Sign in to follow this  

Don't Starve Together Mod Help

Recommended Posts

RxDeath    0



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!



Share this post

Link to post
Share on other sites
rezecib    3193

@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

Share this post

Link to post
Share on other sites

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
Sign in to follow this