RxDeath Posted December 28, 2014 Share Posted December 28, 2014 Hello! I'm needing some help making a modded character, I have most of the coding in. I need to add in some custom items, to be able to have my character gain sanity by being near other players. If I can get any help it would be appreciated! Thanks!! Link to comment Share on other sites More sharing options...
rezecib Posted December 28, 2014 Share Posted December 28, 2014 @RxDeath, For the sanity, you can look at how Willow does it for fire. I'd guess you'd want a custom rate function something like this: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, {"player"}) for k,v in pairs(ents) do local sz = TUNING.SANITYAURA_TINY local rad = 4 -- this is the width of a tile sz = sz * ( math.min(max_rad, rad) / max_rad ) local distsq = inst:GetDistanceSqToInst(v) delta = delta + sz/math.max(1, distsq) end return deltaend 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