Jump to content

Setting game time to a specific time?


PBalfredo

Recommended Posts

OOOOOOOH!

 

I have to define it from the Edit Properties menu! I kept thinking they meant defining the variable in the script itself, so I kept trying to do so. This solves so many of my problems. Not just this one, but other one's I've been having as well. Thank you so much!

 

Problem solved!

Edited by PBalfredo
Link to comment
Share on other sites

Yep, global variables are defined in the CK, so they have to be passed into the script via a Property in the script AND then link it using the Properties button.

I didn't know that the GameHour variable could be changed though, I assumed it was read-only. That's handy to know.

Presumably (if the wiki's correct) there's also a global called "TimeOfDay" or "TimeOfDayGlobal" that could be used, but I haven't checked in the CK, so I can't confim it.Glad you got it solved :thumbsup:

 

Edit: I finally got around to checking the CK. The correct global variable for Skyrim is "GameHour". There's no "TimeOfDay" variable in Skyrim so the wiki needs to be updated. The latter is the name used in the Gamebryo engine only.

Edited by steve40
Link to comment
Share on other sites

Try this:

Scriptname castleScript extends objectreference

Globalvariable Property isInstalled auto ; create a custom short global in your mod, set value to 1

globalvariable Property currentHour auto

Int Property appearHour = 19 auto
Int Property vanishHour = 7 auto

Event onInit()
    RegisterForSingleUpdate(5)
EndEvent

Event onUpdate()
   If(isInstalled.getValueInt() != 1)
         Return
   endif

   If( currentHour.getValueInt() > appearHour || currentHour.getValueInt() < vanishHour)
        Self.enable()
   Else

        ;do not implement some sort of teleport function
        Self.disable()
   Endif

   RegisterForSingleUpdate(5)

EndEvent

 

Attach to ever object you want to disappear.

Create a similar script to handle the teleport function, then attach it to a sepparate object.

Link to comment
Share on other sites

Try this:

Attach to ever object you want to disappear.

Create a similar script to handle the teleport function, then attach it to a sepparate object.

 

@Sjogga: the trick you're trying to do with the global variable to block the OnUpdate from running when the esp is deactivated won't actually work like that. I know that it is suggested in the Beth forums to do it that way, however, I've tested it and what actually happens is that getvalueint() will return a "none variable" kind of error. Then it will give a "this function will not be executed" type of error and the IF statement will be skipped so it will not stop the script. What you need to do is test for "isInstalled.GetValueInt() == 1" and then put all the good code INSIDE the IF statement :)

 

Secondly, running an OnUpdate every 5 seconds isn't very nice. Why not calculate how long you need to wait from current time to enable/disable time, then simply use RegisterForSingleUpdateGameTime so that you only need to run ONE update call instead of a repetitive loop :)

 

Lastly, I think it would be prudent to check if the castle is already enabled or disabled so that the script won't repetitively keep enabling a castle that is already enabled and vice versa :)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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