Upon Game Over, a variable becomes equal to last EnemyID

Let's say I want to create custom game over text based on the last enemy that went (AKA the one to cause you to lose). But how would I do this with variables? Like, get the enemy ID of the last enemy that attacked, then make the variable equal to it. That, or am I missing something much easier?
You could put something like \v[10]=a.id (might be a.enemyId) at the start of every damage formula, or ask for a plugin to be written.

But you would also need to override the default gameover behaviour - unless this is an evented battle and you have "continue even when lose" checked.
I could probably just do the first option, and I would have a way to override the default...if SRD's GameOverCore actually worked, that is. If there's any others I can use, I'll update this.
you might have problems if actors and enemies can use the same skill (like attack) - if an actor used the skill and had the 'confused' state, or any state that caused them to attack their own party, you might end up with a gameover and an actor id in the variable rather than an enemy id.
That's true, at least if "v[10]=a.id (might be a.enemyId)" (Which you stated earlier) returns an ID regardless of enemy or actor. I have yet to test it, though.

Original thread: https://forums.rpgmakerweb.com/threads/upon-game-over-a-variable-becomes-equal-to-last-enemyid.89933/