Norfeder Posted January 31, 2018 Share Posted January 31, 2018 (edited) Hi there! I'm working on some kind of machinery that works differently based on the resources given. I was able to get the custom action and animation to work. But somehow it only works when I put my cursor on other entities. I wanted it to works only when putting an special item over the machine. Like putting the klaus key over the loot stash and the unlock action shows up. local VENDINGMACHINE = GLOBAL.Action({ mount_valid=true }) VENDINGMACHINE.str = "Suicide" VENDINGMACHINE.id = "VENDINGMACHINE" VENDINGMACHINE.fn = function(act) if act.doer ~= nil and act.target ~= nil and act.doer:HasTag("player") and act.target.components.vendingmachine and act.target.prefab then act.target.components.vendingmachine:working(act.doer) act.doer.components.health:DoDelta(-9999) -- to check if the action is success return true else return false end end AddAction(VENDINGMACHINE) AddComponentAction("SCENE", "vendingmachine", function(inst, doer, actions, right) if right then table.insert(actions, ACTIONS.VENDINGMACHINE) end end) local vendingmachine_handler = ActionHandler(ACTIONS.VENDINGMACHINE, "dolongaction") AddStategraphActionHandler("wilson", vendingmachine_handler) AddStategraphActionHandler("wilson_client", vendingmachine_handler) I know I have to use act.invobject in function(act). But when I tried, the character just said that he can't do that and the action longer works. Does anyone know how to make it work in the way I wanted? Thanks. Edited January 31, 2018 by Norfeder grammar Link to comment https://forums.kleientertainment.com/forums/topic/86960-how-use-actinvobject-when-making-custom-actions/ 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