Lues Posted February 17, 2015 Share Posted February 17, 2015 Hello, I've been having trouble figuring out how to make my character lose more sanity during rain. I've got some of the others perks working (move faster at certain healths, lose hunger quicker, etc) but I can't seem to figure this one, so much that I chucked what I had the other day. Any help would be appreciated. Link to comment https://forums.kleientertainment.com/forums/topic/51080-help-increase-sanity-loss-during-rain/ Share on other sites More sharing options...
Jjmarco Posted February 17, 2015 Share Posted February 17, 2015 (edited) @Lues, Use custom_sanity_rate_fn. It's a function of the sanity component that you can assign yourself to add a custom sanity drain/gain to your character.You could do something like this in your char's master_postinit:inst.components.sanity.custom_rate_fn = function(inst) if TheWorld.state.israining then -- if it's raining return <Your custom sanity rate to add to the current one> end return 0 -- else, return nothingendYou can even use TheWorld.state.precipitationrate to make your custom rate vary with the rate of the precipitations:return <Your custom sanity rate do add to the current one>*TheWorld.state.precipitationrate Edited February 17, 2015 by Jjmarco Link to comment https://forums.kleientertainment.com/forums/topic/51080-help-increase-sanity-loss-during-rain/#findComment-613952 Share on other sites More sharing options...
Lues Posted February 19, 2015 Author Share Posted February 19, 2015 @Lues, Use custom_sanity_rate_fn. It's a function of the sanity component that you can assign yourself to add a custom sanity drain/gain to your character.You could do something like this in your char's master_postinit:inst.components.sanity.custom_rate_fn = function(inst) if TheWorld.state.israining then -- if it's raining return <Your custom sanity rate to add to the current one> end return 0 -- else, return nothingendYou can even use TheWorld.state.precipitationrate to make your custom rate vary with the rate of the precipitations:return <Your custom sanity rate do add to the current one>*TheWorld.state.precipitationrateThank you very much! It worked like a charm! @Lues, Use custom_sanity_rate_fn. It's a function of the sanity component that you can assign yourself to add a custom sanity drain/gain to your character.You could do something like this in your char's master_postinit:inst.components.sanity.custom_rate_fn = function(inst) if TheWorld.state.israining then -- if it's raining return <Your custom sanity rate to add to the current one> end return 0 -- else, return nothingendYou can even use TheWorld.state.precipitationrate to make your custom rate vary with the rate of the precipitations:return <Your custom sanity rate do add to the current one>*TheWorld.state.precipitationrateThank you very much! It worked like a charm! Link to comment https://forums.kleientertainment.com/forums/topic/51080-help-increase-sanity-loss-during-rain/#findComment-614644 Share on other sites More sharing options...
Safey Posted February 19, 2015 Share Posted February 19, 2015 (edited) Ignore this, I figured out something! Edited February 19, 2015 by Safey Link to comment https://forums.kleientertainment.com/forums/topic/51080-help-increase-sanity-loss-during-rain/#findComment-614675 Share on other sites More sharing options...
RomanticRedGeek Posted May 8, 2015 Share Posted May 8, 2015 @Lues, Use custom_sanity_rate_fn. It's a function of the sanity component that you can assign yourself to add a custom sanity drain/gain to your character.You could do something like this in your char's master_postinit:inst.components.sanity.custom_rate_fn = function(inst) if TheWorld.state.israining then -- if it's raining return <Your custom sanity rate to add to the current one> end return 0 -- else, return nothingendYou can even use TheWorld.state.precipitationrate to make your custom rate vary with the rate of the precipitations:return <Your custom sanity rate do add to the current one>*TheWorld.state.precipitationrate How can you utilize this function to just change the sanity rate at all times? For instance, I want my character to have a low max sanity but faster regen rate to offset it Link to comment https://forums.kleientertainment.com/forums/topic/51080-help-increase-sanity-loss-during-rain/#findComment-635581 Share on other sites More sharing options...
DarkXero Posted May 8, 2015 Share Posted May 8, 2015 The max sanity you get withinst.components.sanity:SetMax(100)Now what do you mean faster regen rate?You have an invisible top hat equipped all the time giving you sanity, or you boost positive regeneration values?Or you boost positive AND negative values? Link to comment https://forums.kleientertainment.com/forums/topic/51080-help-increase-sanity-loss-during-rain/#findComment-635588 Share on other sites More sharing options...
RomanticRedGeek Posted May 8, 2015 Share Posted May 8, 2015 Boost positive and negative values. Basically the equivalent of wearing an invisible top hat yeah. I want his max sanity to be 50 and night time and other negative factors drain faster, but to offset it, he gains sanity twice as fast as a normal character. Link to comment https://forums.kleientertainment.com/forums/topic/51080-help-increase-sanity-loss-during-rain/#findComment-635593 Share on other sites More sharing options...
DarkXero Posted May 8, 2015 Share Posted May 8, 2015 @RomanticRedGeek, -- night time and other negative factors drain faster, he gains sanity twice as fast as a normal character -- Boost positive and negative valuesThis means that if you have a -5 sanity rate, you would have, for example, -10.And if you have +5, then it would be +10. -- Basically the equivalent of wearing an invisible top hatMeans that you have a constant +3.3/min sanity summed up to your rateDuring night (-5/min), you would have -1.7.During day, +3.3. Do you want both things, only one, or want to rethink what you especifically want?I assume you want the positive and negative boost, so no invisible top hat is needed. Useinst.components.sanity.rate_modifier = 2 Link to comment https://forums.kleientertainment.com/forums/topic/51080-help-increase-sanity-loss-during-rain/#findComment-635597 Share on other sites More sharing options...
RomanticRedGeek Posted May 8, 2015 Share Posted May 8, 2015 So this just doubles the rate for both positive and negative values then? Yes, that's what I want. Link to comment https://forums.kleientertainment.com/forums/topic/51080-help-increase-sanity-loss-during-rain/#findComment-635603 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