Jump to content

Recommended Posts

Yes, and I've made a Support Ticket to another scrip as well the loot spawner script as It has made it all float bad. Here is a Link to This Post

http://feedback.arma3.com/view.php?id=17646

The Same Issue I'm having in this great script is also causing problems with these AI script's for instance the reinforcement Helicopter does not land. I feel BI should fix this and not the Developer of these Scripts as It was the Arma 3 Update that has Caused all the mess. Please Go up-Vote my Issue and Post issue as Well, If We Show Enough of the same issue then they might Fix it.

Share this post


Link to post
Share on other sites

So for the past few days, I've been trying to get these AI scripts working in conjunction with the simplecachev2 release by Na_Palm. For the most part it would work ok, the first time spawning/despawning units - but after that I would experience all sorts of issues, like;

1: Far to many vehicles spawning,

2: Group-names not being saved,

3: Group-names being ignored,

4: Custom group names throwing error messages,

5: Spawn-script unintentionally running several times for the same zone, upon clearing another zone,

6: AI being deleted immidiately upon last unit dead, dead units being deleted before being able to loot them,

7: When using several AI spawn scripts in the same local area and joining them to the same groups the number of AI spawned once you leave and reenter the area was way to high (total number of both spawn groups, instead of each spawn group seperately)

8: Wrong values were deleted from script parameter array in simplecachev2 when using init.sqf to run larger numbers of spawn zones.

and so on.

So I've gone through the scripts with my very little scripting knowlegde and attempted to patch up these errors.

I do not want to take credit for anything, but I figured I'd share my edits, in case someone else was experiencing similar issues to what I've been seeing. At present things seem to work as intended, but if someone else could confirm that that indeed is the case, I would be grateful.

I've made changes in the following files:

militarize.sqf: militarize.sqf download link

Very little changes have been made here, changes have been commented.

/*
			***		ARMA3Alpha MILITARIZE AREA SCRIPT v2.1 - by SPUn / lostvar	***

		Calling the script:

	default: 	nul = [this] execVM "LV\militarize.sqf";

	custom:		nul = [target, side, radius, spawn men, spawn vehicles, still, men ratio, vehicle ratio,
						skills, group, custom init, ID] execVM "LV\militarize.sqf";

	Parameters:

target 		=	center point (name of marker or object or unit which is the center point of militarized area,
								or position array)
side 		=	(0 = civilian, 1 = blue, 2 = red, 3 = green) 													DEFAULT: 2
radius 		=	(from center position) 																			DEFAULT: 150
spawn men 	= 	[spawn land units, spawn water units]															DEFAULT: [true,false]
				(both values are true or false)
spawn vehicles =[spawn land vehicles, spawn water vehicles, spawn air vehicles] 								DEFAULT: [true,false,false]
				(all values are true or false)
still 		= 	true or false 	(if false, then units will patrol in radius, checkin also buildings) 			DEFAULT: false
men ratio 	=	(amount of spawning men is radius * men ratio, ie: 250 * 0.2 = 50 units) 						DEFAULT: 0.3
				NOTE: Array - you can also use following syntax: [amount,random amount] for example:
				[10,5] will spawn at least 10 units + random 1-5 units
vehicle ratio= 	(amount of spawning vehicles is radius * vehicle ratio, ie: 250 * 0.1 = 25 vehicles) 			DEFAULT: 0.1
				NOTE: Same array syntax as in "men ratio" works here too!
skills 		= 	"default" 	(default AI skills) 																DEFAULT: "default"
			or	number	=	0-1.0 = this value will be set to all AI skills, ex: 0.8
			or	array	=	all AI skills invidiually in array, values 0-1.0, order:
	[aimingAccuracy, aimingShake, aimingSpeed, spotDistance, spotTime, courage, commanding, general, endurance, reloadSpeed]
	ex: 	[0.75,0.5,0.6,0.85,0.9,1,1,0.75,1,1]
group 		= 	group name or nil (if you want units in existing group, set it here. if nil, new group is made) DEFAULT: nil
				EXAMPLE: (group player)
custom init = 	"init commands" (if you want something in init field of units, put it here) 					DEFAULT: nil
			NOTE: Keep it inside quotes, and if you need quotes in init commands, you MUST use ' or "" instead of ".
			EXAMPLE: "hint 'this is hint';"
ID 			= 	number (if you want to delete units this script creates, you'll need ID number for them) 		DEFAULT: nil

EXAMPLE: nul = [this,2,50,[true,true],[true,false,true],false,[10,0],0.1,[0.2,0.2,0.2,0.85,0.9,0.75,0.1,0.6,1,1],nil,nil,13] execVM "LV\militarize.sqf";
*/
if (!isServer)exitWith{};
private ["_greenMenArray","_grpId","_customInit","_cPos","_skls","_skills","_dir","_range","_unitType","_unit","_radius","_men","_vehicles","_still","_centerPos","_menAmount","_vehAmount","_milHQ","_milGroup","_menArray","_blueMenArray","_redMenArray","_yellowMenArray","_side","_pos","_yellowCarArray","_allUnitsArray","_menRatio","_vehRatio","_diveArray","_validPos","_side","_driver","_whichOne","_vehicle","_crew","_thisArray","_smokesAndChems","_doorHandling","_BLUdivers","_OPFdivers","_INDdivers"];

//Extra options:
_smokesAndChems = true;
_doorHandling = true;
//

_cPos = if(count _this > 0)then{_this select 0;};
_side = if (count _this > 1) then { _this select 1; }else{2;};
_radius = if (count _this > 2) then { _this select 2; }else{150;};
_men = if (count _this > 3) then { _this select 3; }else{[true,false];};
_vehicles = if (count _this > 4) then { _this select 4; }else{[true,false,false];};
_still = if (count _this > 5) then { _this select 5; }else{false;};
_menRatio = if (count _this > 6) then { _this select 6; }else{0.3;};
_vehRatio = if (count _this > 7) then { _this select 7; }else{0.02;};
_skills = if (count _this > 8) then { _this select 8; }else{"default";};
_milGroup = if (count _this > 9) then { _this select 9; }else{nil;}; if(!isNil("_milGroup"))then{if("_milGroup" == "nil0")then{_milGroup = nil;};};				//Changed by Dashnaw
_customInit = if (count _this > 10) then { _this select 10; }else{nil;}; if(!isNil("_customInit"))then{if(_customInit == "nil0")then{_customInit = nil;};};
_grpId = if (count _this > 11) then { _this select 11; }else{nil;};

if(_cPos in allMapMarkers)then{
_centerPos = getMarkerPos _cPos;
}else{
if (typeName _cPos == "ARRAY") then{
	_centerPos = _cPos;
}else{
	_centerPos = getPos _cPos;
};
};


if(isNil("LV_ACskills"))then{LV_ACskills = compile preprocessFile "LV\LV_functions\LV_fnc_ACskills.sqf";};
if(isNil("LV_vehicleInit"))then{LV_vehicleInit = compile preprocessFile "LV\LV_functions\LV_fnc_vehicleInit.sqf";};

