Gw Temp

Menu

Tutorial - '24-Hour Date/Time System' by Hornet

An item about RPGMaker 2000 posted on

Blurb

You’ll probably notice that some of the popular RPGs have their own variations of time flow. The most basic of these has separate cycles for day and night, which vary in length of time. Well, what if you wanted to add a clock to your game, to more easily determine when night is falling? The following guide will show you how to set up your date/time system, and implement it into your game. (everything in red is What FantasyGames2k reviced )

Body

You’ll probably notice that some of the popular RPGs have their own variations of time flow. The most basic of these has separate cycles for day and night, which vary in length of time. Well, what if you wanted to add a clock to your game, to more easily determine when night is falling? The following guide will show you how to set up your date/time system, and implement it into your game.
(everything in red is What FantasyGames2k reviced )
Step 1: Making Minutes Pass

First, start out by making a common event called “Running Clock”, and set the event start condition to Parallel Process. Create a few variables named TimeMinutes, TimeHours, DateDay, DateMonth, and DateYear. Don’t put them in the common event yet. First, you should have a Wait command. Set a time length for the command to wait (between 0.5 and 1.0 seconds is good), and then place the event command Change Variable to increment the minutes by 1. As you do this, the program will add 1 to the number of minutes in your game’s world. The code will look something like this:
1 Wait: 0.5s. (or whatever time limit you used) (I useed 5 seonds times flies to fast with .5 seconds )
2 Variable Change:[0001:TimeMinutes] +, 1
Right now, if you want to check the clock to see how many minutes have passed, you can make a map with a Clock event on it. What you need to do here is show a message displaying the time, by putting a message event command inside it:
1 Message: “\v[1] minutes have passed.”
This will show you how many minutes (in your game’s world) have passed since you started by displaying the number inside variable 0001 (the TimeMinutes variable).

Step 2: Let’s Make a Date!

All right, you’ve got your basic time system ready. Let’s spice it up a bit by adding hours, days, months, and all that other good stuff. This next part will utilize fork conditions inside other forks, so read carefully.
Underneath the first Variable Change command, put a fork to increment the TimeHours variable when TimeMinutes is 60 or higher, like this:
2 FORK Option: Variable[0001:TimeMinutes]-60 above
o Variable Change:[0001:TimeMinutes] -, 60
o Variable Change:[0002:TimeHours] +, 1
3 END Case
( Here I added a Night Fall Fork so you can get the screen tone to change and also make your events do /say certian things at a certian time)
FORK Option: Variable[0002:TimeHours] = 17
o Set Screen Tone RGB(090,090,090),C(090),1.0sec
END CASE
FORK Option: Variable[0002:TimeHours] = 18
o Set Screen Tone RGB(080,080,080),C(080),1.0sec
(here I decided to make my weatehr event get called at 6pm(18) and 6am everyday)
oCall EVENT: Weather
END CASE
FORK Option: Variable[0002:TimeHours] = 19
o Set Screen Tone RGB(070,070,070),C(070),1.0sec
END CASE
FORK Option: Variable[0002:TimeHours] = 20
o Set Screen Tone RGB(065,065,065),C(065),1.0sec
END CASE
FORK Option: Variable[0002:TimeHours] = 5
o Set Screen Tone RGB(070,070,070),C(070),1.0sec
END CASE
FORK Option: Variable[0002:TimeHours] = 6
o Set Screen Tone RGB(080,080,080),C(080),1.0sec
o Call EVENT: Weather
END CASE
FORK Option: Variable[0002:TimeHours] = 7
o Set Screen Tone RGB(090,090,090),C(090),1.0sec
END CASE
(Make sure yo have no wait on it bercause you want to be moving while the screen changes tone)


