Error when encountering wild Pokémon appearing randomly in the overworld

Marina

Cooltrainer
Member
Joined
Mar 10, 2018
Posts
129
Hello, so when I playtest my game and I walk with my eevee to the next route and through the grass, where other pokémon appear randomly in the overworld - then suddenly an error appears:

---------------------------
Error
---------------------------
Script 'Interpreter' line 276: RuntimeError occurred.

Script error within event 4 (coords 21,21), map 32 (Alabastia):

Exception: NoMethodError

Message: PField_Encounters:345:in `pbGenerateWildPokemon'undefined method `pbHasItem?' for #<PokemonBag:0x9350550>

***Full script:

Kernel.pbNoticePlayer(get_character(0))
pbWildBattle(:ODDISH,2)
pbSetEventTime


Interpreter:243:in `pbExecuteScript'

PField_Battles:88:in `pbWildBattle'

(eval):2:in `pbExecuteScript'

Interpreter:1606:in `eval'

Interpreter:243:in `pbExecuteScript'

Interpreter:1606:in `command_355'

Interpreter:494:in `execute_command'

Interpreter:193:in `update'

Interpreter:106:in `loop'

Interpreter:198:in `update'


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


When I click "OK" the game crashes. I don't know where the problem is, I think maybe it has something to do with the line 136 in PItem_Items:
Code:
if ret && $ItemData[item][ITEMUSE]==1 # Usable on Pokémon, consumed
              bag.pbDeleteItem(item)
            end

Thanks in advance for any help!
 

TechSkylander1518

Wiki Dweeb
Member
Joined
Mar 24, 2017
Posts
381
For future reference, when you get errors like this, the most important part will be this section:
Exception: NoMethodError

Message: PField_Encounters:345:in `pbGenerateWildPokemon'undefined method `pbHasItem?' for #<PokemonBag:0x9350550>
I think I would check in PField_Field (where pbGenerateWildPokemon is) and see if you made any changes there. (Ctrl+F for "pbHasItem" should help you find it-the game is saying that you used that method somewhere in there, but it wasn't defined for that section.)
 
Top