From 560dba02ff949d9bafe2c3687b1f173a3ceb9866 Mon Sep 17 00:00:00 2001 From: second_coming Date: Mon, 18 Apr 2016 14:01:41 +0100 Subject: [PATCH] v23 fixes & changes --- config.sqf | 106 ++++++++++++++++++++++++------ initServer.sqf | 2 +- scripts/occupationHeliCrashes.sqf | 46 +++++++++---- scripts/occupationLootCrates.sqf | 48 +++++++++----- scripts/occupationPlaces.sqf | 54 ++++++++++----- scripts/occupationPublicBus.sqf | 9 --- scripts/occupationSea.sqf | 14 ++-- scripts/occupationSky.sqf | 22 ++++--- scripts/occupationVehicle.sqf | 26 ++++++-- 9 files changed, 232 insertions(+), 95 deletions(-) diff --git a/config.sqf b/config.sqf index 05db6b9..67e2903 100644 --- a/config.sqf +++ b/config.sqf @@ -12,33 +12,37 @@ // Shared Config for each occupation monitor -SC_debug = false; // set to true to turn on debug features (not for live servers) -SC_extendedLogging = true; // set to true for additional logging + +SC_debug = false; // set to true to turn on debug features (not for live servers) +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 = true; // Place map markers at the occupied areas (occupyPlaces and occupyMilitary only) true/false +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_useWaypoints = true; // When spawning AI create waypoints to make them enter buildings - // (can affect performance when the AI is spawned and the waypoints are calculated) +SC_useWaypoints = true; // When spawning AI create waypoints to make them enter buildings (can affect performance when the AI is spawned and the waypoints are calculated) SC_occupyPlaces = true; // true if you want villages,towns,cities patrolled by bandits SC_occupyVehicle = true; // true if you want to have roaming AI vehicles SC_occupyVehiclesLocked = true; // true if AI vehicles to stay locked until all the linked AI are dead -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 + SC_SurvivorsChance = 33; // chance in % to spawn survivors instead of bandits (for places and land vehicles) SC_occupyPlacesSurvivors = true; // true if you want a chance to spawn survivor AI as well as bandits (SC_occupyPlaces must be true to use this option) SC_occupyVehicleSurvivors = true; // true if you want a chance to spawn survivor AI as well as bandits (SC_occupyVehicle must be true to use this option) +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 -SC_occupyMilitary = false; // true if you want military buildings patrolled (specify which types of building below) +// Array of uniforms for survivor AI to use +SC_SurvivorUniforms = ["Exile_Uniform_BambiOverall"]; + +SC_occupyMilitary = false; // true if you want military buildings patrolled + +// Array of buildings to add military patrols to SC_buildings = [ "Land_TentHangar_V1_F","Land_Hangar_F", "Land_Airport_Tower_F","Land_Cargo_House_V1_F", "Land_Cargo_House_V3_F","Land_Cargo_HQ_V1_F", @@ -84,29 +88,79 @@ SC_LootCrateGuards = 4; // number of AI to spawn at SC_LootCrateGuardsRandomize = true; // Use a random number of guards up to a maximum = SC_numberofGuards (so between 1 and SC_numberofGuards) SC_occupyLootCratesMarkers = true; // true if you want to have markers on the loot crate spawns +// Array of possible common items to go in loot crates ["classname",fixed amount,random amount] +// ["Exile_Item_Matches",1,2] this example would add between 1 and 3 Exile_Item_Matches to the crate (1 + 0 to 2 more) +// to add a fixed amount make the second number 0 +SC_LootCrateItems = [ + ["Exile_Melee_Axe",1,0], + ["Exile_Item_GloriousKnakworst",1,2], + ["Exile_Item_PlasticBottleFreshWater",1,2], + ["Exile_Item_Beer",5,1], + ["Exile_Item_BaseCameraKit",0,2], + ["Exile_Item_InstaDoc",1,1], + ["Exile_Item_Matches",1,0], + ["Exile_Item_CookingPot",1,0], + ["Exile_Item_MetalPole",1,0], + ["Exile_Item_LightBulb",1,0], + ["Exile_Item_FuelCanisterEmpty",1,0], + ["Exile_Item_WoodPlank",1,8], + ["Exile_Item_woodFloorKit",1,2], + ["Exile_Item_WoodWindowKit",1,1], + ["Exile_Item_WoodDoorwayKit",1,1], + ["Exile_Item_WoodFloorPortKit",1,2], + ["Exile_Item_Laptop",0,1], + ["Exile_Item_CodeLock",0,1] + ]; + SC_occupyHeliCrashes = true; // true if you want to have Dayz style helicrashes SC_numberofHeliCrashes = 5; // if SC_occupyHeliCrashes = true spawn this many loot crates (overrided below for Namalsk) +// 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 = [ + ["HandGrenade",0,2], + ["APERSBoundingMine_Range_Mag",0,2], + ["B_Parachute",1,1], + ["H_CrewHelmetHeli_B",1,1], + ["ItemGPS",0,1], + ["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_HeliCrashWeaponsAmount = [1,3]; // [fixed amount to add, random amount to add] +SC_HeliCrashMagazinesAmount = [2,2]; // [fixed amount to add, random amount to add] + SC_statics = [ [[1178,2524,0],8,250,true] ]; //[[pos],ai count,radius,search buildings] +SC_maximumCrewAmount = 2; // Maximum amount of AI allowed in a vehicle + // (essential crew like drivers and gunners will always spawn regardless of this setting) // Settings for roaming ground vehicle AI -SC_maxNumberofVehicles = 4; +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_Octavius_White"]; // 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"]; // 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" ]; -// AI Custom Loadouts - // namalsk specific settings + +// namalsk specific settings (if you want to override settings for specific maps if you run multiple servers) if (worldName == 'Namalsk') then { SC_maxAIcount = 80; @@ -118,15 +172,31 @@ if (worldName == 'Namalsk') then SC_occupyPublicBusClass = "Exile_Car_LandRover_Urban"; // the ikarus bus gets stuck on Namalsk }; +if (SC_debug) then +{ + SC_extendedLogging = true; + SC_mapMarkers = true; + SC_occupyPlaces = true; + SC_occupyVehicle = true; + SC_occupyMilitary = true; + SC_occupyStatic = true; + SC_occupySky = true; + SC_occupySea = true; + SC_occupyPublicBus = true; + SC_occupyLootCrates = true; + SC_occupyHeliCrashes = true; +}; + // Don't alter anything below this point, unless you want your server to explode :) if(!SC_SurvivorsFriendly) then { CIVILIAN setFriend[RESISTANCE,0]; - CIVILIAN setFriend[EAST,0]; - CIVILIAN setFriend[WEST,0]; - EAST setFriend[CIVILIAN,0]; - WEST setFriend[CIVILIAN,0]; }; +CIVILIAN setFriend[EAST,0]; +CIVILIAN setFriend[WEST,0]; +EAST setFriend[CIVILIAN,0]; +WEST setFriend[CIVILIAN,0]; + SC_SurvivorSide = CIVILIAN; SC_BanditSide = EAST; SC_liveVehicles = 0; @@ -136,7 +206,6 @@ SC_liveHelisArray = []; SC_liveBoats = 0; SC_liveBoatsArray = []; SC_publicBusArray = []; -SC_StopTheBus = false; publicVariable "SC_liveVehicles"; publicVariable "SC_liveVehiclesArray"; @@ -146,6 +215,5 @@ publicVariable "SC_liveBoats"; publicVariable "SC_liveBoatsArray"; publicVariable "SC_numberofLootCrates"; publicVariable "SC_publicBusArray"; -publicVariable "SC_StopTheBus"; publicVariable "SC_SurvivorSide"; publicVariable "SC_BanditSide"; \ No newline at end of file diff --git a/initServer.sqf b/initServer.sqf index e4c0c50..792f7f8 100644 --- a/initServer.sqf +++ b/initServer.sqf @@ -2,7 +2,7 @@ // // Server Occupation script by second_coming // -SC_occupationVersion = "v22 (16-04-2016)"; +SC_occupationVersion = "v23 (18-04-2016)"; // // http://www.exilemod.com/profile/60-second_coming/ // diff --git a/scripts/occupationHeliCrashes.sqf b/scripts/occupationHeliCrashes.sqf index 4881f9e..c1c71d8 100644 --- a/scripts/occupationHeliCrashes.sqf +++ b/scripts/occupationHeliCrashes.sqf @@ -47,26 +47,48 @@ for "_i" from 1 to SC_numberofHeliCrashes do _box enableRopeAttach false; _box setVariable ["permaLoot",true]; _box allowDamage false; - _box addMagazineCargoGlobal ["HandGrenade", (random 2)]; - _box addMagazineCargoGlobal ["APERSBoundingMine_Range_Mag", (random 2)]; - _box addBackpackCargoGlobal ["B_Parachute", 1 + (random 1)]; - _box addItemCargoGlobal ["H_CrewHelmetHeli_B", 1 + (random 1)]; - _box addItemCargoGlobal ["U_B_HeliPilotCoveralls", 1 + (random 1)]; - _box addItemCargoGlobal ["ItemGPS", (random 1)]; - _box addItemCargoGlobal ["Exile_Item_InstaDoc", (random 1)]; - _box addItemCargoGlobal ["Exile_Item_PlasticBottleFreshWater", 2 + (random 2)]; - _box addItemCargoGlobal ["Exile_Item_EMRE", 2 + (random 2)]; + + { + _item = _x select 0; + _amount = _x select 1; + _randomAmount = _x select 2; + _amount = _amount + (random _randomAmount); + _itemType = _x call BIS_fnc_itemType; + + + if((_itemType select 0) == "Weapon") then + { + _box addWeaponCargoGlobal [_item, _amount]; + }; + if((_itemType select 0) == "Magazine") then + { + _box addMagazineCargoGlobal [_item, _amount]; + }; + if((_itemType select 0) == "Item") then + { + _box addItemCargoGlobal [_item, _amount]; + }; + if((_itemType select 0) == "Equipment") then + { + _box addItemCargoGlobal [_item, _amount]; + }; + if((_itemType select 0) == "Backpack") then + { + _box addBackpackCargoGlobal [_item, _amount]; + }; + }forEach SC_HeliCrashItems; // Add weapons with ammo to the Box - _possibleWeapons = ["srifle_DMR_02_camo_F","srifle_DMR_03_woodland_F","srifle_DMR_04_F","srifle_DMR_05_hex_F"]; - _amountOfWeapons = 1 + (random 3); - + _possibleWeapons = SC_HeliCrashWeapons; + _amountOfWeapons = (SC_HeliCrashWeaponsAmount select 0) + round random (SC_HeliCrashWeaponsAmount select 1); + for "_i" from 1 to _amountOfWeapons do { _weaponToAdd = _possibleWeapons call BIS_fnc_selectRandom; _box addWeaponCargoGlobal [_weaponToAdd,1]; _magazinesToAdd = getArray (configFile >> "CfgWeapons" >> _weaponToAdd >> "magazines"); + _magazineAmount = (SC_HeliCrashMagazinesAmount select 0) + round random (SC_HeliCrashMagazinesAmount select 1); _box addMagazineCargoGlobal [(_magazinesToAdd select 0),round random 5]; }; diff --git a/scripts/occupationLootCrates.sqf b/scripts/occupationLootCrates.sqf index 4e53621..7c185bd 100644 --- a/scripts/occupationLootCrates.sqf +++ b/scripts/occupationLootCrates.sqf @@ -80,22 +80,34 @@ for "_i" from 1 to SC_numberofLootCrates do _box setVariable ["permaLoot",true]; // Crate stays until next server restart _box allowDamage false; // Stop crates taking damage - _box addItemCargoGlobal ["Exile_Melee_Axe", 1]; - _box addItemCargoGlobal ["Exile_Item_GloriousKnakworst", 1 + (random 2)]; - _box addItemCargoGlobal ["Exile_Item_PlasticBottleFreshWater", 1 + (random 2)]; - _box addItemCargoGlobal ["Exile_Item_Beer", 5 + (random 1)]; - _box addItemCargoGlobal ["Exile_Item_Laptop", (random 1)]; - _box addItemCargoGlobal ["Exile_Item_BaseCameraKit", (random 2)]; - _box addItemCargoGlobal ["Exile_Item_InstaDoc", 1 + (random 1)]; - _box addItemCargoGlobal ["Exile_Item_Matches", 1]; - _box addItemCargoGlobal ["Exile_Item_CookingPot", 1]; - _box addItemCargoGlobal ["Exile_Item_CodeLock", (random 1)]; - _box addItemCargoGlobal ["Exile_Item_MetalPole", 1]; - _box addItemCargoGlobal ["Exile_Item_LightBulb", 1]; - _box addItemCargoGlobal ["Exile_Item_FuelCanisterEmpty", 1]; - _box addItemCargoGlobal ["Exile_Item_WoodPlank", 1 + (random 8)]; - _box addItemCargoGlobal ["Exile_Item_woodFloorKit", 1 + (random 2)]; - _box addItemCargoGlobal ["Exile_Item_WoodWindowKit", 1 + (random 1)]; - _box addItemCargoGlobal ["Exile_Item_WoodDoorwayKit", 1 + (random 1)]; - _box addItemCargoGlobal ["Exile_Item_WoodFloorPortKit", 1 + (random 2)]; + { + _item = _x select 0; + _amount = _x select 1; + _randomAmount = _x select 2; + _amount = _amount + (random _randomAmount); + _itemType = _x call BIS_fnc_itemType; + + + if((_itemType select 0) == "Weapon") then + { + _box addWeaponCargoGlobal [_item, _amount]; + }; + if((_itemType select 0) == "Magazine") then + { + _box addMagazineCargoGlobal [_item, _amount]; + }; + if((_itemType select 0) == "Item") then + { + _box addItemCargoGlobal [_item, _amount]; + }; + if((_itemType select 0) == "Equipment") then + { + _box addItemCargoGlobal [_item, _amount]; + }; + if((_itemType select 0) == "Backpack") then + { + _box addBackpackCargoGlobal [_item, _amount]; + }; + }forEach SC_LootCrateItems; + }; \ No newline at end of file diff --git a/scripts/occupationPlaces.sqf b/scripts/occupationPlaces.sqf index 35900ee..3b8a9f1 100644 --- a/scripts/occupationPlaces.sqf +++ b/scripts/occupationPlaces.sqf @@ -127,7 +127,7 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi } else { - if(_nearBanditAI == 0 AND _nearSurvivorAI == 0) then + if(_nearSurvivorAI == 0) then { _sideToSpawn = random 100; if(_sideToSpawn <= SC_SurvivorsChance) then @@ -141,14 +141,7 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi } else { - if(_nearSurvivorAI == 0) then - { - _side = "survivor"; - } - else - { - _side = "bandit"; - }; + _side = "bandit"; }; }; @@ -194,7 +187,8 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi _unit addMPEventHandler ["mphit", "_this call SC_fnc_unitMPHit;"]; _unit addMPEventHandler ["mpkilled", "_this call SC_fnc_unitMPKilled;"]; removeUniform _unit; - _unit forceAddUniform "Exile_Uniform_BambiOverall"; + _survivorUniform = SC_SurvivorUniforms call BIS_fnc_selectRandom; + _unit forceAddUniform _survivorUniform; if(SC_debug) then { _tag = createVehicle ["Sign_Arrow_Green_F", position _unit, [], 0, "CAN_COLLIDE"]; @@ -292,7 +286,8 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi _unit addMPEventHandler ["mphit", "_this call SC_fnc_unitMPHit;"]; _unit addMPEventHandler ["mpkilled", "_this call SC_fnc_unitMPKilled;"]; removeUniform _unit; - _unit forceAddUniform "Exile_Uniform_BambiOverall"; + _survivorUniform = SC_SurvivorUniforms call BIS_fnc_selectRandom; + _unit forceAddUniform _survivorUniform; if(SC_debug) then { _tag = createVehicle ["Sign_Arrow_Green_F", position _unit, [], 0, "CAN_COLLIDE"]; @@ -314,29 +309,54 @@ _locations = (nearestLocations [_spawnCenter, ["NameVillage","NameCity", "NameCi _group2 setCombatMode "RED"; }; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + _markerName = "Occupation Area"; + _markerColour = "ColorOrange"; if(SC_mapMarkers) then { - _marker = createMarker [format ["%1", _spawnPosition],_pos]; + deleteMarker format ["%1", _spawnPosition]; + _nearBanditAI = { side _x == SC_BanditSide AND _x distance _pos < 500 } count allUnits; + _nearSurvivorAI = { side _x == SC_SurvivorSide AND _x distance _pos < 500 } count allUnits; + + if(_nearBanditAI > 0 && _nearSurvivorAI > 0) then + { + _markerName = "Survivors and Bandits"; + _markerColour = "ColorOrange"; + }; + if(_nearBanditAI == 0 && _nearSurvivorAI > 0) then + { + _markerName = "Survivors"; + _markerColour = "ColorGreen"; + }; + if(_nearBanditAI > 0 && _nearSurvivorAI == 0) then + { + _markerName = "Bandits"; + _markerColour = "ColorRed"; + }; + + _marker = createMarker [format ["%1", _spawnPosition],_pos]; _marker setMarkerShape "Icon"; _marker setMarkerSize [3,3]; _marker setMarkerType "mil_dot"; _marker setMarkerBrush "Solid"; + _marker setMarkerText _markerName; + _marker setMarkerColor _markerColour; _marker setMarkerAlpha 0.5; - _marker setMarkerText "Occupied Area"; + if(_side == "survivor") then { - _marker setMarkerColor "ColorGreen"; _logDetail = format ["[OCCUPATION:Places]:: Spawning %2 survivor AI in at %3 to patrol %1",_locationName,_aiCount,_spawnPosition]; } else { - _marker setMarkerColor "ColorOrange"; _logDetail = format ["[OCCUPATION:Places]:: Spawning %2 bandit AI in at %3 to patrol %1",_locationName,_aiCount,_spawnPosition]; }; - }; - [_logDetail] call SC_fnc_log; + [_logDetail] call SC_fnc_log; + _logDetail = format ["[OCCUPATION:Places]:: %1 Bandits:%2 Survivors:%3 Marker Colour:%4 Marker Name:%5",_locationName,_nearBanditAI,_nearSurvivorAI,_markerColour,_markerName]; + [_logDetail] call SC_fnc_log; + }; _okToSpawn = false; }; diff --git a/scripts/occupationPublicBus.sqf b/scripts/occupationPublicBus.sqf index 17f0029..728fa34 100644 --- a/scripts/occupationPublicBus.sqf +++ b/scripts/occupationPublicBus.sqf @@ -116,15 +116,6 @@ while {true} do busDriver enableAI "MOVE"; if(!Alive busDriver) exitWith {}; }; - - if(SC_StopTheBus) then - { - uiSleep 0.5; - _publicBus setFuel 0; - busDriver disableAI "MOVE"; - uiSleep 5; - SC_StopTheBus = false; - }; uiSleep 5; }; diff --git a/scripts/occupationSea.sqf b/scripts/occupationSea.sqf index 7542507..7e2c90b 100644 --- a/scripts/occupationSea.sqf +++ b/scripts/occupationSea.sqf @@ -71,6 +71,8 @@ for "_i" from 1 to _vehiclesToSpawn do sleep 0.2; _group addVehicle _vehicle; + _amountOfCrew = 0; + _unitPlaced = false; // Calculate the crew requried _vehicleRoles = (typeOf _vehicle) call bis_fnc_vehicleRoles; @@ -80,7 +82,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; + _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]; @@ -88,19 +91,22 @@ for "_i" from 1 to _vehiclesToSpawn do }; if(_vehicleRole == "Turret") then { - _unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier; + _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") then + if(_vehicleRole == "CARGO" && _amountOfCrew <= SC_maximumCrewAmount) then { - _unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier; + _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]; diff --git a/scripts/occupationSky.sqf b/scripts/occupationSky.sqf index b2038e6..5abf00f 100644 --- a/scripts/occupationSky.sqf +++ b/scripts/occupationSky.sqf @@ -90,39 +90,47 @@ for "_i" from 1 to _vehiclesToSpawn do _vehicle setVariable ["ExileIsLocked", 0, true]; _vehicle action ["LightOn", _vehicle]; - + _amountOfCrew = 0; + _unitPlaced = false; // Calculate the crew requried _vehicleRoles = (typeOf _vehicle) call bis_fnc_vehicleRoles; { - _vehicleRole = _x select 0; + _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; + _unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] 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 { - _unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] call DMS_fnc_SpawnAISoldier; + _unit = [_group,_spawnLocation,"assault","random","bandit","Vehicle"] 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") then + if(_vehicleRole == "CARGO" && _amountOfCrew <= SC_maximumCrewAmount) 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]; removeBackpackGlobal _unit; _unit addBackpackGlobal "B_Parachute"; + _unitPlaced = true; }; if(SC_extendedLogging) then { @@ -137,13 +145,11 @@ for "_i" from 1 to _vehiclesToSpawn do [_unit] joinSilent _group; }foreach units _group; - if(SC_infiSTAR_log) then + if(SC_extendedLogging && _unitPlaced) then { _logDetail = format['[OCCUPATION:Sky] %1 spawned @ %2',_VehicleClassToUse,_spawnLocation]; [_logDetail] call SC_fnc_log; }; - - clearMagazineCargoGlobal _vehicle; clearWeaponCargoGlobal _vehicle; diff --git a/scripts/occupationVehicle.sqf b/scripts/occupationVehicle.sqf index 4872519..7cce0ae 100644 --- a/scripts/occupationVehicle.sqf +++ b/scripts/occupationVehicle.sqf @@ -149,6 +149,9 @@ if(_vehiclesToSpawn >= 1) then _vehicle limitSpeed 60; _vehicle action ["LightOn", _vehicle]; + _amountOfCrew = 0; + _unitPlaced = false; + // Calculate the crew requried _vehicleRoles = (typeOf _vehicle) call bis_fnc_vehicleRoles; { @@ -158,13 +161,16 @@ if(_vehiclesToSpawn >= 1) then if(_vehicleRole == "Driver") then { _unit = [_group,_spawnLocation,"assault","random",_side,"Vehicle"] call DMS_fnc_SpawnAISoldier; + _amountOfCrew = _amountOfCrew + 1; _unit removeAllMPEventHandlers "mphit"; _unit removeAllMPEventHandlers "mpkilled"; _unit disableAI "FSM"; if(_side == "survivor") then { removeUniform _unit; - _unit forceAddUniform "Exile_Uniform_BambiOverall"; + sleep 0.1; + _survivorUniform = SC_SurvivorUniforms call BIS_fnc_selectRandom; + _unit forceAddUniform _survivorUniform; }; _unit disableAI "TARGET"; _unit disableAI "AUTOTARGET"; @@ -188,29 +194,35 @@ if(_vehiclesToSpawn >= 1) then _vehicle addMPEventHandler ["mpkilled", "_this call SC_fnc_vehicleDestroyed;"]; _vehicle addMPEventHandler ["mphit", "_this call SC_fnc_repairVehicle;"]; }; - if(_vehicleRole == "Turret") then + if(_vehicleRole == "Turret" && _amountOfCrew <= SC_maximumCrewAmount) then { - _unit = [_group,_spawnLocation,"assault","random",_side,"Vehicle"] call DMS_fnc_SpawnAISoldier; + _unit = [_group,_spawnLocation,"assault","random",_side,"Vehicle"] call DMS_fnc_SpawnAISoldier; + _amountOfCrew = _amountOfCrew + 1; if(_side == "survivor") then { _unit addMPEventHandler ["mphit", "_this call SC_fnc_unitMPHit;"]; _unit addMPEventHandler ["mpkilled", "_this call SC_fnc_unitMPKilled;"]; removeUniform _unit; - _unit forceAddUniform "Exile_Uniform_BambiOverall"; + sleep 0.1; + _survivorUniform = SC_SurvivorUniforms call BIS_fnc_selectRandom; + _unit forceAddUniform _survivorUniform; }; _unit moveInTurret [_vehicle, _vehicleSeat]; _unit setVariable ["DMS_AssignedVeh",_vehicle]; _unitPlaced = true; }; - if(_vehicleRole == "CARGO") then + if(_vehicleRole == "CARGO" && _amountOfCrew <= SC_maximumCrewAmount) then { - _unit = [_group,_spawnLocation,"assault","random",_side,"Vehicle"] call DMS_fnc_SpawnAISoldier; + _unit = [_group,_spawnLocation,"assault","random",_side,"Vehicle"] call DMS_fnc_SpawnAISoldier; + _amountOfCrew = _amountOfCrew + 1; if(_side == "survivor") then { _unit addMPEventHandler ["mphit", "_this call SC_fnc_unitMPHit;"]; _unit addMPEventHandler ["mpkilled", "_this call SC_fnc_unitMPKilled;"]; removeUniform _unit; - _unit forceAddUniform "Exile_Uniform_BambiOverall"; + sleep 0.1; + _survivorUniform = SC_SurvivorUniforms call BIS_fnc_selectRandom; + _unit forceAddUniform _survivorUniform; }; _unit assignAsCargo _vehicle; _unit moveInCargo _vehicle;