Jump to content

Recommended Posts

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.

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