Parusoid Posted October 6, 2017 Share Posted October 6, 2017 How can I interrupt DoTaskInTime before it reaches the end and proceeds further into code? Link to comment https://forums.kleientertainment.com/forums/topic/82709-how-to-stop-dotaskintime/ Share on other sites More sharing options...
Arkathorn Posted October 6, 2017 Share Posted October 6, 2017 If I recall correctly, the original call of DoTaskInTime returns a task handler. You should be able to interrupt the task like so: local task = inst:DoTaskInTime(3, fn_dothing) task:Kill() (This info might be completely wrong, I'm not sure.) Link to comment https://forums.kleientertainment.com/forums/topic/82709-how-to-stop-dotaskintime/#findComment-961457 Share on other sites More sharing options...
Parusoid Posted October 6, 2017 Author Share Posted October 6, 2017 3 hours ago, Arkathorn said: If I recall correctly, the original call of DoTaskInTime returns a task handler. You should be able to interrupt the task like so: local task = inst:DoTaskInTime(3, fn_dothing) task:Kill() (This info might be completely wrong, I'm not sure.) Can it be done from another function? Link to comment https://forums.kleientertainment.com/forums/topic/82709-how-to-stop-dotaskintime/#findComment-961602 Share on other sites More sharing options...
w00tyd00d Posted October 7, 2017 Share Posted October 7, 2017 (edited) 6 hours ago, Arkathorn said: If I recall correctly, the original call of DoTaskInTime returns a task handler. You should be able to interrupt the task like so: local task = inst:DoTaskInTime(3, fn_dothing) task:Kill() (This info might be completely wrong, I'm not sure.) You were close, but the function is actually "task:Cancel()" 2 hours ago, Parusoid said: Can it be done from another function? And yes you can, all you need to do is reference the instance its attached to. A common method I've seen in the files goes like: if inst.task ~= nil then inst.task:Cancel() inst.task = nil end Edited October 7, 2017 by w00tyd00d Link to comment https://forums.kleientertainment.com/forums/topic/82709-how-to-stop-dotaskintime/#findComment-961636 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