Hello, I'm adding all the Pikachu forms from ORAS and I'm trying that, when you change the form of the Pikachu with and item, she learns the attack that corresponds to that "form".
Before nothing, the forms that I use for this Pikachus are: 4 (Cosplay), 5, 6, 7, 8, 9 to all the customes. Pikachu_1 is the one that I use for alolan raichu, 2 is for flying pikachu and 3 for surfing pikachu.
The item works like a charm. I modified the "Rotom Catalog" made by Golisopod User in this thread: https://www.pokecommunity.com/showthread.php?p=10109969. Credits to him.
Heres is the code:
But the problem appears when I try the thing with the attacks. I looked into the Rotom code to do that, but everything that I try doesn't make nothing.
Here is the code that I'm trying to use. Obviously modified from rotom's code.
I know that I'm missing something, but I don't know what is.
I tested rotom and works perfectly, by the way.
Someone can help me?
Thanks.
Before nothing, the forms that I use for this Pikachus are: 4 (Cosplay), 5, 6, 7, 8, 9 to all the customes. Pikachu_1 is the one that I use for alolan raichu, 2 is for flying pikachu and 3 for surfing pikachu.
The item works like a charm. I modified the "Rotom Catalog" made by Golisopod User in this thread: https://www.pokecommunity.com/showthread.php?p=10109969. Credits to him.
Heres is the code:
Spoiler:
Code:
ItemHandlers::UseOnPokemon.add(:COSPLAYCATALOG,proc{|item,pokemon,scene|
if (isConst?(pokemon.species,PBSpecies,:PIKACHU)) && pokemon.form==4 ||
pokemon.form==5 || pokemon.form==6 || pokemon.form==7 || pokemon.form==8 || pokemon.form==9
if pokemon.hp>0
scene.pbDisplay(_INTL("¡El Catálogo contiene una muestra de atuendos para que {1} Coqueta haga cosplay!",pokemon.name))
cmd=0
msg = _INTL("¿Qué atuendo quieres pedir?")
cmd = scene.pbShowCommands(msg,[
_INTL("Sin atuendo"),
_INTL("Roquera"),
_INTL("Aristócrata"),
_INTL("Erudita"),
_INTL("Super Star"),
_INTL("Enmascarada"),
_INTL("Cancelar")],cmd)
if cmd>=0 && cmd<6
scene.pbDisplay(_INTL("¡{1} cambió de aspecto!",pokemon.name))
pokemon.form=cmd+4
else
scene.pbDisplay(_INTL("No realizaste ningún pedido."))
end
scene.pbRefresh
next true
else
scene.pbDisplay(_INTL("No puede usarse en un Pokémon debilitado."))
end
else
scene.pbDisplay(_INTL("No tendrá ningún efecto."))
next false
end
})
But the problem appears when I try the thing with the attacks. I looked into the Rotom code to do that, but everything that I try doesn't make nothing.
Here is the code that I'm trying to use. Obviously modified from rotom's code.
Spoiler:
Code:
MultipleForms.register(:PIKACHU,{
"onSetForm"=>proc{|pokemon,form|
moves=[
:METEORMASH, # Roquera
:ICICLECRASH, # Aristócrata
:ELECTRICTERRAIN, # Erudita
:DRAININGKISS, # Super Star
:FLYINGPRESS # Enmascarada
]
hasoldmove=-1
for i in 0...4
for j in 0...moves.length
if isConst?(pokemon.moves[i].id,PBMoves,moves[j])
hasoldmove=i; break
end
end
break if hasoldmove>=0
end
if form>4
newmove = moves[form-5]
if newmove!=nil && hasConst?(PBMoves,newmove)
if hasoldmove>=0
# Automatically replace the old form's special move with the new one's
oldmovename = PBMoves.getName(pokemon.moves[hasoldmove].id)
newmovename = PBMoves.getName(getID(PBMoves,newmove))
pokemon.moves[hasoldmove] = PBMove.new(getID(PBMoves,newmove))
Kernel.pbMessage(_INTL("1,\\wt[16] 2, y\\wt[16]...\\wt[16] ...\\wt[16] ... ¡Ta-da!\\se[Battle ball drop]\1"))
Kernel.pbMessage(_INTL("{1} olvidó como usar {2}.\\nY...\1",pokemon.name,oldmovename))
Kernel.pbMessage(_INTL("\\se[]¡{1} aprendió {2}!\\se[Pkmn move learnt]",pokemon.name,newmovename))
else
# Try to learn the new form's special move
pbLearnMove(pokemon,getID(PBMoves,newmove),true)
end
end
else
if hasoldmove>=0
# Forget the old form's special move
oldmovename=PBMoves.getName(pokemon.moves[hasoldmove].id)
pokemon.pbDeleteMoveAtIndex(hasoldmove)
Kernel.pbMessage(_INTL("{1} olvidó {2}...",pokemon.name,oldmovename))
if pokemon.moves.find_all{|i| i.id!=0}.length==0
pbLearnMove(pokemon,getID(PBMoves,:THUNDERSHOCK))
end
end
end
}
})
I know that I'm missing something, but I don't know what is.
I tested rotom and works perfectly, by the way.
Someone can help me?
Thanks.