How to make enemies kill themselves after using specific skill

So basically i want this skill, when activated, to kill it's user after the ability is finished attacking the entire team, what is the best way to do this?
1761236491982.png
you can use a common event to get the actor ID / enemy index of the last battler to act and apply the death state to them
Try to put a.setHp(0) next to the damage to see if it matches your idea, like:
Code:
200;a.setHp(0)
Try to put a.setHp(0) next to the damage to see if it matches your idea, like:
iirc setHp triggers a refresh, so the skill will hit the first target, kill the user, and wouldnt hit the rest of the targets

Edit: also skills do the damage of the last statement's value. you'd want to put the 200 after the setHp call. setHp last would make the skill do 0 damage since its value would be undefined
Do i use Force Action here? It demands a specific target
1761238507185.png
Do i use Force Action here? It demands a specific target
no. for actors, you can use the change state command and use the variable with the actor's ID to specify them.

I thought the change enemy state command had a variable option, but i was mistaken. at that point you could use a script call
Code:
$gameTroop.members()[$gameVariables.value(x)-1].addState(1);
replace "x" with the ID of the variable you have the enemy index in. No leading zeroes
You would need an actor version and an enemy version of the skill get the right battler each time.


you would need the info for the last battler to act, not the one targeted
get the actor ID / enemy index of the last battler to act

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-enemies-kill-themselves-after-using-specific-skill.180674/