kelsuis Posted March 31, 2016 Share Posted March 31, 2016 new to lua and not used to programming. I was trying to add negative effect when eating specific item not just what type it is. I found a prefabs of veggies.lua and there is veggies table inside contain an item name I want to trigger an effect, but I don't know how to call it from this point. local function OnEat(inst, food) if food.components.edible ~= nil then if food.components.eadible.foodtype == FOODTYPE.VEGGIE then inst.components.sanity:DoDelta(-TUNING.SANITY_HUGE) end end end not sure if it possible or not trying to see others code so far I haven't seen one that specific the item name. Link to comment https://forums.kleientertainment.com/forums/topic/65931-need-help-with-lua-component/ Share on other sites More sharing options...
kelsuis Posted April 1, 2016 Author Share Posted April 1, 2016 solved. with food.prefab == "foodname" Link to comment https://forums.kleientertainment.com/forums/topic/65931-need-help-with-lua-component/#findComment-742185 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