Lues 0 Report post 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. Share this post Link to post Share on other sites
Jjmarco 54 Report post 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 Share this post Link to post Share on other sites
Lues 0 Report post 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! Share this post Link to post Share on other sites
Safey 2 Report post Posted February 19, 2015 (edited) Ignore this, I figured out something! Edited February 19, 2015 by Safey Share this post Link to post Share on other sites
RomanticRedGeek 2 Report post 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 Share this post Link to post Share on other sites
DarkXero 2889 Report post 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? Share this post Link to post Share on other sites
RomanticRedGeek 2 Report post 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. Share this post Link to post Share on other sites
DarkXero 2889 Report post 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 Share this post Link to post Share on other sites
RomanticRedGeek 2 Report post Posted May 8, 2015 So this just doubles the rate for both positive and negative values then? Yes, that's what I want. Share this post Link to post Share on other sites