Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float Function HoursUntilTimeOnDOW(float hour, int dow) ; Sundas is 0, Morndas is 1, etc.
- {Returns number of hours until the target time on a specific day of the week.
- Values of 9.5 and 1 will return 2 if it's 7:30 on a Morndas, but those same
- values would return 166 (7 * 24 - 2) if it's already 11:30 on a Morndas.}
- float targetTime = dow * 24 + hour ; scale target time into hour offset during week
- float currentTime = Utility.GetCurrentGameTime() ; scale current time to match
- currentTime = (((currentTime as int) % 7) + (currentTime - (currentTime as int))) * 24
- if currentTime >= targetTime ; it's already past the target time this week
- targetTime += 7 * 24 ; add a week
- endif
- return targetTime - currentTime
- EndFunction
- ; Register for 9:30 on next Morndas + one week (7 days * 24 hours)
- RegisterForSingleUpdateGameTime(HoursUntilTimeOnDOW(9.5, 1) + 168)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement