Gw Temp

Menu

Tutorial - 'Game Timer and Timer Item' by Rhynir

An item about RPGMaker 2000 posted on

Blurb

Rhynir gives out the details on how to create an item in your RM2K game that will display the total playing time!

Body

First, create 3 variables; Timerseconds, Timerminutes, and Timerhours. Also make 2 switches called Time and Timerwatch or something.

(*: Actual Code)

  1. Now, go to the Common events in the database.

  2. Make a common event called Timer and make it a Parallel process and its appearance conditions switch the switch you made- Time.


  3. Now, we're gonna make the universal unit...Seconds.

    Make a Wait command and set if for 1 second (10 in the set command).
  4. *Wait: 1.0 seconds


  5. Then add it to the timer seconds. Add one to the variable[Timerseconds]
  6. *Change Variable [Timerseconds] + 1


  7. Now, we wouldn't want 61 seconds, would we? So we'll make it change to minutes. A fork Conditions! Make it equal to sixty for the If
  8. *Fork Condition: IF Variable[Timerseconds] = 60


  9. So we gotta change 60 seconds into 1 minute.
  10. *Change Variable[TimerMinutes] + 1


  11. Then change the seconds back to zero.
  12. *Change Variable[TimerSeconds] set 0


  13. Now, for hours! It's pretty much the same, so I won't explain it much.
  14. *Fork Contition: IF Variable[TimerMinutes] = 60

  15. *Change Variable[Timerhours] + 1

  16. *Change Variable[Timerminutes] set 0


And that's that for the Timer thing, now to make it viewable.
By the way, be sure to turn on the switch "Time" in your intro event! Gotta make it work first!

Timer Item:
Think up a ckickarse name for the timer, then make it a SWITCH item. Make it cost Zero, so you can't sell it, and the usage rate should be LIMITLESS. And at the switch, make the on switch Timerwatch. And it's availability is at the field only. With that done, go back to common events. Be sure to give this item to your hero some point early in the game.

Timer Item view:
Make another Common event. Set it's event start condition to AUTOSTART and its appearance Conditions switch Timerwatch.
Then make a message saying how long you've played.

*Mess: You have been playing for:
\v[Timerhours] Hours
\v[Timerminutes] Minutes
\v[Timerseconds] Seconds.
Now you wouldn't want it to loop over and over like the first timer should. So make a change switch and turn Timerwatch off.

*ChangeSwitch[Timerwatch] OFF

And that's that!

Actual Code: (V1 = Timerseconds, V2 = Timerminutes, V3 = Timerhours, S1 = Time, S2 = Timer)

Time Code: (Common Events)
Event Start Condition: Parallel Process
Appearance Conditions Switch: S1
*Wait 1 second
*Change Variable V1 + 1
*IF V1 = 60
*Change Variable V2 + 1
*Change Variable V1 = 0
*IF V2 = 60
*Change Variable V3 + 1
*Change Variable V2 = 0

Timer Item:
Name: ????
Classification: Switch
Price: 0
Use number of times: Limitless
Explination: ????
ON switch: S2
Available At: Field

Timer Code: (Common Events)
Event Start Condition: Auto Start
Appearance Conditions Switch: S2
*Message: You have been playing for \v[3] hours, \v[2] minutes, and \v[1] seconds
*Change Switch S2 OFF

Questions? Email me: rhynir@yahoo.com
www.freewebs.com/rhynir