Solved Strange NoMethodError

SJFzone

Novice
Member
Joined
Jul 27, 2020
Posts
12
Likes
4
#1
When I tried to test a new ability, I started getting these errors. Problem is, the lines they are specifying are from script sections that I haven't changed, so I don't know which of my changes are coming from, or what I have to change. I've put in two different spoilers, for Wild and Trainer battles, for convenience.
---------------------------
Error
---------------------------
Script '[Pokemon_Forms]' line 109: NoMethodError occurred.

undefined method `species' for nil:NilClass

from 'Pokemon_Forms' line 109 in `call'
from 'Pokemon_Forms' line 67 in `pbOnEnteringBattle'
from 'Battle_Action_Switching' line 295 in `pbSendOut'
from 'Battle_Action_Switching' line 295 in `each'
from 'Battle_Action_Switching' line 295 in `pbSendOut'
from 'Battle_StartAndEnd' line 230 in `pbStartBattleSendOut'
from 'Battle_StartAndEnd' line 187 in `each'
from 'Battle_StartAndEnd' line 187 in `pbStartBattleSendOut'
from 'Battle_StartAndEnd' line 272 in `pbStartBattleCore'
from 'Battle_StartAndEnd' line 258 in `pbStartBattle'
from 'PField_Battles' line 276 in `pbWildBattleCore'
from 'PField_Battles' line 275 in `pbSceneStandby'
---------------------------
OK
---------------------------
---------------------------
Error
---------------------------
Script '[Interpreter]' line 237: RuntimeError occurred.

Script error within event 4 (coords 80,29), map 43 (Route A):

Exception: NoMethodError

Message: Pokemon_Forms:109:in `call'undefined method `species' for nil:NilClass



***Full script:

pbTrainerBattle(:PICNICKER,"Caitlin")



Backtrace:

Interpreter:201:in `pbExecuteScript'

Pokemon_Forms:67:in `pbOnEnteringBattle'

Battle_Action_Switching:295:in `pbSendOut'

Battle_Action_Switching:295:in `each'

Battle_Action_Switching:295:in `pbSendOut'

Battle_StartAndEnd:230:in `pbStartBattleSendOut'

Battle_StartAndEnd:187:in `each'

Battle_StartAndEnd:187:in `pbStartBattleSendOut'

Battle_StartAndEnd:272:in `pbStartBattleCore'

Battle_StartAndEnd:258:in `pbStartBattle'


---------------------------
OK
---------------------------

And here's a screenshot of the lines around 109 in Pokemon_Forms, even though it should be unmodified.
 
Last edited:

NettoHikari

Trainer
Member
Joined
Jan 4, 2019
Posts
67
Likes
27
#2
What about a screenshot of the ability code you added? The error may not be pointing there but it might still be a result of that code (maybe it's calling the function on line 108 but passing the wrong parameters).
 
OP
OP
SJFzone

SJFzone

Novice
Member
Joined
Jul 27, 2020
Posts
12
Likes
4
#3


Here it is, although I don't THINK this is the reason for it. I hadn't tested battles for a while.
 

Golisopod User

Elite Trainer
Member
Joined
May 11, 2020
Posts
146
Likes
28
#4
You may have edited something in Battle_Switching and Battle_Start_and_End while adding Gen 8 stuff. Try looking at if anything like this happens in base Essentials and edit the code accordingly.
 
OP
OP
SJFzone

SJFzone

Novice
Member
Joined
Jul 27, 2020
Posts
12
Likes
4
#5
Just updating for posterity since I figured it out, I accidentally deleted this Very Important Line in Pokemon_ShadowPokemon in pbInitPokemon while editing how heart gauges work.
Code:
    __shadow__pbInitPokemon(*arg)
    # Called into battle
So the lesson is: don't do that!
 
Top