Ravenhart Posted September 15, 2013 Share Posted September 15, 2013 (edited) 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 September 15, 2013 by Ravenhart Link to comment https://forums.kleientertainment.com/forums/topic/27810-how-can-i-change-the-effect-a-certain-food-has-on-my-custom-character/ Share on other sites More sharing options...
RCatta Posted September 15, 2013 Share Posted September 15, 2013 (edited) So you want your character to get more health if he eats seeds as opposed to how much other characters get ? Edited September 15, 2013 by RCatta Link to comment https://forums.kleientertainment.com/forums/topic/27810-how-can-i-change-the-effect-a-certain-food-has-on-my-custom-character/#findComment-322241 Share on other sites More sharing options...
Heavenfall Posted September 15, 2013 Share Posted September 15, 2013 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) Link to comment https://forums.kleientertainment.com/forums/topic/27810-how-can-i-change-the-effect-a-certain-food-has-on-my-custom-character/#findComment-322256 Share on other sites More sharing options...
RCatta Posted September 15, 2013 Share Posted September 15, 2013 (edited) 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")endalso add this to your local fninst.components.eater:SetOnEatFn(iLoveSeeds) Edited September 15, 2013 by RCatta Link to comment https://forums.kleientertainment.com/forums/topic/27810-how-can-i-change-the-effect-a-certain-food-has-on-my-custom-character/#findComment-322267 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