rons0n Posted August 2, 2017 Share Posted August 2, 2017 So I have a character who whenever she does an emote she loses 25 hunger and gains 25 sanity. But I dont know how to set it to a specific emote and make it so that everyone gains sanity around a certain proximity(Like the firepits light range). RIght now I have this thanks to browsing through these fourms: -- Emote for Sanity inst:ListenForEvent("emote", function(inst, data) if inst:HasTag("cheery") then inst.components.sanity:DoDelta(25) inst.components.hunger:DoDelta(-25) end end) Any ideas? I appreciate the help! Link to comment https://forums.kleientertainment.com/forums/topic/80974-cheers-for-sanity/ Share on other sites More sharing options...
DarkXero Posted August 2, 2017 Share Posted August 2, 2017 -- Emote for Sanity inst:ListenForEvent("emote", function(inst, data) if inst:HasTag("cheery") then inst.components.sanity:DoDelta(25) inst.components.hunger:DoDelta(-25) for k, v in pairs(AllPlayers) do if v ~= inst and v:IsNear(inst, 16) and v.components.sanity then v.components.sanity:DoDelta(10) end end end end) You can use TheSim:FindEntities and loop through the result, too. But this isn't as expensive. The 16 is the range in units (1 turf = 4 units). Link to comment https://forums.kleientertainment.com/forums/topic/80974-cheers-for-sanity/#findComment-943403 Share on other sites More sharing options...
rons0n Posted August 2, 2017 Author Share Posted August 2, 2017 Thanks man! Been life saving me for years. Works perfectly and I can't thank ya enough. Link to comment https://forums.kleientertainment.com/forums/topic/80974-cheers-for-sanity/#findComment-943432 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