Search the Community
Showing results for tags 'eaten'.
Found 1 result
I'm trying to make woodie be able to use living logs as an off and on switch of his state, if he eats a living log as a beaver he turns into woodie and vice versa, but I'm not able to make it happen without crashing, I've been looking at everything related to this, event handlers because transforming is an event but how do I apply it to a eaten item? it says eater is not defined to say it's woodie who transforms if eaten. I noticed that there was only inst so I decided to replace everything with eater to see if it worked, I've stressed out options in the past by using woodie's prefab own transform bits but it doesn't work, i've read rezecibs post to understand. inst:AddComponent("edible") inst.components.edible.foodtype = FOODTYPE.WOOD inst.components.edible.woodiness = 0 inst.components.edible.healthvalue = 0 inst.components.edible.hungervalue = 0 if eater.isbeavermode:value() then eater:RemoveTag("beaver") eater.Network:RemoveUserFlag(USERFLAGS.CHARACTER_STATE_1) eater.isbeavermode:set(false) eater:PushEvent("stopbeaver") OnBeaverModeDirty(eater) if not eater.isbeavermode:value() then eater:AddTag("beaver") eater.Network:AddUserFlag(USERFLAGS.CHARACTER_STATE_1) eater.isbeavermode:set(true) eater:PushEvent("startbeaver") OnBeaverModeDirty(eater) inst.components.edible:SetOnEatenFn(oneaten)