• 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] NameError: Undefined Variable/Method 'i'

I get this error when I try to attack in a battle:
Code:
---------------------------
Pokémon Universal
---------------------------
[Pokémon Essentials version 17.2]

Exception: NameError

Message: undefined local variable or method `i' for #<PokeBattle_Battler:0xc8dcb70>

PokeBattle_Battler:3284:in `pbSuccessCheck'

PokeBattle_Battler:3680:in `pbProcessMoveAgainstTarget'

PokeBattle_Battler:3676:in `each'

PokeBattle_Battler:3676:in `pbProcessMoveAgainstTarget'

PokeBattle_Battler:4279:in `pbUseMove'

PokeBattle_Battler:4259:in `loop'

PokeBattle_Battler:4282:in `pbUseMove'

PokeBattle_Battler:4489:in `pbProcessTurn'

PokeBattle_Battler:4488:in `logonerr'

PokeBattle_Battler:4488:in `pbProcessTurn'
Here is my screen around Line 3284 in PokeBattle_Battler:

[PokeCommunity.com] NameError: Undefined Variable/Method 'i'


And here is the actual code on the image:
Code:
    r -= c
    # Hurt self in confusion
    if r<c && self.status!=PBStatuses::SLEEP
      @battle.pbDisplay(_INTL("{1} won't obey! It hurt itself in its confusion!",pbThis))
      pbConfusionDamage
      return false
    end
    # Show refusal message and do nothing
    case @battle.pbRandom(4)
    when 0; @battle.pbDisplay(_INTL("{1} won't obey!",pbThis))
    when 1; @battle.pbDisplay(_INTL("{1} turned away!",pbThis))
    when 2; @battle.pbDisplay(_INTL("{1} is loafing around!",pbThis))
    when 3; @battle.pbDisplay(_INTL("{1} pretended not to notice!",pbThis))
    end
    return false
  end

  def pbSuccessCheck(thismove,user,target,turneffects,accuracy=true)
    if @battle.field.effects[PBEffects::PsychicTerrain]>0 && thismove.priority>0 &&
       !user.isAirborne?(false) && !thismove.doesIgnoreDazzling?
       PBDebug.log("Psychic Terrain prevented #{user.pbThis}'s priority move")
       @battle.pbDisplay(_INTL("The psychic terrain prevented the use of priority moves!"))
      return false
    elsif !user.hasMoldBreaker && pbIsOpposing?(i) && (battler.hasWorkingAbility(:QUEENLYMAJESTY) || 
                                                       battler.hasWorkingAbility(:DAZZLING))
      @battle.pbDisplay(_INTL("{1} cannot use {2}!",user.pbThis,PBMoves.getName(thismove)))
      return false
    end
    # TODO: "Before Protect" applies to Counter/Mirror Coat
    if thismove.function==0xDE && # Dream Eater
      target.status!=PBStatuses::SLEEP && (!target.hasWorkingAbility(:COMATOSE) || !isConst?(target.species,PBSpecies,:KOMALA))
      @battle.pbDisplay(_INTL("{1} wasn't affected!",target.pbThis))
      PBDebug.log("[Move failed] #{user.pbThis}'s Dream Eater's target isn't asleep")
      return false
    end
    if thismove.function==0x113 && user.effects[PBEffects::Stockpile]==0 # Spit Up
      @battle.pbDisplay(_INTL("But it failed to spit up a thing!"))
      PBDebug.log("[Move failed] #{user.pbThis}'s Spit Up did nothing as Stockpile's count is 0")
      return false
    end
    if target.effects[PBEffects::Protect] && thismove.canProtectAgainst? &&
       !target.effects[PBEffects::ProtectNegation]
      @battle.pbDisplay(_INTL("{1} protected itself!",target.pbThis))
      @battle.successStates[user.index].protected=true
      PBDebug.log("[Move failed] #{target.pbThis}'s Protect stopped the attack")
Thanks in advance!
 
Didn't I tell you in the previous thread that you must have messed up in the implementation of Gen 7.

On line 3284 remove that line about Mold Breaker and Dazzling and Queen Majesty. Then try it. You're gonna have to reimplement those 2 Abilities so check them out on Google.
 
Back
Top