diff --git a/@GMS/addons/custom_server/Changelog 6.90.txt b/@GMS/addons/custom_server/Changelog 6.90.txt new file mode 100644 index 0000000..a40b99c --- /dev/null +++ b/@GMS/addons/custom_server/Changelog 6.90.txt @@ -0,0 +1,28 @@ +1. Added new settings to specify the number of crew per vehhicle to blck_config.sqf and blck_config_mil.sqf + + // global settings for this parameters + // Determine the number of crew plus driver per vehicle; excess crew are ignored. + // This can be a value or array of [_min, _max]; + blck_vehCrew_blue = 3; + blck_vehCrew_red = 3; + blck_vehCrew_green = 3; + blck_vehCrew_orange = 3; + + You can also define this value in missions by adding the following variable definition to the mission template: + + _vehicleCrewCount = [3,6]; // min/max number of AI to load including driver. see the missions\blue\template.sqf and blck_configs.sqf for more info. + +2. Lists of items to be excluded from dynamically generated loadouts has been moved to: + blck_config.sqf + blck_config_mil.sqf + +3. Added a new setting that specifies whether logging of blacklisted items is done (handy for debugging) + blck_logBlacklistedItems = true; // set to false to disable logging + +4. Hit and Killed event handlers extensively reworked. Methods for notification of nearby AI and Vehicles of the killers whereabouts were revised to be more inclusive of neighboring AI. + +5. Issues with AIHit events fixed; AI now deploy smoke and heal. + +6. Removed some unnecessary logging. + +7. Other minor coding fixes and optimizations. \ No newline at end of file diff --git a/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_checkGroupWaypointStatus.sqf b/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_checkGroupWaypointStatus.sqf index 5aa577a..304d8be 100644 --- a/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_checkGroupWaypointStatus.sqf +++ b/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_checkGroupWaypointStatus.sqf @@ -17,7 +17,7 @@ params["_group","_maxTime","_radius"]; if (diag_tickTime > (_group getVariable "timeStamp") + _maxTime) then // || ( (getPos (leader)) distance2d (_group getVariable "patrolCenter") > _radius)) then { (leader _group) call blck_fnc_changeToMoveWaypoint; - //#ifdef blck_debugMode - if (blck_debugLevel > -1) then {diag_log format["_fnc_checkGroupWaypointStatus: group %1 stuck, waypoint reset",_group];}; - //#endif + #ifdef blck_debugMode + if (blck_debugLevel > 1) then {diag_log format["_fnc_checkGroupWaypointStatus: group %1 stuck, waypoint reset",_group];}; + #endif }; diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_EH_vehicleGetOut.sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_EH_vehicleGetOut.sqf index 6b05f81..f76faac 100644 --- a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_EH_vehicleGetOut.sqf +++ b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_EH_vehicleGetOut.sqf @@ -10,22 +10,12 @@ http://creativecommons.org/licenses/by-nc-sa/4.0/ */ -diag_log format["_EH_vehicleGetOut: _this = %1",_this]; +//diag_log format["_EH_vehicleGetOut: _this = %1",_this]; if (isServer) then { _this call blck_fnc_handleVehicleGetOut }; -/* else { - if ((crew _this) isEqualTo []) then - { - private _veh = _this select 0; - //_veh lock 1; - diag_log format["_EH_vehicleGetOut: letting the server handle unit getout event for _vehicle %1",_veh]; - }; -}; -//_this remoteExec["blck_fnc_handleVehicleGetOut",2]; - diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_handleEmptyVehicle.sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_handleEmptyVehicle.sqf index a860313..cf0d79f 100644 --- a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_handleEmptyVehicle.sqf +++ b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_handleEmptyVehicle.sqf @@ -14,7 +14,7 @@ params["_veh"]; //diag_log format["_fnc_handleEmptyVehicle: vehicle %1 | count(crew _veh) = %2 | typoeOf _veh = %3 | description _veh = %4",_veh,count(crew _veh),typeOf _veh,gettext(configFile >> 'cfgWeapons' >> typeOf _veh >> 'displayName')]; if ({alive _x} count (crew _veh) == 0 || crew(_veh) isEqualTo []) then { - diag_log format["_fnc_handleEmptyVehicle: no units alive in vehicle %1",_veh, typeOf _veh,gettext (configFile >> 'cfgWeapons' >> typeOf _veh >> 'displayName')]; + //diag_log format["_fnc_handleEmptyVehicle: no units alive in vehicle %1",_veh, typeOf _veh,gettext (configFile >> 'cfgWeapons' >> typeOf _veh >> 'displayName')]; if (_veh getVariable["GRG_vehType","none"] isEqualTo "emplaced") then { //diag_log format["_fnc_handleEmptyVehicle: emplaced weapon %1 being handled",_veh]; @@ -36,7 +36,7 @@ if ({alive _x} count (crew _veh) == 0 || crew(_veh) isEqualTo []) then _veh setFuel 0; _veh setVariable["blck_deleteAtTime",diag_tickTime + 60]; } else { - diag_log format["_fnc_handleEmptyVehicle: releasing vehicle %1 to players and setting a default delete timer",_veh]; + //diag_log format["_fnc_handleEmptyVehicle: releasing vehicle %1 to players and setting a default delete timer",_veh]; _veh setVariable["blck_deleteAtTime",diag_tickTime + blck_vehicleDeleteTimer,true]; [_veh] call blck_fnc_releaseVehicleToPlayers; }; diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_unlockServerVehicle.sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_unlockServerVehicle.sqf index fd1caf6..c509107 100644 --- a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_unlockServerVehicle.sqf +++ b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_unlockServerVehicle.sqf @@ -12,12 +12,7 @@ // assumptions: there are no crew in vehicle. there are no players in vehicle. thus we can just be sure the owner is the server then set the lock locally #include "\q\addons\custom_server\Configs\blck_defines.hpp"; params["_vehicle"]; -//diag_log format["_fnc+unlockServerVehicle: _vehicle = %1 | typeOf _vehicle = %2 | crewCount _vehicle = %3",_vehicle,typeOf _vehicle,count(crew _vehicle)]; -//[_vehicle,"UNLOCKED"] remoteExec["setVehicleLock", owner _vehicle]; - -//if !((owner _vehicle) isEqualTo 2) then {_vehicle setOwner 2}; -//_vehicle lock 0; if (local _vehicle) then { _vehicle lock 1; @@ -26,5 +21,3 @@ else { [_vehicle, 1] remoteExecCall ["lock", _vehicle]; }; -//diag_log format["_fn_unlockServerVehicle: owner of vehicle %1 = %2",_vehicle, owner _vehicle]; -diag_log format["_fn_unlockServerVehicle: vehicle %1 lock state set to %2",_vehicle,locked _vehicle]; \ No newline at end of file diff --git a/@GMS/addons/custom_server/Configs/blck_configs.sqf b/@GMS/addons/custom_server/Configs/blck_configs.sqf index 771b371..e5b78c2 100644 --- a/@GMS/addons/custom_server/Configs/blck_configs.sqf +++ b/@GMS/addons/custom_server/Configs/blck_configs.sqf @@ -17,7 +17,7 @@ changing any of these variables may break the mission systemChat */ blck_locationBlackList = []; // Do not touch ... - blck_debugON = false; // Do not touch ... + blck_debugON = true; // Do not touch ... blck_debugLevel = 0; // Do not touch ... #ifdef blck_milServer if (true) exitWith @@ -75,7 +75,7 @@ // Client Offloading and Headless Client Configurations blck_useHC = true; // Experimental (death messages and rewards not yet working). // Credit to Defent and eraser for their excellent work on scripts to transfer AI to clients for which these settings are required. - blck_ai_offload_to_client = false; // forces AI to be transfered to player's PCs. Disable if you have players running slow PCs. + blck_ai_offload_to_client = true; // forces AI to be transfered to player's PCs. Disable if you have players running slow PCs. blck_ai_offload_notifyClient = false; // Set true if you want notifications when AI are offloaded to a client PC. Only for testing/debugging purposes. // TODO: set to false before release blck_limit_ai_offload_to_blckeagls = true; // when true, only groups spawned by blckeagls are evaluated. @@ -135,17 +135,19 @@ /////////////////////////////// // PLAYER PENALTIES /////////////////////////////// - + blck_RunGear = true; // When set to true, AI that have been run over will ve stripped of gear, and the vehicle will be given blck_RunGearDamage of damage. blck_RunGearDamage = 0.2; // Damage applied to player vehicle for each AI run over - blck_VK_Gear = true; // When set to true, AI that have been killed by a player in a vehicle in the list of forbidden vehicles or using a forbiden gun will be stripped of gear and the vehicle will be given blck_RunGearDamage of damage + blck_VK_Gear = false; // When set to true, AI that have been killed by a player in a vehicle in the list of forbidden vehicles or using a forbiden gun will be stripped of gear and the vehicle will be given blck_RunGearDamage of damage blck_VK_RunoverDamage = true; // when the AI was run over blck_RunGearDamage of damage will be applied to the killer's vehicle. blck_VK_GunnerDamage = false; // when the AI was killed by a gunner on a vehicle that is is in the list of forbidden vehicles, blck_RunGearDamage of damage will be applied to the killer's vehicle each time an AI is killed with a vehicle's gun. - blck_forbidenVehicles = ["B_MRAP_01_hmg_F","O_MRAP_02_hmg_F","I_MRAP_03_hmg_F","B_MRAP_01_hmg_F","O_MRAP_02_hmg_F"]; // Add any vehicles for which you wish to forbid vehicle kills + //blck_forbidenVehicles = ["B_MRAP_01_hmg_F","O_MRAP_02_hmg_F","I_MRAP_03_hmg_F","B_MRAP_01_hmg_F","O_MRAP_02_hmg_F"]; // Add any vehicles for which you wish to forbid vehicle kills + blck_forbidenVehicles = []; + // For a listing of the guns mounted on various land vehicles see the following link: https://community.bistudio.com/wiki/Arma_3_CfgWeapons_Vehicle_Weapons // HMG_M2 is mounted on the armed offroad that is spawned by Epoch - blck_forbidenVehicleGuns = ["LMG_RCWS","LMG_M200","HMG_127","HMG_127_APC","HMG_M2","HMG_NSVT","GMG_40mm","GMG_UGV_40mm","autocannon_40mm_CTWS","autocannon_30mm_CTWS","autocannon_35mm","LMG_coax","autocannon_30mm","HMG_127_LSV_01"]; // Add any vehicles for which you wish to forbid vehicle kills, o - + //blck_forbidenVehicleGuns = ["LMG_RCWS","LMG_M200","HMG_127","HMG_127_APC","HMG_M2","HMG_NSVT","GMG_40mm","GMG_UGV_40mm","autocannon_40mm_CTWS","autocannon_30mm_CTWS","autocannon_35mm","LMG_coax","autocannon_30mm","HMG_127_LSV_01"]; // Add any vehicles for which you wish to forbid vehicle kills, o + blck_forbidenVehicleGuns = []; /////////////////////////////// // MISC MISSION PARAMETERS @@ -187,7 +189,7 @@ _blck_armed_hurons = ["B_Heli_Transport_03_F","B_Heli_Transport_03_black_F"]; _blck_armed_attackHelis = ["B_Heli_Attack_01_F"]; _blck_armed_heavyAttackHelis = ["O_Heli_Attack_02_F","O_Heli_Attack_02_black_F"]; - _blck_fighters = [ + _blck_fighters = [ "O_Plane_CAS_02_F", // /ti-199 Neophron (CAS) "I_Plane_Fighter_03_AA_F", // A-143 Buzzard (AA) "I_Plane_Fighter_04_F", // A-149 Gryphon @@ -225,26 +227,16 @@ //////////////////// // Maximum number of missions shown on the map at any one time. - #ifdef GRGserver - blck_maxSpawnedMissions = 15; - #else // Change this value to reduce the number of spawned missions at any one time. blck_maxSpawnedMissions = 4; - #endif //Set to -1 to disable. Values of 2 or more force the mission spawner to spawn copies of that mission - this feature is not recommended because you may run out of available groups. blck_enableOrangeMissions = 1; - blck_enableGreenMissions = 2; + blck_enableGreenMissions = 1; blck_enableRedMissions = 2; - blck_enableBlueMissions = 2; + blck_enableBlueMissions = 1; blck_numberUnderwaterDynamicMissions = 3; // Values from -1 (no UMS) to N (N Underwater missions will be spawned; static UMS units and subs will be spawned. - #ifdef GRGserver - blck_enableHunterMissions = 1; - blck_enableScoutsMissions = 1; - blck_maxcrashsites = 3; - #endif - //////////////////// // MISSION TIMERS //////////////////// @@ -256,32 +248,20 @@ blck_TMin_Red = 150; blck_TMin_UMS = 180; - #ifdef GRGserver - blck_TMin_Hunter = 120; - blck_TMin_Scouts = 115; - blck_TMin_Crashes = 115; - #endif - //Maximum Spawn time between missions in seconds blck_TMax_Orange = 360; blck_TMax_Green = 300; blck_TMax_Blue = 200; blck_TMax_Red = 250; blck_TMax_UMS = 400; - - #ifdef GRGserver - blck_TMax_Hunter = 200; - blck_TMax_Scouts = 200; - blck_TMax_Crashes = 200; - #endif /////////////////////////////// // AI VEHICLE PATROL PARAMETERS /////////////////////////////// - blck_useVehiclePatrols = false; // When true vehicles will be spawned at missions and will patrol the mission area. + blck_useVehiclePatrols = true; // When true vehicles will be spawned at missions and will patrol the mission area. blck_killEmptyAIVehicles = false; // when true, the AI vehicle will be extensively damaged once all AI have gotten outor been killed. - blck_vehicleDeleteTimer = 120*60; + blck_vehicleDeleteTimer = 120*60; //////////////////// // Mission Vehicle Settings //////////////////// @@ -370,7 +350,7 @@ ]; ///////////////////////////////////////////// - + blck_groupBehavior = "SENTRY"; // Suggested choices are "SAD", "SENTRY", "AWARE" https://community.bistudio.com/wiki/ArmA:_AI_Combat_Modes blck_combatMode = "RED"; // Change this to "YELLOW" if the AI wander too far from missions for your tastes. blck_groupFormation = "WEDGE"; // Possibilities include "WEDGE","VEE","FILE","DIAMOND" @@ -442,67 +422,13 @@ ["aimingAccuracy",0.1],["aimingShake",0.5],["aimingSpeed",0.5],["endurance",0.50],["spotDistance",0.6],["spotTime",0.6],["courage",0.60],["reloadSpeed",0.60],["commanding",0.7],["general",0.60] ]; - // Add some money to AI; + // Add some money to AI; only works with Exile for now. blck_maxMoneyOrange = 25; blck_maxMoneyGreen = 20; blck_maxMoneyRed = 15; blck_maxMoneyBlue = 10; - #ifdef GRGserver - blck_AIAlertDistance = [250,450,650,800]; // Radius within which AI will be notified of enemy activity. Depricated as a group-sed system is used now. The group is informed of the enemy location when a group member is hit or killed. - //blck_AIAlertDistance = [150,225,400,500]; - // How precisely player locations will be revealed to AI after an AI kill - // values are ordered as follows [blue, red, green, orange]; - blck_AIIntelligence = [0.3, 0.5, 0.7, 0.9]; - - blck_baseSkill = 0.7; // The overal skill of the AI - range 0.1 to 1.0. - - /*************************************************************** - - MISSION TYPE SPECIFIC AI SETTINGS - - **************************************************************/ - //This defines the skill, minimum/Maximum number of AI and how many AI groups are spawned for each mission type - // Orange Missions - blck_MinAI_Orange = 20; - blck_MaxAI_Orange = 25; - blck_AIGrps_Orange = 5; - blck_SkillsOrange = [ - ["aimingAccuracy",[0.25,0.36]],["aimingShake",[0.45,0.55]],["aimingSpeed",[0.65,0.75]],["endurance",1.00],["spotDistance",1.0],["spotTime",0.7],["courage",1.00],["reloadSpeed",1.00],["commanding",1.00],["general",1.00] - ]; - - // Green Missions - blck_MinAI_Green = 16; - blck_MaxAI_Green = 21; - blck_AIGrps_Green = 4; - blck_SkillsGreen = [ - ["aimingAccuracy",[0.2,0.3]],["aimingShake",[0.4,0.5]],["aimingSpeed",[0.55,0.7]],["endurance",0.9],["spotDistance",0.9],["spotTime",0.65],["courage",0.9],["reloadSpeed",0.9],["commanding",0.9],["general",0.75] - ]; - - // Red Missions - blck_MinAI_Red = 12; - blck_MaxAI_Red = 15; - blck_AIGrps_Red = 3; - blck_SkillsRed = [ - ["aimingAccuracy",[0.2,0.25]],["aimingShake",[0.35,0.4]],["aimingSpeed",0.6],["endurance",0.80],["spotDistance",0.7],["spotTime",0.6],["courage",0.80],["reloadSpeed",0.70],["commanding",0.8],["general",0.70] - ]; - - // Blue Missions - blck_MinAI_Blue = 8; - blck_MaxAI_Blue = 12; - blck_AIGrps_Blue = 2; - blck_SkillsBlue = [ - ["aimingAccuracy",[0.08,16]],["aimingShake",[0.25,0.35]],["aimingSpeed",0.5],["endurance",0.50],["spotDistance",0.6],["spotTime",0.6],["courage",0.60],["reloadSpeed",0.60],["commanding",0.7],["general",0.60] - ]; - - // Add some money to AI; - blck_maxMoneyOrange = 25; - blck_maxMoneyGreen = 20; - blck_maxMoneyRed = 15; - blck_maxMoneyBlue = 10; - #endif - - if (toLower(blck_modType) isEqualTo "epoch") then + if (toLower(blck_modType) isEqualTo "epoch") then { diag_log format["[blckeagls] Loading Mission System using Parameters for %1",blck_modType]; execVM "\q\addons\custom_server\Configs\blck_configs_epoch.sqf"; diff --git a/@GMS/addons/custom_server/Configs/blck_configs_exile_mil - Namalks v146.sqf b/@GMS/addons/custom_server/Configs/blck_configs_exile_mil - Namalks v146.sqf index f273281..f8fbea7 100644 --- a/@GMS/addons/custom_server/Configs/blck_configs_exile_mil - Namalks v146.sqf +++ b/@GMS/addons/custom_server/Configs/blck_configs_exile_mil - Namalks v146.sqf @@ -51,7 +51,7 @@ AI WEAPONS, UNIFORMS, VESTS AND GEAR blck_useConfigsGeneratedLoadouts = true; blck_maximumItemPriceInAI_Loadouts = 1000; - blck_armed_vehicles_Exile = [ + _blck_armed_vehicles_Exile = [ "Exile_Car_BTR40_MG_Green", "Exile_Car_HMMWV_M134_Green", "Exile_Car_HMMWV_M2_Green", @@ -59,7 +59,7 @@ AI WEAPONS, UNIFORMS, VESTS AND GEAR "Exile_Car_Offroad_Armed_Guerilla01" ]; - blck_lightlyArmed_ARMA3 = [ + _blck_lightlyArmed_ARMA3 = [ "B_G_Offroad_01_armed_F", "O_G_Offroad_01_armed_F", "B_MRAP_01_gmg_F", @@ -72,7 +72,7 @@ AI WEAPONS, UNIFORMS, VESTS AND GEAR "I_APC_Wheeled_03_cannon_F" ]; - blck_tracked_APC_ARMA3 = [ + _blck_tracked_APC_ARMA3 = [ "B_APC_Tracked_01_rcws_F", "B_APC_Tracked_01_CRV_F", "B_APC_Tracked_01_AA_F", @@ -82,7 +82,7 @@ AI WEAPONS, UNIFORMS, VESTS AND GEAR "I_APC_tracked_03_cannon_F" ]; - blck_Tanks_ARMA3 = [ + _blck_Tanks_ARMA3 = [ //"B_MBT_01_arty_F", //"B_MBT_01_mlrs_F", "B_MBT_01_TUSK_F", @@ -189,13 +189,13 @@ AI WEAPONS, UNIFORMS, VESTS AND GEAR "B_LSV_01_armed_F" ]; - blck_AIPatrolVehiclesRed = blck_lightlyArmed_ARMA3 + _blck_APC_CUP; - blck_AIPatrolVehiclesGreen = blck_Tanks_ARMA3 + _blck_Tanks_CUP; - blck_AIPatrolVehiclesOrange = blck_Tanks_ARMA3 + _blck_Tanks_CUP; + blck_AIPatrolVehiclesRed = _blck_lightlyArmed_ARMA3 + _blck_APC_CUP; + blck_AIPatrolVehiclesGreen = _blck_Tanks_ARMA3 + _blck_Tanks_CUP; + blck_AIPatrolVehiclesOrange = _blck_Tanks_ARMA3 + _blck_Tanks_CUP; if (toLower(worldName) isEqualTo "namalsk") then { - = [ + _blck_lightlyArmed_ARMA3 = [ "B_G_Offroad_01_armed_F", "O_G_Offroad_01_armed_F", //"B_MRAP_01_gmg_F", @@ -208,7 +208,7 @@ AI WEAPONS, UNIFORMS, VESTS AND GEAR //"I_APC_Wheeled_03_cannon_F" ]; diag_log "blck)configs_exile_mil.sqf:: - > Using special settings for namalsk"; - blck_AIPatrolVehiclesRed = blck_lightlyArmed_ARMA3 + blck_AIPatrolVehiclesBlue; + blck_AIPatrolVehiclesRed = _blck_lightlyArmed_ARMA3 + blck_AIPatrolVehiclesBlue; blck_AIPatrolVehiclesGreen = blck_AIPatrolVehiclesRed; blck_AIPatrolVehiclesOrange = blck_AIPatrolVehiclesRed; }; diff --git a/@GMS/addons/custom_server/Configs/blck_configs_mil.sqf b/@GMS/addons/custom_server/Configs/blck_configs_mil.sqf index 482a7c5..7c2c8c3 100644 --- a/@GMS/addons/custom_server/Configs/blck_configs_mil.sqf +++ b/@GMS/addons/custom_server/Configs/blck_configs_mil.sqf @@ -213,13 +213,9 @@ //////////////////// // Maximum number of missions shown on the map at any one time. - #ifdef GRGserver - blck_maxSpawnedMissions = 15; - #else // Change this value to reduce the number of spawned missions at any one time. blck_maxSpawnedMissions = 4; - #endif - + //Set to -1 to disable. Values of 2 or more force the mission spawner to spawn copies of that mission - this feature is not recommended because you may run out of available groups. blck_enableOrangeMissions = 1; blck_enableGreenMissions = 1; @@ -227,12 +223,6 @@ blck_enableBlueMissions = 2; blck_numberUnderwaterDynamicMissions = 2; // Values from 0 (no UMS) to N (N Underwater missions will be spawned; static UMS units and subs will be spawned. - #ifdef GRGserver - blck_enableHunterMissions = 1; - blck_enableScoutsMissions = 2; - blck_maxcrashsites = 3; - #endif - //////////////////// // MISSION TIMERS //////////////////// @@ -243,12 +233,6 @@ blck_TMin_Blue = 120; blck_TMin_Red = 150; blck_TMin_UMS = 180; - #ifdef GRGserver - blck_TMin_Hunter = 120; - blck_TMin_Scouts = 115; - blck_TMin_Crashes = 115; - - #endif //Maximum Spawn time between missions in seconds blck_TMax_Orange = 360; @@ -256,11 +240,6 @@ blck_TMax_Blue = 200; blck_TMax_Red = 250; blck_TMax_UMS = 200; - #ifdef GRGserver - blck_TMax_Hunter = 200; - blck_TMax_Scouts = 200; - blck_TMax_Crashes = 200; - #endif /////////////////////////////// // AI VEHICLE PATROL PARAMETERS @@ -278,10 +257,10 @@ blck_SpawnVeh_Blue = 1; // Number of vehicles at Blue Missions blck_SpawnVeh_Red = 2; // Number of vehicles at Red Missions - blck_vehCrew_blue = 5; - blck_vehCrew_red = 5; - blck_vehCrew_green = 4; - blck_vehCrew_orange = 5; + blck_vehCrew_blue = 3; + blck_vehCrew_red = 3; + blck_vehCrew_green = 3; + blck_vehCrew_orange = 3; /////////////////////////////// // AI STATIC WEAPON Settings @@ -370,11 +349,6 @@ //This defines how long after an AI dies that it's body disappears. blck_bodyCleanUpTimer = 80*60; // time in seconds after which dead AI bodies are deleted - #ifdef GRGserver - #ifdef blck_milServer - blck_bodyCleanUpTimer = 80*60; // Trying to reduce lag with player counts > 20 - #endif - #endif // Each time an AI is killed, the location of the killer will be revealed to all AI within this range of the killed AI, set to -1 to disable // values are ordered as follows [blue, red, green, orange]; @@ -434,60 +408,6 @@ blck_maxMoneyRed = 30; blck_maxMoneyBlue = 20; - #ifdef GRGserver - blck_AIAlertDistance = [250,425,650,800]; // Radius within which AI will be notified of enemy activity. Depricated as a group-sed system is used now. The group is informed of the enemy location when a group member is hit or killed. - //blck_AIAlertDistance = [150,225,400,500]; - // How precisely player locations will be revealed to AI after an AI kill - // values are ordered as follows [blue, red, green, orange]; - blck_AIIntelligence = [0.3, 0.5, 0.7, 0.9]; - - blck_baseSkill = 1; // The overal skill of the AI - range 0.1 to 1.0. - - /*************************************************************** - - MISSION TYPE SPECIFIC AI SETTINGS - - **************************************************************/ - //This defines the skill, minimum/Maximum number of AI and how many AI groups are spawned for each mission type - // Orange Missions - blck_MinAI_Orange = 30; - blck_MaxAI_Orange = 35; - blck_AIGrps_Orange = 5; - blck_SkillsOrange = [ - ["aimingAccuracy",0.6],["aimingShake",0.9],["aimingSpeed",0.9],["endurance",1.00],["spotDistance",1.0],["spotTime",1.0],["courage",1.00],["reloadSpeed",1.00],["commanding",1.00],["general",1.00] - ]; - - // Green Missions - blck_MinAI_Green = 26; - blck_MaxAI_Green = 31; - blck_AIGrps_Green = 4; - blck_SkillsGreen = [ - ["aimingAccuracy",0.55],["aimingShake",0.75],["aimingSpeed",0.85],["endurance",0.9],["spotDistance",0.9],["spotTime",0.9],["courage",0.9],["reloadSpeed",0.9],["commanding",0.9],["general",0.75] - ]; - - // Red Missions - blck_MinAI_Red = 12; - blck_MaxAI_Red = 18; - blck_AIGrps_Red = 3; - blck_SkillsRed = [ - ["aimingAccuracy",0.4],["aimingShake",0.6],["aimingSpeed",0.6],["endurance",0.80],["spotDistance",0.7],["spotTime",0.8],["courage",0.80],["reloadSpeed",0.70],["commanding",0.8],["general",0.70] - ]; - - // Blue Missions - blck_MinAI_Blue = 8; - blck_MaxAI_Blue = 14; - blck_AIGrps_Blue = 2; - blck_SkillsBlue = [ - ["aimingAccuracy",0.12],["aimingShake",0.3],["aimingSpeed",0.5],["endurance",0.50],["spotDistance",0.6],["spotTime",0.6],["courage",0.60],["reloadSpeed",0.60],["commanding",0.7],["general",0.60] - ]; - - // Add some money to AI; only works with Exile for now. - blck_maxMoneyOrange = 25; - blck_maxMoneyGreen = 20; - blck_maxMoneyRed = 15; - blck_maxMoneyBlue = 10; - #endif - if (toLower(blck_modType) isEqualTo "epoch") then { diag_log format["[blckeagls] Loading Mission System using Parameters for %1 for militarized servers",blck_modType]; diff --git a/@GMS/addons/custom_server/Configs/blck_custom_config.sqf b/@GMS/addons/custom_server/Configs/blck_custom_config.sqf index d9f0454..62c87fb 100644 --- a/@GMS/addons/custom_server/Configs/blck_custom_config.sqf +++ b/@GMS/addons/custom_server/Configs/blck_custom_config.sqf @@ -151,26 +151,23 @@ if (blck_debugON || (blck_debugLevel > 0)) then // These variables are found in blck_enableOrangeMissions = 1; blck_enableGreenMissions = 1; blck_enableRedMissions = 1; - blck_enableBlueMissions = -1; - blck_numberUnderwaterDynamicMissions = -3; + blck_enableBlueMissions = 1; + blck_numberUnderwaterDynamicMissions = 1; blck_enableHunterMissions = -1; blck_enableScoutsMissions = -1; blck_maxCrashSites = -3; //blck_killEmptyStaticWeapons = false; //blck_killEmptyAIVehicles = true; - //blck_cleanupCompositionTimer = 20; // Time after mission completion at which items in the composition are deleted. - //blck_AliveAICleanUpTimer = 20; // Time after mission completion at which any remaining live AI are deleted. - //blck_bodyCleanUpTimer = 20; - //blck_vehicleDeleteTimer = 20; + blck_cleanupCompositionTimer = 20; // Time after mission completion at which items in the composition are deleted. + blck_AliveAICleanUpTimer = 20; // Time after mission completion at which any remaining live AI are deleted. + blck_bodyCleanUpTimer = 20; + blck_vehicleDeleteTimer = 20; //blck_MissionTimeout = 30; - blck_noPatrolHelisOrange = 1; - blck_chanceHeliPatrolOrange = 1; - blck_chanceParaOrange = 1; - blck_chanceHeliPatrolGreen = 1; - blck_chanceParaGreen = 1; - //blck_chanceHeliPatrolRed = -1; + //blck_noPatrolHelisOrange = 1; + //blck_chanceHeliPatrolOrange = 1; + //blck_chanceParaOrange = 1; //blck_chanceHeliPatrolBlue = -1; //blck_noPatrolHelisBlue = -1; //blck_chanceParaBlue = -1; // [0 - 1] set to 0 to deactivate and 1 to always have paratroops spawn over the center of the mission. This value can be a range as well [0.1,0.3] @@ -181,12 +178,12 @@ if (blck_debugON || (blck_debugLevel > 0)) then // These variables are found in //blck_SpawnEmplaced_Orange = 1; // Number of static weapons at Orange Missions //blck_SpawnEmplaced_Green = 1; // Number of static weapons at Green Missions //blck_SpawnEmplaced_Blue = 1; // Number of static weapons at Blue Missions - //blck_SpawnEmplaced_Red = -1; + //blck_SpawnEmplaced_Red = 1; //blck_SpawnVeh_Orange = 1; // Number of vehicles at Orange Missions //blck_SpawnVeh_Green = 1; // Number of vehicles at Green Missions //blck_SpawnVeh_Blue = 1; // Number of vehicles at Blue Missions - //blck_SpawnVeh_Red = 1; + blck_SpawnVeh_Red = 1; blck_TMin_Blue = 7; blck_TMin_Red = 10; diff --git a/@GMS/addons/custom_server/Configs/blck_defines.hpp b/@GMS/addons/custom_server/Configs/blck_defines.hpp index 7fab635..e0fa2b7 100644 --- a/@GMS/addons/custom_server/Configs/blck_defines.hpp +++ b/@GMS/addons/custom_server/Configs/blck_defines.hpp @@ -11,22 +11,20 @@ http://creativecommons.org/licenses/by-nc-sa/4.0/ */ - #define useAPEX -#define blck_milServer +//#define blck_milServer //#define blck_useCUP //#define blck_useRHS -#define blck_useLAGO +//#define blck_useLAGO //////////////////////////// // Do not touch anything below this line /////////////////////////// //#define blck_debugMode -#define GRGserver +//#define GRGserver //#define blck_addCarParts #define blck_triggerLoopCompleteTime 40*60 - #define onFoot 1 #define inVehicle 2 diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_AddAircraft.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_AddAircraft.sqf new file mode 100644 index 0000000..2aed2f4 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_AddAircraft.sqf @@ -0,0 +1,17 @@ +/* + by Ghostrider [GRG] + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +//diag_log format["_sm_addAircraft: _this = %5",_this]; +params["_aircraftPatrol"]; +//diag_log format["_sm_addAircraft: _aircraftPatrol = %1",_aircraftPatrol]; +blck_sm_Aircraft pushBack [_aircraftPatrol,grpNull,0]; +//diag_log format["_sm_addAircraft: updated blck_sm_Aircraft = %1",blck_sm_Aircraft]; +true diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_AddEmplaced.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_AddEmplaced.sqf new file mode 100644 index 0000000..01d7722 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_AddEmplaced.sqf @@ -0,0 +1,16 @@ +/* + by Ghostrider [GRG] + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +params["_emplacedWeapon"]; +blck_sm_Emplaced pushBack [_emplacedWeapon,grpNull,0]; +diag_log format["_sm_AddEmplaced::-> _emplacedWeapon = %1, blck_sm_Emplaced = %2",_emplacedWeapon,blck_sm_Emplaced]; +true \ No newline at end of file diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_AddGroup.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_AddGroup.sqf new file mode 100644 index 0000000..49abe09 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_AddGroup.sqf @@ -0,0 +1,16 @@ +/* + by Ghostrider [GRG] + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +params["_group"]; +blck_sm_Groups pushBack [_group,grpNull,0]; +diag_log format["_sm_AddGroup:: blck_sm_Groups = %1",blck_sm_Groups]; +true \ No newline at end of file diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_AddGroupToArray.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_AddGroupToArray.sqf new file mode 100644 index 0000000..4efaebc --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_AddGroupToArray.sqf @@ -0,0 +1,22 @@ +/* + by Ghostrider [GRG] + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +params["_array","_patrolInformation",["_timesToRespawn",-1]]; +waitUntil {blck_sm_monitoring isEqualTo 0}; +_array pushBack [ + _patrolInformation, + grpNull, + 0, // groupSpawned + 0, // times Spawned + 0, // Respawn At + _timesToRespawn // Max Times to Respawn +]; +_array diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_AddVehicle.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_AddVehicle.sqf new file mode 100644 index 0000000..47dd046 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_AddVehicle.sqf @@ -0,0 +1,16 @@ +/* + by Ghostrider [GRG] + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +params["_vehicle"]; +blck_sm_Vehicles pushBack [_vehicle,grpNull,0]; +//diag_log format["_fnc_sm_AddVehicle: _vehicle = %1",_vehicle]; +true \ No newline at end of file diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_init_functions.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_init_functions.sqf new file mode 100644 index 0000000..73661a5 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_init_functions.sqf @@ -0,0 +1,80 @@ +/* + by Ghostrider [GRG] + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +//diag_log "[blckeagls] GMS_fnc_sm_init_functions.sqf "; +//blck_sm_Groups = []; +blck_sm_Infantry = []; +blck_sm_Vehicles = []; +blck_sm_Aircraft = []; +blck_sm_Emplaced = []; +blck_sm_scubaGroups = []; +blck_sm_surfaceShips = []; +blck_sm_submarines = []; +blck_sm_lootContainers = []; +blck_sm_garrisonBuildings_ASL = []; +blcl_sm_garrisonBuilding_relPos = []; + +blck_fnc_sm_AddGroupToArray = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_AddGroupToArray.sqf"; + +/* +blck_fnc_sm_AddGroup = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_AddGroup.sqf"; +blck_fnc_sm_AddVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_AddVehicle.sqf"; +blck_fnc_sm_AddAircraft = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_AddAircraft.sqf"; +blck_fnc_sm_AddEmplaced = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_AddEmplaced.sqf"; +*/ +private _functions = [ + //["blck_fnc_sm_monitorStaticUnits","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorStaticPatrols.sqf"], + ["blck_fnc_sm_monitorInfantry","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorInfantry.sqf"], + ["blck_fnc_sm_monitorScuba","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorScuba.sqf"], + ["blck_fnc_sm_monitorVehicles","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorVehicles.sqf"], + ["blck_fnc_sm_monitorAircraft","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorAircraft.sqf"], + ["blck_fnc_sm_monitorShips","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorShips.sqf"], + ["blck_fnc_sm_monitorSubs","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorSubs.sqf"], + ["blck_fnc_sm_monitorEmplaced","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorEmplaced.sqf"], + ["blck_fnc_sm_monitorGarrisonsASL","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorGarrisonsASL.sqf"], + ["blck_fnc_sm_monitorGarrisons_relPos","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorGarrisons_relPos.sqf"], + ["blck_fnc_sm_spawnVehiclePatrol","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnVehiclePatrol.sqf"], + ["blck_fnc_sm_spawnAirPatrol","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnAirPatrol.sqf"], + ["blck_fnc_sm_spawnEmplaced","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnEmplaced.sqf"], +// ["blck_fnc_sm_spawnInfantryPatrol","\q\addons\custom_server\Missions\Static\Code\GMS_sm_spawnInfantryPatrol.sqf"], + ["blck_fnc_sm_staticPatrolMonitor","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_staticPatrolMonitor.sqf"], +// ["blck_fnc_sm_checkForPlayerNearMission","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_checkForPlayerNearMission.sqf"], + ["blck_fnc_sm_spawnAirPatrols","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnAirPatrols.sqf"], + ["blck_fnc_sm_spawnEmplaceds","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnEmplaced.sqf"], + ["blck_fnc_sm_spawnInfantryPatrols","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnInfantryPatrols.sqf"], + ["blck_fnc_sm_spawnLootContainers","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnLootContainers.sqf"], + ["blck_fnc_sm_spawnObjects","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnObjects.sqf"], + ["blck_fnc_sm_spawnVehiclePatrols","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnVehiclePatrols.sqf"], + ["blck_fnc_sm_spawnBuildingGarrison_ASL","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnBuildingGarrisonASL.sqf"], + ["blck_fnc_sm_spawnBuildingGarrison_relPos","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnBuildingGarrison_relPos.sqf"], + ["blck_fnc_sm_spawnObjectASLVectorDirUp","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnObjectASLVectorDirUp.sqf"], + ["blck_fnc_spawnScubaGroup","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_spawnScubaGroup.sqf"], + ["blck_fnc_spawnSDVPatrol","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_spawnSDVPatrol.sqf"], + ["blck_fnc_spawnSurfacePatrol","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_spawnSurfacePatrol.sqf"], + //["blck_fnc_sm_AddScubaGroup","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_AddScubaGroup.sqf"], + //["blck_fnc_sm_AddSurfaceVehicle","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_AddSurfaceVehicle.sqf"], + ["blck_fnc_sm_AddSDVVehicle","\q\addons\custom_server\Missions\Static\Code\GMS_sm_AddSDVVehicle.sqf"] +]; +{ + _x params ["_name","_path"]; + missionnamespace setvariable [_name,compileFinal preprocessFileLineNumbers _path]; +} foreach _functions; + +diag_log "[blckeagls] GMS_sm_init_functions.sqf "; + + +/* +blck_fnc_spawnScubaGroup = compileFinal preprocessFileLineNumbers "q\addons\custom_server\Missions\UMS\code\GMS_fnc_spawnScubaGroup.sqf"; +blck_fnc_spawnSDVPatrol = compileFinal preprocessFileLineNumbers "q\addons\custom_server\Missions\UMS\code\GMS_fnc_spawnSDVPatrol.sqf"; +blck_fnc_spawnSurfacePatrol = compileFinal preprocessFileLineNumbers "q\addons\custom_server\Missions\UMS\code\GMS_fnc_spawnSurfacePatrol.sqf"; +blck_fnc_sm_AddScubaGroup = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\UMS\code\GMS_sm_AddScubaGroup.sqf"; +blck_fnc_sm_AddSurfaceVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\UMS\code\GMS_sm_AddSurfaceVehicle.sqf"; +blck_fnc_sm_AddSDVVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\UMS\code\GMS_sm_AddSDVVehicle.sqf"; diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_initializeMission.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_initializeMission.sqf new file mode 100644 index 0000000..c0fe1b9 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_initializeMission.sqf @@ -0,0 +1,88 @@ +/* + by Ghostrider [GRG] + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +params["_mission"]; +// Spawn landscape +// params["_objects"]; +if (isNil "_markerColor") then {_markerColor = "ColorBlack"}; +if (isNil "_markerType") then {_markerType = ["mil_box",[]]}; +if (isNil "_missionLandscape") then {_missionLandscape = []}; +if (isNil "_garrisonedBuilding_ASLsystem") then { + //diag_log "_fnc_sm_initializeMission: _garrisonedBuilding_ASLsystem set to []"; + _garrisonedBuilding_ASLsystem = []; + }; +if (isNil "_garrisonedBuildings_BuildingPosnSystem") then { + //diag_log "_fnc_sm_initializeMission: _garrisonedBuildings_BuildingPosnSystem set to []"; + _garrisonedBuildings_BuildingPosnSystem = []; + }; +if (isNil "_airPatrols") then {_airPatrols = []}; +if (isNil "_aiGroupParameters") then {_aiGroupParameters = []}; +if (isNil "_missionEmplacedWeapons") then {_missionEmplacedWeapons = []}; +if (isNil "_vehiclePatrolParameters") then {_vehiclePatrolParameters = []}; +if (isNil "_missionLootVehicles") then {_missionLootVehicles = []}; + +_markerClass = format["static%1",floor(random(1000000))]; +_blck_localMissionMarker = [_markerClass,_missionCenter,"","",_markerColor,_markerType]; +if (blck_labelMapMarkers select 0) then +{ + _blck_localMissionMarker set [2, _markerMissionName]; +}; +if !(blck_preciseMapMarkers) then +{ + _blck_localMissionMarker set [1,[_missionCenter,75] call blck_fnc_randomPosition]; +}; +_blck_localMissionMarker set [3,blck_labelMapMarkers select 1]; // Use an arrow labeled with the mission name? +[_blck_localMissionMarker] call blck_fnc_spawnMarker; + +[_missionLandscape] call blck_fnc_sm_spawnObjects; + +{ + //diag_log format["processing _garrisonedBuilding_ASL %1 which = %2",_forEachIndex,_x]; + // ["Land_i_House_Big_02_V2_F",[23650.3,18331.9,3.19],[[0,1,0],[0,0,1]],[true,true],"Red", + _x params["_buildingClassName","_buildingPosnASL","_buildingVectorDirUp","_buildingDamSim","_aiDifficulty","_staticsASL","_unitsASL","_respawnTimer","_noRespawns"]; + private _building = [_buildingClassName,_buildingPosnASL,_buildingVectorDirUp,_buildingDamSim] call blck_fnc_sm_spawnObjectASLVectorDirUp; + [blck_sm_garrisonBuildings_ASL,[_building,_aiDifficulty,_staticsASL,_unitsASL,_respawnTimer,_noRespawns]] call blck_fnc_sm_AddGroupToArray; + //diag_log format["_fnc_sm_initializeMission: blck_sm_garrisonBuildings_ASL updated to: %1",blck_sm_garrisonBuildings_ASL]; +}forEach _garrisonedBuilding_ASLsystem; + +// blcl_sm_garrisonBuilding_relPos +{ + //diag_log format["processing _garrisonedBuilding_relPos %1 which = %2",_forEachIndex,_x]; + _x params["_buildingClassName","_buildingPosnASL","_buildingVectorDirUp","_buildingDamSim","_aiDifficulty","_p","_noStatics","_typesStatics","_noUnits","_respawnTimer","_noRespawns"]; + private _building = [_buildingClassName,_buildingPosnASL,_buildingVectorDirUp,_buildingDamSim] call blck_fnc_sm_spawnObjectASLVectorDirUp; + [blcl_sm_garrisonBuilding_relPos,[_building,_aiDifficulty,_noStatics,_typesStatics,_noUnits,_respawnTimer,_noRespawns]] call blck_fnc_sm_AddGroupToArray; + //diag_log format["_fnc_sm_initializeMission: blcl_sm_garrisonBuilding_relPos updated to: %1",blcl_sm_garrisonBuilding_relPos]; +}forEach _garrisonedBuildings_BuildingPosnSystem; + +{ + [blck_sm_Aircraft,_x] call blck_fnc_sm_AddGroupToArray; + +}forEach _airPatrols; +//uiSleep 1; + +{ + [blck_sm_Infantry,_x] call blck_fnc_sm_AddGroupToArray; +}forEach _aiGroupParameters; + +{ + [blck_sm_Emplaced,_x] call blck_fnc_sm_AddGroupToArray; +}forEach _missionEmplacedWeapons; + +{ + [blck_sm_Vehicles,_x] call blck_fnc_sm_AddGroupToArray; +}forEach _vehiclePatrolParameters; + +uiSleep 30; +// spawn loot chests +[_missionLootBoxes,_missionCenter] call blck_fnc_sm_spawnLootContainers; +[_missionLootVehicles,_missionCenter] call blck_fnc_sm_spawnLootContainers; +diag_log format["[blckeagls] Static Mission Spawner: Mission %1 spawned",_mission]; + diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorAircraft.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorAircraft.sqf new file mode 100644 index 0000000..325b8d2 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorAircraft.sqf @@ -0,0 +1,93 @@ +/* + by Ghostrider [GRG] + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ + +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +//private["_mode","_sm_groups"]; +//_sm_groups = +blck_sm_Aircraft; +//diag_log format["_fnc_monitorAircraft: time %2 | blck_sm_Aircraft %1",blck_sm_Aircraft,diag_tickTime]; +for "_i" from 1 to (count blck_sm_Aircraft) do +{ + if (_i == (count blck_sm_Aircraft)) exitWith {}; + private _element = blck_sm_Aircraft deleteAt 0; + _element params["_groupParameters","_group","_groupSpawned","_timesSpawned","_respawnAt","_maxRespawns"]; + //diag_log format["_fnc_monitorAircraft: _x %1",_element]; + //diag_log format["_fnc_monitorAircraft: _groupParameters = %1",_groupParameters]; + //diag_log format["_fnc_monitorAircraft (9): _group %1 | _groupSpawned %2 | _timesSpawned %3 | _respawnAt %4",_group,_groupSpawned,_timesSpawned,_respawnAt]; + _groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnTime"]; + _groupParameters params["_aircraftType","_pos","_difficulty","_patrolRadius","_respawnTime"]; + //diag_log format["_fnc_monitorAircraft: _aircraftType | %1 | _pos = %2 | _difficulty = %3 | _patrolRadius = %4 | _respawnTime = %5",_aircraftType,_pos,_difficulty,_patrolRadius,_respawnTime]; + + if (!(isNull _group) && {alive _x} count (units _group) == 0) then + { + deleteGroup _group; + _group = grpNull; + }; + if (isNull _group) then + { + _mode = -1; + if ((_timesSpawned == 0) && (_groupSpawned == 0)) then {_mode = 1}; // spawn-respawn + if (_timesSpawned > 0) then + { + if ((_groupSpawned == 1) && (_respawnTime == 0)) then {_mode = 0}; // remove patrol from further evaluation + if ((_timesSpawned > _maxRespawns) && (_maxRespawns != -1)) then {_mode = 0}; + if ((_groupSpawned == 1) && (_respawnTime > 0)) then {_mode = 2}; // set up for respawn at a later time + if ((_groupSpawned == 0) && (diag_tickTime > _respawnAt)) then {_mode = 1}; + }; + switch (_mode) do + { + case 0: {}; + case 1: { + + if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then + { + _return = [_pos,_difficulty,[_aircraftType]] call blck_fnc_spawnMissionHeli; + _group = group (driver (_return select 0)); + _element set[patrolGroup,_group]; + _element set[groupSpawned,1]; + _element set[timesSpawned,_timesSpawned + 1]; + _element set[respawnAt,0]; + }; + blck_sm_Aircraft pushBack _element; + }; + case 2: { + _element set[respawnAt,diag_tickTime + _respawnTime]; + _element set[groupSpawned,0]; + blck_sm_Aircraft pushBack _element; + //diag_log format["_fnc_monitorAircraft: update respawn time to %1",_respawnAt]; + }; + default {}; + }; + //diag_log format["_fnc_monitorAircraft(56) respawn conditions evaluated : _group = %1 | _groupSpawned = %2 | _timesSpawned = %3",_group,_groupSpawned,_timesSpawned]; + } else { + //diag_log format["_fnc_monitorAircraft: diag_tickTime = %1 | playerNearAt = %2",diag_tickTime,_group getVariable["playerNearAt",-1]]; + if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then + { + _group setVariable["playerNearAt",diag_tickTime]; + //diag_log format["_fnc_monitorAircraft: playerNearAt updated to %1",_group getVariable["playerNearAt",-1]]; + blck_sm_Aircraft pushBack _element; + } else { + if (diag_tickTime > (_group getVariable["playerNearAt",diag_tickTime]) + blck_sm_groupDespawnTime) then + { + //diag_log format["_fnc_monitorAircraft: despanwing patrol for _element %1",_element]; + //_groupParameters set [2, {alive _x} count (units _group)]; + private _veh = vehicle (leader _group); + {deleteVehicle _x} forEach (units _group); + deleteGroup _group; + [_veh] call blck_fnc_destroyVehicleAndCrew; + _element set[groupParameters,_groupParameters]; + _element set[patrolGroup ,grpNull]; + _element set[timesSpawned,(_timesSpawned - 1)]; + _element set[groupSpawned,0]; + }; + blck_sm_Aircraft pushBack _element; + }; + }; +}; \ No newline at end of file diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorEmplaced.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorEmplaced.sqf new file mode 100644 index 0000000..a4cb16b --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorEmplaced.sqf @@ -0,0 +1,92 @@ +/* + by Ghostrider [GRG] + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +//diag_log format["_fnc_monitorEmplaced: time %2 | blck_sm_Emplaced %1",blck_sm_Emplaced,diag_tickTime]; +for "_i" from 0 to (count blck_sm_Emplaced) do +{ + if (_i >= (count blck_sm_Emplaced)) exitWith {}; + private _element = blck_sm_Emplaced deleteAt 0; + _element params["_groupParameters","_group","_groupSpawned","_timesSpawned","_respawnAt","_maxRespawns"]; + //diag_log format["_fnc_monitorEmplaced: _element %1",_element]; + //diag_log format["_fnc_monitorEmplaced: _groupParameters = %1",_groupParameters]; + //diag_log format["_fnc_monitorEmplaced (9): _group %1 | _groupSpawned %2 | _timesSpawned %3 | _respawnAt %4",_group,_groupSpawned,_timesSpawned,_respawnAt]; + _groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnTime"]; + _groupParameters params["_vehicleType","_pos","_difficulty","_patrolRadius","_respawnTime"]; + //diag_log format["_fnc_monitorEmplaced: _vehicleType | %1 | _pos = %2 | _difficulty = %3 | _patrolRadius = %4 | _respawnTime = %5",_vehicleType,_pos,_difficulty,_patrolRadius,_respawnTime]; + + if (!(isNull _group) && {alive _x} count (units _group) == 0) then + { + deleteGroup _group; + _group = grpNull; + }; + if (isNull _group) then + { + _mode = -1; + if ((_timesSpawned == 0) && (_groupSpawned == 0)) then {_mode = 1}; // spawn-respawn + if (_timesSpawned > 0) then + { + if ((_groupSpawned == 1) && (_respawnTime == 0)) then {_mode = 0}; // remove patrol from further evaluation + if ((_timesSpawned > _maxRespawns) && (_maxRespawns != -1)) then {_mode = 0}; + if ((_groupSpawned == 1) && (_respawnTime > 0)) then {_mode = 2}; // set up for respawn at a later time + if ((_groupSpawned == 0) && (diag_tickTime > _respawnAt)) then {_mode = 1}; + }; + switch (_mode) do + { + case 0: {}; + case 1: { + + if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then + { + // params["_coords","_missionEmplacedWeapons","_useRelativePos","_noEmplacedWeapons","_aiDifficultyLevel",["_uniforms",[]], ["_headGear",[]],["_vests",[]],["_backpacks",[]],["_weaponList",[]],["_sideArms",[]]]; + private _return = [_pos,[_groupParameters],false,1,_difficulty] call blck_fnc_spawnEmplacedWeaponArray; + _group = group( (_return select 1) select 0); + _element set[patrolGroup,_group]; + _element set[groupSpawned,1]; + _element set[timesSpawned,_timesSpawned + 1]; + _element set[respawnAt,0]; + }; + blck_sm_Emplaced pushBack _element; + }; + case 2: { + _element set[respawnAt,diag_tickTime + _respawnTime]; + _element set[groupSpawned,0]; + blck_sm_Emplaced pushBack _element; + //diag_log format["_fnc_monitorEmplaced: update respawn time to %1",_respawnAt]; + }; + default {}; + }; + //diag_log format["_fnc_monitorEmplaced(56) respawn conditions evaluated : _group = %1 | _groupSpawned = %2 | _timesSpawned = %3",_group,_groupSpawned,_timesSpawned]; + } else { + //diag_log format["_fnc_monitorEmplaced: diag_tickTime = %1 | playerNearAt = %2",diag_tickTime,_group getVariable["playerNearAt",-1]]; + if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then + { + _group setVariable["playerNearAt",diag_tickTime]; + //diag_log format["_fnc_monitorEmplaced: playerNearAt updated to %1",_group getVariable["playerNearAt",-1]]; + blck_sm_Emplaced pushBack _element; + } else { + if (diag_tickTime >= (_group getVariable["playerNearAt",diag_tickTime]) + blck_sm_groupDespawnTime) then + { + //diag_log format["_fnc_monitorEmplaced: despanwing patrol for _element %1",_element]; + //_groupParameters set [2, {alive _x} count (units _group)]; + private _veh = vehicle (leader _group); + {deleteVehicle _x} forEach (units _group); + deleteGroup _group; + [_veh] call blck_fnc_destroyVehicleAndCrew; + _element set[groupParameters,_groupParameters]; + _element set[patrolGroup ,grpNull]; + _element set[timesSpawned,(_timesSpawned - 1)]; + _element set[groupSpawned,0]; + }; + blck_sm_Emplaced pushBack _element; + }; + }; +}; \ No newline at end of file diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorGarrisonsASL.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorGarrisonsASL.sqf new file mode 100644 index 0000000..b48d478 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorGarrisonsASL.sqf @@ -0,0 +1,97 @@ +/* + by Ghostrider [GRG] + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +private["_mode","_sm_groups"]; +//diag_log format["_fnc_sm_monitorGarrisonASL: blck_fnc_spawnGarrisonInsideBuilding_ATL = %1",blck_sm_garrisonBuildings_ASL]; +if (blck_sm_garrisonBuildings_ASL isEqualTo []) exitWith {}; +for "_i" from 0 to (count blck_sm_garrisonBuildings_ASL) do + { + if (_i >= (count blck_sm_garrisonBuildings_ASL)) exitWith {}; + private _element = blck_sm_garrisonBuildings_ASL deleteAt 0; + _element params["_groupParameters","_group","_groupSpawned","_timesSpawned","_respawnAt"]; + // ["_building","_aiDifficultyLevel","_staticsATL","_unitsATL"]; + _groupParameters params['_building','_aiDifficulty','_staticsASL','_unitsASL','_respawnTime','_maxRespawns']; + //diag_log format["_fnc_sm_monitorGarrisonASL: _group = %1 | _timesSpawned = %2 | _respawnTime = %3 | _respawnAt = %4 | _groupSpawned = %5",_group,_timesSpawned,_respawnTime,_respawnAt,_groupSpawned]; + private _pos = position _building; + if (!(isNull _group) && {alive _x} count (units _group) == 0) then + { + deleteGroup _group; + _group = grpNull; + }; + if (isNull _group) then + { + _mode = -1; + if ((_timesSpawned == 0) && (_groupSpawned == 0)) then {_mode = 1}; // spawn-respawn + if (_timesSpawned > 0) then + { + if ((_groupSpawned == 1) && (_respawnTime == 0)) then {_mode = 0}; // remove patrol from further evaluation + if ((_timesSpawned > _maxRespawns) && (_maxRespawns != -1)) then {_mode = 0}; + if ((_groupSpawned == 1) && (_respawnTime > 0)) then {_mode = 2}; // set up for respawn at a later time + if ((_groupSpawned == 0) && (diag_tickTime > _respawnAt)) then {_mode = 1}; + }; + switch (_mode) do + { + case 0: {}; + case 1: { + + if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then + { + // ["_building","_aiDifficultyLevel","_staticsATL","_unitsATL"] + //diag_log format + private _group = [_building,_aiDifficulty,_staticsASL,_unitsASL] call blck_fnc_sm_spawnBuildingGarrison_ASL; + _timesSpawned = _timesSpawned + 1; + _groupSpawned = 1; + _respawnAt = 0; + _element set[patrolGroup,_group]; + _element set[groupSpawned,1]; + _element set[timesSpawned,_timesSpawned]; + _element set[respawnAt,_respawnAt]; + //blck_sm_garrisonBuildings_ASL set[blck_sm_garrisonBuildings_ASL find _x,_element]; + }; + blck_sm_garrisonBuildings_ASL pushBack _element; + }; + case 2: { + _groupSpawned = 0; + _respawnAt = diag_tickTime + _respawnTime; + _element set[respawnAt,_respawnAt]; + _element set[groupSpawned,_groupSpawned]; + //blck_sm_garrisonBuildings_ASL set[blck_sm_garrisonBuildings_ASL find _x,_element]; + blck_sm_garrisonBuildings_ASL pushBack _element; + }; + default {}; + }; + + } else { + + if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then + { + _group setVariable["playerNearAt",diag_tickTime]; + blck_sm_garrisonBuildings_ASL pushBack _element; + } else { + if (diag_tickTime > (_group getVariable["playerNearAt",diag_tickTime]) + blck_sm_groupDespawnTime) then + { + + //_groupParameters set [2, {alive _x} count (units _group)]; + private _veh = vehicle (leader _group); + {deleteVehicle _x} forEach (units _group); + deleteGroup _group; + [_veh] call blck_fnc_destroyVehicleAndCrew; + _element set[groupParameters,_groupParameters]; + _element set[patrolGroup ,grpNull]; + _element set[timesSpawned,(_timesSpawned - 1)]; + _element set[groupSpawned,0]; + //blck_sm_garrisonBuildings_ASL set[(blck_sm_garrisonBuildings_ASL find _x), _element]; + + }; + blck_sm_garrisonBuildings_ASL pushBack _element; + }; + }; +}; \ No newline at end of file diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorGarrisons_relPos.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorGarrisons_relPos.sqf new file mode 100644 index 0000000..af99c94 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorGarrisons_relPos.sqf @@ -0,0 +1,89 @@ +/* + by Ghostrider [GRG] + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +private["_mode","_sm_groups","_pos","_element"]; +if (blck_fnc_sm_spawnBuildingGarrison_relPos isEqualTo []) exitWith {}; +_sm_groups = +blcl_sm_garrisonBuilding_relPos; + +{ + _x params["_groupParameters","_group","_groupSpawned","_timesSpawned","_respawnAt"]; + // [_building,_aiDifficulty,_noStatics,_typesStatics,_noUnits,_respawn] + _groupParameters params['_building','_aiDifficulty','_noStatics','_typesStatics','_noUnits','_respawnTime','_maxRespawns']; + _element = +_x;// + _pos = position _building; + if (!(isNull _group) && {alive _x} count (units _group) == 0) then + { + deleteGroup _group; + _group = grpNull; + }; + if (isNull _group) then + { + _mode = -1; + if ((_timesSpawned == 0) && (_groupSpawned == 0)) then {_mode = 1}; // spawn-respawn + if (_timesSpawned > 0) then + { + if ((_groupSpawned == 1) && (_respawnTime == 0)) then {_mode = 0}; // remove patrol from further evaluation + if ((_timesSpawned > _maxRespawns) && (_maxRespawns != -1)) then {_mode = 0}; + if ((_groupSpawned == 1) && (_respawnTime > 0)) then {_mode = 2}; // set up for respawn at a later time + if ((_groupSpawned == 0) && (diag_tickTime > _respawnAt)) then {_mode = 1}; + }; + switch (_mode) do + { + case 0: {blcl_sm_garrisonBuilding_relPos deleteAt (blcl_sm_garrisonBuilding_relPos find _x)}; + case 1: { + + if (true /*[_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange*/) then + { + // ["_building","_skillLevel","_noStatics","_typesStatics","_noUnits"]; + private _group = [_building,_aiDifficulty,_noStatics,_typesStatics,_noUnits] call blck_fnc_sm_spawnBuildingGarrison_relPos; + _timesSpawned = _timesSpawned + 1; + _groupSpawned = 1; + _respawnAt = 0; + _element set[patrolGroup,_group]; + _element set[groupSpawned,1]; + _element set[timesSpawned,_timesSpawned]; + _element set[respawnAt,_respawnAt]; + blcl_sm_garrisonBuilding_relPos set[blcl_sm_garrisonBuilding_relPos find _x,_element]; + }; + }; + case 2: { + _groupSpawned = 0; + _respawnAt = diag_tickTime + _respawnTime; + _element set[respawnAt,_respawnAt]; + _element set[groupSpawned,_groupSpawned]; + blcl_sm_garrisonBuilding_relPos set[blcl_sm_garrisonBuilding_relPos find _x,_element]; + + }; + default {}; + }; + + } else { + + if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then + { + _group setVariable["playerNearAt",diag_tickTime]; + + } else { + if (diag_tickTime > (_group getVariable["playerNearAt",diag_tickTime]) + blck_sm_groupDespawnTime) then + { + + _groupParameters set [2, {alive _x} count (units _group)]; + private _veh = vehicle (leader _group); + [_veh] call blck_fnc_destroyVehicleAndCrew; + _element set[groupParameters,_groupParameters]; + _element set[patrolGroup ,grpNull]; + _element set[timesSpawned,(_timesSpawned - 1)]; + _element set[groupSpawned,0]; + blcl_sm_garrisonBuilding_relPos set[(blcl_sm_garrisonBuilding_relPos find _x), _element]; + }; + }; + }; +}forEach _sm_groups; \ No newline at end of file diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorInfantry.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorInfantry.sqf new file mode 100644 index 0000000..db85898 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorInfantry.sqf @@ -0,0 +1,111 @@ +/* + by Ghostrider [GRG] + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +//diag_log format["_fnc_monitorInfantry(12): time %2 | blck_sm_Infantry %1",blck_sm_Infantry,diag_tickTime]; +if (blck_sm_Infantry isEqualTo []) exitWith {}; +private["_element"]; +for "_i" from 0 to (count blck_sm_Infantry) do +{ + if (_i >= count(blck_sm_Infantry)) exitWith {}; + _element = blck_sm_Infantry deleteAt 0; + //diag_log format["(18) element = %1",_element]; + //diag_log format["_fnc_monitorInfantry(20): _element %1 | _i = %2",_element,_i]; + + if !(_element isEqualTo []) then + { + _element params["_groupParameters","_group","_groupSpawned","_timesSpawned","_respawnAt","_maxRespawns"]; + _groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnTime","_maxRespawns"]; + //diag_log format["_fnc_monitorInfantry(21): _groupParameters = %1",_groupParameters]; + //diag_log format["_fnc_monitorInfantry (22): _group %1 | _groupSpawned %2 | _timesSpawned %3 | _respawnAt %4",_group,_groupSpawned,_timesSpawned,_respawnAt]; + //diag_log format["_fnc_monitorInfantry(28): _pos = %1 | _difficulty = 2 | _units = %3 | _patrolRadius = %4 | _respawnTime = %5",_pos,_difficulty,_units,_patrolRadius,_respawnTime]; + if (!(isNull _group) && {alive _x} count (units _group) == 0) then + { + deleteGroup _group; + _group = grpNull; + }; + if (isNull _group) then + { + _mode = -1; + if ((_timesSpawned == 0) && (_groupSpawned == 0)) then {_mode = 1}; // spawn-respawn + if (_timesSpawned > 0) then + { + if ((_groupSpawned == 1) && (_respawnTime == 0)) then {_mode = 0}; // remove patrol from further evaluation + if ((_timesSpawned > _maxRespawns) && (_maxRespawns != -1)) then {_mode = 0}; + if ((_groupSpawned == 1) && (_respawnTime > 0)) then {_mode = 2}; // set up for respawn at a later time + if ((_groupSpawned == 0) && (diag_tickTime > _respawnAt)) then {_mode = 1}; + }; + + switch (_mode) do + { + case 0: { + //diag_log format["_fnc_sm_monitorInfantry(46): no further respawns requested for %1",_element]; + }; + case 1: { // Spawn Group Now + //diag_log format["_fnc_sm_monitorInfantry(49): spawning infantry group with element = %1",_element]; + if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then + { + private _numAI = [_units] call blck_fnc_getNumberFromRange; + //params["_pos", "_center", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], ["_minDist",20], ["_maxDist",35],["_configureWaypoints",true], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_scuba",false] ]; + _group = [ + _pos,_pos,_numAI,_numAI,_difficulty,_patrolRadius-1,_patrolRadius,true, + [_difficulty] call blck_fnc_selectAIUniforms, + [_difficulty] call blck_fnc_selectAIHeadgear, + [_difficulty] call blck_fnc_selectAIVests, + [_difficulty] call blck_fnc_selectAIBackpacks, + [_difficulty] call blck_fnc_selectAILoadout, + [_difficulty] call blck_fnc_selectAISidearms + ] call blck_fnc_spawnGroup; + _element set[patrolGroup,_group]; + _element set[groupSpawned,1]; + _element set[timesSpawned,_timesSpawned + 1]; + _element set[respawnAt,0]; + //diag_log format["_fnc_monitorInfantry (67): _element %1",_element]; + //diag_log format["_fnc_monitorInfantry (69): blck_sm_Infantry %1",blck_sm_Infantry]; + }; + blck_sm_Infantry pushBack _element; + }; + case 2: { // Spawn Group at a Later Time. + blck_liveMissionAI pushBack[units _group,diag_tickTime]; // schedule units of group for deletion now. + _element set[respawnAt,diag_tickTime + _respawnTime]; + _element set[groupSpawned,0]; + blck_sm_Infantry pushBack _element; + //diag_log format["_fnc_monitorInfantry(77): update respawn time to %1",_respawnAt]; + }; + default {}; + }; + //diag_log format["_fnc_monitorInfantry(81) respawn conditions evaluated : _group = %1 | _groupSpawned = %2 | _timesSpawned = %3",_group,_groupSpawned,_timesSpawned]; + } else { + //diag_log format["_fnc_monitorInfantry(83): diag_tickTime = %1 | playerNearAt = %2",diag_tickTime,_group getVariable["playerNearAt",-1]]; + if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then + { + _group setVariable["playerNearAt",diag_tickTime]; + //diag_log format["_fnc_monitorInfantry(87): playerNearAt updated to %1",_group getVariable["playerNearAt",-1]]; + blck_sm_Infantry pushBack _element; + } else { + if (diag_tickTime > (_group getVariable["playerNearAt",diag_tickTime]) + blck_sm_groupDespawnTime) then + { + //diag_log format["_fnc_monitorInfantry(92): despanwing patrol for _element %1",_element]; + _groupParameters set [2, {alive _x} count (units _group)]; + {[_x] call blck_fnc_deleteAI} forEach (units _group); + deleteGroup _group; + _element set[groupParameters,_groupParameters]; + _element set[patrolGroup ,grpNull]; + _element set[timesSpawned,(_timesSpawned - 1)]; + _element set[groupSpawned,0]; + //diag_log format["_fnc_monitorInfantry (101): _element %1",_element]; + //diag_log format["_fnc_monitorInfantry (102): blck_sm_Infantry %1",blck_sm_Infantry]; + }; + blck_sm_Infantry pushBack _element; + }; + }; + }; + //blck_sm_Infantry pushBack _element; +}; \ No newline at end of file diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorScuba.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorScuba.sqf new file mode 100644 index 0000000..9ffcad5 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorScuba.sqf @@ -0,0 +1,92 @@ +/* + by Ghostrider [GRG] + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ + +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +//diag_log format["_fnc_monitorScubaGroups: time %2 | blck_sm_scubaGroups %1",blck_sm_scubaGroups,diag_tickTime]; +if (blck_sm_scubaGroups isEqualTo []) exitWith {}; +for "_i" from 0 to (count blck_sm_scubaGroups) do +{ + if (_i >= (count blck_sm_scubaGroups)) exitWith {}; + private _element = blck_sm_scubaGroups deleteAt 0; + _element params["_groupParameters","_group","_groupSpawned","_timesSpawned","_respawnAt","_maxRespawns"]; + //diag_log format["_fnc_monitorScubaGroups: _element %1 | _i = %2",_element,_i]; + //diag_log format["_fnc_monitorScubaGroups: _groupParameters = %1",_groupParameters]; + //diag_log format["_fnc_monitorScubaGroups (9): _group %1 | _groupSpawned %2 | _timesSpawned %3 | _respawnAt %4",_group,_groupSpawned,_timesSpawned,_respawnAt]; + _groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnTime","_maxRespawns"]; + //diag_log format["_fnc_monitorScubaGroups: _pos = %1 | _difficulty = 2 | _units = %3 | _patrolRadius = %4 | _respawnTime = %5",_pos,_difficulty,_units,_patrolRadius,_respawnTime]; + + if (!(isNull _group) && {alive _x} count (units _group) == 0) then + { + deleteGroup _group; + _group = grpNull; + }; + if (isNull _group) then + { + _mode = -1; + if ((_timesSpawned == 0) && (_groupSpawned == 0)) then {_mode = 1}; // spawn-respawn + if (_timesSpawned > 0) then + { + if ((_groupSpawned == 1) && (_respawnTime == 0)) then {_mode = 0}; // remove patrol from further evaluation + if ((_timesSpawned > _maxRespawns) && (_maxRespawns != -1)) then {_mode = 0}; + if ((_groupSpawned == 1) && (_respawnTime > 0)) then {_mode = 2}; // set up for respawn at a later time + if ((_groupSpawned == 0) && (diag_tickTime > _respawnAt)) then {_mode = 1}; + }; + switch (_mode) do + { + case 0: { + //diag_log format["_fnc_sm_monitorInfantry(46): no further respawns requested for %1",_element]; + }; + case 1: { + if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then + { + private _numAI = [_units] call blck_fnc_getNumberFromRange; + //params["_pos", "_center", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], ["_minDist",20], ["_maxDist",35],["_configureWaypoints",true], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_scuba",false] ]; + _group = [_pos,_difficulty,_units,_patrolRadius] call blck_fnc_spawnScubaGroup; + _element set[patrolGroup,_group]; + _element set[groupSpawned,1]; + _element set[timesSpawned,_timesSpawned + 1]; + _element set[respawnAt,0]; + }; + blck_sm_scubaGroups pushBack _element; + }; + case 2: { + blck_liveMissionAI pushBack[units _group,diag_tickTime]; // schedule units of group for deletion now. + _element set[respawnAt,diag_tickTime + _respawnTime]; + _element set[groupSpawned,0]; + blck_sm_scubaGroups pushBack _element; + //diag_log format["_fnc_monitorScubaGroups: update respawn time to %1",_respawnAt]; + }; + default {}; + }; + //diag_log format["_fnc_monitorScubaGroups(56) respawn conditions evaluated : _group = %1 | _groupSpawned = %2 | _timesSpawned = %3",_group,_groupSpawned,_timesSpawned]; + } else { + //diag_log format["_fnc_monitorScubaGroups: diag_tickTime = %1 | playerNearAt = %2",diag_tickTime,_group getVariable["playerNearAt",-1]]; + if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then + { + _group setVariable["playerNearAt",diag_tickTime]; + blck_sm_scubaGroups pushBack _element; + //diag_log format["_fnc_monitorScubaGroups: playerNearAt updated to %1",_group getVariable["playerNearAt",-1]]; + } else { + if (diag_tickTime > (_group getVariable["playerNearAt",diag_tickTime]) + blck_sm_groupDespawnTime) then + { + //diag_log format["_fnc_monitorScubaGroups: despanwing patrol for _element %1",_element]; + _groupParameters set [2, {alive _x} count (units _group)]; + {[_x] call blck_fnc_deleteAI} forEach (units _group); + deleteGroup _group; + _element set[groupParameters,_groupParameters]; + _element set[patrolGroup ,grpNull]; + _element set[timesSpawned,(_timesSpawned - 1)]; + _element set[groupSpawned,0]; + }; + blck_sm_scubaGroups pushBack _element; + }; + }; +}; \ No newline at end of file diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorShips.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorShips.sqf new file mode 100644 index 0000000..5f3a0b2 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorShips.sqf @@ -0,0 +1,94 @@ +/* + by Ghostrider [GRG] + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ + +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +//diag_log format["_fnc_monitorShips: time %2 | blck_sm_surfaceShips %1",blck_sm_surfaceShips,diag_tickTime]; +for "_i" from 0 to (count blck_sm_surfaceShips) do +{ + if (_i >= (count blck_sm_surfaceShips)) exitWith {}; + private _element = blck_sm_surfaceShips deleteAt 0; + _element params["_groupParameters","_group","_groupSpawned","_timesSpawned","_respawnAt","_maxRespawns"]; + //diag_log format["_fnc_monitorShips: _element %1",_element]; + //diag_log format["_fnc_monitorShips: _groupParameters = %1",_groupParameters]; + //diag_log format["_fnc_monitorShips (9): _group %1 | _groupSpawned %2 | _timesSpawned %3 | _respawnAt %4",_group,_groupSpawned,_timesSpawned,_respawnAt]; + _groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnTime"]; + _groupParameters params["_vehicleType","_pos","_difficulty","_patrolRadius","_respawnTime","_maxRespawns"]; + //diag_log format["_fnc_monitorVehicles: _vehicleType | %1 | _pos = %2 | _difficulty = %3 | _patrolRadius = %4 | _respawnTime = %5",_vehicleType,_pos,_difficulty,_patrolRadius,_respawnTime]; + + if (!(isNull _group) && {alive _x} count (units _group) == 0) then + { + deleteGroup _group; + _group = grpNull; + }; + if (isNull _group) then + { + _mode = -1; + if ((_timesSpawned == 0) && (_groupSpawned == 0)) then {_mode = 1}; // spawn-respawn + if (_timesSpawned > 0) then + { + if ((_groupSpawned == 1) && (_respawnTime == 0)) then {_mode = 0}; // remove patrol from further evaluation + if ((_timesSpawned > _maxRespawns) && (_maxRespawns != -1)) then {_mode = 0}; + if ((_groupSpawned == 1) && (_respawnTime > 0)) then {_mode = 2}; // set up for respawn at a later time + if ((_groupSpawned == 0) && (diag_tickTime > _respawnAt)) then {_mode = 1}; + }; + switch (_mode) do + { + case 0: {}; + case 1: { + + if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then + { + _return = [_pos,1,_difficulty,[_groupParameters],false] call blck_fnc_spawnMissionVehiclePatrols; + //diag_log format["_fnc_monitorShips: _return = %1",_return]; + _group = group ((_return select 1) select 0); + _element set[patrolGroup,_group]; + _element set[groupSpawned,1]; + _element set[timesSpawned,_timesSpawned + 1]; + _element set[respawnAt,0]; + //blck_sm_surfaceShips pushBack _element; + }; + blck_sm_surfaceShips pushBack _element; + }; + case 2: { + _element set[respawnAt,diag_tickTime + _respawnTime]; + _element set[groupSpawned,0]; + blck_sm_surfaceShips pushBack _element; + //diag_log format["_fnc_monitorShips: update respawn time to %1",_respawnAt]; + }; + default {}; + }; + //diag_log format["_fnc_monitorShips(56) respawn conditions evaluated : _group = %1 | _groupSpawned = %2 | _timesSpawned = %3",_group,_groupSpawned,_timesSpawned]; + } else { + //diag_log format["_fnc_monitorShips: diag_tickTime = %1 | playerNearAt = %2",diag_tickTime,_group getVariable["playerNearAt",-1]]; + if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then + { + _group setVariable["playerNearAt",diag_tickTime]; + //diag_log format["_fnc_monitorShips: playerNearAt updated to %1",_group getVariable["playerNearAt",-1]]; + blck_sm_surfaceShips pushBack _element; + } else { + if (diag_tickTime > (_group getVariable["playerNearAt",diag_tickTime]) + blck_sm_groupDespawnTime) then + { + //diag_log format["_fnc_monitorShips: despanwing patrol for _element %1",_element]; + //_groupParameters set [2, {alive _x} count (units _group)]; + private _veh = vehicle (leader _group); + {deleteVehicle _x} forEach (units _group); + deleteGroup _group; + [_veh] call blck_fnc_destroyVehicleAndCrew; + _element set[groupParameters,_groupParameters]; + _element set[patrolGroup ,grpNull]; + _element set[timesSpawned,(_timesSpawned - 1)]; + _element set[groupSpawned,0]; + }; + blck_sm_surfaceShips pushBack _element; + }; + }; +}; \ No newline at end of file diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorStaticUnits.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorStaticUnits.sqf new file mode 100644 index 0000000..ceb0974 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorStaticUnits.sqf @@ -0,0 +1,236 @@ +/* + by Ghostrider [GRG] + for ghostridergaming + 12/5/17 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +private _triggerRange = 2000; +_fnc_updateGroupSpawnTimerFields = { + //diag_log format["_fnc_updateGroupSpawnTimerFields::-> _this = %1",_this]; + params["_array","_element",["_group",grpNull],["_spawnTime",0]]; + private["_index"]; + _index = _array find _element; + _element set[1,_group]; + _element set[2,_spawnTime]; + _array set[_index,_element]; +}; + +private["_group","_groupParameters","_numAI","_return"]; +_sm_groups = +blck_sm_Groups; +{ + + // [ [px, py, pz] /* position*/, "difficulty", 4 /*Number to Spawn*/, 150 /*radius of patrol*/, _respawnTime, _group, _spawnAt] + _x params["_groupParameters","_group","_spawnAt"]; + _groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnTime","_maxRespawns"]; + //diag_log format["<_sm_monitorStaticUnits::Group spawning routine:: _units = %1 | _x = %2 |_forEachIndex = %3",_units,_x,_forEachIndex]; + private _groupSpawned = false; + if ([_pos,_triggerRange] call blck_fnc_playerInRange) then + { + if ((isNull _group) && (diag_tickTime > _spawnAt) && (_spawnAt != -1)) then // no group has been spawned, spawn one. + { + //diag_log format["[blckeagls static group spawner] evaluating _x = %1 ",_x]; + _numAI = [_units] call blck_fnc_getNumberFromRange; + //diag_log format["[blckeagls static group spawner] _units = %1 and _numAI = %2",_units,_numAI]; + // // params["_pos", "_center", _numai1, _numai2, _skillLevel, _minDist, _maxDist, _configureWaypoints, _uniforms, _headGear,_vests,_backpacks,_weaponList,_sideArms, _scuba ]; + _group = [_pos,_pos,_numAI,_numAI,_difficulty,_patrolRadius-2,_patrolRadius,true] call blck_fnc_spawnGroup; + //diag_log format["[blckeagls static group spawner] _group %1",_group]; + [blck_sm_Groups,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields; + //diag_log format["_sm_monitorStaticUnits | spawn Group step :: blck_sm_Groups updated to %1",blck_sm_Groups]; + }; + if (!(_groupSpawned) && (isNull _group) && (_spawnAt == -1) && (_respawnTime > 0)) then // a group was spawned and all units are dead and we should rspawn them after a certain interval + { + [blck_sm_Groups,_x,_group,(diag_tickTime + _respawnTime)] call _fnc_updateGroupSpawnTimerFields; + //diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Groups updated to %1",blck_sm_Groups]; + }; + if (!(_groupSpawned) && (isNull _group) && (_spawnAt == -1) && (_respawnTime == 0) ) then // a group was spawned and all units are dead but we should not do a respawn + { + blck_sm_Groups deleteAt (blck_sm_Groups find _x); + }; + }; +}forEach _sm_groups; + +_sm_scubaGroups = +blck_sm_scubaGroups; +{ + + // [ [px, py, pz] /* position*/, "difficulty", 4 /*Number to Spawn*/, 150 /*radius of patrol*/, _respawnTime, _group, _spawnAt] + _x params["_groupParameters","_group","_spawnAt"]; + _groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnTime"]; + //diag_log format["<_sm_monitorScubaUnits:: _group = %1 | _x = %2 |_forEachIndex = %3",_group,_x,_forEachIndex]; + private _groupSpawned = false; + if ([_pos,_triggerRange] call blck_fnc_playerInRange) then + { + if ((isNull _group) && (diag_tickTime > _spawnAt) && (_spawnAt != -1)) then // no group has been spawned, spawn one. + { + //diag_log format["[blckeagls static scubaGroup spawner] evaluating _x = %1 ",_x]; + _numAI = [_units] call blck_fnc_getNumberFromRange; + //diag_log format["[blckeagls static scubaGroup spawning routine] _units = %1 and _numAI = %2",_units,_numAI]; + //params["_pos", "_numUnits", ["_skillLevel","red"], "_center", ["_minDist",20], ["_maxDist",35], ["_uniforms",blck_UMS_uniforms], ["_headGear",blck_UMS_headgear],["_configureWaypoints",true],["_weapons",blck_UMS_weapons],["_vests",blck_UMS_vests]]; + _group = [_pos,_difficulty,_units,_patrolRadius] call blck_fnc_spawnScubaGroup; + //diag_log format["[blckeagls static scubaGroup spawner] _group %1",_group]; + [blck_sm_scubaGroups,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields; + //diag_log format["_sm_monitorStaticUnits | spawn Group step :: blck_sm_Groups updated to %1",blck_sm_Groups]; + }; + if (!(_groupSpawned) && (isNull _group) && (_spawnAt == -1) && (_respawnTime > 0)) then // a group was spawned and all units are dead and we should rspawn them after a certain interval + { + [blck_sm_scubaGroups,_x,_group,(diag_tickTime + _respawnTime)] call _fnc_updateGroupSpawnTimerFields; + //diag_log format["_sm_monitorStaticUnits | set scubaGroup respawn time step :: blck_sm_Groups updated to %1",blck_sm_scubaGroups]; + }; + if (!(_groupSpawned) && (isNull _group) && (_spawnAt == -1) && (_respawnTime == 0) ) then // a group was spawned and all units are dead but we should not do a respawn + { + blck_sm_scubaGroups deleteAt (blck_sm_scubaGroups find _x); + }; + }; +}forEach _sm_scubaGroups; + +_sm_Emplaced = +blck_sm_Emplaced; +{ + // ["B_G_Mortar_01_F",[22944.3,16820.5,3.14243],"green",0,0,_group,_spawnAt] + //diag_log format["_sm_monitorEmplacedUnits::-> _x = %1",_x]; + _x params["_groupParameters","_group","_spawnAt"]; + _groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnTime"]; + if ([_pos,_triggerRange] call blck_fnc_playerInRange) then + { + if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one. + { + //diag_log format["[blckeagls static Emplaced spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty]; + // params["_coords","_missionEmplacedWeapons","_useRelativePos","_noEmplacedWeapons","_aiDifficultyLevel",["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols]]; + _group = [_pos,[_groupParameters],false,1,_difficulty] call blck_fnc_spawnEmplacedWeaponArray; + [blck_sm_Emplaced,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields; + //diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Emplaced updated to %1",blck_sm_Emplaced]; + }; + }; + if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnTime > 0) ) then // a group was spawned and all units are dead + { + [blck_sm_Emplaced,_x,_group,(diag_tickTime + _respawnTime)] call _fnc_updateGroupSpawnTimerFields; + //diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Emplaced updated to %1",blck_sm_Emplaced]; + }; + if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnTime == 0)) then // a group was spawned and all units are dead + { + blck_sm_Emplaced deleteAt (blck_sm_Emplaced find _x); + }; + +}forEach _sm_Emplaced; + +_sm_Vehicles = +blck_sm_Vehicles; +{ + // ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt], + //diag_log format["_sm_monitorVehicles::-> _x = %1",_x]; + _x params["_groupParameters","_group","_spawnAt"]; + _groupParameters params["_vehicleType","_pos","_difficulty","_patrolRadius","_respawnTime"]; + if ([_pos,_triggerRange] call blck_fnc_playerInRange) then + { + if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one. + { + //params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_isScubaGroup",false]]; + _return = [_pos,1,_difficulty,[_groupParameters],false] call blck_fnc_spawnMissionVehiclePatrols; + // _return = [_vehicles, _missionAI, _abort]; + _group = group (_return select 1 select 0); + [blck_sm_Vehicles,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields; + //diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles]; + }; + }; + if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnTime > 0) ) then // a group was spawned and all units are dead + { + [blck_sm_Vehicles,_x,_group,(diag_tickTime + _respawnTime)] call _fnc_updateGroupSpawnTimerFields; + //diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles]; + }; + if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnTime == 0) ) then // a group was spawned and all units are dead + { + blck_sm_Vehicles deleteAt (blck_sm_Vehicles find _x); + }; +}forEach _sm_Vehicles; + +_sm_surfaceVehicles = +blck_sm_surfaceShips; +{ + // ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt], + _x params["_groupParameters","_group","_spawnAt"]; + _groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnTime"]; + if ([_pos,_triggerRange] call blck_fnc_playerInRange) then + { + if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one. + { + //diag_log format["[blckeagls static vehiclePatrol spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty]; + [_pos,1,_difficulty,[_groupParameters],false] call blck_fnc_spawnMissionVehiclePatrols; + _return params ["_vehicles", "_missionAI", "_abort"]; + _group = group (_missionAI select 0); + [blck_sm_surfaceShips,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields; + //diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles]; + }; + }; + if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnTime > 0) ) then // a group was spawned and all units are dead + { + [blck_sm_surfaceShips,_x,_group,(diag_tickTime + _respawnTime)] call _fnc_updateGroupSpawnTimerFields; + //diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles]; + }; + if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnTime == 0) ) then // a group was spawned and all units are dead + { + blck_sm_surfaceShips deleteAt (blck_sm_surfaceShips find _x); + }; +}forEach _sm_surfaceVehicles; + +_sm_SDVVehicles = +blck_sm_submarines; +{ + // ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt], + _x params["_groupParameters","_group","_spawnAt"]; + _groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnTime"]; + if ([_pos,_triggerRange] call blck_fnc_playerInRange) then + { + if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one. + { + //diag_log format["[blckeagls static sub patrol spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty]; + //params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_isScubaGroup",false]]; + _return = [_pos,1,_difficulty,[_groupParameters],false,blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,blck_backpacks,blck_UMS_weapons,blck_Pistols,true] call blck_fnc_spawnMissionVehiclePatrols; + _return params ["_vehicles", "_missionAI", "_abort"]; + _group = group (_missionAI select 0); + [blck_sm_submarines,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields; + //diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles]; + }; + }; + if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnTime > 0) ) then // a group was spawned and all units are dead + { + [blck_sm_submarines,_x,_group,(diag_tickTime + _respawnTime)] call _fnc_updateGroupSpawnTimerFields; + //diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles]; + }; + if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnTime == 0) ) then // a group was spawned and all units are dead + { + blck_sm_submarines deleteAt (blck_sm_submarines find _x); + }; +}forEach _sm_SDVVehicles; + +_sm_Aircraft = +blck_sm_Aircraft; +{ + // ["Exile_Chopper_Huey_Armed_Green",[22923.4,16953,3.19],"red",1000,0], + _x params["_groupParameters","_group","_spawnAt"]; + _groupParameters params["_aircraftType","_pos","_difficulty","_patrolRadius","_respawnTime"]; + if ([_pos,_triggerRange] call blck_fnc_playerInRange) then + { + if ( (isNull _group) && (diag_tickTime > _spawnAt) && (_spawnAt != -1)) then // no group has been spawned, spawn one. + { + _weapon = [toLower _difficulty] call blck_fnc_selectAILoadout; + //params["_coords","_skillAI","_helis",["_uniforms", blck_SkinList],["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_Launcher","none"],["_weaponList",[]],["_sideArms",[]]] + //diag_log format["[blckeagls static aircraftePatrol spawner] _weapon = %1 and _difficulty = %2",_weapon,_difficulty]; + _return = [_pos,_difficulty,[_aircraftType]] call blck_fnc_spawnMissionHeli; // Allow the spawner to fit the default AI Loadouts for blckeagls; revisit at a later time when custom uniforms are set up for these AI. + //diag_log format["[blckeagls] static aircraftePatrol spawner -> _return = %1",_return]; + _return params ["_patrolHeli","_ai","_abort"]; + _group = group (_ai select 0); + [blck_sm_Aircraft,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields; + //diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Aircraft updated to %1",blck_sm_Aircraft]; + }; + }; + if ( (isNull _group) && (_spawnAt == -1) && (_respawnTime > 0) ) then // a group was spawned and all units are dead + { + [blck_sm_Aircraft,_x,_group,(diag_tickTime + _respawnTime)] call _fnc_updateGroupSpawnTimerFields; + //diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Aircraft updated to %1",blck_sm_Aircraft]; + }; + if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnTime == 0) ) then // a group was spawned and all units are dead + { + blck_sm_Aircraft deleteAt (blck_sm_Aircraft find _x); + }; +}forEach _sm_Aircraft; diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorSubs.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorSubs.sqf new file mode 100644 index 0000000..fc2790d --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorSubs.sqf @@ -0,0 +1,94 @@ +/* + by Ghostrider [GRG] + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ + +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +//diag_log format["_fnc_monitorSubs: time %2 | blck_sm_submarines %1",blck_sm_submarines,diag_tickTime]; +for "_i" from 0 to (count blck_sm_submarines) do +{ + if (_i >= (count blck_sm_submarines)) exitWith {}; + private _element = blck_sm_submarines deleteAt 0; + _element params["_groupParameters","_group","_groupSpawned","_timesSpawned","_respawnAt","_maxRespawns"]; + //diag_log format["_fnc_monitorSubs: _element %1",_element]; + //diag_log format["_fnc_monitorSubs: _groupParameters = %1",_groupParameters]; + //diag_log format["_fnc_monitorSubs (9): _group %1 | _groupSpawned %2 | _timesSpawned %3 | _respawnAt %4",_group,_groupSpawned,_timesSpawned,_respawnAt]; + //_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnTime"]; + _groupParameters params["_vehicleType","_pos","_difficulty","_patrolRadius","_respawnTime","_maxRespawns"]; + //diag_log format["_fnc_monitorVehicles: _vehicleType | %1 | _pos = %2 | _difficulty = %3 | _patrolRadius = %4 | _respawnTime = %5",_vehicleType,_pos,_difficulty,_patrolRadius,_respawnTime]; + + if (!(isNull _group) && {alive _x} count (units _group) == 0) then + { + deleteGroup _group; + _group = grpNull; + }; + if (isNull _group) then + { + _mode = -1; + if ((_timesSpawned == 0) && (_groupSpawned == 0)) then {_mode = 1}; // spawn-respawn + if (_timesSpawned > 0) then + { + if ((_groupSpawned == 1) && (_respawnTime == 0)) then {_mode = 0}; // remove patrol from further evaluation + if ((_timesSpawned > _maxRespawns) && (_maxRespawns != -1)) then {_mode = 0}; + if ((_groupSpawned == 1) && (_respawnTime > 0)) then {_mode = 2}; // set up for respawn at a later time + if ((_groupSpawned == 0) && (diag_tickTime > _respawnAt)) then {_mode = 1}; + }; + switch (_mode) do + { + case 0: {}; + case 1: { + + if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then + { + _return = [_pos,1,_difficulty,[_groupParameters],false,blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,blck_backpacks,blck_UMS_weapons,blck_Pistols,true] call blck_fnc_spawnMissionVehiclePatrols; + //diag_log format["_fnc_monitorSubs: _return = %1",_return]; + _group = group ((_return select 1) select 0); + _element set[patrolGroup,_group]; + _element set[groupSpawned,1]; + _element set[timesSpawned,_timesSpawned + 1]; + _element set[respawnAt,0]; + //blck_sm_submarines pushBack _element; + }; + blck_sm_submarines pushBack _element; + }; + case 2: { + _element set[respawnAt,diag_tickTime + _respawnTime]; + _element set[groupSpawned,0]; + bblck_sm_submarines pushBack _element; + //diag_log format["_fnc_monitorSubs: update respawn time to %1",_respawnAt]; + }; + default {}; + }; + //diag_log format["_fnc_monitorSubs(56) respawn conditions evaluated : _group = %1 | _groupSpawned = %2 | _timesSpawned = %3",_group,_groupSpawned,_timesSpawned]; + } else { + //diag_log format["_fnc_monitorSubs: diag_tickTime = %1 | playerNearAt = %2",diag_tickTime,_group getVariable["playerNearAt",-1]]; + if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then + { + _group setVariable["playerNearAt",diag_tickTime]; + //diag_log format["_fnc_monitorSubs: playerNearAt updated to %1",_group getVariable["playerNearAt",-1]]; + blck_sm_submarines pushBack _element; + } else { + if (diag_tickTime > (_group getVariable["playerNearAt",diag_tickTime]) + blck_sm_groupDespawnTime) then + { + //diag_log format["_fnc_monitorSubs: despanwing patrol for _element %1",_element]; + //_groupParameters set [2, {alive _x} count (units _group)]; + private _veh = vehicle (leader _group); + {deleteVehicle _x} forEach (units _group); + deleteGroup _group; + [_veh] call blck_fnc_destroyVehicleAndCrew; + _element set[groupParameters,_groupParameters]; + _element set[patrolGroup ,grpNull]; + _element set[timesSpawned,(_timesSpawned - 1)]; + _element set[groupSpawned,0]; + }; + blck_sm_submarines pushBack _element; + }; + }; +}; \ No newline at end of file diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorVehicles.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorVehicles.sqf new file mode 100644 index 0000000..50b5f48 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_monitorVehicles.sqf @@ -0,0 +1,96 @@ +/* + by Ghostrider [GRG] + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ + +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +//diag_log format["_fnc_monitorVehicles: time %2 | blck_sm_Vehicles %1",blck_sm_Vehicles,diag_tickTime]; +for "_i" from 0 to (count blck_sm_Vehicles) do +{ + if (_i >= (count blck_sm_Vehicles)) exitWith {}; + private _element = blck_sm_Vehicles deleteAt 0; + //diag_log format["_fnc_monitorVehicles(18): _element %1",_element]; + _element params["_groupParameters","_group","_groupSpawned","_timesSpawned","_respawnAt","_maxRespawns"]; + //diag_log format["_fnc_monitorVehicles: _groupParameters = %1",_groupParameters]; + //diag_log format["_fnc_monitorVehicles (21): _group %1 | _groupSpawned %2 | _timesSpawned %3 | _respawnAt %4",_group,_groupSpawned,_timesSpawned,_respawnAt]; + _groupParameters params["_vehicleType","_pos","_difficulty","_patrolRadius","_respawnTime","_maxRespawns"]; + //diag_log format["_fnc_monitorVehicles(23): _vehicleType | %1 | _pos = %2 | _difficulty = %3 | _patrolRadius = %4 | _respawnTime = %5",_vehicleType,_pos,_difficulty,_patrolRadius,_respawnTime]; + + if (!(isNull _group) && {alive _x} count (units _group) == 0) then + { + deleteGroup _group; + _group = grpNull; + }; + if (isNull _group) then + { + _mode = -1; + if ((_timesSpawned == 0) && (_groupSpawned == 0)) then {_mode = 1}; // spawn-respawn + if (_timesSpawned > 0) then + { + if ((_groupSpawned == 1) && (_respawnTime == 0)) then {_mode = 0}; // remove patrol from further evaluation + if ((_timesSpawned > _maxRespawns) && (_maxRespawns != -1)) then {_mode = 0}; + if ((_groupSpawned == 1) && (_respawnTime > 0)) then {_mode = 2}; // set up for respawn at a later time + if ((_groupSpawned == 0) && (diag_tickTime > _respawnAt)) then {_mode = 1}; + }; + switch (_mode) do + { + case 0: {}; + case 1: { + + if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then + { + // params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",[]], ["_headGear",[]],["_vests",[]],["_backpacks",[]],["_weaponList",[]],["_sideArms",[]], ["_isScubaGroup",false]]; + _return = [_pos,1,_difficulty,[_groupParameters],false] call blck_fnc_spawnMissionVehiclePatrols; + //diag_log format["_fnc_monitorVehicles(50): _return = %1",_return]; + _group = group ((_return select 1) select 0); + // _element [[""Exile_Car_Offroad_Armed_Guerilla02"",[22809.5,16699.2,8.78706],""green"",600,90],O Alpha 1-1,1,1,0,-1]" + // _groupParameters = [""Exile_Car_Offroad_Armed_Guerilla02"",[22809.5,16699.2,8.78706],""green"",600,90]" + _element set[patrolGroup,_group]; + _element set[groupSpawned,1]; + _element set[timesSpawned,_timesSpawned + 1]; + _element set[respawnAt,0]; + }; + blck_sm_Vehicles pushBack _element; + }; + case 2: { + _element set[respawnAt,diag_tickTime + _respawnTime]; + _element set[groupSpawned,0]; + blck_sm_Vehicles pushBack _element; + //diag_log format["_fnc_monitorVehicles(63): update respawn time to %1",_respawnAt]; + }; + default {}; + }; + //diag_log format["_fnc_monitorVehicles(67) respawn conditions evaluated : _group = %1 | _groupSpawned = %2 | _timesSpawned = %3",_group,_groupSpawned,_timesSpawned]; + } else { + //diag_log format["_fnc_monitorVehicles(69): diag_tickTime = %1 | playerNearAt = %2 | _playerInRange = %3",diag_tickTime,_group getVariable["playerNearAt",-1],[_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange]; + if ([_pos,staticPatrolTriggerRange] call blck_fnc_playerInRange) then + { + _group setVariable["playerNearAt",diag_tickTime]; + //diag_log format["_fnc_monitorVehicles(73): playerNearAt updated to %1",_group getVariable["playerNearAt",-1]]; + blck_sm_Vehicles pushBack _element; + } else { + if (diag_tickTime > (_group getVariable["playerNearAt",diag_tickTime]) + blck_sm_groupDespawnTime) then + { + //diag_log format["_fnc_monitorVehicles(78): despanwing patrol for _element %1",_element]; + // _element [[""Exile_Car_Offroad_Armed_Guerilla02"",[22809.5,16699.2,8.78706],""green"",600,90],O Alpha 1-1,1,1,0,-1]" + // _groupParameters = [""Exile_Car_Offroad_Armed_Guerilla02"",[22809.5,16699.2,8.78706],""green"",600,90]" + //_groupParameters set [2, {alive _x} count (units _group)]; + private _veh = vehicle (leader _group); + {deleteVehicle _x} forEach (units _group); + deleteGroup _group; + [_veh] call blck_fnc_destroyVehicleAndCrew; + _element set[groupParameters,_groupParameters]; + _element set[patrolGroup ,grpNull]; + _element set[timesSpawned,(_timesSpawned - 1)]; + _element set[groupSpawned,0]; + }; + blck_sm_Vehicles pushBack _element; + }; + }; +}; \ No newline at end of file diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnAirPatrol.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnAirPatrol.sqf new file mode 100644 index 0000000..02dc685 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnAirPatrol.sqf @@ -0,0 +1,31 @@ +/* + by Ghostrider [GRG] + for ghostridergaming + 12/5/17 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +diag_log format["_fnc_sm_spawnAirPatrols: _this = %1",_this]; +params["_airPatrols"]; +private["_aircraft","_pos","_difficulty","_uniforms","_headGear"]; +_aircraft = _x select 0; +_pos = _x select 1; +_difficulty = _x select 2; +_uniforms = blck_SkinList; +_headGear = blck_headgearList; +switch (_difficulty) do +{ + case "blue": {_weapons = blck_WeaponList_Blue;}; + case "red": {_weapons = blck_WeaponList_Red}; + case "green": {_weapons = blck_WeaponList_Green}; + case "orange": {_weapons = blck_WeaponList_Orange}; +}; +_return = [_pos,_difficulty,_weapons,_uniforms,_headGear,_aircraft] call blck_fnc_spawnMissionHeli; +_group = group (_return select 1 select 0); +_group + diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnAirPatrols.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnAirPatrols.sqf new file mode 100644 index 0000000..9aaf64e --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnAirPatrols.sqf @@ -0,0 +1,50 @@ +/* + by Ghostrider [GRG] + for ghostridergaming + 12/5/17 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +/* +_coords = _this select 0; +_skillAI = _this select 1; +_weapons = _this select 2; +_uniforms = _this select 3; +_headGear = _this select 4; +_helis = _this select 5; +*/ + +params["_airPatrols","_noAirPatrols","_heliTypes","_center","_difficulty","_uniforms","_headGear","_weapons"]; +diag_log format["_sm_spawnAirPatrols:: _this = %1",_this]; +diag_log format["_sm_spawnAirPatrols:: _airPatrols = %1",_airPatrols]; +if (_airPatrols isEqualTo []) then +{ + for "_i" from 1 to _noAirPatrols do + { + /* + _coords = _this select 0; + _skillAI = _this select 1; + _weapons = _this select 2; + _uniforms = _this select 3; + _headGear = _this select 4; + _helis = _this select 5; + */ + [_center,_difficulty,_weapons,_uniforms,_headGear,_heliTypes,0] call blck_fnc_spawnMissionHeli; + }; +} else { + { + /* + /*[aircraft classname, position, difficulty(blue, red etc)]*/ + _aircraft = _x select 0; + _pos = _x select 1; + _difficulty = _x select 2; + [_pos,_difficulty,_weapons,_uniforms,_headGear,_aircraft] call blck_fnc_spawnMissionHeli; + }forEach _airPatrols; +}; + diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnBuildingGarrisonASL.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnBuildingGarrisonASL.sqf new file mode 100644 index 0000000..6cb3fd4 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnBuildingGarrisonASL.sqf @@ -0,0 +1,8 @@ + + +params["_building","_aiDifficultyLevel","_statics","_units"]; +diag_log format["_fnc_sm_spawnBuildingGarrisonASL: handling _building = %1 | at location = %2",_building,position _building]; +private _group = [] call blck_fnc_create_AI_Group; +//params["_building","_group","_statics","_men","_aiDifficultyLevel","_uniforms","_headGear","_vests","_backpacks",["_launcher","none"],"_weaponList","_sideArms"]; +[_building,_group,_statics,_units,_aiDifficultyLevel] call blck_fnc_spawnGarrisonInsideBuilding_ATL; +_group diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnBuildingGarrison_relPos.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnBuildingGarrison_relPos.sqf new file mode 100644 index 0000000..a49e28f --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnBuildingGarrison_relPos.sqf @@ -0,0 +1,8 @@ + + +params["_building","_skillLevel","_noStatics","_typesStatics","_noUnits"]; +diag_log format["_fnc_sm_spawnBuildingGarrison_relPos: handling _building = %1 | at location = %2",_building,position _building]; +private _group = [] call blck_fnc_create_AI_Group; +// ["_building","_group","_noStatics","_typesStatics","_noUnits",["_aiDifficultyLevel","Red"], +[_building,_group,_noStatics,[],_noUnits,_skillLevel] call blck_fnc_spawnGarrisonInsideBuilding_relPos; +_group \ No newline at end of file diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnEmplaced.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnEmplaced.sqf new file mode 100644 index 0000000..73109e5 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnEmplaced.sqf @@ -0,0 +1,58 @@ +/* + by Ghostrider [GRG] + for ghostridergaming + 12/5/17 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +params["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear"]; +private["_return","_emplacedWeps","_emplacedAI","_wep","_units","_gunner","_abort","_pos","_mode"]; +_emplacedWeps = []; +_emplacedAI = []; +_units = []; +_abort = false; +_pos = []; + +//diag_log format["_sm_spawnEmplaced :: _missionEmplacedWeapons = %1",_missionEmplacedWeapons]; +// Define _missionEmplacedWeapons if not already configured. +if (_missionEmplacedWeapons isEqualTo []) then +{ + _missionEmplacedWeaponPositions = [_coords,_noEmplacedWeapons,35,50] call blck_fnc_findPositionsAlongARadius; + { + _static = selectRandom blck_staticWeapons; + //diag_log format["_fnc_spawnEmplacedWeaponArray: creating spawn element [%1,%2]",_static,_x]; + _missionEmplacedWeapons pushback [_static,_coords vectorAdd _x,_aiDifficultyLevel]; + //diag_log format["_fnc_spawnEmplacedWeaponArray: _mi updated to %1",_missionEmplacedWeapons]; + } forEach _missionEmplacedWeaponPositions; +}; +//diag_log format["_sm_spawnEmplaced:: _missionEmplacedWeapons = %1",_missionEmplacedWeapons]; +{ + _wepnClassName = _x select 0; + _pos = _x select 1; + _difficulty = _x select 2; + + // params["_pos", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], "_center", ["_minDist",20], ["_maxDist",35], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear] ]; + _empGroup = [_pos,1,1,_difficulty,_pos,1,2,_uniforms,_headGear,false] call blck_fnc_spawnGroup; + _empGroup setcombatmode "RED"; + _empGroup setBehaviour "COMBAT"; + [_pos,0.01,0.02,_empGroup,"random","SAD","emplaced"] spawn blck_fnc_setupWaypoints; + //if (isNull _empGroup) exitWith {_abort = _true}; + _wep = [_wepnClassName,[0,0,0],false] call blck_fnc_spawnVehicle; + //_empGroup setVariable["groupVehicle",_wep]; + _wep setVariable["vehicleGroup",_empGroup]; + _wep setVariable["GRG_vehType","emplaced"]; + _wep setPosATL _pos; + [_wep,false] call blck_fnc_configureMissionVehicle; + _units = units _empGroup; + _gunner = _units select 0; + _gunner moveingunner _wep; +} forEach _missionEmplacedWeapons; +blck_monitoredVehicles append _emplacedWeps; + +true diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnEmplaceds.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnEmplaceds.sqf new file mode 100644 index 0000000..7bef936 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnEmplaceds.sqf @@ -0,0 +1,58 @@ +/* + by Ghostrider [GRG] + for ghostridergaming + 12/5/17 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +params["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear"]; +private["_return","_emplacedWeps","_emplacedAI","_wep","_units","_gunner","_abort","_pos","_mode"]; +_emplacedWeps = []; +_emplacedAI = []; +_units = []; +_abort = false; +_pos = []; + +//diag_log format["_sm_spawnEmplaced :: _missionEmplacedWeapons = %1",_missionEmplacedWeapons]; +// Define _missionEmplacedWeapons if not already configured. +if (_missionEmplacedWeapons isEqualTo []) then +{ + _missionEmplacedWeaponPositions = [_coords,_noEmplacedWeapons,35,50] call blck_fnc_findPositionsAlongARadius; + { + _static = selectRandom blck_staticWeapons; + //diag_log format["_fnc_spawnEmplacedWeaponArray: creating spawn element [%1,%2]",_static,_x]; + _missionEmplacedWeapons pushback [_static,_coords vectorAdd _x,_aiDifficultyLevel]; + //diag_log format["_fnc_spawnEmplacedWeaponArray: _mi updated to %1",_missionEmplacedWeapons]; + } forEach _missionEmplacedWeaponPositions; +}; +//diag_log format["_sm_spawnEmplaced:: _missionEmplacedWeapons = %1",_missionEmplacedWeapons]; +{ + _wepnClassName = _x select 0; + _pos = _x select 1; + _difficulty = _x select 2; + + /// params["_pos", "_center", _numai1, _numai2, _skillLevel, _minDist, _maxDist, _configureWaypoints, _uniforms, _headGear,_vests,_backpacks,_weaponList,_sideArms, _scuba ]; + __empGroup = [_pos,_pos,1,1,_difficulty,1,2,false,_uniforms,_headGear] call blck_fnc_spawnGroup; + _empGroup setcombatmode "RED"; + _empGroup setBehaviour "COMBAT"; + [_pos,0.01,0.02,_empGroup,"random","SAD","emplaced"] spawn blck_fnc_setupWaypoints; + //if (isNull _empGroup) exitWith {_abort = _true}; + _wep = [_wepnClassName,[0,0,0],false] call blck_fnc_spawnVehicle; + //_empGroup setVariable["groupVehicle",_wep]; + _wep setVariable["vehicleGroup",_empGroup]; + _wep setVariable["GRG_vehType","emplaced"]; + _wep setPosATL _pos; + [_wep,false] call blck_fnc_configureMissionVehicle; + _units = units _empGroup; + _gunner = _units select 0; + _gunner moveingunner _wep; +} forEach _missionEmplacedWeapons; +blck_monitoredVehicles append _emplacedWeps; + +true diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnInfantryPatrols.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnInfantryPatrols.sqf new file mode 100644 index 0000000..e99242a --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnInfantryPatrols.sqf @@ -0,0 +1,37 @@ +/* + by Ghostrider [GRG] + for ghostridergaming + 12/5/17 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +// params["_coords",["_minNoAI",3],["_maxNoAI",6],["_aiDifficultyLevel","red"],["_uniforms",blck_SkinList],["_headGear",blck_BanditHeadgear]]; +params["_patrols","_coords",["_minNoAI",3],["_maxNoAI",6],["_aiDifficultyLevel","red"],["_weapons",blck_WeaponList_Orange],["_uniforms",blck_SkinList],["_headGear",blck_BanditHeadgear]]; +//diag_log format["_sm_spawnInfantryPatrols:: _this = %1",_this]; +//diag_log format["_sm_spawnInfantryPatrols:: patrols = %1",_patrols]; +if (_patrols isEqualTo []) then +{ + // Use the random spawn logic from the regular dyanmic mission system. + //params[_coords,"_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weapons,sideArms,_isScubaGroup]; + [_coords,_minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionAI +} else { + { + //diag_log format["_sm_spawnInfantryPatrols.sqf:: _x = %1",_x]; + // Use the pre-defined spawn positions and other parameters for each group. + // [[22819.4,16929.5,5.33892],"red",4, 75] + private["_pos","_difficulty","_noAI","_patrolRadius"]; + _pos = _x select 0; // Position at which to spawn the group + _difficulty = _x select 1; // AI difficulty setting (blue, green etc) + _noAI = _x select 2; // Number of AI to spawn with the group + _patrolRadius = _x select 3; // Radius within which AI should patrol + // params["_pos", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], "_center", ["_minDist",20], ["_maxDist",35], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_configureWaypoints",true] ]; + [_pos,_pos,_noAI,_noAI,_difficulty,_patrolRadius,_patrolRadius,true,_uniforms,_headGear] call blck_fnc_spawnGroup; + }forEach _patrols; +}; + diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnLootContainers.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnLootContainers.sqf new file mode 100644 index 0000000..a2fe092 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnLootContainers.sqf @@ -0,0 +1,40 @@ +/* + by Ghostrider [GRG] + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +params["_objects","_coords"]; +private["_object"]; + +if !(_objects isEqualTo []) exitWith +{ // Spawn loot crates where specified in _objects using the information for loot parameters provided for each location. + { + #ifdef blck_debugMode + if (blck_debugLevel > 2) then + { + diag_log format["_fnc_sm_spawnLootContainers (21):-> _x = %1",_x]; + }; + #endif + //diag_log format["_fnc_sm_spawnLootContainers (21):-> _x = %1",_x]; + // [selectRandom blck_crateTypes,[22904.8,16742.5,6.30195],[[0,1,0],[0,0,1]],[true,false], _crateLoot, _lootCounts] + _x params["_crateClassName","_cratePosASL","_vectorDirUp","_allowDamageSim","_crateLoot","_lootCounts"]; + _crate = [_cratePosASL, _crateClassName] call blck_fnc_spawnCrate; + [_crate, _crateLoot,_lootCounts] call blck_fnc_fillBoxes; + } forEach _objects; +}; + +// In the case where no loot crate parameters are defined in _objects just spawn 1 at the center of the mission. +if (_objects isEqualTo []) then +{ + _crateType = selectRandom blck_crateTypes; + _crate = [_coords,_crateType] call blck_fnc_spawnCrate; + [_crate,blck_BoxLoot_Red,blck_lootCountsGreen] call blck_fnc_fillBoxes; +}; + diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnMission.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnMission.sqf new file mode 100644 index 0000000..e359772 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnMission.sqf @@ -0,0 +1,51 @@ +/* + by Ghostrider [GRG] + for ghostridergaming + 12/5/17 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +params["_mission"]; +// Spawn landscape +// params["_objects"]; +[_missionLandscape] call blck_fnc_sm_spawnObjects; +uiSleep 10; // Let the objects 'settle' before placing anything on or around them. + + +// Spawn Air Patrols +// params["_airPatrols","_noAirPatrols","_heliTypes","_center","_difficulty","_uniforms","_headGear"]; +[_airPatrols,_noAirPatrols,_aircraftTypes,_missionCenter,_difficulty,_uniforms,_headgear,_weapons] call blck_fnc_sm_spawnAirPatrols; +//uiSleep 1; + +// Spawn Vehicle Patrols +// params["_coords","_noVehiclePatrols","_vehiclePatrolSpawns","_aiDifficultyLevel","_uniforms","_headGear",["_missionType","unspecified"]]; +[_missionCenter,_noVehiclePatrols,_vehiclePatrolParameters,_difficulty,_uniforms,_headGear] call blck_fnc_sm_spawnVehiclePatrols; +//uiSleep 1; + + +// spawn infantry +// params["_patrols","_coords",["_minNoAI",3],["_maxNoAI",6],["_aiDifficultyLevel","red"],["_weapons",blck_WeaponList_Orange],["_uniforms",blck_SkinList],["_headGear",blck_BanditHeadgear]]; +[_aiGroupParameters, _missionCenter,_minNoAI,_maxNoAI,_difficulty,_weapons,_uniforms,_headGear] call blck_fnc_sm_spawnInfantryPatrols; +//uiSleep 1; + +// spawn loot vehicles +// params["_objects","_coords","_loot","_lootCounts"]; +[_missionLootVehicles,_missionCenter,_crateLoot,_lootCounts] call blck_fnc_sm_spawnLootContainers; + +// Spawn static weapons +// params["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear"]; +[_missionEmplacedWeapons,_noEmplacedWeapons,_difficulty,_missionCenter,_uniforms,_headGear] call blck_fnc_sm_spawnEmplaceds; + +// spawn loot chests +[_missionLootBoxes,_missionCenter,_crateLoot,_lootCounts] call blck_fnc_sm_spawnLootContainers; + +_blck_localMissionMarker = ["",_missionCenter,"","",_markerColor,_markerType]; +[_blck_localMissionMarker] call blck_fnc_spawnMarker; + +diag_log format["[blckeagls] Static Mission Spawner: Mission %1 spawned",_mission]; + diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnObjectASLVectorDirUp.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnObjectASLVectorDirUp.sqf new file mode 100644 index 0000000..9ed7137 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnObjectASLVectorDirUp.sqf @@ -0,0 +1,21 @@ + +/* + by Ghostrider [GRG] + for ghostridergaming + 12/5/17 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +params["_buildingClassName","_posASL","_vectorDirUp","_enableDamSim"]; +_object = createVehicle [_buildingClassName, [0,0,0], [], 0, "CAN_COLLIDE"]; +_object setPosASL _posASL; +_object setVectorDirAndUp _vectorDirUp; +_object enableSimulationGlobal (_enableDamSim select 0); +_object allowDamage (_enableDamSim select 1); + +_object \ No newline at end of file diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnObjects.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnObjects.sqf new file mode 100644 index 0000000..c9f885f --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnObjects.sqf @@ -0,0 +1,19 @@ +/* + by Ghostrider [GRG] + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +params["_objects"]; +private["_objects","_object"]; +{ + _object = [_x select 0, _x select 1, _x select 2, _x select 3] call blck_fnc_sm_spawnObjectASLVectorDirUp; +} forEach _objects; + + diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnVehiclePatrol.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnVehiclePatrol.sqf new file mode 100644 index 0000000..689b715 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnVehiclePatrol.sqf @@ -0,0 +1,33 @@ +/* + by Ghostrider [GRG] + for ghostridergaming + 12/5/17 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +params["_airPatrols"]; +private["_aircraft","_pos","_difficulty","_uniforms","_headGear"]; +_aircraft = _x select 0; +_pos = _x select 1; +_difficulty = _x select 2; +_uniforms = blck_SkinList; +_headGear = blck_headgearList; +switch (_difficulty) do +{ + case "blue": {_weapons = blck_WeaponList_Blue;}; + case "red": {_weapons = blck_WeaponList_Red}; + case "green": {_weapons = blck_WeaponList_Green}; + case "orange": {_weapons = blck_WeaponList_Orange}; +}; +_vehGroup = [_spawnPos,3,3,_aiDifficultyLevel,_coords,1,2,_uniforms,_headGear,false] call blck_fnc_spawnGroup; +//params["_center","_pos",["_vehType","I_G_Offroad_01_armed_F"],["_minDis",30],["_maxDis",45],["_group",grpNull]]; +_return = [_pos,_difficulty,_weapons,_uniforms,_headGear,_aircraft] call blck_fnc_spawnVehiclePatrol; +_group = group (_return select 1 select 0); +_group + diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnVehiclePatrols.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnVehiclePatrols.sqf new file mode 100644 index 0000000..c89c602 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnVehiclePatrols.sqf @@ -0,0 +1,51 @@ +/* + by Ghostrider [GRG] + for ghostridergaming + 12/5/17 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + + +params["_coords","_noVehiclePatrols","_vehiclePatrolSpawns","_aiDifficultyLevel","_uniforms","_headGear",["_missionType","unspecified"]]; +//diag_log format["_sm_spawnVehiclePatrols:: _vehiclePatrolSpawns = %1",_vehiclePatrolSpawns]; +private["_vehGroup","_patrolVehicle","_missionAI","_missiongroups","_vehicles","_return","_vehiclePatrolSpawns","_randomVehicle","_return","_abort"]; +//if (count _weapons isEqualTo 0) then {_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout}; +if (_vehiclePatrolSpawns isEqualTo []) then +{ + private["_spawnPoints","_vehType"]; + _spawnPoints = [_coords,_noVehiclePatrols,75,100] call blck_fnc_findPositionsAlongARadius; + { + // ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red", 600], + _vehType = selectRandom blck_AIPatrolVehicles; + _vehiclePatrolSpawns pushBack [_vehType, _x, _aiDifficultyLevel, 150]; + } forEach _spawnPoints; +}; + +{ + private ["_vehicle","_spawnPos","_difficulty","_patrolRadius"]; + _vehicle = _x select 0; + _spawnPos = _x select 1; + _difficulty = _x select 2; + _patrolRadius = _x select 3; + //_newGroup = [_x,_unitsPerGroup,_unitsPerGroup,_aiDifficultyLevel,_coords,_minDist,_maxDist,_uniforms,_headGear,true,_weapons,_vests,_isScubaGroup] call blck_fnc_spawnGroup; + _vehGroup = [_spawnPos,_spawnPos,3,3,_difficulty,1,2,_uniforms,_headGear,false] call blck_fnc_spawnGroup; + + //params["_center","_pos",["_vehType","I_G_Offroad_01_armed_F"],["_minDis",30],["_maxDis",45],["_group",grpNull]]; + _patrolVehicle = [_spawnPos,_spawnPos,_vehicle,_patrolRadius,_patrolRadius,_vehGroup] call blck_fnc_spawnVehiclePatrol; + //_vehGroup setVariable["groupVehicle",_vehicle]; + + if !(isNull _patrolVehicle) then + { + _patrolVehicle setVariable["vehicleGroup",_vehGroup]; + }; +} forEach _vehiclePatrolSpawns; + +true + + diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_staticPatrolMonitor.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_staticPatrolMonitor.sqf new file mode 100644 index 0000000..f57a5de --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_staticPatrolMonitor.sqf @@ -0,0 +1,27 @@ +/* + by Ghostrider [GRG] + for ghostridergaming + 12/5/17 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +// GMS_fnc_sm_missionPatrolMonitor + +[] call blck_fnc_sm_monitorInfantry; +[] call blck_fnc_sm_monitorScuba; +//uiSleep 0.1; +[] call blck_fnc_sm_monitorVehicles; +[] call blck_fnc_sm_monitorAircraft; +[] call blck_fnc_sm_monitorEmplaced; + +[] call blck_fnc_sm_monitorShips; +[] call blck_fnc_sm_monitorSubs; +//[] call blck_fnc_sm_monitorGarrisonsASL; +//[] call blck_fnc_sm_monitorGarrisons_relPos; + + diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_spawnSDVPatrol.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_spawnSDVPatrol.sqf new file mode 100644 index 0000000..49a418e --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_spawnSDVPatrol.sqf @@ -0,0 +1,21 @@ +/* + by Ghostrider [GRG] + Copyright 2016 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +// ["B_SDV_01_F",[22584.9,15304.8,-6.14801],"red",4, 75,0], +params["_SDV","_pos","_difficulty","_numAI","_patrolRadius","_respawnTime"]; +//diag_log format["_fnc_spawnSDVPatrol: _this = %1",_this]; +private["_vehicle","_group","_diveDepth"]; + +_group = [_pos,_numAI,_numAI,_difficulty,_pos,_patrolRadius - 2,_patrolRadius,blck_UMS_uniforms,blck_UMS_headgear,true,blck_UMS_weapons,blck_UMS_vests,true] call blck_fnc_spawnGroup; +_vehicle = [[_pos select 0, _pos select 1,0],[_pos select 0, _pos select 1,0],_vehType,_patrolRadius - 2,_patrolRadius,_group] call blck_fnc_spawnVehiclePatrol; +_diveDepth = 0.5 * [_pos] call blck_fnc_findWaterDepth; +(driver _vehicle) swiminDepth (_diveDepth select 2); +_group \ No newline at end of file diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_spawnScubaGroup.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_spawnScubaGroup.sqf new file mode 100644 index 0000000..b9d40c1 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_spawnScubaGroup.sqf @@ -0,0 +1,38 @@ +/* + by Ghostrider [GRG] + Copyright 2016 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +#define configureWaypoints true +#define isScubaGroup true +// [_pos,_difficulty,_units,_patrolRadius] +params["_pos",["_skillLevel","red"],["_numUnits",6],["_patrolRadius",15]]; +//diag_log format["_fnc_spawnScubaGroup: _this = %1",_this]; +private["_group","_diveDepth"]; +_group = grpNull; +//params["_pos", "_center", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], ["_minDist",20], ["_maxDist",35],["_configureWaypoints",true], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_scuba",false] ]; +_group = [_pos,_pos,_numUnits,_numUnits,_skillLevel, _patrolRadius - 2, _patrolRadius, configureWaypoints, blck_UMS_uniforms, blck_UMS_headgear, blck_UMS_vests, [], blck_UMS_weapons, [], isScubaGroup] call blck_fnc_spawnGroup; +//diag_log format["_fnc_spawnScubaGroup (14): -> value returned for group = %1",_group]; +private _waterDepth = [_pos] call blck_fnc_findWaterDepth; +_diveDepth = _waterDepth * 0.5; +{ + _x swimInDepth (_diveDepth); +} forEach units _group; + +#ifdef blck_debugMode +if (blck_debugLevel > 1) then +{ + { + diag_log format["_fnc_spawnScubaGroup:: _this select %1 = %2",_forEachIndex,_this select _forEachIndex]; + }forEach _this; + + diag_log format["_fnc_spawnScubaGroup:: -->> group spawned = %1",_group]; +}; +#endif +_group; diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_spawnSurfacePatrol.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_spawnSurfacePatrol.sqf new file mode 100644 index 0000000..c2a6612 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_spawnSurfacePatrol.sqf @@ -0,0 +1,22 @@ + +/* + by Ghostrider [GRG] + Copyright 2016 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +// ["B_SDV_01_F",[22584.9,15304.8,-6.14801],"red",4, 75,0], +params["_SDV","_pos","_difficulty","_numAI","_patrolRadius","_respawnTime"]; +//diag_log format["_fnc_spawnSurfacePatrol: _this = %1",_this]; +private["_vehicle"]; +_group = [_pos,_numAI,_numAI,_difficulty,_pos,_patrolRadius - 2,_patrolRadius,blck_UMS_uniforms,blck_UMS_headgear,true,blck_UMS_weapons,blck_UMS_vests,true] call blck_fnc_spawnGroup; +// params["_center","_pos",["_vehType","I_G_Offroad_01_armed_F"],["_minDis",30],["_maxDis",45],["_group",grpNull]]; + +_vehicle = [_pos,_pos,_vehType,_minDis,_maxDis,_group] call blck_fnc_spawnVehiclePatrol; +_vehicle + diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_sm_AddSDVVehicle.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_sm_AddSDVVehicle.sqf new file mode 100644 index 0000000..49581d0 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_sm_AddSDVVehicle.sqf @@ -0,0 +1,15 @@ +/* + by Ghostrider [GRG] + Copyright 2016 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +params["_vehicle"]; +blck_sm_submarines pushBack [_vehicle,grpNull,0]; +true \ No newline at end of file diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_sm_AddScubaGroup.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_sm_AddScubaGroup.sqf new file mode 100644 index 0000000..3b73fdc --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_sm_AddScubaGroup.sqf @@ -0,0 +1,16 @@ +/* + by Ghostrider [GRG] + Copyright 20167 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +params["_group"]; +blck_sm_scubaGroups pushBack [_group,grpNull,0]; +//diag_log format["_sm_AddScubaGroup:: blck_sm_scubaGroups = %1",blck_sm_scubaGroups]; +true \ No newline at end of file diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_sm_AddSurfaceVehicle.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_sm_AddSurfaceVehicle.sqf new file mode 100644 index 0000000..3150815 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_sm_AddSurfaceVehicle.sqf @@ -0,0 +1,15 @@ +/* + by Ghostrider [GRG] + Copyright 2016 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +params["_vehicle"]; +blck_sm_surfaceShips pushBack [_vehicle,grpNull,0]; +true \ No newline at end of file diff --git a/@GMS/addons/custom_server/Missions/Static/GMS_StaticMissions_Lists.sqf b/@GMS/addons/custom_server/Missions/Static/GMS_StaticMissions_Lists.sqf index 7ba591f..0bacb1f 100644 --- a/@GMS/addons/custom_server/Missions/Static/GMS_StaticMissions_Lists.sqf +++ b/@GMS/addons/custom_server/Missions/Static/GMS_StaticMissions_Lists.sqf @@ -17,9 +17,8 @@ _staticMissions = [ // [mod (Epoch, Exile), map (Altis, Tanoa etc), mission center, eg [10445,2014,0], filename.sqf (name of static mission template for that mission)]; //["Epoch","Altis","template.sqf"], //["Epoch","Altis","staticMissionExample2_Epoch.sqf"], - //["Epoch","Altis","destroyer.sqf"], - //["Exile","Altis","template.sqf"], - //["Exile","Altis","staticMissionExample2_Exile.sqf"] + //["Exile","Altis","staticMissionExample2_Exile.sqf"], + ["newmission","newmap","somescript.sqf"] ]; diag_log "[blckeagls] GMS_StaticMissions_Lists.sqf "; diff --git a/@GMS/addons/custom_server/Missions/Static/GMS_StaticMissions_init.sqf b/@GMS/addons/custom_server/Missions/Static/GMS_StaticMissions_init.sqf index fe6f3e1..2cf1d3b 100644 --- a/@GMS/addons/custom_server/Missions/Static/GMS_StaticMissions_init.sqf +++ b/@GMS/addons/custom_server/Missions/Static/GMS_StaticMissions_init.sqf @@ -11,12 +11,21 @@ */ #include "\q\addons\custom_server\Configs\blck_defines.hpp"; //diag_log "[blckeagls] GMS_StaticMissions_init.sqf "; - //static mission descriptor for code: [position,level, numAI or [min,maxAI],patrolRadius, respawn, group[groupNull],spawnedAt[0],respawn[0]] #include "\q\addons\custom_server\Configs\blck_defines.hpp"; -#include "\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_init_functions.sqf"; #include "\q\addons\custom_server\Missions\Static\GMS_StaticMissions_Lists.sqf"; +blck_sm_Infantry = []; +blck_sm_Vehicles = []; +blck_sm_Aircraft = []; +blck_sm_Emplaced = []; +blck_sm_scubaGroups = []; +blck_sm_surfaceShips = []; +blck_sm_submarines = []; +blck_sm_lootContainers = []; +blck_sm_garrisonBuildings_ASL = []; +blcl_sm_garrisonBuilding_relPos = []; + blck_sm_monitoring = 0; blck_sm_groupDespawnTime = 10; // 120; blck_sm_patrolRespawnInterval = 10; // 600 diff --git a/@GMS/addons/custom_server/Missions/Static/missions/staticMissionExample2_Epoch.sqf b/@GMS/addons/custom_server/Missions/Static/missions/staticMissionExample2_Epoch.sqf index 572eb4a..cc01a84 100644 --- a/@GMS/addons/custom_server/Missions/Static/missions/staticMissionExample2_Epoch.sqf +++ b/@GMS/addons/custom_server/Missions/Static/missions/staticMissionExample2_Epoch.sqf @@ -102,9 +102,9 @@ _aiGroupParameters = [ //[[22947.8,16717,6.80305],"red",4, 75,900], // [[22849,16720.4,7.33123],"red",4, 75,9000], //[[22832.9,16805.6,4.59315],"red",4, 75,900], - [[22909.8,16778.6,3.19144],"red",4, 75,900], - [[22809.4,16929.5,5.33892],"blue",5, 75,0], - [[22819.4,16929.5,0],"red",5, 75, 10, 9000] +//[[22909.8,16778.6,3.19144],"red",4, 75,900], + //[[22809.4,16929.5,5.33892],"blue",1, 75,0], + [[22819.4,16929.5,0],"red",1, 75, 10, 1] ]; _noVehiclePatrols = blck_SpawnVeh_Red; // Modified as needed; can be a numberic value (e.g. 3) or range presented as [2,4]; diff --git a/@GMS/addons/custom_server/Missions/Static/missions/staticMissionExample2_Exile.sqf b/@GMS/addons/custom_server/Missions/Static/missions/staticMissionExample2_Exile.sqf index 25cc45c..21d2334 100644 --- a/@GMS/addons/custom_server/Missions/Static/missions/staticMissionExample2_Exile.sqf +++ b/@GMS/addons/custom_server/Missions/Static/missions/staticMissionExample2_Exile.sqf @@ -86,7 +86,7 @@ _missionLootBoxes = [ // Paste appropriate lines from M3EDEN editor output her _missionLootVehicles = [ // Paste appropriate lines from the output of M3EDEN Editor here and add the loot crate type and loot counts at the end of each entry as shown in the example below. // Many vehicles have less inventory capacity than crates so you may have to modify _lootcounts to avoid having stuff spawned all over the ground. //["Exile_Car_Van_Box_Guerilla02",[22896.8,16790.1,3.18987],[[0,1,0],[0,0,1]],[true,false], _crateLoot, [[1,2],[4,6],[2,6],[5,8],6,1]], - ["Exile_Car_Van_Fuel_Guerilla02",[22919,16782.7,3.18132],[[0,1,0],[0.00129187,0,0.999999]],[true,false],_crateLoot, _lootCounts] + //["Exile_Car_Van_Fuel_Guerilla02",[22919,16782.7,3.18132],[[0,1,0],[0.00129187,0,0.999999]],[true,false],_crateLoot, _lootCounts] ]; // [ ["vehicleClassName", [px, py, pz] /* possition at which to spawn*/, _loot /* pointer to array of loot (see below)]; // When blank nothing is spawned. // You can use the same format used for _missionLootBoxes to add vehicles with/without loot. @@ -97,8 +97,8 @@ _noEmplacedWeapons = blck_SpawnEmplaced_Red; // Modified as needed; can be a num // Note that this value is ignored if you define static weapon positions and types in the array below. _missionEmplacedWeapons = [ // ["Weapon Class Name", position[x,y,z], AI Skill [blue, red, green, orange],patrol radius [0 for static units], respawn time [seconds]] - ["B_HMG_01_high_F",[22922.7,16763.9,6.30801],"red",0,0], - ["B_HMG_01_high_F",[22883.5,16757.6,6.31652],"blue",0,10] + //["B_G_Mortar_01_F",[22867.3,16809.1,3.17968],"red",0,0], + //["B_HMG_01_high_F",[22944.3,16820.5,3.14243],"green",0,0] ]; // example [ ["emplacedClassName",[px, py, pz] /* position to spawn weapon */, difficulty /* difficulty of AI manning weapon (blue, red etc)] ]; // can be used to define the precise placement of static weapons [[1,2,3] /*loc 1*/, [2,3,4] /*loc 2*/]; if blank random locations will be used // If the number of possible locations exceeds the number of emplaced weapons specified above then only some of the locations in the array will have emplaced weapons spawned. @@ -109,9 +109,14 @@ _maxNoAI = blck_MaxAI_Red; // Modify as needed. _noAIGroups = blck_AIGrps_Red; // Modify as needed; note that these values are ignored of you specify AI patrols in the array below. _aiGroupParameters = [ // [ [px, py, pz] /* position*/, "difficulty", 4 /*Number to Spawn*/, 150 /*radius of patrol*/, 120 /* seconds to wait to respawn after all units dead */] + //[[22920.4,16887.3,3.19144],"red",[1,2], 75,120], + //[[22993.3,16830.8,5.6292],"red",4, 75,9000], + //[[22947.8,16717,6.80305],"red",4, 75,900], + //[[22849,16720.4,7.33123],"red",4, 75,9000], + //[[22832.9,16805.6,4.59315],"red",4, 75,900], //[[22909.8,16778.6,3.19144],"red",4, 75,900], - //[[22809.4,16929.5,5.33892],"blue",5, 75,0], - [[22819.4,16929.5,0],"red",5, 75, 10, 10] + //[[22819.4,16929.5,5.33892],"red",4, 75,900], + [[22819.4,16929.5,5.33892],"red",4, 75,900] ]; _noVehiclePatrols = blck_SpawnVeh_Red; // Modified as needed; can be a numberic value (e.g. 3) or range presented as [2,4]; @@ -129,7 +134,7 @@ _noAirPatrols = blck_noPatrolHelisRed; // You can use one of the pre-defined val _airPatrols = [ // // ["Aircraft Class Name", position[x,y,z], AI Skill [blue, red, green, orange],patrol radius [0 for static units], respawn time [seconds]] //["Exile_Chopper_Huey_Armed_Green",[22923.4,16953,3.19],"red",1000,900]//, - [selectRandom _aircraftTypes,[22830.2,16618.1,11.4549],"green",1000,0] + //[selectRandom _aircraftTypes,[22830.2,16618.1,11.4549],"blue",1000,0] ]; // Change _useMines to true/false below to enable mission-specific settings. _useMines = blck_useMines; // Set to false if you have vehicles patrolling nearby. diff --git a/@GMS/addons/custom_server/Missions/UMS/GMS_UMS_StaticMissions_init.sqf b/@GMS/addons/custom_server/Missions/UMS/GMS_UMS_StaticMissions_init.sqf index 23703e8..6ddba04 100644 --- a/@GMS/addons/custom_server/Missions/UMS/GMS_UMS_StaticMissions_init.sqf +++ b/@GMS/addons/custom_server/Missions/UMS/GMS_UMS_StaticMissions_init.sqf @@ -15,8 +15,8 @@ #include "\q\addons\custom_server\Missions\UMS\GMS_UMS_StaticMissions_Lists.sqf"; { - diag_log format["[blckeagls] GMS__UMS_StaticMissions_init.sqf ",_x]; - diag_log format["[blckeagls] GMS__UMS_StaticMissions_init.sqf ",toLower worldName,(toLower blck_modType)]; + //diag_log format["[blckeagls] GMS__UMS_StaticMissions_init.sqf ",_x]; + //diag_log format["[blckeagls] GMS__UMS_StaticMissions_init.sqf ",toLower worldName,(toLower blck_modType)]; if ((toLower worldName) isEqualTo toLower(_x select 1)) then { if ((toLower blck_modType) isEqualTo (toLower(_x select 0))) then diff --git a/@GMS/addons/custom_server/Missions/UMS/GMS_UMS_configurations.sqf b/@GMS/addons/custom_server/Missions/UMS/GMS_UMS_configurations.sqf index 31c1c06..6f96211 100644 --- a/@GMS/addons/custom_server/Missions/UMS/GMS_UMS_configurations.sqf +++ b/@GMS/addons/custom_server/Missions/UMS/GMS_UMS_configurations.sqf @@ -60,7 +60,7 @@ if ((tolower blck_modType) isEqualTo "epoch") then "B_SDV_01_EPOCH" ]; //blck_UMS_crates = blck_crateTypes; - blck_UMS_crates = ["container_epoch"]; + blck_UMS_crates = ["container_epoch"]; }; blck_UMS_unarmedSurfaceVessels = [ diff --git a/@GMS/addons/custom_server/Missions/UMS/GMS_UMS_init.sqf b/@GMS/addons/custom_server/Missions/UMS/GMS_UMS_init.sqf index d163365..a455c0b 100644 --- a/@GMS/addons/custom_server/Missions/UMS/GMS_UMS_init.sqf +++ b/@GMS/addons/custom_server/Missions/UMS/GMS_UMS_init.sqf @@ -17,7 +17,7 @@ blck_UMS_ActiveDynamicMissions = []; #include "GMS_UMS_configurations.sqf"; -#include "code\GMS_UMS_functions.sqf"; +//#include "code\GMS_UMS_functions.sqf"; #include "GMS_UMS_dynamicMissionList.sqf"; [] execVM "q\addons\custom_server\Missions\UMS\GMS_UMS_StaticMissions_init.sqf"; diff --git a/@GMS/addons/custom_server/Missions/UMS/GMS_fnc_spawnDynamicUMSMission.sqf b/@GMS/addons/custom_server/Missions/UMS/GMS_fnc_spawnDynamicUMSMission.sqf new file mode 100644 index 0000000..76646b7 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/UMS/GMS_fnc_spawnDynamicUMSMission.sqf @@ -0,0 +1,636 @@ +/* + Dynamic Underwater Mission Spawner + By Ghostrider GRG + Copyright 2016 + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +#define isScubaMission true +#define delayTime 1 +private ["_abort","_crates","_aiGroup","_objects","_mines","_blck_AllMissionAI","_blck_localMissionMarker", + "_AI_Vehicles","_timeOut","_aiDifficultyLevel","_missionPatrolVehicles","_missionGroups","_loadCratesTiming","_spawnCratesTiming","_assetSpawned", + "_blck_AllMissionAI","_delayTime","_wait","_missionStartTime","_playerInRange","_missionTimedOut","_temp","_patrolVehicles","_vehToSpawn","_marker","_vehiclecrewcount"]; + +params["_coords","_mission",["_allowReinforcements",false]]; + +_markerClass = _mission; +_aiDifficultyLevel = _difficulty; // _difficulty is defined in the mission description file. see \addons\custom_server\Missions\UMS\dynamicMissions\default.sqf for an example + +diag_log format["[blckeagls Dynamic UMS] dynamicUMSspawner (34):: Initializing mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + +if (isNil "_markerColor") then {_markerColor = "ColorBlack"}; +if (isNil "_markerType") then {_markerType = ["mil_box",[]]}; +//if (isNil "_timeOut") then {_timeOut = -1;}; +if (isNil "_missionGroups") then {_missionGroups = []}; +if (isNil "_endCondition") then {_endCondition = blck_missionEndCondition}; // Options are "allUnitsKilled", "playerNear", "allKilledOrPlayerNear"}; +if (isNil "_spawnCratesTiming") then {_spawnCratesTiming = blck_spawnCratesTiming}; // Choices: "atMissionSpawnGround","atMissionStartAir","atMissionEndGround","atMissionEndAir". +if (isNil "_loadCratesTiming") then {_loadCratesTiming = blck_loadCratesTiming}; // valid choices are "atMissionCompletion" and "atMissionSpawn"; +if (isNil "_useMines") then {_useMines = blck_useMines;}; + +if (isNil "_weaponList") then {_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout}; +if (isNil "_sideArms") then {_sideArms = [_aiDifficultyLevel] call blck_fnc_selectAISidearms}; +if (isNil "_uniforms") then {_uniforms = [_aiDifficultyLevel] call blck_fnc_selectAIUniforms}; +if (isNil "_headGear") then {_headGear = [_aiDifficultyLevel] call blck_fnc_selectAIHeadgear}; +if (isNil "_vests") then {_vests = [_aiDifficultyLevel] call blck_fnc_selectAIVests}; +if (isNil "_backpacks") then {_backpacks = [_aiDifficultyLevel] call blck_fnc_selectAIBackpacks}; + +if (isNil "_chanceHeliPatrol") then {_chanceHeliPatrol = [_aiDifficultyLevel] call blck_fnc_selectChanceHeliPatrol}; +if (isNil "_noChoppers") then {_noChoppers = [_aiDifficultyLevel] call blck_fnc_selectNumberAirPatrols}; +if (isNil "_chancePara") then {_chancePara = [_aiDifficultyLevel] call blck_fnc_selectChanceParatroops}; +if (isNil "_missionHelis") then {_missionHelis = [_aiDifficultyLevel] call blck_fnc_selectMissionHelis}; +if (isNil "_noPara") then {_noPara = [_aiDifficultyLevel] call blck_fnc_selectNumberParatroops}; + +if (isNil "_chanceLoot") then {_chanceLoot = 0}; +if (isNil "_paraTriggerDistance") then {_paraTriggerDistance = 400;}; +if (isNil "_paraLoot") then {_paraLoot = blck_BoxLoot_Blue}; +if (isNil "_paraLootCounts") then {_paraLootCounts = blck_lootCountsRed}; +if (isNil "_vehicleCrewCount") then {_vehicleCrewCount = [_aiDifficultyLevel] call GMS_fnc_selectVehicleCrewCount}; + +_objects = []; +_mines = []; +_crates = []; +_aiGroup = []; +_missionAIVehicles = []; +_blck_AllMissionAI = []; +_AI_Vehicles = []; +_blck_localMissionMarker = [_markerClass,_coords,"","",_markerColor,_markerType]; +_delayTime = 1; +_groupPatrolRadius = 50; + +if (blck_labelMapMarkers select 0) then +{ + _blck_localMissionMarker set [2, _markerMissionName]; +}; +if !(blck_preciseMapMarkers) then +{ + _blck_localMissionMarker set [1,[_coords,75] call blck_fnc_randomPosition]; +}; +_blck_localMissionMarker set [3,blck_labelMapMarkers select 1]; // Use an arrow labeled with the mission name? +[["start",_startMsg,_markerMissionName]] call blck_fnc_messageplayers; +_marker = [_blck_localMissionMarker] call blck_fnc_spawnMarker; +#ifdef blck_debugMode +if (blck_debugLevel > 0) then {diag_log "dynamicUMSspawner:: (91) message players and spawn a mission marker";}; +if (blck_debugLevel > 0) then {diag_log "dynamicUMSspawner:: (77) waiting for player to trigger the mission";}; +#endif +//////// +// All parameters are defined, let's wait until a player is nearby or the mission has timed out +//////// + +_missionStartTime = diag_tickTime; +_playerInRange = false; +_missionTimedOut = false; + +_wait = true; + +#ifdef blck_debugMode +if (blck_debugLevel > 0) then {diag_log "dynamicUMSspawner:: (90) starting mission trigger loop"}; +if (blck_debugLevel > 2) then {_wait = false}; +#endif + +while {_wait} do +{ + #ifdef blck_debugMode + if (blck_debugLevel > 2) exitWith {_playerInRange = true;}; + #endif + + if ([_coords, blck_TriggerDistance, false] call blck_fnc_playerInRange) exitWith {_playerInRange = true;}; + if ([_missionStartTime,blck_MissionTimeout] call blck_fnc_timedOut) exitWith {_missionTimedOut = true;}; + uiSleep 5; + + #ifdef blck_debugMode + if (blck_debugLevel > 2) then + { + diag_log format["dynamicUMSspawner:: Trigger Loop - blck_debugLevel = %1 and _coords = %2",blck_debugLevel, _coords]; + diag_log format["dynamicUMSspawner:: Trigger Loop - players in range = %1",{isPlayer _x && _x distance2D _coords < blck_TriggerDistance} count allPlayers]; + diag_log format["dynamicUMSspawner:: Trigger Loop - timeout = %1", [_missionStartTime,blck_MissionTimeout] call blck_fnc_timedOut]; + }; + #endif +}; + +if (_missionTimedOut) exitWith +{ + // Deal with the case in which the mission timed out. + blck_priorDynamicUMS_Missions pushback [_coords,diag_tickTime]; + blck_UMS_ActiveDynamicMissions = blck_UMS_ActiveDynamicMissions - [_coords]; + blck_dynamicUMS_MissionsRuning = blck_dynamicUMS_MissionsRuning - 1; + diag_log format["_fnc_dynamicUMSSpawner (187): mission timed out"]; + [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; +}; + +//////// +// Spawn the mission objects, loot chest, and AI +//////// +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] dynamicUMSspawner:: (142) -- >> Mission tripped: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; +}; +#endif + +if (blck_SmokeAtMissions select 0) then // spawn a fire and smoke near the crate +{ + _temp = [_coords,blck_SmokeAtMissions select 1] call blck_fnc_smokeAtCrates; + if (typeName _temp isEqualTo "ARRAY") then + { + _objects append _temp; + }; +}; + +uiSleep delayTime; +if (_useMines) then +{ + _mines = [_coords] call blck_fnc_spawnMines; + //uiSleep _delayTime;; +}; +uiSleep delayTime; +_temp = []; +//diag_log format["_dynamicUMSspawner"" _missionLandscape = %1 | _missionLandscapeMode = %2",_missionLandscape, _missionLandscapeMode]; +if (_missionLandscapeMode isEqualTo "random") then +{ + _temp = [_coords,_missionLandscape, 3, 15, 2] call blck_fnc_spawnRandomLandscape; +}; +if (_missionLandscapeMode isEqualTo "precise") then +{ + //params["_center","_objects"]; + _temp = [_coords, _missionLandscape] call blck_fnc_spawnCompositionObjects; + //uiSleep 1; +}; +//diag_log format["_fnc_dynamicUMSspawner: _temp = %1, typeName _temp = %2",_temp, typeName _temp]; +if (typeName _temp isEqualTo "ARRAY") then +{ + _objects append _temp; +}; +//diag_log format["_fnc_dynamicUMSspawner:: (176)->> _objects = %1",_objects]; + +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] dynamicUMSspawner:: (190) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; +}; +#endif + +uiSleep delayTime;; + +_temp = [_coords,_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles; +//uisleep 1; +_crates append _temp; + +uiSleep _delayTime; + +_abort = false; +_temp = [[],[],false]; +//diag_log format["_fnc_dynamicUMSspawner: spawning infantry using data in _missionGroups with _missionGroups = %1",_missionGroups]; +// Require that the server admin define the location of any infantry patrols given that missions will be off-shore. +// AI could be spawned on a platform or floating structure. +if (count _missionGroups > 0) then +{ + // params["_coords",["_minNoAI",3],["_maxNoAI",6],"_missionGroups",["_aiDifficultyLevel","red"],["_uniforms",blck_SkinList],["_headGear",blck_BanditHeadgear],["_vests",blck_vests],["_backpacks",[]],["_weapons",[]],["_sideArms",blck_Pistols],["_isScubaGroup",false]]; + _temp = [_coords, _minNoAI,_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,false] call blck_fnc_spawnMissionAI; +}; + +#ifdef blck_debugMode +if (blck_debugLevel > 2) then +{ + diag_log format["dynamicUMSspawner :: (209) blck_fnc_spawnMissionAI returned a value of _temp = %1",_temp]; uiSleep 1; +}; + +_abort = _temp select 1; +if (blck_debugLevel > 2) then +{ + diag_log format["dynamicUMSspawner :: (214) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1; +}; +#endif + +if (count _scubaGroupParameters > 0) then +{ + //diag_log format["_fnc_dynamicUMSspawner: spawning scuba groups with _scubaGroupParameters = %1",_scubaGroupParameters]; + // params["_coords",["_minNoAI",3],["_maxNoAI",6],"_missionGroups",["_aiDifficultyLevel","red"],["_uniforms",blck_SkinList],["_headGear",blck_BanditHeadgear],["_vests",blck_vests],["_backpacks",[]],["_weapons",[]],["_sideArms",blck_Pistols],["_isScubaGroup",false]]; + _temp = [_coords, _minNoAI,_maxNoAI,_scubaGroupParameters,_aiDifficultyLevel,blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,[],blck_UMS_weapons,[],isScubaMission] call blck_fnc_spawnMissionAI; +}; + +#ifdef blck_debugMode +if (blck_debugLevel > 2) then +{ + diag_log format["dynamicUMSspawner :: (209) blck_fnc_spawnMissionAI returned a value of _temp = %1",_temp]; uiSleep 1; +}; + +_abort = _temp select 1; +if (blck_debugLevel > 2) then +{ + diag_log format["dynamicUMSspawner :: (214) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1; +}; +#endif + +if (_abort) exitWith +{ + if (blck_debugLevel > 1) then { + diag_log "dynamicUMSspawner:: (220) grpNull returned, mission termination criteria met, calling blck_fnc_endMission" + }; + [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,1,isScubaMission] call blck_fnc_endMission; +}; +if !(_abort) then +{ + _blck_AllMissionAI append (_temp select 0); +}; + +uiSleep _delayTime; + +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] dynamicUMSspawner:: (235) AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; +}; +#endif + +uiSleep _delayTime; +_temp = [[],[],false]; +_abort = false; +private["_patrolVehicles","_vehToSpawn"]; +//diag_log format["_fnc_dynamicUMSspawner (258): _noVehiclePatrols = %1",_noVehiclePatrols]; +_vehToSpawn = 0; +//diag_log format["_dynamicUMSspawner:: _vehToSpawn = %1",_vehToSpawn]; +// Spawn any surface patrols +if (blck_useVehiclePatrols && count _vehiclePatrolParameters > 0) then +{ + // params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_isScubaGroup",false]]; + _temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_vehiclePatrolParameters,true,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,false,_vehicleCrewCount /*,blck_UMS_weapons,blck_UMS_vests,isScubaMission*/ ] call blck_fnc_spawnMissionVehiclePatrols; + #ifdef blck_debugMode + if (blck_debugLevel > 1) then { + diag_log format["dynamicUMSspawner :: (251) blck_fnc_spawnMissionVehiclePatrols returned _temp = %1",_temp]; + }; + #endif + + if (typeName _temp isEqualTo "ARRAY") then + { + _abort = _temp select 2; + }; + if !(_abort) then + { + _patrolVehicles = _temp select 0; + _blck_AllMissionAI append (_temp select 1); + + #ifdef blck_debugMode + if (blck_debugLevel > 0) then + { + diag_log format["[blckeagls] dynamicUMSspawner:: (267) Vehicle Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + }; + #endif + + }; +}; +// Spawn any submarine patrols +if (blck_useVehiclePatrols && count _submarinePatrolParameters > 0) then +{ + // params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_isScubaGroup",false]]; + _temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_submarinePatrolParameters,true,blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,[],blck_UMS_weapons,[],isScubaMission] call blck_fnc_spawnMissionVehiclePatrols; + #ifdef blck_debugMode + if (blck_debugLevel > 1) then { + diag_log format["dynamicUMSspawner :: (251) blck_fnc_spawnMissionVehiclePatrols returned _temp = %1",_temp]; + }; + #endif + + if (typeName _temp isEqualTo "ARRAY") then + { + _abort = _temp select 2; + }; + if !(_abort) then + { + _patrolVehicles = _temp select 0; + //diag_log format["[blckeagls] dynamicUMSspawner:: Patrol vehicles = %1",_patrolVehicles]; + _blck_AllMissionAI append (_temp select 1); + + #ifdef blck_debugMode + if (blck_debugLevel > 0) then + { + diag_log format["[blckeagls] dynamicUMSspawner:: (267) Vehicle Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + }; + #endif + + }; +}; + +if (_abort) exitWith +{ + #ifdef blck_debugMode + if (blck_debugLevel > 0) then { + diag_log "dynamicUMSspawner:: (279) grpNull returned, mission termination criteria met, calling blck_endMission"; + }; + #endif + + [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,1,isScubaMission] call blck_fnc_endMission; +}; + +uiSleep delayTime; +_temp = [[],[],false]; +_abort = false; + +_noChoppers = [_noChoppers] call blck_fnc_getNumberFromRange; +_noPara = [_noPara] call blck_fnc_getNumberFromRange; + +#ifdef blck_debugMode +if (blck_debugLevel > 1) then {diag_log format["_dynamicUMSspawner(322):: _noChoppers = %1 && _chancePara = %2",_noChoppers,_chancePara]}; +#endif +if (_noChoppers > 0) then +{ + for "_i" from 1 to (_noChoppers) do + { + if (random(1) < _chanceHeliPatrol) then + { + //_temp = [_coords,_missionHelis,spawnHeli,_aiDifficultyLevel,_chancePara,_noPara,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionReinforcements; + _temp = [_coords,_aiDifficultyLevel,_missionHelis] call blck_fnc_spawnMissionHeli; + + if (typeName _temp isEqualTo "ARRAY") then + { + _abort = _temp select 2; + blck_monitoredVehicles pushBack (_temp select 0); + _blck_AllMissionAI append (_temp select 1); + }; + if (_abort) then + { + _objects pushback (_temp select 0); + [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; + }; + }; + }; +}; + +////////////////////////// +// Spawn Crates and Emplaced Weapons Last to try to force them to correct positions relative to spawned buildinga or other objects. +#ifdef blck_debugMode +if (blck_debugLevel > 0) then {diag_log format["dynamicUMSspawner:: (361) preparing to spawn emplaced weapons for _coords %4 | _markerClass %3 | blck_useStatic = %1 | _noEmplacedWeapons = %2",blck_useStatic,_noEmplacedWeapons,_markerClass,_coords];}; +#endif +uiSleep 15; +private["_noEmplacedToSpawn"]; +_noEmplacedToSpawn = [_noEmplacedWeapons] call blck_fnc_getNumberFromRange; +//diag_log format["_dynamicUMSspawner:: _noEmplacedToSpawn = %1",_vehToSpawn]; +if (blck_useStatic && ((_noEmplacedToSpawn > 0)) || count _missionEmplacedWeapons > 0) then +{ + // params["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear"]; + //_temp = [_missionEmplacedWeapons,_noEmplacedToSpawn,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnEmplacedWeaponArray; + _temp = [_coords,_missionEmplacedWeapons,true,_noEmplacedToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnEmplacedWeaponArray; + + #ifdef blck_debugMode + if (blck_debugLevel > 2) then + { + diag_log format ["dynamicUMSspawner:: (375) blck_fnc_spawnEmplacedWeaponArray returned _temp = %1",_temp]; + }; + #endif + + if (typeName _temp isEqualTo "ARRAY") then + { + _abort = _temp select 2; + }; + + #ifdef blck_debugMode + if (blck_debugLevel > 2) then + { + diag_log format ["dynamicUMSspawner:: (387) _abort = %1",_abort]; + + }; + #endif + + if !(_abort) then + { + _objects append (_temp select 0); + _blck_AllMissionAI append (_temp select 1); + + #ifdef blck_debugMode + if (blck_debugLevel > 0) then + { + diag_log format["[blckeagls] dynamicUMSspawner:: (400) Static Weapons Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + }; + #endif + }; +}; +if (_abort) exitWith +{ + #ifdef blck_debugMode + if (blck_debugLevel > 2) then + { + diag_log "dynamicUMSspawner:: (410) grpNull ERROR in blck_fnc_spawnEmplacedWeaponArray, mission termination criteria met, calling blck_endMission"; + }; + #endif + + [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,1,isScubaMission] call blck_fnc_endMission; +}; + +uiSleep _delayTime; +if (_spawnCratesTiming isEqualTo "atMissionSpawnGround") then +{ + if (count _missionLootBoxes > 0) then + { + _crates = [_coords,_missionLootBoxes,_loadCratesTiming, _spawnCratesTiming, "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; + } + else + { + _crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming, _spawnCratesTiming, "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; + + }; + + if (blck_cleanUpLootChests) then + { + _objects append _crates; + }; +}; + +if (blck_cleanUpLootChests) then +{ + _objects append _crates; +}; +if (_noPara > 0 && (random(1) < _chancePara) && _paraTriggerDistance == 0) then +{ + //diag_log format["_fnc_missionSpawner (435): spawning %1 paraunits at mission spawn",_noPara]; + //private _paratroops = [_coords,_noPara,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnParaUnits; + // blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,[],blck_UMS_weapons,[],isScubaMission + private _paratroops = [_coords,_noPara,_aiDifficultyLevel,blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,[],blck_UMS_weapons,[],isScubaMission] call blck_fnc_spawnParaUnits; + if !(isNull _paratroops) then + { + _blck_AllMissionAI append (units _paratroops); + }; + if (random(1) < _chanceLoot) then + { + private _extraCrates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_paraLoot,_paraLootCounts]], "atMissionSpawn","atMissionStartAir", "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; + if (blck_cleanUpLootChests) then + { + _objects append _extraCrates; + }; + }; +}; + +//uisleep 2; +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] dynamicUMSspawner:: (428) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; +}; +#endif + +// Trigger for mission end +#ifdef blck_debugMode +diag_log format["[blckeagls] mission Spawner(436) _endCondition = %1",_endCondition]; +#endif +private["_missionComplete","_endIfPlayerNear","_endIfAIKilled"]; +_missionComplete = -1; +_startTime = diag_tickTime; +if (blck_showCountAliveAI) then +{ + //diag_log format["_dynamicUMSspawner(441): Adding Number Alive AI: _marker = %1 | _markerMissionName = %2",_marker,_markerMissionName]; + //diag_log format["_dynamicUMSspawner(442): Alive AI = %1 | Current Marker Text = %2",{alive _x} count _blck_AllMissionAI, markerText _marker]; + if !(_marker isEqualTo "") then + { + [_marker,_markerMissionName,_blck_AllMissionAI] call blck_fnc_updateMarkerAliveCount; + blck_missionMarkers pushBack [_marker,_markerMissionName,_blck_AllMissionAI]; + //diag_log format["_dynamicUMSspawner: blck_missionMarkers = %1",blck_missionMarkers]; + }; +}; +switch (_endCondition) do +{ + case "playerNear": {_endIfPlayerNear = true;_endIfAIKilled = false;}; + case "allUnitsKilled": {_endIfPlayerNear = false;_endIfAIKilled = true;}; + case "allKilledOrPlayerNear": {_endIfPlayerNear = true;_endIfAIKilled = true;}; +}; +#ifdef blck_debugMode +diag_log format["dynamicUMSspawner :: (449) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled]; +#endif +private["_locations"]; +_locations = [_coords]; +{ + _locations pushback (getPos _x); + _x setVariable["crateSpawnPos", (getPos _x)]; +} forEach _crates; +#ifdef blck_debugMode +diag_log format["dynamicUMSspawner (458):: _coords = %1 | _crates = %2 | _locations = %3",_coords,_crates,_locations]; +#endif +private _crateStolen = false; +#ifdef blck_debugMode +diag_log format["dynamicUMSspawner(462):: Waiting for player to satisfy mission end criteria of _endIfPlayerNear %1 with _endIfAIKilled %2",_endIfPlayerNear,_endIfAIKilled]; +#endif + +if (blck_showCountAliveAI) then +{ + if !(_marker isEqualTo "") then + { + [_marker,_markerMissionName,_blck_AllMissionAI] call blck_fnc_updateMarkerAliveCount; + blck_missionMarkers pushBack [_marker,_markerMissionName,_blck_AllMissionAI]; + }; +}; + +private _spawnPara = if (random(1) < _chancePara) then {true} else {false}; +_missionComplete = -1; +while {_missionComplete isEqualTo -1} do +{ + #ifdef blck_debugMode + if (blck_debugLevel isEqualTo 3) exitWith {uiSleep 10; diag_log "_fnc_dynamicUMSSpawner (574): scripted mission end";}; + #endif + if ((_endIfPlayerNear) && [_locations,10,true] call blck_fnc_playerInRangeArray) exitWith {}; + if ((_endIfAIKilled) && ({alive _x} count _blck_AllMissionAI) < 1) exitWith {}; + + if (_spawnCratesTiming isEqualTo "atMissionSpawn") then + { + { + if ({[_x] call blck_fnc_crateMoved} count _crates > 0) exitWith + { + _missionComplete = 1; + _crateStolen = true; + }; + }forEach _crates; + }; + if (_spawnPara) then + { + + if ([_coords,_paraTriggerDistance,true] call blck_fnc_playerInRange) then + { + _spawnPara = false; // The player gets one try to spawn these. + if (random(1) < _chancePara) then // + { + // blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,[],blck_UMS_weapons,[],isScubaMission] call blck_fnc_spawnParaUnits;] call blck_fnc_spawnParaUnits; + private _paratroops = [_coords,_noPara,_aiDifficultyLevel,blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,[],blck_UMS_weapons,[],isScubaMission] call blck_fnc_spawnParaUnits; + if !(isNull _paratroops) then + { + _blck_AllMissionAI append (units _paratroops); + }; + if (random(1) < _chanceLoot) then + { + private _extraCrates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_paraLoot,_paraLootCounts]], "atMissionSpawn","atMissionStartAir", "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; + if (blck_cleanUpLootChests) then + { + _objects append _extraCrates; + }; + }; + }; + }; + }; + //diag_log format["dynamicUMSspawner:: (483) missionCompleteLoop - > players near = %1 and ai alive = %2 and crates stolen = %3",[_coords,20] call blck_fnc_playerInRange, {alive _x} count _blck_AllMissionAI, _crateStolen]; + uiSleep 4; +}; +if (_crateStolen) exitWith +{ + //diag_log format["dynamicUMSspawner:: (542) Crate Stolen Callening _fnc_endMission - > players near = %1 and ai alive = %2 and crates stolen = %3",[_locations,10,true] call blck_fnc_playerInRangeArray, {alive _x} count _blck_AllMissionAI, _crateStolen]; + [_mines,_objects,_crates, _blck_AllMissionAI,"Crate Removed from Mission Site Before Mission Completion: Mission Aborted",_blck_localMissionMarker,_coords,_mission,2,isScubaMission] call blck_fnc_endMission; +}; + +if (_spawnCratesTiming in ["atMissionEndGround","atMissionEndAir"]) then +{ + if (count _missionLootBoxes > 0) then + { + _crates = [_coords,_missionLootBoxes,_loadCratesTiming,_spawnCratesTiming, "end", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; + } + else + { + _crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming,_spawnCratesTiming, "end", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; + }; + + #ifdef blck_debugMode + if (blck_debugLevel > 0) then {diag_log format["_fnc_dynamicUMSspawner (531): _crates = %1", _crates]}; + #endif + + if (blck_cleanUpLootChests) then + { + _objects append _crates; + }; + + #ifdef blck_debugMode + if (blck_debugLevel > 0) then {diag_log format["[blckeagls] dynamicUMSspawner:: (428) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]}; + #endif +}; + +if (_spawnCratesTiming isEqualTo "atMissionSpawnGround" && _loadCratesTiming isEqualTo "atMissionCompletion") then +{ + { + [_x] call blck_fnc_loadMissionCrate; + } forEach _crates; +}; + +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] dynamicUMSspawner:: (496) Mission completion criteria fulfilled: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + diag_log format["dynamicUMSspawner :: (497) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled]; + diag_log format["[blckeagls] dynamicUMSspawner:: (498) calling endMission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; +}; +#endif +private["_result"]; +// Force passing the mission name for informational purposes. +_blck_localMissionMarker set [2, _markerMissionName]; +if (blck_showCountAliveAI) then +{ + //_marker setMarkerText format["%1: All AI Dead",_markerMissionName]; + { + if ((_x select 1) isEqualTo _markerMissionName) exitWith{blck_missionMarkers deleteAt _forEachIndex}; + }forEach blck_missionMarkers; +}; +// params["_mines","_objects","_crates","_blck_AllMissionAI","_endMsg","_blck_localMissionMarker","_coords","_mission",["_endCondition",0],["_vehicles",[]],["_isScubaMission",false]]; +_result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,0,_missionAIVehicles,isScubaMission] call blck_fnc_endMission; + +#ifdef blck_debugMode +diag_log format["[blckeagls] dynamicUMSspawner:: (559) end of mission: blck_fnc_endMission has returned control to _fnc_dynamicUMSspawner"]; +#endif +blck_missionsRun = blck_missionsRun + 1; +diag_log format["[blckeagls] dynamicUMSspawner:: Total Dyanamic Land and UMS Run = %1", blck_missionsRun]; \ No newline at end of file diff --git a/@GMS/addons/custom_server/Missions/UMS/code/GMS_UMS_fnc_findShoreLocation.sqf b/@GMS/addons/custom_server/Missions/UMS/code/GMS_UMS_fnc_findShoreLocation.sqf new file mode 100644 index 0000000..1297ea8 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/UMS/code/GMS_UMS_fnc_findShoreLocation.sqf @@ -0,0 +1,71 @@ +/* + by Ghostrider [GRG] + Copyright 2016 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +private["_mapCenter","_waterPos","_priorUMSpositions"]; + +switch (toLower worldName) do +{ + case "altis": {_mapCenter = [15000,19000,0];_maxDistance = 20000}; + case "tanoa": {_mapCenter = getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition");_maxDistance = 10000}; + case "malden": {_mapCenter = [6000,7000,0];_maxDistance = 5500}; + case "namalsk": {_mapCenter = getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition");_maxDistance = 5000}; + case "taviana": {_mapCenter = [12000,12000,0];_maxDistance = 12000}; + case "napf" : {_mapCenter = getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition");_maxDistance = 12000}; + case "lythium": {_mapCenter = [10000,10000,0]; _maxDistance = 6000;}; + default {_mapCenter = [6000,6000,0]; _maxDistance = 6000;}; +}; + +_evaluate = true; + while {_evaluate} do +{ + _waterPos = [ + _mapCenter, // center of search area + 2, // min distance to search + 20000, // max distance to search + 0, // distance to nearest object + 2, // water mode [2 = water only] + 25, // max gradient + 0 // shoreMode [0 = anywhere] + ] call BIS_fnc_findSafePos; + /* + _priorUMSpositions = +blck_priorDynamicUMS_Missions; + { + if (diag_tickTime > ((_x select 1) + 1800) then + { + blck_priorDynamicUMS_Missions = blck_priorDynamicUMS_Missions - _x; + } else { + if (_waterPos distance2D (_x select 0) < 2000) exitWith {_evaluate = false}; + }; + } forEach _priorUMSpositions; + */ + if (_evaluate) then + { + if (abs(getTerrainHeightASL _waterPos) < 30) then + { + if (abs(getTerrainHeightASL _waterPos) > 1) then + { + //_waterMarker = createMarker [format["water mission %1",getTerrainHeightASL _waterPos],_waterPos]; + //_waterMarker setMarkerColor "ColorRed"; + //_waterMarker setMarkerType "mil_triangle"; + //_waterMarker setMarkerText format["Depth %1",getTerrainHeightASL _waterPos]; + _evaluate = false; + }; + }; + }; +}; +_waterPos + + + + + + + diff --git a/@GMS/addons/custom_server/Missions/UMS/code/GMS_UMS_fnc_findWaterDepth.sqf b/@GMS/addons/custom_server/Missions/UMS/code/GMS_UMS_fnc_findWaterDepth.sqf new file mode 100644 index 0000000..c5e0d0c --- /dev/null +++ b/@GMS/addons/custom_server/Missions/UMS/code/GMS_UMS_fnc_findWaterDepth.sqf @@ -0,0 +1,23 @@ +/* + by Ghostrider [GRG] + Copyright 2016 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +private["_depth"]; +params["_pos"]; +_depth = (getTerrainHeightASL _pos); +//diag_log format["_fnc_findWaterDepth: _depth = %1",_depth]; +_depth + + + + + + + diff --git a/@GMS/addons/custom_server/Missions/UMS/code/GMS_UMS_functions.sqf b/@GMS/addons/custom_server/Missions/UMS/code/GMS_UMS_functions.sqf new file mode 100644 index 0000000..636ad48 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/UMS/code/GMS_UMS_functions.sqf @@ -0,0 +1,16 @@ +/* + by Ghostrider [GRG] + Copyright 20167 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +blck_fnc_findShoreLocation = compileFinal preprocessFileLineNumbers "q\addons\custom_server\Missions\UMS\code\GMS_UMS_fnc_findShoreLocation.sqf"; +blck_fnc_addDyanamicUMS_Mission = compileFinal preprocessFileLineNumbers "q\addons\custom_server\Missions\UMS\code\GMS_fnc_addDynamicUMS_Mission.sqf"; +blck_fnc_findWaterDepth = compileFinal preprocessFileLineNumbers "q\addons\custom_server\Missions\UMS\code\GMS_UMS_fnc_findWaterDepth.sqf"; + +diag_log "[blckeagls] UMS functions Functions compiled"; diff --git a/@GMS/addons/custom_server/Missions/UMS/code/GMS_fnc_addDynamicUMS_Mission.sqf b/@GMS/addons/custom_server/Missions/UMS/code/GMS_fnc_addDynamicUMS_Mission.sqf new file mode 100644 index 0000000..8c73e2e --- /dev/null +++ b/@GMS/addons/custom_server/Missions/UMS/code/GMS_fnc_addDynamicUMS_Mission.sqf @@ -0,0 +1,33 @@ +/* + by Ghostrider [GRG] + Copyright 2016 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +//params["_pos"]; +private["_UMS_mission","_waitTime","_mission","_pos"]; + +if (count blck_dynamicUMS_MissionList == 0) exitWith +{ + blck_numberUnderwaterDynamicMissions = -1; + diag_log "No Dynamic UMS Missions Listed "; +}; +_UMS_mission = selectRandom blck_dynamicUMS_MissionList; +_waitTime = (blck_TMin_UMS) + random(blck_TMax_UMS - blck_TMin_UMS); +_mission = format["%1%2","Mafia Pirates",floor(random(1000000))]; +_pos = call blck_fnc_findShoreLocation; +#ifdef blck_debugMode +if (blck_debugLevel >= 2) then {diag_log format["_fnc_addDynamicUMS_Mission: blck_dynamicUMS_MissionsRuning = %1 | blck_missionsRunning = %2 | blck_UMS_ActiveDynamicMissions = %3",blck_dynamicUMS_MissionsRuning,blck_missionsRunning,blck_UMS_ActiveDynamicMissions]};; +#endif +blck_UMS_ActiveDynamicMissions pushBack _pos; +blck_missionsRunning = blck_missionsRunning + 1; +blck_dynamicUMS_MissionsRuning = blck_dynamicUMS_MissionsRuning + 1; +//diag_log format["[blckeagls] UMS Spawner:-> waiting for %1",_waitTime]; +uiSleep _waitTime; +//diag_log format["[blckeagls] UMS Spawner:-> spawning mission %1",_UMS_mission]; +[_pos,_mission] call compileFinal preprocessFileLineNumbers format["q\addons\custom_server\Missions\UMS\dynamicMissions\%1",_UMS_mission]; diff --git a/@GMS/addons/custom_server/Missions/UMS/code/GMS_fnc_sm_initializeUMSStaticMission.sqf b/@GMS/addons/custom_server/Missions/UMS/code/GMS_fnc_sm_initializeUMSStaticMission.sqf new file mode 100644 index 0000000..e1ed9a3 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/UMS/code/GMS_fnc_sm_initializeUMSStaticMission.sqf @@ -0,0 +1,73 @@ +/* + By Ghostrider GRG + Copyright 2016 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ + +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +params["_mission"]; +// Spawn landscape +// params["_objects"]; +if (isNil "_markerColor") then {_markerColor = "ColorBlack"}; +if (isNil "_markerType") then {_markerType = ["mil_box",[]]}; +if (isNil "_markerColor") then {_markerColor = "ColorBlack"}; +if (isNil "_markerType") then {_markerType = ["mil_box",[]]}; +if (isNil "_missionLandscape") then {_missionLandscape = []}; +if (isNil "_garrisonedBuilding_ASLsystem") then {_garrisonedBuilding_ASLsystem = []}; +if (isNil "_garrisonedBuildings_BuildingPosnSystem") then {_garrisonedBuildings_BuildingPosnSystem = []}; +if (isNil "_airPatrols") then {_airPatrols = []}; +if (isNil "_aiGroupParameters") then {_aiGroupParameters = []}; +if (isNil "_missionEmplacedWeapons") then {_missionEmplacedWeapons = []}; +if (isNil "_vehiclePatrolParameters") then {_vehiclePatrolParameters = []}; +if (isNil "_missionLootVehicles") then {_missionLootVehicles = []}; + +_markerClass = format["static%1",floor(random(1000000))]; +_blck_localMissionMarker = [_markerClass,_missionCenter,"","",_markerColor,_markerType]; +if (blck_labelMapMarkers select 0) then +{ + _blck_localMissionMarker set [2, _markerMissionName]; +}; +if !(blck_preciseMapMarkers) then +{ + _blck_localMissionMarker set [1,[_missionCenter,75] call blck_fnc_randomPosition]; +}; +_blck_localMissionMarker set [3,blck_labelMapMarkers select 1]; // Use an arrow labeled with the mission name? +[_blck_localMissionMarker] call blck_fnc_spawnMarker; + +[_missionLandscape] call blck_fnc_sm_spawnObjects; +//diag_log format["_fnc_sm_initializeUMSStaticMission: count _airPatrols = %1 | _airPatrols = %2", count _airPatrols, _airPatrols]; +{ + [blck_sm_Aircraft,_x] call blck_fnc_sm_AddGroupToArray; + +}forEach _airPatrols; +//uiSleep 1; + +{ + [blck_sm_Infantry,_x] call blck_fnc_sm_AddGroupToArray; +}forEach _aiGroupParameters; + +{ + [blck_sm_scubaGroups,_x] call blck_fnc_sm_AddGroupToArray; +}forEach _aiScubaGroupParameters; + +{ + [blck_sm_Emplaced,_x] call blck_fnc_sm_AddGroupToArray; +}forEach _missionEmplacedWeapons; + +{ + [blck_sm_surfaceShips,_x] call blck_fnc_sm_AddGroupToArray; +}forEach _vehiclePatrolParameters; + +{ + [blck_sm_submarines,_x] call blck_fnc_sm_AddGroupToArray; +} forEach _submarinePatrolParameters; +//uiSleep 30; +// spawn loot chests +[_missionLootBoxes,_missionCenter] call blck_fnc_sm_spawnLootContainers; + +diag_log format["[blckeagls] UMS Mission Spawner: Static UMS Mission %1 spawned",_mission]; diff --git a/@GMS/addons/custom_server/Missions/UMS/code/GMS_fnc_spawnDynamicUMSMission.sqf b/@GMS/addons/custom_server/Missions/UMS/code/GMS_fnc_spawnDynamicUMSMission.sqf new file mode 100644 index 0000000..b636498 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/UMS/code/GMS_fnc_spawnDynamicUMSMission.sqf @@ -0,0 +1,636 @@ +/* + Dynamic Underwater Mission Spawner + By Ghostrider GRG + Copyright 2016 + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +#define isScubaMission true +#define delayTime 1 +private ["_abort","_crates","_aiGroup","_objects","_mines","_blck_AllMissionAI","_blck_localMissionMarker", + "_AI_Vehicles","_timeOut","_aiDifficultyLevel","_missionPatrolVehicles","_missionGroups","_loadCratesTiming","_spawnCratesTiming","_assetSpawned", + "_blck_AllMissionAI","_delayTime","_wait","_missionStartTime","_playerInRange","_missionTimedOut","_temp","_patrolVehicles","_vehToSpawn","_marker"]; + +params["_coords","_mission",["_allowReinforcements",false]]; + +_markerClass = _mission; +_aiDifficultyLevel = _difficulty; // _difficulty is defined in the mission description file. see \addons\custom_server\Missions\UMS\dynamicMissions\default.sqf for an example + +diag_log format["[blckeagls Dynamic UMS] dynamicUMSspawner (34):: Initializing mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + +if (isNil "_markerColor") then {_markerColor = "ColorBlack"}; +if (isNil "_markerType") then {_markerType = ["mil_box",[]]}; +//if (isNil "_timeOut") then {_timeOut = -1;}; +if (isNil "_missionGroups") then {_missionGroups = []}; +if (isNil "_endCondition") then {_endCondition = blck_missionEndCondition}; // Options are "allUnitsKilled", "playerNear", "allKilledOrPlayerNear"}; +if (isNil "_spawnCratesTiming") then {_spawnCratesTiming = blck_spawnCratesTiming}; // Choices: "atMissionSpawnGround","atMissionStartAir","atMissionEndGround","atMissionEndAir". +if (isNil "_loadCratesTiming") then {_loadCratesTiming = blck_loadCratesTiming}; // valid choices are "atMissionCompletion" and "atMissionSpawn"; +if (isNil "_useMines") then {_useMines = blck_useMines;}; + +if (isNil "_weaponList") then {_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout}; +if (isNil "_sideArms") then {_sideArms = [_aiDifficultyLevel] call blck_fnc_selectAISidearms}; +if (isNil "_uniforms") then {_uniforms = [_aiDifficultyLevel] call blck_fnc_selectAIUniforms}; +if (isNil "_headGear") then {_headGear = [_aiDifficultyLevel] call blck_fnc_selectAIHeadgear}; +if (isNil "_vests") then {_vests = [_aiDifficultyLevel] call blck_fnc_selectAIVests}; +if (isNil "_backpacks") then {_backpacks = [_aiDifficultyLevel] call blck_fnc_selectAIBackpacks}; + +if (isNil "_chanceHeliPatrol") then {_chanceHeliPatrol = [_aiDifficultyLevel] call blck_fnc_selectChanceHeliPatrol}; +if (isNil "_noChoppers") then {_noChoppers = [_aiDifficultyLevel] call blck_fnc_selectNumberAirPatrols}; +if (isNil "_chancePara") then {_chancePara = [_aiDifficultyLevel] call blck_fnc_selectChanceParatroops}; +if (isNil "_missionHelis") then {_missionHelis = [_aiDifficultyLevel] call blck_fnc_selectMissionHelis}; +if (isNil "_noPara") then {_noPara = [_aiDifficultyLevel] call blck_fnc_selectNumberParatroops}; + +if (isNil "_chanceLoot") then {_chanceLoot = 0}; +if (isNil "_paraTriggerDistance") then {_paraTriggerDistance = 400;}; +if (isNil "_paraLoot") then {_paraLoot = blck_BoxLoot_Blue}; +if (isNil "_paraLootCounts") then {_paraLootCounts = blck_lootCountsRed}; +if (isNil "_vehicleCrewCount") then {_vehicleCrewCount = [_aiDifficultyLevel] call GMS_fnc_selectVehicleCrewCount}; + +_objects = []; +_mines = []; +_crates = []; +_aiGroup = []; +_missionAIVehicles = []; +_blck_AllMissionAI = []; +_AI_Vehicles = []; +_blck_localMissionMarker = [_markerClass,_coords,"","",_markerColor,_markerType]; +_delayTime = 1; +_groupPatrolRadius = 50; + +if (blck_labelMapMarkers select 0) then +{ + _blck_localMissionMarker set [2, _markerMissionName]; +}; +if !(blck_preciseMapMarkers) then +{ + _blck_localMissionMarker set [1,[_coords,75] call blck_fnc_randomPosition]; +}; +_blck_localMissionMarker set [3,blck_labelMapMarkers select 1]; // Use an arrow labeled with the mission name? +[["start",_startMsg,_markerMissionName]] call blck_fnc_messageplayers; +_marker = [_blck_localMissionMarker] call blck_fnc_spawnMarker; +#ifdef blck_debugMode +if (blck_debugLevel > 0) then {diag_log "dynamicUMSspawner:: (91) message players and spawn a mission marker";}; +if (blck_debugLevel > 0) then {diag_log "dynamicUMSspawner:: (77) waiting for player to trigger the mission";}; +#endif +//////// +// All parameters are defined, let's wait until a player is nearby or the mission has timed out +//////// + +_missionStartTime = diag_tickTime; +_playerInRange = false; +_missionTimedOut = false; + +_wait = true; + +#ifdef blck_debugMode +if (blck_debugLevel > 0) then {diag_log "dynamicUMSspawner:: (90) starting mission trigger loop"}; +if (blck_debugLevel > 2) then {_wait = false}; +#endif + +while {_wait} do +{ + #ifdef blck_debugMode + if (blck_debugLevel > 2) exitWith {_playerInRange = true;}; + #endif + + if ([_coords, blck_TriggerDistance, false] call blck_fnc_playerInRange) exitWith {_playerInRange = true;}; + if ([_missionStartTime,blck_MissionTimeout] call blck_fnc_timedOut) exitWith {_missionTimedOut = true;}; + uiSleep 5; + + #ifdef blck_debugMode + if (blck_debugLevel > 2) then + { + diag_log format["dynamicUMSspawner:: Trigger Loop - blck_debugLevel = %1 and _coords = %2",blck_debugLevel, _coords]; + diag_log format["dynamicUMSspawner:: Trigger Loop - players in range = %1",{isPlayer _x && _x distance2D _coords < blck_TriggerDistance} count allPlayers]; + diag_log format["dynamicUMSspawner:: Trigger Loop - timeout = %1", [_missionStartTime,blck_MissionTimeout] call blck_fnc_timedOut]; + }; + #endif +}; + +if (_missionTimedOut) exitWith +{ + // Deal with the case in which the mission timed out. + blck_priorDynamicUMS_Missions pushback [_coords,diag_tickTime]; + blck_UMS_ActiveDynamicMissions = blck_UMS_ActiveDynamicMissions - [_coords]; + blck_dynamicUMS_MissionsRuning = blck_dynamicUMS_MissionsRuning - 1; + diag_log format["_fnc_dynamicUMSSpawner (187): mission timed out"]; + [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; +}; + +//////// +// Spawn the mission objects, loot chest, and AI +//////// +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] dynamicUMSspawner:: (142) -- >> Mission tripped: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; +}; +#endif + +if (blck_SmokeAtMissions select 0) then // spawn a fire and smoke near the crate +{ + _temp = [_coords,blck_SmokeAtMissions select 1] call blck_fnc_smokeAtCrates; + if (typeName _temp isEqualTo "ARRAY") then + { + _objects append _temp; + }; +}; + +uiSleep delayTime; +if (_useMines) then +{ + _mines = [_coords] call blck_fnc_spawnMines; + //uiSleep _delayTime;; +}; +uiSleep delayTime; +_temp = []; +//diag_log format["_dynamicUMSspawner"" _missionLandscape = %1 | _missionLandscapeMode = %2",_missionLandscape, _missionLandscapeMode]; +if (_missionLandscapeMode isEqualTo "random") then +{ + _temp = [_coords,_missionLandscape, 3, 15, 2] call blck_fnc_spawnRandomLandscape; +}; +if (_missionLandscapeMode isEqualTo "precise") then +{ + //params["_center","_objects"]; + _temp = [_coords, _missionLandscape] call blck_fnc_spawnCompositionObjects; + //uiSleep 1; +}; +//diag_log format["_fnc_dynamicUMSspawner: _temp = %1, typeName _temp = %2",_temp, typeName _temp]; +if (typeName _temp isEqualTo "ARRAY") then +{ + _objects append _temp; +}; +//diag_log format["_fnc_dynamicUMSspawner:: (176)->> _objects = %1",_objects]; + +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] dynamicUMSspawner:: (190) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; +}; +#endif + +uiSleep delayTime;; + +_temp = [_coords,_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles; +//uisleep 1; +_crates append _temp; + +uiSleep _delayTime; + +_abort = false; +_temp = [[],[],false]; +//diag_log format["_fnc_dynamicUMSspawner: spawning infantry using data in _missionGroups with _missionGroups = %1",_missionGroups]; +// Require that the server admin define the location of any infantry patrols given that missions will be off-shore. +// AI could be spawned on a platform or floating structure. +if (count _missionGroups > 0) then +{ + // params["_coords",["_minNoAI",3],["_maxNoAI",6],"_missionGroups",["_aiDifficultyLevel","red"],["_uniforms",blck_SkinList],["_headGear",blck_BanditHeadgear],["_vests",blck_vests],["_backpacks",[]],["_weapons",[]],["_sideArms",blck_Pistols],["_isScubaGroup",false]]; + _temp = [_coords, _minNoAI,_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,false] call blck_fnc_spawnMissionAI; +}; + +#ifdef blck_debugMode +if (blck_debugLevel > 2) then +{ + diag_log format["dynamicUMSspawner :: (209) blck_fnc_spawnMissionAI returned a value of _temp = %1",_temp]; uiSleep 1; +}; + +_abort = _temp select 1; +if (blck_debugLevel > 2) then +{ + diag_log format["dynamicUMSspawner :: (214) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1; +}; +#endif + +if (count _scubaGroupParameters > 0) then +{ + //diag_log format["_fnc_dynamicUMSspawner: spawning scuba groups with _scubaGroupParameters = %1",_scubaGroupParameters]; + // params["_coords",["_minNoAI",3],["_maxNoAI",6],"_missionGroups",["_aiDifficultyLevel","red"],["_uniforms",blck_SkinList],["_headGear",blck_BanditHeadgear],["_vests",blck_vests],["_backpacks",[]],["_weapons",[]],["_sideArms",blck_Pistols],["_isScubaGroup",false]]; + _temp = [_coords, _minNoAI,_maxNoAI,_scubaGroupParameters,_aiDifficultyLevel,blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,[],blck_UMS_weapons,[],isScubaMission] call blck_fnc_spawnMissionAI; +}; + +#ifdef blck_debugMode +if (blck_debugLevel > 2) then +{ + diag_log format["dynamicUMSspawner :: (209) blck_fnc_spawnMissionAI returned a value of _temp = %1",_temp]; uiSleep 1; +}; + +_abort = _temp select 1; +if (blck_debugLevel > 2) then +{ + diag_log format["dynamicUMSspawner :: (214) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1; +}; +#endif + +if (_abort) exitWith +{ + if (blck_debugLevel > 1) then { + diag_log "dynamicUMSspawner:: (220) grpNull returned, mission termination criteria met, calling blck_fnc_endMission" + }; + [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,1,isScubaMission] call blck_fnc_endMission; +}; +if !(_abort) then +{ + _blck_AllMissionAI append (_temp select 0); +}; + +uiSleep _delayTime; + +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] dynamicUMSspawner:: (235) AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; +}; +#endif + +uiSleep _delayTime; +_temp = [[],[],false]; +_abort = false; +private["_patrolVehicles","_vehToSpawn"]; +//diag_log format["_fnc_dynamicUMSspawner (258): _noVehiclePatrols = %1",_noVehiclePatrols]; +_vehToSpawn = 0; +//diag_log format["_dynamicUMSspawner:: _vehToSpawn = %1",_vehToSpawn]; +// Spawn any surface patrols +if (blck_useVehiclePatrols && count _vehiclePatrolParameters > 0) then +{ + // params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_isScubaGroup",false]]; + _temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_vehiclePatrolParameters,true,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,false,_vehicleCrewCount /*,blck_UMS_weapons,blck_UMS_vests,isScubaMission*/ ] call blck_fnc_spawnMissionVehiclePatrols; + #ifdef blck_debugMode + if (blck_debugLevel > 1) then { + diag_log format["dynamicUMSspawner :: (251) blck_fnc_spawnMissionVehiclePatrols returned _temp = %1",_temp]; + }; + #endif + + if (typeName _temp isEqualTo "ARRAY") then + { + _abort = _temp select 2; + }; + if !(_abort) then + { + _patrolVehicles = _temp select 0; + _blck_AllMissionAI append (_temp select 1); + + #ifdef blck_debugMode + if (blck_debugLevel > 0) then + { + diag_log format["[blckeagls] dynamicUMSspawner:: (267) Vehicle Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + }; + #endif + + }; +}; +// Spawn any submarine patrols +if (blck_useVehiclePatrols && count _submarinePatrolParameters > 0) then +{ + // params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_isScubaGroup",false]]; + _temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_submarinePatrolParameters,true,blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,[],blck_UMS_weapons,[],isScubaMission] call blck_fnc_spawnMissionVehiclePatrols; + #ifdef blck_debugMode + if (blck_debugLevel > 1) then { + diag_log format["dynamicUMSspawner :: (251) blck_fnc_spawnMissionVehiclePatrols returned _temp = %1",_temp]; + }; + #endif + + if (typeName _temp isEqualTo "ARRAY") then + { + _abort = _temp select 2; + }; + if !(_abort) then + { + _patrolVehicles = _temp select 0; + //diag_log format["[blckeagls] dynamicUMSspawner:: Patrol vehicles = %1",_patrolVehicles]; + _blck_AllMissionAI append (_temp select 1); + + #ifdef blck_debugMode + if (blck_debugLevel > 0) then + { + diag_log format["[blckeagls] dynamicUMSspawner:: (267) Vehicle Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + }; + #endif + + }; +}; + +if (_abort) exitWith +{ + #ifdef blck_debugMode + if (blck_debugLevel > 0) then { + diag_log "dynamicUMSspawner:: (279) grpNull returned, mission termination criteria met, calling blck_endMission"; + }; + #endif + + [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,1,isScubaMission] call blck_fnc_endMission; +}; + +uiSleep delayTime; +_temp = [[],[],false]; +_abort = false; + +_noChoppers = [_noChoppers] call blck_fnc_getNumberFromRange; +_noPara = [_noPara] call blck_fnc_getNumberFromRange; + +#ifdef blck_debugMode +if (blck_debugLevel > 1) then {diag_log format["_dynamicUMSspawner(322):: _noChoppers = %1 && _chancePara = %2",_noChoppers,_chancePara]}; +#endif +if (_noChoppers > 0) then +{ + for "_i" from 1 to (_noChoppers) do + { + if (random(1) < _chanceHeliPatrol) then + { + //_temp = [_coords,_missionHelis,spawnHeli,_aiDifficultyLevel,_chancePara,_noPara,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionReinforcements; + _temp = [_coords,_aiDifficultyLevel,_missionHelis] call blck_fnc_spawnMissionHeli; + + if (typeName _temp isEqualTo "ARRAY") then + { + _abort = _temp select 2; + blck_monitoredVehicles pushBack (_temp select 0); + _blck_AllMissionAI append (_temp select 1); + }; + if (_abort) then + { + _objects pushback (_temp select 0); + [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; + }; + }; + }; +}; + +////////////////////////// +// Spawn Crates and Emplaced Weapons Last to try to force them to correct positions relative to spawned buildinga or other objects. +#ifdef blck_debugMode +if (blck_debugLevel > 0) then {diag_log format["dynamicUMSspawner:: (361) preparing to spawn emplaced weapons for _coords %4 | _markerClass %3 | blck_useStatic = %1 | _noEmplacedWeapons = %2",blck_useStatic,_noEmplacedWeapons,_markerClass,_coords];}; +#endif +uiSleep 15; +private["_noEmplacedToSpawn"]; +_noEmplacedToSpawn = [_noEmplacedWeapons] call blck_fnc_getNumberFromRange; +//diag_log format["_dynamicUMSspawner:: _noEmplacedToSpawn = %1",_vehToSpawn]; +if (blck_useStatic && ((_noEmplacedToSpawn > 0)) || count _missionEmplacedWeapons > 0) then +{ + // params["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear"]; + //_temp = [_missionEmplacedWeapons,_noEmplacedToSpawn,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnEmplacedWeaponArray; + _temp = [_coords,_missionEmplacedWeapons,true,_noEmplacedToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnEmplacedWeaponArray; + + #ifdef blck_debugMode + if (blck_debugLevel > 2) then + { + diag_log format ["dynamicUMSspawner:: (375) blck_fnc_spawnEmplacedWeaponArray returned _temp = %1",_temp]; + }; + #endif + + if (typeName _temp isEqualTo "ARRAY") then + { + _abort = _temp select 2; + }; + + #ifdef blck_debugMode + if (blck_debugLevel > 2) then + { + diag_log format ["dynamicUMSspawner:: (387) _abort = %1",_abort]; + + }; + #endif + + if !(_abort) then + { + _objects append (_temp select 0); + _blck_AllMissionAI append (_temp select 1); + + #ifdef blck_debugMode + if (blck_debugLevel > 0) then + { + diag_log format["[blckeagls] dynamicUMSspawner:: (400) Static Weapons Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + }; + #endif + }; +}; +if (_abort) exitWith +{ + #ifdef blck_debugMode + if (blck_debugLevel > 2) then + { + diag_log "dynamicUMSspawner:: (410) grpNull ERROR in blck_fnc_spawnEmplacedWeaponArray, mission termination criteria met, calling blck_endMission"; + }; + #endif + + [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,1,isScubaMission] call blck_fnc_endMission; +}; + +uiSleep _delayTime; +if (_spawnCratesTiming isEqualTo "atMissionSpawnGround") then +{ + if (count _missionLootBoxes > 0) then + { + _crates = [_coords,_missionLootBoxes,_loadCratesTiming, _spawnCratesTiming, "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; + } + else + { + _crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming, _spawnCratesTiming, "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; + + }; + + if (blck_cleanUpLootChests) then + { + _objects append _crates; + }; +}; + +if (blck_cleanUpLootChests) then +{ + _objects append _crates; +}; +if (_noPara > 0 && (random(1) < _chancePara) && _paraTriggerDistance == 0) then +{ + //diag_log format["_fnc_missionSpawner (435): spawning %1 paraunits at mission spawn",_noPara]; + //private _paratroops = [_coords,_noPara,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnParaUnits; + // blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,[],blck_UMS_weapons,[],isScubaMission + private _paratroops = [_coords,_noPara,_aiDifficultyLevel,blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,[],blck_UMS_weapons,[],isScubaMission] call blck_fnc_spawnParaUnits; + if !(isNull _paratroops) then + { + _blck_AllMissionAI append (units _paratroops); + }; + if (random(1) < _chanceLoot) then + { + private _extraCrates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_paraLoot,_paraLootCounts]], "atMissionSpawn","atMissionStartAir", "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; + if (blck_cleanUpLootChests) then + { + _objects append _extraCrates; + }; + }; +}; + +//uisleep 2; +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] dynamicUMSspawner:: (428) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; +}; +#endif + +// Trigger for mission end +#ifdef blck_debugMode +diag_log format["[blckeagls] mission Spawner(436) _endCondition = %1",_endCondition]; +#endif +private["_missionComplete","_endIfPlayerNear","_endIfAIKilled"]; +_missionComplete = -1; +_startTime = diag_tickTime; +if (blck_showCountAliveAI) then +{ + //diag_log format["_dynamicUMSspawner(441): Adding Number Alive AI: _marker = %1 | _markerMissionName = %2",_marker,_markerMissionName]; + //diag_log format["_dynamicUMSspawner(442): Alive AI = %1 | Current Marker Text = %2",{alive _x} count _blck_AllMissionAI, markerText _marker]; + if !(_marker isEqualTo "") then + { + [_marker,_markerMissionName,_blck_AllMissionAI] call blck_fnc_updateMarkerAliveCount; + blck_missionMarkers pushBack [_marker,_markerMissionName,_blck_AllMissionAI]; + //diag_log format["_dynamicUMSspawner: blck_missionMarkers = %1",blck_missionMarkers]; + }; +}; +switch (_endCondition) do +{ + case "playerNear": {_endIfPlayerNear = true;_endIfAIKilled = false;}; + case "allUnitsKilled": {_endIfPlayerNear = false;_endIfAIKilled = true;}; + case "allKilledOrPlayerNear": {_endIfPlayerNear = true;_endIfAIKilled = true;}; +}; +#ifdef blck_debugMode +diag_log format["dynamicUMSspawner :: (449) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled]; +#endif +private["_locations"]; +_locations = [_coords]; +{ + _locations pushback (getPos _x); + _x setVariable["crateSpawnPos", (getPos _x)]; +} forEach _crates; +#ifdef blck_debugMode +diag_log format["dynamicUMSspawner (458):: _coords = %1 | _crates = %2 | _locations = %3",_coords,_crates,_locations]; +#endif +private _crateStolen = false; +#ifdef blck_debugMode +diag_log format["dynamicUMSspawner(462):: Waiting for player to satisfy mission end criteria of _endIfPlayerNear %1 with _endIfAIKilled %2",_endIfPlayerNear,_endIfAIKilled]; +#endif + +if (blck_showCountAliveAI) then +{ + if !(_marker isEqualTo "") then + { + [_marker,_markerMissionName,_blck_AllMissionAI] call blck_fnc_updateMarkerAliveCount; + blck_missionMarkers pushBack [_marker,_markerMissionName,_blck_AllMissionAI]; + }; +}; + +private _spawnPara = if (random(1) < _chancePara) then {true} else {false}; +_missionComplete = -1; +while {_missionComplete isEqualTo -1} do +{ + #ifdef blck_debugMode + if (blck_debugLevel isEqualTo 3) exitWith {uiSleep 10; diag_log "_fnc_dynamicUMSSpawner (574): scripted mission end";}; + #endif + if ((_endIfPlayerNear) && [_locations,10,true] call blck_fnc_playerInRangeArray) exitWith {}; + if ((_endIfAIKilled) && ({alive _x} count _blck_AllMissionAI) < 1) exitWith {}; + + if (_spawnCratesTiming isEqualTo "atMissionSpawn") then + { + { + if ({[_x] call blck_fnc_crateMoved} count _crates > 0) exitWith + { + _missionComplete = 1; + _crateStolen = true; + }; + }forEach _crates; + }; + if (_spawnPara) then + { + + if ([_coords,_paraTriggerDistance,true] call blck_fnc_playerInRange) then + { + _spawnPara = false; // The player gets one try to spawn these. + if (random(1) < _chancePara) then // + { + // blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,[],blck_UMS_weapons,[],isScubaMission] call blck_fnc_spawnParaUnits;] call blck_fnc_spawnParaUnits; + private _paratroops = [_coords,_noPara,_aiDifficultyLevel,blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,[],blck_UMS_weapons,[],isScubaMission] call blck_fnc_spawnParaUnits; + if !(isNull _paratroops) then + { + _blck_AllMissionAI append (units _paratroops); + }; + if (random(1) < _chanceLoot) then + { + private _extraCrates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_paraLoot,_paraLootCounts]], "atMissionSpawn","atMissionStartAir", "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; + if (blck_cleanUpLootChests) then + { + _objects append _extraCrates; + }; + }; + }; + }; + }; + //diag_log format["dynamicUMSspawner:: (483) missionCompleteLoop - > players near = %1 and ai alive = %2 and crates stolen = %3",[_coords,20] call blck_fnc_playerInRange, {alive _x} count _blck_AllMissionAI, _crateStolen]; + uiSleep 4; +}; +if (_crateStolen) exitWith +{ + //diag_log format["dynamicUMSspawner:: (542) Crate Stolen Callening _fnc_endMission - > players near = %1 and ai alive = %2 and crates stolen = %3",[_locations,10,true] call blck_fnc_playerInRangeArray, {alive _x} count _blck_AllMissionAI, _crateStolen]; + [_mines,_objects,_crates, _blck_AllMissionAI,"Crate Removed from Mission Site Before Mission Completion: Mission Aborted",_blck_localMissionMarker,_coords,_mission,2,isScubaMission] call blck_fnc_endMission; +}; + +if (_spawnCratesTiming in ["atMissionEndGround","atMissionEndAir"]) then +{ + if (count _missionLootBoxes > 0) then + { + _crates = [_coords,_missionLootBoxes,_loadCratesTiming,_spawnCratesTiming, "end", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; + } + else + { + _crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming,_spawnCratesTiming, "end", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; + }; + + #ifdef blck_debugMode + if (blck_debugLevel > 0) then {diag_log format["_fnc_dynamicUMSspawner (531): _crates = %1", _crates]}; + #endif + + if (blck_cleanUpLootChests) then + { + _objects append _crates; + }; + + #ifdef blck_debugMode + if (blck_debugLevel > 0) then {diag_log format["[blckeagls] dynamicUMSspawner:: (428) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]}; + #endif +}; + +if (_spawnCratesTiming isEqualTo "atMissionSpawnGround" && _loadCratesTiming isEqualTo "atMissionCompletion") then +{ + { + [_x] call blck_fnc_loadMissionCrate; + } forEach _crates; +}; + +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] dynamicUMSspawner:: (496) Mission completion criteria fulfilled: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + diag_log format["dynamicUMSspawner :: (497) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled]; + diag_log format["[blckeagls] dynamicUMSspawner:: (498) calling endMission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; +}; +#endif +private["_result"]; +// Force passing the mission name for informational purposes. +_blck_localMissionMarker set [2, _markerMissionName]; +if (blck_showCountAliveAI) then +{ + //_marker setMarkerText format["%1: All AI Dead",_markerMissionName]; + { + if ((_x select 1) isEqualTo _markerMissionName) exitWith{blck_missionMarkers deleteAt _forEachIndex}; + }forEach blck_missionMarkers; +}; +// params["_mines","_objects","_crates","_blck_AllMissionAI","_endMsg","_blck_localMissionMarker","_coords","_mission",["_endCondition",0],["_vehicles",[]],["_isScubaMission",false]]; +_result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,0,_missionAIVehicles,isScubaMission] call blck_fnc_endMission; + +#ifdef blck_debugMode +diag_log format["[blckeagls] dynamicUMSspawner:: (559) end of mission: blck_fnc_endMission has returned control to _fnc_dynamicUMSspawner"]; +#endif +blck_missionsRun = blck_missionsRun + 1; +diag_log format["[blckeagls] dynamicUMSspawner:: Total Dyanamic Land and UMS Run = %1", blck_missionsRun]; \ No newline at end of file diff --git a/@GMS/addons/custom_server/Missions/UMS/dynamicMissions/default.sqf b/@GMS/addons/custom_server/Missions/UMS/dynamicMissions/default.sqf index 195cc67..25ffda9 100644 --- a/@GMS/addons/custom_server/Missions/UMS/dynamicMissions/default.sqf +++ b/@GMS/addons/custom_server/Missions/UMS/dynamicMissions/default.sqf @@ -8,7 +8,7 @@ private ["_markerLabel","_endMsg","_startMsg","_lootCounts","_crateLoot","_marke "_chanceReinforcements","_helipatrol","_endCondition","_markerColor","_markerType","_useMines","_difficulty","_missionCenter", "_missionGroups","_scubaGroupParameters","_vehiclePatrolParameters","_submarinePatrolParameters","_aircraftTypes","_noAirPatrols","_airPatrols", "_vests","_backpacks","_weaponList","_sideArms","_uniforms","_headGear","_chanceHeliPatrol","_noChoppers","_chancePara","_missionHelis","_noPara", - "_chanceLoot","_paraTriggerDistance","_paraLoot","_paraLootCounts"]; + "_chanceLoot","_paraTriggerDistance","_paraLoot","_paraLootCounts","_vehiclecrewcount"]; params["_missionCenter","_mission"]; //_mission = "UMS mission example #2"; // Included for additional documentation. Not intended to be spawned as a mission per se. //_missionCenter = [22584.9,15304.8,0]; // I pulled this from the position of the marker. @@ -169,5 +169,5 @@ _chanceLoot = 0.999999990; _paraLoot = blck_BoxLoot_Blue; _paraLootCounts = blck_lootCountsRed; // Throw in something more exotic than found at a normal blue mission. -#include "\q\addons\custom_server\Missions\UMS\code\GMS_fnc_spawnDynamicUMSMission.sqf"; +#include "\q\addons\custom_server\Missions\UMS\GMS_fnc_spawnDynamicUMSMission.sqf"; diff --git a/@GMS/addons/custom_server/Missions/UMS/staticMissions/privateVars.sqf b/@GMS/addons/custom_server/Missions/UMS/staticMissions/privateVars.sqf index 02028d5..24c5890 100644 --- a/@GMS/addons/custom_server/Missions/UMS/staticMissions/privateVars.sqf +++ b/@GMS/addons/custom_server/Missions/UMS/staticMissions/privateVars.sqf @@ -8,6 +8,6 @@ private ["_mission","_difficulty","_crateLoot","_lootCounts","_markerMissionName "_minNoAI","_maxNoAI","_noAIGroups","_noVehiclePatrols","_noEmplacedWeapons","_noPara","_helipatrol", "_uniforms","_headgear","_weaponList","_sideArms","_vests","_backpacks", "_weapons","_sideArms","_chanceReinforcements","_endCondition", - "_useMines"]; + "_useMines","_vehiclecrewcount"]; // _mission diff --git a/@GMS/addons/custom_server/init/blck_init_server.sqf b/@GMS/addons/custom_server/init/blck_init_server.sqf index c554cd6..90ddf14 100644 --- a/@GMS/addons/custom_server/init/blck_init_server.sqf +++ b/@GMS/addons/custom_server/init/blck_init_server.sqf @@ -127,33 +127,6 @@ if (blck_enableBlueMissions > 0) then [_missionListBlue,_pathBlue,"BlueMarker","blue",blck_TMin_Blue,blck_TMax_Blue,blck_enableBlueMissions] call blck_fnc_addMissionToQue; }; -#ifdef GRGserver -diag_log "[blckeagls] Running GhostriderGaming Version"; -//diag_log format["[blckeagls] _init_server: blck_enableScoutsMissions = %1",blck_enableScoutsMissions]; -if (blck_enableScoutsMissions > 0) then -{ - //[_missionListScouts,_pathScouts,"ScoutsMarker","red",blck_TMin_Scouts,blck_TMax_Scouts] spawn blck_fnc_missionTimer; - [_missionListScouts,_pathScouts,"ScoutsMarker","red",blck_TMin_Scouts,blck_TMax_Scouts,blck_enableScoutsMissions,false] call blck_fnc_addMissionToQue; -}; - -//diag_log format["[blckeagls] _init_server: blck_enableHunterMissions = %1",blck_enableHunterMissions]; -if (blck_enableHunterMissions > 0) then -{ - //[_missionListHunters,_pathHunters,"HunterMarker","green",blck_TMin_Hunter,blck_TMax_Hunter] spawn blck_fnc_missionTimer; - // params["_missionList","_path","_marker","_difficulty","_tMin","_tMax","_noMissions"]; - [_missionListHunters,_pathHunters,"HunterMarker","green",blck_TMin_Hunter,blck_TMax_Hunter,blck_enableHunterMissions,false] call blck_fnc_addMissionToQue; -}; - -// Running new version of Crash sites. -//diag_log format["[blckeagls] _init_server: blck_maxCrashSites = %1",blck_maxCrashSites]; -if (blck_maxCrashSites > 0) then -{ - [] execVM "\q\addons\custom_server\Missions\HeliCrashs\Crashes2.sqf"; -}; -//diag_log "loading DLS System"; -call compile preprocessfilelinenumbers "\q\addons\custom_server\DLS\DLS_init.sqf"; -#endif - // start the main thread for the mission system which monitors missions running and stuff to be cleaned up [] spawn blck_fnc_mainThread; blck_pvs_version = blck_versionNumber; diff --git a/@GMS/addons/custom_server/init/testCrateLoading.sqf b/@GMS/addons/custom_server/init/testCrateLoading.sqf index 3178c6f..df3e845 100644 --- a/@GMS/addons/custom_server/init/testCrateLoading.sqf +++ b/@GMS/addons/custom_server/init/testCrateLoading.sqf @@ -3,7 +3,7 @@ uiSleep 5; diag_log format["<< ---- START TEST Crate Loading ---- >>"]; _coords = [12000,12000,0]; //_loot = blck_supportLoot; //[causes problems] blck_highPoweredLoot; // [causes problems] blck_contructionLoot ; //blck_BoxLoot_Orange; -_loot = blck_BoxLoot_Orange; +_loot = blck_supportLoot; _lootCounts = [100,100,100,100,100,100]; _aiDifficultyLevel = "Orange"; for "_i" from 1 to 100 do @@ -12,7 +12,7 @@ for "_i" from 1 to 100 do _crateType = selectRandom blck_crateTypes; _crate = [_coords,_crateType] call blck_fnc_spawnCrate; [_crate,_loot,_lootCounts] call blck_fnc_fillBoxes; - //uiSleep 0.1; + uiSleep 5; diag_log format["testCrateLoading: crate inventory = %1",getItemCargo _crate]; };