Check to see if character is unaffected by state error

Hello!!

So what I'm trying to do is during a random turn in combat, check to see if one of my characters is unaffected by a specific state and, if so, add that state during that turn. This is what I tried just to see if it works:

!$gameActors.actor(1).isStateAffected(11)

But for some reason I keep getting this error:
Cannot read property 'opacity' of null

Not exactly sure what is happening cuz I checked other forums and what I have seems to be right. Any help would be nice. Here's some screenshots. THANK YOU!!
1) please give a screenshot of the console when the error happens (press F8).
there is a good chance that the cause is something else.

2) does this happen when you start a new game or only if you continue a saved game?
1) please give a screenshot of the console when the error happens (press F8).
there is a good chance that the cause is something else.

2) does this happen when you start a new game or only if you continue a saved game?


Ummm....funny story. I actually figured it out a little bit after your reply. One of my plugins seems to be conflicting with that script that I made ^^;. Lol sorry for wasting your time.

Funny enough it only happened in battle testing. When I started a new game it worked perfectly......no idea what happened there ^^;
Battletest contains shortcuts to prevent the need to load the full project.
but that means that a plugins that is not handling itself with those shortcuts can't be correctly loaded, and that causes such errors in the same way (and for the same reasons) that using a "continue" can miss new plugins.

Original thread: https://forums.rpgmakerweb.com/threads/check-to-see-if-character-is-unaffected-by-state-error.99802/