Okay, so I've had this bug for a good month now, and finally narrowed it down to either this plugin or a fault in stock Essentials v19.1. I do not have the time today to eliminate this plugin, and am posting here to see if you can replicate it, and if so, see whether it can be fixed. The error in question only occurs while playing a game nonstop for 5 hours or more, and only happens when that condition is met and the player tries to use any move defined in the PokeBattle_Clauses script, like Sonic Boom or Dragon Rage, multiple times in a battle. In most cases, the crash can be triggered before using the offending move 4 times, but sometimes using the move up to 10 times is required.
To test this error, I created a trainer about halfway through the game story-wise that had a level 80 Blissey with only Defense Curl as its move.
For testing, I used a level 10 Voltorb that I generated via Debug. I then played the game until I reached that trainer, and was able to reproduce the crash with 80% reliability. I have several plugins installed, so I migrated my PBS and Data folders to a barebones PE v19.1 installation, replacing everything except the Scripts.rxdata file. I then added in only the plugins that could not possibly have caused an issue, such as 'EVs and IVs in Summary' and the v19.1 Hotfixes plugin, as well as scripts that could not possibly be the offender, which included the speedup scripts 'Better Fast Forward' by Marin, and PokemonSelection by FL. I tested with both the ZUD plugin and the Generation 8 Project installed, then tested with only the Generation 8 Project. The bug only presented itself when the ZUD Plugin was installed alongside the Generation 8 Project, eliminating the latter as the culprit. It is still possible that one of the hotfixes within the Generation 8 Project fixes the bug with stock Essentials, and it is also possible that my testing of the lone Generation 8 Project was just 'unlucky'. Time will tell.
Actually, upon further consideration, it HAS to be the ZUD plugin, since if the Generation 8 Project fixes the supposed bug with stock Essentials, then the 2 plugins together would not have the error. I realized this while typing this message. So please, if you are developing a fan game that has the ZUD plugin, and have at least 10 hours of gameplay playable currently, playtest the game from beginning to end in one sitting, inserting 2 trainers in your test version, like my test case, one at the 5 hour mark, and one at the 10 hour mark, when you get the time. Something in the ZUD plugin is poorly optimized and has unterminated processes that pile up, causing the error.
Here is the error I have come across: