Ok, so I'm trying to make that, when you mine from a boulder, you have to come again in 3 hours or so, but the game can be closed, anyone knows how to make it?
Time
RPG Maker MV Supportso you want a dynamic time system? rather than ingame time system?
Dynamic timeSystem is a bit more complicate to use, as it need probably
constant checked or every 60 frames as lowest (1 second per time).
than you need a 3 variables, (hours, minutes, seconds).
creating it is the easy part, remember the time used last to add +3 for
the next is harder, which I didn't test how to impliment yet, but it is
certainly possible.
Dynamic timeSystem is a bit more complicate to use, as it need probably
constant checked or every 60 frames as lowest (1 second per time).
than you need a 3 variables, (hours, minutes, seconds).
creating it is the easy part, remember the time used last to add +3 for
the next is harder, which I didn't test how to impliment yet, but it is
certainly possible.
You probably need to access the system time for that, if you want the timer to still "run" when the game is closed. you can then compare the time the event had when the game was closed to the time it was opened again and determine how much is left, if any.
You can easily check the actual time with js using Date.now() which returns a precise timestamp in ms.
So you could get a time stamp for the initial event and save it in a game variable with the script call:
Where NUMBER is the variable ID you want to use
Then you can check if that game variable / 3,600,000 > 3. (The number is in ms for precision so we convert to hours).
So you could get a time stamp for the initial event and save it in a game variable with the script call:
Code:
gameVariables.setValue(NUMBER, Date.now())
Then you can check if that game variable / 3,600,000 > 3. (The number is in ms for precision so we convert to hours).
Original thread: https://forums.rpgmakerweb.com/threads/time.150794/