Calendar & Clock tutorial RPG Maker VX Ace and MV - Part 1

- Intro
- Variables and Switches
- Setting up date and time
- Setting up lightning (in part 2)
- Setting up weather (in part 2)
- Examples to use (in part 2)

This should works for at least RPG Maker VX, VX Ace and MV. I assume older versions too, but I am not entirely sure.

Making a day and night system rpg maker, is not hard. There is a little math involved, but other than that, it is just a lot of work.

I made this system using a common event. To use this system, there is no plugins required. This is all done using 10 variables, 2 switches and one common event.

With this common event, 1 second playtime, is 1 minute in the game. This make time tun 60 times as fast as real life.

1 minute | 1 second
1 hour   | 1 minute
1 day    | 24 minutes

Every month has exactly 30 days. And a year has 12 months. This makes a year 360 days.

1 month | 12 hours
1 year  | 6 days

Yes, a month is exactly 12 hours, and 1 year is exactly 6 days. Isn't that something? Take out your calculator, and do the math: 360 days, but 60 times as fast: 360/60=6

In this tutorial, I use the following variables:
- Weather
- YYYY/../.. ..:..
- ..../MM/.. ..:..
- ..../../DD ..:..
- ..../../.. HH:..
- ..../../.. ..:M.
- ..../../.. ..:.M
- Total Hrs Sleep
- Sleep(Temp)
- Sleep input

And I use the following switches:
- Outside
- Lights

ID's don't matter, but this way you can easily see which variables and switches I use. To make it easier, you may want to use 10 variables in a row, and pair your switches together.

I did all the math. I will talk you trough it. First we check how long the player has been playing. You do this by selecting Game Data → Playtime. If done right, it should look like this:
Control Variables:#0035 ..../../.. ..:.M = Play Time
* Note: Don't forget ↑↑↑↑ This ID might be different for you.

The next thing we do, is add the amount of time slept by waiting/sleeping.
Comment:\\Add sleeping/waiting hours.
Control Variables:#0037 Sleep(Temp) = Total Hrs sleep
Control Variables:#0037 Sleep(Temp) *= 60
Control Variables:#0035 ..../../.. ..:.M += Sleep(Temp)

I like to put comments within my events, so it is clear what happens where. You don't have to take over the green lines, but they can't hurt.
I use a temporary variable, because time is skipped by the hour, and time is proceeding by the minute.

What we have now, in ..../../.. ../.M = Game minutes passed + minutes skipped my sleeping or waiting.

The next step, is setting up the hours:
Comment:\\Minutes -> Hours
Control Variables:#0033 ..../../.. HH:.. = ..../../.. ..:.M
Control Variables:#0035 ..../../.. ..:.M %= 60
Control Variables:#0033 ..../../.. HH:.. -= ..../../.. ..:.M
Control Variables:#0033 ..../../.. HH:.. /= 60

The first line is just taking over ALL the minutes from the other variable.
The second line deletes all complete hours from the minutes. To use set up %=, select “Mod” in the “Operations” section of “Control Variables”.
The third line deletes the lose minutes, and leaves ..../../.. HH:.. with full hours worth of minutes.
The last line converts the minutes to hours.

Now in ..../../.. HH:.. we have the total full hours played. The remaining minutes are in ..../../.. ..:.M.

We do the same thing for hours into days, then for days into months, and then for months into years. Keep in mind that every month in this case has 30 days.
Comment:\\Hours -> Days
Control Variables:#0032 ..../../DD ..:.. = ..../../.. HH:..
Control Variables:#0033 ..../../.. HH:.. %= 24
Control Variables:#0032 ..../../DD ..:.. -= ..../../.. HH:..
Control Variables:#0032 ..../../DD ..:.. /= 24
Comment:\\Days -> Months
Control Variables:#0031 ..../MM/.. ..:.. = ..../../DD ..:..
Control Variables:#0032 ..../../DD ..:.. %= 30
Control Variables:#0031 ..../MM/.. ..:.. -= ..../../DD ..:..
Control Variables:#0031 ..../MM/.. ..:.. /= 30
Comment:\\Months -> Years
Control Variables:#0030 YYYY/../.. ..:.. = ..../MM/.. ..:..
Control Variables:#0031 ..../MM/.. ..:.. %= 12
Control Variables:#0030 YYYY/../.. ..:.. -= ..../MM/.. ..:..
Control Variables:#0030 YYYY/../.. ..:.. /= 12

What we have now, is all time that has passed in the game. If you now start a testplay and run the common event, you can find the exact times in the variables. 

But now we have to convert this into the current time and date. Variables start at 0, which is perfect for hours and minutes, it is bad for days and months. Those start counting at 1. So, lets correct this:
Control Variables:#0032 ..../../DD ..:.. += 1
Control Variables:#0031 ..../MM/.. ..:.. += 1
Control Variables:#0030 YYYY/../.. ..:.. += 1482

Replace 1482 with any year you want to start you game in. But do NOT change the days and months here! This is pure for calculation, NOT for setting the starter date!

Something else that needs fixing is the minutes. If you would run a message \v[33]:\v[35] now, that would show a quarter to nine, like 8:45. Totally fine. But five past nine, with show as 9:5. We ill fix this using another variable. You might have noticed before there is 2 variables for minutes. Here is what we do with this:
Comment:\\Minutes Correction
Control Variables:#0034 ..../../.. ..:M. = ..../../.. ..:.M
Control Variables:#0035 ..../../.. ..:.M %= 10
Control Variables:#0034 ..../../.. ..:M. -= ..../../.. ..:.M
Control Variables:#0034 ..../../.. ..:M. /= 10

Hooray!!! We now have a completely functional clock and calendar! 

But to make it a little more slick, we're going to name our months. Because all months have 30 days, real months won't look perfect, but for a fantasy game, we will just make our own months:
Comment:\\Months Correction
If:..../MM/.. ..:.. = 1
Control Variables:#0031 ..../MM/.. ..:.. = 'Janimonth'

If:..../MM/.. ..:.. = 2
Control Variables:#0031 ..../MM/.. ..:.. = 'Febrimonth'

If:..../MM/.. ..:.. = 3
Control Variables:#0031 ..../MM/.. ..:.. = 'Marchmonth'


Repeat this until you have a name for all 12 months.

Change the names of the months to whatever you like. But for the example, this will work.

If we now make a text message like this:
Time: \v[33]:\v[34]\v[35]
Date: \v[32] \v[31], \v[31]

It should look like this:
Time: 0:03
Date: Janimonth 1, 1482

If you try this, and you get only zero's, or the wrong number, then remember: Your might have used other variable ID's than I did.

In my case it says 0:03, cause I triggered the common event after 3 seconds of game play. If you run it again after 90 seconds, it will say:
Time: 1:33
Date: Janimonth 1, 1482

We're not done yet. The next step is setting up day and night. We want it to be dark every time you go outside at night, right? And how about a weather system? Rain increases or decreases slowely, so you will never go from storm to sunny within some steps in between. We will set this up in the next post.

Kudos: You're here quick! I have not written the second part of the tutorial yet. The link will be added here as soon as it is finished.