Jump to content

Code for "losing sanity at day" and "gaining sanity at dusk/night"


Recommended Posts

In your character lua


inst.components.sanity.dapperness = TUNING.DAPPERNESS.MED*-1

-- where Tuning.Dapperness is your default (daytime) sanity loss/gain rate

-- this is adapted from the character waxwell.lua

-- Dapperness rates are shown in the Tuning.Lua file


        DAPPERNESS_TINY = 100/(day_time*15),
        DAPPERNESS_SMALL = 100/(day_time*10),
        DAPPERNESS_MED = 100/(day_time*6),
        DAPPERNESS_LARGE = 100/(day_time*3),
        DAPPERNESS_HUGE = 100/(day_time),


day_time default is 300* but is dependent on day segments (daylight time) so probably changes slightly

with seasons as the number of segments of day light increase and decrease.

At default day_time 'Tiny' comes out to 0.02 and 'Huge' comes out to 0.33


* 30 seconds per segment, 10 segments of daylight.


I think dapperness is the sanity change per real time second, and 30 real time seconds per day 'segment' resulting in 480 real time seconds per day, (300 in daylight by default).  At night the dapperness is affected by other factors and (while you might normally be gaining sanity) you loose sanity faster than any gain.


My point being at 'Tiny' there is (barring any other factors light night and monsters) a change of about 11 sanity per full day, 16 at 'Small', 27 at 'Med', 53 at 'Large' and 160 at 'Huge'.



inst.components.sanity.night_drain_mult = -0.5

-- multiplier for sanity drain at night, in theory the negative multiplier will result in sanity gain.

-- this is adapted from the character wolfgang.lua

-- be careful of this, the character might rapidly gain sanity just by standing in the pitch black


inst.components.sanity.neg_aura_mult = 1.0

-- multiplier for sanity drain around creatures (if you want a change in that)

-- this is adapted from the character wolfgang.lua

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

  • Create New...