diff --git a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_findSafePosn.sqf b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_findSafePosn.sqf index 3662329..191b07e 100644 --- a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_findSafePosn.sqf +++ b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_findSafePosn.sqf @@ -15,10 +15,10 @@ */ #include "\q\addons\custom_server\Configs\blck_defines.hpp"; -private["_findNew","_coords","_dist","_xpos","_ypos","_newPos","_townPos","_pole"]; +private["_findNew","_tries","_coords","_dist","_xpos","_ypos","_newPos","_townPos","_pole"]; _findNew = true; - +_tries = 0; while {_findNew} do { _findNew = false; //[_centerForSearch,_minDistFromCenter,_maxDistanceFromCenter,_minDistanceFromNearestObj,_waterMode,_maxTerainGradient,_shoreMode] call BIS_fnc_findSafePos @@ -87,7 +87,7 @@ while {_findNew} do { // check that missions spawn at least 1 kkm from towns { _townPos = [((locationPosition _x) select 0), ((locationPosition _x) select 1), 0]; - if (_townPos distance2D _coords < 200) exitWith { + if (_townPos distance2D _coords < blck_minDistanceFromTowns) exitWith { _findNew = true; }; } forEach blck_townLocations; @@ -99,15 +99,15 @@ while {_findNew} do { if (_mod isEqualTo "Exile") then {_pole = "Exile_Construction_Flag_Static"}; //diag_log format["_fnc_findSafePosn:: -- >> _mod = %1 and _pole = %2",_mod,_pole]; { - if ((_x distance2D _coords) < 600) then + if ((_x distance2D _coords) < blck_minDistanceToBases) then { _findNew = true; }; - }forEach nearestObjects[player, [_pole], 800]; + }forEach nearestObjects[blck_mapCenter, [_pole], blck_minDistanceToBases]; // check to be sure we do not spawn a mission on top of a player. { - if (isPlayer _x && (_x distance2D _coords) < 600) then + if (isPlayer _x && (_x distance2D _coords) < blck_minDistanceToPlayer) then { _findNew = true; }; @@ -120,6 +120,7 @@ while {_findNew} do { deleteVehicle _tavTest; if (_tavHeight > 100) then {_FindNew = true;}; }; + _tries = _tries + 1; }; if ((count _coords) > 2) then diff --git a/@GMS/addons/custom_server/Configs/blck_configs.sqf b/@GMS/addons/custom_server/Configs/blck_configs.sqf index 0b09691..1d5f0d7 100644 --- a/@GMS/addons/custom_server/Configs/blck_configs.sqf +++ b/@GMS/addons/custom_server/Configs/blck_configs.sqf @@ -73,7 +73,10 @@ //Minimum distance between missions blck_MinDistanceFromMission = 1500; - + blck_minDistanceToBases = 900; + blck_minDistanceToPlayer = 900; + blck_minDistanceFromTowns = 300; + /////////////////////////////// // Mission Smoke and Signals /////////////////////////////// diff --git a/@GMS/addons/custom_server/Configs/blck_configs_mil.sqf b/@GMS/addons/custom_server/Configs/blck_configs_mil.sqf index 798e038..568e067 100644 --- a/@GMS/addons/custom_server/Configs/blck_configs_mil.sqf +++ b/@GMS/addons/custom_server/Configs/blck_configs_mil.sqf @@ -68,7 +68,10 @@ //Minimum distance between missions blck_MinDistanceFromMission = 1500; - + blck_minDistanceToBases = 900; + blck_minDistanceToPlayer = 900; + blck_minDistanceFromTowns = 300; + /////////////////////////////// // Mission Smoke and Signals /////////////////////////////// diff --git a/@GMS/addons/custom_server/Missions/Green/munitionsResearch.sqf b/@GMS/addons/custom_server/Missions/Green/munitionsResearch.sqf deleted file mode 100644 index 07816da..0000000 --- a/@GMS/addons/custom_server/Missions/Green/munitionsResearch.sqf +++ /dev/null @@ -1,106 +0,0 @@ -/* - Mission Template by Ghostrider-DbD- - Mission Compositions by Bill prepared for DBD Clan - Copyright 2016 - Last modified 3/20/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/ -*/ -private ["_markerLabel","_endMsg","_startMsg","_lootCounts","_crateLoot","_markerMissionName","_missionLandscapeMode","_missionLandscape", - "_missionLootBoxes","_missionLootVehicles","_missionEmplacedWeapons","_minNoAI","_maxNoAI","_noAIGroups","_noVehiclePatrols","_noEmplacedWeapons", - "_uniforms","_headgear","_chanceReinforcements","_noPara","_helipatrol","_endCondition","_markerColor","_markerType","_useMines"]; - -//diag_log "[blckeagls] Spawning Green Mission with template = default"; -_crateLoot = blck_BoxLoot_Green; -_lootCounts = blck_lootCountsOrange; -_startMsg = "An munitions research center was sighted in a nearby sector! Check the Green marker on your map for the location!"; -_endMsg = "The Sector at the Green Marker is under survivor control!"; -_markerLabel = ""; -_markerType = ["ELIPSE",[225,225],"GRID"]; -_markerColor = "ColorGreen"; -_markerMissionName = "Munitions"; -_missionLandscapeMode = "precise"; // acceptable values are "none","random","precise" -_missionLandscape = [ - ["Flag_AltisColonial_F",[12.9492,-14.2676,0],0,[true,false]], - ["Land_Research_HQ_F",[-40.4258,-57.4492,-7.15256e-007],0,[true,false]], - ["Land_Research_HQ_F",[79.9063,68.1406,2.38419e-007],0,[true,false]], - ["Land_Research_house_V1_F",[-27.6895,70.9883,0],0,[true,false]], - ["Land_Research_house_V1_F",[-110.166,14.3926,0],0,[true,false]], - ["Land_Research_house_V1_F",[54.5078,-70.8457,0],0,[true,false]], - ["Land_Cargo_Patrol_V1_F",[111.865,11.9375,9.53674e-007],0,[true,false]], - ["Land_Cargo_HQ_V2_F",[-115.473,-44.5977,-4.76837e-007],0,[true,false]], - ["Land_SharpRock_apart",[-59.6836,-59.5996,-4.76837e-007],0,[true,false]], - ["Land_W_sharpRock_apart",[-81.6973,-42.4082,-4.76837e-007],0,[true,false]], - ["Land_SharpRock_apart",[-96.2168,-5.32031,4.76837e-007],0,[true,false]], - ["Land_Limestone_01_apart_F",[-79.2305,43.4219,0],0,[true,false]], - ["Land_Limestone_01_apart_F",[-50.2344,82.4746,0],0,[true,false]], - ["Land_BluntRock_apart",[3.88281,-71.5488,-2.38419e-007],0,[true,false]], - ["Land_Limestone_01_apart_F",[35.8926,-77.5918,0],0,[true,false]], - ["Land_Limestone_01_apart_F",[78.541,-52.3926,-4.76837e-007],0,[true,false]], - ["Land_Limestone_01_apart_F",[103.91,-6.88867,0],0,[true,false]], - ["Land_BluntRock_apart",[-11.5586,93.9688,-2.38419e-007],0,[true,false]], - ["Land_W_sharpStone_02",[54.7344,96.7012,0],0,[true,false]], - ["Land_BluntRock_apart",[77.4453,88.8301,-2.38419e-007],0,[true,false]], - ["Land_SharpRock_apart",[104.758,45.668,0],0,[true,false]], - ["Land_Limestone_01_02_F",[99.5117,23.752,-4.76837e-007],0,[true,false]], - ["Land_Limestone_01_02_F",[49.8477,50.0039,0],0,[true,false]], - ["Land_Limestone_01_02_F",[-8.14844,32.2227,4.76837e-007],0,[true,false]], - ["Land_Limestone_01_02_F",[-35.334,35.1465,-2.38419e-007],0,[true,false]], - ["Land_SharpStone_02",[-28.6523,1.33398,4.76837e-007],0,[true,false]], - ["Land_SharpStone_02",[-58.707,-7.46094,-4.76837e-007],0,[true,false]], - ["Land_Limestone_01_02_F",[64.5078,31.9707,0],0,[true,false]], - ["Land_Limestone_01_02_F",[33.7246,11.5469,0],0,[true,false]], - ["Land_SharpStone_02",[69.4277,-3.20313,0],0,[true,false]], - ["Land_SharpStone_02",[53.7227,-40.1777,-2.38419e-007],0,[true,false]], - ["Land_Limestone_01_02_F",[-6.26563,-46.0996,-4.76837e-007],0,[true,false]] -]; // list of objects to spawn as landscape -_missionLootBoxes = []; // Parameters are "Box Item Code", array defining the loot to be spawned, and position. -_missionLootVehicles = []; // Parameters are "Box Item Code", array defining the loot to be spawned, and position. -_missionEmplacedWeapons = - [ - /*["B_HMG_01_high_F",[31.7266,-34.6699,-4.76837e-007],0,[true,false]], - ["B_HMG_01_high_F",[-24.5781,-33.8281,-3.1268],0,[true,false]], - ["B_G_Mortar_01_F",[73.1836,62.9492,-3.1265],0,[true,false]] - */ - ["B_HMG_01_high_F",[47.1777,73.5469,-3.12644],0,[true,false]], - ["B_GMG_01_high_F",[-32.8926,-35.8047,-3.1268],0,[true,false]], - ["B_G_Mortar_01_F",[33.1582,-34.8867,-4.76837e-007],0,[true,false]] - ]; // 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 - -_missionGroups = - [ - //_x params["_position","_minAI","_maxAI","_skillLevel","_minPatrolRadius","_maxPatrolRadius"]; - [[-52.6523,15.8281,-0.00143838],7,9,"Green",8,15], - [[-48.6113,-38.877,-0.00143886],7,9,"Green",8,15], - [[18.4492,-39.5684,-0.00143838],7,9,"Green",8,15], - [[42.6504,31.6621,-0.00143886],7,9,"Green",8,15], - [[7.51563,46.4531,-0.001438864],7,9,"Green",8,15], - [[-8.99219,-11.623,-0.00143838],7,9,"Green",8,15] -]; // Can be used to define spawn positions of AI patrols - -_missionPatrolVehicles = [ - [selectRandom blck_AIPatrolVehicles,[27.8945,100.275,0],0,[true,false]], - [selectRandom blck_AIPatrolVehicles,[-84.7793,72.2617,9.53674e-007],0,[true,false]], - [selectRandom blck_AIPatrolVehicles,[-87.8457,-109.947,7.15256e-007],0,[true,false]] -]; // can be used to define the spawn positions of vehicle patrols - -// Change _useMines to true/false below to enable mission-specific settings. -_useMines = blck_useMines; -_minNoAI = blck_MinAI_Green; -_maxNoAI = blck_MaxAI_Green; -_noAIGroups = blck_AIGrps_Green; -_noVehiclePatrols = blck_SpawnVeh_Green; -_noEmplacedWeapons = blck_SpawnEmplaced_Green; -_uniforms = blck_SkinList; -_headgear = blck_headgear; -//_chanceReinforcements = blck_reinforcementsGreen select 0; -//_noPara = blck_reinforcementsGreen select 1; -//_helipatrol = blck_reinforcementsGreen select 2; -_endCondition = "allKilledOrPlayerNear"; // Options are "allUnitsKilled", "playerNear", "allKilledOrPlayerNear" -//_timeOut = -1; -#include "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionSpawner.sqf"; diff --git a/@GMS/addons/custom_server/Missions/UMS/GMS_UMS_StaticMissions_Lists.sqf b/@GMS/addons/custom_server/Missions/UMS/GMS_UMS_StaticMissions_Lists.sqf index bfe87ff..95c064e 100644 --- a/@GMS/addons/custom_server/Missions/UMS/GMS_UMS_StaticMissions_Lists.sqf +++ b/@GMS/addons/custom_server/Missions/UMS/GMS_UMS_StaticMissions_Lists.sqf @@ -17,8 +17,8 @@ private ["_staticMissions"]; _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","staticMissionExample2_Epoch.sqf"], - ["Exile","Altis","staticMissionExample2_Exile.sqf"] + //["Epoch","Altis","staticMissionExample2_Epoch.sqf"], + //["Exile","Altis","staticMissionExample2_Exile.sqf"] ]; diag_log "[blckeagls] GMS_UMS_StaticMissions_Lists.sqf "; 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 index 2670ea9..1f8c754 100644 --- 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 @@ -13,12 +13,13 @@ params["_pos"]; diag_log format["_fnc_addDynamicUMS_Mission: _pos = %1",_pos]; private["_UMS_mission","_waitTime","_mission"]; -//blck_dynamicUMS_MissionsRuning = blck_dynamicUMS_MissionsRuning + 1; - _UMS_mission = selectRandom blck_dynamicUMS_MissionList; +_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; 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]; diff --git a/@GMS/addons/custom_server/Missions/UMS/code/GMS_fnc_spawnDynamicUMSMission - Copy.sqf b/@GMS/addons/custom_server/Missions/UMS/code/GMS_fnc_spawnDynamicUMSMission - Copy.sqf new file mode 100644 index 0000000..669d2a7 --- /dev/null +++ b/@GMS/addons/custom_server/Missions/UMS/code/GMS_fnc_spawnDynamicUMSMission - Copy.sqf @@ -0,0 +1,563 @@ +/* + Generic Mission Spawner + By Ghostrider GRG + Copyright 2016 + Last modified 12/14/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"; +#define isScubaMission true +private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_AI_Vehicles","_timeOut","_aiDifficultyLevel","_missionPatrolVehicles","_missionGroups"]; +params["_coords","_mission",["_allowReinforcements",false]]; +//diag_log format["_missionSpawner (18):: _allowReinforcements = %1",_allowReinforcements]; + +//////// +// set all variables needed for the missions +// data is pulled either from the mission description or from the _mission variable passsed as a parameter +// Deal with situations where some of these variables might not be defined as well. +//////// + +// _mission params[_missionListOrange,_pathOrange,"OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange]; +_markerClass = _mission; +_aiDifficultyLevel = _difficulty; // _difficulty is defined in the mission description file. see \addons\custom_server\Missions\UMS\dynamicMissions\default.sqf for an example + +blck_ActiveMissionCoords pushback _coords; +blck_UMS_ActiveDynamicMissions pushBack _coords; +blck_dynamicUMS_MissionsRuning = blck_dynamicUMS_MissionsRuning + 1; +blck_missionsRunning = blck_missionsRunning + 1; + +diag_log format["[blckeagls] missionSpawner (34):: Initializing mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + +private["_chanceHeliPatrol","_noPara","_reinforcementLootCounts","_chanceLoot","_heliCrew","_loadCratesTiming"]; + +if (isNil "_markerColor") then {_markerColor = "ColorBlack"}; +if (isNil "_markerType") then {_markerType = ["mil_box",[]]}; +//if (isNil "_timeOut") then {_timeOut = -1;}; +if (isNil "_loadCratesTiming") then {_loadCratesTiming = blck_loadCratesTiming}; // valid choices are "atMissionCompletion" and "atMissionSpawn"; +if (isNil "_missionGroups") then {_missionGroups = []}; +private["_useMines","_blck_AllMissionAI","_delayTime","_groupPatrolRadius"]; +if (isNil "_useMines") then {_useMines = blck_useMines;}; + +_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 +{ + //diag_log "labeling map markers *****"; + _blck_localMissionMarker set [2, _markerMissionName]; +}; +if !(blck_preciseMapMarkers) then +{ + //diag_log "Map marker will be OFFSET from the mission position"; + _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; +[_blck_localMissionMarker] call blck_fnc_spawnMarker; +#ifdef blck_debugMode +if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (91) message players and spawn a mission marker";}; +if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (77) waiting for player to trigger the mission";}; +#endif +//////// +// All parameters are defined, lets wait until a player is nearby or the mission has timed out +//////// + +private["_wait","_missionStartTime","_playerInRange","_missionTimedOut"]; +_missionStartTime = diag_tickTime; +_playerInRange = false; +_missionTimedOut = false; + +_wait = true; + +#ifdef blck_debugMode +if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (90) starting mission trigger loop"}; +if (blck_debugLevel > 2) then {_wait = false}; +#endif + +while {_wait} do +{ + #ifdef blck_debugMode + //diag_log "missionSpawner:: top of mission trigger loop"; + if (blck_debugLevel > 2) exitWith {_playerInRange = true;}; + #endif + + if ([_coords, blck_TriggerDistance, false] call blck_fnc_playerInRange) exitWith {_playerInRange = true;}; + if ([_missionStartTime] 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] call blck_fnc_timedOut]; + }; + #endif +}; + +if (_missionTimedOut) exitWith +{ +/* + +*/ + // Deal with the case in which the mission timed out. + //["timeOut",_endMsg,_blck_localMissionMarker select 2] call blck_fnc_messageplayers; + blck_priorDynamicUMS_Missions pushback [_coords,diag_tickTime]; + blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords]; + blck_missionsRunning = blck_missionsRunning - 1; + blck_UMS_ActiveDynamicMissions = blck_UMS_ActiveDynamicMissions - [_coords]; + blck_dynamicUMS_MissionsRuning = blck_dynamicUMS_MissionsRuning - 1; + + [_blck_localMissionMarker select 0] call blck_fnc_deleteMarker; + //_blck_localMissionMarker set [1,[0,0,0]]; + //_blck_localMissionMarker set [2,""]; + [_objects, 0.1] spawn blck_fnc_cleanupObjects; + + #ifdef blck_debugMode + if (blck_debugLevel > 0) then + { + diag_log format["[blckeagls] dynamicUMSspawner:: (133) Mission Timed Out: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + }; + #endif +}; + +//////// +// 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 + +private ["_temp"]; +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 +{ + _temp = [_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear,_missionGroups] 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 + +//diag_log format["_fnc_dynamicUMSspawner: spawning scuba groups with _scubaGroupParameters = %1",_scubaGroupParameters]; +// params["_coords",["_minNoAI",3],["_maxNoAI",6],["_aiDifficultyLevel","red"],["_uniforms",blck_SkinList],["_headGear",blck_BanditHeadgear],"_missionGroups",["weapons",[]],["_vests",blck_vests],["_isScubaGroup",false]]; +_temp = [_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,blck_UMS_uniforms,blck_UMS_headgear,_scubaGroupParameters,blck_UMS_weapons,blck_UMS_vests,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","_uniforms","_headGear","_missionPatrolVehicles",["_useRelativePos",true],["_weapons",[]],["_vests",blck_vests],["_isScubaGroup",false]]; + _temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_vehiclePatrolParameters,true /*,blck_UMS_weapons,blck_UMS_vests,isScubaMission*/ ] call blck_fnc_spawnMissionVehiclePatrols; + //[_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear,_markerClass] 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 +{ + _temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_submarinePatrolParameters,true,blck_UMS_weapons,blck_UMS_vests,isScubaMission] call blck_fnc_spawnMissionVehiclePatrols; + //[_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear,_markerClass] 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 + + }; +}; + +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; + +if (_allowReinforcements) then +{ + _weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout; + _temp = []; + + #ifdef blck_debugMode + if (blck_debugLevel > 1) then + { + diag_log format["[blckeagls] dynamicUMSspawner:: (298) calling in reinforcements: Current mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + }; + #endif + private _noChoppers = 0; + private _chancePara = 0; + switch (toLower _aiDifficultyLevel) do + { + case "blue":{ + _noChoppers = [blck_noPatrolHelisBlue] call blck_fnc_getNumberFromRange; + //_chancePara = [blck_chanceParaBlue] call blck_fnc_getNumberFromRange; + }; + case "red":{ + _noChoppers = [blck_noPatrolHelisRed] call blck_fnc_getNumberFromRange; + //_chancePara = [blck_chanceParaRed] call blck_fnc_getNumberFromRange; + }; + case "green":{ + _noChoppers = [blck_noPatrolHelisGreen] call blck_fnc_getNumberFromRange; + //_chancePara = [blck_chanceParaGreen] call blck_fnc_getNumberFromRange; + }; + case "orange":{ + _noChoppers = [blck_noPatrolHelisOrange] call blck_fnc_getNumberFromRange; + //_chancePara = [blck_chanceParaOrange] call blck_fnc_getNumberFromRange; + }; + }; + #ifdef blck_debugMode + diag_log format["_dynamicUMSspawner(322):: _noChoppers = %1 && _chancePara = %2",_noChoppers,_chancePara]; + #endif + for "_i" from 1 to (_noChoppers) do + { + //params["_coords","_aiSkillsLevel","_weapons","_uniforms","_headgear"]; + + _temp = [_coords,_aiDifficultyLevel,_weaponList,_uniforms,_headGear,_chancePara] call blck_fnc_spawnMissionReinforcements; + + #ifdef blck_debugMode + if (blck_debugLevel >= 2) then + { + diag_log format["dynamicUMSspawner(334):: blck_fnc_spawnMissionReinforcements call for chopper # %1 out of a total of %2 choppers",_i, _noChoppers]; + diag_log format["dynamicUMSspawner(335):: _temp = %1",_temp]; + }; + #endif + + if (typeName _temp isEqualTo "ARRAY") then + { + _abort = _temp select 2; + _objects pushback (_temp select 0); + _blck_AllMissionAI append (_temp select 1); + }; + if (_abort) then + { + #ifdef blck_debugMode + if (blck_debugLevel > 2) then + { + diag_log "dynamicUMSspawner:: (349) grpNul or ERROR in blck_fnc_spawnMissionReinforcements, mission termination criteria met, calling blck_endMission"; + }; + #endif + + [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,1,isScubaMission] 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; + + #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 (count _missionLootBoxes > 0) then +{ + _crates = [_coords,_missionLootBoxes,_loadCratesTiming] call blck_fnc_spawnMissionCrates; +} +else +{ + _crates = [_coords,[[selectRandom blck_UMS_crates,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming] call blck_fnc_spawnMissionCrates; + +}; + +if (blck_cleanUpLootChests) then +{ + _objects append _crates; +}; + + +//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; + +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 +_fn_crateMoved = { + params["_crate"]; + private _result = (_x distance (_x getVariable["crateSpawnPos",[0,0,0]])) > 10; + //diag_log format["_fn_crateMoved:: _result = %1",_result]; + _result; +}; +_missionComplete = -1; +while {_missionComplete isEqualTo -1} do +{ + //if (blck_debugLevel isEqualTo 3) exitWith {uiSleep 180}; + if ((_endIfPlayerNear) && [_locations,10,true] call blck_fnc_playerInRangeArray) exitWith {}; + if ((_endIfAIKilled) && ({alive _x} count _blck_AllMissionAI) < 1) exitWith {}; + + { + if ({[_x] call _fn_crateMoved} count _crates > 0) exitWith + { + _missionComplete = 1; + _crateStolen = true; + }; + }forEach _crates; + //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; +}; +#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]; +// params["_mines","_objects","_crates","_blck_AllMissionAI","_endMsg","_blck_localMissionMarker","_coords","_mission",["_aborted",false],["_vehicles",[]],["_isScubaMission",false]]; +_result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,0,_missionAIVehicles,isScubaMission] call blck_fnc_endMission; + +//diag_log format["[blckeagls] dynamicUMSspawner:: (559) end of mission: blck_fnc_endMission has returned control to _fnc_dynamicUMSspawner"]; + 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 index 669d2a7..db45187 100644 --- a/@GMS/addons/custom_server/Missions/UMS/code/GMS_fnc_spawnDynamicUMSMission.sqf +++ b/@GMS/addons/custom_server/Missions/UMS/code/GMS_fnc_spawnDynamicUMSMission.sqf @@ -27,11 +27,6 @@ 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 -blck_ActiveMissionCoords pushback _coords; -blck_UMS_ActiveDynamicMissions pushBack _coords; -blck_dynamicUMS_MissionsRuning = blck_dynamicUMS_MissionsRuning + 1; -blck_missionsRunning = blck_missionsRunning + 1; - diag_log format["[blckeagls] missionSpawner (34):: Initializing mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; private["_chanceHeliPatrol","_noPara","_reinforcementLootCounts","_chanceLoot","_heliCrew","_loadCratesTiming"]; @@ -494,7 +489,17 @@ diag_log format["[blckeagls] mission Spawner(436) _endCondition = %1",_endCondit private["_missionComplete","_endIfPlayerNear","_endIfAIKilled"]; _missionComplete = -1; _startTime = diag_tickTime; - +if (blck_showCountAliveAI) then +{ + //diag_log format["_missionSpawner(441): Adding Number Alive AI: _marker = %1 | _markerMissionName = %2",_marker,_markerMissionName]; + //diag_log format["_missionSpawner(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["_missionSpawner: blck_missionMarkers = %1",blck_missionMarkers]; + }; +}; switch (_endCondition) do { case "playerNear": {_endIfPlayerNear = true;_endIfAIKilled = false;}; diff --git a/@GMS/addons/custom_server/init/build.sqf b/@GMS/addons/custom_server/init/build.sqf index 0635a96..af70ecc 100644 --- a/@GMS/addons/custom_server/init/build.sqf +++ b/@GMS/addons/custom_server/init/build.sqf @@ -1,6 +1,12 @@ private ["_version","_versionDate"]; +<<<<<<< HEAD blck_version = "6.80 Build 117"; _blck_version = blck_version; _blck_versionDate = "3-3-18 7:00 PM"; +======= +blck_version = "6.80 Build 118"; +_blck_version = blck_version; +_blck_versionDate = "3-3-18 7:00 AM"; +>>>>>>> Experimental blck_pvs_version = _blck_version; publicVariable blck_pvs_version; diff --git a/changeLog.sqf b/changeLog.sqf index 3ef7ff7..55fb415 100644 --- a/changeLog.sqf +++ b/changeLog.sqf @@ -8,12 +8,25 @@ Ideas or code from that by Vampire and KiloSwiss have been used for certain func Significant Changes: ===================== +<<<<<<< HEAD Version 1.80 Build 117 Added: you can now determine whether objects spawned at dynamic missions have simulation or damage enabled. See the medicalCamp.sqf mission for an example of how this is done. Added: you can now spawn simple objects as part of your mission landscape. Useful for STATIC missions only. Changed: Default missions reworked to support the above. +======= +Version 1.80 build 118 +Added: The server now sets simulation on/off and damage on/off for objects at dynamic missions. default missions updated. +Added: lists of armed vehicles from which you can choose those you wish to spawn at vehicles broken down by category (wheeled, traced APC, Tank, etc) +Added: Three constants that define how far away missions are from certain ingame bases, players and towns when they spawn. These were previously embedded in the code but not configurable. + blck_minDistanceToBases = 900; Minimum distance from any freq jammer or flag + blck_minDistanceToPlayer = 900; Minimum distance from any player + blck_minDistanceFromTowns = 300; Minimum distance from cites or towns. +Fixed: Alive AI counts were not disabled by blck_showCountAliveAI. +Fixed: The number of dynamically spawned underwater missions was not correctly set by blck_numberUnderwaterDynamicMissions. + +>>>>>>> Experimental Version 1.79, Build 116 Added: Map-specific information for Lythium. Added: New configuration setting: blck_showCountAliveAI = true; When = true, the number of alive AI at a mission will be displayed by the mission marker.