Home
Help
Search
Calendar
Login
Register
Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
New forum theme up and running!
Charas-Project
»
Game Creation
»
Requests
»
Tutorials
»
In-Game Timer Tutorial
Poll
Do you like thi tutorial?
Yes! It is excellent!
2 (28.6%)
4 (57.1%)
Yes! It is excellent!
1 (14.3%)
No. It's crap!
0 (0%)
Total Members Voted:
0
« previous
next »
Print
Pages: [
1
]
Author
Topic: In-Game Timer Tutorial (Read 1978 times)
Fortet
Cheeky Bastard
Exemplar
Posts: 1,365
In-Game Timer Tutorial
«
on:
December 20, 2004, 11:52:21 PM »
In some RPGs, have you ever noticed that it tells you how many hours, minutes, and seconds you have played on your game? Well, now you can have it on your game, too by using this tutorial.
First of all, go to common events and make a new one called Time (or whatever), parallel process, and no trigger switch. Dont forget to make 3 variables: SECONDS, MINUTES, and HOURS. First part of the event should look like this:
<>Wait: 1.0 seconds
<>Variable Oper: [0001:SECONDS] +1
<>Branch if Var [0001:SECONDS] is 60 greater
<>Branch if Var [0001:SECONDS] is 120 greater
<>Branch if VAR [0001:SECONDS] is 180 greater
Next is a bit trickier. Now, we go down through the variables. Here's what you should have now:
<>Wait: 1.0 seconds
<>Variable Oper: [0001:SECONDS] +1
<>Branch if Var [0001:SECONDS] is 60 greater
<>Branch if Var [0001:SECONDS] is 120 greater
<>Branch if VAR [0001:SECONDS] is 180 greater
<>Variable Oper: [0001: SECONDS] Set, 0
<>Variable OPer: [0002: MINUTES] +3
<>
:Else Handler
<>Variable Oper: [0001: SECONDS] Set, 0
<>Variable Oper: [0002: Minutes] +2
<>
:End
<>
:Else Handler
<>Variable Oper: [0001 SECONDS] Set, 0
<>Variable Oper: [0002 MINUTES] +1
:End
<>
Now, the easiest part. At the end, you should have something like this:
<>Wait: 1.0 seconds
<>Variable Oper: [0001:SECONDS] +1
<>Branch if Var [0001:SECONDS] is 60 greater
<>Branch if Var [0001:SECONDS] is 120 greater
<>Branch if VAR [0001:SECONDS] is 180 greater
<>Variable Oper: [0001: SECONDS] Set, 0
<>Variable OPer: [0002: MINUTES] +3
<>
:Else Handler
<>Variable Oper: [0001: SECONDS] Set, 0
<>Variable Oper: [0002: Minutes] +2
<>
:End
<>
:Else Handler
<>Variable Oper: [0001 SECONDS] Set, 0
<>Variable Oper: [0002 MINUTES] +1
:End
<>
:Else Handler
<>Branch if Var: [0002:MINUTES] is 60
<>Variable Oper: [0002:MINUTES] Set, 0
<>Variable Oper: [0003:HOURS] +1
<>
:Else Handler
<>
:End
<>
:End
<>
To make an item that tells you this, make a swith item named Watch (Or whatever), a common event named watch (or whatever) and a switch named watch (or whatever). On the item, make the switch event 'watch'. Then, go to common events, open event 'Wacth', parallel process, trigger switch 'watch', and make a message saying 'Current Playing time is \v[3] hours, \v[2] minutes, and \v[1] seconds.' Then, under it, turn the switch off. It should look like this:
<>Message: Current playing time is \v[3] hours, \v[2] minutes,
and \v[1] seconds.
<> Switch Oper: [0004: WATCH] OFF
<>
I hope that helps some people!
Logged
Snake Eater
keeps on trying until I run out of cake
Exemplar
Posts: 1,318
(No subject)
«
Reply #1 on:
December 21, 2004, 01:50:53 AM »
Good job!
*claps*
Logged
Slippy_Gonzalez
[ Espa-Mancer ]
Initiate
Posts: 83
[ Espa-Mancer ]
(No subject)
«
Reply #2 on:
June 12, 2005, 11:47:52 AM »
I don't want to bump this or anything....but i must. THANK YOU....this is the first time i've used variables and now i finally understand them thanks to you...i'm going to credit you.
But is there any way i can make it so it resets when it reaches 24 hours. and is there a way i can make the screen darker when its between a certain time.
if you know please help. Thankyou all the same.
Logged
Print
Pages: [
1
]
« previous
next »
Charas-Project
»
Game Creation
»
Requests
»
Tutorials
»
In-Game Timer Tutorial