From c8adb1f6d43958000c8c259c8e9de7871d2b5b4e Mon Sep 17 00:00:00 2001 From: Ghostrider-GRG- Date: Wed, 14 Feb 2018 11:26:14 -0500 Subject: [PATCH 1/4] Added Option to Show Alive AI number at Missions. --- .../Functions/GMS_fnc_deleteMarker.sqf | 14 + .../GMS_fnc_markerSetAliveAICount.sqf | 18 + .../GMS_fnc_missionCompleteMarker.sqf | 19 + .../Functions/GMS_fnc_spawnMarker.sqf | 93 ++++ .../GMS_fnc_updateMarkerAliveCount.sqf | 13 + .../GMS_fnc_missionSpawner - Copy.sqf | 504 ------------------ .../Missions/GMS_fnc_missionSpawner.sqf | 28 +- .../Compiles/Units/GMS_fnc_processAIKill.sqf | 10 +- .../Vehicles/GMS_fnc_spawnVehiclePatrol.sqf | 7 +- .../GMS_fnc_vehicleMonitor_updated.sqf | 214 ++++++++ .../custom_server/Compiles/blck_functions.sqf | 5 + .../custom_server/Compiles/blck_variables.sqf | 5 +- .../custom_server/Configs/blck_configs.sqf | 2 +- .../Configs/blck_configs_mil.sqf | 2 +- changeLog.sqf | 5 +- 15 files changed, 423 insertions(+), 516 deletions(-) create mode 100644 @GMS/addons/custom_server/Compiles/Functions/GMS_fnc_deleteMarker.sqf create mode 100644 @GMS/addons/custom_server/Compiles/Functions/GMS_fnc_markerSetAliveAICount.sqf create mode 100644 @GMS/addons/custom_server/Compiles/Functions/GMS_fnc_missionCompleteMarker.sqf create mode 100644 @GMS/addons/custom_server/Compiles/Functions/GMS_fnc_spawnMarker.sqf create mode 100644 @GMS/addons/custom_server/Compiles/Functions/GMS_fnc_updateMarkerAliveCount.sqf delete mode 100644 @GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy.sqf create mode 100644 @GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor_updated.sqf diff --git a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_deleteMarker.sqf b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_deleteMarker.sqf new file mode 100644 index 0000000..5ad507c --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_deleteMarker.sqf @@ -0,0 +1,14 @@ +//////////////////////////////////////////// +// Delete and change Mission Markers +// 7/10/15 +// by Ghostrider-DbD- +////////////////////////////////////////// +// delete a marker + +//diag_log format["blck_fnc_deleteMarker:: _this = %1",_this]; +private["_markerName"]; +_markerName = _this select 0; +deleteMarker _markerName; +_markerName = "label" + _markerName; +deleteMarker _markerName; +//diag_log format["deleteMarker complete script for _this = %1",_this]; diff --git a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_markerSetAliveAICount.sqf b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_markerSetAliveAICount.sqf new file mode 100644 index 0000000..9d57755 --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_markerSetAliveAICount.sqf @@ -0,0 +1,18 @@ +/* + Set Alive AI Count +*/ + +params["_mArray","_count"]; + +_mArray params["_missionType","_markerPos","_markerLabel","_markerLabelType","_markerColor","_markerType"]; + +//diag_log "++++++++++++++--- marker label arrow detected"; +_name = "ai_count" + _name; +_textPos = [(_pos select 0) + (count toArray (_text) * 12), (_pos select 1) + (_size select 0), 0]; +_MainMarker = createMarker [_name, _textPos]; +_MainMarker setMarkerShape "Icon"; +_MainMarker setMarkerType "HD_Arrow"; +_MainMarker setMarkerColor "ColorBlack"; +_MainMarker setMarkerText format["% Alive",_count]; + +//_MainMarker setMarkerDir 37; \ No newline at end of file diff --git a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_missionCompleteMarker.sqf b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_missionCompleteMarker.sqf new file mode 100644 index 0000000..ea8eee7 --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_missionCompleteMarker.sqf @@ -0,0 +1,19 @@ +//////////////////////////////////////////// +// Create, delete and change Mission Markers +// 7/10/15 +// by Ghostrider-DbD- +////////////////////////////////////////// +// spawn a temporary marker to indicate the position of a 'completed' mission +// this will not show to JIP players + +private["_location","_MainMarker","_name"]; +//diag_log format["blck_fnc_missionCompleteMarker:: _this = %1",_this]; +_location = _this select 0; +_name = str(random(1000000)) + "MarkerCleared"; +_MainMarker = createMarker [_name, _location]; +_MainMarker setMarkerColor "ColorBlack"; +_MainMarker setMarkerType "n_hq"; +_MainMarker setMarkerText "Mission Cleared"; +uiSleep 300; +deleteMarker _MainMarker; +//diag_log format["missionCompleteMarker complete script for _this = %1",_this]; diff --git a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_spawnMarker.sqf b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_spawnMarker.sqf new file mode 100644 index 0000000..4dcf03b --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_spawnMarker.sqf @@ -0,0 +1,93 @@ +//////////////////////////////////////////// +// Create Mission Markers +// by Ghostrider-GRG- +////////////////////////////////////////// +// spawn a round marker of a size and color specified in passed parameters + +private["_blck_fn_configureRoundMarker"]; + +private["_blck_fn_configureRoundMarker"]; +_blck_fn_configureRoundMarker = { + private["_name","_pos","_color","_size","_MainMarker","_arrowMarker","_labelMarker","_labelType"]; + //diag_log format["_blck_fn_configureRoundMarker: -: _this = %1", _this]; + params["_name","_pos","_color","_text","_size","_labelType"]; + + //diag_log format["_blck_fn_configureRoundMarker: _pos = %1, _color = %2, _size = %3, _name = %4, label %5",_pos, _color, _size, _name, _text]; + // Do not show the marker if it is in the left upper corner + if ((_pos distance [0,0,0]) < 10) exitWith {}; + + _MainMarker = createMarker [_name, _pos]; + _MainMarker setMarkerColor _color; + _MainMarker setMarkerShape "ELLIPSE"; + _MainMarker setMarkerBrush "Grid"; + _MainMarker setMarkerSize _size; // + //diag_log format["_blck_fn_configureRoundMarker: -: _labelType = %1", _labelType]; + if (count toArray(_text) > 0) then + { + switch (_labelType) do { + case "arrow": + { + //diag_log "++++++++++++++--- marker label arrow detected"; + _name = "label" + _name; + _textPos = [(_pos select 0) + (count toArray (_text) * 12), (_pos select 1) - (_size select 0), 0]; + _arrowMarker = createMarker [_name, _textPos]; + _arrowMarker setMarkerShape "Icon"; + _arrowMarker setMarkerType "HD_Arrow"; + _arrowMarker setMarkerColor "ColorBlack"; + _arrowMarker setMarkerText _text; + //_MainMarker setMarkerDir 37; + }; + case "center": + { + //diag_log "++++++++++++++--- marker label dot detected"; + _name = "label" + _name; + _labelMarker = createMarker [_name, _pos]; + _labelMarker setMarkerShape "Icon"; + _labelMarker setMarkerType "mil_dot"; + _labelMarker setMarkerColor "ColorBlack"; + _labelMarker setMarkerText _text; + }; + }; + }; + if (isNil "_labelMarker") then {_labelMarker = ""}; + _labelMarker +}; + +_blck_fn_configureIconMarker = { + private["_MainMarker"]; + params["_name","_pos",["_color","ColorBlack"],["_text",""],["_icon","mil_triangle"]]; + //diag_log format["_blck_fn_configureIconMarker: _name=%1; _pos=%2; _color=%3; _text=%4",_name,_pos,_color,_text]; + + _name = "label" + _name; + _MainMarker = createMarker [_name, _pos]; + _MainMarker setMarkerShape "Icon"; + _MainMarker setMarkerType _icon; + _MainMarker setMarkerColor _color; + _MainMarker setMarkerText _text; + _MainMarker +}; + +//diag_log format["spawnMarker:: -- >> _this = %1",_this]; +// _this = [[""BlueMarker"",[12524.1,18204.7,0],""Bandit Patrol"",""center"",""ColorBlue"",[""ELIPSE"",[175,175]]],""ColorBlue"",""BlueMarker""]" +params["_mArray"]; +private["_marker"]; +_mArray params["_missionType","_markerPos","_markerLabel","_markerLabelType","_markerColor","_markerType"]; +_markerType params["_mShape","_mSize","_mBrush"]; +//diag_log format["spawnMarker.sqf:: -- >> _missionType %1 | _markerPos %2 | _markerLabel %3 | _markerLabelType %4 | _markerColor %5 | _markerType %6",_missionType,_markerPos,_markerLabel,_markerLabelType,_markerColor,_markerType]; + +if ((_markerType select 0) in ["ELIPSE","RECTANGLE"]) then // not an Icon .... +{ + switch (_missionType) do { + // params["_missionType","_pos","_text","_labelType","_color","_type","_size","_brush"]; + // Type Size Brush + default {_marker = [_missionType,_markerPos,_markerColor,_markerLabel, _mSize,_markerLabelType,_mShape,_mBrush] call _blck_fn_configureRoundMarker;}; + }; +}; +if !((_markerType select 0) in ["ELIPSE","RECTANGLE"]) then +{ // Deal with case of an icon + // params["_name","_pos",["_color","ColorBlack"],["_text",""],["_icon","mil_triangle"]]; + _marker = [_missionType,_markerPos, _markerColor,_markerLabel,_markerType select 0] call _blck_fn_configureIconMarker; +}; +//diag_log format["spawnMarker complete script with _marker = %1",_marker]; +if (isNil "_marker") then {_marker = ""}; +_marker diff --git a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_updateMarkerAliveCount.sqf b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_updateMarkerAliveCount.sqf new file mode 100644 index 0000000..7289fa9 --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_updateMarkerAliveCount.sqf @@ -0,0 +1,13 @@ +/* + by Ghostrider [GRG] + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +params["_marker","_rootText","_missionAI"]; +//diag_log format["_fnc_updateMarkerAliveCount: _this = %1",_this]; +_marker setMarkerText format["%1 / %2 AI Alive",_rootText,{alive _x} count _missionAI]; \ No newline at end of file diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy.sqf deleted file mode 100644 index afc369a..0000000 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy.sqf +++ /dev/null @@ -1,504 +0,0 @@ -/* - Generic Mission Spawner - By Ghostrider GRG - Copyright 2016 - Last modified 10/9/17 - - -------------------------- - License - -------------------------- - All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. - - http://creativecommons.org/licenses/by-nc-sa/4.0/ -*/ -#include "\q\addons\custom_server\Configs\blck_defines.hpp"; - -private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_AI_Vehicles","_timeOut","_aiDifficultyLevel","_missionPatrolVehicles","_missionGroups"]; -params["_coords","_mission",["_allowReinforcements",true]]; -//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 select 2; -_aiDifficultyLevel = _mission select 3; - -[_mission,"active",_coords] call blck_fnc_updateMissionQue; -blck_ActiveMissionCoords pushback _coords; -diag_log format["[blckeagls] missionSpawner (17):: 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 "_missionPatrolVehicles") then { - //diag_log format["_missionSpawner (44):: _missionPatrolVehicles isNil, Definining it as an empty array"]; - _missionPatrolVehicles = []; - //diag_log format["_missionSpawner (46):: _missionPatrolVehicles is %1",_missionPatrolVehicles]; -}; -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"}; -#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["missionSpawner:: Trigger Loop - blck_debugLevel = %1 and _coords = %2",blck_debugLevel, _coords]; - diag_log format["missionSpawner:: Trigger Loop - players in range = %1",{isPlayer _x && _x distance2D _coords < blck_TriggerDistance} count allPlayers]; - diag_log format["missionSpawner:: 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_recentMissionCoords pushback [_coords,diag_tickTime]; - blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords]; - [_mission,"inactive",[0,0,0]] call blck_fnc_updateMissionQue; - blck_missionsRunning = blck_missionsRunning - 1; - [_blck_localMissionMarker select 0] call compile preprocessfilelinenumbers "debug\deleteMarker.sqf"; - //_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] missionSpawner:: (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] missionSpawner:: (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["_missionSpawner"" _missionLandscape = %1",_missionLandscape]; -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; - //uiSleep 1; -}; -if (typeName _temp isEqualTo "ARRAY") then -{ - _objects append _temp; -}; -//diag_log format["_fnc_missionSpawner:: (181)->> _objects = %1",_objects]; - -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["[blckeagls] missionSpawner:: (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]; -_temp = [_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear,_missionGroups] call blck_fnc_spawnMissionAI; - -#ifdef blck_debugMode -if (blck_debugLevel > 2) then { - diag_log format["missionSpawner :: (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["missionSpawner :: (214) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1; -}; -#endif - -if (_abort) exitWith -{ - if (blck_debugLevel > 1) then { - diag_log "missionSpawner:: (220) grpNull returned, mission termination criteria met, calling blck_fnc_endMission" - }; - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,1] 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] missionSpawner:: (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"]; -_vehToSpawn = [_noVehiclePatrols] call blck_fnc_getNumberFromRange; -//diag_log format["_missionSpawner:: _vehToSpawn = %1",_vehToSpawn]; -//diag_log format["_missionSpawner (245):: _missionPatrolVehicles = %1",_missionPatrolVehicles]; -if (blck_useVehiclePatrols && ((_vehToSpawn > 0) || count _missionPatrolVehicles > 0)) then -{ - _temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_missionPatrolVehicles] 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["missionSpawner :: (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] missionSpawner:: (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 "missionSpawner:: (279) grpNull returned, mission termination criteria met, calling blck_endMission"; - }; - #endif - - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,1] 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] missionSpawner:: (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.5; - 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["_missionSpawner(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["missionSpawner(334):: blck_fnc_spawnMissionReinforcements call for chopper # %1 out of a total of %2 choppers",_i, _noChoppers]; - diag_log format["missionSpawner(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 "missionSpawner:: (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] 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["missionSpawner:: (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["_missionSpawner:: _noEmplacedToSpawn = %1",_vehToSpawn]; -if (blck_useStatic && (_noEmplacedToSpawn > 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 ["missionSpawner:: (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 ["missionSpawner:: (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] missionSpawner:: (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 "missionSpawner:: (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] call blck_fnc_endMission; -}; - -uiSleep _delayTime; -if (count _missionLootBoxes > 0) then -{ - _crates = [_coords,_missionLootBoxes,_loadCratesTiming] call blck_fnc_spawnMissionCrates; -} -else -{ - _crates = [_coords,[[selectRandom blck_crateTypes,[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] missionSpawner:: (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["missionSpawner :: (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["missionSpawner (458):: _coords = %1 | _crates = %2 | _locations = %3",_coords,_crates,_locations]; -#endif -private _crateStolen = false; -#ifdef blck_debugMode -diag_log format["missionSpawner(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; -}; -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["missionSpawner:: (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["missionSpawner:: (491) 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] call blck_fnc_endMission; -}; -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["[blckeagls] missionSpawner:: (496) Mission completion criteria fulfilled: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; - diag_log format["missionSpawner :: (497) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled]; - diag_log format["[blckeagls] missionSpawner:: (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]; -_result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,0] call blck_fnc_endMission; - -diag_log format["[blckeagls] missionSpawner:: (507)end of mission: blck_fnc_endMission has returned control to _fnc_missionSpawner"]; - 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 495e4bb..0ea4632 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf @@ -69,9 +69,11 @@ if !(blck_preciseMapMarkers) then }; _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; +private _marker = [_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) message players and spawn a mission marker";}; +if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (77) _marker = %1",_marker];}; if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (77) waiting for player to trigger the mission";}; #endif //////// @@ -120,7 +122,7 @@ if (_missionTimedOut) exitWith blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords]; [_mission,"inactive",[0,0,0]] call blck_fnc_updateMissionQue; blck_missionsRunning = blck_missionsRunning - 1; - [_blck_localMissionMarker select 0] call compile preprocessfilelinenumbers "debug\deleteMarker.sqf"; + [_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; @@ -434,6 +436,17 @@ 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;}; @@ -494,7 +507,16 @@ if (blck_debugLevel > 0) then 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]; + // blck_missionMarkers pushBack [_marker, _markerMissionName, _blck_AllMissionAI]; + { + if ((_x select 1) isEqualTo _markerMissionName) exitWith{blck_missionMarkers deleteAt _forEachIndex}; + }forEach blck_missionMarkers; +}; _result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,0] call blck_fnc_endMission; + diag_log format["[blckeagls] missionSpawner:: (507)end of mission: blck_fnc_endMission has returned control to _fnc_missionSpawner"]; diff --git a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill.sqf b/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill.sqf index 73d75a3..27ca0f2 100644 --- a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill.sqf +++ b/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill.sqf @@ -64,5 +64,13 @@ if (blck_useKillMessages) then [["aikilled",_message,"victory"],playableUnits] call blck_fnc_messageplayers; }; [_unit,_killer] call blck_fnc_rewardKiller; - +if (blck_showCountAliveAI) then +{ + //diag_log "_fnc_processAIKills: Updating Map Marker AI Counts - blck_missionMarkers items are"; + { + //diag_log format["_fnc_processAIKills: blck_missionMarkers itm %1 = %2",_forEachIndex,_x]; + [_x select 0, _x select 1, _x select 2] call blck_fnc_updateMarkerAliveCount; + } forEach blck_missionMarkers; + //call blck_fnc_updateAllMarkerAliveCounts; +}; diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehiclePatrol.sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehiclePatrol.sqf index ce20863..69fb7c3 100644 --- a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehiclePatrol.sqf +++ b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnVehiclePatrol.sqf @@ -15,7 +15,7 @@ #include "\q\addons\custom_server\Configs\blck_defines.hpp"; private["_vehType","_safepos","_veh"]; -params["_center","_pos",["_vehType","I_G_Offroad_01_armed_F"],["_minDis",30],["_maxDis",45],["_group",grpNull]]; +params["_center","_pos",["_vehType","I_G_Offroad_01_armed_F"],["_minDis",30],["_maxDis",45],["_group",grpNull],["_setWaypoints",true]]; //_center Center of the mission area - this is usuall the position treated as the center by the mission spawner. Vehicles will patrol the perimeter of the mission area. @@ -61,7 +61,10 @@ if !(isNull _group) then // params["_pos","_minDis","_maxDis","_group",["_mode","random"],["_wpPatrolMode","SAD"],["_soldierType","null"] ]; _group setcombatmode "RED"; _group setBehaviour "COMBAT"; - [_center,_minDis,_maxDis,_group,"perimeter","SAD","vehicle"] spawn blck_fnc_setupWaypoints; + if (_setWaypoints) then + { + [_center,_minDis,_maxDis,_group,"perimeter","SAD","vehicle"] spawn blck_fnc_setupWaypoints; + }; }; #ifdef blck_debugMode if (blck_debugLevel > 1) then diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor_updated.sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor_updated.sqf new file mode 100644 index 0000000..168fcdd --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor_updated.sqf @@ -0,0 +1,214 @@ +/* + Handle the case that all AI assigned to a vehicle are dead. + Allows players to enter and use the vehicle when appropriate + or otherwise destroys the vehicle. + + Logic: + 1) Mission ended; players can keep vehicles BUT not all vehicle AI were killed - > delete vehicle when live AI are killed; + 2) Vehicle has a blck_deleteAT timer set - > delete vehicle; + 3) All AI killed an players may NOT keep vehicles - > detroy vehicle + 4) All AI Killed and players MAY keep vehicles -> release vehicle + 5) vehicle ammo low AND vehicle gunner is alive - > reloaded + + By Ghostrider [GRG] + Copyright 2016 + Last updated 12-22-17 + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +//diag_log format["_fnc_vehicleMonitor: starting function at diag_tickTime = %1",diag_tickTime]; +#ifdef blck_debugMode + //diag_log format["_fnc_vehicleMonitor:: blck_debugMode defined"]; +#endif + +_fn_releaseVehicle = { + params["_veh"]; + //blck_monitoredVehicles = blck_monitoredVehicles - [_veh]; + _veh setVehicleLock "UNLOCKED" ; + //_v setVariable["releasedToPlayers",true]; + //[_v] call blck_fnc_emptyObject; + { + _veh removealleventhandlers _x; + } forEach ["GetIn","GetOut","fired","hit","hitpart","reloaded","dammaged","HandleDamage"]; + { + _veh removeAllMPEventHandlers _x; + } forEach ["MPHit","MPKilled"]; + _veh setVariable["blck_DeleteAt",diag_tickTime + blck_vehicleDeleteTimer,true]; + if ((damage _veh) > 0.5) then {_veh setDamage 0.5}; + //diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle released to players where vehicle = %1 and blck_deleteAT = %2",_veh, _veh getVariable["blck_DeleteAt",0]]; + #ifdef blck_debugMode + if (blck_debugLevel > 3) then + { + diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle released to players where vehicle = %1",_veh]; + }; + #endif +}; + +_fn_destroyVehicleAndCrew = { + params["_veh"]; + //private["_crew"]; + //_crew = crew _veh; + //diag_log format["_fn_destroyVehicleAndCrew: called for _veh = %1",_veh]; + {[_x] call blck_fnc_deleteAI;} forEach (crew _veh); + [_veh] call blck_fn_deleteAIvehicle; +}; + +_fn_reloadAmmo = { + params["_veh"]; + private ["_crew","_mag","_allMags","_cnt"]; + // https://community.bistudio.com/wiki/fullCrew + // 0 1 2 3 4 + // returns Array - format [[unit,role,cargoIndex,turretPath,personTurret], ...] + //diag_log format["_fnc_vehicleMonitor:: (65) _veh = %1",_veh]; + if ({alive _x and !(isPlayer _x)} count (crew _veh) > 0) then + { + _crew = fullCrew _veh; + //diag_log format["_fnc_vehicleMonitor:: (67) _crew = %1",_crew]; + { + //diag_log format ["_fnc_vehicleMonitor:: (69) _x = %1",_x]; + _mag = _veh currentMagazineTurret (_x select 3); + if (count _mag > 0) then + { + //diag_log format["_fnc_vehicleMonitor:: (71) _mag is typeName %1", typeName _mag]; + //diag_log format ["_fnc_vehicleMonitor:: (71) length _mag = %2 and _mag = %1",_mag,count _mag]; + _allMags = magazinesAmmo _veh; + //diag_log format["_fnc_vehicleMonitor:: (71) _allMags = %1",_allMags]; + _cnt = ( {_mag isEqualTo (_x select 0)}count _allMags); + //diag_log format["_fnc_vehicleMonitor:: (75) _cnt = %1",_cnt]; + if (_cnt < 2) then {_veh addMagazineCargo [_mag,2]}; + }; + } forEach _crew; + }; +}; + +blck_fn_deleteAIvehicle = { + params["_veh"]; + //diag_log format["blck_fn_deleteAIvehicle: _veh %1 deleted",_veh]; + { + _veh removeAllEventHandlers _x; + }forEach ["Hit","HitPart","GetIn","GetOut","Fired","FiredNear","HandleDamage","Reloaded"]; + blck_monitoredVehicles = blck_monitoredVehicles - [_veh]; + deleteVehicle _veh; +}; + +private _vehList = +blck_monitoredVehicles; + +#ifdef blck_debugMode +if (blck_debugLevel > 3) then {diag_log format["_fnc_vehicleMonitor:: function called at %1 with _vehList %2 and blck_monitoredVehicles %3",diag_tickTime,_vehList,blck_monitoredVehicles];}; +#endif + //blck_fnc_releaseVehicleToPlayers +{ + /* + Determine state of vehicle + _isEmplaced + _ownerIsPlayer + _allCrewDead + _deleteNow + */ + + private _veh = _x; // (purely for clarity at this point, _x could be used just as well) + private _isEmplaced = _veh getVariable["DBD_vehType","none"] isEqualTo "emplaced"; + private _ownerIsPlayer = if (owner _veh > 2 && !(owner _veh in blck_connectedHCs)) then {true} else {false}; + private _allCrewDead = {alive _x} count (crew _veh); + private _deletenow = if ( (_veh getVariable["blck_DeleteAt",0] > 0) && (diag_tickTime > (_veh getVariable "blck_DeleteAt"))) then {true} else {false}; + #ifdef blck_debugMode + if (blck_debugLevel > 3) then + { + diag_log format["_fnc_vehicleMonitor: vehicle %1 with missionCompleted = %2 being evaluated",_x, _x getVariable"missionCompleted",0]; + }; + #endif + private _evaluate = true; + //diag_log format["_fnc_vehicleMonitor: owner of _veh %1 isEqualTo %2",_veh, owner _veh]; + + { + // Vehicle is NOT local to server or an HC so a player so must have been entered. + _evaluate = false; + _veh setVariable["blck_DeleteAt",0]; + blck_monitoredVehicles = blck_monitoredVehicles - [_veh]; + diag_log format["_fnc_vehicleMonitor: vehicle %1 now owned by player %2",_veh, owner _veh]; + }; + //diag_log format["_fnc_vehicleMonitor: _veh = %1 getVariable[blck_DeleteAt] = %2",_veh, _veh getVariable["blck_DeleteAt",0]]; + if (_evaluate) then + { + //diag_log format["_fnc_vehicleMonitor: deleting _veh %1 with diag_tickTime %2 and blck_deleteAT %3",_veh,diag_tickTime,_veh getVariable["blck_DeleteAt",0]]; + // Case where vehicle has been marked for deletion after a certain time. + if ( (_veh getVariable["blck_DeleteAt",0] > 0) && (diag_tickTime > (_veh getVariable "blck_DeleteAt"))) then + { + [_veh] call _fn_destroyVehicleAndCrew; + _evaluate = false; + }; + }; + + // Case where is an emplaced / static wweapon and has no alive crew and such vehicles should be 'killed' or released to players + if (_evaluate) then + { + if ( (_veh getVariable["DBD_vehType","none"] isEqualTo "emplaced") && {alive _x} count crew _veh isEqualTo 0) then + { + if (blck_killEmptyStaticWeapons) then + { + //diag_log format["_fnc_vehicleMonitor:: case of destroyed where vehicle = %1",_veh]; + + #ifdef blck_debugMode + if (blck_debugLevel > 3) then {diag_log format["_fnc_vehicleMonitor:: case of destroyed where vehicle = %1",_veh];}; + #endif + + _veh setDamage 1; + _veh setVariable["blck_DeleteAt",diag_tickTime + 60]; + }else { + [_veh] call _fn_releaseVehicle; + }; + _evaluate = false; + }; + }; + if ( (_veh getVariable["blck_DeleteAt",0]) > 0) then + { + _evaluate = false; + }; + // Case where a vehicle is NOT an emplaced / static weapon and has no alive crew and such vehicles should be 'killed' or released to players + if (_evaluate) then + { + if (_veh getVariable["DBD_vehType","none"] isEqualTo "none" && ({alive _x} count crew _veh isEqualTo 0) ) then + { + if (blck_killEmptyAIVehicles) then + { + _veh setDamage 0.7; + _veh setVariable["blck_DeleteAt",diag_tickTime + 60]; + } else { + //diag_log format["_fnc_vehicleMonitor:: case of RELEASE where vehicle = %1 and Vehicle is typeOf %2",_veh, typeOf _veh]; + [_veh] call _fn_releaseVehicle; + }; + _evaluate = false; + }; + }; + + // Case where a vehicle is part of a mission that has been completed and containes live AI. + if (_evaluate) then + { + if ( _veh getVariable["missionCompleted",0] > 0 && ({alive _x} count crew _veh > 0)) then + { + //diag_log format["_fnc_vehicleMonitor:: case of mission vehicle with AI alive at mission end: schedule destruction with _veh = %1 and typeOf _veh = %2",_veh, typeOf _veh]; + private _cleanupTimer = _veh getVariable["blck_DeleteAt",0]; // The time delete to deleting any alive AI units + if (_cleanupTimer == 0) then {_veh setVariable["blck_DeleteAt",diag_tickTime + blck_vehicleDeleteTimer]}; + if (diag_tickTime > _veh getVariable["blck_DeleteAt",0]) then + { + [_veh] call _fn_destroyVehicleAndCrew; + _evaluate = false; + }; + }; + }; + + if (_evaluate) then + { + [_veh] call _fn_reloadAmmo; + }; +}forEach _vehList; + + + diff --git a/@GMS/addons/custom_server/Compiles/blck_functions.sqf b/@GMS/addons/custom_server/Compiles/blck_functions.sqf index c40f8cc..1b623f0 100644 --- a/@GMS/addons/custom_server/Compiles/blck_functions.sqf +++ b/@GMS/addons/custom_server/Compiles/blck_functions.sqf @@ -33,6 +33,11 @@ blck_fnc_addItemToCrate = compileFinal preprocessFileLineNumbers "\q\addons\cust blck_fnc_loadLootItemsFromArray = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_loadLootItemsFromArray.sqf"; blck_fnc_getNumberFromRange = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_getNumberFromRange.sqf"; blck_fnc_passToHCs = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_passToHCs.sqf"; +blck_fnc_spawnMarker = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_spawnMarker.sqf"; +blck_fnc_missionCompleteMarker = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_missionCompleteMarker.sqf"; +blck_fnc_deleteMarker = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_deleteMarker.sqf"; +blck_fnc_updateMarkerAliveCount = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_updateMarkerAliveCount.sqf"; +//blck_fnc_updateAllMarkerAliveCounts = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\updateAllMarkerAliveCounts.sqf"; // GMS_fnc_updateAllMarkerAliveCounts #ifdef GRGserver blck_fnc_broadcastServerFPS = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_broadcastServerFPS.sqf"; diff --git a/@GMS/addons/custom_server/Compiles/blck_variables.sqf b/@GMS/addons/custom_server/Compiles/blck_variables.sqf index cee4d5e..bc43e9a 100644 --- a/@GMS/addons/custom_server/Compiles/blck_variables.sqf +++ b/@GMS/addons/custom_server/Compiles/blck_variables.sqf @@ -12,8 +12,8 @@ */ #include"\q\addons\custom_server\Configs\blck_defines.hpp"; -blck_debugON = false; -blck_debugLevel = 0; // Sets level of detail for debugging info - WIP. +blck_debugON = true; +blck_debugLevel = 1; // Sets level of detail for debugging info - WIP. blck_minFPS = 8; //////////////////////////////////////////////// @@ -32,6 +32,7 @@ blck_missionsRunning = 0; blck_activeMissions = []; blck_deadAI = []; blck_connectedHCs = []; +blck_missionMarkers = []; #ifdef useDynamicSimulation "Group" setDynamicSimulationDistance 1800; enableDynamicSimulationSystem true; diff --git a/@GMS/addons/custom_server/Configs/blck_configs.sqf b/@GMS/addons/custom_server/Configs/blck_configs.sqf index 4628e99..7082119 100644 --- a/@GMS/addons/custom_server/Configs/blck_configs.sqf +++ b/@GMS/addons/custom_server/Configs/blck_configs.sqf @@ -69,7 +69,7 @@ // When set to true,"dot", ext will be to the right of a black dot at the center the mission marker. blck_labelMapMarkers = [true,"center"]; blck_preciseMapMarkers = true; // Map markers are/are not centered at the loot crate - + blck_showCountAliveAI = true; //Minimum distance between missions blck_MinDistanceFromMission = 1500; diff --git a/@GMS/addons/custom_server/Configs/blck_configs_mil.sqf b/@GMS/addons/custom_server/Configs/blck_configs_mil.sqf index e2375f0..a58f287 100644 --- a/@GMS/addons/custom_server/Configs/blck_configs_mil.sqf +++ b/@GMS/addons/custom_server/Configs/blck_configs_mil.sqf @@ -64,7 +64,7 @@ // When set to true,"dot", ext will be to the right of a black dot at the center the mission marker. blck_labelMapMarkers = [false,"center"]; blck_preciseMapMarkers = false; // Map markers are/are not centered at the loot crate - + blck_showCountAliveAI = true; //Minimum distance between missions blck_MinDistanceFromMission = 1500; diff --git a/changeLog.sqf b/changeLog.sqf index 18b4a18..17514a1 100644 --- a/changeLog.sqf +++ b/changeLog.sqf @@ -8,9 +8,10 @@ Ideas or code from that by Vampire and KiloSwiss have been used for certain func Significant Changes: ===================== -Version 1.79, Build 110 +Version 1.79, Build 112 Added: Map-specific information for Lythium. -Added: (in process) When blck_showCountOfAliveAI = true; The number of alive AI at a mission will be displayed by the mission marker. +Added: New configuration setting: blck_showCountAliveAI = true; When = true, the number of alive AI at a mission will be displayed by the mission marker. +Fixed: Setting blck_useTimeAcceleration = false; now disables the time acceleration module. Fixed: several issues with dynamic UMS missions. Changed: Please replace the debug folder in your mission PBO with the updated one found on the github. [removed all scripts for markers from mission\debug. These are now located in custom_server\compiles\functions.] From b43d027a1650d7748cb79f89a3e584c5edbf9a80 Mon Sep 17 00:00:00 2001 From: Ghostrider-GRG- Date: Wed, 14 Feb 2018 18:38:26 -0500 Subject: [PATCH 2/4] Added AI Counts to map markers, bug fixes Rewrote _fnc_vehicleMonitor to improve accuracy when releasing vehicles to players. --- .../GMS_fnc_updateAllMarkerAliveCounts.sqf | 16 + .../Compiles/Functions/passToHC_default.sqf | 287 ---------- .../Compiles/Groups/GMS_fnc_setWaypoints.sqf | 92 ---- .../GMS_fnc_missionSpawner - Copy.sqf | 519 ++++++++++++++++++ .../GMS_fnc_vehicleMonitor - Copy.sqf | 203 +++++++ .../Vehicles/GMS_fnc_vehicleMonitor.sqf | 119 ++-- .../Vehicles/GMS_fnc_vehicleMonitor_updated | 203 +++++++ .../GMS_fnc_vehicleMonitor_updated.sqf | 104 ++-- .../custom_server/Compiles/blck_variables.sqf | 4 +- MPMissions/Exile.Altis/debug/blckconfigs.sqf | 20 - MPMissions/Exile.Altis/debug/build.sqf | 3 - MPMissions/Exile.Altis/debug/deleteMarker.sqf | 14 - .../debug/missionCompleteMarker.sqf | 19 - MPMissions/Exile.Altis/debug/spawnMarker.sqf | 99 ---- MPMissions/Exile.Altis/debug/versionCheck.sqf | 187 ------- MPMissions/epoch.Altis/debug/blckconfigs.sqf | 20 - MPMissions/epoch.Altis/debug/build.sqf | 3 - MPMissions/epoch.Altis/debug/deleteMarker.sqf | 14 - .../debug/missionCompleteMarker.sqf | 19 - MPMissions/epoch.Altis/debug/spawnMarker.sqf | 99 ---- MPMissions/epoch.Altis/debug/versionCheck.sqf | 187 ------- 21 files changed, 1018 insertions(+), 1213 deletions(-) create mode 100644 @GMS/addons/custom_server/Compiles/Functions/GMS_fnc_updateAllMarkerAliveCounts.sqf delete mode 100644 @GMS/addons/custom_server/Compiles/Functions/passToHC_default.sqf delete mode 100644 @GMS/addons/custom_server/Compiles/Groups/GMS_fnc_setWaypoints.sqf create mode 100644 @GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy.sqf create mode 100644 @GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor - Copy.sqf create mode 100644 @GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor_updated delete mode 100644 MPMissions/Exile.Altis/debug/blckconfigs.sqf delete mode 100644 MPMissions/Exile.Altis/debug/build.sqf delete mode 100644 MPMissions/Exile.Altis/debug/deleteMarker.sqf delete mode 100644 MPMissions/Exile.Altis/debug/missionCompleteMarker.sqf delete mode 100644 MPMissions/Exile.Altis/debug/spawnMarker.sqf delete mode 100644 MPMissions/Exile.Altis/debug/versionCheck.sqf delete mode 100644 MPMissions/epoch.Altis/debug/blckconfigs.sqf delete mode 100644 MPMissions/epoch.Altis/debug/build.sqf delete mode 100644 MPMissions/epoch.Altis/debug/deleteMarker.sqf delete mode 100644 MPMissions/epoch.Altis/debug/missionCompleteMarker.sqf delete mode 100644 MPMissions/epoch.Altis/debug/spawnMarker.sqf delete mode 100644 MPMissions/epoch.Altis/debug/versionCheck.sqf diff --git a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_updateAllMarkerAliveCounts.sqf b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_updateAllMarkerAliveCounts.sqf new file mode 100644 index 0000000..7597e6b --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_updateAllMarkerAliveCounts.sqf @@ -0,0 +1,16 @@ +/* + by Ghostrider [GRG] + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +diag_log "_fnc_updateAllMarkerAliveCounts called"; +/* +{ + diag_log format["_fnc_updateAllMarkerAliveCounts: _x = %1",_x]; + [_x select 0, _x select 1, _x select 2] call blck_fnc_updateMarkerAliveCount; +}forEach blck_missionMarkers; diff --git a/@GMS/addons/custom_server/Compiles/Functions/passToHC_default.sqf b/@GMS/addons/custom_server/Compiles/Functions/passToHC_default.sqf deleted file mode 100644 index 5cfe14b..0000000 --- a/@GMS/addons/custom_server/Compiles/Functions/passToHC_default.sqf +++ /dev/null @@ -1,287 +0,0 @@ -/* - * passToHCs.sqf - * - * In the mission editor, name the Headless Clients "HC", "HC2", "HC3" without the quotes - * - * In the mission init.sqf, call passToHCs.sqf with: - * execVM "passToHCs.sqf"; - * - * It seems that the dedicated server and headless client processes never use more than 20-22% CPU each. - * With a dedicated server and 3 headless clients, that's about 88% CPU with 10-12% left over. Far more efficient use of your processing power. - * - */ - -PassToHC_ReceiveMessage = compileFinal " - if (hasInterface && (serverCommandAvailable '#kick' || isServer)) then { - player globalChat (_this select 0); - }; -"; - -if (!isServer) exitWith {}; - -waitUntil{!isNil "f_param_headlessClient"}; - -if (f_param_headlessClient == 0) exitWith {}; - -private ["_HC_ID","_HC2_ID","_HC3_ID","_rebalanceTimer","_cleanUpThreshold","_maxWait","_loadBalance","_currentHC","_numTransfered","_swap","_rc","_numHC","_numHC2","_numHC3","_numDeleted"]; - -PassToHC_SendMessage = compileFinal " - diag_log text _this; - if (isServer && hasInterface) then { - [_this] call PassToHC_ReceiveMessage; - } else { - [[_this], 'PassToHC_ReceiveMessage', true, false] call BIS_fnc_MP; - }; -"; - -"passToHCs: Started" call PassToHC_SendMessage; - -waitUntil {!isNil "HC"}; -waitUntil {!isNull HC}; - -_HC_ID = -1; // Will become the Client ID of HC -_HC2_ID = -1; // Will become the Client ID of HC2 -_HC3_ID = -1; // Will become the Client ID of HC3 -_rebalanceTimer = 60; // Rebalance sleep timer in seconds -_cleanUpThreshold = 50; // Threshold of number of dead bodies + destroyed vehicles before forcing a clean up - -PassToHC_NumTransfered = 0; - -"passToHCs: Waiting for init scripts to settle before starting first pass..." call PassToHC_SendMessage; - -sleep 15; - -// If DAC is initializing after start delay wait until it finishes or timeout -if (!isNil "DAC_Basic_Value") then { - _maxWait = time + 30; - waituntil {sleep 1; (DAC_Basic_Value > 0) || time > _maxWait}; -}; - -// If UPSMON is initializing after start delay wait until it finishes or timeout -if (!isNil "UPSMON_INIT") then { - _maxWait = time + 30; - waituntil {sleep 1; (UPSMON_INIT > 0) || time > _maxWait}; -}; - -// Wait a bit more just in-case they scripts have not settled/synced yet -sleep 3; - -format["passToHCs: First pass beginning now..."] call PassToHC_SendMessage; - -while {true} do { - // Do not enable load balancing unless more than one HC is present - // Leave this variable false, we'll enable it automatically under the right conditions - _loadBalance = false; - - // Get HC Client ID else set variables to null - try { - _HC_ID = owner HC; - - if (_HC_ID > 2) then { - diag_log format ["passToHCs: Found HC with Client ID %1", _HC_ID]; - } else { - diag_log "passToHCs: [WARN] HC disconnected"; - - HC = objNull; - _HC_ID = -1; - }; - } catch { diag_log format ["passToHCs: [ERROR] [HC] %1", _exception]; HC = objNull; _HC_ID = -1; }; - - // Get HC2 Client ID else set variables to null - if (!isNil "HC2") then { - try { - _HC2_ID = owner HC2; - - if (_HC2_ID > 2) then { - diag_log format ["passToHCs: Found HC2 with Client ID %1", _HC2_ID]; - } else { - diag_log "passToHCs: [WARN] HC2 disconnected"; - - HC2 = objNull; - _HC2_ID = -1; - }; - } catch { diag_log format ["passToHCs: [ERROR] [HC2] %1", _exception]; HC2 = objNull; _HC2_ID = -1; }; - } else { - HC2 = objNull; - }; - - // Get HC3 Client ID else set variables to null - if (!isNil "HC3") then { - try { - _HC3_ID = owner HC3; - - if (_HC3_ID > 2) then { - diag_log format ["passToHCs: Found HC2 with Client ID %1", _HC3_ID]; - } else { - diag_log "passToHCs: [WARN] HC3 disconnected"; - - HC3 = objNull; - _HC3_ID = -1; - }; - } catch { diag_log format ["passToHCs: [ERROR] [HC3] %1", _exception]; HC3 = objNull; _HC3_ID = -1; }; - } else { - HC3 = objNull; - }; - - // If no HCs present, wait for HC to rejoin - if ( (isNull HC) && (isNull HC2) && (isNull HC3) ) then { waitUntil {!isNull HC}; }; - - // Check to auto enable Round-Robin load balancing strategy - if ( (!isNull HC && !isNull HC2) || (!isNull HC && !isNull HC3) || (!isNull HC2 && !isNull HC3) ) then { _loadBalance = true; }; - - if ( _loadBalance ) then { - diag_log "passToHCs: Starting load-balanced transfer of AI groups to HCs"; - } else { - // No load balancing - diag_log "passToHCs: Starting transfer of AI groups to HC"; - }; - - // Determine first HC to start with - _currentHC = 0; - - if (!isNull HC) then { _currentHC = 1; } else { - if (!isNull HC2) then { _currentHC = 2; } else { _currentHC = 3; }; - }; - - // Pass the AI - _numTransfered = 0; - { - _syncGroup = _x; - _swap = true; - - _ownerID = _HC_ID; - - if ( _loadBalance ) then { - - _ownerID = switch (_currentHC) do { - case 1: { if (!isNull HC2) then { _currentHC = 2; } else { _currentHC = 3; }; _HC_ID }; - case 2: { if (!isNull HC3) then { _currentHC = 3; } else { _currentHC = 1; }; _HC2_ID }; - case 3: { if (!isNull HC) then { _currentHC = 1; } else { _currentHC = 2; }; _HC3_ID }; - default {-1}; - }; - - } else { - - _ownerID = switch (_currentHC) do { - case 1: {_HC_ID}; - case 2: {_HC2_ID}; - case 3: {_HC3_ID}; - default {-1}; - }; - - }; - - // Check if group has already been transfered - if (_syncGroup getVariable ["hc_transfered", false]) then { - _swap = false; - } else { - - if (groupOwner _syncGroup == _ownerID) then { - _x setVariable ["hc_transfered", true]; - _swap = false; - }; - - }; - - // Check if group is blacklisted - if (_syncGroup getVariable ["hc_blacklist", false]) then { - _swap = false; - }; - - if ( _swap ) then { - { - // If a player is in this group, don't swap to an HC - if (isPlayer _x) exitWith { _swap = false; }; - - // If a unit has 'hc_blacklist' set to true and is in this group, don't swap to an HC. - if (_x getVariable ["hc_blacklist", false]) exitWith { _swap = false; }; - - // If unit is in a vehicle check if vehicle or crew is blacklisted - if (vehicle _x != _x) then { - if ((vehicle _x) getVariable ["hc_blacklist", false]) exitWith { _swap = false; }; - }; - - } forEach (units _syncGroup); - }; - - // Check if group has any waypoints synced to triggers and auto blacklist - if ( _swap ) then { - { - if (count (synchronizedTriggers _x) > 0) exitWith { - _syncGroup setVariable ["hc_blacklist", true]; - _swap = false; - }; - } forEach (waypoints _syncGroup); - }; - - // If load balance enabled, round robin between the HCs - else pass all to HC - if ( _swap ) then { - _rc = false; - - _syncTrigArray = []; - _syncWayArray = []; - { - _wayNum = _forEachIndex; - _syncedTrigs = synchronizedTriggers _x; - _syncTrigArray set [_wayNum,_syncedTrigs]; - - _syncedWays = synchronizedWaypoints _x; - _syncWayArray set [_wayNum,_syncedWays]; - } forEach waypoints _x; - - if (_ownerID >= 0) then { - _rc = _x setGroupOwner _ownerID; - } else { - diag_log format["passToHCs: [ERROR] No Valid HC to pass to. _currentHC = %1", _currentHC]; - }; - - - // If the transfer was successful, count it for accounting and diagnostic information - if ( _rc ) then { - _x setVariable ["hc_transfered", true]; - PassToHC_NumTransfered = PassToHC_NumTransfered + 1; - }; - }; - } forEach (allGroups); - - if (PassToHC_NumTransfered > 0) then { - // More accounting and diagnostic information - - diag_log format ["passToHCs: Transfered %1 AI groups to HC(s)", PassToHC_NumTransfered]; - - _numHC = 0; - _numHC2 = 0; - _numHC3 = 0; - - { - switch (owner ((units _x) select 0)) do { - case _HC_ID: { _numHC = _numHC + 1; }; - case _HC2_ID: { _numHC2 = _numHC2 + 1; }; - case _HC3_ID: { _numHC3 = _numHC3+ 1; }; - }; - } forEach (allGroups); - - diag_log if (_numHC > 0) then { format ["passToHCs: %1 AI groups currently on HC", _numHC]; }; - diag_log if (_numHC2 > 0) then { format ["passToHCs: %1 AI groups currently on HC2", _numHC2]; }; - diag_log if (_numHC3 > 0) then { format ["passToHCs: %1 AI groups currently on HC3", _numHC3]; }; - - diag_log format ["passToHCs: %1 AI groups total across all HC(s)", (_numHC + _numHC2 + _numHC3)]; - } else { - diag_log "passToHCs: No rebalance or transfers required this round"; - }; - - // Force clean up dead bodies and destroyed vehicles - if (count allDead > _cleanUpThreshold) then { - _numDeleted = 0; - { - deleteVehicle _x; - - _numDeleted = _numDeleted + 1; - } forEach allDead; - - diag_log format ["passToHCs: Cleaned up %1 dead bodies/destroyed vehicles", _numDeleted]; - }; - - // Rebalance every rebalanceTimer seconds to avoid hammering the server - sleep _rebalanceTimer; -}; \ No newline at end of file diff --git a/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_setWaypoints.sqf b/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_setWaypoints.sqf deleted file mode 100644 index 316f435..0000000 --- a/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_setWaypoints.sqf +++ /dev/null @@ -1,92 +0,0 @@ -// Sets up waypoints for a specified group. -/* - for ghostridergaming - By Ghostrider [GRG] - Copyright 2016 - Last modified 3/17/17 - - -------------------------- - License - -------------------------- - All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. - - http://creativecommons.org/licenses/by-nc-sa/4.0/ -*/ -#include "\q\addons\custom_server\Configs\blck_defines.hpp"; - - -private["_dir","_arc","_noWp","_newpos","_wpradius","_wp"]; -params["_pos","_minDis","_maxDis","_group",["_mode","random"],["_patrolMode","SAD"]]; - -/* -_pos = _this select 0; // center of the patrol area -_minDis = _this select 1; // minimum distance from the center of a patrol area for waypoints -_maxDis = _this select 2; // maximum distance from the center of a patrol area for waypoints -_group = _this select 3; -*/ - - -_group setVariable["patrolCenter",_pos]; -_group setVariable["minDis",_minDis]; -_group setVariable["maxDis",_maxDis]; -_group setVariable["timeStamp",diag_tickTime]; -_group setVariable["arc",0]; -_group setVariable["wpRadius",30]; -_group setVariable["wpMode",_mode]; - -_dir = 0; -_arc = 30; -_noWp = 1; -_wpradius = 30; -_newPos = _pos getPos [(_minDis+(random (_maxDis - _minDis))), _dir]; -_wp = [_group, 0]; - -#ifdef wpModeMove -_wp setWaypointType "MOVE"; -_wp setWaypointName "move"; -_wp setWaypointTimeout [1,1.1,1.2]; -_wp setWaypointStatements ["true","this call blck_fnc_changeToSADWaypoint;diag_log format['====Updating waypoint to SAD for group %1',group this];"]; -#else -_wp setWaypointType "SAD"; -_wp setWaypointName "sad"; -_wp setWaypointTimeout [20,25,30]; -_wp setWaypointStatements ["true","this call blck_fnc_changeToMoveWaypoint;diag_log format['====Updating waypoint to Move for group %1',group this];"]; -#endif - -_wp setWaypointBehaviour blck_groupBehavior; -_wp setWaypointCombatMode blck_combatMode; -_group setCurrentWaypoint _wp; - -/* -Code for Build 44 as a referemce/ -private["_dist","_dir","_arc","_xpos","_ypos","_newpos","_wpradius","_wpnum","_oldpos"]; -params["_pos","_minDis","_maxDis","_group"]; - -_wpradius = 30; -_wpnum = 6; -_dir = random 360; -_arc = 360/_wpnum; - -for "_i" from 0 to (_wpnum - 1) do -{ - _dir = _dir + _arc; - _dist = (_minDis+(random (_maxDis - _minDis))); - _newpos = _pos getPos [_dist, _arc]; - - _wp = _group addWaypoint [_newpos, 0]; - _wp setWaypointTimeout [1, 1.1, 1.2]; - _wp setWaypointType "MOVE"; - _wp setWaypointBehaviour "COMBAT"; - _wp setWaypointCombatMode "RED"; - _wp setWaypointName "move"; - _wp = _group addWaypoint [_newpos, 0]; - _wp setWaypointTimeout [15,20,25]; - _wp setWaypointType "SAD"; - _wp setWaypointBehaviour "COMBAT"; - _wp setWaypointCombatMode "RED"; - _wp setWaypointName "sad"; -}; -deleteWaypoint [_group, 0]; -_group setVariable["wpIndex",0]; -_wp = _group addWaypoint [_newpos, _wpradius]; -_wp setWaypointType "CYCLE"; diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy.sqf new file mode 100644 index 0000000..eca6d38 --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy.sqf @@ -0,0 +1,519 @@ +/* + Generic Mission Spawner + By Ghostrider GRG + Copyright 2016 + Last modified 10/9/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 delayTime 1 +private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_AI_Vehicles","_timeOut","_aiDifficultyLevel","_missionPatrolVehicles","_missionGroups"]; +params["_coords","_mission",["_allowReinforcements",true]]; +//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 select 2; +_aiDifficultyLevel = _mission select 3; + +[_mission,"active",_coords] call blck_fnc_updateMissionQue; +blck_ActiveMissionCoords pushback _coords; +diag_log format["[blckeagls] missionSpawner (17):: 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 "_missionPatrolVehicles") then { + //diag_log format["_missionSpawner (44):: _missionPatrolVehicles isNil, Definining it as an empty array"]; + _missionPatrolVehicles = []; + //diag_log format["_missionSpawner (46):: _missionPatrolVehicles is %1",_missionPatrolVehicles]; +}; +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; + blck_aiCountMarkers pushBack ["ai_count" + _markerClass, _blck_AllMissionAI]; +#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"}; +#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["missionSpawner:: Trigger Loop - blck_debugLevel = %1 and _coords = %2",blck_debugLevel, _coords]; + diag_log format["missionSpawner:: Trigger Loop - players in range = %1",{isPlayer _x && _x distance2D _coords < blck_TriggerDistance} count allPlayers]; + diag_log format["missionSpawner:: 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_recentMissionCoords pushback [_coords,diag_tickTime]; + blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords]; + [_mission,"inactive",[0,0,0]] call blck_fnc_updateMissionQue; + blck_missionsRunning = blck_missionsRunning - 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] missionSpawner:: (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] missionSpawner:: (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["_missionSpawner"" _missionLandscape = %1",_missionLandscape]; +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; + //uiSleep 1; +}; +if (typeName _temp isEqualTo "ARRAY") then +{ + _objects append _temp; +}; +//diag_log format["_fnc_missionSpawner:: (181)->> _objects = %1",_objects]; + +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] missionSpawner:: (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]; +_temp = [_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear,_missionGroups] call blck_fnc_spawnMissionAI; + +#ifdef blck_debugMode +if (blck_debugLevel > 2) then { + diag_log format["missionSpawner :: (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["missionSpawner :: (214) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1; +}; +#endif + +if (_abort) exitWith +{ + if (blck_debugLevel > 1) then { + diag_log "missionSpawner:: (220) grpNull returned, mission termination criteria met, calling blck_fnc_endMission" + }; + [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,1] call blck_fnc_endMission; +}; +if !(_abort) then +{ + _blck_AllMissionAI append (_temp select 0); +}; + +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] missionSpawner:: (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"]; +_vehToSpawn = [_noVehiclePatrols] call blck_fnc_getNumberFromRange; +//diag_log format["_missionSpawner:: _vehToSpawn = %1",_vehToSpawn]; +//diag_log format["_missionSpawner (245):: _missionPatrolVehicles = %1",_missionPatrolVehicles]; +if (blck_useVehiclePatrols && ((_vehToSpawn > 0) || count _missionPatrolVehicles > 0)) then +{ + _temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_missionPatrolVehicles] 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["missionSpawner :: (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] missionSpawner:: (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 "missionSpawner:: (279) grpNull returned, mission termination criteria met, calling blck_endMission"; + }; + #endif + + [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,1] 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] missionSpawner:: (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.5; + 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["_missionSpawner(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["missionSpawner(334):: blck_fnc_spawnMissionReinforcements call for chopper # %1 out of a total of %2 choppers",_i, _noChoppers]; + diag_log format["missionSpawner(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 "missionSpawner:: (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] 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["missionSpawner:: (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["_missionSpawner:: _noEmplacedToSpawn = %1",_vehToSpawn]; +if (blck_useStatic && (_noEmplacedToSpawn > 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 ["missionSpawner:: (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 ["missionSpawner:: (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] missionSpawner:: (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 "missionSpawner:: (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] call blck_fnc_endMission; +}; + +uiSleep _delayTime; +if (count _missionLootBoxes > 0) then +{ + _crates = [_coords,_missionLootBoxes,_loadCratesTiming] call blck_fnc_spawnMissionCrates; +} +else +{ + _crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming] call blck_fnc_spawnMissionCrates; + +}; + +if (blck_cleanUpLootChests) then +{ + _objects append _crates; +}; + +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] missionSpawner:: (428) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; +}; +#endif +/* + _name = "label" + _name; + _textPos = [(_pos select 0) + (count toArray (_text) * 12), (_pos select 1) - (_size select 0), 0]; + _MainMarker = createMarker [_name, _textPos]; +*/ +private _aliveAImarker; +if (blck_showCountOfAliveAI) then +{ + private _text = format["% Alive",{alive _x} count _blck_AllMissionAI]; + _aliveAImarker = createMarker["aiCount" + _markerClass, [(_coords select 0) + (count toArray (_text) * 12), (_coords select 1) + (100), 0]]; + _aliveAImarker setMarkerText _text;; + blck_aiCountMarkers pushBack [_aliveAImarker, _blck_AllMissionAI]; + diag_log format["Alive AI Marker Spawned with Marker of %1 and blck_aiCountMarkers = %2",_aliveAImarker,blck_aiCountMarkers]; +}; +// 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["missionSpawner :: (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["missionSpawner (458):: _coords = %1 | _crates = %2 | _locations = %3",_coords,_crates,_locations]; +#endif +private _crateStolen = false; +#ifdef blck_debugMode +diag_log format["missionSpawner(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; +}; +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["missionSpawner:: (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["missionSpawner:: (491) 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] call blck_fnc_endMission; +}; +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] missionSpawner:: (496) Mission completion criteria fulfilled: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + diag_log format["missionSpawner :: (497) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled]; + diag_log format["[blckeagls] missionSpawner:: (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]; +_result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,0] call blck_fnc_endMission; +if (blck_showCountOfAliveAI) then +{ + deleteMarker _aliveAImarker; + blck_aiCountMarkers = blck_aiCountMarkers - [_aliveAImarker, _blck_AllMissionAI]; +}; + +diag_log format["[blckeagls] missionSpawner:: (507)end of mission: blck_fnc_endMission has returned control to _fnc_missionSpawner"]; + diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor - Copy.sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor - Copy.sqf new file mode 100644 index 0000000..c966951 --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor - Copy.sqf @@ -0,0 +1,203 @@ +/* + Handle the case that all AI assigned to a vehicle are dead. + Allows players to enter and use the vehicle when appropriate + or otherwise destroys the vehicle. + + Logic: + 1) Mission ended; players can keep vehicles BUT not all vehicle AI were killed - > delete vehicle when live AI are killed; + 2) Vehicle has a blck_deleteAT timer set - > delete vehicle; + 3) All AI killed an players may NOT keep vehicles - > detroy vehicle + 4) All AI Killed and players MAY keep vehicles -> release vehicle + 5) vehicle ammo low AND vehicle gunner is alive - > reloaded + + By Ghostrider [GRG] + Copyright 2016 + Last updated 12-22-17 + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +//diag_log format["_fnc_vehicleMonitor: starting function at diag_tickTime = %1",diag_tickTime]; +#ifdef blck_debugMode + //diag_log format["_fnc_vehicleMonitor:: blck_debugMode defined"]; +#endif + +_fn_releaseVehicle = { + params["_veh"]; + //blck_monitoredVehicles = blck_monitoredVehicles - [_veh]; + _veh setVehicleLock "UNLOCKED" ; + //_v setVariable["releasedToPlayers",true]; + //[_v] call blck_fnc_emptyObject; + { + _veh removealleventhandlers _x; + } forEach ["GetIn","GetOut","fired","hit","hitpart","reloaded","dammaged","HandleDamage"]; + { + _veh removeAllMPEventHandlers _x; + } forEach ["MPHit","MPKilled"]; + _veh setVariable["blck_DeleteAt",diag_tickTime + blck_vehicleDeleteTimer,true]; + if ((damage _veh) > 0.5) then {_veh setDamage 0.5}; + //diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle released to players where vehicle = %1 and blck_deleteAT = %2",_veh, _veh getVariable["blck_DeleteAt",0]]; + #ifdef blck_debugMode + if (blck_debugLevel > 3) then + { + diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle released to players where vehicle = %1",_veh]; + }; + #endif +}; + +_fn_destroyVehicleAndCrew = { + params["_veh"]; + //private["_crew"]; + //_crew = crew _veh; + //diag_log format["_fn_destroyVehicleAndCrew: called for _veh = %1",_veh]; + {[_x] call blck_fnc_deleteAI;} forEach (crew _veh); + [_veh] call blck_fn_deleteAIvehicle; +}; + +_fn_reloadAmmo = { + params["_veh"]; + private ["_crew","_mag","_allMags","_cnt"]; + // https://community.bistudio.com/wiki/fullCrew + // 0 1 2 3 4 + // returns Array - format [[unit,role,cargoIndex,turretPath,personTurret], ...] + //diag_log format["_fnc_vehicleMonitor:: (65) _veh = %1",_veh]; + if ({alive _x and !(isPlayer _x)} count (crew _veh) > 0) then + { + _crew = fullCrew _veh; + //diag_log format["_fnc_vehicleMonitor:: (67) _crew = %1",_crew]; + { + //diag_log format ["_fnc_vehicleMonitor:: (69) _x = %1",_x]; + _mag = _veh currentMagazineTurret (_x select 3); + if (count _mag > 0) then + { + //diag_log format["_fnc_vehicleMonitor:: (71) _mag is typeName %1", typeName _mag]; + //diag_log format ["_fnc_vehicleMonitor:: (71) length _mag = %2 and _mag = %1",_mag,count _mag]; + _allMags = magazinesAmmo _veh; + //diag_log format["_fnc_vehicleMonitor:: (71) _allMags = %1",_allMags]; + _cnt = ( {_mag isEqualTo (_x select 0)}count _allMags); + //diag_log format["_fnc_vehicleMonitor:: (75) _cnt = %1",_cnt]; + if (_cnt < 2) then {_veh addMagazineCargo [_mag,2]}; + }; + } forEach _crew; + }; +}; + +blck_fn_deleteAIvehicle = { + params["_veh"]; + //diag_log format["blck_fn_deleteAIvehicle: _veh %1 deleted",_veh]; + { + _veh removeAllEventHandlers _x; + }forEach ["Hit","HitPart","GetIn","GetOut","Fired","FiredNear","HandleDamage","Reloaded"]; + blck_monitoredVehicles = blck_monitoredVehicles - [_veh]; + deleteVehicle _veh; +}; + +private _vehList = +blck_monitoredVehicles; + +#ifdef blck_debugMode +if (blck_debugLevel > 3) then {diag_log format["_fnc_vehicleMonitor:: function called at %1 with _vehList %2 and blck_monitoredVehicles %3",diag_tickTime,_vehList,blck_monitoredVehicles];}; +#endif + //blck_fnc_releaseVehicleToPlayers +{ + private _veh = _x; // (purely for clarity at this point, _x could be used just as well) + + #ifdef blck_debugMode + if (blck_debugLevel > 3) then + { + diag_log format["_fnc_vehicleMonitor: vehicle %1 with missionCompleted = %2 being evaluated",_x, _x getVariable"missionCompleted",0]; + }; + #endif + private _evaluate = true; + //diag_log format["_fnc_vehicleMonitor: owner of _veh %1 isEqualTo %2",_veh, owner _veh]; + if (owner _veh > 2 && !(owner _veh in blck_connectedHCs)) then + { + // Vehicle is NOT local to server or an HC so a player so must have been entered. + _evaluate = false; + _veh setVariable["blck_DeleteAt",0]; + blck_monitoredVehicles = blck_monitoredVehicles - [_veh]; + diag_log format["_fnc_vehicleMonitor: vehicle %1 now owned by player %2",_veh, owner _veh]; + }; + //diag_log format["_fnc_vehicleMonitor: _veh = %1 getVariable[blck_DeleteAt] = %2",_veh, _veh getVariable["blck_DeleteAt",0]]; + if (_evaluate) then + { + //diag_log format["_fnc_vehicleMonitor: deleting _veh %1 with diag_tickTime %2 and blck_deleteAT %3",_veh,diag_tickTime,_veh getVariable["blck_DeleteAt",0]]; + // Case where vehicle has been marked for deletion after a certain time. + if ( (_veh getVariable["blck_DeleteAt",0] > 0) && (diag_tickTime > (_veh getVariable "blck_DeleteAt"))) then + { + [_veh] call _fn_destroyVehicleAndCrew; + _evaluate = false; + }; + }; + + // Case where is an emplaced / static wweapon and has no alive crew and such vehicles should be 'killed' or released to players + if (_evaluate) then + { + if ( (_veh getVariable["DBD_vehType","none"] isEqualTo "emplaced") && {alive _x} count crew _veh isEqualTo 0) then + { + if (blck_killEmptyStaticWeapons) then + { + //diag_log format["_fnc_vehicleMonitor:: case of destroyed where vehicle = %1",_veh]; + + #ifdef blck_debugMode + if (blck_debugLevel > 3) then {diag_log format["_fnc_vehicleMonitor:: case of destroyed where vehicle = %1",_veh];}; + #endif + + _veh setDamage 1; + _veh setVariable["blck_DeleteAt",diag_tickTime + 60]; + }else { + [_veh] call _fn_releaseVehicle; + }; + _evaluate = false; + }; + }; + if ( (_veh getVariable["blck_DeleteAt",0]) > 0) then + { + _evaluate = false; + }; + // Case where a vehicle is NOT an emplaced / static weapon and has no alive crew and such vehicles should be 'killed' or released to players + if (_evaluate) then + { + if (_veh getVariable["DBD_vehType","none"] isEqualTo "none" && ({alive _x} count crew _veh isEqualTo 0) ) then + { + if (blck_killEmptyAIVehicles) then + { + _veh setDamage 0.7; + _veh setVariable["blck_DeleteAt",diag_tickTime + 60]; + } else { + //diag_log format["_fnc_vehicleMonitor:: case of RELEASE where vehicle = %1 and Vehicle is typeOf %2",_veh, typeOf _veh]; + [_veh] call _fn_releaseVehicle; + }; + _evaluate = false; + }; + }; + + // Case where a vehicle is part of a mission that has been completed and containes live AI. + if (_evaluate) then + { + if ( _veh getVariable["missionCompleted",0] > 0 && ({alive _x} count crew _veh > 0)) then + { + //diag_log format["_fnc_vehicleMonitor:: case of mission vehicle with AI alive at mission end: schedule destruction with _veh = %1 and typeOf _veh = %2",_veh, typeOf _veh]; + private _cleanupTimer = _veh getVariable["blck_DeleteAt",0]; // The time delete to deleting any alive AI units + if (_cleanupTimer == 0) then {_veh setVariable["blck_DeleteAt",diag_tickTime + blck_vehicleDeleteTimer]}; + if (diag_tickTime > _veh getVariable["blck_DeleteAt",0]) then + { + [_veh] call _fn_destroyVehicleAndCrew; + _evaluate = false; + }; + }; + }; + + if (_evaluate) then + { + [_veh] call _fn_reloadAmmo; + }; +}forEach _vehList; + + + diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf index c966951..0d16d20 100644 --- a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf +++ b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf @@ -1,19 +1,6 @@ /* - Handle the case that all AI assigned to a vehicle are dead. - Allows players to enter and use the vehicle when appropriate - or otherwise destroys the vehicle. - - Logic: - 1) Mission ended; players can keep vehicles BUT not all vehicle AI were killed - > delete vehicle when live AI are killed; - 2) Vehicle has a blck_deleteAT timer set - > delete vehicle; - 3) All AI killed an players may NOT keep vehicles - > detroy vehicle - 4) All AI Killed and players MAY keep vehicles -> release vehicle - 5) vehicle ammo low AND vehicle gunner is alive - > reloaded - By Ghostrider [GRG] Copyright 2016 - Last updated 12-22-17 - -------------------------- License -------------------------- @@ -24,6 +11,7 @@ #include "\q\addons\custom_server\Configs\blck_defines.hpp"; //diag_log format["_fnc_vehicleMonitor: starting function at diag_tickTime = %1",diag_tickTime]; + #ifdef blck_debugMode //diag_log format["_fnc_vehicleMonitor:: blck_debugMode defined"]; #endif @@ -44,7 +32,7 @@ _fn_releaseVehicle = { if ((damage _veh) > 0.5) then {_veh setDamage 0.5}; //diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle released to players where vehicle = %1 and blck_deleteAT = %2",_veh, _veh getVariable["blck_DeleteAt",0]]; #ifdef blck_debugMode - if (blck_debugLevel > 3) then + if (blck_debugLevel > 0) then { diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle released to players where vehicle = %1",_veh]; }; @@ -55,7 +43,7 @@ _fn_destroyVehicleAndCrew = { params["_veh"]; //private["_crew"]; //_crew = crew _veh; - //diag_log format["_fn_destroyVehicleAndCrew: called for _veh = %1",_veh]; + diag_log format["_fn_destroyVehicleAndCrew: called for _veh = %1",_veh]; {[_x] call blck_fnc_deleteAI;} forEach (crew _veh); [_veh] call blck_fn_deleteAIvehicle; }; @@ -90,7 +78,7 @@ _fn_reloadAmmo = { blck_fn_deleteAIvehicle = { params["_veh"]; - //diag_log format["blck_fn_deleteAIvehicle: _veh %1 deleted",_veh]; + diag_log format["blck_fn_deleteAIvehicle: _veh %1 deleted",_veh]; { _veh removeAllEventHandlers _x; }forEach ["Hit","HitPart","GetIn","GetOut","Fired","FiredNear","HandleDamage","Reloaded"]; @@ -101,102 +89,83 @@ blck_fn_deleteAIvehicle = { private _vehList = +blck_monitoredVehicles; #ifdef blck_debugMode -if (blck_debugLevel > 3) then {diag_log format["_fnc_vehicleMonitor:: function called at %1 with _vehList %2 and blck_monitoredVehicles %3",diag_tickTime,_vehList,blck_monitoredVehicles];}; +if (blck_debugLevel > 0) then {diag_log format["_fnc_vehicleMonitor:: function called at %1 with _vehList %2 and blck_monitoredVehicles %3",diag_tickTime,_vehList,blck_monitoredVehicles];}; #endif //blck_fnc_releaseVehicleToPlayers { + /* + Determine state of vehicle + _isEmplaced + _ownerIsPlayer + _allCrewDead + _deleteNow + */ + //diag_log format["_fnc_vehicleMonitor: evaluating vehicle %1",_x]; private _veh = _x; // (purely for clarity at this point, _x could be used just as well) - - #ifdef blck_debugMode - if (blck_debugLevel > 3) then - { - diag_log format["_fnc_vehicleMonitor: vehicle %1 with missionCompleted = %2 being evaluated",_x, _x getVariable"missionCompleted",0]; - }; - #endif + private _isEmplaced = _veh getVariable["DBD_vehType","none"] isEqualTo "emplaced"; + private _ownerIsPlayer = if (owner _veh > 2 && !(owner _veh in blck_connectedHCs)) then {true} else {false}; + private _allCrewDead = if (({alive _x} count (crew _veh)) == 0) then {true} else {false}; + private _deletenow = false; + if ( (_veh getVariable["blck_DeleteAt",0] > 0) && (diag_tickTime > (_veh getVariable "blck_DeleteAt"))) then {_deleteNow = true}; + private _missionCompleted = if (_veh getVariable["missionCompleted",0] != 0) then {true} else {false}; private _evaluate = true; - //diag_log format["_fnc_vehicleMonitor: owner of _veh %1 isEqualTo %2",_veh, owner _veh]; - if (owner _veh > 2 && !(owner _veh in blck_connectedHCs)) then + + if (_ownerIsPlayer) then { - // Vehicle is NOT local to server or an HC so a player so must have been entered. + // disable further monitoring and mark to never be deleted. _evaluate = false; _veh setVariable["blck_DeleteAt",0]; blck_monitoredVehicles = blck_monitoredVehicles - [_veh]; - diag_log format["_fnc_vehicleMonitor: vehicle %1 now owned by player %2",_veh, owner _veh]; - }; - //diag_log format["_fnc_vehicleMonitor: _veh = %1 getVariable[blck_DeleteAt] = %2",_veh, _veh getVariable["blck_DeleteAt",0]]; - if (_evaluate) then - { - //diag_log format["_fnc_vehicleMonitor: deleting _veh %1 with diag_tickTime %2 and blck_deleteAT %3",_veh,diag_tickTime,_veh getVariable["blck_DeleteAt",0]]; - // Case where vehicle has been marked for deletion after a certain time. - if ( (_veh getVariable["blck_DeleteAt",0] > 0) && (diag_tickTime > (_veh getVariable "blck_DeleteAt"))) then - { - [_veh] call _fn_destroyVehicleAndCrew; - _evaluate = false; - }; + diag_log format["_fnc_vehicleMonitor: vehicle %1 now owned by player %2",_veh, owner _veh]; }; - // Case where is an emplaced / static wweapon and has no alive crew and such vehicles should be 'killed' or released to players - if (_evaluate) then + if (_allCrewDead && _evaluate) then { - if ( (_veh getVariable["DBD_vehType","none"] isEqualTo "emplaced") && {alive _x} count crew _veh isEqualTo 0) then + if (_isEmplaced) then { if (blck_killEmptyStaticWeapons) then { - //diag_log format["_fnc_vehicleMonitor:: case of destroyed where vehicle = %1",_veh]; - #ifdef blck_debugMode - if (blck_debugLevel > 3) then {diag_log format["_fnc_vehicleMonitor:: case of destroyed where vehicle = %1",_veh];}; + if (blck_debugLevel > 0) then {diag_log format["_fnc_vehicleMonitor:: case of destroyed where vehicle = %1",_veh];}; #endif - _veh setDamage 1; _veh setVariable["blck_DeleteAt",diag_tickTime + 60]; }else { [_veh] call _fn_releaseVehicle; }; - _evaluate = false; - }; - }; - if ( (_veh getVariable["blck_DeleteAt",0]) > 0) then - { - _evaluate = false; - }; - // Case where a vehicle is NOT an emplaced / static weapon and has no alive crew and such vehicles should be 'killed' or released to players - if (_evaluate) then - { - if (_veh getVariable["DBD_vehType","none"] isEqualTo "none" && ({alive _x} count crew _veh isEqualTo 0) ) then - { + _evaluate = false; + } else { if (blck_killEmptyAIVehicles) then { _veh setDamage 0.7; _veh setVariable["blck_DeleteAt",diag_tickTime + 60]; } else { - //diag_log format["_fnc_vehicleMonitor:: case of RELEASE where vehicle = %1 and Vehicle is typeOf %2",_veh, typeOf _veh]; + diag_log format["_fnc_vehicleMonitor:: case of RELEASE where vehicle = %1 and Vehicle is typeOf %2",_veh, typeOf _veh]; [_veh] call _fn_releaseVehicle; }; - _evaluate = false; + _evaluate = false; }; }; - - // Case where a vehicle is part of a mission that has been completed and containes live AI. - if (_evaluate) then + + if (_missionCompleted && !(_allCrewDead)) then { - if ( _veh getVariable["missionCompleted",0] > 0 && ({alive _x} count crew _veh > 0)) then - { - //diag_log format["_fnc_vehicleMonitor:: case of mission vehicle with AI alive at mission end: schedule destruction with _veh = %1 and typeOf _veh = %2",_veh, typeOf _veh]; - private _cleanupTimer = _veh getVariable["blck_DeleteAt",0]; // The time delete to deleting any alive AI units - if (_cleanupTimer == 0) then {_veh setVariable["blck_DeleteAt",diag_tickTime + blck_vehicleDeleteTimer]}; - if (diag_tickTime > _veh getVariable["blck_DeleteAt",0]) then - { - [_veh] call _fn_destroyVehicleAndCrew; - _evaluate = false; - }; - }; + diag_log format["_fnc_vehicleMonitor:: case of mission vehicle with AI alive at mission end: schedule destruction with _veh = %1 and typeOf _veh = %2",_veh, typeOf _veh]; + private _cleanupTimer = _veh getVariable["blck_DeleteAt",0]; // The time delete to deleting any alive AI units + if (_cleanupTimer == 0) then {_veh setVariable["blck_DeleteAt",diag_tickTime + blck_vehicleDeleteTimer]}; + _evaluate = false; }; - + if (_evaluate) then { [_veh] call _fn_reloadAmmo; + }; + + if (_deleteNow) then + { + [_veh] call _fn_destroyVehicleAndCrew; + _evaluate = false; }; + }forEach _vehList; diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor_updated b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor_updated new file mode 100644 index 0000000..c966951 --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor_updated @@ -0,0 +1,203 @@ +/* + Handle the case that all AI assigned to a vehicle are dead. + Allows players to enter and use the vehicle when appropriate + or otherwise destroys the vehicle. + + Logic: + 1) Mission ended; players can keep vehicles BUT not all vehicle AI were killed - > delete vehicle when live AI are killed; + 2) Vehicle has a blck_deleteAT timer set - > delete vehicle; + 3) All AI killed an players may NOT keep vehicles - > detroy vehicle + 4) All AI Killed and players MAY keep vehicles -> release vehicle + 5) vehicle ammo low AND vehicle gunner is alive - > reloaded + + By Ghostrider [GRG] + Copyright 2016 + Last updated 12-22-17 + + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +//diag_log format["_fnc_vehicleMonitor: starting function at diag_tickTime = %1",diag_tickTime]; +#ifdef blck_debugMode + //diag_log format["_fnc_vehicleMonitor:: blck_debugMode defined"]; +#endif + +_fn_releaseVehicle = { + params["_veh"]; + //blck_monitoredVehicles = blck_monitoredVehicles - [_veh]; + _veh setVehicleLock "UNLOCKED" ; + //_v setVariable["releasedToPlayers",true]; + //[_v] call blck_fnc_emptyObject; + { + _veh removealleventhandlers _x; + } forEach ["GetIn","GetOut","fired","hit","hitpart","reloaded","dammaged","HandleDamage"]; + { + _veh removeAllMPEventHandlers _x; + } forEach ["MPHit","MPKilled"]; + _veh setVariable["blck_DeleteAt",diag_tickTime + blck_vehicleDeleteTimer,true]; + if ((damage _veh) > 0.5) then {_veh setDamage 0.5}; + //diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle released to players where vehicle = %1 and blck_deleteAT = %2",_veh, _veh getVariable["blck_DeleteAt",0]]; + #ifdef blck_debugMode + if (blck_debugLevel > 3) then + { + diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle released to players where vehicle = %1",_veh]; + }; + #endif +}; + +_fn_destroyVehicleAndCrew = { + params["_veh"]; + //private["_crew"]; + //_crew = crew _veh; + //diag_log format["_fn_destroyVehicleAndCrew: called for _veh = %1",_veh]; + {[_x] call blck_fnc_deleteAI;} forEach (crew _veh); + [_veh] call blck_fn_deleteAIvehicle; +}; + +_fn_reloadAmmo = { + params["_veh"]; + private ["_crew","_mag","_allMags","_cnt"]; + // https://community.bistudio.com/wiki/fullCrew + // 0 1 2 3 4 + // returns Array - format [[unit,role,cargoIndex,turretPath,personTurret], ...] + //diag_log format["_fnc_vehicleMonitor:: (65) _veh = %1",_veh]; + if ({alive _x and !(isPlayer _x)} count (crew _veh) > 0) then + { + _crew = fullCrew _veh; + //diag_log format["_fnc_vehicleMonitor:: (67) _crew = %1",_crew]; + { + //diag_log format ["_fnc_vehicleMonitor:: (69) _x = %1",_x]; + _mag = _veh currentMagazineTurret (_x select 3); + if (count _mag > 0) then + { + //diag_log format["_fnc_vehicleMonitor:: (71) _mag is typeName %1", typeName _mag]; + //diag_log format ["_fnc_vehicleMonitor:: (71) length _mag = %2 and _mag = %1",_mag,count _mag]; + _allMags = magazinesAmmo _veh; + //diag_log format["_fnc_vehicleMonitor:: (71) _allMags = %1",_allMags]; + _cnt = ( {_mag isEqualTo (_x select 0)}count _allMags); + //diag_log format["_fnc_vehicleMonitor:: (75) _cnt = %1",_cnt]; + if (_cnt < 2) then {_veh addMagazineCargo [_mag,2]}; + }; + } forEach _crew; + }; +}; + +blck_fn_deleteAIvehicle = { + params["_veh"]; + //diag_log format["blck_fn_deleteAIvehicle: _veh %1 deleted",_veh]; + { + _veh removeAllEventHandlers _x; + }forEach ["Hit","HitPart","GetIn","GetOut","Fired","FiredNear","HandleDamage","Reloaded"]; + blck_monitoredVehicles = blck_monitoredVehicles - [_veh]; + deleteVehicle _veh; +}; + +private _vehList = +blck_monitoredVehicles; + +#ifdef blck_debugMode +if (blck_debugLevel > 3) then {diag_log format["_fnc_vehicleMonitor:: function called at %1 with _vehList %2 and blck_monitoredVehicles %3",diag_tickTime,_vehList,blck_monitoredVehicles];}; +#endif + //blck_fnc_releaseVehicleToPlayers +{ + private _veh = _x; // (purely for clarity at this point, _x could be used just as well) + + #ifdef blck_debugMode + if (blck_debugLevel > 3) then + { + diag_log format["_fnc_vehicleMonitor: vehicle %1 with missionCompleted = %2 being evaluated",_x, _x getVariable"missionCompleted",0]; + }; + #endif + private _evaluate = true; + //diag_log format["_fnc_vehicleMonitor: owner of _veh %1 isEqualTo %2",_veh, owner _veh]; + if (owner _veh > 2 && !(owner _veh in blck_connectedHCs)) then + { + // Vehicle is NOT local to server or an HC so a player so must have been entered. + _evaluate = false; + _veh setVariable["blck_DeleteAt",0]; + blck_monitoredVehicles = blck_monitoredVehicles - [_veh]; + diag_log format["_fnc_vehicleMonitor: vehicle %1 now owned by player %2",_veh, owner _veh]; + }; + //diag_log format["_fnc_vehicleMonitor: _veh = %1 getVariable[blck_DeleteAt] = %2",_veh, _veh getVariable["blck_DeleteAt",0]]; + if (_evaluate) then + { + //diag_log format["_fnc_vehicleMonitor: deleting _veh %1 with diag_tickTime %2 and blck_deleteAT %3",_veh,diag_tickTime,_veh getVariable["blck_DeleteAt",0]]; + // Case where vehicle has been marked for deletion after a certain time. + if ( (_veh getVariable["blck_DeleteAt",0] > 0) && (diag_tickTime > (_veh getVariable "blck_DeleteAt"))) then + { + [_veh] call _fn_destroyVehicleAndCrew; + _evaluate = false; + }; + }; + + // Case where is an emplaced / static wweapon and has no alive crew and such vehicles should be 'killed' or released to players + if (_evaluate) then + { + if ( (_veh getVariable["DBD_vehType","none"] isEqualTo "emplaced") && {alive _x} count crew _veh isEqualTo 0) then + { + if (blck_killEmptyStaticWeapons) then + { + //diag_log format["_fnc_vehicleMonitor:: case of destroyed where vehicle = %1",_veh]; + + #ifdef blck_debugMode + if (blck_debugLevel > 3) then {diag_log format["_fnc_vehicleMonitor:: case of destroyed where vehicle = %1",_veh];}; + #endif + + _veh setDamage 1; + _veh setVariable["blck_DeleteAt",diag_tickTime + 60]; + }else { + [_veh] call _fn_releaseVehicle; + }; + _evaluate = false; + }; + }; + if ( (_veh getVariable["blck_DeleteAt",0]) > 0) then + { + _evaluate = false; + }; + // Case where a vehicle is NOT an emplaced / static weapon and has no alive crew and such vehicles should be 'killed' or released to players + if (_evaluate) then + { + if (_veh getVariable["DBD_vehType","none"] isEqualTo "none" && ({alive _x} count crew _veh isEqualTo 0) ) then + { + if (blck_killEmptyAIVehicles) then + { + _veh setDamage 0.7; + _veh setVariable["blck_DeleteAt",diag_tickTime + 60]; + } else { + //diag_log format["_fnc_vehicleMonitor:: case of RELEASE where vehicle = %1 and Vehicle is typeOf %2",_veh, typeOf _veh]; + [_veh] call _fn_releaseVehicle; + }; + _evaluate = false; + }; + }; + + // Case where a vehicle is part of a mission that has been completed and containes live AI. + if (_evaluate) then + { + if ( _veh getVariable["missionCompleted",0] > 0 && ({alive _x} count crew _veh > 0)) then + { + //diag_log format["_fnc_vehicleMonitor:: case of mission vehicle with AI alive at mission end: schedule destruction with _veh = %1 and typeOf _veh = %2",_veh, typeOf _veh]; + private _cleanupTimer = _veh getVariable["blck_DeleteAt",0]; // The time delete to deleting any alive AI units + if (_cleanupTimer == 0) then {_veh setVariable["blck_DeleteAt",diag_tickTime + blck_vehicleDeleteTimer]}; + if (diag_tickTime > _veh getVariable["blck_DeleteAt",0]) then + { + [_veh] call _fn_destroyVehicleAndCrew; + _evaluate = false; + }; + }; + }; + + if (_evaluate) then + { + [_veh] call _fn_reloadAmmo; + }; +}forEach _vehList; + + + diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor_updated.sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor_updated.sqf index 168fcdd..d9035b6 100644 --- a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor_updated.sqf +++ b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor_updated.sqf @@ -1,19 +1,6 @@ /* - Handle the case that all AI assigned to a vehicle are dead. - Allows players to enter and use the vehicle when appropriate - or otherwise destroys the vehicle. - - Logic: - 1) Mission ended; players can keep vehicles BUT not all vehicle AI were killed - > delete vehicle when live AI are killed; - 2) Vehicle has a blck_deleteAT timer set - > delete vehicle; - 3) All AI killed an players may NOT keep vehicles - > detroy vehicle - 4) All AI Killed and players MAY keep vehicles -> release vehicle - 5) vehicle ammo low AND vehicle gunner is alive - > reloaded - By Ghostrider [GRG] Copyright 2016 - Last updated 12-22-17 - -------------------------- License -------------------------- @@ -23,7 +10,10 @@ */ #include "\q\addons\custom_server\Configs\blck_defines.hpp"; -//diag_log format["_fnc_vehicleMonitor: starting function at diag_tickTime = %1",diag_tickTime]; +diag_log format["_fnc_vehicleMonitor: starting function at diag_tickTime = %1",diag_tickTime]; + +if (true) exitWith {}; + #ifdef blck_debugMode //diag_log format["_fnc_vehicleMonitor:: blck_debugMode defined"]; #endif @@ -44,7 +34,7 @@ _fn_releaseVehicle = { if ((damage _veh) > 0.5) then {_veh setDamage 0.5}; //diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle released to players where vehicle = %1 and blck_deleteAT = %2",_veh, _veh getVariable["blck_DeleteAt",0]]; #ifdef blck_debugMode - if (blck_debugLevel > 3) then + if (blck_debugLevel > 0) then { diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle released to players where vehicle = %1",_veh]; }; @@ -55,7 +45,7 @@ _fn_destroyVehicleAndCrew = { params["_veh"]; //private["_crew"]; //_crew = crew _veh; - //diag_log format["_fn_destroyVehicleAndCrew: called for _veh = %1",_veh]; + diag_log format["_fn_destroyVehicleAndCrew: called for _veh = %1",_veh]; {[_x] call blck_fnc_deleteAI;} forEach (crew _veh); [_veh] call blck_fn_deleteAIvehicle; }; @@ -90,7 +80,7 @@ _fn_reloadAmmo = { blck_fn_deleteAIvehicle = { params["_veh"]; - //diag_log format["blck_fn_deleteAIvehicle: _veh %1 deleted",_veh]; + diag_log format["blck_fn_deleteAIvehicle: _veh %1 deleted",_veh]; { _veh removeAllEventHandlers _x; }forEach ["Hit","HitPart","GetIn","GetOut","Fired","FiredNear","HandleDamage","Reloaded"]; @@ -101,7 +91,7 @@ blck_fn_deleteAIvehicle = { private _vehList = +blck_monitoredVehicles; #ifdef blck_debugMode -if (blck_debugLevel > 3) then {diag_log format["_fnc_vehicleMonitor:: function called at %1 with _vehList %2 and blck_monitoredVehicles %3",diag_tickTime,_vehList,blck_monitoredVehicles];}; +if (blck_debugLevel > 0) then {diag_log format["_fnc_vehicleMonitor:: function called at %1 with _vehList %2 and blck_monitoredVehicles %3",diag_tickTime,_vehList,blck_monitoredVehicles];}; #endif //blck_fnc_releaseVehicleToPlayers { @@ -118,95 +108,63 @@ if (blck_debugLevel > 3) then {diag_log format["_fnc_vehicleMonitor:: function c private _ownerIsPlayer = if (owner _veh > 2 && !(owner _veh in blck_connectedHCs)) then {true} else {false}; private _allCrewDead = {alive _x} count (crew _veh); private _deletenow = if ( (_veh getVariable["blck_DeleteAt",0] > 0) && (diag_tickTime > (_veh getVariable "blck_DeleteAt"))) then {true} else {false}; - #ifdef blck_debugMode - if (blck_debugLevel > 3) then - { - diag_log format["_fnc_vehicleMonitor: vehicle %1 with missionCompleted = %2 being evaluated",_x, _x getVariable"missionCompleted",0]; - }; - #endif + private _missionCompleted = _veh getVariable["missionCompleted",0]; private _evaluate = true; - //diag_log format["_fnc_vehicleMonitor: owner of _veh %1 isEqualTo %2",_veh, owner _veh]; + if (_ownerIsPlayer) then { - // Vehicle is NOT local to server or an HC so a player so must have been entered. + // disable further monitoring and mark to never be deleted. _evaluate = false; _veh setVariable["blck_DeleteAt",0]; blck_monitoredVehicles = blck_monitoredVehicles - [_veh]; - diag_log format["_fnc_vehicleMonitor: vehicle %1 now owned by player %2",_veh, owner _veh]; - }; - //diag_log format["_fnc_vehicleMonitor: _veh = %1 getVariable[blck_DeleteAt] = %2",_veh, _veh getVariable["blck_DeleteAt",0]]; - if (_evaluate) then - { - //diag_log format["_fnc_vehicleMonitor: deleting _veh %1 with diag_tickTime %2 and blck_deleteAT %3",_veh,diag_tickTime,_veh getVariable["blck_DeleteAt",0]]; - // Case where vehicle has been marked for deletion after a certain time. - if ( (_veh getVariable["blck_DeleteAt",0] > 0) && (diag_tickTime > (_veh getVariable "blck_DeleteAt"))) then - { - [_veh] call _fn_destroyVehicleAndCrew; - _evaluate = false; - }; + diag_log format["_fnc_vehicleMonitor: vehicle %1 now owned by player %2",_veh, owner _veh]; }; - // Case where is an emplaced / static wweapon and has no alive crew and such vehicles should be 'killed' or released to players - if (_evaluate) then + if (_allCrewDead && _evaluate) then { - if ( (_veh getVariable["DBD_vehType","none"] isEqualTo "emplaced") && {alive _x} count crew _veh isEqualTo 0) then + if (_isEmplaced) then { if (blck_killEmptyStaticWeapons) then { - //diag_log format["_fnc_vehicleMonitor:: case of destroyed where vehicle = %1",_veh]; - #ifdef blck_debugMode - if (blck_debugLevel > 3) then {diag_log format["_fnc_vehicleMonitor:: case of destroyed where vehicle = %1",_veh];}; + if (blck_debugLevel > 0) then {diag_log format["_fnc_vehicleMonitor:: case of destroyed where vehicle = %1",_veh];}; #endif - _veh setDamage 1; _veh setVariable["blck_DeleteAt",diag_tickTime + 60]; }else { [_veh] call _fn_releaseVehicle; }; - _evaluate = false; - }; - }; - if ( (_veh getVariable["blck_DeleteAt",0]) > 0) then - { - _evaluate = false; - }; - // Case where a vehicle is NOT an emplaced / static weapon and has no alive crew and such vehicles should be 'killed' or released to players - if (_evaluate) then - { - if (_veh getVariable["DBD_vehType","none"] isEqualTo "none" && ({alive _x} count crew _veh isEqualTo 0) ) then - { + _evaluate = false; + } else { if (blck_killEmptyAIVehicles) then { _veh setDamage 0.7; _veh setVariable["blck_DeleteAt",diag_tickTime + 60]; } else { - //diag_log format["_fnc_vehicleMonitor:: case of RELEASE where vehicle = %1 and Vehicle is typeOf %2",_veh, typeOf _veh]; + diag_log format["_fnc_vehicleMonitor:: case of RELEASE where vehicle = %1 and Vehicle is typeOf %2",_veh, typeOf _veh]; [_veh] call _fn_releaseVehicle; }; - _evaluate = false; + _evaluate = false; }; }; - - // Case where a vehicle is part of a mission that has been completed and containes live AI. - if (_evaluate) then + + if (_missionCompleted && !(_allCrewDead)) then { - if ( _veh getVariable["missionCompleted",0] > 0 && ({alive _x} count crew _veh > 0)) then - { - //diag_log format["_fnc_vehicleMonitor:: case of mission vehicle with AI alive at mission end: schedule destruction with _veh = %1 and typeOf _veh = %2",_veh, typeOf _veh]; - private _cleanupTimer = _veh getVariable["blck_DeleteAt",0]; // The time delete to deleting any alive AI units - if (_cleanupTimer == 0) then {_veh setVariable["blck_DeleteAt",diag_tickTime + blck_vehicleDeleteTimer]}; - if (diag_tickTime > _veh getVariable["blck_DeleteAt",0]) then - { - [_veh] call _fn_destroyVehicleAndCrew; - _evaluate = false; - }; - }; + diag_log format["_fnc_vehicleMonitor:: case of mission vehicle with AI alive at mission end: schedule destruction with _veh = %1 and typeOf _veh = %2",_veh, typeOf _veh]; + private _cleanupTimer = _veh getVariable["blck_DeleteAt",0]; // The time delete to deleting any alive AI units + if (_cleanupTimer == 0) then {_veh setVariable["blck_DeleteAt",diag_tickTime + blck_vehicleDeleteTimer]}; + _evaluate = false; }; if (_evaluate) then { [_veh] call _fn_reloadAmmo; + }; + + if (_deleteNow) then + { + [_veh] call _fn_destroyVehicleAndCrew; + _evaluate = false; }; }forEach _vehList; diff --git a/@GMS/addons/custom_server/Compiles/blck_variables.sqf b/@GMS/addons/custom_server/Compiles/blck_variables.sqf index bc43e9a..58cbf3b 100644 --- a/@GMS/addons/custom_server/Compiles/blck_variables.sqf +++ b/@GMS/addons/custom_server/Compiles/blck_variables.sqf @@ -12,8 +12,8 @@ */ #include"\q\addons\custom_server\Configs\blck_defines.hpp"; -blck_debugON = true; -blck_debugLevel = 1; // Sets level of detail for debugging info - WIP. +blck_debugON = false; +blck_debugLevel = 0; // Sets level of detail for debugging info - WIP. blck_minFPS = 8; //////////////////////////////////////////////// diff --git a/MPMissions/Exile.Altis/debug/blckconfigs.sqf b/MPMissions/Exile.Altis/debug/blckconfigs.sqf deleted file mode 100644 index 1b1ce57..0000000 --- a/MPMissions/Exile.Altis/debug/blckconfigs.sqf +++ /dev/null @@ -1,20 +0,0 @@ -//////////////////////////////////////////// -// Define configurations for the client-side of the mission system -// Last Updated 11/20/16 -// by Ghostrider-DbD- -////////////////////////////////////////// - -//diag_log "[blckeagls] initializing client variables"; -blck_MarkerPeristTime = 300; -blck_useHint = true; -blck_useSystemChat = false; -blck_useTitleText = false; -blck_useDynamic = false; -blck_useToast = false; // Exile only -blck_aiKilluseSystemChat = true; -blck_aiKilluseDynamic = false; -blck_aiKilluseTitleText = false; -blck_processingMsg = -1; -blck_processingKill = -1; - - diff --git a/MPMissions/Exile.Altis/debug/build.sqf b/MPMissions/Exile.Altis/debug/build.sqf deleted file mode 100644 index b3b85e8..0000000 --- a/MPMissions/Exile.Altis/debug/build.sqf +++ /dev/null @@ -1,3 +0,0 @@ -private ["_version","_versionDate"]; -_blck_version = "6.72 Build 78"; -_blck_versionDate = "10-01-17 4:00 PM"; diff --git a/MPMissions/Exile.Altis/debug/deleteMarker.sqf b/MPMissions/Exile.Altis/debug/deleteMarker.sqf deleted file mode 100644 index 5ad507c..0000000 --- a/MPMissions/Exile.Altis/debug/deleteMarker.sqf +++ /dev/null @@ -1,14 +0,0 @@ -//////////////////////////////////////////// -// Delete and change Mission Markers -// 7/10/15 -// by Ghostrider-DbD- -////////////////////////////////////////// -// delete a marker - -//diag_log format["blck_fnc_deleteMarker:: _this = %1",_this]; -private["_markerName"]; -_markerName = _this select 0; -deleteMarker _markerName; -_markerName = "label" + _markerName; -deleteMarker _markerName; -//diag_log format["deleteMarker complete script for _this = %1",_this]; diff --git a/MPMissions/Exile.Altis/debug/missionCompleteMarker.sqf b/MPMissions/Exile.Altis/debug/missionCompleteMarker.sqf deleted file mode 100644 index ea8eee7..0000000 --- a/MPMissions/Exile.Altis/debug/missionCompleteMarker.sqf +++ /dev/null @@ -1,19 +0,0 @@ -//////////////////////////////////////////// -// Create, delete and change Mission Markers -// 7/10/15 -// by Ghostrider-DbD- -////////////////////////////////////////// -// spawn a temporary marker to indicate the position of a 'completed' mission -// this will not show to JIP players - -private["_location","_MainMarker","_name"]; -//diag_log format["blck_fnc_missionCompleteMarker:: _this = %1",_this]; -_location = _this select 0; -_name = str(random(1000000)) + "MarkerCleared"; -_MainMarker = createMarker [_name, _location]; -_MainMarker setMarkerColor "ColorBlack"; -_MainMarker setMarkerType "n_hq"; -_MainMarker setMarkerText "Mission Cleared"; -uiSleep 300; -deleteMarker _MainMarker; -//diag_log format["missionCompleteMarker complete script for _this = %1",_this]; diff --git a/MPMissions/Exile.Altis/debug/spawnMarker.sqf b/MPMissions/Exile.Altis/debug/spawnMarker.sqf deleted file mode 100644 index 32ad44a..0000000 --- a/MPMissions/Exile.Altis/debug/spawnMarker.sqf +++ /dev/null @@ -1,99 +0,0 @@ -//////////////////////////////////////////// -// Create Mission Markers that are visible to JIP players -// 10/14/16 -// by Ghostrider-DbD- -////////////////////////////////////////// -// spawn a round marker of a size and color specified in passed parameters - -private["_blck_fn_configureRoundMarker"]; - -private["_blck_fn_configureRoundMarker"]; -_blck_fn_configureRoundMarker = { - private["_name","_pos","_color","_size","_MainMarker","_labelType"]; - //diag_log format["_blck_fn_configureRoundMarker: -: _this = %1", _this]; - params["_name","_pos","_color","_text","_size","_labelType"]; - /* - _name = _this select 0; - _pos = _this select 1; - _color = _this select 2; - _text = _this select 3; - _size = _this select 4; - _labelType = _this select 5; - //_shape = _this select 6; - //_brush = _this select 7; - */ - //diag_log format["_blck_fn_configureRoundMarker: _pos = %1, _color = %2, _size = %3, _name = %4, label %5",_pos, _color, _size, _name, _text]; - // Do not show the marker if it is in the left upper corner - if ((_pos distance [0,0,0]) < 10) exitWith {}; - - _MainMarker = createMarker [_name, _pos]; - _MainMarker setMarkerColor _color; - _MainMarker setMarkerShape "ELLIPSE"; - _MainMarker setMarkerBrush "Grid"; - _MainMarker setMarkerSize _size; // - //diag_log format["_blck_fn_configureRoundMarker: -: _labelType = %1", _labelType]; - if (count toArray(_text) > 0) then - { - switch (_labelType) do { - case "arrow": - { - //diag_log "++++++++++++++--- marker label arrow detected"; - _name = "label" + _name; - _textPos = [(_pos select 0) + (count toArray (_text) * 12), (_pos select 1) - (_size select 0), 0]; - _MainMarker = createMarker [_name, _textPos]; - _MainMarker setMarkerShape "Icon"; - _MainMarker setMarkerType "HD_Arrow"; - _MainMarker setMarkerColor "ColorBlack"; - _MainMarker setMarkerText _text; - //_MainMarker setMarkerDir 37; - }; - case "center": - { - //diag_log "++++++++++++++--- marker label dot detected"; - _name = "label" + _name; - _MainMarker = createMarker [_name, _pos]; - _MainMarker setMarkerShape "Icon"; - _MainMarker setMarkerType "mil_dot"; - _MainMarker setMarkerColor "ColorBlack"; - _MainMarker setMarkerText _text; - }; - }; - }; -}; - -_blck_fn_configureIconMarker = { - private["_MainMarker"]; - params["_name","_pos",["_color","ColorBlack"],["_text",""],["_icon","mil_triangle"]]; - //diag_log format["_blck_fn_configureIconMarker: _name=%1; _pos=%2; _color=%3; _text=%4",_name,_pos,_color,_text]; - - _name = "label" + _name; - _MainMarker = createMarker [_name, _pos]; - _MainMarker setMarkerShape "Icon"; - _MainMarker setMarkerType _icon; - _MainMarker setMarkerColor _color; - _MainMarker setMarkerText _text; -}; - -//diag_log format["spawnMarker:: -- >> _this = %1",_this]; -// _this = [[""BlueMarker"",[12524.1,18204.7,0],""Bandit Patrol"",""center"",""ColorBlue"",[""ELIPSE"",[175,175]]],""ColorBlue"",""BlueMarker""]" -params["_mArray"]; - -_mArray params["_missionType","_markerPos","_markerLabel","_markerLabelType","_markerColor","_markerType"]; -_markerType params["_mShape","_mSize","_mBrush"]; -//diag_log format["spawnMarker.sqf:: -- >> _missionType %1 | _markerPos %2 | _markerLabel %3 | _markerLabelType %4 | _markerColor %5 | _markerType %6",_missionType,_markerPos,_markerLabel,_markerLabelType,_markerColor,_markerType]; - -if ((_markerType select 0) in ["ELIPSE","RECTANGLE"]) then // not an Icon .... -{ - switch (_missionType) do { - // params["_missionType","_pos","_text","_labelType","_color","_type","_size","_brush"]; - // Type Size Brush - default {[_missionType,_markerPos,_markerColor,_markerLabel, _mSize,_markerLabelType,_mShape,_mBrush] call _blck_fn_configureRoundMarker;}; - }; -}; -if !((_markerType select 0) in ["ELIPSE","RECTANGLE"]) then -{ // Deal with case of an icon - // params["_name","_pos",["_color","ColorBlack"],["_text",""],["_icon","mil_triangle"]]; - [_missionType,_markerPos, _markerColor,_markerLabel,_markerType select 0] call _blck_fn_configureIconMarker; -}; -//diag_log format["spawnMarker complete script for _this = %1",_this]; - diff --git a/MPMissions/Exile.Altis/debug/versionCheck.sqf b/MPMissions/Exile.Altis/debug/versionCheck.sqf deleted file mode 100644 index 9ef231a..0000000 --- a/MPMissions/Exile.Altis/debug/versionCheck.sqf +++ /dev/null @@ -1,187 +0,0 @@ -//////////////////////////////////////////// -// Start Server-side functions and Create, Display Mission Messages for blckeagls mission system for Arma 3 Epoch -// Last Updated 1/11/17 -// by Ghostrider-DbD- -////////////////////////////////////////// -blck_fnc_spawnMarker = compileFinal preprocessfilelinenumbers "debug\spawnMarker.sqf"; -blck_fnc_deleteMarker = compileFinal preprocessfilelinenumbers "debug\deleteMarker.sqf"; -blck_fnc_missionCompleteMarker = compileFinal preprocessfilelinenumbers "debug\missionCompleteMarker.sqf"; -if !(isServer) then -{ - //diag_log "[blckeagls] initializing client variables"; - blck_MarkerPeristTime = 300; - blck_useHint = false; - blck_useSystemChat = true; - blck_useTitleText = false; - blck_useDynamic = true; - blck_useToast = false; // Exile only - blck_aiKilluseSystemChat = true; - blck_aiKilluseDynamic = false; - blck_aiKilluseTitleText = false; - blck_processingMsg = -1; - blck_processingKill = -1; - blck_message = ""; - - fn_killScoreNotification = { - params["_bonus","_distanceBonus","_killStreak"]; - //diag_log format["fn_killScoreNotification:: -- >> _bonus = %1 | _distanceBonus = %2 | _killStreak = %3",_bonus,_distanceBonus,_killStreak]; - _msg2 = format["AI Killed
"]; - if (typeName _bonus isEqualTo "SCALAR") then // add message for the bonus - { - if (_bonus > 0) then - { - _msg2 = _msg2 + format["Bonus +%1
",_bonus]; - }; - }; - if (typeName _distanceBonus isEqualTo "SCALAR") then // Add message for distance bonus - { - if (_distanceBonus > 0) then - { - _msg2 = _msg2 + format["Dist Bonus +%1
",_distanceBonus]; - }; - }; - if (typeName _killStreak isEqualTo "SCALAR") then - { - if (_killStreak > 0) then - { - _msg2 = _msg2 + format["Killstreak %1X
",_killStreak]; - }; - }; - [parseText _msg2,[0.0823437 * safezoneW + safezoneX,0.379 * safezoneH + safezoneY,0.0812109 * safezoneW,0.253 * safezoneH], nil, 7, 0.3, 0] spawn BIS_fnc_textTiles; - }; - - fn_dynamicNotification = { - private["_text","_screentime","_xcoord","_ycoord"]; - params["_mission","_message"]; - - waitUntil {blck_processingMsg < 0}; - blck_processingMsg = 1; - _screentime = 7; - _text = format[ - "%1

- %2
", - _mission,_message - ]; - _ycoord = [safezoneY + safezoneH - 0.8,0.7]; - _xcoord = [safezoneX + safezoneW - 0.5,0.35]; - [_text,_xcoord,_ycoord,_screentime,0.5] spawn BIS_fnc_dynamicText; - uiSleep 3; // 3 second delay before the next message - blck_processingMsg = -1; - }; - - //diag_log "[blckeagls] initializing client functions"; - fn_missionNotification = { - params["_event","_message","_mission"]; - - if (blck_useSystemChat) then {systemChat format["%1",_message];}; - if (blck_useHint) then { - hint parseText format[ - "%1
- ______________

- %2
- ______________

- Any loot you find is yours as payment for eliminating the threat!",_mission,_message - ]; - }; - if (blck_useDynamic) then { - [_mission,_message] call fn_dynamicNotification; - }; - if (blck_useTitleText) then { - [_message] spawn { - params["_msg"]; - titleText [_msg, "PLAIN DOWN",5];uiSleep 5; titleText ["", "PLAIN DOWN",5] - }; - }; - if (blck_useToast) then - { - ["InfoTitleAndText", [_mission, _message]] call ExileClient_gui_toaster_addTemplateToast; - }; - //diag_log format["_fn_missionNotification ====] Paremeters _event %1 _message %2 _mission %3",_event,_message,_mission]; - }; - - fn_AI_KilledNotification = { - private["_message","_text","_screentime","_xcoord","_ycoord"]; - _message = _this select 0; - //diag_log format["_fn_AI_KilledNotification ====] Paremeters _event %1 _message %2 _mission %3",_message]; - if (blck_aiKilluseSystemChat) then {systemChat format["%1",_message];}; - if (blck_aiKilluseTitleText) then {titleText [_message, "PLAIN DOWN",5];uiSleep 5; titleText ["", "PLAIN DOWN",5]}; - if (blck_aiKilluseDynamic) then { - //diag_log format["blckClient.sqf:: dynamic messaging called for mission %2 with message of %1",_message]; - waitUntil{blck_processingKill < 0}; - blck_processingKill = 1; - _text = format["%1",_message]; - _xcoord = [safezoneX,0.8]; - _ycoord = [safezoneY + safezoneH - 0.5,0.2]; - _screentime = 5; - [" "+ _text,_xcoord,_ycoord,_screentime] spawn BIS_fnc_dynamicText; - uiSleep 3; - blck_processingKill = -1; - }; - }; - - fn_handleMessage = { - //private["_event","_msg","_mission"]; - //diag_log format["blck_Message ====] Paremeters = _this = %1",_this]; - params["_event","_message",["_mission",""]]; - - //diag_log format["blck_Message ====] Paremeters _event %1 _message %2 paramter #3 %3",_event,_message,_mission]; - //diag_log format["blck_Message ====] _message isEqualTo %1",_message]; - - switch (_event) do - { - case "start": - { - playSound "UAV_05"; - //diag_log "switch start"; - //_mission = _this select 1 select 2; - [_event,_message,_mission] spawn fn_missionNotification; - }; - case "end": - { - playSound "UAV_03"; - //diag_log "switch end"; - //_mission = _this select 1 select 2; - [_event,_message,_mission] spawn fn_missionNotification; - }; - case "aikilled": - { - //diag_log "switch aikilled"; - [_message] spawn fn_AI_KilledNotification; - }; - case "DLS": - { - if ( (player distance _mission) < 1000) then {playsound "AddItemOK"; hint _message;systemChat _message}; - }; - case "reinforcements": - { - if ( (player distance _mission) < 1000) then {playsound "AddItemOK"; ["Alert",_message] call fn_dynamicNotification;}; - //diag_log "---->>>> Reinforcements Spotted"; - }; - case "IED": - { - [1] call BIS_fnc_Earthquake; - //["IED","Bandits targeted your vehicle with an IED"] call fn_dynamicNotification; - ["Bandits targeted your vehicle with an IED.", 5] call Epoch_message; - for "_i" from 1 to 3 do {playSound "BattlefieldExplosions3_3D";uiSleep 0.3;}; - }; - case "showScore": - { - [_message select 0, _message select 1, _message select 2] call fn_killScoreNotification; - }; - }; - - }; - - diag_log "blck client loaded ver 1/11/17 2.0 8 PM"; - diag_log "[blckeagls] starting client loop"; - - while {true} do - { - waitUntil {!(blck_message isEqualTo "")}; - //diag_log format["[blckClient] blck_Message = %1", blck_message]; - private["_message"]; - _message = blck_message; - _message spawn fn_handleMessage; - blck_Message = ""; - }; -}; \ No newline at end of file diff --git a/MPMissions/epoch.Altis/debug/blckconfigs.sqf b/MPMissions/epoch.Altis/debug/blckconfigs.sqf deleted file mode 100644 index 1b1ce57..0000000 --- a/MPMissions/epoch.Altis/debug/blckconfigs.sqf +++ /dev/null @@ -1,20 +0,0 @@ -//////////////////////////////////////////// -// Define configurations for the client-side of the mission system -// Last Updated 11/20/16 -// by Ghostrider-DbD- -////////////////////////////////////////// - -//diag_log "[blckeagls] initializing client variables"; -blck_MarkerPeristTime = 300; -blck_useHint = true; -blck_useSystemChat = false; -blck_useTitleText = false; -blck_useDynamic = false; -blck_useToast = false; // Exile only -blck_aiKilluseSystemChat = true; -blck_aiKilluseDynamic = false; -blck_aiKilluseTitleText = false; -blck_processingMsg = -1; -blck_processingKill = -1; - - diff --git a/MPMissions/epoch.Altis/debug/build.sqf b/MPMissions/epoch.Altis/debug/build.sqf deleted file mode 100644 index b3b85e8..0000000 --- a/MPMissions/epoch.Altis/debug/build.sqf +++ /dev/null @@ -1,3 +0,0 @@ -private ["_version","_versionDate"]; -_blck_version = "6.72 Build 78"; -_blck_versionDate = "10-01-17 4:00 PM"; diff --git a/MPMissions/epoch.Altis/debug/deleteMarker.sqf b/MPMissions/epoch.Altis/debug/deleteMarker.sqf deleted file mode 100644 index 5ad507c..0000000 --- a/MPMissions/epoch.Altis/debug/deleteMarker.sqf +++ /dev/null @@ -1,14 +0,0 @@ -//////////////////////////////////////////// -// Delete and change Mission Markers -// 7/10/15 -// by Ghostrider-DbD- -////////////////////////////////////////// -// delete a marker - -//diag_log format["blck_fnc_deleteMarker:: _this = %1",_this]; -private["_markerName"]; -_markerName = _this select 0; -deleteMarker _markerName; -_markerName = "label" + _markerName; -deleteMarker _markerName; -//diag_log format["deleteMarker complete script for _this = %1",_this]; diff --git a/MPMissions/epoch.Altis/debug/missionCompleteMarker.sqf b/MPMissions/epoch.Altis/debug/missionCompleteMarker.sqf deleted file mode 100644 index ea8eee7..0000000 --- a/MPMissions/epoch.Altis/debug/missionCompleteMarker.sqf +++ /dev/null @@ -1,19 +0,0 @@ -//////////////////////////////////////////// -// Create, delete and change Mission Markers -// 7/10/15 -// by Ghostrider-DbD- -////////////////////////////////////////// -// spawn a temporary marker to indicate the position of a 'completed' mission -// this will not show to JIP players - -private["_location","_MainMarker","_name"]; -//diag_log format["blck_fnc_missionCompleteMarker:: _this = %1",_this]; -_location = _this select 0; -_name = str(random(1000000)) + "MarkerCleared"; -_MainMarker = createMarker [_name, _location]; -_MainMarker setMarkerColor "ColorBlack"; -_MainMarker setMarkerType "n_hq"; -_MainMarker setMarkerText "Mission Cleared"; -uiSleep 300; -deleteMarker _MainMarker; -//diag_log format["missionCompleteMarker complete script for _this = %1",_this]; diff --git a/MPMissions/epoch.Altis/debug/spawnMarker.sqf b/MPMissions/epoch.Altis/debug/spawnMarker.sqf deleted file mode 100644 index 32ad44a..0000000 --- a/MPMissions/epoch.Altis/debug/spawnMarker.sqf +++ /dev/null @@ -1,99 +0,0 @@ -//////////////////////////////////////////// -// Create Mission Markers that are visible to JIP players -// 10/14/16 -// by Ghostrider-DbD- -////////////////////////////////////////// -// spawn a round marker of a size and color specified in passed parameters - -private["_blck_fn_configureRoundMarker"]; - -private["_blck_fn_configureRoundMarker"]; -_blck_fn_configureRoundMarker = { - private["_name","_pos","_color","_size","_MainMarker","_labelType"]; - //diag_log format["_blck_fn_configureRoundMarker: -: _this = %1", _this]; - params["_name","_pos","_color","_text","_size","_labelType"]; - /* - _name = _this select 0; - _pos = _this select 1; - _color = _this select 2; - _text = _this select 3; - _size = _this select 4; - _labelType = _this select 5; - //_shape = _this select 6; - //_brush = _this select 7; - */ - //diag_log format["_blck_fn_configureRoundMarker: _pos = %1, _color = %2, _size = %3, _name = %4, label %5",_pos, _color, _size, _name, _text]; - // Do not show the marker if it is in the left upper corner - if ((_pos distance [0,0,0]) < 10) exitWith {}; - - _MainMarker = createMarker [_name, _pos]; - _MainMarker setMarkerColor _color; - _MainMarker setMarkerShape "ELLIPSE"; - _MainMarker setMarkerBrush "Grid"; - _MainMarker setMarkerSize _size; // - //diag_log format["_blck_fn_configureRoundMarker: -: _labelType = %1", _labelType]; - if (count toArray(_text) > 0) then - { - switch (_labelType) do { - case "arrow": - { - //diag_log "++++++++++++++--- marker label arrow detected"; - _name = "label" + _name; - _textPos = [(_pos select 0) + (count toArray (_text) * 12), (_pos select 1) - (_size select 0), 0]; - _MainMarker = createMarker [_name, _textPos]; - _MainMarker setMarkerShape "Icon"; - _MainMarker setMarkerType "HD_Arrow"; - _MainMarker setMarkerColor "ColorBlack"; - _MainMarker setMarkerText _text; - //_MainMarker setMarkerDir 37; - }; - case "center": - { - //diag_log "++++++++++++++--- marker label dot detected"; - _name = "label" + _name; - _MainMarker = createMarker [_name, _pos]; - _MainMarker setMarkerShape "Icon"; - _MainMarker setMarkerType "mil_dot"; - _MainMarker setMarkerColor "ColorBlack"; - _MainMarker setMarkerText _text; - }; - }; - }; -}; - -_blck_fn_configureIconMarker = { - private["_MainMarker"]; - params["_name","_pos",["_color","ColorBlack"],["_text",""],["_icon","mil_triangle"]]; - //diag_log format["_blck_fn_configureIconMarker: _name=%1; _pos=%2; _color=%3; _text=%4",_name,_pos,_color,_text]; - - _name = "label" + _name; - _MainMarker = createMarker [_name, _pos]; - _MainMarker setMarkerShape "Icon"; - _MainMarker setMarkerType _icon; - _MainMarker setMarkerColor _color; - _MainMarker setMarkerText _text; -}; - -//diag_log format["spawnMarker:: -- >> _this = %1",_this]; -// _this = [[""BlueMarker"",[12524.1,18204.7,0],""Bandit Patrol"",""center"",""ColorBlue"",[""ELIPSE"",[175,175]]],""ColorBlue"",""BlueMarker""]" -params["_mArray"]; - -_mArray params["_missionType","_markerPos","_markerLabel","_markerLabelType","_markerColor","_markerType"]; -_markerType params["_mShape","_mSize","_mBrush"]; -//diag_log format["spawnMarker.sqf:: -- >> _missionType %1 | _markerPos %2 | _markerLabel %3 | _markerLabelType %4 | _markerColor %5 | _markerType %6",_missionType,_markerPos,_markerLabel,_markerLabelType,_markerColor,_markerType]; - -if ((_markerType select 0) in ["ELIPSE","RECTANGLE"]) then // not an Icon .... -{ - switch (_missionType) do { - // params["_missionType","_pos","_text","_labelType","_color","_type","_size","_brush"]; - // Type Size Brush - default {[_missionType,_markerPos,_markerColor,_markerLabel, _mSize,_markerLabelType,_mShape,_mBrush] call _blck_fn_configureRoundMarker;}; - }; -}; -if !((_markerType select 0) in ["ELIPSE","RECTANGLE"]) then -{ // Deal with case of an icon - // params["_name","_pos",["_color","ColorBlack"],["_text",""],["_icon","mil_triangle"]]; - [_missionType,_markerPos, _markerColor,_markerLabel,_markerType select 0] call _blck_fn_configureIconMarker; -}; -//diag_log format["spawnMarker complete script for _this = %1",_this]; - diff --git a/MPMissions/epoch.Altis/debug/versionCheck.sqf b/MPMissions/epoch.Altis/debug/versionCheck.sqf deleted file mode 100644 index 9ef231a..0000000 --- a/MPMissions/epoch.Altis/debug/versionCheck.sqf +++ /dev/null @@ -1,187 +0,0 @@ -//////////////////////////////////////////// -// Start Server-side functions and Create, Display Mission Messages for blckeagls mission system for Arma 3 Epoch -// Last Updated 1/11/17 -// by Ghostrider-DbD- -////////////////////////////////////////// -blck_fnc_spawnMarker = compileFinal preprocessfilelinenumbers "debug\spawnMarker.sqf"; -blck_fnc_deleteMarker = compileFinal preprocessfilelinenumbers "debug\deleteMarker.sqf"; -blck_fnc_missionCompleteMarker = compileFinal preprocessfilelinenumbers "debug\missionCompleteMarker.sqf"; -if !(isServer) then -{ - //diag_log "[blckeagls] initializing client variables"; - blck_MarkerPeristTime = 300; - blck_useHint = false; - blck_useSystemChat = true; - blck_useTitleText = false; - blck_useDynamic = true; - blck_useToast = false; // Exile only - blck_aiKilluseSystemChat = true; - blck_aiKilluseDynamic = false; - blck_aiKilluseTitleText = false; - blck_processingMsg = -1; - blck_processingKill = -1; - blck_message = ""; - - fn_killScoreNotification = { - params["_bonus","_distanceBonus","_killStreak"]; - //diag_log format["fn_killScoreNotification:: -- >> _bonus = %1 | _distanceBonus = %2 | _killStreak = %3",_bonus,_distanceBonus,_killStreak]; - _msg2 = format["AI Killed
"]; - if (typeName _bonus isEqualTo "SCALAR") then // add message for the bonus - { - if (_bonus > 0) then - { - _msg2 = _msg2 + format["Bonus +%1
",_bonus]; - }; - }; - if (typeName _distanceBonus isEqualTo "SCALAR") then // Add message for distance bonus - { - if (_distanceBonus > 0) then - { - _msg2 = _msg2 + format["Dist Bonus +%1
",_distanceBonus]; - }; - }; - if (typeName _killStreak isEqualTo "SCALAR") then - { - if (_killStreak > 0) then - { - _msg2 = _msg2 + format["Killstreak %1X
",_killStreak]; - }; - }; - [parseText _msg2,[0.0823437 * safezoneW + safezoneX,0.379 * safezoneH + safezoneY,0.0812109 * safezoneW,0.253 * safezoneH], nil, 7, 0.3, 0] spawn BIS_fnc_textTiles; - }; - - fn_dynamicNotification = { - private["_text","_screentime","_xcoord","_ycoord"]; - params["_mission","_message"]; - - waitUntil {blck_processingMsg < 0}; - blck_processingMsg = 1; - _screentime = 7; - _text = format[ - "%1

