From 22a6fc572a393bc04ee753007c361277f69e5e93 Mon Sep 17 00:00:00 2001 From: "Ghostrider [GRG]" Date: Mon, 16 Oct 2023 15:35:01 -0400 Subject: [PATCH] Sorted issues with static missions Removed most debugging code. Static missions randomly selected from a list of available missions. See changelog for details. --- .../Functions/fn_createMissionMarkers.sqf | 29 ++-- @GMS/addons/GMS/Compiles/GMS_variables.sqf | 3 +- .../Missions/GMS_fnc_missionSpawner.sqf | 12 +- .../Compiles/Missions/fn_addMIssionToQue.sqf | 12 +- .../Missions/fn_initializeMission.sqf | 82 ++++++---- .../Missions/fn_monitorSpawnedMissions.sqf | 2 +- .../Missions/fn_spawnMissionAssets.sqf | 2 +- .../Missions/fn_spawnMissionHelis.sqf | 4 +- .../fn_spawnMissionVehiclePatrols.sqf | 6 +- .../Compiles/Missions/fn_spawnNewMissions.sqf | 149 ++++++++++-------- @GMS/addons/GMS/Compiles/init/fn_init.sqf | 12 +- @GMS/addons/GMS/Configs/GMS_configs.sqf | 4 +- @GMS/addons/GMS/Configs/GMS_custom_config.sqf | 2 +- @GMS/addons/GMS/config.cpp | 6 +- 14 files changed, 185 insertions(+), 140 deletions(-) diff --git a/@GMS/addons/GMS/Compiles/Functions/fn_createMissionMarkers.sqf b/@GMS/addons/GMS/Compiles/Functions/fn_createMissionMarkers.sqf index 3c1c120..1f9113f 100644 --- a/@GMS/addons/GMS/Compiles/Functions/fn_createMissionMarkers.sqf +++ b/@GMS/addons/GMS/Compiles/Functions/fn_createMissionMarkers.sqf @@ -18,7 +18,8 @@ private "_markers"; "_markerColor", "_markerType", // Use either the name of the icon or "ELLIPSE" or "RECTANGLE" where non-icon markers are used ["_markerSize",[0,0]], - ["_markerBrush","GRID"] + ["_markerBrush","GRID"], + ["_showMarkers",true] ]; if (GMS_debugLevel > 3) then @@ -41,22 +42,28 @@ if (GMS_debugLevel > 3) then if (toUpper(_markerType) in ["ELLIPSE","RECTANGLE"]) then // not an Icon .... { private _m = createMarker [GMS_missionMarkerRootName + _markerName,_markerPos]; - _m setMarkerShape _markerType; - _m setMarkerColor _markerColor; - _m setMarkerBrush _markerBrush; - _m setMarkerSize _markerSize; + If (_showMarkers) then { + _m setMarkerShape _markerType; + _m setMarkerColor _markerColor; + _m setMarkerBrush _markerBrush; + _m setMarkerSize _markerSize; + }; private _m2 = createMarker [GMS_missionMarkerRootName + _markerName + "label", _markerPos]; - _m2 setMarkerType "loc_destroy"; - _m2 setMarkerColor "ColorWhite"; - _m2 setMarkerText _markerLabel; + if (_showMarkers) then { + _m2 setMarkerType "loc_destroy"; + _m2 setMarkerColor "ColorWhite"; + _m2 setMarkerText _markerLabel; + }; _markers = [_m,_m2]; //diag_log format["_fnc_createMarkers: case of ELLIPSE/RECTANGLE: _markers = %1",_markers]; } else { private _m = ""; private _m2 = createMarker [GMS_missionMarkerRootName + _markerName + "label", _markerPos]; - _m2 setMarkerType _markerType; - _m2 setMarkerColor _markerColor; - _m2 setMarkerText _markerLabel; + if (_showMarkers) then { + _m2 setMarkerType _markerType; + _m2 setMarkerColor _markerColor; + _m2 setMarkerText _markerLabel; + }; _markers = [_m,_m2]; //diag_log format["_fnc_createMarkers: case of ICON: _markers = %1",_markers]; }; diff --git a/@GMS/addons/GMS/Compiles/GMS_variables.sqf b/@GMS/addons/GMS/Compiles/GMS_variables.sqf index 416b4c6..e5a9cd0 100644 --- a/@GMS/addons/GMS/Compiles/GMS_variables.sqf +++ b/@GMS/addons/GMS/Compiles/GMS_variables.sqf @@ -43,8 +43,9 @@ GMS_spawnHelisPass = 0; //GMS_aiKilled = false; GMS_triggered = false; GMS_revealMode = "detailed"; //""basic" /*group or vehicle level reveals*/,detailed /*unit by unit reveals*/"; -GMS_dynamicMissionsSpawned = 0; +GMS_MissionsSpawned = 0; GMS_missionData = []; + GMS_initializedMissionsList = []; GMS_landVehiclePatrols = []; GMS_aircraftPatrols = []; diff --git a/@GMS/addons/GMS/Compiles/Missions/GMS_fnc_missionSpawner.sqf b/@GMS/addons/GMS/Compiles/Missions/GMS_fnc_missionSpawner.sqf index af2346f..9909333 100644 --- a/@GMS/addons/GMS/Compiles/Missions/GMS_fnc_missionSpawner.sqf +++ b/@GMS/addons/GMS/Compiles/Missions/GMS_fnc_missionSpawner.sqf @@ -26,7 +26,9 @@ private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_mission "_chanceMissionSpawned", "_rewardVehicles", // New private Variables from 10-15-23 - "_timeoutMsg" + "_timeoutMsg", + "_missionLandscapeMode", + "_showMarker" ]; params["_markerName",["_aiDifficultyLevel","Red"]]; @@ -92,6 +94,7 @@ if (isNil "_missionemplacedweapons") then {_missionemplacedweapons = []}; // Allow for and capture any custom difficult setting in the mission if !(isNil "_difficulty") then {_aiDifficultyLevel = _difficulty}; if (isNil "_timeoutMsg") then {_timeoutMsg = ""}; +if (isNil "_showMarker") then {_showMarker = true}; _markerType params["_markerType",["_markersize",[250,250]],["_markerBrush","GRID"]]; private _paraSkill = _aiDifficultyLevel; @@ -100,12 +103,12 @@ private _paraSkill = _aiDifficultyLevel; if !(_spawnCratesTiming in GMS_validLootSpawnTimings) then { [format['Invalid crate spawn timing %1 found in mission %2 :: default value atMissionSpawnGround used',_spawnCratesTiming,_markerMissionName],""] call GMS_fnc_log; - _spawnCratesTiming = atMissionSpawnGround; + _spawnCratesTiming = "atMissionSpawnGround"; }; if !(_loadCratesTiming in GMS_validLootLoadTimings) then { [format['Invalid crate loading timing %1 found in mission %2 :: default atMissionSpawn value used',_loadCratesTiming,_markerMissionName],""] call GMS_fnc_log; - _loadCratesTiming = atMissionSpawn; + _loadCratesTiming = "atMissionSpawn"; }; if !(_endCondition in GMS_validEndStates) then { @@ -119,7 +122,8 @@ private _markerConfigs = [ _markerType, _markerColor, _markerSize, - _markerBrush + _markerBrush, + _showMarker ]; private _paraConfigs = [ diff --git a/@GMS/addons/GMS/Compiles/Missions/fn_addMIssionToQue.sqf b/@GMS/addons/GMS/Compiles/Missions/fn_addMIssionToQue.sqf index b562ab3..c206a95 100644 --- a/@GMS/addons/GMS/Compiles/Missions/fn_addMIssionToQue.sqf +++ b/@GMS/addons/GMS/Compiles/Missions/fn_addMIssionToQue.sqf @@ -12,7 +12,7 @@ params[["_missionList",[]],["_path",""],["_marker",""],["_difficulty","Red"],["_ //diag_log format["_addMissionToQue: _this = %1",_this]; //{ - //diag_log format["_addMissionToQue: _this %1 = %2",_forEachIndex, _this select _forEachIndex]; +// diag_log format["_addMissionToQue: _this %1 = %2",_forEachIndex, _this select _forEachIndex]; //} forEach _this; private "_waitTime"; @@ -22,13 +22,13 @@ if (_isStatic) then { _waitTime = diag_tickTime + (_tMin) + random((_tMax) - (_tMin)); }; -diag_log format["_addMissionToQue: _waitTime = %1",_waitTime]; +//diag_log format["_addMissionToQue: _waitTime = %1",_waitTime]; private _missionsData = []; // Parameters definine each of the missions for this difficulty are stored as arrays here. { private _missionFile = format["\GMS\Missions\%1\%2.sqf",_path,_x]; - diag_log format["_addMissionToQue: _missionFile = %1",_missionFile]; + //diag_log format["_addMissionToQue: _missionFile = %1",_missionFile]; private _missionCode = compileFinal preprocessFileLinenumbers _missionFile;//return all of the values that define how the mission is spawned as an array of values if !(isNil "_missionCode") then { @@ -36,10 +36,10 @@ private _missionsData = []; // Parameters definine each of the missions for this if !(isNil "_data") then { _missionsData pushBack _data; - diag_log format["_addMissionToQue: _data = %1",_data]; + //diag_log format["_addMissionToQue: _data = %1",_data]; }; } else { - diag_log format["bad path\mission combination %1",_missionFile]; + //diag_log format["bad path\mission combination %1",_missionFile]; }; } forEach _missionList; @@ -56,7 +56,7 @@ private _missions = [ _missionsData, // Array of data about individual missions that could be spawned. The data table for each mission is defined in _missionSpawner _isStatic ]; -diag_log format["_addMissionToQue (55): _missions = %1",_missions]; +//diag_log format["_addMissionToQue (55): _missions = %1",_missions]; GMS_missionData pushBack _missions; diff --git a/@GMS/addons/GMS/Compiles/Missions/fn_initializeMission.sqf b/@GMS/addons/GMS/Compiles/Missions/fn_initializeMission.sqf index 6fe78c6..d7188c0 100644 --- a/@GMS/addons/GMS/Compiles/Missions/fn_initializeMission.sqf +++ b/@GMS/addons/GMS/Compiles/Missions/fn_initializeMission.sqf @@ -22,25 +22,25 @@ params[ "_isStatic" ]; - // _missionConfigs is configured as: - /* - params [ - _aiDifficultyLevel, // index 0 - _markerConfigs, // index 1 - _endCondition, // index 2 - _isscubamission, // index 3 - _missionLootConfigs, // index 4 - _aiConfigs, // index 5 - _missionMessages, // index 6 - _paraConfigs, // index 7 - _defaultMissionLocations, // index 8 - _maxMissionRespawns, // index 9 - _timesSpawned, // index 10 - _chanceMissionSpawned, // index 11 - _isSpawned, // index 12 - _spawnedAt // index 13 - ]; - */ +// _missionConfigs is configured as: +/* + params [ + _aiDifficultyLevel, // index 0 + _markerConfigs, // index 1 + _endCondition, // index 2 + _isscubamission, // index 3 + _missionLootConfigs, // index 4 + _aiConfigs, // index 5 + _missionMessages, // index 6 + _paraConfigs, // index 7 + _defaultMissionLocations, // index 8 + _maxMissionRespawns, // index 9 + _timesSpawned, // index 10 + _chanceMissionSpawned, // index 11 + _isSpawned, // index 12 + _spawnedAt // index 13 + ]; +*/ _missionConfigs params [ "_difficulty", // index 0 @@ -59,11 +59,28 @@ params[ "_spawnedAt" // index 13 ]; -#define timesSpawnedIndex 11 - -//diag_log format["_fnc_initializeMission _chanceMissionRespawned = %1", _chanceMissionSpawned]; // do not initialize if the odds of spawning are not favorable. -if (random(1) > _chanceMissionSpawned) exitWith {-1}; +if (random(1) > _chanceMissionSpawned) exitWith { + diag_log format["_initializeMission (27): returning value of -1"]; + -1 +}; +// If the mission has already been spawned the max number of times, pass back a code indicating that. +if (!(_maxMissionRespawns == -1) && (_timesSpawned > _maxMissionRespawns)) exitWith { + diag_log format["_initializeMission (32): returning value of -2"]; + -2 +}; +// If the mission has not been spawned, but is a static mission and could be spawned if it met the test for chance of a spawn, pass back a code indicating that. +if (random(1) > _chanceMissionSpawned && (_isStatic) && (_timesSpawned == 0)) exitWith { + diag_log format["_initializeMission (37): returning value of 2"]; + 2 +}; +// If the mission is a static mission and it has been spawned but not cleared then pass back a code indicating that +if (_isStatic && _isSpawned) exitWith { + diag_log format["_initializeMission (42): returning value of 3"]; + 3 +}; + +#define timesSpawnedIndex 11 _markerConfigs params[ "_markerName", // The unique text identifier for the marker @@ -71,14 +88,12 @@ _markerConfigs params[ "_markerType", "_markerColor", "_markerSize", - "_markerBrush" + "_markerBrush", + "_showMarkers" ]; //[format["_initializeMission (39): _markerName %1 | _key %2 | _missionCount %3 | _maxMissionRespawns %4 | _timesSpawned %5",_markerName,_key,_missionCount,_maxMissionRespawns,_timesSpawned]] call GMS_fnc_log; -// If the mission is a static mission and it has been spawned but not cleared then pass back a code indicating that -if (_isStatic && _isSpawned) exitWith {private _initialized = 3; _initialized}; - private _initialized = 0; /* @@ -110,7 +125,7 @@ if (_coords isEqualTo [] || {_coords isEqualTo [0,0,0]}) exitWith GMS_ActiveMissionCoords pushback _coords; GMS_missionsRunning = GMS_missionsRunning + 1; -//[format["_initializeMission (70): _coords = %1 | GMS_missionsRunning = %2",_coords,GMS_missionsRunning]] call GMS_fnc_log; +//[format["_initializeMission (118): _coords = %1 | GMS_missionsRunning = %2",_coords,GMS_missionsRunning]] call GMS_fnc_log; private _markers = []; @@ -142,7 +157,7 @@ if !(GMS_preciseMapMarkers) then private _markerError = false; if !(toLowerANSI (_markerType) in ["ellipse","rectangle"] || {isClass(configFile >> "CfgMarkers" >> _markerType)} ) then { - //[format["_markerType set to 'ELLIPSE': Illegal marker type %1 used for mission %2 of difficulty %3",_markerType,_markerMissionName,_difficulty],"warning"] call GMS_fnc_log; + [format["_markerType set to 'ELLIPSE': Illegal marker type %1 used for mission %2 of difficulty %3",_markerType,_markerMissionName,_difficulty],"warning"] call GMS_fnc_log; _markerType = "ELLIPSE"; _markerSize = [200,200]; _markerBrush = "GRID"; @@ -151,7 +166,7 @@ if !(toLowerANSI (_markerType) in ["ellipse","rectangle"] || {isClass(configFile if !(isClass(configFile >> "CfgMarkerColors" >> _markerColor)) then { - //[format["_markerColor set to 'default': Illegal color %1 used for mission %2 of difficulty %3",_markerColor,_markerMissionName,_difficulty],"warning"] call GMS_fnc_log; + [format["_markerColor set to 'default': Illegal color %1 used for mission %2 of difficulty %3",_markerColor,_markerMissionName,_difficulty],"warning"] call GMS_fnc_log; _markerColor = "DEFAULT"; _markerError = true; }; @@ -166,9 +181,11 @@ private _markers = [ _markerColor, _markerType, _markerSize, - _markerBrush] call GMS_fnc_createMissionMarkers; + _markerBrush, + _showMarkers +] call GMS_fnc_createMissionMarkers; -if (GMS_debugLevel >= 0) then {[format["_initializeMission (130): _marker = %1 | _markerMissionName = %2 | _difficulty = %3",_markers,_markerMissionName,_difficulty]] call GMS_fnc_log}; +//if (GMS_debugLevel >= 0) then {[format["_initializeMission (130): _marker = %1 | _markerMissionName = %2 | _difficulty = %3",_markers,_markerMissionName,_difficulty]] call GMS_fnc_log}; /* Send a message to players. @@ -205,6 +222,7 @@ private _missionData = [ lootVehicles, // index 8 _markers // index 9 ]; + #define spawnPara -1 GMS_initializedMissionsList pushBack [_key, missionTimeoutAt, triggered, _missionData, _missionConfigs, spawnPara,_isStatic]; //[format["_initializeMission (163): count GMS_initializedMissionsList = %1",count GMS_initializedMissionsList]] call GMS_fnc_log; diff --git a/@GMS/addons/GMS/Compiles/Missions/fn_monitorSpawnedMissions.sqf b/@GMS/addons/GMS/Compiles/Missions/fn_monitorSpawnedMissions.sqf index 1d300b7..5baa881 100644 --- a/@GMS/addons/GMS/Compiles/Missions/fn_monitorSpawnedMissions.sqf +++ b/@GMS/addons/GMS/Compiles/Missions/fn_monitorSpawnedMissions.sqf @@ -229,7 +229,7 @@ for "_i" from 1 to (count _missionsList) do "_missionLootVehicles" ]; - if (GMS_debugLevel > 0) then {[format["_monitorSpawnedMissions(234): _exception = %1 | _spawnedAt = %2",_exception,_spawnedAt]] call GMS_fnc_log}; + //if (GMS_debugLevel > 0) then {[format["_monitorSpawnedMissions(234): _exception = %1 | _spawnedAt = %2",_exception,_spawnedAt]] call GMS_fnc_log}; switch (_exception) do { case 1: { // Normal Mission End diff --git a/@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionAssets.sqf b/@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionAssets.sqf index d4b79b7..4ebd093 100644 --- a/@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionAssets.sqf +++ b/@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionAssets.sqf @@ -358,7 +358,7 @@ if (_spawnCratesTiming in ["atMissionSpawnGround","atMissionSpawnAir"]) then if (_loadCratesTiming isEqualTo "atMissionSpawn") then { private _crateMoney =(missionNamespace getVariable[format["GMS_crateMoney%1",_difficulty],GMS_rewardsOrange]); - diag_log format["_spawnMissionAssets(395): _crateMoney = %1",_crateMoney]; + //diag_log format["_spawnMissionAssets(395): _crateMoney = %1",_crateMoney]; { [_x,_difficulty,_crateMoney] call GMSCore_fnc_setMoney; } forEach _crates; diff --git a/@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionHelis.sqf b/@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionHelis.sqf index 5ba90c9..982e050 100644 --- a/@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionHelis.sqf +++ b/@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionHelis.sqf @@ -84,12 +84,12 @@ private _units = []; ] call GMSCore_fnc_initializeWaypointsAreaPatrol; */ _helis pushBack _aircraft; - if (GMS_debugLevel > 0) then {[format["_spawnMissionHelis: _heli %1 spawned with pilot %2 and crew %2",typeOf _aircraft, currentPilot _aircraft, _crewGroup]] call GMS_fnc_log}; + //if (GMS_debugLevel > 0) then {[format["_spawnMissionHelis: _heli %1 spawned with pilot %2 and crew %2",typeOf _aircraft, currentPilot _aircraft, _crewGroup]] call GMS_fnc_log}; } else { [format["GMS_fnc_spawnMissionHelis: Invalid classname %1 used in _airPatrols", _heli],"warning"] call GMS_fnc_log; }; } forEach _missionHelis; -[format["GMS_fnc_spawnMissionHelis: count _units = %1 | count _helis = %2", count _units, count _helis]] call GMS_fnc_log; +//[format["GMS_fnc_spawnMissionHelis: count _units = %1 | count _helis = %2", count _units, count _helis]] call GMS_fnc_log; GMS_spawnHelisPass = GMS_spawnHelisPass + 1; [_helis,_units] \ No newline at end of file diff --git a/@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionVehiclePatrols.sqf b/@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionVehiclePatrols.sqf index 7ff5342..aa332ae 100644 --- a/@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionVehiclePatrols.sqf +++ b/@GMS/addons/GMS/Compiles/Missions/fn_spawnMissionVehiclePatrols.sqf @@ -39,9 +39,9 @@ private _patrolsThisMission = +_missionPatrolVehicles; { //diag_log format["_spawnMissionVehiclePatrols(41): _x = %1",_x]; _x params[["_vehName",""],["_pos",[]],["_dir",0]]; - diag_log format["_spawnMissionVehiclePatrols(43): _vehName = %1 | _pos = %2 | _dir = %3 | isClass _vehName = %4",_vehName,_pos,_dir, isClass(configFile >> "CfgVehicles" >> _vehName)]; + //diag_log format["_spawnMissionVehiclePatrols(43): _vehName = %1 | _pos = %2 | _dir = %3 | isClass _vehName = %4",_vehName,_pos,_dir, isClass(configFile >> "CfgVehicles" >> _vehName)]; _pos = _coords vectorAdd _pos; // else {_pos = (_coords vectorAdd _pos) findEmptyPosition[0,50,_vehName]}; - diag_log format["_spawnMissionVehiclePatrols(45): _pos updated to %1",_pos]; + //diag_log format["_spawnMissionVehiclePatrols(45): _pos updated to %1",_pos]; if (isClass(configFile >> "CfgVehicles" >> _vehName)) then { if !(_pos isEqualTo []) then { @@ -122,6 +122,6 @@ private _patrolsThisMission = +_missionPatrolVehicles; } forEach _patrolsThisMission; GMS_landVehiclePatrols append _vehicles; GMS_monitoredVehicles append _vehicles; -[format["GMS_fnc_spawnMissionVehiclePatrols: count _missionAI = %1 | count _vehicles = %2", count _missionAI, count _vehicles]] call GMS_fnc_log; +//[format["GMS_fnc_spawnMissionVehiclePatrols: count _missionAI = %1 | count _vehicles = %2", count _missionAI, count _vehicles]] call GMS_fnc_log; [_vehicles, _missionAI]; diff --git a/@GMS/addons/GMS/Compiles/Missions/fn_spawnNewMissions.sqf b/@GMS/addons/GMS/Compiles/Missions/fn_spawnNewMissions.sqf index 79701ec..8b1899a 100644 --- a/@GMS/addons/GMS/Compiles/Missions/fn_spawnNewMissions.sqf +++ b/@GMS/addons/GMS/Compiles/Missions/fn_spawnNewMissions.sqf @@ -19,89 +19,100 @@ if (GMS_missionsRunning >= GMS_maxSpawnedMissions) exitWith { [format["_spawnNewMissions (18): GMS_maxSpawnedMissions of %1 Reached",GMS_maxSpawnedMissions]] call GMS_fnc_log; }; -//[format["_spawnNewMissions (18): time = %1 GMS_debugLevel = %2",diag_tickTime,GMS_debugLevel]] call GMS_fnc_log; + +for "_i" from 1 to (count GMS_missionData) do { - private _missionDescriptors = _x; + if (_i > (count GMS_missionData)) exitWith {}; + private _missionDescriptors = GMS_missionData deleteAt 0; + // _missionDescriptor is configures as follows: /* private _mission = [ - _key, + _key, // We can search for this key or for _missionDescriptors if we need to delete this particular mission. _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, // Array of data about individual missions that could be spawned. The data table for each mission is defined in _missionSpawner + _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, // Array of data about individual missions that could be spawned. The data table for each mission is defined in _missionSpawner _isStatic ]; - */ + */ + _missionDescriptors params["_key","_difficulty","_maxMissions","_activeMissions","_tMin","_tMax","_waitTime","_missionsData","_isStatic"]; - /* - { - diag_log format["_spawnNewMission: _this %1 = %2",_forEachIndex, _x]; - } forEach _missionDescriptors; - */ - - //diag_log format["_spawnNewMission: _missionsData = %1",_missionsData]; - - if (_missionsData isEqualTo []) exitWith {-1}; - if (_activeMissions < _maxMissions && {diag_tickTime > _waitTime && {GMS_missionsRunning < GMS_maxSpawnedMissions}}) then - { - // time to reset timers and spawn something. - private _missionSelected = selectRandom _missionsData; - // _missionSelected is configured as: + // Just in case there are no missions to choose from for some reason. + // But this could happen if all of the available missions had reached their maximal number of respawns. + // Note that an element with an empty _missionsData array is not added back for future evaluation. + if !(_missionsData isEqualTo []) then { /* - params [ - _aiDifficultyLevel, // index 0 - _markerConfigs, // index 1 - _endCondition, // index 2 - _isscubamission, // index 3 - _missionLootConfigs, // index 4 - _aiConfigs, // index 5 - _missionMessages, // index 6 - _paraConfigs, // index 8 - _defaultMissionLocations, // index 9 - _maxMissionRespawns, // index 10 - _timesSpawned, // index 11 - _chanceMissionSpawned, // index 12 - _isSpawned, // index 13 - _spawnedAt // index 14 - ]; + _activeMissions = the number of active missions allowed of this type which can be, for example, blue missions or static missions. + _maxMissions = the maximum number of missions allowed of this type. + _waitTime = at what time can the next mission be spawned. */ - /*{ - diag_log format["_spawnNewMission:_missionSelected: _this %1 = %2",_forEachIndex,_x]; - } forEach _missionSelected; - */ - /* - params[ // for GMS_fnc_initialiZeMission are - "_key", // This key can be used to seach the list of available mission types to update that list when a mission is completed or times out - "_missionConfigs", // Selfevident but this is an array with all configs for the mission - "_missionCount", // The number of missions run thus far which is used to unsure each marker has a unique name - "_isStatic" - ]; - */ - //diag_log format["_spawnNewMissions: _missionSelected = %1",_missionSelected]; - private _missionInitialized = [_key,_missionSelected,GMS_dynamicMissionsSpawned,_isStatic] call GMS_fnc_initializeMission; - - if (_missionInitialized == 1) then { // This is a dynamic mission s see if we can spawn another instance of this categore (blue, red, green, orange) - GMS_dynamicMissionsSpawned = GMS_dynamicMissionsSpawned + 1; - #define waitTime 6 - #define noActive 3 - private _wt = diag_tickTime + _tmin + (random(_tMax - _tMin)); - _missionDescriptors set[waitTime, _wt]; - _missionDescriptors set[noActive, _activeMissions + 1]; - } else { - if (_missionInitialized == -1) then // failed the test about chance of spawning + if (_activeMissions < _maxMissions && {diag_tickTime > _waitTime && {GMS_missionsRunning < GMS_maxSpawnedMissions}}) then + { + // time to reset timers and spawn something. + private _missionSelected = selectRandom _missionsData; + // _missionSelected is configured as: + /* + params [ + _aiDifficultyLevel, // index 0 + _markerConfigs, // index 1 + _endCondition, // index 2 + _isscubamission, // index 3 + _missionLootConfigs, // index 4 + _aiConfigs, // index 5 + _missionMessages, // index 6 + _paraConfigs, // index 8 + _defaultMissionLocations, // index 9 + _maxMissionRespawns, // index 10 + _timesSpawned, // index 11 + _chanceMissionSpawned, // index 12 + _isSpawned, // index 13 + _spawnedAt // index 14 + ]; + */ + private _missionInitialized = [_key,_missionSelected,GMS_MissionsSpawned,_isStatic] call GMS_fnc_initializeMission; + //[format["_spawnNewMissions (78) GMS_fnc_initializeMission returned %1",_missionInitialized]] call GMS_fnc_log; + switch (_missionInitialized) do { - #define waitTime 6 - private _wt = diag_tickTime + _tmin + (random(_tMax - _tMin)); - _missionDescriptors set[waitTime, _wt]; + case -2: { + // Handle the case in which a mission has been spawned _maxmissionRespawns + [format["_spawnNewMission (82): count _missionsData before deletion = %1", count _missionsData]] call GMS_fnc_log; + private _posn = _missionsData findIf {(_x select 0) isEqualTo _key}; + _missionsData deleteAt _posn; + [format["_spawnNewMission (85): count _missionsData after deletion = %1", count _missionsData]] call GMS_fnc_log; + #define missionsData 7 + _missionDescriptors set [missionsData, _missionsData]; + }; + case -1: { + #define waitTime 6 + private _wt = diag_tickTime + _tmin + (random(_tMax - _tMin)); + _missionDescriptors set[waitTime, _wt]; + }; + case 1: { + GMS_MissionsSpawned = GMS_MissionsSpawned + 1; + #define waitTime 6 + #define noActive 3 + private _wt = diag_tickTime + _tmin + (random(_tMax - _tMin)); + _missionDescriptors set[waitTime, _wt]; + _missionDescriptors set[noActive, _activeMissions + 1]; + }; + case 2: { // A special case for static missions that have never been spawned that did not pass the test for chance of a spawn. Here we set waitTime to 60 sec. + #define waitTime 6 + private _wt = diag_tickTime + 60; + _missionDescriptors set[waitTime, _wt]; + }; + case 3: { + // Nothing to do here at this time. + }; }; - }; + }; + GMS_missionData pushBack _missionDescriptors; }; -} forEach GMS_missionData; +}; private _exitcode = 1; _exitCode; diff --git a/@GMS/addons/GMS/Compiles/init/fn_init.sqf b/@GMS/addons/GMS/Compiles/init/fn_init.sqf index 103da80..dc37e8a 100644 --- a/@GMS/addons/GMS/Compiles/init/fn_init.sqf +++ b/@GMS/addons/GMS/Compiles/init/fn_init.sqf @@ -203,10 +203,14 @@ if (GMS_enableStaticMissions > 0 && !(_missionLIstStatics isEqualTo [])) then // private _isStatic = true; private _numberStatics = count _missionListStatics; { - if ((count _staticsToSpawn) > (count _missionLIstStatics)) exitWith {}; - private _mission = selectRandom _missionLIstStatics; + [format["_init (206): _missionListStatics %1 = %2",_forEachIndex, _x]] call GMS_fnc_log; + } forEach _missionListStatics; + while {(count _staticsToSpawn) < (count _missionListStatics) && ((count _staticsToSpawn) < (GMS_enableStaticMissions))} do + { + private _mission = selectRandom _missionListStatics; _staticsToSpawn pushBackUnique _mission; - } forEach _missionLIstStatics; + [format["GMS_fnc_init (209): _mission = %1 | count _staticsToSpawn = %2",_mission, count _staticsToSpawn]] call GMS_fnc_log; + }; /* params[ ["_missionList",[]], @@ -218,7 +222,7 @@ if (GMS_enableStaticMissions > 0 && !(_missionLIstStatics isEqualTo [])) then // ["_noMissions",1], ["_isStatic",false]]; */ - //diag_log format["_init: count _staticsToSpawn = %1 | GMS_enableStaticMissions = %2:",count _staticsToSpawn,GMS_enableStaticMissions]; + diag_log format["_init: count _staticsToSpawn = %1 | GMS_enableStaticMissions = %2:",count _staticsToSpawn,GMS_enableStaticMissions]; [_staticsToSpawn,_pathStatics,"StaticsMarker","orange",GMS_TMin_Statics,GMS_TMax_Statics,GMS_enableStaticMissions,_isStatic] call GMS_fnc_addMissionToQue; }; diff --git a/@GMS/addons/GMS/Configs/GMS_configs.sqf b/@GMS/addons/GMS/Configs/GMS_configs.sqf index 63284c1..9b2449a 100644 --- a/@GMS/addons/GMS/Configs/GMS_configs.sqf +++ b/@GMS/addons/GMS/Configs/GMS_configs.sqf @@ -17,7 +17,7 @@ changing any of these variables may break the mission system */ GMS_locationBlackList = []; // Do not touch ... - GMS_debugLevel = 3; // should be set to 0 ... + GMS_debugLevel = 0; // should be set to 0 ... [format["Loading configurations for Non-militarized servers"]] call GMS_fnc_log; /* @@ -342,7 +342,7 @@ switch (GMSCore_modType) do GMS_enableRedMissions = 2; GMS_enableBlueMissions = 1; GMS_numberUnderwaterDynamicMissions = 0; // Values from -1 (no UMS) to N (N Underwater missions will be spawned; static UMS units and subs will be spawned. - GMS_enableStaticMissions = 3; + GMS_enableStaticMissions = 2; #ifdef GRGserver GMS_enableHunterMissions = 1; diff --git a/@GMS/addons/GMS/Configs/GMS_custom_config.sqf b/@GMS/addons/GMS/Configs/GMS_custom_config.sqf index 119d57f..3472e17 100644 --- a/@GMS/addons/GMS/Configs/GMS_custom_config.sqf +++ b/@GMS/addons/GMS/Configs/GMS_custom_config.sqf @@ -152,7 +152,7 @@ if (GMS_debugLevel > 0) then { GMS_enableRedMissions = 0; // 10-2-2023 Tested with mission list= "fuelDepot", "junkyardWilly", "TraderBoss", "carThieves", "Ammunition_depot", "IDAP", "Outpost", "Service_Point" GMS_enableBlueMissions = 0; // 10-2-2023 Tested with mission list= "sniperBase", "survivalSupplies", "Service_point", and "default" GMS_numberUnderwaterDynamicMissions = 0; - GMS_enableHunterMissions = 0; + GMS_enableHunterMissions = 1; GMS_enableScoutsMissions = 1; GMS_enableStaticMissions = 1; GMS_maxCrashSites = 0; diff --git a/@GMS/addons/GMS/config.cpp b/@GMS/addons/GMS/config.cpp index 01ca2f6..f14a973 100644 --- a/@GMS/addons/GMS/config.cpp +++ b/@GMS/addons/GMS/config.cpp @@ -12,9 +12,9 @@ */ class GMSBuild { - Version = "7.166"; - Build = "271"; - Date = "10-15-2023"; + Version = "7.17"; + Build = "272"; + Date = "10-16-2023"; }; class CfgPatches {