I've been thinking about this, and there is a simple solution, although it does not involve a trigger
Basically, you add an onKilled event handler to the units you want to "monitor".
For each of the player objects, add this line to their init fields:
In Init.sqf, add the following:
This would, on a player death, fail the task "taskNoPlayerMusDie" (insert the name you used here), and after 10 seconds, bring up the mission failed screen.
As I wrote above, the line "if (!isPlayer") ... " basically makes the thing does nothing when an AI is killed that is not currently the player. Just leave out the whole line if you want the mission to fail if ANY playasble team member is killed.
This is IHMO the simplest method of achieving this, and should be pretty robust. Anything with a trigger is going to be too fiddly.
Basically, you add an onKilled event handler to the units you want to "monitor".
For each of the player objects, add this line to their init fields:
Code:
this addEventHandler ["killed", {_this call OnPlayerKilledHandler}];
In Init.sqf, add the following:
Code:
OnPlayerKilledHandler = {
/* Add this only if you want the mission NOT to fail when a playable AI is killed that is not player controlled */
if (!isPlayer) exitWith {};
/* Here, you add the code that you want to execute when a player is killed to fail the mission, something like this: */
["taskNoPlayerMustDie", "failed"] call FHQ_fnc_ttSetTaskState;
[] spawn {
sleep 10;
"EveryoneLost" call BIS_fnc_EndMissionServer;
};
};
This would, on a player death, fail the task "taskNoPlayerMusDie" (insert the name you used here), and after 10 seconds, bring up the mission failed screen.
As I wrote above, the line "if (!isPlayer") ... " basically makes the thing does nothing when an AI is killed that is not currently the player. Just leave out the whole line if you want the mission to fail if ANY playasble team member is killed.
This is IHMO the simplest method of achieving this, and should be pretty robust. Anything with a trigger is going to be too fiddly.