diff --git a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_AIM.sqf b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_AIM.sqf index d6f94ef..1cf31ab 100644 --- a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_AIM.sqf +++ b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_AIM.sqf @@ -3,7 +3,7 @@ //blck_Message = _this; params["_msg",["_players",playableUnits]]; -diag_log format["AIM.sqf ===] _this = %1 | _msg = %2 | _players = %3",_this,_msg, _players]; +if (blck_debugLevel > 1) then {diag_log format["AIM.sqf ===] _this = %1 | _msg = %2 | _players = %3",_this,_msg, _players];}; blck_Message = _msg; { //diag_log format["AIM.sqf ===] _ = %2, and (owner _x) = %1", (owner _x), _x]; diff --git a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_mainThread.sqf b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_mainThread.sqf index 8ec1ca6..e91009f 100644 --- a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_mainThread.sqf +++ b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_mainThread.sqf @@ -5,11 +5,10 @@ - whether it is time to delete the mission objects at a specific location - whether it is time to delete live AI associated with a specific mission By Ghostrider-DbD- - Last modified 1-13-17 + Last modified 1-21-17 */ -private ["_index","_timer10Min","_timer1min","_timer5min","_modType"]; +private ["_timer10Min","_timer1min","_timer5min","_modType"]; -_index = 0; _timer5sec = diag_tickTime; _timer1min = diag_tickTime; _timer5min = diag_tickTime; @@ -28,31 +27,31 @@ while {true} do }; if ((diag_tickTime - _timer1min) > 15) then { - diag_log format["_fnc_mainThread:: (30) diag_tickTime = %1", diag_tickTime]; - diag_log format["_fnc_mainThread:: (31) blck_liveMissionAI = %1", blck_liveMissionAI]; + //diag_log format["_fnc_mainThread:: (30) diag_tickTime = %1", diag_tickTime]; + //diag_log format["_fnc_mainThread:: (31) blck_liveMissionAI = %1", blck_liveMissionAI]; _ai = blck_liveMissionAI; { - diag_log format["_fnc_mainThread:: (34) evaluating liveAIArray %1 with diag_tickTime %2", _x,diag_tickTime]; + //diag_log format["_fnc_mainThread:: (34) evaluating liveAIArray %1 with diag_tickTime %2", _x,diag_tickTime]; if (diag_tickTime > (_x select 1) ) then { - diag_log format["_fnc_mainTread:: cleaning up AI group %1",_x]; + //diag_log format["_fnc_mainTread:: cleaning up AI group %1",_x]; [_x select 0] call blck_fnc_cleanupAliveAI; blck_liveMissionAI set[ _forEachIndex, -1]; blck_liveMissionAI = blck_liveMissionAI - [-1]; // Remove that list of live AI from the list. - diag_log format["_fnc_mainTread:: blck_liveMissionAI updated from %1",_ai]; + //diag_log format["_fnc_mainTread:: blck_liveMissionAI updated from %1",_ai]; diag_log format["_fnc_mainTread:: blck_liveMissionAI updated to %1",blck_liveMissionAI]; }; }forEach _ai; - diag_log format["_fnc_mainThread:: (44) blck_oldMissionObjects = %1", blck_oldMissionObjects]; + //diag_log format["_fnc_mainThread:: (44) blck_oldMissionObjects = %1", blck_oldMissionObjects]; _obj = blck_oldMissionObjects; { - diag_log format["mainThread::-->> evaluating missionObjects = %1 diag_tickTime %2",_x,diag_tickTime]; + //diag_log format["mainThread::-->> evaluating missionObjects = %1 diag_tickTime %2",_x,diag_tickTime]; if (diag_tickTime > (_x select 1) ) then { - diag_log format["_fnc_mainTread:: cleaning up mission objects %1",_x]; + //diag_log format["_fnc_mainTread:: cleaning up mission objects %1",_x]; [_x select 0] call blck_fnc_cleanupObjects; blck_oldMissionObjects set[_forEachIndex, -1]; blck_oldMissionObjects = blck_oldMissionObjects - [-1]; - diag_log format["_fnc_mainTread:: blck_oldMissionObjects updated from %1",_obj]; + //diag_log format["_fnc_mainTread:: blck_oldMissionObjects updated from %1",_obj]; diag_log format["_fnc_mainTread:: blck_oldMissionObjects updated to %1",blck_oldMissionObjects]; }; }forEach _obj; @@ -63,7 +62,6 @@ while {true} do [] call blck_fnc_cleanEmptyGroups; }; // Exile cleans up empty groups automatically so this should not be needed with that mod. - /* [Jan 13, 2017] reverted the the approach based on mission timers for now { if (blck_debugLevel > 2) then {diag_log format["_fnc_mainThread:: -- >> _x = %1 and _x select 6 = %2",_x, _x select 6];}; if (_x select 6 > 0) then // The mission is not running, check the time left till it is spawned @@ -72,22 +70,15 @@ while {true} do { private _coords = [] call blck_fnc_FindSafePosn; _coords pushback 0; - blck_ActiveMissionCoords pushback _coords; // Note, old entries are delete in blck_fnc_FindSafePosn - private["_markerClass","_missionName","_missionPath","_aiDifficultyLevel"]; - //diag_log format["_fnc_mainThread:: -->> _missionClass would = %1%2",_x select 2, _index]; - _markerClass = _x select 2; - if (blck_debugLevel > 2) then {diag_log format["_fnc_mainThread:: -->> _markerClass = %1",_markerClass];}; - _aiDifficultyLevel = _x select 4; + private["_missionName","_missionPath"]; _missionName = selectRandom (_x select 0); _missionPath = _x select 1; - // example: - // [_missionListHunters,_pathHunters,"HunterMarker","green",blck_TMin_Hunter,blck_TMax_Hunter] - [_coords,_markerClass,_aiDifficultyLevel] execVM format["\q\addons\custom_server\Missions\%1\%2.sqf",_missionPath,_missionName]; + [_coords,_x] execVM format["\q\addons\custom_server\Missions\%1\%2.sqf",_missionPath,_missionName]; }; }; }forEach blck_pendingMissions; _timer1min = diag_tickTime; - */ + }; if ((diag_tickTime - _timer5min) > 300) then { diff --git a/@epochhive/addons/custom_server/Compiles/Groups/GMS_fnc_spawnGroup.sqf b/@epochhive/addons/custom_server/Compiles/Groups/GMS_fnc_spawnGroup.sqf index b3d6483..4df5dfa 100644 --- a/@epochhive/addons/custom_server/Compiles/Groups/GMS_fnc_spawnGroup.sqf +++ b/@epochhive/addons/custom_server/Compiles/Groups/GMS_fnc_spawnGroup.sqf @@ -3,13 +3,13 @@ for DBD Clan By Ghostrider-DBD- Copyright 2016 - Last Modified 12/21/16 + Last Modified 1/22/17 */ //Sets Private Variables to they don't interfere when this script is called more than once private["_numbertospawn","_i","_groupSpawned","_safepos","_x","_weaponList","_useLauncher","_launcherType","_aiSkills"]; params["_pos", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], "_center", ["_minDist",20], ["_maxDist",35], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear] ]; -if (blck_debugLevel isEqualTo 3) then +if (blck_debugLevel > 1) then { diag_log format["[blckeagls] _fnc_spawnGroup called parameters: _numai1 %1, _numbai2 %2, _skillLevel %3, _center %4",_numai1,_numai2,_skillLevel,_center]; }; @@ -19,7 +19,7 @@ if (_numai2 > _numai1) then { } else { _numbertospawn = _numai2; }; -if (blck_debugLevel isEqualTo 3) then +if (blck_debugLevel > 1) then { diag_log format["spawnGroup.sqf: _numbertospawn = %1",_numbertospawn]; }; @@ -27,7 +27,7 @@ if (blck_debugLevel isEqualTo 3) then _groupSpawned = createGroup blck_AI_Side; if !(isNull _groupSpawned) then { - if (blck_debugON) then {diag_log format["_fnc_spawnGroup:: -- >> Group created = %1",_groupSpawned]}; + if (blck_debugLevel > 1) then {diag_log format["_fnc_spawnGroup:: -- >> Group created = %1",_groupSpawned]}; _groupSpawned setcombatmode blck_combatMode; _groupSpawned allowfleeing 0; _groupSpawned setspeedmode "FULL"; diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_addMIssionToQue.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_addMIssionToQue.sqf index 752ff9f..9fcff3e 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_addMIssionToQue.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_addMIssionToQue.sqf @@ -2,7 +2,7 @@ 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-DbD- - Last modified 10-14-16 + Last modified 1-21-17 */ //private _mission = _this; @@ -16,7 +16,8 @@ for "_i" from 1 to _noMissions do private _waitTime = diag_tickTime + (_tMin) + random((_tMax) - (_tMin)); // 0 1 2 3 4 5 6 7 private _mission = [_missionList,_path,format["%1%2",_marker,_i],_difficulty,_tMin,_tMax,_waitTime,[0,0,0]]; - diag_log format["-fnc_addMissionToQue::-->> _mission = %1",_mission]; + if (blck_debugLevel > 0) then {diag_log format["-fnc_addMissionToQue::-->> _mission = %1",_mission];}; blck_pendingMissions pushback _mission; }; -diag_log format["_fnc_addMissionToQue:: -- >> Result - blck_pendingMissions = %1",blck_pendingMissions]; + +if (blck_debugLevel > 0) then {diag_log format["_fnc_addMissionToQue:: -- >> Result - blck_pendingMissions = %1",blck_pendingMissions];}; diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf index d736359..0ad8377 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf @@ -3,14 +3,27 @@ for DBD Clan By Ghostrider-DBD- Copyright 2016 - Last modified 1/12/17 + Last modified 1/22/17 */ -private ["_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_AI_Vehicles","_timeOut"]; -params["_coords","_missionType","_aiDifficultyLevel"]; -waitUntil {blck_missionSpawning isEqualTo false}; -blck_missionSpawning = true; -diag_log format["[blckeagls] missionSpawner:: Initializing mission: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; +private ["_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_AI_Vehicles","_timeOut","_aiDifficultyLevel"]; +params["_coords","_mission"]; + +//////// +// 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; + +if (blck_debugLevel > 0) then {diag_log format["_fnc_mainThread:: -->> _markerClass = %1",_markerClass];}; + +[_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"]; if (isNil "_chanceReinforcements") then @@ -39,14 +52,14 @@ if (isNil "_reinforcementLootCounts") then _optics = 1 + floor(random(6)); _loadout = 1 + floor(random(3)); _reinforcementLootCounts = [_weap,_mags,_optics,0,0,_backpacks]; - if (blck_debugLevel > 0) then {diag_log "missionSpawner:: default values used for _reinforcementLootCounts";}; + if (blck_debugLevel > 1) then {diag_log "missionSpawner:: default values used for _reinforcementLootCounts";}; } else { - if (blck_debugLevel > 0) then {diag_log "missionSpawner:: Mission specific values used for _reinforcementLootCounts";}; + if (blck_debugLevel > 1) then {diag_log "missionSpawner (47):: Mission specific values used for _reinforcementLootCounts";}; }; -if (blck_debugLevel > 0) then { +if (blck_debugLevel > 1) then { diag_log format["[blckEagle] Mission Reinforcement Parameters: changeReinforcements %1 numAI %2 changePatrol %3 chanceLoot %4",_chanceReinforcements,_noPara,_chanceHeliPatrol,_chanceLoot]; }; @@ -60,32 +73,30 @@ _aiGroup = []; _missionAIVehicles = []; _blck_AllMissionAI = []; _AI_Vehicles = []; -_blck_localMissionMarker = [_missionType,_coords,"","",_markerColor,_markerType]; +_blck_localMissionMarker = [_markerClass,_coords,"","",_markerColor,_markerType]; _delayTime = 1; _groupPatrolRadius = 50; if (blck_labelMapMarkers select 0) then { - //diag_log "SM1.sqf: labeling map markers *****"; + //diag_log "labeling map markers *****"; _blck_localMissionMarker set [2, _markerMissionName]; }; if !(blck_preciseMapMarkers) then { - //diag_log "SM1.sqf: Map marker will be OFFSET from the mission position"; + //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,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers; [_blck_localMissionMarker] execVM "debug\spawnMarker.sqf"; -uiSleep 1; -///////////////////////////// -// Everything has been set up for the mission and it is now waiting to be triggered by a nearby player or to time out. -// Lets let other instances of the mission spawner know it is OK to go ahead -//////////////////////////// -blck_missionSpawning = false; +if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (89) waiting for player to trigger the mission";}; + +//////// +// All parameters are defined, lets wait until a player is nearby or the mission has timed out +//////// -if (blck_debugON) then {diag_log "missionSpawner:: waiting for player to trigger the mission";}; private["_wait","_missionStartTime","_playerInRange","_missionTimedOut"]; _missionStartTime = diag_tickTime; _playerInRange = false; @@ -113,30 +124,31 @@ while {_wait} do uiSleep 1; }; }; -//waitUntil{ { (isPlayer _x && _x distance _coords <= blck_TriggerDistance /*&& vehicle _x == _x*/) || ([_missionStartTime] call _fn_timedOut) } count playableunits > 0 }; -if (blck_debugON) then -{ - diag_log format["missionSpawner:: Mission Triggerred contition playerInRange %1 and timout = %2",_playerInRange, _missionTimedOut]; -}; -if (!_playerInRange && _missionTimedOut) exitWith +if (_missionTimedOut) exitWith { + // Deal with the case in which the mission timed out. //["timeOut",_endMsg,_blck_localMissionMarker select 2] call blck_fnc_messageplayers; - [_blck_localMissionMarker select 0] execVM "debug\deleteMarker.sqf"; + blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords]; + [_mission,"inactive",[0,0,0]] call blck_fnc_updateMissionQue; + [_blck_localMissionMarker select 0] call compile preprocessfilelinenumbers "debug\deleteMarker.sqf"; _blck_localMissionMarker set [1,[0,0,0]]; _blck_localMissionMarker set [2,""]; - [_objects, 1] spawn blck_fnc_cleanupObjects; - if (blck_debugON) then + [_objects, 0.1] spawn blck_fnc_cleanupObjects; + if (blck_debugLevel > 0) then { - diag_log format["[blckeagls] missionSpawner:: Mission Timed Out: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; + diag_log format["[blckeagls] missionSpawner:: (105) Mission Timed Out: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; }; }; if (_playerInRange) then { - if (blck_debugON) then - { diag_log format["[blckeagls] missionSpawner:: -- >> Mission tripped by nearby player: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; + //////// + // Spawn the mission objects, loot chest, and AI + //////// + if (blck_debugLevel > 0) then + { diag_log format["[blckeagls] missionSpawner:: (112) -- >> Mission tripped by nearby player: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; }; if (count _missionLootBoxes > 0) then @@ -148,11 +160,12 @@ if (_playerInRange) then _crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]]] call blck_fnc_spawnMissionCrates; }; + // un-comment this if you want crates cleaned up when the rest of the mission objects are removed. //_objects append _crates; - if (blck_debugON) then + if (blck_debugLevel > 0) then { - diag_log format["[blckeagls] missionSpawner:: Crates Spawned: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; + diag_log format["[blckeagls] missionSpawner:: (131) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; }; uiSleep _delayTime; @@ -187,64 +200,22 @@ if (_playerInRange) then if (blck_debugON) then { - diag_log format["[blckeagls] missionSpawner:: Landscape spawned: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; + diag_log format["[blckeagls] missionSpawner:: (166) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; }; uiSleep _delayTime;; - // ======== - // Old version - // ======== - /* - if ((count _missionLootVehicles) > 0) then // spawn loot vehicles - { - { - //diag_log format["spawnMissionCVehicles.sqf _x = %1",_x]; - _offset = _x select 1; // offset relative to _coords at which to spawn the vehicle - _pos = [(_coords select 0)+(_offset select 0),(_coords select 1) + (_offset select 1),(_coords select 2)+(_offset select 2)]; - _veh = [_x select 0, _pos] call blck_fnc_spawnVehicle; - _vehs pushback _veh; - [_veh,_x select 2, _x select 3] call blck_fnc_fillBoxes; - }forEach _missionLootVehicles; - - }; - */ - // ======== - // Modular Version - // ======== [_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles; - // ========== + uiSleep _delayTime; private _precise = false; + if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (233) preparing to spawn emplaced weapons for _markerClass %3:: blck_useStatic = %1 and _noEmplacedWeapons = %2",blck_useStatic,_noEmplacedWeapons,_markerClass];}; if (blck_useStatic && (_noEmplacedWeapons > 0)) then { - // ======= - // Old version - // ======= - /*if ( count (_missionEmplacedWeapons) isEqualTo 0 ) then - { - _missionEmplacedWeapons = [_coords,_noEmplacedWeapons,35,50] call blck_fnc_findPositionsAlongARadius; - _precise = true; - }; - - { - _emplacedGroup = [_x,1,1,_aiDifficultyLevel,_coords,1,2,_uniforms,_headGear] call blck_fnc_spawnGroup; - if !(isNull _emplacedGroup) then - { - _blck_AllMissionAI append (units _emplacedGroup); - _emplacedWeapon = [_x,_emplacedGroup,blck_staticWeapons,5,15,_precise] call blck_fnc_spawnEmplacedWeapon; - }; - }forEach _missionEmplacedWeapons; - //=============================== - */ - - // ====== - // Modular Version - // ====== private ["_emplacedUnits"]; - _emplacedUnits = [_missionEmplacedWeapons,_noEmplacedWeapons,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnMissionEmplacedWeapons; - //diag_log format["missionSpawner :: (247) _emplacedUnits = %1",_emplacedUnits]; + _emplacedUnits = [_missionEmplacedWeapons,_noEmplacedWeapons,_aiDifficultyLevel,_coords,_uniforms,_headGear,_markerClass] call blck_fnc_spawnMissionEmplacedWeapons; + //diag_log format["missionSpawner :: (218) _emplacedUnits = %1",_emplacedUnits]; uisleep 0.1; if (typeName _emplacedUnits isEqualTo "ARRAY") then { @@ -252,128 +223,34 @@ if (_playerInRange) then { _blck_AllMissionAI append _emplacedUnits; }; - //diag_log format["missionSpawner :: (255) _blck_AllMissionAI updated to = %1",_blck_AllMissionAI]; + //diag_log format["missionSpawner :: (226) _blck_AllMissionAI updated to = %1",_blck_AllMissionAI]; }; - //============================== - if (blck_debugON) then + if (blck_debugLevel > 0) then { - diag_log format["[blckeagls] missionSpawner:: Static Weapons Spawned: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; + diag_log format["[blckeagls] missionSpawner:: (236) Static Weapons Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; }; }; uisleep _delayTime; if (blck_useVehiclePatrols && (_noVehiclePatrols > 0)) then { - // ============== - // Old code - // =============== - /* - private["_vehGroup","_patrolVehicle"]; - //_vehiclePatrolSpawns= [_coords,_noVehiclePatrols,45,60] call blck_fnc_findPositionsAlongARadius; - { - _vehGroup = [_x,3,3,_aiDifficultyLevel,_coords,1,2,_uniforms,_headGear] call blck_fnc_spawnGroup; - diag_log format["missionSpawner:: (249) group for AI Patrol vehicle spawn: group is %1 with units of %2",_vehGroup, units _vehGroup]; - diag_log format["missionSpawner:: (250) _blck_AllMissionAI prior to appending _vehGroup units = %1",_blck_AllMissionAI]; - uiSleep 0.1; - if !(isNull _vehGroup) then - { - if (typeName (units _vehGroup) isEqualTo "ARRAY") then - { - _blck_AllMissionAI = _blck_AllMissionAI append (units _vehGroup); - diag_log format["missionSpawner:: _blck_AllMissionAI after appending _vehGroup units = %1",_blck_AllMissionAI]; - _randomVehicle = selectRandom blck_AIPatrolVehicles; - _patrolVehicle = [_coords,_x,_randomVehicle,(_x distance _coords) -5,(_x distance _coords) + 5,_vehGroup] call blck_fnc_spawnVehiclePatrol; - }; - }; - }forEach [_coords,_noVehiclePatrols,45,60] call blck_fnc_findPositionsAlongARadius;; - */ - // ===================== - // Modular version - // ===================== private["_vehUnits"]; - _vehUnits = [_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionVehiclePatrols; - //diag_log format["missionSpawner :: (240) _vehUnits = %1",_vehUnits]; + _vehUnits = [_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear,_markerClass] call blck_fnc_spawnMissionVehiclePatrols; + //diag_log format["missionSpawner :: (238) _vehUnits = %1",_vehUnits]; if (typeName _vehUnits isEqualTo "ARRAY") then { _blck_AllMissionAI append _vehUnits; }; uiSleep _delayTime; - if (blck_debugON) then + if (blck_debugLevel > 0) then { - diag_log format["[blckeagls] missionSpawner:: Vehicle Patrols Spawned: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; + diag_log format["[blckeagls] missionSpawner:: Vehicle Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; }; }; uiSleep _delayTime; - - // ===== - // Old Version - // +++++++++++ - /* - private["_unitsToSpawn","_unitsPerGroup","_ResidualUnits","_newGroup"]; - _unitsToSpawn = round(_minNoAI + round(random(_maxNoAI - _minNoAI))); - _unitsPerGroup = floor(_unitsToSpawn/_noAIGroups); - _ResidualUnits = _unitsToSpawn - (_unitsPerGroup * _noAIGroups); - //diag_log format["missionSpawner:: _unitsToSpawn %1 ; _unitsPerGroup %2 _ResidualUnits %3",_unitsToSpawn,_unitsPerGroup,_ResidualUnits]; - switch (_noAIGroups) do - { - case 1: { // spawn the group near the mission center - //params["_pos", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], "_center", ["_minDist",20], ["_maxDist",35], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear] ]; - _newGroup = [_coords,_unitsToSpawn,_unitsToSpawn,_aiDifficultyLevel,_coords,3,18,_uniforms,_headGear] call blck_fnc_spawnGroup; - _blck_AllMissionAI = _blck_AllMissionAI append (units _newGroup); - //diag_log format["missionSpawner: Spawning Groups: _noAIGroups=1 _newGroup=%1 _newAI = %2",_newGroup, (units _newGroup)]; - }; - case 2: { - //diag_log format["missionSpawner: Spawning Groups: _noAIGroups=2"]; // spawn groups on either side of the mission area - _groupLocations = [_coords,_noAIGroups,15,30] call blck_fnc_findPositionsAlongARadius; - { - private["_adjusttedGroupSize"]; - if (_ResidualUnits > 0) then - { - _adjusttedGroupSize = _unitsPerGroup + _ResidualUnits; - _ResidualUnits = 0; - } else { - _adjusttedGroupSize = _unitsPerGroup; - }; - _newGroup = [_x,_adjusttedGroupSize,_adjusttedGroupSize,_aiDifficultyLevel,_coords,1,12,_uniforms,_headGear] call blck_fnc_spawnGroup; - _blck_AllMissionAI = _blck_AllMissionAI append (units _newGroup); - //diag_log format["missionSpawner: Spawning 2 Groups: _newGroup=%1 _newAI = %2",_newGroup, (units _newGroup)]; - }forEach _groupLocations; - - }; - case 3: { // spawn one group near the center of the mission and the rest on the perimeter - //diag_log format["missionSpawner: Spawning Groups: _noAIGroups=3"]; - _newGroup = [_coords,_unitsPerGroup + _ResidualUnits,_unitsPerGroup + _ResidualUnits,_aiDifficultyLevel,_coords,1,12,_uniforms,_headGear] call blck_fnc_spawnGroup; - _blck_AllMissionAI = _blck_AllMissionAI append (units _newGroup); - //diag_log format["missionSpawner: Spawning Groups: _noAIGroups=3 _newGroup=%1 _newAI = %2",_newGroup, append (units _newGroup)]; - _groupLocations = [_coords,2,20,35] call blck_fnc_findPositionsAlongARadius; - { - _newGroup = [_x,_unitsPerGroup,_unitsPerGroup,_aiDifficultyLevel,_coords,1,12,_uniforms,_headGear] call blck_fnc_spawnGroup; - _blck_AllMissionAI = _blck_AllMissionAI append (units _newGroup); - //diag_log format["missionSpawner: Spawning 2 Groups:_newGroup=%1 _newAI = %2",_newGroup, (units _newGroup)]; - }forEach _groupLocations; - - }; - default { // spawn one group near the center of the mission and the rest on the perimeter - //diag_log format["missionSpawner: Spawning Groups: _noAIGroups=default"]; - _newGroup = [_coords,_unitsPerGroup + _ResidualUnits,_unitsPerGroup + _ResidualUnits,_aiDifficultyLevel,_coords,1,12,_uniforms,_headGear] call blck_fnc_spawnGroup; - _blck_AllMissionAI = _blck_AllMissionAI append (units _newGroup); - //diag_log format["missionSpawner: Spawning Groups: _noAIGroups=%3 _newGroup=%1 _newAI = %2",_newGroup, (units _newGroup),_noAIGroups]; - _groupLocations = [_coords,(_noAIGroups - 1),20,40] call blck_fnc_findPositionsAlongARadius; - { - _newGroup = [_x,_unitsPerGroup,_unitsPerGroup,_aiDifficultyLevel,_coords,1,12,_uniforms,_headGear] call blck_fnc_spawnGroup; - _blck_AllMissionAI = _blck_AllMissionAI append (units _newGroup); - //diag_log format["missionSpawner: Spawning %3 Groups: _newGroup=%1 _newAI = %2",_newGroup, (units _newGroup),_noAIGroups]; - }forEach _groupLocations; - }; - }; - */ - - //////// - // Modular Version - // ===== private ["_infantry"]; _infantry = [_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionAI; - //diag_log format["missionSpawner:: (337) -> _infantry = %1",_infantry]; + //diag_log format["missionSpawner:: (254) -> _infantry = %1",_infantry]; if (typeName _infantry isEqualto "ARRAY") then { _blck_AllMissionAI append _infantry; @@ -382,30 +259,20 @@ if (_playerInRange) then uiSleep _delayTime; if (blck_debugON) then { - diag_log format["[blckeagls] missionSpawner:: AI Patrols Spawned: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; + diag_log format["[blckeagls] missionSpawner:: AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; }; if ((random(1) < _chanceReinforcements)) then { - _weaponList = blck_WeaponList_Red; - - switch (_aiDifficultyLevel) do { - case "blue": {_weaponList = blck_WeaponList_Blue;}; - case "red": {_weaponList = blck_WeaponList_Red;}; - case "green": {_weaponList = blck_WeaponList_Green;}; - case "orange": {_weaponList = blck_WeaponList_Orange;}; - default {_weaponList = blck_WeaponList_Blue;}; - }; - - //diag_log format["missionSpawner:: weaponList = %1",_weaponList]; + _weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout; private["_grpReinforcements"]; _grpReinforcements = grpNull; - //diag_log format["[blckeagls] missionSpawner:: calling in reinforcements: Current mission: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; + //diag_log format["[blckeagls] missionSpawner:: calling in reinforcements: Current mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; [] spawn { //[_coords,_noPara,_aiDifficultyLevel,_chanceLoot,_reinforcementLootCounts,_weaponList,_uniforms,_headgear,_chanceHeliPatrol] call blck_fnc_Reinforcements; //waitUntil {_grpReinforcements != grpNull}; - //diag_log format["[blckeagls] missionSpawner::reinforcement spawner started: Current mission: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; + //diag_log format["[blckeagls] missionSpawner::reinforcement spawner started: Current mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; }; if !(_grpReinforcements isEqualTo grpNull) then { @@ -447,20 +314,18 @@ if (_playerInRange) then _missionComplete = 1; }; }; - //diag_log format["missionSpawner:: count alive _blck_AllMissionAI = %1",{alive _x} count _blck_AllMissionAI]; if (_endIfAIKilled) then { if (({alive _x} count _blck_AllMissionAI) < 1 ) then { _missionComplete = 1; - //diag_log format["missionSpawner:: _blck_AllMissionAI = %1","testing case _endIfAIKilled"]; }; }; uiSleep 2; }; }; - if (blck_debugON) then + if (blck_debugLevel > 1) then { - diag_log format["[blckeagls] missionSpawner:: Mission completion criteria fulfilled: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; + diag_log format["[blckeagls] missionSpawner:: (329) Mission completion criteria fulfilled: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; }; if (blck_useSignalEnd) then @@ -468,9 +333,9 @@ if (_playerInRange) then //diag_log format["**** Minor\SM1.sqf:: _crate = %1",_crates select 0]; [_crates select 0] spawn blck_fnc_signalEnd; - if (blck_debugON) then + if (blck_debugLevel > 1) then { - diag_log format["[blckeagls] missionSpawner:: SignalEnd called: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; + diag_log format["[blckeagls] missionSpawner:: (340) SignalEnd called: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; }; }; [_mines] spawn blck_fnc_clearMines; @@ -481,8 +346,11 @@ if (_playerInRange) then uisleep 0.1; [_blck_AllMissionAI,blck_AliveAICleanUpTimer] spawn blck_fnc_addLiveAItoQue; [["end",_endMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers; - [_blck_localMissionMarker select 1, _missionType] execVM "debug\missionCompleteMarker.sqf"; + [_blck_localMissionMarker select 1, _markerClass] execVM "debug\missionCompleteMarker.sqf"; [_blck_localMissionMarker select 0] execVM "debug\deleteMarker.sqf"; + blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords]; + blck_recentMissionCoords pushback [_coords,diag_tickTime]; + [_mission,"inactive",[0,0,0]] call blck_fnc_updateMissionQue; uisleep 0.1; - diag_log format["[blckeagls] missionSpawner:: end of mission: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; + diag_log format["[blckeagls] missionSpawner:: (357)end of mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; }; diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionTimedOut.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionTimedOut.sqf new file mode 100644 index 0000000..0af1cfc --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionTimedOut.sqf @@ -0,0 +1,11 @@ +/* + [_blck_localMissionMarker, _coords, _objects] call blck_fnc_missionTimedOut; +*/ +params["_blck_localMissionMarker", "_coords", "_objects"]; + +//["timeOut",_endMsg,_blck_localMissionMarker select 2] call blck_fnc_messageplayers; +[_blck_localMissionMarker select 0] execVM "debug\deleteMarker.sqf"; +_blck_localMissionMarker set [1,[0,0,0]]; +_blck_localMissionMarker set [2,""]; +blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords]; +[_objects, 1] spawn blck_fnc_cleanupObjects; \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionTriggeredConditionsMet.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionTriggeredConditionsMet.sqf new file mode 100644 index 0000000..8f01fb8 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionTriggeredConditionsMet.sqf @@ -0,0 +1,38 @@ +/* + test if either of two conditions is true: + player within a specific range of the coordinates + mission has timed out + + By Ghostrider-DbD- + 1/21/17 +*/ + + +params["_coords"]; +private["_result"]; +#define GMS_playerInRange 1 +#define GMS_missionTimeOut 2 + +_result = 0; +if (blck_debugLevel > 2) then +{ + _result = GMS_playerInRange; + diag_log format["_fnc_missionTriggeredConditionsMet:: -> Trigger conditions met with blck_debugLevel > 2 and _result set to %1",_result]; +} else { + if ({ (isPlayer _x) && (_x distance _coords < blck_TriggerDistance) } count allPlayers > 0) then + { + _result = GMS_playerInRange; + diag_log format["_fnc_missionTriggeredConditionsMet:: -> Trigger conditions met with player in range and _result set to %1",_result]; + + } else + { + if ((diag_tickTime - _missionStartTime) > blck_MissionTimout) then + { + _result = GMS_missionTimeOut; + diag_log format["_fnc_missionTriggeredConditionsMet:: -> Trigger conditions met with mission timed out and _result set to %1",_result]; + }; + }; +}; +if (blck_debugLevel > 0) then {diag_log format["_fnc_missionTriggeredConditionsMet:: _result returned = %1 at time %2:",_result,_diag_tickTime]; + +_result \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionEmplacedWeapons.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionEmplacedWeapons.sqf index 8604dcd..e7899fd 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionEmplacedWeapons.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionEmplacedWeapons.sqf @@ -3,16 +3,17 @@ [_missionEmplacedWeapons,_noEmplacedWeapons,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnMissionEmplacedWeapons; */ -// [_missionEmplacedWeapons,_noEmplacedWeapons,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnMissionEmplacedWeapons; -params["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear"]; + +params["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear",["_missionType","unspecified"]]; private ["_emplacedGroup","_emplacedAI"]; _emplacedAI = []; -diag_log format["[blckeagls] _fnc_spawnMissionEmplacedWeapons(10):: - > _noEmplacedWeapons = %1",_noEmplacedWeapons]; +if (blck_debugLevel > 0) then {diag_log format["[blckeagls] _fnc_spawnMissionEmplacedWeapons(10):: - >_missionEmplacedWeapons = %2 and _noEmplacedWeapons = %1",_noEmplacedWeapons,_missionEmplacedWeapons];}; if ( count (_missionEmplacedWeapons) isEqualTo 0 ) then { _missionEmplacedWeapons = [_coords,_noEmplacedWeapons,35,50] call blck_fnc_findPositionsAlongARadius; + diag_log format["_fnc_spawnMissionEmplacedWeapons:: (16) _missionType = %2 _missionEmplacedWeapons updated to %1",_missionEmplacedWeapons,_missionType]; _precise = false; }; @@ -20,8 +21,9 @@ if ( count (_missionEmplacedWeapons) isEqualTo 0 ) then _emplacedGroup = [_x,1,1,_aiDifficultyLevel,_coords,1,2,_uniforms,_headGear] call blck_fnc_spawnGroup; if !(isNull _emplacedGroup) then { - diag_log format["_fnc_spawnMissionEmplacedWeapons:: (23) -> spawning _blck_fnc_spawnEmplaceWeapon with group %1",_emplacedGroup]; - [_x,_emplacedGroup,blck_staticWeapons,5,15,_precise] call blck_fnc_spawnEmplacedWeapon; + diag_log format["_fnc_spawnMissionEmplacedWeapons:: (23) -> spawning _blck_fnc_spawnEmplaceWeapon for _missionType %2 with group %1",_emplacedGroup, _missionType]; + // ["_pos","_emplacedGroup","_emplacedTypes",["_minDist",20],["_maxDist",35],["_precise",false] ]; + [_x,_emplacedGroup,blck_staticWeapons,5,15,_precise,_missionType] call blck_fnc_spawnEmplacedWeapon; } else { diag_log format["[blckeagls] _fnc_spawnMissionEmplacedWeapons(26):: - > Null group spawned"]; }; diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionVehiclePatrols.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionVehiclePatrols.sqf index cbe1a82..c318b45 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionVehiclePatrols.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionVehiclePatrols.sqf @@ -1,11 +1,11 @@ /* [_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionVehiclePatrols by Ghostrider-DbD- - 1/13/17 + 1/22/17 returns [] if no groups could be created returns [_AI_Vehicles,_missionAI] otherwise; */ -params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_uniforms","_headGear"]; +params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_uniforms","_headGear",["_missionType","unspecified"]]; private["_vehGroup","_patrolVehicle","_vehiclePatrolSpawns","_missionAI","_missiongroups","_AI_Vehicles","_abort","_vehiclePatrolSpawns","_randomVehicle","_return"]; _missionAI = []; @@ -13,7 +13,7 @@ _vehiclePatrolSpawns= [_coords,_noVehiclePatrols,45,60] call blck_fnc_findPositi { _vehGroup = [_x,3,3,_aiDifficultyLevel,_coords,1,2,_uniforms,_headGear] call blck_fnc_spawnGroup; //if (isNull _vehGroup) exitWith {_abort = true;}; - diag_log format["_fnc_spawnMissionVehiclePatrols:: -> _vehGroup = %1 and units _vehGroup = %2",_vehGroup, units _vehGroup]; + if (blck_debugLevel > 0) then {diag_log format["_fnc_spawnMissionVehiclePatrols:: -> _missionType = %3 _vehGroup = %1 and units _vehGroup = %2",_vehGroup, units _vehGroup,_missionType];}; if (typename (units _vehGroup) isEqualTo "ARRAY") then { _randomVehicle = selectRandom blck_AIPatrolVehicles; @@ -24,7 +24,7 @@ _vehiclePatrolSpawns= [_coords,_noVehiclePatrols,45,60] call blck_fnc_findPositi }forEach _vehiclePatrolSpawns; if (blck_debugLevel > 1) then { - diag_log format["[blckeagls] _fnc_spawnMissionVehiclePatrols :: Vehicle Patrols Spawned: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; + diag_log format["[blckeagls] _fnc_spawnMissionVehiclePatrols :: Vehicle Patrols Spawned: _coords %1 : _missionType %2 : _aiDifficultyLevel %3",_coords,_aiDifficultyLevel]; }; _missionAI; \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnRandomLandscape.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnRandomLandscape.sqf index 3f805d9..778e98b 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnRandomLandscape.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnRandomLandscape.sqf @@ -1,7 +1,7 @@ /* spawn a group of objects in random locations aligned with the radial from the center of the region to the object. By Ghostrider-DbD- - Last modified 9-5-2016 + Last modified 1/22/17 copyright 2016 */ @@ -24,5 +24,5 @@ _objects = []; _objects pushback _wreck; sleep 0.1; } forEach _missionLandscape; -diag_log format["_fnc_spawnRandomLandscape::-->> _objects = %1",_objects]; +if (blck_debugLevel > 2) then {diag_log format["_fnc_spawnRandomLandscape::-->> _objects = %1",_objects];}; _objects \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_updateMissionQue.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_updateMissionQue.sqf index c1e4aee..8adab54 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_updateMissionQue.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_updateMissionQue.sqf @@ -2,32 +2,32 @@ Update the parameters for a mission in the list of missions running at that time. Call with the name of the marker associated with the mission and either "Active" or "Completed" by Ghostrider-DbD- - Last modified 1-12-17 + Last modified 1-22-17 */ params["_mission","_status",["_coords",[0,0,0]] ]; if (blck_debugON) then {diag_log format["_fnc_updateMissionQue :: _mission = %1 | _status = %2 | _coords = %3",_mission,_status,_coords];}; -{ - if (_mission isEqualTo (_x select 2)) exitWith - { - private _element = _x; - if (blck_debugON) then {diag_log format ["_fnc_updateMissionQue :: blck_pendingMissions began as %1",blck_pendingMissions];}; - blck_pendingMissions set[_forEachIndex, -1]; - blck_pendingMissions = blck_pendingMissions - [-1]; - if (blck_debugON) then {diag_log format ["_fnc_updateMissionQue :: blck_pendingMissions after deleteing element = %1 resulted in %2",_element,blck_pendingMissions];}; - if (toLower(_status) isEqualTo "active") then { - _element set[6, -1]; - _element set[7,_coords]; - }; - if (toLower(_status) isEqualTo "completed") then - { - private _waitTime = (_element select 4) + random((_element select 5) - (_element select 4)); - _element set[6, _waitTime]; - _element set [7,[0,0,0]]; - }; - if (blck_debugON) then {diag_log format["_fnc_updateMissionQue:: -- >> _element updated to %1",_x,_element];}; - blck_pendingMissions pushback _element; - if (blck_debugON) then {diag_log format ["_fnc_updateMissionQue :: blck_pendingMissions updated to %1",blck_pendingMissions];}; - }; -}forEach blck_pendingMissions; +private["_index","_element","_waitTime"]; + +_index = blck_pendingMissions find _mission; +if (_index > -1) then +{ + if (blck_debuglevel > 0) then {diag_log format ["_fnc_updateMissionQue :: blck_pendingMissions began as %1",blck_pendingMissions];}; + _element = blck_pendingMissions select _index; + if (blck_debuglevel > 0) then {diag_log format["_fnc_updateMissionQue:: -- >> _element before update = %1",_element];}; + if (toLower(_status) isEqualTo "active") then { + _element set[6, -1]; + _element set[7,_coords]; + }; + if (toLower(_status) isEqualTo "inactive") then + { + _waitTime = (_element select 4) + random((_element select 5) - (_element select 4)); + _element set[6, diag_tickTime + _waitTime]; + _element set [7,[0,0,0]]; + }; + if (blck_debuglevel > 0) then {diag_log format["_fnc_updateMissionQue:: -- >> _element after update = %1",_element];}; + blck_pendingMissions set [_index, _element]; + if (blck_debuglevel > 0) then {diag_log format ["_fnc_updateMissionQue :: blck_pendingMissions after update = %1",blck_pendingMissions];}; +}; + diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_missionsDefinitions.hpp b/@epochhive/addons/custom_server/Compiles/Missions/GMS_missionsDefinitions.hpp new file mode 100644 index 0000000..95c13ab --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_missionsDefinitions.hpp @@ -0,0 +1,5 @@ + + +#define GMS_playerInRange 1 +#define GMS_missionTimeOut 2 +#defin GMS_delayTime 0.1 \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Units/GMS_EH_reloadWeapon.sqf b/@epochhive/addons/custom_server/Compiles/Units/GMS_EH_reloadWeapon.sqf new file mode 100644 index 0000000..07238f3 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Units/GMS_EH_reloadWeapon.sqf @@ -0,0 +1,21 @@ +/* + + + unit: Object - Object the event handler is assigned to. + selectionName: String - Name of the selection where the unit was damaged. "" for over-all structural damage, "?" for unknown selections. + damage: Number - Resulting level of damage for the selection. + source: Object - The source unit that caused the damage. + projectile: String - Classname of the projectile that caused inflicted the damage. ("" for unknown, such as falling damage.) + +(Since Arma 3 v 1.49.131802) + + hitPartIndex: Number - Hit part index of the hit point, -1 otherwise. +*/ + +private ["_unit","_killer","_group","_deleteAI_At"]; +_unit = _this select 0; +_source = _this select 3; + +if (isPlayer _source) then { + [_unit,_source] call GRMS_fnc_alertGroup; +}; diff --git a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnEmplacedWeapon.sqf b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnEmplacedWeapon.sqf index 88217b3..8127bb1 100644 --- a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnEmplacedWeapon.sqf +++ b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnEmplacedWeapon.sqf @@ -1,9 +1,9 @@ // Spawns an emplaced weapons, man's it, and saves it to an array of monitored vehicles. // by Ghostrider-DBD- // Last Updated 10-25-16 - +// ["_pos","_emplacedGroup","_emplacedTypes",["_minDist",20],["_maxDist",35],["_precise",false] ] call blck_fnc_spawnEmplacedWeapon; private["_emplaced","_safepos","_emp","_gunner"]; -params["_pos","_emplacedGroup","_emplacedTypes",["_minDist",20],["_maxDist",35],["_precise",false] ]; +params["_pos","_emplacedGroup","_emplacedTypes",["_minDist",20],["_maxDist",35],["_precise",false], ["_missionType","undefined" ]]; if (isNull _emplacedGroup) exitWith {diag_log "[blckeagls] ERROR CONDITION:-->> NULL-GROUP Provided to _fnc_spawnEmplaced"; objNull;}; diag_log format["_fnc_spawnEmplacedGroup:: -- >> _emplacedGroup = %1",_emplacedGroup]; _safepos = [_pos,_minDist,_maxDist,0,0,20,0] call BIS_fnc_findSafePos; @@ -16,6 +16,6 @@ _gunner moveingunner _emp; [_emp] call blck_fnc_configureMissionVehicle; waitUntil { count crew _emp > 0}; blck_missionVehicles pushback _emp; -diag_log format["spawnEmplaced.sqf: Emplaced weapon %1 spawned"]; +if (blck_debugLevel > 1) then {diag_log format["spawnEmplaced.sqf: _missionType %3 || Emplaced weapon %1 spawned at position %2",_emp,getPosATL _emp,_missionType]; _emp diff --git a/@epochhive/addons/custom_server/Compiles/blck_functions.sqf b/@epochhive/addons/custom_server/Compiles/blck_functions.sqf index a481cf0..85467c0 100644 --- a/@epochhive/addons/custom_server/Compiles/blck_functions.sqf +++ b/@epochhive/addons/custom_server/Compiles/blck_functions.sqf @@ -25,7 +25,7 @@ blck_fnc_MessagePlayers = compileFinal preprocessFileLineNumbers "\q\addons\cus //blck_fnc_sendRewardMessage = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_sendRewardMessage.sqf"; // Mission-related functions -blck_fnc_missionStartConditionsMet = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionStartConditionsMet.sqf"; +blck_fnc_missionTriggeredConditionsMet = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionTriggeredConditionsMet.sqf"; blck_fnc_selectAILoadout = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_selectAILoadout.sqf"; blck_fnc_addMissionToQue = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_addMissionToQue.sqf"; // blck_fnc_updateMissionQue = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_updateMissionQue.sqf"; // @@ -48,7 +48,7 @@ blck_fnc_loadLootItemsFromArray = compileFinal preprocessFileLineNumbers "\q\add blck_fnc_fillBoxes = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_fillBoxes.sqf"; // Adds items to an object according to passed parameters. See the script for details. blck_fnc_smokeAtCrates = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_smokeAtCrates.sqf"; // Spawns a wreck and adds smoke to it blck_fnc_spawnMines = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnMines.sqf"; // Deploys mines at random locations around the mission center -blck_fnc_abortMission = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnMines.sqf"; +blck_fnc_missionTimedOut = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionTimedOut.sqf"; blck_fnc_missionEndConditionsMet = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionEndConditionsMet.sqf"; blck_fnc_clearMines = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_clearMines.sqf"; // clears mines in an array passed as a parameter blck_fnc_signalEnd = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_signalEnd.sqf"; // deploy smoke grenades at loot crates at the end of the mission. diff --git a/@epochhive/addons/custom_server/Compiles/blck_variables.sqf b/@epochhive/addons/custom_server/Compiles/blck_variables.sqf index 8153481..4686f24 100644 --- a/@epochhive/addons/custom_server/Compiles/blck_variables.sqf +++ b/@epochhive/addons/custom_server/Compiles/blck_variables.sqf @@ -7,7 +7,7 @@ */ //blck_variablesLoaded = false; blck_debugON = true; -blck_debugLevel = 1; // Sets level of detail for debugging info - WIP. +blck_debugLevel = 3; // Sets level of detail for debugging info - WIP. blck_minFPS = 10; //////////////////////////////////////////////// @@ -31,6 +31,6 @@ DBD_HeliCrashSites = []; // radius within whih missions are triggered. The trigger causes the crate and AI to spawn. blck_TriggerDistance = 1000; blck_mainThreadUpdateInterval = 60; -blck_missionSpawning = false; +//blck_missionSpawning = false; diag_log "[blckeagls] Variables Loaded"; blck_variablesLoaded = true; diff --git a/@epochhive/addons/custom_server/Configs/blck_custom_config.sqf b/@epochhive/addons/custom_server/Configs/blck_custom_config.sqf index aa42e13..dca1756 100644 --- a/@epochhive/addons/custom_server/Configs/blck_custom_config.sqf +++ b/@epochhive/addons/custom_server/Configs/blck_custom_config.sqf @@ -24,10 +24,10 @@ if (blck_debugON) then // Used primarily for debugging. diag_log "[blckeagls] Debug seting is ON, Custom configurations used"; - blck_mainThreadUpdateInterval = 10; + //blck_mainThreadUpdateInterval = 10; blck_enableOrangeMissions = -1; blck_enableGreenMissions = -1; - blck_enableRedMissions = 1; + blck_enableRedMissions = -1; blck_enableBlueMissions = 1; @@ -37,12 +37,12 @@ if (blck_debugON) then blck_SpawnEmplaced_Orange = 4; // Number of static weapons at Orange Missions blck_SpawnEmplaced_Green = 3; // Number of static weapons at Green Missions - blck_SpawnEmplaced_Blue = 0; // Number of static weapons at Blue Missions + blck_SpawnEmplaced_Blue = 1; // Number of static weapons at Blue Missions blck_SpawnEmplaced_Red = 2; blck_SpawnVeh_Orange = 4; // Number of static weapons at Orange Missions blck_SpawnVeh_Green = 3; // Number of static weapons at Green Missions - blck_SpawnVeh_Blue = 0; // Number of static weapons at Blue Missions + blck_SpawnVeh_Blue = 2; // Number of static weapons at Blue Missions blck_SpawnVeh_Red = 2; //blck_reinforcementsBlue = [0, 0, 0.0, 0]; // Chance of reinforcements, number of reinforcements, Chance of reinforcing heli patrols, chance of dropping supplies for the reinforcements @@ -60,7 +60,7 @@ if (blck_debugON) then blck_TMax_Orange = 31; blck_reinforceBlue = [0.999, 2, 0.001]; - //blck_MissionTimout = 120; // 40 min + //blck_MissionTimout = 60; // 40 min blck_SkillsBlue = [ ["aimingAccuracy",0.01], ["aimingShake",0.01], diff --git a/@epochhive/addons/custom_server/changeLog.sqf b/@epochhive/addons/custom_server/changeLog.sqf index a772ab7..5b89988 100644 --- a/@epochhive/addons/custom_server/changeLog.sqf +++ b/@epochhive/addons/custom_server/changeLog.sqf @@ -4,9 +4,17 @@ Loosely based on the AI mission system by blckeagls ver 2.0.2 Contributions by Narines: bug fixes, testing, infinite ammo fix. Ideas or code from that by Vampire and KiloSwiss have been used for certain functions. -1/13/17 Build 29. -Modularizing mission spawner. -Searching for bug that causes mission completion code to hang. +1/22/17 Version 6.54 build 30 +Fixed an error in how the waitTime till a mission was respawned after being updated to inactive status. +Added additional reporting as to the mission type for which AI, statics and vehicle patrols are being spawned. +Continued switching from blck_debugOn to blck_debugLevel. +Removed old code that had been commented out from GMS_missionSpawner. + +1/21/17 Build 29. +Went back to the timerless system for spawning missions. +Improved code for updating the array of pending/active missions + GMS_fnc_updateMissionQue.sqf re-written to take greater advantage of existing array commands: set and find. +Ensured that the array used to store the location(s) of active or recent missions is properly updated. 1/13/17 Version 6.54 Build 27 Rerverted back to the code that spawned a single instance of each mission until I can debug certain issues. diff --git a/@epochhive/addons/custom_server/init/blck_init.sqf b/@epochhive/addons/custom_server/init/blck_init.sqf index 0cd4325..0439e3f 100644 --- a/@epochhive/addons/custom_server/init/blck_init.sqf +++ b/@epochhive/addons/custom_server/init/blck_init.sqf @@ -94,23 +94,23 @@ blck_spawnStaticLootCrates = nil; //Start the mission timers if (blck_enableOrangeMissions > 0) then { - [_missionListOrange,_pathOrange,"OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange] spawn blck_fnc_missionTimer;//Starts major mission system (Orange Map Markers) - //[_missionListOrange,_pathOrange,"OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange,blck_enableOrangeMissions] call blck_fnc_addMissionToQue; + //[_missionListOrange,_pathOrange,"OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange] spawn blck_fnc_missionTimer;//Starts major mission system (Orange Map Markers) + [_missionListOrange,_pathOrange,"OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange,blck_enableOrangeMissions] call blck_fnc_addMissionToQue; }; if (blck_enableGreenMissions > 0) then { - [_missionListGreen,_pathGreen,"GreenMarker","green",blck_TMin_Green,blck_TMax_Green] spawn blck_fnc_missionTimer;//Starts major mission system 2 (Green Map Markers) - //[_missionListGreen,_pathGreen,"GreenMarker","green",blck_TMin_Green,blck_TMax_Green,blck_enableGreenMissions] call blck_fnc_addMissionToQue; + //[_missionListGreen,_pathGreen,"GreenMarker","green",blck_TMin_Green,blck_TMax_Green] spawn blck_fnc_missionTimer;//Starts major mission system 2 (Green Map Markers) + [_missionListGreen,_pathGreen,"GreenMarker","green",blck_TMin_Green,blck_TMax_Green,blck_enableGreenMissions] call blck_fnc_addMissionToQue; }; if (blck_enableRedMissions > 0) then { - [_missionListRed,_pathRed,"RedMarker","red",blck_TMin_Red,blck_TMax_Red] spawn blck_fnc_missionTimer;//Starts minor mission system (Red Map Markers)//Starts minor mission system 2 (Red Map Markers) - //[_missionListRed,_pathRed,"RedMarker","red",blck_TMin_Red,blck_TMax_Red,blck_enableRedMissions] call blck_fnc_addMissionToQue; + //[_missionListRed,_pathRed,"RedMarker","red",blck_TMin_Red,blck_TMax_Red] spawn blck_fnc_missionTimer;//Starts minor mission system (Red Map Markers)//Starts minor mission system 2 (Red Map Markers) + [_missionListRed,_pathRed,"RedMarker","red",blck_TMin_Red,blck_TMax_Red,blck_enableRedMissions] call blck_fnc_addMissionToQue; }; if (blck_enableBlueMissions > 0) then { - [_missionListBlue,_pathBlue,"BlueMarker","blue",blck_TMin_Blue,blck_TMax_Blue] spawn blck_fnc_missionTimer;//Starts minor mission system (Blue Map Markers) - //[_missionListBlue,_pathBlue,"BlueMarker","blue",blck_TMin_Blue,blck_TMax_Blue,blck_enableBlueMissions] call blck_fnc_addMissionToQue; + //[_missionListBlue,_pathBlue,"BlueMarker","blue",blck_TMin_Blue,blck_TMax_Blue] spawn blck_fnc_missionTimer;//Starts minor mission system (Blue Map Markers) + [_missionListBlue,_pathBlue,"BlueMarker","blue",blck_TMin_Blue,blck_TMax_Blue,blck_enableBlueMissions] call blck_fnc_addMissionToQue; }; // start the main thread for the mission system which monitors missions running and stuff to be cleaned up diff --git a/@epochhive/addons/custom_server/init/build.sqf b/@epochhive/addons/custom_server/init/build.sqf index 5591d18..86839d7 100644 --- a/@epochhive/addons/custom_server/init/build.sqf +++ b/@epochhive/addons/custom_server/init/build.sqf @@ -1,3 +1,3 @@ private ["_version","_versionDate"]; -_blck_version = "6.54 Build 29"; +_blck_version = "6.54 Build 30"; _blck_versionDate = "1-21-17 5:00 PM";