Jump to content

Recommended Posts

I need compare if the item in my EQUIPSLOTS.HANDS have a action/ability of chop trees, but have no idea in where i find this comparison. I need this result based on the item equipped, returning TRUE or FALSE. Anyone know how do it, or where I find the answer?

Well, if someone need, I found:

if item.components.tool:CanDoAction(ACTIONS.CHOP) then
end

But this don't work inside the Brains. I want an option for a mob chop a tree, if he have an item that can CHOP (axe, gold axe, pick/axe) equiped in your hand. But i can't compare it, I don't know how get. In Brain, OnStart:

                IfNode(function() return self.inst.prefab == "pig" end, "Keep Chopping",
                    DoAction(self.inst, function() return GoChop(self.inst, ACTIONS.CHOP) end)),

I want change self.inst.prefab == "pig" for this comparison, or do it inside of my local function GoChop. But I can't get the item in  EQUIPSLOTS.HANDS.

@Edit

This "Keep Chopping", what is? Where I use or send this, what means, or any information about it? '-'

Edited by kavaline

I'm not 100% sure what you're wanting here but if you want it to read whats in your handslot then heres this:

 

local handslot = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS) or nil

if handslot ~= nil and handslot.components.tool ~= nil and handslot.components.tool:CanDoAction(ACTIONS.CHOP) then

end

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