- 15
- Posts
- 6
- Years
- I live in England, which is in the UK.
- Seen Jul 1, 2022
I get this error when I try to attack in a battle:
Here is my screen around Line 3284 in PokeBattle_Battler:
And here is the actual code on the image:
Thanks in advance!
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'
![[PokeCommunity.com] NameError: Undefined Variable/Method 'i' [PokeCommunity.com] NameError: Undefined Variable/Method 'i'](https://i.ibb.co/yXT6Npq/Error-IMG.png)
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")