Jump to content

Help with sanity modifiers


Recommended Posts

Hey guys, my question is this;

I want my character to be doubly affected (both positively and negatively) with anything pertaining to sanity. I basically want picked flowers to give 10 and dark to do -10 etc etc. I've experimented with dapperness and I've done some truly bizarre things with it but I just can't seem to get a general x2 sanity modifier to work. I understand the tuning values for everything is already predetermined.

 My code is this.

-- Sanity modifiers
    local Sanity = Class(function(self, inst)
    inst.components.sanity.night_drain_mult = 1.3
    inst.components.sanity.neg_aura_mult = 2
    inst.components.sanity.rate_modifier = 2
    end)

 

Originally it was ...sanity.self.rate_modifier but it didn't seem to work either. Should I remove the previous multiplier values pertaining to night and negative drains for a universal modifier? Please help :( :?

Link to comment
Share on other sites

AddPrefabPostInit("wilson",
    function(inst)
        if(inst and inst.components and inst.components.sanity)
        then
            local DoDelta_old = inst.components.sanity.DoDelta
            inst.components.sanity.DoDelta = function(self, delta, overtime)
                    if(DoDelta_old~=nil)
                    then
                        DoDelta_old(self, delta*2.0, overtime)
                    end
                end
        end
    end
)

The portion of the code for a custom character would be lines 5-11 put in the character's postinit function.

Edited by CarlZalph
Link to comment
Share on other sites

4 hours ago, CarlZalph said:

AddPrefabPostInit("wilson",
    function(inst)
        if(inst and inst.components and inst.components.sanity)
        then
            local DoDelta_old = inst.components.sanity.DoDelta
            inst.components.sanity.DoDelta = function(self, delta, overtime)
                    if(DoDelta_old~=nil)
                    then
                        DoDelta_old(self, delta*2.0, overtime)
                    end
                end
        end
    end
)

The portion of the code for a custom character would be lines 5-11 put in the character's postinit function.

Thank you, you rock!

 

Edit:

However, with this added to my character my brother cannot join my server if it has caves enabled. It gives him the "server is not responding" error, any suggestions?

Edited by BeansInMyLean
Link to comment
Share on other sites

10 hours ago, BeansInMyLean said:

However, with this added to my character my brother cannot join my server if it has caves enabled. It gives him the "server is not responding" error, any suggestions?

Caverns turn the server into a shard server and a full dedicated.

Ensure the mod has all_clients_require_mod and that it's enabled on the server.

Link to comment
Share on other sites

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
 Share

×
  • Create New...