Adding Actors Mid-Battle using Yanfly's "Visual Battlers" Script

Hi,
I'm using Barreytor's edit to Yanfly's Visual Battlers script found here on Pastebin.

The edit's main feature is to change an actor's sprite to be sideways when they have the death state. The original script does not have this feature and doesn't produce an error.

When attempting to add an actor mid-battle (from in game or from the Battle Test in the database), I get the following error:

xQBBuQV.png


I've tried tinkering with the script a little bit, but I have limited knowledge of RGSS3.

Any help is appreciated. Thanks!

Original thread: https://forums.rpgmakerweb.com/threads/adding-actors-mid-battle-using-yanflys-visual-battlers-script.40325/