Pausing A Variable Based Time System

Hi,


I have a standard variable based time system with variables for seconds, minutes, hours, and week days set as a parallel common event. What I'd like to do is pause the time when I enter certain maps(like indoors), and then resume time when I leave them. Predictably I tried to turn the event switch off for when i enter these maps, but it resets the timer whenever I leave. Any ideas how I could do this through eventing?


Edit: So the variables are all set to increase by one. I'm wondering now if I could turn on a switch in all maps that I want time to stop. Then I could wrap my time system common event in a conditional branch that states 'If "aforementioned switch" is off, run all of the variables as normal'. BUT, in the else section I could copy/paste the variable system, but instead of having the seconds variable add by 1, I could set it to add by zero. That way the common event would stay on, but the seconds wouldn't go up, which would keep the minutes, hours, and days from going up. Thus pausing, but hopefully not resetting, time. Let me know if this sounds like a feasible idea. I have to go to bed, so trying it will have to wait haha
Turning off the parallel event that counts time is the correct way to do this.


If that doesn't work, youmade a mistake in the event logic somewhere, and without seeing the commands we can't tell you where.


Best guess? you placed the time initialisation into the parallel process that counts the time - that is always a bad idea.


Post screenshots of your time events and we can tell you how to improve them
For the time initialisation you mentioned, if I'm thinking of the right thing, I put it into a non-common event on autorun. You'll see in the second picture. Hopefully this helps. 


Screenshot (2).pngScreenshot (3).png


Edit: I tried my own suggestion in the edit in post #1. I tried containing the common event in a conditional branch that stated "If SWITCH Time Pause is off, than the clock runs normally. ELSE, if SWITCH time pause is on, then the seconds variable is set to increase by zero to pause time.


Now, I set an event on an indoors map to switch the Time Pause on, and then I put erase event afterwards. It's on autorun.


Time does pause when I do this, but not until I exit the indoors and reenter outside. Also, I can't figure out how to resume time. Been messing with switches and calling common events, but I can't seem to get time to reactivate again once it's been paused. So two issues with this:


-Time doesn't pause until I exit the map I want it to pause on.


-I can't get time to resume.


-I'll post two shots of the modified common event for reference. Note the 0 in the seconds variable.


Screenshot (4).pngScreenshot (5).png
your problem is the loop command - a time system should rely on parallel processes and NOT on a loop.


And unless you know exactly what you're doing, you should never use a loop inside a parallel process.


The first variant (in your first screenshot) already was almost perfect - you only need to completely remove the loop command from it, and it will work as intended.


As for stopping time on a map, use a self-erasing autorun to stop the time on entering the map (by control switch "clock beginning" off), and edit all transfer commands to leave the map to include a control switch ON before transfering the player
Worked like a charm, thanks a lot! And I totally get why it wasn't working now too. When I'd reset the switch before, it would start the loop over.

Original thread: https://forums.rpgmakerweb.com/threads/pausing-a-variable-based-time-system.70316/