if(isNil("LV_fullLandVehicle"))then{LV_fullLandVehicle = compile preprocessFile "LV\LV_functions\LV_fnc_fullLandVehicle.sqf";};
if(isNil("LV_fullAirVehicle"))then{LV_fullAirVehicle = compile preprocessFile "LV\LV_functions\LV_fnc_fullAirVehicle.sqf";};
if(isNil("LV_fullWaterVehicle"))then{LV_fullWaterVehicle = compile preprocessFile "LV\LV_functions\LV_fnc_fullWaterVehicle.sqf";};

if(typeName _menRatio == "ARRAY")then{
_menAmount = (_menRatio select 0) + (round (random (_menRatio select 1)));													//Changed by Dashnaw
}else{
_menAmount = round (_radius * _menRatio);
};
if(typeName _vehRatio == "ARRAY")then{
_vehAmount = (_vehRatio select 0) + (round (random (_vehRatio select 1)));													//Changed by Dashnaw
}else{
_vehAmount = round (_radius * _vehRatio);
};

_allUnitsArray = [];

_blueMenArray = ["B_Soldier_A_F","B_soldier_AR_F","B_medic_F","B_engineer_F","B_soldier_exp_F","B_Soldier_GL_F","B_soldier_M_F","B_soldier_AA_F","B_soldier_AT_F","B_officer_F","B_soldier_repair_F","B_Soldier_F","B_soldier_LAT_F","B_Soldier_lite_F","B_Soldier_SL_F","B_Soldier_TL_F","B_soldier_AAR_F","B_soldier_AAA_F","B_soldier_AAT_F"];
_redMenArray = ["O_Soldier_A_F","O_soldier_AR_F","O_medic_F","O_engineer_F","O_soldier_exp_F","O_Soldier_GL_F","O_soldier_M_F","O_soldier_AA_F","O_soldier_AT_F","O_officer_F","O_soldier_repair_F","O_Soldier_F","O_soldier_LAT_F","O_Soldier_lite_F","O_Soldier_SL_F","O_Soldier_TL_F","O_soldier_AAR_F","O_soldier_AAA_F","O_soldier_AAT_F"];
_greenMenArray = ["I_Soldier_A_F","I_soldier_AR_F","I_medic_F","I_engineer_F","I_soldier_exp_F","I_Soldier_GL_F","I_soldier_M_F","I_soldier_AA_F","I_soldier_AT_F","I_officer_F","I_soldier_repair_F","I_Soldier_F","I_soldier_LAT_F","I_Soldier_lite_F","I_Soldier_SL_F","I_Soldier_TL_F","I_soldier_AAR_F","I_soldier_AAA_F","I_soldier_AAT_F"];
_yellowMenArray = ["C_man_p_beggar_F","C_man_1","C_man_polo_2_F","C_man_polo_3_F","C_man_polo_4_F","C_man_polo_5_F","C_man_polo_6_F",
"C_man_shorts_1_F","C_man_1_1_F","C_man_1_2_F","C_man_1_3_F","C_man_p_fugitive_F","C_man_p_shorts_1_F","C_man_hunter_1_F",
"C_man_pilot_F","C_man_shorts_2_F","C_man_shorts_3_F","C_man_shorts_4_F","C_man_w_worker_F",
"C_man_p_beggar_F_euro","C_man_1_euro","C_man_polo_2_F_euro","C_man_polo_3_F_euro","C_man_polo_4_F_euro","C_man_polo_5_F_euro","C_man_polo_6_F_euro",
"C_man_shorts_1_F_euro","C_man_p_fugitive_F_euro","C_man_p_shorts_1_F_euro","C_man_shorts_2_F_euro","C_man_shorts_3_F_euro","C_man_shorts_4_F_euro",
"C_man_p_beggar_F_afro","C_man_1_afro","C_man_polo_2_F_afro","C_man_polo_3_F_afro","C_man_polo_4_F_afro","C_man_polo_5_F_afro","C_man_polo_6_F_afro",
"C_man_shorts_1_F_afro","C_man_p_fugitive_F_afro","C_man_p_shorts_1_F_afro","C_man_shorts_2_F_afro","C_man_shorts_3_F_afro","C_man_shorts_4_F_afro",
"C_man_p_beggar_F_asia","C_man_1_asia","C_man_polo_2_F_asia","C_man_polo_3_F_asia","C_man_polo_4_F_asia","C_man_polo_5_F_asia","C_man_polo_6_F_asia",
"C_man_shorts_1_F_asia","C_man_p_fugitive_F_asia","C_man_p_shorts_1_F_asia","C_man_shorts_2_F_asia","C_man_shorts_3_F_asia","C_man_shorts_4_F_asia"];

_BLUdivers = ["B_diver_F","B_diver_exp_F","B_diver_TL_F"];
_OPFdivers = ["O_diver_F","O_diver_exp_F","O_diver_TL_F"];
_INDdivers = ["I_diver_F","I_diver_exp_F","I_diver_TL_F"];

_yellowCarArray = ["C_Offroad_01_F","C_Quadbike_01_F","C_Hatchback_01_F","C_Hatchback_01_sport_F","C_SUV_01_F","C_Van_01_transport_F","C_Van_01_box_F"];

switch (_side) do {
   case 1: {
       _milHQ = createCenter west;
	if(isNil("_milGroup"))then{_milGroup = createGroup west;}else{_milGroup = _milGroup;};
       _menArray = _blueMenArray;
	_diveArray = _BLUdivers;
   };
   case 2: {
       _milHQ = createCenter east;
       if(isNil("_milGroup"))then{_milGroup = createGroup east;}else{_milGroup = _milGroup;};
       _menArray = _redMenArray;
	_diveArray = _OPFdivers;
   };
case 3: {
       _milHQ = createCenter resistance;
       if(isNil("_milGroup"))then{_milGroup = createGroup resistance;}else{_milGroup = _milGroup;};
       _menArray = _greenMenArray;
	_diveArray = _INDdivers;
   };
   default {
       _milHQ = createCenter civilian;
       if(isNil("_milGroup"))then{_milGroup = createGroup civilian;}else{_milGroup = _milGroup;};
       _menArray = _yellowMenArray;
   };
};

if((_men select 0)||(_men select 1))then{
for "_i" from 1 to _menAmount do{
	_validPos = false;
	while{!_validPos}do{
		_dir = random 360;
		_range = random _radius;
		_pos = [(_centerPos select 0) + (sin _dir) * _range, (_centerPos select 1) + (cos _dir) * _range, 0];

		if(_side > 0)then{
			if(surfaceIsWater _pos)then{
				if(_men select 1)then{
					_unitType = _diveArray select (floor(random(count _diveArray)));
					_validPos = true;
				};
			}else{
				if(_men select 0)then{
					_unitType = _menArray select (floor(random(count _menArray)));
					_validPos = true;
				};
			};
		}else{
			if(!surfaceIsWater _pos)then{
				_unitType = _menArray select (floor(random(count _menArray)));
				_validPos = true;
			};
		};
	};
	_unit = _milGroup createUnit [_unitType, _pos, [], 0, "NONE"];
	_unit setPos _pos;

	if(!_still)then{
		if(_unitType in _menArray)then{
			nul = [_unit,_cPos,_radius,_doorHandling] execVM "LV\patrol-vD.sqf";
		}else{
			nul = [_unit,_pos] execVM 'LV\patrol-vH.sqf';
		};
	};
	_unit allowDamage false;
	_allUnitsArray set [(count _allUnitsArray), _unit];

	_unit addMagazine "SmokeShell";
	_unit addMagazine ["Chemlight_green","Chemlight_red","Chemlight_yellow","Chemlight_blue"] call BIS_fnc_selectRandom;
};
};

_milGroup setBehaviour "SAFE";

if((_vehicles select 0)||(_vehicles select 1)||(_vehicles select 2))then{
   for "_i" from 1 to _vehAmount do{

	_validPos = false;
	while{!_validPos}do{

		_dir = random 360;
		_range = random _radius;
		_pos = [(_centerPos select 0) + (sin _dir) * _range, (_centerPos select 1) + (cos _dir) * _range, 0];

		if(_side > 0)then{
			if(surfaceIsWater _pos)then{
				if(_vehicles select 1)then{
					_driver = [_pos, (_side - 1)] call LV_fullWaterVehicle;
					if(!_still)then{nul = [vehicle _driver,_pos] execVM 'LV\patrol-vH.sqf';};
					_validPos = true;
				};
			}else{
				if((_vehicles select 0)&&(_vehicles select 2))then{
					_whichOne = floor(random 10);
					if(_whichOne < 3)then{
						_driver = [_pos, (_side - 1)] call LV_fullAirVehicle;
						if(!_still)then{nul = [_driver,_pos,[200,200]] execVM 'LV\patrol-vE.sqf';};
						vehicle _driver flyInHeight 10;
						_validPos = true;
					}else{
						_driver = [_pos, (_side - 1)] call LV_fullLandVehicle;
						if(!_still)then{nul = [vehicle _driver,_pos] execVM 'LV\patrol-vE.sqf';};
						_validPos = true;
					};
				}else{
					if(_vehicles select 0)then{
						_driver = [_pos, (_side - 1)] call LV_fullLandVehicle;
						if(!_still)then{nul = [vehicle _driver,_pos] execVM 'LV\patrol-vE.sqf';};
						_validPos = true;
					}else{
						if(_vehicles select 2)then{
							_driver = [_pos, (_side - 1)] call LV_fullAirVehicle;
							if(!_still)then{nul = [_driver,_pos,[200,200]] execVM 'LV\patrol-vE.sqf';};
							vehicle _driver flyInHeight 10;
							_validPos = true;
						};
					};
				};
			};
		}else{
			if(!surfaceIsWater _pos)then{
				_unitType = _yellowCarArray select (floor(random(count _yellowCarArray)));
				_vehicle = createVehicle [_unitType, _pos, [], 0, "NONE"];
				_crew = [_vehicle, _milGroup] call BIS_fnc_spawnCrew;
				_driver = driver _vehicle;
				if(!_still)then{nul = [_driver,_pos] execVM 'LV\patrol-vE.sqf';};
				_validPos = true;
			};
		};

	};
	_vehicle = vehicle _driver;
       _vehicle allowDamage false;

       _allUnitsArray set [(count _allUnitsArray), _vehicle];

	(units(group _driver)) joinSilent _milGroup;
   };
};

{
	if((typeName _skills != "STRING")&&((side _x) != civilian))then{ _skls = [_x,_skills] call LV_ACskills; };
	if(!isNil("_customInit"))then{
		[_x,_customInit] spawn LV_vehicleInit;
	};
} forEach units _milGroup;

sleep 3;
{
   _x allowDamage true;
}forEach _allUnitsArray;


if(!isNil("_grpId"))then{
call compile format ["LVgroup%1 = _milGroup",_grpId];
call compile format["LVgroup%1spawned = true;", _grpId];
_thisArray = [];
{
	if(isNil("_x"))then{
		_thisArray set[(count _thisArray),"nil0"];
	}else{
		_thisArray set[(count _thisArray),_x];
	};
}forEach _this;
call compile format["LVgroup%1CI = ['militarize',%2]",_grpId,'_thisArray'];									//Changed by Dashnaw
call compile format["LVgroup%1UNITS = [%2,%3]",_grpId,_menAmount,_vehAmount];								//Changed by Dashnaw
};



if(_smokesAndChems)then{
[_milGroup] spawn {
private ["_grp","_chance"];
_grp = _this select 0;
while{(count units _grp) > 0}do{
		{
			if((behaviour _x) == "COMBAT")then{
				if(daytime > 23 || daytime < 5)then{
					_chance = floor(random 100);
					if(_chance < 3)exitWith{
						if("Chemlight_green" in (magazines _x))exitWith{
							_x fire ["ChemlightGreenMuzzle","ChemlightGreenMuzzle","Chemlight_green"];
						};
						if("Chemlight_red" in (magazines _x))exitWith{
							_x fire ["ChemlightRedMuzzle","ChemlightRedMuzzle","Chemlight_red"];
						};
						if("Chemlight_yellow" in (magazines _x))exitWith{
							_x fire ["ChemlightYellowMuzzle","ChemlightYellowMuzzle","Chemlight_yellow"];
						};
						if("Chemlight_blue" in (magazines _x))exitWith{
							_x fire ["ChemlightBlueMuzzle","ChemlightBlueMuzzle","Chemlight_blue"];
						};
					};
				};
				if("SmokeShell" in (magazines _x))exitWith{
					_chance = floor(random 100);
					if(_chance < 3)exitWith{
						_x fire ["SmokeShellMuzzle","SmokeShellMuzzle","SmokeShell"];
					};
				};
			};
		}forEach units _grp;
	sleep 0.1;																								//Changed by Dashnaw
};
};
};

fillhouse.sqf: fillhouse.sqf download link

Very little changes have been made here, changes have been commented.

