PlayMaker Help & Tips > PlayMaker Help

Daytime/NightTime real time clock

(1/1)

Gabe:
Hi, :'(
I'm trying to set up a system with a real time clock where it gets dark after 19:00 and bright after 07:00. I managed to build a simple fsm using 'get system date time' and 'string compare' but it obviously only unleashes the event at a singular minute and hour. For instance, if the game starts at 07:01 it will off course not work. I'd appreciate any help. Thank you

Lane:
You just need some fake number to maintain the time.

If your clock works by minutes then there are 1440 minutes in a day. Make it an integer/float and add some number to it per second which translates to game minutes per real second. Reset it to zero if it ever equals 1440 or more and start the count all over.

Now you know what time it is in the game, so you can correlate that number to some value on your weather system. By dividing, multiplying or normalizing that value you can turn it into other numbers that you could use to adjust rotations of a directional light or light intensities/colors for instance.

Gabe:
Hi,Lane
Thanks a million for your reply. I implemented what you suggested but what I'm really trying to do is to have the events happening accordingly to a real clock, as if it's HH:MM in the pc it is HH:MM in the game. Sorry if I misunderstood your explanation. I had this working:

Lane:
There's a thread about Time Formatting, it should help with that.

http://hutonggames.com/playmakerforum/index.php?topic=1911

Navigation

[0] Message Index

Go to full version