Next, we’ll add calendar days to the mix. Underneath the second Variable Change command in the TimeMinutes fork, make another fork to add to DateDay when TimeHours is 24 or higher.
4 FORK Option: Variable[0002:TimeHours]-24 above
o Variable Change:[0002:TimeHours] -, 24
o Variable Change:[0003:DateDay] +, 1
5 END Case
Once the days have been added, we can put the months in. It’ll be a bit complicated to do a calendar that’s exactly like the standard Julian calendar, since you’ll have to figure in leap years and months with 31 and 30 days. Let’s just assume for your game that all months have an equal number of days (30 sounds reasonable). Put a new fork inside the TimeHours fork that adds one to DateMonth when DateDay exceeds 30.
6 FORK Option: Variable[0003:DateDay]-30 more than (use “Bigger” in the drop-down menu)
o Variable Change:[0003:DateDay] -, 30
o Variable Change:[0004:DateMonth] +, 1
7 END Case
(here I added in a lil feather to keep track of the Season so you can controll the weather a little bit better, create the followng switches Winter, Spring, Summer, Autumn)
FORK Option: Variable[0004:DateMonth] = 12
o Change Switch: [0004:Autumn] Switch Off
o Change Switch: [0001:Winter] Switch On
END CASE
FORK Option: Variable[0004:DateMonth] = 3
o Change Switch: [0001:Winter] Switch Off
o Change Switch: [0002:Spring] Switch On
END CASE
FORK Option: Variable[0004:DateMonth] = 6
o Change Switch: [0002:Spring] Switch Off
o Change Switch: [0003:Summer] Switch On
END CASE
FORK Option: Variable[0004:DateMonth] = 9
o Change Switch: [0003:Summer] Switch Off
o Change Switch: [0004:Autumn] Switch On
END CASE

And finally, let’s add years to our calendar (which really only involves using another fork). Set up this one inside the DateDay fork, and make it add to DateYear once DateMonth goes over 12.
8 FORK Option: Variable[0004:DateMonth]-12 more than
o Variable Change:[0004:DateMonth] -, 12
o Variable Change:[0005:DateYear] +, 1
9 END Case

