Jump to content
Sign in to follow this  
pcc

How to exclude certain barracks units

Recommended Posts

In the Server_BuyUnit.sqf, I'm using the following for random soldier types. 

_unit = Call Compile Format["[%1%2Units] Call BIS_WF_GetRandomElement",_sideText,_factoryName];

But, how do I exclude certain units like pilot and crew? 

 

I've tried

_unit = Call Compile Format["[%1%2Units] Call BIS_WF_GetRandomElement",_sideText,_factoryName];
	while{_unit == "%1CREW" || _unit == "%1PILOT"} do
	{
		_unit = Call Compile Format["[%1%2Units] Call BIS_WF_GetRandomElement",_sideText,_factoryName];
	};

But pilot and crew still gets picked. 

Share this post


Link to post
Share on other sites

Crew and pilot have to be call-compile-formatted as well.  They use side letters rather than side text.

 

Not tested, but this should make a copy of the factory units list, remove the pilot and crew from the copied list, and do random selection from it.

_units = +(Call Compile Format ["%1%2Units",_sideText,_factoryName]);
_pilot = Call Compile Format ["%1PILOT",_side Call GetSideLetter];
_crew = Call Compile Format ["%1CREW",_side Call GetSideLetter];
_units = _units - [_pilot,_crew];
_unit = _units Call BIS_WF_GetRandomElement;

If no good, try call-compile-format on crew and pilot.

  • Like 1

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  

×