- Joined
- Mar 12, 2024
- Posts
- 30
I'm no expert, as I'm still getting into understanding the Pokemon Essentials code myself.Hey man, so first, no worries about the late response. Secondly, I tried making the edit to the file to where you recommended as so:
Ruby:alias abilityMutations_pbInitPokemon pbInitPokemon def pbInitPokemon(pkmn, idxParty) abilityMutations_pbInitPokemon(pkmn, idxParty) # Initialize the innate abilities if not already set pkmn.assign_innate_abilities if pkmn.active_innates.empty? # Set the original innates of the pokemon pkmn.save_original_innates # Set the ability mutation list using the new method if (!battler.pbOwnedByPlayer?) @abilityMutationList = pkmn.active_innates else @abilityMutationList = pkmn.set_innate_limits end end
But when getting into an encounter, the game crashes with this message:
[Pokémon Essentials version 21.1]
[v21.1 Hotfixes 1.0.9]
Exception: NameError
Message: undefined local variable or method `battler' for #<Battle::Battler>
Backtrace:
[Innate Abilities] AAM Battler.rb:93:in `pbInitPokemon'
Battler_Initialize:61:in `pbInitialize'
[[DBK] Animated Pokémon System] [006] Battler Sprites.rb:395:in `pbInitialize'
Battle_StartAndEnd:117:in `pbCreateBattler'
Battle_StartAndEnd:153:in `block (3 levels) in pbSetUpSides'
Battle:411:in `block in eachInTeam'
Battle:411:in `each'
Battle:411:in `each_with_index'
Battle:411:in `eachInTeam'
Battle_StartAndEnd:150:in `block (2 levels) in pbSetUpSides'
To remedy this, I tried adding a 'battler' parameter to the pbInitPokemon function, like so:
Ruby:def pbInitPokemon(pkmn, idxParty) --> def pbInitPokemon(pkmn, idxParty, battler)
But now I get this error:
[Pokémon Essentials version 21.1]
[v21.1 Hotfixes 1.0.9]
Exception: ArgumentError
Message: wrong number of arguments (given 2, expected 3)
Backtrace:
[Innate Abilities] AAM Battler.rb:83:in `pbInitPokemon'
Battler_Initialize:61:in `pbInitialize'
[[DBK] Animated Pokémon System] [006] Battler Sprites.rb:395:in `pbInitialize'
Battle_StartAndEnd:117:in `pbCreateBattler'
Battle_StartAndEnd:153:in `block (3 levels) in pbSetUpSides'
Battle:411:in `block in eachInTeam'
Battle:411:in `each'
Battle:411:in `each_with_index'
Battle:411:in `eachInTeam'
Battle_StartAndEnd:150:in `block (2 levels) in pbSetUpSides'
Now I'm just lost. Obviously there must be something wrong with my conditional branch, I guess !battler.pbOwnedByPlayer? wasn't the right call.
Though, with your original code, what happens if you remove the battler parameter from pbInitPokemon, and then instead of referencing if (!battler.pbOwnedByPlayer?) try using if (!pkmn.pbOwnedByPlayer?)