Postado Julho 6, 2015 9 anos Olá... Gostaria da ajuda de vocês... Baixei um OTserv 0.6.4 versão 8.6 bem limpo... Estou tentando adicionar o sistema de change gold nele mas, por algum motivo, não funciona. As alterações foram: actions.xml <!-- Change gold --> <action itemid="2148" event="script" value="changegold.lua"/> <action itemid="2152" event="script" value="changegold.lua"/> <action itemid="2160" event="script" value="changegold.lua"/> changegold.lua function onUse(cid, item, fromPosition, itemEx, toPosition) if item.itemid == 2148 and item.type == 100 then doChangeTypeItem(item.uid, item.type - item.type) doPlayerAddItem(cid, 2152, 1) doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_LIGHTBLUE) elseif item.itemid == 2152 and item.type == 100 then doChangeTypeItem(item.uid, item.type - item.type) doPlayerAddItem(cid, 2160, 1) doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_TEAL) elseif item.itemid == 2152 and item.type < 100 then doChangeTypeItem(item.uid, item.type - 1) doPlayerAddItem(cid, 2148, 100) doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_YELLOW) elseif item.itemid == 2160 then doChangeTypeItem(item.uid, item.type - 1) doPlayerAddItem(cid, 2152, 100) doSendAnimatedText(fromPosition, "$$$", TEXTCOLOR_LIGHTBLUE) else return false end return true end Já conferi o items.xml e tá tudo ok lá... já até reiniciei o server imaginando que o reload pudesse estar com problema, mas não funcionou. Estou esquecendo algo? Valeu!!
Postado Julho 7, 2015 9 anos tenta assim em actions.xml coloca <action itemid="2148;2152;2160" event="script" value="changegold.lua"/> 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, 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 Editado Julho 7, 2015 9 anos por loreal (veja o histórico de edições)
Postado Julho 7, 2015 9 anos Autor Em 07/07/2015 em 00:13, moviebr disse: Tem algum código que é para ser adicionado nos movements? Não, nada no movements... loreal, o script que você mandou é exatamente igual ao meu, com uma diferença que usa constantes como ITEM_GOLD_COIN que nem estão declaradas nessa versão que eu uso... O problema aqui é algo mais complicado... O otserv ignora o action, como se não houve nenhum script de action pra esse item...
Postado Julho 7, 2015 9 anos Tente isto Mostrar conteúdo oculto local coins = { [2148] = {to = 2152}, [2152] = {to = 2160, from = 2148}, [2160] = {to = 8777, from = 2152}, [8777] = {from = 2160}, } 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) elseif(coin.from ~= nil) then doChangeTypeItem(item.uid, item.type - 1) doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX) end return true end <action itemid="2148;2152;2160;8777" event="script" value="other/changegold.lua"/> Não se esqueça de colocar no diretório corretamente. Editado Julho 7, 2015 9 anos por Shyrriro (veja o histórico de edições)
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.