ah acho que posso ti ajudar
[Resolvido] Go/back, Valendo +Rep [Ajuda]
Por Flaah, 13 de abr. de 2012 em Scripts
info
Grupo: Infante
Registrado: 27/07/09
Posts: 1.5k
Reputação: +405
Char no Tibia: Gean Riot

info
Grupo: Campones
Registrado: 11/04/12
Posts: 13
Reputação: 0

function onUse(cid, item, fromPosition, itemEx, toPosition)
function getPokemonMaxLife(name)
local file = io.open('data/monster/monsters.xml','r')
local arquivo = file:read(-1):lower():match('')
file:close()
local data = io.open('data/monster/'..(arquivo or ''),'r')
if not data then
return 100
end
local maximo = data:read(-1):match('max%s*=%s*"(%d+)"')
data:close()
return maximo
end
----- Config -----
local MaximoSummon = 1
local nome1 = getItemName(item.uid)
local nome = nome1:match('(.-) Pokeball')
local summons = getCreatureSummons(cid)
local action_id = getItemAttribute(item.uid, "aid")
------ Config -----
local summons = getCreatureSummons(cid)
if item.uid ~= getPlayerSlotItem(cid, CONST_SLOT_AMMO).uid then
doPlayerSendCancel(cid, "Coloque no slot certo!.")
return TRUE
end
if getTilePzInfo(getCreaturePosition(cid)) then
return doPlayerSendCancel(cid, "You can't use pokeball in Protection Zones.")
end
if getItemAttribute(item.uid,"level") >= getPlayerLevel(cid) then
doPlayerSendCancel(cid, "You dont have level to use.")
return TRUE
end
if(table.maxn(summons) < MaximoSummon) then -- no summons
creature = doSummonCreature(nome, getCreaturePosition(cid))
doConvinceCreature(cid, creature)
local hp = getCreatureHealth(getCreatureSummons(cid)[1])
doItemSetAttribute(item.uid, "aid", hp)
doPlayerSay(cid, "Go,"..nome.."", TALKTYPE_SAY)
registerCreatureEvent(cid, "PlayerPokeDeath")
registerCreatureEvent(creature, "DiePoke")
doSendMagicEffect(getCreaturePosition(creature), 188)
doTransformItem(getPlayerSlotItem(cid,8).uid, 2532, 1)
doItemSetAttribute(item.uid,"name",""..nome.." Pokeball")
if action_id ~= 0 then
doCreatureAddHealth(creature, -(tonumber(getPokemonMaxLife(nome) - action_id)))
else
doCreatureAddHealth(creature, getPokemonMaxLife(nome))
end
else
for _, pid in ipairs(summons) do
if (table.maxn(summons) >= 1) then
doItemSetAttribute(item.uid, "aid", getCreatureHealth(summons[1]))
doSendMagicEffect(getCreaturePosition(creature), 188)
doPlayerSay(cid, "Back,"..nome.."", TALKTYPE_SAY)
doRemoveCreature(pid)
doTransformItem(item.uid, 2532, 1)
doItemSetAttribute(item.uid,"name", nome .." Pokeball")
end
end
end
return true
end
acho que agora n da mais o erro, OBS eu n testei caso n funcione avise no tópico
info
Grupo: Barão
Registrado: 26/12/11
Posts: 201
Reputação: +18
Char no Tibia: Flaah

ForeverTobi deu quase certo, só que esta dando o seguintes ERROS:
[15/04/2012 15:30:18] [Error - Action Interface]
[15/04/2012 15:30:18] data/actions/scripts/goback.lua:onUse
[15/04/2012 15:30:18] Description:
[15/04/2012 15:30:18] (luaDoTransformItem) Item not found
[15/04/2012 15:30:18] [Error - CreatureScript Interface]
[15/04/2012 15:30:18] data/creaturescripts/scripts/goback.lua:onDeath
[15/04/2012 15:30:18] Description:
[15/04/2012 15:30:18] (luaDoTransformItem) Item not found
OBS: Além desses ERROS, quando chamo o pokémon depois de 2 segundos ele morre, mais da pra chama de novo, mais morre denovo, ai fica nessa vai e vem.
AJUDA? Porfavor? ![]()
info
Grupo: Infante
Registrado: 04/03/11
Posts: 1.6k
Reputação: +393
Char no Tibia: No Have

eu vi o script nao achei nenhum erro grava
passe seu creaturevents goback ai agente olha certinho.





