kaachiel Posted June 15, 2017 Share Posted June 15, 2017 (edited) Hi! I've been stalking this forum for a whole day now and none of the codes I found worked for me... To be fair, I am new to coding and I've probably messed up somewhere. The codes I need are for: -Sanity drains noticeably faster when raining (can be prevented with umbrella or hat or etc) [edit: I tried this, it works buuuuuuuuuuut it made no difference, in fact despite having a high wetness the sanity wouldn't budge from max] Quote local function onisraining(inst, israining) if israining then inst.rain_task = inst.rain_task or inst:DoPeriodicTask(1, function(inst) inst.components.sanity:DoDelta(-10) end) else if inst.rain_task ~= nil then inst.rain_task:Cancel() end end end local function onbecamealive(inst) inst:WatchWorldState("israining", onisraining) end local function onbecameghost(inst) inst:StopWatchingWorldState("israining", onisraining) end or -Character walks slower when raining (walks normally with umbrella, hat, etc) and here's a code I tried for that...but it didn't work (it crashed) inst:ListenForEvent("onrain", function(inst, data) -- Checks if an umbrella is equipped local mitigates_rain = false for k,v in pairs (inst.components.inventory.equipslots) do if v:HasTag("waterproofer") then mitigates_rain = true end end -- Slows down the character if it is raining and there isn't an umbrella equipped if TheWorld.state.israining and not umbrella_equipped then inst.components.locomotor:SetExternalSpeedMultiplier(inst, "character_speed_mod", 0.10) else inst.components.locomotor:SetExternalSpeedMultiplier(inst, "character_speed_mod", 1) end end Thank you in advance! Edited June 15, 2017 by kaachiel Link to comment https://forums.kleientertainment.com/forums/topic/79878-perk-sanity-and-rain/ 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