• 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.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Serena, Kris, Dawn, Red - which Pokémon protagonist is your favorite? Let us know by voting in our grand final favorite protagonist poll!
  • PokéCommunity supports the Stop Killing Games movement. If you're a resident of the UK or EU, consider signing one of the petitions to stop publishers from destroying games. Click here for more information!
  • 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-

  • 413
    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