Jump to content

Recommended Posts

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.

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...