GibusPyro Posted January 16, 2025 Share Posted January 16, 2025 (edited) Hey there. I'm trying to code a character that has a sanity gain when around passive insects (I.e. bees, butterflies, etc.) and no sanity loss when around aggressive entities (I.e. spiders). I'm pretty new to the process of modding, and I've had little success surfing the forums. Any help would be greatly appreciated. Edited January 16, 2025 by GibusPyro Link to comment https://forums.kleientertainment.com/forums/topic/163171-character-restoring-sanity-near-specific-entites/ Share on other sites More sharing options...
yanecc Posted January 17, 2025 Share Posted January 17, 2025 -- For your character inst.components.sanity:AddSanityAuraImmunity("hostile") inst.components.sanity:AddSanityAuraImmunity("monster") for i, v in pairs({ "bee", "butterfly", "moonbutterfly" }) do AddPrefabPostInit(v, function(inst) inst:AddComponent("sanityaura") inst.components.sanityaura.aura = 24 / TUNING.TOTAL_DAY_TIME end) end Link to comment https://forums.kleientertainment.com/forums/topic/163171-character-restoring-sanity-near-specific-entites/#findComment-1786253 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