Jump to content

Recommended Posts

I'm trying to delete a subtask from a parenttask by using BIS_fnc_deleteTask.

The task in the interface (map -> tasks) getting deleted but if I'm using ...

_parentTask call BIS_fnc_taskChildren;

...my deleted subtask is still listed in the array. How can I delete them from this array too?

Share this post


Link to post
Share on other sites

Try this...

Spoiler


	#include "\a3\functions_f\tasks\defines.inc"

	params[ "_taskID" ];

	//Get task var
	private _taskVar = _taskID call BIS_fnc_taskVar;

	//Get parent task id
	private _parent = GET_DATA( _taskVar, PARENT );

	//If it has a parent task
	if !( _parent isEqualTo "" ) then {

		//Get parent task var
		private _parentVar = _parent call bis_fnc_taskVar;

		//Get parents child tasks
		_children = GET_DATA( _parentVar, CHILDREN );

		//Remove taskID
		_children = _children - [ _taskID ];

		//Set parents children
		SET_DATA( _parentVar, CHILDREN, _children );
	};

 

think thats correct but totally untested. Needs calling on all owners of the task for whom you are deleting it. Needs fixing in BIS_fnc_deleteTask so put a ticket in for it.

 

Share this post


Link to post
Share on other sites

OK thanks for help. Tomorrow I will create a ticket.

I had thought of it too. But I was not sure if it had to be that way for some reason.

 

If it is not possible, I will try another workaround without deleting from array.

I'll try to count the true's after using BIS_fnc_taskCompleted.

And if the count true's == 1 I will delete _childTask & _parentTask. If not I only delete the _childTask.

Could work. But it is not my first choice

Share this post


Link to post
Share on other sites

For information:

My workaround doesn't work because BIS_fnc_taskCompleted return false for open task and deleted tasks too.

It does not work to counteract existing tasks with completed ones.

 

I have created a ticket.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×