Jump to content
Sign in to follow this  
Phantom Six

AI Param Amount? (Anyone know how?)

Recommended Posts

Does anyone knows how to create a paramsarray where you can set how many AIs are on your mission? Kind of like this?

description.ext

class AIAmount
{
   		title = "Terrorist Count:";
   		values[] = {25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40}; 
   		texts[] = {"25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40"};
   		default = 30;
 	};

I was thinking of something like this and then for example there will be around 100 or something enemies on the mission, but if you set the mission parameter to something like 30, delete random enemies around the mission until 30 of them remains? (Kind of like rainbow six's terrorist hunt)

I just don't think what to put for the init besides

 if (paramsarray select 0 == 30) then 

Does anyone know what goes next to make some AIs get deleted until that amount shows up once you set it to that?

Share this post


Link to post
Share on other sites

place 30 single terrorists on your map, group them or not, does not matter.

now place a trigger with timeout 1 sec,

cond: true

on act: _null [] execVM "amount.sqf"

here is amount.sqf:

// for SP missions replace playableUnits with switchableUnits. this will delete all units above the set number in paramsarray that is not a playable unit.
_allCnt = ({!(_x in playableUnits)} count allUnits);
if ((paramsarray select 0) != _allCnt) then {
_nonplayable = [];
{if (!(_x in playableUnits)) then {_nonplayable = _nonplayable + [_x]}} foreach allUnits;
_cnt = count _nonplayable;
while {_cnt != (paramsarray select 0)} do {
	_unit = _nonplayable select 0;
	_nonplayable = _nonplayable - [_unit];
	_cnt = count _nonplayable;
	deleteVehicle _unit;
};
};

// also if its only terrorists you want to limit, not other units.
// place all terrorist names here.
_terrorists = [name1,name2,name3];
_cnt = count _terrorists;
while {_cnt != (paramsarray select 0)} do {
_unit = _terrorists select 0;
_terrorists = _terrorists - [_unit];
_cnt = count _terrorists;
deleteVehicle _unit;
};

Share this post


Link to post
Share on other sites
// place all terrorist names here.

_terrorists = [name1,name2,name3];[/php]

I haven't read your code, so I won't comment on it.

However, instead of putting every name, just name the group leaders then do this to add all units of the specified leaders.

_terrorists = units group leader1 + units group leader2

Or if everyone on the OPFOR team are terrorists, just add them all.

_terrorists = [];
{
   if(side _x == east) then
   {
       _terrorists = _terrorists + [_x];
   };
} forEach allUnits;

I haven't scripted for ARMA 2 for some time, so I don't know if there's a command to get all units of a specific side only. I'm not even sure that's how you concatenate lists. But I'm pretty sure it is.

Share this post


Link to post
Share on other sites

Tested the script you gave me thanks to you demonized for the script on top and mulledr for the count all easternunit as terrorist script. It came out close enough. I set the parameters to around 40, it ends up around 44 the first try, 41 the next try, etc. It doesn't come up on the exact number, but its close enough. So far I got 60 OPFOR units on the maps; some are grouped and others aren't.

Edited by Phantom Six

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  

×