kaccraftowy Posted November 14, 2018 Share Posted November 14, 2018 Hi, I want to make function, when character eat any food then script do action like adding +1 sanity/health. How I can do this? Link to comment https://forums.kleientertainment.com/forums/topic/98794-how-to-solve-this/ Share on other sites More sharing options...
Ultroman Posted November 15, 2018 Share Posted November 15, 2018 (edited) Every time a player eats something, this event is pushed: self.inst:PushEvent("oneaten", { eater = eater }) You can listen for this event like this: AddPlayerPostInit(function() inst:ListenForEvent("oneaten", function(eater) if eater and eater.components.health then eater.components.health:DoDelta(1) end if eater and eater.components.sanity then eater.components.sanity:DoDelta(1) end end) end) Edited November 16, 2018 by Ultroman Link to comment https://forums.kleientertainment.com/forums/topic/98794-how-to-solve-this/#findComment-1116519 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