Jump to content
Sign in to follow this  
alleycat

Reliable method (MP) to end mission when all playable units dead/wounded?

Recommended Posts

What is a reliable method (MP) to end a mission when all playable units on one side are either dead or wounded (needing first aid as in BIS medic module). I used "not alive man1 and ...." however that method does not count wounded units and the trigger itself does not kick in at times in MP.

Share this post


Link to post
Share on other sites

Try this:

{lifeState _x == "ALIVE" && canStand _x} count [man1, man2] == 0

Put all necessary units into the [man1, man2 ...] array. The lifeState command will also detect when units are unconscious (lying on the ground in agony) with the first aid module. I added the canStand part because I assume you also want the mission to end when the last few units are unable to walk. If you don't want that, remove that part and just use this:

{lifeState _x == "ALIVE"} count [man1, man2] == 0

:)

Share this post


Link to post
Share on other sites

If that doesn't work. This one will:

init.sqf:

 SHK_inAgony = {
   private ["_r"];
   _r = _this getVariable "BIS_IS_inAgony";
   if (isNil "_r") then { _r = false };
   _r
 };

condition in trigger/whatever:

{isplayer _x && alive _x && !(_x call SHK_inAgony)} count playableunits < 1

That checks that if all players are dead or wounded (disabled by the BIS module/rolling on the ground). And, it ignores playable AI units.

Share this post


Link to post
Share on other sites

thx to both posters for the solutions. shk, how to split your method for each side? Like when all west players are dead or wounded and so forth?

---------- Post added at 04:46 PM ---------- Previous post was at 03:33 PM ----------

Never mind, I got it working by listing the units in the array.

Share this post


Link to post
Share on other sites

[/color]Never mind, I got it working by listing the units in the array.

That or

{isplayer _x && alive _x && !(_x call SHK_inAgony) && side _x == WEST} count playableunits < 1

{isplayer _x && alive _x && !(_x call SHK_inAgony) && side _x == EAST} count playableunits < 1

Share this post


Link to post
Share on other sites

That work great. Also is there any way to make this work for when only 1 human player is on the server and all others are AI? Currently certain end triggers will fire if I am the only player, which sort of sucks if you are testing it alone.

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
Sign in to follow this  

×