Build 204

Fixed issues with markers not showing number of alive AI (land missions only)

UMS missions still need work in that regard.
This commit is contained in:
Chris Cardozo 2020-05-27 09:04:49 -04:00
parent 7bc4495976
commit a8156bb8d9
16 changed files with 1110 additions and 90 deletions

View File

@ -13,12 +13,11 @@ for "_i" from 1 to (count blck_temporaryMarkers) do
if (_i > (count blck_temporaryMarkers)) exitWith {};
private _m = blck_temporaryMarkers deleteAt 0;
_m params["_marker","_deleteAt"];
//diag_log format["_cleanupTemporaryMarkers: _marker = %1 | _deleteAt = %2",_marker, _deleteAt];
if (diag_tickTime > _deleteAt) then
{
deleteMarker _marker;
} else {
blck_temporaryMarkers pushBack _m;
//diag_log format["_cleanupTemporaryMarkers: wait longer before deleting _marker = %1 | _deleteAt = %2",_marker, _deleteAt];
};
};
};

View File

@ -0,0 +1,63 @@
/*
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
//#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private "_markers";
params[
"_markerName", // the name used when creating the marker. Must be unique.
"_markerPos",
"_markerLabel", // Text used to label the marker
"_markerColor",
"_markerType", // Use either the name of the icon or "ELLIPSE" or "RECTANGLE" where non-icon markers are used
["_markerSize",[0,0]],
["_markerBrush","GRID"]
];
private _pList =[
"_markerName", // the name used when creating the marker. Must be unique.
"_markerPos",
"_markerLabel",
"_markerColor",
"_markerType", // Use either the name of the icon or "ELLIPSE" or "RECTANGLE" where non-icon markers are used
"_markerSize",
"_markerBrush"
];
for "_i" from 0 to ((count _this) - 1) do
{
diag_log format["_fnc_createMarker: parameter %1 = %2",_pList select _i,_this select _i];
};
if (toUpper(_markerType) in ["ELLIPSE","RECTANGLE"]) then // not an Icon ....
{
private _m = createMarker [blck_missionMarkerRootName + _markerName,_markerPos];
_m setMarkerShape _markerType;
_m setMarkerColor _markerColor;
_m setMarkerBrush _markerBrush;
_m setMarkerSize _markerSize;
private _m2 = createMarker [blck_missionMarkerRootName + _markerName + "label", _markerPos];
_m2 setMarkerType "mil_dot";
_m2 setMarkerColor "ColorBlack";
_m2 setMarkerText _markerLabel;
_markers = [_m,_m2];
diag_log format["_fnc_createMarkers: case of ELLIPSE/RECTANGLE: _markers = %1",_markers];
} else {
private _m = "";
private _m2 = createMarker [blck_missionMarkerRootName + _markerName + "label", _markerPos];
_m2 setMarkerType _markerType;
_m2 setMarkerColor _markerColor;
_m2 setMarkerText _markerLabel;
_markers = [_m,_m2];
diag_log format["_fnc_createMarkers: case of ICON: _markers = %1",_markers];
};
_markers

View File

@ -13,5 +13,4 @@ params[["_markerName",""]];
if (_markerName isEqualTo "" || !(typeName _markerName isEqualTo "STRING")) exitWith {diag_log format"[blckeagls] <ERROR> illeagal or missing marker name: typeName _markerName = %1 | _makerName = %2",typeName _markerName,_markerName};
deleteMarker _markerName;
deleteMarker ("label" + _markerName);
deleteMarker (_markerName + "label");

View File

@ -10,4 +10,6 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_marker","_rootText","_missionAI"];
_marker setMarkerText format["%1 / %2 AI Alive",_rootText,{alive _x} count _missionAI];
private _txtPrior = markerText _marker;
_marker setMarkerText format["%1 / %2 AI Alive",_rootText,{alive _x} count _missionAI];

View File

@ -0,0 +1,50 @@
/*
Adds the basic list of parameters that define a mission such as the marker name, mission list, mission path, AI difficulty, and timer settings, to the arrays that the main thread inspects.
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[
"_missionList", // list of missions to be used for that category (blue, red, gree, orange, etc)
"_path", // path to the folder with the mission.sqf's
"_marker", // a root name for markers used in the mission
"_difficulty",
"_tMin",
"_tMax",
["_noMissions",1]
];
//{diag_log format["_fnc_addMissionToCue: _this %1 = %2",_forEachIndex,_x]} forEach _this;
private["_compiledMission","_compiledMissionsList"];
private _waitTime = diag_tickTime + (_tMin) + random((_tMax) - (_tMin));
private _missionsData = []; // Parameters definine each of the missions for this difficulty are stored as arrays here.
{
private _missionFile = format["\q\addons\custom_server\Missions\%1\%2.sqf",_path,_x];
private _missionCode = compileFinal preprocessFileLinenumbers _missionFile;//return all of the values that define how the mission is spawned as an array of values.
private _data = [] call _missionCode;
_missionsData pushBack _data;
} forEach _missionList;
private _missionCategoryDescriptors = [
_difficulty,
_noMissions, // Max no missions of this category
0, // Number active
_tMin, // Used to calculate waittime in the future
_tMax, // as above
_waitTime, // time at which a mission should be spawned
_missionsData //
];
blck_missionData pushBack _missionCategoryDescriptors;

View File

@ -16,7 +16,7 @@
private["_cleanupAliveAITimer","_cleanupCompositionTimer","_isScubaMission"];
_fn_missionCleanup = {
params["_mines","_objects","_blck_AllMissionAI","_mission","_cleanupAliveAITimer","_cleanupCompositionTimer",["_isScubaMission",false]];
params["_coords","_mines","_objects","_blck_AllMissionAI","_markerName","_cleanupAliveAITimer","_cleanupCompositionTimer",["_isScubaMission",false]];
[_mines] call blck_fnc_clearMines;
//[_coords,_objects, _cleanupCompositionTimer] call blck_fnc_addObjToQue;
blck_oldMissionObjects pushback [_coords,_objects, (diag_tickTime + _cleanupCompositionTimer)];
@ -26,7 +26,7 @@ _fn_missionCleanup = {
if !(_isScubaMission) then
{
blck_recentMissionCoords pushback [_coords,diag_tickTime];
[_mission,"inactive",[0,0,0]] call blck_fnc_updateMissionQue;
[_markerName,"inactive",[0,0,0]] call blck_fnc_updateMissionQue;
};
if (_isScubaMission) then
{
@ -40,33 +40,51 @@ _fn_missionCleanup = {
// MAIN FUNCTION STARTS HERE
//////////////////////////////////////////////////////////////////////
params["_mines","_objects","_crates","_blck_AllMissionAI","_endMsg","_blck_localMissionMarker","_coords","_mission",["_endCondition",0],["_vehicles",[]],["_isScubaMission",false]];
private _param = ["_mines","_objects","_crates","_blck_AllMissionAI","_endMsg","_blck_localMissionMarker","_coords","_mission","_endCondition","_vehicles","_isScubaMission"];
diag_log format["_fnc_endMission: _this = %1",_this];
params[
"_coords",
"_mines",
"_objects",
"_crates",
"_blck_AllMissionAI",
"_endMsg",
"_markers",
"_markerPos",
"_markerName",
"_markerLabel",
["_endCondition",0],
["_vehicles",[]],
["_isScubaMission",false]
];
/*
if (blck_debugLevel >=3) then
private _param = ["_coords","_mines","_objects","_crates","_blck_AllMissionAI","_endMsg","_markers","_markerPos","_markerName","_markerLabel","_endCondition","_vehicles","_isScubaMission"];
{
diag_log format["_fnc_endMission: param %1 = %2",_forEachIndex,_x];
diag_log format["_fnc_endMission: parameter %1 named %2 = %3",_forEachIndex,_param select _forEachIndex,_x];
} forEach _this;
*/
{
[_x] call blck_fnc_deleteMarker;
}forEach (_blck_localMissionMarker select 0);
if (_endCondition > 0) exitWith // Mision aborted for some reason
{
[_blck_localMissionMarker select 0] call blck_fnc_deleteMarker;
_cleanupCompositionTimer = 0;
_cleanupAliveAITimer = 0;
[_mines,_objects,_blck_AllMissionAI,_mission,_cleanupAliveAITimer,_cleanupCompositionTimer,_isScubaMission] call _fn_missionCleanup;
#define cleanupCompositionTimer 0
#define cleanupAliveAITimer 0
// params["_coords","_mines","_objects","_blck_AllMissionAI","_markerName","_cleanupAliveAITimer","_cleanupCompositionTimer",["_isScubaMission",false]];
[_coords,_mines,_objects,_blck_AllMissionAI,_markerName,cleanupAliveAITimer,cleanupCompositionTimer,_isScubaMission] call _fn_missionCleanup;
/*
{
//if (local _x) then {deleteVehicle _x};
if (local _x) then {deleteVehicle _x};
}forEach _crates;
*/
{
deleteVehicle _x;
if (local _x) then {deleteVehicle _x};
}forEach _vehicles;
};
if (_endCondition <= 0) then // Normal Mission End State
{
private["_cleanupAliveAITimer","_cleanupCompositionTimer"];
if (blck_useSignalEnd) then
{
[_crates select 0] spawn blck_fnc_signalEnd;
@ -74,19 +92,14 @@ if (_endCondition <= 0) then // Normal Mission End State
_x enableRopeAttach true;
}forEach _crates;
};
_cleanupCompositionTimer = blck_cleanupCompositionTimer;
_cleanupAliveAITimer = blck_AliveAICleanUpTimer;
if (_endCondition == 0) then {[["end",_endMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers;};
if (_endCondition == -1) then {[["warning",_endMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers;};
[_blck_localMissionMarker select 0] call blck_fnc_deleteMarker;
[_blck_localMissionMarker select 1, _markerClass] spawn blck_fnc_missionCompleteMarker;
// Using a variable attached to the crate rather than the global setting to be sure we do not fill a crate twice.
// the "lootLoaded" loaded should be set to true by the crate filler script so we can use that for our check.
diag_log format["_fnc_endMission (93) _endMsg = %1 | _markerLabel = %2",_endMsg,_markerLabel];
if (_endCondition == 0) then {[["end",_endMsg,_markerLabel]] call blck_fnc_messageplayers;};
if (_endCondition == -1) then {[["warning",_endMsg,_markerLabel]] call blck_fnc_messageplayers;};
[_markerPos, _markerName] spawn blck_fnc_missionCompleteMarker;
{
if !(_x getVariable["lootLoaded",false] || _endCondition == 1) then // dont load loot if the asset was killed
{
// _crateLoot,_lootCounts are defined above and carry the loot table to be used and the number of items of each category to load
[_x,_crateLoot,_lootCounts] call blck_fnc_fillBoxes;
};
}forEach _crates;
@ -102,7 +115,8 @@ if (_endCondition <= 0) then // Normal Mission End State
blck_monitoredVehicles pushback _x;
};
} forEach _vehicles;
[_mines,_objects,_blck_AllMissionAI,_mission,_cleanupAliveAITimer,_cleanupCompositionTimer,_isScubaMission] call _fn_missionCleanup;
// params["_coords","_mines","_objects","_blck_AllMissionAI","_markerName","_cleanupAliveAITimer","_cleanupCompositionTimer",["_isScubaMission",false]];
[_coords,_mines,_objects,_blck_AllMissionAI,_markerName,blck_AliveAICleanUpTimer,blck_cleanupCompositionTimer,_isScubaMission] call _fn_missionCleanup;
};
_endCondition

View File

@ -0,0 +1,222 @@
/*
Perform all functions necessary to initialize a mission.
[_mrkr,_difficulty,_m] call blck_fnc_initializeMission;
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private ["_coords","_coordArray","_return"];
params["_missionCategoryDescriptors","_missionParameters"];
_missionCategoryDescriptors params [
"_difficulty",
"_noMissions", // Max no missions of this category
"_noActive", // Number active
"_tMin", // Used to calculate waittime in the future
"_tMax", // as above
"_waitTime", // time at which a mission should be spawned
"_missionsData" //
];
/*
{
diag_log format["fnc_initializeMission: _missionCategoryDescriptors:%1 = %2",_x,_missionCategoryDescriptors select _forEachIndex];
} forEach [
"_difficulty",
"_noMissions", // Max no missions of this category
"_noActive", // Number active
"_tMin", // Used to calculate waittime in the future
"_tMax", // as above
"_waitTime", // time at which a mission should be spawned
"_missionsData" //
];
*/
if (_noActive > _noMissions) exitWith {if (blck_debugOn) then {}};
_missionParameters params[
"_defaultMissionLocations", // 1
"_crateLoot", // 2
"_lootCounts", // 3
"_startMsg", // 4
"_endMsg", // 5
"_markerMissionName", // 6 "Scouts";
"_markerType", // 7 "mil_triangle"
"_markerColor", // 8 ColorBlue
"_markerSize", // 9 [200,200] for ELLIPSE and rectangle markers only
"_markerBrush", // 10 "GRID", for ELLIPSE and rectangle markers only
"_missionLandscapeMode", // 11
"_garrisonedBuildings_BuildingPosnSystem",
"_garrisonedBuilding_ATLsystem", // 13
"_missionLandscape", // 14
"_missionLootBoxes", // 15
"_missionLootVehicles", // 16
"_missionPatrolVehicles", // 17
"_submarinePatrolParameters", // 18
"_airPatrols", // 19
"_noVehiclePatrols", // 20
"_vehicleCrewCount", // 21
"_missionEmplacedWeapons", // 22
"_noEmplacedWeapons", // 23
"_missionLootVehicles", // 24
"_useMines", // 25
"_minNoAI", // 26
"_maxNoAI",
"_noAIGroups",
"_missionGroups",
"_scubaGroupParameters",
"_hostageConfig",
"_enemyLeaderConfig",
"_uniforms",
"_headgear",
"_vests",
"_backpacks",
"_weaponList",
"_sideArms",
"_chanceHeliPatrol",
"_noChoppers",
"_missionHelis",
"_chancePara",
"_noPara",
"_paraTriggerDistance",
"_paraSkill",
"_chanceLoot",
"_paraLoot",
"_paraLootCounts",
"_spawnCratesTiming",
"_loadCratesTiming",
"_endCondition",
"_isScubaMission"
];
/*
{
diag_log format["fnc_initializeMission: _missionParameters:%1 = %2",_x,_missionParameters select _forEachIndex];
} forEach [
"_defaultMissionLocations", // 1
"_crateLoot", // 2
"_lootCounts", // 3
"_startMsg", // 2
"_endMsg", // 3
"_markerMissionName",
"_markerType",
"_markerColor",
"_markerSize",
"_markerBrush",
"_missionLandscapeMode",
"_garrisonedBuildings_BuildingPosnSystem",
"_garrisonedBuilding_ATLsystem",
"_missionLandscape",
"_missionLootBoxes",
"_missionLootVehicles",
"_missionPatrolVehicles",
"_submarinePatrolParameters",
"_airPatrols",
"_noVehiclePatrols",
"_vehicleCrewCount",
"_missionEmplacedWeapons",
"_noEmplacedWeapons",
"_missionLootVehicles",
"_useMines",
"_minNoAI",
"_maxNoAI",
"_noAIGroups",
"_missionGroups",
"_scubaGroupParameters",
"_hostageConfig",
"_enemyLeaderConfig",
"_uniforms",
"_headgear",
"_vests",
"_backpacks",
"_weaponList",
"_sideArms",
"_chanceHeliPatrol",
"_noChoppers",
"_missionHelis",
"_chancePara",
"_noPara",
"_paraTriggerDistance",
"_paraSkill",
"_chanceLoot",
"_paraLoot",
"_paraLootCounts",
"_spawnCratesTiming",
"_loadCratesTiming",
"_endCondition",
"_isScubaMission"
];
*/
//diag_log format["_fnc_initializeMission: _isScubaMission = %1",_isScubaMission];
_coordsArray = [];
if !(_defaultMissionLocations isEqualTo []) then
{
_coords = selectRandom _defaultMissionLocations;
} else {
if (_isScubaMission) then
{
_coords = [] call blck_fnc_findShoreLocation;
} else {
_coords = [] call blck_fnc_findSafePosn;
};
};
//diag_log format["_fnc_initializeMission: _coords = %1",_coords];
//uiSleep 1;
if (_coords isEqualTo []) exitWith
{
//diag_log format['_fnc_initializeMission: no safe location found, defering initialization'];
false;
};
//diag_log format["_fnc_initializeMission(160): _defaultMissionLocations = %3 | _markerMissionName = %1 | _coords = %2",_markerMissionName,_coords,_defaultMissionLocations];
blck_ActiveMissionCoords pushback _coords;
blck_missionsRunning = blck_missionsRunning + 1;
blck_missionsRun = blck_missionsRun + 1;
//diag_log format["_initializeMission (164): Total Dyanamic Land and UMS Run = %1 | total Dynamic and UMS Missions Running = %2", blck_missionsRun,blck_missionsRunning];
private _markers = [];
/*
Handle map markers
*/
private _markerName = format["%1:%2",_markerMissionName,blck_missionsRun];
//diag_log format["_initializeMission: _markerName = %1",_markerName];
private "_missionMarkerPosition";
if (blck_labelMapMarkers select 0) then
{
_missionMarkerPosition = _coords;
};
if !(blck_preciseMapMarkers) then
{
_missionMarkerPosition = [_coords,75] call blck_fnc_randomPosition;
};
private _markers = [_markerName,_coords,_markerMissionName,_markerColor,_markerType,_markerSize,_markerBrush] call blck_fnc_createMarker;
_markers params["_mainMarker",["_labelMarker",""]];
/*
Send a message to players.
*/
[["start",_startMsg,_markerMissionName]] call blck_fnc_messageplayers;
private _missionTimeoutAt = diag_tickTime + blck_MissionTimeout;
private _triggered = 0;
private _spawnPara = if (random(1) < _chancePara) then {true} else {false};
private _objects = [];
private _mines = [];
private _crates = [];
private _missionAIVehicles = [];
private _blck_AllMissionAI = [];
private _AI_Vehicles = [];
private _assetSpawned = objNull;
private _missionData = [_coords,_mines,_objects,_crates, _blck_AllMissionAI,_assetSpawned,_missionAIVehicles,_mainMarker,_labelMarker];
blck_activeMissionsList pushBack [_missionCategoryDescriptors,_missionTimeoutAt,_triggered,_spawnPara,_missionData,_missionParameters];
true

View File

@ -19,11 +19,11 @@ private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_mission
"_wait","_missionStartTime","_playerInRange","_missionTimedOut","_temp","_patrolVehicles","_vehToSpawn","_noChoppers","_chancePara","_paraSkill","_marker","_vehicleCrewCount",
"_defaultMissionLocations"];
params["_coords","_markerClass","_aiDifficultyLevel"];
params["_coords","_markerName","_aiDifficultyLevel"];
[_markerClass, "active",_coords] call blck_fnc_updateMissionQue;
[_markerName, "active",_coords] call blck_fnc_updateMissionQue;
diag_log format["[blckeagls] missionSpawner (17):: Initializing mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
diag_log format["[blckeagls] missionSpawner (17):: Initializing mission: _cords %1 : _markerName %2 : _aiDifficultyLevel %3 _markerLabel %4",_coords,_markerName,_aiDifficultyLevel,_markerLabel];
if (isNil "_assetKilledMsg") then {_assetKilledMsg = ""};
if (isNil "_markerColor") then {_markerColor = "ColorBlack"};
@ -92,29 +92,33 @@ _aiGroup = [];
_missionAIVehicles = [];
_blck_AllMissionAI = [];
_AI_Vehicles = [];
_blck_localMissionMarker = [_markerClass,_coords,"","",_markerColor,_markerType];
_blck_localMissionMarker = [[],_markerName,_coords,"","",_markerColor,_markerType];
#define delayTime 1
#define useRelativePos true
#ifdef blck_debugMode
diag_log "_missionSpawner: All variables initialized";
#endif
private _markerPos = _coords;
if (blck_labelMapMarkers select 0) then
{
_blck_localMissionMarker set [2, _markerMissionName];
};
if !(blck_preciseMapMarkers) then
{
_blck_localMissionMarker set [1,[_coords,75] call blck_fnc_randomPosition];
};
private _markerPos = [_coords,75] call blck_fnc_randomPosition;
diag_log format["_fnc_missionSpawner (110): _markerPos = %1",_markerPos];
_blck_localMissionMarker set [1,_markerMissionName];
} ;
_blck_localMissionMarker set [3,blck_labelMapMarkers select 1]; // Use an arrow labeled with the mission name?
[["start",_startMsg,_markerMissionName]] call blck_fnc_messageplayers;
_marker = [_blck_localMissionMarker] call blck_fnc_spawnMarker;
_blck_localMissionMarker set [0, _marker];
_markerType params["_type",["_size",[250,250]],["_brush","GRID"]];
_markers = [_markerName,_markerPos,_markerMissionName,_markerColor,_type,_size,_brush] call blck_fnc_createMissionMarkers;
_blck_localMissionMarker set [0, _markers];
#ifdef blck_debugMode
if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (145) message players and spawn a mission marker";};
if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (146) _marker = %1",_marker];};
if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (146) _markers = %1",_markers];};
if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (147) waiting for player to trigger the mission";};
#endif
////////
@ -134,20 +138,20 @@ if (blck_debugLevel > 0) then {
while {_wait} do
{
//ifdef blck_debugMode
//#ifdef blck_debugMode
if (blck_debugLevel > 2) exitWith {_playerInRange = true;diag_log "_fnc_missionSpawner (168): player trigger loop triggered by scripting";};
//endif
//#endif
if ([_coords, blck_TriggerDistance, false] call blck_fnc_playerInRange) exitWith {_playerInRange = true;};
if ([_missionStartTime,blck_MissionTimeout] call blck_fnc_timedOut) exitWith {_missionTimedOut = true;};
uiSleep 5;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
if (blck_debugLevel > 3) 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,blck_MissionTimeout] call blck_fnc_timedOut];
diag_log format["missionSpawner:: Trigger Loop - blck_MissionTimeout = %4 | _missionStartTime = %1 | time = %2 | timeout = %3",_missionStartTime, diag_tickTime, [_missionStartTime,blck_MissionTimeout] call blck_fnc_timedOut,blck_MissionTimeout];
};
#endif
};
@ -155,7 +159,25 @@ while {_wait} do
if (_missionTimedOut) exitWith
{
diag_log format["_fnc_missionSpawner (187): mission timed out"];
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission;
/*
params[
"_coords",
"_mines",
"_objects",
"_crates",
"_blck_AllMissionAI",
"_endMsg",
"_markers",
"_markerPos",
"_markerName",
"_markerLabel",
["_endCondition",0],
["_vehicles",[]],
["_isScubaMission",false]
];
*/
[_coords,_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_markers,_markerPos,_markerName,_markerMissionName, 1] call blck_fnc_endMission;
};
////////////////////////////////////////////////
@ -164,7 +186,7 @@ if (_missionTimedOut) exitWith
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (200) -- >> Mission tripped: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
diag_log format["[blckeagls] missionSpawner:: (200) -- >> Mission tripped: _cords %1 : _markerName %2 : _aiDifficultyLevel %3 _markerLabel %4",_coords,_markerName,_aiDifficultyLevel,_markerMissionName];
};
#endif
@ -201,7 +223,7 @@ if (typeName _temp isEqualTo "ARRAY") then
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (237) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
diag_log format["[blckeagls] missionSpawner:: (237) Landscape spawned: _cords %1 : _markerName %2 : _aiDifficultyLevel %3 _markerLabel %4",_coords,_markerName,_aiDifficultyLevel,_markerLabel];
};
#endif
@ -223,7 +245,7 @@ if !(_abort) then
uiSleep 10;
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (288) AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
diag_log format["[blckeagls] missionSpawner:: (288) AI Patrols Spawned: _cords %1 : _markerName %2 : _aiDifficultyLevel %3 _markerLabel %4",_coords,_markerName,_aiDifficultyLevel,_markerLabel];
};
#endif
@ -410,11 +432,9 @@ switch (_endCondition) do
if (blck_showCountAliveAI) then
{
if !(_marker isEqualTo "") then
{
[_marker,_markerMissionName,_blck_AllMissionAI] call blck_fnc_updateMarkerAliveCount;
blck_missionMarkers pushBack [_marker,_markerMissionName,_blck_AllMissionAI];
};
diag_log format["_missionSpawner(419): updating AI Alive Counts for _markers = %1",_markers];
[_markers select 1,_markerMissionName,_blck_AllMissionAI] call blck_fnc_updateMarkerAliveCount;
blck_missionLabelMarkers pushBack [_markers select 1,_markerMissionName,_blck_AllMissionAI];
};
_crateStolen = false;
@ -511,7 +531,24 @@ while {_missionComplete isEqualTo -1} do
if (_crateStolen) exitWith
{
[_mines,_objects,_crates, _blck_AllMissionAI,"Crate Removed from Mission Site Before Mission Completion: Mission Aborted",_blck_localMissionMarker,_coords,_markerClass, 2] call blck_fnc_endMission;
/*
params[
"_coords",
"_mines",
"_objects",
"_crates",
"_blck_AllMissionAI",
"_endMsg",
"_markers",
"_markerPos",
"_markerName",
"_markerLabel",
["_endCondition",0],
["_vehicles",[]],
["_isScubaMission",false]
];
*/
[_coords,_mines,_objects,_crates, _blck_AllMissionAI,"Crate Removed from Mission Site Before Mission Completion: Mission Aborted",_markers,_markerPos,_markerName,_markerLabel, 2] call blck_fnc_endMission;
};
if (_spawnCratesTiming in ["atMissionEndGround","atMissionEndAir"]) then
@ -537,7 +574,7 @@ if (_spawnCratesTiming in ["atMissionEndGround","atMissionEndAir"]) then
};
#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]};
if (blck_debugLevel > 0) then {diag_log format["[blckeagls] missionSpawner:: (428) Crates Spawned: _cords %1 : _markerName %2 : _aiDifficultyLevel %3 _markerLabel %4",_coords,_markerName,_aiDifficultyLevel,_markerLabel]};
#endif
};
};
@ -559,11 +596,13 @@ _blck_localMissionMarker set [2, _markerMissionName];
// delete the prior instance of this mission.
if (blck_showCountAliveAI) then
{
_marker setMarkerText format["%1: All AI Dead",_markerMissionName];
_marker setMarkerText format["%1: All AI Dead",_markerLabel];
{
if ((_x select 1) isEqualTo _markerMissionName) exitWith{blck_missionMarkers deleteAt _forEachIndex};
}forEach blck_missionMarkers;
if ((_x select 1) isEqualTo _markerLabel) exitWith{blck_missionLabelMarkers deleteAt _forEachIndex};
}forEach blck_missionLabelMarkers;
};
*/
if (_secureAsset && (alive _assetSpawned)) then
{
@ -588,18 +627,33 @@ if (_secureAsset && (alive _assetSpawned)) then
};
if (_secureAsset && !(alive _assetSpawned)) then
{
//diag_log format["_fnc_missionSpawner: irregular mission end, asset killed"];
_result = [_mines,_objects,_crates,_blck_AllMissionAI,_assetKilledMsg,_blck_localMissionMarker,_coords,_markerClass, -1] call blck_fnc_endMission;
/* params[
"_coords",
"_mines",
"_objects",
"_crates",
"_blck_AllMissionAI",
"_endMsg",
"_markers",
"_markerPos",
"_markerName",
"_markerLabel",
["_endCondition",0],
["_vehicles",[]],
["_isScubaMission",false]
];
*/
[_coords,_mines,_objects,_crates,_blck_AllMissionAI,_assetKilledMsg,_markers,_markerPos,_markerName,_markerLabel, -1] call blck_fnc_endMission;
};
if (!(_secureAsset) || (_secureAsset && (alive _assetSpawned))) then
{
_result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 0] call blck_fnc_endMission;
[_coords,_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_markers,_markerPos,_markerName,_markerLabel, 0] call blck_fnc_endMission;
};
#ifdef blck_debugMode
if (blck_debugLevel > 2) then {diag_log format["[blckeagls] missionSpawner:: (507)end of mission: blck_fnc_endMission has returned control to _fnc_missionSpawner"]};
#endif
diag_log format["_fnc_missionSpawner (643) Mission Completed | _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
diag_log format["_fnc_missionSpawner (643) Mission Completed | _cords %1 : _markerName %2 : _aiDifficultyLevel %3 _markerLabel %4",_coords,_markerName,_aiDifficultyLevel,_markerLabel];
blck_missionsRun = blck_missionsRun + 1;
diag_log format["_fnc_missionSpawner (644): Total Dyanamic Land and UMS Run = %1", blck_missionsRun];

View File

@ -0,0 +1,627 @@
/*
GMS_fnc_monitorInitializedMissions
by Ghostrider-GRG-
*/
//diag_log format["fnc_monitorInitializedMissions: time = %1 | count blck_activeMissionsList %2 | blck_activeMissionsList %3",diag_tickTime,count blck_activeMissionsList,blck_activeMissionsList];
for "_i" from 1 to (count blck_activeMissionsList) do
{
if (_i > (count blck_activeMissionsList)) exitWith {};
// Select a mission category (blue, red, green , etd)
private _el = blck_activeMissionsList deleteAt 0;
//diag_log format["fnc_monitorInitializedMissions: _el = %1",_el];
//blck_activeMissionsList pushBack [_missionCategoryDescriptors,_missionTimeoutAt,_triggered,_spawnPara,_missionData,_missionParameters];
_el params [
"_missionCategoryDescriptors", // 0
"_missionTimeoutAt", // 1
"_triggered", // 2
"_spawnPara", // 3
"_missionData", // 6
"_missionParameters" // 7
];
/*
{
diag_log format["_fnc_monitorInitializedMissions: _el:%1 = %2",_x, _el select _forEachIndex];
} forEach [
"_missionCategoryDescriptors", // 0
"_missionTimeoutAt", // 1
"_triggered", // 2
"_spawnPara", // 3
"_missionData", // 6
"_missionParameters" // 7
];
*/
/*
private _missionCategoryDescriptors = [
_difficulty,
_noMissions, // Max no missions of this category
0, // Number active
_tMin, // Used to calculate waittime in the future
_tMax, // as above
_waitTime, // time at which a mission should be spawned
_missionsData //
];
*/
#define noActive 2
#define waitTime 5
#define missionData 6
_missionCategoryDescriptors params [
"_difficulty",
"_noMissions", // Max no missions of this category
"_noActive", // Number active
"_tMin", // Used to calculate waittime in the future
"_tMax", // as above
"_waitTime", // time at which a mission should be spawned
"_missionsData" //
];
/*
{
diag_log format["fnc_monitorInitializeMission: _missionCategoryDescriptors:%1 = %2",_x,_missionCategoryDescriptors select _forEachIndex];
} forEach [
"_difficulty",
"_noMissions", // Max no missions of this category
"_noActive", // Number active
"_tMin", // Used to calculate waittime in the future
"_tMax", // as above
"_waitTime", // time at which a mission should be spawned
"_missionsData" //
];
*/
#define setMissionData _missionData = [_coords,_mines,_objects,_crates, _blck_AllMissionAI,_assetSpawned,_missionAIVehicles,_mainMarker,_labelMarker];
//private _missionData = [_coords,_mines,_objects,_crates, _blck_AllMissionAI,_assetSpawned,_missionAIVehicles,_mainMarker,_labelMarker];
// 0 1 2 3 4 5 6 7 8
_missionData params ["_coords","_mines","_objects","_crates","_blck_AllMissionAI","_assetSpawned","_missionAIVehicles","_mainMarker","_labelMarker"];
/*
{
diag_log format["_fnc_monitorInitializedMissions (79): _missionData:%1 = %2",_x, _missionData select _forEachIndex];
} forEach ["_coords","_mines","_objects","_crates","_blck_AllMissionAI","_assetSpawned","_missionAIVehicles","_mainMarker","_labelMarker"];
*/
_missionParameters params[
"_defaultMissionLocations",
"_crateLoot", // 0
"_lootCounts", // 1
"_startMsg", // 2
"_endMsg", // 3
"_markerMissionName",
"_markerType",
"_markerColor",
"_markerSize",
"_markerBrush",
"_missionLandscapeMode",
"_garrisonedBuildings_BuildingPosnSystem",
"_garrisonedBuilding_ATLsystem",
"_missionLandscape",
"_missionLootBoxes",
"_missionLootVehicles",
"_missionPatrolVehicles",
"_submarinePatrolParameters",
"_airPatrols",
"_noVehiclePatrols",
"_vehicleCrewCount",
"_missionEmplacedWeapons",
"_noEmplacedToSpawn",
"_missionLootVehicles",
"_useMines",
"_minNoAI",
"_maxNoAI",
"_noAIGroups",
"_missionGroups",
"_scubaGroupParameters",
"_hostageConfig",
"_enemyLeaderConfig",
"_uniforms",
"_headgear",
"_vests",
"_backpacks",
"_weaponList",
"_sideArms",
"_chanceHeliPatrol",
"_noChoppers",
"_missionHelis",
"_chancePara",
"_noPara",
"_paraTriggerDistance",
"_paraSkill",
"_chanceLoot",
"_paraLoot",
"_paraLootCounts",
"_spawnCratesTiming",
"_loadCratesTiming",
"_endCondition",
"_isScubaMission"
];
private _playerInRange = [_coords, blck_TriggerDistance, false] call blck_fnc_playerInRange;
#define delayTime 1
private _monitorAction = -2;
if (_triggered isEqualTo 0) then
{
if (diag_tickTime > _missionTimeoutAt) then
{
_monitorAction = -1;
} else {
if (_playerInRange) then {
_monitorAction = 0;
} else {
if (blck_debugLevel >= 3) then {_monitorAction = 0}; // simulate the mission being tripped by a player
};
};
} else {
if (_triggered isEqualTo 1) then
{
_monitorAction = 1;
};
};
//diag_log format["_monitorInitializedMissions(149): _triggered = %1 | _monitorAction = %2",_triggered,_monitorAction];
private _blck_localMissionMarker = [_markerType,_coords,"","",_markerColor,_markerType];
switch (_monitorAction) do
{
// Handle Timeout
case -1:
{
diag_log format["_fnc_monitorInitializedMissions: mission timed out: %1",_el];
_missionCategoryDescriptors set[noActive, _noActive - 1];
// params ["_mines","_objects","_crates","_blck_AllMissionAI","_endMsg","_mainMarker","_labelMarker","_markerClass","_coords",["_endCondition",0]]
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_mainMarker,_labelMarker,_markerType,_coords,1] call blck_fnc_endMission;
};
// Handle mission waiting to be triggerd and player is within the range to trigger
case 0:
{
if (blck_debugLevel >= 3) then
{
diag_log format["_fnc_moniorInitializedMissions: blck_debugLevel == 3, spawning objects for mission %1",_el];
} else {
//diag_log format["_fnc_moniorInitializedMissions: mission TRIGGERED by player: spawning objects for mission %1",_el];
};
#define triggered 2
#define timedOut 1
_el set[triggered,1];
_el set[timedOut,diag_tickTime + 240];
//diag_log format["_fnc_monitorInitializedMissions (167): spawning smoking wrecks as needed: blck_smokeAtMissions == %1",blck_SmokeAtMissions];
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;
};
};
//diag_log format["_fnc_monitorInitializedMissions (193): spawning mines as needed: _useMines == %1",_useMines];
if (_useMines) then
{
_mines = [_coords] call blck_fnc_spawnMines;
uiSleep delayTime;
};
//diag_log format["_fnc_monitorInitializedMissions (200): spawning landscape as needed: _missionLandscapeMode = %1 | _missionLandscape = %2",_missionLandscapeMode,_missionLandscape];
if (_missionLandscapeMode isEqualTo "random") then
{
_temp = [_coords,_missionLandscape, 3, 15, 2] call blck_fnc_spawnRandomLandscape;
} else {
_temp = [_coords, _missionLandscape] call blck_fnc_spawnCompositionObjects;
};
_objects append _temp;
uiSleep delayTime;
try {
//diag_log format["_fnc_monitorInitializedMissions (213): spawning AI Patrols as needed: _missionGroups == %1",_missionGroups];
_temp = [_coords, _minNoAI,_maxNoAI,_noAIGroups,_missionGroups,_difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionAI;
_temp params["_ai","_abort"];
if (_abort) throw 1;
_blck_AllMissionAI append (_ai);
uiSleep delayTime;
//diag_log format["_fnc_monitorInitializedMissions (220): spawning hostages as needed: _hostageConfig == %1",_hostageConfig];
//private ["_assetSpawned"];
if !(_hostageConfig isEqualTo []) then
{
_temp = [_coords,_hostageConfig] call blck_fnc_spawnHostage;
if (_temp isEqualTo grpNull) then {throw 1} else
{
_assetSpawned = _temp select 0;
// 0 1 2 3 4 5 6 7
// _missionData params ["_coords","_mines","_objects","_crates","_blck_AllMissionAI","_assetSpawned","_mainMarker","_labelMarker"];
_missionData set[5,_assetSpawned];
_objects pushBack (_temp select 1);
_blck_AllMissionAI pushBack _assetSpawned;
};
};
//diag_log format["_fnc_monitorInitializedMissions (234): spawning leaders as needed: _enemyLeaderConfig == %1",_enemyLeaderConfig];
if !(_enemyLeaderConfig isEqualTo []) then
{
private _temp = [_coords,_enemyLeaderConfig] call blck_fnc_spawnLeader;
if (_temp isEqualTo grpNull) then {throw 1} else
{
_assetSpawned = _temp select 0;
_missiondata set[5,_assetSpawned];
_objects pushBack (_temp select 1);
_blck_AllMissionAI pushBack _assetSpawned;
};
};
//diag_log format["_fnc_monitorInitializedMissions (248): spawning chopers as needed: _noChoppers = %1 | _chanceHeliPatrol = %2 | _missionHelis = %3",_noChoppers,_chanceHeliPatrol,_missionHelis];
private _noChoppers = [_noChoppers] call blck_fnc_getNumberFromRange;
if (_noChoppers > 0) then
{
for "_i" from 1 to (_noChoppers) do
{
if (random(1) < _chanceHeliPatrol) then
{
_temp = [_coords,_difficulty,_missionHelis,_uniforms,_headGear,_vests,_backpacks,_weaponList, _sideArms,"none"] call blck_fnc_spawnMissionHeli;
if (typeName _temp isEqualTo "ARRAY") then
{
blck_monitoredVehicles pushBack (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
} else {
if (typeName _temp isEqualTo "GROUP") then
{
if (isNull _temp) throw 1;
};
};
};
};
};
uisleep 3;
//diag_log format["_fnc_monitorInitializedMissions (271): spawning garrisons using ATL coordinate system as needed: _garrisonedBuilding_ATLsystem == %1",_garrisonedBuilding_ATLsystem];
if (count _garrisonedBuilding_ATLsystem > 0) then // Note that there is no error checking here for nulGroups
{
private _temp = [_coords, _garrisonedBuilding_ATLsystem, _difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_garrisonBuilding_ATLsystem;
if (_temp isEqualTo grpNull) then {throw 1} else
// TODO: Add error checks for grpNull to the ATLsystem spawner
{
_objects append (_temp select 1);
blck_monitoredVehicles append (_temp select 2);
_blck_AllMissionAI append (units (_temp select 0));
};
};
uiSleep 3;
//diag_log format["_fnc_monitorInitializedMissions (285): spawning garrisons using relative coordinate system as needed: _garrisonedBuildings_BuildingPosnSystem == %1",_garrisonedBuildings_BuildingPosnSystem];
if (count _garrisonedBuildings_BuildingPosnSystem > 0) then
{
private _temp = [_coords, _garrisonedBuildings_BuildingPosnSystem, _difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_garrisonBuilding_RelPosSystem;
if (_temp isEqualTo grpNull) then {throw 1} else
// TODO: add error checks for grpNull to the RelPosSystem
{
_objects append (_temp select 1);
blck_monitoredVehicles append (_temp select 2);
_blck_AllMissionAI append (units (_temp select 0));
};
};
uiSleep 15;
private _userelativepos = true;
//diag_log format["_fnc_monitorInitializedMissions (300): spawning static turrets needed: _noEmplacedToSpawn == %1 | _missionEmplacedWeapons = %2",_noEmplacedToSpawn,_missionEmplacedWeapons];
private _noEmplacedToSpawn = [_noEmplacedToSpawn] call blck_fnc_getNumberFromRange;
if (blck_useStatic && ((_noEmplacedToSpawn > 0) || count _missionEmplacedWeapons > 0)) then
// TODO: add error checks for grpNull to the emplaced weapon spawner
{
private _temp = [_coords,_missionEmplacedWeapons,_userelativepos,_noEmplacedToSpawn,_difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnEmplacedWeaponArray;
if (_temp isEqualTo grpNull) then {throw 1} else
{
_objects append (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
};
};
uisleep 10;
//diag_log format["_fnc_monitorInitializedMissions (316): spawning patrol vehicles as needed: _noVehiclePatrols == %1 | _missionPatrolVehicles = %2",_noVehiclePatrols,_missionPatrolVehicles];
private _noVehiclePatrols = [_noVehiclePatrols] call blck_fnc_getNumberFromRange;
if (blck_useVehiclePatrols && ((_noVehiclePatrols > 0) || count _missionPatrolVehicles > 0)) then
{
_temp = [_coords,_noVehiclePatrols,_difficulty,_missionPatrolVehicles,_userelativepos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,false,_vehicleCrewCount] call blck_fnc_spawnMissionVehiclePatrols;
// TODO: add grpNull checks to missionVehicleSpawner
if (_temp isEqualTo grpNull) then {throw 1} else
{
_patrolVehicles = _temp select 0;
_blck_AllMissionAI append (_temp select 1);
};
};
uiSleep delayTime;
if (_spawnCratesTiming isEqualTo "atMissionSpawnGround") then
{
if (_missionLootBoxes isEqualTo []) then
{
_crates = [_coords,[[selectRandom blck_crateTypes,[1,1,0],_crateLoot,_lootCounts]], _loadCratesTiming, _spawnCratesTiming, "start", _difficulty] call blck_fnc_spawnMissionCrates;
}
else
{
_crates = [_coords,_missionLootBoxes,_loadCratesTiming, _spawnCratesTiming, "start", _difficulty] call blck_fnc_spawnMissionCrates;
};
if (blck_cleanUpLootChests) then
{
_objects append _crates;
};
};
_missionData set[2,_objects];
_missionData set[3,_crates];
uiSleep delayTime;
if (blck_showCountAliveAI) then
{
[_mainMarker,_labelMarker,_markerMissionName,_blck_AllMissionAI] call blck_fnc_updateMarkerAliveCount;
};
{
_x setVariable["crateSpawnPos", (getPos _x)];
} forEach _crates;
private _spawnPara = if (random(1) < _chancePara) then {true} else {false};
setMissionData // code defined above
//{diag_log format["_monotirInitializedMissions:(371) _missiondata %1 = %2",_forEachIndex,_x]} forEach _missionData;
_el set[missionData, _missionData];
// Everything spawned withouth serous errors so lets keep the mission active for future monitoring
blck_activeMissionsList pushBack _el;
//diag_log format["_fnc_monitorInitializedMissions (366): all objects, men and vehicles spawened, blck_activeMissionsList= %1", blck_activeMissionsList];
}
catch
{
if (_exception isEqualTo 1) then
{
_missionCategoryDescriptors set[noActive, _noActive - 1];
// params ["_mines","_objects","_crates","_blck_AllMissionAI","_endMsg","_mainMarker","_labelMarker","_markerClass","_coords",["_endCondition",0]]
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_mainMarker,_labelMarker,_markerType,_coords, 1] call blck_fnc_endMission;
diag_log format["[blkeagls] <WARNING> grpNull returned by one or more critical functions, mission spawning aborted!"];
};
};
};
case 1:
{
//diag_log format["_fnc_moniorInitializedMissions(398): evaluating status of mission %1 | _missionTimeoutAt = %2 | time = %3 | _crates = %4",_el,_missionTimeoutAt,diag_tickTime,_crates];
private _missionComplete = -1;
private _crateStolen = -1;
private ["_secureAsset","_endIfPlayerNear","_endIfAIKilled"];
switch (_endCondition) do
{
case "playerNear": {_secureAsset = false; _endIfPlayerNear = true;_endIfAIKilled = false;};
case "allUnitsKilled": {_secureAsset = false; _endIfPlayerNear = false;_endIfAIKilled = true;};
case "allKilledOrPlayerNear": {_secureAsset = false; _endIfPlayerNear = true;_endIfAIKilled = true;};
case "assetSecured": {_secureAsset = true; _endIfPlayerNear = false; _endIfAIKilled = false;};
};
if (blck_showCountAliveAI) then
{
[_mainMarker,_labelMarker,_markerMissionName,_blck_AllMissionAI] call blck_fnc_updateMarkerAliveCount;
};
try {
if (blck_debugLevel == 5) throw 1;
if (blck_debugLevel == 6) then {
diag_log format["_fnc_monitorInitializedMissions: mission ended, condition CRATE MOVED, mission %1",_el];
throw 2;
};
if (blck_debugLevel == 7) then
{
diag_log format["_fnc_monitorInitializedMissions: mission ended, condition simulated death of asset, mission %1",_el];
throw 3;
};
private _playerIsNear = [_crates,20,true] call blck_fnc_playerInRangeArray;
private _minNoAliveForCompletion = (count _blck_AllMissionAI) - (round(blck_killPercentage * (count _blck_AllMissionAI)));
private _aiKilled = if (({alive _x} count _blck_AllMissionAI) <= _minNoAliveForCompletion) then {true} else {false}; // mission complete
//diag_log format["_fnc_monitorInitializedMissions (404): _playerIsNear = %1 | _aiKilled = %2 | _crates = %3",_playerIsNear,_aiKilled,_crates];
if (_endIfPlayerNear) then
{
//diag_log format["_fnc_monitorInitializedMissions: mission ended, condition player near, mission %1",_el];
if (_playerIsNear) throw 1; // mission complete
};
if (_endIfAIKilled) then
{
//diag_log format["_fnc_monitorInitializedMissions: mission ended, condition AI Killed, mission %1",_el];
if (_aiKilled) throw 1;
};
if (_spawnCratesTiming isEqualTo "atMissionSpawnGround") then
{
{
private _d = _x distance (_x getVariable ["crateSpawnPos",_coords]);
if (_d > 25) then
{
//diag_log format["_fnc_monitorInitializedMissions: mission ended, condition CRATE MOVED, mission %1",_el];
throw 2;
}; // crate moved illegally
}forEach _crates;
};
if (_spawnPara) then
{
if ([_coords,_paraTriggerDistance,true] call blck_fnc_playerInRange) then
{
_spawnPara = false; // The player gets one try to spawn these.
_el set[3,_spawnPara];
if (random(1) < _chancePara) then //
{
private _paratroops = [_coords,_noPara,_difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnParaUnits;
if !(isNull _paratroops) then
{
_blck_AllMissionAI append (units _paratroops);
};
if (random(1) < _chanceLoot) then
{
private _extraCrates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_paraLoot,_paraLootCounts]], "atMissionSpawn","atMissionStartAir", "start", _difficulty] call blck_fnc_spawnMissionCrates;
if (blck_cleanUpLootChests) then
{
_objects append _extraCrates;
};
};
};
};
};
if (_secureAsset) then
{
if !(alive _assetSpawned) then
{
diag_log format["_line 498 asset %1 killed throwing error with code 3",_assetSpawned];
throw 3;
} else {
diag_log format["line 501: asset alive, count _blck_AllMissionAI = %1",count _blck_AllMissionAI];
if (({alive _x} count _blck_AllMissionAI) <= _minNoAliveForCompletion) then
{
if ((_assetSpawned getVariable["blck_unguarded",0]) isEqualTo 0) then
{
_assetSpawned setVariable["blck_unguarded",1,true];
diag_log format["_assetSpawned: blck_unguarded updated to 1 for asset %1",_assetSpawned];
};
if ((_assetSpawned getVariable["blck_AIState",0]) isEqualTo 1) then
{
diag_log format["_assetSpawned: blck_AIState updated to 1 for asset %1",_assetSpawned];
_assetSpawned allowdamage false;
[_assetSpawned] remoteExec["GMS_fnc_clearAllActions",-2, true];
throw 1;
};
};
};
};
if (blck_debugLevel > 3 && diag_tickTime > _missionTimeoutAt) then
{
diag_log format["_monitoInitializeMissions: debugLevel == 3, mission triggered, timout condition reached, ending mission"];
throw 1;
};
setMissionData // Code defined above
_el set[missionData, _missionData];
// If there were no throws then lets check on the mission in a bit.
blck_activeMissionsList pushBack _el;
}
catch // catch all conditions that cause the mission to end.
{
//diag_log format["_fnc_monitorInitializeMissions (507): _exception = %1",_exception];
switch (_exception) do
{
case 1: { // Normal Mission End
if (_spawnCratesTiming in ["atMissionEndGround","atMissionEndAir"]) then
{
if (!(_secureAsset) || (_secureAsset && (alive _assetSpawned))) then
{
if (count _missionLootBoxes > 0) then
{
_crates = [_coords,_missionLootBoxes,_loadCratesTiming,_spawnCratesTiming, "end", _difficulty] call blck_fnc_spawnMissionCrates;
}
else
{
_crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming,_spawnCratesTiming, "end", _difficulty] call blck_fnc_spawnMissionCrates;
};
if (blck_cleanUpLootChests) then
{
_objects append _crates;
};
};
};
if (_spawnCratesTiming isEqualTo "atMissionSpawnGround" && _loadCratesTiming isEqualTo "atMissionCompletion") then
{
if (!(_secureAsset) || (_secureAsset && (alive _assetSpawned))) then
{
{
[_x] call blck_fnc_loadMissionCrate;
} forEach _crates;
};
};
_blck_localMissionMarker set [2, _markerMissionName];
if (_secureAsset && (alive _assetSpawned)) then
{
if (_assetSpawned getVariable["assetType",0] isEqualTo 1) then
{
_assetSpawned setVariable["GMSAnimations",[""],true];
[_assetSpawned,""] remoteExec["switchMove",-2];;
uiSleep 0.1;
_assetSpawned enableAI "ALL";
private _newPos = (getPos _assetSpawned) getPos [1000, random(360)];
(group _assetSpawned) setCurrentWaypoint [group _assetSpawned, 0];
[group _assetSpawned,0] setWaypointPosition [_newPos,0];
[group _assetSpawned,0] setWaypointType "MOVE";
};
if (_assetSpawned getVariable["assetType",0] isEqualTo 2) then
{
[_assetSpawned,""] remoteExec["switchMove",-2];
_assetSpawned setVariable["GMSAnimations",_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]],true];
[_assetSpawned,selectRandom(_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]])] remoteExec["switchMove",-2];
};
};
diag_log format["_fnc_monitorInitializedMissions (430) calling <_fnc_endMission> | _cords %1 : _markerType %2 : _difficulty %3 _markerMissionName %4",_coords,_markerType,_difficulty,_markerMissionName];
// params ["_mines","_objects","_crates","_blck_AllMissionAI","_endMsg","_mainMarker","_labelMarker","_markerClass","_coords",["_endCondition",0]];
[_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_mainMarker,_labelMarker,_markerType,_coords, 0] call blck_fnc_endMission;
//diag_log format["_fnc_monitorInitializedMissions (430) Mission Completed | _cords %1 : _markerType %2 : _difficulty %3 _markerMissionName %4",_coords,_markerType,_difficulty,_markerMissionName];
_waitTime = diag_tickTime + _tMin + random(_tMax - _tMin);
/*
_missionCategoryDescriptors params [
//"_marker",
"_difficulty", 0
"_noMissions", 1 // Max no missions of this category
"_noActive", 2 // Number active
//"_timesSpawned", // times spawned, useful for keeping unique markers
"_tMin", 3 // Used to calculate waittime in the future
"_tMax", 4 // as above
"_waitTime", 5 // time at which a mission should be spawned
"_missionsData" //
];
*/
_missionCategoryDescriptors set [noActive,_noActive - 1];
_missionCategoryDescriptors set [waitTime,_waitTime];
/*
{
diag_log format["_fnc_monitorInitializedMissions (570): _missionCategoryDescriptors parameter %1 = %2",_x,_missionCategoryDescriptors select _forEachIndex];
} forEach [
//"_marker",
"_difficulty",
"_noMissions", // Max no missions of this category
"_noActive", // Number active
//"_timesSpawned", // times spawned, useful for keeping unique markers
"_tMin", // Used to calculate waittime in the future
"_tMax", // as above
"_waitTime", // time at which a mission should be spawned
"_missionsData" //
];
*/
};
case 2: { // Abort, crate moved.
//[_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_mainMarker,_labelMarker,_markerType,_coords, 0]
[_mines,_objects,_crates, _blck_AllMissionAI,"Crate Removed from Mission Site Before Mission Completion: Mission Aborted",_mainMarker,_labelMarker,_markerType,_coords,2] call blck_fnc_endMission;
_endMsg = "Crate Removed from Mission Site Before Mission Completion: Mission Aborted";
[_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_mainMarker,_labelMarker,_markerType,_coords, 0] call blck_fnc_endMission;
};
case 3: { // Abort, key asset killed
diag_log format["Asset Killed, aborting mission"];
#define missionAbort 1
//[_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_mainMarker,_labelMarker,_markerType,_coords, 0]
[_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_mainMarker,_labelMarker,_markerType,_coords, missionAbort] call blck_fnc_endMission;
};
};
};
};
default
{
blck_activeMissionsList pushBack _el;
};
};
};

View File

@ -14,20 +14,7 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then {
diag_log format["_fnc_spawnPendingMissions:: count blck_pendingMissions = %1", count blck_pendingMissions];
};
#endif
if (blck_missionsRunning >= blck_maxSpawnedMissions) exitWith {
#ifdef blck_debugMode
if (blck_debugLevel > 2) then {
diag_log "_fnc_spawnPendingMissions:: --- >> Maximum number of missions is running; function exited without attempting to find a new mission to spawn";
};
#endif
};
if (blck_missionsRunning >= blck_maxSpawnedMissions) exitWith {};
private["_coords","_compiledMission","_search","_readyToSpawnQue","_missionToSpawn","_allowReinforcements"];
_readyToSpawnQue = [];
@ -41,12 +28,12 @@ _readyToSpawnQue = [];
if (count _readyToSpawnQue > 0) then
{
_missionToSpawn = selectRandom _readyToSpawnQue;
diag_log format["_fnc_spawnPendingMIssions: blc markers = %1",[] call blck_fnc_getAllBlackeaglsMarkers];
_coords = [] call blck_fnc_FindSafePosn;
_compiledMission = selectRandom (_missionToSpawn select 0);
// _mission = [_compiledMissionsList,format["%1%2",_marker,_i],_difficulty,_tMin,_tMax,_waitTime,[0,0,0]];
_missionMarker = _missionToSpawn select 1;
_missionDifficulty = _missionToSpawn select 2;
[_coords,_missionMarker,_missionDifficulty] spawn _compiledMission;

View File

@ -61,8 +61,9 @@ _wp setWaypointCombatMode "RED";
if (blck_showCountAliveAI) then
{
{
[_x select 0, _x select 1, _x select 2] call blck_fnc_updateMarkerAliveCount;
} forEach blck_missionMarkers;
diag_log format["_fnc_processAIKill: _x = %1",_x];
_x call blck_fnc_updateMarkerAliveCount;
} forEach blck_missionLabelMarkers;
};
if ([_unit,_killer] call blck_fnc_processIlleagalAIKills) then {

View File

@ -48,6 +48,7 @@ private _functions = [
["blck_fnc_getAllBlackeaglsMarkers" ,"\q\addons\custom_server\Compiles\Functions\GMS_fnc_getAllBlckeaglsMarkers.sqf"],
["blck_fnc_getAllMarkersOfSubtype","\q\addons\custom_server\Compiles\Functions\GMS_fnc_getAllMarkersOfSubtype.sqf"],
["blck_fnc_getAllDMSMarkers","\q\addons\custom_server\Compiles\Functions\GMS_fnc_getAllDMSMarkers.sqf"],
["blck_fnc_createMissionMarkers","\q\addons\custom_server\Compiles\Functions\GMS_fnc_createMissionMarkers.sqf"],
// Player-related functions
["GMS_fnc_handlePlayerUpdates","\q\addons\custom_server\Compiles\Units\GMS_fnc_handlePlayerUpdates.sqf"],

View File

@ -40,7 +40,7 @@ blck_activeMissions = [];
blck_connectedHCs = [];
blck_missionMarkerRootName = "blckeagls_marker";
DMS_missionMarkerRootName = "DMS_MissionMarker";
blck_missionMarkers = [];
blck_missionLabelMarkers = [];
blck_heliCrashSites = [];
blck_temporaryMarkers = [];
blck_illuminatedCrates = []; // [crate,duration,freq of replacement]

View File

@ -7,12 +7,12 @@ Many thanks for new Coding and ideas from Grahame.
Significant Changes:
=====================
6.96 Build 203
6.98 Build 204
FIXED: few minor bug fixes.
FIXED: Static Mission Loot vehicles are no longer deleted by Epoch servers when players enter them.
FIXED: an error in coordinates for some randomly spawned missions tha added an extra 0 to the array with the coordinaates.
Added: a define for NIA all in one in blck_defines;
Added a few preconfigures variables with lists of NIA Armas items.
Added a few preconfiguration variables with lists of NIA Armas items.
Added: an optional parameter to define the location of a mission as one of one or more locations in an array
_defaultMissionLocations = [];

View File

@ -63,7 +63,8 @@ waitUntil{(!isNil "blck_useHC") && (!isNil "blck_simulationManager") && (!isNil
uiSleep 10;
// Load any user-defined specifications or overrides
[] execVM "\q\addons\custom_server\Configs\blck_custom_config.sqf";
#include "\q\addons\custom_server\Configs\blck_custom_config.sqf";
diag_log format["[blckeagls] Custom Configurations Loaded at %1",diag_tickTime];
diag_log format["[blckeagls] debug mode settings:blck_debugON = %1 | blck_debugLevel = %3",blck_debugON,blck_debugLevel];

View File

@ -1,4 +1,4 @@
#define blck_buildNumber 203
#define blck_versionNumber 6.96
#define blck_buildDate "5-8-20"
#define blck_buildNumber 204
#define blck_versionNumber 6.98
#define blck_buildDate "5-26-20"