Changing Party KO to not end the game

I'm trying to configure the RMMV battler in a way that when all party members enter the knockout state (0 HP) that it doesn't just dump into Game over. I've tried a few settings, like if actor HP <= 0% then remove the knockout state, and run an event to check to see if it's actually game over or not.

IF I have events that cause a player to enter combat, using the event page I can prevent the game ending due to knockout. However, I don't want to create umpteen thousand events for every possible encounter, and I'd like to set it up in a dynamic way that any time the player enters combat, if the whole party gets KO'd it performs a check prior to just skipping ahead to Game Over.

Goal in Psuedo Code:
if all members of party hp = 0
{
Remove knockout state from all members,
Call common Death Event to perform checks to see if the game is really over
If the game isn't over, do some stuff
Else, Game Over.
}

Can anyone help point me in the direction to look to make this happen?
I'm hoping it's a core configurable possibility, although I'll use an addon if I have no choice.
you can do that in the troop event (if you want never be game over) you can check a box that skips the
game over screen and return them back to the map

tab 3 -> battle processing -> you can check there if the player can lose or not, if they can lose, they wont get a game over screen.
this must be done to every troop enemies you have.

idk if there is a simple scripcall for parallel process that checks the battle and "can lose" command
so the only way to get the game over screen is to call it yourself

by example, make a variable, if lose +=1, if its 3 it will be game over (would be harder if they save it in between)
Ahh! yes, I did that in my event page. Thanks for helping me find that again. Feeling a bit dummy 😉

Original thread: https://forums.rpgmakerweb.com/threads/changing-party-ko-to-not-end-the-game.110700/