MV Plugin to change character graphic when HP is 0

This is doable through common events, I know, but I think a plugin probably makes it simpler to return actors to their normal character graphic once they're alive again.

Anyway, I'm just looking for the plugin to change the actor graphic on the game's maps rather than in battle, as I opted for the front view system. If possible, I'd also love it to shift a dead actor to the rear of the party, since a clearly dead person leading a group looks really, really weird. If that's not simple to do though, I'll make do with the graphic changing.
Have you tried it with a passive state? That would only help with the image changing part, not so much the party rearranging.

Edit: Here's the easy part. Stick this into a plugin, then call an event at the end of battle that, in a script box, calls PushDead()

It should reorder your party with dead members at the end. The other stuff should be doable with passive states - have it trigger at 0 HP and change the actor's map sprite to one that has the dead body in all cells.

Code:
function PushDead()
{
    if ($gameParty.aliveMembers().length==$gameParty.members().length)
        return;

    var deadIndex=$gameParty.members().length-1;
    while ($gameParty.members[deadIndex].isDead()
        deadIndex--;
    
    for (var i=0; i<deadIndex; i++)
    {
        if ($gameParty.members()[i].isDead())
        {
            $gameParty.swapOrder(i, deadIndex);
            deadIndex--;
        }
    }
}
No, I haven't. It was my original idea, but I was hoping I could get a plugin made to streamline the whole process. If that's a difficult thing to request for free, I might have to make it a paid offer.

EDIT: @ATT_Turan Oh, neat little scriptlet! I'll definitely give that a shot. One thing for the passive state though: I can't put a sprite change in the normal traits box for a state, so I figured I'd have to use a parallel process with a conditional branch to achieve the effect. Is there a lunatic code script to do it instead?

Original thread: https://forums.rpgmakerweb.com/threads/plugin-to-change-character-graphic-when-hp-is-0.145164/