Jump to content

Need Help this check function don't work


Recommended Posts

 

local function ShouldAcceptOrNot(inst, item, giver)

 

    local hasenoughtwigs = false

    if giver.components.inventory:Has("twigs", 5) then

        hasenoughtwigs = true

    end

 

    local hasenoughgrass = false

    if giver.components.inventory:Has("cutgrass",5) then

        hasenoughgrass = true

    end

 

    local hasenoughberries = false

    if giver.components.inventory:Has("berries",5) then

        hasenoughberries = true

    end

 

    local acceptlist = item.components.tradable.goldvalue > 0 or item.prefab == "butterflywings" or item.prefab == "log" or item.prefab == "pinecone" or item.prefab == "acorn" or item.prefab == "red_cap" or item.prefab == "green_cap" or item.prefab == "blue_cap" or item.prefab == "petals" or item.prefab == "petals_evil" or item.prefab == "carrot" or item.prefab == "seeds" or hasenoughgrass or hasenoughberries or hasenoughtwigs or item.prefab == "flint" or item.prefab == "nitre" or item.prefab == "ice" or item.prefab == "rocks"

 

    return acceptlist

 

end

 

........

 

[some code between]

 

.......

 

 

 

inst.components.trader:SetAcceptTest(ShouldAcceptOrNot)

 

 

Link to comment
Share on other sites

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
 Share

×
  • Create New...