Jump to content

Recommended Posts

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?

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 by w00tyd00d

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...