This tutorial is a day/night system with optional features such as months and years, random weather that changes according to in-game seasons, and a pop-up clock that can be activated at any time. Since the coding for the more complex ones relies on the Day/Night system, I felt it made sense to put them all into one tutorial.
I have colour-coded the tutorial so that any features you do not want to do can easily be skipped. Coding for the day/night system is normal text, the yearly cycle events are in bold, random weather events are in italics, and the pop-up clock is in both bold and italics. You can remove any or all of these features, and the others will work correctly, but having all of these adds extra features that some programmers or RPG-players may want.
To set our day/night system up, we need to go to Common Events (Tools, Database, Common Events). For our first event, we should create an event called Time Calculator. Make it a parallel processing event, and give it a switch called “Time Passing”. Turn this switch on when you want time to start updating, and turn it off while you want time to stop. The very first thing we need to do is set the time when we will first be using the event. If you don’t, your event will start at midnight.
Conditional Branch: Switch Start Time Changed == ON
Else
Switch Start Time Changed == ON
Variable Hours = Hour of start of RPG (You might want to start at 8:00am, so set this to 8)
For those implementing a yearly cycle:
Variable Days = Day of start of RPG
Variable Months = Month of start of RPG
Variable Years = Year of start of RPG.
Now, we need to set how the time progresses in the RPG.
Wait 20 Frames (1 second on RPG XP unless it is changed to run 40fps.)
Minutes + 1
For those implementing a yearly cycle:
Variable Minutes 2 + 1
Conditional Branch Minutes 2 >= 30
Variable Minutes 2 – 30
Variable Half-Hours + 1
(This is to change the length of day and night later in the coding, with a half-hour change being less obvious than a whole hour of change.)
Conditional Branch Minutes >= 60
Variable Minutes – 60
Variable Hours + 1
Conditional Branch Hours >=24
Variable Hours – 24
For those implementing a yearly cycle:
Variable Days + 1
Conditional Branch Days > 10
Variable Days – 10
Variable Months + 1
Conditional Branch Months >4
Variable Years + 1
Variable Months -4
Here, I have set up my game so that there are ten days to a month, and four months to a year. Obviously, you can change the amount of hours in a day, days in a month, and onths in a year, and it is not a large task to set up a system like the traditional European Calendar, but I felt it was not necessary for what I wished to do with my game. If you feel it is, though, just set up conditional branches based on month number and then the amount of days.
After entering the time-changing variables, you can have the time displayed by a button press if you choose. Set up a new parallel processing event, set the condition of it working identical to the time calculating event, and put this code in:
Key Input Processing: Key Input Variable
Conditional Branch: Key X pressed (A Button on keyboard)
Conditional Branch 24-Hour Time ON
(This allows users to switch between 12 hour and 24 hour display. If you prefer one over the other, just use the coding for that one style and do not put in the other style)
Conditional Branch Minutes = 0
Message: \v[hours]:00
(For those with days, months, years)
Message: \v[Years] year notation, \v[Months], \v[Days]
\v[hours]:00
Conditional Branch Minutes <= 9
(For those with days, months, years)
Message: \v[Years] year notation, \v[Months], \v[Days]
\v[hours]:0\v[Minutes
Message: \v[hours]:0\v[Minutes]
Else
(For those with days, months, years)
Message: \v[Years] year notation, \v[Months], \v[Days]
\v[hours]:\v[Minutes]
(For those with only hours)
Message: \v[hours]:\v[Minutes]
Else (24 Hour Time OFF)
Variable Operations Hours 2 = Hours
Conditional Branch Hours 2 > 12
Variable Hours 2 – 12
Conditional Branch Hours > 12
Conditional Branch Minutes = 0
(For those with days, months, years)
Message: \v[Years] year notation, \v[Months], \v[Days]
(For those with only hours)
Message: \v[hours 2]:00 pm
Conditional Branch Minutes <= 9
(For those with days, months, years)
Message: \v[Years] year notation, \v[Months], \v[Days]
\v[hours 2]:0\v[Minutes] pm
(For those with only hours)
\v[hours 2]:0\v[Minutes] pm
Else
(For those with days, months, years)
Message: \v[Years] year notation, \v[Months], \v[Days]
\v[hours 2]:\v[Minutes] pm
Else
Conditional Branch Minutes = 0
(For those with days, months, years)
Message: \v[Years] year notation, \v[Months], \v[Days]
\v[hours 2]:00 pm
Conditional Branch Minutes <= 9
(For those with days, months, years)
Message: \v[Years] year notation, \v[Months], \v[Days]
\v[hours 2]:0\v[Minutes] pm
Else
(For those with days, months, years)
Message: \v[Years] year notation, \v[Months], \v[Days]
\v[hours 2]:\v[Minutes] pm
By pressing the “X” key (default input is A button), the clock will be displayed for viewing by the player
Now that we have time changing through the day, we will want to change the picture tint depending on the time of day, so the player is able to visually tell approximately what time it is.
This is what my conditional branches look like (in RPG Maker XP, modify for 2k3 and VX as required)
Conditional Branch Hours <= 4
Tint Screen -150, -150, -100, 60 @120
Conditional Branch Hours <= 5
Tint Screen -50, -50, -25, 0 @60
Conditional Branch Hours <= 7
Tint Screen 0, 0, 0, 0 @60
Conditional Branch Hours <= 15
Tint Screen 25, 25, 0, 0 @60
Conditional Branch Hours <= 17
Tint Screen 0, 0, 0, 0 @60
Conditional Branch Hours <= 19
Tint Screen -50, -50, 0, 0 @60
Conditional Branch Hours <= 21
Tint Screen -150, -150, -100, 60 @60
Obviously, you can try and find your own desired settings should you not like these tints or transition times.
Copy these to a second common event. Make this a call event, change the transition for each to 20 frames, and call this “Going Outside.” When we wish to go outside where the day changes, we will want to automatically load the tint we require. Therefore, we will need to slightly alter the way in which we exit buildings through events.
Going Inside
Tint Screen: -255, -255, -255, @ 20
Wait 20 frames
Teleport
Switch Outside OFF
Tint Screen: 0, 0, 0, 0
Heading Outdoors
Tint Screen: -255, -255, -255, @ 20
Wait 20 frames
Teleport
Switch Outside ON
Call Event “Going Outside”
Those that are not putting in any year-based calendar or weather events can skip to the end of the tutorial.
However, for those that do, I will be using the same coding I put in my game – a three-season cycle (Long Dry, Little Death, and The Wet) with the dry season taking two months, while the others take one month each. The longest sunlight hours will take place in the first month of the Dry, while the shortest will be in the Little Death. The second month of Dry and Wet have the same length of day and night, Obviously, you can make your own seasons or take them straight from the European calendar.
Open up the Day/Night Cycle event.
For those implementing a yearly cycle:
Conditional Branch: Month ==1 (Dry season 1)
Time-Based Tinting Previously Specified
Conditional Branch: Month =-2 (Dry season 2)
Conditional Branch Half-Hours <= 9
Tint Screen -150, -150, -100, 60 @120
Conditional Branch Half-Hours <= 11
Tint Screen -50, -50, -25, 0 @60
Conditional Branch Half-Hours <= 15
Tint Screen 0, 0, 0, 0 @60
Conditional Branch Half-Hours <= 29
Tint Screen 25, 25, 0, 0 @60
Conditional Branch Half-Hours <= 33
Tint Screen 0, 0, 0, 0 @60
Conditional Branch Half-Hours <= 37
Tint Screen -50, -50, 0, 0 @60
Conditional Branch Half-Hours <= 41
Tint Screen -150, -150, -100, 60 @60
(This lengthens mornings and afternoons by half an hour each, decreasing the brightest part of the day by an hour.)
Conditional Branch Variable Month = 3
Conditional Branch Hours <= 5
Tint Screen -150, -150, -100, 60 @120
Conditional Branch Hours <= 6
Tint Screen -50, -50, -25, 0 @60
Conditional Branch Hours <= 8
Tint Screen 0, 0, 0, 0 @60
Conditional Branch Hours <= 14
Tint Screen 25, 25, 0, 0 @60
Conditional Branch Hours <= 16
Tint Screen 0, 0, 0, 0 @60
Conditional Branch Hours <= 18
Tint Screen -50, -50, 0, 0 @60
Conditional Branch Hours <= 20
Tint Screen -150, -150, -100, 60 @60
(Sunrise is half an hour later again in the mornings, and half an hour earlier in the evenings, than the previous month.)
Conditional Branch Variable Month = 4
Copy, Paste Tintings from Month 2.
Copy the tinting data to the Going Outside event, and change the transition times to 20 frames for each tint.
For those who want randomised weather, at the top of the Going Outside screen, above the coding for tinting, put this:
Variable Weather Change Hours 2 = Weather Change Hours
Variable Weather Change Hours 2 – Hours
Conditional Branch: Variable Weather Change Hours 2 >= 4
Variable Random Weather = Random 0 to 25
(This is so that weather changes when you go outside, but only after four hours have expired since the last weather change). If this was not there, it would change every time someone entered and exited a building.
Now, add your desired weather each month, beneath the screen tints for that month.
Month 1
Conditional Branch Random Weather <= 10
Change Map Settings: Fog None
Conditional Branch Random Weather <= 15
Change Map Settings: Fog 002-Clouds 1, 10, 10 , Magnify 200
Conditional Branch Random Weather <= 24
Change Map Settings: Fog 001-Fog 1, 5, 5, Magnify 200
Else
Weather Effects: Rain 2 @ 0
Month 2
Identical to first month.
Month 3
Conditional Branch Random Weather <= 10
Change Map Settings: Fog 001-Fog 1, 5, 5, Magnify 400
Conditional Branch Random Weather <= 15
Weather Effects: Snow 2 @ 0
Conditional Branch Random Weather <= 20
Weather Effects: Snow 4 @ 0
Conditional Branch Random Weather <= 24
Weather Effects: Snow 6 @ 0
Else
Weather Effects: Snow 9 @ 0
Month 4
Conditional Branch Random Weather <= 5
Change Map Settings: Fog None
Conditional Branch Random Weather <= 10
Change Map Settings: Fog 001-Fog 1, 5, 5, Magnify 200
Conditional Branch Random Weather <= 25
Change Map Settings: Fog 001-Fog 1, 5, 5, Magnify 200
Weather Effects: Rain 5
Conditional Branch Random Weather <= 20
Change Map Settings: Fog 001-Fog 1, 5, 5, Magnify 200
Weather Effects: Rain 7
Else
Change Map Settings: Fog 001-Fog 1, 5, 5, Magnify 200
Weather Effects: Snow 9 @ 0
This changes the weather for each season.
I hope you have found this tutorial useful, and can implement at least a part of it in your game. If you have any problems or suggestions with my tutorial, feel free to post.

