Comrades in Arms Discussion Board
Ending mission when all units in agony (psycho revive) - Printable Version

+- Comrades in Arms Discussion Board (http://forum.ciahome.net)
+-- Forum: Comrades in Arms Life (http://forum.ciahome.net/forumdisplay.php?fid=3)
+--- Forum: Mission Making (http://forum.ciahome.net/forumdisplay.php?fid=8)
+--- Thread: Ending mission when all units in agony (psycho revive) (/showthread.php?tid=2746)



Ending mission when all units in agony (psycho revive) - Outlawz7 - 09-12-2014

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?


Re: Ending mission when all units in agony (psycho revive) - alias - 09-12-2014

wouldn't be easier to check players instead of group?


Re: Ending mission when all units in agony (psycho revive) - Alwarren - 09-12-2014

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.


Re: Ending mission when all units in agony (psycho revive) - Outlawz7 - 09-12-2014

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



Re: Ending mission when all units in agony (psycho revive) - Alwarren - 09-12-2014

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.


Re: Ending mission when all units in agony (psycho revive) - Outlawz7 - 09-13-2014

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.



Re: Ending mission when all units in agony (psycho revive) - Alwarren - 09-13-2014

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.


Re: Ending mission when all units in agony (psycho revive) - Outlawz7 - 09-13-2014

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.


Re: Ending mission when all units in agony (psycho revive) - Alwarren - 09-13-2014

(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


Re: Ending mission when all units in agony (psycho revive) - JGaz-UK - 11-17-2014

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.