MV Check if actor or enemy receives a state

I am using Yan's Buffs and States core... I'm trying to figure out how to execute some events if the state is being added to an enemy. Something like this:

<Custom Apply Effect>
if (state being added to = troop/enemy)
{
do such and such
}
</Custom Apply Effect>

I was doing some research but couldn't find anyone with similar problems.
What exactly are you trying to do because Custom Apply Effect applies when the state is applied
sounds like they trying to get common event to run when state is applied to an enemy.
but buff/state core isnt even needed for that.
can have the skill that is adding the state also run common event.
whether the event is triggered by the skill or a custom apply effect it would still be the same thing,
the event would need a series of conditional check to figure out which enemy the state was applied to and then do stuff to that enemy.
this is usually just done with an invisible "target" state and the event checking for that state.
(remember to remove the target state with the event too.)

custom apply effect would be used to skip the whole event checking each target for the state before doing stuff and just do the stuff directly.
for someone to help with that coding we would need to know exactly what the event was intending to do to the target.
What exactly are you trying to do because Custom Apply Effect applies when the state is applied
Well, I'm basically just trying to figure out how to check if the state is being applied to an enemy. If it is being applied to an enemy, run some code. This code is only to be processed if a certain variable is enabled, in this case, a special party skill called Vampire which is a skill that works only using code and variables.

I'm just basically just trying to figure out how to check if the state is being applied to an enemy so it runs this code only once per enemy it is applied to.

-Edit-
Knowing how to do so will also help me with keeping track of variables that check how many enemies have been applied with X state to complete achievements or something.
A <custom apply effect> only happens if the state was successfully applied, so anything you put inside that tag will only happen if the state had been successfully applied. The script inside can safely assume the state had been applied, otherwise that block of code wouldn't be running.
Code:
<custom apply effect>
console.log('state applied!')
</custom apply effect>
Putting just this example will show that the text only shows up in the console if the state has been applied successfully. So if an enemy resists it, this code doesn't happen at all.
A <custom apply effect> only happens if the state was successfully applied, so anything you put inside that tag will only happen if the state had been successfully applied. The script inside can safely assume the state had been applied, otherwise that block of code wouldn't be running.
Code:
<custom apply effect>
console.log('state applied!')
</custom apply effect>
Putting just this example will show that the text only shows up in the console if the state has been applied successfully. So if an enemy resists it, this code doesn't happen at all.
Lmao, I understand how it works, I just need to know how to check if the state was applied to an enemy and not to an actor since both can receive this state. But I want to check if it's the enemy receiving it, and if it is, then do so and so.
Gotcha.
Code:
<custom apply effect>
if (target.isEnemy()){
    //do stuff
} else {
    //do other stuff
}
</custom apply effect>

Original thread: https://forums.rpgmakerweb.com/threads/check-if-actor-or-enemy-receives-a-state.133918/