<item id="2157" article="a" name="gold nugget" plural="gold nuggets">
<attribute key="weight" value="10" />
</item>
<item id="2157" article="a" name="gold nugget" plural="gold nuggets">
<attribute key="weight" value="10" />
<attribute key="worth" value="1000000" />
</item>
--Configurations
local ITEM_NUGGET = 2157 -- Nugget ID
--End of Configs
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == ITEM_GOLD_COIN and item.type == ITEMCOUNT_MAX then --Gold Coin to Platinum Coin
doChangeTypeItem(item.uid, item.type - item.type)
doPlayerAddItem(cid, ITEM_PLATINUM_COIN, 1)
doSendAnimatedText(fromPosition, "Platinum", TEXTCOLOR_LIGHTBLUE)
elseif item.itemid == ITEM_PLATINUM_COIN and item.type == ITEMCOUNT_MAX then --Platinum Coin to Crystal Coin
doChangeTypeItem(item.uid, item.type - item.type)
doPlayerAddItem(cid, ITEM_CRYSTAL_COIN, 1)
doSendAnimatedText(fromPosition, "Crystal!", TEXTCOLOR_TEAL)
elseif item.itemid == ITEM_PLATINUM_COIN and item.type < ITEMCOUNT_MAX then --Platinum Coin to Gold Coin
doChangeTypeItem(item.uid, item.type - 1)
doPlayerAddItem(cid, ITEM_GOLD_COIN, ITEMCOUNT_MAX)
doSendAnimatedText(fromPosition, "Gold", TEXTCOLOR_YELLOW)
elseif item.itemid == ITEM_CRYSTAL_COIN and item.type < ITEMCOUNT_MAX then --Crystal Coin to Platinum Coin
doChangeTypeItem(item.uid, item.type - 1)
doPlayerAddItem(cid, ITEM_PLATINUM_COIN, ITEMCOUNT_MAX)
doSendAnimatedText(fromPosition, "Platinum", TEXTCOLOR_LIGHTBLUE)
elseif item.itemid == ITEM_CRYSTAL_COIN and item.type == ITEMCOUNT_MAX then --Crystal Coin to Nugget
doChangeTypeItem(item.uid, item.type - item.type)
doPlayerAddItem(cid, ITEM_NUGGET,1)
doSendAnimatedText(fromPosition, "Nugget", TEXTCOLOR_YELLOW)
else
return FALSE
end
return TRUE
end
--Configurations
local ITEM_NUGGET = 2157 -- Nugget ID
--End of Configs
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == ITEM_NUGGET then --Nugget to Crystal Coin
doChangeTypeItem(item.uid, item.type - 1)
doPlayerAddItem(cid, ITEM_CRYSTAL_COIN, ITEMCOUNT_MAX)
doSendAnimatedText(fromPosition, "Crystal", TEXTCOLOR_TEAL)
else
return FALSE
end
return TRUE
end
<action itemid="2157" script="other/changenugget.lua"/>
I used that script too. But when you want to buy items from NPC with nuggets it will not accept it.. lol ;9 i changed in source it failed XD
when i repYou must spread some Reputation around before giving it to mhamad again.
<action itemid="2148" event="script" value="other/changegold.lua"/>
<action itemid="2152" event="script" value="other/changegold.lua"/>
<action itemid="2160" event="script" value="other/changegold.lua"/>
<action itemid="9971" event="script" value="other/changegold.lua"/>
<action itemid="2157" event="script" value="other/changegold.lua"/>
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 = 9971, effect = TEXTCOLOR_TEAL
},
[9971] = {
from = ITEM_CRYSTAL_COIN, to = 2157, effect = TEXTCOLOR_TEAL
},
[2157] = {
from = 9971 , effect = TEXTCOLOR_TEAL
}
}
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
Could you help me? I have a banker npc how can i add so he accepts gold nuggets to?Yes, you can also just test it.
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Banker" script="data/npc/scripts/bank.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="132" head="97" body="21" legs="76" feet="19" addons="3" corpse="2212"/>
<parameters>
<parameter key="message_greet" value="Welcome |PLAYERNAME|. What can I do for you? {Deposit}, {withdraw}, check {balance} or {transfer}? I can also {change} gold for you." />
</parameters>
</npc>
<attribute key="worth" value="1000000" />
Thanks limos^^Add attribute worth to items.xml.
Code:<attribute key="worth" value="1000000" />
This happend after one restartAdd attribute worth to items.xml.
Code:<attribute key="worth" value="1000000" />