Decreasing Party Members

Hey,
I'm trying to finish a short project using MV. Basically what I want is something that will allow me to take away party members after interacting with events. The game has no combat, instead you need to meet certain conditions to win fights, and if you don't then your party goes down by one member. I'm sure this is possible but I can't figure out a way to make it work repeatedly. Any help would be great.
There's probably a way to remove your last party member, but I don't know how. You can probably just use if statements though.

For example, you start with party members A,B,C, and D.

Lose fight.
If D is in party, remove D.
else if C is in party, remove C.
else if B is in party, remove B.
else (only A remaining) game over.

That way, every time you lose the fight, you will always only lose exactly 1 party member (starting with D), no matter the size of your party
Yeah that actually worked perfectly. I kinda feel stupid that it was that simple. Thanks a lot

Original thread: https://forums.rpgmakerweb.com/threads/decreasing-party-members.145406/