playMaker

Author Topic: Daytime/NightTime real time clock  (Read 3008 times)

Gabe

  • Playmaker Newbie
  • *
  • Posts: 5
Daytime/NightTime real time clock
« on: November 11, 2014, 10:41:58 AM »
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
« Last Edit: November 11, 2014, 11:01:14 AM by Gabe »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Daytime/NightTime real time clock
« Reply #1 on: November 11, 2014, 11:09:50 AM »
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.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Gabe

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Daytime/NightTime real time clock
« Reply #2 on: November 11, 2014, 12:14:08 PM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Daytime/NightTime real time clock
« Reply #3 on: November 11, 2014, 12:42:32 PM »
There's a thread about Time Formatting, it should help with that.

http://hutonggames.com/playmakerforum/index.php?topic=1911
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D