(Here I added character Birthdays an optional Code I won't give this to you ( the game I am creating involves character age and things like that ) )
Now, we’re going to make a few changes to our clock event, so that it displays the actual time and date. Change the message in your Clock event to read as follows:
1 Message: “Time: \v[2]:\v[1]
Date: \v[4]/\v[3]/\v[5]”

When you check out your clock, you should see a message like this one:
Time: 12:46
Date: 7/16/2001

There is one exception to this: if your TimeMinutes variable is less than 10, you may end up with a message like this one:
Time: 12:4
Date: 7/16/2001

To fix that problem, we’re going to - yes, that’s right - use another fork. Go back to your Clock event, and put a Fork in to show a different time message depending on whether or not TimeMinutes is less than 10. Check the “Add ELSE Case” box when setting up the fork condition. In the top section, copy and paste your original time message, but alter it slightly to include a zero before the TimeMinutes variable (\v[1]), so that it looks like this:
1 Message: “Time: \v[2]:0\v[1]
Date: \v[4]/\v[3]/\v[5]”
Your completed fork will look almost like this:
1 FORK Option: Variable[0001:TimeMinutes]- 10 less than
o Message: “Time: \v[2]:0\v[1]
Date: \v[4]/\v[3]/\v[5]”
2 ELSE Case
o Message: “Time: \v[2]:\v[1]
Date: \v[4]/\v[3]/\v[5]”
3 END Case

When you check your clock now, the time and date will look something like this:

Time: 12:04
Date: 7/16/2001

(Weather you need create a entirely new common event as a call event lets call it weather )

FORK Option: Switch (0001:Winter) is ON
Change Variable: Var [0006:Random Weather] (Set)-Random(1*100)
FORK Option: Variable [0006:Random Weather] 95 (>=)
Call Weather Effect: Snow-High
Change Switch: [0005:Weather] ON
ELSE Case
FORK Option: Variable [0006:Random Weather] 90 (>=)
Call Weather Effect: Rain-High
Change Switch: [0005:Weather] ON
ELSE Case
FORK Option: Variable [0006:Random Weather] 75 (>=)
Call Weather Effect: Snow-Med
Change Switch: [0005:Weather] ON
ELSE Case
FORK Option: Variable [0006:Random Weather] 70 (>=)
Call Weather Effect: Rain-Med
Change Switch: [0005:Weather] ON
ESLE Case
FORK Option: Variable [0006:Random Weather] 55 (>=)
Call Weather Effect: Snow-Low
Change Switch: [0005:Weather] ON
ESLE Case
FORK Option: Variable [0006:Random Weather] 50 (>=)
Call Weather Effect: Rain-Low
Change Switch: [0005:Weather] ON
ELSE Case
Change Switch [0005:Weather] OFF
END Case
END Case
END Case
END Case
END Case
Cange Variable: [0006:Random Weather], (Set)-0
END Case
FORK Option: Switch (0002:Spring) is ON
Change Variable: Var [0006:Random Weather] (Set)-Random(1*100)
FORK Option: Variable [0006:Random Weather] 95 (>=)
Call Weather Effect: Rain-High
Change Switch: [0005:Weather] ON
ELSE Case
FORK Option: Variable [0006:Random Weather] 85 (>=)
Call Weather Effect: Rain-Med
Change Switch: [0005:Weather] ON
ELSE Case
FORK Option: Variable [0006:Random Weather] 75 (>=)
Call Weather Effect: Rain-Low
Change Switch: [0005:Weather] ON
ELSE Case
Change Switch [0005:Weather] OFF
END Case
END Case
Cange Variable: [0006:Random Weather], (Set)-0
END Case
FORK Option: Switch (0003:Summer) is ON
Change Variable: Var [0006:Random Weather] (Set)-Random(1*100)
FORK Option: Variable [0006:Random Weather] 95 (>=)
Call Weather Effect: Rain-Med
Change Switch: [0005:Weather] ON
ELSE Case
FORK Option: Variable [0006:Random Weather] 90 (>=)
Call Weather Effect: Rain-Low
Change Switch: [0005:Weather] ON
ELSE Case
Change Switch [0005:Weather] OFF
END Case
END Case
Cange Variable: [0006:Random Weather], (Set)-0
END Case
FORK Option: Switch (0004:Autumn) is ON
Change Variable: Var [0006:Random Weather] (Set)-Random(1*100)
FORK Option: Variable [0006:Random Weather] 98 (>=)
Call Weather Effect: Snow-Med
Change Switch: [0005:Weather] ON
ELSE Case
FORK Option: Variable [0006:Random Weather] 95 (>=)
Call Weather Effect: Rain-High
Change Switch: [0005:Weather] ON
ELSE Case
FORK Option: Variable [0006:Random Weather] 88 (>=)
Call Weather Effect: Snow-Low
Change Switch: [0005:Weather] ON
ELSE Case
FORK Option: Variable [0006:Random Weather] 85 (>=)
Call Weather Effect: Rain-Med
Change Switch: [0005:Weather] ON
ESLE Case
FORK Option: Variable [0006:Random Weather] 75 (>=)
Call Weather Effect: Rain-Low
Change Switch: [0005:Weather] ON
ESLE Case
Change Switch [0005:Weather] OFF
END Case
END Case
END Case
END Case
Cange Variable: [0006:Random Weather], (Set)-0
END Case

(Here I thought about adding a WeatherWatch Scipt that you look uyp at teh sky and see the weather is like this would require maing switchs for Sonw and Rain in all High Med and Low and then creating a message so if switch weather on it would check and see if switch rain or snow is on then check for high low or medium and would tell you It is raining very hard right now, or if weather is off it would say You see the Bright Sun shining down upon teh world...... For now I created an item that checks the weather and can change the weather everytime you use it )



,

If you have any questions or comments about this FAQ, send e-mail to mega_man_digger@msn.com or siliconhero@barrysworld.com.