- 288
- Posts
- 6
- Years
- Seen Feb 3, 2025
For some reason, when Ally Switch is used, an error message pops up and the user does not switch places with its partner (its sprite disappears but this may be part of the animation used and not the error). I have not edited the MoveEffects code for Ally Switch, but I must have changed something else that is causing it not to work. Here is the error message:
[Pokémon Essentials version 17.2]
Exception: NoMethodError
Message: undefined method `pbUpdate' for nil:NilClass
PokeBattle_MoveEffects:1807:in `pbEffect'
PokeBattle_Battler:5002:in `pbUseMove'
PokeBattle_Battler:5001:in `logonerr'
PokeBattle_Battler:5001:in `pbUseMove'
PokeBattle_Battler:6361:in `pbProcessTurn'
PokeBattle_Battler:6360:in `logonerr'
PokeBattle_Battler:6360:in `pbProcessTurn'
PokeBattle_Battle:4225:in `pbAttackPhase'
PokeBattle_Battle:4222:in `each'
PokeBattle_Battle:4222:in `pbAttackPhase'
This is the code for Ally Switch as present in PokeBattle_MoveEffects:
[Pokémon Essentials version 17.2]
Exception: NoMethodError
Message: undefined method `pbUpdate' for nil:NilClass
PokeBattle_MoveEffects:1807:in `pbEffect'
PokeBattle_Battler:5002:in `pbUseMove'
PokeBattle_Battler:5001:in `logonerr'
PokeBattle_Battler:5001:in `pbUseMove'
PokeBattle_Battler:6361:in `pbProcessTurn'
PokeBattle_Battler:6360:in `logonerr'
PokeBattle_Battler:6360:in `pbProcessTurn'
PokeBattle_Battle:4225:in `pbAttackPhase'
PokeBattle_Battle:4222:in `each'
PokeBattle_Battle:4222:in `pbAttackPhase'
This is the code for Ally Switch as present in PokeBattle_MoveEffects:
Code:
class PokeBattle_Move_120 < PokeBattle_Move
def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
if [email protected] ||
!attacker.pbPartner || attacker.pbPartner.fainted?
@battle.pbDisplay(_INTL("But it failed!"))
return -1
end
pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
[email protected][attacker.index]
[email protected][attacker.pbPartner.index]
temp=a; a=b; b=temp
# Swap effects that point at the position rather than the Pokémon
# NOT PerishSongUser (no need to swap), Attract, MultiTurnUser
effectstoswap=[PBEffects::BideTarget,
PBEffects::CounterTarget,
PBEffects::LeechSeed,
PBEffects::LockOnPos,
PBEffects::MeanLook,
PBEffects::MirrorCoatTarget]
for i in effectstoswap
a.effects[i],b.effects[i]=b.effects[i],a.effects[i]
end
attacker.pbUpdate(true)
opponent.pbUpdate(true)
@battle.pbDisplay(_INTL("{1} and {2} switched places!",opponent.pbThis,attacker.pbThis(true)))
end
end