Event that counts down after player takes an action.

In my current project, the player can go into a battle arena (where the most action of the game takes place) and fight some enemies. To make the gameplay loop more interesting, I tried to make some events that restart after the player goes and returns from the arena. I'm a bit new to eventing more complicated stuff, so here is what I did:
1716710077708.png

First, a common event that sets up a switch corresponding to each of the major areas of the game. For now I'm mostly testing it in the park area.
1716710180645.png

1716710192329.png

Second, the event that's supposed to reset (there's more but as of now this is the one I have most trouble with.) The basic design idea is that once player prays at the shrine, a countdown starts that will go down for every trip to the arena (also im using Yanfly's mini labels to show the exact number left).
1716710371125.png

Finally the last event is a parallel that's supposed to run every time player enters the park (so the shrine event won't inifintely count down when player enters.).

I'm pretty sure I was on the right track, but I need some advice to make this actually work...
Ah... I see a few beginner mistakes. First, when you ran the event checking for the timer to be 0, you never turn off the A switch, so the event will keep running, even when the timer is set to 0.

In the "If var < 0" condition, you can add: "Turn self switch A off"

But if you want to make a cooldown timer in events, let me teach you a cool trick.
1716722957305.png


When I say "Time" below, I mean playtime, which is the number of seconds the game has been running.

Every time the character eats, it saves the time, in variable 103. And when drinking it sets the time in variable 104.

Then when trying to eat again, it checks [current time - last time eaten], which gives you the amount of seconds the game has been running after the last time you ate. And when trying to dring, it will do the same thing.

I hope this makes sense to you, but if you have more questions, please ask.

---

I used eating and drinking as an example to show you how to make that timer. You can use it for anything, as long as you have 1 variables dedicated to the last time the action was performed last.
Thanks for the example! Although I'm more interested in making events that work independant of the gameplay time - since that would probably at some point reach a maximum number, right?

Also one thing that I didn't mention in the original post is that the "shrineWait" value seemingly doesn't decrease at all. My best guess at that is because for some reason the game runs the pararell event before the shrine event.
Thanks for the example! Although I'm more interested in making events that work independant of the gameplay time - since that would probably at some point reach a maximum number, right?
Huh? No, that goes on forever.


Also one thing that I didn't mention in the original post is that the "shrineWait" value seemingly doesn't decrease at all. My best guess at that is because for some reason the game runs the pararell event before the shrine event.
The reason is because you turn that switch of straight away, in a parallel event. As soon as that switch is off, the parallel depending on it stops running
The reason is because you turn that switch of straight away, in a parallel event. As soon as that switch is off, the parallel depending on it stops running
so how can I make it so the order of action is:
  1. Player enters the map with the main switch on.
  2. Shrine event counts down
  3. The main pararell event turns of the switch.
If you want to see if the number degrees, put "test \v[30]" instead of "test"

The reason it keeps looping, is because you never turn the A switch off. At the very end of the event, put: "If ShrineWait = 0, turn self switch A off"

Why are you using parallel events anyway? This should be autorun events, I feel.

Also... If you take that test message out, it will almost instantly go back to 0. You need to put something like "Wait 60 frames" or "Wait 300 frames" at the end of the event. 60 frames = 1 second.

If there is going to be a message, then you shouldn't make this a parallel event, but an autorun event.

Original thread: https://forums.rpgmakerweb.com/threads/event-that-counts-down-after-player-takes-an-action.169005/