OT

[Encerrado] Transformar Stones em Talkactions

Por otavio101, 19 de nov. de 2013 em Tópicos Sem Resposta

pda
com
level
stone
talkaction
evolution
evolução
pokemon
resolvido
21
1.8k
otavio101O
19 de novembro de 2013 às 11:34

Olá, uso PDA com Level, e estou fazendo algumas modificações e queria mudar as stones e transforma-las em talkactions por exemplo,

Fire Stone - !FIRE

Ao dizer !FIRE ele checa se o Charmander está no level 18 e se estiver evolui.

zipter98Z
19 de novembro de 2013 às 16:35

Se um pokémon evoluisse, por exemplo, com leaf stone, o comando seria qual? !grass ou !leaf? E se um pokémon tiver dois elementos, será verificado o elemento primário? Por exemplo, Venusaur é grass/poison. Então, com qual comando seria evoluído o Ivysaur?

Ah, tem alguma informação adicional? Poderá evoluir o pokémon durante batalha?

Editado Novembro 19 por zipter98

otavio101O
19 de novembro de 2013 às 16:45

Pode ser durante a batalha, cara pode usar o nome das stone mesmo isso ai depois eu consigo mudar . Pode colocar pro elemento primario ser prioridade.

 

A cara se conseguir colocar um Delay (Tempo de uso) de 10min eu agradeço também =D

Editado Novembro 19 por otaviogfl

zipter98Z
19 de novembro de 2013 às 18:19

Bom, eu tentei fazer aqui. Não está completo, pois a configuração é bem grande. Sobre as special evolutions, fiz/tentei apenas do Eevee. Para fazer as outras, basta seguir esta como base. Qualquer erro, só postar. Ah, não se esqueça de ir configurando as words na tag, a medida que configura no script.

Enfim, crie um arquivo .lua com o nome evolvetalk,em data/talkactions/scripts, com o conteúdo:

 

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.."!")
setPlayerStorageValue(cid, 412001, os.time () + 600)
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)
doTeleportThing(mypoke, oldpos, false)
doCreatureSetLookDir(mypoke, oldlod)
sendFinishEvolutionEffect(pk, true)
addEvent(sendFinishEvolutionEffect, 550, mypoke, true)
addEvent(sendFinishEvolutionEffect, 1050, mypoke)
doAddPokemonInOwnList(cid, theevo)
local status = getPokemonStatus(getCreatureName(mypoke))
local off = status.off * 7.5
local def = status.def * 7.5
local agi = status.agi * 7.5
local spatk = status.spatk * 7.5
local vit = status.vit * 7
doItemSetAttribute(pokeball.uid, "offense", getItemAttribute(pokeball.uid, "offense") + off)
doItemSetAttribute(pokeball.uid, "defense", getItemAttribute(pokeball.uid, "defense") + def)
doItemSetAttribute(pokeball.uid, "speed", getItemAttribute(pokeball.uid, "speed") + agi)
doItemSetAttribute(pokeball.uid, "specialattack", getItemAttribute(pokeball.uid, "specialattack") + spatk)
doItemSetAttribute(pokeball.uid, "vitality", getItemAttribute(pokeball.uid, "vitality") + vit)
doPlayerSendTextMessage(cid, 27, "Bônus de evolução: • Offense: +"..doMathDecimal(off).." • Defense: +"..doMathDecimal(def).." • Spc. Atk: +"..doMathDecimal(spatk).." • Agility: +"..doMathDecimal(agi).." • Vitality: +"..doMathDecimal(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)
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).." segundo(s) para evoluir um pokémon novamente.")
end
local mypoke = getCreatureSummons(cid)[1]
if not pokes_evolve[getCreatureName(mypoke)] 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)
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)
else
return doPlayerSendCancel(cid, "Seu pokémon não possui o level necessário para evoluir!")
end
end
return true
end

Depois, em data/talkactions, talkactions.xml, adicione a tag:
<talkaction words="!fire;!normal;!leaf;!water;!cocoon" event="script" value="evolvetalk.lua"/>

Editado Novembro 19 por zipter98

otavio101O
19 de novembro de 2013 às 18:51

Vlw cara deu quase tudo certo só apareceu esse erro:

 

 

[19/11/2013 18:45:16] [Error - TalkAction Interface]
[19/11/2013 18:45:16] data/talkactions/scripts/evolvetalk.lua:onSay
[19/11/2013 18:45:16] Description:
[19/11/2013 18:45:16] (luaDoTeleportThing) Thing not found

[19/11/2013 18:45:16] [Error - TalkAction Interface]
[19/11/2013 18:45:16] data/talkactions/scripts/evolvetalk.lua:onSay
[19/11/2013 18:45:16] Description:
[19/11/2013 18:45:16] (luaDoCreatureSetLookDir) Creature not found

[19/11/2013 18:45:16] [Error - TalkAction Interface]
[19/11/2013 18:45:16] data/talkactions/scripts/evolvetalk.lua:onSay
[19/11/2013 18:45:16] Description:
[19/11/2013 18:45:16] (luaGetCreatureName) Creature not found

[19/11/2013 18:45:16] [Error - TalkAction Interface]
[19/11/2013 18:45:16] data/talkactions/scripts/evolvetalk.lua:onSay
[19/11/2013 18:45:16] Description:
[19/11/2013 18:45:16] data/talkactions/scripts/evolvetalk.lua:44: attempt to index local 'status' (a boolean value)
[19/11/2013 18:45:16] stack traceback:
[19/11/2013 18:45:16] data/talkactions/scripts/evolvetalk.lua:44: in function 'evolving_pokemon'
[19/11/2013 18:45:16] data/talkactions/scripts/evolvetalk.lua:135: in function

 

 

 

 

