Custom Script - Day/Night Cycle?

Everything having to do with OpenMW's TES3MP branch.
Post Reply
Seldalore
Posts: 20
Joined: 09 Sep 2017, 08:40

Custom Script - Day/Night Cycle?

Post by Seldalore » 30 Apr 2019, 01:02

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.

davidcernat
Posts: 203
Joined: 19 Jul 2016, 01:02

Re: Custom Script - Day/Night Cycle?

Post by davidcernat » 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.

Seldalore
Posts: 20
Joined: 09 Sep 2017, 08:40

Re: Custom Script - Day/Night Cycle?

Post by Seldalore » 01 May 2019, 02:11

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.

silentthief
Posts: 399
Joined: 18 Apr 2013, 01:20
Location: Currently traversing the Ascadian Isles

Re: Custom Script - Day/Night Cycle?

Post by silentthief » 01 May 2019, 14:48

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
"Hurry, hurry! Last boat to Solstheim! Until the next one. Hah-ha-hah."

davidcernat
Posts: 203
Joined: 19 Jul 2016, 01:02

Re: Custom Script - Day/Night Cycle?

Post by davidcernat » 02 May 2019, 02:23

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.

Post Reply