Actor gains state after defeating enemy MZ

I was wondering if there was a way to add a state to an actor when they defeat an enemy.
For example Actor 3 kills an enemy after that they gain a state the "Motivated" state for 1 turn.
Using VisuStella Battle Core, put the notetag into your skill:
Code:
<JS Post-Damage>
if (target.isDead())
    user.addState(id);
</JS Post-Damage>
replacing "id" with the appropriate number.
or simply make a troop event conditioned on enemy HP = 0 that gives the state to the actor.
is a bit tricky to identify the actor, but would not need a plugin
or simply make a troop event conditioned on enemy HP = 0 that gives the state to the actor.
is a bit tricky to identify the actor, but would not need a plugin
You can do this, but then you need also to go through the complexity of making enemies immortal and having this troop event for each one to apply the effects before letting the enemy die. On top of correctly identifying the actor. (not sure at that point I'd classify it as "simply" 😉)

Unless this state expires at the end of battle anyway and you don't care about it not applying when you kill the last of the troop.
I think I will just apply it to a certain skill so it's easier to use.

Using VisuStella Battle Core, put the notetag into your skill:
Code:
<JS Post-Damage>
if (target.isDead())
    user.addState(id);
</JS Post-Damage>
replacing "id" with the appropriate number.
I input the code in the Notetag of the skill and the state didn't apply to the user upon the enemy's defeat. I do have Visustella's Battle too.
Maybe it doesn't apply the death state until after the attack resolves. You can try
Code:
if (target.hp<=0)
Maybe it doesn't apply the death state until after the attack resolves. You can try
Code:
if (target.hp<=0)
This worked like a charm.

Original thread: https://forums.rpgmakerweb.com/threads/actor-gains-state-after-defeating-enemy-mz.150952/