Jump to content

How to stop "DoTaskInTime"?


Recommended Posts

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
Share on other sites

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
Share on other sites

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

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...