[SOLVED] Please help.

So I know the title is a little "out there" but I've run into an out of the blue error and I don't know what caused it. I literally changed nothing since I launched the editor yesterday. My game is hitting me with the bug report after someone is damaged in battle and I have TONIGHT to finish this game my friend's birthday. I literally have no idea. What's going on. I took some screenshots of the error as well as my plugin list and the order I have them. I'd be lying to myself and everyone here if I said I knew what I'm doing. I don't know javascript. I rely solely on plugins and plugin commands (some scripts too). I plan on learning sooner than later but as of right now I'm stuck. Did the engine update and break something? IF anyone can help please I'd appreciate the heck out of you. Thanks. 🙁


Screenshots:
Fatal-Error1.PNG
Fatal-Error2.PNG
Fatal-Error3.PNG


Plugins used:
FatalError4.PNG

Fatal-Error5.PNG
The error points to the function that reserves common events.

Do you have something that is calling a common event on hit? A state? A skill that calls a common event? An action sequence?

Did you recently change the number of common events in the database? Does this happen in a new game, or an old save? A battle test?

I'm leaning towards the cause being something calling a common event that either no longer exists, or an old save calling a common event that exists in the database, but didn't exist at the time the savegame was made.

Eg: You had a steal skill that called common event 21, but then later reduced the total number of common events in the database to 5. Common event 21 no longer exists anymore, so when it tries to read the event commands list, it can't find it, and crashes.

Alt: You have a steal skill that calls common event 21, but you're loading a savegame from when you only had 5 common events in the database, and had increased the number from 5 to 21 to accommodate the new skill. The old save may not have updated the database length for the common events, so it doesn't know there is a common event Id 21, so it can't find the event command list when it goes to check for it.
So yes, I recently was toying with a common event to read the enemies MP (on one encounter though) and realized it didn't work so I removed the event. It was a new event so I have no idea.

*EDIT* Holy crap I just added another blank empty common event and everything works again...

While we're here can I ask why it is this happens? I feel like a big dum but this is a big learning process for me. Thank you so much for the quick response ramza, you're a G.
This happens when you try to reference a database item that doesn't exist. This is different from if you simply deleted the item and left it blank in the database.

A command like getCommonEvent(21) is going to look specifically for index 21 in the list of common events. If you have 25 common events in your database, but the 21st is blank, the event list is going to be blank, so nothing will happen. If you only have 20 common events in your database, DataManager.commonEvents[21] (or whatever the actual object is) does not exist at all. When the next step checks for the event list inside that common event, it fails because the event doesn't exist, so it can't read a property of something that doesn't exist.

The same thing happens if you create a troop of monsters out of a bunch of enemies, and then make the enemy list in the database smaller to delete the enemies you used. Battle testing that troop returns a similar, but different, error, because it's trying to read object properties of something that no longer exists.
That makes a lot of sense actually. I feel like I had something like this similar in the past through save data. Didn't realise that it read database to that extent however. It confused me because it was happening even in the Troop testing but it's interesting how it still finds it necessary. Even if the restored common event is totally blank.

Thanks for clearing that up @ramza . I'll be sure to be more aware of that in the future. I learn more about these program/s every day I swear haha.

Mods may close.
@Acidicjester Next time you can report your own post (little button next to the edit button) and request your thread to be closed. Mods don't always oversee all threads at all times so it's easy for us to miss a post asking for us to close a thread. But since I'm already here...

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/solved-please-help.129338/