info
Grupo: Barão
Registrado: 26/12/11
Posts: 201
Reputação: +18
Char no Tibia: Flaah
Ola amigos do XTIBIA tenho um grande problema que esta acontecendo no meu server, que seria:
O ERRO que de um sistema de Go/Back de um Pokemon Tibia que eu achei.
Este é o unico erro que esta no meu server, porfavor amigos me ajuda ae, VALENDO +REP!
Erro quando coloco pra FORA da pokebola o pokémon.
[13/04/2012 13:59:18] [Error - Action Interface]
[13/04/2012 13:59:18] data/actions/scripts/goback.lua:onUse
[13/04/2012 13:59:18] Description:
[13/04/2012 13:59:18] (luaDoItemSetAttribute) Item not found
[13/04/2012 13:59:18] [Error - Action Interface]
[13/04/2012 13:59:18] data/actions/scripts/goback.lua:onUse
[13/04/2012 13:59:18] Description:
[13/04/2012 13:59:18] (luaDoTransformItem) Item not found
[13/04/2012 13:59:18] [Error - Action Interface]
[13/04/2012 13:59:18] data/actions/scripts/goback.lua:onUse
[13/04/2012 13:59:18] Description:
[13/04/2012 13:59:18] (luaDoItemSetAttribute) Item not found
Erro quando coloco pra DENTRO da pokebola o pokémon.
[13/04/2012 13:59:18] [Error - Action Interface]
[13/04/2012 13:59:18] data/actions/scripts/goback.lua:onUse
[13/04/2012 13:59:18] Description:
[13/04/2012 13:59:18] (luaDoItemSetAttribute) Item not found
[13/04/2012 13:59:30] [Error - Action Interface]
[13/04/2012 13:59:30] data/actions/scripts/goback.lua:onUse
[13/04/2012 13:59:30] Description:
[13/04/2012 13:59:30] (luaDoTransformItem) Item not found
[13/04/2012 13:59:30] [Error - Action Interface]
[13/04/2012 13:59:30] data/actions/scripts/goback.lua:onUse
[13/04/2012 13:59:30] Description:
[13/04/2012 13:59:30] (luaDoItemSetAttribute) Item not found
Arquivo: GoBack.lua
function onUse(cid, item, fromPosition, itemEx, toPosition) function getPokemonMaxLife(name) local file = io.open('data/monster/monsters.xml','r') local arquivo = file:read(-1):lower():match('') file:close() local data = io.open('data/monster/'..(arquivo or ''),'r') if not data then return 100 end local maximo = data:read(-1):match('max%s*=%s*"(%d+)"') data:close() return maximo end ----- Config ----- local MaximoSummon = 1 local nome1 = getItemName(item.uid) local nome = nome1:match('(.-) Pokeball') local summons = getCreatureSummons(cid) local action_id = getItemAttribute(item.uid, "aid") ------ Config ----- local summons = getCreatureSummons(cid) if item.uid ~= getPlayerSlotItem(cid, CONST_SLOT_AMMO).uid then doPlayerSendCancel(cid, "Coloque no slot certo!.") return TRUE end if getTilePzInfo(getCreaturePosition(cid)) then return doPlayerSendCancel(cid, "You can't use pokeball in Protection Zones.") end if getItemAttribute(item.uid,"level") >= getPlayerLevel(cid) then doPlayerSendCancel(cid, "You dont have level to use.") return TRUE end if(table.maxn(summons) < MaximoSummon) then -- no summons creature = doSummonCreature(nome, getCreaturePosition(cid)) doConvinceCreature(cid, creature) local hp = getCreatureHealth(getCreatureSummons(cid)[1]) doItemSetAttribute(getPlayerSlotItem(cid,8).uid, "aid", hp) doPlayerSay(cid, "Go,"..nome.."", TALKTYPE_SAY) registerCreatureEvent(cid, "PlayerPokeDeath") registerCreatureEvent(creature, "DiePoke") doSendMagicEffect(getCreaturePosition(creature), 188) doTransformItem(getPlayerSlotItem(cid,8).uid, 2532, 1) doItemSetAttribute(getPlayerSlotItem(cid,8).uid,"name",""..nome.." Pokeball") if action_id ~= 0 then doCreatureAddHealth(creature, -(tonumber(getPokemonMaxLife(nome) - action_id))) else doCreatureAddHealth(creature, getPokemonMaxLife(nome)) end else for _, pid in ipairs(summons) do if (table.maxn(summons) >= 1) then doItemSetAttribute(item.uid, "aid", getCreatureHealth(summons[1])) doSendMagicEffect(getCreaturePosition(creature), 188) doPlayerSay(cid, "Back,"..nome.."", TALKTYPE_SAY) doRemoveCreature(pid) doTransformItem(getPlayerSlotItem(cid,8).uid, 2532, 1) doItemSetAttribute(getPlayerSlotItem(cid,8).uid,"name", nome .." Pokeball") end end end return true endValendo +REP
Poxa galera, preciso muuuuuito da ajuda de vcs
AJUDA ALGUEM AI, PORFAVOR
VALENDO +REP
Editado Abril 14 por Flaah