SHARE
TWEET

Patrols

Pwner-Actual Mar 19th, 2019 (edited) 253 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*========================================================================================
  2. ========================================  SETUP  =========================================
  3. ==========================================================================================
  4.     INSTRUCTIONS
  5. ==========================================================================================
  6.  
  7.     USAGE   :   Server only.
  8.     PURPOSE :   Spawn groups of units and vehicles that will patrol an area in accordance with
  9.                 all your selected arguments.
  10.                
  11.     EXAMPLE :   nul = [["ETP","ETS"], [2,25], ["markerName",500,1500], [], "LAND", true, false] execVM "UAF\patrols.sqf";
  12.     EXAMPLE :   nul = [["EIRP"], [1,100], [HVT,250,500], [zoneTrig,"safeMarker"], "LAND", false, false] execVM "UAF\patrols.sqf";
  13.  
  14.     FORMAT  :   nul = [["A"], [B,C], ["D",E,F], [G], "H", I, J] execVM "UAF\patrols.sqf";
  15.     FORMAT  :   nul = [["A","A"], [B,C], [D,E,F], [G,"G"], "H", I, J] execVM "UAF\patrols.sqf";
  16.     A =         [Array] of "strings" of group types that can be chosen to patrol.
  17.                     If more than one choice exists, a random one is selected from this array.
  18.                     See the whole selection of available types below this section.
  19.     B =         1st element of array stating how many units/vehicles must spawn at a minimum.
  20.                     If the group normally contains 6 units and 'B' is 8, then 6 units will spawn.
  21.                     If the group normally contains 6 units and 'B' is 2, then at least 2 units will spawn.
  22.     C =         2nd element of array stating a percentage (0 to 100) of probability that the remaining units spawn.
  23.                     If the number is '0' then only amount 'B' will spawn.
  24.                     If the number is anything more, then the full group might spawn entirely.
  25.     D =         1st element of origin array.
  26.                     This is the center point from which the group is spawned and plots its movements.
  27.                     This can be a marker ("markerName") with quotation marks.
  28.                     This can also be an object's name (nameOfObject) without quotation marks.
  29.     E =         2nd element of origin array.
  30.                     Minimum distance in meters from which no group can spawn from the center point 'D'.
  31.     F =         3rd element of Radius array.
  32.                     Maximum distance in meters from the center point 'D' at which the group can spawn.
  33.     G =         Array of trigger or "marker" names serving as safe zones.
  34.                     No spawn or patrol position will be plotted within a safe zone.
  35.                     Groups might still cross thru (true for aircraft and some land vehicles) or fire at units in safe zones!
  36.                     But as much as possible, groups will double back when entering a safe zone.
  37.     H =         String stating the permitted layout of the spawn and patrol positions.
  38.                     "WATER" = group can only spawn and patrol on water  (good for boats and divers)
  39.                     "LAND"  = group can only spawn and patrol on land   (good for infantry and land vehicles)
  40.                     "ALL"   = group can spawn and patrol anywhere       (good for aircraft)
  41.     I =         Bool (true or false) stating if roads should be prioritized.
  42.                     if 'true' then spawn and patrol points are going to be on roads if any are found.
  43.                     if 'false' then roads are not taken into account, although land vehicles will usually go toward them.
  44.     J =         Debug markers (true or false)
  45.                     if 'true' then markers will show the units and waypoints on the map, as well as other info.
  46.                    
  47. =======================================================================================
  48.     REFERENCE
  49. =======================================================================================
  50.         "GROUP TYPES" (argument 'A')
  51. =======================================================================================
  52.             EAST INFANTRY                                       EAST PACIFIC INFANTRY
  53. =======================================================================================
  54.             EIATH   = EAST INFANTRY ANTI-TANK HEAVY             EPIS    = EAST PACIFIC INFANTRY SENTRY
  55.             EIRP    = EAST INFANTRY RECON PATROL                EPISQ   = EAST PACIFIC INFANTRY SQUAD
  56.             EIRS    = EAST INFANTRY RECON SENTRY                EPISW   = EAST PACIFIC INFANTRY WEAPONS SQUAD
  57.             EIRT    = EAST INFANTRY RECON TEAM                  EPIT    = EAST PACIFIC INFANTRY TEAM
  58.             EIST    = EAST INFANTRY SNIPER TEAM                 EPITAA  = EAST PACIFIC INFANTRY TEAM ANTI-AIR
  59.             EIA     = EAST INFANTRY ASSAULT                     EPITAT  = EAST PACIFIC INFANTRY TEAM ANTI-TANK
  60.             EIS     = EAST INFANTRY SENTRY                      EPITATH = EAST PACIFIC INFANTRY TEAM ANTI-TANK HEAVY
  61.             EISQ    = EAST INFANTRY SQUAD                       EPIRP   = EAST PACIFIC INFANTRY RECON PATROL
  62.             EIWS    = EAST INFANTRY WEAPONS SQUAD               EPIRS   = EAST PACIFIC INFANTRY RECON SENTRY
  63.             EIT     = EAST INFANTRY TEAM                        EPIRT   = EAST PACIFIC INFANTRY RECON TEAM
  64.             EITAA   = EAST INFANTRY TEAM ANTI-AIR               EPIST   = EAST PACIFIC INFANTRY SNIPER TEAM
  65.             EITAT   = EAST INFANTRY TEAM ANTI-TANK              EPIG    = RANDOM GROUP FROM ALL OF THE ABOVE
  66.             EIRSQ   = EAST INFANTRY RECON SQUAD
  67.             EIG     = RANDOM GROUP FROM ALL OF THE ABOVE           
  68. =======================================================================================
  69.             EAST URBAN INFANTRY
  70. =======================================================================================
  71.             EUIGS   = EAST URBAN INFANTRY GUARD SENTRY
  72.             EUIGSQ  = EAST URBAN INFANTRY GUARD SQUAD
  73.             EUIGT   = EAST URBAN INFANTRY GUARD TEAM
  74.             EUIG    = RANDOM GROUP FROM ALL OF THE ABOVE           
  75. =======================================================================================
  76.             EAST SPECOPS                                        EAST PACIFIC SPECOPS
  77. =======================================================================================
  78.             ESATUV  = EAST SPECOPS ATTACK TEAM UAV              EPSATUV = EAST PACIFIC SPECOPS ATTACK TEAM UAV
  79.             ESATUG  = EAST SPECOPS ATTACK TEAM UGV              EPSATUG = EAST PACIFIC SPECOPS ATTACK TEAM UGV
  80.             ESDT    = EAST SPECOPS DIVER TEAM                   EPSDT   = EAST PACIFIC SPECOPS DIVER TEAM
  81.             ESDTB   = EAST SPECOPS DIVER TEAM BOAT              EPSDTB  = EAST PACIFIC SPECOPS DIVER TEAM BOAT
  82.             ESDTSD  = EAST SPECOPS DIVER TEAM SDV               EPSDTSD = EAST PACIFIC SPECOPS DIVER TEAM SDV
  83.             ESRTUV  = EAST SPECOPS RECON TEAM UAV               EPSRTUV = EAST PACIFIC SPECOPS RECON TEAM UAV
  84.             ESRTUG  = EAST SPECOPS RECON TEAM UGV               EPSRTUG = EAST PACIFIC SPECOPS RECON TEAM UGV
  85.             ESSTUV  = EAST SPECOPS SMALL TEAM UAV               EPSSTUV = EAST PACIFIC SPECOPS SMALL TEAM UAV
  86.             ESVT    = EAST SPECOPS VIPER TEAM                   EPSVT   = EAST PACIFIC SPECOPS VIPER TEAM
  87. =======================================================================================
  88.             EAST SUPPORT                                        EAST PACIFIC SUPPORT
  89. =======================================================================================
  90.             ESREOD  = EAST SUPPORT RECON EOD                    EPSREOD = EAST PACFIC SUPPORT RECON EOD
  91.             ESCLS   = EAST SUPPORT CLS                          EPSCLS  = EAST PACFIC SUPPORT CLS
  92.             ESENG   = EAST SUPPORT ENG                          EPSENG  = EAST PACFIC SUPPORT ENG
  93.             ESEOD   = EAST SUPPORT EOD                          EPSEOD  = EAST PACFIC SUPPORT EOD
  94.             ESGMG   = EAST SUPPORT GMG                          EPSGMG  = EAST PACFIC SUPPORT GMG
  95.             ESMG    = EAST SUPPORT MG                           EPSMG   = EAST PACFIC SUPPORT MG
  96.             ESMORT  = EAST SUPPORT MORTAR                       EPSMORT = EAST PACFIC SUPPORT MORTAR
  97.             ESG     = RANDOM GROUP FROM ALL OF THE ABOVE        EPSG    = RANDOM GROUP FROM ALL OF THE ABOVE
  98. =======================================================================================
  99.             EAST ARMOR                                              EAST ARMOR PACIFIC
  100. =======================================================================================
  101.             ETPH    = EAST TANK PLATOON HEAVY                   EPTPS   = EAST PACIFIC TANK PLATOON SCORCHER
  102.             ETSH    = EAST TANK SECTION HEAVY                   EPTPS   = EAST PACIFIC TANK SECTION SCORCHER
  103.             EAP     = EAST ARTILLERY PLATOON                    EPTP    = EAST PACIFIC TANK PLATOON
  104.             EAS     = EAST ARTILLERY SECTION                    EPTPAA  = EAST PACIFIC TANK PLATOON ANTI-AIR
  105.             ETP     = EAST TANK PLATOON                         EPTPH   = EAST PACIFIC TANK PLATOON HEAVY
  106.             ETPAA   = EAST TANK PLATOON ANTI-AIR                EPTS    = EAST PACIFIC TANK SECTION
  107.             ETS     = EAST TANK SECTION                         EPTS    = EAST PACIFIC TANK SECTION HEAVY
  108.             EAG     = RANDOM GROUP FROM ALL OF THE ABOVE        EPAG    = RANDOM GROUP FROM ALL OF THE ABOVE
  109. =======================================================================================
  110.             EAST MECHANIZED                                     EAST PACIFIC MECHANIZED
  111. =======================================================================================
  112.             EMIAA   = EAST MECHANIZED INFANTRY ANTI-AIR         EPMIAA  = EAST PACIFIC MECHANIZED INFANTRY ANTI-AIR
  113.             EMIAT   = EAST MECHANIZED INFANTRY ANTI-TANK        EPMIAT  = EAST PACIFIC MECHANIZED INFANTRY ANTI-TANK
  114.             EMIS    = EAST MECHANIZED INFANTRY SUPPORT          EPMIS   = EAST PACIFIC MECHANIZED INFANTRY SUPPORT
  115.             EMISQ   = EAST MECHANIZED INFANTRY SQUAD            EPMISQ  = EAST PACIFIC MECHANIZED INFANTRY SQUAD
  116.             EMG     = RANDOM GROUP FROM ALL OF THE ABOVE        EPMG    = RANDOM GROUP FROM ALL OF THE ABOVE
  117. =======================================================================================
  118.             EAST MOTORIZED                                      EAST PACIFIC MOTORIZED
  119. =======================================================================================
  120.             EMOAV   = EAST MOTORIZED ASSAULT VIPER TEAM         EPMOAV  = EAST PACIFIC MOTORIZED ASSAULT VIPER TEAM
  121.             EMORV   = EAST MOTORIZED RECON VIPER TEAM           EPMORV  = EAST PACIFIC MOTORIZED RECON VIPER TEAM
  122.             EMOIAA  = EAST MOTORIZED INFANTRY ANTI-AIR          EPMOIAA = EAST PACIFIC MOTORIZED INFANTRY ANTI-AIR
  123.             EMOIAT  = EAST MOTORIZED INFANTRY ANTI-TANK         EPMOIAT = EAST PACIFIC MOTORIZED INFANTRY ANTI-TANK
  124.             EMOIGMG = EAST MOTORIZED INFANTRY GMG               EPMOIGM = EAST PACIFIC MOTORIZED INFANTRY GMG
  125.             EMOIMG  = EAST MOTORIZED INFANTRY MG                EPMOIMG = EAST PACIFIC MOTORIZED INFANTRY MG
  126.             EMOIMO  = EAST MOTORIZED INFANTRY MORTAR            EPMOIMO = EAST PACIFIC MOTORIZED INFANTRY MORTAR
  127.             EMOIRE  = EAST MOTORIZED INFANTRY REINFORCEMENTS    EPMOIRE = EAST PACIFIC MOTORIZED INFANTRY REINFORCEMENTS
  128.             EMOIT   = EAST MOTORIZED INFANTRY TEAM              EPMOIT  = EAST PACIFIC MOTORIZED INFANTRY TEAM
  129.             EMOG    = RANDOM GROUP FROM ALL OF THE ABOVE        EPMOG   = RANDOM GROUP FROM ALL OF THE ABOVE
  130. =======================================================================================
  131.             EAST GUERILLA INFANTRY
  132. =======================================================================================
  133.             EGISA   = EAST GUERILLA INFANTRY ASSAULT SQUAD
  134.             EGITL   = EAST GUERILLA INFANTRY LIGHT TEAM
  135.             EGIG    = RANDOM GROUP FROM ALL OF THE ABOVE
  136. =======================================================================================
  137.             INDEPENDENT AAF INFANTRY
  138. =======================================================================================
  139.             IAIS    = INDEPENDENT AAF INFANTRY SENTRY
  140.             IAISQ   = INDEPENDENT AAF INFANTRY SQUAD
  141.             IAISW   = INDEPENDENT AAF INFANTRY WEAPONS SQUAD
  142.             IAIT    = INDEPENDENT AAF INFANTRY TEAM
  143.             IAITAA  = INDEPENDENT AAF INFANTRY TEAM ANTI-AIR
  144.             IAITAT  = INDEPENDENT AAF INFANTRY TEAM ANTI-TANK
  145.             IAIST   = INDEPENDENT AAF INFANTRY SNIPER TEAM
  146.             IAITL   = INDEPENDENT AAF INFANTRY TEAM LIGHT
  147.             IAIG    = RANDOM GROUP FROM ALL OF THE ABOVE
  148. =======================================================================================
  149.             INDEPENDENT AAF SPECOPS
  150. =======================================================================================
  151. */
  152. // =======================================================================================
  153. // SERVER ONLY
  154. // =======================================================================================
  155. if (!isServer) exitWith {};
  156. // =======================================================================================
  157. // DEFINE & DECLARE VARIABLES
  158. // =======================================================================================
  159. //      VARS & VALUES THRU ARGUMENTS
  160. // =======================================================================================
  161. private _tps    =   _this   select 0;                   // A
  162. private _amt    = ( _this   select 1) select 0;         // B
  163. private _per    = ((_this   select 1) select 1)/100;    // C
  164. private _ori    = ( _this   select 2) select 0;         // D
  165. private _min    = ( _this   select 2) select 1;         // E
  166. private _max    = ( _this   select 2) select 2;         // F
  167. private _sfz    =   _this   select 3;                   // G
  168. private _spl    =   _this   select 4;                   // H
  169. private _rds    =   _this   select 5;                   // I
  170. private _dbg    =   _this   select 6;                   // J
  171. // =======================================================================================
  172. //      VARS & VALUES THRU SCRIPT
  173. // =======================================================================================
  174. private ["_ctr","_relD","_grp","_dbp","_wp","_oriM","_sfzM","_sfzMI"];
  175. // get position of origin point depending on its data type
  176. if (typeName _ori == "STRING") then {_ctr = getMarkerPos    _ori};
  177. if (typeName _ori == "OBJECT") then {_ctr = position        _ori};
  178. private _pos        = [0,0];    // start with a spawn position to compare
  179. private _rocks      = [];       // array of nearby rocks
  180. private _rBuf       = 30;       // buffer radius for rock positions
  181. private _rdsOK      = [];       // roads outside safe zones and outside minimum radius
  182. private _untMkrs    = [];       // debug markers
  183. private _dbgMkrs    = [];       // debug markers
  184. private _wpMkr      = "";       // waypoint reference for removal
  185. // =======================================================================================
  186. // ====================================  SCRIPT  =========================================
  187. // =======================================================================================
  188. //  CHECK CONDITIONS TO CALCULATE A SPAWN POSITION
  189. // =======================================================================================
  190. while
  191.     {
  192.     ({_pos inArea _x} count _sfz > 0)                       // spawn position is in a safezone
  193.     ||
  194.     ((_spl == "LAND") && (surfaceIsWater _pos))             // spawn position is on water and not permitted
  195.     ||
  196.     ((_spl == "WATER") && !(surfaceIsWater _pos))           // spawn position is on land and not permitted
  197.     ||
  198.     ({getPos _x distance _pos <= _rBuf} count _rocks >= 1)  // spawn position is too close to a rock
  199.     ||
  200.     (_pos distance _ctr > _max)                             // outside max radius
  201.     ||
  202.     (_pos distance _ctr < _min)                             // inside min radius
  203.     }
  204. do  {
  205. // =======================================================================================
  206. //  CALCULATE A SPAWN POSITION
  207. // =======================================================================================
  208. //      FIND CONVENIENT ROADS IF SPECIFIED AND CHOOSE ONE AS SPAWN POINT IF ANY ARE FOUND
  209. // =======================================================================================
  210.     if (_rds) then {
  211.         _rdsL = _ctr nearRoads _max;
  212.         if  (count _rdsL > 0) then {
  213.             _rPos = _rdsL apply {_x modelToWorld [0,0,0];};
  214.             for [{_i=(count _rPos)-1},{_i>-1},{_i=_i-1}] do {
  215.                 if      (({(_rPos select _i) inArea (_x)} count _sfz < 1) && ((_rPos select _i) distance _ctr > _min))
  216.                 then    {_rdsOK append [_rPos select _i];};
  217.             };
  218.         };
  219.     };
  220.     if  (count _rdsOK >= 1) then {_pos = selectRandom _rdsOK} else {
  221. // =======================================================================================
  222. //      FIND A CONVENIENT SPAWN POSITION (not on roads)
  223. // =======================================================================================
  224.         // find a position within circle with a min and max radius
  225.         _pos    = [(_ctr select 0)+((_min)+(random(_max-_min)))*(cos(random 360)),(_ctr select 1)+((_min)+(random(_max-_min)))*(sin(random 360))];
  226.         // get nearby rocks to avoid spawning in them
  227.         _rocks  = nearestTerrainObjects [_pos,["ROCK","ROCKS"],_rBuf];
  228.     };
  229. };
  230. // =======================================================================================
  231. //  SELECT A GROUP TO SPAWN
  232. // =======================================================================================
  233. _relD   = _pos getDir _ctr;     // point toward the center
  234. _typ    = selectRandom _tps;    // choose a group at random from argument
  235. switch (_typ) do {
  236. //=======================================================================================
  237. //      EAST INFANTRY
  238. //=======================================================================================  
  239.     case "EIATH":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "O_InfTeam_AT_Heavy"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  240.     case "EIRP":    {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OI_reconPatrol"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  241.     case "EIRS":    {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OI_reconSentry"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  242.     case "EIRT":    {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OI_reconTeam"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  243.     case "EIST":    {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OI_SniperTeam"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  244.     case "EIA":     {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfAssault"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  245.     case "EIS":     {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfSentry"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  246.     case "EISQ":    {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfSquad"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  247.     case "EIWS":    {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfSquad_Weapons"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  248.     case "EIT":     {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfTeam"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  249.     case "EITAA":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfTeam_AA"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  250.     case "EITAT":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfTeam_AT"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  251.     case "EIRSQ":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_ReconSquad"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  252.     case "EIG":     {
  253.                     _sel =  selectRandom ["O_InfTeam_AT_Heavy","OI_reconPatrol","OI_reconSentry","OI_reconTeam","OI_SniperTeam","OIA_InfAssault","OIA_InfSentry","OIA_InfSquad","OIA_InfSquad_Weapons","OIA_InfTeam","OIA_InfTeam_AA","OIA_InfTeam_AT","OIA_ReconSquad"];
  254.                     _grp =  [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> _sel),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;
  255.                     };
  256. //=======================================================================================
  257. //      EAST PACIFIC INFANTRY
  258. //=======================================================================================  
  259.     case "EPIS":    {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Infantry" >> "O_T_InfSentry"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  260.     case "EPISQ":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Infantry" >> "O_T_InfSquad"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  261.     case "EPISW":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Infantry" >> "O_T_InfSquad_Weapons"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  262.     case "EPIT":    {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Infantry" >> "O_T_InfTeam"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  263.     case "EPITAA":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Infantry" >> "O_T_InfTeam_AA"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  264.     case "EPITAT":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Infantry" >> "O_T_InfTeam_AT"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  265.     case "EPITATH": {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Infantry" >> "O_T_InfTeam_AT_Heavy"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  266.     case "EPIRP":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Infantry" >> "O_T_reconPatrol"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  267.     case "EPIRS":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Infantry" >> "O_T_reconSentry"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  268.     case "EPIRT":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Infantry" >> "O_T_reconTeam"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  269.     case "EPIST":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Infantry" >> "O_T_SniperTeam"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  270.     case "EPIG":    {
  271.                     _sel =  selectRandom ["O_T_InfSentry","O_T_InfSquad","O_T_InfSquad_Weapons","O_T_InfTeam","O_T_InfTeam_AA","O_T_InfTeam_AT","O_T_InfTeam_AT_Heavy","O_T_reconPatrol","O_T_reconSentry","O_T_reconTeam","O_T_SniperTeam"];
  272.                     _grp =  [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Infantry" >> _sel),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;
  273.                     };                 
  274. //=======================================================================================
  275. //      EAST URBAN INFANTRY
  276. //=======================================================================================  
  277.     case "EUIGS":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "UInfantry" >> "OIA_GuardSentry"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  278.     case "EUIGSQ":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "UInfantry" >> "OIA_GuardSquad"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  279.     case "EUIGT":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "UInfantry" >> "OIA_GuardTeam"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  280.     case "EUIG":    {
  281.                     _sel =  selectRandom ["OIA_GuardSentry","OIA_GuardSquad","OIA_GuardTeam"];
  282.                     _grp =  [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "UInfantry" >> _sel),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;
  283.                     };
  284. //=======================================================================================
  285. //      EAST SPECOPS
  286. //=======================================================================================  
  287.     case "ESATUV":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "SpecOps" >> "OI_AttackTeam_UAV"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  288.     case "ESATUG":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "SpecOps" >> "OI_AttackTeam_UGV"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  289.     case "ESDT":    {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "SpecOps" >> "OI_diverTeam"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  290.     case "ESDTB":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "SpecOps" >> "OI_diverTeam_Boat"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  291.     case "ESDTSD":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "SpecOps" >> "OI_diverTeam_SDV"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  292.     case "ESRTUV":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "SpecOps" >> "OI_ReconTeam_UAV"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  293.     case "ESRTUG":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "SpecOps" >> "OI_ReconTeam_UGV"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  294.     case "ESSTUV":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "SpecOps" >> "OI_SmallTeam_UAV"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  295.     case "ESVT":    {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "SpecOps" >> "OI_ViperTeam"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  296. //=======================================================================================
  297. //      EAST PACIFIC SPECOPS
  298. //=======================================================================================  
  299.     case "EPSATUV": {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "SpecOps" >> "O_T_AttackTeam_UAV"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  300.     case "EPSATUG": {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "SpecOps" >> "O_T_AttackTeam_UGV"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  301.     case "EPSDT":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "SpecOps" >> "O_T_diverTeam"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  302.     case "EPSDTB":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "SpecOps" >> "O_T_diverTeam_Boat"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  303.     case "EPSDTSD": {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "SpecOps" >> "O_T_diverTeam_SDV"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  304.     case "EPSRTUV": {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "SpecOps" >> "O_T_ReconTeam_UAV"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  305.     case "EPSRTUG": {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "SpecOps" >> "O_T_ReconTeam_UGV"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  306.     case "EPSSTUV": {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "SpecOps" >> "O_T_SmallTeam_UAV"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  307.     case "EPSVT":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "SpecOps" >> "O_T_ViperTeam"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  308. //=======================================================================================
  309. //      EAST SUPPORT
  310. //=======================================================================================  
  311.     case "ESREOD":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Support" >> "OI_recon_EOD"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  312.     case "ESCLS":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Support" >> "OI_support_CLS"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  313.     case "ESENG":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Support" >> "OI_support_ENG"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  314.     case "ESEOD":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Support" >> "OI_support_EOD"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  315.     case "ESGMG":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Support" >> "OI_support_GMG"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  316.     case "ESMG":    {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Support" >> "OI_support_MG"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  317.     case "ESMORT":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Support" >> "OI_support_Mort"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  318.     case "ESG":     {
  319.                     _sel =  selectRandom ["OI_recon_EOD","OI_support_CLS","OI_support_ENG","OI_support_EOD","OI_support_GMG","OI_support_MG","OI_support_Mort"];
  320.                     _grp =  [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Support" >> _sel),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;
  321.                     };
  322. //=======================================================================================
  323. //      EAST PACIFIC SUPPORT
  324. //=======================================================================================  
  325.     case "EPSREOD": {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Support" >> "O_T_recon_EOD"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  326.     case "EPSCLS":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Support" >> "O_T_support_CLS"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  327.     case "EPSENG":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Support" >> "O_T_support_ENG"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  328.     case "EPSEOD":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Support" >> "O_T_support_EOD"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  329.     case "EPSGMG":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Support" >> "O_T_support_GMG"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  330.     case "EPSMG":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Support" >> "O_T_support_MG"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  331.     case "EPSMORT": {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Support" >> "O_T_support_Mort"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  332.     case "EPSG":    {
  333.                     _sel =  selectRandom ["O_T_recon_EOD","O_T_support_CLS","O_T_support_ENG","O_T_support_EOD","O_T_support_GMG","O_T_support_MG","O_T_support_Mort"];
  334.                     _grp =  [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Support" >> _sel),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;
  335.                     };                 
  336. //=======================================================================================
  337. //      EAST ARMOR
  338. //=======================================================================================
  339.     case "ETPH":    {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Armored" >> "O_TankPlatoon_Heavy"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  340.     case "ETSH":    {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Armored" >> "O_TankSection_Heavy"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  341.     case "EAP":     {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Armored" >> "OIA_SPGPlatoon_Scorcher"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  342.     case "EAS":     {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Armored" >> "OIA_SPGSection_Scorcher"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  343.     case "ETP":     {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Armored" >> "OIA_TankPlatoon"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  344.     case "ETPAA":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Armored" >> "OIA_TankPlatoon_AA"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  345.     case "ETS":     {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Armored" >> "OIA_TankSection"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  346.     case "EAG":     {
  347.                     _sel =  selectRandom ["O_TankPlatoon_Heavy","O_TankSection_Heavy","OIA_SPGPlatoon_Scorcher","OIA_SPGSection_Scorcher","OIA_TankPlatoon","OIA_TankPlatoon_AA","OIA_TankSection"];
  348.                     _grp =  [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Armored" >> _sel),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;
  349.                     }; 
  350. //=======================================================================================
  351. //      EAST PACIFIC ARMOR
  352. //=======================================================================================
  353.     case "EPTPS":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Armored" >> "O_T_SPGPlatoon_Scorcher"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  354.     case "EPTSS":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Armored" >> "O_T_SPGPlatoon_Scorcher"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  355.     case "EPTP":    {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Armored" >> "O_T_TankPlatoon"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  356.     case "EPTPAA":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Armored" >> "O_T_TankPlatoon_AA"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  357.     case "EPTPH":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Armored" >> "O_T_TankPlatoon_Heavy"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  358.     case "EPTS":    {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Armored" >> "O_T_TankSection"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  359.     case "EPTSH":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Armored" >> "O_T_TankSection_Heavy"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  360.     case "EPAG":    {
  361.                     _sel =  selectRandom ["O_T_SPGPlatoon_Scorcher","O_T_SPGPlatoon_Scorcher","O_T_TankPlatoon","O_T_TankPlatoon_AA","O_T_TankPlatoon_Heavy","O_T_TankSection_Heavy"];
  362.                     _grp =  [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Armored" >> _sel),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;
  363.                     };                     
  364. //=======================================================================================
  365. //      EAST MECHANIZED
  366. //=======================================================================================
  367.     case "EMIAA":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Mechanized" >> "OIA_MechInf_AA"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  368.     case "EMIAT":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Mechanized" >> "OIA_MechInf_AT"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  369.     case "EMIS":    {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Mechanized" >> "OIA_MechInf_Support"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  370.     case "EMISQ":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Mechanized" >> "OIA_MechInfSquad"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  371.     case "EMG":     {
  372.                     _sel =  selectRandom ["OIA_MechInf_AA","OIA_MechInf_AT","OIA_MechInf_Support","OIA_MechInfSquad"];
  373.                     _grp =  [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Mechanized" >> _sel),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;
  374.                     }; 
  375. //=======================================================================================
  376. //      EAST PACIFIC MECHANIZED
  377. //=======================================================================================
  378.     case "EPMIAA":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Mechanized" >> "O_T_MechInf_AA"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  379.     case "EPMIAT":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Mechanized" >> "O_T_MechInf_AT"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  380.     case "EPMIS":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Mechanized" >> "O_T_MechInf_Support"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  381.     case "EPMISQ":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Mechanized" >> "O_T_MechInfSquad"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  382.     case "EPMG":    {
  383.                     _sel =  selectRandom ["O_T_MechInf_AA","O_T_MechInf_AT","O_T_MechInf_Support","O_T_MechInfSquad"];
  384.                     _grp =  [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Mechanized" >> _sel),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;
  385.                     };                     
  386. //=======================================================================================
  387. //      EAST MOTORIZED
  388. //=======================================================================================
  389.     case "EMOAV":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Motorized_MTP" >> "O_MotInf_AssaultViperTeam"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  390.     case "EMORV":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Motorized_MTP" >> "O_MotInf_ReconViperTeam"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  391.     case "EMOIAA":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Motorized_MTP" >> "OIA_MotInf_AA"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  392.     case "EMOIAT":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Motorized_MTP" >> "OIA_MotInf_AT"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  393.     case "EMOIGMG": {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Motorized_MTP" >> "OIA_MotInf_GMGTeam"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  394.     case "EMOIMG":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Motorized_MTP" >> "OIA_MotInf_MGTeam"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  395.     case "EMOIMO":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Motorized_MTP" >> "OIA_MotInf_MortTeam"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  396.     case "EMOIRE":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Motorized_MTP" >> "OIA_MotInf_Reinforce"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  397.     case "EMOIT":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Motorized_MTP" >> "OIA_MotInf_Team"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  398.     case "EMOG":    {
  399.                     _sel =  selectRandom ["O_MotInf_AssaultViperTeam","O_MotInf_ReconViperTeam","OIA_MotInf_AA","OIA_MotInf_AT","OIA_MotInf_GMGTeam","OIA_MotInf_MGTeam","OIA_MotInf_MortTeam","OIA_MotInf_Reinforce","OIA_MotInf_Team"];
  400.                     _grp =  [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Motorized_MTP" >> _sel),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;
  401.                     };     
  402. //=======================================================================================
  403. //      EAST PACIFIC MOTORIZED
  404. //=======================================================================================
  405.     case "EPMOAV":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Motorized_MTP" >> "O_T_MotInf_AssaultViperTeam"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  406.     case "EPMORV":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Motorized_MTP" >> "O_T_MotInf_ReconViperTeam"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  407.     case "EPMOIAA": {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Motorized_MTP" >> "O_T_MotInf_AA"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  408.     case "EPMOIAT": {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Motorized_MTP" >> "O_T_MotInf_AT"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  409.     case "EPMOIGM": {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Motorized_MTP" >> "O_T_MotInf_GMGTeam"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  410.     case "EPMOIMG": {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Motorized_MTP" >> "O_T_MotInf_MGTeam"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  411.     case "EPMOIMO": {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Motorized_MTP" >> "O_T_MotInf_MortTeam"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  412.     case "EPMOIRE": {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Motorized_MTP" >> "O_T_MotInf_Reinforce"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  413.     case "EPMOIT":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Motorized_MTP" >> "O_T_MotInf_Team"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  414.     case "EPMOG":   {
  415.                     _sel =  selectRandom ["O_T_MotInf_AssaultViperTeam","O_T_MotInf_ReconViperTeam","O_T_MotInf_AA","O_T_MotInf_AT","O_T_MotInf_GMGTeam","O_T_MotInf_MGTeam","O_T_MotInf_MortTeam","O_T_MotInf_Reinforce","O_T_MotInf_Team"];
  416.                     _grp =  [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Motorized_MTP" >> _sel),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;
  417.                     };     
  418. //=======================================================================================
  419. //      EAST GUERILLA INFANTRY
  420. //=======================================================================================  
  421.     case "EGISA":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_G_F" >> "Infantry" >> "O_G_InfSquad_Assault"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  422.     case "EGITL":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_G_F" >> "Infantry" >> "O_G_InfTeam_Light"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  423.     case "EGIG":    {
  424.                     _sel =  selectRandom ["O_G_InfSquad_Assault","O_G_InfTeam_Light"];
  425.                     _grp =  [_pos,East,(configfile >> "CfgGroups" >> "East" >> "OPF_G_F" >> "Infantry" >> _sel),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;
  426.                     };
  427. //=======================================================================================
  428. //      INDEPENDENT AAF INFANTRY
  429. //=======================================================================================  
  430.     case "IAIS":    {_grp = [_pos,East,(configfile >> "CfgGroups" >> "Indep" >> "IND_F" >> "Infantry" >> "HAF_InfSentry"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  431.     case "IAISQ":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "Indep" >> "IND_F" >> "Infantry" >> "HAF_InfSquad"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  432.     case "IAISW":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "Indep" >> "IND_F" >> "Infantry" >> "HAF_InfSquad_Weapons"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  433.     case "IAIT":    {_grp = [_pos,East,(configfile >> "CfgGroups" >> "Indep" >> "IND_F" >> "Infantry" >> "HAF_InfTeam"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  434.     case "IAITAA":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "Indep" >> "IND_F" >> "Infantry" >> "HAF_InfTeam_AA"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  435.     case "IAITAT":  {_grp = [_pos,East,(configfile >> "CfgGroups" >> "Indep" >> "IND_F" >> "Infantry" >> "HAF_InfTeam_AT"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  436.     case "IAIST":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "Indep" >> "IND_F" >> "Infantry" >> "HAF_SniperTeam"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  437.     case "IAITL":   {_grp = [_pos,East,(configfile >> "CfgGroups" >> "Indep" >> "IND_F" >> "Infantry" >> "I_InfTeam_Light"),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;};
  438.     case "IAIG":    {
  439.                     _sel =  selectRandom ["HAF_InfSentry","HAF_InfSquad","HAF_InfSquad_Weapons","HAF_InfTeam","HAF_InfTeam_AA","HAF_InfTeam_AT","HAF_SniperTeam","I_InfTeam_Light"];
  440.                     _grp =  [_pos,East,(configfile >> "CfgGroups" >> "Indep" >> "IND_F" >> "Infantry" >> _sel),[],[],[],[],[_amt,_per],_relD] call BIS_fnc_spawnGroup;
  441.                     };
  442. //=======================================================================================
  443. //      INDEPENDENT AAF SPECOPS
  444. //=======================================================================================  
  445.                    
  446. }; // end of group choices
  447. //=======================================================================================
  448. //      SET ATTRIBUTES
  449. //=======================================================================================
  450. _grp deleteGroupWhenEmpty true; // make sure the group is deleted when dead
  451. // =======================================================================================
  452. //  DEBUG MARKERS
  453. // =======================================================================================
  454. if (_dbg) then {
  455.     // origin
  456.     _oriMN  = format        ["marker_%1",floor(random 1000)];
  457.     if (typeName _ori == "STRING") then {_oriM = createMarker [_oriMN, getMarkerPos _ori];};
  458.     if (typeName _ori == "OBJECT") then {_oriM = createMarker [_oriMN, position _ori];};
  459.     _oriM   setMarkerShape  "ICON";
  460.     _oriM   setMarkerType   "mil_dot";
  461.     _oriM   setMarkerColor  "ColorWhite";
  462.     _oriM   setMarkerText   "ORIGIN";
  463.     _dbgMkrs    append      [_oriM];
  464.     // min radius
  465.     _minMN  = format        ["marker_%1",floor(random 1000)];
  466.     _minM   = createMarker  [_minMN, _ctr];
  467.     _minM   setMarkerShape  "ELLIPSE";
  468.     _minM   setMarkerSize   [_min,_min];
  469.     _minM   setMarkerBrush  "Horizontal";
  470.     _minM   setMarkerAlpha  1;
  471.     _minM   setMarkerColor  "ColorBlue";
  472.     _dbgMkrs    append      [_minM];
  473.     // max radius
  474.     _maxMN  = format        ["marker_%1",floor(random 1000)];
  475.     _maxM   = createMarker  [_maxMN, _ctr];
  476.     _maxM   setMarkerShape  "ELLIPSE";
  477.     _maxM   setMarkerSize   [_max,_max];
  478.     _maxM   setMarkerBrush  "Solid";
  479.     _maxM   setMarkerAlpha  0.75;
  480.     _maxM   setMarkerColor  "ColorOrange";
  481.     _dbgMkrs    append      [_maxM];
  482.     // safe zones circles
  483.     _sfz apply {
  484.         _sfzMN  = format        ["marker_%1",floor(random 1000)];
  485.         if (typeName _x == "STRING") then {_sfzM = createMarker [_sfzMN, getMarkerPos _x];};
  486.         if (typeName _x == "OBJECT") then {_sfzM = createMarker [_sfzMN, position _x];};       
  487.         _sfzM   setMarkerShape  "ELLIPSE";
  488.         if (typeName _x == "STRING") then {_sfzM setMarkerSize [(getMarkerSize _x) select 0,(getMarkerSize _x) select 1];};
  489.         if (typeName _x == "OBJECT") then {_sfzM setMarkerSize [(triggerArea _x) select 0,(triggerArea _x) select 1];};    
  490.         _sfzM   setMarkerBrush  "SolidFull";
  491.         _sfzM   setMarkerAlpha  0.25;
  492.         _sfzM   setMarkerColor  "ColorCIV";
  493.         _dbgMkrs    append      [_sfzM];
  494.     // safe zones icons
  495.         _sfzMIN =   format          ["marker_%1",floor(random 1000)];
  496.         if (typeName _x == "STRING") then {_sfzMI = createMarker [_sfzMIN, getMarkerPos _x];};
  497.         if (typeName _x == "OBJECT") then {_sfzMI = createMarker [_sfzMIN, position _x];};     
  498.         _sfzMI      setMarkerShape  "ICON";
  499.         _sfzMI      setMarkerType   "mil_box";
  500.         _sfzMI      setMarkerColor  "ColorWhite";
  501.         _sfzMI      setMarkerText   "SAFEZONE";
  502.         _dbgMkrs    append          [_sfzMI];
  503.     };
  504. };
  505. // =======================================================================================
  506. //  PLOT PATROL POINTS WHILE GROUP LIVES
  507. // =======================================================================================
  508. while {({alive _x} count units _grp > 0)} do {
  509. // =======================================================================================
  510. //      RESET VALUES
  511. // =======================================================================================
  512.     _pos    = [0,0];
  513.     _rocks  = [];
  514.     _rdsOK  = [];
  515. // =======================================================================================
  516. //      CHECK CONDITIONS TO CALCULATE A PATROL POSITION
  517. // =======================================================================================
  518.     while
  519.         {
  520.         ({_pos inArea _x} count _sfz > 0)                       // spawn position is in a safezone
  521.         ||
  522.         ((_spl == "LAND") && (surfaceIsWater _pos))             // spawn position is on water and not permitted
  523.         ||
  524.         ((_spl == "WATER") && !(surfaceIsWater _pos))           // spawn position is on land and not permitted
  525.         ||
  526.         ({getPos _x distance _pos <= _rBuf} count _rocks >= 1)  // spawn position is too close to a rock
  527.         ||
  528.         (_pos distance _ctr > _max)                             // outside max radius
  529.         ||
  530.         (_pos distance _ctr < _min)                             // inside min radius
  531.         }
  532.     do  {
  533. // =======================================================================================
  534. //      CALCULATE A PATROL POSITION
  535. // =======================================================================================
  536. //          FIND CONVENIENT ROADS IF SPECIFIED AND CHOOSE ONE IF ANY ARE FOUND
  537. // =======================================================================================
  538.             if (_rds) then {
  539.                 _rdsL = _ctr nearRoads _max;
  540.                 if  (count _rdsL > 0) then {
  541.                     _rPos = _rdsL apply {_x modelToWorld [0,0,0];};
  542.                     for [{_i=(count _rPos)-1},{_i>-1},{_i=_i-1}] do {
  543.                         if      (({(_rPos select _i) inArea (_x)} count _sfz < 1) && ((_rPos select _i) distance _ctr > _min))
  544.                         then    {_rdsOK append [_rPos select _i];};
  545.                     };
  546.                 };
  547.             };
  548.             if  (count _rdsOK >= 1) then {_pos = selectRandom _rdsOK} else {
  549. // =======================================================================================
  550. //          FIND A CONVENIENT PATROL POSITION (not on roads)
  551. // =======================================================================================
  552.                 // find a position within circle with a min and max radius
  553.                 _pos    = [(_ctr select 0)+((_min)+(random(_max-_min)))*(cos(random 360)),(_ctr select 1)+((_min)+(random(_max-_min)))*(sin(random 360))];
  554.                 // get nearby rocks to avoid moving in them
  555.                 _rocks  = nearestTerrainObjects [_pos,["ROCK","ROCKS"],_rBuf];
  556.             };
  557.         }; // loop patrol positions calculations       
  558. // =======================================================================================
  559. //      GROUP ON THE MOVE
  560. // =======================================================================================
  561.     _dbp    = (position leader _grp); // double back position in case group enters a safezone
  562.     _form   = selectRandom ["LINE","STAG COLUMN","WEDGE","DIAMOND","FILE"]; // choose random formation
  563.     [_grp, 0]   setWaypointFormation    _form;                              // set formation
  564.     [_grp, 0]   setWaypointCombatMode   "YELLOW";                           // fire at will
  565.     [_grp, 0]   setWaypointSpeed        "LIMITED";                          // walk
  566.     [_grp, 0]   setWaypointBehaviour    "SAFE";                             // walk but aware  
  567.     _wp         = _grp addWaypoint      [_pos, 0];                          // set WP position
  568.     _wp         setWaypointPosition     [_pos, 0];                          // precise placement
  569.     _wp         setWaypointType         "MOVE";                             // move
  570. // =======================================================================================
  571. //          DEBUG
  572. // ======================================================================================= 
  573.     if (_dbg) then {
  574.         deleteMarker _wpMkr;
  575.         _wpMkrN = format ["marker_%1",floor(random 1000)];
  576.         _wpMkr  = createMarker [_wpMkrN, _pos];
  577.         _wpMkr  setMarkerShape "ICON";
  578.         _wpMkr  setMarkerType "hd_objective";
  579.         _wpMkr  setMarkerColor "ColorYellow";
  580.         _wpMkr  setMarkerText "WAYPOINT";
  581.     };
  582. // =======================================================================================
  583. //          CHECK IF GROUP ALIVE, OR IN A SAFE ZONE, OR REACHED WAYPOINT
  584. // =======================================================================================     
  585.     while   {
  586.                 ({alive _x} count units _grp > 0)
  587.                 &&
  588.                 !(unitReady (leader _grp))
  589.                 &&
  590.                 ({(position leader _grp) inArea (_x)} count _sfz < 1)          
  591.             }
  592.     do      {
  593.                 sleep 1;
  594. // =======================================================================================
  595. //              DEBUG
  596. // ======================================================================================= 
  597.                 if (_dbg) then {
  598.                     _untMkrs apply {deleteMarker _x;};
  599.                     _untMkrs = [];
  600.                     (units _grp) apply {
  601.                     _untMkrN    = format        ["marker_%1",floor(random 1000)];
  602.                     _untMkr     = createMarker  [_untMkrN, getPos _x];
  603.                     _untMkr     setMarkerShape  "ICON";
  604.                     _untMkr     setMarkerType   "mil_triangle";
  605.                     _untMkr     setMarkerColor  "ColorRed";
  606.                     _untMkr     setMarkerText   format ["%1", typeOf _x];
  607.                     _untMkr     setMarkerDir    (getDir _x);
  608.                     _untMkrs   append          [_untMkr];
  609.                     };
  610.                 };
  611.             }; // end of waypoint checks
  612. // =======================================================================================
  613. //              EXIT IF ALL DEAD
  614. // ======================================================================================= 
  615.     if  ({alive _x} count units _grp < 1) exitWith {
  616.         deleteWaypoint _wp;
  617.         if (_dbg) then {(_untMkrs + _dbgMkrs) apply {deleteMarker _x;}; deleteMarker _wpMkr;};
  618.     };
  619. // =======================================================================================
  620. //              STOP AND RESTART IF WAYPOINT DONE
  621. // =======================================================================================     
  622.     if  (unitReady (leader _grp)) then {
  623.         deleteWaypoint _wp;
  624.         if (_dbg) then {deleteMarker _wpMkr;};
  625.     };
  626. // =======================================================================================
  627. //              DOUBLE BACK TO PREVIOUS POINT IF INSIDE A SAFE ZONE
  628. // ======================================================================================= 
  629.     if  ({(position leader _grp) inArea (_x)} count _sfz > 0) then {
  630.         deleteWaypoint _wp;
  631.         _form   = selectRandom ["LINE","STAG COLUMN","WEDGE","DIAMOND","FILE"]; // choose random formation
  632.         [_grp, 0]   setWaypointFormation    _form;                              // set formation
  633.         [_grp, 0]   setWaypointCombatMode   "YELLOW";                           // fire at will
  634.         [_grp, 0]   setWaypointSpeed        "LIMITED";                          // walk
  635.         [_grp, 0]   setWaypointBehaviour    "SAFE";                             // walk but aware  
  636.         _wp         = _grp addWaypoint      [_dbp, 0];                          // set WP position
  637.         _wp         setWaypointPosition     [_dbp, 0];                          // precise placement
  638.         _wp         setWaypointType         "MOVE";                             // move
  639. // =======================================================================================
  640. //                  DEBUG
  641. // ======================================================================================= 
  642.         if (_dbg) then {
  643.             deleteMarker _wpMkr;
  644.             _wpMkrN = format ["marker_%1",floor(random 1000)];
  645.             _wpMkr  = createMarker [_wpMkrN, _dbp];
  646.             _wpMkr  setMarkerShape "ICON";
  647.             _wpMkr  setMarkerType "hd_objective";
  648.             _wpMkr  setMarkerColor "ColorYellow";
  649.             _wpMkr  setMarkerText "WAYPOINT";
  650.         };
  651. // =======================================================================================
  652. //                  CHECK FOR WAYPOINT COMPLETION OR GROUP ALL DEAD
  653. // =======================================================================================     
  654.         while   {
  655.                     ({alive _x} count units _grp > 0)
  656.                     &&
  657.                     !(unitReady (leader _grp))
  658.                 }
  659.         do
  660.                 {
  661.                     sleep 1;
  662. // =======================================================================================
  663. //                      DEBUG
  664. // ======================================================================================= 
  665.                     if (_dbg) then {
  666.                         _untMkrs apply {deleteMarker _x;};
  667.                         _untMkrs = [];
  668.                         (units _grp) apply {
  669.                         _untMkrN    = format        ["marker_%1",floor(random 1000)];
  670.                         _untMkr     = createMarker  [_untMkrN, getPos _x];
  671.                         _untMkr     setMarkerShape  "ICON";
  672.                         _untMkr     setMarkerType   "mil_triangle";
  673.                         _untMkr     setMarkerColor  "ColorRed";
  674.                         _untMkr     setMarkerText   format ["%1", typeOf _x];
  675.                         _untMkr     setMarkerDir    (getDir _x);
  676.                         _untMkrs   append          [_untMkr];
  677.                         };
  678.                     };
  679.                 };
  680. // =======================================================================================
  681. //                      EXIT IF ALL DEAD
  682. // ======================================================================================= 
  683.         if  ({alive _x} count units _grp < 1) exitWith {
  684.             deleteWaypoint _wp;
  685.             if (_dbg) then {(_untMkrs + _dbgMkrs) apply {deleteMarker _x;}; deleteMarker _wpMkr;};
  686.             };
  687. // =======================================================================================
  688. //              STOP AND RESTART IF WAYPOINT DONE
  689. // ======================================================================================= 
  690.         if  (unitReady (leader _grp)) then {
  691.             deleteWaypoint _wp;
  692.             if (_dbg) then {deleteMarker _wpMkr;};
  693.         };
  694.     }; // end of double back position
  695. // =======================================================================================
  696. //  RESTART
  697. // =======================================================================================         
  698. }; // loop back for another patrol point ... or else end of script — group is dead
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top