Common Errors (and How to Fix Them)
Common points to check, the line the error points at, as well as the line just before it, as either can cause the error.
Error Line points to an end:
There are two possible causes for this type of error depending on the location of the end. The first is the end is the very last one in the script section or proc, the second is when it is not.
In the first case, this means there are not enough ends, and you might have missed placing one higher up. For the future, you should always type both halves of the def/end, if/end, case/end, class/end, loop do/end, for/end, module/end, and any other that I have not mentioned.
In the second case, this means you have too many ends. Sometimes this happens when you copy and paste code from another spot and take the ifs and ends with it.
The fixes for both are the same, go down through the script from the top, adding a level of indentation for every if, def, class, module, case, and all of the other situations that require an end. you also have to remove a level of indentation for every end. If you end up with an indentation level that is not 0, but you've finished the method/class/module, then you are missing a few ends. A negative level, too many. This method does allow you to establish the location of missing ends for loops and if blocks, provided of course, you know what the code is supposed to be doing.
An awful lot of errors in general can be fixed by deleting the save file or renaming the project (which dissociates it from the default "Pokemon Essentials" Save file you probably have).
"Filename is nil":
This error shows up because a helper method could not find a corresponding image (like the pokemon battler or icon), so it gives an invalid result.
Generally, based on where you crashed, you'll know which file it choked on, or at least an idea (what ever pokemon it tried to load).
- Load screen is almost always because you have a party from a different project and it contains pokemon which don't exist in this project (else you'd have icons for it). Rename your project already!
"undefined method 'name' for nil:NilClass" (last call stack trace "PField_Field:408"):
When you get this error, that means the game tried to load up a map that was deleted from the game. Chances are you deleted the map on purpose, so just deleting the save will do the trick to fixing this error. Fun fact, on the default load screen, if the map name is blank, you deleted it through RMXP, so the MapInfos.rxdata no longer has the name, while if you just deleted the map in the Data folder directly, the old map name will still appear, because the MapInfos was never updated.
"undefined method 'pokedexSeen' for nil:NilClass":
This one shows up because the $Trainer wasn't set up. That should normally be done in your intro event, so compare with the default ones.
Are the critical method calls.
"undefined method '' for nil:NilClass" (last call stack trace "PScreen_PokedexMain:328:in 'pbGetDexList'"):
If you end up giving two pokemon the same regional dex number in the PBS, this error will occur. There's no easy way to check for this, but at least you know the cause.
You can also get this error if you skip some regional numbers for a particular regional dex.
"undefined local variable or method 'foo' for #<CLASS_NAME:0xdeafbeef>":
This error shows up because you've tried to call a method or use a variable that doesn't exist in class 'CLASS_NAME'. This may be because you've mistyped the method/variable or because you failed to define it. Good on you for learning to script though!
"undefined method '>' for nil:NilClass" (last call stack trace "PokeBattle_Battler:2736:in 'pbProcessMoveAgainstTarget'"):
This error shows up because you've forgotten a return in your def pbEffect for the function code of the last used move. Most of the default move effects have the line "ret=super(attacker,opponent,hitnum,alltargets,showanimation)" and "return ret" at the end.
"PSystem_Utilities:855:in `'cannot convert false into Integer" (Catching a pokemon with a "getForm" property, usually):
This error is actually a bug in v17.2. The fix is here, in Maruno's reply: https://essentialsdocs.fandom.com/f/p/3100000000000000033/r/3085673425470174620
"Symbol as array index"
This one shows up because you ended up doing something like this: [1,2,3,4][:REPEL]. If you got this error while trying to do a getName, that's because you need to convert the symbol to a number. So PBItems.getName(getID(PBItems,:REPEL)) is the trick. If that wasn't what you were doing, you'll still need that getID probably.
"Script 'Scene_Intro' line 78: NameError occurred. uninitialized constant IntroEventScene::PBSpecies"
So, PBSpecies is the module with all of the pokemon constants in it. It is created when the game is compiled, so if you stop the compilation in the middle, that module might not be created, and when you run the game normally, through Game.exe, instead of looking for module PBSpecies, it defaults to a constant PBSpecies. Run your game from the green playtest arrow, and hold down CTRL while the game boots up. This will force a recompile, and correct the issue.
Hopefully you don't get any of these...
"This version is from an old version of RPG Maker XP":
Or something like that. This error is generally because the Game.rxproj is saying it's using an older version number (usually 1.02) while the latest is 1.05. Just copy the Game.rxproj from a working project in, that'll do the trick.
"Failed to load Actor data":
This one really sucks to get. It tends to point to a corrupted project. Have no fear because a number of the .rxdatas are not actually used by Essentials, like Actors, Armors, Classes, Enemies, Items, Weapons, Troops, States, and Skills. If replacing all of those doesn't do the trick, you can still potentially salvage the project, by copying over the MapInfos and Map files, as well as the PBS files, graphics, and audio. Try to copy over Tilesets and Scripts too, so you don't lose too much.
This is damage control mode though, so take this as a lesson in making back ups if you haven't already.
Popular Script Errors:
This isn't an extensive list, but some scripts are pretty popular.
v17 renamed some classes when compared to v16.2. This breaks scripts when they try to alias methods in those classes because the old name doesn't exist anymore.
This is a link to assorted renamed classes: https://pastebin.com/CYLRYii9
"undefined method '>' for nil:NilClass":
That one shows up because it tried to load an animation from a non-existant index. Make sure you close RMXP completely before you replace the Aimations.rxdata.
"Game_CommonEvent:27:in 'trigger'undefined method 'trigger' for nil:NilClass":
This one appears because the Common Event index you set for the script is out of bounds, way too big.
Luka's Scripts (EBS, etc.):
"undefined method 'isVersion17?' for nil:NilClass":
This error happens because you've missed Luka's Utilities script. That one should be installed in a script section above all of the other scripts Luka SJ has made.