• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Error] Error during a battle

AskipLudo

The Masked Guy
159
Posts
7
Years
  • 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
     
    Last edited:

    Swdfm

    Game Developer
    245
    Posts
    5
    Years
    • he/him
    • UK
    • Seen Dec 8, 2023
    Hello, @Ludow79,
    I believe this error may be due to the new script imported (Gen 9 Pack) being based on a later version of essentials than your other scripts
    If this is the problem, then this can be fixed by putting:
    Code:
    class Battle::Battler
      alias has_active_ability? hasActiveAbility?
    end
    However, you should expect to find other errors further on for the same reason
    Hope this helps!
    Swdfm
     

    Swdfm

    Game Developer
    245
    Posts
    5
    Years
    • he/him
    • UK
    • Seen Dec 8, 2023
    Ok, thanks for telling me that.
    Upon reflection, that is not the issue.
    The issue is that the battler referred to in line 842 is a Battle::Battler, when it should be a Battle::AI::AIBattler
    (Apologies, I am not very familiar with the new AI system)
     

    AskipLudo

    The Masked Guy
    159
    Posts
    7
    Years
  • Weird I feel like I'm the only one with this error tho, and I don't know where I should modify this since I'm also not familiar with all this. Maybe I will wait and see if the creator of this will check my message on reliccastle xD
     

    Swdfm

    Game Developer
    245
    Posts
    5
    Years
    • he/him
    • UK
    • Seen Dec 8, 2023
    You can ask him by all means, but he will likely say that the addition fo the Gen 9 Pack caused the issue. I will come back and have another look at this tomorrow
     

    AskipLudo

    The Masked Guy
    159
    Posts
    7
    Years
  • Well I didn't tested much those days but the last time I test with a pokemon with rest and the "has_active_ability?" changed to "hasActiveAbility?" in line 842 didn't made any error, I guess everything didnt get changed

    Edit: The dev will fix this next update so it will be fixed :P
     
    Last edited:
    Back
    Top