From cb56ee0134f69e5c70331716fe072dd171f33717 Mon Sep 17 00:00:00 2001 From: second_coming Date: Fri, 6 May 2016 10:30:41 +0100 Subject: [PATCH] V37 changes --- changeLog.txt | 5 +++++ config.sqf | 36 ++++++++++++++++++----------------- initServer.sqf | 2 +- scripts/occupationSea.sqf | 18 +++++++++++++++++- scripts/occupationSky.sqf | 18 +++++++++++++++++- scripts/occupationVehicle.sqf | 31 ++++++++++++++++++++++++++++-- 6 files changed, 88 insertions(+), 22 deletions(-) diff --git a/changeLog.txt b/changeLog.txt index f9073ef..40e2ac9 100644 --- a/changeLog.txt +++ b/changeLog.txt @@ -1,3 +1,8 @@ +================================================================================= +V37 (05-05-2016) +================================================================================= +Added limit checks for the amount of each class of vehicle in Sky, Sea and Vehicle modules + ================================================================================= V36 (05-05-2016) ================================================================================= diff --git a/config.sqf b/config.sqf index 7c59818..67f3f64 100644 --- a/config.sqf +++ b/config.sqf @@ -192,36 +192,36 @@ SC_maximumCrewAmount = 4; // Maximum amount of AI allowed in a vehicl // Settings for roaming ground vehicle AI SC_maxNumberofVehicles = 4; -// Array of ground vehicles which can be used by AI patrols +// Array of arrays of ground vehicles 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_VehicleClassToUse = [ - "Exile_Car_LandRover_Green", - "Exile_Bike_QuadBike_Black", - "Exile_Car_UAZ_Open_Green" + ["Exile_Car_LandRover_Green",0], + ["Exile_Bike_QuadBike_Black",2], + ["Exile_Car_UAZ_Open_Green",2] ]; SC_VehicleClassToUseRare = [ - "Exile_Car_Hunter", - "Exile_Car_HEMMT", - "Exile_Car_Zamak", - "Exile_Car_Offroad_Armed_Guerilla12", - "Exile_Car_Offroad_Armed_Guerilla03", - "Exile_Car_Tempest" + ["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] ]; // 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" ]; +// 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] ]; // 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 +// Array of boats 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_BoatClassToUse = [ - "B_Boat_Armed_01_minigun_F", - "I_Boat_Armed_01_minigun_F", - "O_Boat_Transport_01_F", - "Exile_Boat_MotorBoat_Police" + ["B_Boat_Armed_01_minigun_F",1], + ["I_Boat_Armed_01_minigun_F",1], + ["O_Boat_Transport_01_F",0], + ["Exile_Boat_MotorBoat_Police",1] ]; // Arrays of names used to generate names for AI @@ -266,6 +266,8 @@ CIVILIAN setFriend[EAST,0]; CIVILIAN setFriend[WEST,0]; EAST setFriend[CIVILIAN,0]; WEST setFriend[CIVILIAN,0]; +EAST setFriend[WEST,0]; +WEST setFriend[EAST,0]; SC_SurvivorSide = CIVILIAN; SC_BanditSide = EAST; diff --git a/initServer.sqf b/initServer.sqf index 3352ed5..ba2b769 100644 --- a/initServer.sqf +++ b/initServer.sqf @@ -2,7 +2,7 @@ // // Server Occupation script by second_coming // -SC_occupationVersion = "v36 (05-05-2016)"; +SC_occupationVersion = "v37 (06-05-2016)"; // // http://www.exilemod.com/profile/60-second_coming/ // diff --git a/scripts/occupationSea.sqf b/scripts/occupationSea.sqf index 8dca51b..54e57cb 100644 --- a/scripts/occupationSea.sqf +++ b/scripts/occupationSea.sqf @@ -45,7 +45,23 @@ for "_i" from 1 to _vehiclesToSpawn do private["_group"]; _spawnLocation = [ 250, 0, 1, 1000, 1000, 1000, 1000, 1000, true, true ] call DMS_fnc_findSafePos; _group = createGroup SC_BanditSide; - _VehicleClassToUse = SC_BoatClassToUse call BIS_fnc_selectRandom; + + _VehicleClass = SC_BoatClassToUse call BIS_fnc_selectRandom; + _VehicleClassToUse = _VehicleClass select 0; + + boatOkToSpawn = false; + while{!boatOkToSpawn} do + { + _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 diff --git a/scripts/occupationSky.sqf b/scripts/occupationSky.sqf index cd66dad..338ef2a 100644 --- a/scripts/occupationSky.sqf +++ b/scripts/occupationSky.sqf @@ -70,7 +70,23 @@ for "_i" from 1 to _vehiclesToSpawn do _spawnLocation = [_safePos select 0, _safePos select 1, _height]; _group = createGroup SC_BanditSide; - _VehicleClassToUse = SC_HeliClassToUse call BIS_fnc_selectRandom; + + _VehicleClass = SC_HeliClassToUse call BIS_fnc_selectRandom; + _VehicleClassToUse = _VehicleClass select 0; + + heliOkToSpawn = false; + while{!heliOkToSpawn} do + { + _VehicleClass = SC_HeliClassToUse 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 { heliOkToSpawn = true; }; + }; + _vehicle = createVehicle [_VehicleClassToUse, _spawnLocation, [], 0, "NONE"]; if(!isNull _vehicle) then diff --git a/scripts/occupationVehicle.sqf b/scripts/occupationVehicle.sqf index ccd04d4..1650c60 100644 --- a/scripts/occupationVehicle.sqf +++ b/scripts/occupationVehicle.sqf @@ -119,13 +119,40 @@ if(_vehiclesToSpawn >= 1) then _group setVariable ["DMS_SpawnedGroup",true]; _group setVariable ["DMS_Group_Side", _side]; - _VehicleClassToUse = SC_VehicleClassToUse call BIS_fnc_selectRandom; + _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 { - _VehicleClassToUse = SC_VehicleClassToUseRare call BIS_fnc_selectRandom; + + 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; }; + }; };