Advertisement
Nebulazer

Untitled

Aug 31st, 2016
415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 71.72 KB | None | 0 0
  1. /*  
  2. * BASE WARS FUNCTION LIBRARY
  3. *  by Nebulazer
  4. */
  5.  
  6. neb_fnc_core_setStartingPos = {
  7.                         params ["_position"];
  8.                        
  9.                         player setPos _position;    // _position
  10.                         diag_log format["setting player's position to: %1", _position];
  11.                         sleep 1;
  12.                         _real_player_pos = getPos player;
  13.                         diag_log format["position that has been set: %1", _real_player_pos];
  14.                         _tries = 0;
  15.                         sleep 1;
  16.                        
  17.                        
  18.                         while {abs(abs(_real_player_pos select 0) - abs(_position select 0))  > 10 or abs(abs(_real_player_pos select 1) - abs(_position select 1)) > 10} do {
  19.                             diag_log format["player pos is %1 which is not target pos %2. retrying...", _real_player_pos, _position];
  20.                             hint format["position wasn't set correctly; trying again... %1", _tries];
  21.                             sleep 1;
  22.                             _tries = _tries +1;
  23.                             player setPos _position;
  24.                             sleep 1;
  25.                             _real_player_pos = getPos player;
  26.                             diag_log format["player pos is %1 which is not target pos %2. retrying...", _real_player_pos, _position];
  27.                         };
  28. };
  29.  
  30. //Tele to Truck
  31. neb_fnc_core_teleToTruckFree = {
  32.         params ["_home", "_truck", "_action"];
  33.        
  34.         _action = [
  35.     /* 0 object */              _home,
  36.     /* 1 action title */            "Teleport To Mobile FOB (FREE)[AIR]",
  37.     /* 2 idle icon */               "images\blinkicon.paa",
  38.     /* 3 progress icon */           "images\blinkicon.paa",
  39.     /* 4 condition to show */       "true",
  40.     /* 5 condition for action */        "true",
  41.     /* 6 code executed on start */      {},
  42.     /* 7 code executed per tick */      {},
  43.     /* 8 code executed on completion */ {
  44.                                         param[ 3 ] params ["_home","_truck", "_action"];
  45.                                         player setPos [getPos _truck select 0, (getPos _truck select 1), (getPos _truck select 2) +500];
  46.                                         },
  47.     /* 9 code executed on interruption */   {},
  48.     /* 10 arguments */          [_home,_truck, _action],
  49.     /* 11 action duration */        1,
  50.     /* 12 priority */           0,
  51.     /* 13 remove on completion */       false,
  52.     /* 14 show unconscious */       false
  53.     ] call bis_fnc_holdActionAdd;
  54. };
  55.  
  56. neb_fnc_core_teleToTruck = {
  57.     params [ "_home", "_truckVarName" ];
  58.        
  59.     _action = [
  60.     /* 0 object */              _home,
  61.     /* 1 action title */            "Teleport To Mobile FOB ($500)",
  62.     /* 2 idle icon */           "images\blinkicon.paa",
  63.     /* 3 progress icon */           "images\blinkicon.paa",
  64.     /* 4 condition show */              format[ "
  65.                                                    call {
  66.                                                        private _truck = missionNamespace getVariable [ '%1', objNull ];
  67.                                                        !isNull _truck && { alive _truck && canMove _truck }
  68.                                                    };
  69.                                                ", _truckVarName ],
  70.     /* 5 condition progress */              "
  71.                                                    _arguments params [ '_truckVarName' ];
  72.                                                    _truck = missionNamespace getVariable [ _truckVarName, objNull ];
  73.                                                    !isNull _truck && { alive _truck && canMove _truck }
  74.                                                ",
  75.     /* 6 code executed on start */      {},
  76.     /* 7 code executed per tick */      {},
  77.     /* 8 code executed on completion */ {
  78.                             param[ 3 ] params [ "_truckVarName" ];
  79.                             _truck = missionNamespace getVariable [ _truckVarName, objNull ];
  80.                             if ( !isNull _truck && { alive _truck && canMove _truck } ) then {
  81.                                 [ 500 ] call neb_fnc_core_pay;
  82.                                 player setPos ( _truck getPos [ 5, random 360 ] );
  83.                             };
  84.                         },
  85.     /* 9 code executed on interruption */   {},
  86.     /* 10 arguments */          [ _truckVarName ],
  87.     /* 11 action duration */        1,
  88.     /* 12 priority */           0,
  89.     /* 13 remove on completion */       false,
  90.     /* 14 show unconscious */       false
  91.     ] call BIS_fnc_holdActionAdd;
  92. };
  93.  
  94. //Crate Saving
  95. neb_fnc_core_crateSave = {
  96.        
  97.     _crate = player getVariable [ "NEB_shopCrate", objNull ];
  98.     if !( isNull _crate ) then {
  99.         profileNamespace setVariable[ "NEB_telecache",
  100.             [
  101.                 magazineCargo _crate call BIS_fnc_consolidateArray,
  102.                 itemCargo _crate call BIS_fnc_consolidateArray,
  103.                 weaponCargo _crate call BIS_fnc_consolidateArray
  104.             ]
  105.         ];
  106.     };
  107.     saveProfileNamespace;
  108. };
  109.  
  110. //End Mission
  111. neb_fnc_core_ticketCounter = {
  112. _quarterScore = round (endScore / 4);
  113. _midscore = round (endScore / 2);
  114. _threeQuarter = round (endScore / 4) * 3;
  115. _almostEnd = round (endScore / 4) * round 3.8;
  116. _amountleftEnd = endScore - _almostEnd;
  117.     // Blu is at Quarter Score
  118.     if ((bluScore >= _quarterScore) && {isNil "bluQuarterFlag"}) then {
  119.         _scoreText = format [ "Blu Is Now At %1 Out of %2 Points To Win The Game", bluScore, endScore ];
  120.         ["<t color='#1603B0' size = '.8'>" + _scoreText + "</t>",-1,safezoneY + safezoneH - 0.13,4,1,0,825] spawn BIS_fnc_dynamicText;
  121.         bluQuarterFlag = true;
  122.     };
  123.     // Red is at Quarter Score
  124.     if ((redScore >= _quarterScore) && {isNil "redQuarterFlag"}) then {
  125.         _scoreText = format [ "Red Is Now At %1 Out of %2 Points To Win The Game", redScore, endScore ];
  126.         ["<t color='#971F1F' size = '.8'>" + _scoreText + "</t>",-1,safezoneY + safezoneH - 0.07,4,1,0,833] spawn BIS_fnc_dynamicText;
  127.         redQuarterFlag = true ;
  128.         };
  129.  
  130.     // Blu Has Half points needed to win
  131.     if ((bluScore >= _midScore) && {isNil "bluHalfFlag"}) then {
  132.         _scoreText = format [ "Blu Is Now At %1 Out of %2 Points To Win The Game", bluScore, endScore ];
  133.         ["<t color='#1603B0' size = '.8'>" + _scoreText + "</t>",-1,safezoneY + safezoneH - 0.13,4,1,0,845] spawn BIS_fnc_dynamicText;
  134.         bluHalfFlag = true;
  135.         };
  136.  
  137.     // Red Has Half points needed to win
  138.     if ((redScore >= _midScore) && {isNil "redHalfFlag"}) then {
  139.         _scoreText = format [ "Red Is Now At %1 Out of %2 Points To Win The Game", redScore, endScore ];
  140.         ["<t color='#971F1F' size = '.8'>" + _scoreText + "</t>",-1,safezoneY + safezoneH - 0.07,4,1,0,855] spawn BIS_fnc_dynamicText;
  141.         redHalfFlag = true;
  142.         };
  143.  
  144.     if ((bluScore >= _threeQuarter) && {isNil "bluThreeQFlag"}) then {
  145.         _scoreText = format [ "Blu Is Now At %1 Out of %2 Points To Win The Game", bluScore, endScore ];
  146.         ["<t color='#1603B0' size = '.8'>" + _scoreText + "</t>",-1,safezoneY + safezoneH - 0.13,4,1,0,860] spawn BIS_fnc_dynamicText;
  147.         bluThreeQFlag = true;
  148.         };
  149.  
  150.     if ((redScore >= _threeQuarter) && {isNil "redThreeQFlag"}) then {
  151.         _scoreText = format [ "Red Is Now At %1 Out of %2 Points To Win The Game", redScore, endScore ];
  152.         ["<t color='#971F1F' size = '.8'>" + _scoreText + "</t>",-1,safezoneY + safezoneH - 0.07,4,1,0,870] spawn BIS_fnc_dynamicText;
  153.         redThreeQFlag = true;
  154.         };
  155.    
  156.     if ((bluScore >= _almostEnd) && {isNil "bluAlmostFlag"}) then {
  157.         _scoreText = format [ "Blu Only Needs %1 Points To Win The Game!!", _amountleftEnd];
  158.         ["<t color='#1603B0' size = '.8'>" + _scoreText + "</t>",-1,safezoneY + safezoneH - 0.13,4,1,0,875] spawn BIS_fnc_dynamicText;
  159.         bluAlmostFlag = true;
  160.         };
  161.  
  162.     if ((redScore >= _almostEnd) && {isNil "redAlmostFlag"}) then {
  163.         _scoreText = format [ "Red Only Needs %1 Points To Win The Game!!", _amountleftEnd];
  164.         ["<t color='#971F1F' size = '.8'>" + _scoreText + "</t>",-1,safezoneY + safezoneH - 0.07,4,1,0,880] spawn BIS_fnc_dynamicText;
  165.         redAlmostFlag = true;
  166.         };
  167.    
  168.     if (bluScore >= endScore) then {
  169.         //Crate Saving
  170.     [] call neb_fnc_core_crateSave;
  171.     endMission "END1";
  172.         };
  173.     if (redScore >= endScore) then {
  174.         //Crate Saving
  175.     [] call neb_fnc_core_crateSave;
  176.     endMission "END1";
  177.         };
  178.  
  179. };
  180.  
  181. //Take Money
  182. neb_fnc_core_pay = {
  183. params[["_cost", 0], ["_unit", player], ["_paid", false]];
  184. _cash = _unit getVariable["cash", 0];
  185.  
  186. if (_cash >= _cost) then {
  187. _balance = _cash - _cost;
  188. _unit setVariable["cash", _balance, true];
  189. _paid = true;
  190. [] call fnc_updateStats;
  191. saveProfileNamespace;
  192. };
  193. _paid
  194. };
  195.  
  196. // Disable Stamina
  197. neb_fnc_core_disableStamina = {
  198.     params ["_unit"];
  199.     _unit enableStamina false;
  200. };
  201.  
  202. /* Copy gear from a unit
  203. neb_fnc_core_copyGear = {
  204.     params["_object", "_caller", "_id", "_args", "_copyFrom","_loadout"];
  205.     _copyFrom = cursorTarget;
  206.     if (!(_copyFrom isKindOf "Man")) exitWith {};
  207.     _loadout = getUnitLoadout _copyFrom;
  208.     _caller setUnitLoadout _loadout;
  209.     hint format["You copied %1's gear.", name _copyFrom];
  210. };
  211. */
  212.  
  213.        
  214. /*
  215. if (player == red_command)  then{
  216.        
  217.         };
  218.  
  219.     if (player == blu_command)  then{
  220.        
  221.         };
  222. */
  223.  
  224.  
  225. //Protects the commanders from friendly damage.
  226. neb_fnc_core_protectCommander = {
  227.     params["_commander"];
  228.      _commander addEventHandler
  229.      [
  230.          "HandleDamage",
  231.          {
  232.             params["_unit", "_selection", "_damage", "_source", "_projectile", "_hitPart", "_returnDamage"];
  233.              _returnDamage = _damage;
  234.              if ((side _unit) isEqualTo (side _source)) then
  235.                  {
  236.                      _returnDamage = 0;
  237.                  };
  238.              _returnDamage;
  239.         }
  240.     ];
  241. };
  242.  
  243. //Reward from taking merc camp
  244. neb_fnc_core_cashonCamp = {
  245.     params [ "_module", "_owner" ];
  246.  
  247.     //make sure the PV change has happened
  248.     waitUntil{ _module getVariable [ "owner", sideUnknown ] isEqualTo _owner };
  249.     sleep 0.5;
  250.  
  251.     //While the secotr still belongs to the players side
  252.     while{ ( _module getVariable [ "owner", sideUnknown ] ) isEqualTo playerSide } do {
  253.        
  254.         switch (_owner) do {
  255.                                 case west: {
  256.                                 bluScore = bluScore + 1;
  257.                                 };
  258.                                 case east: {
  259.                                 redScore = redScore + 1;
  260.                                 };                             
  261.                             };
  262.         publicVariable "redScore";
  263.         publicVariable "bluScore";
  264.         [ 125, 50 ] remoteExec [ "fnc_updateStats", _owner ];
  265.         sleep 30;
  266.     };
  267. };
  268.  
  269. //Reward from sector East
  270. neb_fnc_core_cashonCiviCamp = {
  271.     params [ "_module", "_owner" ];
  272.  
  273.     //make sure the PV change has happened
  274.     waitUntil{ _module getVariable [ "owner", sideUnknown ] isEqualTo _owner };
  275.     sleep 0.5;
  276.  
  277.     //While the secotr still belongs to the players side
  278.     while{ ( _module getVariable [ "owner", sideUnknown ] ) isEqualTo playerSide } do {
  279.      
  280.       switch (_owner) do {
  281.                                 case west: {
  282.                                 bluScore = bluScore + 1;
  283.                                 };
  284.                                 case east: {
  285.                                 redScore = redScore + 1;
  286.                                 };                             
  287.                             };
  288.                            
  289.          publicVariable "redScore";
  290.          publicVariable "bluScore";
  291.          [ 250, 25 ] remoteExec [ "fnc_updateStats", _owner ];
  292.         sleep 30;
  293.     };
  294. };
  295.  
  296. //Reward from sector West
  297. neb_fnc_core_cashonCiviCampB = {
  298.     params [ "_module", "_owner" ];
  299.  
  300.     //make sure the PV change has happened
  301.     waitUntil{ _module getVariable [ "owner", sideUnknown ] isEqualTo _owner };
  302.     sleep 0.5;
  303.  
  304.     //While the secotr still belongs to the players side
  305.     while{ ( _module getVariable [ "owner", sideUnknown ] ) isEqualTo playerSide } do {
  306.        
  307.         switch (_owner) do {
  308.                                 case west: {
  309.                                 bluScore = bluScore + 1;
  310.                                 };
  311.                                 case east: {
  312.                                 redScore = redScore + 1;
  313.                                 };
  314.                             };
  315.         publicVariable "redScore";
  316.         publicVariable "bluScore";
  317.         [ 250, 25 ] remoteExec [ "fnc_updateStats", _owner ];
  318.         sleep 30;
  319.     };
  320. };
  321.  
  322. //Reward For taking Red Base
  323. neb_fnc_core_bluWin = {
  324.   params [ "_module", "_owner" ];
  325.  
  326.     //make sure the PV change has happened
  327.     waitUntil{ _module getVariable [ "owner", sideUnknown ] isEqualTo _owner };
  328.     sleep 0.5;
  329.  
  330.     //While the secotr still belongs to the players side
  331.     while{ ( _module getVariable [ "owner", sideUnknown ] ) isEqualTo WEST } do {
  332.     player globalChat "Opfor is Holding Blufors Coms Tower";
  333.     [ 500, 100 ] remoteExec [ "fnc_updateStats", _owner ];
  334.     bluScore = bluScore + 2;
  335.     publicVariable "bluScore";
  336.     sleep 30;
  337.     //endMission "END1";
  338.         };  
  339.     };
  340.  
  341. //Reward for taking Blu Base
  342. neb_fnc_core_redWin = {
  343.   params [ "_module", "_owner" ];
  344.  
  345.     //make sure the PV change has happened
  346.     waitUntil{ _module getVariable [ "owner", sideUnknown ] isEqualTo _owner };
  347.     sleep 0.5;
  348.  
  349.     //While the secotr still belongs to the players side
  350.     while{ ( _module getVariable [ "owner", sideUnknown ] ) isEqualTo EAST } do {
  351.     player globalChat "Opfor is Holding Blufors Coms Tower";
  352.     [ 500, 100 ] remoteExec [ "fnc_updateStats", _owner ];
  353.     redScore = redScore + 2;
  354.     publicVariable "redScore";
  355.     sleep 30;
  356.    
  357.         };  
  358.     };
  359.    
  360. //Level Rewards after Respawn
  361. neb_fnc_core_levelRewards = {
  362.         private ["_myLvl"];
  363.         _myLvl = player getVariable [ "level", 0 ];
  364.         _starterClothes = ["U_C_Poloshirt_blue","U_C_Poloshirt_burgundy","U_C_Poloshirt_stripped",
  365.         "U_C_Poloshirt_tricolour","U_C_Poloshirt_salmon","U_C_Poloshirt_redwhite","U_OrestesBody"] call BIS_fnc_selectRandom;
  366.         //_starterHat = ["","","",""]
  367.         switch (playerSide) do {
  368.                 case west: {
  369.                 if (_myLvl >=1) then {
  370.                 player forceAddUniform _starterClothes;
  371.                 player addVest "V_Rangemaster_belt";
  372.                 {player removeWeapon _x} forEach weapons player;
  373.                 {player removeMagazine _x} forEach magazines player;
  374.                 //Add new weapons
  375.                 player addMagazine '30Rnd_9x21_Mag_SMG_02_Tracer_Red';
  376.                 player addWeapon 'SMG_05_F';
  377.                 player addMagazines ['30Rnd_9x21_Mag_SMG_02_Tracer_Red', 3];
  378.                 player addMagazine '30Rnd_9x21_Mag';
  379.                 player addWeapon 'hgun_P07_khk_F';
  380.                 player addMagazines ['16Rnd_9x21_Mag', 2];
  381.                 player addItem "FirstAidKit";
  382.                 player addPrimaryWeaponItem 'optic_ACO';
  383.                 player addItem "itemGPS";
  384.                 player assignItem "itemGPS";
  385.                 };
  386.                 if (_myLvl >=5) then {
  387.                 player addeventhandler ["HandleDamage",{(_this select 2) / 10;} ];
  388.                 player forceAddUniform "U_B_T_Soldier_AR_F";
  389.                 player addHeadGear "H_HelmetB_Light_tna_F";
  390.                 player addBackpack "B_AssaultPack_tna_F";
  391.                 {player removeWeapon _x} forEach weapons player;
  392.                 {player removeMagazine _x} forEach magazines player;
  393.                 //Add new weapons
  394.                 player addMagazine '30Rnd_556x45_Stanag_Tracer_Red';
  395.                 player addWeapon 'arifle_SPAR_01_blk_F';
  396.                 player addMagazines ['30Rnd_556x45_Stanag_Tracer_Red', 3];
  397.                 player addMagazine '30Rnd_9x21_Mag';
  398.                 player addWeapon 'hgun_P07_khk_F';
  399.                 player addMagazines ['16Rnd_9x21_Mag', 2];
  400.                 player addPrimaryWeaponItem 'optic_ACO';
  401.                 player addItem "FirstAidKit";
  402.                 player addItem "FirstAidKit";
  403.                 player addMagazines ['HandGrenade', 4];
  404.                 player addMagazines ['30Rnd_556x45_Stanag_Tracer_Red', 4];
  405.                 player addItem "FirstAidKit";
  406.                
  407.                 };
  408.                 if (_myLvl >=10) then {
  409.                 removeVest player;
  410.                 player addVest "V_TacChestrig_oli_F";
  411.                
  412.                 };
  413.                 if (_myLvl >=15) then {
  414.                 removeHeadgear player;
  415.                 player addHeadgear "H_HelmetB_tna_F";
  416.                 player addMagazine 'HandGrenade';              
  417.                 };
  418.                 if (_myLvl >=20) then {
  419.                 removeVest player;
  420.                 player addVest "V_TacVest_oli";
  421.                 player forceAddUniform "U_B_T_Soldier_F";
  422.                 {player removeWeapon _x} forEach weapons player;
  423.                 {player removeMagazine _x} forEach magazines player;
  424.                 //Add new weapons
  425.                 player addMagazines ['HandGrenade', 5];
  426.                 player addMagazine '30Rnd_65x39_caseless_mag';
  427.                 player addWeapon 'arifle_MX_khk_F';
  428.                 player addPrimaryWeaponItem 'optic_ERCO_khk_F';
  429.                 player addMagazines ['30Rnd_65x39_caseless_mag', 6];
  430.                 player addMagazine '30Rnd_9x21_Mag';
  431.                 player addWeapon 'hgun_P07_khk_F';
  432.                 player addMagazines ['16Rnd_9x21_Mag', 2];
  433.                 player addItem "FirstAidKit";
  434.                 player addItem "FirstAidKit";
  435.                 player addItem "FirstAidKit";
  436.                 player addItem "FirstAidKit";
  437.                 };
  438.                 if (_myLvl >=25) then {
  439.                 removeVest player;
  440.                 player addVest "V_PlateCarrier1_tna_F";
  441.                 player addMagazines ['30Rnd_65x39_caseless_mag', 4];
  442.                 player addMagazines ['16Rnd_9x21_Mag', 2];
  443.                 player addItem "FirstAidKit";
  444.                 player addItem "FirstAidKit";
  445.                 player addItem "FirstAidKit";
  446.                 player addItem "FirstAidKit";
  447.                 };
  448.                 if (_myLvl >=30) then {
  449.                 removeVest player;
  450.                 player addVest "V_PlateCarrier2_tna_F";
  451.                 player addMagazines ['30Rnd_65x39_caseless_mag', 4];
  452.                 player addMagazines ['16Rnd_9x21_Mag', 2];
  453.                 player addItem "FirstAidKit";
  454.                 player addItem "FirstAidKit";
  455.                 player addItem "FirstAidKit";
  456.                 player addItem "FirstAidKit";
  457.                 };
  458.                 if (_myLvl >=35) then {
  459.                 removeVest player;
  460.                 player addVest "Vest_V_PlateCarrierSpec_tna_F";
  461.                 player addMagazines ['30Rnd_65x39_caseless_mag', 4];
  462.                 player addMagazines ['16Rnd_9x21_Mag', 2];
  463.                 player addItem "FirstAidKit";
  464.                 player addItem "FirstAidKit";
  465.                 player addItem "FirstAidKit";
  466.                 player addItem "FirstAidKit";
  467.                 };
  468.                 if (_myLvl >=40) then {
  469.                 removeVest player;
  470.                 player addVest "V_PlateCarrierGL_tna_F";
  471.                 player addMagazines ['30Rnd_65x39_caseless_mag', 4];
  472.                 player addMagazines ['16Rnd_9x21_Mag', 2];
  473.                 player addItem "FirstAidKit";
  474.                 player addItem "FirstAidKit";
  475.                 player addItem "FirstAidKit";
  476.                 player addItem "FirstAidKit";
  477.                 };
  478.                 if (_myLvl >=45) then {
  479.                 removeVest player;
  480.                 player addVest "V_PlateCarrierIAGL_oli";
  481.                 player addMagazines ['30Rnd_65x39_caseless_mag', 4];
  482.                 player addMagazines ['16Rnd_9x21_Mag', 2];
  483.                 player addItem "FirstAidKit";
  484.                 player addItem "FirstAidKit";
  485.                 player addItem "FirstAidKit";
  486.                 player addItem "FirstAidKit";
  487.                 };
  488.             };
  489.  
  490.  
  491.         case east: {
  492.                 if (_myLvl >=1) then {
  493.                 player forceAddUniform _starterClothes;
  494.                 player addVest "V_Rangemaster_belt";
  495.                 {player removeWeapon _x} forEach weapons player;
  496.                 {player removeMagazine _x} forEach magazines player;
  497.                 //Add new weapons
  498.                 player addMagazine '30Rnd_9x21_Mag_SMG_02_Tracer_Red';
  499.                 player addWeapon 'SMG_05_F';
  500.                 player addMagazines ['30Rnd_9x21_Mag_SMG_02_Tracer_Red', 3];
  501.                 player addMagazine '30Rnd_9x21_Mag';
  502.                 player addWeapon 'hgun_Rook40_F';
  503.                 player addMagazines ['16Rnd_9x21_Mag', 2];
  504.                 player addPrimaryWeaponItem 'optic_ACO';
  505.                 player addItem "itemGPS";
  506.                 player assignItem "itemGPS";
  507.                 };
  508.                 if (_myLvl >=5) then {
  509.                 player forceAddUniform "U_O_T_Soldier_F";
  510.                 player addHeadGear "H_CrewHelmetHeli_O";
  511.                 player addBackpack "B_FieldPack_ghex_F";
  512.                 {player removeWeapon _x} forEach weapons player;
  513.                 {player removeMagazine _x} forEach magazines player;
  514.                 //Add new weapons
  515.                 player addMagazine '30Rnd_580x42_Mag_F';
  516.                 player addWeapon 'arifle_CTAR_blk_F';
  517.                 player addMagazines ['30Rnd_580x42_Mag_F', 3];
  518.                 player addMagazine '30Rnd_9x21_Mag';
  519.                 player addWeapon 'hgun_Rook40_F';
  520.                 player addMagazines ['16Rnd_9x21_Mag', 2];
  521.                 player addPrimaryWeaponItem 'optic_ACO';
  522.                 player addItem "FirstAidKit";
  523.                 player addItem "FirstAidKit";
  524.                 player addMagazines ['HandGrenade', 4];
  525.                 player addMagazines ['30Rnd_580x42_Mag_F', 4];
  526.                 };
  527.                 if (_myLvl >=10) then {
  528.                 removeVest player;
  529.                 player addVest "V_HarnessO_ghex_F";
  530.                
  531.                 };
  532.                 if (_myLvl >=15) then {
  533.                 removeHeadgear player;
  534.                 player addHeadgear "H_HelmetO_ghex_F";
  535.                 player addMagazine 'HandGrenade';
  536.                 player addBackpack "B_FieldPack_ghex_F";               
  537.                 };
  538.                 if (_myLvl >=20) then {
  539.                 removeVest player;
  540.                 player addVest "V_TacVest_oli";
  541.                 {player removeWeapon _x} forEach weapons player;
  542.                 {player removeMagazine _x} forEach magazines player;
  543.                 //Add new weapons
  544.                 player addMagazines ['HandGrenade', 5];
  545.                 player addMagazine '30Rnd_65x39_caseless_green';
  546.                 player addWeapon 'arifle_ARX_ghex_F';
  547.                 player addPrimaryWeaponItem 'optic_ARCO_ghex_F';
  548.                 player addMagazines ['30Rnd_65x39_caseless_green', 6];
  549.                 player addMagazine '30Rnd_9x21_Mag';
  550.                 player addWeapon 'hgun_Rook40_F';
  551.                 player addMagazines ['16Rnd_9x21_Mag', 2];
  552.                 player addItem "FirstAidKit";
  553.                 player addItem "FirstAidKit";
  554.                 player addItem "FirstAidKit";
  555.                 player addItem "FirstAidKit";
  556.                 };
  557.                 if (_myLvl >=25) then {
  558.                 removeVest player;
  559.                 player addVest "V_PlateCarrier1_rgr_noflag_F";
  560.                 player addMagazines ['30Rnd_65x39_caseless_green', 4];
  561.                 player addMagazines ['16Rnd_9x21_Mag', 2];
  562.                 player addItem "FirstAidKit";
  563.                 player addItem "FirstAidKit";
  564.                 player addItem "FirstAidKit";
  565.                 player addItem "FirstAidKit";
  566.                 };
  567.                 if (_myLvl >=30) then {
  568.                 removeVest player;
  569.                 player addVest "V_PlateCarrier2_rgr_noflag_F";
  570.                 player addMagazines ['30Rnd_65x39_caseless_green', 4];
  571.                 player addMagazines ['16Rnd_9x21_Mag', 2];
  572.                 player addItem "FirstAidKit";
  573.                 player addItem "FirstAidKit";
  574.                 player addItem "FirstAidKit";
  575.                 player addItem "FirstAidKit";
  576.                 };
  577.                 if (_myLvl >=35) then {
  578.                 removeVest player;
  579.                 player addVest "V_PlateCarrierSpec_rgr";
  580.                 player addMagazines ['30Rnd_65x39_caseless_green', 4];
  581.                 player addMagazines ['16Rnd_9x21_Mag', 2];
  582.                 player addItem "FirstAidKit";
  583.                 player addItem "FirstAidKit";
  584.                 player addItem "FirstAidKit";
  585.                 player addItem "FirstAidKit";
  586.                 };
  587.                 if (_myLvl >=40) then {
  588.                 removeVest player;
  589.                 player addVest "V_PlateCarrierGL_rgr";
  590.                 player addMagazines ['30Rnd_65x39_caseless_green', 4];
  591.                 player addMagazines ['16Rnd_9x21_Mag', 2];
  592.                 player addItem "FirstAidKit";
  593.                 player addItem "FirstAidKit";
  594.                 player addItem "FirstAidKit";
  595.                 player addItem "FirstAidKit";
  596.                 };
  597.                 if (_myLvl >=45) then {
  598.                 removeVest player;
  599.                 player addVest "V_PlateCarrierIAGL_dgtl";
  600.                 player addMagazines ['30Rnd_65x39_caseless_green', 4];
  601.                 player addMagazines ['16Rnd_9x21_Mag', 2];
  602.                 player addItem "FirstAidKit";
  603.                 player addItem "FirstAidKit";
  604.                 player addItem "FirstAidKit";
  605.                 player addItem "FirstAidKit";
  606.                 };
  607.         };
  608.     };
  609. };
  610.  
  611. //Show Markers over friendlies
  612. neb_fnc_core_playerMarkers = {
  613.                 if (isDedicated) exitWith {}; // is server  
  614. if (!isNil{aero_player_markers_pos}) exitWith {}; // already running
  615.                    
  616. private ["_marker","_markerText","_temp","_unit","_vehicle","_markerNumber","_show","_injured","_text","_num","_getNextMarker","_getMarkerColor","_showAllSides","_showPlayers","_showAIs","_l"];
  617.  
  618. _showAllSides=false;
  619. _showPlayers=false;
  620. _showAIs=false;
  621.  
  622. if(count _this==0) then {
  623.     _showAllSides=false;
  624.     _showPlayers=true;
  625.     _showAIs=!isMultiplayer;
  626. };
  627.                          
  628. {
  629.     _l=toLower _x;
  630.     if(_l in ["player","players"]) then {
  631.         _showPlayers=true;
  632.     };
  633.     if(_l in ["ai","ais"]) then {
  634.         _showAIs=true;
  635.     };
  636.     if(_l in ["allside","allsides"]) then {
  637.         _showAllSides=true;
  638.     };
  639. } forEach _this;
  640.  
  641. aero_player_markers_pos = [0,0];
  642. onMapSingleClick "aero_player_markers_pos=_pos;";
  643.  
  644. _getNextMarker = {
  645.     private ["_marker"];
  646.     _markerNumber = _markerNumber + 1;
  647.     _marker = format["um%1",_markerNumber];
  648.     if(getMarkerType _marker == "") then {
  649.         createMarkerLocal [_marker, _this];
  650.     } else {
  651.         _marker setMarkerPosLocal _this;
  652.     };
  653.     _marker;
  654. };
  655.  
  656. _getMarkerColor = {
  657.     [(((side _this) call bis_fnc_sideID) call bis_fnc_sideType),true] call bis_fnc_sidecolor;
  658. };
  659.  
  660. while {true} do {
  661.      
  662.     waitUntil {
  663.         sleep 0.025;
  664.         true;
  665.     };
  666.    
  667.     _markerNumber = 0;
  668.    
  669.     // show players or player's vehicles
  670.     {
  671.         _show = false;
  672.         _injured = false;
  673.         _unit = _x;
  674.        
  675.         if(
  676.             (
  677.                 (_showAIs && {!isPlayer _unit} && {0=={ {_x==_unit} count crew _x>0} count allUnitsUav}) ||
  678.                 (_showPlayers && {isPlayer _unit})
  679.             ) && {
  680.                 _showAllSides || side _unit==side player
  681.             }
  682.         ) then {   
  683.             if((crew vehicle _unit) select 0 == _unit) then {
  684.                 _show = true;
  685.             };     
  686.             if(!alive _unit || damage _unit > 0.9) then {
  687.                 _injured = true;
  688.             };   
  689.             if(!isNil {_unit getVariable "hide"}) then {
  690.                 _show = false;
  691.             };  
  692.             if(_unit getVariable ["BTC_need_revive",-1] == 1) then {
  693.                 _injured = true;
  694.                 _show = false;
  695.             };       
  696.             if(_unit getVariable ["NORRN_unconscious",false]) then {
  697.                 _injured = true;
  698.             };             
  699.         };
  700.                  
  701.         if(_show) then {
  702.             _vehicle = vehicle _unit;                  
  703.             _pos = getPosATL _vehicle;                         
  704.             _color = _unit call _getMarkerColor;  
  705.  
  706.             _markerText = _pos call _getNextMarker;                    
  707.             _markerText setMarkerColorLocal _color;                                        
  708.             _markerText setMarkerTypeLocal "c_unknown";                    
  709.             _markerText setMarkerSizeLocal [0.8,0];
  710.  
  711.             _marker = _pos call _getNextMarker;        
  712.             _marker setMarkerColorLocal _color;
  713.             _marker setMarkerDirLocal getDir _vehicle;
  714.             _marker setMarkerTypeLocal "mil_triangle";
  715.             _marker setMarkerTextLocal ""; 
  716.             _playerLevel = _x getVariable [ "level", 0 ];
  717.             if(_vehicle == vehicle player) then {
  718.                 _marker setMarkerSizeLocal [0.8,1];
  719.             } else {
  720.                 _marker setMarkerSizeLocal [0.5,0.7];
  721.             };
  722.            
  723.             if(_vehicle != _unit && !(_vehicle isKindOf "ParachuteBase")) then {                                   
  724.                 _text = format["[%1]", getText(configFile>>"CfgVehicles">>typeOf _vehicle>>"DisplayName")];
  725.                 if(!isNull driver _vehicle) then {
  726.                     _text = format["%1 %2 %3", name driver _vehicle, _text, _playerLevel]; 
  727.                 };                                                 
  728.                
  729.                 if((aero_player_markers_pos distance getPosATL _vehicle) < 50) then {
  730.                     aero_player_markers_pos = getPosATL _vehicle;
  731.                     _num = 0;
  732.                     {
  733.                         if(alive _x && isPlayer _x && _x != driver _vehicle) then {                    
  734.                             _text = format["%1%2 %3 %4", _text, if(_num>0)then{","}else{""}, name _x, _playerLevel];
  735.                             _num = _num + 1;
  736.                         };                     
  737.                     } forEach crew _vehicle;
  738.                 } else {
  739.                     _num = {alive _x && isPlayer _x && _x != driver _vehicle} count crew _vehicle;
  740.                     if (_num>0) then {                 
  741.                         if (isNull driver _vehicle) then {
  742.                             _text = format["%1 %2 %3", _text, name (crew _vehicle select 0), _playerLevel];
  743.                             _num = _num - 1;
  744.                         };
  745.                         if (_num>0) then {
  746.                             _text = format["%1 +%2", _text, _num];
  747.                         };
  748.                     };
  749.                 };                     
  750.             } else {
  751.                 _text = name _x;           
  752.             };
  753.             _markerText setMarkerTextLocal _text;
  754.         };
  755.        
  756.     } forEach allUnits;
  757.  
  758.  
  759.     // show player controlled uavs
  760.     {
  761.         if(isUavConnected _x) then {   
  762.             _unit=(uavControl _x) select 0;
  763.             if(
  764.                 (              
  765.                     (_showAIs && {!isPlayer _unit}) ||
  766.                     (_showPlayers && {isPlayer _unit})
  767.                 ) && {
  768.                     _showAllSides || side _unit==side player
  769.                 }
  770.             ) then {
  771.                 _color = _x call _getMarkerColor;                                                                                      
  772.                 _pos = getPosATL _x;
  773.                
  774.                 _marker = _pos call _getNextMarker;        
  775.                 _marker setMarkerColorLocal _color;
  776.                 _marker setMarkerDirLocal getDir _x;
  777.                 _marker setMarkerTypeLocal "mil_triangle";         
  778.                 _marker setMarkerTextLocal "";
  779.                 if(_unit == player) then {
  780.                     _marker setMarkerSizeLocal [0.8,1];
  781.                 } else {
  782.                     _marker setMarkerSizeLocal [0.5,0.7];
  783.                 };
  784.                                            
  785.                 _markerText = _pos call _getNextMarker;
  786.                 _markerText setMarkerColorLocal _color;    
  787.                 _markerText setMarkerTypeLocal "c_unknown";
  788.                 _markerText setMarkerSizeLocal [0.8,0];
  789.                 _markerText setMarkerTextLocal format["%1 [%2]", name _unit, getText(configFile>>"CfgVehicles">>typeOf _x>>"DisplayName")];
  790.             };
  791.         };
  792.     } forEach allUnitsUav;
  793.    
  794.    
  795.    
  796.  
  797.     _markerNumber = _markerNumber + 1;
  798.     _marker = format["um%1",_markerNumber];
  799.     while {(getMarkerType _marker) != ""} do {
  800.         deleteMarkerLocal _marker;
  801.         _markerNumber = _markerNumber + 1;
  802.         _marker = format["um%1",_markerNumber];
  803.         };
  804.      
  805.     };
  806. };
  807.  
  808.  
  809. //Diary entry
  810. neb_fnc_core_instructions = {
  811.                 player createDiaryRecord ["Welcome", ["Welcome to Base Wars!", "Level Up And Buy New Gear From The Shop, Capture The Enemy Coms Tower To Win The Game."]];
  812. };
  813.  
  814. //Starting Money and Level
  815. neb_fnc_core_startingStats = {
  816.                 player getVariable ["cash",0];
  817.                 _newCash = [500, 20000] select (player in [blu_command, red_command]);
  818.                 _xpgain = (player getVariable ["experience", 0]) + 100;
  819.                 player setVariable ["cash", _newCash];
  820.                 player setVariable ["experience", _xpgain, true];  
  821.                 [ [], "fnc_updateStats", player ] call BIS_fnc_MP;
  822.                
  823. };
  824.  
  825. //Open Parachute at 100m
  826. neb_fnc_core_openChute = {
  827.                 while {true} do {
  828.                     if ( (getPosATL player select 2 > 100) && (vehicle player IsEqualto player) && (alive player)) then {
  829.                         waitUntil {(position player select 2) <= 100};
  830.                         chute = createVehicle ['Steerable_Parachute_F', position Player, [], 0, 'FLY'];
  831.                         chute setPos position player;
  832.                         player moveIndriver chute;
  833.                         chute allowDamage false;
  834.                         };
  835.                     sleep 2;
  836.     };
  837. };
  838.  
  839.  
  840. //Cleanup script
  841. neb_fnc_core_repeatCleanUp = {
  842.     if (!isServer) exitWith {}; // isn't server        
  843.  
  844.     #define PUSH(A,B) A set [count (A),B];
  845.     #define REM(A,B) A=A-[B];
  846.  
  847.     private ["_ttdBodies","_ttdVehiclesDead","_ttdVehiclesImmobile","_ttdWeapons","_ttdPlanted","_ttdSmokes","_addToCleanup","_unit","_objectsToCleanup","_timesWhenToCleanup","_removeFromCleanup"];
  848.  
  849.     _ttdBodies=[_this,0,0,[0]] call BIS_fnc_param;
  850.     _ttdVehiclesDead=[_this,1,0,[0]] call BIS_fnc_param;
  851.     _ttdVehiclesImmobile=[_this,2,0,[0]] call BIS_fnc_param;
  852.     _ttdWeapons=[_this,3,0,[0]] call BIS_fnc_param;
  853.     _ttdPlanted=[_this,4,0,[0]] call BIS_fnc_param;
  854.     _ttdSmokes=[_this,5,0,[0]] call BIS_fnc_param;
  855.  
  856.     if({_x>0}count _this==0) exitWith {}; // all times are 0, we do not want to run this script at all
  857.  
  858.  
  859.     _objectsToCleanup=[];
  860.     _timesWhenToCleanup=[];
  861.  
  862.     _addToCleanup = {
  863.         _object = _this select 0;
  864.         if(!(_object getVariable["persistent",false])) then {
  865.             _newTime = (_this select 1)+time;
  866.             _index = _objectsToCleanup find _object;
  867.             if(_index == -1) then {
  868.                 PUSH(_objectsToCleanup,_object)
  869.                 PUSH(_timesWhenToCleanup,_newTime)
  870.             } else {
  871.                 _currentTime = _timesWhenToCleanup select _index;
  872.                 if(_currentTime>_newTime) then {       
  873.                     _timesWhenToCleanup set[_index, _newTime];
  874.                 };
  875.             };             
  876.         };
  877.     };
  878.  
  879.     _removeFromCleanup = {
  880.         _object = _this select 0;
  881.         _index = _objectsToCleanup find _object;
  882.         if(_index != -1) then {
  883.             _objectsToCleanup set[_index, 0];
  884.             _timesWhenToCleanup set[_index, 0];
  885.         };             
  886.     };
  887.  
  888.  
  889.     while{true} do {
  890.  
  891.         sleep 10;
  892.            
  893.         {  
  894.             _unit = _x;
  895.            
  896.             if (_ttdWeapons>0) then {
  897.                 {
  898.                     {    
  899.                         [_x, _ttdWeapons] call _addToCleanup;          
  900.                     } forEach (getpos _unit nearObjects [_x, 100]);
  901.                 } forEach ["WeaponHolder","GroundWeaponHolder","WeaponHolderSimulated"];
  902.             };
  903.            
  904.             if (_ttdPlanted>0) then {
  905.                 {
  906.                     {
  907.                         [_x, _ttdPlanted] call _addToCleanup;  
  908.                     } forEach (getpos _unit nearObjects [_x, 100]);
  909.                 } forEach ["TimeBombCore"];
  910.             };
  911.            
  912.             if (_ttdSmokes>0) then {
  913.                 {
  914.                     {    
  915.                         [_x, _ttdSmokes] call _addToCleanup;
  916.                     } forEach (getpos _unit nearObjects [_x, 100]);
  917.                 } forEach ["SmokeShell"];
  918.             };
  919.        
  920.         } forEach allUnits;
  921.        
  922.         {
  923.             if (_x getVariable [ "cleanup", true ] && (count units _x)==0) then {
  924.             deleteGroup _x;
  925.             };
  926.         } forEach allGroups;
  927.        
  928.         if (_ttdBodies>0) then {
  929.             {
  930.                 [_x, _ttdBodies] call _addToCleanup;
  931.             } forEach allDeadMen;
  932.         }; 
  933.        
  934.         if (_ttdVehiclesDead>0) then {     
  935.             {
  936.                 if(_x == vehicle _x) then { // make sure its vehicle    
  937.                     [_x, _ttdVehiclesDead] call _addToCleanup;
  938.                 };
  939.             } forEach (allDead - allDeadMen); // all dead without dead men == mostly dead vehicles
  940.         };
  941.        
  942.         if (_ttdVehiclesImmobile>0) then {     
  943.             {
  944.                 if(!canMove _x && {alive _x}count crew _x==0) then {    
  945.                     [_x, _ttdVehiclesImmobile] call _addToCleanup;
  946.                 } else {
  947.                     [_x] call _removeFromCleanup;
  948.                 };
  949.             } forEach vehicles;
  950.         };
  951.  
  952.                            
  953.         REM(_objectsToCleanup,0)
  954.         REM(_timesWhenToCleanup,0)
  955.  
  956.         {        
  957.             if(isNull(_x)) then {
  958.                 _objectsToCleanup set[_forEachIndex, 0];
  959.                 _timesWhenToCleanup set[_forEachIndex, 0];
  960.             } else {
  961.                 if(_timesWhenToCleanup select _forEachIndex < time) then {
  962.                     deleteVehicle _x;
  963.                     _objectsToCleanup set[_forEachIndex, 0];
  964.                     _timesWhenToCleanup set[_forEachIndex, 0];             
  965.                 };
  966.             }; 
  967.         } forEach _objectsToCleanup;
  968.        
  969.         REM(_objectsToCleanup,0)
  970.         REM(_timesWhenToCleanup,0)
  971.                
  972.     };
  973. };
  974.  
  975.  
  976. //Set Side Relations
  977. neb_fnc_core_setRelations = {
  978.                 EAST setFriend [CIVILIAN,1];
  979.                 WEST setFriend [CIVILIAN,1];
  980.                 CIVILIAN setFriend [WEST,1];
  981.                 CIVILIAN setFriend [EAST,1];
  982.                 RESISTANCE setFriend [WEST,0];
  983.                 RESISTANCE setFriend [EAST,0];
  984.                 WEST setFriend [RESISTANCE,0];
  985.                 EAST setFriend [RESISTANCE,0];
  986. };
  987.  
  988.  
  989. //Lightning Ability
  990. neb_fnc_core_strikeLightning = {
  991.                 private ["_strikeTarget","_dummy"];
  992.                 _strikeTarget = cursorObject;
  993.                 _strikeLoc =  (getPos _strikeTarget);
  994.                 _validObject = nearestObject _strikeLoc;
  995.                 if (_strikeLoc isequalto [0,0,0]) then {
  996.                 [_validObject,nil,true] call BIS_fnc_moduleLightning;
  997.                 }else{
  998.  
  999.                 [_strikeTarget,nil,true] call BIS_fnc_moduleLightning;
  1000.  
  1001.                 hint "";
  1002.                     };
  1003. };
  1004.  
  1005. //Sign Texture loading
  1006. neb_fnc_core_signTextures = {
  1007.                 vehStoreSign1 setdir getdir(vehStoreSign1);
  1008.                 vehStoreSign1 SetObjectTextureGlobal [0,"images\storesignA.jpg"];
  1009.                 vehStoreSign1 attachTo [vehStoreSign1,[0,-.1,0.6]];
  1010.  
  1011.                 vehMenuBluSpawn setdir getdir(vehMenuBluSpawn);
  1012.                 vehMenuBluSpawn SetObjectTextureGlobal [0,"images\computerscreenA.jpg"];
  1013.                 vehMenuBluSpawn attachTo [vehMenuBluSpawn,[0,-.1,0.6]];
  1014.  
  1015.                 MenuBlu setdir getdir(MenuBlu);
  1016.                 MenuBlu SetObjectTextureGlobal [0,"images\computerscreenA.jpg"];
  1017.                 MenuBlu attachTo [MenuBlu,[0,-.1,0.6]];
  1018. };
  1019.  
  1020. /*Blu Vehicle Spawns*/
  1021.  
  1022. //Prowler 1 spawn
  1023. neb_fnc_core_bluVehicleSpawnA = {
  1024. //BLULSV1
  1025.     if (isServer) then {
  1026.             disableSerialization;
  1027.             private["_position","_direction","_nearestTargets","_scanArea"];
  1028.     //Create Marker
  1029.             createMarker ["LSVB1",[2926,13069]];
  1030.             "LSVB1" setMarkerType "Empty";
  1031.             "LSVB1" setMarkerSize [2, 2];
  1032.             while{true} do{
  1033.     //Check if the marker has any cars near it
  1034.             _position = getMarkerPos "LSVB1";
  1035.             _scanArea = 5;
  1036.             _direction = 125;
  1037.             _nearestTargets = nearestObjects[_position,["landVehicle","Air","Ship"],_scanArea] select 0;
  1038.     //if the marker has no cars near it then spawn the new car with nothing in inventory
  1039.     if (!isNil "_nearestTargets") then {
  1040.                 sleep 20;
  1041.             }else{
  1042.                    
  1043.                     _veh = createVehicle ["B_T_LSV_01_unarmed_F", _position, [], 0, "NONE"];
  1044.                     _veh setVariable ["BIS_enableRandomization", false];
  1045.                     _veh setDir _direction;
  1046.                     clearWeaponCargoGlobal _veh;
  1047.                     clearMagazineCargoGlobal _veh;
  1048.                     clearItemCargoGlobal _veh;
  1049.                     _veh setVehicleVarName "BluLSV1";
  1050.                     BluLSV1 = _veh;
  1051.                     [BluLSV1] call neb_fnc_addBounty;
  1052.                     waitUntil {!alive BluLSV1};
  1053.                     sleep .5;
  1054.                     BluLSV1 = nil;
  1055.                     sleep 10;
  1056.                 };
  1057.             };
  1058.         };
  1059. };
  1060.  
  1061. //Prowler 2 Spawn
  1062. neb_fnc_core_bluVehicleSpawnB = {
  1063. //BLULSV2
  1064.     if (isServer) then {
  1065.             disableSerialization;
  1066.             private["_position","_direction","_nearestTargets","_scanArea"];
  1067.     //Create Marker
  1068.             createMarker ["LSVB2",[3132.202,13601.272]];
  1069.             "LSVB2" setMarkerType "Empty";
  1070.             "LSVB2" setMarkerSize [2, 2];
  1071.             while{true} do{
  1072.     //Check if the marker has any cars near it
  1073.             _position = getMarkerPos "LSVB2";
  1074.             _scanArea = 5;
  1075.             _direction = 200;
  1076.             _nearestTargets = nearestObjects[_position,["landVehicle","Air","Ship"],12] select 0;
  1077.     //if the marker has no cars near it then spawn the new car with nothing in inventory
  1078.     if (!isNil "_nearestTargets") then {
  1079.                 sleep 20;
  1080.             }else{
  1081.                    
  1082.                     _veh = createVehicle ["B_T_LSV_01_unarmed_F", _position, [], 0, "NONE"];
  1083.                     _veh setVariable ["BIS_enableRandomization", false];
  1084.                     _veh setDir _direction;
  1085.                     clearWeaponCargoGlobal _veh;
  1086.                     clearMagazineCargoGlobal _veh;
  1087.                     clearItemCargoGlobal _veh;
  1088.                     _veh setVehicleVarName "BluLSV2";
  1089.                     BluLSV2 = _veh;
  1090.                     [BluLSV2] call neb_fnc_addBounty;
  1091.                     waitUntil {!alive BluLSV2};
  1092.                     sleep .5;
  1093.                     BluLSV3 = nil;
  1094.                     sleep 10;
  1095.             };
  1096.         };
  1097.     };
  1098. };
  1099. //Prowler 3 Spawn
  1100. neb_fnc_core_bluVehicleSpawnC = {
  1101. //BLULSV2
  1102.     if (isServer) then {
  1103.             disableSerialization;
  1104.             private["_position","_direction","_nearestTargets","_scanArea"];
  1105.     //Create Marker
  1106.             createMarker ["LSVB3",[3136.9,13613.6]];
  1107.             "LSVB3" setMarkerType "Empty";
  1108.             "LSVB3" setMarkerSize [2, 2];
  1109.             while{true} do{
  1110.     //Check if the marker has any cars near it
  1111.             _position = getMarkerPos "LSVB3";
  1112.             _scanArea = 5;
  1113.             _direction = 200;
  1114.             _nearestTargets = nearestObjects[_position,["landVehicle","Air","Ship"],12] select 0;
  1115.     //if the marker has no cars near it then spawn the new car with nothing in inventory
  1116.     if (!isNil "_nearestTargets") then {
  1117.                 sleep 20;
  1118.             }else{
  1119.                    
  1120.                     _veh = createVehicle ["B_T_LSV_01_unarmed_F", _position, [], 0, "NONE"];
  1121.                     _veh setVariable ["BIS_enableRandomization", false];
  1122.                     _veh setDir _direction;
  1123.                     clearWeaponCargoGlobal _veh;
  1124.                     clearMagazineCargoGlobal _veh;
  1125.                     clearItemCargoGlobal _veh;
  1126.                     _veh setVehicleVarName "BluLSV3";
  1127.                     BluLSV3 = _veh;
  1128.                     [BluLSV3] call neb_fnc_addBounty;
  1129.                     waitUntil {!alive BluLSV3};
  1130.                     sleep .5;
  1131.                     BluLSV3 = nil;
  1132.                     sleep 10;
  1133.             };
  1134.         };
  1135.     };
  1136. };
  1137.  
  1138. //BLU SPAWN TRUCK
  1139. neb_fnc_core_bluSpawnTruck = {
  1140.     createMarker ["BluTruckSpawn",[3116.23,13584.7]];
  1141.         "BluTruckSpawn" setMarkerType "Empty";
  1142.         "BluTruckSpawn" setMarkerSize [2, 2];
  1143.  
  1144.     while {true} do {
  1145.                    
  1146.                     _direction = 120;
  1147.                     _position = getMarkerPos "BluTruckSpawn";
  1148.                     _mrk = "BluTruckSpawn";
  1149.                     _veh = createVehicle ["B_T_Truck_01_box_F", _position, [], 0, "NONE"];
  1150.                     _veh setVariable ["BIS_enableRandomization", false];
  1151.                     _veh setDir _direction;
  1152.                     clearWeaponCargoGlobal _veh;
  1153.                     clearMagazineCargoGlobal _veh;
  1154.                     clearItemCargoGlobal _veh;
  1155.                     _veh setVehicleVarName "BluSpawnTruck";
  1156.                     missionNamespace setVariable [ "BluSpawnTruck", _veh, true ];
  1157.                     [BluSpawnTruck] call neb_fnc_addBounty;
  1158.                     if (isNil "BluActionSpawnTruckCheck") then {
  1159.                     [ BluTeleScreen, "BluSpawnTruck" ] remoteExec ["neb_fnc_core_teleToTruck", 0, "BluTruckJIP" ];
  1160.                     BluActionSpawnTruckCheck = true;
  1161.                     };
  1162.                    
  1163.                     //Create trigger for shop
  1164.                     _trigger = createTrigger[ "EmptyDetector", getMarkerPos _mrk, true ];
  1165.                     //Set trigger size on all clients and JIP
  1166.                     [ _trigger, [ 5, 5, 0, false, 5 ] ] remoteExec [ "setTriggerArea", 0, true ];
  1167.                     //Attach it to the vehicle
  1168.                     _trigger attachTo [ BluSpawnTruck, [0,0,0] ];
  1169.  
  1170.                     //Call shopInit on server and all clients and JIP
  1171.                     _JIP = [ _trigger, "Blu Mobile FOB", "ALL", true, true ] remoteExec [ "NEB_fnc_shopInit", [ 0, 2 ], true ];
  1172.                    
  1173.                    
  1174.                     waitUntil {!alive BluSpawnTruck};
  1175.                     sleep 10;
  1176.         };
  1177.    
  1178. };
  1179.  
  1180. //Quilin 1 spawn
  1181. neb_fnc_core_redVehicleSpawnA = {
  1182. //REDLSV1
  1183.     //Create Marker
  1184.         createMarker ["LSVR1",[2726.971,12315.556]];
  1185.         "LSVR1" setMarkerType "Empty";
  1186.         "LSVR1" setMarkerSize [2, 2];
  1187.        
  1188.    
  1189.         disableSerialization;
  1190.         private["_position","_direction","_nearestTargets","_scanArea"];
  1191.     while{true} do{
  1192.     //Check if the marker has any cars near it
  1193.         _position = getMarkerPos "LSVR1";
  1194.         _scanArea = 5;
  1195.         _direction = -100;
  1196.         _nearestTargets = nearestObjects[_position,["landVehicle","Air","Ship"],_scanArea] select 0;
  1197.     //if the marker has no cars near it then spawn the new car with nothing in inventory
  1198.     if (!isNil "_nearestTargets") then {
  1199.             sleep 20;
  1200.         }else{
  1201.                 _veh = createVehicle ["O_T_LSV_02_unarmed_F", _position, [], 0, "NONE"];
  1202.                 _veh setVariable ["BIS_enableRandomization", false];
  1203.                 _veh setDir _direction;
  1204.                 _veh setPos _position;
  1205.                 clearWeaponCargoGlobal _veh;
  1206.                 clearMagazineCargoGlobal _veh;
  1207.                 clearItemCargoGlobal _veh;
  1208.                 _veh setVehicleVarName "RedLSV1";
  1209.                 RedLSV1 = _veh;
  1210.                 [RedLSV1] call neb_fnc_addBounty;
  1211.                 waitUntil {!alive RedLSV1};
  1212.                 sleep .5;
  1213.                 RedLSV1 = nil;
  1214.                 sleep 10;
  1215.         };
  1216.     };
  1217. };
  1218.  
  1219. //Quilin 2 Spawn
  1220. neb_fnc_core_redVehicleSpawnB = {
  1221. //REDLSV2
  1222.     //Create Marker
  1223.         createMarker ["LSVR2",[2129.23,12074.7]];
  1224.         "LSVR2" setMarkerType "Empty";
  1225.         "LSVR2" setMarkerSize [2, 2];
  1226.        
  1227.    
  1228.         disableSerialization;
  1229.         private["_position","_direction","_nearestTargets","_scanArea"];
  1230.     while{true} do{
  1231.     //Check if the marker has any cars near it
  1232.         _position = getMarkerPos "LSVR2";
  1233.         _scanArea = 5;
  1234.         _direction = 345;
  1235.         _nearestTargets = nearestObjects[_position,["landVehicle","Air","Ship"],_scanArea] select 0;
  1236.     //if the marker has no cars near it then spawn the new car with nothing in inventory
  1237.     if (!isNil "_nearestTargets") then {
  1238.             sleep 20;
  1239.         }else{
  1240.                 _veh = createVehicle ["O_T_LSV_02_unarmed_F", _position, [], 0, "NONE"];
  1241.                 _veh setVariable ["BIS_enableRandomization", false];
  1242.                 _veh setDir _direction;
  1243.                 _veh setPos _position;
  1244.                 clearWeaponCargoGlobal _veh;
  1245.                 clearMagazineCargoGlobal _veh;
  1246.                 clearItemCargoGlobal _veh;
  1247.                 _veh setVehicleVarName "RedLSV2";
  1248.                 RedLSV2 = _veh;
  1249.                 [RedLSV2] call neb_fnc_addBounty;
  1250.                 waitUntil {!alive RedLSV2};
  1251.                 sleep .5;
  1252.                 RedLSV2 = nil;
  1253.                 sleep 10;
  1254.         };
  1255.     };
  1256. };
  1257. //Quilin 3 Spawn
  1258. neb_fnc_core_redVehicleSpawnC = {
  1259. //REDLSV3
  1260.         //Create Marker
  1261.         createMarker ["LSVR3",[2144.99,12093.7]];
  1262.         "LSVR3" setMarkerType "Empty";
  1263.         "LSVR3" setMarkerSize [2, 2];
  1264.        
  1265.    
  1266.         disableSerialization;
  1267.         private["_position","_direction","_nearestTargets","_scanArea"];
  1268.     while{true} do{
  1269.     //Check if the marker has any cars near it
  1270.         _position = getMarkerPos "LSVR3";
  1271.         _scanArea = 5;
  1272.         _direction = 300;
  1273.         _nearestTargets = nearestObjects[_position,["landVehicle","Air","Ship"],_scanArea] select 0;
  1274.     //if the marker has no cars near it then spawn the new car with nothing in inventory
  1275.     if (!isNil "_nearestTargets") then {
  1276.             sleep 20;
  1277.         }else{
  1278.                 _veh = createVehicle ["O_T_LSV_02_unarmed_F", _position, [], 0, "NONE"];
  1279.                 _veh setVariable ["BIS_enableRandomization", false];
  1280.                 _veh setDir _direction;
  1281.                 _veh setPos _position;
  1282.                 clearWeaponCargoGlobal _veh;
  1283.                 clearMagazineCargoGlobal _veh;
  1284.                 clearItemCargoGlobal _veh;
  1285.                 _veh setVehicleVarName "RedLSV3";
  1286.                 RedLSV3 = _veh;
  1287.                 [RedLSV3] call neb_fnc_addBounty;
  1288.                 waitUntil {!alive RedLSV3};
  1289.                 sleep .5;
  1290.                 RedLSV3 = nil;
  1291.                 sleep 10;
  1292.         };
  1293.     };
  1294. };
  1295.  
  1296. //RED SPAWN TRUCK
  1297. neb_fnc_core_redSpawnTruck = {
  1298.     createMarker ["RedTruckSpawn",[2147.53,12101.6]];
  1299.         "RedTruckSpawn" setMarkerType "Empty";
  1300.         "RedTruckSpawn" setMarkerSize [2, 2];
  1301.        
  1302.     while {true} do {
  1303.                    
  1304.                     _direction = 300;
  1305.                     _position = getMarkerPos "RedTruckSpawn";
  1306.                     _mrk = "RedTruckSpawn";
  1307.                     _veh = createVehicle ["O_T_Truck_03_device_ghex_F", _position, [], 0, "NONE"];
  1308.                     _veh setVariable ["BIS_enableRandomization", false];
  1309.                     _veh setDir _direction;
  1310.                     clearWeaponCargoGlobal _veh;
  1311.                     clearMagazineCargoGlobal _veh;
  1312.                     clearItemCargoGlobal _veh;
  1313.                     _veh setVehicleVarName "RedSpawnTruck";
  1314.                     missionNamespace setVariable [ "RedSpawnTruck", _veh, true ];
  1315.                     [RedSpawnTruck] call neb_fnc_addBounty;
  1316.                     if (isNil "RedActionSpawnTruckCheck") then {
  1317.                     [ RedTeleScreen, "RedSpawnTruck" ] remoteExec ["neb_fnc_core_teleToTruck", 0, "RedTruckJIP" ];
  1318.                     RedActionSpawnTruckCheck = true;
  1319.                     };
  1320.                     //Create trigger for shop
  1321.                     _trigger = createTrigger[ "EmptyDetector", getMarkerPos _mrk, true ];
  1322.                     //Set trigger size on all clients and JIP
  1323.                     [ _trigger, [ 5, 5, 0, false, 5 ] ] remoteExec [ "setTriggerArea", 0, true ];
  1324.                     //Attach it to the vehicle
  1325.                     _trigger attachTo [ RedSpawnTruck, [0,0,0] ];
  1326.  
  1327.                     //Call shopInit on server and all clients and JIP
  1328.                     _JIP = [ _trigger, "Red Mobile FOB", "ALL", true, true ] remoteExec [ "NEB_fnc_shopInit", [ 0, 2 ], true ];
  1329.                     waitUntil {!alive RedSpawnTruck};
  1330.                     sleep .5;
  1331.                     RedSpawnTruck = nil;
  1332.                     sleep 10;
  1333.     };
  1334. };
  1335. /*Random Vehicles*/
  1336.  
  1337. //Merc Camp Vehicle
  1338. neb_fnc_core_randomVehicleSpawnA = {
  1339.     //Create Marker
  1340.             createMarker ["LSVM1",[2914.5,12625.5]];
  1341.             "LSVM1" setMarkerType "Empty";
  1342.             "LSVM1" setMarkerSize [2, 2];
  1343.            
  1344.     while{true} do{
  1345.         if (isServer) then {
  1346.             disableSerialization;
  1347.             private["_position","_direction","_nearestTargets","_scanArea"];
  1348.    
  1349.     //Check if the marker has any cars near it
  1350.             _position = getMarkerPos "LSVM1";
  1351.             _scanArea = 5;
  1352.             _direction = 125;
  1353.             _nearestTargets = nearestObjects[_position,["landVehicle","Air","Ship"],_scanArea] select 0;
  1354.     //if the marker has no cars near it then spawn the new car with nothing in inventory
  1355.     if (!isNil "_nearestTargets") then {
  1356.                 sleep 20;
  1357.             }else{
  1358.                     _choices = ["C_Offroad_02_unarmed_F","O_T_LSV_02_unarmed_F","B_T_LSV_01_unarmed_F",
  1359.                     "B_T_LSV_01_armed_F","O_T_LSV_02_armed_F","B_G_Offroad_01_armed_F","I_G_Offroad_01_armed_F","O_G_Offroad_01_armed_F"] call BIS_fnc_selectRandom;
  1360.                     _veh = createVehicle [_choices, _position, [], 0, "FLY"];
  1361.                     _veh setVariable ["BIS_enableRandomization", false];
  1362.                     _veh setDir _direction;
  1363.                     _veh setPos [2914.5,12625.5,5];
  1364.                     clearWeaponCargoGlobal _veh;
  1365.                     clearMagazineCargoGlobal _veh;
  1366.                     clearItemCargoGlobal _veh;
  1367.                     _veh setVehicleVarName "MercLSV1";
  1368.                     MercLSV1 = _veh;
  1369.                     [MercLSV1] call neb_fnc_addBounty;
  1370.     //Respawn Vehicle If It Dies
  1371.                     waitUntil {!alive MercLSV1};
  1372.                     sleep .5;
  1373.                     MercLSV1 = nil;
  1374.                     sleep 10;
  1375.                    
  1376.             };
  1377.         };
  1378.     };
  1379. };
  1380.  
  1381. //Jungle 1 Vehicle 1
  1382. neb_fnc_core_randomVehicleSpawnB = {
  1383.     //Create Marker
  1384.             createMarker ["LSVJ1V1",[3425.78,12807.7]];
  1385.             "LSVJ1V1" setMarkerType "Empty";
  1386.             "LSVJ1V1" setMarkerSize [2, 2];
  1387.            
  1388.     while{true} do{
  1389.         if (isServer) then {
  1390.             disableSerialization;
  1391.             private["_position","_direction","_nearestTargets","_scanArea"];
  1392.    
  1393.     //Check if the marker has any cars near it
  1394.             _position = getMarkerPos "LSVJ1V1";
  1395.             _scanArea = 5;
  1396.             _direction = 270;
  1397.             _nearestTargets = nearestObjects[_position,["landVehicle","Air","Ship"],_scanArea] select 0;
  1398.     //if the marker has no cars near it then spawn the new car with nothing in inventory
  1399.     if (!isNil "_nearestTargets") then {
  1400.                 sleep 20;
  1401.             }else{
  1402.                     _choices = ["C_Offroad_02_unarmed_F","O_T_LSV_02_unarmed_F","B_T_LSV_01_unarmed_F",
  1403.                     "B_T_LSV_01_armed_F","O_T_LSV_02_armed_F","B_G_Offroad_01_armed_F","I_G_Offroad_01_armed_F","O_G_Offroad_01_armed_F"] call BIS_fnc_selectRandom;
  1404.                     _veh = createVehicle [_choices, _position, [], 0, "NONE"];
  1405.                     _veh setVariable ["BIS_enableRandomization", false];
  1406.                     _veh setDir _direction;
  1407.                     clearWeaponCargoGlobal _veh;
  1408.                     clearMagazineCargoGlobal _veh;
  1409.                     clearItemCargoGlobal _veh;
  1410.                     _veh setVehicleVarName "J1LSV1";
  1411.                     J1LSV1 = _veh;
  1412.                     [J1LSV1] call neb_fnc_addBounty;
  1413.     //Respawn Vehicle If It Dies
  1414.                     waitUntil {!alive J1LSV1};
  1415.                     sleep .5;
  1416.                     J1LSV1 = nil;
  1417.                     sleep 10;
  1418.                    
  1419.             };
  1420.         };
  1421.     };
  1422. };
  1423.  
  1424.  
  1425. //Jungle 2 Vehicle 1
  1426. neb_fnc_core_randomVehicleSpawnC = {
  1427.     //Create Marker
  1428.             createMarker ["LSVJ2V1",[2487.66,12914.6]];
  1429.             "LSVJ2V1" setMarkerType "Empty";
  1430.             "LSVJ2V1" setMarkerSize [2, 2];
  1431.            
  1432.     while{true} do{
  1433.         if (isServer) then {
  1434.             disableSerialization;
  1435.             private["_position","_direction","_nearestTargets","_scanArea"];
  1436.    
  1437.     //Check if the marker has any cars near it
  1438.             _position = getMarkerPos "LSVJ2V1";
  1439.             _scanArea = 5;
  1440.             _direction = 60;
  1441.             _nearestTargets = nearestObjects[_position,["landVehicle","Air","Ship"],_scanArea] select 0;
  1442.     //if the marker has no cars near it then spawn the new car with nothing in inventory
  1443.     if (!isNil "_nearestTargets") then {
  1444.                 sleep 20;
  1445.             }else{
  1446.                     _choices = ["C_Offroad_02_unarmed_F","O_T_LSV_02_unarmed_F","B_T_LSV_01_unarmed_F",
  1447.                     "B_T_LSV_01_armed_F","O_T_LSV_02_armed_F","B_G_Offroad_01_armed_F","I_G_Offroad_01_armed_F","O_G_Offroad_01_armed_F"] call BIS_fnc_selectRandom;
  1448.                     _veh = createVehicle [_choices, _position, [], 0, "NONE"];
  1449.                     _veh setVariable ["BIS_enableRandomization", false];
  1450.                     _veh setDir _direction;
  1451.                     clearWeaponCargoGlobal _veh;
  1452.                     clearMagazineCargoGlobal _veh;
  1453.                     clearItemCargoGlobal _veh;
  1454.                     _veh setVehicleVarName "J2LSV1";
  1455.                     J2LSV1 = _veh;
  1456.                     [J2LSV1] call neb_fnc_addBounty;
  1457.     //Respawn Vehicle If It Dies
  1458.                     waitUntil {!alive J2LSV1};
  1459.                     sleep .5;
  1460.                     J2LSV1 = nil;
  1461.                     sleep 10;
  1462.                    
  1463.             };
  1464.         };
  1465.     };
  1466. };
  1467.  
  1468. //Random Spawn 1
  1469. neb_fnc_core_randomVehicleSpawnD = {
  1470.     //Create Marker
  1471.             createMarker ["RandomVM1",[3699.36,12861.5]];
  1472.             "RandomVM1" setMarkerType "Empty";
  1473.             "RandomVM1" setMarkerSize [2, 2];
  1474.            
  1475.             createMarker ["RandomVM2",[3648.43,13217.7]];
  1476.             "RandomVM2" setMarkerType "Empty";
  1477.             "RandomVM2" setMarkerSize [2, 2];
  1478.            
  1479.             createMarker ["RandomVM3",[3918.43,12822.7]];
  1480.             "RandomVM3" setMarkerType "Empty";
  1481.             "RandomVM3" setMarkerSize [2, 2];
  1482.            
  1483.             createMarker ["RandomVM4",[3859.62,13408.5]];
  1484.             "RandomVM4" setMarkerType "Empty";
  1485.             "RandomVM4" setMarkerSize [2, 2];
  1486.            
  1487.     while{true} do{
  1488.         if (isServer) then {
  1489.             disableSerialization;
  1490.             private["_position","_direction","_nearestTargets","_scanArea"];
  1491.    
  1492.     //Check if the marker has any cars near it
  1493.             _positionA = getMarkerPos "RandomVM1";
  1494.             _positionB = getMarkerPos "RandomVM2";
  1495.             _positionC = getMarkerPos "RandomVM3";
  1496.             _positionD = getMarkerPos "RandomVM4";
  1497.             _rPosition = [_positionA, _positionB, _positionC, _positionD] call BIS_fnc_selectRandom;
  1498.             _scanArea = 5;
  1499.             _direction = [60,120,30,90,50,300,210] call BIS_fnc_selectRandom;
  1500.             _nearestTargets = nearestObjects[_rPosition,["landVehicle","Air","Ship"],_scanArea] select 0;
  1501.     //if the marker has no cars near it then spawn the new car with nothing in inventory
  1502.     if (!isNil "_nearestTargets") then {
  1503.                 sleep 20;
  1504.             }else{
  1505.                     _choices = ["O_T_APC_Tracked_02_cannon_ghex_F","B_T_MBT_01_cannon_F","I_APC_Wheeled_03_cannon_F",
  1506.                     "B_T_LSV_01_armed_F","O_T_LSV_02_armed_F","B_G_Offroad_01_armed_F","I_G_Offroad_01_armed_F","O_G_Offroad_01_armed_F"] call BIS_fnc_selectRandom;
  1507.                     _veh = createVehicle [_choices, _rPosition, [], 0, "NONE"];
  1508.                     _veh setVariable ["BIS_enableRandomization", false];
  1509.                     _veh setDir _direction;
  1510.                     clearWeaponCargoGlobal _veh;
  1511.                     clearMagazineCargoGlobal _veh;
  1512.                     clearItemCargoGlobal _veh;
  1513.                     _veh setVehicleVarName "RandomV1";
  1514.                     RandomV1 = _veh;
  1515.                     [RandomV1] call neb_fnc_addBounty;
  1516.     //Respawn Vehicle If It Dies
  1517.                     waitUntil {!alive RandomV1};
  1518.                     sleep .5;
  1519.                     RandomV1 = nil;
  1520.                     sleep 10;
  1521.                    
  1522.             };
  1523.         };
  1524.     };
  1525. };
  1526.  
  1527. //Spawn The vehicles in the functions above
  1528. neb_fnc_core_vehicleSpawns = {
  1529. [] spawn neb_fnc_core_bluVehicleSpawnA;
  1530. [] spawn neb_fnc_core_bluVehicleSpawnB;
  1531. [] spawn neb_fnc_core_bluVehicleSpawnC;
  1532. [] spawn neb_fnc_core_bluSpawnTruck;
  1533. [] spawn neb_fnc_core_redVehicleSpawnA;
  1534. [] spawn neb_fnc_core_redVehicleSpawnB;
  1535. [] spawn neb_fnc_core_redVehicleSpawnC;
  1536. [] spawn neb_fnc_core_redSpawnTruck;
  1537. [] spawn neb_fnc_core_randomVehicleSpawnA;
  1538. [] spawn neb_fnc_core_randomVehicleSpawnB;
  1539. [] spawn neb_fnc_core_randomVehicleSpawnC;
  1540. [] spawn neb_fnc_core_randomVehicleSpawnD;
  1541. };
  1542.  
  1543. // Add Player Icons over friendly Heads
  1544. neb_fnc_core_addPlayerIcons = {
  1545.     onEachFrame
  1546.  
  1547.     {
  1548.  
  1549.         private["_vis","_pos"];
  1550.  
  1551.         {
  1552.  
  1553.             if(player distance _x < 1000 && side _x == playerSide && _x != player) then
  1554.  
  1555.             {
  1556.  
  1557.                 _vis = lineIntersects [eyePos player, eyePos _x,player, _x];
  1558.  
  1559.                 if(!_vis) then
  1560.  
  1561.                 {
  1562.  
  1563.                     _pos = visiblePosition _x;
  1564.  
  1565.                     _pos set[2,(getPosATL _x select 2) + 2.1];
  1566.                     switch (playerSide) do {
  1567.                         case west: {
  1568.                         drawIcon3D ["\A3\ui_f\data\map\markers\flags\nato_ca.paa",[1,1,1,1],_pos,.6,.6,0,name _x,0,0.03];
  1569.                         };
  1570.                         case east: {
  1571.                         drawIcon3D ["\A3\ui_f\data\map\markers\flags\CSAT_ca.paa",[1,1,1,1],_pos,.6,.6,0,name _x,0,0.03];
  1572.                         };
  1573.                    
  1574.                     };
  1575.                
  1576.  
  1577.                 };
  1578.  
  1579.             };
  1580.  
  1581.         } foreach allUnits;
  1582.  
  1583.     };
  1584. };
  1585.  
  1586. /* Creep and Jungle Spawns */
  1587.  
  1588. //Spawn Jungle
  1589. neb_fnc_core_terrorSpawn = {
  1590.     params[
  1591.         //Default name, start and end to an empty string if not given
  1592.         [ "_groupName", "" ],
  1593.         [ "_start", "" ],
  1594.         [ "_end", "" ],
  1595.         [ "_groupUnits",
  1596.             //default set of units if none are passed to the script
  1597.             [
  1598.                 [ "I_C_Soldier_Bandit_3_F", "A" ],
  1599.                 [ "I_C_Soldier_Bandit_4_F", "B" ],
  1600.                 [ "I_C_Soldier_Bandit_7_F", "C" ],
  1601.                 [ "I_C_Soldier_Bandit_8_F", "D" ],
  1602.                 [ "I_C_Soldier_Bandit_2_F", "E" ]
  1603.             ]
  1604.         ],
  1605.         //Default skills if none passed to the script
  1606.         [ "_skills",
  1607.             [
  1608.                 [ "aimingAccuracy", .5 ],
  1609.                 [ "aimingShake", .5 ],
  1610.                 [ "aimingSpeed", .7 ],
  1611.                 [ "endurance", 1 ],
  1612.                 [ "spotDistance", .7 ],
  1613.                 [ "spotTime", .8 ],
  1614.                 [ "courage", .8 ],
  1615.                 [ "reloadSpeed", 1 ],
  1616.                 [ "commanding", 1 ],
  1617.                 [ "general", 1 ]
  1618.             ]
  1619.         ]
  1620.     ];
  1621.  
  1622.     //Catch any errors and exit the script with a global error message
  1623.     //as we can not spawn a group without a name, start or end
  1624.     if ( _groupName isEqualTo "" ) exitWith {
  1625.         //Display error globally for connected clients
  1626.         "No groupName supplied for group spawn" remoteExec [ "BIS_fnc_error", 0 ];
  1627.     };
  1628.     if ( _start isEqualTo "" ) exitWith {
  1629.         //Display error globally for connected clients
  1630.         "No start position supplied for group spawn" remoteExec [ "BIS_fnc_error", 0 ];
  1631.     };
  1632.     if ( _end isEqualTo "" ) exitWith {
  1633.         //Display error globally for connected clients
  1634.         "No end position supplied for group spawn" remoteExec [ "BIS_fnc_error", 0 ];
  1635.     };
  1636.  
  1637.     //Work out what we have passed as positions
  1638.     {
  1639.         private[ "_pos" ];
  1640.         //What have we passed as _start and _end
  1641.         switch( typeName _x ) do {
  1642.             //Is it a STRING which means its a marker
  1643.             case ( typeName "" ) : {
  1644.                 _pos = getMarkerPos _x
  1645.             };
  1646.             //Is it an object
  1647.             case ( "OBJECT" ) : {
  1648.                 _pos = getPos _x;
  1649.             };
  1650.             //Is it a location
  1651.             case ( "LOCATION" ) : {
  1652.                 _pos = locationPosition _x;
  1653.             };
  1654.         };
  1655.        
  1656.         //Put position in the right variable
  1657.         //_start
  1658.         if ( _forEachIndex isEqualTo 0 ) then {
  1659.             _start = _pos;
  1660.         }else{
  1661.             //_end
  1662.             _end = _pos;
  1663.         };
  1664.        
  1665.     }forEach [ _start, _end ];
  1666.  
  1667.  
  1668.     //********
  1669.     // SPAWN Reinforcement Group
  1670.     //********
  1671.  
  1672.     private[ "_group", "_wp" ];
  1673.     //Setup one time group with waypoint
  1674.     _group = createGroup resistance;
  1675.     _group setvariable ["cleanup",false];
  1676.     //Use end for WP position
  1677.     _wp = _group addWaypoint [ _end, 1 ];
  1678.     _wp setWaypointType "MOVE";
  1679.     _wp setWaypointSpeed "FULL";
  1680.  
  1681.     //Create global variable holding reference to the group
  1682.     //global variables like TerrorSquadA are held in an area called missionNamespace
  1683.     //so setting a variable there of the value of _groupName
  1684.     //gives us the same functionality as saying
  1685.     //TerrorSquadA = createGroup resistance;
  1686.     missionNamespace setVariable[ _groupName, _group ];
  1687.  
  1688.     while {true} do {
  1689.        
  1690.         //Spawn units
  1691.         {
  1692.             private[ "_unit" ];
  1693.             _x params [ "_unitType", "_nameSuffix" ];
  1694.            
  1695.             //Unit ARRAY command
  1696.             //Use _start as unit spawn position
  1697.             //format["group is null - %2",isnull _group] remoteexec ["hint",0];
  1698.             _unit = _group createUnit [ _unitType, _start, [], 0, "FORM" ];
  1699.            
  1700.             //Give unit a global var name
  1701.             //Although you would think you could use the same trick here as for the Group
  1702.             //by using missionNamespace, Object varaibles are slightly different
  1703.             //and require some extra setup
  1704.             //using BIS_fnc_objectVar is by far the easiest method to do this.
  1705.             //To make things easier on ourselfs lets use the group varname eg TerrorSquadA
  1706.             //as the prefix for the units name
  1707.             [ _unit, format[ "%1_%2", _groupName, _nameSuffix ] ] call BIS_fnc_objectVar;
  1708.            
  1709.             //Set unit skills
  1710.             {
  1711.                 _x params[ "_skill", "_value" ];
  1712.                 _unit setSkill [ _skill, _value ];
  1713.             }forEach _skills;
  1714.            
  1715.             //Pass unit to script
  1716.             [ _unit ] call neb_fnc_addBounty;
  1717.            
  1718.             _unit spawn tlq_killTicker;
  1719.            
  1720.             //Reset their current waypoint
  1721.             //( as if the previous group had already got here
  1722.             //any new units would think this waypoint has been completed )
  1723.             _group setCurrentWaypoint _wp;
  1724.            
  1725.         }forEach _groupUnits;
  1726.        
  1727.         //Wait unitl they are all dead
  1728.         waitUntil {{alive _x} count units _group == 0};
  1729.        
  1730.         //debug
  1731.         //format[ "group %1 is dead", _groupName ] remoteExec [ "systemchat", 0 ];
  1732.        
  1733.         sleep 30;
  1734.     };
  1735. };
  1736. // Spawn Blu Defense Creeps
  1737. neb_fnc_core_bluDefender = {
  1738.     params[
  1739.         //Default name, start and end to an empty string if not given
  1740.         [ "_groupName", "" ],
  1741.         [ "_start", "" ],
  1742.         [ "_end", "" ],
  1743.         [ "_groupUnits",
  1744.             //default set of units if none are passed to the script
  1745.             [
  1746.                 [ "B_T_Soldier_F", "A" ],
  1747.                 [ "B_T_Soldier_F", "B" ],
  1748.                 [ "B_T_Soldier_F", "C" ],
  1749.                 [ "B_T_Soldier_AA_F", "D" ],
  1750.                 [ "B_T_Soldier_AT_F", "E" ],
  1751.                 [ "B_T_Soldier_F", "F" ],
  1752.                 [ "B_T_Soldier_F", "G" ]
  1753.             ]
  1754.         ],
  1755.         //Default skills if none passed to the script
  1756.         [ "_skills",
  1757.             [
  1758.                 [ "aimingAccuracy", .5 ],
  1759.                 [ "aimingShake", .5 ],
  1760.                 [ "aimingSpeed", .5 ],
  1761.                 [ "endurance", 1 ],
  1762.                 [ "spotDistance", .2 ],
  1763.                 [ "spotTime", .5 ],
  1764.                 [ "courage", .3 ],
  1765.                 [ "reloadSpeed", 1 ],
  1766.                 [ "commanding", .1 ],
  1767.                 [ "general", .5 ]
  1768.             ]
  1769.         ]
  1770.     ];
  1771.  
  1772.     //Catch any errors and exit the script with a global error message
  1773.     //as we can not spawn a group without a name, start or end
  1774.     if ( _groupName isEqualTo "" ) exitWith {
  1775.         //Display error globally for connected clients
  1776.         "No groupName supplied for group spawn" remoteExec [ "BIS_fnc_error", 0 ];
  1777.     };
  1778.     if ( _start isEqualTo "" ) exitWith {
  1779.         //Display error globally for connected clients
  1780.         "No start position supplied for group spawn" remoteExec [ "BIS_fnc_error", 0 ];
  1781.     };
  1782.     if ( _end isEqualTo "" ) exitWith {
  1783.         //Display error globally for connected clients
  1784.         "No end position supplied for group spawn" remoteExec [ "BIS_fnc_error", 0 ];
  1785.     };
  1786.  
  1787.     //Work out what we have passed as positions
  1788.     {
  1789.         private[ "_pos" ];
  1790.         //What have we passed as _start and _end
  1791.         switch( typeName _x ) do {
  1792.             //Is it a STRING which means its a marker
  1793.             case ( typeName "" ) : {
  1794.                 _pos = getMarkerPos _x
  1795.             };
  1796.             //Is it an object
  1797.             case ( "OBJECT" ) : {
  1798.                 _pos = getPos _x;
  1799.             };
  1800.             //Is it a location
  1801.             case ( "LOCATION" ) : {
  1802.                 _pos = locationPosition _x;
  1803.             };
  1804.         };
  1805.        
  1806.         //Put position in the right variable
  1807.         //_start
  1808.         if ( _forEachIndex isEqualTo 0 ) then {
  1809.             _start = _pos;
  1810.         }else{
  1811.             //_end
  1812.             _end = _pos;
  1813.         };
  1814.        
  1815.     }forEach [ _start, _end ];
  1816.  
  1817.  
  1818.     //********
  1819.     // SPAWN Reinforcement Group
  1820.     //********
  1821.  
  1822.     private[ "_group", "_wp1" ];
  1823.  
  1824.     //Setup one time group with waypoint
  1825.     _group = createGroup west;
  1826.     //Use end for WP position
  1827.     _wp1 = _group addWaypoint [ _end, 1 ];
  1828.     _wp1 setWaypointType "LOITER";
  1829.     _wp1 setWaypointSpeed "FULL";
  1830.  
  1831.     //Create global variable holding reference to the group
  1832.     //global variables like TerrorSquadA are held in an area called missionNamespace
  1833.     //so setting a variable there of the value of _groupName
  1834.     //gives us the same functionality as saying
  1835.     //TerrorSquadA = createGroup resistance;
  1836.     missionNamespace setVariable[ _groupName, _group ];
  1837.  
  1838.     while {true} do {
  1839.        
  1840.         //Spawn units
  1841.         {
  1842.             private[ "_unit" ];
  1843.             _x params [ "_unitType", "_nameSuffix" ];
  1844.            
  1845.             //Unit ARRAY command
  1846.             //Use _start as unit spawn position
  1847.             _unit = _group createUnit [ _unitType, _start, [], 0, "FORM" ];
  1848.            
  1849.             //Give unit a global var name
  1850.             //Although you would think you could use the same trick here as for the Group
  1851.             //by using missionNamespace, Object varaibles are slightly different
  1852.             //and require some extra setup
  1853.             //using BIS_fnc_objectVar is by far the easiest method to do this.
  1854.             //To make things easier on ourselfs lets use the group varname eg TerrorSquadA
  1855.             //as the prefix for the units name
  1856.             [ _unit, format[ "%1_%2", _groupName, _nameSuffix ] ] call BIS_fnc_objectVar;
  1857.            
  1858.             //Set unit skills
  1859.             {
  1860.                 _x params[ "_skill", "_value" ];
  1861.                 _unit setSkill [ _skill, _value ];
  1862.             }forEach _skills;
  1863.            
  1864.             //Pass unit to script
  1865.             [ _unit ] call neb_fnc_addBounty;
  1866.             _unit spawn tlq_killTicker;
  1867.            
  1868.             //Reset their current waypoint
  1869.             //( as if the previous group had already got here
  1870.             //any new units would think this waypoint has been completed )
  1871.             _group setCurrentWaypoint _wp1;
  1872.            
  1873.         }forEach _groupUnits;
  1874.        
  1875.         //Wait unitl they are all dead
  1876.         waitUntil {{alive _x} count units _group == 0};
  1877.        
  1878.         //debug
  1879.         //format[ "group %1 is dead", _groupName ] remoteExec [ "systemchat", 0 ];
  1880.        
  1881.         sleep 10;
  1882.     }; 
  1883. };
  1884. // Spawn Red Defense Creeps
  1885. neb_fnc_core_redDefender = {
  1886.     params[
  1887.         //Default name, start and end to an empty string if not given
  1888.         [ "_groupName", "" ],
  1889.         [ "_start", "" ],
  1890.         [ "_end", "" ],
  1891.         [ "_groupUnits",
  1892.             //default set of units if none are passed to the script
  1893.             [
  1894.                 [ "O_T_Soldier_F", "A" ],
  1895.                 [ "O_T_Soldier_F", "B" ],
  1896.                 [ "O_T_Soldier_F", "C" ],
  1897.                 [ "O_T_Soldier_AA_F", "D" ],
  1898.                 [ "O_T_Soldier_AT_F", "E" ],
  1899.                 [ "O_T_Soldier_F", "F" ],
  1900.                 [ "O_T_Soldier_F", "G" ]
  1901.             ]
  1902.         ],
  1903.         //Default skills if none passed to the script
  1904.         [ "_skills",
  1905.             [
  1906.                 [ "aimingAccuracy", .5 ],
  1907.                 [ "aimingShake", .5 ],
  1908.                 [ "aimingSpeed", .5 ],
  1909.                 [ "endurance", 1 ],
  1910.                 [ "spotDistance", .3 ],
  1911.                 [ "spotTime", .5 ],
  1912.                 [ "courage", .2 ],
  1913.                 [ "reloadSpeed", 1 ],
  1914.                 [ "commanding", .1 ],
  1915.                 [ "general", .5 ]
  1916.             ]
  1917.         ]
  1918.     ];
  1919.  
  1920.     //Catch any errors and exit the script with a global error message
  1921.     //as we can not spawn a group without a name, start or end
  1922.     if ( _groupName isEqualTo "" ) exitWith {
  1923.         //Display error globally for connected clients
  1924.         "No groupName supplied for group spawn" remoteExec [ "BIS_fnc_error", 0 ];
  1925.     };
  1926.     if ( _start isEqualTo "" ) exitWith {
  1927.         //Display error globally for connected clients
  1928.         "No start position supplied for group spawn" remoteExec [ "BIS_fnc_error", 0 ];
  1929.     };
  1930.     if ( _end isEqualTo "" ) exitWith {
  1931.         //Display error globally for connected clients
  1932.         "No end position supplied for group spawn" remoteExec [ "BIS_fnc_error", 0 ];
  1933.     };
  1934.  
  1935.     //Work out what we have passed as positions
  1936.     {
  1937.         private[ "_pos" ];
  1938.         //What have we passed as _start and _end
  1939.         switch( typeName _x ) do {
  1940.             //Is it a STRING which means its a marker
  1941.             case ( typeName "" ) : {
  1942.                 _pos = getMarkerPos _x
  1943.             };
  1944.             //Is it an object
  1945.             case ( "OBJECT" ) : {
  1946.                 _pos = getPos _x;
  1947.             };
  1948.             //Is it a location
  1949.             case ( "LOCATION" ) : {
  1950.                 _pos = locationPosition _x;
  1951.             };
  1952.         };
  1953.        
  1954.         //Put position in the right variable
  1955.         //_start
  1956.         if ( _forEachIndex isEqualTo 0 ) then {
  1957.             _start = _pos;
  1958.         }else{
  1959.             //_end
  1960.             _end = _pos;
  1961.         };
  1962.        
  1963.     }forEach [ _start, _end ];
  1964.  
  1965.  
  1966.     //********
  1967.     // SPAWN Reinforcement Group
  1968.     //********
  1969.  
  1970.     private[ "_group", "_wp1" ];
  1971.  
  1972.     //Setup one time group with waypoint
  1973.     _group = createGroup east;
  1974.     //Use end for WP position
  1975.     _wp1 = _group addWaypoint [ _end, 1 ];
  1976.     _wp1 setWaypointType "LOITER";
  1977.     _wp1 setWaypointSpeed "FULL";
  1978.  
  1979.     //Create global variable holding reference to the group
  1980.     //global variables like TerrorSquadA are held in an area called missionNamespace
  1981.     //so setting a variable there of the value of _groupName
  1982.     //gives us the same functionality as saying
  1983.     //TerrorSquadA = createGroup resistance;
  1984.     missionNamespace setVariable[ _groupName, _group ];
  1985.  
  1986.     while {true} do {
  1987.        
  1988.         //Spawn units
  1989.         {
  1990.             private[ "_unit" ];
  1991.             _x params [ "_unitType", "_nameSuffix" ];
  1992.            
  1993.             //Unit ARRAY command
  1994.             //Use _start as unit spawn position
  1995.             _unit = _group createUnit [ _unitType, _start, [], 0, "FORM" ];
  1996.            
  1997.             //Give unit a global var name
  1998.             //Although you would think you could use the same trick here as for the Group
  1999.             //by using missionNamespace, Object varaibles are slightly different
  2000.             //and require some extra setup
  2001.             //using BIS_fnc_objectVar is by far the easiest method to do this.
  2002.             //To make things easier on ourselfs lets use the group varname eg TerrorSquadA
  2003.             //as the prefix for the units name
  2004.             [ _unit, format[ "%1_%2", _groupName, _nameSuffix ] ] call BIS_fnc_objectVar;
  2005.            
  2006.             //Set unit skills
  2007.             {
  2008.                 _x params[ "_skill", "_value" ];
  2009.                 _unit setSkill [ _skill, _value ];
  2010.             }forEach _skills;
  2011.            
  2012.             //Pass unit to script
  2013.             [ _unit ] call neb_fnc_addBounty;
  2014.             _unit spawn tlq_killTicker;
  2015.            
  2016.             //Reset their current waypoint
  2017.             //( as if the previous group had already got here
  2018.             //any new units would think this waypoint has been completed )
  2019.             _group setCurrentWaypoint _wp1;
  2020.            
  2021.         }forEach _groupUnits;
  2022.        
  2023.         //Wait unitl they are all dead
  2024.         waitUntil {{alive _x} count units _group == 0};
  2025.        
  2026.         //debug
  2027.         //format[ "group %1 is dead", _groupName ] remoteExec [ "systemchat", 0 ];
  2028.        
  2029.         sleep 10;
  2030.     };
  2031. };
  2032.  
  2033. //Spawn Blu Attack Creeps
  2034. neb_fnc_core_bluCreeps = {
  2035.     params[
  2036.         //Default name, start and end to an empty string if not given
  2037.         [ "_groupName", "" ],
  2038.         [ "_start", "" ],
  2039.         [ "_end", "" ],
  2040.         [ "_groupUnits",
  2041.             //default set of units if none are passed to the script
  2042.             [
  2043.                 [ "B_T_Soldier_F", "A" ],
  2044.                 [ "B_T_Soldier_F", "B" ],
  2045.                 [ "B_T_Soldier_F", "C" ],
  2046.                 [ "B_T_Soldier_AA_F", "D" ],
  2047.                 [ "B_T_Soldier_AT_F", "E" ]
  2048.             ]
  2049.         ],
  2050.         //Default skills if none passed to the script
  2051.         [ "_skills",
  2052.             [
  2053.                 [ "aimingAccuracy", .5 ],
  2054.                 [ "aimingShake", .5 ],
  2055.                 [ "aimingSpeed", .5 ],
  2056.                 [ "endurance", 1 ],
  2057.                 [ "spotDistance", .7 ],
  2058.                 [ "spotTime", .8 ],
  2059.                 [ "courage", .8 ],
  2060.                 [ "reloadSpeed", 1 ],
  2061.                 [ "commanding", 1 ],
  2062.                 [ "general", 1 ]
  2063.             ]
  2064.         ]
  2065.     ];
  2066.  
  2067.     //Catch any errors and exit the script with a global error message
  2068.     //as we can not spawn a group without a name, start or end
  2069.     if ( _groupName isEqualTo "" ) exitWith {
  2070.         //Display error globally for connected clients
  2071.         "No groupName supplied for group spawn" remoteExec [ "BIS_fnc_error", 0 ];
  2072.     };
  2073.     if ( _start isEqualTo "" ) exitWith {
  2074.         //Display error globally for connected clients
  2075.         "No start position supplied for group spawn" remoteExec [ "BIS_fnc_error", 0 ];
  2076.     };
  2077.     if ( _end isEqualTo "" ) exitWith {
  2078.         //Display error globally for connected clients
  2079.         "No end position supplied for group spawn" remoteExec [ "BIS_fnc_error", 0 ];
  2080.     };
  2081.  
  2082.     //Work out what we have passed as positions
  2083.     {
  2084.         private[ "_pos" ];
  2085.         //What have we passed as _start and _end
  2086.         switch( typeName _x ) do {
  2087.             //Is it a STRING which means its a marker
  2088.             case ( typeName "" ) : {
  2089.                 _pos = getMarkerPos _x
  2090.             };
  2091.             //Is it an object
  2092.             case ( "OBJECT" ) : {
  2093.                 _pos = getPos _x;
  2094.             };
  2095.             //Is it a location
  2096.             case ( "LOCATION" ) : {
  2097.                 _pos = locationPosition _x;
  2098.             };
  2099.         };
  2100.        
  2101.         //Put position in the right variable
  2102.         //_start
  2103.         if ( _forEachIndex isEqualTo 0 ) then {
  2104.             _start = _pos;
  2105.         }else{
  2106.             //_end
  2107.             _end = _pos;
  2108.         };
  2109.        
  2110.     }forEach [ _start, _end ];
  2111.  
  2112.  
  2113.     //********
  2114.     // SPAWN Reinforcement Group
  2115.     //********
  2116.  
  2117.     private[ "_group", "_wp1" ];
  2118.  
  2119.     //Setup one time group with waypoint
  2120.     _group = createGroup west;
  2121.     //Use end for WP position
  2122.     _wp1 = _group addWaypoint [ _end, 1 ];
  2123.     _wp1 setWaypointType "MOVE";
  2124.     _wp1 setWaypointSpeed "FULL";
  2125.  
  2126.     //Create global variable holding reference to the group
  2127.     //global variables like TerrorSquadA are held in an area called missionNamespace
  2128.     //so setting a variable there of the value of _groupName
  2129.     //gives us the same functionality as saying
  2130.     //TerrorSquadA = createGroup resistance;
  2131.     missionNamespace setVariable[ _groupName, _group ];
  2132.  
  2133.     while {true} do {
  2134.        
  2135.         //Spawn units
  2136.         {
  2137.             private[ "_unit" ];
  2138.             _x params [ "_unitType", "_nameSuffix" ];
  2139.            
  2140.             //Unit ARRAY command
  2141.             //Use _start as unit spawn position
  2142.             _unit = _group createUnit [ _unitType, _start, [], 0, "FORM" ];
  2143.            
  2144.             //Give unit a global var name
  2145.             //Although you would think you could use the same trick here as for the Group
  2146.             //by using missionNamespace, Object varaibles are slightly different
  2147.             //and require some extra setup
  2148.             //using BIS_fnc_objectVar is by far the easiest method to do this.
  2149.             //To make things easier on ourselfs lets use the group varname eg TerrorSquadA
  2150.             //as the prefix for the units name
  2151.             [ _unit, format[ "%1_%2", _groupName, _nameSuffix ] ] call BIS_fnc_objectVar;
  2152.            
  2153.             //Set unit skills
  2154.             {
  2155.                 _x params[ "_skill", "_value" ];
  2156.                 _unit setSkill [ _skill, _value ];
  2157.             }forEach _skills;
  2158.            
  2159.             //Pass unit to script
  2160.             [ _unit ] call neb_fnc_addBounty;
  2161.             _unit spawn tlq_killTicker;
  2162.             //Reset their current waypoint
  2163.             //( as if the previous group had already got here
  2164.             //any new units would think this waypoint has been completed )
  2165.             _group setCurrentWaypoint _wp1;
  2166.            
  2167.         }forEach _groupUnits;
  2168.        
  2169.         //Wait unitl they are all dead
  2170.         waitUntil {{alive _x} count units _group == 0};
  2171.        
  2172.         //debug
  2173.         //format[ "group %1 is dead", _groupName ] remoteExec [ "systemchat", 0 ];
  2174.        
  2175.         sleep 10;
  2176.     };
  2177. };
  2178.  
  2179. //Spawn Red attack Creeps
  2180. neb_fnc_core_redCreeps = {
  2181.     params[
  2182.         //Default name, start and end to an empty string if not given
  2183.         [ "_groupName", "" ],
  2184.         [ "_start", "" ],
  2185.         [ "_end", "" ],
  2186.         [ "_groupUnits",
  2187.             //default set of units if none are passed to the script
  2188.             [
  2189.                 [ "O_T_Soldier_F", "A" ],
  2190.                 [ "O_T_Soldier_F", "B" ],
  2191.                 [ "O_T_Soldier_F", "C" ],
  2192.                 [ "O_T_Soldier_AA_F", "D" ],
  2193.                 [ "O_T_Soldier_AT_F", "E" ]
  2194.             ]
  2195.         ],
  2196.         //Default skills if none passed to the script
  2197.         [ "_skills",
  2198.             [
  2199.                 [ "aimingAccuracy", .5 ],
  2200.                 [ "aimingShake", .5 ],
  2201.                 [ "aimingSpeed", .5 ],
  2202.                 [ "endurance", 1 ],
  2203.                 [ "spotDistance", .7 ],
  2204.                 [ "spotTime", .8 ],
  2205.                 [ "courage", .8 ],
  2206.                 [ "reloadSpeed", 1 ],
  2207.                 [ "commanding", 1 ],
  2208.                 [ "general", 1 ]
  2209.             ]
  2210.         ]
  2211.     ];
  2212.  
  2213.     //Catch any errors and exit the script with a global error message
  2214.     //as we can not spawn a group without a name, start or end
  2215.     if ( _groupName isEqualTo "" ) exitWith {
  2216.         //Display error globally for connected clients
  2217.         "No groupName supplied for group spawn" remoteExec [ "BIS_fnc_error", 0 ];
  2218.     };
  2219.     if ( _start isEqualTo "" ) exitWith {
  2220.         //Display error globally for connected clients
  2221.         "No start position supplied for group spawn" remoteExec [ "BIS_fnc_error", 0 ];
  2222.     };
  2223.     if ( _end isEqualTo "" ) exitWith {
  2224.         //Display error globally for connected clients
  2225.         "No end position supplied for group spawn" remoteExec [ "BIS_fnc_error", 0 ];
  2226.     };
  2227.  
  2228.     //Work out what we have passed as positions
  2229.     {
  2230.         private[ "_pos" ];
  2231.         //What have we passed as _start and _end
  2232.         switch( typeName _x ) do {
  2233.             //Is it a STRING which means its a marker
  2234.             case ( typeName "" ) : {
  2235.                 _pos = getMarkerPos _x
  2236.             };
  2237.             //Is it an object
  2238.             case ( "OBJECT" ) : {
  2239.                 _pos = getPos _x;
  2240.             };
  2241.             //Is it a location
  2242.             case ( "LOCATION" ) : {
  2243.                 _pos = locationPosition _x;
  2244.             };
  2245.         };
  2246.        
  2247.         //Put position in the right variable
  2248.         //_start
  2249.         if ( _forEachIndex isEqualTo 0 ) then {
  2250.             _start = _pos;
  2251.         }else{
  2252.             //_end
  2253.             _end = _pos;
  2254.         };
  2255.        
  2256.     }forEach [ _start, _end ];
  2257.  
  2258.  
  2259.     //********
  2260.     // SPAWN Reinforcement Group
  2261.     //********
  2262.  
  2263.     private[ "_group", "_wp1" ];
  2264.  
  2265.     //Setup one time group with waypoint
  2266.     _group = createGroup east;
  2267.     //Use end for WP position
  2268.     _wp = _group addWaypoint [ _end, 1 ];
  2269.     _wp setWaypointType "MOVE";
  2270.     _wp setWaypointSpeed "FULL";
  2271.  
  2272.     //Create global variable holding reference to the group
  2273.     //global variables like TerrorSquadA are held in an area called missionNamespace
  2274.     //so setting a variable there of the value of _groupName
  2275.     //gives us the same functionality as saying
  2276.     //TerrorSquadA = createGroup resistance;
  2277.     missionNamespace setVariable[ _groupName, _group ];
  2278.  
  2279.     while {true} do {
  2280.        
  2281.         //Spawn units
  2282.         {
  2283.             private[ "_unit" ];
  2284.             _x params [ "_unitType", "_nameSuffix" ];
  2285.            
  2286.             //Unit ARRAY command
  2287.             //Use _start as unit spawn position
  2288.             _unit = _group createUnit [ _unitType, _start, [], 0, "FORM" ];
  2289.            
  2290.             //Give unit a global var name
  2291.             //Although you would think you could use the same trick here as for the Group
  2292.             //by using missionNamespace, Object varaibles are slightly different
  2293.             //and require some extra setup
  2294.             //using BIS_fnc_objectVar is by far the easiest method to do this.
  2295.             //To make things easier on ourselfs lets use the group varname eg TerrorSquadA
  2296.             //as the prefix for the units name
  2297.             [ _unit, format[ "%1_%2", _groupName, _nameSuffix ] ] call BIS_fnc_objectVar;
  2298.            
  2299.             //Set unit skills
  2300.             {
  2301.                 _x params[ "_skill", "_value" ];
  2302.                 _unit setSkill [ _skill, _value ];
  2303.             }forEach _skills;
  2304.            
  2305.             //Pass unit to script
  2306.             [ _unit ] call neb_fnc_addBounty;
  2307.             _unit spawn tlq_killTicker;
  2308.            
  2309.             //Reset their current waypoint
  2310.             //( as if the previous group had already got here
  2311.             //any new units would think this waypoint has been completed )
  2312.             _group setCurrentWaypoint _wp;
  2313.            
  2314.         }forEach _groupUnits;
  2315.        
  2316.         //Wait unitl they are all dead
  2317.         waitUntil {{alive _x} count units _group == 0};
  2318.        
  2319.         //debug
  2320.         //format[ "group %1 is dead", _groupName ] remoteExec [ "systemchat", 0 ];
  2321.        
  2322.         sleep 10;
  2323.     };
  2324. };
  2325.  
  2326. // Initiate AI Spawns
  2327. neb_fnc_core_creepSpawn = {
  2328. waitUntil { time > 0 }; //after briefing
  2329. [ "TerrorSquadA", "TerrorSpawnA", civiZoneA ] spawn neb_fnc_core_terrorSpawn;
  2330. [ "TerrorSquadB", "TerrorSpawnB", civiZoneB ] spawn neb_fnc_core_terrorSpawn;
  2331. sleep 5;
  2332. [ "BluSquadA", "BluSpawn", BluBase ] spawn neb_fnc_core_bluDefender;
  2333. [ "RedSquadA", "RedSpawn", RedBase ] spawn neb_fnc_core_redDefender;
  2334. sleep 60;
  2335. [ "BluSquadB", "BluSpawn", mercZone ] spawn neb_fnc_core_bluCreeps;
  2336. [ "RedSquadB", "RedSpawn", mercZone ] spawn neb_fnc_core_redCreeps;
  2337. sleep 10;
  2338. [ "BluSquadS", "BluSpawn", BluShop ] spawn neb_fnc_core_bluDefender;
  2339. [ "RedSquadS", "RedSpawn", RedShop ] spawn neb_fnc_core_redDefender;
  2340. /*
  2341. sleep 300;
  2342. [ "BluSquadC", "BluSpawn", mercZone ] spawn neb_fnc_core_bluCreeps;
  2343. [ "RedSquadC", "RedSpawn", mercZone ] spawn neb_fnc_core_redCreeps;
  2344. */
  2345. sleep 300;
  2346. [ "BluSquadD", "BluSpawn", RedBase ] spawn neb_fnc_core_bluCreeps;
  2347. [ "RedSquadD", "RedSpawn", BluBase ] spawn neb_fnc_core_redCreeps;
  2348. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement