Jump to content
bangabob

Enemy occupation system (eos)

Recommended Posts

On 13. 10. 2017 at 8:24 AM, Mirek said:

Another maybe stupid question: If i create the bastion marker during allready running EOS mission, will it work, or do i have to initialise EOS again after spawning the marker, also if i delete the marker during mission, will the enemy waves stop spawning?

What iam trying to acomplish is: when players/blufor are detected by opfor in or around the EOS zone.

Opfpr calls for reinforcements, and they start to arive. 

I was thinking about spawning a bastion zone on top of EOS zone to accomplish that. 

so i would have 

mrk_xl = selectRandom(allMapMarkers select { _x find "xl_"== 0});
null = [[mrk_xl],[8,1],[6,3],[2,2,90],[2,40],[4,90],[1,1,25],[0,2,1000,EAST,False]] call EOS_Spawn;

and then 

_cpos01 = [getMarkerPos mrk_xl , 0, 100, 12, 0, 0.3, 0] call BIS_fnc_findSafePos;

_comm1 = "INS_WarfareBUAVterminal" createVehicle _cpos01;

and then a trigger with conditions

_trigger setTriggerActivation [ "WEST", "EAST D", false ]; 

and

alive comm1

and then somehow (no idea how, yet) i would by this trigger call: 

null = [["mrk_xl"],[0,1],[0,2],[0],[1,2],[0,0,EAST,TRUE],[0,100,120,TRUE,FALSE]] call Bastion_Spawn;

or something like that, and enemy reinforcements would start to arrive. 

 

Then i would have to find a way to stop the bastion spawn when 

!Alive _comm1

no idea yet how to do it.

Share this post


Link to post
Share on other sites

Still cant figure this out. Any ideas?

 

Would this work? :

_trigger = [ objNull, _mrk_xl ] call BIS_fnc_triggerToMarker;

_trigger setTriggerActivation [ "WEST", "EAST D", false ]; 
_trigger setTriggerStatements [
	"this && alive _comm1", 
	"null = [["mrk_xl"],[0,1],[0,2],[0],[1,2],[0,0,EAST,TRUE],[0,100,120,TRUE,FALSE]] call Bastion_Spawn;", 
	""
];

 

  • Like 1

Share this post


Link to post
Share on other sites

Wow time flies, this script could have won some sort of prize... i been half assed reading and searching through this thread but its tooo loong, i was wondering if there was a way to 'reset/restart' a zone once all units that were spawned by the zone have died, or when zone turns green... i.e. i dont want the party to stop.

  • Like 2

Share this post


Link to post
Share on other sites

Getting an error that seems to be coming from the infantry_fnc.SQF i can't seem to fix it and I'm not sure what to try, I added RHS units to the unit pool so i am not sure if that has an issue or not. The error message says  _Pool is an undefined variable in line 21, will post the SQF file with the undefined line bolded. Keep in mind I have basically zero knowledge of scripting

 

if (!isServer) exitWith {};
// SINGLE INFANTRY GROUP
private ["_grp","_unit","_pool","_pos","_faction"];

_pos=(_this select 0);
_grpSize=(_this select 1);
_faction=(_this select 2);
_side=(_this select 3);

_grpMin=_grpSize select 0;
_grpMax=_grpSize select 1;
_d=_grpMax-_grpMin;    
_r=floor(random _d);       
_grpSize=_r+_grpMin;
    
 if (surfaceiswater _pos) then {_pool=[_faction,1] call eos_fnc_getunitpool;}else{_pool=[_faction,0] call eos_fnc_getunitpool;};
 
 _grp=createGroup _side;
   
for "_x" from 1 to _grpSize do {     
  _unitType=_pool select (floor(random(count _pool)));
  _unit = _grp createUnit [_unitType, _pos, [], 6, "FORM"]; 
 };


_grp

 

Thanks for the help, super excited to start making missions with this once i can finally get it to work

Share this post


Link to post
Share on other sites

made a small script that turns on and off triggers when player isn't near since I use about 100 of them

 


[] spawn 
{			
while {true} do
{		
list1 = player nearObjects ["EmptyDetector", 500];
if (count (list1) > 0) then 
{
{
_x enableSimulation true;
} forEach list1;
};

sleep 5;
};
};

[] spawn 
{
while {true} do
{	
waituntil {sleep 5;(count (list1) == 0)};
_alltriggers = allMissionObjects "EmptyDetector";
{
_x enableSimulation false;
} forEach _alltriggers;

};
};

 

  • Like 2

Share this post


Link to post
Share on other sites

battlecarrysabot

9 hours ago, battlecarrysabot said:

made a small script that turns on and off triggers when player isn't near since I use about 100 of them

 



[] spawn 
{			
while {true} do
{		
list1 = player nearObjects ["EmptyDetector", 500];
if (count (list1) > 0) then 
{
{
_x enableSimulation true;
} forEach list1;
};

sleep 5;
};
};

[] spawn 
{
while {true} do
{	
waituntil {sleep 5;(count (list1) == 0)};
_alltriggers = allMissionObjects "EmptyDetector";
{
_x enableSimulation false;
} forEach _alltriggers;

};
};

 

Hi. If possible, put an example mission here. I will be grateful.

Share this post


Link to post
Share on other sites
1 hour ago, battlecarrysabot said:

just copy the script into a sqf file and run it null=execvm "blah.sqf"; 

Thank you for an answer. I'm just wondering how other people build their mission. Perhaps something interesting and original. They are new for me. Another time I thank for the answer.

Share this post


Link to post
Share on other sites

made small addiction since I like my uavs to activate eos

[] spawn 
{	
private "_pos","_list1","_pos1";	

while {true} do
{
list1 = {};
_pos = getpos player;			
_pos1 = getConnectedUAV player;
list1 = _pos nearObjects ["EmptyDetector", 700];
if !(isNull _pos1) then {_pos = getConnectedUAV player; _list1 = _pos nearObjects ["EmptyDetector", 1000]; list1 append _list1;};	
//systemChat format ["UAV: %1",list1];	
if (count (list1) > 0) then 
{
{
_x enableSimulation true;
} forEach list1;
};

sleep 5;
};
};

[] spawn 
{
while {true} do
{
waituntil {sleep 3;(count (list1) == 0)};
sleep 1;
//systemChat format ["UAV: hi"];	
_alltriggers = allMissionObjects "EmptyDetector";
{
_x enableSimulation false;
} forEach _alltriggers;
waituntil {sleep 3;(count (list1) > 0)};
};
};

this script allows uavs to activate eos. the code that makes it happen is this

 {_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"; };

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

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


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

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

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


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

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

// SPAWN HOUSE PATROLS
 for "_counter" from 1 to _aGrps do {
 if (isnil "_aGrp") then {_aGrp=[];};
  if (_cache) then {
    _cacheGrp=format ["HP%1",_counter];
    _units=_eosActivated getvariable _cacheGrp; 
      _aSize=[_units,_units];
      _aMin=_aSize select 0;
       if (_debug)then{player sidechat format ["ID:%1,restore - %2",_cacheGrp,_units];};
       };
        if (_aMin > 0) then {
          _aGroup=[_mPos,_aSize,_faction,_side] call EOS_fnc_spawngroup; 
          if (!surfaceiswater _mPos) then {
           0=[_mPos,units _aGroup,_mkrX,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 (_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; 
while {_eosAct} do
 {
 // IF PLAYER LEAVES THE AREA OR ZONE DEACTIVATED
 if (!triggeractivated _eosActivated || getmarkercolor _mkr == "colorblack") exitwith
  {
  if (_debug) then {if (!(getmarkercolor _mkr == "colorblack")) then {hint "Restarting Zone AND deleting units";}else{hint "EOS zone deactivated";};};  
//CACHE LIGHT VEHICLES
 if (!isnil "_cGrp") then
    {    
      { _vehicle = _x select 0;_crew = _x select 1;_grp = _x select 2;
         if (!alive _vehicle || {!alive _x} foreach _crew) then { _cGrps= _cGrps - 1;}; 
            {deleteVehicle _x} forEach (_crew);  
              if (!(vehicle player == _vehicle)) then {{deleteVehicle _x} forEach[_vehicle];};            
                   {deleteVehicle _x} foreach units _grp;deleteGroup _grp;
      }foreach _cGrp;
if (_debug) then {player sidechat format ["ID:c%1",_cGrps];};};
           
// CACHE ARMOURED VEHICLES
  if (!isnil "_dGrp") then
    {    
      { _vehicle = _x select 0;_crew = _x select 1;_grp = _x select 2;
         if (!alive _vehicle || {!alive _x} foreach _crew) then {_dGrps= _dGrps - 1;}; 
            {deleteVehicle _x} forEach (_crew);  
              if (!(vehicle player == _vehicle)) then {{deleteVehicle _x} forEach[_vehicle];};            
                   {deleteVehicle _x} foreach units _grp;deleteGroup _grp;
      }foreach _dGrp;
if (_debug) then {player sidechat format ["ID:c%1",_dGrps];};};

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

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

 

Share this post


Link to post
Share on other sites
3 minutes ago, battlecarrysabot said:

made small addiction since I like my uavs to activate eos


		[] spawn 
{	
private "_pos";		
while {true} do
{		
_pos = getPos player;
_pos1 = getConnectedUAV player;
if !(isNull _pos1) then {_pos = getConnectedUAV player};	
list1 = _pos nearObjects ["EmptyDetector", 500];
if (count (list1) > 0) then 
{
{
_x enableSimulation true;
} forEach list1;
};

sleep 5;
};
};

[] spawn 
{
while {true} do
{	
waituntil {sleep 3;(count (list1) == 0)};
_alltriggers = allMissionObjects "EmptyDetector";
{
_x enableSimulation false;
} forEach _alltriggers;
waituntil {sleep 3;(count (list1) > 0)};
};
};

this script allows uavs to activate eos. the code that makes it happen is this


 {_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"; };

eos_core

  Hide contents

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

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


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

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

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


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

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

// SPAWN HOUSE PATROLS
 for "_counter" from 1 to _aGrps do {
 if (isnil "_aGrp") then {_aGrp=[];};
  if (_cache) then {
    _cacheGrp=format ["HP%1",_counter];
    _units=_eosActivated getvariable _cacheGrp; 
      _aSize=[_units,_units];
      _aMin=_aSize select 0;
       if (_debug)then{player sidechat format ["ID:%1,restore - %2",_cacheGrp,_units];};
       };
        if (_aMin > 0) then {
          _aGroup=[_mPos,_aSize,_faction,_side] call EOS_fnc_spawngroup; 
          if (!surfaceiswater _mPos) then {
           0=[_mPos,units _aGroup,_mkrX,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 (_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; 
while {_eosAct} do
 {
 // IF PLAYER LEAVES THE AREA OR ZONE DEACTIVATED
 if (!triggeractivated _eosActivated || getmarkercolor _mkr == "colorblack") exitwith
  {
  if (_debug) then {if (!(getmarkercolor _mkr == "colorblack")) then {hint "Restarting Zone AND deleting units";}else{hint "EOS zone deactivated";};};  
//CACHE LIGHT VEHICLES
 if (!isnil "_cGrp") then
    {    
      { _vehicle = _x select 0;_crew = _x select 1;_grp = _x select 2;
         if (!alive _vehicle || {!alive _x} foreach _crew) then { _cGrps= _cGrps - 1;}; 
            {deleteVehicle _x} forEach (_crew);  
              if (!(vehicle player == _vehicle)) then {{deleteVehicle _x} forEach[_vehicle];};            
                   {deleteVehicle _x} foreach units _grp;deleteGroup _grp;
      }foreach _cGrp;
if (_debug) then {player sidechat format ["ID:c%1",_cGrps];};};
           
// CACHE ARMOURED VEHICLES
  if (!isnil "_dGrp") then
    {    
      { _vehicle = _x select 0;_crew = _x select 1;_grp = _x select 2;
         if (!alive _vehicle || {!alive _x} foreach _crew) then {_dGrps= _dGrps - 1;}; 
            {deleteVehicle _x} forEach (_crew);  
              if (!(vehicle player == _vehicle)) then {{deleteVehicle _x} forEach[_vehicle];};            
                   {deleteVehicle _x} foreach units _grp;deleteGroup _grp;
      }foreach _dGrp;
if (_debug) then {player sidechat format ["ID:c%1",_dGrps];};};

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

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

 

Ooo, you are super! Very grateful. I really interesting. Thank you.

Share this post


Link to post
Share on other sites

Need some help please I am spawning a BASTION  but when i leave  i.e die and go back is there a way to start the process over again until it is turned green ?

 

 

Share this post


Link to post
Share on other sites
On 1/28/2018 at 5:10 PM, 1para{god-father} said:

Need some help please I am spawning a BASTION  but when i leave  i.e die and go back is there a way to start the process over again until it is turned green ?

 

 

Enable EOS integration 
null = [["BAS_zone_1"],[3,1],[2,1],[2],[0,0],[0,0,EAST],[10,2,20,***TRUE***,TRUE]] call Bastion_Spawn;


Simulates capturing of areas.
If TRUE the marker will act as a normal EOS zone if the player leaves the bastion zone. If *FALSE then bastion zone will turn red on the map but will not contain any units.

Share this post


Link to post
Share on other sites

made an EH that activates if player fires a shot. all groups around player that are atleast 200 meters away will converge around the player based on relative dir. the rest of the groups will carry on with their patrol

fired1 = true;
while {true} do {

    	sleep 5;
		
        if (fired1) then {hint "hi";
			player setvariable ["MyFiringEH",99];
			fired1 = false;
            eventHandlerID2 = player addEventHandler ["fired",
			
	{
	hint "shot";
	[] spawn{
		_wp0 = "";
		{if (side _x isEqualTo EAST && (((units _x) select 0) distance player) < 200 ) then 
		{_dir = ((units _x) select 0) getRelDir player;
		_start = position player;
		_dist = 20;
		_pos = [(_start select 0) + cos _dir * _dist, (_start select 1) - sin _dir * _dist, 0];
		{deleteWaypoint _x} foreach waypoints _x;
		sleep 0.3;
		if ((count (waypoints _x)) < 1) then{
		_wp0 = _x addwaypoint [_pos,5];  _wp0 setwaypointtype "Move"; _x setBehaviour "combat"; };};
		} foreach allgroups;

		
	};player removeAllEventHandlers "fired"; fired1 = true;}];

};
};

had to edit it, since it created waypoints == to the amount of all groups counted

 

I don't know if  "move" is better for this?

fired1 = true;
while {true} do {

    	sleep 5;
		
        if (fired1) then {hint "hi";
			player setvariable ["MyFiringEH",99];
			fired1 = false;
            eventHandlerID2 = player addEventHandler ["fired",
			
	{
	hint "shot";
	[] spawn{
		_wp0 = "";
		{if (side _x isEqualTo EAST && (((units _x) select 0) distance player) < 200 ) then 
		{_dir = ((units _x) select 0) getRelDir player;
		_start = position player;
		_dist = 20;
		_pos = [(_start select 0) + cos _dir * _dist, (_start select 1) - sin _dir * _dist, 0];
		//{deleteWaypoint _x} foreach waypoints _x;
		sleep 0.3;
		//if ((count (waypoints _x)) <= 1) then{
		/*_wp0 = _x addwaypoint [_pos,5];  _wp0 setwaypointtype "Move";*/ _x move _pos; _x setBehaviour "combat";};
		} foreach allgroups;

		
	};player removeAllEventHandlers "fired"; fired1 = true;}];

};
};

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

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;};
 };

 

Share this post


Link to post
Share on other sites
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

 

Share this post


Link to post
Share on other sites

Hi, I have a question which probably already has been answered, but 53 pages are a bit too much:

If you kill half of the AI in a marker and you leave and come back, will they respawn fully? If so, is possible to get a persistent count on them?

What I'm try to accomplish is a big marker with numerous patrols to be cleared, but be able to save game and come back to finish the job, not restart all over again.

 

Is even doable?

Thank you.

 

Zagor out!

Share this post


Link to post
Share on other sites

excuse this ramble:

 

in 'eos_core.sqf' it creates every zone by making a trigger, setting the statements to

 

Quote

_eosActivated setTriggerStatements [_actCond,"",""];

 

and then creating and passing a triggerActivated variable and starting:

 

Quote

waituntil {triggeractivated _eosActivated};

 

which means theres both a trigger and a waitUntil for every zone and some global variable passing. by the time you've got 40 zones + thats a fair bit of traffic, (see BMRinsurgency etc).

 

but theres a handy wizz i found once on these forums to pass local variable to triggers using 'format' command like so:

 

Quote

_starttrig setTriggerStatements ["this",format ["_towSet = [%1,getPos thisTrigger, 1, %2, %3]spawn LF_fnc_milbaseSetup;",str _locNm, _array, _posType],format ["_towSet = [%1,getPos thisTrigger, 2, %2, %3]spawn LF_fnc_milbaseSetup;",str _locNm, _array, _posType]];

 

what if each EOS zone could be spawned using one trigger and all the cache/dechache code could be called from the trigger statements removing the need for the double wating and a bunch of variable calling?

 

tbh a lot of EOS is a bit still a bit over my level ;) but this seems like it could improve performance for big missions quite substantially. i may attempt it myself but i thought i'd put the idea out there...

  • Thanks 1

Share this post


Link to post
Share on other sites

I have made missions with eos that had 400 zones, running cos and many other scripts and have not had performance issues (No mods). This was running on a server with 40 slots. I am not saying it can't be tweak for better perfomance, but if you are see issues I might look at the other scripts, mods, etc. you have going on.

Share this post


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

I have made missions with eos that had 400 zones

 

my experience is maybe not such a good computer because i do have performance issues running/playing missions with hundreds of EOS zones. to use your example if you have 400 zones then there are 800 things waiting to be triggered and a whole bunch of global variables that need to be passed outside of the trigger.  i'd need to try and write it out and test it before we could see how much difference it actually made anyway, it was just an idea.

 

No disrespect to bangabob or EOS, it works fekin fantastic or i wouldn't be reading through it trying to see how it works in the first place ;)

Share this post


Link to post
Share on other sites

Hi Bangabob,

 

Thank you for the very nice script. Simple, right to the point, only realistic useful features, no bs.

 

Please, is it possible to change the spawned units when you clear a sector?

 

I mean, once I occupy key sectors like an airfield_marker_1, then it pops up friendly units. No big deal, just same sintax, same parameters, etc. It would be something like this:

 

if marker = red, then null = [["MARKERNAME"],[2,1,70],[0,1],[1,2,30],[2,60],[2],[1,0,10],[1,0,250,EAST]] call EOS_Spawn;

if marker = blue, then null = [["MARKERNAME"],[2,1,70],[0,1],[1,2,30],[2,60],[2],[1,0,10],[2,1,250,WEST]] call EOS_Spawn;

 

The reason why I ask that is that I can create some mission progression. For example, Players start as infantry (no vehicles), then they secure an airfield, friendly infantry and vehicles spawn, now players can use them.

 

I have checked some pages here but, not all the 53. :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×