SchattenspielRex Posted October 2, 2015 Share Posted October 2, 2015 I have been working fine with mods in both DS and DST BUTI have one problem; Im making a character for a friend who is supposed to lose sanity when it rains; and lose more and more depending on how wet the world is (well significantly more than normal sanity drain from rain)And I cant figure out at all how to do this Im still pretty much a noob so any explainations are helpful Link to comment Share on other sites More sharing options...
Valkyrie19k Posted October 2, 2015 Share Posted October 2, 2015 (edited) I have been working fine with mods in both DS and DST BUTI have one problem; Im making a character for a friend who is supposed to lose sanity when it rains; and lose more and more depending on how wet the world is (well significantly more than normal sanity drain from rain)And I cant figure out at all how to do this Im still pretty much a noob so any explainations are helpful This is the code I used to "gain sanity" during rain, dapperness included.(You could probably put a negative sign before the TUNING in order to get the opposite effect.)Put this outside your master_postinit--Gain sanity in rainlocal function doraincheck(inst) --, dt) --insects local x,y,z = inst.Transform:GetWorldPosition() local e = TheSim:FindEntities(x,y,z,5,nil,nil,{"bee","mosquito"}) local dapp = TUNING.DAPPERNESS_MED_LARGE * 3 * #e --rain local w = TheWorld.state if w.israining then if inst.components.sanity.current > 50 then dapp = dapp + TUNING.DAPPERNESS_MED_LARGE * 1.5 * w.precipitationrate elseif inst.components.sanity.current > 30 then dapp = dapp + TUNING.DAPPERNESS_MED_LARGE*2* w.precipitationrate else dapp = dapp + TUNING.DAPPERNESS_MED_LARGE*2.5* w.precipitationrate end end --moisture if inst.components.moisture and inst.components.moisture:GetMoisture() > 0 and inst.components.moisture:GetMoisturePercent() < 0.15 then dapp = dapp + TUNING.DAPPERNESS_SMALL + TUNING.MOISTURE_SANITY_PENALTY_MAX/4 end inst.components.sanity.dapperness = dappendPut this inside your master_postinit --Sanity in rain check inst:DoPeriodicTask(0.3 + math.random()*0.1, doraincheck )I'm not a pro modder so I'm not sure if this is the best code out there. I'm just a newbie learning and just sharing this info before the pro modders come in. Hope I helped. Edited October 2, 2015 by Valkyrie19k Link to comment 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