MZ Detect Killing Blow on Party

Hello,

I've tried searching but can't seem to find a plugin with this function.

Is there a plugin which allows you to detect which enemy in a troop dealt the killing blow to the player party, in the event of a defeat?

I would like to turn on a switch depending on which enemy defeated the player to run some specific events before game over.
no need for a plugin, that is basic eventing functionailty for MZ

control variable:game data: last enemy index to act
no need for a plugin, that is basic eventing functionailty for MZ

control variable:game data: last enemy index to act
Wow how did I miss this!?

To think I've used RPG Maker for so long and never seen that lol.

Thank you so much!

Edit:

Okay well it seems that is a useful feature but it isn't great for multiple different troops as it only takes their position in the troop into account instead of their enemy database ID.
Sorry to bump but I'm still looking for a solution for this which will take into account the database ID for use in a long chain of Common events. Instead of the troop ID.

Otherwise I will need to set up a huge amount of variables and conditions to find the correct enemy and avoid triggering the wrong event.
If you have a variable storing the index, you can simply set that to the ID with:
Code:
$gameVariables.setValue(X, $gameTroop.members()[$gameVariables.value(X)].enemyId());
where X is the ID of the variable being used.
If you have a variable storing the index, you can simply set that to the ID with:
Code:
$gameVariables.setValue(X, $gameTroop.members()[$gameVariables.value(X)].enemyId());
where X is the ID of the variable being used.
Thank you, I'll give this a go and see if it works! 🙂

Original thread: https://forums.rpgmakerweb.com/threads/detect-killing-blow-on-party.142118/