How do I have an event on another map happen every X minutes?

As the title states above, I would like to have an event on a map that I am not currently on to happen every X minutes.

To help give a better understanding.

  • Talking to NPC in forest triggers an event in town in which a container begins to fill.
  • Every X minutes the number of items in the container increases, regardless of where the player is in the game.
The possible solution that I thought of was a common event, set to parallel based on the triggering event, with a wait set at the start of the event. The 2 problems I have with this are:

1)The less  parallel events running the better, and

2)The wait command only goes to 999, or just over 16 seconds. I want the event to happen about once every 15 minutes.

Thanks!
That's over complicating things~ Just have a common event set to parallel process, with a switch that is turned on by the forest NPC.

In the common event, just add to a variable you want to use for the number of items in the container.

Page 1 Event Commands >> Control Variables >> Single Var "items in container" >> Add Constant >> ## (number you want to add every 15 minutes)

Page 3 Event Commands >> Script Call >> wait(54000)

But doing it this way will make the wait reset if you end up saving and reloading, or perhaps changing maps (I believe) so a better way to do it would be to iterate a second variable you can use to time it.

Page 1 Event Commands >> Control Variables >> Single Var "items in container" >> Add Constant >> ## (number you want to add every 15 minutes)

Loop (Page 1 Event Commands)

  Page 2 >> Wait 60(frames)

  Page 1 >> Control Variables >> Single Var "container timer" >> Add Constant >> 1 (add a second to the wait)

  Page 1 >> Conditional Branch >> if Variable "container timer" Greater than or Equal To 900 (900 seconds = 15 minutes)

    Page 1 >> Control Variables >> Single Var "container timer" >> Set>> 0 (reset to 0)

    Page 1 >> Break Loop

  Branch End (end of conditional branch

Repeat Above (end of loop)
I don't know why I didn't think about the fact that a script call could break out of the restrain of the wait command. I had everything set up except that. Pretty much the way you had it listed above in the first example.

I didn't think about the variable to track the time, however. Thanks!!
To Avoid the Wait Methode Problem in this Case OP could use a Time Stamp.

Set a Time Stamp after getting your Event Activated for example:

Control Variable[1] = Others "GameTime"

Control Variable[1] += 54000 (54000=15mins, 1sec=60Frames. This is the new Time Stamp, Actual Game Time + 15mins)

Activate Switch of Common Event that runs the condition Loop.

Common Event example:

Control Variable[2] = Others "GameTime"

Conditional Branch Variable[2] is more or equal to Variable[1]

if yes:

Control Variable[1] = Others "GameTime"

Control Variable[1] += 54000 (54000=15mins, 1sec=60Frames. This is the new Time Stamp, Actual Game Time + 15mins)

Add your Items.

if no: nothing (maybe a 60 Frames Wait so this Condition just gets executed once per Seccond).

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-have-an-event-on-another-map-happen-every-x-minutes.38109/