Unfunnyguy Posted March 6, 2024 Share Posted March 6, 2024 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 https://forums.kleientertainment.com/forums/topic/154670-help-dont-starve-together-character-modding/ Share on other sites More sharing options...
Thomas_klei Posted March 9, 2024 Share Posted March 9, 2024 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 https://forums.kleientertainment.com/forums/topic/154670-help-dont-starve-together-character-modding/#findComment-1703552 Share on other sites More sharing options...
Unfunnyguy Posted March 10, 2024 Author Share Posted March 10, 2024 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 1 Link to comment https://forums.kleientertainment.com/forums/topic/154670-help-dont-starve-together-character-modding/#findComment-1703847 Share on other sites More sharing options...
Unfunnyguy Posted March 10, 2024 Author Share Posted March 10, 2024 (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 March 10, 2024 by Unfunnyguy Link to comment https://forums.kleientertainment.com/forums/topic/154670-help-dont-starve-together-character-modding/#findComment-1703858 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