- 10
- Posts
- 9
- Years
- Lilycove City, Hoenn
- Seen Sep 27, 2022
I'm working in Pokemon Essentials v17.2, and trying to create a move that turns the battle into an Inverse Battle, Trick Room style. I'm currently running into an error though, in the PokeBattle_Battle script, with a NoMethodError, with the text underneath being "undefined method 'effects' for nil:NilClass". The code I'm using is as follows, and the error is on "if @field.effects[PBEffects::InverseRoom]>0"
# Inverse Room
if @field.effects[PBEffects::InverseRoom]>0
@field.effects[PBEffects::InverseRoom]-=1
if @field.effects[PBEffects::InverseRoom]==0
pbDisplay(_INTL("Inverse Room wore off, and type effectiveness returned to normal!"))
PBDebug.log("[End of effect] Inverse Room ended")
end
end
I've set up an effect in PBEffects and PokeBattle_ActiveSideField in the correct section, and set up the effect in PokeBattle_MoveEffects, and what it actually does in PokeBattle_Move (since it directly changes type effectiveness). Everything is spelled the same way everywhere.
Anyone know why I'm getting this error and how to fix it?
I've set up an effect in PBEffects and PokeBattle_ActiveSideField in the correct section, and set up the effect in PokeBattle_MoveEffects, and what it actually does in PokeBattle_Move (since it directly changes type effectiveness). Everything is spelled the same way everywhere.
Anyone know why I'm getting this error and how to fix it?
# Inverse Room
if @field.effects[PBEffects::InverseRoom]>0
@field.effects[PBEffects::InverseRoom]-=1
if @field.effects[PBEffects::InverseRoom]==0
pbDisplay(_INTL("Inverse Room wore off, and type effectiveness returned to normal!"))
PBDebug.log("[End of effect] Inverse Room ended")
end
end
I've set up an effect in PBEffects and PokeBattle_ActiveSideField in the correct section, and set up the effect in PokeBattle_MoveEffects, and what it actually does in PokeBattle_Move (since it directly changes type effectiveness). Everything is spelled the same way everywhere.
Anyone know why I'm getting this error and how to fix it?
I've set up an effect in PBEffects and PokeBattle_ActiveSideField in the correct section, and set up the effect in PokeBattle_MoveEffects, and what it actually does in PokeBattle_Move (since it directly changes type effectiveness). Everything is spelled the same way everywhere.
Anyone know why I'm getting this error and how to fix it?
Last edited: