Jump to content
bangabob

Enemy occupation system (eos)

Recommended Posts

I know Bangabob, is not active at this time, that's to bad. I hope someone else can help. My question is : is there a way to have the zones spawn only 1 time. Thanks for any help.

 

Share this post


Link to post
Share on other sites
On 11/2/2018 at 4:02 AM, zagor64bz said:

Sure.

instead of calling the areas from the openMe.sqf of the EOS folder, call the function in a trigger with whatever condition you like (i/e present/not present/whatever), and then


null=[["M1","M2","M3"],[HOUSE GROUPS,SIZE OF GROUPS,PROBABILITY],[PATROL GROUPS,SIZE OF GROUPS,PROBABILITY],[LIGHT VEHICLES,SIZE OF CARGO,PROBABILITY],[ARMOURED VEHICLES,PROBABILITY], [STATIC VEHICLES,PROBABILITY],[HELICOPTERS,SIZE OF HELICOPTER CARGO,PROBABILITY],[FACTION,MARKERTYPE,DISTANCE,SIDE,HEIGHTLIMIT,DEBUG]] call EOS_Spawn;

in "on act" field

Have you tested this recently? For the life of me, I can't get trigger zones to work. I had it several months ago and now nothing happens when entering the trigger: no units spawn, no debug, no hints, nothing. 

Share this post


Link to post
Share on other sites

decided to make a script that fills infpool based on cfgfactionclass. it works by saving units to a variable named exactly the same as written in editor with the addition of _ in front. example say you want the new faction spetsnaz added to the infpool inside the UnitPools.sqf file, write 

(missionNamespace getVariable "man_spetsnaz") +  (missionNamespace getVariable "man_CSAT")

missionNamespace getVariable "tank_CSAT"

missionNamespace getVariable "arty_CSAT"

missionNamespace getVariable "apc_CSAT"

missionNamespace getVariable "car_CSAT"

missionNamespace getVariable "boat_CSAT"

missionNamespace getVariable "plane_CSAT"

missionNamespace getVariable "crewman_CSAT"

missionNamespace getVariable "sforce_CSAT"

missionNamespace getVariable "boat_CSAT"

missionNamespace getVariable "tranheli_CSAT"

missionNamespace getVariable "attackheli_CSAT"

should work with all mods, and support modules

init.sqf

Spoiler

TAG_fnc_getVehicleWeapons = {
	params[ "_vehicle" ];
	
	_baseCfg = configFile >> "CfgVehicles" >> _vehicle;
	
	_availableWeapons = [];
	
	if ( isClass( _baseCfg >> "Components" >> "TransportPylonsComponent" >> "Pylons" ) ) then {
		{
			_mag = getText( _x >> "attachment" );
			if (getnumber(configFile >> "CfgMagazines" >> _mag >> "scope") isEqualTo 2) then {
			_availableWeapons append [ getText( configFile >> "CfgMagazines" >> _mag >> "pylonWeapon" ) ];
			};
		}forEach ("true" configClasses( _baseCfg >> "Components" >> "TransportPylonsComponent" >> "Pylons" ));
	};
	/*
	_fnc_turrets = {
		params[ "_cfg" ];
		
		_availableWeapons append getArray( _cfg >> "weapons" );
		
		{
			_x call _fnc_turrets;
		}forEach ( "true" configClasses( _cfg >> "turrets" ));
	};
	
	_baseCfg call _fnc_turrets;*/
	
	_availableWeapons	
};

		{
		_cfgName = configName _x;
		_Faction = gettext (_x >> "faction");
		_SolClas = gettext( _x >> "displayName" );
		_FacClass = gettext (configfile >> "cfgfactionclasses" >> _Faction>> "displayName");
		_vehtran = getnumber (_x >> "transportSoldier");
		_vehcat = gettext (_x >> "editorSubcategory");
		switch (_vehcat) do {
			case ("EdSubcat_Personnel") : {
					if !(_SolClas in ["Officer","Competitor","Pilot","Range Master","Helicopter Crew","Helicopter Pilot","Fighter Pilot","Deck Crew","UAV Operator","Survivor","Rifleman (Unarmed)"]) then {
						_varName = format ["Man_%1", toupper _FacClass];
						if (_SolClas == "crewman") then {_varName = format ["Crew_%1", toupper _FacClass];};
						_array = missionNamespace getVariable [_varName,[]];
						_nul = _array pushback _cfgName;
						missionNamespace setVariable [_varName,_array];
					};
			};
			case ("EdSubcat_APCs") : {
					_varName = format ["APC_%1", toupper _FacClass];
					_array = missionNamespace getVariable [_varName,[]];
					_nul = _array pushback _cfgName;
					missionNamespace setVariable [_varName,_array];	
			};
			
			case ("EdSubcat_Cars") : {
				if ((_vehtran) >= 3) then {
					_varName = format ["Car_%1", toupper _FacClass];
					_array = missionNamespace getVariable [_varName,[]];
					_nul = _array pushback _cfgName;
					missionNamespace setVariable [_varName,_array];	
				};
			};
			
			case ("EdSubcat_Artillery") : {
					_varName = format ["arty_%1", toupper _FacClass];
					_array = missionNamespace getVariable [_varName,[]];
					_nul = _array pushback _cfgName;
					missionNamespace setVariable [_varName,_array];	
				};
			
			case ("EdSubcat_Helicopters") : {
					_num = _cfgName call TAG_fnc_getVehicleWeapons;
					if (count (_num) > 1) then {
						_varName = format ["AttackHeli_%1", toupper _FacClass];
						_array = missionNamespace getVariable [_varName,[]];
						_nul = _array pushback _cfgName;
						missionNamespace setVariable [_varName,_array];
					}; 
						if ((_vehtran) > 7) then {
						_varName = format ["TranHeli_%1", toupper _FacClass];
						_array = missionNamespace getVariable [_varName,[]];
						_nul = _array pushback _cfgName;
						hint str _array;
						missionNamespace setVariable [_varName,_array];
					
					};
			};
			
			case ("EdSubcat_Tanks") : {
					_varName = format ["Tank_%1", toupper _FacClass];
					_array = missionNamespace getVariable [_varName,[]];
					_nul = _array pushback _cfgName;
					missionNamespace setVariable [_varName,_array];	
			};
			
			case ("EdSubcat_Planes") : {
					_num = _cfgName call TAG_fnc_getVehicleWeapons;
					if (count (_num) > 2) then {
					_varName = format ["plane_%1", toupper _FacClass];
					_array = missionNamespace getVariable [_varName,[]];
					_nul = _array pushback _cfgName;
					missionNamespace setVariable [_varName,_array];
				};
			
			};

			
			case ("EdSubcat_Boats") : {
					_varName = format ["boat_%1", toupper _FacClass];
					_array = missionNamespace getVariable [_varName,[]];
					_nul = _array pushback _cfgName;
					missionNamespace setVariable [_varName,_array];
			};
			
			case ("EdSubcat_Personnel_SpecialForces") : {
					_varName = format ["Sforce_%1", toupper _FacClass];
					if (_SolClas in ["Assault Diver","Diver Team Leader","Diver Explosive Specialist"]) then {_varName = format ["Diver_%1", toupper _FacClass];};
					_array = missionNamespace getVariable [_varName,[]];
					_nul = _array pushback _cfgName;
					missionNamespace setVariable [_varName,_array];	
			};
		};
		}forEach ( "getNumber( _x >> 'scope' ) isEqualTo 2" configClasses ( configFile >> "CfgVehicles" ));

 

UnitPools.sqf

Spoiler

private ["_tempArray","_InfPool","_MotPool","_ACHPool","_CHPool","_uavPool","_stPool","_shipPool","_diverPool","_crewPool","_heliCrew","_ArmPool"];
_faction=(_this select 0);
_type=(_this select 1);
_tempArray=[];



// EAST CSAT FACTION
	if (_faction==0) then {
	_InfPool=	(missionNamespace getVariable "man_spetsnaz") +  (missionNamespace getVariable "man_CSAT");	
	_ArmPool=	missionNamespace getVariable "tank_CSAT";
	_MotPool=	missionNamespace getVariable "car_CSAT";
	_ACHPool=	["O_Heli_Attack_02_black_F","O_Heli_Attack_02_F"];
	_CHPool=	missionNamespace getVariable "tranheli_CSAT";];
	_uavPool=	["O_UAV_01_F","O_UAV_02_CAS_F","O_UGV_01_rcws_F"];
	_stPool=	["O_Mortar_01_F","O_static_AT_F","O_static_AA_F"];
	_shipPool=	missionNamespace getVariable "boat_CSAT";];
	_diverPool=	missionNamespace getVariable "diver_CSAT";;
	_crewPool=	missionNamespace getVariable "crew_CSAT";;
	_heliCrew=	["O_helicrew_F","O_helipilot_F"];
};
// WEST NATO FACTION	
	if (_faction==1) then {
	_InfPool=	missionNamespace getVariable "_NATO";	
	_ArmPool=	["B_MBT_01_arty_F","B_MBT_01_cannon_F","B_MBT_01_mlrs_F","B_APC_Tracked_01_AA_F","B_APC_Tracked_01_CRV_F","B_APC_Tracked_01_rcws_F","B_APC_Wheeled_01_cannon_F","B_MBT_02_cannon_F"];
	_MotPool=	["B_Truck_01_covered_F","B_Truck_01_transport_F","B_MRAP_01_F","B_MRAP_01_gmg_F","B_MRAP_01_hmg_F","B_Truck_01_medical_F"];
	_ACHPool=	["B_Heli_Attack_01_F","B_Heli_Light_01_armed_F"];
	_CHPool=	["B_Heli_Light_01_F","B_Heli_Transport_01_camo_F","B_Heli_Transport_01_F"];
	_uavPool=	["B_UAV_01_F","B_UAV_01_CAS_F","B_UGV_01_rcws_F"];
	_stPool=	["B_Mortar_01_F","B_static_AT_F","B_static_AA_F"];
	_shipPool=	["B_Boat_Armed_01_minigun_F","B_Boat_Transport_01_F"];
	_diverPool=	["B_diver_exp_F","B_diver_F","B_diver_TL_F"];
	_crewPool=	["B_crew_F"];
	_heliCrew=	["B_helicrew_F","B_helipilot_F"];
};
// INDEPENDENT AAF FACTION	
	if (_faction==2) then {
	_InfPool=	missionNamespace getVariable "_FIA";	
	_ArmPool=	["I_APC_Wheeled_03_cannon_F"];
	_MotPool=	["I_MRAP_03_F","I_MRAP_03_gmg_F","I_MRAP_03_hmg_F","I_Truck_02_medical_F"];
	_ACHPool=	[];
	_CHPool=	["I_Heli_Transport_02_F","B_Heli_Light_02_unarmed_F"];
	_uavPool=	["I_UAV_01_F","I_UAV_02_CAS_F","I_UGV_01_rcws_F"];
	_stPool=	["I_Mortar_01_F"];
	_shipPool=	["I_Boat_Transport_01_F","I_G_Boat_Transport_01_F","I_Boat_Armed_01_minigun_F"];
	_diverPool=	["I_diver_exp_F","I_diver_F","I_diver_TL_F"];
	_crewPool=	["I_crew_F"];
	_heliCrew=	["I_helicrew_F","I_helipilot_F"];
};
// CIVILIAN	
	if (_faction==3) then {
	_InfPool=	["C_man_1","C_man_1_1_F","C_man_1_2_F","C_man_1_3_F","C_man_hunter_1_F","C_man_p_beggar_F","C_man_p_beggar_F_afro","C_man_p_fugitive_F","C_man_p_shorts_1_F","C_man_pilot_F","C_man_polo_1_F","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_shorts_2_F","C_man_shorts_3_F","C_man_shorts_4_F","C_man_w_worker_F"];	
	_ArmPool=	["C_Hatchback_01_F","C_Hatchback_01_sport_F","C_Quadbike_01_F","C_SUV_01_F","C_Van_01_transport_F","C_Van_01_box_F"];
	_MotPool=	["C_Hatchback_01_F","C_Hatchback_01_sport_F","C_Quadbike_01_F","C_SUV_01_F","C_Van_01_transport_F","C_Van_01_box_F"];
	_ACHPool=	[];
	_CHPool=	[];
	_uavPool=	[];
	_stPool=	[];
	_shipPool=	["C_Boat_Civil_01_F","C_Boat_Civil_01_rescue_F","C_Boat_Civil_04_F","C_Rubberboat"];
	_diverPool=	[];
	_crewPool=	["C_man_1"];
	_heliCrew=	["C_man_1","C_man_1"];
};
// WEST FIA FACTION
	if (_faction==4) then {
	_InfPool=	["B_G_engineer_F","B_G_medic_F","B_G_officer_F","B_G_Soldier_A_F","B_G_Soldier_AR_F","B_G_Soldier_exp_F","B_G_Soldier_F","B_G_Soldier_GL_F","B_G_Soldier_LAT_F","B_G_Soldier_lite_F","B_G_Soldier_M_F","B_G_Soldier_SL_F","B_G_Soldier_TL_F"];	
	_ArmPool=	[];
	_MotPool=	["B_G_Offroad_01_F","B_G_Offroad_01_armed_F","B_G_Van_01_transport_F","B_G_Van_01_fuel_F"];
	_ACHPool=	[];
	_CHPool=	[];
	_uavPool=	[];
	_stPool=	["B_G_Mortar_01_F"];
	_shipPool=	["B_G_Boat_Transport_01_F"];
	_diverPool=	[];
	_crewPool=	[];
	_heliCrew=	[];
};
// ADD CLASSNAMES 
	if (_faction==5) then {
	_InfPool=	[];	
	_ArmPool=	[];
	_MotPool=	[];
	_ACHPool=	[];
	_CHPool=	[];
	_uavPool=	[];
	_stPool=	[];
	_shipPool=	[];
	_diverPool=	[];
	_crewPool=	[];
	_heliCrew=	[];
	};
	
// ADD CLASSNAMES 	
	if (_faction==6) then {
	_InfPool=	[];	
	_ArmPool=	[];
	_MotPool=	[];
	_ACHPool=	[];
	_CHPool=	[];
	_uavPool=	[];
	_stPool=	[];
	_shipPool=	[];
	_diverPool=	[];
	_crewPool=	[];
	_heliCrew=	[];};
	
// ADD CLASSNAMES 	
	if (_faction==7) then {
	_InfPool=	[];	
	_ArmPool=	[];
	_MotPool=	[];
	_ACHPool=	[];
	_CHPool=	[];
	_uavPool=	[];
	_stPool=	[];
	_shipPool=	[];
	_diverPool=	[];
	_crewPool=	[];
	_heliCrew=	[];};
	
////////////////////////////////////////////////////////////////////////////////////////
if (_type==0) then {
		for "_i" from 0 to 5 do{
		_unit=_InfPool select (floor(random(count _InfPool)));
		_tempArray set [count _tempArray,_unit];};
						};
						
if (_type==1) then {_tempArray=_diverPool};
	
				
// CREATE ARMOUR & CREW			
if (_type==2) then {
				_tempUnit=_ArmPool select (floor(random(count _ArmPool)));
				_temparray set [count _temparray,_tempUnit];
				_crew=_crewPool select (floor(random(count _crewPool)));
				_temparray set [count _temparray,_crew];
};

// CREATE ATTACK CHOPPER & CREW	
if (_type==3) then {
				_tempUnit=_ACHPool select (floor(random(count _ACHPool)));
				_temparray set [count _temparray,_tempUnit];
				_crew=_heliCrew select (floor(random(count _heliCrew)));
				_temparray set [count _temparray,_crew];
};

// CREATE TRANSPORT CHOPPER & CREW		
if (_type==4) then {
				_tempUnit=_CHPool select (floor(random(count _CHPool)));
				_temparray set [count _temparray,_tempUnit];
				_crew=_heliCrew select (floor(random(count _heliCrew)));
				_temparray set [count _temparray,_crew];
						};
						
// CREATE STATIC & CREW						
if (_type==5) then {
				_tempUnit=_stPool select (floor(random(count _stPool)));
				_temparray set [count _temparray,_tempUnit];
				_crew=_crewPool select (floor(random(count _crewPool)));
				_temparray set [count _temparray,_crew];

};
if (_type==6) then {_tempArray=_uavPool select (floor(random(count _uavPool)));};

// CREATE TRANSPORT & CREW
if (_type==7) then {
				_tempUnit=_MotPool select (floor(random(count _MotPool)));
				_temparray set [count _temparray,_tempUnit];
				_crew=_crewPool select (floor(random(count _crewPool)));
				_temparray set [count _temparray,_crew];
				};

// CREATE BOAT & DIVER CREW
if (_type==8) then {
				_tempUnit=_shipPool select (floor(random(count _shipPool)));
				_temparray set [count _temparray,_tempUnit];
				_crew=_diverPool select (floor(random(count _diverPool)));
				_temparray set [count _temparray,_crew];
				};
				
// CREATE CARGO
if (_type==9) then {
		for "_i" from 0 to 4 do{
			_unit=_InfPool select (floor(random(count _InfPool)));
			_temparray set [count _temparray,_unit];
							};
};

// CREATE DIVER CARGO
if (_type==10) then {
		for "_i" from 0 to 4 do{
			_unit=_diverPool select (floor(random(count _diverPool)));
			_temparray set [count _temparray,_unit];
							};			
};

//hint format ["%1",_tempArray];
_tempArray

 

 

  • Like 2

Share this post


Link to post
Share on other sites
On 7/27/2019 at 4:12 AM, sabot10.5mm said:

call compile format["missionNamespace setvariable ['man_%1', (missionNamespace getVariable ['man_%1',[]]) + [_cfgNam]];", toupper _getfac];

That's unnecessarily complex and VERY inefficient code.

 

private _varName = format ["man_%1", toupper _getfac];
missionNamespace setVariable [_varName, missionNamespace getVariable [_varName, []] + [_cfgNam]];

Actually... now that I think about it...

private _varName = format ["man_%1", toupper _getfac];
private _array = missionNamespace getVariable _varName;
_array pushBack _cfgNam;

Though for that variant the variable needs to already be defined.
 

  • Like 1

Share this post


Link to post
Share on other sites
54 minutes ago, Dedmen said:

That's unnecessarily complex and VERY inefficient code.

 


private _varName = format ["man_%1", toupper _getfac];
missionNamespace setVariable [_varName, missionNamespace getVariable [_varName, []] + [_cfgNam]];

Actually... now that I think about it...


private _varName = format ["man_%1", toupper _getfac];
private _array = missionNamespace getVariable _varName;
_array pushBack _cfgNam;

Though for that variant the variable needs to already be defined.
 

Quote

 

i already made a thread about what i got wrong. post it there. thank you though

Share this post


Link to post
Share on other sites
On 7/22/2019 at 4:30 PM, DirtyDel said:

Have you tested this recently? For the life of me, I can't get trigger zones to work. I had it several months ago and now nothing happens when entering the trigger: no units spawn, no debug, no hints, nothing. 

Sorry for the late response, mate..been out of town for a short vacation.

Nope..I haven't tested it lately...and if it's not working anymore maybe the latest updates have broken something.

I'll be digging into this asap tho....

Share this post


Link to post
Share on other sites
On 7/29/2019 at 6:24 AM, Dedmen said:

That's unnecessarily complex and VERY inefficient code.

 


private _varName = format ["man_%1", toupper _getfac];
missionNamespace setVariable [_varName, missionNamespace getVariable [_varName, []] + [_cfgNam]];

Actually... now that I think about it...


private _varName = format ["man_%1", toupper _getfac];
private _array = missionNamespace getVariable _varName;
_array pushBack _cfgNam;

Though for that variant the variable needs to already be defined.
 

Spoiler

TAG_fnc_getVehicleWeapons = {
	params[ "_vehicle" ];
	
	_baseCfg = configFile >> "CfgVehicles" >> _vehicle;
	
	_availableWeapons = [];
	
	if ( isClass( _baseCfg >> "Components" >> "TransportPylonsComponent" >> "Pylons" ) ) then {
		{
			_mag = getText( _x >> "attachment" );
			if (getnumber(configFile >> "CfgMagazines" >> _mag >> "scope") isEqualTo 2) then {
			_availableWeapons append [ getText( configFile >> "CfgMagazines" >> _mag >> "pylonWeapon" ) ];
			};
		}forEach ("true" configClasses( _baseCfg >> "Components" >> "TransportPylonsComponent" >> "Pylons" ));
	};
	/*
	_fnc_turrets = {
		params[ "_cfg" ];
		
		_availableWeapons append getArray( _cfg >> "weapons" );
		
		{
			_x call _fnc_turrets;
		}forEach ( "true" configClasses( _cfg >> "turrets" ));
	};
	
	_baseCfg call _fnc_turrets;*/
	
	_availableWeapons	
};

		{
		_cfgName = configName _x;
		_Faction = gettext (_x >> "faction");
		_SolClas = gettext( _x >> "displayName" );
		_FacClass = gettext (configfile >> "cfgfactionclasses" >> _Faction>> "displayName");
		_vehtran = getnumber (_x >> "transportSoldier");
		_vehcat = gettext (_x >> "editorSubcategory");
		switch (_vehcat) do {
			case ("EdSubcat_Personnel") : {
					if !(_SolClas in ["Officer","Competitor","Pilot","Range Master","Helicopter Crew","Helicopter Pilot","Fighter Pilot","Deck Crew","UAV Operator","Survivor","Rifleman (Unarmed)"]) then {
						_varName = format ["Man_%1", toupper _FacClass];
						if (_SolClas == "crewman") then {_varName = format ["Crew_%1", toupper _FacClass];};
						_array = missionNamespace getVariable [_varName,[]];
						_nul = _array pushback _cfgName;
						missionNamespace setVariable [_varName,_array];
					};
			};
			case ("EdSubcat_APCs") : {
					_varName = format ["APC_%1", toupper _FacClass];
					_array = missionNamespace getVariable [_varName,[]];
					_nul = _array pushback _cfgName;
					missionNamespace setVariable [_varName,_array];	
			};
			
			case ("EdSubcat_Cars") : {
				if ((_vehtran) >= 3) then {
					_varName = format ["Car_%1", toupper _FacClass];
					_array = missionNamespace getVariable [_varName,[]];
					_nul = _array pushback _cfgName;
					missionNamespace setVariable [_varName,_array];	
				};
			};
			
			case ("EdSubcat_Helicopters") : {
					_num = _cfgName call TAG_fnc_getVehicleWeapons;
					if (count (_num) > 1) then {
						_varName = format ["AttackHeli_%1", toupper _FacClass];
						_array = missionNamespace getVariable [_varName,[]];
						_nul = _array pushback _cfgName;
						missionNamespace setVariable [_varName,_array];
					}; 
						if ((_vehtran) > 7) then {
						_varName = format ["TranHeli_%1", toupper _FacClass];
						_array = missionNamespace getVariable [_varName,[]];
						_nul = _array pushback _cfgName;
						hint str _array;
						missionNamespace setVariable [_varName,_array];
					
					};
			};
			
			case ("EdSubcat_Tanks") : {
					_varName = format ["Tank_%1", toupper _FacClass];
					_array = missionNamespace getVariable [_varName,[]];
					_nul = _array pushback _cfgName;
					missionNamespace setVariable [_varName,_array];	
			};
			
			case ("EdSubcat_Planes") : {
					_varName = format ["plane_%1", toupper _FacClass];
					_array = missionNamespace getVariable [_varName,[]];
					_nul = _array pushback _cfgName;
					missionNamespace setVariable [_varName,_array];
			};
			
			case ("EdSubcat_Boats") : {
					_varName = format ["boat_%1", toupper _FacClass];
					_array = missionNamespace getVariable [_varName,[]];
					_nul = _array pushback _cfgName;
					missionNamespace setVariable [_varName,_array];
			};
			
			case ("EdSubcat_Personnel_SpecialForces") : {
					_varName = format ["Sforce_%1", toupper _FacClass];
					if (_SolClas in ["Assault Diver","Diver Team Leader","Diver Explosive Specialist"]) then {_varName = format ["Diver_%1", toupper _FacClass];};
					_array = missionNamespace getVariable [_varName,[]];
					_nul = _array pushback _cfgName;
					missionNamespace setVariable [_varName,_array];	
			};
		};
		}forEach ( "getNumber( _x >> 'scope' ) isEqualTo 2" configClasses ( configFile >> "CfgVehicles" ));

 

 

thanks for the advice

 

Share this post


Link to post
Share on other sites
On 7/29/2019 at 9:42 AM, zagor64bz said:

Sorry for the late response, mate..been out of town for a short vacation.

Nope..I haven't tested it lately...and if it's not working anymore maybe the latest updates have broken something.

I'll be digging into this asap tho....

let me know when you find out. i'm still trying to tackle this. it's not working.

Share this post


Link to post
Share on other sites
9 hours ago, DirtyDel said:

let me know when you find out. i'm still trying to tackle this. it's not working.

Tested..and it still works as it's supposed too,  mate.

 

To test this I did (in VR):

- I placed a BLUFOR squad down

-placed a gamelogic named "server"

-placed a marker named "marker01"

-placed a trigger with activate> BLUFOR> present,  with on Act: 

null = [["marker01"],[2,0,75],[5,2,90],[2,1,75],[1,1,75],[0],[0,0],[5,1,500,EAST,FALSE,FALSE]] call EOS_Spawn;

-create a "init.sqf" file with 

[] execVM "eos\OpenMe.sqf";

-pasted the EOS folder in the mission folder

-opened the OpenMe.sqf file and erased the unnecessary parts, which should look like this at the end:

EOS_Spawn = compile preprocessfilelinenumbers "eos\core\eos_launch.sqf";Bastion_Spawn=compile preprocessfilelinenumbers "eos\core\b_launch.sqf";null=[] execVM "eos\core\spawn_fnc.sqf";onplayerConnected {[] execVM "eos\Functions\EOS_Markers.sqf";};
/* EOS 1.98 by BangaBob 
GROUP SIZES
 0 = 1
 1 = 2,4
 2 = 4,8
 3 = 8,12
 4 = 12,16
 5 = 16,20

EXAMPLE CALL - EOS
 null = [["MARKERNAME","MARKERNAME2"],[2,1,70],[0,1],[1,2,30],[2,60],[2],[1,0,10],[1,0,250,WEST]] call EOS_Spawn;
 null=[["M1","M2","M3"],[HOUSE GROUPS,SIZE OF GROUPS,PROBABILITY],[PATROL GROUPS,SIZE OF GROUPS,PROBABILITY],[LIGHT VEHICLES,SIZE OF CARGO,PROBABILITY],[ARMOURED VEHICLES,PROBABILITY], [STATIC VEHICLES,PROBABILITY],[HELICOPTERS,SIZE OF HELICOPTER CARGO,PROBABILITY],[FACTION,MARKERTYPE,DISTANCE,SIDE,HEIGHTLIMIT,DEBUG]] call EOS_Spawn;

EXAMPLE CALL - BASTION
 null = [["BAS_zone_1"],[3,1],[2,1],[2],[0,0],[0,0,EAST,false,false],[10,2,120,TRUE,TRUE]] call Bastion_Spawn;
 null=[["M1","M2","M3"],[PATROL GROUPS,SIZE OF GROUPS],[LIGHT VEHICLES,SIZE OF CARGO],[ARMOURED VEHICLES],[HELICOPTERS,SIZE OF HELICOPTER CARGO],[FACTION,MARKERTYPE,SIDE,HEIGHTLIMIT,DEBUG],[INITIAL PAUSE, NUMBER OF WAVES, DELAY BETWEEN WAVES, INTEGRATE EOS, SHOW HINTS]] call Bastion_Spawn;
*/
VictoryColor="colorGreen";	// Colour of marker after completion
hostileColor="colorRed";	// Default colour when enemies active
bastionColor="colorOrange";	// Colour for bastion marker
EOS_DAMAGE_MULTIPLIER=1;	// 1 is default
EOS_KILLCOUNTER=true;		// Counts killed units

NOTHING ELSE IN IT!!!!

 

Start mission>when I walked in the trigger area the enemy spawned as intended.

 

I hope this helps mate.

 

EDIT: I know it sounds stupid for me to say this, as you already know, but....NOTE that the enemy spawns in the marker area, not in the trigger area.

 

 

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, zagor64bz said:

Tested..and it still works as it's supposed too,  mate.

 

To test this I did (in VR):

- I placed a BLUFOR squad down

-placed a gamelogic named "server"

-placed a marker named "marker01"

-placed a trigger with activate> BLUFOR> present,  with on Act: 


null = [["marker01"],[2,0,75],[5,2,90],[2,1,75],[1,1,75],[0],[0,0],[5,1,500,EAST,FALSE,FALSE]] call EOS_Spawn;

-create a "init.sqf" file with 


[] execVM "eos\OpenMe.sqf";

-pasted the EOS folder in the mission folder

-opened the OpenMe.sqf file and erased the unnecessary parts, which should look like this at the end:


EOS_Spawn = compile preprocessfilelinenumbers "eos\core\eos_launch.sqf";Bastion_Spawn=compile preprocessfilelinenumbers "eos\core\b_launch.sqf";null=[] execVM "eos\core\spawn_fnc.sqf";onplayerConnected {[] execVM "eos\Functions\EOS_Markers.sqf";};
/* EOS 1.98 by BangaBob 
GROUP SIZES
 0 = 1
 1 = 2,4
 2 = 4,8
 3 = 8,12
 4 = 12,16
 5 = 16,20

EXAMPLE CALL - EOS
 null = [["MARKERNAME","MARKERNAME2"],[2,1,70],[0,1],[1,2,30],[2,60],[2],[1,0,10],[1,0,250,WEST]] call EOS_Spawn;
 null=[["M1","M2","M3"],[HOUSE GROUPS,SIZE OF GROUPS,PROBABILITY],[PATROL GROUPS,SIZE OF GROUPS,PROBABILITY],[LIGHT VEHICLES,SIZE OF CARGO,PROBABILITY],[ARMOURED VEHICLES,PROBABILITY], [STATIC VEHICLES,PROBABILITY],[HELICOPTERS,SIZE OF HELICOPTER CARGO,PROBABILITY],[FACTION,MARKERTYPE,DISTANCE,SIDE,HEIGHTLIMIT,DEBUG]] call EOS_Spawn;

EXAMPLE CALL - BASTION
 null = [["BAS_zone_1"],[3,1],[2,1],[2],[0,0],[0,0,EAST,false,false],[10,2,120,TRUE,TRUE]] call Bastion_Spawn;
 null=[["M1","M2","M3"],[PATROL GROUPS,SIZE OF GROUPS],[LIGHT VEHICLES,SIZE OF CARGO],[ARMOURED VEHICLES],[HELICOPTERS,SIZE OF HELICOPTER CARGO],[FACTION,MARKERTYPE,SIDE,HEIGHTLIMIT,DEBUG],[INITIAL PAUSE, NUMBER OF WAVES, DELAY BETWEEN WAVES, INTEGRATE EOS, SHOW HINTS]] call Bastion_Spawn;
*/
VictoryColor="colorGreen";	// Colour of marker after completion
hostileColor="colorRed";	// Default colour when enemies active
bastionColor="colorOrange";	// Colour for bastion marker
EOS_DAMAGE_MULTIPLIER=1;	// 1 is default
EOS_KILLCOUNTER=true;		// Counts killed units

NOTHING ELSE IN IT!!!!

 

Start mission>when I walked in the trigger area the enemy spawned as intended.

 

I hope this helps mate.

 

EDIT: I know it sounds stupid for me to say this, as you already know, but....NOTE that the enemy spawns in the marker area, not in the trigger area.

 

 

good news. that means i ave something inherently work with my eos script. can you tell me if a bastion trigger is working correctly on your system.

Share this post


Link to post
Share on other sites
5 hours ago, DirtyDel said:

can you tell me if a bastion trigger is working correctly on your system

Although I never use the bastion, I tested it, and it's working for me.

Share this post


Link to post
Share on other sites
18 hours ago, zagor64bz said:

Although I never use the bastion, I tested it, and it's working for me.

I figured it out. I attempted to edit out the ai skill and deleted another component that was causing issues.

 

does anyone know how to remove the "mission completed" in a bastion zone? I have my mission where we go into a hot zone and clear before moving on in the scenario; however, once we clear the last wave in the bastion zone, the mission is ending with "mission completed". I can't figure out how to stop it. any thoughts?

Share this post


Link to post
Share on other sites
Spoiler

EOS_Spawn = compile preprocessfilelinenumbers "eos\core\eos_launch.sqf";Bastion_Spawn=compile preprocessfilelinenumbers "eos\core\b_launch.sqf";null=[] execVM "eos\core\spawn_fnc.sqf";onplayerConnected {[] execVM "eos\Functions\EOS_Markers.sqf";}; 
VictoryColor="colorGreen"; // Colour of marker after completion 
hostileColor="colorRed"; // Default colour when enemies active 
bastionColor="colorOrange"; // Colour for bastion marker 
EOS_DAMAGE_MULTIPLIER=1; // 1 is default 
EOS_KILLCOUNTER=true;  // Counts killed units 
/* 
UNIT SIZE PER GROUP
 0 = 1
 1 = 2,4
 2 = 4,8
 3 = 8,12
 4 = 12,16
 5 = 16,20
 */
{ 
if (_x find "EOS_MARKER" > -1) then  
{ 
_xcargo=3; //max units in cargo
_maxVh=3;  //max amount of vehicles
_maxGp=8;  //max amount of groups
_maxUt=2;  //max amount of units per group 
_minUt=0;  //min amount of units per group
_mkrSz=(getMarkerSize _x#0) + (getMarkerSize _x#1); 
_grps =  round(linearConversion [0,1000,_mkrSz,1,_maxGp,false]); 
_vehs =  round(linearConversion [0,1000,_mkrSz,0,_maxVh,false]); 
_vcarg = round(linearConversion [0,1000,_mkrSz,0,_xcargo,true]); 
_grpSz = round(linearConversion [0,1000,_mkrSz,_minUt,_maxUt,true]); 
_prob =  round(linearConversion [0,1000,_mkrSz,0,100,true]); 
[[_x],[_grps,_grpSz],[_grps,_grpSz],[_vehs,_vcarg,_prob],[_vehs,_prob],[_vehs],[_vehs,_vcarg,_prob],[0,0,400,EAST,FALSE]] call EOS_Spawn; 
}; 
}foreach allmapmarkers;

 

OpenMe.sqf

this script gets all markers named "eos_marker", and changes the groupsize. unitsize, vehiclesize and cargosize based on the size of the marker; then it calls eos_spawn for each marker.

 

 

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
1 hour ago, sabot10.5mm said:
  Hide contents


EOS_Spawn = compile preprocessfilelinenumbers "eos\core\eos_launch.sqf";Bastion_Spawn=compile preprocessfilelinenumbers "eos\core\b_launch.sqf";null=[] execVM "eos\core\spawn_fnc.sqf";onplayerConnected {[] execVM "eos\Functions\EOS_Markers.sqf";}; 
VictoryColor="colorGreen"; // Colour of marker after completion 
hostileColor="colorRed"; // Default colour when enemies active 
bastionColor="colorOrange"; // Colour for bastion marker 
EOS_DAMAGE_MULTIPLIER=1; // 1 is default 
EOS_KILLCOUNTER=true;  // Counts killed units 
/* 
UNIT SIZE PER GROUP
 0 = 1
 1 = 2,4
 2 = 4,8
 3 = 8,12
 4 = 12,16
 5 = 16,20
 */
{ 
if (["EOS_MARKER", _x] call BIS_fnc_inString) then  
{ 
_xcargo=3; //max units in cargo
_maxVh=3;  //max amount of vehicles
_maxGp=8;  //max amount of groups
_maxUt=2;  //max amount of units per group 
_minUt=0;  //min amount of units per group
_mkrSz=(getMarkerSize _x#0) + (getMarkerSize _x#1); 
_grps =  round(linearConversion [0,1000,_mkrSz,1,_maxGp,false]); 
_vehs =  round(linearConversion [0,1000,_mkrSz,0,_maxVh,false]); 
_vcarg = round(linearConversion [0,1000,_mkrSz,0,_xcargo,true]); 
_grpSz = round(linearConversion [0,1000,_mkrSz,_minUt,_maxUt,true]); 
_prob =  round(linearConversion [0,1000,_mkrSz,0,100,true]); 
[[_x],[_grps,_grpSz],[_grps,_grpSz],[_maxVh,_vcarg,_prob],[_vehs,_prob],[_vehs],[_vehs,_vcarg,_prob],[0,0,400,EAST,FALSE]] call EOS_Spawn; 
}; 
}foreach allmapmarkers;

 

OpenMe.sqf

this script gets all markers named "eos_marker", and changes the groupsize. unitsize, vehiclesize and cargosize based on the size of the marker; then it calls eos_spawn for each marker.

 

 

 

BRILLIANT!

  • Thanks 1

Share this post


Link to post
Share on other sites
Spoiler

eos/functions DynSimEnab.sqf

Spoiler


params["_grp","_mkrX","_mkrY"];
_mkrSz = _mkrX + _mkrY;
if (_mkrSz > 1000) then {
	if !(_grp isEqualtype grpNull) then {
		(_grp select 0) enableDynamicSimulation true;
		(_grp select 2) enableDynamicSimulation true;
						
	} else {
		_grp enableDynamicSimulation true;
	};
};

 

eos/core spawn_fnc.sqf

Spoiler



IF (isnil "server")then{hint "YOU MUST PLACE A GAME LOGIC NAMED SERVER!";};
eos_fnc_spawnvehicle=compile preprocessfilelinenumbers "eos\functions\eos_SpawnVehicle.sqf";
eos_fnc_grouphandlers=compile preprocessfilelinenumbers "eos\functions\setSkill.sqf";
eos_fnc_findsafepos=compile preprocessfilelinenumbers "eos\functions\findSafePos.sqf";
eos_fnc_spawngroup= compile preprocessfile "eos\functions\infantry_fnc.sqf";
eos_fnc_setcargo = compile preprocessfile "eos\functions\cargo_fnc.sqf";
eos_fnc_taskpatrol= compile preprocessfile "eos\functions\shk_patrol.sqf";
SHK_pos= compile preprocessfile "eos\functions\shk_pos.sqf";
shk_fnc_fillhouse = compile preprocessFileLineNumbers "eos\Functions\SHK_buildingpos.sqf";
fnc_enabledynamicsim = compile preprocessFileLineNumbers "eos\Functions\DynSimEnab.sqf";
eos_fnc_getunitpool= compile preprocessfilelinenumbers "eos\UnitPools.sqf";
call compile preprocessfilelinenumbers "eos\AI_Skill.sqf";

EOS_Deactivate = {
	private ["_mkr"];
		_mkr=(_this select 0);		
	{
		_x setmarkercolor "colorblack";
		_x setmarkerAlpha 0;
	}foreach _mkr;
};

EOS_debug = {
private ["_note"];
_mkr=(_this select 0);
_n=(_this select 1);
_note=(_this select 2);
_pos=(_this select 3);

_mkrID=format ["%3:%1,%2",_mkr,_n,_note];
deletemarker _mkrID;
_debugMkr = createMarker[_mkrID,_pos];
_mkrID setMarkerType "Mil_dot";
_mkrID setMarkercolor "colorBlue";
_mkrID setMarkerText _mkrID;
_mkrID setMarkerAlpha 0.5;
};

 

 

eos/core/eos_core.sqf

Spoiler


if (!isServer) exitWith {};
private ["_newpos","_cargoType","_vehType","_dGrp","_mkrAgl","_side","_bGroup","_civZone","_fGrp","_fSize","_fGrps","_eGrp","_eGrps","_dGrps","_aMin","_aSize","_aGrps","_aGrp","_bMin","_units","_bSize","_bGrps","_bGrp","_trig","_cache","_grp","_crew","_vehicle","_actCond","_mAN","_mAH","_distance","_mA","_settings","_cGrp","_cSize","_cGrps","_taken","_clear","_enemyFaction","_faction","_n","_eosAct","_eosActivated","_debug","_mkr","_mPos","_mkrX","_mkrY"];

_mkr=(_this select 0);_mPos=markerpos(_this select 0);
_mkrX=getMarkerSize _mkr select 0;
_mkrY=getMarkerSize _mkr select 1;
_mkrAgl=markerDir _mkr;
_a=(_this select 1);_aGrps=_a select 0;_aSize=_a select 1;_aMin=_aSize select 0;
_b=(_this select 2);_bGrps=_b select 0;_bSize=_b select 1;_bMin=_bSize select 0;
_c=(_this select 3);_cGrps=_c select 0;_cSize=_c select 1;
_d=(_this select 4);_dGrps=_d select 0;_eGrps=_d select 1;_fGrps=_d select 2;_fSize=_d select 3;
_settings=(_this select 5);_faction=_settings select 0;_mA=_settings select 1;_distance=_settings select 2;_side=_settings select 3;
_heightLimit=if (count _settings > 4) then {_settings select 4} else {false};
_debug=if (count _settings > 5) then {_settings select 5} else {false};
_cache= if (count _this > 6) then {_this select 6} else {false};


	if (_side==EAST) then {_enemyFaction="east";_civZone=false;};
	if (_side==WEST) then {_enemyFaction="west";_civZone=false;};
	if (_side==INDEPENDENT) then {_enemyFaction="guer";_civZone=false;};
	if (_side==CIVILIAN) then {_enemyFaction="civ";_civZone=true;};

	if (_mA==0) then {_mAH = 1;_mAN = 0.5;};
	if (_mA==1) then {_mAH = 0;_mAN = 0;};
	if (_mA==2) then {_mAH = 0.5;_mAN = 0.5;};

// INITIATE ZONE
_trig=format ["EOSTrigger%1",_mkr];


if (!_cache) then {
	if ismultiplayer then {
			if (_heightLimit) then 
			{_actCond="{vehicle _x in thisList && isplayer _x && ((getPosATL _x) select 2) < 5} count playableunits > 0";
							}else 
							{_actCond="{vehicle _x in thisList && isplayer _x} count playableunits > 0";
		};}else{
			if (_heightLimit) then 
						{_actCond="{vehicle _x in thisList && isplayer _x && ((getPosATL _x) select 2) < 5  } count allUnits > 0";
								}else
	
									  {_actCond="{vehicle _x in thisList && isplayer _x || ({_player = _x; {getConnectedUAV _player == _x} count [uav, uav1, uav2, uav3] > 0} count allPlayers > 0 && ({_x in thislist} count [uav, uav1, uav2, uav3] > 0))} count allUnits > 0"; };};
		_eosActivated = createTrigger ["EmptyDetector",_mPos]; 
		_eosActivated = createTrigger ["EmptyDetector",_mPos]; 
		_eosActivated setTriggerArea [(_distance+_mkrX),(_distance+_mkrY),_mkrAgl,FALSE]; 
		_eosActivated setTriggerActivation ["ANY","PRESENT",true];
		_eosActivated setTriggerTimeout [1, 1, 1, true];
		_eosActivated setTriggerStatements [_actCond,"",""];
		
			server setvariable [_trig,_eosActivated];	
					}else{
				_eosActivated=server getvariable _trig;	
					};
		
					_mkr setmarkerAlpha _mAN;
						if (!(getmarkercolor _mkr == VictoryColor)) then 	//IF MARKER IS GREEN DO NOT CHANGE COLOUR
							{
						_mkr setmarkercolor hostileColor;
							};



waituntil {triggeractivated _eosActivated};	//WAIT UNTIL PLAYERS IN ZONE
if (!(getmarkercolor _mkr == "colorblack"))then {
	if (!(getmarkercolor _mkr == VictoryColor)) then {_mkr setmarkerAlpha _mAH;};

// SPAWN HOUSE PATROLS
	for "_counter" from 1 to _aGrps do {
	if (isnil "_aGrp") then {_aGrp=[];};
		if (_cache) then {
				_cacheGrp=format ["HP%1",_counter];
				_units=_eosActivated getvariable _cacheGrp;	
						_aSize=[_units,_units];
						_aMin=_aSize select 0;
							if (_debug)then{player sidechat format ["ID:%1,restore - %2",_cacheGrp,_units];};
							};
								if (_aMin > 0) then {
										_aGroup=[_mPos,_aSize,_faction,_side] call EOS_fnc_spawngroup;	
				
										if (!surfaceiswater _mPos) then {
											0=[_mPos,(units _aGroup),_mkrX,true,false,true,false] call shk_fnc_fillhouse;
												}else{
												0 = [_aGroup,_mkr] call EOS_fnc_taskpatrol;
													};
												_aGrp set [count _aGrp,_aGroup];
												0=[_aGroup,"INFskill"] call eos_fnc_grouphandlers;
												[_aGroup,_mkrX,_mkrY] call fnc_enabledynamicsim;
if (_debug) then {PLAYER SIDECHAT (format ["Spawned House Patrol: %1",_counter]);0= [_mkr,_counter,"House Patrol",getpos (leader _aGroup)] call EOS_debug};
												};
		};
		
// SPAWN PATROLS
	for "_counter" from 1 to _bGrps do {
	if (isnil "_bGrp") then {_bGrp=[];};
		if (_cache) then {
				_cacheGrp=format ["PA%1",_counter];
				_units=_eosActivated getvariable _cacheGrp;	
					_bSize=[_units,_units];
					_bMin=_bSize select 0;
					if (_debug)then{player sidechat format ["ID:%1,restore - %2",_cacheGrp,_units];};
						};
							if (_bMin > 0) then {	
									_pos = [_mkr,true] call SHK_pos;			
									_bGroup=[_pos,_bSize,_faction,_side] call EOS_fnc_spawngroup;
										0 = [_bGroup,_mkr] call EOS_fnc_taskpatrol;
										_bGrp set [count _bGrp,_bGroup];
										0=[_bGroup,"INFskill"] call eos_fnc_grouphandlers;
										[_bGroup,_mkrX,_mkrY] call fnc_enabledynamicsim;
if (_debug) then {PLAYER SIDECHAT (format ["Spawned Patrol: %1",_counter]);0= [_mkr,_counter,"patrol",getpos (leader _bGroup)] call EOS_debug};
												};
		};	
	
//SPAWN LIGHT VEHICLES
	for "_counter" from 1 to _cGrps do {	
	if (isnil "_cGrp") then {_cGrp=[];};	
	
		_newpos=[_mkr,50] call EOS_fnc_findSafePos;
			if (surfaceiswater _newpos) then {_vehType=8;_cargoType=10;}else{_vehType=7;_cargoType=9;};
	
					_cGroup=[_newpos,_side,_faction,_vehType]call EOS_fnc_spawnvehicle;
				if ((_cSize select 0) > 0) then{
						0=[(_cGroup select 0),_cSize,(_cGroup select 2),_faction,_cargoType] call eos_fnc_setcargo;
						};
						
							0=[(_cGroup select 2),"LIGskill"] call eos_fnc_grouphandlers;
								0 = [(_cGroup select 2),_mkr] call EOS_fnc_taskpatrol;
								_cGrp set [count _cGrp,_cGroup];	
								[_cGroup,_mkrX,_mkrY] call fnc_enabledynamicsim;
								
if (_debug) then {player sidechat format ["Light Vehicle:%1 - r%2",_counter,_cGrps];0= [_mkr,_counter,"Light Veh",(getpos leader (_cGroup select 2))] call EOS_debug};
		};	
		
//SPAWN ARMOURED VEHICLES
	for "_counter" from 1 to _dGrps do {
	if (isnil "_dGrp") then {_dGrp=[];};
	
		_newpos=[_mkr,50] call EOS_fnc_findSafePos;
			if (surfaceiswater _newpos) then {_vehType=8;}else{_vehType=2;};
			
					_dGroup=[_newpos,_side,_faction,_vehType]call EOS_fnc_spawnvehicle;
					
						0=[(_dGroup select 2),"ARMskill"] call eos_fnc_grouphandlers;
						0 = [(_dGroup select 2),_mkr] call EOS_fnc_taskpatrol;
							_dGrp set [count _dGrp,_dGroup];
							[_dGroup,_mkrX,_mkrY] call fnc_enabledynamicsim;
							
if (_debug) then {player sidechat format ["Armoured:%1 - r%2",_counter,_dGrps];0= [_mkr,_counter,"Armour",(getpos leader (_dGroup select 2))] call EOS_debug};
		};
		
//SPAWN STATIC PLACEMENTS
	for "_counter" from 1 to _eGrps do {
		if (surfaceiswater _mPos) exitwith {};
		if (isnil "_eGrp") then {_eGrp=[];};
				
		_newpos=[_mkr,50] call EOS_fnc_findSafePos;
			
					_eGroup=[_newpos,_side,_faction,5]call EOS_fnc_spawnvehicle;
		
						0=[(_eGroup select 2),"STAskill"] call eos_fnc_grouphandlers;
							_eGrp set [count _eGrp,_eGroup];
							[_eGroup,_mkrX,_mkrY] call fnc_enabledynamicsim;
							
if (_debug) then {player sidechat format ["Static:%1",_counter];0= [_mkr,_counter,"Static",(getpos leader (_eGroup select 2))] call EOS_debug};
		};	
		
//SPAWN CHOPPER
	for "_counter" from 1 to _fGrps do {
	if (isnil "_fGrp") then {_fGrp=[];};	
		if ((_fSize select 0) > 0) then {_vehType=4}else{_vehType=3};
				_newpos = [(markerpos _mkr), 1500, random 360] call BIS_fnc_relPos;	
						_fGroup=[_newpos,_side,_faction,_vehType,"fly"]call EOS_fnc_spawnvehicle;	
						_fGrp set [count _fGrp,_fGroup];

						
						
						
if ((_fSize select 0) > 0) then {
	_cargoGrp = createGroup _side;
		0=[(_fGroup select 0),_fSize,_cargoGrp,_faction,9] call eos_fnc_setcargo;
			0=[_cargoGrp,"INFskill"] call eos_fnc_grouphandlers;
		_fGroup set [count _fGroup,_cargoGrp];
			null = [_mkr,_fGroup,_counter] execvm "eos\functions\TransportUnload_fnc.sqf";
				}else{
					_wp1 = (_fGroup select 2) addWaypoint [(markerpos _mkr), 0];  
					_wp1 setWaypointSpeed "FULL";  
					_wp1 setWaypointType "SAD";};
			
						0=[(_fGroup select 2),"AIRskill"] call eos_fnc_grouphandlers;
			
if (_debug) then {player sidechat format ["Chopper:%1",_counter];0= [_mkr,_counter,"Chopper",(getpos leader (_fGroup select 2))] call EOS_debug};
			};	


			
//SPAWN ALT TRIGGERS	
			_clear = createTrigger ["EmptyDetector",_mPos]; 
			_clear setTriggerArea [_mkrX,_mkrY,_mkrAgl,FALSE]; 
			_clear setTriggerActivation [_enemyFaction,"NOT PRESENT",true]; 
			_clear setTriggerStatements ["this","",""]; 
				_taken = createTrigger ["EmptyDetector",_mPos]; 
				_taken setTriggerArea [_mkrX,_mkrY,_mkrAgl,FALSE];
				_taken setTriggerActivation ["ANY","PRESENT",true]; 
				_taken setTriggerStatements ["{vehicle _x in thisList && isplayer _x && ((getPosATL _x) select 2) < 5} count allUnits > 0","",""]; 
_eosAct=true;	
while {_eosAct} do
	{
	// IF PLAYER LEAVES THE AREA OR ZONE DEACTIVATED
	if (!triggeractivated _eosActivated || getmarkercolor _mkr == "colorblack") exitwith 
		{
		if (_debug) then {if (!(getmarkercolor _mkr == "colorblack")) then {hint "Restarting Zone AND deleting units";}else{hint "EOS zone deactivated";};};		
//CACHE LIGHT VEHICLES
	if (!isnil "_cGrp") then 
				{				
						{	_vehicle = _x select 0;_crew = _x select 1;_grp = _x select 2;
									if (!alive _vehicle || {!alive _x} foreach _crew) then { _cGrps= _cGrps - 1;};	
												{deleteVehicle _x} forEach (_crew);		
														if (!(vehicle player == _vehicle)) then {{deleteVehicle _x} forEach[_vehicle];};												
																			{deleteVehicle _x} foreach units _grp;deleteGroup _grp;
						}foreach _cGrp;
if (_debug) then {player sidechat format ["ID:c%1",_cGrps];};};
											
// CACHE ARMOURED VEHICLES
		if (!isnil "_dGrp") then 
				{				
						{	_vehicle = _x select 0;_crew = _x select 1;_grp = _x select 2;
									if (!alive _vehicle || {!alive _x} foreach _crew) then {_dGrps= _dGrps - 1;};	
												{deleteVehicle _x} forEach (_crew);		
														if (!(vehicle player == _vehicle)) then {{deleteVehicle _x} forEach[_vehicle];};												
																			{deleteVehicle _x} foreach units _grp;deleteGroup _grp;
						}foreach _dGrp;
if (_debug) then {player sidechat format ["ID:c%1",_dGrps];};};

// CACHE PATROL INFANTRY					
	if (!isnil "_bGrp") then 
				{		_n=0;					
						{	_n=_n+1;_units={alive _x} count units _x;_cacheGrp=format ["PA%1",_n];
	if (_debug) then{player sidechat format ["ID:%1,cache - %2",_cacheGrp,_units];};
						_eosActivated setvariable [_cacheGrp,_units];		
						{deleteVehicle _x} foreach units _x;deleteGroup _x;
						}foreach _bGrp;
				};
						
// CACHE HOUSE INFANTRY
	if (!isnil "_aGrp") then 
				{		_n=0;					
						{	_n=_n+1;_units={alive _x} count units _x;_cacheGrp=format ["HP%1",_n];
	if (_debug) then{player sidechat format ["ID:%1,cache - %2",_cacheGrp,_units];};
						_eosActivated setvariable [_cacheGrp,_units];		
						{deleteVehicle _x} foreach units _x;deleteGroup _x;
						}foreach _aGrp;
				};
					
// CACHE MORTARS			
	if (!isnil "_eGrp") then 
				{			
						{	_vehicle = _x select 0;_crew = _x select 1;_grp = _x select 2;
									if (!alive _vehicle || {!alive _x} foreach _crew) then {_eGrps= _eGrps - 1;};			
														{deleteVehicle _x} forEach (_crew);
															if (!(vehicle player == _vehicle)) then {{deleteVehicle _x} forEach[_vehicle];};													
																	{deleteVehicle _x} foreach units _grp;deleteGroup _grp;
						}foreach _eGrp;};	
						
// CACHE HELICOPTER TRANSPORT
	if (!isnil "_fGrp") then 
				{			
						{	_vehicle = _x select 0;_crew = _x select 1;_grp = _x select 2; _cargoGrp = _x select 3;
									if (!alive _vehicle || {!alive _x} foreach _crew) then {_fGrps= _fGrps - 1;};			
														{deleteVehicle _x} forEach (_crew);
															if (!(vehicle player == _vehicle)) then {{deleteVehicle _x} forEach[_vehicle];};													
																	{deleteVehicle _x} foreach units _grp;deleteGroup _grp;
																	if (!isnil "_cargoGrp") then {
																	{deleteVehicle _x} foreach units _cargoGrp;deleteGroup _cargoGrp;};
																	
						}foreach _fGrp;};	
						
_eosAct=false;
if (_debug) then {hint "Zone Cached";};
};
	if (triggeractivated _clear and triggeractivated _taken and !_civZone)exitwith 
			{// IF ZONE CAPTURED BEGIN CHECKING FOR ENEMIES
				_cGrps=0;_aGrps=0;_bGrps=0;_dGrps=0;_eGrps=0;_fGrps=0;		
				while {triggeractivated _eosActivated AND !(getmarkercolor _mkr == "colorblack")} do 
						{
							if (!triggeractivated _clear) then
							{
								_mkr setmarkercolor hostileColor;
								_mkr setmarkerAlpha _mAH;
								if (_debug) then {hint "Zone Lost";};
										}else{
											_mkr setmarkercolor VictoryColor;
											_mkr setmarkerAlpha _mAN;
											if (_debug) then {hint "Zone Captured";};
											};
				sleep 1;};
// PLAYER LEFT ZONE				
_eosAct=false;		
			};sleep 0.5;};

deletevehicle _clear;deletevehicle _taken;	
	
if (!(getmarkercolor _mkr == "colorblack")) then {	
	null = [_mkr,[_aGrps,_aSize],[_bGrps,_bSize],[_cGrps,_cSize],[_dGrps,_eGrps,_fGrps,_fSize],_settings,true] execVM "eos\core\eos_core.sqf";
	}else{_Mkr setmarkeralpha 0;};
	};

 

eos/functions SHK_buildingpos.sqf

Spoiler


// Infantry Occupy House
// by Zenophon
// Released under Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
// http://creativecommons.org/licenses/by-nc/4.0/

// Teleports the units to random windows of the building(s) within the distance
// Faces units in the right direction and orders them to stand up or crouch on a roof
// Units will only fill the building to as many positions as there are windows
// Multiple buildings can be filled either evenly or to the limit of each sequentially
// Usage : Call, execVM
// Params: 1. Array, the building(s) nearest this position is used
//         2. Array of objects, the units that will garrison the building(s)
//  (opt.) 3. Scalar, radius in which to fill building(s), -1 for only nearest building, (default: -1)
//  (opt.) 4. Boolean, true to put units on the roof, false for only inside, (default: false)
//  (opt.) 5. Boolean, true to fill all buildings in radius evenly, false for one by one, (default: false)
//  (opt.) 6. Boolean, true to fill from the top of the building down, (default: false)
//  (opt.) 7. Boolean, true to order AI units to move to the position instead of teleporting, (default: false)
// Return: Array of objects, the units that were not garrisoned

#define I(X) X = X + 1;
#define EVAL(X) (X call _comparator)
#define EYE_HEIGHT 1.53
#define CHECK_DISTANCE 5
#define FOV_ANGLE 10
#define ROOF_CHECK 4
#define ROOF_EDGE 2

private ["_center", "_units", "_buildingRadius", "_putOnRoof", "_fillEvenly", "_Zen_ExtendPosition", "_buildingsArray", "_buildingPosArray", "_buildingPositions", "_posArray", "_unitIndex", "_j", "_building", "_posArray", "_randomIndex", "_housePos", "_startAngle", "_i", "_checkPos", "_hitCount", "_isRoof", "_edge", "_k", "_unUsedUnits", "_array", "_sortHeight", "_Zen_InsertionSort", "_Zen_ArrayShuffle", "_doMove"];

_center = _this param [0, [0,0,0], [[]], 3];
_units = _this param [1, [objNull], [[]]];
_buildingRadius = _this param [2, -1, [0]];
_putOnRoof = _this param [3, false, [true]];
_fillEvenly = _this param [4, false, [true]];
_sortHeight = _this param [5, false, [true]];
_doMove = _this param [6, false, [true]];

if (_center isEqualTo [0,0,0]) exitWith {
    player sideChat str "Zen_Occupy House Error : Invalid position given.";
    diag_log "Zen_Occupy House Error : Invalid position given.";
    ([])
};

if ((count _units == 0) || {isNull (_units select 0)}) exitWith {
    player sideChat str "Zen_Occupy House Error : No units given.";
    diag_log "Zen_Occupy House Error : No units given.";
    ([])
};

_Zen_ExtendPosition = {
    private ["_center", "_dist", "_phi"];

    _center = _this select 0;
    _dist = _this select 1;
    _phi = _this select 2;

    ([(_center select 0) + (_dist * (cos _phi)),(_center select 1) + (_dist * (sin _phi)), (_this select 3)])
};

_Zen_InsertionSort = {
    private ["_i", "_j", "_count", "_array", "_element", "_value", "_comparator"];

    _array = _this select 0;
    _comparator = _this select 1;
    _count = count _array - 1;

    if (count _array == 0) exitWith {};
    for "_i" from 1 to _count step 1 do {
        scopeName "forI";
        _element = _array select _i;
        _value = EVAL(_element);

        for [{_j = _i}, {_j >= 1}, {_j = _j - 1}] do {
            if (_value > EVAL(_array select (_j - 1))) then {
                breakTo "forI";
            };
            _array set [_j, _array select (_j - 1)];
        };

        _array set [_j, _element];
    };
    if (true) exitWith {};
};

_Zen_ArrayShuffle = {
    private ["_array", "_j", "_i", "_temp"];
    _array = _this select 0;

    if (count _array > 1) then {
        for "_i" from 0 to (count _array - 1) do {
                _j = _i + floor random ((count _array) - _i);
                _temp = _array select _i;
                _array set [_i, (_array select _j)];
                _array set [_j, _temp];
        };
    };
    if (true) exitWith {};
};

if (_buildingRadius < 0) then {
    _buildingsArray = [nearestBuilding _center];
} else {
    _buildingsArray0 = nearestObjects [_center, ["house"], _buildingRadius];
    _buildingsArray1 = nearestObjects [_center, ["building"], _buildingRadius];
    _buildingsArray = _buildingsArray0 arrayIntersect _buildingsArray1;
};

if (count _buildingsArray == 0) exitWith {
    player sideChat str "Zen_Occupy House Error : No buildings found.";
    diag_log "Zen_Occupy House Error : No buildings found.";
    ([])
};

_buildingPosArray = [];
0 = [_buildingsArray] call _Zen_ArrayShuffle;
{
    _posArray = [];
    for "_i" from 0 to 1000 do {
        if ((_x buildingPos _i) isEqualTo [0,0,0]) exitWith {};
        _posArray pushBack (_x buildingPos _i);
    };

    _buildingPosArray pushBack _posArray;
} forEach _buildingsArray;

if (_sortHeight) then {
    {
        0 = [_x, {-1 * (_this select 2)}] call _Zen_InsertionSort;
    } forEach _buildingPosArray;
} else {
    {
        0 = [_x] call _Zen_ArrayShuffle;
    } forEach _buildingPosArray;
};

_unitIndex = 0;
for [{_j = 0}, {(_unitIndex < count _units) && {(count _buildingPosArray > 0)}}, {I(_j)}] do {
    scopeName "for";

    _building = _buildingsArray select (_j % (count _buildingsArray));
    _posArray = _buildingPosArray select (_j % (count _buildingPosArray));

    if (count _posArray == 0) then {
        _buildingsArray deleteAt (_j % (count _buildingsArray));
        _buildingPosArray deleteAt (_j % (count _buildingPosArray));
    };

    while {(count _posArray) > 0} do {
        scopeName "while";
        if (_unitIndex >= count _units) exitWith {};

        _housePos = _posArray select 0;
        _posArray deleteAt 0;
        _housePos = [(_housePos select 0), (_housePos select 1), (_housePos select 2) + (getTerrainHeightASL _housePos) + EYE_HEIGHT];

        _startAngle = (round random 10) * (round random 36);
        for "_i" from _startAngle to (_startAngle + 350) step 10 do {
            _checkPos = [_housePos, CHECK_DISTANCE, (90 - _i), (_housePos select 2)] call _Zen_ExtendPosition;
            if !(lineIntersects [_checkPos, [_checkPos select 0, _checkPos select 1, (_checkPos select 2) + 25], objNull, objNull]) then {
                if !(lineIntersects [_housePos, _checkPos, objNull, objNull]) then {
                    _checkPos = [_housePos, CHECK_DISTANCE, (90 - _i), (_housePos select 2) + (CHECK_DISTANCE * tan FOV_ANGLE)] call _Zen_ExtendPosition;
                    if !(lineIntersects [_housePos, _checkPos, objNull, objNull]) then {
                        _hitCount = 0;
                        for "_k" from 30 to 360 step 30 do {
                            _checkPos = [_housePos, 20, (90 - _k), (_housePos select 2)] call _Zen_ExtendPosition;
                            if (lineIntersects [_housePos, _checkPos, objNull, objNull]) then {
                                I(_hitCount)
                            };

                            if (_hitCount >= ROOF_CHECK) exitWith {};
                        };

                        _isRoof = (_hitCount < ROOF_CHECK) && {!(lineIntersects [_housePos, [_housePos select 0, _housePos select 1, (_housePos select 2) + 25], objNull, objNull])};
                        if (!(_isRoof) || {((_isRoof) && {(_putOnRoof)})}) then {
                            if (_isRoof) then {
                                _edge = false;
                                for "_k" from 30 to 360 step 30 do {
                                    _checkPos = [_housePos, ROOF_EDGE, (90 - _k), (_housePos select 2)] call _Zen_ExtendPosition;
                                    _edge = !(lineIntersects [_checkPos, [(_checkPos select 0), (_checkPos select 1), (_checkPos select 2) - EYE_HEIGHT - 1], objNull, objNull]);

                                    if (_edge) exitWith {
                                        _i = _k;
                                    };
                                };
                            };

                            if (!(_isRoof) || {_edge}) then {
                                (_units select _unitIndex) doWatch ([_housePos, CHECK_DISTANCE, (90 - _i), (_housePos select 2) - (getTerrainHeightASL _housePos)] call _Zen_ExtendPosition);

                                (_units select _unitIndex) disableAI "TARGET";
                                if (_doMove) then {
                                    (_units select _unitIndex) doMove ASLToATL ([(_housePos select 0), (_housePos select 1), (_housePos select 2) - EYE_HEIGHT]);
                                } else {
                                    (_units select _unitIndex) setPosASL [(_housePos select 0), (_housePos select 1), (_housePos select 2) - EYE_HEIGHT];
                                    (_units select _unitIndex) setDir _i;

                                    doStop (_units select _unitIndex);
                                    (_units select _unitIndex) forceSpeed 0;
                                };

                               //** JBOY_UpDown by JohnnyBoy //*/
                                #define JBOY_UpDown \
                                    if ((_this select 0) getVariable ["FIREDLOCKOUT", false]) exitWith {}; \
                                    if (!isServer)  exitWith {}; \
                                    _dude = _this select 0; \
                                    _stances = _this select 1; \
                                    _ehid = (_dude getVariable "EHID"); \
                                    _dude setVariable ["FIREDLOCKOUT", true]; \
                                    while {alive _dude} do { \
                                        if ((unitPos _dude) == (_stances select 0)) then { \
                                            _dude setUnitPos (_stances select 1); \
                                        } else { \
                                            _dude setUnitPos (_stances select 0); \
                                        }; \
                                        sleep 5 + (random 2); \
                                    }; \
									_dude removeEventHandler ["FiredNear",_ehid]; 
								
                                    if (_isRoof) then {
                                    	(_units select _unitIndex) setUnitPos "MIDDLE";
                                       _eh = (_units select _unitIndex) addEventHandler ["FiredNear",{[(_this select 0),["DOWN","MIDDLE"]] spawn {JBOY_UpDown};}];
                                    	(_units select _unitIndex) setVariable ["EHID", _eh];
                                       
                                    } else {
                                    	(_units select _unitIndex) setUnitPos "UP";
                                       _eh = (_units select _unitIndex) addEventHandler ["FiredNear",{[(_this select 0),["UP","MIDDLE"]] spawn {JBOY_UpDown};}];
                                       (_units select _unitIndex) setVariable ["EHID", _eh];
                                      
                                    }; 
								

                                I(_unitIndex)
                                if (_fillEvenly) then {
                                    breakTo "for";
                                } else {
                                    breakTo "while";
                                };
                            };
                        };
                    };
                };
            };
        };
    };
};

if (_doMove) then {
    0 = [_units, _unitIndex] spawn {
        _units = _this select 0;
        _unitIndex = _this select 1;

        _usedUnits = [];
        for "_i" from 0 to (_unitIndex - 1) do {
            _usedUnits pushBack (_units select _i);
        };

        while {count _usedUnits > 0} do {
            sleep 1;
            _toRemove =  [];
            {
                if (unitReady _x) then {
                    doStop _x;
                    _x forceSpeed 0;
                    _toRemove pushBack _forEachIndex;
                };
            } forEach _usedUnits;

            {
                _usedUnits deleteAt (_x - _forEachIndex);
            } forEach _toRemove;
        };
        if (true) exitWith {};
    };
};

_unUsedUnits = [];
for "_i" from _unitIndex to (count _units - 1) step 1 do {
    _unUsedUnits pushBack (_units select _i);
};

(_unUsedUnits)

// Changelog
// 7/21/15
    // 1. Added: Error reporting for invalid position and unit array arguments
    // 1. Added: Check and error report if no buildings are found
    // 3. Improved: Parameters 3, 4, and 5 are now optional and check for the correct type
    // 4. Improved: Parameters 6 and 7 check for the correct type
    // 5. Improved: AI should now stay in place better (thanks to JohnnyBoy)

// 7/6/15
    // 1. Added: AI now take cover when fired upon (credit to JohnnyBoy)
    // 2. Added: Parameter to order the AI to move to their position
    // 3. Improved: The order of buildings filled is now random
    // 4. Improved: A few minor optimizations

// 6/30/15
    // 1. Added: Parameter to fill buildings from top to bottom
    // 2. Improved: Optimized

// 7/31/14
    // 1. Added: Parameter to cycle through each building in the radius, giving units to each one
    // 2. Improved: Units on roof are only placed at the edge, and face the edge
    // 3. Improved: Optimized roof check
    // 4. Improved: General script cleanup

// 7/28/14
    // 1. Fixed: Units facing the wrong window
    // 2. Added: Parameter for distance to select multiple buildings
    // 3. Added: Parameter for units being on a roof
    // 4. Improved: Now checks that unit has a good FOV from the windows
    // 5. Improved: Units can no longer face a windows greater than 5 meters away
    // 6. Improved: Units on a roof now crouch
    // 7. Tweaked: Height of human eye to the exact value in ArmA

// 7/24/14
    // Initial Release

// Known Issues
    // None

 

 

enable dynamic simulation for markers more then 500m by 500m. I like this fillhouse script a little better

  • Like 2

Share this post


Link to post
Share on other sites
On 8/4/2019 at 12:57 PM, sabot10.5mm said:
  Reveal hidden contents


EOS_Spawn = compile preprocessfilelinenumbers "eos\core\eos_launch.sqf";Bastion_Spawn=compile preprocessfilelinenumbers "eos\core\b_launch.sqf";null=[] execVM "eos\core\spawn_fnc.sqf";onplayerConnected {[] execVM "eos\Functions\EOS_Markers.sqf";}; 
VictoryColor="colorGreen"; // Colour of marker after completion 
hostileColor="colorRed"; // Default colour when enemies active 
bastionColor="colorOrange"; // Colour for bastion marker 
EOS_DAMAGE_MULTIPLIER=1; // 1 is default 
EOS_KILLCOUNTER=true;  // Counts killed units 
/* 
UNIT SIZE PER GROUP
 0 = 1
 1 = 2,4
 2 = 4,8
 3 = 8,12
 4 = 12,16
 5 = 16,20
 */
{ 
if (["EOS_MARKER", _x] call BIS_fnc_inString) then  
{ 
_xcargo=3; //max units in cargo
_maxVh=3;  //max amount of vehicles
_maxGp=8;  //max amount of groups
_maxUt=2;  //max amount of units per group 
_minUt=0;  //min amount of units per group
_mkrSz=(getMarkerSize _x#0) + (getMarkerSize _x#1); 
_grps =  round(linearConversion [0,1000,_mkrSz,1,_maxGp,false]); 
_vehs =  round(linearConversion [0,1000,_mkrSz,0,_maxVh,false]); 
_vcarg = round(linearConversion [0,1000,_mkrSz,0,_xcargo,true]); 
_grpSz = round(linearConversion [0,1000,_mkrSz,_minUt,_maxUt,true]); 
_prob =  round(linearConversion [0,1000,_mkrSz,0,100,true]); 
[[_x],[_grps,_grpSz],[_grps,_grpSz],[_maxVh,_vcarg,_prob],[_vehs,_prob],[_vehs],[_vehs,_vcarg,_prob],[0,0,400,EAST,FALSE]] call EOS_Spawn; 
}; 
}foreach allmapmarkers;

 

OpenMe.sqf

this script gets all markers named "eos_marker", and changes the groupsize. unitsize, vehiclesize and cargosize based on the size of the marker; then it calls eos_spawn for each marker.

 

 

 

Wow man, this is incredible. What adjustments did you make to core in the 8/10/19 post? or is that including the auto feature in video? also can you help me with bastion? i still cant figure out why its ending the mission when the last wave is completed.

 

does anyone know how to integrate grimes simple revive script into eos?

Share this post


Link to post
Share on other sites
On 8/10/2019 at 1:31 PM, sabot10.5mm said:
  Reveal hidden contents

eos/functions DynSimEnab.sqf

  Reveal hidden contents



params["_grp","_mkrX","_mkrY"];
_mkrSz = _mkrX + _mkrY;
if (_mkrSz > 1000) then {
	if !(_grp isEqualtype grpNull) then {
		(_grp select 0) enableDynamicSimulation true;
		(_grp select 2) enableDynamicSimulation true;
						
	} else {
		_grp enableDynamicSimulation true;
	};
};

 

eos/core spawn_fnc.sqf

  Reveal hidden contents




IF (isnil "server")then{hint "YOU MUST PLACE A GAME LOGIC NAMED SERVER!";};
eos_fnc_spawnvehicle=compile preprocessfilelinenumbers "eos\functions\eos_SpawnVehicle.sqf";
eos_fnc_grouphandlers=compile preprocessfilelinenumbers "eos\functions\setSkill.sqf";
eos_fnc_findsafepos=compile preprocessfilelinenumbers "eos\functions\findSafePos.sqf";
eos_fnc_spawngroup= compile preprocessfile "eos\functions\infantry_fnc.sqf";
eos_fnc_setcargo = compile preprocessfile "eos\functions\cargo_fnc.sqf";
eos_fnc_taskpatrol= compile preprocessfile "eos\functions\shk_patrol.sqf";
SHK_pos= compile preprocessfile "eos\functions\shk_pos.sqf";
shk_fnc_fillhouse = compile preprocessFileLineNumbers "eos\Functions\SHK_buildingpos.sqf";
fnc_enabledynamicsim = compile preprocessFileLineNumbers "eos\Functions\DynSimEnab.sqf";
eos_fnc_getunitpool= compile preprocessfilelinenumbers "eos\UnitPools.sqf";
call compile preprocessfilelinenumbers "eos\AI_Skill.sqf";

EOS_Deactivate = {
	private ["_mkr"];
		_mkr=(_this select 0);		
	{
		_x setmarkercolor "colorblack";
		_x setmarkerAlpha 0;
	}foreach _mkr;
};

EOS_debug = {
private ["_note"];
_mkr=(_this select 0);
_n=(_this select 1);
_note=(_this select 2);
_pos=(_this select 3);

_mkrID=format ["%3:%1,%2",_mkr,_n,_note];
deletemarker _mkrID;
_debugMkr = createMarker[_mkrID,_pos];
_mkrID setMarkerType "Mil_dot";
_mkrID setMarkercolor "colorBlue";
_mkrID setMarkerText _mkrID;
_mkrID setMarkerAlpha 0.5;
};

 

 

eos/core/eos_core.sqf

  Reveal hidden contents



if (!isServer) exitWith {};
private ["_newpos","_cargoType","_vehType","_dGrp","_mkrAgl","_side","_bGroup","_civZone","_fGrp","_fSize","_fGrps","_eGrp","_eGrps","_dGrps","_aMin","_aSize","_aGrps","_aGrp","_bMin","_units","_bSize","_bGrps","_bGrp","_trig","_cache","_grp","_crew","_vehicle","_actCond","_mAN","_mAH","_distance","_mA","_settings","_cGrp","_cSize","_cGrps","_taken","_clear","_enemyFaction","_faction","_n","_eosAct","_eosActivated","_debug","_mkr","_mPos","_mkrX","_mkrY"];

_mkr=(_this select 0);_mPos=markerpos(_this select 0);
_mkrX=getMarkerSize _mkr select 0;
_mkrY=getMarkerSize _mkr select 1;
_mkrAgl=markerDir _mkr;
_a=(_this select 1);_aGrps=_a select 0;_aSize=_a select 1;_aMin=_aSize select 0;
_b=(_this select 2);_bGrps=_b select 0;_bSize=_b select 1;_bMin=_bSize select 0;
_c=(_this select 3);_cGrps=_c select 0;_cSize=_c select 1;
_d=(_this select 4);_dGrps=_d select 0;_eGrps=_d select 1;_fGrps=_d select 2;_fSize=_d select 3;
_settings=(_this select 5);_faction=_settings select 0;_mA=_settings select 1;_distance=_settings select 2;_side=_settings select 3;
_heightLimit=if (count _settings > 4) then {_settings select 4} else {false};
_debug=if (count _settings > 5) then {_settings select 5} else {false};
_cache= if (count _this > 6) then {_this select 6} else {false};


	if (_side==EAST) then {_enemyFaction="east";_civZone=false;};
	if (_side==WEST) then {_enemyFaction="west";_civZone=false;};
	if (_side==INDEPENDENT) then {_enemyFaction="guer";_civZone=false;};
	if (_side==CIVILIAN) then {_enemyFaction="civ";_civZone=true;};

	if (_mA==0) then {_mAH = 1;_mAN = 0.5;};
	if (_mA==1) then {_mAH = 0;_mAN = 0;};
	if (_mA==2) then {_mAH = 0.5;_mAN = 0.5;};

// INITIATE ZONE
_trig=format ["EOSTrigger%1",_mkr];


if (!_cache) then {
	if ismultiplayer then {
			if (_heightLimit) then 
			{_actCond="{vehicle _x in thisList && isplayer _x && ((getPosATL _x) select 2) < 5} count playableunits > 0";
							}else 
							{_actCond="{vehicle _x in thisList && isplayer _x} count playableunits > 0";
		};}else{
			if (_heightLimit) then 
						{_actCond="{vehicle _x in thisList && isplayer _x && ((getPosATL _x) select 2) < 5  } count allUnits > 0";
								}else
	
									  {_actCond="{vehicle _x in thisList && isplayer _x || ({_player = _x; {getConnectedUAV _player == _x} count [uav, uav1, uav2, uav3] > 0} count allPlayers > 0 && ({_x in thislist} count [uav, uav1, uav2, uav3] > 0))} count allUnits > 0"; };};
		_eosActivated = createTrigger ["EmptyDetector",_mPos]; 
		_eosActivated = createTrigger ["EmptyDetector",_mPos]; 
		_eosActivated setTriggerArea [(_distance+_mkrX),(_distance+_mkrY),_mkrAgl,FALSE]; 
		_eosActivated setTriggerActivation ["ANY","PRESENT",true];
		_eosActivated setTriggerTimeout [1, 1, 1, true];
		_eosActivated setTriggerStatements [_actCond,"",""];
		
			server setvariable [_trig,_eosActivated];	
					}else{
				_eosActivated=server getvariable _trig;	
					};
		
					_mkr setmarkerAlpha _mAN;
						if (!(getmarkercolor _mkr == VictoryColor)) then 	//IF MARKER IS GREEN DO NOT CHANGE COLOUR
							{
						_mkr setmarkercolor hostileColor;
							};



waituntil {triggeractivated _eosActivated};	//WAIT UNTIL PLAYERS IN ZONE
if (!(getmarkercolor _mkr == "colorblack"))then {
	if (!(getmarkercolor _mkr == VictoryColor)) then {_mkr setmarkerAlpha _mAH;};

// SPAWN HOUSE PATROLS
	for "_counter" from 1 to _aGrps do {
	if (isnil "_aGrp") then {_aGrp=[];};
		if (_cache) then {
				_cacheGrp=format ["HP%1",_counter];
				_units=_eosActivated getvariable _cacheGrp;	
						_aSize=[_units,_units];
						_aMin=_aSize select 0;
							if (_debug)then{player sidechat format ["ID:%1,restore - %2",_cacheGrp,_units];};
							};
								if (_aMin > 0) then {
										_aGroup=[_mPos,_aSize,_faction,_side] call EOS_fnc_spawngroup;	
				
										if (!surfaceiswater _mPos) then {
											0=[_mPos,(units _aGroup),_mkrX,true,false,true,false] call shk_fnc_fillhouse;
												}else{
												0 = [_aGroup,_mkr] call EOS_fnc_taskpatrol;
													};
												_aGrp set [count _aGrp,_aGroup];
												0=[_aGroup,"INFskill"] call eos_fnc_grouphandlers;
												[_aGroup,_mkrX,_mkrY] call fnc_enabledynamicsim;
if (_debug) then {PLAYER SIDECHAT (format ["Spawned House Patrol: %1",_counter]);0= [_mkr,_counter,"House Patrol",getpos (leader _aGroup)] call EOS_debug};
												};
		};
		
// SPAWN PATROLS
	for "_counter" from 1 to _bGrps do {
	if (isnil "_bGrp") then {_bGrp=[];};
		if (_cache) then {
				_cacheGrp=format ["PA%1",_counter];
				_units=_eosActivated getvariable _cacheGrp;	
					_bSize=[_units,_units];
					_bMin=_bSize select 0;
					if (_debug)then{player sidechat format ["ID:%1,restore - %2",_cacheGrp,_units];};
						};
							if (_bMin > 0) then {	
									_pos = [_mkr,true] call SHK_pos;			
									_bGroup=[_pos,_bSize,_faction,_side] call EOS_fnc_spawngroup;
										0 = [_bGroup,_mkr] call EOS_fnc_taskpatrol;
										_bGrp set [count _bGrp,_bGroup];
										0=[_bGroup,"INFskill"] call eos_fnc_grouphandlers;
										[_bGroup,_mkrX,_mkrY] call fnc_enabledynamicsim;
if (_debug) then {PLAYER SIDECHAT (format ["Spawned Patrol: %1",_counter]);0= [_mkr,_counter,"patrol",getpos (leader _bGroup)] call EOS_debug};
												};
		};	
	
//SPAWN LIGHT VEHICLES
	for "_counter" from 1 to _cGrps do {	
	if (isnil "_cGrp") then {_cGrp=[];};	
	
		_newpos=[_mkr,50] call EOS_fnc_findSafePos;
			if (surfaceiswater _newpos) then {_vehType=8;_cargoType=10;}else{_vehType=7;_cargoType=9;};
	
					_cGroup=[_newpos,_side,_faction,_vehType]call EOS_fnc_spawnvehicle;
				if ((_cSize select 0) > 0) then{
						0=[(_cGroup select 0),_cSize,(_cGroup select 2),_faction,_cargoType] call eos_fnc_setcargo;
						};
						
							0=[(_cGroup select 2),"LIGskill"] call eos_fnc_grouphandlers;
								0 = [(_cGroup select 2),_mkr] call EOS_fnc_taskpatrol;
								_cGrp set [count _cGrp,_cGroup];	
								[_cGroup,_mkrX,_mkrY] call fnc_enabledynamicsim;
								
if (_debug) then {player sidechat format ["Light Vehicle:%1 - r%2",_counter,_cGrps];0= [_mkr,_counter,"Light Veh",(getpos leader (_cGroup select 2))] call EOS_debug};
		};	
		
//SPAWN ARMOURED VEHICLES
	for "_counter" from 1 to _dGrps do {
	if (isnil "_dGrp") then {_dGrp=[];};
	
		_newpos=[_mkr,50] call EOS_fnc_findSafePos;
			if (surfaceiswater _newpos) then {_vehType=8;}else{_vehType=2;};
			
					_dGroup=[_newpos,_side,_faction,_vehType]call EOS_fnc_spawnvehicle;
					
						0=[(_dGroup select 2),"ARMskill"] call eos_fnc_grouphandlers;
						0 = [(_dGroup select 2),_mkr] call EOS_fnc_taskpatrol;
							_dGrp set [count _dGrp,_dGroup];
							[_dGroup,_mkrX,_mkrY] call fnc_enabledynamicsim;
							
if (_debug) then {player sidechat format ["Armoured:%1 - r%2",_counter,_dGrps];0= [_mkr,_counter,"Armour",(getpos leader (_dGroup select 2))] call EOS_debug};
		};
		
//SPAWN STATIC PLACEMENTS
	for "_counter" from 1 to _eGrps do {
		if (surfaceiswater _mPos) exitwith {};
		if (isnil "_eGrp") then {_eGrp=[];};
				
		_newpos=[_mkr,50] call EOS_fnc_findSafePos;
			
					_eGroup=[_newpos,_side,_faction,5]call EOS_fnc_spawnvehicle;
		
						0=[(_eGroup select 2),"STAskill"] call eos_fnc_grouphandlers;
							_eGrp set [count _eGrp,_eGroup];
							[_eGroup,_mkrX,_mkrY] call fnc_enabledynamicsim;
							
if (_debug) then {player sidechat format ["Static:%1",_counter];0= [_mkr,_counter,"Static",(getpos leader (_eGroup select 2))] call EOS_debug};
		};	
		
//SPAWN CHOPPER
	for "_counter" from 1 to _fGrps do {
	if (isnil "_fGrp") then {_fGrp=[];};	
		if ((_fSize select 0) > 0) then {_vehType=4}else{_vehType=3};
				_newpos = [(markerpos _mkr), 1500, random 360] call BIS_fnc_relPos;	
						_fGroup=[_newpos,_side,_faction,_vehType,"fly"]call EOS_fnc_spawnvehicle;	
						_fGrp set [count _fGrp,_fGroup];

						
						
						
if ((_fSize select 0) > 0) then {
	_cargoGrp = createGroup _side;
		0=[(_fGroup select 0),_fSize,_cargoGrp,_faction,9] call eos_fnc_setcargo;
			0=[_cargoGrp,"INFskill"] call eos_fnc_grouphandlers;
		_fGroup set [count _fGroup,_cargoGrp];
			null = [_mkr,_fGroup,_counter] execvm "eos\functions\TransportUnload_fnc.sqf";
				}else{
					_wp1 = (_fGroup select 2) addWaypoint [(markerpos _mkr), 0];  
					_wp1 setWaypointSpeed "FULL";  
					_wp1 setWaypointType "SAD";};
			
						0=[(_fGroup select 2),"AIRskill"] call eos_fnc_grouphandlers;
			
if (_debug) then {player sidechat format ["Chopper:%1",_counter];0= [_mkr,_counter,"Chopper",(getpos leader (_fGroup select 2))] call EOS_debug};
			};	


			
//SPAWN ALT TRIGGERS	
			_clear = createTrigger ["EmptyDetector",_mPos]; 
			_clear setTriggerArea [_mkrX,_mkrY,_mkrAgl,FALSE]; 
			_clear setTriggerActivation [_enemyFaction,"NOT PRESENT",true]; 
			_clear setTriggerStatements ["this","",""]; 
				_taken = createTrigger ["EmptyDetector",_mPos]; 
				_taken setTriggerArea [_mkrX,_mkrY,_mkrAgl,FALSE];
				_taken setTriggerActivation ["ANY","PRESENT",true]; 
				_taken setTriggerStatements ["{vehicle _x in thisList && isplayer _x && ((getPosATL _x) select 2) < 5} count allUnits > 0","",""]; 
_eosAct=true;	
while {_eosAct} do
	{
	// IF PLAYER LEAVES THE AREA OR ZONE DEACTIVATED
	if (!triggeractivated _eosActivated || getmarkercolor _mkr == "colorblack") exitwith 
		{
		if (_debug) then {if (!(getmarkercolor _mkr == "colorblack")) then {hint "Restarting Zone AND deleting units";}else{hint "EOS zone deactivated";};};		
//CACHE LIGHT VEHICLES
	if (!isnil "_cGrp") then 
				{				
						{	_vehicle = _x select 0;_crew = _x select 1;_grp = _x select 2;
									if (!alive _vehicle || {!alive _x} foreach _crew) then { _cGrps= _cGrps - 1;};	
												{deleteVehicle _x} forEach (_crew);		
														if (!(vehicle player == _vehicle)) then {{deleteVehicle _x} forEach[_vehicle];};												
																			{deleteVehicle _x} foreach units _grp;deleteGroup _grp;
						}foreach _cGrp;
if (_debug) then {player sidechat format ["ID:c%1",_cGrps];};};
											
// CACHE ARMOURED VEHICLES
		if (!isnil "_dGrp") then 
				{				
						{	_vehicle = _x select 0;_crew = _x select 1;_grp = _x select 2;
									if (!alive _vehicle || {!alive _x} foreach _crew) then {_dGrps= _dGrps - 1;};	
												{deleteVehicle _x} forEach (_crew);		
														if (!(vehicle player == _vehicle)) then {{deleteVehicle _x} forEach[_vehicle];};												
																			{deleteVehicle _x} foreach units _grp;deleteGroup _grp;
						}foreach _dGrp;
if (_debug) then {player sidechat format ["ID:c%1",_dGrps];};};

// CACHE PATROL INFANTRY					
	if (!isnil "_bGrp") then 
				{		_n=0;					
						{	_n=_n+1;_units={alive _x} count units _x;_cacheGrp=format ["PA%1",_n];
	if (_debug) then{player sidechat format ["ID:%1,cache - %2",_cacheGrp,_units];};
						_eosActivated setvariable [_cacheGrp,_units];		
						{deleteVehicle _x} foreach units _x;deleteGroup _x;
						}foreach _bGrp;
				};
						
// CACHE HOUSE INFANTRY
	if (!isnil "_aGrp") then 
				{		_n=0;					
						{	_n=_n+1;_units={alive _x} count units _x;_cacheGrp=format ["HP%1",_n];
	if (_debug) then{player sidechat format ["ID:%1,cache - %2",_cacheGrp,_units];};
						_eosActivated setvariable [_cacheGrp,_units];		
						{deleteVehicle _x} foreach units _x;deleteGroup _x;
						}foreach _aGrp;
				};
					
// CACHE MORTARS			
	if (!isnil "_eGrp") then 
				{			
						{	_vehicle = _x select 0;_crew = _x select 1;_grp = _x select 2;
									if (!alive _vehicle || {!alive _x} foreach _crew) then {_eGrps= _eGrps - 1;};			
														{deleteVehicle _x} forEach (_crew);
															if (!(vehicle player == _vehicle)) then {{deleteVehicle _x} forEach[_vehicle];};													
																	{deleteVehicle _x} foreach units _grp;deleteGroup _grp;
						}foreach _eGrp;};	
						
// CACHE HELICOPTER TRANSPORT
	if (!isnil "_fGrp") then 
				{			
						{	_vehicle = _x select 0;_crew = _x select 1;_grp = _x select 2; _cargoGrp = _x select 3;
									if (!alive _vehicle || {!alive _x} foreach _crew) then {_fGrps= _fGrps - 1;};			
														{deleteVehicle _x} forEach (_crew);
															if (!(vehicle player == _vehicle)) then {{deleteVehicle _x} forEach[_vehicle];};													
																	{deleteVehicle _x} foreach units _grp;deleteGroup _grp;
																	if (!isnil "_cargoGrp") then {
																	{deleteVehicle _x} foreach units _cargoGrp;deleteGroup _cargoGrp;};
																	
						}foreach _fGrp;};	
						
_eosAct=false;
if (_debug) then {hint "Zone Cached";};
};
	if (triggeractivated _clear and triggeractivated _taken and !_civZone)exitwith 
			{// IF ZONE CAPTURED BEGIN CHECKING FOR ENEMIES
				_cGrps=0;_aGrps=0;_bGrps=0;_dGrps=0;_eGrps=0;_fGrps=0;		
				while {triggeractivated _eosActivated AND !(getmarkercolor _mkr == "colorblack")} do 
						{
							if (!triggeractivated _clear) then
							{
								_mkr setmarkercolor hostileColor;
								_mkr setmarkerAlpha _mAH;
								if (_debug) then {hint "Zone Lost";};
										}else{
											_mkr setmarkercolor VictoryColor;
											_mkr setmarkerAlpha _mAN;
											if (_debug) then {hint "Zone Captured";};
											};
				sleep 1;};
// PLAYER LEFT ZONE				
_eosAct=false;		
			};sleep 0.5;};

deletevehicle _clear;deletevehicle _taken;	
	
if (!(getmarkercolor _mkr == "colorblack")) then {	
	null = [_mkr,[_aGrps,_aSize],[_bGrps,_bSize],[_cGrps,_cSize],[_dGrps,_eGrps,_fGrps,_fSize],_settings,true] execVM "eos\core\eos_core.sqf";
	}else{_Mkr setmarkeralpha 0;};
	};

 

eos/functions SHK_buildingpos.sqf

  Reveal hidden contents



// Infantry Occupy House
// by Zenophon
// Released under Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
// http://creativecommons.org/licenses/by-nc/4.0/

// Teleports the units to random windows of the building(s) within the distance
// Faces units in the right direction and orders them to stand up or crouch on a roof
// Units will only fill the building to as many positions as there are windows
// Multiple buildings can be filled either evenly or to the limit of each sequentially
// Usage : Call, execVM
// Params: 1. Array, the building(s) nearest this position is used
//         2. Array of objects, the units that will garrison the building(s)
//  (opt.) 3. Scalar, radius in which to fill building(s), -1 for only nearest building, (default: -1)
//  (opt.) 4. Boolean, true to put units on the roof, false for only inside, (default: false)
//  (opt.) 5. Boolean, true to fill all buildings in radius evenly, false for one by one, (default: false)
//  (opt.) 6. Boolean, true to fill from the top of the building down, (default: false)
//  (opt.) 7. Boolean, true to order AI units to move to the position instead of teleporting, (default: false)
// Return: Array of objects, the units that were not garrisoned

#define I(X) X = X + 1;
#define EVAL(X) (X call _comparator)
#define EYE_HEIGHT 1.53
#define CHECK_DISTANCE 5
#define FOV_ANGLE 10
#define ROOF_CHECK 4
#define ROOF_EDGE 2

private ["_center", "_units", "_buildingRadius", "_putOnRoof", "_fillEvenly", "_Zen_ExtendPosition", "_buildingsArray", "_buildingPosArray", "_buildingPositions", "_posArray", "_unitIndex", "_j", "_building", "_posArray", "_randomIndex", "_housePos", "_startAngle", "_i", "_checkPos", "_hitCount", "_isRoof", "_edge", "_k", "_unUsedUnits", "_array", "_sortHeight", "_Zen_InsertionSort", "_Zen_ArrayShuffle", "_doMove"];

_center = _this param [0, [0,0,0], [[]], 3];
_units = _this param [1, [objNull], [[]]];
_buildingRadius = _this param [2, -1, [0]];
_putOnRoof = _this param [3, false, [true]];
_fillEvenly = _this param [4, false, [true]];
_sortHeight = _this param [5, false, [true]];
_doMove = _this param [6, false, [true]];

if (_center isEqualTo [0,0,0]) exitWith {
    player sideChat str "Zen_Occupy House Error : Invalid position given.";
    diag_log "Zen_Occupy House Error : Invalid position given.";
    ([])
};

if ((count _units == 0) || {isNull (_units select 0)}) exitWith {
    player sideChat str "Zen_Occupy House Error : No units given.";
    diag_log "Zen_Occupy House Error : No units given.";
    ([])
};

_Zen_ExtendPosition = {
    private ["_center", "_dist", "_phi"];

    _center = _this select 0;
    _dist = _this select 1;
    _phi = _this select 2;

    ([(_center select 0) + (_dist * (cos _phi)),(_center select 1) + (_dist * (sin _phi)), (_this select 3)])
};

_Zen_InsertionSort = {
    private ["_i", "_j", "_count", "_array", "_element", "_value", "_comparator"];

    _array = _this select 0;
    _comparator = _this select 1;
    _count = count _array - 1;

    if (count _array == 0) exitWith {};
    for "_i" from 1 to _count step 1 do {
        scopeName "forI";
        _element = _array select _i;
        _value = EVAL(_element);

        for [{_j = _i}, {_j >= 1}, {_j = _j - 1}] do {
            if (_value > EVAL(_array select (_j - 1))) then {
                breakTo "forI";
            };
            _array set [_j, _array select (_j - 1)];
        };

        _array set [_j, _element];
    };
    if (true) exitWith {};
};

_Zen_ArrayShuffle = {
    private ["_array", "_j", "_i", "_temp"];
    _array = _this select 0;

    if (count _array > 1) then {
        for "_i" from 0 to (count _array - 1) do {
                _j = _i + floor random ((count _array) - _i);
                _temp = _array select _i;
                _array set [_i, (_array select _j)];
                _array set [_j, _temp];
        };
    };
    if (true) exitWith {};
};

if (_buildingRadius < 0) then {
    _buildingsArray = [nearestBuilding _center];
} else {
    _buildingsArray0 = nearestObjects [_center, ["house"], _buildingRadius];
    _buildingsArray1 = nearestObjects [_center, ["building"], _buildingRadius];
    _buildingsArray = _buildingsArray0 arrayIntersect _buildingsArray1;
};

if (count _buildingsArray == 0) exitWith {
    player sideChat str "Zen_Occupy House Error : No buildings found.";
    diag_log "Zen_Occupy House Error : No buildings found.";
    ([])
};

_buildingPosArray = [];
0 = [_buildingsArray] call _Zen_ArrayShuffle;
{
    _posArray = [];
    for "_i" from 0 to 1000 do {
        if ((_x buildingPos _i) isEqualTo [0,0,0]) exitWith {};
        _posArray pushBack (_x buildingPos _i);
    };

    _buildingPosArray pushBack _posArray;
} forEach _buildingsArray;

if (_sortHeight) then {
    {
        0 = [_x, {-1 * (_this select 2)}] call _Zen_InsertionSort;
    } forEach _buildingPosArray;
} else {
    {
        0 = [_x] call _Zen_ArrayShuffle;
    } forEach _buildingPosArray;
};

_unitIndex = 0;
for [{_j = 0}, {(_unitIndex < count _units) && {(count _buildingPosArray > 0)}}, {I(_j)}] do {
    scopeName "for";

    _building = _buildingsArray select (_j % (count _buildingsArray));
    _posArray = _buildingPosArray select (_j % (count _buildingPosArray));

    if (count _posArray == 0) then {
        _buildingsArray deleteAt (_j % (count _buildingsArray));
        _buildingPosArray deleteAt (_j % (count _buildingPosArray));
    };

    while {(count _posArray) > 0} do {
        scopeName "while";
        if (_unitIndex >= count _units) exitWith {};

        _housePos = _posArray select 0;
        _posArray deleteAt 0;
        _housePos = [(_housePos select 0), (_housePos select 1), (_housePos select 2) + (getTerrainHeightASL _housePos) + EYE_HEIGHT];

        _startAngle = (round random 10) * (round random 36);
        for "_i" from _startAngle to (_startAngle + 350) step 10 do {
            _checkPos = [_housePos, CHECK_DISTANCE, (90 - _i), (_housePos select 2)] call _Zen_ExtendPosition;
            if !(lineIntersects [_checkPos, [_checkPos select 0, _checkPos select 1, (_checkPos select 2) + 25], objNull, objNull]) then {
                if !(lineIntersects [_housePos, _checkPos, objNull, objNull]) then {
                    _checkPos = [_housePos, CHECK_DISTANCE, (90 - _i), (_housePos select 2) + (CHECK_DISTANCE * tan FOV_ANGLE)] call _Zen_ExtendPosition;
                    if !(lineIntersects [_housePos, _checkPos, objNull, objNull]) then {
                        _hitCount = 0;
                        for "_k" from 30 to 360 step 30 do {
                            _checkPos = [_housePos, 20, (90 - _k), (_housePos select 2)] call _Zen_ExtendPosition;
                            if (lineIntersects [_housePos, _checkPos, objNull, objNull]) then {
                                I(_hitCount)
                            };

                            if (_hitCount >= ROOF_CHECK) exitWith {};
                        };

                        _isRoof = (_hitCount < ROOF_CHECK) && {!(lineIntersects [_housePos, [_housePos select 0, _housePos select 1, (_housePos select 2) + 25], objNull, objNull])};
                        if (!(_isRoof) || {((_isRoof) && {(_putOnRoof)})}) then {
                            if (_isRoof) then {
                                _edge = false;
                                for "_k" from 30 to 360 step 30 do {
                                    _checkPos = [_housePos, ROOF_EDGE, (90 - _k), (_housePos select 2)] call _Zen_ExtendPosition;
                                    _edge = !(lineIntersects [_checkPos, [(_checkPos select 0), (_checkPos select 1), (_checkPos select 2) - EYE_HEIGHT - 1], objNull, objNull]);

                                    if (_edge) exitWith {
                                        _i = _k;
                                    };
                                };
                            };

                            if (!(_isRoof) || {_edge}) then {
                                (_units select _unitIndex) doWatch ([_housePos, CHECK_DISTANCE, (90 - _i), (_housePos select 2) - (getTerrainHeightASL _housePos)] call _Zen_ExtendPosition);

                                (_units select _unitIndex) disableAI "TARGET";
                                if (_doMove) then {
                                    (_units select _unitIndex) doMove ASLToATL ([(_housePos select 0), (_housePos select 1), (_housePos select 2) - EYE_HEIGHT]);
                                } else {
                                    (_units select _unitIndex) setPosASL [(_housePos select 0), (_housePos select 1), (_housePos select 2) - EYE_HEIGHT];
                                    (_units select _unitIndex) setDir _i;

                                    doStop (_units select _unitIndex);
                                    (_units select _unitIndex) forceSpeed 0;
                                };

                               //** JBOY_UpDown by JohnnyBoy //*/
                                #define JBOY_UpDown \
                                    if ((_this select 0) getVariable ["FIREDLOCKOUT", false]) exitWith {}; \
                                    if (!isServer)  exitWith {}; \
                                    _dude = _this select 0; \
                                    _stances = _this select 1; \
                                    _ehid = (_dude getVariable "EHID"); \
                                    _dude setVariable ["FIREDLOCKOUT", true]; \
                                    while {alive _dude} do { \
                                        if ((unitPos _dude) == (_stances select 0)) then { \
                                            _dude setUnitPos (_stances select 1); \
                                        } else { \
                                            _dude setUnitPos (_stances select 0); \
                                        }; \
                                        sleep 5 + (random 2); \
                                    }; \
									_dude removeEventHandler ["FiredNear",_ehid]; 
								
                                    if (_isRoof) then {
                                    	(_units select _unitIndex) setUnitPos "MIDDLE";
                                       _eh = (_units select _unitIndex) addEventHandler ["FiredNear",{[(_this select 0),["DOWN","MIDDLE"]] spawn {JBOY_UpDown};}];
                                    	(_units select _unitIndex) setVariable ["EHID", _eh];
                                       
                                    } else {
                                    	(_units select _unitIndex) setUnitPos "UP";
                                       _eh = (_units select _unitIndex) addEventHandler ["FiredNear",{[(_this select 0),["UP","MIDDLE"]] spawn {JBOY_UpDown};}];
                                       (_units select _unitIndex) setVariable ["EHID", _eh];
                                      
                                    }; 
								

                                I(_unitIndex)
                                if (_fillEvenly) then {
                                    breakTo "for";
                                } else {
                                    breakTo "while";
                                };
                            };
                        };
                    };
                };
            };
        };
    };
};

if (_doMove) then {
    0 = [_units, _unitIndex] spawn {
        _units = _this select 0;
        _unitIndex = _this select 1;

        _usedUnits = [];
        for "_i" from 0 to (_unitIndex - 1) do {
            _usedUnits pushBack (_units select _i);
        };

        while {count _usedUnits > 0} do {
            sleep 1;
            _toRemove =  [];
            {
                if (unitReady _x) then {
                    doStop _x;
                    _x forceSpeed 0;
                    _toRemove pushBack _forEachIndex;
                };
            } forEach _usedUnits;

            {
                _usedUnits deleteAt (_x - _forEachIndex);
            } forEach _toRemove;
        };
        if (true) exitWith {};
    };
};

_unUsedUnits = [];
for "_i" from _unitIndex to (count _units - 1) step 1 do {
    _unUsedUnits pushBack (_units select _i);
};

(_unUsedUnits)

// Changelog
// 7/21/15
    // 1. Added: Error reporting for invalid position and unit array arguments
    // 1. Added: Check and error report if no buildings are found
    // 3. Improved: Parameters 3, 4, and 5 are now optional and check for the correct type
    // 4. Improved: Parameters 6 and 7 check for the correct type
    // 5. Improved: AI should now stay in place better (thanks to JohnnyBoy)

// 7/6/15
    // 1. Added: AI now take cover when fired upon (credit to JohnnyBoy)
    // 2. Added: Parameter to order the AI to move to their position
    // 3. Improved: The order of buildings filled is now random
    // 4. Improved: A few minor optimizations

// 6/30/15
    // 1. Added: Parameter to fill buildings from top to bottom
    // 2. Improved: Optimized

// 7/31/14
    // 1. Added: Parameter to cycle through each building in the radius, giving units to each one
    // 2. Improved: Units on roof are only placed at the edge, and face the edge
    // 3. Improved: Optimized roof check
    // 4. Improved: General script cleanup

// 7/28/14
    // 1. Fixed: Units facing the wrong window
    // 2. Added: Parameter for distance to select multiple buildings
    // 3. Added: Parameter for units being on a roof
    // 4. Improved: Now checks that unit has a good FOV from the windows
    // 5. Improved: Units can no longer face a windows greater than 5 meters away
    // 6. Improved: Units on a roof now crouch
    // 7. Tweaked: Height of human eye to the exact value in ArmA

// 7/24/14
    // Initial Release

// Known Issues
    // None

 

 

enable dynamic simulation for markers more then 500m by 500m. I like this fillhouse script a little better

This one? i added a call to a script to see if marker is bigger then 500m by 500m than enable dynamic simulation for each unit. i also switched out the fillhouse to a much better IMHO, each file must be replaced for it to work

Share this post


Link to post
Share on other sites

Wow awesome to see someone still making tweaks to this great script.
I've just started getting back to using EOS and one thing I think is missing is the ability to scale dependant on the number of players.

So if you have 10 players on the server you'll see more enemies than if you only had 2 on the server. I suppose you could use the same principal but instead of adjusting via marker size, adjust via count of allplayers?

 

 

Share this post


Link to post
Share on other sites
On 8/11/2019 at 5:18 PM, JD Wang said:

So if you have 10 players on the server you'll see more enemies than if you only had 2 on the server. I suppose you could use the same principal but instead of adjusting via marker size, adjust via count of allplayers?

something like this

Spoiler

EOS_Spawn = compile preprocessfilelinenumbers "eos\core\eos_launch.sqf";Bastion_Spawn=compile preprocessfilelinenumbers "eos\core\b_launch.sqf";null=[] execVM "eos\core\spawn_fnc.sqf";onplayerConnected {[] execVM "eos\Functions\EOS_Markers.sqf";}; 
VictoryColor="colorGreen"; // Colour of marker after completion 
hostileColor="colorRed"; // Default colour when enemies active 
bastionColor="colorOrange"; // Colour for bastion marker 
EOS_DAMAGE_MULTIPLIER=1; // 1 is default 
EOS_KILLCOUNTER=true;  // Counts killed units 
/* 
UNIT SIZE PER GROUP
 0 = 1
 1 = 2,4
 2 = 4,8
 3 = 8,12
 4 = 12,16
 5 = 16,20
 */
 _pcnt = {isPlayer _x} count playableUnits;
{ 
if (_x find "EOS_MARKER" > -1) then  
{ 
_actd = 0;
_mrkx = getMarkerSize _x#0;
_mrky = getMarkerSize _x#1;
_mkrSz=(_mrkx) + (_mrky);
if ((_mrkx)>(_mrky)) then [{_actd = _mrkx;},{_actd = _mrky;}];
_xcargo=3; //max units in cargo
_maxVh=3;  //max amount of vehicles
_maxGp=10; //max amount of groups //if multiplayer _maxGp is min (# of groups) _mxSz is max
_maxUt=2;  //max amount of units per group 
_minUt=0;  //min amount of units per group
_mxPl=32;  //max player server slots
_mxSz=30;  //max amount of groups in server. triggers bigger then 500m+500m will increase this number unless (_grps) clipping is set to true 
if (_pcnt > 1) then {_maxGp = round(linearConversion [0,_mxPl,_pcnt,_maxGp,_mxSz,true])};
_grps =  round(linearConversion [0,1000,_mkrSz,1,_maxGp,false]); // clipping=false. _grpS will increase proportionally to size of marker, even when exceeding 500+500 _mkrSz 
_vehs =  round(linearConversion [0,1000,_mkrSz,0,_maxVh,false]); // clipping=false. _vehs will increase proportionally to size of marker, even when exceeding 500+500 _mkrSz  
_vcarg = round(linearConversion [0,1000,_mkrSz,0,_xcargo,true]); // clipping=true.
_grpSz = round(linearConversion [0,1000,_mkrSz,_minUt,_maxUt,true]); // clipping=true. 
_prob =  round(linearConversion [0,1000,_mkrSz,0,100,true]); // clipping=true.
[[_x],[_grps,_grpSz],[_grps,_grpSz],[_vehs,_vcarg,_prob],[_vehs,_prob],[_vehs],[_vehs,_vcarg,_prob],[0,0,_actd,EAST,FALSE]] call EOS_Spawn; 
}; 
}foreach allmapmarkers;

 

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Something exactly like that 🙂
Thank you

Share this post


Link to post
Share on other sites
7 hours ago, JD Wang said:

Something exactly like that 🙂
Thank you

i don't have a server to test if it fully works. only thing i could test is artificialy increasing _Pcnt which seemed to work. And you are welcome. I'm ou-:thud:

Share this post


Link to post
Share on other sites

Hey together,

i'm trying to remove NV Googles from the spawning units. How can i do this?

Share this post


Link to post
Share on other sites
On 8/13/2019 at 7:53 AM, Kozaka said:

Hey together,

i'm trying to remove NV Googles from the spawning units. How can i do this?


Here's an earlier comment that should help 

 

Share this post


Link to post
Share on other sites
On 8/12/2019 at 8:53 PM, Kozaka said:

i'm trying to remove NV Googles from the spawning units. How can i do this?

/*
	\eos\functions\setSkill.sqf
	Below "ADD CUSTOM SCRIPTS TO UNIT HERE"
	Place the following;
*/

_unit unlinkItem (hmd _unit);

 

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

×