boardman94 Posted November 12, 2014 Share Posted November 12, 2014 I have a food item that I want to make regen the players sanity over time.I have tried using sanity:DoDelta, that is only instant.I have tried making the player have a sanityaura, that doesn't work.I can do repeated DoDeltas (with a task) but then it plays the sound and flashes the indicator green.I want just the arrow. I looked at the code for the garland but could not find the sanity part. Any help would be great.Thanks Link to comment https://forums.kleientertainment.com/forums/topic/44107-making-a-food-item-slowly-regen-sanity/ Share on other sites More sharing options...
Heavenfall Posted November 12, 2014 Share Posted November 12, 2014 Check out DoTaskInTime() Link to comment https://forums.kleientertainment.com/forums/topic/44107-making-a-food-item-slowly-regen-sanity/#findComment-567883 Share on other sites More sharing options...
Heavenfall Posted November 13, 2014 Share Posted November 13, 2014 (edited) So I started working on this yesterday but it turns out it's quite difficult to add things to be counted into the sanity UI badge. I couldn't come up with a good solution after an hour. Good luck. The simplest solution I could come up with was this for the prefab inst.components.edible:SetOnEatenFn(oneaten) local function oneaten(inst, eater) eater.components.sanity.dapperness = eater.components.sanity.dapperness + 1 eater:DoTaskInTime(30, function (inst) inst.components.sanity.dapperness = inst.components.sanity.dapperness - 1 end)end Edited November 13, 2014 by Heavenfall Link to comment https://forums.kleientertainment.com/forums/topic/44107-making-a-food-item-slowly-regen-sanity/#findComment-568130 Share on other sites More sharing options...
boardman94 Posted November 15, 2014 Author Share Posted November 15, 2014 @HeavenfallThanks, That produced the desired effect and will work great!Helpful, as always. Link to comment https://forums.kleientertainment.com/forums/topic/44107-making-a-food-item-slowly-regen-sanity/#findComment-569474 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