/*
			***		ARMA3Alpha FILL HOUSE SCRIPT v1.6 - by SPUn / lostvar	***

					Fills house or buildings in defined range with soldiers

		Calling the script:

				default: nul = [this] execVM "LV\fillHouse.sqf";

				custom:  nul = [target, side, patrol, patrol type, spawn rate, radius, skills, group,
								custom init, ID] execVM "LV\fillHouse.sqf";

	Parameters:

target 		= 	center point 	(Game Logics/Objects/Marker name, ex: GL01 or this or "marker1")
side 		= 	1 or 2 or 3		(1 = blue team, 2 = red team, 3 = green team) 							DEFAULT: 2
patrol 		= 	true or false 	(if true, units will patrol) 											DEFAULT: true
patrol type = 	1 or 2 			(1=only inside building, 2=also outside of building) 					DEFAULT: 2
spawn rate  = 	1-100 OR Array 	(on how many percentage of possible positions are soldiers spawned) 	DEFAULT: 50
			NOTE: Array - you can also use following syntax: [amount,random amount] for example:
			[10,12] will spawn at least 10 units + random 12 units
radius 		= 	1 or larger number (1=nearest building. if larger number, then all buildings in radius) DEFAULT: 1
skills 		= 	"default" 	(default AI skills) 														DEFAULT: "default"
			or	number	=	0-1.0 = this value will be set to all AI skills, ex: 0.8
			or	array	=	all AI skills invidiually in array, values 0-1.0, order:
	[aimingAccuracy, aimingShake, aimingSpeed, spotDistance, spotTime, courage, commanding, general, endurance, reloadSpeed]
	ex: 	[0.75,0.5,0.6,0.85,0.9,1,1,0.75,1,1]
group 		= 	group name or nil (if you want units in existing group, set it here. if nil, 			DEFAULT: nil
				new group is made) EXAMPLE: (group player)
custom init = 	"init commands" (if you want something in init field of units, put it here) 			DEFAULT: nil
			NOTE: Keep it inside quotes, and if you need quotes in init commands, you MUST use ' or "" instead of ".
			EXAMPLE: "hint 'this is hint';"
ID 			= 	number (if you want to delete units this script creates, you'll need ID number for them)DEFAULT: nil

EXAMPLE: 	nul = [this, 2, true, 2, 50, 1, 0.75, nil, nil, 9] execVM "LV\fillHouse.sqf";
		spawns in nearest building east soldiers in 50% of possible building positions with skill 0.75,
		and makes them patrol in & outside of that building
*/
if (!isServer)exitWith{};
private ["_blueMenArray3","_blueMenArray2","_BLUarrays","_redMenArray2","_OPFarrays","_greenMenArray","_grpId","_customInit","_center","_skls","_skills","_a","_buildings","_rat","_milHQ","_milGroup","_menArray","_i","_newPos","_i2","_unitType","_unit","_building","_sideOption","_blueMenArray","_redMenArray","_bPoss","_patrol","_pFile","_pType"];

_center = if (count _this > 0) then { _this select 0;};
_sideOption = if (count _this > 1) then { _this select 1;} else {2};
_patrol = if (count _this > 2) then { _this select 2;} else {true};
_pType = if (count _this > 3) then { _this select 3;} else {2};
_ratio = if (count _this > 4) then { _this select 4;} else {50};
_radius = if (count _this > 5) then { _this select 5;} else {1};
_skills = if (count _this > 6) then { _this select 6;} else {"default"};
_milGroup = if (count _this > 7) then { _this select 7;} else {nil}; if(!isNil("_milGroup"))then{if("_milGroup" == "nil0")then{_milGroup = nil;};};				//Changed by Dashnaw
_customInit = if (count _this > 8) then { _this select 8;} else {nil}; if(!isNil("_customInit"))then{if(_customInit == "nil0")then{_customInit = nil;};};
_grpId = if (count _this > 9) then { _this select 9;} else {nil};

if(isNil("LV_ACskills"))then{LV_ACskills = compile preprocessFile "LV\LV_functions\LV_fnc_ACskills.sqf";};
if(isNil("LV_vehicleInit"))then{LV_vehicleInit = compile preprocessFile "LV\LV_functions\LV_fnc_vehicleInit.sqf";};
if(isNil("LV_nearestBuilding"))then{LV_nearestBuilding = compile preprocessFile "LV\LV_functions\LV_fnc_nearestBuilding.sqf";};

_blueMenArray = ["B_Soldier_A_F","B_soldier_AR_F","B_medic_F","B_engineer_F","B_soldier_exp_F","B_Soldier_GL_F","B_soldier_M_F","B_soldier_AA_F","B_soldier_AT_F","B_officer_F","B_soldier_repair_F","B_Soldier_F","B_soldier_LAT_F","B_Soldier_lite_F","B_Soldier_SL_F","B_Soldier_TL_F","B_soldier_AAR_F","B_soldier_AAA_F","B_soldier_AAT_F"];
_blueMenArray2 = ["B_recon_exp_F","B_recon_JTAC_F","B_recon_M_F","B_recon_medic_F","B_recon_F","B_recon_LAT_F","B_recon_TL_F","B_soldier_AAR_F","B_soldier_AAA_F","B_soldier_AAT_F"];
_blueMenArray3 = ["B_G_Soldier_A_F","B_G_soldier_AR_F","B_G_medic_F","B_G_engineer_F","B_G_soldier_exp_F","B_G_Soldier_GL_F","B_G_soldier_M_F","B_G_officer_F","B_G_Soldier_F","B_G_soldier_LAT_F","B_G_Soldier_lite_F","B_G_Soldier_SL_F","B_G_Soldier_TL_F"];
_BLUarrays = [_blueMenArray,_blueMenArray2,_blueMenArray3];
_redMenArray = ["O_Soldier_A_F","O_soldier_AR_F","O_medic_F","O_engineer_F","O_soldier_exp_F","O_Soldier_GL_F","O_soldier_M_F","O_soldier_AA_F","O_soldier_AT_F","O_officer_F","O_soldier_repair_F","O_Soldier_F","O_soldier_LAT_F","O_Soldier_lite_F","O_Soldier_SL_F","O_Soldier_TL_F","O_soldier_AAR_F","O_soldier_AAA_F","O_soldier_AAT_F"];
_redMenArray2 = ["O_recon_exp_F","O_recon_JTAC_F","O_recon_M_F","O_recon_medic_F","O_recon_F","O_recon_LAT_F","O_recon_TL_F","O_soldier_AAR_F","O_soldier_AAA_F","O_soldier_AAT_F"];
_OPFarrays = [_redMenArray,_redMenArray2];
_greenMenArray = ["I_Soldier_A_F","I_soldier_AR_F","I_medic_F","I_engineer_F","I_soldier_exp_F","I_Soldier_GL_F","I_soldier_M_F","I_soldier_AA_F","I_soldier_AT_F","I_officer_F","I_soldier_repair_F","I_Soldier_F","I_soldier_LAT_F","I_Soldier_lite_F","I_Soldier_SL_F","I_Soldier_TL_F","I_soldier_AAR_F","I_soldier_AAA_F","I_soldier_AAT_F"];

switch (_sideOption) do {
   case 1: {
       _milHQ = createCenter west;
	if(isNil("_milGroup"))then{_milGroup = createGroup west;}else{_milGroup = _milGroup};
       _menArray = (_BLUarrays call BIS_fnc_selectRandom);
   };
case 2: {
       _milHQ = createCenter east;
       if(isNil("_milGroup"))then{_milGroup = createGroup east;}else{_milGroup = _milGroup};
       _menArray = (_OPFarrays call BIS_fnc_selectRandom);
   };
   default {
       _milHQ = createCenter resistance;
       if(isNil("_milGroup"))then{_milGroup = createGroup resistance;}else{_milGroup = _milGroup};
       _menArray = _greenMenArray;
   };
};

if(_center in allMapMarkers)then{
	_center0 = getMarkerPos _center;
}else{
	if (typeName _center == "ARRAY") then{
		_center0 = _center;
	}else{
		_center0 = getPos _center;
	};
};

if(_radius > 1)then{
_buildings = ["all in radius",_center,_radius] call LV_nearestBuilding;
}else{
_buildings = ["nearest one",_center] call LV_nearestBuilding;
};
if(isNil("_buildings"))exitWith{};
if(count _buildings == 0) exitWith{};

_bPoss = [];
_a = 0;
while { _a < (count _buildings) } do {
_building = (_buildings select _a);
_i = 0;
while { ((_building buildingPos _i) select 0) != 0 } do {
	_bPoss set [count (_bPoss), (_building buildingPos _i)];
	_i = _i + 1;
};
_a = _a + 1;
};

if(typeName _ratio == "ARRAY")then{
_rat = (_ratio select 0) + (round (random (_ratio select 1)));																	//Changed by Dashnaw
}else{
_rat = ceil((_ratio / 100) * (count _bPoss));
};
_i2 = 0;
while{_i2 < _rat}do{
   //if(_radius > 1)then{_newPos = _bPoss select floor(random count _bPoss);}else{_newPos = _bPoss select _i2;};
_newPos = _bPoss select floor(random count _bPoss);
if(_rat < count _bPoss)then{_bPoss = _bPoss - [_newPos];};
   _i2 = _i2 + 1;

   _unitType = _menArray select (floor(random(count _menArray)));
_unit = _milGroup createUnit [_unitType, _newPos, [], 0, "NONE"];
_unit setpos _newPos;

if(typeName _skills != "STRING")then{_skls = [_unit,_skills] call LV_ACskills;};

if(_patrol)then{
       	switch (_pType) do {
           		case 1: {
               		_pFile = "LV\patrol-vF.sqf";
           		};
           		case 2: {
               		_pFile = "LV\patrol-vG.sqf";
           		};
       	};
		nul = [_unit] execVM format["%1",_pFile];
}else{
       	doStop _unit;
   };
if(!isNil("_customInit"))then{
	nul = [_unit,_customInit] spawn LV_vehicleInit;
};
};

if(!isNil("_grpId"))then{
call compile format ["LVgroup%1 = _milGroup",_grpId];
call compile format["LVgroup%1spawned = true;", _grpId];
_thisArray = [];
{
	if(isNil("_x"))then{
		_thisArray set[(count _thisArray),"nil0"];
	}else{
		_thisArray set[(count _thisArray),_x];
	};
}forEach _this;
call compile format["LVgroup%1CI = ['fillhouse',%2]",_grpId,'_thisArray'];									//Changed by Dashnaw
call compile format["LVgroup%1UNITS = [%2]",_grpId,_rat];													//Changed by Dashnaw
};

LV_fnc_simpleCachev2.sqf: LV_fnc_simpleCachev2.sqf download link

I've made quite a few changes in this, non of which I've commented as I didn't want to flood it with comments. If you want to compare the differences, compare the files directly with each other.

/*ARMA3 function LV_fnc_simpleCachev2 v0.2 - by Na_Palm
initial version by SPUn / lostvar

	This script caches fillHouse & militarize scripts.

nul = [[script parameter list], distance, keep count] execVM "LV\LV_functions\LV_fnc_simpleCachev2.sqf";

script parameter list	=	array of [scriptID, [parameter]]
							scriptID = 1: militarize, 2: fillHouse
							parameter = array of required parameters for the script
							the same as you would use for them direcly
distance				=	distance between player(s) and militarize/fillHouse on where scripts will be activated
keep count				=	true = script will count & save AI amounts, false = AI amount will be reseted on each time it activates again

For server admins, the loop can be switched off with command on server: {swAI_Run = false;}

example 1 (for use in GameLogic):
nul = [[[1, [<parameter for 1>]], [2, [<parameter for 2>]]], 500, true] execVM "LV\LV_functions\LV_fnc_simpleCachev2.sqf";

example 2 (for use in init.sqf or initServer.sqf):
LV_fnc_simpleCachev2 = compileFinal preProcessFileLineNumbers "LV\LV_functions\LV_fnc_simpleCachev2.sqf";
[[[1, [<parameter for 1>]], [2, [<parameter for 2>]]], 500, true] spawn LV_fnc_simpleCachev2;

example 3 (for use in init.sqf or initServer.sqf):
LV_fnc_simpleCachev2 = compileFinal preProcessFileLineNumbers "LV\LV_functions\LV_fnc_simpleCachev2.sqf";
_sCscript_list =[
					[1, [<parameter for 1>]],
					[2, [<parameter for 2>]]
				];
[_sCscript_list, 500, true] spawn LV_fnc_simpleCachev2;

*/
if (!isServer)exitWith{};
if(isNil {LV_fnc_removeGroupv2}) then {LV_fnc_removeGroupv2 = compileFinal preProcessFileLineNumbers "LV\LV_functions\LV_fnc_removeGroupv2.sqf";};
if(isNil {NP_fnc_isPlayernear}) then {NP_fnc_isPlayernear = compileFinal preProcessFileLineNumbers "LV\LV_functions\NP_fnc_isPlayernear.sqf";};
if(isNil {LV_militarize}) then {LV_militarize = compileFinal preProcessFileLineNumbers "LV\militarize.sqf";};
if(isNil {LV_fillHouse}) then {LV_fillHouse = compileFinal preProcessFileLineNumbers "LV\fillHouse.sqf";};

private ["_distance","_grpname","_hndl","_keepCount","_MenCount","_needDespwn","_needSpwn",
"_posOfScriptMrkr","_scrptPara_list","_spwndSciptIdx_list","_VehCount", "_OldUnitNumberArray"];

_scrptPara_list = [_this, 0, [], [[]]] call BIS_fnc_param;
_distance = [_this, 1, 1000, [0]] call BIS_fnc_param;
_keepCount = [_this, 2, false, [true]] call BIS_fnc_param;


//vars it needs
_spwndSciptIdx_list = [];
swAI_Run = true;
diag_log format["---- starting simpleCacheV2 now ------------------"];

