Get Index of Enemy in State

  Unsing Yanfly's Buff and States Core, I need a command to get the enemy index of the enemy who is has the state.
Depending on which state note tag you're using, it's either going to be user or target in the snippet below. (user if it's a turn end, action end, target if it's apply for example)


var stateindex = (user.isEnemy() == true ? user.index() : -1)


If the user of the state is an enemy, stores it's index in var stateindex. If it's not an enemy, it stores a -1 in stateindex.


That should work for you, though I haven't tested it myself.
 Ah.


Thank you very much.

Original thread: https://forums.rpgmakerweb.com/threads/get-index-of-enemy-in-state.66197/