Time based gameplay

dude13579

Villager
Member
Joined
Jan 14, 2017
Messages
6
Reaction score
0
First Language
english
Primarily Uses
Would it be feasible to make something that would require a certain amount of time to pass in the real world before in Rpg maker? For example, you accept a quest, then you have to wait 3 hours for the quest to become available, probably using the date and time function because it needs to work even when the program is closed.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
21,779
Reaction score
10,999
First Language
English
Primarily Uses
RMVXA
'Tutorials' is where people who have made a tutorial for others to use can post them.

[move]RPG Maker MV[/move]
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
1,510
Reaction score
992
First Language
EN
Primarily Uses
RMMV
Yes, using a little scripting! Here's an example (source):
Code:
◆If:Self Switch A is OFF
  ◆Control Variables:#0001 timestamp = Math.floor(Date.now()/1000)
  ◆Control Self Switch:A = ON
  ◆Text:None, Window, Bottom
  :    :Come back in 10 seconds!
  ◆
:Else
  ◆Control Variables:#0002 check = Math.floor(Date.now()/1000)
  ◆Control Variables:#0002 check -= timestamp
  ◆If:check ≥ 10
    ◆Text:None, Window, Bottom
    :    :Such patience, much wow.
    ◆Control Self Switch:A = OFF
    ◆
  :Else
    ◆Text:None, Window, Bottom
    :    :I SAID WAIT!
    ◆
  :End
  ◆
:End
Here I've assigned a time value to a variable using Control Variables > Script:
Code:
Math.floor(Date.now() / 1000)
Date.now() gets the milliseconds since midnight on 1 Jan 1970. More details here: the Date object (MDN). Basically it simply stores the start time, then takes the difference between current and stored times to decide whether enough time has elapsed yet. :kaopride:
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

I was planning to release a useless plugin for april fools, but then I thought I let it be.
Tfw every dev around me is using Live2D in their MV games and make me question my skills repeatedly.

Spending the day reworking my maps, especially the first "biome". This time it's not even in the dark. :LZSwink:
Activity on the forums has increased lately, probably because of people staying home. The amount of work for moderators has increased lol.

Forum statistics

Threads
95,522
Messages
929,783
Members
125,791
Latest member
Oersted_LAL
Top