Jump to content

sabot10.5mm

Member
  • Content Count

    125
  • Joined

  • Last visited

  • Medals

Posts posted by sabot10.5mm


  1. getting time to completion of 138 ms. i will post here all revisions until i get tired of it  

    0.1

    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" ));

     

     


  2. 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

     


  3. 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


  4. Spoiler

    onPlayerKilled.sqf

    
    private ["_plyr","_kilr"];
    
    _plyr = _this select 0;
    _kilr = _this select 1;
    
    
    
    //If you want to respawn at a marker...call the script like this...
    nul = [_plyr,_kilr,"wrespawn"] execVM "playerKilled.sqf";
    
    
    //If you want to respawn as a playable AI...call the script like this...
    //nul = [_plyr,_kilr] execVM "playerKilled.sqf";

     

    playerKilled.sqf

    
    private ["_plyr","_kilr","_type","_group","_dist","_camera","_found","_rand","_unit"];
    
    _plyr = _this select 0;
    _kilr = _this select 1;
    _mrkr = if (count _this >2) then {_this select 2};
    
    if (isNil "_kilr") then {_kilr = objNull};
    
    //grab some stuff we need later
    _type = typeOf _plyr;
    _group = group _plyr;
    _dist = _plyr distance _kilr;
    
    if (count _this > 2) then {
    //if (not (isNil _mrkr)) then {
    	//create the new unit.... same group
    	_unit = _group createUnit [_type, (getMarkerPos _mrkr), [], 1, "none"];
    	sleep 1;
    	addSwitchableUnit _unit;
    	selectPlayer _unit;
    	_unit setRank "COLONEL";
    	waitUntil {_unit == player};
    	_found = true;
        _oldUnit = _plyr;
        _oldGroup = group _oldUnit;
        //We dont care if he was not the leader
        if ((leader _oldGroup) == _oldUnit) then {
    		_oldGroup selectLeader _unit;
    		waitUntil {(leader _oldGroup) == _unit};
            _handle = [_oldUnit, _oldGroup, _unit] spawn {
                _oldUnit = _this select 0;
                _oldGroup = _this select 1;
    			_unit = _this select 2;
                _oldProviders = _oldUnit getVariable ["BIS_SUPP_allProviderModules",[]];
                _HQ = _oldUnit getVariable ["BIS_SUPP_HQ",nil];
                //Wait for a new leader to be assigned 
                _leader = _unit;
    		if (isNil {_unit getVariable ["BIS_SUPP_HQ",nil]}) then {
                if ((count _oldProviders) > 0) then {
                  {
                        _providerModule = _x;
                        {
                             if (typeOf _x == "SupportRequester" && _oldUnit in (synchronizedObjects _x)) then {
                                  [_leader, _x, _providerModule] call BIS_fnc_addSupportLink;
                             };
                        }forEach synchronizedObjects _providerModule;
                  }forEach _oldProviders;
                };
               	_unit setVariable ["BIS_SUPP_transmitting", false];
    			_unit kbAddTopic ["BIS_SUPP_protocol", "A3\Modules_F\supports\kb\protocol.bikb", "A3\Modules_F\supports\kb\protocol.fsm", {call compile preprocessFileLineNumbers "A3\Modules_F\supports\kb\protocol.sqf"}];
    			_unit setVariable ["BIS_SUPP_HQ", _HQ];
    		};
    		   
                {
                  _used = _oldUnit getVariable [format ["BIS_SUPP_used_%1",_x], 0];
                  _leader setVariable [format ["BIS_SUPP_used_%1", _x], _used, true]
                } forEach [
                  "Artillery",
                  "CAS_Heli",
                  "CAS_Bombing",
                  "UAV",
                  "Drop",
                  "Transport"
                ];
            };
          
    
         
    	};	 
       
            
    } else {
    	//try to find a random playable unit
    	while {(not (_found)) and ((count switchableunits) >=1)} do {
    		_unit = switchableunits select (floor (random (count switchableunits)));
    		if (alive _unit) then {
    			_found = true;
    			selectplayer _unit;
    		};
    		sleep 1;
    	};
    };
    BIS_DeathBlur ppEffectAdjust [0.0];
    BIS_DeathBlur ppEffectCommit 0.0;

     

    onPlayerKilled.sqf Executed when player is killed in singleplayer or in multiplayer mission.

    • Like 1

  5.  this script relieves all playable units, saves them to a variable and sorts by faction (cfgfactionclass >>displayName). my question is about navigating configfiles,  most notably navigating and filtering configs. example say you want to filter out all of the unwanted "man" units like "range master", and "survivor" est. is there a more logical approach to this instead of saying is _unit in [array]? also saving units to variables to be used later. my approach looks weird anybody with the knowhow to guide me in the right direction

     

    _cfg = "getnumber( _x >> 'scope' ) isEqualTo 2" configClasses (configFile >> "Cfgvehicles");
    for "_i" from 0 to ((count _cfg)-1) do {
    	if (isClass ((_cfg select _i) )) then {
    		_cfgNam = configName (_cfg select _i);	
    		_getside = getnumber (configfile >> "Cfgvehicles" >> _cfgNam>> "side");	
    		_getfaction = gettext (configfile >> "Cfgvehicles" >> _cfgNam >> "faction");
    		_getfac = gettext (configfile >> "cfgfactionclasses" >> _getfaction>> "displayName");
    		_getSolClas = gettext (configfile >> "Cfgvehicles" >> _cfgNam>> "displayName");
    		_getvehcat = gettext (configfile >> "Cfgvehicles" >> _cfgNam>> "editorSubcategory");
    		hint str _getvehcat;
    		if !(_getSolClas in ["Crewman","Officer","Competitor","Pilot","Helicopter Crew","UAV Operator","Survivor","Rifleman (Unarmed)","Assault Diver","Diver Team Leader","Diver Explosive Specialist"]) then {
    		switch _getvehcat do {
    		case ("EdSubcat_Personnel"): {call compile format["missionNamespace setvariable ['man_%1', (missionNamespace getVariable ['man_%1',[]]) + [_cfgNam]];", toupper _getfac];};
    		case ("EdSubcat_Cars"): {call compile format["missionNamespace setvariable ['car_%1', (missionNamespace getVariable ['car_%1',[]]) + [_cfgNam]];", toupper _getfac];};
    		case ("EdSubcat_APCs"): {call compile format["missionNamespace setvariable ['apc_%1', (missionNamespace getVariable ['apc_%1',[]]) + [_cfgNam]];", toupper _getfac];};
    		case ("EdSubcat_Tanks"): {call compile format["missionNamespace setvariable ['tank_%1', (missionNamespace getVariable ['tank_%1',[]]) + [_cfgNam]];", toupper _getfac];};};
    		};
    		};};

     missionNamespace getVariable "man_NATO";


  6. 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

  7. I was thinking more of a queue for repeating scripts, most notably would be applying a loop script to every unit. ive did some tinkering and made each script (+ 1 to a queue variable)  it does not matter to me how this looks, 

    missionNamespace setVariable ["queue", 0];
    allunits apply {
    while {alive _x} do {
    _queue = missionNamespace getVariable "queue";
    if (_queue >= 10) exitWith {};
    missionNamespace setVariable ["queue", (missionNamespace getVariable "queue")+1];
    
    while {what ever is true} do {what ever is here does not matter. its just a concept};
    missionNamespace setVariable ["queue", (missionNamespace getVariable "queue")-1];
    };
    };

     


  8. This is just a concept i had in my head. What i had in mind is say you want to run a script foreach unit, and only want a limited amount of scrips to run at any given time; would it be a good idea to queue 5 to run and finish before the next 5 can run? This script probably wont work, since i cant debug from my phone

    missionNamespace setVariable ["queue", 0];
    allunits apply {
    while {alive _x} do {
    _queue = missionNamespace getVariable "queue";
    if (_queue >= 10) exitWith {};
    missionNamespace setVariable ["queue", (missionNamespace getVariable "queue")+1];
    
    while {what ever is true} do {what ever is here does not matter. its just a concept};
    missionNamespace setVariable ["queue", (missionNamespace getVariable "queue")-1];
    };
    };

     


  9. 4 hours ago, killzone_kid said:

     

     

    since you are checking multiple weapons it is unclear if you want results in an array or a single result for the 1st found weapon only.

    When i wrote  that, i didnt know if i wanted to return an array of all empty or just one. Sorry for confusion. To answer that i just want one returned.

    5 mins after writing the thread, i did away with apply. 

    Spoiler

    params ["_staticWp"];

    _crew = fullCrew [_staticWp, "gunner", true];

    if (isNull ((_crew#0)#0)) exitwith {true};

    if !(alive ((_crew#0)#0)) exitwith {true}; 

    false;

     

    !alive gunner _staticWp

     Easier to read. There are many different ways of writing code. then there are better ways


  10. _weaps = nearestObjects [(getPos player),["StaticWeapon", "StaticATWeapon","StaticCannon"],50]; 
    _crew = fullCrew [_weaps select 0, "gunner", true];  
    _crew apply {if (isNull (_x select 0)) exitWith {true}; 
       if !(alive (_x select 0)) exitwith {true};
       false; 
       };

    I made this with the intention to find static weapons. it works but I was wondering, when returning false it returns false as an array like [false]. im sure I am missing something here, but why is it returning an array with false in it? also 1 side note. why does fullcrew return dead crew members?


  11. On 7/8/2019 at 12:12 PM, Blitzen88 said:

    Would one method be more efficient (performance wise) than the other?

    why not benchmark the scripts using the performance button in the console. its the speedometer looking icon.

     

    Quote

     I recently found a script which applies AI skill settings by loops ing/re-running every 30 seconds or so. 

     Just set the skill and get/setloadout when creating the unit. No need to loop set skill.

     

     

    Quote

    I like to apply the same skill settings for all of the units in a mission but issues arise when AI units are spawned after the mission starts.

     

    Waituntil {sleep 5; count (allunits) >= 8};
    {_x setskill 0.5;}foreach allunits select {side _x == east /* != playerside !=player */}; 

     

    or just setskill when each unit is created.

    allunits select {side _x != player} apply {_x addEventHandler ["---", { params ["---", "---"]; _unit setskill 0.5;}];};

     


  12. 3 hours ago, sabot10.5mm said:

    you could use buildingexit to find all the door to breach. 

    
    _eh = nearestObjects [player, ["house"], 20];
    _he = _eh select 0 buildingExit 0;
    arrow = "Sign_Arrow_F" createVehicle _he;

    use this in the debug console to find the doors

    better yet 

    _eh = nearestObjects [player, ["house"], 200];  
    {{arrow = "Sign_Arrow_F" createVehicle [0,0,0];  arrow setPos _x}foreach  (_x buildingPos -1);  
    _he = _x buildingExit 0;  arrow = "Sign_Arrow_F" createVehicle _he;  } foreach _eh;

     


  13. 12 hours ago, johnnyboy said:

    Hey buddy.  That is really hard actually.  Its difficult to get that level of control over these whacky ai dudes.

    you could use buildingexit to find all the door to breach. 

    _eh = nearestObjects [player, ["house"], 20];
    _he = _eh select 0 buildingExit 0;
    arrow = "Sign_Arrow_F" createVehicle _he;

    use this in the debug console to find the doors

    • Like 1
    • Thanks 1

  14. Spoiler
    
    _debugText = "";
    allUnits select {_x != player} apply {_x addeventhandler ["FiredNear",{ 
    params ["_unit", "_firer", "_distance", "_weapon", "_muzzle", "_mode", "_ammo", "_gunner"];
    
    _stances = ["Up","Middle"];
    _unitOriStan = unitPos _unit;
    _debugText = "";
    if ((_unit getVariable ["FIREDLOCKOUT",[false,-1]] select 0)) exitWith {};
    hint "nonexit";
    _unit setVariable ["FIREDLOCKOUT",[true, time + random [1, 10, 3]],true]; 
    [_stances, _unit, _unitOriStan, _distance,_debugText ] spawn 
    	{
    
    		params ["_stances","_unit", "_unitOriStan", "_distance", "_debugText"];
    		
    		while {(_unit getVariable ["FIREDLOCKOUT",[true,-1]] select 0) && alive _unit} do
    		{
    			
    			_debugText = _debugText + format ["%1 in stance for %2 secs\n", _unit,(_unit getVariable ["FIREDLOCKOUT",[true,-1]] select 1) - time];
    			waitUntil {time > (_unit getVariable ["FIREDLOCKOUT",[true,(time + 1)]]) select 1};
    				
    				if ((unitpos _unit) == (_stances select 0)) then
    				{
    					_unit setUnitPos (_stances select 1);
    				} else
    				{
    					_unit setUnitPos (_stances select 0);
    				};
    
    
    				if (isNull (_unit findNearestEnemy _unit)) exitwith {hint "exit"; _unit setVariable ["FIREDLOCKOUT",[false, -1],true];};
    				if !(alive _unit) exitWith {_unit setVariable ["FIREDLOCKOUT",[false, -1],true];};
    				_unit setVariable ["FIREDLOCKOUT",[true,time + random [1, 10, 3]],true];
    				hintsilent str _debugText;
    			
    		};
    		
    		_unit setUnitPos _unitOriStan;
    		
    	};
    	
    }];};

     

     

    used _unit variables to store time between stance changes and firednear EH timeouts to avoid adding and removing EHs..

     

     

    this one finds objects close to unit and changes stance

    Spoiler
    
    params [["_side", east,[east]], ["_staticMG", false], ["_debug", false]];
    missionNamespace setVariable ["staticmg", _staticMG];
    missionNamespace setVariable ["debug", _debug];
    allUnits select {side _x == _side && _x != player} apply {_x addeventhandler ["FiredNear",{ 
    params ["_unit", "_firer", "_distance", "_weapon", "_muzzle", "_mode", "_ammo", "_gunner"];
    _stances = ["Up","Middle"];
    _staticMG = missionNamespace getVariable ["staticmg", false];
    _debug = missionNamespace getVariable ["debug", false];
    if (_unit getVariable ["FIREDLOCKOUT", false]) exitWith {};
    _unit setVariable ["FIREDLOCKOUT", true, false];
    _unit setVariable ["COVERTIMEOUT", (time + 60), false]; 
    
    [_stances, _unit, _staticMG, _debug] spawn 
    	{
    
    		params ["_stances","_unit", "_staticMG", "_debug"];
    		_Nearobject = nearestObjects [_unit, ["strategic", "house", "Rocks_base_F"], 4];
    		if (_staticMG && {_unit == (units _unit select 0)}) then {[_unit,50] execvm "staticgun.sqf";};
    		if (count _Nearobject == 0) exitWith {sleep 5; _unit setVariable ["FIREDLOCKOUT", false, false];}; 
    		if !([getPosATL  _unit, getDir _unit, 30, getPosATL (_Nearobject select 0)] call BIS_fnc_inAngleSector) exitwith {sleep 5; _unit setVariable ["FIREDLOCKOUT", false, false];}; 
    		while {_unit getVariable ["FIREDLOCKOUT", true]} do
    		{	
    			_unit disableAI "PATH";
    			_unit setVariable ["COVERTIME", floor(random[1, 4, 20]), false];
    		
    			waitUntil {sleep(_unit getVariable ["COVERTIME", 4]); true;}; 
    			_target = assignedTarget _unit;
    			switch (unitPos _unit) do { 
    				case "Auto" : {_unit setUnitPos (_stances select 0);};
    				case "Up" : {_unit setUnitPos (_stances select 1); if (floor(random (5))> 3) then {_unit doSuppressiveFire _target;};};
    				case "Middle" : {_unit setUnitPos (_stances select 0);};  
    				case "Down" : {_unit setUnitPos (_stances select 1);};};
    				if (_debug) then {diag_log format ["%1 in %4 stance for %2 secs. Nearobject %3", _unit,(_unit getVariable ["COVERTIME", -1]), _Nearobject, unitPos _unit];};
    				if !(alive _unit) exitwith {_unit removeEventHandler ["FiredNear", 0]; if (_debug) then {diag_log format ["removing EventHandler from killed %1", _unit];};};
    				if (isNull (_unit findNearestEnemy _unit)) then {_unit setVariable ["FIREDLOCKOUT",false, false]; if (_debug) then {diag_log format ["%1 no enemy sighted", _unit];};};
    				if (time > (_unit getVariable ["COVERTIMEOUT", -1]) && {!(isNull _target)}) then 
    				{
    					if !((_unit getRelDir _target) < 30 or (_unit getRelDir _target) > 315) then {_unit setVariable ["FIREDLOCKOUT", false, false]; if (_debug) then {diag_log format ["%1 turned %2 from target enabling 'PATH'", _unit, _unit getRelDir _target];};};
    				};
    		};
    		
    	_unit setUnitPos "AUTO";
    	_unit enableAI "PATH";
    	};
    	
    }];};

    staticgun.sqf

    
    params ["_unit","_searchDist"];
    if (isNil "_searchDist") then {_searchDist = 100};
    
    
    private _weaps = nearestObjects [(getPos _unit),["StaticWeapon", "StaticATWeapon","StaticCannon"],_searchDist];
    
    if (_weaps isEqualType []) exitWith
    {
    private _units = units _unit;
    private _manned = [];
    private _time = time + 90;
      {
        _gun = _x;
    	if !([_gun] call compile preprocessFileLineNumbers "staticempty.sqf") exitWith {hint "exit";};
        _sortedEntites = _units apply {[_gun distance2D _x,_x]};
        _sortedEntites sort True;
        if (count _sortedEntites >0) then {
          _c = _sortedEntites select 0 select 1;
    	  _manned pushback [_c,_gun];
          _units deleteAt 0;
          _c assignasturret [_gun, [0] ];
    	 [_c] allowGetIn true;
    	 [_c] orderGetIn true;
    	 _c forcespeed 100;
    	 _c setDestination [getPosATL _gun, "LEADER PLANNED", true];
    	 waitUntil {if ((_c distance _gun) < 6 or {_time < time}) exitwith {true};};
    	 _c moveInTurret [_gun,[0]];
        };
      } forEach _weaps;
     };

    staticempty.sqf

     

    
    params ["_staticWp"];
    
    _crew = fullCrew [_staticWp, "gunner", true]; 
    if (isNull ((_crew#0)#0)) exitwith {true}; 
    if !(alive ((_crew#0)#0)) exitwith {true}; 
    false;
    

     

    • Like 1

  15. On ‎2‎/‎12‎/‎2018 at 11:46 PM, Grumpy Old Man said:

     

     

    
    {
    _x addEventHandler ["Fired",{
    
    	params ["_firer"];
    	{
    	_x reveal [_firer,0.3];
    	} forEach (allUnits select {_x distance2D _firer < 200});
    	_firer removeEventHandler ["Fired",_thisEventHandler];//remove it after first shot or keep it in, up to you
    
    }];
    
    } forEach allUnits;

     

    I like this script and I'm tying to implement a reveal increment number, but I get the weirdest error code I have ever seen 

    Error Type Number,Not a Number, expected Number
    fired1 = true;
    _1=0;
    while {true} do {
        	sleep 5;
    		_1=_1+0.1;
            if (fired1) then {//hint "hi";
    			fired1 = false;
                player addEventHandler ["fired",{
    			params ["_firer"];
    			{
    			_x reveal [_firer,(0.2)+_1];
    			} forEach (allUnits select {_x distance2D _firer < 200});
    			_firer removeEventHandler ["Fired",_thisEventHandler];
    			fired1 = true;
    			}];
    			
    			
    
    };
    };

    is there a better way of doing this


  16. On 2/12/2018 at 4:52 PM, sabot10.5mm said:

    edited the eos_core.sqf to save vehicle damage and then set the damage on spawn. Works for armored vehicles only atm. Since the script spawns random vehicle types, damage array may be different type from last. Wheeled damage array vs tracked. I will try to save vehicle type before cache.  thanks for the help @Grumpy Old Man

      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","_vehdam"];
    _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;_vehdam = _d select 4;
    _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,0,[0,20],true,true] call shk_fnc_fillhouse;
                }else{
                0 = [_aGroup,_mkr] call EOS_fnc_taskpatrol;
                 };
                _aGrp set [count _aGrp,_aGroup];
                0=[_aGroup,"INFskill"] call eos_fnc_grouphandlers;
    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;
    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];  
           
    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];
        if !(isnil "_vehdam") then { 
        _vehdam params ["_hitpointNames","_hitpointSelections","_hitpointDamages"];
        {_dGroup select 0 setHitPointDamage [_hitpointNames select _forEachIndex,_x];
        if (_x > 0) then {systemchat format ["Damaged: %1",_hitpointNames select _forEachIndex]};} forEach _hitpointDamages;_vehdam deleterange [0,3];copyToClipboard str _vehdam;};
    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];
          
    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;
    _vehdam = [];
    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 {{_vehhit = getAllHitPointsDamage _x; _vehdam append _vehhit; 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,_vehdam],_settings,true] execVM "eos\core\eos_core.sqf";
     }else{_Mkr setmarkeralpha 0;};
     };

     

    modified eos to save vehicle type and vehicle damage

    eos_launch

    Spoiler

    if (isServer) then {
    private ["_HPpatrols","_HPgroupProbability","_CHgroupArray","_LVgroupArray","_HPgroupArray","_PAgroupArray","_CHgroupSize","_CHGroups","_SVehGroups","_AVgroupSize","_AVehGroups","_LVehGroups","_LVgroupSize","_PAgroupSize","_PApatrols","_HPpatrols","_HPgroupSize"];

    _JIPmkr=(_this select 0);
    _HouseInfantry=(_this select 1);
    _HPpatrols=_HouseInfantry select 0;
    _HPgroupSize=_HouseInfantry select 1;
    _HPgroupProbability=if (count _HouseInfantry > 2) then {_HouseInfantry select 2} else {100};

    _infantry=(_this select 2);
    _PApatrols=_infantry select 0;
    _PAgroupSize=_infantry select 1;
    _PAgroupProbability=if (count _infantry > 2) then {_infantry select 2} else {100};

    _LVeh=(_this select 3);
    _LVehGroups=_LVeh select 0;
    _LVgroupSize=_LVeh select 1;
    _LVgroupProbability=if (count _LVeh > 2) then {_LVeh select 2} else {100};

    _AVgrp=(_this select 4);
    _AVehGroups=_AVgrp select 0;
    _AVgroupProbability=if (count _AVgrp > 1) then {_AVgrp select 1} else {100};

    _SVgrp=(_this select 5);
    _SVehGroups=_SVgrp select 0;
    _SVgroupProbability=if (count _SVgrp > 1) then {_SVgrp select 1} else {100};

    _CHGrp=(_this select 6);
    _CHGroups=_CHGrp select 0;
    _CHgroupSize=_CHGrp select 1;
    _CHgroupProbability=if (count _CHGrp > 2) then {_CHGrp select 2} else {100};

    _settings=(_this select 7);

    if (_HPgroupProbability > floor random 100) then {
     if (_HPgroupSize==0) then {_HPgroupArray=[1,1]};
     if (_HPgroupSize==1) then {_HPgroupArray=[2,4]};
     if (_HPgroupSize==2) then {_HPgroupArray=[4,8]};
     if (_HPgroupSize==3) then {_HPgroupArray=[8,12]};
     if (_HPgroupSize==4) then {_HPgroupArray=[12,16]};
     if (_HPgroupSize==5) then {_HPgroupArray=[16,20]};
     }else{_HPpatrols=0;_HPgroupArray=[1,1];};
     
    if (_PAgroupProbability > floor random 100) then { 
     if (_PAgroupSize==0) then {_PAgroupArray=[1,1]};
     if (_PAgroupSize==1) then {_PAgroupArray=[2,4]};
     if (_PAgroupSize==2) then {_PAgroupArray=[4,8]};
     if (_PAgroupSize==3) then {_PAgroupArray=[8,12]};
     if (_PAgroupSize==4) then {_PAgroupArray=[12,16]};
     if (_PAgroupSize==5) then {_PAgroupArray=[16,20]};
     }else{_PApatrols=0;_PAgroupArray=[1,1];}; 

    if (_LVgroupProbability > floor random 100) then { 
     if (_LVgroupSize==0) then {_LVgroupArray=[0,0]};
     if (_LVgroupSize==1) then {_LVgroupArray=[2,4]};
     if (_LVgroupSize==2) then {_LVgroupArray=[4,8]};
     if (_LVgroupSize==3) then {_LVgroupArray=[8,12]};
     if (_LVgroupSize==4) then {_LVgroupArray=[12,16]};
     if (_LVgroupSize==5) then {_LVgroupArray=[16,20]};
    }else{_LVehGroups=0;_LVgroupArray=[0,0];};

    if (_AVgroupProbability > floor random 100) then {
    }else{_AVehGroups=0;};

    if (_SVgroupProbability > floor random 100) then {
    }else{_SVehGroups=0;};

    if (_CHgroupProbability > floor random 100) then {
     if (_CHgroupSize==0) then {_CHgroupArray=[0,0]};
     if (_CHgroupSize==1) then {_CHgroupArray=[2,4]};
     if (_CHgroupSize==2) then {_CHgroupArray=[4,8]};
     if (_CHgroupSize==3) then {_CHgroupArray=[8,12]};
     if (_CHgroupSize==4) then {_CHgroupArray=[12,16]};
     if (_CHgroupSize==5) then {_CHgroupArray=[16,20]};
    }else{_CHGroups=0;_CHgroupArray=[0,0]};
    _vehdam=0;_vehT=0;
    {
     _eosMarkers=server getvariable "EOSmarkers";
     if (isnil "_eosMarkers") then {_eosMarkers=[];};
      _eosMarkers set [count _eosMarkers,_x];
      server setvariable ["EOSmarkers",_eosMarkers,true];
      null = [_x,[_HPpatrols,_HPgroupArray],[_PApatrols,_PAgroupArray],[_LVehGroups,_LVgroupArray],[_AVehGroups,_SVehGroups,_CHGroups,_CHgroupArray,_vehdam,_vehT],_settings] execVM "eos\core\EOS_Core.sqf";
    }foreach _JIPmkr;
    };

     

    eos_core

    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","_vehdam"];
    _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;_vehdam=_d select 4;_vehT = _d select 5;
    _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;};
     _dGroup=nil;

    // 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,0,[0,20],true,true] call shk_fnc_fillhouse;
                }else{
                0 = [_aGroup,_mkr] call EOS_fnc_taskpatrol;
                 };
                _aGrp set [count _aGrp,_aGroup];
                0=[_aGroup,"INFskill"] call eos_fnc_grouphandlers;
    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;
    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,"CAN_COLLIDE"]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];  
           
    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;};

         if (_vehT isequaltype []) then [{_vehT1 = _veht deleteat 0;_dGroup=[_newpos,_side,_faction,_vehType,"CAN_COLLIDE",_vehT1]call EOS_fnc_spawnvehicle;},{_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];
        if (_vehT isequaltype []) then { 
        _vehdam params ["_hitpointNames","_hitpointSelections","_hitpointDamages"];
        {_dGroup select 0 setHitPointDamage [_hitpointNames select _forEachIndex,_x];
        /*if (_x > 0) then {systemchat format ["Damaged: %1",_hitpointNames select _forEachIndex]};*/} forEach _hitpointDamages;_vehdam deleterange [0,3];};
       
    if (_debug) then {player sidechat format ["Armoured:%1 - r%2",_counter,_dGrps];0= [_mkr,_counter,"Armour",(getpos leader (_dGroup select 2))] call EOS_debug};
    _dGroup=nil;
      };
     
    //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];
          
    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
    _vehT=[];
    _vehdam=[];
      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 {{_vehhit = getAllHitPointsDamage _x; _vehdam append _vehhit; _veh = typeOf _x; _vehT set[count _vehT,_veh];  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,_vehdam,_vehT],_settings,true] execVM "eos\core\eos_core.sqf";
     }else{_Mkr setmarkeralpha 0;};
     };

    eos_spawnvehicle

    Spoiler

    params[ "_position" , "_side" , "_faction" , "_type"  , ["_special","CAN_COLLIDE"] , ["_vehT1",0]];
    /*_position=(_this select 0);
    _side=(_this select 1);
    _faction=(_this select 2);
    _type=(_this select 3);
    _vehT = if (count _this > 5) then {_this select 4};
    _special = if (count _this > 6) then {_this select 5} else {"CAN_COLLIDE"};*/


    _vehicleType=[_faction,_type] call eos_fnc_getunitpool;

    if (_vehT1 isequaltype "") then {_vehT1= [_vehT1];_vehT1 set [count _vehT1,(_vehicleType select 1)];_vehicleType=_vehT1;};

     
      _grp = createGroup _side;

     _vehPositions=[(_vehicleType select 0)] call BIS_fnc_vehicleRoles;
     _vehicle = createVehicle [(_vehicleType select 0), _position, [], 0, _special];

    _vehCrew=[];

      {
     _currentPosition=_x;
     if (_currentPosition select 0 == "driver")then {
       _unit = _grp createUnit [(_vehicleType select 1), _position, [], 0, "CAN_COLLIDE"];     
       _unit assignAsDriver _vehicle;
       _unit moveInDriver _vehicle;
       _vehCrew set [count _vehCrew,_unit];
       };
     
     if (_currentPosition select 0 == "turret")then {
       _unit = _grp createUnit [(_vehicleType select 1), _position, [], 0, "CAN_COLLIDE"];
       _unit assignAsGunner _vehicle;
       _unit MoveInTurret [_vehicle,_currentPosition select 1];
       _vehCrew set [count _vehCrew,_unit];
       };
       
      }foreach _vehPositions;
     
    _return=[_vehicle,_vehCrew,_grp];

    _return

     


  17. According to larrow, you can't whitelist arsenal without first spawning arsenal with no gear and adding gear back into it.

     

     

    On 7/4/2015 at 7:38 PM, Larrow said:

    Create box and contents you want via Zeus, with the crate selected press Esc and run the code below from the debugConsole.

     

    
    _contents = [];
    _container = curatorSelected select 0 select 0;
    {
    _tmp = _container call compile format [ "%1Cargo _this", _x ];
    _unique = [];
    {
    	if !( _x in _unique ) then {
    		_unique pushBack _x;
    	};
    }forEach _tmp;
    _contents pushBack _unique;
    }forEach [ "backpack", "item", "magazine", "weapon" ];
    copyToClipboard str _contents;
     

     

    Open a txt editor and paste the exported info for safe keeping. Should look something like ..

     

    
    [["B_Mortar_01_weapon_F"],["U_B_PilotCoveralls","V_Press_F","H_Cap_red"],["HandGrenade","UGL_FlareGreen_F","30Rnd_556x45_Stanag","Laserbatteries"],["arifle_Katiba_F"]]
     

     

    Go back to the editor, place your crate, paste the code below into its init..

     

    
    _contents = [["B_Mortar_01_weapon_F"],["U_B_PilotCoveralls","V_Press_F","H_Cap_red"],["HandGrenade","UGL_FlareGreen_F","30Rnd_556x45_Stanag","Laserbatteries"],["arifle_Katiba_F"]];
    
    nul = ["AmmoboxInit",[this,false]] spawn BIS_fnc_arsenal;
    
    clearBackpackCargoGlobal this;
    clearItemCargoGlobal this;
    clearMagazineCargoGlobal this;
    clearWeaponCargoGlobal this;
    
    {
    _toAdd = _contents select _forEachIndex;
    _fnc = missionNamespace getVariable format [ "BIS_fnc_addVirtual%1Cargo", _x ];
    [this, _toAdd, true ] call _fnc;
    }forEach [ "backpack", "item", "magazine", "weapon" ];
     

    Replacing the first line, as shown, with the array you exported with the first code.

    On previewing the mission, the crate should be empty, with a Arsenal action on it, when opening the arsenal there should be only the items you added plus what ever your currently wearing available to choose from.

    Have not put it through much testing other than to make sure that it seemed to be correct. Let me know how you get on.

     


  18. edited the eos_core.sqf to save vehicle damage and then set the damage on spawn. Works for armored vehicles only atm. Since the script spawns random vehicle types, damage array may be different type from last. Wheeled damage array vs tracked. I will try to save vehicle type before cache.  thanks for the help @Grumpy Old Man

    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","_vehdam"];
    _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;_vehdam = _d select 4;
    _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,0,[0,20],true,true] call shk_fnc_fillhouse;
                }else{
                0 = [_aGroup,_mkr] call EOS_fnc_taskpatrol;
                 };
                _aGrp set [count _aGrp,_aGroup];
                0=[_aGroup,"INFskill"] call eos_fnc_grouphandlers;
    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;
    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];  
           
    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];
        if !(isnil "_vehdam") then { 
        _vehdam params ["_hitpointNames","_hitpointSelections","_hitpointDamages"];
        {_dGroup select 0 setHitPointDamage [_hitpointNames select _forEachIndex,_x];
        if (_x > 0) then {systemchat format ["Damaged: %1",_hitpointNames select _forEachIndex]};} forEach _hitpointDamages;_vehdam deleterange [0,3];copyToClipboard str _vehdam;};
    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];
          
    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;
    _vehdam = [];
    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 {{_vehhit = getAllHitPointsDamage _x; _vehdam append _vehhit; 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,_vehdam],_settings,true] execVM "eos\core\eos_core.sqf";
     }else{_Mkr setmarkeralpha 0;};
     };

     


  19. I'm trying to get the hitpoint damage when caching every vehicle, then set the damage when vehicle spawned.  script comes up with error   _hitpnt=getHitPointDamage ;_x; is it not possible to put 2 magic variables in a foreach?

     

    _dgroup select 0 is the vehicle spawned

    	if (isnil "_dGrp") then {_dGrp=[];_vehdmgrp=[];_vehdam = [];};
    	
    		_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];
    							if !(isnil "_vehdam") then {(_dGroup select 0) setHitPointDamage (_vehdam deleteat 0);};

    "_vehdam select 0"  should have all the damage to set for the command

    {_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; _hitpnt=getHitPointDamage _x; _vehdam=set[count _vehdmgrp,_hitpnt];} forEach[_vehicle];};			{deleteVehicle _x} foreach units _grp;deleteGroup _grp;
    }foreach _dGrp;

     

     

×