Difference between revisions of "User:Rasikko"
Jump to navigation
Jump to search
no edit summary
imported>Scrivener07 (Created page with "== Time Functions == These are some helper functions you can use to work with time in the game. I offer three ways of starting them off, as the functions will require any of t...") |
imported>Scrivener07 |
||
Line 10: | Line 10: | ||
The last method is through GetFormFromFile and pulls the global instead of making it a property. | The last method is through GetFormFromFile and pulls the global instead of making it a property. | ||
<source lang="papyrus">Float daysPassed = (Game.GetFormFromFile(0x00000039, "Fallout4.ESM") as GlobalVariable).GetValue() | <source lang="papyrus">Float daysPassed = (Game.GetFormFromFile(0x00000039, "Fallout4.ESM") as GlobalVariable).GetValue() | ||
<br> | |||
Using any of them, you pass into the arguments where needed for the following functions: | |||
<source lang="papyrus"> | |||
Float Function GetGameTime(Float afDaysPassed) Global | |||
; Returns the number of hours passed for the current day. | |||
Float gameTime = (afDaysPassed - afDaysPassed as int) * 24.0 | |||
if gameTime > 12.00 | |||
return gameTime - 12.00 | |||
endif | |||
return gameTime | |||
EndFunction | |||
</source> | |||
<br> | |||
<source lang="papyrus"> | |||
Float Function GetCurrentInGameTime(Float afGameTime) Global | |||
; Returns the actual in game time. h.mm0000 | |||
return afGameTime as int + ((((afGameTime - afGameTime as int) * 60.0) as int) / 100.0) | |||
EndFunction | |||
</source> |