Jump to content

How to solve this?


Recommended Posts

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 by Ultroman
Link to comment
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
 Share

×
  • Create New...