BushmannGG1392 Posted July 17, 2018 Share Posted July 17, 2018 (edited) I know how to start one, but how do you end it? variable:DoPeriodicTask(0.1, function (inst) inst.sg:GoToState("state") end) Edited July 17, 2018 by maxisawesome101 Link to comment Share on other sites More sharing options...
Wolf_EX Posted July 18, 2018 Share Posted July 18, 2018 (edited) variable:Cancel() to remove it from memory set it to nil, so variable = nil Edited July 18, 2018 by Wolf_EX Link to comment Share on other sites More sharing options...
BushmannGG1392 Posted July 18, 2018 Author Share Posted July 18, 2018 Could you show me a example of how to use it? Because I can't really figure it out. Link to comment Share on other sites More sharing options...
Wolf_EX Posted July 18, 2018 Share Posted July 18, 2018 (edited) There are plenty of examples in the game files. I am assuming this is a stategraph so in glommer's stategraph, SGglommer.lua there is local function StartFlap(inst) if inst.FlapTask then return end inst.FlapTask = inst:DoPeriodicTask(4*FRAMES, function(inst) inst.SoundEmitter:PlaySound("dontstarve_DLC001/creatures/glommer/flap") end) end local function StopFlap(inst) if inst.FlapTask then inst.FlapTask:Cancel() inst.FlapTask = nil end end my guess would be that your are missing the "inst" Edited July 18, 2018 by Wolf_EX Link to comment Share on other sites More sharing options...
BushmannGG1392 Posted July 18, 2018 Author Share Posted July 18, 2018 (edited) So, do I have to make it a command in a lua file in order to stop it? Edit: Nevermind, I just figured something out, Thanks! Edited July 18, 2018 by maxisawesome101 Link to comment 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