Jump to content
Sign in to follow this  
bvrettski

Minimum player count check for bounty mission

Recommended Posts

I'm now messing with a bounty system that is part of A3Wasteland.

 

I want to make the mission check for a minimum number of available players.

 

Here is the code section that searches for a player:

//select a random player
_players = playableUnits;
_count = count _players;


// Find out how many players are currently alive
_alivePlayerCount = 0;
for "_x" from 0 to (_count - 1) do {
_p = _players select _x;
if (alive _p) then {
_alivePlayerCount = _alivePlayerCount + 1;
};
};

if (_alivePlayerCount == 0) exitWith {};


// Keep looping over players until we find an alive one
_finished = 0;
scopeName "main";
while {true} do {
_random = floor(random _count);
_potentialPlayer = _players select _random;


if (alive _potentialPlayer) then {
_foundPlayer = _potentialPlayer;
_finished = 1;
};


if (_finished == 1) then {breakTo "main"}; // Breaks all scopes and return to "main"
sleep 0.1;
};

How difficult would it be to build in a check so the minimum number of players must be 3 or more?

 

There really is no point in running this type of mission when there are less players than that.

 

Can this line be edited something like this:

if (_alivePlayerCount < 3) exitWith {};

Share this post


Link to post
Share on other sites

hi,

if ({alive _x} count playableUnits < 3) exitWith {};

cya.

 

Nikiller.

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  

×