diff --git a/README.md b/README.md index 58672c6..9c1d094 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,28 @@ -# Exile Occupation (a3_exile_occupation) - -![Arma 1.62](https://img.shields.io/badge/Arma-1.62-blue.svg) ![Exile 1.0.1 Sweet Potato](https://img.shields.io/badge/Exile-1.0.1%20Sweet%20Potato-C72651.svg) - -WTF is Occupation? -An AI spawner and monitor to be used in conjunction with DMS and will not work without it: -http://www.exilemod.com/topic/61-dms-defents-mission-system/ - -Download the pbo version here: - -https://github.com/secondcoming/a3_exile_occupation/blob/development/pre-packaged%20pbo/a3_exile_occupation.pbo - - -To install place the pbo into the @ExileServer/addons folder - -For more info: -http://www.exilemod.com/topic/12517-release-exile-occupation-roaming-ai - -###License Overview: -This work is protected by [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](http://creativecommons.org/licenses/by-nc-sa/4.0/). By using, downloading, or copying any of the work contained, you agree to the license included. - -Creative Commons License
Exile Occupation by second_coming is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. - -### Donations: -Anyone wishing to donate can do so here http://exileyorkshire.co.uk/ -All donations go towards coffee to keep me awake :) +# Exile Occupation (a3_exile_occupation) + +![v66 New Features](https://img.shields.io/badge/v66-New%20Features-red.svg) ![Arma 1.68](https://img.shields.io/badge/Arma-1.68-blue.svg) ![Exile 1.0.2 Sweet Potato](https://img.shields.io/badge/Exile-1.0.2%20Sweet%20Potato-C72651.svg) + +WTF is Occupation? +An AI spawner and monitor to be used in conjunction with DMS and will not work without it: +http://www.exilemod.com/topic/61-dms-defents-mission-system/ + +How to install? +To install place the pbo into the @ExileServer/addons folder + +How edit and compile? +You'll find the files in the source folder. Edit the config as you need and then compile the PBO with PBO Manager 1.4b: +http://www.armaholic.com/page.php?id=16369 - (Please note, only use the x64 version) + +For more info: +http://www.exilemod.com/topic/12517-release-exile-occupation-roaming-ai + +###License Overview: +This work is protected by [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](http://creativecommons.org/licenses/by-nc-sa/4.0/). By using, downloading, or copying any of the work contained, you agree to the license included. + +Creative Commons License
Exile Occupation by second_coming is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. + +### Donations: +Anyone wishing to donate can do so here http://exileyorkshire.co.uk/ +All donations go towards coffee to keep me awake :) + +###Updated and modified by [FPS]kuplion \ No newline at end of file diff --git a/pre-packaged pbo/a3_exile_occupation.pbo b/pre-packaged pbo/a3_exile_occupation.pbo index e502985..cb1a062 100644 Binary files a/pre-packaged pbo/a3_exile_occupation.pbo and b/pre-packaged pbo/a3_exile_occupation.pbo differ diff --git a/source/a3_exile_occupation/README.md b/source/a3_exile_occupation/README.md index 9e1d447..517455c 100644 --- a/source/a3_exile_occupation/README.md +++ b/source/a3_exile_occupation/README.md @@ -1,26 +1,28 @@ -# Exile Occupation (a3_exile_occupation) - -![Arma 1.62](https://img.shields.io/badge/Arma-1.62-blue.svg) ![Exile 1.0.0 Potato](https://img.shields.io/badge/Exile-1.0.1%20Sweet%20Potato-C72651.svg) - -WTF is Occupation? -An AI spawner and monitor to be used in conjunction with DMS and will not work without it: -http://www.exilemod.com/topic/61-dms-defents-mission-system/ - -Download the pbo version here: - -https://github.com/secondcoming/a3_exile_occupation/blob/development/pre-packaged%20pbo/a3_exile_occupation.pbo - - -To install place the pbo into the @ExileServer/addons folder - -For more info: -http://www.exilemod.com/topic/12517-release-exile-occupation-roaming-ai - -###License Overview: -This work is protected by [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](http://creativecommons.org/licenses/by-nc-sa/4.0/). By using, downloading, or copying any of the work contained, you agree to the license included. - -Creative Commons License
Exile Occupation by second_coming is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. - -### Donations: -Anyone wishing to donate can do so here http://exileyorkshire.co.uk/ -All donations go towards coffee to keep me awake :) +# Exile Occupation (a3_exile_occupation) + +![v65a Bug Fix](https://img.shields.io/badge/v65a-Bug%20Fix-red.svg) ![Arma 1.66](https://img.shields.io/badge/Arma-1.66-blue.svg) ![Exile 1.0.2 Sweet Potato](https://img.shields.io/badge/Exile-1.0.2%20Sweet%20Potato-C72651.svg) + +WTF is Occupation? +An AI spawner and monitor to be used in conjunction with DMS and will not work without it: +http://www.exilemod.com/topic/61-dms-defents-mission-system/ + +How to install? +To install place the pbo into the @ExileServer/addons folder + +How edit and compile? +You'll find the files in the source folder. Edit the config as you need and then compile the PBO with PBO Manager 1.4b: +http://www.armaholic.com/page.php?id=16369 - (Please note, only use the x64 version) + +For more info: +http://www.exilemod.com/topic/12517-release-exile-occupation-roaming-ai + +###License Overview: +This work is protected by [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](http://creativecommons.org/licenses/by-nc-sa/4.0/). By using, downloading, or copying any of the work contained, you agree to the license included. + +Creative Commons License
Exile Occupation by second_coming is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. + +### Donations: +Anyone wishing to donate can do so here http://exileyorkshire.co.uk/ +All donations go towards coffee to keep me awake :) + +###Updated and modified by [FPS]kuplion \ No newline at end of file diff --git a/source/a3_exile_occupation/config.cpp b/source/a3_exile_occupation/config.cpp index 0d18c43..65c5cf9 100644 --- a/source/a3_exile_occupation/config.cpp +++ b/source/a3_exile_occupation/config.cpp @@ -4,9 +4,9 @@ class CfgPatches units[] = {}; weapons[] = {}; requiredVersion = 0.1; - a3_exile_occupation_version = "V65 (30-08-2016)"; + a3_exile_occupation_version = "V66 (23-03-2017)"; requiredAddons[] = {"a3_dms"}; - author[]= {"second_coming"}; + author[]= {"second_coming - modified by [FPS]kuplion"}; }; }; diff --git a/source/a3_exile_occupation/config.sqf b/source/a3_exile_occupation/config.sqf index 51ecb55..5a1a9d1 100644 --- a/source/a3_exile_occupation/config.sqf +++ b/source/a3_exile_occupation/config.sqf @@ -13,20 +13,18 @@ // Shared Config for each occupation monitor -SC_debug = false; // set to true to turn on debug features (not recommended for live servers) +SC_debug = false; // set to true to turn on debug features (not recommended for live servers) +SC_extendedLogging = false; // set to true for additional +SC_infiSTAR_log = true; // true Use infiSTAR logging, false logs to server rpt + SC_useApexClasses = true; // true if you want to use the Apex class list over rides, false to use vanilla Arma gear SC_useMapOverrides = true; // set to true to enable over riding options per map (see the bottom of this file for examples) -SC_extendedLogging = false; // set to true for additional logging -SC_infiSTAR_log = true; // true Use infiSTAR logging, false logs to server rpt SC_maxAIcount = 100; // the maximum amount of AI, if the AI count is above this then additional AI won't spawn SC_mapMarkers = false; // Place map markers at the occupied areas (occupyPlaces and occupyMilitary only) true/false SC_minFPS = 5; // any lower than minFPS on the server and additional AI won't spawn SC_scaleAI = 10; // any more than _scaleAI players on the server and _maxAIcount is reduced for each extra player -SC_removeUserMapMarkers = true; // true to delete map markers placed by players every 10 seconds - - // Distance limits for selecting safe places to spawn AI SC_minDistanceToSpawnZones = 750; // Minimum distance in metres to the nearest spawn zone SC_minDistanceToTraders = 750; // Minimum distance in metres to the nearest trader zone SC_minDistanceToTerritory = 350; // Minimum distance in metres to the nearest player territory @@ -50,6 +48,7 @@ SC_occupyMilitary = false; // true if you want military buildings SC_occupyVehicle = true; // true if you want to have roaming AI land vehicles SC_occupySky = true; // true if you want to have roaming AI helis SC_occupySea = false; // true if you want to have roaming AI boats +SC_occupyHeliCrashes = true; // true if you want to have Dayz style helicrashes ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Fast nights Setup @@ -71,11 +70,11 @@ SC_randomSpawnMaxGroupSize = 5; // Maximum amount of ra SC_randomSpawnChance = 12; // Percentage chance of spawning if suitable player found SC_randomSpawnIgnoreCount = true; // true if you want spawn random AI groups regardless of overall AI count (they still count towards the total though) SC_randomSpawnFrequency = 3600; // time in seconds between the possibility of random AI hunting the same player (1800 for 30 minutes) -SC_randomSpawnAnnounce = true; // true if you want a warning toast issued to all players when AI spawns - SC_randomSpawnNearBases = true; // true if you want to allow random spawns in range of territories SC_randomSpawnNearSpawns = false; // true if you want to allow random spawns in range of spawn zones SC_randomSpawnTargetBambis = false; // true if you want to allow random spawns to target bambis +SC_randomSpawnAnnounce = true; // true if you want a warning toast issued to all players when AI spawns +SC_randomSpawnNameTarget = false; // true if you want to name the targeted player ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Occupy Places Setup @@ -90,13 +89,15 @@ SC_occupyPlacesSurvivors = true; // true if you want a chance to spawn sur SC_occupyTraderDetails = [ //["Tanoa","Lifou Traders",[7317,7217,0],"trader1.sqf",true], //["Tanoa","Lijnhaven Traders",[11580,2051,0],"trader1.sqf",true], - ["Napf","Hafen Traders",[9286,17606,0],"trader1.sqf",true] + //["Napf","Hafen Traders",[9286,17606,0],"trader1.sqf",true] ]; //["mapname","Name",[x,y,z],"filename",true] trader name, location, safezone true/false ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Occupy Static Setup ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +SC_staticIgnoreNearbyPlayers = false;// Spawn even if players are nearby +SC_staticIgnoreAICount = false;// Ignore the AI count for Static AI Spawns SC_staticBandits = [ //[[pos],ai count,radius,search buildings] ]; @@ -141,6 +142,7 @@ SC_occupyLootCratesLocations = [ [3000,3000,0], [4000,4000,0] ]; +SC_SpawnLootCrateGuards = true; // true if you want to enable AI guards SC_numberofLootCrates = 6; // if SC_occupyLootCrates = true spawn this many loot crates (overrided below for Namalsk) SC_LootCrateGuards = 2; // number of AI to spawn at each crate SC_LootCrateGuardsRandomize = true; // Use a random number of guards up to a maximum = SC_LootCrateGuards (so between 1 and SC_LootCrateGuards) @@ -196,9 +198,18 @@ SC_blackListedAreas = [ // Heli Crash Setup ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -SC_occupyHeliCrashes = true; // true if you want to have Dayz style helicrashes -SC_numberofHeliCrashesFire = true; // true if you want the crash on fire, false if you just want smoke -SC_numberofHeliCrashes = 5; // if SC_occupyHeliCrashes = true spawn this many loot crates +SC_occupyHeliCrashesStatic = false; // true if you want to have random Heli Crash spawn in pre-defined locations set in SC_occupyHeliCrashesLocations +SC_occupyHeliCrashesLocations = [ + [1000,1000,0], + [2000,2000,0], + [3000,3000,0], + [4000,4000,0] + ]; +SC_HeliCrashesOnFire = true; // true if you want the crash on fire, false if you just want smoke +SC_SpawnHeliCrashGuards = true; // true if you want to enable AI guards +SC_numberofHeliCrashes = 5; // if SC_occupyHeliCrashes = true spawn this many Heli Crashes +SC_HeliCrashGuards = 6; // number of AI to spawn at each crate +SC_HeliCrashGuardsRandomize = true; // Use a random number of guards up to a maximum = SC_HeliCrashGuards (so between 1 and SC_HeliCrashGuards) // Array of possible common items to go in heli crash crates ["classname",fixed amount,random amount] NOT INCLUDING WEAPONS // ["HandGrenade",0,2] this example would add between 0 and 2 HandGrenade to the crate (fixed 0 plus 0-2 random) @@ -235,7 +246,7 @@ SC_HeliCrashMagazinesAmount = [2,2]; // [fixed amount to add, random amount to ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// SC_minimumCrewAmount = 2; // Minimum amount of AI allowed in a vehicle -SC_maximumCrewAmount = 3; // Maximum amount of AI allowed in a vehicle +SC_maximumCrewAmount = 5; // Maximum amount of AI allowed in a vehicle // (essential crew like drivers and gunners will always spawn regardless of these settings) ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -243,7 +254,7 @@ SC_maximumCrewAmount = 3; // Maximum amount of AI allowed in a vehi ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// SC_maxNumberofVehicles = 3; // How many roaming vehicles to spawn -SC_occupyVehicleIgnoreCount = false; // true if you want spawn vehicles regardless of overall AI count +SC_occupyLandVehicleIgnoreCount = false; // true if you want spawn vehicles regardless of overall AI count SC_occupyVehiclesLocked = false; // true if AI vehicles to stay locked until all the linked AI are dead SC_occupyVehicleSurvivors = false; // true if you want a chance to spawn survivor AI as well as bandits (SC_occupyVehicle must be true to use this option) @@ -272,6 +283,21 @@ SC_VehicleClassToUseRare = [ ["Exile_Car_Offroad_Armed_Guerilla03",1], ["Exile_Car_Tempest",1] ]; + +// Array of arrays of ground vehicles which can be used by Survivor AI patrols (the number next to next vehicle is the maximum amount of that class allowed, 0 for no limit) +SC_SurvivorVehicleClassToUse = [ + ["Exile_Car_LandRover_Green",0], + ["Exile_Bike_QuadBike_Black",2], + ["Exile_Car_UAZ_Open_Green",2] + ]; +SC_SurvivorVehicleClassToUseRare = [ + ["Exile_Car_Hunter",1], + ["Exile_Car_HEMMT",1], + ["Exile_Car_Zamak",1], + ["Exile_Car_Offroad_Armed_Guerilla12",1], + ["Exile_Car_Offroad_Armed_Guerilla03",1], + ["Exile_Car_Tempest",1] + ]; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Roaming Aircraft Setup @@ -279,6 +305,7 @@ SC_VehicleClassToUseRare = [ // Settings for roaming airborne AI (non armed helis will just fly around) SC_maxNumberofHelis = 1; +SC_occupySkyVehicleIgnoreCount = false; // true if you want spawn vehicles regardless of overall AI count // Array of aircraft which can be used by AI patrols (the number next to next vehicle is the maximum amount of that class allowed, 0 for no limit) SC_HeliClassToUse = [ ["Exile_Chopper_Huey_Armed_Green",0] ]; @@ -391,7 +418,21 @@ SC_BanditPistol = ["hgun_ACPC2_F","hgun_P07_F","hgun_Pistol_heavy_0 SC_BanditPistolAttachments = []; SC_BanditAssignedItems = ["ItemMap","ItemCompass","ItemRadio","ItemWatch"]; // all these items will be added SC_BanditLauncher = []; -SC_BanditBackpack = ["B_HuntingBackpack","B_Kitbag_cbr","B_Kitbag_mcamo","B_Kitbag_sgg","B_OutdoorPack_blk","B_OutdoorPack_blu","B_OutdoorPack_tan","B_TacticalPack_blk","B_TacticalPack_mcamo","B_TacticalPack_ocamo","B_TacticalPack_oli","B_TacticalPack_rgr"]; +SC_BanditBackpack = ["B_HuntingBackpack","B_Kitbag_cbr","B_Kitbag_mcamo","B_Kitbag_sgg","B_OutdoorPack_blk","B_OutdoorPack_blu","B_OutdoorPack_tan","B_TacticalPack_blk","B_TacticalPack_mcamo","B_TacticalPack_ocamo","B_TacticalPack_oli","B_TacticalPack_rgr"]; + +// Possible equipment for random ai to spawn with +// spawning random ai without vests or backpacks will result in them having no ammunition +SC_RandomUniforms = ["U_B_GEN_Soldier_F"]; +SC_RandomVests = ["V_TacVest_gen_F"]; +SC_RandomHeadgear = ["H_Cap_police"]; +SC_RandomWeapon = ["SMG_05_F"]; +SC_RandomWeaponAttachments = ["muzzle_snds_L"]; +SC_RandomMagazines = ["Exile_Item_InstaDoc","Exile_Item_Vishpirin","Exile_Item_Bandage","Exile_Item_DuctTape","Exile_Item_PlasticBottleFreshWater","Exile_Item_Energydrink","Exile_Item_EMRE","Exile_Item_Cheathas","Exile_Item_Noodles","Exile_Item_BBQSandwich","Exile_Item_Catfood"]; +SC_RandomPistol = ["hgun_Rook40_F"]; +SC_RandomPistolAttachments = ["muzzle_snds_L"]; +SC_RandomAssignedItems = ["ItemMap","ItemCompass","ItemRadio","ItemWatch"]; // all these items will be added +SC_RandomLauncher = []; +SC_RandomBackpack = ["B_AssaultPack_blk"]; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Map Specific Overrides @@ -424,22 +465,64 @@ if (worldName == 'Tanoa' AND SC_useMapOverrides) then if(SC_useApexClasses) then { - SC_BanditWeapon = [ "arifle_MX_khk_F","arifle_MX_GL_khk_F","arifle_MX_SW_khk_F","arifle_MXC_khk_F","arifle_MXM_khk_F","arifle_AK12_F","arifle_AK12_GL_F","arifle_AKM_F", - "arifle_AKS_F","arifle_ARX_blk_F","arifle_ARX_ghex_F","arifle_ARX_hex_F","arifle_CTAR_blk_F","arifle_CTAR_GL_blk_F","arifle_CTARS_blk_F","arifle_SPAR_01_blk_F","arifle_SPAR_01_khk_F", - "arifle_SPAR_01_snd_F","arifle_SPAR_01_GL_blk_F","arifle_SPAR_01_GL_khk_F","arifle_SPAR_01_GL_snd_F","arifle_SPAR_02_blk_F","arifle_SPAR_02_khk_F","arifle_SPAR_02_snd_F", - "arifle_SPAR_03_blk_F","arifle_SPAR_03_khk_F","arifle_SPAR_03_snd_F"]; - SC_BanditUniforms = [ "U_I_C_Soldier_Para_1_F","U_I_C_Soldier_Para_2_F","U_I_C_Soldier_Para_3_F","U_I_C_Soldier_Para_4_F","U_I_C_Soldier_Para_5_F","U_I_C_Soldier_Bandit_1_F","U_I_C_Soldier_Bandit_2_F", - "U_I_C_Soldier_Bandit_3_F","U_I_C_Soldier_Bandit_4_F","U_I_C_Soldier_Bandit_5_F","U_I_C_Soldier_Camo_F","U_B_CTRG_Soldier_urb_1_F","U_B_CTRG_Soldier_urb_2_F","U_B_CTRG_Soldier_urb_3_F"]; - SC_VehicleClassToUse = [ + SC_BanditWeapon = [ + "arifle_MX_khk_F", + "arifle_MX_GL_khk_F", + "arifle_MX_SW_khk_F", + "arifle_MXC_khk_F", + "arifle_MXM_khk_F", + "arifle_AK12_F", + "arifle_AK12_GL_F", + "arifle_AKM_F", + "arifle_AKS_F", + "arifle_ARX_blk_F", + "arifle_ARX_ghex_F", + "arifle_ARX_hex_F", + "arifle_CTAR_blk_F", + "arifle_CTAR_GL_blk_F", + "arifle_CTARS_blk_F", + "arifle_SPAR_01_blk_F", + "arifle_SPAR_01_khk_F", + "arifle_SPAR_01_snd_F", + "arifle_SPAR_01_GL_blk_F", + "arifle_SPAR_01_GL_khk_F", + "arifle_SPAR_01_GL_snd_F", + "arifle_SPAR_02_blk_F", + "arifle_SPAR_02_khk_F", + "arifle_SPAR_02_snd_F", + "arifle_SPAR_03_blk_F", + "arifle_SPAR_03_khk_F", + "arifle_SPAR_03_snd_F" + ]; + + SC_BanditUniforms = [ + "U_I_C_Soldier_Para_1_F", + "U_I_C_Soldier_Para_2_F", + "U_I_C_Soldier_Para_3_F", + "U_I_C_Soldier_Para_4_F", + "U_I_C_Soldier_Para_5_F", + "U_I_C_Soldier_Bandit_1_F", + "U_I_C_Soldier_Bandit_2_F", + "U_I_C_Soldier_Bandit_3_F", + "U_I_C_Soldier_Bandit_4_F", + "U_I_C_Soldier_Bandit_5_F", + "U_I_C_Soldier_Camo_F", + "U_B_CTRG_Soldier_urb_1_F", + "U_B_CTRG_Soldier_urb_2_F", + "U_B_CTRG_Soldier_urb_3_F" + ]; + + SC_VehicleClassToUse = [ ["B_GEN_Offroad_01_gen_F",0], ["C_Offroad_02_unarmed_F",0], ["I_C_Offroad_02_unarmed_F",0] - ]; + ]; + SC_VehicleClassToUseRare = [ ["B_LSV_01_unarmed_black_F",1], ["O_T_LSV_02_unarmed_black_F",1], ["O_T_Truck_03_device_ghex_F",1] - ]; + ]; }; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/a3_exile_occupation/scripts/functions/fnc_findsafePos.sqf b/source/a3_exile_occupation/scripts/functions/fnc_findsafePos.sqf index 9672a04..8b8e6aa 100644 --- a/source/a3_exile_occupation/scripts/functions/fnc_findsafePos.sqf +++ b/source/a3_exile_occupation/scripts/functions/fnc_findsafePos.sqf @@ -15,6 +15,11 @@ if (worldName == 'Esseker') then _maxDist = 5000; }; +if (worldName == 'Chernarus') then +{ + _maxDist = _middle - 1500;; +}; + if(_roadSpawn) then { _maxDist = _maxDist - 1400; diff --git a/source/a3_exile_occupation/scripts/functions/fnc_selectGear.sqf b/source/a3_exile_occupation/scripts/functions/fnc_selectGear.sqf index b4aa99d..3b995e1 100644 --- a/source/a3_exile_occupation/scripts/functions/fnc_selectGear.sqf +++ b/source/a3_exile_occupation/scripts/functions/fnc_selectGear.sqf @@ -56,17 +56,28 @@ switch (_side) do }; case "cops": { - _uniform = "U_B_GEN_Soldier_F"; - _vest = "V_TacVest_gen_F"; - _headgear = "H_Cap_police"; - _weapon = "SMG_05_F"; - _weaponAttachments = ["muzzle_snds_L"]; - _pistol = "hgun_Rook40_F"; - _pistolAttachments = ["muzzle_snds_L"]; - _launcher = ""; - _backpack = ""; - _assignedItems = ["ItemMap","ItemCompass","ItemRadio","ItemWatch"]; - _magazines = ["30Rnd_9x21_Mag_SMG_02","30Rnd_9x21_Mag_SMG_02","16Rnd_9x21_Mag","16Rnd_9x21_Mag"]; + if(count SC_RandomUniforms == 0) then { _uniform = ""; } else { _uniform = SC_RandomUniforms call BIS_fnc_selectRandom; }; + if(count SC_RandomVests == 0) then { _vest = ""; } else { _vest = SC_RandomVests call BIS_fnc_selectRandom; }; + if(count SC_RandomHeadgear == 0) then { _headgear = ""; } else { _headgear = SC_RandomHeadgear call BIS_fnc_selectRandom; }; + if(count SC_RandomWeapon == 0) then { _weapon = ""; } else { _weapon = SC_RandomWeapon call BIS_fnc_selectRandom; }; + if(count SC_RandomWeaponAttachments == 0) then { _weaponAttachments = [""]; } else { _weaponAttachments = [SC_RandomWeaponAttachments call BIS_fnc_selectRandom]; }; + if(count SC_RandomPistol == 0) then { _pistol = ""; } else { _pistol = SC_RandomPistol call BIS_fnc_selectRandom; }; + if(count SC_RandomPistolAttachments == 0) then { _pistolAttachments = [""]; } else { _pistolAttachments = [SC_RandomPistolAttachments call BIS_fnc_selectRandom]; }; + if(count SC_RandomLauncher == 0) then { _launcher = ""; } else { _launcher = SC_RandomLauncher call BIS_fnc_selectRandom; }; + if(count SC_RandomBackpack == 0) then { _backpack = ""; } else { _backpack = SC_RandomBackpack call BIS_fnc_selectRandom; }; + _assignedItems = SC_RandomAssignedItems; + + _magazines = []; + if(count SC_RandomMagazines > 0) then + { + _amountOfMagazines = 1 + round random (2); + for "_i" from 1 to _amountOfMagazines do + { + _newMagazine = SC_RandomMagazines call BIS_fnc_selectRandom; + _quantity = 1 + round random (2); + _magazines pushBack [_newMagazine,_quantity]; + }; + }; }; }; diff --git a/source/a3_exile_occupation/scripts/functions/fnc_spawnStatics.sqf b/source/a3_exile_occupation/scripts/functions/fnc_spawnStatics.sqf index 57b649e..b6fdb8d 100644 --- a/source/a3_exile_occupation/scripts/functions/fnc_spawnStatics.sqf +++ b/source/a3_exile_occupation/scripts/functions/fnc_spawnStatics.sqf @@ -41,7 +41,7 @@ if(_side == "survivor") then { _currentSide = SC_SurvivorSide }; // Don't spawn additional AI if there are players in range - if([_spawnPosition, 250] call ExileClient_util_world_isAlivePlayerInRange) exitwith + if(!(SC_staticIgnoreNearbyPlayers) && ([_spawnPosition, 250] call ExileClient_util_world_isAlivePlayerInRange)) exitwith { _okToSpawn = false; if(_debug) then diff --git a/source/a3_exile_occupation/scripts/occupationHeliCrashes.sqf b/source/a3_exile_occupation/scripts/occupationHeliCrashes.sqf index e99bea1..aff83a4 100644 --- a/source/a3_exile_occupation/scripts/occupationHeliCrashes.sqf +++ b/source/a3_exile_occupation/scripts/occupationHeliCrashes.sqf @@ -16,7 +16,22 @@ for "_i" from 1 to SC_numberofHeliCrashes do while{!_validspot} do { sleep 0.2; - _position = [ false, false ] call SC_fnc_findsafePos; + if(SC_occupyHeliCrashesStatic) then + { + _tempPosition = SC_occupyHeliCrashesLocations call BIS_fnc_selectRandom; + SC_occupyHeliCrashesLocations = SC_occupyHeliCrashesLocations - _tempPosition; + + _position = [_tempPosition select 0, _tempPosition select 1, _tempPosition select 2]; + if(isNil "_position") then + { + _position = [ false, false ] call SC_fnc_findsafePos; + }; + } + else + { + _position = [ false, false ] call SC_fnc_findsafePos; + }; + _validspot = true; //Check if near another heli crash site @@ -37,7 +52,7 @@ for "_i" from 1 to SC_numberofHeliCrashes do _effect = "test_EmptyObjectForSmoke"; - if(SC_numberofHeliCrashesFire) then + if(SC_HeliCrashesOnFire) then { _effect = "test_EmptyObjectForFireBig"; }; @@ -45,6 +60,65 @@ for "_i" from 1 to SC_numberofHeliCrashes do _heliFire = _effect createVehicle (position _vehHeli); _heliFire attachto [_vehHeli, [0,0,-1]]; _vehHeli setPos _position; + + if (SC_SpawnHeliCrashGuards) then + { + //Infantry spawn using DMS + _AICount = SC_HeliCrashGuards; + + if(SC_HeliCrashGuardsRandomize) then + { + _AICount = 1 + (round (random (SC_HeliCrashGuards-1))); + }; + + if(_AICount > 0) then + { + _spawnPosition = [_position select 0, _position select 1, 0]; + + _initialGroup = createGroup SC_BanditSide; + _initialGroup setCombatMode "BLUE"; + _initialGroup setBehaviour "SAFE"; + + for "_i" from 1 to _AICount do + { + _loadOut = ["bandit"] call SC_fnc_selectGear; + _unit = [_initialGroup,_spawnPosition,"custom","random","bandit","soldier",_loadOut] call DMS_fnc_SpawnAISoldier; + _unitName = ["bandit"] call SC_fnc_selectName; + if(!isNil "_unitName") then { _unit setName _unitName; }; + reload _unit; + }; + + // Get the AI to shut the fuck up :) + enableSentences false; + enableRadio false; + + + _group = createGroup SC_BanditSide; + _group setVariable ["DMS_LockLocality",nil]; + _group setVariable ["DMS_SpawnedGroup",true]; + _group setVariable ["DMS_Group_Side", SC_BanditSide]; + + { + _unit = _x; + [_unit] joinSilent grpNull; + [_unit] joinSilent _group; + _unit setCaptive false; + }foreach units _initialGroup; + deleteGroup _initialGroup; + + [_group, _spawnPosition, 100] call bis_fnc_taskPatrol; + _group setBehaviour "STEALTH"; + _group setCombatMode "RED"; + + _logDetail = format ["[OCCUPATION:HeliCrash]:: Creating HeliCrash %3 at %1 with %2 guards",_position,_AICount,_i]; + [_logDetail] call SC_fnc_log; + }; + } + else + { + _logDetail = format ["[OCCUPATION:HeliCrash]:: Creating HeliCrash %2 at %1 with no guards",_position,_i]; + [_logDetail] call SC_fnc_log; + }; _positionOfBox = [_position,3,10,1,0,10,0] call BIS_fnc_findSafePos; _box = "Box_NATO_Ammo_F" createvehicle _positionOfBox; diff --git a/source/a3_exile_occupation/scripts/occupationLog.sqf b/source/a3_exile_occupation/scripts/occupationLog.sqf index 5a2c9a7..3d22424 100644 --- a/source/a3_exile_occupation/scripts/occupationLog.sqf +++ b/source/a3_exile_occupation/scripts/occupationLog.sqf @@ -3,7 +3,7 @@ _logDetail = format["%1 %2",SC_occupationVersion,_this select 0]; _fileName = _this select 1; -if(isNil "_fileName") then { _fileName = "A3_EXILE_OCCUPATION"; }; +if(isNil "_fileName") then { _fileName = "OCCUPATION"; }; if(SC_infiSTAR_log && !(isNil "INFISTARVERSION")) then { @@ -12,4 +12,4 @@ if(SC_infiSTAR_log && !(isNil "INFISTARVERSION")) then else { diag_log _logDetail; -}; \ No newline at end of file +}; diff --git a/source/a3_exile_occupation/scripts/occupationLootCrates.sqf b/source/a3_exile_occupation/scripts/occupationLootCrates.sqf index 1e74d89..83b80af 100644 --- a/source/a3_exile_occupation/scripts/occupationLootCrates.sqf +++ b/source/a3_exile_occupation/scripts/occupationLootCrates.sqf @@ -49,55 +49,58 @@ for "_i" from 1 to SC_numberofLootCrates do _event_marker setMarkerSize [(3), (3)]; }; - //Infantry spawn using DMS - _AICount = SC_LootCrateGuards; - - if(SC_LootCrateGuardsRandomize) then - { - _AICount = 1 + (round (random (SC_LootCrateGuards-1))); - }; - - if(_AICount > 0) then + if (SC_SpawnLootCrateGuards) then { - _spawnPosition = [_position select 0, _position select 1, 0]; - - _initialGroup = createGroup SC_BanditSide; - _initialGroup setCombatMode "BLUE"; - _initialGroup setBehaviour "SAFE"; - - for "_i" from 1 to _AICount do - { - _loadOut = ["bandit"] call SC_fnc_selectGear; - _unit = [_initialGroup,_spawnPosition,"custom","random","bandit","soldier",_loadOut] call DMS_fnc_SpawnAISoldier; - _unitName = ["bandit"] call SC_fnc_selectName; - if(!isNil "_unitName") then { _unit setName _unitName; }; - reload _unit; - }; - - // Get the AI to shut the fuck up :) - enableSentences false; - enableRadio false; + //Infantry spawn using DMS + _AICount = SC_LootCrateGuards; + + if(SC_LootCrateGuardsRandomize) then + { + _AICount = 1 + (round (random (SC_LootCrateGuards-1))); + }; - - _group = createGroup SC_BanditSide; - _group setVariable ["DMS_LockLocality",nil]; - _group setVariable ["DMS_SpawnedGroup",true]; - _group setVariable ["DMS_Group_Side", SC_BanditSide]; + if(_AICount > 0) then + { + _spawnPosition = [_position select 0, _position select 1, 0]; + + _initialGroup = createGroup SC_BanditSide; + _initialGroup setCombatMode "BLUE"; + _initialGroup setBehaviour "SAFE"; + + for "_i" from 1 to _AICount do + { + _loadOut = ["bandit"] call SC_fnc_selectGear; + _unit = [_initialGroup,_spawnPosition,"custom","random","bandit","soldier",_loadOut] call DMS_fnc_SpawnAISoldier; + _unitName = ["bandit"] call SC_fnc_selectName; + if(!isNil "_unitName") then { _unit setName _unitName; }; + reload _unit; + }; + + // Get the AI to shut the fuck up :) + enableSentences false; + enableRadio false; - { - _unit = _x; - [_unit] joinSilent grpNull; - [_unit] joinSilent _group; - _unit setCaptive false; - }foreach units _initialGroup; - deleteGroup _initialGroup; - - [_group, _spawnPosition, 100] call bis_fnc_taskPatrol; - _group setBehaviour "STEALTH"; - _group setCombatMode "RED"; + + _group = createGroup SC_BanditSide; + _group setVariable ["DMS_LockLocality",nil]; + _group setVariable ["DMS_SpawnedGroup",true]; + _group setVariable ["DMS_Group_Side", SC_BanditSide]; - _logDetail = format ["[OCCUPATION:LootCrates]:: Creating crate %3 at drop zone %1 with %2 guards",_position,_AICount,_i]; - [_logDetail] call SC_fnc_log; + { + _unit = _x; + [_unit] joinSilent grpNull; + [_unit] joinSilent _group; + _unit setCaptive false; + }foreach units _initialGroup; + deleteGroup _initialGroup; + + [_group, _spawnPosition, 100] call bis_fnc_taskPatrol; + _group setBehaviour "STEALTH"; + _group setCombatMode "RED"; + + _logDetail = format ["[OCCUPATION:LootCrates]:: Creating crate %3 at drop zone %1 with %2 guards",_position,_AICount,_i]; + [_logDetail] call SC_fnc_log; + }; } else { diff --git a/source/a3_exile_occupation/scripts/occupationRandomSpawn.sqf b/source/a3_exile_occupation/scripts/occupationRandomSpawn.sqf index 6532443..1262b1d 100644 --- a/source/a3_exile_occupation/scripts/occupationRandomSpawn.sqf +++ b/source/a3_exile_occupation/scripts/occupationRandomSpawn.sqf @@ -449,7 +449,14 @@ _livePlayers call BIS_fnc_arrayShuffle; if(SC_randomSpawnAnnounce) then { + if (SC_randomSpawnNameTarget) then + { + ["toastRequest", ["InfoTitleAndText", ["Raid group Incoming!", format["A squad of Police have been despatched to take out %1!",name _selectedPlayer]]]] call ExileServer_system_network_send_broadcast; + } + else + { ["toastRequest", ["InfoTitleAndText", ["Raid group Incoming!", "A squad of Police have been despatched to take out a trouble prisoner."]]] call ExileServer_system_network_send_broadcast; + }; }; _logDetail = format ["[OCCUPATION:RandomSpawn]:: Spawning a group of AI @ %2 to hunt player %1",_selectedPlayer,_spawnLocation]; diff --git a/source/a3_exile_occupation/scripts/occupationSea.sqf b/source/a3_exile_occupation/scripts/occupationSea.sqf index 083ffb5..46b7ed3 100644 --- a/source/a3_exile_occupation/scripts/occupationSea.sqf +++ b/source/a3_exile_occupation/scripts/occupationSea.sqf @@ -43,28 +43,37 @@ _maxDistance = _middle; for "_i" from 1 to _vehiclesToSpawn do { - private["_group"]; - - _locationArray = SC_occupyBoatFixedPositions; - // Select the spawn position - _spawnLocation = [0,0,0]; - _radius = 4000; - if(SC_occupyBoatUseFixedPos) then + if (_vehiclesToSpawn > 0) then { - { - _vehLocation = _x getVariable "SC_vehicleSpawnLocation"; - _locationArray = _locationArray - _vehLocation; - }forEach SC_liveBoatsArray; + private["_group"]; - if(count _locationArray > 0) then + _locationArray = SC_occupyBoatFixedPositions; + // Select the spawn position + _spawnLocation = [0,0,0]; + _radius = 4000; + if(SC_occupyBoatUseFixedPos) then { - _randomLocation = _locationArray call BIS_fnc_selectRandom; - diag_log format["_randomLocation: %1",_randomLocation]; - _tempLocation = _randomLocation select 0; - _spawnLocation = [_tempLocation select 0, _tempLocation select 1, _tempLocation select 2]; - _radius = _randomLocation select 1; - _locationArray = _locationArray - _randomLocation; + { + _vehLocation = _x getVariable "SC_vehicleSpawnLocation"; + _locationArray = _locationArray - _vehLocation; + }forEach SC_liveBoatsArray; + + if(count _locationArray > 0) then + { + _randomLocation = _locationArray call BIS_fnc_selectRandom; + diag_log format["_randomLocation: %1",_randomLocation]; + _tempLocation = _randomLocation select 0; + _spawnLocation = [_tempLocation select 0, _tempLocation select 1, _tempLocation select 2]; + _radius = _randomLocation select 1; + _locationArray = _locationArray - _randomLocation; + } + else + { + _potentialspawnLocation = [ _spawnCenter, 0, _maxDistance + 500, 25, 2, 1, 1] call BIS_fnc_findSafePos; + _spawnLocation = [_potentialspawnLocation select 0, _potentialspawnLocation select 1,0]; + _radius = 4000; + }; } else { @@ -72,193 +81,188 @@ for "_i" from 1 to _vehiclesToSpawn do _spawnLocation = [_potentialspawnLocation select 0, _potentialspawnLocation select 1,0]; _radius = 4000; }; - } - else - { - _potentialspawnLocation = [ _spawnCenter, 0, _maxDistance + 500, 25, 2, 1, 1] call BIS_fnc_findSafePos; - _spawnLocation = [_potentialspawnLocation select 0, _potentialspawnLocation select 1,0]; - _radius = 4000; - }; - diag_log format["[OCCUPATION:Sea] found position %1",_spawnLocation]; - _group = createGroup SC_BanditSide; - _group setVariable ["DMS_AllowFreezing",false]; - [_group,false] call DMS_fnc_FreezeToggle; - _group setVariable ["DMS_LockLocality",true]; - _group setVariable ["DMS_SpawnedGroup",true]; - _group setVariable ["DMS_Group_Side", SC_BanditSide]; - _VehicleClass = SC_BoatClassToUse call BIS_fnc_selectRandom; - _VehicleClassToUse = _VehicleClass select 0; - - boatOkToSpawn = false; - while{!boatOkToSpawn} do - { + diag_log format["[OCCUPATION:Sea] found position %1",_spawnLocation]; + _group = createGroup SC_BanditSide; + _group setVariable ["DMS_AllowFreezing",false]; + [_group,false] call DMS_fnc_FreezeToggle; + _group setVariable ["DMS_LockLocality",true]; + _group setVariable ["DMS_SpawnedGroup",true]; + _group setVariable ["DMS_Group_Side", SC_BanditSide]; _VehicleClass = SC_BoatClassToUse call BIS_fnc_selectRandom; - _VehicleClassToUse = _VehicleClass select 0; - _VehicleClassAllowedCount = _VehicleClass select 1; - _vehicleCount = 0; + _VehicleClassToUse = _VehicleClass select 0; + + boatOkToSpawn = false; + while{!boatOkToSpawn} do { - if(_VehicleClassToUse == typeOf _x) then { _vehicleCount = _vehicleCount + 1; }; - }forEach SC_liveHelisArray; - if(_vehicleCount < _VehicleClassAllowedCount OR _VehicleClassAllowedCount == 0) then { boatOkToSpawn = true; }; - }; + _VehicleClass = SC_BoatClassToUse call BIS_fnc_selectRandom; + _VehicleClassToUse = _VehicleClass select 0; + _VehicleClassAllowedCount = _VehicleClass select 1; + _vehicleCount = 0; + { + if(_VehicleClassToUse == typeOf _x) then { _vehicleCount = _vehicleCount + 1; }; + }forEach SC_liveHelisArray; + if(_vehicleCount < _VehicleClassAllowedCount OR _VehicleClassAllowedCount == 0) then { boatOkToSpawn = true; }; + }; - _vehicle = createVehicle [_VehicleClassToUse, _spawnLocation, [], 0, "NONE"]; - - if(!isNull _vehicle) then - { - _vehicle setPosASL _spawnLocation; - _vehicle setVariable["vehPos",_spawnLocation,true]; - _vehicle setVariable["vehClass",_VehicleClassToUse,true]; + _vehicle = createVehicle [_VehicleClassToUse, _spawnLocation, [], 0, "NONE"]; - _SC_vehicleSpawnLocation = [_spawnLocation,_radius,worldName]; - _vehicle setVariable ["SC_vehicleSpawnLocation", _SC_vehicleSpawnLocation,true]; - - // Remove the overpowered weapons from boats - _vehicle removeWeaponTurret ["HMG_01",[0]]; - _vehicle removeWeaponTurret ["GMG_40mm",[0]]; + if(!isNull _vehicle) then + { + _vehicle setPosASL _spawnLocation; + _vehicle setVariable["vehPos",_spawnLocation,true]; + _vehicle setVariable["vehClass",_VehicleClassToUse,true]; + + _SC_vehicleSpawnLocation = [_spawnLocation,_radius,worldName]; + _vehicle setVariable ["SC_vehicleSpawnLocation", _SC_vehicleSpawnLocation,true]; + + // Remove the overpowered weapons from boats + _vehicle removeWeaponTurret ["HMG_01",[0]]; + _vehicle removeWeaponTurret ["GMG_40mm",[0]]; - SC_liveBoats = SC_liveBoats + 1; - SC_liveBoatsArray = SC_liveBoatsArray + [_vehicle]; + SC_liveBoats = SC_liveBoats + 1; + SC_liveBoatsArray = SC_liveBoatsArray + [_vehicle]; - _vehicle setVehiclePosition [_spawnLocation, [], 0, "NONE"]; - _vehicle setVariable ["vehicleID", _spawnLocation, true]; - _vehicle setFuel 1; - _vehicle setDamage 0; - _vehicle engineOn true; - _vehicle lock 0; - _vehicle setVehicleLock "UNLOCKED"; - _vehicle setVariable ["ExileIsLocked", 0, true]; - _vehicle setVariable ["ExileIsPersistent", false]; - _vehicle action ["LightOn", _vehicle]; - sleep 0.2; - _group addVehicle _vehicle; - - // Calculate the number of seats in the vehicle and fill the required amount - _crewRequired = SC_minimumCrewAmount; - if(SC_maximumCrewAmount > SC_minimumCrewAmount) then - { - _crewRequired = floor(random[SC_minimumCrewAmount,SC_maximumCrewAmount-SC_minimumCrewAmount,SC_maximumCrewAmount]); - }; - _amountOfCrew = 0; - _unitPlaced = false; - _vehicleRoles = (typeOf _vehicle) call bis_fnc_vehicleRoles; - { - _unitPlaced = false; - _vehicleRole = _x select 0; - _vehicleSeat = _x select 1; - if(_vehicleRole == "Driver") then - { - _unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier; - _amountOfCrew = _amountOfCrew + 1; - _unit assignAsDriver _vehicle; - _unit moveInDriver _vehicle; - _unit setVariable ["DMS_AssignedVeh",_vehicle]; - _unitPlaced = true; - }; - if(_vehicleRole == "Turret") then - { - _unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier; - _amountOfCrew = _amountOfCrew + 1; - _unit moveInTurret [_vehicle, _vehicleSeat]; - _unit setVariable ["DMS_AssignedVeh",_vehicle]; - _unitPlaced = true; - }; - if(_vehicleRole == "CARGO" && _amountOfCrew < _crewRequired) then - { - _unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier; - _amountOfCrew = _amountOfCrew + 1; - _unit assignAsCargo _vehicle; - _unit moveInCargo _vehicle; - _unit setVariable ["DMS_AssignedVeh",_vehicle]; - _unitPlaced = true; - }; + _vehicle setVehiclePosition [_spawnLocation, [], 0, "NONE"]; + _vehicle setVariable ["vehicleID", _spawnLocation, true]; + _vehicle setFuel 1; + _vehicle setDamage 0; + _vehicle engineOn true; + _vehicle lock 0; + _vehicle setVehicleLock "UNLOCKED"; + _vehicle setVariable ["ExileIsLocked", 0, true]; + _vehicle setVariable ["ExileIsPersistent", false]; + _vehicle action ["LightOn", _vehicle]; + sleep 0.2; + _group addVehicle _vehicle; + + // Calculate the number of seats in the vehicle and fill the required amount + _crewRequired = SC_minimumCrewAmount; + if(SC_maximumCrewAmount > SC_minimumCrewAmount) then + { + _crewRequired = floor(random[SC_minimumCrewAmount,SC_maximumCrewAmount-SC_minimumCrewAmount,SC_maximumCrewAmount]); + }; + _amountOfCrew = 0; + _unitPlaced = false; + _vehicleRoles = (typeOf _vehicle) call bis_fnc_vehicleRoles; + { + _unitPlaced = false; + _vehicleRole = _x select 0; + _vehicleSeat = _x select 1; + if(_vehicleRole == "Driver") then + { + _unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier; + _amountOfCrew = _amountOfCrew + 1; + _unit assignAsDriver _vehicle; + _unit moveInDriver _vehicle; + _unit setVariable ["DMS_AssignedVeh",_vehicle]; + _unitPlaced = true; + }; + if(_vehicleRole == "Turret") then + { + _unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier; + _amountOfCrew = _amountOfCrew + 1; + _unit moveInTurret [_vehicle, _vehicleSeat]; + _unit setVariable ["DMS_AssignedVeh",_vehicle]; + _unitPlaced = true; + }; + if(_vehicleRole == "CARGO" && _amountOfCrew < _crewRequired) then + { + _unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier; + _amountOfCrew = _amountOfCrew + 1; + _unit assignAsCargo _vehicle; + _unit moveInCargo _vehicle; + _unit setVariable ["DMS_AssignedVeh",_vehicle]; + _unitPlaced = true; + }; - if(SC_extendedLogging && _unitPlaced) then - { - _logDetail = format['[OCCUPATION:Sky] %1 added to %2',_vehicleRole,_vehicle]; - [_logDetail] call SC_fnc_log; - }; - } forEach _vehicleRoles; - - { - _unit = _x; - _unitName = ["bandit"] call SC_fnc_selectName; - if(!isNil "_unitName") then { _unit setName _unitName; }; - [_unit] joinSilent grpNull; - [_unit] joinSilent _group; - }foreach units _group; + if(SC_extendedLogging && _unitPlaced) then + { + _logDetail = format['[OCCUPATION:Sky] %1 added to %2',_vehicleRole,_vehicle]; + [_logDetail] call SC_fnc_log; + }; + } forEach _vehicleRoles; + + { + _unit = _x; + _unitName = ["bandit"] call SC_fnc_selectName; + if(!isNil "_unitName") then { _unit setName _unitName; }; + [_unit] joinSilent grpNull; + [_unit] joinSilent _group; + }foreach units _group; - if(SC_infiSTAR_log) then - { - _logDetail = format['[OCCUPATION:Sea] %1 spawned @ %2',_VehicleClassToUse,_spawnLocation]; - [_logDetail] call SC_fnc_log; - }; + if(SC_infiSTAR_log) then + { + _logDetail = format['[OCCUPATION:Sea] %1 spawned @ %2',_VehicleClassToUse,_spawnLocation]; + [_logDetail] call SC_fnc_log; + }; - - clearMagazineCargoGlobal _vehicle; - clearWeaponCargoGlobal _vehicle; - clearItemCargoGlobal _vehicle; + + clearMagazineCargoGlobal _vehicle; + clearWeaponCargoGlobal _vehicle; + clearItemCargoGlobal _vehicle; - _vehicle addMagazineCargoGlobal ["HandGrenade", (random 2)]; - _vehicle addItemCargoGlobal ["ItemGPS", (random 1)]; - _vehicle addItemCargoGlobal ["Exile_Item_InstaDoc", (random 1)]; - _vehicle addItemCargoGlobal ["Exile_Item_PlasticBottleFreshWater", 2 + (random 2)]; - _vehicle addItemCargoGlobal ["Exile_Item_EMRE", 2 + (random 2)]; - - // Add weapons with ammo to the vehicle - _possibleWeapons = - [ - "arifle_MXM_Black_F", - "arifle_MXM_F", - "srifle_DMR_01_F", - "srifle_DMR_02_camo_F", - "srifle_DMR_02_F", - "srifle_DMR_02_sniper_F", - "srifle_DMR_03_F", - "srifle_DMR_03_khaki_F", - "srifle_DMR_03_multicam_F", - "srifle_DMR_03_tan_F", - "srifle_DMR_03_woodland_F", - "srifle_DMR_04_F", - "srifle_DMR_04_Tan_F", - "srifle_DMR_05_blk_F", - "srifle_DMR_05_hex_F", - "srifle_DMR_05_tan_f", - "srifle_DMR_06_camo_F", - "srifle_DMR_06_olive_F", - "srifle_EBR_F", - "srifle_GM6_camo_F", - "srifle_GM6_F", - "srifle_LRR_camo_F", - "srifle_LRR_F" - ]; - _amountOfWeapons = 1 + (random 3); - - for "_i" from 1 to _amountOfWeapons do - { - _weaponToAdd = _possibleWeapons call BIS_fnc_selectRandom; - _vehicle addWeaponCargoGlobal [_weaponToAdd,1]; - - _magazinesToAdd = getArray (configFile >> "CfgWeapons" >> _weaponToAdd >> "magazines"); - _vehicle addMagazineCargoGlobal [(_magazinesToAdd select 0),round random 3]; - }; + _vehicle addMagazineCargoGlobal ["HandGrenade", (random 2)]; + _vehicle addItemCargoGlobal ["ItemGPS", (random 1)]; + _vehicle addItemCargoGlobal ["Exile_Item_InstaDoc", (random 1)]; + _vehicle addItemCargoGlobal ["Exile_Item_PlasticBottleFreshWater", 2 + (random 2)]; + _vehicle addItemCargoGlobal ["Exile_Item_EMRE", 2 + (random 2)]; + + // Add weapons with ammo to the vehicle + _possibleWeapons = + [ + "arifle_MXM_Black_F", + "arifle_MXM_F", + "srifle_DMR_01_F", + "srifle_DMR_02_camo_F", + "srifle_DMR_02_F", + "srifle_DMR_02_sniper_F", + "srifle_DMR_03_F", + "srifle_DMR_03_khaki_F", + "srifle_DMR_03_multicam_F", + "srifle_DMR_03_tan_F", + "srifle_DMR_03_woodland_F", + "srifle_DMR_04_F", + "srifle_DMR_04_Tan_F", + "srifle_DMR_05_blk_F", + "srifle_DMR_05_hex_F", + "srifle_DMR_05_tan_f", + "srifle_DMR_06_camo_F", + "srifle_DMR_06_olive_F", + "srifle_EBR_F", + "srifle_GM6_camo_F", + "srifle_GM6_F", + "srifle_LRR_camo_F", + "srifle_LRR_F" + ]; + _amountOfWeapons = 1 + (random 3); + + for "_i" from 1 to _amountOfWeapons do + { + _weaponToAdd = _possibleWeapons call BIS_fnc_selectRandom; + _vehicle addWeaponCargoGlobal [_weaponToAdd,1]; + + _magazinesToAdd = getArray (configFile >> "CfgWeapons" >> _weaponToAdd >> "magazines"); + _vehicle addMagazineCargoGlobal [(_magazinesToAdd select 0),round random 3]; + }; - - [_group, _spawnLocation, _radius] call bis_fnc_taskPatrol; - _group setBehaviour "AWARE"; - _group setCombatMode "RED"; - _vehicle addEventHandler ["getin", "_this call SC_fnc_claimVehicle;"]; - _vehicle addMPEventHandler ["mpkilled", "_this call SC_fnc_vehicleDestroyed;"]; - _vehicle addMPEventHandler ["mphit", "_this call SC_fnc_hitSea;"]; - _vehicle setVariable ["SC_crewEjected", false,true]; - sleep 0.2; - } - else - { - _logDetail = format['[OCCUPATION:Sea] vehicle %1 failed to spawn (check classname is correct)',_VehicleClassToUse]; - [_logDetail] call SC_fnc_log; - }; + + [_group, _spawnLocation, _radius] call bis_fnc_taskPatrol; + _group setBehaviour "AWARE"; + _group setCombatMode "RED"; + _vehicle addEventHandler ["getin", "_this call SC_fnc_claimVehicle;"]; + _vehicle addMPEventHandler ["mpkilled", "_this call SC_fnc_vehicleDestroyed;"]; + _vehicle addMPEventHandler ["mphit", "_this call SC_fnc_hitSea;"]; + _vehicle setVariable ["SC_crewEjected", false,true]; + sleep 0.2; + } + else + { + _logDetail = format['[OCCUPATION:Sea] vehicle %1 failed to spawn (check classname is correct)',_VehicleClassToUse]; + [_logDetail] call SC_fnc_log; + }; + + }; }; diff --git a/source/a3_exile_occupation/scripts/occupationSky.sqf b/source/a3_exile_occupation/scripts/occupationSky.sqf index 97f09c6..b58a2bd 100644 --- a/source/a3_exile_occupation/scripts/occupationSky.sqf +++ b/source/a3_exile_occupation/scripts/occupationSky.sqf @@ -20,11 +20,11 @@ if(diag_fps < SC_minFPS) exitWith [_logDetail] call SC_fnc_log; }; -_aiActive = {alive _x && (side _x == SC_BanditSide OR side _x == SC_SurvivorSide)} count allUnits; -if(_aiActive > _maxAIcount) exitWith -{ - _logDetail = format ["[OCCUPATION:Sky]:: %1 active AI, so not spawning AI this time",_aiActive]; - [_logDetail] call SC_fnc_log; +_aiActive = { !isPlayer _x } count allunits; +if((_aiActive > _maxAIcount) && !SC_occupySkyVehicleIgnoreCount) exitWith +{ + _logDetail = format ["[OCCUPATION:Sky]:: %1 active AI, so not spawning AI this time",_aiActive]; + [_logDetail] call SC_fnc_log; }; SC_liveHelis = count(SC_liveHelisArray); @@ -65,27 +65,40 @@ _i = 0; for "_i" from 1 to _vehiclesToSpawn do { - private["_group"]; - _height = 350 + (round (random 200)); - _locationArray = SC_occupyHeliFixedPositions; - - // Select the spawn position - _spawnLocation = [0,0,0]; - _radius = 2000; - if(SC_occupyHeliUseFixedPos) then + if (_vehiclesToSpawn > 0) then { - { - _vehLocation = _x getVariable "SC_vehicleSpawnLocation"; - _locationArray = _locationArray - _vehLocation; - }forEach SC_liveHelisArray; + private["_group"]; + _height = 350 + (round (random 200)); + _locationArray = SC_occupyHeliFixedPositions; - if(count _locationArray > 0) then + // Select the spawn position + _spawnLocation = [0,0,0]; + _radius = 2000; + if(SC_occupyHeliUseFixedPos) then { - _randomLocation = _locationArray call BIS_fnc_selectRandom; - diag_log format["_randomLocation: %1",_randomLocation]; - _tempLocation = _randomLocation select 0; - _spawnLocation = [_tempLocation select 0, _tempLocation select 1, _tempLocation select 2]; - _radius = _randomLocation select 1; + { + _vehLocation = _x getVariable "SC_vehicleSpawnLocation"; + _locationArray = _locationArray - _vehLocation; + }forEach SC_liveHelisArray; + + if(count _locationArray > 0) then + { + _randomLocation = _locationArray call BIS_fnc_selectRandom; + diag_log format["_randomLocation: %1",_randomLocation]; + _tempLocation = _randomLocation select 0; + _spawnLocation = [_tempLocation select 0, _tempLocation select 1, _tempLocation select 2]; + _radius = _randomLocation select 1; + } + else + { + _Location = _locations call BIS_fnc_selectRandom; + _pos = position _Location; + _position = [_pos select 0, _pos select 1, 300]; + _safePos = [_position,10,100,5,0,20,0] call BIS_fnc_findSafePos; + _spawnLocation = [_safePos select 0, _safePos select 1, _height]; + _spawnLocation = [_safePos select 0, _safePos select 1, _height]; + _radius = 2000; + }; } else { @@ -97,203 +110,193 @@ for "_i" from 1 to _vehiclesToSpawn do _spawnLocation = [_safePos select 0, _safePos select 1, _height]; _radius = 2000; }; - } - else - { - _Location = _locations call BIS_fnc_selectRandom; - _pos = position _Location; - _position = [_pos select 0, _pos select 1, 300]; - _safePos = [_position,10,100,5,0,20,0] call BIS_fnc_findSafePos; - _spawnLocation = [_safePos select 0, _safePos select 1, _height]; - _spawnLocation = [_safePos select 0, _safePos select 1, _height]; - _radius = 2000; - }; - diag_log format["[OCCUPATION:Sky] found position %1",_spawnLocation]; - _group = createGroup SC_BanditSide; - _group setVariable ["DMS_AllowFreezing",false]; - [_group,false] call DMS_fnc_FreezeToggle; - _group setVariable ["DMS_LockLocality",true]; - _group setVariable ["DMS_SpawnedGroup",true]; - _group setVariable ["DMS_Group_Side", SC_BanditSide]; - - _VehicleClass = SC_HeliClassToUse call BIS_fnc_selectRandom; - _VehicleClassToUse = _VehicleClass select 0; - - heliOkToSpawn = false; - while{!heliOkToSpawn} do - { + diag_log format["[OCCUPATION:Sky] found position %1",_spawnLocation]; + _group = createGroup SC_BanditSide; + _group setVariable ["DMS_AllowFreezing",false]; + [_group,false] call DMS_fnc_FreezeToggle; + _group setVariable ["DMS_LockLocality",true]; + _group setVariable ["DMS_SpawnedGroup",true]; + _group setVariable ["DMS_Group_Side", SC_BanditSide]; + _VehicleClass = SC_HeliClassToUse call BIS_fnc_selectRandom; - _VehicleClassToUse = _VehicleClass select 0; - _VehicleClassAllowedCount = _VehicleClass select 1; - _vehicleCount = 0; + _VehicleClassToUse = _VehicleClass select 0; + + heliOkToSpawn = false; + while{!heliOkToSpawn} do { - if(_VehicleClassToUse == typeOf _x) then { _vehicleCount = _vehicleCount + 1; }; - }forEach SC_liveHelisArray; - if(_vehicleCount < _VehicleClassAllowedCount OR _VehicleClassAllowedCount == 0) then { heliOkToSpawn = true; }; - }; - - _vehicle = createVehicle [_VehicleClassToUse, _spawnLocation, [], 0, "NONE"]; - - if(!isNull _vehicle) then - { - _group addVehicle _vehicle; - _vehicle setVariable["vehPos",_spawnLocation,true]; - _vehicle setVariable["vehClass",_VehicleClassToUse,true]; - _SC_vehicleSpawnLocation = [_spawnLocation,_radius,worldName]; - diag_log format ["[occupationSky] _SC_vehicleSpawnLocation: %1",_SC_vehicleSpawnLocation]; - _vehicle setVariable ["SC_vehicleSpawnLocation", _SC_vehicleSpawnLocation,true]; - - SC_liveHelis = SC_liveHelis + 1; - SC_liveHelisArray = SC_liveHelisArray + [_vehicle]; - - _vehicle setVehiclePosition [_spawnLocation, [], 0, "FLY"]; - _vehicle setVariable ["vehicleID", _spawnLocation, true]; - _vehicle setFuel 1; - _vehicle setDamage 0; - _vehicle engineOn true; - _vehicle flyInHeight 150; - _vehicle lock 0; - _vehicle setVehicleLock "UNLOCKED"; - _vehicle setVariable ["ExileIsLocked", 0, true]; - _vehicle setVariable ["ExileIsPersistent", false]; - _vehicle action ["LightOn", _vehicle]; - - // Calculate the number of seats in the vehicle and fill the required amount - _crewRequired = SC_minimumCrewAmount; - if(SC_maximumCrewAmount > SC_minimumCrewAmount) then - { - _crewRequired = floor(random[SC_minimumCrewAmount,SC_maximumCrewAmount-SC_minimumCrewAmount,SC_maximumCrewAmount]); - }; - _amountOfCrew = 0; - _unitPlaced = false; - _vehicleRoles = (typeOf _vehicle) call bis_fnc_vehicleRoles; - { - _unitPlaced = false; - _vehicleRole = _x select 0; - _vehicleSeat = _x select 1; - if(_vehicleRole == "Driver") then + _VehicleClass = SC_HeliClassToUse call BIS_fnc_selectRandom; + _VehicleClassToUse = _VehicleClass select 0; + _VehicleClassAllowedCount = _VehicleClass select 1; + _vehicleCount = 0; { - _loadOut = ["bandit"] call SC_fnc_selectGear; - _unit = [_group,_spawnLocation,"custom","random","bandit","Vehicle",_loadOut] call DMS_fnc_SpawnAISoldier; - _amountOfCrew = _amountOfCrew + 1; - _unit assignAsDriver _vehicle; - _unit moveInDriver _vehicle; - //_vehicle lockDriver true; - _unit setVariable ["DMS_AssignedVeh",_vehicle]; - removeBackpackGlobal _unit; - _unit addBackpackGlobal "B_Parachute"; - _unitPlaced = true; - }; - if(_vehicleRole == "Turret") then - { - _loadOut = ["bandit"] call SC_fnc_selectGear; - _unit = [_group,_spawnLocation,"custom","random","bandit","Vehicle",_loadOut] call DMS_fnc_SpawnAISoldier; - _amountOfCrew = _amountOfCrew + 1; - _unit moveInTurret [_vehicle, _vehicleSeat]; - _unit setVariable ["DMS_AssignedVeh",_vehicle]; - removeBackpackGlobal _unit; - _unit addBackpackGlobal "B_Parachute"; - _unitPlaced = true; - }; - if(_vehicleRole == "CARGO" && _amountOfCrew < _crewRequired) then - { - _loadOut = ["bandit"] call SC_fnc_selectGear; - _unit = [_group,_spawnLocation,"custom","random","bandit","Vehicle",_loadOut] call DMS_fnc_SpawnAISoldier; - _amountOfCrew = _amountOfCrew + 1; - _unit assignAsCargo _vehicle; - _unit moveInCargo _vehicle; - _unit setVariable ["DMS_AssignedVeh",_vehicle]; - removeBackpackGlobal _unit; - _unit addBackpackGlobal "B_Parachute"; - _unitPlaced = true; - }; - if(SC_extendedLogging) then - { - _logDetail = format['[OCCUPATION:Sky] %1 added to %2',_vehicleRole,_vehicle]; - [_logDetail] call SC_fnc_log; - }; - } forEach _vehicleRoles; - + if(_VehicleClassToUse == typeOf _x) then { _vehicleCount = _vehicleCount + 1; }; + }forEach SC_liveHelisArray; + if(_vehicleCount < _VehicleClassAllowedCount OR _VehicleClassAllowedCount == 0) then { heliOkToSpawn = true; }; + }; + + _vehicle = createVehicle [_VehicleClassToUse, _spawnLocation, [], 0, "NONE"]; + + if(!isNull _vehicle) then { - _unit = _x; - _unitName = ["bandit"] call SC_fnc_selectName; - if(!isNil "_unitName") then { _unit setName _unitName; }; - [_unit] joinSilent grpNull; - [_unit] joinSilent _group; - }foreach units _group; + _group addVehicle _vehicle; + _vehicle setVariable["vehPos",_spawnLocation,true]; + _vehicle setVariable["vehClass",_VehicleClassToUse,true]; + _SC_vehicleSpawnLocation = [_spawnLocation,_radius,worldName]; + diag_log format ["[occupationSky] _SC_vehicleSpawnLocation: %1",_SC_vehicleSpawnLocation]; + _vehicle setVariable ["SC_vehicleSpawnLocation", _SC_vehicleSpawnLocation,true]; - if(SC_extendedLogging && _unitPlaced) then - { - _logDetail = format['[OCCUPATION:Sky] %1 spawned @ %2',_VehicleClassToUse,_spawnLocation]; - [_logDetail] call SC_fnc_log; - }; - - clearMagazineCargoGlobal _vehicle; - clearWeaponCargoGlobal _vehicle; - clearItemCargoGlobal _vehicle; + SC_liveHelis = SC_liveHelis + 1; + SC_liveHelisArray = SC_liveHelisArray + [_vehicle]; - _vehicle addMagazineCargoGlobal ["HandGrenade", (random 2)]; - _vehicle addItemCargoGlobal ["ItemGPS", (random 1)]; - _vehicle addItemCargoGlobal ["Exile_Item_InstaDoc", (random 1)]; - _vehicle addItemCargoGlobal ["Exile_Item_PlasticBottleFreshWater", 2 + (random 2)]; - _vehicle addItemCargoGlobal ["Exile_Item_EMRE", 2 + (random 2)]; - - // Add weapons with ammo to the vehicle - _possibleWeapons = - [ - "arifle_MXM_Black_F", - "arifle_MXM_F", - "srifle_DMR_01_F", - "srifle_DMR_02_camo_F", - "srifle_DMR_02_F", - "srifle_DMR_02_sniper_F", - "srifle_DMR_03_F", - "srifle_DMR_03_khaki_F", - "srifle_DMR_03_multicam_F", - "srifle_DMR_03_tan_F", - "srifle_DMR_03_woodland_F", - "srifle_DMR_04_F", - "srifle_DMR_04_Tan_F", - "srifle_DMR_05_blk_F", - "srifle_DMR_05_hex_F", - "srifle_DMR_05_tan_f", - "srifle_DMR_06_camo_F", - "srifle_DMR_06_olive_F", - "srifle_EBR_F", - "srifle_GM6_camo_F", - "srifle_GM6_F", - "srifle_LRR_camo_F", - "srifle_LRR_F" - ]; - _amountOfWeapons = 1 + (random 3); - - for "_i" from 1 to _amountOfWeapons do + _vehicle setVehiclePosition [_spawnLocation, [], 0, "FLY"]; + _vehicle setVariable ["vehicleID", _spawnLocation, true]; + _vehicle setFuel 1; + _vehicle setDamage 0; + _vehicle engineOn true; + _vehicle flyInHeight 150; + _vehicle lock 0; + _vehicle setVehicleLock "UNLOCKED"; + _vehicle setVariable ["ExileIsLocked", 0, true]; + _vehicle setVariable ["ExileIsPersistent", false]; + _vehicle action ["LightOn", _vehicle]; + + // Calculate the number of seats in the vehicle and fill the required amount + _crewRequired = SC_minimumCrewAmount; + if(SC_maximumCrewAmount > SC_minimumCrewAmount) then + { + _crewRequired = floor(random[SC_minimumCrewAmount,SC_maximumCrewAmount-SC_minimumCrewAmount,SC_maximumCrewAmount]); + }; + _amountOfCrew = 0; + _unitPlaced = false; + _vehicleRoles = (typeOf _vehicle) call bis_fnc_vehicleRoles; + { + _unitPlaced = false; + _vehicleRole = _x select 0; + _vehicleSeat = _x select 1; + if(_vehicleRole == "Driver") then + { + _loadOut = ["bandit"] call SC_fnc_selectGear; + _unit = [_group,_spawnLocation,"custom","random","bandit","Vehicle",_loadOut] call DMS_fnc_SpawnAISoldier; + _amountOfCrew = _amountOfCrew + 1; + _unit assignAsDriver _vehicle; + _unit moveInDriver _vehicle; + //_vehicle lockDriver true; + _unit setVariable ["DMS_AssignedVeh",_vehicle]; + removeBackpackGlobal _unit; + _unit addBackpackGlobal "B_Parachute"; + _unitPlaced = true; + }; + if(_vehicleRole == "Turret") then + { + _loadOut = ["bandit"] call SC_fnc_selectGear; + _unit = [_group,_spawnLocation,"custom","random","bandit","Vehicle",_loadOut] call DMS_fnc_SpawnAISoldier; + _amountOfCrew = _amountOfCrew + 1; + _unit moveInTurret [_vehicle, _vehicleSeat]; + _unit setVariable ["DMS_AssignedVeh",_vehicle]; + removeBackpackGlobal _unit; + _unit addBackpackGlobal "B_Parachute"; + _unitPlaced = true; + }; + if(_vehicleRole == "CARGO" && _amountOfCrew < _crewRequired) then + { + _loadOut = ["bandit"] call SC_fnc_selectGear; + _unit = [_group,_spawnLocation,"custom","random","bandit","Vehicle",_loadOut] call DMS_fnc_SpawnAISoldier; + _amountOfCrew = _amountOfCrew + 1; + _unit assignAsCargo _vehicle; + _unit moveInCargo _vehicle; + _unit setVariable ["DMS_AssignedVeh",_vehicle]; + removeBackpackGlobal _unit; + _unit addBackpackGlobal "B_Parachute"; + _unitPlaced = true; + }; + if(SC_extendedLogging) then + { + _logDetail = format['[OCCUPATION:Sky] %1 added to %2',_vehicleRole,_vehicle]; + [_logDetail] call SC_fnc_log; + }; + } forEach _vehicleRoles; + + { + _unit = _x; + _unitName = ["bandit"] call SC_fnc_selectName; + if(!isNil "_unitName") then { _unit setName _unitName; }; + [_unit] joinSilent grpNull; + [_unit] joinSilent _group; + }foreach units _group; + + if(SC_extendedLogging && _unitPlaced) then + { + _logDetail = format['[OCCUPATION:Sky] %1 spawned @ %2',_VehicleClassToUse,_spawnLocation]; + [_logDetail] call SC_fnc_log; + }; + + clearMagazineCargoGlobal _vehicle; + clearWeaponCargoGlobal _vehicle; + clearItemCargoGlobal _vehicle; + + _vehicle addMagazineCargoGlobal ["HandGrenade", (random 2)]; + _vehicle addItemCargoGlobal ["ItemGPS", (random 1)]; + _vehicle addItemCargoGlobal ["Exile_Item_InstaDoc", (random 1)]; + _vehicle addItemCargoGlobal ["Exile_Item_PlasticBottleFreshWater", 2 + (random 2)]; + _vehicle addItemCargoGlobal ["Exile_Item_EMRE", 2 + (random 2)]; + + // Add weapons with ammo to the vehicle + _possibleWeapons = + [ + "arifle_MXM_Black_F", + "arifle_MXM_F", + "srifle_DMR_01_F", + "srifle_DMR_02_camo_F", + "srifle_DMR_02_F", + "srifle_DMR_02_sniper_F", + "srifle_DMR_03_F", + "srifle_DMR_03_khaki_F", + "srifle_DMR_03_multicam_F", + "srifle_DMR_03_tan_F", + "srifle_DMR_03_woodland_F", + "srifle_DMR_04_F", + "srifle_DMR_04_Tan_F", + "srifle_DMR_05_blk_F", + "srifle_DMR_05_hex_F", + "srifle_DMR_05_tan_f", + "srifle_DMR_06_camo_F", + "srifle_DMR_06_olive_F", + "srifle_EBR_F", + "srifle_GM6_camo_F", + "srifle_GM6_F", + "srifle_LRR_camo_F", + "srifle_LRR_F" + ]; + _amountOfWeapons = 1 + (random 3); + + for "_i" from 1 to _amountOfWeapons do + { + _weaponToAdd = _possibleWeapons call BIS_fnc_selectRandom; + _vehicle addWeaponCargoGlobal [_weaponToAdd,1]; + + _magazinesToAdd = getArray (configFile >> "CfgWeapons" >> _weaponToAdd >> "magazines"); + _vehicle addMagazineCargoGlobal [(_magazinesToAdd select 0),round random 3]; + }; + + + [_group, _spawnLocation, _radius] call bis_fnc_taskPatrol; + _group setBehaviour "AWARE"; + _group setCombatMode "RED"; + _vehicle addEventHandler ["getin", "_this call SC_fnc_claimVehicle;"]; + _vehicle addMPEventHandler ["mpkilled", "_this call SC_fnc_vehicleDestroyed;"]; + _vehicle addMPEventHandler ["mphit", "_this call SC_fnc_hitAir;"]; + _vehicle setVariable ["SC_crewEjected", false,true]; + sleep 0.2; + } + else { - _weaponToAdd = _possibleWeapons call BIS_fnc_selectRandom; - _vehicle addWeaponCargoGlobal [_weaponToAdd,1]; - - _magazinesToAdd = getArray (configFile >> "CfgWeapons" >> _weaponToAdd >> "magazines"); - _vehicle addMagazineCargoGlobal [(_magazinesToAdd select 0),round random 3]; + _logDetail = format['[OCCUPATION:Sky] aircraft %1 failed to spawn (check classname is correct)',_VehicleClassToUse]; + [_logDetail] call SC_fnc_log; }; - - [_group, _spawnLocation, _radius] call bis_fnc_taskPatrol; - _group setBehaviour "AWARE"; - _group setCombatMode "RED"; - _vehicle addEventHandler ["getin", "_this call SC_fnc_claimVehicle;"]; - _vehicle addMPEventHandler ["mpkilled", "_this call SC_fnc_vehicleDestroyed;"]; - _vehicle addMPEventHandler ["mphit", "_this call SC_fnc_hitAir;"]; - _vehicle setVariable ["SC_crewEjected", false,true]; - sleep 0.2; - } - else - { - _logDetail = format['[OCCUPATION:Sky] aircraft %1 failed to spawn (check classname is correct)',_VehicleClassToUse]; - [_logDetail] call SC_fnc_log; }; - }; diff --git a/source/a3_exile_occupation/scripts/occupationStatic.sqf b/source/a3_exile_occupation/scripts/occupationStatic.sqf index aab0900..f08f2e7 100644 --- a/source/a3_exile_occupation/scripts/occupationStatic.sqf +++ b/source/a3_exile_occupation/scripts/occupationStatic.sqf @@ -29,7 +29,7 @@ if(diag_fps < _minFPS) exitWith _aiActive = { !isPlayer _x } count allunits; -if(_aiActive > _maxAIcount) exitWith +if(!(SC_staticIgnoreAICount) && (_aiActive > _maxAIcount)) exitWith { _logDetail = format ["[OCCUPATION Static]:: %1 active AI, so not spawning AI this time",_aiActive]; [_logDetail] call SC_fnc_log; diff --git a/source/a3_exile_occupation/scripts/occupationVehicle.sqf b/source/a3_exile_occupation/scripts/occupationVehicle.sqf index 49cf04d..a744ccc 100644 --- a/source/a3_exile_occupation/scripts/occupationVehicle.sqf +++ b/source/a3_exile_occupation/scripts/occupationVehicle.sqf @@ -22,7 +22,7 @@ if(diag_fps < SC_minFPS) exitWith [_logDetail] call SC_fnc_log; }; _aiActive = { !isPlayer _x } count allunits; -if((_aiActive > _maxAIcount) && !SC_occupyVehicleIgnoreCount) exitWith +if((_aiActive > _maxAIcount) && !SC_occupyLandVehicleIgnoreCount) exitWith { _logDetail = format ["[OCCUPATION:Vehicle]:: %1 active AI, so not spawning AI this time",_aiActive]; [_logDetail] call SC_fnc_log; @@ -54,264 +54,296 @@ if(_vehiclesToSpawn > 0) then }; _useLaunchers = DMS_ai_use_launchers; - for "_j" from 1 to _vehiclesToSpawn do + for "_i" from 1 to _vehiclesToSpawn do { - private["_group"]; - - _locationArray = SC_occupyVehicleFixedPositions; - - // Select the spawn position - _spawnLocation = [0,0,0]; - _radius = 2000; - if(SC_occupyVehicleUseFixedPos) then + if (_vehiclesToSpawn > 0) then { - { - _vehLocation = _x getVariable "SC_vehicleSpawnLocation"; - _locationArray = _locationArray - [_vehLocation]; - }forEach SC_liveVehiclesArray; + private["_group"]; - if(count _locationArray > 0) then + _locationArray = SC_occupyVehicleFixedPositions; + + // Select the spawn position + _spawnLocation = [0,0,0]; + _radius = 2000; + if(SC_occupyVehicleUseFixedPos) then { - _randomLocation = _locationArray call BIS_fnc_selectRandom; - _spawnLocation = _randomLocation select 0; - _radius = _randomLocation select 1; - _locationArray = _locationArray - [_randomLocation]; + { + _vehLocation = _x getVariable "SC_vehicleSpawnLocation"; + _locationArray = _locationArray - [_vehLocation]; + }forEach SC_liveVehiclesArray; + + if(count _locationArray > 0) then + { + _randomLocation = _locationArray call BIS_fnc_selectRandom; + _spawnLocation = _randomLocation select 0; + _radius = _randomLocation select 1; + _locationArray = _locationArray - [_randomLocation]; + } + else + { + _spawnLocation = [ true, false ] call SC_fnc_findsafePos; + _radius = 2000; + }; } else { _spawnLocation = [ true, false ] call SC_fnc_findsafePos; _radius = 2000; }; - } - else - { - _spawnLocation = [ true, false ] call SC_fnc_findsafePos; - _radius = 2000; - }; - - diag_log format["[OCCUPATION:Vehicle] found position %1",_spawnLocation]; - _group = createGroup SC_BanditSide; - if(_side == "survivor") then - { - deleteGroup _group; - _group = createGroup SC_SurvivorSide; - }; - _group setVariable ["DMS_AllowFreezing",false]; - _group setVariable ["DMS_LockLocality",false]; - _group setVariable ["DMS_SpawnedGroup",true]; - _group setVariable ["DMS_Group_Side", _side]; - - _VehicleClass = SC_VehicleClassToUse call BIS_fnc_selectRandom; - _VehicleClassToUse = _VehicleClass select 0; - vehicleOkToSpawn = false; - - // Percentage chance to spawn a rare vehicle - _rareChance = round (random 100); - if(_rareChance >= 90) then - { - - while{!vehicleOkToSpawn} do - { - _VehicleClass = SC_VehicleClassToUseRare call BIS_fnc_selectRandom; - _VehicleClassToUse = _VehicleClass select 0; - _VehicleClassAllowedCount = _VehicleClass select 1; - _vehicleCount = 0; - { - if(_VehicleClassToUse == typeOf _x) then { _vehicleCount = _vehicleCount + 1; }; - }forEach SC_liveVehiclesArray; - if(_vehicleCount < _VehicleClassAllowedCount OR _VehicleClassAllowedCount == 0) then { vehicleOkToSpawn = true; }; - }; - } - else - { - while{!vehicleOkToSpawn} do - { - _VehicleClass = SC_VehicleClassToUse call BIS_fnc_selectRandom; - _VehicleClassToUse = _VehicleClass select 0; - _VehicleClassAllowedCount = _VehicleClass select 1; - _vehicleCount = 0; - { - if(_VehicleClassToUse == typeOf _x) then { _vehicleCount = _vehicleCount + 1; }; - }forEach SC_liveVehiclesArray; - if(_vehicleCount < _VehicleClassAllowedCount OR _VehicleClassAllowedCount == 0) then { vehicleOkToSpawn = true; }; - }; - }; - - - _vehicle = createVehicle [_VehicleClassToUse, _spawnLocation, [], 0, "NONE"]; - - if(!isNull _vehicle) then - { - _group addVehicle _vehicle; - - SC_liveVehiclesArray = SC_liveVehiclesArray + [_vehicle]; - - _vehicle setVariable ["SC_repairStatus",false,true]; - _vehicle setVariable ["vehPos",_spawnLocation,true]; - _vehicle setVariable ["vehClass",_VehicleClassToUse,true]; - _SC_vehicleSpawnLocation = [_spawnLocation,_radius,worldName]; - _vehicle setVariable ["SC_vehicleSpawnLocation", _SC_vehicleSpawnLocation,true]; - _vehicle setFuel 1; - _vehicle engineOn true; - - if(SC_occupyVehiclesLocked) then - { - _vehicle lock 2; - _vehicle setVehicleLock "LOCKED"; - _vehicle setVariable ["ExileIsLocked", 1, true]; - } - else - { - _vehicle lock 0; - _vehicle setVehicleLock "UNLOCKED"; - _vehicle setVariable ["ExileIsLocked", 0, true]; - }; + + diag_log format["[OCCUPATION:Vehicle] found position %1",_spawnLocation]; + _group = createGroup SC_BanditSide; + if(_side == "survivor") then + { + deleteGroup _group; + _group = createGroup SC_SurvivorSide; + }; + _group setVariable ["DMS_AllowFreezing",false]; + _group setVariable ["DMS_LockLocality",false]; + _group setVariable ["DMS_SpawnedGroup",true]; + _group setVariable ["DMS_Group_Side", _side]; - _vehicle setVariable ["ExileIsPersistent", false]; - _vehicle setSpeedMode "LIMITED"; - _vehicle limitSpeed 60; - _vehicle action ["LightOn", _vehicle]; - _vehicle addEventHandler ["getin", "_this call SC_fnc_getIn;"]; - _vehicle addEventHandler ["getout", "_this call SC_fnc_getOut;"]; - _vehicle addMPEventHandler ["mpkilled", "_this call SC_fnc_vehicleDestroyed;"]; - _vehicle addMPEventHandler ["mphit", "_this call SC_fnc_hitLand;"]; - + _VehicleClass = SC_VehicleClassToUse call BIS_fnc_selectRandom; + _VehicleClassToUse = _VehicleClass select 0; + vehicleOkToSpawn = false; + + // Percentage chance to spawn a rare vehicle + _rareChance = round (random 100); + if(_rareChance >= 90) then + { + + while{!vehicleOkToSpawn} do + { + if (_side == "survivor") then { + + _VehicleClass = SC_SurvivorVehicleClassToUseRare call BIS_fnc_selectRandom; + _VehicleClassToUse = _VehicleClass select 0; + _VehicleClassAllowedCount = _VehicleClass select 1; + _vehicleCount = 0; + { + if(_VehicleClassToUse == typeOf _x) then { _vehicleCount = _vehicleCount + 1; }; + }forEach SC_liveVehiclesArray; + if(_vehicleCount < _VehicleClassAllowedCount OR _VehicleClassAllowedCount == 0) then { vehicleOkToSpawn = true; }; + + } else { + + _VehicleClass = SC_VehicleClassToUseRare call BIS_fnc_selectRandom; + _VehicleClassToUse = _VehicleClass select 0; + _VehicleClassAllowedCount = _VehicleClass select 1; + _vehicleCount = 0; + { + if(_VehicleClassToUse == typeOf _x) then { _vehicleCount = _vehicleCount + 1; }; + }forEach SC_liveVehiclesArray; + if(_vehicleCount < _VehicleClassAllowedCount OR _VehicleClassAllowedCount == 0) then { vehicleOkToSpawn = true; }; + }; + }; + } + else + { + while{!vehicleOkToSpawn} do + { + if (_side == "survivor") then { + + _VehicleClass = SC_SurvivorVehicleClassToUse call BIS_fnc_selectRandom; + _VehicleClassToUse = _VehicleClass select 0; + _VehicleClassAllowedCount = _VehicleClass select 1; + _vehicleCount = 0; + { + if(_VehicleClassToUse == typeOf _x) then { _vehicleCount = _vehicleCount + 1; }; + }forEach SC_liveVehiclesArray; + if(_vehicleCount < _VehicleClassAllowedCount OR _VehicleClassAllowedCount == 0) then { vehicleOkToSpawn = true; }; + + } else { + + _VehicleClass = SC_VehicleClassToUse call BIS_fnc_selectRandom; + _VehicleClassToUse = _VehicleClass select 0; + _VehicleClassAllowedCount = _VehicleClass select 1; + _vehicleCount = 0; + { + if(_VehicleClassToUse == typeOf _x) then { _vehicleCount = _vehicleCount + 1; }; + }forEach SC_liveVehiclesArray; + if(_vehicleCount < _VehicleClassAllowedCount OR _VehicleClassAllowedCount == 0) then { vehicleOkToSpawn = true; }; + }; + }; + }; + + + _vehicle = createVehicle [_VehicleClassToUse, _spawnLocation, [], 0, "NONE"]; + + if(!isNull _vehicle) then + { + _group addVehicle _vehicle; + + SC_liveVehiclesArray = SC_liveVehiclesArray + [_vehicle]; - - - // Calculate the number of seats in the vehicle and fill the required amount - _crewRequired = SC_minimumCrewAmount; - if(SC_maximumCrewAmount > SC_minimumCrewAmount) then - { - _crewRequired = ceil(random[SC_minimumCrewAmount,SC_maximumCrewAmount-SC_minimumCrewAmount,SC_maximumCrewAmount]); - }; - _amountOfCrew = 0; - _unitPlaced = false; - _vehicleRoles = (typeOf _vehicle) call bis_fnc_vehicleRoles; - { - _unitPlaced = false; - _vehicleRole = _x select 0; - _vehicleSeat = _x select 1; - if(_vehicleRole == "Driver") then - { - _loadOut = [_side] call SC_fnc_selectGear; - _unit = [_group,_spawnLocation,"custom","random",_side,"Vehicle",_loadOut] call DMS_fnc_SpawnAISoldier; - _amountOfCrew = _amountOfCrew + 1; - _unit disableAI "FSM"; - _unit disableAI "MOVE"; - [_side,_unit] call SC_fnc_addMarker; - _unit removeAllMPEventHandlers "mphit"; - _unit removeAllMPEventHandlers "mpkilled"; - _unit disableAI "TARGET"; - _unit disableAI "AUTOTARGET"; - _unit disableAI "AUTOCOMBAT"; - _unit disableAI "COVER"; - _unit disableAI "SUPPRESSION"; - _unit assignAsDriver _vehicle; - _unit moveInDriver _vehicle; - _unit setVariable ["DMS_AssignedVeh",_vehicle]; - _unit setVariable ["SC_drivenVehicle", _vehicle,true]; - _unit addMPEventHandler ["mpkilled", "_this call SC_fnc_driverKilled;"]; - _vehicle setVariable ["SC_assignedDriver", _unit,true]; + _vehicle setVariable ["SC_repairStatus",false,true]; + _vehicle setVariable ["vehPos",_spawnLocation,true]; + _vehicle setVariable ["vehClass",_VehicleClassToUse,true]; + _SC_vehicleSpawnLocation = [_spawnLocation,_radius,worldName]; + _vehicle setVariable ["SC_vehicleSpawnLocation", _SC_vehicleSpawnLocation,true]; + _vehicle setFuel 1; + _vehicle engineOn true; + + if(SC_occupyVehiclesLocked) then + { + _vehicle lock 2; + _vehicle setVehicleLock "LOCKED"; + _vehicle setVariable ["ExileIsLocked", 1, true]; + } + else + { + _vehicle lock 0; + _vehicle setVehicleLock "UNLOCKED"; + _vehicle setVariable ["ExileIsLocked", 0, true]; + }; + + _vehicle setVariable ["ExileIsPersistent", false]; + _vehicle setSpeedMode "LIMITED"; + _vehicle limitSpeed 60; + _vehicle action ["LightOn", _vehicle]; + _vehicle addEventHandler ["getin", "_this call SC_fnc_getIn;"]; + _vehicle addEventHandler ["getout", "_this call SC_fnc_getOut;"]; + _vehicle addMPEventHandler ["mpkilled", "_this call SC_fnc_vehicleDestroyed;"]; + _vehicle addMPEventHandler ["mphit", "_this call SC_fnc_hitLand;"]; + - }; - if(_vehicleRole == "Turret" && _amountOfCrew < _crewRequired) then - { - _loadOut = [_side] call SC_fnc_selectGear; - _unit = [_group,_spawnLocation,"custom","random",_side,"Vehicle",_loadOut] call DMS_fnc_SpawnAISoldier; - _amountOfCrew = _amountOfCrew + 1; - [_side,_unit] call SC_fnc_addMarker; - _unit moveInTurret [_vehicle, _vehicleSeat]; - _unit setVariable ["DMS_AssignedVeh",_vehicle]; - _unit addMPEventHandler ["mpkilled", "_this call SC_fnc_unitMPKilled;"]; - _unitPlaced = true; - }; - if(_vehicleRole == "CARGO" && _amountOfCrew < _crewRequired) then - { - _loadOut = [_side] call SC_fnc_selectGear; - _unit = [_group,_spawnLocation,"custom","random",_side,"Vehicle",_loadOut] call DMS_fnc_SpawnAISoldier; - _amountOfCrew = _amountOfCrew + 1; - [_side,_unit] call SC_fnc_addMarker; - _unit assignAsCargo _vehicle; - _unit moveInCargo _vehicle; - _unit setVariable ["DMS_AssignedVeh",_vehicle]; - _unit addMPEventHandler ["mpkilled", "_this call SC_fnc_unitMPKilled;"]; - _unitPlaced = true; - }; - if(SC_extendedLogging && _unitPlaced) then - { - _logDetail = format['[OCCUPATION:Vehicle] %1 %2 added to vehicle %3',_side,_vehicleRole,_vehicle]; - [_logDetail] call SC_fnc_log; - }; - if(_amountOfCrew == _crewRequired) exitWith{}; - } forEach _vehicleRoles; + + + // Calculate the number of seats in the vehicle and fill the required amount + _crewRequired = SC_minimumCrewAmount; + if(SC_maximumCrewAmount > SC_minimumCrewAmount) then + { + _crewRequired = ceil(random[SC_minimumCrewAmount,SC_maximumCrewAmount-SC_minimumCrewAmount,SC_maximumCrewAmount]); + }; + _amountOfCrew = 0; + _unitPlaced = false; + _vehicleRoles = (typeOf _vehicle) call bis_fnc_vehicleRoles; + { + _unitPlaced = false; + _vehicleRole = _x select 0; + _vehicleSeat = _x select 1; + if(_vehicleRole == "Driver") then + { + _loadOut = [_side] call SC_fnc_selectGear; + _unit = [_group,_spawnLocation,"custom","random",_side,"Vehicle",_loadOut] call DMS_fnc_SpawnAISoldier; + _amountOfCrew = _amountOfCrew + 1; + _unit disableAI "FSM"; + _unit disableAI "MOVE"; + [_side,_unit] call SC_fnc_addMarker; + _unit removeAllMPEventHandlers "mphit"; + _unit removeAllMPEventHandlers "mpkilled"; + _unit disableAI "TARGET"; + _unit disableAI "AUTOTARGET"; + _unit disableAI "AUTOCOMBAT"; + _unit disableAI "COVER"; + _unit disableAI "SUPPRESSION"; + _unit assignAsDriver _vehicle; + _unit moveInDriver _vehicle; + _unit setVariable ["DMS_AssignedVeh",_vehicle]; + _unit setVariable ["SC_drivenVehicle", _vehicle,true]; + _unit addMPEventHandler ["mpkilled", "_this call SC_fnc_driverKilled;"]; + _vehicle setVariable ["SC_assignedDriver", _unit,true]; - // Get the AI to shut the fuck up :) - enableSentences false; - enableRadio false; + }; + if(_vehicleRole == "Turret" && _amountOfCrew < _crewRequired) then + { + _loadOut = [_side] call SC_fnc_selectGear; + _unit = [_group,_spawnLocation,"custom","random",_side,"Vehicle",_loadOut] call DMS_fnc_SpawnAISoldier; + _amountOfCrew = _amountOfCrew + 1; + [_side,_unit] call SC_fnc_addMarker; + _unit moveInTurret [_vehicle, _vehicleSeat]; + _unit setVariable ["DMS_AssignedVeh",_vehicle]; + _unit addMPEventHandler ["mpkilled", "_this call SC_fnc_unitMPKilled;"]; + _unitPlaced = true; + }; + if(_vehicleRole == "CARGO" && _amountOfCrew < _crewRequired) then + { + _loadOut = [_side] call SC_fnc_selectGear; + _unit = [_group,_spawnLocation,"custom","random",_side,"Vehicle",_loadOut] call DMS_fnc_SpawnAISoldier; + _amountOfCrew = _amountOfCrew + 1; + [_side,_unit] call SC_fnc_addMarker; + _unit assignAsCargo _vehicle; + _unit moveInCargo _vehicle; + _unit setVariable ["DMS_AssignedVeh",_vehicle]; + _unit addMPEventHandler ["mpkilled", "_this call SC_fnc_unitMPKilled;"]; + _unitPlaced = true; + }; + if(SC_extendedLogging && _unitPlaced) then + { + _logDetail = format['[OCCUPATION:Vehicle] %1 %2 added to vehicle %3',_side,_vehicleRole,_vehicle]; + [_logDetail] call SC_fnc_log; + }; + if(_amountOfCrew == _crewRequired) exitWith{}; + } forEach _vehicleRoles; - _logDetail = format['[OCCUPATION:Vehicle] %3 vehicle %1 spawned @ %2',_VehicleClassToUse,_spawnLocation,_side]; - [_logDetail] call SC_fnc_log; - sleep 2; - - { - _unit = _x; - _unit enableAI "FSM"; - _unit enableAI "MOVE"; - _unit enableAI "TARGET"; - _unit enableAI "AUTOTARGET"; - _unit enableAI "AUTOCOMBAT"; - _unit allowCrewInImmobile false; - reload _unit; - _unitName = [_side] call SC_fnc_selectName; - if(!isNil "_unitName") then { _unit setName _unitName; }; - }forEach units _group; - [_group,false] call DMS_fnc_FreezeToggle; - - [units _group] orderGetIn true; - sleep 10; - - [_group, _spawnLocation, 2000] call bis_fnc_taskPatrol; - _group setBehaviour "AWARE"; - _group setCombatMode "RED"; - sleep 0.2; - - clearMagazineCargoGlobal _vehicle; - clearWeaponCargoGlobal _vehicle; - clearItemCargoGlobal _vehicle; + // Get the AI to shut the fuck up :) + enableSentences false; + enableRadio false; - _vehicle addMagazineCargoGlobal ["HandGrenade", (random 2)]; - _vehicle addItemCargoGlobal ["ItemGPS", (random 1)]; - _vehicle addItemCargoGlobal ["Exile_Item_InstaDoc", (random 1)]; - _vehicle addItemCargoGlobal ["Exile_Item_PlasticBottleFreshWater", 2 + (random 2)]; - _vehicle addItemCargoGlobal ["Exile_Item_EMRE", 2 + (random 2)]; - - // Add weapons with ammo to the vehicle - _possibleWeapons = - [ - "arifle_MXM_Black_F", - "arifle_MXM_F", - "arifle_MX_SW_Black_F", - "arifle_MX_SW_F", - "LMG_Mk200_F", - "LMG_Zafir_F" - ]; - _amountOfWeapons = 1 + (random 3); - - for "_i" from 1 to _amountOfWeapons do - { - _weaponToAdd = _possibleWeapons call BIS_fnc_selectRandom; - _vehicle addWeaponCargoGlobal [_weaponToAdd,1]; - - _magazinesToAdd = getArray (configFile >> "CfgWeapons" >> _weaponToAdd >> "magazines"); - _vehicle addMagazineCargoGlobal [(_magazinesToAdd select 0),round random 3]; - }; - } - else - { - _logDetail = format['[OCCUPATION:Vehicle] vehicle %1 failed to spawn (check classname is correct)',_VehicleClassToUse]; - [_logDetail] call SC_fnc_log; - }; + _logDetail = format['[OCCUPATION:Vehicle] %3 vehicle %1 spawned @ %2',_VehicleClassToUse,_spawnLocation,_side]; + [_logDetail] call SC_fnc_log; + sleep 2; + + { + _unit = _x; + _unit enableAI "FSM"; + _unit enableAI "MOVE"; + _unit enableAI "TARGET"; + _unit enableAI "AUTOTARGET"; + _unit enableAI "AUTOCOMBAT"; + _unit allowCrewInImmobile false; + reload _unit; + _unitName = [_side] call SC_fnc_selectName; + if(!isNil "_unitName") then { _unit setName _unitName; }; + }forEach units _group; + [_group,false] call DMS_fnc_FreezeToggle; + + [units _group] orderGetIn true; + sleep 10; + + [_group, _spawnLocation, 2000] call bis_fnc_taskPatrol; + _group setBehaviour "AWARE"; + _group setCombatMode "RED"; + sleep 0.2; + + clearMagazineCargoGlobal _vehicle; + clearWeaponCargoGlobal _vehicle; + clearItemCargoGlobal _vehicle; + + _vehicle addMagazineCargoGlobal ["HandGrenade", (random 2)]; + _vehicle addItemCargoGlobal ["ItemGPS", (random 1)]; + _vehicle addItemCargoGlobal ["Exile_Item_InstaDoc", (random 1)]; + _vehicle addItemCargoGlobal ["Exile_Item_PlasticBottleFreshWater", 2 + (random 2)]; + _vehicle addItemCargoGlobal ["Exile_Item_EMRE", 2 + (random 2)]; + + // Add weapons with ammo to the vehicle + _possibleWeapons = + [ + "arifle_MXM_Black_F", + "arifle_MXM_F", + "arifle_MX_SW_Black_F", + "arifle_MX_SW_F", + "LMG_Mk200_F", + "LMG_Zafir_F" + ]; + _amountOfWeapons = 1 + (random 3); + + for "_i" from 1 to _amountOfWeapons do + { + _weaponToAdd = _possibleWeapons call BIS_fnc_selectRandom; + _vehicle addWeaponCargoGlobal [_weaponToAdd,1]; + + _magazinesToAdd = getArray (configFile >> "CfgWeapons" >> _weaponToAdd >> "magazines"); + _vehicle addMagazineCargoGlobal [(_magazinesToAdd select 0),round random 3]; + }; + } + else + { + _logDetail = format['[OCCUPATION:Vehicle] vehicle %1 failed to spawn (check classname is correct)',_VehicleClassToUse]; + [_logDetail] call SC_fnc_log; + }; + + }; }; }; SC_liveVehicles = count(SC_liveVehiclesArray);