while{((count _scrptPara_list) > 0) && swAI_Run} do {
//check if to keep count
if (_keepCount) then {
	{
		_grpname = grpNull;
		//is it already spawned?
		if (_forEachIndex in _spwndSciptIdx_list) then {
			_MenCount = 0;
			_VehCount = 0;
			//get groupname
			if ((_x select 0) == 1) then {
				call compile format["_grpname = LVgroup%1",(_x select 1 select 11)];
			} else {
				call compile format["_grpname = LVgroup%1",(_x select 1 select 9)];
			};
			//get unit/vehicle count in group
			_MenCount = ({alive _x} count units _grpname);
			if ((_x select 0) == 1) then {
				{
					if (vehicle _x != _x) then {
						if ((canMove (vehicle _x)) && (alive _x)) then {
							_vArray = [];
							{If !((vehicle _x) In _vArray) Then {_vArray=_vArray+[vehicle _x]}} Foreach (units _grpname);
							_VehCount="LandVehicle" countType _vArray;
							_MenCount = _MenCount - 1;
						};
					};
					sleep 0.001;
				}forEach units _grpname;
			};
			if ((_MenCount == 0) && (_VehCount == 0)) then {
				//script has no units left, so delete it from _scrptPara_list and DESPAWN
				if ((_x select 0) == 1) then {
					call compile format["_grpname = LVgroup%1",(_x select 1 select 11)];
				} else {
					call compile format["_grpname = LVgroup%1",(_x select 1 select 9)];
				};
				[_grpname] call LV_fnc_removeGroupv2;
				//_spwndSciptIdx_list = _spwndSciptIdx_list - [_forEachIndex];									//Commented out, else problems ensue.
				_scrptPara_list set [_forEachIndex, 999999];
				//_scrptPara_list = _scrptPara_list - [999999];													//Moved outside foreach loop, else wrong values be deleted with long 																								  arrays.
			} else {
				//change parameter array according to new counts
				if ((_x select 0) == 1) then {
					//militarize
					call compile format["_OldUnitNumberArray = LVgroup%1UNITS",(_x select 1 select 11)];
					if(_MenCount > (_OldUnitNumberArray select 0)) then {_MenCount = _MenCount - (_MenCount - (_OldUnitNumberArray select 0));};
					if(_VehCount > (_OldUnitNumberArray select 1)) then {_VehCount = _VehCount - (_VehCount - (_OldUnitNumberArray select 1));};
					(_x select 1) set [6, [_MenCount, 0]];
					(_x select 1) set [7, [_VehCount, 0]];
					sleep 0.001;
				} else {
					//fillHouse
					(_x select 1) set [4, [_MenCount, 0]];
				};
			};
		};

		sleep 0.001;
	}forEach _scrptPara_list;
	_scrptPara_list = _scrptPara_list - [999999];																//Moved here, from above to prevent wrong values from being deleted 																											  with long _scrptPara_list arrays
};
sleep 0.01;
//check if a spawned script needs to DESPAWN, then do it
{
	_needDespwn = true;
	//is it already spawned?
	if (_forEachIndex in _spwndSciptIdx_list) then {
		//get position in accordance to type
		if ((_x select 1 select 0) in allMapMarkers) then {
			_posOfScriptMrkr = getMarkerPos (_x select 1 select 0);
		} else {
			if (typeName (_x select 1 select 0) == "ARRAY") then {
				_posOfScriptMrkr = (_x select 1 select 0);
			} else {
				_posOfScriptMrkr = getPos (_x select 1 select 0);
			};
		};
		//check if player near
		_needDespwn = !([_posOfScriptMrkr, _distance] call NP_fnc_isPlayernear);
	} else {
		_needDespwn	= false;
	};
	//despawn it
	if (_needDespwn) then {
		if ((_x select 0) == 1) then {
			if(!isnil (call compile format["'LVgroup%1'",(_x select 1 select 11)])) then
			{
				call compile format["_grpname = LVgroup%1",(_x select 1 select 11)];
				//check if vehicle got hijacked
				//thanks Meatball for reminding me!
				{
					if (vehicle _x != _x) then {
					_hijacked = false;
					_hijGroup = grpNull;
					{
						if (alive _x) then {
							if !(_x in (units _grpname)) exitWith {_hijGroup = (group _x); _hijacked = true;};
						};
						if (_hijacked) exitWith {};
						sleep 0.001;
					}forEach crew _x;
					if (_hijacked) then {
						[_x] joinSilent _hijGroup;
					};
				};
				sleep 0.001;
				}forEach units _grpname;
			} else {
			_grpname = grpNull;
			sleep 0.001;
			};
		} else {
			if(!isnil (call compile format["'LVgroup%1'",(_x select 1 select 9)])) then
			{
				call compile format["_grpname = LVgroup%1",(_x select 1 select 9)];
			} else {
				_grpname = grpNull;
				sleep 0.001;
			};
		};
		[_grpname] call LV_fnc_removeGroupv2;
		_spwndSciptIdx_list = _spwndSciptIdx_list - [_forEachIndex];
	};
	sleep 0.001;
}forEach _scrptPara_list;
//check if a script needs to SPAWN, then do it
{
	_needSpwn = false;
	//is it already spawned?
	if !(_forEachIndex in _spwndSciptIdx_list) then {
		//get position in accordance to type
		if ((_x select 1 select 0) in allMapMarkers) then {
			_posOfScriptMrkr = getMarkerPos (_x select 1 select 0);
		} else {
			if (typeName (_x select 1 select 0) == "ARRAY") then {
				_posOfScriptMrkr = (_x select 1 select 0);
			} else {
				_posOfScriptMrkr = getPos (_x select 1 select 0);
			};
		};
		//check if player near
		_needSpwn = [_posOfScriptMrkr, _distance] call NP_fnc_isPlayernear;
	};
	//spawn it
	if (_needSpwn) then {
		if ((_x select 0) == 1) then {
			_hndl = (_x select 1) spawn LV_militarize;
			waitUntil {scriptDone _hndl};
		} else {
			_hndl = (_x select 1) spawn LV_fillHouse;
			waitUntil {scriptDone _hndl};
		};
		_spwndSciptIdx_list set [count _spwndSciptIdx_list, _forEachIndex];
	};
	sleep 0.001;
}forEach _scrptPara_list;

sleep 0.001;
};
diag_log format ["-%1-!!LV_simpleCachev2 SHOTDOWN!!--"];

LV_fnc_removeGroupV2.sqf: LV_fnc_removeGroupV2.sqf download link

Very few changes made here - basically dead units are no longer deleted by this script, giving you time to actually loot them. And as I'm using another script to remove dead bodies after a set time-delay I didn't want this script to circumvent that. Changes have been commented.

//ARMA3Alpha function LV_fnc_removeGroup v0.2 - by SPUn / lostvar, REMAKE by kemor
//removes fillHouse or militarize units
//Syntax: nul = [LVgroup*] execVM "LV\LV_functions\LV_fnc_removeGroupV2.sqf";
// * = id number (which is defined in fillHouse or militarize, so if ID is 10 = LVgroup10)
private["_grp"];

_grp = _this select 0;

{
if(vehicle _x != _x)then
{
	_veh = vehicle _x;
	{
           //getting rid of the frikkin gunners!
		_x assignAsDriver _veh;
		unassignVehicle _x;
		moveOut _x;
		_x setPos [0,0,0];
		deleteVehicle _x;
	}forEach crew _veh;
	if(alive _veh) then {deleteVehicle _veh;};									//Changed by Dashnaw
}
else
{
	if(alive _x) then {deleteVehicle _x;};										//Changed by Dashnaw
};
}forEach units _grp;
deleteGroup _grp;

In my test setup, I've primarily been initializing these script with init.sqf:

