Jump to content

Game.PassTime() insanity


SKKmods

Recommended Posts

I need game time to pass without player interaction or UI.

 

To avoid adding hours to GameHour which can trip midnight forcing tests for 30/31 day month rollovers and then year rollovers, the function Game.PassTime(int aiHours) looks sweet.

 

But, no matter what INT value is used, Game.PassTime() increments GameDaysPassed by exactly 4 days and 4 hours per call on two separate clean Fallout4.exe 1.10.163 .0 installs.

 

I notice that PassTime is commented out of the two base game scripts it appears in MQ04IrmaReject and DLC03:DLC03_V118_QuestScript

 

(1) Is this a new regression, or a known issue that is not published anywhere google can find ?

 

(2) Any alternatives (that don't involve odd month calculations) ?

Link to comment
Share on other sites

I wanted to use PassTime() for the nuka world glory bus transit, but couldn't get it to work.

 

Didn't work on it in quite a while, but my alternative plan was to adjust the fast travel speed multiplier (bus goes faster than walking) and then use scripted fast travel instead.

Link to comment
Share on other sites

  • 2 weeks later...

This is the best solution that I found, I tested it and it seems to work fine, probably the timescale value can be better adjusted, but that's the general idea:

Function PassTime(int aiHours)
	GlobalVariable TimeScale = Game.GetFormFromFile(0x0000003A, "Fallout4.esm") As GlobalVariable
	StartTimerGameTime(aiHours)
	TimeScale.SetValue(10000)
EndFunction

Event OnTimerGameTime(int aiTimerID)
	GlobalVariable TimeScale = Game.GetFormFromFile(0x0000003A, "Fallout4.esm") As GlobalVariable
	TimeScale.SetValue(30)
EndEvent
Link to comment
Share on other sites

  • 1 year later...

 

But, no matter what INT value is used, Game.PassTime() increments GameDaysPassed by exactly 4 days and 4 hours per call on two separate clean Fallout4.exe 1.10.163 .0 installs.

 

You don't happen to remember how you called it? Right now, I noticed that while calling it with 5 as argument, and assumed that the function actually tries to pass 5 RL hours. Because 5(irl hours) * 20(scale) = 100(in-game hours), and 100/24 makes 4.1666..., or 4 days and 4 hours.

 

 

But good to know that changing GameHour handles rollover, thanks for that!

 

edit: I have done more testing.

So calling the function with 3 also makes it wait 100 in-game hours. So it is probably always 100 hours, no matter what you give it.

 

On the up side, incrementing GameHour also affects GetCurrentGameTime* and GameTime timers.

 

____

* If you try to measure the time before and after doing that, you have to do Utility.wait(0.1) after incrementing GameHour. It seems to continue with the script before it actually processes the time progressing

Link to comment
Share on other sites

  • 2 years later...

Thread necromancy!

I've been doing some testing yesterday, and, it seems, GameHour does NOT handle rollover properly. It works, if you want to advance the time by one day at most, but not more.

 

This is what I did:

debug.TraceUser(LOG_NAME,  "Needed time "+timeToPass)
debug.TraceUser(LOG_NAME, "GameHour before = "+GameHour.getValue()+", gametime before "+Utility.GetCurrentGameTime())
GameHour.mod(timeToPass)
debug.TraceUser(LOG_NAME, "GameHour after = "+GameHour.getValue()+", gametime after "+Utility.GetCurrentGameTime())

And the output was:

Needed time 759.229980
GameHour before = 14.640729, gametime before 0.610032
GameHour after = 773.870728, gametime after 1.244614

My code had a bug where it would calculate a way too large value for timeToPass. That number comes to about a month, not just one day.

Doing some more math:

14.640729 / 24 = 0.610030375, which is close enough to the gametime before (probably some seconds missing or such)

773.870728  / 24 =  32.24461367. The decimals are similarily close enough to the decimals of gametime after, but the day itself got only advanced by 1, not by 32.

 

What I think is going on is that the game is doing GameHour mod 24, and then, if the result ends up less than what it used to be before, it advances the game by one day.

Link to comment
Share on other sites

The only functions I can add to this discussion are the [ Set TimeScale to fValue ] and [ SetGlobalTimeMultiplier fValue ]. Set TimeScale to advance game time and SetGlobalTimeMultiplier to speed up time (latter speeds up character movement, animations and voices too..).

Link to comment
Share on other sites

  • Recently Browsing   0 members

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