nuhuh Posted July 18, 2024 Share Posted July 18, 2024 I only found how to lose sanity from damage in walter.lua, but I dont know how to rework these lines so my character's sanity gain from damage Quote local function OnHealthDelta(inst, data) if data.amount < 0 then inst.components.sanity:DoDelta(data.amount * ((data ~= nil and data.overtime) and TUNING.WALTER_SANITY_DAMAGE_OVERTIME_RATE or TUNING.WALTER_SANITY_DAMAGE_RATE) * inst._sanity_damage_protection:Get()) end end Link to comment https://forums.kleientertainment.com/forums/topic/158381-help-how-to-make-gain-sanity-from-taking-damage/ Share on other sites More sharing options...
zaptrap Posted July 18, 2024 Share Posted July 18, 2024 make sure OnHealthDelta is in a ListenForEvent call, and make sure that the number is negative (for example use -2 instead of that that tuning variable. remember that 2 negatives multiplied make a positive) Link to comment https://forums.kleientertainment.com/forums/topic/158381-help-how-to-make-gain-sanity-from-taking-damage/#findComment-1736381 Share on other sites More sharing options...
nuhuh Posted July 19, 2024 Author Share Posted July 19, 2024 (edited) 19 hours ago, zaptrap said: make sure OnHealthDelta is in a ListenForEvent call, and make sure that the number is negative (for example use -2 instead of that that tuning variable. remember that 2 negatives multiplied make a positive) tysm for help, it's working, doesn't crashes anymore, but sanity still loses, not regain. i think i wrote negative number in wrong spot... or i wrote "-2" wrong? (idk how negative number working in lua) Edited July 19, 2024 by nuhuh Link to comment https://forums.kleientertainment.com/forums/topic/158381-help-how-to-make-gain-sanity-from-taking-damage/#findComment-1736580 Share on other sites More sharing options...
zaptrap Posted July 19, 2024 Share Posted July 19, 2024 you shouldnt be checking if data.amount is less than -2 (keep that at 0). you should be replacing the TUNING.SANITY_DAMAGE_RATE variables with a negative number (these constants are a mult factor, you can see what they are in tuning.lua) Link to comment https://forums.kleientertainment.com/forums/topic/158381-help-how-to-make-gain-sanity-from-taking-damage/#findComment-1736602 Share on other sites More sharing options...
nuhuh Posted July 20, 2024 Author Share Posted July 20, 2024 (edited) 23 hours ago, zaptrap said: you shouldnt be checking if data.amount is less than -2 (keep that at 0). you should be replacing the TUNING.SANITY_DAMAGE_RATE variables with a negative number (these constants are a mult factor, you can see what they are in tuning.lua) I tried several from tuning.lua but it leads to crashes, maybe cuz i don't know what should it look like. sorry, but can you write the finished line? Edited July 20, 2024 by nuhuh Link to comment https://forums.kleientertainment.com/forums/topic/158381-help-how-to-make-gain-sanity-from-taking-damage/#findComment-1736884 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