Hello, It's been a long time not messing with Pokemon essentials and I don't know who I got an error while doing a battle, I've made like 5 before this one,
This is the error:
[2023-09-16 03:07:26 +0200]
[Pokémon Essentials version 21.1]
[v21.1 Hotfixes 1.0.1]
Exception: NoMethodError
Message: undefined method `has_active_ability?' for #<Battle::Battler>
Backtrace:
[Generation 9 Pack] [004] AI_MoveEffects.rb:842:in `block in <main>'
Event_Handlers:139:in `trigger'
Battle_AI:98:in `move_will_fail?'
AI_ChooseMove:190:in `pbPredictMoveFailure'
AI_ChooseMove:38:in `block in pbGetMoveScores'
Battle_Battler:461:in `block in eachMoveWithIndex'
Battle_Battler:461:in `each'
Battle_Battler:461:in `each_with_index'
Battle_Battler:461:in `eachMoveWithIndex'
AI_ChooseMove:25:in `pbGetMoveScores'
And about what I'm doing i'm just making the player into an AI so that both fight themselves. Found the code somewhere on the forum and added it to my essentials and worked perfectly until a fight against 2 trainers
One with a Paras and one with a Poliwhirl.
Thanks for any help (and maybe any way to improve the AI vs AI thing well be nice)
Edit: After some checking seems like it's pointing to this code:
#===============================================================================
# Rest
#===============================================================================
# Adds failure check with the Purifying Salt ability.
Battle::AI::Handlers::MoveFailureCheck.add("HealUserFullyAndFallAsleep",
proc { |move, user, ai, battle|
next true if user.battler.has_active_ability?(:PURIFYINGSALT)
next true if !user.battler.canHeal?
next true if user.battler.asleep?
next true if !user.battler.pbCanSleep?(user.battler, false, move.move, true)
next false
}
)
Because the Poliwhirl actually have the
Rest move