Post by Eyesore on May 31, 2005 16:31:02 GMT -5
==This tutorial requires a semi-decent knowledge of variables and conditional branches==
Now it's probably impossible to get a clock to accurately tell what the real time is where the player lives, or even where you live [unless it's by accident], although to tell the time in a game is actually relatively simple. NOTE: It's really good to pair this with a day/night system so that the time makes sense.
Keep in mind I work with a semi-badly translated version of rm2k3, so if there's any problems with the language I use, just use the rm2k/rmxp equivalent of it. Conditional Branches are FORK CONDITIONS by the way.
Preliminary steps:
-Create three variables, one called "Hours" and another called "Minutes", as well as another called "PMHours". It's important to note that minutes will only last a second, so your day is going to be twenty four MINUTES long. You can make it realistic, but keep in mind that your whole game will probably average about 25 hours, 200 at the very very most, so the best case scenario is that your game only lasts eight days... not very realistic.
-Create three common events, one called "Minutes", the next called "Hours", and the last called "New Day".
Minutes should be written as such:
"PARALELL PROCESS"
Variable "MINUTES" +1
Wait 1.0 seconds"
Hours should be written like so:
"PARALELL PROCESS:
Branch if Variable "MINUTES" equals 60:
Variable "HOURS" +1
Variable "MINUTES", set to 0
Else: [blank]"
And new day...:
"PARALELL PROCESS:
Branch if "HOURS" equals 25
Variable "HOURS", set to 0
Else: [blank]"
Okay, now your game is counting the time. If you want, you can start the game at 10 in the morning or something realistic.
HOW TO MAKE A CLOCK TELL THE TIME:
You could have it so that once you press the action key on a clock, it says "The current time is \v[HOURS(must be numbered)]:\v[MINUTES]" which would tell the time like a digital clock. However there's a problem... if you're at nine minutes past six o clock in the afternoon for example, it will only say "6:9". You would want "6:09 PM". So here's how we expand on this, NO THIS IS NOT A COMMON EVENT:
"Action Key, Same Layer as Hero:
<>Branch if Var[HOURS] is less than 12:
..<>Branch if Var[MINUTES] is less than 10:
....<>Message: The current time is \v[HOURS]:0\v[MINUTES] AM
....<>
..Else:
....<>Message: The current time is \v[HOURS]:\v[MINUTES] AM
....<>END
Else:
..<>Branch if Var[HOURS] is 24
....<>Branch if Var[MINUTES] is less than ten
......<>Var[PMHours] Set to [HOURS]
......<>Var[PMHours] -12
......<>Message: The current time is
\v[PMHours]:0\v[MINUTES] AM
....<>Else:
......<>Var[PMHours] Set to [HOURS]
......<>Var[PMHours] -12
......<>Message: The current time is
\v[PMHours]:\v[MINUTES] AM
....<>END
....Else:
....<>Branch if Var[HOURS] equals 12
......<>Branch if Var[MINUTES] is less than 10
........<>Message:\v[HOURS]:0\v[MINUTES] PM
......Else:
........<>Message:\v[HOURS]:\v[MINUTES] PM
........<>END
......Else:
......<>Branch if Var[MINUTES] is less than 10
........<>Var[PMHours] Set to [HOURS]
........<>Var[PMHours] -12
........<>Message:The current time is \v[PMHours]:0\v[Minutes] PM
........Else:
........<>Var[PMHours] Set to [HOURS]
........<>Var[PMHours] -12
........<>Message:The current time is \v[PMHours]:\v[Minutes] PM
........<>END
......<>END
....<>END
..<>END"
Now it's probably impossible to get a clock to accurately tell what the real time is where the player lives, or even where you live [unless it's by accident], although to tell the time in a game is actually relatively simple. NOTE: It's really good to pair this with a day/night system so that the time makes sense.
Keep in mind I work with a semi-badly translated version of rm2k3, so if there's any problems with the language I use, just use the rm2k/rmxp equivalent of it. Conditional Branches are FORK CONDITIONS by the way.
Preliminary steps:
-Create three variables, one called "Hours" and another called "Minutes", as well as another called "PMHours". It's important to note that minutes will only last a second, so your day is going to be twenty four MINUTES long. You can make it realistic, but keep in mind that your whole game will probably average about 25 hours, 200 at the very very most, so the best case scenario is that your game only lasts eight days... not very realistic.
-Create three common events, one called "Minutes", the next called "Hours", and the last called "New Day".
Minutes should be written as such:
"PARALELL PROCESS"
Variable "MINUTES" +1
Wait 1.0 seconds"
Hours should be written like so:
"PARALELL PROCESS:
Branch if Variable "MINUTES" equals 60:
Variable "HOURS" +1
Variable "MINUTES", set to 0
Else: [blank]"
And new day...:
"PARALELL PROCESS:
Branch if "HOURS" equals 25
Variable "HOURS", set to 0
Else: [blank]"
Okay, now your game is counting the time. If you want, you can start the game at 10 in the morning or something realistic.
HOW TO MAKE A CLOCK TELL THE TIME:
You could have it so that once you press the action key on a clock, it says "The current time is \v[HOURS(must be numbered)]:\v[MINUTES]" which would tell the time like a digital clock. However there's a problem... if you're at nine minutes past six o clock in the afternoon for example, it will only say "6:9". You would want "6:09 PM". So here's how we expand on this, NO THIS IS NOT A COMMON EVENT:
"Action Key, Same Layer as Hero:
<>Branch if Var[HOURS] is less than 12:
..<>Branch if Var[MINUTES] is less than 10:
....<>Message: The current time is \v[HOURS]:0\v[MINUTES] AM
....<>
..Else:
....<>Message: The current time is \v[HOURS]:\v[MINUTES] AM
....<>END
Else:
..<>Branch if Var[HOURS] is 24
....<>Branch if Var[MINUTES] is less than ten
......<>Var[PMHours] Set to [HOURS]
......<>Var[PMHours] -12
......<>Message: The current time is
\v[PMHours]:0\v[MINUTES] AM
....<>Else:
......<>Var[PMHours] Set to [HOURS]
......<>Var[PMHours] -12
......<>Message: The current time is
\v[PMHours]:\v[MINUTES] AM
....<>END
....Else:
....<>Branch if Var[HOURS] equals 12
......<>Branch if Var[MINUTES] is less than 10
........<>Message:\v[HOURS]:0\v[MINUTES] PM
......Else:
........<>Message:\v[HOURS]:\v[MINUTES] PM
........<>END
......Else:
......<>Branch if Var[MINUTES] is less than 10
........<>Var[PMHours] Set to [HOURS]
........<>Var[PMHours] -12
........<>Message:The current time is \v[PMHours]:0\v[Minutes] PM
........Else:
........<>Var[PMHours] Set to [HOURS]
........<>Var[PMHours] -12
........<>Message:The current time is \v[PMHours]:\v[Minutes] PM
........<>END
......<>END
....<>END
..<>END"