• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved Give value to new item

darksta

New Member
Joined
Feb 10, 2010
Messages
39
Reaction score
0
my new items (gold ingot id 9971) created by transforming 100 diamond is worthless on my server
having the new item in my backpack and I want to buy with tells me I have no money
ise and all that good
if I'm missing something but please tell me: C


items.xml
Code:
item id="9971" article="a" name="gold ingot">
        <attribute key="weight" value="10" />
        <attribute key="worth" value="1000000" />

data/lib/000-constant
Code:
ITEM_GOLD_COIN = 2148
ITEM_PLATINUM_COIN = 2152
ITEM_CRYSTAL_COIN = 2160
ITEM_GOLD_INGOT = 9971

Action.xml
Code:
<action itemid="2148" script="changegold.lua" />
<action itemid="2152" script="changegold.lua" />
<action itemid="2160" script="changegold.lua" />
<action itemid="9971" script="changegold.lua" />

Scritps
Code:
local ITEM_GOLD_INGOT = 9971
local coins = {
[ITEM_GOLD_COIN] = {
to = ITEM_PLATINUM_COIN, effect = TEXTCOLOR_YELLOW
},
[ITEM_PLATINUM_COIN] = {
from = ITEM_GOLD_COIN, to = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_LIGHTBLUE
},
[ITEM_CRYSTAL_COIN] = {
from = ITEM_PLATINUM_COIN, to = ITEM_GOLD_INGOT, effect = TEXTCOLOR_TEAL
},
[ITEM_GOLD_INGOT] = {
from = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_ORANGE
}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
  if(getPlayerFlagValue(cid, PLAYERFLAG_CANNOTPICKUPITEM)) then
      return false
  end
  local coin = coins[item.itemid]
  if(not coin) then
      return false
  end
  if(coin.to ~= nil and item.type == ITEMCOUNT_MAX) then
      doChangeTypeItem(item.uid, item.type - item.type)
      doPlayerAddItem(cid, coin.to, 1)
      doSendAnimatedText(fromPosition, "$$$", coins[coin.to].effect)
  elseif(coin.from ~= nil) then
      doChangeTypeItem(item.uid, item.type - 1)
      doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX)
      doSendAnimatedText(fromPosition, "$$$", coins[coin.from].effect)
  end
  return true
end

Version OT 8.60
-purchases are made by ACTION ID and not by NPC
if I pass some way please tell me, I hope help thanks
 
You dont have to use separate actions, you can do it all in one like this
Code:
<action itemid="2148;2152;2160;9971" event="script" value="changegold.lua"/>
 
Back
Top