Jump to content

Checking for current season

Recommended Posts

Hello, this is my first time modding for Don't Starve and I'm trying to add an effect to my character's movement speed based on the season. I have looked around and found other modders' success, but I can't seem to understand what I am doing wrong. I have taken to figuring it out by looking through code of other characters that people have made, more specifically a character named Wurbert, a snow man made by "The Tiddler" on the steam workshop.


They have used an if statement like this to detect winter and summer:

if GetSeasonManager():IsWinter() then...

elseif GetSeasonManager():IsSummer() then...

And so I used it for my own: (note: it is in  a "local fn = function(inst)"  and the numbers are exaggerated for testing purposes)


if GetSeasonManager():IsWinter() then
      inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED * 3)
      inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 3)

elseif GetSeasonManager():IsSummer() then
      inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED 0.5)
      inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED * 0.5)

      inst.components.locomotor.walkspeed = (TUNING.WILSON_WALK_SPEED)
      inst.components.locomotor.runspeed = (TUNING.WILSON_RUN_SPEED)



But the code keeps on crashing Don't Starve when I enable the mod.

Can anyone help?

It is also my first time with lua codding.


Link to comment
Share on other sites

First of all, it sounds like you need an introduction to DS/DSTmodding. This post should answer most of the starter questions and help you get truckin'.

Second, we can't really help without the log files, so follow the guide in the post I just linked, to find your log files, and attach them to a reply by dragging the files onto your reply. Also please include a zip of your mod, so we can see what you're doing.

It's good to note that you're modding for Don't Starve and not Don't Starve Together, since in DST it'd be really bad to change the tuning variables, since it would affect everyone. However, even in DS, it's a good idea to search the game files for the tuning-variable you're about to change, because it MIGHT be used for something other than the player character. I don't think that's the case for run- and walk-speed, but maybe the pigmen have their movement speed set by using the same variable, and that wouldn't be good :) There are tips for how to do this ("Find in files" in Notepad++) in the post I linked, as well.

Edited by Ultroman
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...