Parallel Process continue to run in battle

Hello.  What I need help with is a countdown sequence.


Here's the scenario: You've just made it to the end of a dungeon, and have encountered the Big Bad of that area.  He laughs and pushes a button, and now you must escape in 5 minutes, or you shall be blown to smithereens.  Now just having a leisurely stroll out of the dungeon would be no fun now would it?  So you must walk out while trying to speed your way through enemy encounters.


I have the timer displaying properly and when it reaches 0, you die.  The problem, is the logic behind the scenes doing the actual countdown (an invisible event counting down 600 frames 10 times before killing you) restarts after a battle.  So when you enter a battle, the visible time for the player keeps counting down, but the invisible one stops completely, and starts over upon battle end.  If you encountered an enemy with one second left on the clock, you'd see the timer reach 0:00, but you'd really have 5 minutes as soon as the battle ends.


What I want is for the event to keep counting down frames, while in battle, I guess is what I'm trying to say.
I've moved this thread to RGSS Script Requests. Please be sure to post your threads in the correct forum next time. Thank you.
Oh, this has to be solved using scripts?  Sorry, I thought something could be done with events.
And why you need this "invisible counter" and don't just use the actual timer for the event?
I didn't see a way for an event to activate upon the timer running out, so the invisible timer is what activates the game over when time runs out.  The normal counter is for showing players the time left.
Create a switch, call it 'Timer started' or something. Set it to true when the big bad pushes the button.


Create a common event, call it Timer finished or something. Set it to parallel process while 'Timer started' is true.


In the common event, create a conditional branch that checks for the timer being 0 min 0 sec or less. 


Inside the conditional branch, put the Gameover command.
Hey, that's just what I was looking for!  Thanks!


I feared that if you were in battle and the countdown reached 0, it wouldn't activate it until after the battle, but that appears to not be the case.  The battle will end abruptly and you get the game over. 


Once again, thank you!

Original thread: https://forums.rpgmakerweb.com/threads/parallel-process-continue-to-run-in-battle.55944/