iV - Ghost 50 Posted January 15, 2019 How can I waitUntil all childTasks are completed? private _childTask = _parentTask call BIS_fnc_taskChildren; ... Share this post Link to post Share on other sites
HazJ 1288 Posted January 15, 2019 Not tested but something like this perhaps? waitUntil {count ("task_1" call BIS_fnc_taskChildren) isEqualTo 0}; Share this post Link to post Share on other sites
iV - Ghost 50 Posted January 15, 2019 The problem is that completed tasks will not deleted from a parentTask. I have tried with BIS_fnc_taskCompleted but can't find the right way. Share this post Link to post Share on other sites
HazJ 1288 Posted January 15, 2019 Does that not work? What are you trying to do? Check if a or all child task(s) are complete? Maybe try: (taskChildren "task_1" select 0) call BIS_fnc_taskCompleted // also not tested: {_x call BIS_fnc_taskCompleted} count (taskChildren "task_1") 1 Share this post Link to post Share on other sites
Schatten 268 Posted January 15, 2019 @iV - Ghost, try this: waitUntil { _subtasks = _taskId call BIS_fnc_taskChildren; ({_x call BIS_fnc_taskCompleted} count _subtasks) == (count _subtasks) }; 2 1 Share this post Link to post Share on other sites
iV - Ghost 50 Posted January 15, 2019 12 hours ago, Schatten said: @iV - Ghost, try this: waitUntil { _subtasks = _taskId call BIS_fnc_taskChildren; ({_x call BIS_fnc_taskCompleted} count _subtasks) == (count _subtasks); }; This seems to be the right way. Thx a lot for help. Share this post Link to post Share on other sites
Dedmen 2590 Posted January 18, 2019 Can be optimized a little waitUntil { _subtasks = _taskId call BIS_fnc_taskChildren; _subtasks findIf {!(_x call BIS_fnc_taskCompleted)} == -1 }; findIf aborts at the first "true" it finds. So it doesn't always have to iterate over the whole list of tasks. As soon as it finds a task that is not completed it can just abort right away. 2 Share this post Link to post Share on other sites