MV Finding the Id of this.battler

Hi All,

I am trying to write a bit of script to adjust the location of the state overlay. What I have so far is this:
JavaScript:
this._battler == $gameActors.actor(4)
which works fine.

What I need is a way to determine the enemy id of "this.battler". Something along the lines of this:
JavaScript:
this._battler.enemyId() == 45

But like a way that actually works. Is this even possible? Please let me know if you need any addition information. Any help would be greatly appreciated.
if this._battler can be any battler, youd want to make sure its an enemy with isEnemy() before you try to use enemyId(). an actor isnt going to have an enemyId()
if this._battler can be any battler, youd want to make sure its an enemy with isEnemy() before you try to use enemyId(). an actor isnt going to have an enemyId()
I see, would you know how I would write that?

would it be something like:
JavaScript:
this._battler.isEnemy() && this._battler.enemyId() == 45
would it be something like:
JavaScript:
this._battler.isEnemy() && this._battler.enemyId() == 45
it should work. did you encounter an issue?
it should work. did you encounter an issue?
Unfortunately not, I get a "Cannot read property 'isEnemy' of null" error.

UPDATE: It was a plugin conflict. I got your suggestion working! Thank you so much for your help!
Unfortunately not, I get a "Cannot read property 'isEnemy' of null" error.

UPDATE: It was a plugin conflict. I got your suggestion working! Thank you so much for your help!
you got it working, but just to add it in - StateOverlay sprites do initialize with their _battler being null. if you do get the issue again, try
Code:
this._battler && this._battler.isEnemy() && this._battler.enemyId() == 45
to catch the possibility of it being null at the time of checking

Original thread: https://forums.rpgmakerweb.com/threads/finding-the-id-of-this-battler.177457/