Cow_en Posted June 17 Share Posted June 17 I'm new to DST modding, so I'm unaware of all the ins and outs. At the moment, I want to rework the sanity system for a character and need help with editing how sanity works. How would I make a character -- A.) Not have a constant drain on sanity (time of day / negative sanity auras / instant sanity drops). B.) Make the character lose sanity to other sources, that might not usually drop sanity. Thanks ahead of time, any responses are greatly appreciated! Link to comment Share on other sites More sharing options...
Cow_en Posted July 11 Author Share Posted July 11 Boost Link to comment Share on other sites More sharing options...
Glommer2 Posted July 16 Share Posted July 16 local GOOD_REQUIRED_SANITY_TAGS = { "tree" } local GOOD_EXCLUDE_SANITY_TAGS = { "burnt", "stump", "fire" } local BAD_REQUIRED_SANITY_TAGS = { "tree" } local BAD_EXCLUDE_SANITY_TAGS = { "burnt", "stump", "fire" } local function UpdateExtraSanityGain(inst) local x, y, z = inst.Transform:GetWorldPosition() local num_good_entities = #TheSim:FindEntities(x, y, z, 10, GOOD_REQUIRED_SANITY_TAGS, GOOD_EXCLUDE_SANITY_TAGS) --local num_bad_entities = #TheSim:FindEntities(x, y, z, 10, BAD_REQUIRED_SANITY_TAGS, BAD_EXCLUDE_SANITY_TAGS) --------(x,y,z,a range to find what effect your san,what inclued,what excluded) --here we look for tree that is not on fire inst._extra_sanity_gain = num_good_entities --- num_bad_entities end local function CustomSanityFn(inst, dt) return inst._extra_sanity_gain end local master_postinit = function(inst) inst._extra_sanity_gain = 0 inst._update_extra_sanity_task = inst:DoPeriodicTask(1, UpdateExtraSanityGain) inst.components.sanity.get_equippable_dappernessfn = GetEquippableDapperness--this will make equip sanity effect you no more inst.components.sanity.night_drain_mult = 0--this is night and dawn san decrease inst.components.sanity.neg_aura_mult = 0--this is negative creature effect end --as for flower thing, it changes your sanity in their fn,you may need to write a listener to deduct it Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now