Is there a way to trigger a common event when enemy dies?

I suppose I don't need to write much more than just the title's question:
Is there a way to trigger a common event when enemy dies?

My goal is to have a player attack a lever during combat which triggers a common event during combat and then ends the fight. Is that possible through some means I'm not thinking of?

Thanks for your time.
troop events have a condition that is triggered by specific enemy HP values
no need to make that as a common event, you can handle it directly as a troop event.
troop events have a condition that is triggered by specific enemy HP values
no need to make that as a common event, you can handle it directly as a troop event.
Without a plugin it won't trigger on the last enemy death because the battle ends there
@AquaEcho wrong, there is a workaround with pure eventing, no plugin needed.

and I didn't mention that because from the description the OP wants that to happen before the last enemy is killed, so that exception is probably not needed.
@AquaEcho wrong, there is a workaround with pure eventing, no plugin needed.

and I didn't mention that because from the description the OP wants that to happen before the last enemy is killed, so that exception is probably not needed.
Is that the workaround where you give your enemy more HP than they actually have and use a non-zero percentage for the event condition, or something different?
something different?
You create an immortal state and use one troop event to give it to every enemy. then make one troop event on HP=0 for every troop where you do what you want to happen before removing the immortal state.

The immortal state prevents the enemy death until the event has happened and then kills the enemy by removing the immortal state.
You create an immortal state and use one troop event to give it to every enemy. then make one troop event on HP=0 for every troop where you do what you want to happen before removing the immortal state.

The immortal state prevents the enemy death until the event has happened and then kills the enemy by removing the immortal state.
Ah yeah, that one. Cheers.
I got it to work. Thanks for your help.

Original thread: https://forums.rpgmakerweb.com/threads/is-there-a-way-to-trigger-a-common-event-when-enemy-dies.162563/