CA
action

[Action] Adicione Novas Moedas No Seu Otserv! (8.5)

Por caramelosoares, 28 de nov. de 2009 em Actions e Talkactions

script
otserv
6
2.7k
28 de novembro de 2009 às 01:16

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!

Editado Novembro 28 por DouglasSoares

28 de novembro de 2009 às 01:26

UP UP UP UP UP UP UP UP UP UP GOOD GOOD GOOD FUNFOU LEGAL!!!

 

 

RULEZZZ!!

APROVADO :great:

 

 

mundotibia.servergame.com .::8.52::50x::24hrs::.

Editado Novembro 28 por GOD Psico Master

rod_doidimR
28 de novembro de 2009 às 15:54

rsrsrsrs!

legal legal !!!

isso é velho pakas .. mais é legal ^^.

Parabens só esqueceu de formatar para ficar mais visivel o post.

 

Bom. Obrigado

rockstar96R
28 de novembro de 2009 às 16:09

se usasse tabelas diminuía mais de 70% das linhas

gkaonicx72G
28 de novembro de 2009 às 16:47

Opa obrigado. Por enquanto esta funcionando vou ver se achar bugs aviso. Obrigado por trazer novo conteúdo ao Xtibia, continue assim.

Até mais.

28 de novembro de 2009 às 17:34

Tenho uma dúvida pessoal, eu fiz isso só que nao da pra usar em npcs comuns, veja aqui o post completo:

http://www.xtibia.com/forum/actionqualquer...oe-t124097.html

 

Obrigado!