Jump to content
Sign in to follow this  
JPreston

playersNumber for self balancing mission

Recommended Posts

Couple of questions for the experts today.

I've got a co-op mission that works perfectly if I set the number of respawns (I've got a basic respawn limiter) and the number of enemies. I have however, been trying to get the mission to auto-balance itself. So if more players join, more enemies are spawned and the respawn limit is upped.

Initially I tried using:

players = playersNumber west;

publicvariable "players";

But as I'm sure you know that returns the number of playable AI, so the respawn limit always get set as if there are 10 players. Is there any work around for this as it is doing my head in!

Also I was trying to use the "Condition of presence: players >=5;" field to spawn more AI when there are more players. I cannot get them to spawn, anyone got any ideas?

Thanks in advance.

J

Share this post


Link to post
Share on other sites

Try

numPlayers = {isPlayer _x} count playableUnits;

Condition looks ok, could try wrapping it in () maybe.

Share this post


Link to post
Share on other sites

Ok, after a few days of fiddling I've finally got my respawn system to work as intended. I still cannot get these AI units to spawn though. Tired wrapping the condition in () as suggested, to no avail.

Has anyone got any ideas about this?

J

Share this post


Link to post
Share on other sites

players = ({isPlayer _x} count playableUnits);

Should properly count players. You can debug the value with

systemChat str(players);

to see what value "players" has at certain moment in your script. (will output value into chat)

Also if you use this variable just once you can simply avoid using variable completely:


if(({isPlayer _x} count playableUnits) > 5) then {
//something
};

Or use it in equation:

_number_of_ai_to_spawn = (({isPlayer _x} count playableUnits) * 5) min 10;

Edited by SaMatra

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  

×