. . . Posted April 10, 2018 Share Posted April 10, 2018 (edited) Hello, if someone can help me out with this that'd be great ! So, basically like the title I'm wondering if there's a way to make a character not take sanity penalty from wetness, thanks for your time have a good time ! Edited April 13, 2018 by SuperDavid Link to comment https://forums.kleientertainment.com/forums/topic/89693-solved-way-to-make-character-not-take-sanity-penalty-from-wetness/ Share on other sites More sharing options...
. . . Posted April 13, 2018 Author Share Posted April 13, 2018 Hmm... so is giving my character a inst.components.sanity.dapperness = TUNING.DAPPERNESS_LARGE when they're wet the way to go about this? Probably not but that's all I can think of though.. bump ! Link to comment https://forums.kleientertainment.com/forums/topic/89693-solved-way-to-make-character-not-take-sanity-penalty-from-wetness/#findComment-1026106 Share on other sites More sharing options...
IronHunter Posted April 13, 2018 Share Posted April 13, 2018 (edited) If you want an accurate way to do it, you could just add this code to your custom_rate_fn --Taken from sanity.lua component from Sanity:Recalc fn local moisture_delta = easing.inSine(inst.components.moisture:GetMoisture(), 0, -TUNING.MOISTURE_SANITY_PENALTY_MAX, inst.components.moisture:GetMaxMoisture()) --add moisture_delta to your returned rate if you have it already or simply return it if you don't --By default TUNING.MOISTURE_SANITY_PENALTY_MAX is a negative number so we double negative it to make it gain sanity. Edited April 16, 2018 by IronHunter Link to comment https://forums.kleientertainment.com/forums/topic/89693-solved-way-to-make-character-not-take-sanity-penalty-from-wetness/#findComment-1026152 Share on other sites More sharing options...
. . . Posted April 13, 2018 Author Share Posted April 13, 2018 (edited) So is this how code should look like? local function sanityfn(inst) local delta = 0 local moisture_delta = easing.inSine(inst.components.moisture:GetMoisture(), 0, -TUNING.MOISTURE_SANITY_PENALTY_MAX, inst.components.moisture:GetMaxMoisture()) --add moisture_delta to your returned rate if you have it already or simply return it if you don't --By default TUNING.MOISTURE_SANITY_PENALTY_MAX is a negative number so we double negative it to make it gain sanity. return delta end --inside masterpostinit inst.components.sanity.custom_rate_fn = sanityfn Edited April 13, 2018 by SuperDavid Link to comment https://forums.kleientertainment.com/forums/topic/89693-solved-way-to-make-character-not-take-sanity-penalty-from-wetness/#findComment-1026156 Share on other sites More sharing options...
IronHunter Posted April 13, 2018 Share Posted April 13, 2018 (edited) local easing = require("easing")--line 1~ similar to willow local function sanityfn(inst) local delta = 0 local moisture_delta = easing.inSine(inst.components.moisture:GetMoisture(), 0, -TUNING.MOISTURE_SANITY_PENALTY_MAX, inst.components.moisture:GetMaxMoisture()) -- in the event you have other delta modifiers you can add them to the rest of the delta delta = delta + moisture_delta return delta end --master_postinit inst.components.sanity.custom_rate_fn = sanityfn more like this If you want to prevent sanity loss from equippables as well local easing = require("easing")--line 1~ similar to willow local function sanityfn(inst) local delta = 0 local moisture_delta = easing.inSine(inst.components.moisture:GetMoisture(), 0, -TUNING.MOISTURE_SANITY_PENALTY_MAX, inst.components.moisture:GetMaxMoisture()) -- in the event you have other delta modifiers you can add them to the rest of the delta for k, v in pairs(inst.components.inventory.equipslots) do if v.components.equippable ~= nil and v:GetIsWet() then moisture_delta = moisture_delta - TUNING.WET_ITEM_DAPPERNESS --double negative again end end delta = delta + moisture_delta return delta end --master_postinit inst.components.sanity.custom_rate_fn = sanityfn Edited April 16, 2018 by IronHunter equippables added Link to comment https://forums.kleientertainment.com/forums/topic/89693-solved-way-to-make-character-not-take-sanity-penalty-from-wetness/#findComment-1026159 Share on other sites More sharing options...
Lokoluna Posted April 16, 2018 Share Posted April 16, 2018 I've tried this, keeps stating that self is not declared. Link to comment https://forums.kleientertainment.com/forums/topic/89693-solved-way-to-make-character-not-take-sanity-penalty-from-wetness/#findComment-1026667 Share on other sites More sharing options...
IronHunter Posted April 16, 2018 Share Posted April 16, 2018 1 hour ago, Lokoluna said: I've tried this, keeps stating that self is not declared. I derped up the copy and paste I guess, updated the code. The self is from the moisture component, as this is suppose to be used in the inst instead. Link to comment https://forums.kleientertainment.com/forums/topic/89693-solved-way-to-make-character-not-take-sanity-penalty-from-wetness/#findComment-1026678 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