Jump to content

Is there any way to manipulate in-game time or move time forward?


acidzebra

Recommended Posts

Changing the GameHour variable WILL move time forwards or backwards, physically not just numerically, BUT if you set a value > 24 hours I'm not sure what will happen. Possibly it might freeze/crash the game. If you're lucky, the days might increment, or maybe it will simply wrap the value, idk. I know that during experimentation using the console I tried to set a negative number to one of the time globals and it froze the game. If worse comes to worse, you'll need to do a few sums and set each variable separately.

 

So anyway, you could try:

 

float fGameDaysPassed = GameHour.Mod(Utility.RandomFloat(288.0, 384.0)) / 24.0

Edited by steve40
Link to comment
Share on other sites

If worse comes to worse, you'll need to do a few sums and set each variable separately.

 

Yeah, so it's a magic boat and travel doesn't take time :)

 

(I suck at simple math)

 

Cheers for the suggestions - at least I have an idea of what _will_ work - read the current date variables (time, day, month, year), do some arcane conversion, add my desired travel time, make sure values don't go out of bounds, convert the whole thing back, then write the variables. Which really is beyond the scope of what I'd hoped it would be: SetTheDamnDateForMe()

 

Probably easier to just script a couple of really long fast travel jumps. People love long load times, right?

;)

Edited by acidzebra
Link to comment
Share on other sites

...thankfully precomputing occlusion for complex files takes a long time so I had some time to fiddle with this. The following code will set the date for X days of travel (will break if you set it for longer than a month but I didn't need that), unfortunately I can't seem to do anything about the gamedayspassed variable, but at least the calendar will be properly updated. I leave it here in case someone else finds some use for it.

 

I have no idea how this will affect people running "needs" mods, depending on what variables they look at, you may starve to death :whistling:

 

May also break any number of other game thingies dependent on these global variables, so use with caution, I'm not responsible for any breakage, yada yada yada.

 

GlobalVariable Property GameYear  Auto  
GlobalVariable Property GameDay  Auto  
GlobalVariable Property GameHour  Auto  
GlobalVariable Property GameMonth  Auto  

;amount of travel time, with fixed component and random element added, change as you see fit
;this will break for really big values, you should add checks if you're traveling longer than a month
int traveldays = 14 + Utility.RandomInt(-3, 3)

int currentday = gameday.GetValue() as int
int currentmonth = gamemonth.GetValue() as int
int currentyear = gameyear.GetValue() as int

;define array with number of days in each month
int[] montharray = new int[12]
montharray[0] = 31
montharray[1] = 28
montharray[2] = 31
montharray[3] = 30
montharray[4] = 31
montharray[5] = 30
montharray[6] = 31
montharray[7] = 31
montharray[8] = 30
montharray[9] = 31
montharray[10] = 30
montharray[11] = 31

;how many days in current month
int currentmonthdays = montharray[currentmonth]

; add travel days to current date
int dayaftertravel = (currentday + traveldays)

;check if we've passed over into the next month
if dayaftertravel > currentmonthdays
dayaftertravel = (dayaftertravel - currentmonthdays)
currentmonth = (currentmonth + 1)
;check if we've passed over into the next year
if currentmonth > 11
currentmonth = 0
gameyear.setvalue(currentyear+1)
endif
endif

; set the month
gamemonth.setvalue(currentmonth)

; and set the new date
gameday.setvalue(dayaftertravel)

; set the game hour to a random number because why not
gamehour.setvalue(Utility.RandomInt(0, 23))
Debug.Notification("You have been at sea for " + traveldays + " days")

 

ACHIEVEMENT UNLOCKED: Acid Zebra learns "array"! :dance:

Edited by acidzebra
Link to comment
Share on other sites

Because in this mod I am building the travel is done via a triggerbox + script and takes you to a different worldspace not parented to Tamriel.

 

See also the first post :)

 

So why don't you just make the trigger box do what I said? Besides, isn't the "set timescale to" command integrated into the engine so it'll work even if you leave skyrim?

Edited by deama
Link to comment
Share on other sites

(pseudocode)

 

On triggerboxenter()

set timescale to 100

moveto.newcell

set timescale to 20

 

...not a lot of time will have passed, and certainly not the ~two weeks I require. Even with timescale set to higher levels, the load will kick in almost immediately.

Edited by acidzebra
Link to comment
Share on other sites

(pseudocode)

 

On triggerboxenter()

set timescale to 100

moveto.newcell

set timescale to 20

 

...not a lot of time will have passed, and certainly not the ~two weeks I require. Even with timescale set to higher levels, the load will kick in almost immediately.

 

That's the point, if you change the timescale, you also change the fast traveling time too. Say the game increased time by 10 hours if I went from windhelm to solitude with a time scale of 10, but If I increased it to 100, then travel to solitude from windhelm, the time that would pass would probably be something like 100 hours.

Link to comment
Share on other sites

That's the point, if you change the timescale, you also change the fast traveling time too

 

Interesting notion, but unfortunately it doesn't bear out. I wrote the below code to test and placed a Triggerbox in Tamriel/Whiterun pointing to the fast travel exit point in SolitudeLighthouseExterior. GameHour and GameDaysPassed ended up being exactly the same, whether I fast traveled by selecting the map and going to the lighthouse, or entering the triggerbox and going to the lighthouse.

 

If you think you've noticed a time difference, that was probably time passing between (you setting timescale and closing the console) + (you opening the map and traveling) and (cell being loaded) + (you reacting).

 

Scriptname SuperDuperFastTravel extends ObjectReference  

ObjectReference Property PlayerRef  Auto  
ObjectReference Property TravelMarker  Auto  
GlobalVariable Property TimeScale  Auto  


Event OnTriggerEnter(ObjectReference akActionRef)
If akActionRef == PlayerREF
float oldtimescale = TimeScale.GetValue()
TimeScale.SetValue(5000)
Game.EnableFastTravel()
Game.FastTravel(TravelMarker)
TimeScale.SetValue(oldtimescale)
	EndIf
EndEvent

 

Too bad though, it would have been nice if this worked.

Edited by acidzebra
Link to comment
Share on other sites

  • Recently Browsing   0 members

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