zipter98 1101 Posted November 20, 2013 Report Share Posted November 20, 2013 (edited) Sobre voltar pra ball, foi intencional colocar isso, pra evitar que o pokémon ficasse fora da ball, e consequentemente bugasse os status. Vou dar uma olhada sobre os status (acho que já sei o que é) e sobre o Eevee. edit: sobre o eevee, já corrigi. Era burrada de minha parte; já sobre os status, só falta eu confirmar uma coisa. edit denovo: Tenta assim: function evolving_pokemon(cid, mypoke, theevo) if not isCreature(cid) then return true end if not pokes[theevo] or not pokes[theevo].offense then doReturnPokemon(cid, mypoke, getPlayerSlotItem(cid, 8), pokeballs[getPokeballType(getPlayerSlotItem(cid, 8).itemid)].effect, false, true) return true end local pokeball = getPlayerSlotItem(cid, 8) local description = "Contains a "..theevo.."." local pct = getCreatureHealth(mypoke) / getCreatureMaxHealth(mypoke) doItemSetAttribute(pokeball.uid, "hp", pct) doItemSetAttribute(pokeball.uid, "poke", theevo) doItemSetAttribute(pokeball.uid, "description", "Contains a "..theevo..".") doPlayerSendTextMessage(cid, 27, "Seu "..getPokeName(mypoke).." evoluiu para "..theevo.."!") doSendMagicEffect(getThingPos(mypoke), 18) doTransformItem(getPlayerSlotItem(cid, 7).uid, fotos[theevo]) doSendMagicEffect(getThingPos(cid), 173) local oldpos = getThingPos(mypoke) local oldlod = getCreatureLookDir(mypoke) local oldlvl = getPokemonLevel(mypoke) doRemoveCreature(mypoke) doSummonMonster(cid, theevo) local pk = getCreatureSummons(cid)[1] doTeleportThing(pk, oldpos, false) doCreatureSetLookDir(pk, oldlod) sendFinishEvolutionEffect(pk, true) addEvent(sendFinishEvolutionEffect, 550, pk, true) addEvent(sendFinishEvolutionEffect, 1050, pk) doAddPokemonInOwnList(cid, theevo) local status = getPokemonStatus(getCreatureName(pk)) local off = status.off local def = status.def local agi = status.agi local spatk = status.spatk local vit = status.vit doItemSetAttribute(pokeball.uid, "offense", off) doItemSetAttribute(pokeball.uid, "defense", def) doItemSetAttribute(pokeball.uid, "speed", agi) doItemSetAttribute(pokeball.uid, "specialattack", spatk) doItemSetAttribute(pokeball.uid, "vitality", vit) local happy = getItemAttribute(pokeball.uid, "happy") doItemSetAttribute(pokeball.uid, "happy", happy + happyGainedOnEvolution) if happy + happyGainedOnEvolution > 255 then doItemSetAttribute(pokeball.uid, "happy", 255) end adjustStatus(mypoke, pokeball.uid, true, false) doReturnPokemon(cid, getCreatureSummons(cid)[1], getPlayerSlotItem(cid, 8), pokeballs[getPokeballType(getPlayerSlotItem(cid, 8).itemid)].effect) if useKpdoDlls then doUpdateMoves(cid) end end function onSay(cid, words, param, channel) local pokes_evolve = { --["Nome do poke"] = {level = level necessário para evoluir, to = "Nome da evolução"}, ["Charmander"] = {level = 16, to = "Charmeleon"}, ["Charmeleon"] = {level = 36, to = "Charizard"}, ["Squirtle"] = {level = 16, to = "Wartortle"}, ["Wartortle"] = {level = 36, to = "Blastoise"}, ["Bulbasaur"] = {level = 16, to = "Ivysaur"}, ["Ivysaur"] = {level = 36, to = "Venusaur"}, } local t = { --["elemento"] = {words = "o que deverá ser dito pelo player (sem o !)"}, ["grass"] = {words = "leaf"}, ["fire"] = {words = "fire"}, ["water"] = {words = "water"}, ["bug"] = {words = "cocoon"}, ["normal"] = {words = "heart"}, } local evolvess = { --["o que deverá ser dito pelo player (dessa vez, com !)"] = {level = level necessário para evoluir, poke = "evolução"}, OBS: Essa tabela é própria para o Eeevee. ["!fire"] = {level = 20, poke = "Flareon"}, ["!water"] = {level = 20, poke = "Vaporeon"}, ["!thunder"] = {level = 20, poke = "Jolteon"}, ["!darkness"] = {level = 20, poke = "Umbreon"}, ["!enigma"] = {level = 20, poke = "Espeon"}, } if #getCreatureSummons(cid) == 0 then return doPlayerSendCancel(cid, "Você precisa de um pokémon para evoluir.") end if getPlayerStorageValue(cid, 412001) > os.time () then return doPlayerSendCancel(cid, "Aguarde "..getPlayerStorageValue(cid, 412001) - os.time ().." segundo(s) para evoluir um pokémon novamente.") end local mypoke = getCreatureSummons(cid)[1] if not pokes_evolve[getCreatureName(mypoke)] and getCreatureName(mypoke) ~= "Eevee" then return doPlayerSendCancel(cid, "Esse pokémon não possui evolução.") end if isCreature(mypoke) then elemento = pokes[getCreatureName(mypoke)].type pokemon = pokes_evolve[getCreatureName(mypoke)] end local next_evo = pokemon.to if mypoke == "Eevee" then --Só fiz uma special evo, faça as outras seguindo como base a do Eevee. if not isCreature(mypoke) then return true end evos = evolvess[words].poke evos_lv = evolvess[words].level if (words == ""..evolvess[words].."") then if getPokemonLevel(mypoke) >= evos_lv then evolving_pokemon(cid, mypoke, evos) setPlayerStorageValue(cid, 412001, os.time () + 600) else return doPlayerSendCancel(cid, "Seu pokémon não possui o level necessário para evoluir!") end end end if (words == "!"..t[elemento].words.."") then if getPokemonLevel(mypoke) >= pokemon.level then evolving_pokemon(cid, mypoke, next_evo) setPlayerStorageValue(cid, 412001, os.time () + 600) else return doPlayerSendCancel(cid, "Seu pokémon não possui o level necessário para evoluir!") end end return true end Edited November 20, 2013 by zipter98 Link to comment https://xtibia.com/forum/topic/224123-encerrado-transformar-stones-em-talkactions/page/2/#findComment-1584095 Share on other sites More sharing options...
otavio101 15 Posted November 21, 2013 Author Report Share Posted November 21, 2013 Não tem jeito dele continuar fora da pokeball não? A deu erro no eevee: [21/11/2013 17:34:39] [Error - TalkAction Interface][21/11/2013 17:34:39] data/talkactions/scripts/evolvetalk.lua:onSay[21/11/2013 17:34:39] Description:[21/11/2013 17:34:39] data/talkactions/scripts/evolvetalk.lua:118: attempt to index global 'pokemon' (a nil value)[21/11/2013 17:34:39] stack traceback:[21/11/2013 17:34:39] data/talkactions/scripts/evolvetalk.lua:118: in function Link to comment https://xtibia.com/forum/topic/224123-encerrado-transformar-stones-em-talkactions/page/2/#findComment-1584469 Share on other sites More sharing options...
zipter98 1101 Posted November 21, 2013 Report Share Posted November 21, 2013 (edited) Ter jeito, tem sim. Mas com aquele bug que você mencionou, não acho muito recomendável. Vou só editar umas coisinhas no script aqui, e já edito. Ah, se você quiser mesmo que o pokémon não retorne para a pokeball, avisa aqui, que eu retiro essa parte. edit: Só do Eevee que está dando este bug? function evolving_pokemon(cid, mypoke, theevo) if not isCreature(cid) then return true end if not pokes[theevo] or not pokes[theevo].offense then doReturnPokemon(cid, mypoke, getPlayerSlotItem(cid, 8), pokeballs[getPokeballType(getPlayerSlotItem(cid, 8).itemid)].effect, false, true) return true end local pokeball = getPlayerSlotItem(cid, 8) local description = "Contains a "..theevo.."." local pct = getCreatureHealth(mypoke) / getCreatureMaxHealth(mypoke) doItemSetAttribute(pokeball.uid, "hp", pct) doItemSetAttribute(pokeball.uid, "poke", theevo) doItemSetAttribute(pokeball.uid, "description", "Contains a "..theevo..".") doPlayerSendTextMessage(cid, 27, "Seu "..getPokeName(mypoke).." evoluiu para "..theevo.."!") doSendMagicEffect(getThingPos(mypoke), 18) doTransformItem(getPlayerSlotItem(cid, 7).uid, fotos[theevo]) doSendMagicEffect(getThingPos(cid), 173) local oldpos = getThingPos(mypoke) local oldlod = getCreatureLookDir(mypoke) local oldlvl = getPokemonLevel(mypoke) doRemoveCreature(mypoke) doSummonMonster(cid, theevo) local pk = getCreatureSummons(cid)[1] doTeleportThing(pk, oldpos, false) doCreatureSetLookDir(pk, oldlod) sendFinishEvolutionEffect(pk, true) addEvent(sendFinishEvolutionEffect, 550, pk, true) addEvent(sendFinishEvolutionEffect, 1050, pk) doAddPokemonInOwnList(cid, theevo) local status = getPokemonStatus(getCreatureName(pk)) local off = status.off local def = status.def local agi = status.agi local spatk = status.spatk local vit = status.vit doItemSetAttribute(pokeball.uid, "offense", off) doItemSetAttribute(pokeball.uid, "defense", def) doItemSetAttribute(pokeball.uid, "speed", agi) doItemSetAttribute(pokeball.uid, "specialattack", spatk) doItemSetAttribute(pokeball.uid, "vitality", vit) local happy = getItemAttribute(pokeball.uid, "happy") doItemSetAttribute(pokeball.uid, "happy", happy + happyGainedOnEvolution) if happy + happyGainedOnEvolution > 255 then doItemSetAttribute(pokeball.uid, "happy", 255) end adjustStatus(mypoke, pokeball.uid, true, false) doReturnPokemon(cid, getCreatureSummons(cid)[1], getPlayerSlotItem(cid, 8), pokeballs[getPokeballType(getPlayerSlotItem(cid, 8).itemid)].effect) if useKpdoDlls then doUpdateMoves(cid) end end function onSay(cid, words, param, channel) local pokes_evolve = { --["Nome do poke"] = {level = level necessário para evoluir, to = "Nome da evolução"}, ["Charmander"] = {level = 16, to = "Charmeleon"}, ["Charmeleon"] = {level = 36, to = "Charizard"}, ["Squirtle"] = {level = 16, to = "Wartortle"}, ["Wartortle"] = {level = 36, to = "Blastoise"}, ["Bulbasaur"] = {level = 16, to = "Ivysaur"}, ["Ivysaur"] = {level = 36, to = "Venusaur"}, } local t = { --["elemento"] = {words = "o que deverá ser dito pelo player (sem o !)"}, ["grass"] = {words = "leaf"}, ["fire"] = {words = "fire"}, ["water"] = {words = "water"}, ["bug"] = {words = "cocoon"}, ["normal"] = {words = "heart"}, } local evolvess = { --["o que deverá ser dito pelo player (dessa vez, com !)"] = {level = level necessário para evoluir, poke = "evolução"}, OBS: Essa tabela é própria para o Eeevee. ["!fire"] = {level = 20, poke = "Flareon"}, ["!water"] = {level = 20, poke = "Vaporeon"}, ["!thunder"] = {level = 20, poke = "Jolteon"}, ["!darkness"] = {level = 20, poke = "Umbreon"}, ["!enigma"] = {level = 20, poke = "Espeon"}, } if #getCreatureSummons(cid) < 1 then return doPlayerSendCancel(cid, "Você precisa de um pokémon para evoluir.") end if getPlayerStorageValue(cid, 412001) > os.time () then return doPlayerSendCancel(cid, "Aguarde "..getPlayerStorageValue(cid, 412001) - os.time ().." segundo(s) para evoluir um pokémon novamente.") end local mypoke = getCreatureSummons(cid)[1] if not pokes_evolve[getCreatureName(mypoke)] and getCreatureName(mypoke) ~= "Eevee" then return doPlayerSendCancel(cid, "Esse pokémon não possui evolução.") end if not isCreature(mypoke) then return true end local elemento = pokes[getCreatureName(mypoke)].type local pokemon = pokes_evolve[getCreatureName(mypoke)] local next_evo = pokemon.to if mypoke == "Eevee" then --Só fiz uma special evo, faça as outras seguindo como base a do Eevee. local evos = evolvess[words].poke local evos_lv = evolvess[words].level if (words == ""..evolvess[words].."") then if getPokemonLevel(mypoke) >= evos_lv then evolving_pokemon(cid, mypoke, evos) setPlayerStorageValue(cid, 412001, os.time () + 600) else return doPlayerSendCancel(cid, "Seu pokémon não possui o level necessário para evoluir!") end end end if (words == "!"..t[elemento].words.."") then if getPokemonLevel(mypoke) >= pokemon.level then evolving_pokemon(cid, mypoke, next_evo) setPlayerStorageValue(cid, 412001, os.time () + 600) else return doPlayerSendCancel(cid, "Seu pokémon não possui o level necessário para evoluir!") end end return true end Edited November 21, 2013 by zipter98 Link to comment https://xtibia.com/forum/topic/224123-encerrado-transformar-stones-em-talkactions/page/2/#findComment-1584477 Share on other sites More sharing options...
otavio101 15 Posted November 21, 2013 Author Report Share Posted November 21, 2013 Sim só o eevee, o charmander e o resto tão ok, continua sem dar. [21/11/2013 18:29:50] [Error - TalkAction Interface][21/11/2013 18:29:50] data/talkactions/scripts/evolvetalk.lua:onSay[21/11/2013 18:29:50] Description:[21/11/2013 18:29:50] data/talkactions/scripts/evolvetalk.lua:117: attempt to index local 'pokemon' (a nil value)[21/11/2013 18:29:50] stack traceback:[21/11/2013 18:29:50] data/talkactions/scripts/evolvetalk.lua:117: in function Link to comment https://xtibia.com/forum/topic/224123-encerrado-transformar-stones-em-talkactions/page/2/#findComment-1584486 Share on other sites More sharing options...
Gabrieltxu 737 Posted November 28, 2013 Report Share Posted November 28, 2013 Tópico movido para a seção de dúvidas e pedidos resolvidos. Link to comment https://xtibia.com/forum/topic/224123-encerrado-transformar-stones-em-talkactions/page/2/#findComment-1586522 Share on other sites More sharing options...
Stigal 584 Posted April 21, 2018 Report Share Posted April 21, 2018 A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta. + Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda. * Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado. Link to comment https://xtibia.com/forum/topic/224123-encerrado-transformar-stones-em-talkactions/page/2/#findComment-1735794 Share on other sites More sharing options...
Recommended Posts