Custom Script - Day/Night Cycle?

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

Custom Script - Day/Night Cycle?

Post 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.
davidcernat
Posts: 256
Joined: 19 Jul 2016, 01:02

Re: Custom Script - Day/Night Cycle?

Post 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.
Seldalore
Posts: 36
Joined: 09 Sep 2017, 08:40
Location: Pelagiad

Re: Custom Script - Day/Night Cycle?

Post 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.
User avatar
silentthief
Posts: 456
Joined: 18 Apr 2013, 01:20
Location: Currently traversing the Ascadian Isles

Re: Custom Script - Day/Night Cycle?

Post 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
davidcernat
Posts: 256
Joined: 19 Jul 2016, 01:02

Re: Custom Script - Day/Night Cycle?

Post 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.
Post Reply