• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Error] Need Help with v17 scripting.

30
Posts
6
Years
undefined method error

Hi there. I was wondering if someone can maybe help me with this error.
Im using pokemon essentials v17.2.
busy working on a PokeMount script and bumped into this error whenever im changing a setting from one of Ulithium_Dragon's settings.

error.jpg

If someone can help pls reply so I can elaborate.

Thanks.
 

Poq

144
Posts
6
Years
  • Age 34
  • Seen Aug 28, 2021
Basically you have an object that is not defined or a variable that is unassigned somewhere. So when the script pbHasSpecies tries to run the method pokemonParty on this object, instead of running that method on the appropriate class, it tries to run it in nil class (because that's where all undefined objects go) and there's no pokemonParty method defined there.
So, how to fix? Look in the script pbHasSpecies for where it calls something.pokemonParty. the problem is with whatever something turns out to be. It might be an argument that was never received or something father back that was defined wrong. You'll have to follow the breadcrumbs.
 
30
Posts
6
Years
Hi,Im gonna make this short.

If anybody can help, i will be more then happy.
Im using PE v17.2

Im creating a piece of code to register a pokemon to a device but only when it is in the pokemon party.
I dont want to edit in the maker's scripts and rather do plug and play.


Ive tried codes like this to check if the species exists.

CODE IE:

---------------------------------------------
class Party_map < Game_Map
alias check_party update
def update

check_party

if pbHasSpecies?(:TAUROS)... .... ....
#my code
end

end #for def
end #for class
---------------------------------------------

for some reason my code does not execute.

and if I use class Game_Map instead of a subclass.
I get this error.
error.jpg

Any Help and guidance will be appreciated.
 
Last edited by a moderator:
1,403
Posts
10
Years
  • Seen Apr 18, 2024
I think that using Game_Map instead of a subclass is probably correct (but maybe there's some sensible way to make your subclass get used by the rest of the code?). In any case I have no idea what pbHasSpecies? calls pokemonParty on, but as the error says that value is nil (which probably means it's not initialized since this is code you didn't write—in your own code it normally means that you didn't define the variable at all); presumably it's the player so you might need to check that a $Trainer object actually exists?
 
Last edited:

WolfPP

Spriter/ Pixel Artist
1,309
Posts
5
Years
So, try to change 'pbHasSpecies?(:TAUROS)' to 'if isConst?(pokemon.species,PBSpecies,:TAUROS)' and check what 'pokemon' could be inside the code.
To 'Pokemon_Sprites' script is '@pokemon', to Day_Care is '$PokemonGlobal.daycare[index][0]'.
Find its 'pokemon' definition to that.
 
Last edited:
30
Posts
6
Years
So, try to change 'pbHasSpecies?(:TAUROS)' to 'if isConst?(pokemon.species,PBSpecies,:TAUROS)' and check what 'pokemon' could be inside the code.
To 'Pokemon_Sprites' script is '@pokemon', to Day_Care is '$PokemonGlobal.daycare[index][0]'.
Find its 'pokemon' definition to that.

Thanks buddy, will give it a go later on.
Should i call a class with that?
 
Back
Top