- 90
- Posts
- 7
- Years
- Seen Nov 24, 2023
I've tried using this code that I found on this site for an item that gives Pokemon a hidden ability in my game:
The are 2 problems that I've found with it, though:
1.There's no way to get the second hidden ability of a Pokemon with this code.
2.If you try to use this item to revert a Pokemon's ability back to its normal one, the first text will instead display the name of the hidden ability.
Can anyone try to fix this? For example, have the Dream Capsule change a Pokemon's ability to its hidden one, then use a normal Ability Capsule to change it to its second Hidden Ability. I'm not very good at coding, so I was thinking someone from here might be able to do it.
Code:
ItemHandlers::UseOnPokemon.add(:DREAMCAPSULE,proc{|item,pokemon,scene|
abil=pokemon.getAbilityList
dream_abil=[]
for i in 0...abil[0].length
dream_abil.push(abil[0][i]) if abil[1][i]>1
end
if dream_abil.length >0
if Kernel.pbConfirmMessage(_INTL("Do you want to change {1}'s ability to {2}?",
pokemon.name,PBAbilities.getName(dream_abil[0])))
pokemon.setAbility(2)
scene.pbDisplay(_INTL("{1}'s ability was changed to {2}!",pokemon.name,PBAbilities.getName(pokemon.ability)))
pokemon.calcStats
next true
else
next false
end
else
scene.pbDisplay(_INTL("It won't have any effect."))
next false
end
})
1.There's no way to get the second hidden ability of a Pokemon with this code.
2.If you try to use this item to revert a Pokemon's ability back to its normal one, the first text will instead display the name of the hidden ability.
Can anyone try to fix this? For example, have the Dream Capsule change a Pokemon's ability to its hidden one, then use a normal Ability Capsule to change it to its second Hidden Ability. I'm not very good at coding, so I was thinking someone from here might be able to do it.