Taob Posted July 17, 2020 Share Posted July 17, 2020 I need help to put in a custom length, I was getting a script from another mod. At first it worked fine, however I made a few changes and it didn't work. The mod I used is this: https://steamcommunity.com/sharedfiles/filedetails/?id=1940293917 and the script is (random season duration) local require = GLOBAL.require local function OnSeasonChange(wrld) wrld:DoTaskInTime(1, function(inst) local autumnseasonlength = GLOBAL.GetRandomItem({ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32 }) local springseasonlength = GLOBAL.GetRandomItem({ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32 }) local winterseasonlength = GLOBAL.GetRandomItem({ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 }) local summerseasonlength = GLOBAL.GetRandomItem({ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 }) if wrld.state.season == "winter" then wrld:PushEvent("ms_setseasonlength", {season="autumn", length=autumnseasonlength}) wrld:PushEvent("ms_setseasonlength", {season="winter", length=winterseasonlength}) wrld:PushEvent("ms_setseasonlength", {season="spring", length=springseasonlength}) wrld:PushEvent("ms_setseasonlength", {season="summer", length=summerseasonlength}) end end) end function WaitPlayerActivated(wrld) wrld:WatchWorldState("season", OnSeasonChange) end AddPrefabPostInit("world", WaitPlayerActivated) ------ However, I changed it to: local require = GLOBAL.require local function OnSeasonChange(wrld) wrld:DoTaskInTime(1, function(inst) local autumnseasonlength = GLOBAL.GetRandomItem({ 89, 90 }) local springseasonlength = GLOBAL.GetRandomItem({ 92, 93 }) local winterseasonlength = GLOBAL.GetRandomItem({ 87, 89 }) local summerseasonlength = GLOBAL.GetRandomItem({ 93, 94 }) if wrld.state.season == "autumn" then wrld:PushEvent("ms_setseasonlength", {season="autumn", length=autumnseasonlength}) wrld:PushEvent("ms_setseasonlength", {season="winter", length=winterseasonlength}) wrld:PushEvent("ms_setseasonlength", {season="spring", length=springseasonlength}) wrld:PushEvent("ms_setseasonlength", {season="summer", length=summerseasonlength}) end end) end function WaitPlayerActivated(wrld) wrld:WatchWorldState("season", OnSeasonChange) end AddPrefabPostInit("world", WaitPlayerActivated) What I'm trying to do is make the stations longer, without the randomness, but I'm afraid to move the code and it won't work, like now. I'm new at this and I'm trying to learn. TY Sorry for my bad english btw. Link to comment https://forums.kleientertainment.com/forums/topic/120164-how-to-set-a-custom-season-length/ Share on other sites More sharing options...
rawii22 Posted July 18, 2020 Share Posted July 18, 2020 I don't know about coding the season, but since I have seen something relating to this, I'll share it... On the DST Commands webpage,https://dontstarve.fandom.com/wiki/Console/Don't_Starve_Together_Commands there is a way to customize the season seg lengths like so: TheWorld:PushEvent("ms_setseasonclocksegs", {summer={day=sx,dusk=sy,night=sz}, winter={day=wx,dusk=wy,night=wz}}) and it is followed by an example stating that the total of the day, dusk, and night segs must equal 16: TheWorld:PushEvent("ms_setseasonclocksegs", {summer={day=14,dusk=1,night=1}, winter={day=13,dusk=1,night=2}}) perhaps you could run this in a modmain right after the world starts, maybe an AddSimPostInit... 1 Link to comment https://forums.kleientertainment.com/forums/topic/120164-how-to-set-a-custom-season-length/#findComment-1355256 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now