Jump to content

Recommended Posts

I have been trying to get this working for a while but to nothing, i want it so when i right click my custom item it runs a function but, when i right click my custom item the character stops moving for a second like it wants to examine then i can move again however the logs does not contain true or false, if anyone knows what i am doing wrong please help me

 

-- wont run
local INVUSE = AddAction("INVUSE", "Use", function(act)
        print(act.invobject.components.useableitemininventory:CanInteract())
        if act.invobject.components.useableitemininventory:CanInteract() == true then
            act.invobject.components.useableitemininventory:StartUsingItem()
        end
    return true
end)
 
AddComponentAction("INVENTORY", "useableitemininventory", function(inst, doer, actions, right)
    --code found in edible.lua but changed the table.insert to work with INVUSE
    if (right or inst.replica.equippable == nil) and not (doer.replica.inventory:GetActiveItem() == inst and doer.replica.rider ~= nil and doer.replica.rider:IsRiding()) then
        table.insert(actions, INVUSE)
    end
end)
3 hours ago, Monti18 said:

You're still missing the actionhandler:


AddStategraphActionHandler("wilson", ActionHandler(INVUSE, "doshortaction"))
AddStategraphActionHandler("wilson_client", ActionHandler(INVUSE, "doshortaction"))

 

Thanks while this is not what i needed (i managed to figure it out RIGHT after reading this and i just needed INVUSE.instant = true) it may help next time i want to make a custom action

  • Like 1

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