Jump to content

Recommended Posts

Hello,

I'm attempting to have two different sources drain sanity without them overriding each other.

The basic setup is the character should lose sanity during the day, dusk would remain normal, and no sanity drain at night.

Along with this they have an alternate mode they can change into by pressing T, this mode drains sanity while you're in it, and when you come out of it it should return back to normal.

The issue I'm running into is using inst.components.sanity.dapperness seems to completely override each instance instead of being added or subtracted from each other.

Any help would be appreciated.

Thank you

I've resolved this issue. Instead of using  inst.components.sanity.dapperness  to set the sanity drain during the day I setup a custom function for sanity drain.

local function sanityfn(inst)
    local delta = 0
    if TheWorld.state.isday then
            delta = TUNING.SANITY_NIGHT_MID
    end
    return delta
end

 

--This part will go into the Master Postinit

inst.components.sanity.custom_rate_fn = sanityfn

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...