• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • 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 when opponent's PP runs out

  • 2
    Posts
    4
    Years
    • Seen Mar 11, 2022
    Whenever the opponent trainer runs out of PP an error message pops up when I select an action. (error message shown below) I think the trainer attempts to struggle but is unable to. This happens in both single and double battles. [edit: The trainer does have multiple pokémons so it should also be able to switch when I make the trainer AI at a high enough level. But is still does not change the error]
    Also when a wild pokemon should struggle it instead doesn't do anything. it just sits still and will not take an action is this normal programmed behavior in essentials v18? I want the opposing wild pokemon to be able to struggle can I change this.
    ---------------------------
    Pokemon Essentials
    ---------------------------
    [Pokémon Essentials version 18.1]

    Exception: NameError

    Message: undefined local variable or method `b' for #<PokeBattle_Battle:0x102b8350>



    Backtrace:

    Battle_Action_Switching:248:in `pbMessageOnRecall'

    Battle_Phase_Attack:57:in `pbAttackPhaseSwitch'

    Battle_Phase_Attack:51:in `each'

    Battle_Phase_Attack:51:in `pbAttackPhaseSwitch'

    Battle_Phase_Attack:183:in `pbAttackPhase'

    Battle_StartAndEnd:323:in `pbBattleLoop'

    Battle_StartAndEnd:323:in `logonerr'

    Battle_StartAndEnd:323:in `pbBattleLoop'

    Battle_StartAndEnd:308:in `loop'

    Battle_StartAndEnd:329:in `pbBattleLoop'



    This exception was logged in

    C:\Users\USERNAME\Saved Games\Pokemon Essentials\errorlog.txt.

    Press Ctrl+C to copy this message to the clipboard.
    ---------------------------
    OK
    ---------------------------
    I do not have any mods installed on this essentials so I think it might actually be a programming bug. Can someone help fix it? I am to new to essentials to understand the code written at all.
     
    I don't have that error in my scripts.

    Can you post the code for the the function:
    Code:
    def pbMessageOnRecall(battler)
    please?
     
    I found this defenition in Battle_Action_Switching. Is this what you meant?

    def pbMessageOnRecall(battler)
    if battler.pbOwnedByPlayer?
    if battler.hp<=battler.totalhp/4
    pbDisplayBrief(_INTL("Good job, {1}! Come back!",battler.name))
    elsif battler.hp<=battler.totalhp/2
    pbDisplayBrief(_INTL("OK, {1}! Come back!",battler.name))
    elsif battler.turnCount>=5
    pbDisplayBrief(_INTL("{1}, that's enough! Come back!",battler.name))
    elsif battler.turnCount>=2
    pbDisplayBrief(_INTL("{1}, come back!",battler.name))
    else
    pbDisplayBrief(_INTL("{1}, switch out! Come back!",battler.name))
    end
    else
    owner = pbGetOwnerName(b.index)
    pbDisplayBrief(_INTL("{1} withdrew {2}!",owner,battler.name))
    end
    end
     
    If the error occurs with every battler then it might be in whichever code checks for 0 PP in all moves for the active battler.
     
    Back
    Top