Jump to content

Recommended Posts

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

 

 

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)
Screenshot_12.png.edfff278d62a100922af8b9ef61d7f43.png

Edited by nuhuh

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)

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 by nuhuh

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...