Jump to content

Time difference


Recommended Posts

Is there a way to compute the game time difference between two events?

Imagine a quest where you have to go to a place and come back, and you want to show a message like: You needed 3 days, 4 hours, 43 minutes!

 

Now, I saw the global variables GameYear, GameMonth, GameDay, and GameHour. But it seems quite clunky to manually use them, there isn't a simpler way?

Link to comment
Share on other sites

float MyTimeStamp

let MyTimeStamp := ( GameDaysPassed * 24 ) + GameHour

 

Every time you calculate as above, you get the number of hours since the game started (Integer part is hours, the non-integer part is fraction of one hour that can be converted to minutes and seconds)

 

Comparing two timestamps gives you the elapsed time, in hours.

 

You may save the timestamp of a kick-off event and, as time passes, calculate how long lince that event occurred.

 

You may also, for example, set a time limit of 3 days/72 hours by using (GameDaysPassed +3) in the formula and, as time goes by, calculate how much time is left before the timer expires.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...