Jump to content

Setting game time to a specific time?


PBalfredo

Recommended Posts

In the mod I'm making, there is going to be a haunted castle that only appears at night and the player has that one night to explore it. Talking to an NPC I made in Riverwood will take the player to the castle. Thing is, I don't want the player popping up at the castle in the middle of the day, or late at night with only a couple in-game hours to explore the castle.

 

Is there a way to set the in-game time to a specific time, so that the player always pops up at the castle at 7:00pm? Or barring that, some way to force the player to wait/sleep until a specific time. At least so that way I can bring the player to a temporary shelter and have him click on a bed to wait until nightfall, or something.

Link to comment
Share on other sites

Thanks. But I tried throwing this onto an object on my world to fire off OnLoad to test it out, but it didn't work. Here's my script:

 

Scriptname changeTime2 extends ObjectReference  

GlobalVariable Property GameHour Auto 
Event OnLoad()
GameHour.SetValue(19.0)
EndEvent

 

Am I doing something wrong with the implementation?

 

(I'm aware that for final implementation I'll need it to fire off some other event because OnLoad would turn the time to 7 every time the player entered the world with the object in it, but right now I'm just trying to get it to work as proof of concept)

Link to comment
Share on other sites

Hmm... I think the correct variable might be "TimeOfDay" (it might be "TimeOfDayGlobal", which was used in the CK wiki example). Try these:

 

float newTime = TimeOfDayGlobal.Mod(3.0) ; this example should advance the time of day by 3 hours.

 

 

TimeOfDayGlobal.SetValue(19.0) ; should set the time to 7pm

 

Edit: ya, as pointed out in later posts, use "GameHour".

Edited by steve40
Link to comment
Share on other sites

  • 2 weeks later...

I tried plugging the script into the papyrus fragment at the end of the dialog with the NPC that's suppose to take me there.

 

GetOwningQuest().SetObjectiveDisplayed(30)
GetOwningQuest().setstage(30)

;ObjectReference Property TeleportMarker auto
;Game.GetPlayer().MoveTo(TeleportMarker)

TimeOfDayGlobal.SetValue(19.0)

 

But it would fail compiling and give me this error:

 

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__02005BD4.psc(17,0): variable TimeOfDayGlobal is undefined

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__02005BD4.psc(17,16): none is not a known user-defined type

 

So I tried defining the variable, both as an int or a float.

 

GetOwningQuest().SetObjectiveDisplayed(30)
GetOwningQuest().setstage(30)

;ObjectReference Property TeleportMarker auto
;Game.GetPlayer().MoveTo(TeleportMarker)

float Property TimeOfDayGlobal auto
;int Property TimeOfDayGlobal auto
TimeOfDayGlobal.SetValue(19.0)

 

Didn't work either time. Now I just get:

 

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__02005BD4.psc(16,0): no viable alternative at input 'int'

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__02005BD4.psc(16,13): no viable alternative at input 'TimeOfDayGlobal

 

I also tried TimeOfDay instead of TimeOfDayGlobal. Same problem. Am I missing something? How exactly am I suppose to set this up?

Link to comment
Share on other sites

I've just been messing around with something like that. I had a triggerbox with this script attached;

 

GlobalVariable Property GameHour  Auto  
Objectreference Property Location01  Auto
Actor Property PlayerRef  Auto

Event OnTrigger(ObjectReference akActionRef)   
GameHour.GetValue()
If akActionRef == PlayerREF
	PlayerRef.MoveTo(Location01, abMatchRotation = true)
	GameHour.Mod(Time01)
EndIf
EndEvent

 

That works great. It looks like you are doing the right thing. Just one dumb question tho. You have set the properties of the "TimeOfDayGlobal" to "GameHour", right?

Link to comment
Share on other sites

Thats the easy part! First off: if you notice in my prev post I had some stuff way op in the top:

 

GlobalVariable Property GameHour  Auto  
Objectreference Property Location01  Auto
Actor Property PlayerRef  Auto

 

That's what you can't get a script to react to without running it trough the the ck. All you have to do to set the global variable, is to double click the script(or right click -> edit properties) from the "reference window" find the variable you need and edit the value - In this case just set the "TimeOfDayGlobalValue" to "GameHour" and you are all set!

 

 

Hope it works!

 

EDIT: I called my var "GameHour" because you can get the ck to recognize it with the "Auto-Fill All" button, but your way is just as legit.

Edited by assterixxx
Link to comment
Share on other sites

  • Recently Browsing   0 members

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