Schulliya Posted September 3, 2021 Share Posted September 3, 2021 Hi. I'm having a hard time trying to understand Actions and Component Actions. I want to print "hi" when I right click the ground, but I don't have an idea on what am I doing wrong. (I'm gonna try making a dash later) Here is a fragment of my modmain.lua: local Action = GLOBAL.Action local ACTIONS = GLOBAL.ACTIONS local DASH_ACTION = Action({priority = 4, distance = 20}) DASH_ACTION.str = "Dash" DASH_ACTION.id = "DASH_ACTION" DASH_ACTION.fn = function(act) print("hi") return true end AddAction(DASH_ACTION) AddComponentAction("POINT", "dash_component", function(inst, doer, pos, actions, right) if right then table.insert(actions, ACTIONS.DASH_ACTION) end end) And here is my Dash_component file: local Dash_component = Class(function(self, inst) self.inst = inst inst:AddTag("dashing") end) function Dash_component:DoDash() print("hi") return true end return Dash_component When I run the game, I can right click the ground with the label "Dash", but it does nothing. Thanks in advance! Link to comment https://forums.kleientertainment.com/forums/topic/133228-help-with-actions/ Share on other sites More sharing options...
HarryPPP Posted September 3, 2021 Share Posted September 3, 2021 You need to asign a stategraph to your custom action... Like this: AddStategraphActionHandler("wilson", GLOBAL.ActionHandler(DASH_ACTION, "dolongaction")) After the character finishes the animation, the text will be printed. Link to comment https://forums.kleientertainment.com/forums/topic/133228-help-with-actions/#findComment-1490747 Share on other sites More sharing options...
Schulliya Posted September 4, 2021 Author Share Posted September 4, 2021 (edited) 22 hours ago, HarryPPP said: You need to asign a stategraph to your custom action... Like this: AddStategraphActionHandler("wilson", GLOBAL.ActionHandler(DASH_ACTION, "dolongaction")) After the character finishes the animation, the text will be printed. @HarryPPP It worked! Thank you so much! BTW where can I see all the stategraphs? I don't want to use dolongaction And I'd like to perform the stategraph animation after my Action, is it possible? Edited September 4, 2021 by Schulliya Link to comment https://forums.kleientertainment.com/forums/topic/133228-help-with-actions/#findComment-1491039 Share on other sites More sharing options...
HarryPPP Posted September 6, 2021 Share Posted September 6, 2021 (edited) Oh! Sorry for the somewhat late response, @Schulliya. On 9/4/2021 at 3:10 PM, Schulliya said: BTW where can I see all the stategraphs? I don't want to use dolongaction You can find all scripts inside a .zip file named "scripts" under "C:\Program Files (x86)\Steam\steamapps\common\Don't Starve Together\data\databundles". All you need to do is open it and go the folder called "stategraphs". You should find a file called "SGWilson", that's where the player stategraphs are. On 9/4/2021 at 3:10 PM, Schulliya said: And I'd like to perform the stategraph animation after my Action, is it possible? I suppose you can by putting "act.doer.sg:GoToState("statename")" in the "DASH.fn" function... If it executes too early, you can always call "act.doer:DoTaskInTime(time, function)". Edited September 6, 2021 by HarryPPP Link to comment https://forums.kleientertainment.com/forums/topic/133228-help-with-actions/#findComment-1491662 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