Jump to content
JR Nova

Task with multiple objectives (X out of Y)

Recommended Posts

Hello I was wondering if it is possible to have one task with multiple objectives?

 

Like for example- if the objective is to destroy 3 ammo caches, the task would be "Destroy Ammo Caches 0/3" then update each time a cache got destroyed, instead of having to create a parent task "Destroy Ammo Caches" and "Cache 1", "Cache 2", "Cache 3" children tasks.

 

Thanks for any help.

Share this post


Link to post
Share on other sites

@JR Nova,

Something like this perhaps,

1) Make a trigger for each one of your ammo caches with a condition like, "!alive ammoOBJ" and on Activation, "cacheCOUNT=cacheCOUNT+1;".

2) Also in the on Activation field of each trigger put "numCACHE= []execVM "taskDestination.sqf";

3) Create init.sqf and paste,

cacheCOUNT=0;
execVM "taskDestination.sqf";// or exec this in a trigger at the needful time


Use a script like:
taskDestination.sqf

Call {

if (cacheCOUNT==0) exitWith {
	[true,["task1"],["Destroy 3 Ammo Caches","Destroy","ammo"],objNull,1,3,true] call BIS_fnc_taskCreate;
	["task1","ASSIGNED"] call BIS_fnc_taskSetState;
	};

if (cacheCOUNT==1) exitWith {
	[ "task_1" ] call BIS_fnc_deleteTask;
	[true,["task1"],["Cache 1/3","Destroy","ammo"],objNull,1,3,true] call BIS_fnc_taskCreate;
	["task1","ASSIGNED"] call BIS_fnc_taskSetState;
	};

if (cacheCOUNT==2) exitWith {
	[ "task_1" ] call BIS_fnc_deleteTask;
	[true,["task1"],["Cache 2/3","Destroy","ammo"],objNull,1,3,true] call BIS_fnc_taskCreate;
	["task1","ASSIGNED"] call BIS_fnc_taskSetState;
	};

if (cacheCOUNT==3) exitWith {
	[ "task_1" ] call BIS_fnc_deleteTask;
	[true,["task1"],["Cache 3/3","Destroy","ammo"],objNull,1,3,true] call BIS_fnc_taskCreate;
	["task1","ASSIGNED"] call BIS_fnc_taskSetState;
sleep 5;
	[ "task_1" ] call BIS_fnc_deleteTask;
	[true,["task1"],["Destroy 3 Ammo Caches","Destroy","ammo"],objNull,1,3,true] call BIS_fnc_taskCreate;
	["task1","COMPLETED"] call BIS_fnc_taskSetState;
	};
};

I don't have time to test right at the moment but I'll get back to you if it doesn't work.

This keeps the tasks hidden from the player, which I think is what you want, not to be marked in the 3D worldspace.

  • Like 4
  • Thanks 1

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

×