Comrades in Arms Discussion Board

Full Version: Ending mission when all units in agony (psycho revive)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So the command to get if a unit needs reviving/is incapacitated in Psycho's revive is:

unit getVariable ["TCB_AIS_agony", true]

However I'd like to check that variable for every unit in a group (and use that to end the mission), otherwise I have to name all the units. Anyone know how?
wouldn't be easier to check players instead of group?
I'd go for playableUnits, but how is agony state actually counted? If the variable returns true IF in agony state, I wouldn't use it as a default value but rather return false, and go for

({!(_x getVariable ["TCB_AIS_agnoy", false]) } count playableUNits) == 0

This would count all units that do not have agony set to true, and trigger if there is no unit left without agony.
Cheers, that works (minus the typo  Tongue )!

edit: would it conflict if I have two triggers in the mission, one for SP and one for MP?
SP
Quote:!isMultiplayer AND ({!(_x getVariable ["TCB_AIS_agony", false]) } count switchableUnits) == 0
MP
Quote:isMultiplayer AND ({!(_x getVariable ["TCB_AIS_agony", false]) } count playableUnits) == 0
To be honest, I dunno how switchableUnits behaves in MP and vice versa. I would assign it as a variable in the init.sqf, I have

FHQ_allPlayers = switch (isMultiplayer) do {
    case true: {playableUnits;};
    default {switchableUnits};
};

(from memory. might have typos Wink)

and use the FHQ_allPlayers in the trigger.
BIKI says

https://community.bistudio.com/wiki/switchableUnits

Quote:On dedicated server this command returns empty array.

https://community.bistudio.com/wiki/playableUnits

Quote:In single-player missions, this command will return an empty array.
In that case the thing will probably always trigger one or the other, since the count will be zero if there is zero members in the array.
Uh, there's "isMultiplayer AND" in front. I ran a dedi game and tested these triggers, I added a 'player sidechat "check";" to the MP trigger and thats the one that triggered in the dedi game.
(09-13-2014, 12:25 PM)Outlawz7 link Wrote:Uh, there's "isMultiplayer AND" in front. I ran a dedi game and tested these triggers, I added a 'player sidechat "check";" to the MP trigger and thats the one that triggered in the dedi game.

You are right... not enough sleep today Smile
There is a simple way to do it. each playable unit must have a squad name yoursquadnam=group this in their init & a trigger that ends the mission when every player is down. Hospital visit has it all in. unpbo it & have a look.


Trigger script is

CONDITION{alive _x} count playableUnits == {captive _x} count playableUnits;

ON ACT
"end1" call BIS_fnc_endMission; _failedtask = [1]      or how ever many tasks there are.