Page 1 of 1

Custom Script - Day/Night Cycle?

Posted: 30 Apr 2019, 01:02
by Seldalore
Hi,

I''m not sure if this is the right place to ask, but as the server can run scripts, could someone provide me with one that doubles the day/night cycle speed during the night, but revert to default speed during the day? Shorter nights is the key.

Re: Custom Script - Day/Night Cycle?

Posted: 30 Apr 2019, 18:47
by davidcernat
Find this line in serverCore.lua:

https://github.com/TES3MP/CoreScripts/b ... e.lua#L169

Add something like this to that spot, to make the timescale higher during the night:

Code: Select all

                -- Pass time faster if it's night
                if hourFloor >= 20 or hourFloor <= 6 then
                    WorldInstance.data.time.timeScale = 60
                else
                    WorldInstance.data.time.timeScale = 30
                end

                frametimeMultiplier = WorldInstance.data.time.timeScale / WorldInstance.defaultTimeScale
Edit: You've inspired me to add this functionality to the default server scripts.

Re: Custom Script - Day/Night Cycle?

Posted: 01 May 2019, 02:11
by Seldalore
Seems to be working well, thanks David! I set the scale to 240 for the desired result. Those nights were just tedious and I kept finding myself outdoors at almost only those times.

Re: Custom Script - Day/Night Cycle?

Posted: 01 May 2019, 14:48
by silentthief
davidcernat wrote: 30 Apr 2019, 18:47 Find this line in serverCore.lua:

https://github.com/TES3MP/CoreScripts/b ... e.lua#L169

Add something like this to that spot, to make the timescale higher during the night:

Code: Select all

                -- Pass time faster if it's night
                if hourFloor >= 20 or hourFloor <= 6 then
                    WorldInstance.data.time.timeScale = 60
                else
                    WorldInstance.data.time.timeScale = 30
                end

                frametimeMultiplier = WorldInstance.data.time.timeScale / WorldInstance.defaultTimeScale
Edit: You've inspired me to add this functionality to the default server scripts.
That's awesome - this allows for seasonal daylight/night lengths, or recreating the night lengths in Alaska (where you may only see 2 hours of sunlight a day for example). Even doing a mod for something like "from dusk til dawn"

ST

Re: Custom Script - Day/Night Cycle?

Posted: 02 May 2019, 02:23
by davidcernat
silentthief wrote: 01 May 2019, 14:48 That's awesome - this allows for seasonal daylight/night lengths, or recreating the night lengths in Alaska (where you may only see 2 hours of sunlight a day for example). Even doing a mod for something like "from dusk til dawn"

ST
Ideally, seasonal day and night lengths would be implemented by making it possible to change the starting hours for days and nights on clients, so that the hour you see in your resting window makes sense. My solution from above just makes time pass faster during night hours.