Jump to content

[HELP] Don't Starve Together Character modding


Recommended Posts

I'm making a character mod and I'm trying to make a string of code to make the character lose 50 sanity when they get wet however I've been really struggling to do it and I can't seem to get it to work

    if inst.components.moisture ~= nil and inst.components.moisture:GetMoisture() > 0 then
    local self = inst.components.sanity
    inst.components.sanity.DoDelta(self, nil, 50, nil, nil)

Some help would be appreciated if anyone could give any

Link to comment
Share on other sites

On 3/6/2024 at 10:19 PM, Unfunnyguy said:

    local self = inst.components.sanity
    inst.components.sanity.DoDelta(self, nil, 50, nil, nil)

It should look like this, depending on how you do this tho; I recommend trying to reset the moisture back to 0 so that it doesn't continue to remove sanity.

    if inst.components.moisture ~= nil and inst.components.moisture:GetMoisture() > 0 then
       inst.components.sanity.DoDelta(-50)
    end
Link to comment
Share on other sites

On 3/9/2024 at 1:40 PM, Thomas Die said:

It should look like this, depending on how you do this tho; I recommend trying to reset the moisture back to 0 so that it doesn't continue to remove sanity.

    if inst.components.moisture ~= nil and inst.components.moisture:GetMoisture() > 0 then
       inst.components.sanity.DoDelta(-50)
    end

Thank you so much

  • Health 1
Link to comment
Share on other sites

Posted (edited)
On 3/9/2024 at 1:40 PM, Thomas Die said:

It should look like this, depending on how you do this tho; I recommend trying to reset the moisture back to 0 so that it doesn't continue to remove sanity.

    if inst.components.moisture ~= nil and inst.components.moisture:GetMoisture() > 0 then
       inst.components.sanity.DoDelta(-50)
    end

 

Edited by Unfunnyguy
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...