From 41603f5c74bee2c496634c863b7d950afb6c2403 Mon Sep 17 00:00:00 2001 From: second_coming Date: Tue, 26 Apr 2016 10:29:50 +0100 Subject: [PATCH] v27 updates and fixes --- config.sqf | 94 +++++++--- initServer.sqf | 7 +- scripts/functions/fnc_addMarker.sqf | 27 +++ scripts/functions/fnc_changeGear.sqf | 41 ----- scripts/functions/fnc_selectGear.sqf | 114 +++++++++++++ scripts/functions/fnc_spawnStatics.sqf | 17 +- scripts/occupationLootCrates.sqf | 13 +- scripts/occupationMonitor.sqf | 4 +- scripts/occupationPlaces.sqf | 34 ++-- scripts/occupationPublicBus.sqf | 129 -------------- scripts/occupationSea.sqf | 10 +- scripts/occupationSky.sqf | 24 ++- scripts/occupationTransport.sqf | 227 +++++++++++++++++++++++++ scripts/occupationVehicle.sqf | 53 ++++-- scripts/reactions/airHit.sqf | 6 +- scripts/reactions/comeUnstuck.sqf | 14 ++ scripts/reactions/driverKilled.sqf | 5 - scripts/reactions/getIn.sqf | 7 + scripts/reactions/unitMPKilled.sqf | 1 + scripts/startOccupation.sqf | 4 +- 20 files changed, 575 insertions(+), 256 deletions(-) create mode 100644 scripts/functions/fnc_addMarker.sqf delete mode 100644 scripts/functions/fnc_changeGear.sqf create mode 100644 scripts/functions/fnc_selectGear.sqf delete mode 100644 scripts/occupationPublicBus.sqf create mode 100644 scripts/occupationTransport.sqf diff --git a/config.sqf b/config.sqf index 8df4279..77bfddf 100644 --- a/config.sqf +++ b/config.sqf @@ -48,17 +48,35 @@ SC_occupyVehicleSurvivors = false; // true if you want a chance t SC_SurvivorsFriendly = true; // true if you want survivors to be friendly to players (until they are attacked by players) // false if you want survivors to be aggressive to players -// Array of uniforms for survivor AI to use +// Possible equipment for survivor AI to spawn with +// spawning survivors without vests or backpacks will result in them having no ammunition SC_SurvivorUniforms = ["Exile_Uniform_BambiOverall"]; -SC_SurvivorVests = []; +SC_SurvivorVests = ["V_BandollierB_blk","V_BandollierB_cbr","V_BandollierB_khk","V_BandollierB_oli"]; SC_SurvivorHeadgear = []; +SC_SurvivorWeapon = ["arifle_MXC_F","arifle_TRG20_F"]; +SC_SurvivorWeaponAttachments= []; +SC_SurvivorMagazines = ["Exile_Item_Vishpirin","Exile_Item_Bandage"]; +SC_SurvivorPistol = ["hgun_Rook40_F"]; +SC_SurvivorPistolAttachments= []; +SC_SurvivorAssignedItems = ["ItemMap","ItemCompass","ItemRadio","ItemWatch","Exile_Item_XM8"]; // all these items will be added +SC_SurvivorLauncher = []; +SC_SurvivorBackpack = []; + +// Possible equipment for bandit AI to spawn with +// spawning bandits without vests or backpacks will result in them having no ammunition +SC_BanditUniforms = ["U_IG_Guerilla1_1","U_IG_Guerilla2_1","U_IG_Guerilla2_2","U_IG_Guerilla2_3","U_IG_Guerilla3_1","U_BG_Guerilla2_1","U_IG_Guerilla3_2","U_BG_Guerrilla_6_1","U_BG_Guerilla1_1","U_BG_Guerilla2_2","U_BG_Guerilla2_3","U_BG_Guerilla3_1"]; +SC_BanditVests = ["V_BandollierB_blk","V_BandollierB_cbr","V_BandollierB_khk","V_BandollierB_oli"]; +SC_BanditHeadgear = ["H_Shemag_khk","H_Shemag_olive","H_Shemag_olive_hs","H_Shemag_tan","H_ShemagOpen_khk","H_ShemagOpen_tan"]; +SC_BanditWeapon = ["LMG_Zafir_F","arifle_Katiba_C_F","arifle_Katiba_F","arifle_Katiba_GL_F","arifle_MXC_Black_F","arifle_MXC_F","arifle_TRG20_F","arifle_TRG21_F","arifle_TRG21_GL_F"]; +SC_BanditWeaponAttachments = ["optic_MRCO","optic_ACO_grn"]; +SC_BanditMagazines = ["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_BanditPistol = ["hgun_ACPC2_F","hgun_P07_F","hgun_Pistol_heavy_01_F","hgun_Pistol_heavy_02_F","hgun_Rook40_F"]; +SC_BanditPistolAttachments = ["optic_MRD","muzzle_snds_acp"]; +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"]; + -// Array of uniforms for bandit AI to use -SC_BanditUniforms = [ "U_IG_Guerilla1_1","U_IG_Guerilla2_1","U_IG_Guerilla2_2","U_IG_Guerilla2_3","U_IG_Guerilla3_1", - "U_BG_Guerilla2_1","U_IG_Guerilla3_2","U_BG_Guerrilla_6_1","U_BG_Guerilla1_1","U_BG_Guerilla2_2", - "U_BG_Guerilla2_3","U_BG_Guerilla3_1"]; -SC_BanditVests = [ "V_BandollierB_blk","V_BandollierB_cbr","V_BandollierB_khk","V_BandollierB_oli"]; -SC_BanditHeadgear = [ "H_Shemag_khk","H_Shemag_olive","H_Shemag_olive_hs","H_Shemag_tan","H_ShemagOpen_khk","H_ShemagOpen_tan"]; SC_occupyMilitary = false; // true if you want military buildings patrolled @@ -101,9 +119,10 @@ SC_staticSurvivors = [ [[23286,18524,0],6,400,true] ]; //[[pos],ai 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_occupyPublicBus = true; // true if you want a roaming bus service -SC_occupyPublicBusClass = "Exile_Car_Ikarus_Party"; // class name for the vehicle to use as the public bus -SC_occupyPublicBusStartPos = []; // if empty defaults to map centre +SC_occupyTransport = true; // true if you want pubic transport (travels between traders) +SC_occupyTransportClass = "Exile_Chopper_Mohawk_FIA"; +SC_occupyTransportStartPos = []; // if empty defaults to map centre + SC_occupyLootCrates = true; // true if you want to have random loot crates with guards SC_numberofLootCrates = 6; // if SC_occupyLootCrates = true spawn this many loot crates (overrided below for Namalsk) @@ -142,7 +161,7 @@ SC_numberofHeliCrashes = 5; // if SC_occupyHeliCrashes = // 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) // to add a fixed amount make the second number 0 -SC_HeliCrashItems = [ +SC_HeliCrashItems = [ ["HandGrenade",0,2], ["APERSBoundingMine_Range_Mag",0,2], ["B_Parachute",1,1], @@ -151,32 +170,56 @@ SC_HeliCrashItems = [ ["Exile_Item_InstaDoc",0,1], ["Exile_Item_PlasticBottleFreshWater",2,2], ["Exile_Item_EMRE",2,2] - ]; + ]; // Array of possible weapons to place in the crate -SC_HeliCrashWeapons = ["srifle_DMR_02_camo_F","srifle_DMR_03_woodland_F","srifle_DMR_04_F","srifle_DMR_05_hex_F"]; +SC_HeliCrashWeapons = [ + "srifle_DMR_02_camo_F", + "srifle_DMR_03_woodland_F", + "srifle_DMR_04_F", + "srifle_DMR_05_hex_F" + ]; + SC_HeliCrashWeaponsAmount = [1,3]; // [fixed amount to add, random amount to add] SC_HeliCrashMagazinesAmount = [2,2]; // [fixed amount to add, random amount to add] -SC_maximumCrewAmount = 2; // Maximum amount of AI allowed in a vehicle - // (essential crew like drivers and gunners will always spawn regardless of this setting) +SC_minimumCrewAmount = 2; // Maximum amount of AI allowed in a vehicle (applies to ground, air and sea vehicles) +SC_maximumCrewAmount = 4; // Maximum amount of AI allowed in a vehicle (applies to ground, air and sea vehicles) + // (essential crew like drivers and gunners will always spawn regardless of these settings) // Settings for roaming ground vehicle AI SC_maxNumberofVehicles = 4; // Array of ground vehicles which can be used by AI patrols -SC_VehicleClassToUse = [ "Exile_Car_LandRover_Green","Exile_Bike_QuadBike_Black","Exile_Car_UAZ_Open_Green"]; +SC_VehicleClassToUse = [ + "Exile_Car_LandRover_Green", + "Exile_Bike_QuadBike_Black", + "Exile_Car_UAZ_Open_Green" + ]; +SC_VehicleClassToUseRare = [ + "Exile_Car_Hunter", + "Exile_Car_HEMMT", + "Exile_Car_Zamak", + "Exile_Car_Offroad_Armed_Guerilla12", + "Exile_Car_Offroad_Armed_Guerilla03", + "Exile_Car_Tempest" + ]; // Settings for roaming airborne AI (non armed helis will just fly around) SC_maxNumberofHelis = 1; // Array of aircraft which can be used by AI patrols -SC_HeliClassToUse = [ "Exile_Chopper_Huey_Armed_Green"]; +SC_HeliClassToUse = [ "Exile_Chopper_Huey_Armed_Green" ]; // Settings for roaming seaborne AI (non armed boats will just sail around) SC_maxNumberofBoats = 1; // Array of boats which can be used by AI patrols -SC_BoatClassToUse = [ "B_Boat_Armed_01_minigun_F","I_Boat_Armed_01_minigun_F","O_Boat_Transport_01_F","Exile_Boat_MotorBoat_Police" ]; +SC_BoatClassToUse = [ + "B_Boat_Armed_01_minigun_F", + "I_Boat_Armed_01_minigun_F", + "O_Boat_Transport_01_F", + "Exile_Boat_MotorBoat_Police" + ]; @@ -189,7 +232,7 @@ if (worldName == 'Namalsk') then SC_numberofLootCrates = 3; SC_numberofHeliCrashes = 2; SC_maxNumberofBoats = 1; - SC_occupyPublicBusClass = "Exile_Car_LandRover_Urban"; // the ikarus bus gets stuck on Namalsk + SC_occupyTransportClass = "Exile_Car_LandRover_Urban"; // the ikarus bus gets stuck on Namalsk }; if (SC_debug) then @@ -199,10 +242,10 @@ if (SC_debug) then SC_occupyPlaces = true; SC_occupyVehicle = true; SC_occupyMilitary = true; - SC_occupyStatic = true; + SC_occupyStatic = false; SC_occupySky = true; SC_occupySea = true; - SC_occupyPublicBus = true; + SC_occupyTransport = true; SC_occupyLootCrates = true; SC_occupyHeliCrashes = true; }; @@ -226,7 +269,7 @@ SC_liveHelisArray = []; SC_liveBoats = 0; SC_liveBoatsArray = []; SC_liveStaticGroups = []; -SC_publicBusArray = []; +SC_transportArray = []; publicVariable "SC_liveVehicles"; publicVariable "SC_liveVehiclesArray"; @@ -236,9 +279,8 @@ publicVariable "SC_liveBoats"; publicVariable "SC_liveBoatsArray"; publicVariable "SC_liveStaticGroups"; publicVariable "SC_numberofLootCrates"; -publicVariable "SC_publicBusArray"; +publicVariable "SC_transportArray"; publicVariable "SC_SurvivorSide"; publicVariable "SC_BanditSide"; -SC_CompiledOkay = true; - +SC_CompiledOkay = true; \ No newline at end of file diff --git a/initServer.sqf b/initServer.sqf index 2a114a4..935ae01 100644 --- a/initServer.sqf +++ b/initServer.sqf @@ -2,7 +2,7 @@ // // Server Occupation script by second_coming // -SC_occupationVersion = "v26 (22-04-2016)"; +SC_occupationVersion = "v27 (26-04-2016)"; // // http://www.exilemod.com/profile/60-second_coming/ // @@ -31,7 +31,7 @@ SC_occupationVersion = "v26 (22-04-2016)"; // Get the config for Occupation call compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\config.sqf"; - if(!SC_CompiledOkay) exitWith { diag_log format ["[OCCUPATION]:: Occupation failed to read config.sqf, check for typos (time: %1)",time]; }; + if(isNil "SC_CompiledOkay") exitWith { diag_log format ["[OCCUPATION]:: Occupation failed to read config.sqf, check for typos (time: %1)",time]; }; // Select the log style depending on config settings SC_fnc_log = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\occupationLog.sqf"; @@ -52,8 +52,9 @@ SC_occupationVersion = "v26 (22-04-2016)"; SC_fnc_getOnBus = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\getOnBus.sqf"; SC_fnc_getOffBus = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\reactions\getOffBus.sqf"; - SC_fnc_changeGear = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\functions\fnc_changeGear.sqf"; + SC_fnc_addMarker = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\functions\fnc_addMarker.sqf"; SC_fnc_spawnstatics = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\functions\fnc_spawnStatics.sqf"; + SC_fnc_selectGear = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\functions\fnc_selectGear.sqf"; _logDetail = "============================================================================================================="; [_logDetail] call SC_fnc_log; diff --git a/scripts/functions/fnc_addMarker.sqf b/scripts/functions/fnc_addMarker.sqf new file mode 100644 index 0000000..3ff5e59 --- /dev/null +++ b/scripts/functions/fnc_addMarker.sqf @@ -0,0 +1,27 @@ +private["_newUniform","_newVest","_newHeadgear","_arrowClass"]; + +_side = _this select 0; +_unit = _this select 1; + +_unit removeAllMPEventHandlers "mphit"; +_unit removeAllMPEventHandlers "mpkilled"; + +switch (_side) do +{ + case "survivor": + { + _arrowClass = "Sign_Arrow_Green_F"; + _unit addMPEventHandler ["mphit", "_this call SC_fnc_unitMPHit;"]; + }; + case "bandit": + { + _arrowClass = "Sign_Arrow_F"; + }; +}; + +if(SC_debug) then +{ + _tag = createVehicle [_arrowClass, position _unit, [], 0, "CAN_COLLIDE"]; + _tag attachTo [_unit,[0,0,0.6],"Head"]; +}; +_unit addMPEventHandler ["mpkilled", "_this call SC_fnc_unitMPKilled;"]; \ No newline at end of file diff --git a/scripts/functions/fnc_changeGear.sqf b/scripts/functions/fnc_changeGear.sqf deleted file mode 100644 index 6d63953..0000000 --- a/scripts/functions/fnc_changeGear.sqf +++ /dev/null @@ -1,41 +0,0 @@ -private["_newUniform","_newVest","_newHeadgear","_arrowClass"]; - -_side = _this select 0; -_unit = _this select 1; - -removeUniform _unit; -removeVest _unit; -removeHeadgear _unit; - -switch (_side) do -{ - case "survivor": - { - _newUniform = SC_SurvivorUniforms call BIS_fnc_selectRandom; - _newVest = SC_SurvivorVests call BIS_fnc_selectRandom; - _newHeadgear = SC_SurvivorHeadgear call BIS_fnc_selectRandom; - _arrowClass = "Sign_Arrow_Green_F"; - _unit addMPEventHandler ["mphit", "_this call SC_fnc_unitMPHit;"]; - }; - case "bandit": - { - _newUniform = SC_BanditUniforms call BIS_fnc_selectRandom; - _newVest = SC_BanditVests call BIS_fnc_selectRandom; - _newHeadgear = SC_BanditHeadgear call BIS_fnc_selectRandom; - _arrowClass = "Sign_Arrow_F"; - }; -}; -sleep 0.1; -_unit forceAddUniform _newUniform; -if(!isNil "_newVest") then { _unit addVest _newVest; }; -if(!isNil "_newHeadgear") then { _unit addHeadgear _newHeadgear; }; -_backpackChance = round (random 100); - -if(_backpackChance < 40) then { removeBackpackGlobal _unit; }; - -if(SC_debug) then -{ - _tag = createVehicle [_arrowClass, position _unit, [], 0, "CAN_COLLIDE"]; - _tag attachTo [_unit,[0,0,0.6],"Head"]; -}; -_unit addMPEventHandler ["mpkilled", "_this call SC_fnc_unitMPKilled;"]; \ No newline at end of file diff --git a/scripts/functions/fnc_selectGear.sqf b/scripts/functions/fnc_selectGear.sqf new file mode 100644 index 0000000..68061e2 --- /dev/null +++ b/scripts/functions/fnc_selectGear.sqf @@ -0,0 +1,114 @@ +private["_uniform","_vest","_headgear","_weapon","_weaponAttachments","_magazines","_pistol","_pistolAttachments","_assignedItems","_launcher","_backpack"]; + +_side = _this select 0; + +switch (_side) do +{ + case "survivor": + { + if(count SC_SurvivorUniforms == 0) then { _uniform = ""; } else { _uniform = SC_SurvivorUniforms call BIS_fnc_selectRandom; }; + if(count SC_SurvivorVests == 0) then { _vest = ""; } else { _vest = SC_SurvivorVests call BIS_fnc_selectRandom; }; + if(count SC_SurvivorHeadgear == 0) then { _headgear = ""; } else { _headgear = SC_SurvivorHeadgear call BIS_fnc_selectRandom; }; + if(count SC_SurvivorWeapon == 0) then { _weapon = ""; } else { _weapon = SC_SurvivorWeapon call BIS_fnc_selectRandom; }; + if(count SC_SurvivorWeaponAttachments == 0) then { _weaponAttachments = []; } else { _weaponAttachments = [SC_SurvivorWeaponAttachments call BIS_fnc_selectRandom]; }; + if(count SC_SurvivorPistol == 0) then { _pistol = ""; } else { _pistol = SC_SurvivorPistol call BIS_fnc_selectRandom; }; + if(count SC_SurvivorPistolAttachments == 0) then { _pistolAttachments = []; } else { _pistolAttachments = [SC_SurvivorPistolAttachments call BIS_fnc_selectRandom]; }; + if(count SC_SurvivorLauncher == 0) then { _launcher = ""; } else { _launcher = SC_SurvivorLauncher call BIS_fnc_selectRandom; }; + if(count SC_SurvivorBackpack == 0) then { _backpack = ""; } else { _backpack = SC_SurvivorBackpack call BIS_fnc_selectRandom; }; + _assignedItems = SC_SurvivorAssignedItems; + + _magazines = []; + if(count SC_SurvivorMagazines > 0) then + { + _amountOfMagazines = 1 + round random (2); + for "_i" from 1 to _amountOfMagazines do + { + _newMagazine = SC_SurvivorMagazines call BIS_fnc_selectRandom; + _quantity = 1 + round random (2); + _magazines pushBack [_newMagazine,_quantity]; + }; + }; + }; + case "bandit": + { + if(count SC_BanditUniforms == 0) then { _uniform = ""; } else { _uniform = SC_BanditUniforms call BIS_fnc_selectRandom; }; + if(count SC_BanditVests == 0) then { _vest = ""; } else { _vest = SC_BanditVests call BIS_fnc_selectRandom; }; + if(count SC_BanditHeadgear == 0) then { _headgear = ""; } else { _headgear = SC_BanditHeadgear call BIS_fnc_selectRandom; }; + if(count SC_BanditWeapon == 0) then { _weapon = ""; } else { _weapon = SC_BanditWeapon call BIS_fnc_selectRandom; }; + if(count SC_BanditWeaponAttachments == 0) then { _weaponAttachments = [""]; } else { _weaponAttachments = [SC_BanditWeaponAttachments call BIS_fnc_selectRandom]; }; + if(count SC_BanditPistol == 0) then { _pistol = ""; } else { _pistol = SC_BanditPistol call BIS_fnc_selectRandom; }; + if(count SC_BanditPistolAttachments == 0) then { _pistolAttachments = [""]; } else { _pistolAttachments = [SC_BanditPistolAttachments call BIS_fnc_selectRandom]; }; + if(count SC_BanditLauncher == 0) then { _launcher = ""; } else { _launcher = SC_BanditLauncher call BIS_fnc_selectRandom; }; + if(count SC_BanditBackpack == 0) then { _backpack = ""; } else { _backpack = SC_BanditBackpack call BIS_fnc_selectRandom; }; + _assignedItems = SC_BanditAssignedItems; + + _magazines = []; + if(count SC_BanditMagazines > 0) then + { + _amountOfMagazines = 1 + round random (2); + for "_i" from 1 to _amountOfMagazines do + { + _newMagazine = SC_BanditMagazines call BIS_fnc_selectRandom; + _quantity = 1 + round random (2); + _magazines pushBack [_newMagazine,_quantity]; + }; + }; + }; +}; + +_weaponAttachmentsChance = round (random 100); +if(_weaponAttachmentsChance < 50) then { _weaponAttachments = [""]; }; + +_pistolAttachmentsChance = round (random 100); +if(_pistolAttachmentsChance < 50) then { _pistolAttachments = [""]; }; + +_backpackChance = round (random 100); +if(_backpackChance < 40) then { _backpack = ""; }; + +_launcherChance = round (random 100); +if(_launcherChance < 40 OR isNil "_launcher") then { _launcher = ""; }; + +// add ammo for selected main weapon +if(_weapon != "") then +{ + _weaponMagazinesToAdd = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines"); + _weaponMagazineAmount = 1 + round random (1); + _magazines pushBack [_weaponMagazinesToAdd select 0,_weaponMagazineAmount]; +}; + +// add ammo for selected pistol +if(_pistol != "") then +{ + _pistolMagazinesToAdd = getArray (configFile >> "CfgWeapons" >> _pistol >> "magazines"); + _pistolMagazineAmount = 1 + round random (1); + _magazines pushBack [_pistolMagazinesToAdd select 0,_pistolMagazineAmount]; +}; + +// add ammo for selected launcher +if(_launcher != "") then +{ + _launcherMagazinesToAdd = getArray (configFile >> "CfgWeapons" >> _launcher >> "magazines"); + _launcherMagazineAmount = 1; + _magazines pushBack [_launcherMagazinesToAdd select 0,_launcherMagazineAmount]; +}; + +_loadout = [ + _weapon, // String | EG: "LMG_Zafir_F" + _weaponAttachments, // Array of strings | EG: ["optic_dms","bipod_03_F_blk"] + _magazines, // Array of arrays | EG: [["150Rnd_762x54_Box",2],["16Rnd_9x21_Mag",3],["Exile_Item_InstaDoc",3]] + _pistol, // String | EG: "hgun_Pistol_heavy_01_snds_F" + _pistolAttachments, // Array of strings | EG: ["optic_MRD","muzzle_snds_acp"] + _assignedItems, // Array of strings | EG: ["Rangefinder","ItemGPS","NVGoggles"] + _launcher, // String | EG: "launch_RPG32_F" + _headgear, // String | EG: "H_HelmetLeaderO_ocamo" + _uniform, // String | EG: "U_O_GhillieSuit" + _vest, // String | EG: "V_PlateCarrierGL_blk" + _backpack // String | EG: "B_Carryall_oli" + ]; + +if(SC_extendedLogging) then +{ + _logDetail = format["[OCCUPATION]:: %2 loadout created: %1",_loadout,_side]; + [_logDetail] call SC_fnc_log; +}; +_loadout \ No newline at end of file diff --git a/scripts/functions/fnc_spawnStatics.sqf b/scripts/functions/fnc_spawnStatics.sqf index 1a3db07..3ff3668 100644 --- a/scripts/functions/fnc_spawnStatics.sqf +++ b/scripts/functions/fnc_spawnStatics.sqf @@ -15,7 +15,7 @@ if(_side == "survivor") then { _currentSide = SC_SurvivorSide }; _radius = _currentStatic select 2; _staticSearch = _currentStatic select 3; - _logDetail = format ["[OCCUPATION Static]:: Checking static spawn @ %1 for existing %2 AI",_spawnPosition,_side]; + _logDetail = format ["[OCCUPATION Static]:: Checking static spawn @ %1 for existing %2 AI",_spawnPosition,_currentSide]; [_logDetail] call SC_fnc_log; _okToSpawn = true; @@ -55,9 +55,16 @@ if(_side == "survivor") then { _currentSide = SC_SurvivorSide }; _groupRadius = _radius; _difficulty = "random"; - DMS_ai_use_launchers = false; - _initialGroup = [_spawnPosition, _aiCount, _difficulty, "assault", _side] call DMS_fnc_SpawnAIGroup; - DMS_ai_use_launchers = _useLaunchers; + _initialGroup = createGroup _currentSide; + + DMS_ai_use_launchers = false; + for "_i" from 1 to _aiCount do + { + _loadOut = [_side] call SC_fnc_selectGear; + _unit = [_initialGroup,_spawnPosition,"custom","random",_side,"soldier",_loadOut] call DMS_fnc_SpawnAISoldier; + }; + DMS_ai_use_launchers = _useLaunchers; + _initialGroup setCombatMode "BLUE"; _initialGroup setBehaviour "SAFE"; @@ -72,7 +79,7 @@ if(_side == "survivor") then { _currentSide = SC_SurvivorSide }; _unit = _x; [_unit] joinSilent grpNull; [_unit] joinSilent _group; - [_side,_unit] call SC_fnc_changeGear; + [_side,_unit] call SC_fnc_addMarker; }foreach units _initialGroup; diff --git a/scripts/occupationLootCrates.sqf b/scripts/occupationLootCrates.sqf index 7c185bd..62983c7 100644 --- a/scripts/occupationLootCrates.sqf +++ b/scripts/occupationLootCrates.sqf @@ -44,13 +44,18 @@ for "_i" from 1 to SC_numberofLootCrates do { _AICount = 1 + (round (random (SC_LootCrateGuards-1))); }; - - - + if(_AICount > 0) then { _spawnPosition = [_position select 0, _position select 1, 0]; - _group = [_spawnPosition, _AICount, "random", "random", "bandit"] call DMS_fnc_SpawnAIGroup; + + _group = createGroup SC_BanditSide; + + for "_i" from 1 to _AICount do + { + _loadOut = ["bandit"] call SC_fnc_selectGear; + _unit = [_group,_spawnPosition,"custom","random","bandit","soldier",_loadOut] call DMS_fnc_SpawnAISoldier; + }; // Get the AI to shut the fuck up :) enableSentences false; diff --git a/scripts/occupationMonitor.sqf b/scripts/occupationMonitor.sqf index 6032662..ee93501 100644 --- a/scripts/occupationMonitor.sqf +++ b/scripts/occupationMonitor.sqf @@ -34,12 +34,12 @@ _logDetail = format ["[OCCUPATION:Unstick]:: Initialised at %1",time]; }forEach SC_liveBoatsArray; { - _logDetail = format ["[OCCUPATION:Unstick]:: publicBus: %1 is active",_x]; + _logDetail = format ["[OCCUPATION:Unstick]:: Transport: %1 is active",_x]; [_logDetail] call SC_fnc_log; _x setFuel 1; [_x] call SC_fnc_comeUnstuck; sleep 5; -}forEach SC_publicBusArray; +}forEach SC_transportArray; _logDetail = format ["[OCCUPATION:Unstick]:: Finished at %1",time]; [_logDetail] call SC_fnc_log; \ No newline at end of file diff --git a/scripts/occupationPlaces.sqf b/scripts/occupationPlaces.sqf index d09bdd1..e25b65e 100644 --- a/scripts/occupationPlaces.sqf +++ b/scripts/occupationPlaces.sqf @@ -182,9 +182,7 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi _spawnPos = [_pos,10,100,5,0,20,0] call BIS_fnc_findSafePos; _spawnPosition = [_spawnPos select 0, _spawnPos select 1,0]; - DMS_ai_use_launchers = false; - _initialGroup = [_spawnPosition, _aiCount, "randomEasy", "assault", _side] call DMS_fnc_SpawnAIGroup; - DMS_ai_use_launchers = _useLaunchers; + _group = createGroup SC_BanditSide; if(_side == "survivor") then @@ -193,6 +191,15 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi _group = createGroup SC_SurvivorSide; }; + DMS_ai_use_launchers = false; + for "_i" from 1 to _aiCount do + { + _loadOut = [_side] call SC_fnc_selectGear; + _unit = [_group,_spawnPosition,"custom","random",_side,"soldier",_loadOut] call DMS_fnc_SpawnAISoldier; + }; + DMS_ai_use_launchers = _useLaunchers; + + _group setVariable ["DMS_LockLocality",nil]; _group setVariable ["DMS_SpawnedGroup",true]; _group setVariable ["DMS_Group_Side", _side]; @@ -201,8 +208,8 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi _unit = _x; [_unit] joinSilent grpNull; [_unit] joinSilent _group; - [_side,_unit] call SC_fnc_changeGear; - }foreach units _initialGroup; + [_side,_unit] call SC_fnc_addMarker; + }foreach units _group; // Get the AI to shut the fuck up :) enableSentences false; @@ -257,16 +264,21 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi if(_locationType isEqualTo "NameCityCapital") then { - DMS_ai_use_launchers = false; - _initialGroup2 = [_spawnPosition, 5, _difficulty, "random", _side] call DMS_fnc_SpawnAIGroup; - DMS_ai_use_launchers = _useLaunchers; - _group2 = createGroup SC_BanditSide; if(_side == "survivor") then { deleteGroup _group2; _group2 = createGroup SC_SurvivorSide; }; + + + DMS_ai_use_launchers = false; + for "_i" from 1 to 5 do + { + _loadOut = ["bandit"] call SC_fnc_selectGear; + _unit = [_group2,_spawnPosition,"custom","random",_side,"soldier",_loadOut] call DMS_fnc_SpawnAISoldier; + }; + DMS_ai_use_launchers = _useLaunchers; _group2 setVariable ["DMS_LockLocality",nil]; _group2 setVariable ["DMS_SpawnedGroup",true]; @@ -280,8 +292,8 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi _unit = _x; [_unit] joinSilent grpNull; [_unit] joinSilent _group2; - [_side,_unit] call SC_fnc_changeGear; - }foreach units _initialGroup2; + [_side,_unit] call SC_fnc_addMarker; + }foreach units _group2; [_group2, _pos, _groupRadius] call bis_fnc_taskPatrol; _group2 setBehaviour "AWARE"; diff --git a/scripts/occupationPublicBus.sqf b/scripts/occupationPublicBus.sqf deleted file mode 100644 index 5791364..0000000 --- a/scripts/occupationPublicBus.sqf +++ /dev/null @@ -1,129 +0,0 @@ -if (!isServer) exitWith {}; - -_logDetail = format ["[OCCUPATION:publicBus]:: Starting @ %1",time]; -[_logDetail] call SC_fnc_log; - -if( count SC_occupyPublicBusStartPos == 0) then -{ - //if(worldName == 'Namalsk') then { _spawnCenter = [6400,6400,0]; } else - //{ - _middle = worldSize/2; - _spawnCenter = [_middle,_middle,0]; - //}; - SC_occupyPublicBusStartPos = _spawnCenter; -}; - -_logDetail = format ["[OCCUPATION:publicBus]:: Spawning near map centre %1 @ %2",SC_occupyPublicBusStartPos,time]; -[_logDetail] call SC_fnc_log; - -_positionOfBus = [SC_occupyPublicBusStartPos,0,500,25,0,10,0] call BIS_fnc_findSafePos; - -// Get position of nearest roads -_nearRoads = _positionOfBus nearRoads 2000; -_nearestRoad = _nearRoads select 0; -_nearestRoadPos = position (_nearRoads select 0); -_spawnLocation = [_nearestRoadPos select 0, _nearestRoadPos select 1, 0]; - -// Create the busDriver and ensure he doest react to gunfire or being shot at. -_group = createGroup resistance; -_group setCombatMode "BLUE"; - -"Exile_Trader_CommunityCustoms" createUnit [_spawnLocation, _group, "busDriver = this; this disableAI 'AUTOTARGET'; this disableAI 'TARGET'; this disableAI 'SUPPRESSION'; "]; - -busDriver allowDamage false; -removeGoggles busDriver; -busDriver forceAddUniform "U_IG_Guerilla3_1"; -busDriver addVest "V_TacVest_blk_POLICE"; -busDriver addBackpack "B_FieldPack_oli"; -busDriver addHeadgear "H_Cap_blk"; -busDriver setCaptive true; - -// Spawn busDrivers Vehicle -_publicBus = createVehicle [SC_occupyPublicBusClass, _spawnLocation, [], 0, "CAN_COLLIDE"]; -SC_publicBusArray = SC_publicBusArray + [_publicBus]; -_publicBus setVariable ["SC_assignedDriver", busDriver,true]; -_publicBus setVariable ["SC_publicBus", true,true]; -_publicBus setVariable ["SC_vehicleSpawnLocation", _spawnLocation,true]; -_publicBus addEventHandler ["getin", "_this call SC_fnc_getOnBus;"]; -_publicBus addEventHandler ["getout", "_this call SC_fnc_getOffBus;"]; - - -_group addVehicle _publicBus; -clearBackpackCargoGlobal _publicBus; -clearItemCargoGlobal _publicBus; -clearMagazineCargoGlobal _publicBus; -clearWeaponCargoGlobal _publicBus; -_publicBus setVariable ["ExileIsPersistent", false]; -_publicBus setVariable["vehPos",_spawnLocation,true]; -_publicBus setFuel 1; - -_logDetail = format['[OCCUPATION:publicBus] Vehicle spawned @ %1',_spawnLocation]; -[_logDetail] call SC_fnc_log; - -_publicBus addEventHandler ["HandleDamage", { _amountOfDamage = 0; _amountOfDamage }]; - -busDriver assignasdriver _publicBus; -busDriver moveInDriver _publicBus; -[busDriver] orderGetin true; -_publicBus lockDriver true; - -{ - _markerName = _x; - _markerPos = getMarkerPos _markerName; - if (markerType _markerName == "ExileTraderZone" OR markerType _markerName == "o_unknown") then - { - _wp = _group addWaypoint [_markerPos, 100]; - _wp setWaypointType "MOVE"; - _wp setWaypointBehaviour "CARELESS"; - _wp setWaypointspeed "LIMITED"; - }; - -} forEach allMapMarkers; - -// Add a final CYCLE -_wp = _group addWaypoint [_spawnLocation, 100]; -_wp setWaypointType "CYCLE"; -_wp setWaypointBehaviour "CARELESS"; -_wp setWaypointspeed "LIMITED"; - - -_busPos = position _publicBus; -_mk = createMarker ["busLocation",_busPos]; -"busLocation" setMarkerType "mil_warning"; -"busLocation" setMarkerText "Public Bus"; - -diag_log format['[OCCUPATION:publicBus] Running']; -busDriver = _publicBus getVariable "SC_assignedDriver"; - -// Make busDriver stop when players near him. -while {true} do -{ - - _pos = position _publicBus; - _mk setMarkerPos _pos; - _nearPlayers = (count (_pos nearEntities [['Exile_Unit_Player'],25])); - - if (_nearPlayers >= 1) then - { - uiSleep 0.5; - _publicBus setFuel 0; - busDriver disableAI "MOVE"; - _publicBus animateDoor ["Doors_1", 1]; - _publicBus animateDoor ["Doors_2", 1]; - _publicBus animateDoor ["Doors_3", 1]; - uiSleep 3; - } - else - { - _publicBus setFuel 1; - _publicBus animateDoor ["Doors_1", 0]; - _publicBus animateDoor ["Doors_2", 0]; - _publicBus animateDoor ["Doors_3", 0]; - uiSleep 3; - busDriver enableAI "MOVE"; - if(!Alive busDriver) exitWith {}; - }; - uiSleep 5; -}; - - diff --git a/scripts/occupationSea.sqf b/scripts/occupationSea.sqf index 7e2c90b..3ed212a 100644 --- a/scripts/occupationSea.sqf +++ b/scripts/occupationSea.sqf @@ -71,10 +71,14 @@ for "_i" from 1 to _vehiclesToSpawn do 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; - - // Calculate the crew requried _vehicleRoles = (typeOf _vehicle) call bis_fnc_vehicleRoles; { _unitPlaced = false; @@ -97,7 +101,7 @@ for "_i" from 1 to _vehiclesToSpawn do _unit setVariable ["DMS_AssignedVeh",_vehicle]; _unitPlaced = true; }; - if(_vehicleRole == "CARGO" && _amountOfCrew <= SC_maximumCrewAmount) then + if(_vehicleRole == "CARGO" && _amountOfCrew < _crewRequired) then { _unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier; _amountOfCrew = _amountOfCrew + 1; diff --git a/scripts/occupationSky.sqf b/scripts/occupationSky.sqf index 5abf00f..e655f4c 100644 --- a/scripts/occupationSky.sqf +++ b/scripts/occupationSky.sqf @@ -6,6 +6,7 @@ _logDetail = format['[OCCUPATION:Sky] Started']; // more than _scaleAI players on the server and the max AI count drops per additional player _currentPlayerCount = count playableUnits; _maxAIcount = SC_maxAIcount; +_side = "bandit"; if(_currentPlayerCount > SC_scaleAI) then { @@ -90,10 +91,14 @@ for "_i" from 1 to _vehiclesToSpawn do _vehicle setVariable ["ExileIsLocked", 0, true]; _vehicle action ["LightOn", _vehicle]; - _amountOfCrew = 0; - _unitPlaced = false; - - // Calculate the crew requried + // 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; @@ -101,7 +106,8 @@ for "_i" from 1 to _vehiclesToSpawn do _vehicleSeat = _x select 1; if(_vehicleRole == "Driver") then { - _unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier; + _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; @@ -113,7 +119,8 @@ for "_i" from 1 to _vehiclesToSpawn do }; if(_vehicleRole == "Turret") then { - _unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier; + _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]; @@ -121,9 +128,10 @@ for "_i" from 1 to _vehiclesToSpawn do _unit addBackpackGlobal "B_Parachute"; _unitPlaced = true; }; - if(_vehicleRole == "CARGO" && _amountOfCrew <= SC_maximumCrewAmount) then + if(_vehicleRole == "CARGO" && _amountOfCrew < _crewRequired) then { - _unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier; + _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; diff --git a/scripts/occupationTransport.sqf b/scripts/occupationTransport.sqf new file mode 100644 index 0000000..e25f60e --- /dev/null +++ b/scripts/occupationTransport.sqf @@ -0,0 +1,227 @@ +if (!isServer) exitWith {}; + +_logDetail = format ["[OCCUPATION:transport]:: Starting @ %1",time]; +[_logDetail] call SC_fnc_log; + +private["_spawnLocation","_transport","_transportSpeed","_transportType","_wp","_transportBehaviour","_transportWaitingTime","_transportGunner"]; + +if( count SC_occupytransportStartPos == 0) then +{ + _middle = worldSize/2; + _spawnCenter = [_middle,_middle,0]; + SC_occupytransportStartPos = _spawnCenter; +}; + + +if!(SC_occupytransportClass isKindOf "LandVehicle" OR SC_occupytransportClass isKindOf "Air") exitWith +{ + _logDetail = format ["[OCCUPATION:transport]:: Only land vehicles or helicopters can be used as public transport"]; + [_logDetail] call SC_fnc_log; +}; + +if(SC_occupytransportClass isKindOf "LandVehicle") then +{ + _transportType = "land"; + _logDetail = format ["[OCCUPATION:transport]:: Spawning near map centre %1 @ %2",SC_occupytransportStartPos,time]; + [_logDetail] call SC_fnc_log; + + _positionOftransport = [SC_occupytransportStartPos,0,500,25,0,10,0] call BIS_fnc_findSafePos; + + // Get position of nearest roads + _nearRoads = _positionOftransport nearRoads 2000; + _nearestRoad = _nearRoads select 0; + _nearestRoadPos = position (_nearRoads select 0); + _spawnLocation = [_nearestRoadPos select 0, _nearestRoadPos select 1, 0]; + _transportSpeed = "NORMAL"; + _transportBehaviour = "CARELESS"; + _transportWaitingTime = 10; +} +else +{ + _transportType = "heli"; + _spawnLocation = [SC_occupytransportStartPos select 0, SC_occupytransportStartPos select 1, 200]; + _transportSpeed = "NORMAL"; + _transportBehaviour = "CARELESS"; + _transportWaitingTime = 60; +}; + + +// Create the driver/pilot and ensure he doest react to gunfire or being shot at. +_group = createGroup resistance; +_group setCombatMode "BLUE"; + + +// Spawn Vehicle + +if(_transportType == "heli") then +{ + _transport = createVehicle [SC_occupytransportClass, _spawnLocation, [], 0, "NONE"]; + _transport setVehiclePosition [_spawnLocation, [], 0, "FLY"]; + _transport setVariable ["vehicleID", _spawnLocation, true]; + _transport setFuel 1; + _transport setDamage 0; + _transport engineOn true; + _transport flyInHeight 100; +} +else +{ + _transport = createVehicle [SC_occupytransportClass, _spawnLocation, [], 0, "CAN_COLLIDE"]; +}; + +_transport setObjectTextureGlobal[0,"#(argb,8,8,3)color(0.518,0.519,0.455,0.2)"]; +_transport setObjectTextureGlobal [1,"#(argb,8,8,3)color(0.518,0.519,0.455,0.2)"]; +_transport setObjectTextureGlobal [2,"#(argb,8,8,3)color(0.518,0.519,0.455,0.2)"]; + +_group addVehicle _transport; +_transport enableCopilot false; + +_transportDriver = _group createUnit [DMS_AI_Classname, _spawnLocation, [], 0,"FORM"]; +removeGoggles _transportDriver; +_transportDriver forceAddUniform "U_IG_Guerilla3_1"; +_transportDriver addVest "V_TacVest_blk_POLICE"; +_transportDriver addHeadgear "H_Cap_blk"; +removeBackpackGlobal _transportDriver; +_transportDriver addBackpackGlobal "B_Parachute"; +_transportDriver disableAI 'AUTOTARGET'; +_transportDriver disableAI 'TARGET'; +_transportDriver disableAI 'SUPPRESSION'; +_transportDriver setCaptive true; +_transportDriver allowDamage false; +_transportDriver assignasdriver _transport; +_transportDriver moveInDriver _transport; +[_transportDriver] orderGetin true; +_transport lockDriver true; + +/* +// Calculate the gunners requried +// adding gunners to helicopters stops them landing to pickup players +_gunnerCount = 0; +_vehicleRoles = (typeOf _transport) call bis_fnc_vehicleRoles; +{ + _unitPlaced = false; + _vehicleRole = _x select 0; + _vehicleSeat = _x select 1; + if(_vehicleRole == "Turret" && _gunnerCount < 2) then + { + _unit = _group createUnit [DMS_AI_Classname, _spawnLocation, [], 0,"FORM"]; + _unit moveInTurret [_transport, _vehicleSeat]; + _unit setVariable ["DMS_AssignedVeh",_transport]; + _unit forceAddUniform "U_BG_leader"; + _unit addVest "V_TacVest_blk_POLICE"; + _unit addHeadgear "H_Cap_blk"; + removeBackpackGlobal _unit; + _unit addBackpackGlobal "B_Parachute"; + _unit allowDamage false; + [_unit] orderGetin true; + _gunnerCount = _gunnerCount + 1; + _unitPlaced = true; + }; + if(SC_extendedLogging && _unitPlaced) then + { + _logDetail = format['[OCCUPATION:Transport] %1 added to %2',_vehicleRole,_transport]; + [_logDetail] call SC_fnc_log; + }; + if(_gunnerCount == 2) exitWith{}; +} forEach _vehicleRoles; + +_transport lockturret [[0],true]; +_transport lockturret [[1],true]; +_transport lockturret [[2],true]; +*/ + +SC_transportArray = SC_transportArray + [_transport]; +_transport setVariable ["SC_assignedDriver", _transportDriver,true]; +_transport setVariable ["SC_transport", true,true]; +_transport setVariable ["SC_vehicleSpawnLocation", _spawnLocation,true]; +_transportDriver setVariable ["DMS_AssignedVeh",_transport]; +_transport addEventHandler ["getin", "_this call SC_fnc_getOnBus;"]; +_transport addEventHandler ["getout", "_this call SC_fnc_getOffBus;"]; + +clearBackpackCargoGlobal _transport; +clearItemCargoGlobal _transport; +clearMagazineCargoGlobal _transport; +clearWeaponCargoGlobal _transport; +_transport setVariable ["ExileIsPersistent", false]; +_transport setVariable["vehPos",_spawnLocation,true]; +_transport setFuel 1; + +_logDetail = format['[OCCUPATION:transport] Vehicle spawned @ %1',_spawnLocation]; +[_logDetail] call SC_fnc_log; + +_transport addEventHandler ["HandleDamage", { _amountOfDamage = 0; _amountOfDamage }]; + + + +{ + _markerName = _x; + _markerPos = getMarkerPos _markerName; + if (markerType _markerName == "ExileTraderZone" OR markerType _markerName == "o_unknown") then + { + _wp = _group addWaypoint [_markerPos, 100]; + _wp setWaypointType "MOVE"; + _wp setWaypointBehaviour _transportBehaviour; + _wp setWaypointspeed _transportSpeed; + + _wp = _group addWaypoint [_markerPos, 25]; + _wp setWaypointType "TR UNLOAD"; + _wp setWaypointBehaviour "SAFE"; + _wp setWaypointspeed "LIMITED"; + _wp setWaypointTimeout [_transportWaitingTime,_transportWaitingTime,_transportWaitingTime]; + }; + +} forEach allMapMarkers; + +// Add a final CYCLE +_wp = _group addWaypoint [_spawnLocation, 20]; +_wp setWaypointType "CYCLE"; +_wp setWaypointBehaviour _transportBehaviour; +_wp setWaypointspeed _transportSpeed; +_wp setWaypointTimeout [_transportWaitingTime,_transportWaitingTime,_transportWaitingTime]; + + +_transportPos = position _transport; +_mk = createMarker ["transportLocation",_transportPos]; + +if(_transportType == "land") then +{ + "transportLocation" setMarkerType "loc_BusStop"; + "transportLocation" setMarkerText "Occupation Public Bus"; +} +else +{ + "transportLocation" setMarkerType "hd_join"; + "transportLocation" setMarkerText "Occupation Airlines"; +}; + + +diag_log format['[OCCUPATION:transport] Running']; +_transportDriver = _transport getVariable "SC_assignedDriver"; + +// Make _transportDriver stop when players near him. +while {true} do +{ + + _pos = position _transport; + _mk setMarkerPos _pos; + _nearPlayers = (count (_pos nearEntities [['Exile_Unit_Player'],25])); + + if (_nearPlayers >= 1 && _transportType == "land") then + { + uiSleep 0.5; + _transport setFuel 1; + _transport setVehicleAmmo 1; + _transportDriver disableAI "MOVE"; + uiSleep 3; + } + else + { + _transport setFuel 1; + _transport setVehicleAmmo 1; + uiSleep 3; + _transportDriver enableAI "MOVE"; + if(!Alive _transportDriver) exitWith {}; + }; + uiSleep 5; +}; + + diff --git a/scripts/occupationVehicle.sqf b/scripts/occupationVehicle.sqf index ddc91ac..17dbb7e 100644 --- a/scripts/occupationVehicle.sqf +++ b/scripts/occupationVehicle.sqf @@ -119,7 +119,16 @@ if(_vehiclesToSpawn >= 1) then _group setVariable ["DMS_SpawnedGroup",true]; _group setVariable ["DMS_Group_Side", _side]; - _VehicleClassToUse = SC_VehicleClassToUse call BIS_fnc_selectRandom; + _VehicleClassToUse = SC_VehicleClassToUse call BIS_fnc_selectRandom; + + // Percentage chance to spawn a rare vehicle + _rareChance = round (random 100); + if(_rareChance >= 90) then + { + _VehicleClassToUse = SC_VehicleClassToUseRare call BIS_fnc_selectRandom; + }; + + _vehicle = createVehicle [_VehicleClassToUse, _spawnLocation, [], 0, "NONE"]; _group addVehicle _vehicle; @@ -149,10 +158,18 @@ if(_vehiclesToSpawn >= 1) then _vehicle limitSpeed 60; _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; - - // Calculate the crew requried _vehicleRoles = (typeOf _vehicle) call bis_fnc_vehicleRoles; { _unitPlaced = false; @@ -160,12 +177,13 @@ if(_vehiclesToSpawn >= 1) then _vehicleSeat = _x select 1; if(_vehicleRole == "Driver") then { - _unit = [_group,_spawnLocation,"assault","random",_side,"Vehicle"] call DMS_fnc_SpawnAISoldier; + _loadOut = [_side] call SC_fnc_selectGear; + _unit = [_group,_spawnLocation,"custom","random",_side,"Vehicle",_loadOut] call DMS_fnc_SpawnAISoldier; _amountOfCrew = _amountOfCrew + 1; - _unit removeAllMPEventHandlers "mphit"; - _unit removeAllMPEventHandlers "mpkilled"; _unit disableAI "FSM"; - [_side,_unit] call SC_fnc_changeGear; + [_side,_unit] call SC_fnc_addMarker; + _unit removeAllMPEventHandlers "mphit"; + _unit removeAllMPEventHandlers "mpkilled"; _unit disableAI "TARGET"; _unit disableAI "AUTOTARGET"; _unit disableAI "AUTOCOMBAT"; @@ -182,30 +200,35 @@ if(_vehiclesToSpawn >= 1) then _vehicle addMPEventHandler ["mpkilled", "_this call SC_fnc_vehicleDestroyed;"]; _vehicle addMPEventHandler ["mphit", "_this call SC_fnc_repairVehicle;"]; }; - if(_vehicleRole == "Turret" && _amountOfCrew <= SC_maximumCrewAmount) then + if(_vehicleRole == "Turret" && _amountOfCrew < _crewRequired) then { - _unit = [_group,_spawnLocation,"assault","random",_side,"Vehicle"] call DMS_fnc_SpawnAISoldier; + _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_changeGear; + [_side,_unit] call SC_fnc_addMarker; _unit moveInTurret [_vehicle, _vehicleSeat]; - _unit setVariable ["DMS_AssignedVeh",_vehicle]; + _unit setVariable ["DMS_AssignedVeh",_vehicle]; + _unit addMPEventHandler ["mpkilled", "_this call SC_fnc_unitMPKilled;"]; _unitPlaced = true; }; - if(_vehicleRole == "CARGO" && _amountOfCrew <= SC_maximumCrewAmount) then + if(_vehicleRole == "CARGO" && _amountOfCrew < _crewRequired) then { - _unit = [_group,_spawnLocation,"assault","random",_side,"Vehicle"] call DMS_fnc_SpawnAISoldier; + _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_changeGear; + [_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; // Get the AI to shut the fuck up :) diff --git a/scripts/reactions/airHit.sqf b/scripts/reactions/airHit.sqf index 1aced44..0d377b6 100644 --- a/scripts/reactions/airHit.sqf +++ b/scripts/reactions/airHit.sqf @@ -77,7 +77,7 @@ if(_heliDamage > 0.2 && _damagedEssentials > 0 && !_crewEjected && _ejectChance _group2 setCombatMode "RED"; }; _heli setVariable ["SC_crewEjected", true,true]; - _heli addMPEventHandler ["mphit", "_this call SC_fnc_airHit;"]; + }; @@ -114,4 +114,6 @@ if(_heliDamage > 0.7 && _damagedEssentials > 0) then [_group2, _destination, 250] call bis_fnc_taskPatrol; _group2 setBehaviour "COMBAT"; _group2 setCombatMode "RED"; -}; \ No newline at end of file +}; + +_heli addMPEventHandler ["mphit", "_this call SC_fnc_airHit;"]; \ No newline at end of file diff --git a/scripts/reactions/comeUnstuck.sqf b/scripts/reactions/comeUnstuck.sqf index fcc402b..bdbf9c4 100644 --- a/scripts/reactions/comeUnstuck.sqf +++ b/scripts/reactions/comeUnstuck.sqf @@ -68,3 +68,17 @@ if(count(crew _vehicle) > 0)then _vehicle setVariable["vehPos",_newPos]; }; +_group = group _vehicle; + +// Remove dead units from the group +{ + if(!alive _x) then { [_x] join grpNull; }; +}forEach units _group; + +if(count units _group > 0) then +{ + _vehicle lock 0; + _vehicle setVehicleLock "UNLOCKED"; + _vehicle setVariable ["ExileIsLocked", 0, true]; +}; + diff --git a/scripts/reactions/driverKilled.sqf b/scripts/reactions/driverKilled.sqf index f70fc94..0ac2736 100644 --- a/scripts/reactions/driverKilled.sqf +++ b/scripts/reactions/driverKilled.sqf @@ -66,11 +66,6 @@ if(count units _group > 0) then [_logDetail] call SC_fnc_log; }; - if(damage _vehicle > 0) then - { - [_vehicle] call SC_fnc_repairVehicle; - - }; } else { diff --git a/scripts/reactions/getIn.sqf b/scripts/reactions/getIn.sqf index abe5fa4..7456acf 100644 --- a/scripts/reactions/getIn.sqf +++ b/scripts/reactions/getIn.sqf @@ -20,6 +20,13 @@ else { { deleteVehicle _x; } forEach attachedObjects _unit; }; + + + if(damage _vehicle > 0) then + { + [_vehicle] call SC_fnc_repairVehicle; + + }; }; diff --git a/scripts/reactions/unitMPKilled.sqf b/scripts/reactions/unitMPKilled.sqf index 3c93b42..363dcda 100644 --- a/scripts/reactions/unitMPKilled.sqf +++ b/scripts/reactions/unitMPKilled.sqf @@ -4,6 +4,7 @@ _killer = _this select 1; // remove all eventhandlers from the dead unit _unit removeAllMPEventHandlers "mphit"; +[_unit] join grpNull; if(SC_debug) then { diff --git a/scripts/startOccupation.sqf b/scripts/startOccupation.sqf index 887722f..3341e65 100644 --- a/scripts/startOccupation.sqf +++ b/scripts/startOccupation.sqf @@ -81,9 +81,9 @@ if(SC_occupyMilitary) then [SC_refreshTime, fnc_occupationMilitary, [], true] call ExileServer_system_thread_addTask; }; -if(SC_occupyPublicBus) then +if(SC_occupyTransport) then { - [] execVM "\x\addons\a3_exile_occupation\scripts\occupationPublicBus.sqf"; + [] execVM "\x\addons\a3_exile_occupation\scripts\occupationTransport.sqf"; }; uiSleep 15; // delay the start