sakhmets Posted February 24, 2018 Share Posted February 24, 2018 hey lads, i'm workin' on two custom characters who have lore nd backstory together etc etc i was wondering if there's any way to make them gain sanity around each other specifically, but not other characters? thankz in advance for any answerz <3 Link to comment https://forums.kleientertainment.com/forums/topic/88002-sanity-gain-around-modded-character/ Share on other sites More sharing options...
K1NGT1GER609 Posted February 24, 2018 Share Posted February 24, 2018 here... local common_postinit = function(inst) --reference on where your code goes inst:AddTag("yourfriendstag") --don't matter too much what you put as long as the tag has meaning you'll avoid some of the reserved tags local master_postinit = function(inst) --reference on where your code goes local function sanityfn(inst) local x,y,z = inst.Transform:GetWorldPosition() local delta = 0 local max_rad = 10 local ents = TheSim:FindEntities(x,y,z, max_rad, nil, nil, {"yourfriendstag"}) for k,v in pairs(ents) do if not (v.components.health and v.components.health:IsDead()) then local sz = TUNING.SANITYAURA_SMALL --you can put small, med, large but it has to be on all caps local rad = 10 sz = sz * ( math.min(max_rad, rad) / max_rad ) local distsq = inst:GetDistanceSqToInst(v) delta = delta + sz/math.max(1, distsq) end end return delta end inst.components.sanity.custom_rate_fn = sanityfn your going to need to put the code in both character files and using tags will avoid crashing when one mod isn't active. Link to comment https://forums.kleientertainment.com/forums/topic/88002-sanity-gain-around-modded-character/#findComment-1008336 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