• 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!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • 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] Infinite loop crash when Storm Drain tries checking if the move's used by a foe or not before redirecting it to the ability holder. Alternatively-

  • 428
    Posts
    5
    Years
    Infinite loop crash when Storm Drain tries checking if the move's used by a foe or not before redirecting it to the ability holder. Alternatively Storm Drain redirects every Water move undesirably.

    Storm Drain's effect redirects every Water attack used to hit the user. Even if the redirected Water attack was used by the Pokemon with Storm Drain or his allies. This turns the ability into a huge handicap for Water Pokemon.

    Storm Drain did look like this.
    Code:
    targets = pbChangeTargetByAbility(:STORMDRAIN, :WATER, move, user, targets, priority, nearOnly)

    And then, I changed it to look like this.
    Code:
         if target.opposes?(user)
        targets = pbChangeTargetByAbility(:STORMDRAIN, :WATER, move, user, targets, priority, nearOnly)
        return targets
      else
              return targets
      end
      end

    This resulted in crashes whenever any Water move is used.

    This also results in crashes and an infinite loop whenever any Water move is used:
    Code:
        targets = pbChangeTargetByAbility(:STORMDRAIN, :WATER, move, user, targets, priority, AllFoes)
      end
    The error message says this:
    Code:
    [Pokémon Essentials version 20.1]
    [v20.1 Hotfixes 1.0.2]
    
    Exception: NameError
    Message: uninitialized constant Battle::Battler::AllFoes
    
    Backtrace:
    167:Battler_UseMoveTargeting:143:in `pbChangeTargets'
    166:Battler_UseMove:253:in `pbUseMove'
    166:Battler_UseMove:52:in `block in pbProcessTurn'
    012:PBDebug:6:in `logonerr'
    166:Battler_UseMove:51:in `pbProcessTurn'
    156:Battle_AttackPhase:128:in `block (2 levels) in pbAttackPhaseMoves'
    156:Battle_AttackPhase:124:in `each'
    156:Battle_AttackPhase:124:in `block in pbAttackPhaseMoves'
    156:Battle_AttackPhase:110:in `loop'
    156:Battle_AttackPhase:110:in `pbAttackPhaseMoves'
     
    Back
    Top