RMMV: Enemy state overlays

I'm trying to get state overlays to display on enemies in battle, but am running into problems. I've tried the following on MV v1.5.0 with no other plugins installed:

Enemy State Overlays v1.00
By DreamX

https://forums.rpgmakerweb.com/index.php?threads/enemy-state-overlays.53373/#entry526779

More state overlay v1.04
by Hakuryo

https://forums.rpgmakerweb.com/index.php?threads/more-state-overlay.47886/



With DreamX's, I get the following error when starting a battle: TypeError Cannot read property 'setup' of undefined

With Hakuryo's I get no error, but no overlays on the enemies. The EnemyOverlay parameter is enabled.


I did also try Yanfly's X_VisualStateFX plugin, and was finally able to get the overlays to display, but that entailed running two additional core plugins and a bunch of features that I don't want.
OK, after a good bit of trial and error I managed to get something to work.

DreamX's code was designed to be compatible with Yanfly's Animated Sideview Enemies, and I found if I had that plugin running, I had no error on battle start and the overlays showed. The code has an If/Else branch that checks for Yanfly's plugin. The "If" part seemed to work fine, it was the "Else" bit that threw the error on battle start if I wasn't running Yanfly's plugin.

I rewrote it so that it just ran the "If" part and no longer had a conditional. Now everything works, with or without Yanfly's plugin.

I'm glad I got it to work the way that I wanted, but I'm still scratching my head as to why I had to mess with the code in the first place.

Original thread: https://forums.rpgmakerweb.com/threads/rmmv-enemy-state-overlays.98178/