Jump to content

How would I do Conditional Stat Changes?


Recommended Posts

For the character I am making, I want to have multiple stat changes based on different conditions. First there is the movement and attack speed boost when holding a weapon. Secondly I would like his health, sanity, sanity drain, hunger, and hunger drain to change when it is winter. Is this possible in Don't Starve?

Link to comment
Share on other sites

Use in the constructor function of your character a WatchWorldState for the season thingy.

For the first point, i would use a ListenForEvent and catch the "equip" event to check which item was equipped/unequipped and apply stats changed accordingly

Link to comment
Share on other sites

@SgtPineapple1st, it's unclear if you're wanting to create a mod for Don't Starve or Don't Starve Together; you simply stated Don't Starve yet you posted in the Don't Starve Together section. While @ZupaleX's post tells you how to do it in Don't Starve Together; if you tried to use the same code in Don't Starve it would not work correctly.

 

In Don't Starve you'd have to ListenForEvent 'seasonchange' and then if you're wanting it to work with Shipwrecked you would have to completely code it for that separately yet again because Shipwrecked doesn't have 'winter' it has different seasons.

 

Link to comment
Share on other sites

@SgtPineapple1st, it's unclear if you're wanting to create a mod for Don't Starve or Don't Starve Together; you simply stated Don't Starve yet you posted in the Don't Starve Together section. While @ZupaleX's post tells you how to do it in Don't Starve Together; if you tried to use the same code in Don't Starve it would not work correctly.

 

In Don't Starve you'd have to ListenForEvent 'seasonchange' and then if you're wanting it to work with Shipwrecked you would have to completely code it for that separately yet again because Shipwrecked doesn't have 'winter' it has different seasons.

Ah thank you. Yeah I meant don't starve together. My friend and I are both making characters. I will look for @ZupaleX's post.

Link to comment
Share on other sites

Use in the constructor function of your character a WatchWorldState for the season thingy.

For the first point, i would use a ListenForEvent and catch the "equip" event to check which item was equipped/unequipped and apply stats changed accordingly

 

I took a look at a few mods that have seasonal changes such as for farming or in the calendar mods. Most of them used GetSeasonManager() and checked season:IsWinter or season:IsSpring. I haven't tested it as I've been doing a majority of my coding at school.

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
 Share

×
×
  • Create New...