if(isserver) then {
LV_fnc_simpleCachev2 = compileFinal preProcessFileLineNumbers "LV\LV_functions\LV_fnc_simpleCachev2.sqf";
_sCscript_list =[
					[1,[POSITION1,3,0,[true,false],[true,false,false],false,[1,2],[1,0],"default",nil,"nil",1]],
					[2,[POSITION2,3,true,2,[4,2],50,"default",nil,nil,2]],
					[2,[POSITION3,3,false,1,[4,2],50,"default",nil,nil,3]]
				];
[_sCscript_list, DISTANCE, true] spawn LV_fnc_simpleCachev2;
};

Where 1 = Militarize script and 2 = Fillhouse script, as detailed by Na_Palm.

Edited by Dashnaw
Fixed few more issues

Share this post


Link to post
Share on other sites

Hi spunFIN,

I continue to use your scripts,particularly ambient combat,over all other mods or scripts out their for my missions.

However,as also mentioned above by others,the last arma3 update broke some things.

Want to reconfirm that Heli reinforcement chopper does not land,and militarizing the area with vehicles causes those vehicles to reproduce each other.

Are you still working on these scripts and keeping them up to date?

I really hope so as their amazing and simply very underated.

Hope to hear from you, cheers man!

---------- Post added at 15:14 ---------- Previous post was at 13:27 ----------

EDIT!!

it turns out that if you give the heli reinforcement script an "landing spot,exact=TRUE. The helo will land. Just tested it numerous times,its the only way it works.

Watch your heads with those propellers!

Also wanna say the paradrop is not working consistently but i think spunfins aware of that.

Share this post


Link to post
Share on other sites

it turns out that if you give the heli reinforcement script an "landing spot,exact=TRUE. The helo will land. Just tested it numerous times,its the only way it works.

That almost suggests that the latest patches have broken whatever script this uses to find a safe landing spot, assuming the "exact" heli landing spot is not set to true. Good spot redarmy, perhaps now we can figure out what`s wrong with this particular script or related scripts.

Share this post


Link to post
Share on other sites
That almost suggests that the latest patches have broken whatever script this uses to find a safe landing spot, assuming the "exact" heli landing spot is not set to true. Good spot redarmy, perhaps now we can figure out what`s wrong with this particular script or related scripts.

Yes it certainly seems so.Happy i found a work around,my only worry is that future updates to arma 3 may further cripple these scripts.I hope not and hope to hear from spunfin himself and hope he finds time to look in on these fine lines of code from time to time.

Share this post


Link to post
Share on other sites

I've not had Any issue's with paradrop, Although I use this script in a simple form, a trigger and a markers for patrolling. Do you have an example Thanks

Share this post


Link to post
Share on other sites
I've not had Any issue's with paradrop, Although I use this script in a simple form, a trigger and a markers for patrolling. Do you have an example Thanks

i also use simple form. Trigger,land at player,patrol around player.

I set the trigger to repeatable. When the trigger fires,the helo flys over head but only drops infantry out 30% of the time.

Could it be possible that calling the script repeatedly in quick succession is what is causing it to not work?

Share this post


Link to post
Share on other sites

@Dashnaw

Hey, thanks for your work on the fillhouse.sqf and militarize.sqf. After that 1.16 update to Arma, both of those scripts were not longer working for me. I downloaded your modified versions and they seem to be working again. Thank you so much!

Share this post


Link to post
Share on other sites

i had an issue with paradrop and cleanup server especially with the deletegroup.

The group of paradrop could be deleted before the jump.

Share this post


Link to post
Share on other sites

Hey guys, great work again on fixing things and finding reasons for issues! :)

About reinforcementChopper - I haven't seen all the changelogs yet on new arma patches, but this could refer to misbehaviour (or misuse?) of isFlatEmpty, as it's being used when exact == false. (line 167)

Paradrop - If whole chopper dissapears before paradrop, it must be spawn block at line 174. If jumpers just doesnt appear but heli flies thru path, then it's somekind of distance issue (line 191).

Militarize & fillHouse - Nice fixes, but I think if("_milGroup" == "nil0") can cause some issues in scenario where group is respawning from cache with group parameter set to nil, as we're now comparing here only two strings. But this would mess up only the original simpleCache I think, so no worries. :) We should just take some time and clean up the whole script and get rid of simpleCache(1) related stuff etc.

I'll get back to these issues on better time, especially that reinforcementHeli issue is now bothering me.

Share this post


Link to post
Share on other sites

Great to hear from you spunFIN!

Im not finding issues with militarize when i use it in single player and using the app to impliment it.

However one other thing i noticed.

Ambient combat with Acavoid, spawned units do not avoid if you set Acavoid. It needs to be "Acavoid_1" _2 _3 _4 etc. so starting with _1 all the way up to _30 works. Not sure if thats been covered.

I am going to try make the para drop helo fly in another behaviour diifferent to careless behaviour and see if it helps.(can i even do that?) maybe aware? Because in recent updates bohemia messed up the ai careless behaviour files somehow.I thought the had fixed it but it may have broke something in your script.

By the way the flares/smoke,chems are awesome looking. Nice touch there,i only started using it.

Keep up the good scripts man

Much appreciated!

Share this post


Link to post
Share on other sites
Ambient combat with Acavoid, spawned units do not avoid if you set Acavoid. It needs to be "Acavoid_1" _2 _3 _4 etc. so starting with _1 all the way up to _30 works. Not sure if thats been covered.

I am going to try make the para drop helo fly in another behaviour diifferent to careless behaviour and see if it helps.(can i even do that?) maybe aware? Because in recent updates bohemia messed up the ai careless behaviour files somehow.I thought the had fixed it but it may have broke something in your script.

Odd, "ACavoid" should be valid as avoid marker, gotta see why it has stopped working.

Indeed, CARELESS could then also be reason for issues. You could maybe try SAFE (to lines 161, 164 and 168). Point of using careless was just to make sure they would really fly directly the path you want, triggering line 191, but let's see how it goes with other behaviours. :)

Share this post


Link to post
Share on other sites
Odd, "ACavoid" should be valid as avoid marker, gotta see why it has stopped working.

Indeed, CARELESS could then also be reason for issues. You could maybe try SAFE (to lines 161, 164 and 168). Point of using careless was just to make sure they would really fly directly the path you want, triggering line 191, but let's see how it goes with other behaviours. :)

Apoligies it was my error.I must have set the marker wrong for "acavoid" it DOES still work ;)

I tested out the paradrop in SAFE and AWARE.The only difference is that the troops who drop sometimes die lol no change,it still skips the waypoint.

Only trend i can see so far is that its got a 99% chance to work the first time on a radio trigger set to repeatadly.But on 2nd and third time its not working most of the time.Il test some more under different conditions.

Maybe its trigger related somehow,or time related. we will see

Testing more.I can confirm the para drop works first time.But stops working after it is used once.So i cant figure out why.I deleted the 1st dropped units and tried again,didnt work.I tried with different triggers,and waited many minutes between calling the script,still dosent work.

From what i can see is that after it works the 1st time,the helo seems to be off its intended waypoint by a few degrees.

Edited by redarmy

Share this post


Link to post
Share on other sites

spunFIN:

