Jump to content
mihikle

Check if specific units are dead

Recommended Posts

Hey all,

Creating a PvP mission (TDM - no respawn) on A3 Alpha, and need a check on if a number of specific players are alive. Have been using this:

(!alive opfor1) && (!alive opfor2) && (!alive opfor3) && (!alive opfor4)

However this only works if every playable slot is filled, which often it will not be. I used a script on A2 that fixed this same problem (I'm essentially porting the mission across) but I couldn't get it to work, and I can't remember for the life of me what the bit of script is, so can anyone help me? If I remember rightly it looked a little bit (roghly) like:

if !alive [opfor1,opfor2,opfor3]; 

or something like that, I can't remember exactly.

If anyone could help it would be great cheers! :)

Share this post


Link to post
Share on other sites
(!alive opfor1) && (!alive opfor2) && (!alive opfor3) && (!alive opfor4)

However this only works if every playable slot is filled

Really? I've often used this in my coop missions to check if all players have died, and it's worked fine even if all playable slot weren't filled. Weird things.

Share this post


Link to post
Share on other sites

Yeah, it does not seem to work in PvP :S

It works for Co-Op, when all the specific enemy will ALWAYS be present, however when it is variable of when they will actually be present, it seems not to work, which is unfortunate. Nobody seems to know what I'm looking for so I'll have a look at my old Arma 2 mission and see if I can copy it across. But it didn't seem to work when I tried it before, perhaps I copied it wrong :)

Share this post


Link to post
Share on other sites

For Opfor:

({(alive _x) and (side _x == east)}count playableUnits) < 1; 

For Blufor:

({(alive _x) and (side _x == west)}count playableUnits) < 1; 

Put this in your condition field and see if that helps.

That should be dynamic, if it works, might be syntax errors because I am not able to test atm. If it doesn not, this should:

({alive _x} count [opfor1,opfor2,...etc]) < 1;

Edited by Tuliq

Share this post


Link to post
Share on other sites

hi guys heres my delemia.

I am trying to create a mission where a downed team is going into a town and holding it. I have the first trigger down so when the team go into the town and it fires the trigger so a squad of csat comes in a a firefight starts. what i want is to put another trigger down to detect that the squad is dead so it fires the next trigger. I have about 4 waves of enimys for the last trigger i would like a chopper to come in and pick the troops up. thanks for the help.

Share this post


Link to post
Share on other sites
... what i want is to put another trigger down to detect that the squad is dead ...

{alive _x} count units bluGrp == 0 //condition

Share this post


Link to post
Share on other sites

Can you do it in an "If" command? (and please show an example if there is?)

Share this post


Link to post
Share on other sites
Can you do it in an "If" command? (and please show an example if there is?)

Why you brought up a pretty old thread...

But in any case, all the above you just move into the condition for the if statement (using Iceman's as example below):

if ({alive _x} count units bluGrp == 0) then {/*stuff*/};

Share this post


Link to post
Share on other sites
Why you brought up a pretty old thread...

But in any case, all the above you just move into the condition for the if statement (using Iceman's as example below):

if ({alive _x} count units bluGrp == 0) then {/*stuff*/};

doesn't seem to work for me :confused:

Here is what I have in my init.sqf:

[] execVM "start.sqf";

In my start.sqf, I have this:

[] execVM "Bomb\T_Win.sqf";

and in T_Win.sqf, I have this:

if ({alive _x} count units bluGrp == 0) then{
terminate actionCTA;
terminate actionCTB;
terminate actionTA;
terminate actionTB;
terminate BombA;
terminate BombB;
terminate DefuseA;
terminate DefuseB;

EScore=(EScore+1);
sleep 1;
titletext [format ["One point for EAST\nScore : CT %1 - T 	%2", WScore, EScore], "PLAIN"];
playMusic "Pfe";
0=[[["East Win!","align = 'center' size = '1.0'"]]] spawn 	BIS_fnc_typeText2;


sleep 9;


setPlayerRespawnTime 0;

T1 setPos (getPos T1_Spawn);
T2 setPos (getPos T2_Spawn);
T3 setPos (getPos T3_Spawn);
T4 setPos (getPos T4_Spawn);
T5 setPos (getPos T5_Spawn);

CT1 setPos (getPos CT1_Spawn);
CT2 setPos (getPos CT2_Spawn);
CT3 setPos (getPos CT3_Spawn);
CT4 setPos (getPos CT4_Spawn);
CT5 setPos (getPos CT5_Spawn);

T1 setDir 89.4289;
T2 setDir 120.084;
T3 setDir 115;
T4 setDir 162.487;
T5 setDir 162.477;

CT1 setDir 349.992;
CT2 setDir 304.992;
CT3 setDir 289.992;
CT4 setDir 284.992;
CT5 setDir 269.992;


T1 setDamage 0;
T2 setDamage 0;
T3 setDamage 0;
T4 setDamage 0;
T5 setDamage 0;

CT1 setDamage 0;
CT2 setDamage 0;
CT3 setDamage 0;
CT4 setDamage 0;
CT5 setDamage 0;

[] execVM "start.sqf";
Area_A setPos (getPos BaseA);
Area_B setPos (getPos BaseB);
};

What am I doing wrong here?

Share this post


Link to post
Share on other sites

Just use a trigger with bis_fnc_mp ?

 

Avoid using MP, use remoteExec instead. Much faster.

Share this post


Link to post
Share on other sites

I'm doing a mission where i'm spawning one oppor unit (O_Soldier_AR_F) around a helicopter crash, and I would like to know if it is possible to check if all units of the same type (O_Soldier_AR_F) are dead

Thanks in advance

Share this post


Link to post
Share on other sites
3 hours ago, notproplayer3 said:

I'm doing a mission where i'm spawning one oppor unit (O_Soldier_AR_F) around a helicopter crash, and I would like to know if it is possible to check if all units of the same type (O_Soldier_AR_F) are dead

Thanks in advance

 

if you just have one unit of this type, spawn it:

_unit = blabla spawn;

and add

_unit spawn {_unit = _this;  waituntil {sleep 1; !alive _unit}; hint "AR is dead"};

 

or working solution all AR killed:

 

addMissionEventHandler ["entityKilled", {
  if ({typeOf _x ==  "O_Soldier_AR_F"} count allUnits == 1 && _this select 0 isKindOf "O_Soldier_AR_F") then {hint "No more AR at all!"};
 }];

 

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

×