Olá pessoal, esse é o meu primeiro tutorial aqui no fórum, vou ensinar como trocar moedas, exemplo, quando se tem 100 golds e vc usa ele, ele vira 1 platinum, de 100 platinum vai pra 1 crystal.... o que vou ensinar eh como transformar 100 crystal em 1 scarab e 100 scarab em 1 gold ingot...
Primeiro abra o arquivo data/actions/actions.xml e procure pelo id 2148, após encontrar vc verá as seguintes linhas depois dele:
<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"/>
altere isso para:
<action itemid="2148" event="script" value="other/changegold.lua"/>
<action itemid="2152" event="script" value="other/changegold.lua"/>
<action itemid="2159" event="script" value="other/changegold.lua"/>
<action itemid="2160" event="script" value="other/changegold.lua"/>
<action itemid="9971" event="script" value="other/changegold.lua"/>
sendo o itemid 2159 o scarab coin e o 9971 o gold ingot.
agora faça um backup do arquivo /data/actions/scripts/other/changegold.lua e depois abra-o, apague tudo dentro dele e cole isso:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == ITEM_GOLD_COIN and item.type == ITEMCOUNT_MAX then
doChangeTypeItem(item.uid, item.type - item.type)
doPlayerAddItem(cid, ITEM_PLATINUM_COIN, 1)
doSendAnimatedText(fromPosition, "R$", TEXTCOLOR_PLATINUMBLUE)
elseif item.itemid == ITEM_PLATINUM_COIN and item.type == ITEMCOUNT_MAX then
doChangeTypeItem(item.uid, item.type - item.type)
doPlayerAddItem(cid, ITEM_CRYSTAL_COIN, 1)
doSendAnimatedText(fromPosition, "R$", TEXTCOLOR_TEAL)
elseif item.itemid == ITEM_PLATINUM_COIN and item.type < ITEMCOUNT_MAX then
doChangeTypeItem(item.uid, item.type - 1)
doPlayerAddItem(cid, ITEM_GOLD_COIN, ITEMCOUNT_MAX)
doSendAnimatedText(fromPosition, "R$", TEXTCOLOR_YELLOW)
elseif item.itemid == ITEM_CRYSTAL_COIN and item.type == ITEMCOUNT_MAX then
doChangeTypeItem(item.uid, item.type - item.type)
doPlayerAddItem(cid, 2159, 1)
doSendAnimatedText(fromPosition, "R$", TEXTCOLOR_TEAL)
elseif item.itemid == ITEM_CRYSTAL_COIN and item.type < ITEMCOUNT_MAX then
doChangeTypeItem(item.uid, item.type - 1)
doPlayerAddItem(cid, ITEM_PLATINUM_COIN, ITEMCOUNT_MAX)
doSendAnimatedText(fromPosition, "R$", TEXTCOLOR_YELLOW)
elseif item.itemid == 2159 and item.type == ITEMCOUNT_MAX then
doChangeTypeItem(item.uid, item.type - item.type)
doPlayerAddItem(cid, 9971, 1)
doSendAnimatedText(fromPosition, "R$", TEXTCOLOR_TEAL)
elseif item.itemid == 2159 and item.type < ITEMCOUNT_MAX then
doChangeTypeItem(item.uid, item.type - 1)
doPlayerAddItem(cid, ITEM_CRYSTAL_COIN, ITEMCOUNT_MAX)
doSendAnimatedText(fromPosition, "R$", TEXTCOLOR_RED)
elseif item.itemid == 9971 and item.type < ITEMCOUNT_MAX then
doChangeTypeItem(item.uid, item.type - 1)
doPlayerAddItem(cid, 2159, ITEMCOUNT_MAX)
doSendAnimatedText(fromPosition, "R$", TEXTCOLOR_GREEN)
else
return FALSE
end
return TRUE
end
agora vc recarrega as actions ou reinicia seu servidor.....
seja feliz...
Abraços!