Everything is working fine but I have a requestion (haha).

Would it be possible in your script to use the Fill House to spawn 1 CSAT officer, have him patrol like normal and give him a name?

The idea is to use your script to make a moving HVT with a name so that a trigger can detect when hes dead.

I realize there would be some extra scripting to this so feel free to tell me to shove it. But I thought I would ask!

Share this post


Link to post
Share on other sites
spunFIN:

Everything is working fine but I have a requestion (haha).

Would it be possible in your script to use the Fill House to spawn 1 CSAT officer, have him patrol like normal and give him a name?

The idea is to use your script to make a moving HVT with a name so that a trigger can detect when hes dead.

I realize there would be some extra scripting to this so feel free to tell me to shove it. But I thought I would ask!

Hey,

You could do this by editing classname arrays at fillHouse.sqf lines 61-62 (or making your custom copy of this file and editing it if you want to use also the original at the same mission). Currently it has 2 classname arrays for OPFOR and it randomly picks one of them where it picks randomly classnames. So populating those two arrays (_redMenArray and _redMenArray2) only with CSAT classnames would do.

For naming the unit you could use custom init, eg. "this setVehicleVarName 'CSAT_guy'; CSAT_guy = this;"

Example of full calling line:

nul = [spot,2,true,1,0,2,"default",nil,"this setVehicleVarName 'CSAT_guy'; CSAT_guy = this;",nil] execVM "LV\fillHouse.sqf";

OR, you could use ID Number parameter of fillHouse: if you set it for example to 1, then you CSAT guy's group can be identified with LVgroup1 and you can refer to the unit itself with (leader LVgroup1), and if he's alive, this will return 1: ({alive _x} count units LVgroup1) .

Share this post


Link to post
Share on other sites

Spunfin,

doing a bit more testing.

It seems that ambient combat is broken too. After the first groups spawn and do their careless waypoint(or whatever you make the wp) the next groups that spawn in do not patrol,they just stand idle.

Could this be a side effect of using mcc ghost mode to make ai ignore player, or too many acavoid markers in an area?

Share this post


Link to post
Share on other sites
Hey,

You could do this by editing classname arrays at fillHouse.sqf lines 61-62 (or making your custom copy of this file and editing it if you want to use also the original at the same mission). Currently it has 2 classname arrays for OPFOR and it randomly picks one of them where it picks randomly classnames. So populating those two arrays (_redMenArray and _redMenArray2) only with CSAT classnames would do.

For naming the unit you could use custom init, eg. "this setVehicleVarName 'CSAT_guy'; CSAT_guy = this;"

Example of full calling line:

nul = [spot,2,true,1,0,2,"default",nil,"this setVehicleVarName 'CSAT_guy'; CSAT_guy = this;",nil] execVM "LV\fillHouse.sqf";

OR, you could use ID Number parameter of fillHouse: if you set it for example to 1, then you CSAT guy's group can be identified with LVgroup1 and you can refer to the unit itself with (leader LVgroup1), and if he's alive, this will return 1: ({alive _x} count units LVgroup1) .

Thank You! I'll give it a try in the next day or two and get back to you!

Share this post


Link to post
Share on other sites
It seems that ambient combat is broken too. After the first groups spawn and do their careless waypoint(or whatever you make the wp) the next groups that spawn in do not patrol,they just stand idle.

Could this be a side effect of using mcc ghost mode to make ai ignore player, or too many acavoid markers in an area?

I'm not sure what ghost mode does - but if it uses setCaptive and you have MP parameter set to true, it will cause issues as AC looks for non-captive alive units from playableUnits and orients patrolling to them.

Too many avoid markers could also surely cause this, but not permanently I think, as eventually the loop should find a new position unless surrounding area is 100% suppressed with them. You could try teleporting to another location and see if this issue persists.

If issue is still there, try changin patrol type parameter from waypoint behaviour array to 1 and they should use doMove.

You could also open LV_functions\LV_fnc_ACpatrol.sqf and uncomment lines 15-31 and 113 and 114, then you should see blue markers on group positions and green markers on waypoint positions always when ACpatrol does something.

Share this post


Link to post
Share on other sites
I'm not sure what ghost mode does - but if it uses setCaptive and you have MP parameter set to true, it will cause issues as AC looks for non-captive alive units from playableUnits and orients patrolling to them.

Too many avoid markers could also surely cause this, but not permanently I think, as eventually the loop should find a new position unless surrounding area is 100% suppressed with them. You could try teleporting to another location and see if this issue persists.

If issue is still there, try changin patrol type parameter from waypoint behaviour array to 1 and they should use doMove.

You could also open LV_functions\LV_fnc_ACpatrol.sqf and uncomment lines 15-31 and 113 and 114, then you should see blue markers on group positions and green markers on waypoint positions always when ACpatrol does something.

Thanks spunfin, DOMOVE is working much better.

Basically i was setting groups to spawn between 450(default) and 1000meters around player,but having 4 big avoid zones as i needed to contain the fighting into a zone around 2x2 km area.Of course player will be traveliing from an avoid zone,therefor ai spawned right on the "border" of avoid zone,hindering a waypoint towards player.After player made his way to centre of the 2kmx 2km zone,groups took a long time to process waypoints.

Again,i was in ghost mode(probably as u said "set captive") not sure,all i know is it makes ai ignore player so yes probably set captive.

All is working fine now and do move seems alot more enjoyable as a "battle panic scramble" formation.

Share this post


Link to post
Share on other sites

Hi spunfin,

iv been tinkering around with ambient combat alot,its great to figure out how to tweak it to my preference,but i have ne small problem i cant figure out...

Im trying to adjust ambient combat so the it spawns "between" south-west-north, and not in the east of players position(behind my unit) i saw the setting "random 360" and changed it to a compass bearing,and it worked,groups spawned from that bearing. But when i entered multiple bearings like this ... "260,280,300" etc, groups only spawned from the first bearing,260. Any way i can alter it so i have groups appearing in say,the east only?

Share this post


Link to post
Share on other sites

Hey Redarmy, If you are Using Markers You Can Set The Direction on them as well to point lets say north then if you defined as well in the Radius in the script it should keep it from spawning from behind the intended target.

Share this post


Link to post
Share on other sites

Hi silent_sniper,im using game logic.I didnt even know you could use markers(which ones and how to face direction?) and which radius to define do you refer to? the one which says "random 360"?

Share this post


Link to post
Share on other sites
My Fault, as Ambient Combat Will not work unless it's a Live Object. Here I Made an Example That Allows all Sides to spawn but keeps them from spawning behind my Unit. Use Link put in editor as I did not PBO this file http://www.disfunctionalradioshow.com/AmbientCombatTest.Altis.zip

Thanks for the demo sniper,taking a look now will give it a try.

Share this post


Link to post
Share on other sites

Really appreciate the release, all the optional parameters are perfect for what I was looking for :)

I'm new to the ARMA editing community and so I'm wondering: if I release a mission on the workshop that utilized scripts from a release is it just a case of giving credit and linking to the release?

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

×