Jump to content

Recommended Posts

I am working on my Raven character and I thought it would be cool to have seeds give him a bonus health boost when consumed. How would I go about coding that if possible???

Edited by Ravenhart

You can put something like this in your local fn function in your prefab file:

 

inst:ListenForEvent( "oneat", function(inst, data)        if data.food == "seeds" or data.food == "seeds_cooked" then              inst.components.health:DoDelta(50)        end    end)

Or if you wanna customize a bit more:

 

local function iLoveSeeds (inst,food)if food and food.components.edible and food.components.edible.foodtype == "SEEDS" theninst.components.health:DoDelta(20)inst.HUD.controls.status.heart:PulseGreen()inst.HUD.controls.status.heart:ScaleTo(1.3,1,.7)inst.components.talker:Say("Raven luv sid")end

also add this to your local fn

inst.components.eater:SetOnEatFn(iLoveSeeds)
Edited by RCatta

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
×
  • Create New...