Male
Lilycove City, Hoenn
Seen 14 Hours Ago
Posted 14 Hours Ago
10 posts
5 Years
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?
Male
Lilycove City, Hoenn
Seen 14 Hours Ago
Posted 14 Hours Ago
10 posts
5 Years
Sorry, typo. It's in PokeBattle_Battle. I tried removing the offending script to try and see if anything else was also causing an error, but the error pops up on the same line... Which is now Wonder Room. The specific line it points to is "if @field.effects[PBEffects::InverseRoom]>0" or, now, "if @field.effects[PBEffects::WonderRoom]>0". I have absolutely zero idea what's causing this.


Edit: Commenting out Wonder Room's code there, now it points to Magic Room, the same line. The same line in Trick Room, which is still above, is causing no errors, oddly. That tells me that the problem probably isn't in this script, it's somewhere else, but showing up here?
Male
Lilycove City, Hoenn
Seen 14 Hours Ago
Posted 14 Hours Ago
10 posts
5 Years
https://prnt.sc/tbtpjj
Like I said, the error now points even to Wonder Room and Magic Room. Even after commenting out the code, the same error persists, just pointing to the same line of Wonder Room and Magic Room. For some reason, Trick Room is not affected, despite no actual differences in the code.

It pops up on launch.
Male
Lilycove City, Hoenn
Seen 14 Hours Ago
Posted 14 Hours Ago
10 posts
5 Years
Ah, found the problem.

At some point, an extra end made its way into the bottom of Trick Room's code. Managed to fix it now, so I guess that does it. Moved the end (without it I was getting the error that happens when you miscount your ends), so I guess that does it. Must have happened while I was adding Psychic Terrain earlier, I guess?