Rogu3 H1Z1Stakes.com 0 Posted May 30, 2018 Hello, so i am trying to figure out the code behind checking whether or not an entire unit is dead Here is the code i tried but didn't have no success players = allPlayers; { if(side _x == west) then { //Exectute code for all dead. } } foreach _players allDead; can anyone help me? Share this post Link to post Share on other sites
Dedmen 2716 Posted May 30, 2018 _westPlayers = allPlayers select {side _x == west};//Returns all players of side west. _aliveDeadPlayers = _westPlayers count {alive _x};//Returns how many west players are alive. Will be 0 if all are dead. Share this post Link to post Share on other sites
Grumpy Old Man 3547 Posted May 30, 2018 5 hours ago, Dedmen said: _westPlayers = allPlayers select {side _x == west};//Returns all players of side west. _aliveDeadPlayers = _westPlayers count {alive _x};//Returns how many west players are alive. Will be 0 if all are dead. Maybe an oversight, the correct syntax would be: _aliveDeadPlayers = {alive _x} count _westPlayers; Cheers 1 Share this post Link to post Share on other sites
gokitty1199 225 Posted May 30, 2018 ? _westCount = allPlayers select {side _x == west && alive _x}; if (count _westCount == 0) then { hint "dey dead"; }; Share this post Link to post Share on other sites
Larrow 2822 Posted May 30, 2018 10 hours ago, Dedmen said: _westPlayers = allPlayers select {side _x == west};//Returns all players of side west. _aliveDeadPlayers = _westPlayers count {alive _x};//Returns how many west players are alive. Will be 0 if all are dead. These will both be the same, as a dead players side is CIV no matter their original side. if ( count( allPlayers select{side _x == west} ) == 0 ) then { hint "West are all dead"; }; Share this post Link to post Share on other sites
gokitty1199 225 Posted May 30, 2018 44 minutes ago, Larrow said: These will both be the same, as a dead players side is CIV no matter their original side. if ( count( allPlayers select{side _x == west} ) == 0 ) then { hint "West are all dead"; }; i thought that was just AI that turned to civ upon death? Share this post Link to post Share on other sites
Larrow 2822 Posted May 31, 2018 On 5/30/2018 at 7:50 PM, gokitty1199 said: i thought that was just AI that turned to civ upon death? No, player units do as well. Test it out in a quick 2 player hosted from the editor, with... allPlayers apply{ side _x } In a watch line in the debug console. As soon as you shoot the other player you will see CIV in the list. Once he respawns it will be back to WEST. You could just do... if ( west countSide allPlayers isEqualTo 0 ) then { hint "All west players are dead"; }; 2 Share this post Link to post Share on other sites