Nhyarlathoteps Posted August 31, 2020 Share Posted August 31, 2020 I would like to add a right-click action on the anchor prefab which already has an action to raise and lower the anchor. To do so I created an empty component named interactions and used the AddComponentAction function AddComponentAction("SCENE", "interactions", function(inst, doer, actions, right) --AddComponentAction("SCENE", "anchor", function(inst, doer, actions, right) same behaviour ("anchor" is a prefab but also a component) if right then doer.components.talker:Say("Wololo") --table.insert(actions, GLOBAL.ACTIONS.TRAVEL) end end) AddStategraphActionHandler("wilson", GLOBAL.ActionHandler(GLOBAL.ACTIONS.TRAVEL, "give")) AddStategraphActionHandler("wilson_client", GLOBAL.ActionHandler(GLOBAL.ACTIONS.TRAVEL, "give")) When I am in the game and as long as I put my mouse on the prefab, the player will repeat "Wololo" in a loop without moving. But when i use table.insert(actions, GLOBAL.ACTIONS.TRAVEL) nothing happens I know for sure that my Action named TRAVEL is working perfectly because i am using it on other custom prefabs Any ideas on how to fix it? Link to comment https://forums.kleientertainment.com/forums/topic/121404-how-to-add-a-right-click-action-when-there-is-already-a-left-one/ Share on other sites More sharing options...
Nhyarlathoteps Posted September 3, 2020 Author Share Posted September 3, 2020 I found that the action choice was defined in componentactions.lua -> COMPONENT_ACTIONS -> SCENE -> anchor. It is possible to change the function with the upvaluehacker ? Link to comment https://forums.kleientertainment.com/forums/topic/121404-how-to-add-a-right-click-action-when-there-is-already-a-left-one/#findComment-1368876 Share on other sites More sharing options...
Serpens Posted September 20, 2020 Share Posted September 20, 2020 you don't need to change the code within componentactions.lua. The AddComponentAction already adds your code and executes it after the original one. And since you see the Wololo, it is executed correctly. So we need to debug your travel action. When you enable this table.insert code, does the game show you the possible action for rightclick? And when rightclicking, nothing happens? Or does it not even show you the travel action? It is some time ago I modded actions, but it also might have to do with the priority, try changing GLOBAL.ACTIONS.TRAVEL.priority=2 , at least I had to do this for my new action to show up together with the pickup action. Link to comment https://forums.kleientertainment.com/forums/topic/121404-how-to-add-a-right-click-action-when-there-is-already-a-left-one/#findComment-1372926 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