Parece que o tempo para soltar o comando novamente também não diminui.

Editado Novembro 19 por otaviogfl

zipter98Z
19 de novembro de 2013 às 19:12

Tenta:

 

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 * 7.5
local def = status.def * 7.5
local agi = status.agi * 7.5
local spatk = status.spatk * 7.5
local vit = status.vit * 7
doItemSetAttribute(pokeball.uid, "offense", getItemAttribute(pokeball.uid, "offense") + off)
doItemSetAttribute(pokeball.uid, "defense", getItemAttribute(pokeball.uid, "defense") + def)
doItemSetAttribute(pokeball.uid, "speed", getItemAttribute(pokeball.uid, "speed") + agi)
doItemSetAttribute(pokeball.uid, "specialattack", getItemAttribute(pokeball.uid, "specialattack") + spatk)
doItemSetAttribute(pokeball.uid, "vitality", getItemAttribute(pokeball.uid, "vitality") + vit)
doPlayerSendTextMessage(cid, 27, "Bônus de evolução: • Offense: +"..doMathDecimal(off).." • Defense: +"..doMathDecimal(def).." • Spc. Atk: +"..doMathDecimal(spatk).." • Agility: +"..doMathDecimal(agi).." • Vitality: +"..doMathDecimal(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)
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)] 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

Editado Novembro 19 por zipter98

otavio101O
19 de novembro de 2013 às 22:47

Quando evolui o level não aparece, e o tempo continua com problema. Mas não aparece nenhum erro. Se der gostaria que não ganhasse Bônus de evolução nos atributos.

Editado Novembro 19 por otaviogfl

zipter98Z
19 de novembro de 2013 às 23:10

Quando volta o pokémon para a ball, o level aparece? Sobre o tempo, editei o script ali em cima.

otavio101O
19 de novembro de 2013 às 23:13

Sim aparece xD O tempo agora está OK vlw.

Editado Novembro 19 por otaviogfl

zipter98Z
19 de novembro de 2013 às 23:17

Sobre não ganhar os bônus de status, tente 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 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)
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)] 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

Agora, está tudo funcionando sem bugs? Bugs que eu digo, é como, por exemplo, um determinado pokémon não evoluir corretamente; algum erro no console; etc.

Editado Novembro 19 por zipter98

otavio101O
19 de novembro de 2013 às 23:30

Sem erros no console, porém quando evolui você esqueceu de colocar pra pegar os atributos.

Chando chamander vira charmelon ele não pega os atributos do charmander.

zipter98Z
19 de novembro de 2013 às 23:33

Ih, é mesmo ._.

tenta agora:

 

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", getItemAttribute(pokeball.uid, "offense") + off)
doItemSetAttribute(pokeball.uid, "defense", getItemAttribute(pokeball.uid, "defense") + def)
doItemSetAttribute(pokeball.uid, "speed", getItemAttribute(pokeball.uid, "speed") + agi)
doItemSetAttribute(pokeball.uid, "specialattack", getItemAttribute(pokeball.uid, "specialattack") + spatk)
doItemSetAttribute(pokeball.uid, "vitality", getItemAttribute(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)
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)] 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

otavio101O
20 de novembro de 2013 às 10:40

Não tem nenhum erro no console, mas precisa chamar ele se não fica sem level e quando ele fica sem level o status fica bugado.

zipter98Z
20 de novembro de 2013 às 13:21

Deixa eu ver se entendi: Se o player não retornar o pokémon pra ball, ele fica sem level, e, consequentemente, os status bugam? Se for, já encontrei uma solução pra isso.

Mas, antes, poderia informar qual servidor base você utiliza?

 

Bom, se for PDA, e tiver a função getPokeballType, provavelmente irá funcionar. Testei aqui no meu sistema de evolução, e no console dá apenas um erro de creature not found quando vai setar a skull nele; porém, nada prejudicial (ao menos, aqui não ocorreu bug algum em relação à isso).

 

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", getItemAttribute(pokeball.uid, "offense") + off)
doItemSetAttribute(pokeball.uid, "defense", getItemAttribute(pokeball.uid, "defense") + def)
doItemSetAttribute(pokeball.uid, "speed", getItemAttribute(pokeball.uid, "speed") + agi)
doItemSetAttribute(pokeball.uid, "specialattack", getItemAttribute(pokeball.uid, "specialattack") + spatk)
doItemSetAttribute(pokeball.uid, "vitality", getItemAttribute(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)] 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

Editado Novembro 20 por zipter98

otavio101O
20 de novembro de 2013 às 14:20

Já tava querendo tirar a skull mesmo.

 

 

Aqui não deu esse erro de skull não, porém o pokémon volta pra pokeball =x

 

Fui tentar usar o evolve no Eevee aqui e não funcionou diz que ele não tem evoluções.

 

 

 

O status ainda muda mesmo que pouco.

15:25 You see a superball.
It contains an Charmander [level 16].
It is male.
--- Status ---
Offense: 83 Defense: 68
Agility: 1 Sp. Attack: 96
Vitality: 62
15:25 You see a superball.
It contains a Charmeleon [level 16].
It is male.
--- Status ---
Offense: 88 Defense: 73
Agility: 1 Sp. Attack: 102
Vitality: 66

Editado Novembro 20 por otaviogfl