diff --git a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_createMissionMarkers.sqf b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_createMissionMarkers.sqf index be4cf13..e13ebf2 100644 --- a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_createMissionMarkers.sqf +++ b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_createMissionMarkers.sqf @@ -21,7 +21,7 @@ private "_markers"; ["_markerBrush","GRID"] ]; - +/* private _pList =[ "_markerName", // the name used when creating the marker. Must be unique. "_markerPos", @@ -35,7 +35,7 @@ for "_i" from 0 to ((count _this) - 1) do { diag_log format["_fnc_createMarker: parameter %1 = %2",_pList select _i,_this select _i]; }; - +*/ if (toUpper(_markerType) in ["ELLIPSE","RECTANGLE"]) then // not an Icon .... { @@ -49,7 +49,7 @@ if (toUpper(_markerType) in ["ELLIPSE","RECTANGLE"]) then // not an Icon .... _m2 setMarkerColor "ColorBlack"; _m2 setMarkerText _markerLabel; _markers = [_m,_m2]; - diag_log format["_fnc_createMarkers: case of ELLIPSE/RECTANGLE: _markers = %1",_markers]; + //diag_log format["_fnc_createMarkers: case of ELLIPSE/RECTANGLE: _markers = %1",_markers]; } else { private _m = ""; private _m2 = createMarker [blck_missionMarkerRootName + _markerName + "label", _markerPos]; @@ -57,7 +57,7 @@ if (toUpper(_markerType) in ["ELLIPSE","RECTANGLE"]) then // not an Icon .... _m2 setMarkerColor _markerColor; _m2 setMarkerText _markerLabel; _markers = [_m,_m2]; - diag_log format["_fnc_createMarkers: case of ICON: _markers = %1",_markers]; + //diag_log format["_fnc_createMarkers: case of ICON: _markers = %1",_markers]; }; -_markers \ No newline at end of file +_markers diff --git a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_deleteMarker.sqf b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_deleteMarker.sqf index caa89d6..22d62ef 100644 --- a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_deleteMarker.sqf +++ b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_deleteMarker.sqf @@ -11,6 +11,6 @@ #include "\q\addons\custom_server\Configs\blck_defines.hpp"; params[["_markerName",""]]; -if (_markerName isEqualTo "" || !(typeName _markerName isEqualTo "STRING")) exitWith {diag_log format"[blckeagls] illeagal or missing marker name: typeName _markerName = %1 | _makerName = %2",typeName _markerName,_markerName}; + deleteMarker _markerName; deleteMarker (_markerName + "label"); diff --git a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_timedOut.sqf b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_timedOut.sqf index 61bedf0..c95f910 100644 --- a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_timedOut.sqf +++ b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_timedOut.sqf @@ -16,7 +16,5 @@ ///////////////////////////////////////////////////// params["_startTime",["_timeoutTime",blck_MissionTimeout]]; -private["_return"]; -//if ((diag_tickTime - _startTime) > _timeoutTime) then {_return = true} else {_return = false}; -_return = ((diag_tickTime - _startTime) > _timeoutTime) ; -_return; +private _return = if ((diag_tickTime - _startTime) > _timeoutTime) then {true} else {false}; +_return diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_endMission.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_endMission.sqf index 5845558..f1c45c4 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_endMission.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_endMission.sqf @@ -63,7 +63,7 @@ private _param = ["_coords","_mines","_objects","_crates","_blck_AllMissionAI"," */ { [_x] call blck_fnc_deleteMarker; -}forEach (_blck_localMissionMarker select 0); +}forEach (_markers); if (_endCondition > 0) exitWith // Mision aborted for some reason diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf index e6a2918..f0d134c 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf @@ -13,11 +13,11 @@ #include "\q\addons\custom_server\Configs\blck_defines.hpp"; #define delayTime 1 -private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_assetKilledMsg","_enemyLeaderConfig", +private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_assetKilledMsg","_enemyLeaderConfig", "_AI_Vehicles","_timeOut","_aiDifficultyLevel","_missionPatrolVehicles","_missionGroups","_loadCratesTiming","_spawnCratesTiming","_assetSpawned","_hostageConfig", "_chanceHeliPatrol","_noPara","_chanceLoot","_heliCrew","_loadCratesTiming","_useMines","_blck_AllMissionAI","_delayTime","_groupPatrolRadius", "_wait","_missionStartTime","_playerInRange","_missionTimedOut","_temp","_patrolVehicles","_vehToSpawn","_noChoppers","_chancePara","_paraSkill","_marker","_vehicleCrewCount", - "_defaultMissionLocations"]; + "_defaultMissionLocations","_garrisonedbuildings_buildingposnsystem","_garrisonedBuilding_ATLsystem", "_isScubaMission"]; params["_coords","_markerName","_aiDifficultyLevel"]; @@ -57,8 +57,9 @@ if (isNil "_missionLootVehicles") then {_missionLootVehicles = []}; if (isNil "_garrisonedBuilding_ATLsystem") then {_garrisonedBuilding_ATLsystem = []}; if (isNil "_garrisonedBuildings_BuildingPosnSystem") then {_garrisonedBuildings_BuildingPosnSystem = []}; if (isNil "_vehicleCrewCount") then {_vehicleCrewCount = [_aiDifficultyLevel] call GMS_fnc_selectVehicleCrewCount}; -if (isNil "_submarinePatrolParameters") then {_submarinePatrolParameters = []}; if (isNil "_airpatrols") then {_airpatrols = []}; +if (isNil "_submarinePatrolParameters") then {_submarinePatrolParameters = []}; + if (isNil "_scubagroupparameters") then {_scubagroupparameters = []}; if (isNil "_markerMissionName") then { diag_log format["_fnc_missionSpawner: _markerMissionName not defined, using default value"]; @@ -67,8 +68,7 @@ if (isNil "_markerMissionName") then { if (isNil "_noLootCrates") then {_noLootCrates = 1}; if (isNil "_lootCrates") then {_lootCrates = blck_crateTypes}; if (isNil "_lootCratePositions") then {_lootCratePositions = []}; -//if (isNil "_markerSize") then {_markerSize = [200,200]}; -//if (isNil "_markerBrush") then {_markerBrush = "GRID"}; + if (isNil "_isScubaMission") then {_isScubaMission = false}; if (isNil "_missionLootBoxes") then {_missionLootBoxes = []}; private "_temp"; @@ -92,7 +92,7 @@ _aiGroup = []; _missionAIVehicles = []; _blck_AllMissionAI = []; _AI_Vehicles = []; -_blck_localMissionMarker = [[],_markerName,_coords,"","",_markerColor,_markerType]; + #define delayTime 1 #define useRelativePos true @@ -100,22 +100,20 @@ _blck_localMissionMarker = [[],_markerName,_coords,"","",_markerColor,_markerTyp diag_log "_missionSpawner: All variables initialized"; #endif private _markerPos = _coords; -if (blck_labelMapMarkers select 0) then -{ - _blck_localMissionMarker set [2, _markerMissionName]; -}; + if !(blck_preciseMapMarkers) then { private _markerPos = [_coords,75] call blck_fnc_randomPosition; - diag_log format["_fnc_missionSpawner (110): _markerPos = %1",_markerPos]; - _blck_localMissionMarker set [1,_markerMissionName]; + //diag_log format["_fnc_missionSpawner (110): _markerPos = %1",_markerPos]; } ; -_blck_localMissionMarker set [3,blck_labelMapMarkers select 1]; // Use an arrow labeled with the mission name? [["start",_startMsg,_markerMissionName]] call blck_fnc_messageplayers; + + _markerType params["_type",["_size",[250,250]],["_brush","GRID"]]; _markers = [_markerName,_markerPos,_markerMissionName,_markerColor,_type,_size,_brush] call blck_fnc_createMissionMarkers; -_blck_localMissionMarker set [0, _markers]; + + #ifdef blck_debugMode if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (145) message players and spawn a mission marker";}; if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (146) _markers = %1",_markers];}; @@ -212,7 +210,7 @@ if (_missionLandscapeMode isEqualTo "random") then { _temp = [_coords,_missionLandscape, 3, 15, 2] call blck_fnc_spawnRandomLandscape; } else { - params["_center","_objects"]; + _temp = [_coords, _missionLandscape] call blck_fnc_spawnCompositionObjects; }; if (typeName _temp isEqualTo "ARRAY") then @@ -223,7 +221,7 @@ if (typeName _temp isEqualTo "ARRAY") then #ifdef blck_debugMode if (blck_debugLevel > 0) then { - diag_log format["[blckeagls] missionSpawner:: (237) Landscape spawned: _cords %1 : _markerName %2 : _aiDifficultyLevel %3 _markerLabel %4",_coords,_markerName,_aiDifficultyLevel,_markerLabel]; + diag_log format["[blckeagls] missionSpawner:: (219) Landscape spawned: _cords %1 : _markerName %2 : _aiDifficultyLevel %3 _markerLabel %4",_coords,_markerName,_aiDifficultyLevel,_markerLabel]; }; #endif @@ -241,6 +239,23 @@ if !(_abort) then _blck_AllMissionAI append (_temp select 0); }; +if (count _scubaGroupParameters > 0) then +{ + #define isScubaMission true + //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]]; + private _temp = [_coords, _minNoAI,_maxNoAI,count _scubaGroupParameters,_scubaGroupParameters,_aiDifficultyLevel,blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,[],blck_UMS_weapons,[],_isScubaMission] call blck_fnc_spawnMissionAI; + diag_log format["_fnc_missionSpawner (243): _temp = %1",_temp]; + uiSleep 2; + _abort = _temp select 1; + + if !(_abort) then + { + _blck_AllMissionAI append (_temp select 0); + }; + diag_log format["[blckeagls] missionSpawner:: (250) scuba AI spawned: _markerName %1 : _markerLabel %2 : count _blck_AllMissionAI = %3",_markerName,_markerLabel, count _blck_AllMissionAI]; +}; + #ifdef blck_debugMode uiSleep 10; if (blck_debugLevel > 0) then @@ -354,6 +369,15 @@ if (blck_useVehiclePatrols && ((_vehToSpawn > 0) || count _missionPatrolVehicles _blck_AllMissionAI append _units; }; +// 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,_umsUniforms,_umsHeadgear,_umsVests,[],_umsWeapons,[],isScubaMission] call blck_fnc_spawnMissionVehiclePatrols; + _missionAIVehicles append (_temp select 0); + _blck_AllMissionAI append (_temp select 1); +}; + #ifdef blck_debugMode uiSleep 10; if (blck_debugLevel > 2) then {diag_log "_fnc_missionSpawner (330) vehicle patrols spawned"}; @@ -369,7 +393,6 @@ if (_spawnCratesTiming isEqualTo "atMissionSpawnGround") then else { _crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming, _spawnCratesTiming, "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - }; if (blck_cleanUpLootChests) then @@ -591,17 +614,7 @@ if (_spawnCratesTiming isEqualTo "atMissionSpawnGround" && _loadCratesTiming isE }; private["_result"]; -// Force passing the mission name for informational purposes. -_blck_localMissionMarker set [2, _markerMissionName]; -// delete the prior instance of this mission. -if (blck_showCountAliveAI) then -{ - _marker setMarkerText format["%1: All AI Dead",_markerLabel]; - { - if ((_x select 1) isEqualTo _markerLabel) exitWith{blck_missionLabelMarkers deleteAt _forEachIndex}; - }forEach blck_missionLabelMarkers; -}; -*/ + if (_secureAsset && (alive _assetSpawned)) then diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnDynamicUMSMission.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnDynamicUMSMission.sqf deleted file mode 100644 index 8ef6292..0000000 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnDynamicUMSMission.sqf +++ /dev/null @@ -1,636 +0,0 @@ -/* - 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,count _missionGroups,_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,count _scubaGroupParameters,_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]; diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionAI.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionAI.sqf index eaa2b8a..079ab2e 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionAI.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionAI.sqf @@ -18,10 +18,17 @@ params["_coords",["_minNoAI",3],["_maxNoAI",6],["_noAIGroups",0],["_missionGroups",[]],["_aiDifficultyLevel","red"],["_uniforms",[]],["_headGear",blck_BanditHeadgear],["_vests",[]],["_backpacks",[]],["_weapons",[]],["_sideArms",[]],["_isScubaGroup",false]]; -private["_unitsToSpawn","_unitsPerGroup","_ResidualUnits","_newGroup","_blck_AllMissionAI","_abort","_return","_adjusttedGroupSize","_minDist","_maxDist"]; -_unitsToSpawn = 0; -_unitsPerGroup = 0; -_ResidualUnits = 0; +/* +private _params = ["_coords","_minNoAI","_maxNoAI","_noAIGroups","_missionGroups","_aiDifficultyLevel","_uniforms","_headGear","_vests","_backpacks","_weapons","_sideArms","_isScubaGroup"]; +{ + diag_log format["_fnc_spawnMissionAI: _this %1 | name %3 = %2",_forEachIndex,_x,_params select _forEachIndex]; +} forEach _this; +*/ + +private _unitsToSpawn = 0; +private _unitsPerGroup = 0; +private _ResidualUnits = 0; +private _adjusttedGroupSize = 0; // TODO: Does not really look right if (_noAIGroups > 0) then @@ -31,17 +38,28 @@ if (_noAIGroups > 0) then _unitsPerGroup = floor(_unitsToSpawn/_noAIGroups); _ResidualUnits = _unitsToSpawn - (_unitsPerGroup * _noAIGroups); }; -_blck_AllMissionAI = []; -_abort = false; +private _allSpawnedAI = []; +private _abort = false; private _newGroup = grpNull; //_newGroup setVariable ["soldierType","infantry"]; -if ( (count _missionGroups > 0) && _noAIGroups > 0) then +if !(_missionGroups isEqualTo []) then { + //diag_log "_fnc_missionspawner: spawning pre-defined groups"; { _x params["_position","_minAI","_maxAI","_skillLevel","_minPatrolRadius","_maxPatrolRadius"]; - _groupSpawnPos = _coords vectorAdd _position; + private _p = ["_position","_minAI","_maxAI","_skillLevel","_minPatrolRadius","_maxPatrolRadius"]; + private _p1 = [_position,_minAI,_maxAI,_skillLevel,_minPatrolRadius,_maxPatrolRadius]; + + /* + { + diag_log format["_fnc_spawnMissionAI: %1 = %2",_p select _forEachIndex, _x]; + } forEach _p1; + */ + + private _groupSpawnPos = _coords vectorAdd _position; _newGroup = [blck_AI_Side,true] call blck_fnc_createGroup; + //diag_log format["_fnc_spawnMissionAI(55): _newGroup = %1",_newGroup]; _newGroup setVariable ["soldierType","infantry"]; #ifdef blck_debugMode if (blck_debugLevel >= 2) then @@ -55,17 +73,12 @@ if ( (count _missionGroups > 0) && _noAIGroups > 0) then //[["_group","Error"],"_pos", "_center", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], ["_minDist",30], ["_maxDist",45],["_configureWaypoints",true], ["_uniforms",[]], ["_headGear",[]],["_vests",[]],["_backpacks",[]],["_weaponList",[]],["_sideArms",[]], ["_scuba",false],["_patrolRadius",30]]; [_newGroup,_groupSpawnPos,_coords,_minAI,_maxAI,_aiDifficultyLevel,_minPatrolRadius,_maxPatrolRadius,configureWaypoints,_uniforms,_headGear,_vests,_backpacks,_weapons,_sideArms,_isScubaGroup] call blck_fnc_spawnGroup; _newGroup setVariable ["soldierType","infantry"]; - _newAI = units _newGroup; + //private _newAI = units _newGroup; blck_monitoredMissionAIGroups pushback _newGroup; - #ifdef blck_debugMode - if (blck_debugLevel >= 2) then - { - diag_log format["_fnc_spawnMissionAI(41): Spawning Groups for defined array of group positions: _noAIGroups=1 _newGroup=%1 _newAI = %2",_newGroup, _newAI]; - }; - #endif - - _blck_AllMissionAI append _newAI; + + _allSpawnedAI append (units _newGroup); + diag_log format["_fnc_spawnMissionAI(77): group %1 | count _newAI = %2 | count _allSpawnedAI = %3",_forEachIndex,count (units _newGroup), count _allSpawnedAI]; }; }forEach _missionGroups; }; @@ -104,9 +117,9 @@ if (_missionGroups isEqualTo [] && _noAIGroups > 0) then diag_log format["_fnc_spawnMissionAI(41): Spawning Groups: _noAIGroups=1 _newGroup=%1 _newAI = %2",_newGroup, _newAI]; }; #endif - - _blck_AllMissionAI append _newAI; - + + _allSpawnedAI append _newAI; + }; }; case 2: { @@ -140,7 +153,7 @@ if (_missionGroups isEqualTo [] && _noAIGroups > 0) then }; #endif - _blck_AllMissionAI append _newAI; + _allSpawnedAI append _newAI; }; }forEach _groupLocations; @@ -166,7 +179,7 @@ if (_missionGroups isEqualTo [] && _noAIGroups > 0) then diag_log format["_fnc_spawnMissionAI (73): Case 3: _newGroup=%1",_newGroup]; }; #endif - _blck_AllMissionAI append _newAI; + _allSpawnedAI append _newAI; _groupLocations = [_coords,2,20,35] call blck_fnc_findPositionsAlongARadius; { _newGroup = [blck_AI_Side,true] call blck_fnc_createGroup; @@ -182,7 +195,7 @@ if (_missionGroups isEqualTo [] && _noAIGroups > 0) then diag_log format["_fnc_spawnMissionAI(78): Case 3: line 81: _newGroup = %1",_newGroup]; }; #endif - _blck_AllMissionAI append _newAI; + _allSpawnedAI append _newAI; }; }forEach _groupLocations; }; @@ -209,7 +222,7 @@ if (_missionGroups isEqualTo [] && _noAIGroups > 0) then diag_log format["_fnc_spawnMissionAI(92): Spawning Groups: Default - > Center Position: _noAIGroups=1 _newGroup=%1 _newAI = %2",_newGroup, _newAI]; }; #endif - _blck_AllMissionAI append _newAI; + _allSpawnedAI append _newAI; }; _groupLocations = [_coords,(_noAIGroups - 1),20,40] call blck_fnc_findPositionsAlongARadius; { @@ -226,7 +239,7 @@ if (_missionGroups isEqualTo [] && _noAIGroups > 0) then diag_log format["_fnc_spawnMissionAI(99): Default: Radial Positions: _newGroup=%1",_newGroup]; }; #endif - _blck_AllMissionAI append _newAI; + _allSpawnedAI append _newAI; }; }forEach _groupLocations; }; @@ -236,9 +249,9 @@ if (_missionGroups isEqualTo [] && _noAIGroups > 0) then #ifdef blck_debugMode if (blck_debugLevel >= 1) then { - diag_log format["_fnc_spawnMissionAI(133): _abort = %1 | _blck_AllMissionAI = %2",_abort,_blck_AllMissionAI]; + diag_log format["_fnc_spawnMissionAI(243): _abort = %1 | _allSpawnedAI = %2",_abort,_allSpawnedAI]; }; #endif - -_return = [_blck_AllMissionAI,_abort]; +//diag_log format["_fnc_spawnMissionAI(246): _unitsToSpawn = %1 | count _allSpawnedAI = %2",_unitsToSpawn,count _allSpawnedAI]; +_return = [_allSpawnedAI,_abort]; _return diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnRandomLandscape.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnRandomLandscape.sqf index 6b513a3..baf8ef2 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnRandomLandscape.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnRandomLandscape.sqf @@ -28,8 +28,7 @@ _objects pushBack _wreck; { private _dir = random(360); private _radius = minObjectSpawnRadius + random(maxObjectSpawnRadius); - _wreck = createVehicle[_x, _coords getPos[_radius,_dir], [], 2]; - //diag_log format["_fnc_spawnRandomLandscape: _x = %1 | _wreck = %2",_x,_wreck]; + _wreck = createVehicle[_x, _coords getPos[_radius,_dir], [], 2]; _wreck allowDamage true; _wreck enableSimulation false; _wreck enableSimulationGlobal false; diff --git a/@GMS/addons/custom_server/Compiles/blck_variables.sqf b/@GMS/addons/custom_server/Compiles/blck_variables.sqf index a0b0724..1557a82 100644 --- a/@GMS/addons/custom_server/Compiles/blck_variables.sqf +++ b/@GMS/addons/custom_server/Compiles/blck_variables.sqf @@ -41,7 +41,7 @@ blck_connectedHCs = []; blck_missionMarkerRootName = "blckeagls_marker"; DMS_missionMarkerRootName = "DMS_MissionMarker"; blck_missionLabelMarkers = []; -blck_heliCrashSites = []; + blck_temporaryMarkers = []; blck_illuminatedCrates = []; // [crate,duration,freq of replacement] blck_mainThreadUpdateInterval = 60; diff --git a/@GMS/addons/custom_server/Missions/UMS/dynamicMissions/default.sqf b/@GMS/addons/custom_server/Missions/UMS/dynamicMissions/default.sqf index 36fd4b0..66d20ad 100644 --- a/@GMS/addons/custom_server/Missions/UMS/dynamicMissions/default.sqf +++ b/@GMS/addons/custom_server/Missions/UMS/dynamicMissions/default.sqf @@ -12,9 +12,9 @@ private ["_markerLabel","_endMsg","_startMsg","_lootCounts","_crateLoot","_marke 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. -_difficulty = "red"; // Skill level of AI (blue, red, green etc) +_aiDifficultyLevel = "red"; // Skill level of AI (blue, red, green etc) //diag_log format["[blckeagls UMS missions] STARTED initializing dynamic mission %1 position at %2 difficulty %3",_mission,_missionCenter,_difficulty]; -_crateLoot = blck_BoxLoot_Orange; // You can use a customized _crateLoot configuration by defining an array here. It must follow the following format shown for a hypothetical loot array called _customLootArray +//_crateLoot = blck_BoxLoot_Orange; // You can use a customized _crateLoot configuration by defining an array here. It must follow the following format shown for a hypothetical loot array called _customLootArray /* _customLootArray = // Loot is grouped as [weapons],[magazines],[items] in order to be able to use the correct function to load the item into the crate later on. @@ -45,15 +45,16 @@ _crateLoot = blck_BoxLoot_Orange; // You can use a customized _crateLoot config */ _isScubaMission = true; // This tells the mission spawner to search for a location on the water near a shore rather than on land. - -_lootCounts = blck_lootCountsRed; // You can use a customized set of loot counts or one that is predefined but it must follow the following format: +_crateLoot = blck_BoxLoot_Red; +_lootCounts = [3,5,2,3,6,1]; +//_lootCounts = blck_lootCountsRed; // You can use a customized set of loot counts or one that is predefined but it must follow the following format: // values are: number of things from the weapons, magazines, optics, materials(cinder etc), items (food etc) and backpacks arrays to add, respectively. // blck_lootCountsOrange = [[6,8],[24,32],[5,10],[25,35],16,1]; // Orange _startMsg = "Pirates were spotted off the coast - intercept them and collect the loot"; _endMsg = "The pirates were defeated"; -_markerLabel = ""; +_markerLabel = ""; // No Longer Used by the mission spawner //_markerType = ["ellipse",[200,200],"GRID"]; // An alternative would be: _markerType = ["mil_triangle",[0,0]]; // You can replace mil_triangle with any other valid Arma 3 marker type https://community.bistudio.com/wiki/cfgMarkers @@ -63,7 +64,7 @@ _missionLandscapeMode = "precise"; // acceptable values are "random","precise" // In precise mode objects will be spawned at the relative positions specified. // In the random mode, objects will be randomly spawned within the mission area. _missionLandscape = [ // Paste appropriate lines from M3EDEN output here. - ["Land_Boat_05_wreck_F",[1,1,0],0,[true,false]] + ["Land_Boat_05_wreck_F",[1,2,0],0,[false,false]] ]; // list of objects to spawn as landscape using output from M3EDEN editor. _missionLootBoxes = [ // Paste appropriate lines from M3EDEN editor output here, then add the appropriate lootArray @@ -71,11 +72,11 @@ _missionLootBoxes = [ // Paste appropriate lines from M3EDEN editor output her // where _customLootArray follows the same format as blck_BoxLoot_Red and the other pre-defined arrays and // where _customlootcountsarray1 also follows the same format as the predefined arrays like blck_lootCountsRed // ["Box_NATO_Ammo_F",[22893,16766.8,6.31652],[[0,1,0],[0,0,1]],[true,false], _crateLoot, _lootCounts], - //[selectRandom blck_UMS_crates,[0,0,0],_crateLoot, _lootCounts] + [selectRandom blck_UMS_crates,[-1,-1,0],_crateLoot, _lootCounts] ]; // If this array is empty a single loot chest will be added at the center. If you add items loot chest(s) will be spawned in specific positions. _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. + // Many vehicles have less inventory capacity than crates so you may have to modify _lootcounts to avoid having stuff spawned all over the ground. ["I_Boat_Transport_01_F",[3,3,0],0,_crateLoot, _lootCounts] ]; // [ ["vehicleClassName", [px, py, pz] /* possition at which to spawn*/, _loot /* pointer to array of loot (see below)]; // When blank nothing is spawned. @@ -134,10 +135,12 @@ _noVehiclePatrols = blck_SpawnVeh_Blue; _noEmplacedWeapons = blck_SpawnEmplaced_Blue; // Pertains to AI on boats, structures or land // The UMS configurations are used for sub and scuba AI. -// These are defined here because they are needed for any calls used to spawn non-scuba AI -_uniforms = blck_SkinList; -_headgear = blck_headgear; -_spawnCratesTiming = "atMissionEndAir"; // Choices: "atMissionSpawnGround","atMissionEndGround","atMissionEndAir". +_umsUniforms = blck_UMS_uniforms; +_umsHeadgear = blck_UMS_headgear; +_umsWeapons = blck_UMS_weapons; +_umsVests = blck_UMS_vests; + +_spawnCratesTiming = "atMissionSpawnGround"; // Choices: "atMissionSpawnGround","atMissionEndGround","atMissionEndAir". // Crates spawned in the air will be spawned at mission center or the position(s) defined in the mission file and dropped under a parachute. // This sets the default value but can be overridden by defining _spawnCrateTiming in the file defining a particular mission. _loadCratesTiming = "atMissionSpawn"; // valid choices are "atMissionCompletion" and "atMissionSpawn"; @@ -164,5 +167,6 @@ _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\GMS_fnc_spawnDynamicUMSMission.sqf"; +//#include "\q\addons\custom_server\Missions\UMS\GMS_fnc_spawnDynamicUMSMission.sqf"; +#include "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionSpawner.sqf";