Jump to content

Recommended Posts

My mod character has the line inst.components.sanity.ignore = true on file. 

Everytime he revives (Be it: Florid postern, Red amulet, Meat effigy etc...) Sanity goes back to normal. The only way it goes back to was originally intended is when i reset the server. 

In the mean time, i think i will just add dapperness so he can have a similar effect (What i'm looking most is that wetness/equipment/spell using: does not consume sanity). Besides that, i also was trying to add a phobia (Similar to what Sr Pelo's mod had, but since the phobia line seems to only work with SP DS, not sure if there is an alternative for DST). 

4 hours ago, TheDarkSyntax said:

Everytime he revives (Be it: Florid postern, Red amulet, Meat effigy etc...) Sanity goes back to normal. The only way it goes back to was originally intended is when i reset the server. 

Yes, this is the default behaviour.  You can see it happening in scripts/prefabs/player_common_extensions.lua 's CommonActualRez:

    --don't ignore sanity any more
    inst.components.sanity.ignore = GetGameModeProperty("no_sanity")

And in the same file's CommonPlayerDeath:

    inst.components.sanity.ignore = true

 

To work around this, you can do a metatable hook on the sanity component and do what's called a proxy table to hook the ignore variable from changing on your character's prefab.

 

Alternatively, if that's too much of a hassle, there's a redirect function for the sanity component that you can make use of:

-- Up in your mod's global space
local NoSanity = function(owner, delta, overtime)
    -- Do nothing.
end


-- In the mastersim post init for your character's prefab
inst.components.sanity.redirect = NoSanity

Which pipes the game logic into your custom handler function instead of its default.  This function isn't overridden elsewhere currently.

  • Like 2

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