- %2
", - _mission,_message - ]; - _ycoord = [safezoneY + safezoneH - 0.8,0.7]; - _xcoord = [safezoneX + safezoneW - 0.5,0.35]; - [_text,_xcoord,_ycoord,_screentime,0.5] spawn BIS_fnc_dynamicText; - uiSleep 3; // 3 second delay before the next message - blck_processingMsg = -1; - }; - - //diag_log "[blckeagls] initializing client functions"; - fn_missionNotification = { - params["_event","_message","_mission"]; - - if (blck_useSystemChat) then {systemChat format["%1",_message];}; - if (blck_useHint) then { - hint parseText format[ - "%1
- ______________

- %2
- ______________

- Any loot you find is yours as payment for eliminating the threat!",_mission,_message - ]; - }; - if (blck_useDynamic) then { - [_mission,_message] call fn_dynamicNotification; - }; - if (blck_useTitleText) then { - [_message] spawn { - params["_msg"]; - titleText [_msg, "PLAIN DOWN",5];uiSleep 5; titleText ["", "PLAIN DOWN",5] - }; - }; - if (blck_useToast) then - { - ["InfoTitleAndText", [_mission, _message]] call ExileClient_gui_toaster_addTemplateToast; - }; - //diag_log format["_fn_missionNotification ====] Paremeters _event %1 _message %2 _mission %3",_event,_message,_mission]; - }; - - fn_AI_KilledNotification = { - private["_message","_text","_screentime","_xcoord","_ycoord"]; - _message = _this select 0; - //diag_log format["_fn_AI_KilledNotification ====] Paremeters _event %1 _message %2 _mission %3",_message]; - if (blck_aiKilluseSystemChat) then {systemChat format["%1",_message];}; - if (blck_aiKilluseTitleText) then {titleText [_message, "PLAIN DOWN",5];uiSleep 5; titleText ["", "PLAIN DOWN",5]}; - if (blck_aiKilluseDynamic) then { - //diag_log format["blckClient.sqf:: dynamic messaging called for mission %2 with message of %1",_message]; - waitUntil{blck_processingKill < 0}; - blck_processingKill = 1; - _text = format["%1",_message]; - _xcoord = [safezoneX,0.8]; - _ycoord = [safezoneY + safezoneH - 0.5,0.2]; - _screentime = 5; - [" "+ _text,_xcoord,_ycoord,_screentime] spawn BIS_fnc_dynamicText; - uiSleep 3; - blck_processingKill = -1; - }; - }; - - fn_handleMessage = { - //private["_event","_msg","_mission"]; - //diag_log format["blck_Message ====] Paremeters = _this = %1",_this]; - params["_event","_message",["_mission",""]]; - - //diag_log format["blck_Message ====] Paremeters _event %1 _message %2 paramter #3 %3",_event,_message,_mission]; - //diag_log format["blck_Message ====] _message isEqualTo %1",_message]; - - switch (_event) do - { - case "start": - { - playSound "UAV_05"; - //diag_log "switch start"; - //_mission = _this select 1 select 2; - [_event,_message,_mission] spawn fn_missionNotification; - }; - case "end": - { - playSound "UAV_03"; - //diag_log "switch end"; - //_mission = _this select 1 select 2; - [_event,_message,_mission] spawn fn_missionNotification; - }; - case "aikilled": - { - //diag_log "switch aikilled"; - [_message] spawn fn_AI_KilledNotification; - }; - case "DLS": - { - if ( (player distance _mission) < 1000) then {playsound "AddItemOK"; hint _message;systemChat _message}; - }; - case "reinforcements": - { - if ( (player distance _mission) < 1000) then {playsound "AddItemOK"; ["Alert",_message] call fn_dynamicNotification;}; - //diag_log "---->>>> Reinforcements Spotted"; - }; - case "IED": - { - [1] call BIS_fnc_Earthquake; - //["IED","Bandits targeted your vehicle with an IED"] call fn_dynamicNotification; - ["Bandits targeted your vehicle with an IED.", 5] call Epoch_message; - for "_i" from 1 to 3 do {playSound "BattlefieldExplosions3_3D";uiSleep 0.3;}; - }; - case "showScore": - { - [_message select 0, _message select 1, _message select 2] call fn_killScoreNotification; - }; - }; - - }; - - diag_log "blck client loaded ver 1/11/17 2.0 8 PM"; - diag_log "[blckeagls] starting client loop"; - - while {true} do - { - waitUntil {!(blck_message isEqualTo "")}; - //diag_log format["[blckClient] blck_Message = %1", blck_message]; - private["_message"]; - _message = blck_message; - _message spawn fn_handleMessage; - blck_Message = ""; - }; -}; \ No newline at end of file From 7982307a4e13291784dced1b059272cc84a20978 Mon Sep 17 00:00:00 2001 From: Ghostrider-GRG- Date: Tue, 20 Feb 2018 21:50:31 -0500 Subject: [PATCH 3/4] Added mission hellis to list of monitored vehicles. --- .../Compiles/Missions/GMS_fnc_missionSpawner.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 0ea4632..49efadd 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf @@ -330,7 +330,7 @@ if (_allowReinforcements) then if (typeName _temp isEqualTo "ARRAY") then { _abort = _temp select 2; - _objects pushback (_temp select 0); + blck_monitoredVehicles pushBack (_temp select 0); _blck_AllMissionAI append (_temp select 1); }; if (_abort) then @@ -341,7 +341,7 @@ if (_allowReinforcements) then diag_log "missionSpawner:: (349) grpNul or ERROR in blck_fnc_spawnMissionReinforcements, mission termination criteria met, calling blck_endMission"; }; #endif - + _objects pushback (_temp select 0); [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,1] call blck_fnc_endMission; }; }; From 399af617e8ad84172a739d0503a3996efd5ae95c Mon Sep 17 00:00:00 2001 From: Ghostrider-GRG- Date: Sun, 25 Feb 2018 08:02:08 -0500 Subject: [PATCH 4/4] Add optional ability to defin lists of vehicles for patrols based on AI difficulty settings. --- .../GMS_fnc_missionSpawner - Copy (2).sqf | 522 ++++++++++++++++++ .../GMS_fnc_spawnMissionVehiclePatrols.sqf | 3 +- .../Vehicles/GMS_fnc_selectPatrolVehicle.sqf | 27 + .../custom_server/Compiles/blck_functions.sqf | 3 +- .../Configs/blck_configs_epoch.sqf | 4 + .../Configs/blck_configs_exile_mil.sqf | 6 +- .../custom_server/Configs/blck_defines.hpp | 2 +- .../Static/Code/GMS_fnc_sm_spawnMission.sqf | 2 +- .../Code/GMS_sm_spawnVehiclePatrols.sqf | 3 +- changeLog.sqf | 10 +- 10 files changed, 574 insertions(+), 8 deletions(-) create mode 100644 @GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy (2).sqf create mode 100644 @GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_selectPatrolVehicle.sqf diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy (2).sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy (2).sqf new file mode 100644 index 0000000..49efadd --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy (2).sqf @@ -0,0 +1,522 @@ +/* + Generic Mission Spawner + By Ghostrider GRG + Copyright 2016 + Last modified 10/9/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 delayTime 1 +private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_AI_Vehicles","_timeOut","_aiDifficultyLevel","_missionPatrolVehicles","_missionGroups"]; +params["_coords","_mission",["_allowReinforcements",true]]; +//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 select 2; +_aiDifficultyLevel = _mission select 3; + +[_mission,"active",_coords] call blck_fnc_updateMissionQue; +blck_ActiveMissionCoords pushback _coords; +diag_log format["[blckeagls] missionSpawner (17):: 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 "_missionPatrolVehicles") then { + //diag_log format["_missionSpawner (44):: _missionPatrolVehicles isNil, Definining it as an empty array"]; + _missionPatrolVehicles = []; + //diag_log format["_missionSpawner (46):: _missionPatrolVehicles is %1",_missionPatrolVehicles]; +}; +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; +private _marker = [_blck_localMissionMarker] call blck_fnc_spawnMarker; + +#ifdef blck_debugMode +if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (77) message players and spawn a mission marker";}; +if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (77) _marker = %1",_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"}; +#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["missionSpawner:: Trigger Loop - blck_debugLevel = %1 and _coords = %2",blck_debugLevel, _coords]; + diag_log format["missionSpawner:: Trigger Loop - players in range = %1",{isPlayer _x && _x distance2D _coords < blck_TriggerDistance} count allPlayers]; + diag_log format["missionSpawner:: 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_recentMissionCoords pushback [_coords,diag_tickTime]; + blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords]; + [_mission,"inactive",[0,0,0]] call blck_fnc_updateMissionQue; + blck_missionsRunning = blck_missionsRunning - 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] missionSpawner:: (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] missionSpawner:: (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["_missionSpawner"" _missionLandscape = %1",_missionLandscape]; +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; + //uiSleep 1; +}; +if (typeName _temp isEqualTo "ARRAY") then +{ + _objects append _temp; +}; +//diag_log format["_fnc_missionSpawner:: (181)->> _objects = %1",_objects]; + +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] missionSpawner:: (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]; +_temp = [_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear,_missionGroups] call blck_fnc_spawnMissionAI; + +#ifdef blck_debugMode +if (blck_debugLevel > 2) then { + diag_log format["missionSpawner :: (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["missionSpawner :: (214) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1; +}; +#endif + +if (_abort) exitWith +{ + if (blck_debugLevel > 1) then { + diag_log "missionSpawner:: (220) grpNull returned, mission termination criteria met, calling blck_fnc_endMission" + }; + [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,1] call blck_fnc_endMission; +}; +if !(_abort) then +{ + _blck_AllMissionAI append (_temp select 0); +}; + +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] missionSpawner:: (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"]; +_vehToSpawn = [_noVehiclePatrols] call blck_fnc_getNumberFromRange; +//diag_log format["_missionSpawner:: _vehToSpawn = %1",_vehToSpawn]; +//diag_log format["_missionSpawner (245):: _missionPatrolVehicles = %1",_missionPatrolVehicles]; +if (blck_useVehiclePatrols && ((_vehToSpawn > 0) || count _missionPatrolVehicles > 0)) then +{ + _temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_missionPatrolVehicles] 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["missionSpawner :: (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] missionSpawner:: (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 "missionSpawner:: (279) grpNull returned, mission termination criteria met, calling blck_endMission"; + }; + #endif + + [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,1] 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] missionSpawner:: (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.5; + 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["_missionSpawner(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["missionSpawner(334):: blck_fnc_spawnMissionReinforcements call for chopper # %1 out of a total of %2 choppers",_i, _noChoppers]; + diag_log format["missionSpawner(335):: _temp = %1",_temp]; + }; + #endif + + 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 + { + #ifdef blck_debugMode + if (blck_debugLevel > 2) then + { + diag_log "missionSpawner:: (349) grpNul or ERROR in blck_fnc_spawnMissionReinforcements, mission termination criteria met, calling blck_endMission"; + }; + #endif + _objects pushback (_temp select 0); + [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,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["missionSpawner:: (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["_missionSpawner:: _noEmplacedToSpawn = %1",_vehToSpawn]; +if (blck_useStatic && (_noEmplacedToSpawn > 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 ["missionSpawner:: (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 ["missionSpawner:: (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] missionSpawner:: (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 "missionSpawner:: (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] call blck_fnc_endMission; +}; + +uiSleep _delayTime; +if (count _missionLootBoxes > 0) then +{ + _crates = [_coords,_missionLootBoxes,_loadCratesTiming] call blck_fnc_spawnMissionCrates; +} +else +{ + _crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming] call blck_fnc_spawnMissionCrates; + +}; + +if (blck_cleanUpLootChests) then +{ + _objects append _crates; +}; + +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] missionSpawner:: (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["_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;}; + case "allUnitsKilled": {_endIfPlayerNear = false;_endIfAIKilled = true;}; + case "allKilledOrPlayerNear": {_endIfPlayerNear = true;_endIfAIKilled = true;}; +}; +#ifdef blck_debugMode +diag_log format["missionSpawner :: (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["missionSpawner (458):: _coords = %1 | _crates = %2 | _locations = %3",_coords,_crates,_locations]; +#endif +private _crateStolen = false; +#ifdef blck_debugMode +diag_log format["missionSpawner(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; +}; +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["missionSpawner:: (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["missionSpawner:: (491) 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] call blck_fnc_endMission; +}; +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] missionSpawner:: (496) Mission completion criteria fulfilled: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + diag_log format["missionSpawner :: (497) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled]; + diag_log format["[blckeagls] missionSpawner:: (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]; + // blck_missionMarkers pushBack [_marker, _markerMissionName, _blck_AllMissionAI]; + { + if ((_x select 1) isEqualTo _markerMissionName) exitWith{blck_missionMarkers deleteAt _forEachIndex}; + }forEach blck_missionMarkers; +}; +_result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,0] call blck_fnc_endMission; + + +diag_log format["[blckeagls] missionSpawner:: (507)end of mission: blck_fnc_endMission has returned control to _fnc_missionSpawner"]; + diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionVehiclePatrols.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionVehiclePatrols.sqf index 94c6a72..d6179f4 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionVehiclePatrols.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionVehiclePatrols.sqf @@ -34,7 +34,8 @@ if (_missionPatrolVehicles isEqualTo []) then _useRelativePos = false; _vehiclePatrolSpawns = [_coords,_noVehiclePatrols,45,60] call blck_fnc_findPositionsAlongARadius; { - private _v = selectRandom blck_AIPatrolVehicles; + //private _v = selectRandom blck_AIPatrolVehicles; + private _v = [_aiDifficultyLevel] call blck_fnc_selectPatrolVehicle; //diag_log format["_fnc_spawnMissionVehiclePatrols (36):: position = %1 and vehicle = %2",_x, _v]; _missionPatrolVehicles pushBack [_v, _x]; }forEach _vehiclePatrolSpawns; diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_selectPatrolVehicle.sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_selectPatrolVehicle.sqf new file mode 100644 index 0000000..a80d171 --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_selectPatrolVehicle.sqf @@ -0,0 +1,27 @@ +/* + By Ghostrider [GRG] + Copyright 2016 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +params["_aiDifficulty"]; +private["_vehicle"]; +switch(toLower _aiDifficulty) do +{ + case "blue":{_vehicle = selectRandom blck_AIPatrolVehiclesBlue}; + case "red":{_vehicle = selectRandom blck_AIPatrolVehiclesRed}; + case "green":{_vehicle = selectRandom blck_AIPatrolVehiclesGreen}; + case "orange":{_vehicle = selectRandom blck_AIPatrolVehiclesOrange}; + default {_vehicle = blck_AIPatrolVehicles}; +}; + +_vehicle + + + diff --git a/@GMS/addons/custom_server/Compiles/blck_functions.sqf b/@GMS/addons/custom_server/Compiles/blck_functions.sqf index 1b623f0..851c270 100644 --- a/@GMS/addons/custom_server/Compiles/blck_functions.sqf +++ b/@GMS/addons/custom_server/Compiles/blck_functions.sqf @@ -98,7 +98,8 @@ blck_fnc_spawnParaUnits = compileFinal preprocessFileLineNumbers "\q\addons\cust blck_EH_AIVehicle_HandleHit = "\q\addons\custom_server\Compiles\Vehicles\GMS_EH_AIVehicle_Hit.sqf"; blck_fnc_HandleAIVehicleHit = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_HandleAIVehicleHit.sqf"; blck_EH_VehicleKilled = "\q\addons\custom_server\Compiles\Vehicles\GMS_EH_VehicleKilled.sqf"; -blck_fnc_processAIVehicleKill = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_processAIVehicleKill.sqf"; +blck_fnc_processAIVehicleKill = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_processAIVehicleKill.sqf"; +blck_fnc_selectPatrolVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Vehicles\GMS_fnc_selectPatrolVehicle.sqf"; // functions to support Units blck_fnc_removeGear = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_removeGear.sqf"; // Strip an AI unit of all gear. diff --git a/@GMS/addons/custom_server/Configs/blck_configs_epoch.sqf b/@GMS/addons/custom_server/Configs/blck_configs_epoch.sqf index 876e519..2c791ac 100644 --- a/@GMS/addons/custom_server/Configs/blck_configs_epoch.sqf +++ b/@GMS/addons/custom_server/Configs/blck_configs_epoch.sqf @@ -40,6 +40,10 @@ AI WEAPONS, UNIFORMS, VESTS AND GEAR blck_AI_Side = RESISTANCE; blck_AIPatrolVehicles = ["B_G_Offroad_01_armed_EPOCH","B_LSV_01_armed_F"]; // Type of vehicle spawned to defend AI bases + blck_AIPatrolVehiclesBlue = blck_AIPatrolVehicles; + blck_AIPatrolVehiclesRed = blck_AIPatrolVehicles; + blck_AIPatrolVehiclesGreen = blck_AIPatrolVehicles; + blck_AIPatrolVehiclesOrange = blck_AIPatrolVehicles; #define useAPEX 1 diff --git a/@GMS/addons/custom_server/Configs/blck_configs_exile_mil.sqf b/@GMS/addons/custom_server/Configs/blck_configs_exile_mil.sqf index 5bf5b93..b318158 100644 --- a/@GMS/addons/custom_server/Configs/blck_configs_exile_mil.sqf +++ b/@GMS/addons/custom_server/Configs/blck_configs_exile_mil.sqf @@ -68,7 +68,11 @@ AI WEAPONS, UNIFORMS, VESTS AND GEAR "B_APC_Tracked_01_CRV_F", "B_APC_Tracked_01_rcws_F" ]; // Type of vehicle spawned to defend AI bases - + blck_AIPatrolVehiclesBlue = blck_AIPatrolVehicles; + blck_AIPatrolVehiclesRed = blck_AIPatrolVehicles; + blck_AIPatrolVehiclesGreen = blck_AIPatrolVehicles; + blck_AIPatrolVehiclesOrange = blck_AIPatrolVehicles; + // Blacklisted itesm blck_blacklistedOptics = ["optic_Nightstalker","optic_tws","optic_tws_mg"]; diff --git a/@GMS/addons/custom_server/Configs/blck_defines.hpp b/@GMS/addons/custom_server/Configs/blck_defines.hpp index 56d73a5..e550baf 100644 --- a/@GMS/addons/custom_server/Configs/blck_defines.hpp +++ b/@GMS/addons/custom_server/Configs/blck_defines.hpp @@ -14,6 +14,6 @@ #define wpModeMove #define useAPEX -#define useDynamicSimulation +//#define useDynamicSimulation //#define blck_debugMode //#define blck_milServer \ No newline at end of file diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnMission.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnMission.sqf index 9d74722..e359772 100644 --- a/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnMission.sqf +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_fnc_sm_spawnMission.sqf @@ -45,7 +45,7 @@ uiSleep 10; // Let the objects 'settle' before placing anything on or around the [_missionLootBoxes,_missionCenter,_crateLoot,_lootCounts] call blck_fnc_sm_spawnLootContainers; _blck_localMissionMarker = ["",_missionCenter,"","",_markerColor,_markerType]; -[_blck_localMissionMarker] execVM "debug\spawnMarker.sqf"; +[_blck_localMissionMarker] call blck_fnc_spawnMarker; diag_log format["[blckeagls] Static Mission Spawner: Mission %1 spawned",_mission]; diff --git a/@GMS/addons/custom_server/Missions/Static/Code/GMS_sm_spawnVehiclePatrols.sqf b/@GMS/addons/custom_server/Missions/Static/Code/GMS_sm_spawnVehiclePatrols.sqf index 2d8dec0..cfa574f 100644 --- a/@GMS/addons/custom_server/Missions/Static/Code/GMS_sm_spawnVehiclePatrols.sqf +++ b/@GMS/addons/custom_server/Missions/Static/Code/GMS_sm_spawnVehiclePatrols.sqf @@ -26,7 +26,8 @@ if (_vehiclePatrolSpawns isEqualTo []) then _spawnPoints = [_coords,_noVehiclePatrols,75,100] call blck_fnc_findPositionsAlongARadius; { // ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red", 600], - _vehType = selectRandom blck_AIPatrolVehicles; + //_vehType = selectRandom blck_AIPatrolVehicles; + _vehType = [_aiDifficultyLevel] call blck_fnc_selectPatrolVehicle; _vehiclePatrolSpawns pushBack [_vehType, _x, _aiDifficultyLevel, 150]; } forEach _spawnPoints; }; diff --git a/changeLog.sqf b/changeLog.sqf index 17514a1..f212347 100644 --- a/changeLog.sqf +++ b/changeLog.sqf @@ -8,12 +8,18 @@ Ideas or code from that by Vampire and KiloSwiss have been used for certain func Significant Changes: ===================== -Version 1.79, Build 112 +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. +Added: You can now define the types of patrol vehicles spawned based on AI difficulty. + Fixed: Setting blck_useTimeAcceleration = false; now disables the time acceleration module. Fixed: several issues with dynamic UMS missions. -Changed: Please replace the debug folder in your mission PBO with the updated one found on the github. +Fixed: AI Heli's at missions should now be released to players when all AI are dead. + +Changed: Code for checking the state of AI vehicles and releasing them to players was re-written. +Changed: Eliminated useless files from the debug folder (mission.pbo). + Please replace the debug folder in your mission PBO with the updated one found on the github. [removed all scripts for markers from mission\debug. These are now located in custom_server\compiles\functions.] Version 6.78 Build 107