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 75ec132..fc2b419 100644 --- a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_mainThread.sqf +++ b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_mainThread.sqf @@ -5,7 +5,7 @@ - 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-7-17 + Last modified 1-13-17 */ private ["_index","_timer10Min","_timer1min","_timer5min","_modType"]; @@ -34,7 +34,7 @@ while {true} do //diag_log format["_fnc_mainTread:: cleaning up AI group %1",_x]; [_x select 0] call blck_fnc_cleanupAliveAI; }; - blck_liveMissionAI = blck_liveMissionAI - _x; // Remove that list of live AI from the list. + blck_liveMissionAI = blck_liveMissionAI - [_x]; // Remove that list of live AI from the list. }forEach _ai; _obj = blck_oldMissionObjects; @@ -44,7 +44,7 @@ while {true} do //diag_log format["_fnc_mainTread:: cleaning up mission objects %1",_x]; [_x select 0] call blck_fnc_cleanupObjects; }; - blck_oldMissionObjects = blck_oldMissionObjects - _x; + blck_oldMissionObjects = blck_oldMissionObjects - [_x]; }forEach _obj; [] call GMS_fnc_cleanupDeadAI; @@ -54,6 +54,7 @@ while {true} do [] call blck_fnc_cleanEmptyGroups; }; // Exile cleans up empty groups automatically so this should not be needed with that mod. + /* [Jan 14, 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 @@ -78,7 +79,7 @@ while {true} do }forEach blck_pendingMissions; _timer1min = diag_tickTime; }; - + */ if ((diag_tickTime - _timer5min) > 300) then { if (blck_timeAcceleration) then { diff --git a/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_timedOut.sqf b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_timedOut.sqf new file mode 100644 index 0000000..878ab75 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Functions/GMS_fnc_timedOut.sqf @@ -0,0 +1,12 @@ +////////////////////////////////////////////////////// +// test if a timeout condition exists. +// by Ghostrider-DBD- +// Last modified 1/9/17 +// [_startTime] call blck_fnc_timedOut +// Returns true (timed out) or false (not timed out) +///////////////////////////////////////////////////// + +params["_startTime"]; +private["_return"]; +_return = ( (diag_tickTime - _startTime) > blck_MissionTimout ); +_return; diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_abortMission.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_abortMission.sqf new file mode 100644 index 0000000..7fdc529 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_abortMission.sqf @@ -0,0 +1,15 @@ +/* + +*/ +params["_objects","_mines","_crates","_blck_AllMissionAI","_AI_Vehicles","_blck_localMissionMarker"]; +// discard everything +{deleteVehicle _x} forEach _objects; +{deleteVehicle _x} forEach _mines; +{deleteVehicle _x} forEach _crates; +{deleteVehicle _x} forEach _blck_AllMissionAI; +{deleteVehicle _x} forEach _AI_Vehicles; +// set the mission status to waiting +[_blck_localMissionMarker select 0,"Completed"] call blck_fnc_updateMissionQue; +uiSleep 1; +// delete any empty groups left over from the cleanup. +[] call blck_fnc_cleanEmptyGroups; \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionEnd.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionEnd.sqf new file mode 100644 index 0000000..c461b2d --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionEnd.sqf @@ -0,0 +1,24 @@ +/* + [_crates,_mines,_objects,_blck_AllMissionAI,_blck_localMissionMarker] call blck_fnc_missionEnd; +*/ + +params["_crates","_mines","_objects","_blck_AllMissionAI","_blck_localMissionMarker"]; +diag_log format["[blckeagls] _fnc_missionEnd (6):-> _blck_AllMissionAI = %1",_blck_AllMissionAI]; +if (blck_useSignalEnd) then +{ + //diag_log format["**** Minor\SM1.sqf:: _crate = %1",_crates select 0]; + [_crates select 0] spawn blck_fnc_signalEnd; + + if (blck_debugLevel > 2) then + { + diag_log format["[blckeagls] missionSpawner:: SignalEnd called: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; + }; +}; + +[_mines] spawn blck_fnc_clearMines; +[_objects, blck_cleanupCompositionTimer] call blck_fnc_addObjToQue; +[_blck_AllMissionAI,blck_AliveAICleanUpTime] call blck_fnc_addLiveAItoQue; +[["end",_endMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers; +[_blck_localMissionMarker select 1, _missionType] call compile preprocessfilelinenumbers "debug\missionCompleteMarker.sqf"; +[_blck_localMissionMarker select 0] call compile preprocessfilelinenumbers "debug\deleteMarker.sqf"; +[_blck_localMissionMarker select 0,"Completed"] call blck_fnc_updateMissionQue; \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionEndConditionsMet.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionEndConditionsMet.sqf new file mode 100644 index 0000000..60e534b --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionEndConditionsMet.sqf @@ -0,0 +1,43 @@ +////////////////////////////////////////////////////// +// test whether the end conditions for a mission have been met +// by Ghostrider-DBD- +// Last modified 1/12/17 +///////////////////////////////////////////////////// + +params ["_locations","_blck_AllMissionAI","_endCondition"]; +private{"_missionComplete","_endIfPlayerNear","_endIfAIKilled"]; + _missionComplete = false; + _endIfAIKilled - false; + _endIfPlayerNear = false; +switch (_endCondition) do +{ + case "playerNear": {_endIfPlayerNear = true;}; + case "allUnitsKilled": {_endIfAIKilled = true;}; + case "allKilledOrPlayerNear": {_endIfPlayerNear = true;_endIfAIKilled = true;}; +}; +if (blck_debugON) then {diag_log format["_fnc_missionEndConditionMet:: -> _endIfPlayerNear = %1, _endIfAIKilled = %2, _endCondition = %3",_endIfPlayerNear,_endIfAIKilled,_endCondition]; +if (blck_debugLevel isEqualTo 3) then +{ + uiSleep 60; + diag_log "_fnc_missionEndConditionMet::-> bypassing end condtions, blck_debugLevel == 3"; +} else { + while {!_missionComplete} do + { + uiSleep 5; + if (_endIfPlayerNear) then { + if ( { (isPlayer _x) && ([_x,_locations,20] call blck_fnc_objectInRange) && (vehicle _x == _x) } count allPlayers > 0) then { + _missionComplete = true; + }; + }; + + if (_endIfAIKilled) then { + private _alive = ({alive _x} count _blck_AllMissionAI) > 0; + diag_log format["missionSpawner:: count alive _blck_AllMissionAI = %1",_alive]; + if (({alive _x} count _blck_AllMissionAI) < 1 ) then { + _missionComplete = true; + diag_log format["missionSpawner:: _blck_AllMissionAI = %1","testing case _endIfAIKilled"]; + }; + }; + }; +}; +true diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner-4Reinforce.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner-4Reinforce.sqf new file mode 100644 index 0000000..6375156 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner-4Reinforce.sqf @@ -0,0 +1,232 @@ +/* + Generic Mission Spawner + for DBD Clan + By Ghostrider-DBD- + Copyright 2016 + Last modified 1/12/17 +*/ + +private ["_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_AI_Vehicles"]; +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["_chanceHeliPatrol","_noPara","_reinforcementLootCounts","_chanceLoot","_heliCrew"]; +if (isNil "_chanceReinforcements") then +{ + _chanceReinforcements = 0; + _noPara = 0; + _reinforcementLootCounts = [0,0,0,0,0,0]; + _chanceHeliPatrol = 0; + _chanceLoot = 0; +}; + +private["_timeOut","_blck_AllMissionAI"]; // _timeOut is the time in seconds after which a mission is deactivated. +if (isNil "_markerColor") then {_markerColor = "ColorBlack"}; +if (isNil "_markerType") then {_markerType = ["mil_box",[]]}; +if (isNil "_timeOut") then {_timeOut = -1;}; +if (isNil "_noPara") then {_noPara = 0}; +if (isNil "_chanceHeliPatrol") then {_chanceHeliPatrol = 0;}; +if (isNil "_chanceLoot") then {_chanceLoot = 0}; +if (isNil "_heliCrew") then {_heliCrew = 3}; + +if (isNil "_reinforcementLootCounts") then +{ + private["__weap","_mags","_backpacks","_optics","_loadout"]; + _weap = 2 + floor(random(4)); + _mags = 5 + floor(random(6)); + _backpacks = 1 + floor(random(2)); + _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";}; +} +else +{ + if (blck_debugLevel > 0) then {diag_log "missionSpawner:: Mission specific values used for _reinforcementLootCounts";}; +}; + +if (blck_debugLevel > 0) then { + diag_log format["[blckEagle] Mission Reinforcement Parameters: changeReinforcements %1 numAI %2 changePatrol %3 chanceLoot %4",_chanceReinforcements,_noPara,_chanceHeliPatrol,_chanceLoot]; +}; + +private["_useMines","_abortMissionSpawner","_blck_AllMissionAI","_delayTime","_groupPatrolRadius"]; +if (isNil "_useMines") then {_useMines = blck_useMines;}; + +_objects = []; +_mines = []; +_crates = []; +_aiGroup = []; +_missionAIVehicles = []; +_blck_AllMissionAI = []; +_AI_Vehicles = []; +_blck_localMissionMarker = [_missionType,_coords,"","",_markerColor,_markerType]; +_delayTime = 1; +_groupPatrolRadius = 50; +_abortMissionSpawner = false; + +[_blck_localMissionMarker select 0,"Active",_coords] call blck_fnc_updateMissionQue; + +if (blck_labelMapMarkers select 0) then +{ + //diag_log "SM1.sqf: 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"; + _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; +blck_missionSpawning = false; +if (blck_debugLevel > 0) then {diag_log "missionSpawner:: waiting for player to trigger the mission";}; +private _missionStartTime = diag_tickTime; +waitUntil{[_coords,blck_TriggerDistance,blck_MissionTimout] call blck_fnc_missionStartConditionsMet;}; +if (((diag_tickTime - _missionStartTime) > blck_MissionTimout)) exitWith +{ + //["timeOut",_endMsg,_blck_localMissionMarker select 2] call blck_fnc_messageplayers; + [_blck_localMissionMarker select 0] execVM "debug\deleteMarker.sqf"; + [_objects, 1] spawn blck_fnc_cleanupObjects; + [_blck_localMissionMarker select 0,"Completed"] call blck_fnc_updateMissionQue; + 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]; + }; +}; + + +if (blck_debugLevel > 0) then +{ diag_log format["[blckeagls] missionSpawner:: -- >> Mission tripped by nearby player: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; +}; + +if (count _missionLootBoxes > 0) then +{ + _crates = [_coords,_missionLootBoxes] call blck_fnc_spawnMissionCrates; +} +else +{ + _crates = [_coords,[[selectRandom blck_crateTypes /*"Box_NATO_Wps_F"*/,[0,0,0],_crateLoot,_lootCounts]]] call blck_fnc_spawnMissionCrates; + +}; + +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] missionSpawner:: Crates Spawned: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; +}; + +uiSleep _delayTime; +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; + _objects append _temp; +}; +uiSleep _delayTime; +if (_useMines) then +{ + _mines = [_coords] call blck_fnc_spawnMines; + uiSleep _delayTime;; +}; + +if (_missionLandscapeMode isEqualTo "random") then +{ + _temp = [_coords,_missionLandscape, 3, 15, 2] call blck_fnc_spawnRandomLandscape; +} else { + _temp = [_coords, floor(random(360)),_missionLandscape,true] call blck_fnc_spawnCompositionObjects; +}; +_objects append _temp; +diag_log format["_fnc_missionSpawner::->> mission objects spawned = %1",_objects]; + +if (blck_debugON) then +{ + diag_log format["[blckeagls] missionSpawner:: Landscape spawned: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; +}; + +uiSleep _delayTime;; + +if ((count _missionLootVehicles) > 0) then // spawn loot vehicles +{ + diag_log "[blckEagles] _fnc_missionSpawner:: Spawning Mission Loot Vehicles"; + private _vehs = [_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles; +}; + +uiSleep _delayTime; +diag_log "[blckEagle] _fnc_missionSpawner:: spawning AI"; +_blck_AllMissionAI = [_coords,_minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionAI; +diag_log format["[blckeagls] _fnc_missionSpawner (190):-> _blck_AllMissionAI = %1",_blck_AllMissionAI]; +if (blck_debugON) then +{ + diag_log format["[blckeagls] missionSpawner:: AI Patrols Spawned: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; +}; + +uiSleep _delayTime; +private _emp = []; +diag_log format["[blckeagls] _fnc_missionSpawner (197):-> _noEmplacedWeapons = %1",_noEmplacedWeapons]; +if (!blck_useStatic && (_noEmplacedWeapons > 0)) then +{ + private ["_emplacedGroup","_emplacedPositions"]; + + _emplacedPositions = [_coords,_count,35,50] call blck_fnc_findPositionsAlongARadius; + //diag_log format["missionSpawner:: _emplacedPositions = %1",_emplacedPositions]; + { + _emplacedGroup = [_x,1,1,_aiDifficultyLevel,_coords,1,2,_uniforms,_headGear] call blck_fnc_spawnGroup; + if !(isNull _emplacedGroup) then + { + _blck_AllMissionAI = _blck_AllMissionAI + (units _emplacedGroup); + _emplacedWeapon = [_x,_emplacedGroup,blck_staticWeapons,5,15] call blck_fnc_spawnEmplacedWeapon; + _missionAIVehicles pushback _emplacedWeapon; + uiSleep _delayTime; + }; + }forEach _emplacedPositions; +}; +if (blck_debugLevel > 0) then {diag_log format["[blckeagls] _fnc_missionSpawner (208):-> _blck_AllMissionAI = %1",_blck_AllMissionAI];}; +uiSleep _delayTime; +if (blck_useVehiclePatrols && (_noVehiclePatrols > 0)) then +{ + diag_log "[blckEagles] _fnc_missionSpawner:: spawning patrol vehicles"; + private _return = [_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionVehiclePatrols; + if (count _return isEqualTo 2) then + { + _blck_AllMissionAI = _blck_AllMissionAI + (_return select 0); + _AI_Vehicles = _AI_Vehicles + (_return select 1); + }; +}; + +if ((random(1) < _chanceReinforcements)) then +{ + diag_log format["[blckeagls] missionSpawner:: calling in reinforcements: _heliCrew = %1",4]; + private["_grpPilot","_supplyHeli"]; + _grpPilot = createGroup blck_AI_Side; + _grpPara = createGroup blck_AI_Side; + if (!(isNulL _grpPilot) && !(isNull _grpPara)) then + { + //_supplyHeli = [_coords,_grpPilot,_chanceLoot] call blck_fnc_spawnMissionHeli; + //[_coords,_grpPara,_noPara,_aiDifficultyLevel,_chanceLoot,_reinforcementLootCounts,_uniforms,_headgear,_supplyHeli,_grpPilot] spawn blck_fnc_callInReinforcements; + } else { deleteGroup _grpPilot; deleteGroup _grpPara;}; +}; + +if (blck_debugON) then {diag_log "[blckeagls] _fnc_missionSpawner (214) :: waiting for mission completion criterion to be met"; +waitUntil{[_crates,_blck_AllMissionAI,_endCondition] call blck_fnc_missionEndConditionsMet;}; +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] missionSpawner:: Mission completion criteria fulfilled: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; +}; + +if (blck_useSignalEnd) then +{ + [_crates select 0] spawn blck_fnc_signalEnd; +}; +[_mines] spawn blck_fnc_clearMines; +[_objects, blck_cleanupCompositionTimer] call blck_fnc_addObjToQue; +[_blck_AllMissionAI,blck_AliveAICleanUpTime] call 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 0] execVM "debug\deleteMarker.sqf"; +[_blck_localMissionMarker select 0,"Completed"] call blck_fnc_updateMissionQue; +diag_log format["[blckeagls] missionSpawner:: end of mission: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; 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 68e6573..8aa7c1c 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf @@ -3,30 +3,16 @@ for DBD Clan By Ghostrider-DBD- Copyright 2016 + Last modified 1/12/17 */ - -private ["_crates","_aiGroup","_objects","_vehicles","_groupPatrolRadius","_missionLandscape","_compositions","_missionCfg","_compSel","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_AI_Vehicles"]; - +private ["_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_AI_Vehicles","_timeOut"]; params["_coords","_missionType","_aiDifficultyLevel"]; -/* -_aiDifficultyLevel = _this select 2; // "blue","red","green" and "orange" -*/ - -// ************************* - -// Once the entire mission system can support timeout cleanup of vehicles (specifically the AI vehicle patrols) then each mission layout can define this varialbe. Until then disable timouts. - -////////////////////////////////// -// To simplify debugging and also reduce load on server besure only once instance of the mission spawner is initializing at a time. -///////////////////////////////// - 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["_chanceHeliPatrol","_noPara","_reinforcementLootCounts","_chanceLoot"]; +private["_chanceHeliPatrol","_noPara","_reinforcementLootCounts","_chanceLoot","_heliCrew"]; if (isNil "_chanceReinforcements") then { _chanceReinforcements = 0; @@ -35,35 +21,37 @@ if (isNil "_chanceReinforcements") then _chanceHeliPatrol = 0; _chanceLoot = 0; }; -private["_timeOut","_blck_AllMissionAI"]; // _timeOut is the time in seconds after which a mission is deactivated. + if (isNil "_markerColor") then {_markerColor = "ColorBlack"}; if (isNil "_markerType") then {_markerType = ["mil_box",[]]}; if (isNil "_timeOut") then {_timeOut = -1;}; if (isNil "_noPara") then {_noPara = 0}; if (isNil "_chanceHeliPatrol") then {_chanceHeliPatrol = 0;}; if (isNil "_chanceLoot") then {_chanceLoot = 0}; +if (isNil "_heliCrew") then {_heliCrew = 3}; + if (isNil "_reinforcementLootCounts") then { + private["__weap","_mags","_backpacks","_optics","_loadout"]; _weap = 2 + floor(random(4)); _mags = 5 + floor(random(6)); _backpacks = 1 + floor(random(2)); _optics = 1 + floor(random(6)); _loadout = 1 + floor(random(3)); _reinforcementLootCounts = [_weap,_mags,_optics,0,0,_backpacks]; - //diag_log "missionSpawner:: default values used for _reinforcementLootCounts"; + if (blck_debugLevel > 0) then {diag_log "missionSpawner:: default values used for _reinforcementLootCounts";}; } else { - //diag_log "missionSpawner:: Mission specific values used for _reinforcementLootCounts"; + if (blck_debugLevel > 0) then {diag_log "missionSpawner:: Mission specific values used for _reinforcementLootCounts";}; }; -if (blck_debugON) then { +if (blck_debugLevel > 0) then { diag_log format["[blckEagle] Mission Reinforcement Parameters: changeReinforcements %1 numAI %2 changePatrol %3 chanceLoot %4",_chanceReinforcements,_noPara,_chanceHeliPatrol,_chanceLoot]; - //[_blck_localMissionMarker select 0,"Completed"] call blck_fnc_updateMissionQue; }; private["_useMines","_abortMissionSpawner","_blck_AllMissionAI","_delayTime","_groupPatrolRadius"]; -if (isNil "_useMines") then {_useMines = blck_useMines; /*diag_log "[blckEagles] Using default setting for _useMines";*/}; +if (isNil "_useMines") then {_useMines = blck_useMines;}; _objects = []; _mines = []; @@ -75,17 +63,6 @@ _AI_Vehicles = []; _blck_localMissionMarker = [_missionType,_coords,"","",_markerColor,_markerType]; _delayTime = 1; _groupPatrolRadius = 50; -_abortMissionSpawner = false; - -// [_markerClass,"Active",_coords] call blck_fnc_updateMissionQue; -[_blck_localMissionMarker select 0,"Active",_coords] call blck_fnc_updateMissionQue; - -if ((_noEmplacedWeapons + _noAIGroups + _noVehiclePatrols + ([] call blck_fnc_groupsOnAISide)) > 140) then { - // There are insufficient groups available within the 144 group per side maximum to spawn the entire mission - // Log the Error Condition - diag_log format["[blckeagls] ERROR CONDITION: Mission spawner aborted. Insufficient groups available to spawn entire mission | %1 groups used", [] call blck_fnc_groupsOnAISide]; - -}; // max groups per side = 144; leave a safety factor of 4 groups. if (blck_labelMapMarkers select 0) then { @@ -101,12 +78,6 @@ _blck_localMissionMarker set [3,blck_labelMapMarkers select 1]; // Use an arrow [["start",_startMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers; [_blck_localMissionMarker] execVM "debug\spawnMarker.sqf"; -_fn_timedOut = { - params["_startTime"]; - private["_return"]; - _return = ( (diag_tickTime - _startTime) > blck_MissionTimout ); - _return; -}; _fn_playerWithinRange = { params["_pos"]; private["_return"]; @@ -118,10 +89,6 @@ _fn_playerWithinRange = { _return; }; -_fnc_abortMissionSpawner = { - -}; - 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. @@ -129,7 +96,7 @@ uiSleep 1; //////////////////////////// blck_missionSpawning = false; -//diag_log "missionSpawner:: waiting for player to trigger the mission"; +diag_log "missionSpawner:: waiting for player to trigger the mission"; private["_wait","_missionStartTime","_playerInRange","_missionTimedOut"]; _missionStartTime = diag_tickTime; _playerInRange = false; @@ -246,94 +213,8 @@ if (_playerInRange) then }forEach _missionLootVehicles; }; - uiSleep _delayTime; - //diag_log format["_fnc_missionSpawner:: after adding any static weapons, _blck_AllMissionAI is %1",_blck_AllMissionAI]; - - //diag_log format["_fnc_missionSpawner:: after adding any vehicle patrols, _blck_AllMissionAI is %1",_blck_AllMissionAI]; - //diag_log format["missionSpawner:: _noAIGroups = %1; spawning AI Groups now",_noAIGroups]; - uiSleep _delayTime; - 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; - if !(isNull _newGroup) then - { - _newAI = units _newGroup; - _blck_AllMissionAI = _blck_AllMissionAI + _newAI; - //diag_log format["missionSpawner: Spawning Groups: _noAIGroups=1 _newGroup=%1 _newAI = %2",_newGroup, _newAI]; - } else { - _abortMissionSpawner = true; - }; - }; - 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; - if (isNull _newGroup) exitWith {_abortMissionSpawner = true;}; - _newAI = units _newGroup; - _blck_AllMissionAI = _blck_AllMissionAI + _newAI; - //diag_log format["missionSpawner: Spawning 2 Groups: _newGroup=%1 _newAI = %2",_newGroup, _newAI]; - }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; - if (isNull _newGroup) then {_abortMissionSpawner = true;} else - { - _newAI = units _newGroup; - _blck_AllMissionAI = _blck_AllMissionAI + _newAI; - //diag_log format["missionSpawner: Spawning Groups: _noAIGroups=3 _newGroup=%1 _newAI = %2",_newGroup, _newAI]; - _groupLocations = [_coords,2,20,35] call blck_fnc_findPositionsAlongARadius; - { - _newGroup = [_x,_unitsPerGroup,_unitsPerGroup,_aiDifficultyLevel,_coords,1,12,_uniforms,_headGear] call blck_fnc_spawnGroup; - if (isNull _newGroup) exitWith {_abortMissionSpawner = true;}; - _newAI = units _newGroup; - _blck_AllMissionAI = _blck_AllMissionAI + _newAI; - //diag_log format["missionSpawner: Spawning 2 Groups:_newGroup=%1 _newAI = %2",_newGroup, _newAI]; - }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; - _newAI = units _newGroup; - _blck_AllMissionAI = _blck_AllMissionAI + _newAI; - //diag_log format["missionSpawner: Spawning Groups: _noAIGroups=%3 _newGroup=%1 _newAI = %2",_newGroup, _newAI,_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; - if (isNull _newGroup) exitWith {_abortMissionSpawner = true;}; - _newAI = units _newGroup; - _blck_AllMissionAI = _blck_AllMissionAI + _newAI; - //diag_log format["missionSpawner: Spawning %3 Groups: _newGroup=%1 _newAI = %2",_newGroup, _newAI,_noAIGroups]; - }forEach _groupLocations; - }; - }; - - if (blck_debugON) then - { - diag_log format["[blckeagls] missionSpawner:: AI Patrols Spawned: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; - }; - - uiSleep _delayTime; - if (!_abortMissionSpawner && blck_useStatic && (_noEmplacedWeapons > 0)) then + if (blck_useStatic && (_noEmplacedWeapons > 0)) then { private["_static","_count"]; if ( count (_missionEmplacedWeapons) > 0 ) then @@ -352,15 +233,11 @@ if (_playerInRange) then //diag_log format["missionSpawner:: _emplacedPositions = %1",_emplacedPositions]; { _emplacedGroup = [_x,1,1,_aiDifficultyLevel,_coords,1,2,_uniforms,_headGear] call blck_fnc_spawnGroup; - if !(isNull _emplacedGroup) then - { - _blck_AllMissionAI = _blck_AllMissionAI + (units _emplacedGroup); - _emplacedWeapon = [_x,_emplacedGroup,blck_staticWeapons,5,15] call blck_fnc_spawnEmplacedWeapon; - _missionAIVehicles pushback _emplacedWeapon; - uiSleep _delayTime; - } exitWith { - _abortMissionSpawner = true; - }; + //_emplacedUnits = units _emplacedGroup; + _blck_AllMissionAI = _blck_AllMissionAI + (units _emplacedGroup); + _emplacedWeapon = [_x,_emplacedGroup,blck_staticWeapons,5,15] call blck_fnc_spawnEmplacedWeapon; + _missionAIVehicles pushback _emplacedWeapon; + uiSleep _delayTime; }forEach _emplacedPositions; //diag_log format["missionSpawner:: emplaced weapons data: _AI_Vehicles %1 _blck_AllMissionAI %1",_AI_Vehicles,_blck_AllMissionAI]; if (blck_debugON) then @@ -368,9 +245,111 @@ if (_playerInRange) then diag_log format["[blckeagls] missionSpawner:: Static Weapons Spawned: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; }; }; + uiSleep _delayTime; + //diag_log format["_fnc_missionSpawner:: after adding any static weapons, _blck_AllMissionAI is %1",_blck_AllMissionAI]; - uiSleep _delayTime; - if (!_abortMissionSpawner && blck_useVehiclePatrols && (_noVehiclePatrols > 0)) then + //diag_log format["_fnc_missionSpawner:: after adding any vehicle patrols, _blck_AllMissionAI is %1",_blck_AllMissionAI]; + //diag_log format["missionSpawner:: _noAIGroups = %1; spawning AI Groups now",_noAIGroups]; + uiSleep _delayTime; + 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; + _newAI = units _newGroup; + _blck_AllMissionAI = _blck_AllMissionAI + _newAI; + //diag_log format["missionSpawner: Spawning Groups: _noAIGroups=1 _newGroup=%1 _newAI = %2",_newGroup, _newAI]; + }; + 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; + _newAI = units _newGroup; + _blck_AllMissionAI = _blck_AllMissionAI + _newAI; + //diag_log format["missionSpawner: Spawning 2 Groups: _newGroup=%1 _newAI = %2",_newGroup, _newAI]; + }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; + _newAI = units _newGroup; + _blck_AllMissionAI = _blck_AllMissionAI + _newAI; + //diag_log format["missionSpawner: Spawning Groups: _noAIGroups=3 _newGroup=%1 _newAI = %2",_newGroup, _newAI]; + _groupLocations = [_coords,2,20,35] call blck_fnc_findPositionsAlongARadius; + { + _newGroup = [_x,_unitsPerGroup,_unitsPerGroup,_aiDifficultyLevel,_coords,1,12,_uniforms,_headGear] call blck_fnc_spawnGroup; + _newAI = units _newGroup; + _blck_AllMissionAI = _blck_AllMissionAI + _newAI; + //diag_log format["missionSpawner: Spawning 2 Groups:_newGroup=%1 _newAI = %2",_newGroup, _newAI]; + }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; + _newAI = units _newGroup; + _blck_AllMissionAI = _blck_AllMissionAI + _newAI; + //diag_log format["missionSpawner: Spawning Groups: _noAIGroups=%3 _newGroup=%1 _newAI = %2",_newGroup, _newAI,_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; + _newAI = units _newGroup; + _blck_AllMissionAI = _blck_AllMissionAI + _newAI; + //diag_log format["missionSpawner: Spawning %3 Groups: _newGroup=%1 _newAI = %2",_newGroup, _newAI,_noAIGroups]; + }forEach _groupLocations; + }; + }; + 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]; + }; + + 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]; + 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]; + [] 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]; + }; + if !(_grpReinforcements isEqualTo grpNull) then + { + _blck_AllMissionAI = _blck_AllMissionAI + (units _grpReinforcements); + //diag_log format["missionSpawner:: _grpReinforcements = %1",_grpReinforcements]; + }; + }; + + if (blck_useVehiclePatrols && (_noVehiclePatrols > 0)) then { private["_vehGroup","_patrolVehicle","_vehiclePatrolSpawns"]; _vehiclePatrolSpawns= [_coords,_noVehiclePatrols,45,60] call blck_fnc_findPositionsAlongARadius; @@ -378,7 +357,6 @@ if (_playerInRange) then //for "_i" from 1 to _noVehiclePatrols do { _vehGroup = [_x,3,3,_aiDifficultyLevel,_coords,1,2,_uniforms,_headGear] call blck_fnc_spawnGroup; - if (isNull _vehGroup) exitWith {_abortMissionSpawner = true;}; //diag_log format["missionSpawner:: group for AI Patrol vehicle spawn: group is %1 with units of %2",_vehGroup, units _vehGroup]; _blck_AllMissionAI = _blck_AllMissionAI + (units _vehGroup); _randomVehicle = blck_AIPatrolVehicles call BIS_fnc_selectRandom; @@ -389,57 +367,13 @@ if (_playerInRange) then //uiSleep _delayTime; _AI_Vehicles pushback _patrolVehicle; }forEach _vehiclePatrolSpawns; + //diag_log format["missionSpawner:: vehicle patrols data: _AI_Vehicles %1 _blck_AllMissionAI %1",_AI_Vehicles,_blck_AllMissionAI]; uiSleep _delayTime; - if (blck_debugLevel > 1) then + if (blck_debugON) then { diag_log format["[blckeagls] missionSpawner:: Vehicle Patrols Spawned: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; }; }; - - if (!_abortMissionSpawner && (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["[blckeagls] missionSpawner:: calling in reinforcements: Current mission: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; - [] spawn { - - // Note that we need to be able to access the group spawned by the reinforcements function in order to add those AI to the list of live AI for the mission. - // Thus, we cannot use spawn to execute the function which creates a minor limitation in that if the mission is small it could be completed before AI are spawned and recorded. - // Trying to work around this by spawning - if (blck_debugLevel > 1) then {diag_log format["[blckeagls] missionSpawner::reinforcement spawner started: Current mission: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName];}; - _grpReinforcements = [_coords,_noPara,_aiDifficultyLevel,_chanceLoot,_reinforcementLootCounts,_weaponList,_uniforms,_headgear,_chanceHeliPatrol] call blck_fnc_callInReinforcements; - if (blck_debugLevel > 1) then {diag_log format["[blckeagls] missionSpawner::reinforcement spawner return _grpReinforcements = %1",_grpReinforcements];}; - if (!isNull _grpReinforcements) then - { - _blck_AllMissionAI = _blck_AllMissionAI + (units _grpReinforcements); - }; - //}; - */ - }; - - if (_abortMissionSpawner) then - { - // discard everything - {deleteVehicle _x} forEach _objects; - {deleteVehicle _x} forEach _mines; - {deleteVehicle _x} forEach _crates; - {deleteVehicle _x} forEach _blck_AllMissionAI; - {deleteVehicle _x} forEach _AI_Vehicles; - // set the mission status to waiting - [_blck_localMissionMarker select 0,"Completed"] call blck_fnc_updateMissionQue; - uiSleep 1; - // delete any empty groups left over from the cleanup. - [] call blck_fnc_cleanEmptyGroups; - - }; // Trigger for mission end //diag_log format["[blckeagls] mission Spawner _endCondition = %1",_endCondition]; private["_missionComplete"]; @@ -465,11 +399,11 @@ if (_playerInRange) then { if (blck_debugLevel isEqualTo 3) then { - uiSleep 240; + uiSleep 120; _missionComplete = 1; } else { if (_endIfPlayerNear) then { - if ( { (isPlayer _x) && ([_x,_locations,20] call blck_fnc_playerInRange) && (vehicle _x == _x) } count allPlayers > 0) then { + if ( { (isPlayer _x) && ([_x,_locations,20] call blck_fnc_objectInRange) && (vehicle _x == _x) } count allPlayers > 0) then { _missionComplete = 1; }; }; @@ -484,7 +418,7 @@ if (_playerInRange) then }; }; - if (blck_debugLevel > 2) then + if (blck_debugON) then { diag_log format["[blckeagls] missionSpawner:: Mission completion criteria fulfilled: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; }; @@ -494,7 +428,7 @@ if (_playerInRange) then //diag_log format["**** Minor\SM1.sqf:: _crate = %1",_crates select 0]; [_crates select 0] spawn blck_fnc_signalEnd; - if (blck_debugLevel > 2) then + if (blck_debugON) then { diag_log format["[blckeagls] missionSpawner:: SignalEnd called: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; }; @@ -505,6 +439,6 @@ if (_playerInRange) then [["end",_endMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers; [_blck_localMissionMarker select 1, _missionType] execVM "debug\missionCompleteMarker.sqf"; [_blck_localMissionMarker select 0] execVM "debug\deleteMarker.sqf"; - [_blck_localMissionMarker select 0,"Completed"] call blck_fnc_updateMissionQue; + //[_blck_localMissionMarker select 0,"Completed"] call blck_fnc_updateMissionQue; diag_log format["[blckeagls] missionSpawner:: end of mission: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; }; diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionStartConditionsMet.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionStartConditionsMet.sqf new file mode 100644 index 0000000..c28bb69 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_missionStartConditionsMet.sqf @@ -0,0 +1,20 @@ +////////////////////////////////////////////////////// +// test whether the start conditions for a mission have been met +// returns true when either a player is within _range meters of _pos or the time elapsed is greater than _timeoutTime +// by Ghostrider-DBD- +// Last modified 1/12/17 +///////////////////////////////////////////////////// + +params ["_pos","_range","_timeoutInterval","_endCondition"]; +private["_missionComplete","_timeoutTime"]; +_startTime = diag_tickTime; +_timeoutTime = _startTime + _timeoutInterval; + +if (blck_debugLevel isEqualTo 3) then +{ + uiSleep 60; + diag_log "_fnc_missionStartConditionsMet::-> bypassing start conditions with blck_debugLevel == 3"; +} else { + waitUntil{uiSleep 1; (diag_tickTime - _startTime) > _timeoutTime || {(isPlayer _x) && (_pos distance _x) < _range} count allPlayers > 0}; +}; +true diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_objectInRange.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_objectInRange.sqf new file mode 100644 index 0000000..2e6bc90 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_objectInRange.sqf @@ -0,0 +1,23 @@ +////////////////////////////////////////////////////// +// Test whether one object (e.g., a player) is within a certain range of any of an array of other objects +/* + for DBD Clan + By Ghostrider-DBD- + Copyright 2016 + Last modified 1/12/2017 +*/ +///////////////////////////////////////////////////// + + private ["_result"]; + params["_obj1","_objList","_minDist"]; + //_obj1 : player or other object + // _objList : array of objects + //_minDist : distance below which the function would return true; + + _result = false; + //diag_log format["playerInRange.sqf: _obj1 = %1, _objList = %2 _minDist = %3",_obj1,_objList,_minDist]; + { + if ((_x distance _obj1) < _minDist) exitWith {_result = true;}; + } forEach _objList; + + _result \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_playerInRange.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_playerInRange.sqf index 7ce0b5b..f02852d 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_playerInRange.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_playerInRange.sqf @@ -4,19 +4,17 @@ for DBD Clan By Ghostrider-DBD- Copyright 2016 + Last Modified 1/12/17 */ ///////////////////////////////////////////////////// - private ["_result"]; - params["_obj1","_objList","_minDist"]; - //_obj1 : player or other object - // _objList : array of objects - //_minDist : distance below which the function would return true; - - _result = false; - //diag_log format["playerInRange.sqf: _obj1 = %1, _objList = %2 _minDist = %3",_obj1,_objList,_minDist]; - { - if ((_x distance _obj1) < _minDist) exitWith {_result = true;}; - } forEach _objList; - - _result \ No newline at end of file +private ["_result"]; +params["_pos","_dist"]; +diag_log format["_fnc_playerInRange:: -> _pos = %1 and _dist = %2",_pos,_dist]; +uiSleep 5; +_result = false; +{ + if ((_x distance _pos) < _dist) exitWith {_result = true;}; +} forEach allPlayers; + +_result \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_selectAILoadout.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_selectAILoadout.sqf new file mode 100644 index 0000000..384bd58 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_selectAILoadout.sqf @@ -0,0 +1,21 @@ +/* + [ + _missionColor // ["blue","red","green","orange"] + ] call blck_fnc_selectAILoadout; + + returns: + _lootarray + by Ghostrider-DbD- + 1/9-17 +*/ +private["_weaponList","_missionColor"]; + +_missionColor = _this select 0; +switch (_missionColor) 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;}; +}; +_weaponList \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionAI.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionAI.sqf new file mode 100644 index 0000000..c647f5a --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionAI.sqf @@ -0,0 +1,90 @@ +/* + blck_fnc_spawnMissionAI + by Ghostrider-DbD- + 1/9/17 + [_coords, // center of the area within which to spawn AI + _minNoAI, // minimum number of AI to spawn + _maxNoAI, // Max number of AI to spawn + _aiDifficultyLevel, // AI level [blue, red, etc] + _uniforms, // Uniforms to use - note default is blck_sSkinList + _headGear // headgear to use - blck_BanditHeager is the default + ] call blck_fnc_spawnMissionAI + returns an array of the units spawned +*/ + params["_coords",["_minNoAI",3],["_maxNoAI",6],["_aiDifficultyLevel","red"],["_uniforms",blck_SkinList],["_headGear",blck_BanditHeadgear]]; + private["_unitsToSpawn","_unitsPerGroup","_ResidualUnits","_newGroup","_blck_AllMissionAI"]; + _unitsToSpawn = round(_minNoAI + round(random(_maxNoAI - _minNoAI))); + _unitsPerGroup = floor(_unitsToSpawn/_noAIGroups); + _ResidualUnits = _unitsToSpawn - (_unitsPerGroup * _noAIGroups); + _blck_AllMissionAI = []; + diag_log format["_fnc_spawnMissionAI :: _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; + if !(isNull _newGroup) then + { + //_newAI = units _newGroup; + _blck_AllMissionAI = _blck_AllMissionAI + units _newGroup; + //diag_log format["missionSpawner: Spawning Groups: _noAIGroups=1 _newGroup=%1 _newAI = %2",_newGroup, _newAI]; + } else { + _abortMissionSpawner = true; + }; + }; + 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; + if (isNull _newGroup) exitWith {_abortMissionSpawner = true;}; + _newAI = units _newGroup; + _blck_AllMissionAI = _blck_AllMissionAI + _newAI; + //diag_log format["missionSpawner: Spawning 2 Groups: _newGroup=%1 _newAI = %2",_newGroup, _newAI]; + }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; + if (isNull _newGroup) then {_abortMissionSpawner = true;} else + { + _newAI = units _newGroup; + _blck_AllMissionAI = _blck_AllMissionAI + _newAI; + //diag_log format["missionSpawner: Spawning Groups: _noAIGroups=3 _newGroup=%1 _newAI = %2",_newGroup, _newAI]; + _groupLocations = [_coords,2,20,35] call blck_fnc_findPositionsAlongARadius; + { + _newGroup = [_x,_unitsPerGroup,_unitsPerGroup,_aiDifficultyLevel,_coords,1,12,_uniforms,_headGear] call blck_fnc_spawnGroup; + if (isNull _newGroup) exitWith {_abortMissionSpawner = true;}; + _newAI = units _newGroup; + _blck_AllMissionAI = _blck_AllMissionAI + _newAI; + //diag_log format["missionSpawner: Spawning 2 Groups:_newGroup=%1 _newAI = %2",_newGroup, _newAI]; + }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; + _newAI = units _newGroup; + _blck_AllMissionAI = _blck_AllMissionAI + _newAI; + //diag_log format["missionSpawner: Spawning Groups: _noAIGroups=%3 _newGroup=%1 _newAI = %2",_newGroup, _newAI,_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; + if (isNull _newGroup) exitWith {_abortMissionSpawner = true;}; + _newAI = units _newGroup; + _blck_AllMissionAI = _blck_AllMissionAI + _newAI; + //diag_log format["missionSpawner: Spawning %3 Groups: _newGroup=%1 _newAI = %2",_newGroup, _newAI,_noAIGroups]; + }forEach _groupLocations; + }; + }; + +_blck_AllMissionAI \ 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 new file mode 100644 index 0000000..6fabff5 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionEmplacedWeapons.sqf @@ -0,0 +1,61 @@ +/* + + [_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"]; +diag_log format["[blckeagls] _fnc_spawnMissionEmplacedWeapons(9):: - > _noEmplacedWeapons = %1",_noEmplacedWeapons]; +private ["_emplacedGroup","_emplacedPositions","_missionGroups","_missionAI","_missionStatics","_false","_return","_count"]; +_missionGroups = []; +_missionAI = []; +_missionStatics = []; +_return = []; +diag_log format["[blckeagls] _fnc_spawnMissionEmplacedWeapons(15):: - > _noEmplacedWeapons = %1",_noEmplacedWeapons]; +if (count _missionEmplacedWeapons > 0) then +{ + { + diag_log format["[blckeagls] _fnc_spawnMissionEmplacedWeapons (19):: - > _spawning from _missionEmplacedWeapons %1",_missionEmplacedWeapons]; + _emplacedGroup = [_x,1,1,_aiDifficultyLevel,_coords,0,0.1,_uniforms,_headGear] call blck_fnc_spawnGroup; + diag_log format["[blckeagls] _fnc_spawnMissionEmplacedWeapons (21):: - > _spawned group %1",_emplacedGroup]; + if !(isNull _emplacedGroup) then + { + _missionGroups pushback _emplacedGroup; + {_x allowDamage false;} forEach units _emplacedGroup; + _emplacedWeapon = [_x,_emplacedGroup,blck_staticWeapons,5,15] call blck_fnc_spawnEmplacedWeapon; + _emplacedWeapon setPosATL _x; + _missionStatics pushback _missionStatics; + uiSleep _delayTime; + {_x allowDamage true;} forEach units _emplacedGroup; + }; + } forEach _missionEmplacedWeapons; +} else { + _emplacedPositions = [_coords,_count,35,50] call blck_fnc_findPositionsAlongARadius; + { + diag_log format["[blckeagls] _fnc_spawnMissionEmplacedWeapons (36):: - > _noEmplacedWeapons = %1",_noEmplacedWeapons]; + _emplacedGroup = [_x,1,1,_aiDifficultyLevel,_coords,1,2,_uniforms,_headGear] call blck_fnc_spawnGroup; + diag_log format["[blckeagls] _fnc_spawnMissionEmplacedWeapons (38):: - > _spawned group %1",_emplacedGroup]; + if !(isNull _emplacedGroup) then + { + _missionGroups pushback _emplacedGroup; + _emplacedWeapon = [_x,_emplacedGroup,blck_staticWeapons,5,15] call blck_fnc_spawnEmplacedWeapon; + _missionStatics pushback _missionStatics; + uiSleep _delayTime; + }; + }forEach _emplacedPositions; +}; + +{ + if !(isNull _x) then {_missionAI pushback (units _x); +}forEach _missionGroups; + +if ( (count _missionAI) < 1) then +{ + {deleteVehicle _x} forEach _missionStatics; +} +else +{ + _return = [_missionAI,_missionStatics]; +}; + +_return; \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionHeli.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionHeli.sqf new file mode 100644 index 0000000..96ff227 --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionHeli.sqf @@ -0,0 +1,62 @@ + +params["_coords","_grpPilot","_chanceLoot"]; +_chopperType = selectRandom blck_AIHelis; + +diag_log format["_fnc_missionSpawner:: _chopperType seleted = %1",_chopperType]; + +_spawnVector = round(random(360)); +_spawnDistance = 1000; // + floor(random(1500)); // We need the heli to be on-site quickly to minimize the chance that a small mission has been completed before the paratroops are deployed and added to the list of live AI for the mission +_dropLoot = (random(1) < _chanceLoot); + +// Use the new functionality of getPos +// https://community.bistudio.com/wiki/getPos +_spawnPos = _coords getPos [_spawnDistance,_spawnVector]; + +diag_log format["_fnc_missionSpawner:: vector was %1 with distance %2 yielding a spawn position of %3 at distance from _coords of %4",_spawnVector,_spawnDistance,_spawnPos, (_coords distance2d _spawnPos)]; + +_grpPilot setBehaviour "CARELESS"; +_grpPilot setCombatMode "RED"; +_grpPilot setSpeedMode "FULL"; +_grpPilot allowFleeing 0; + +private["_supplyHeli"]; +//create helicopter and spawn it +_supplyHeli = createVehicle [_chopperType, _spawnPos, [], 90, "FLY"]; +if ([] call blck_fnc_getModType isEqualTo "Epoch") then +{ + _supplyHeli call EPOCH_server_setVToken; +}; +_supplyHeli setDir (_spawnVector -180); +_supplyHeli setFuel 1; +_supplyHeli engineOn true; +_supplyHeli flyInHeight 250; +_supplyHeli setVehicleLock "LOCKED"; +_supplyHeli addEventHandler ["GetOut",{(_this select 0) setFuel 0;(_this select 0) setDamage 1;}]; + +clearWeaponCargoGlobal _supplyHeli; +clearMagazineCargoGlobal _supplyHeli; +clearItemCargoGlobal _supplyHeli; +clearBackpackCargoGlobal _supplyHeli; + +_unitPilot = _grpPilot createUnit ["I_helipilot_F", getPos _supplyHeli, [], 0, "FORM"]; +_unitPilot setSkill 1; +_unitPilot assignAsDriver _supplyHeli; +_unitPilot moveInDriver _supplyHeli; +_grpPilot selectLeader _unitPilot; +_grpPilot setVariable["paraGroup",_paraGroup]; +diag_log format["_fnc_missionSpawner:: heli spawned and pilot added"]; + +//set waypoint for helicopter +private["_wpDestination"]; +[_grpPilot, 0] setWPPos _coords; +[_grpPilot, 0] setWaypointType "MOVE"; +[_grpPilot, 0] setWaypointSpeed "FULL"; +[_grpPilot, 0] setWaypointBehaviour "CARELESS"; +[_grpPilot, 0] setWaypointCompletionRadius 30; +[_grpPilot, 0] setWaypointStatements ["true","[this, 0] setWaypointName ""done"" ;"]; +[_grpPilot,0] setWaypointTimeout [0.5,0.5,0.5]; +_grpPilot setCurrentWaypoint [_grpPilot,0]; + +diag_log format["_fnc_missionSpawner:: initial pilot waypoints set"]; + +_supplyHeli \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionLootVehicles.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionLootVehicles.sqf new file mode 100644 index 0000000..48dce1f --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionLootVehicles.sqf @@ -0,0 +1,17 @@ +/* + [_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles; + returns _vehs, an array of vehicles spawned. + by Ghostridere-DbD- + 1/10/17 +*/ +params["_missionLootVehicles"]; +private _vehs = []; +{ + //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 /* vehicle class name*/, _pos] call blck_fnc_spawnVehicle; + _vehs pushback _veh; + [_veh,_x select 2 /*loot array*/, _x select 3 /*array of values specifying number of items of each loot type to load*/] call blck_fnc_fillBoxes; +}forEach _missionLootVehicles; +_vehs \ No newline at end of file diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionVehiclePatrols.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionVehiclePatrols.sqf new file mode 100644 index 0000000..0c18fec --- /dev/null +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionVehiclePatrols.sqf @@ -0,0 +1,46 @@ +/* + [_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear] call _fnc_spawnMissionVehiclePatrols + by Ghostrider-DbD- + 1/9/17 + returns [] if no groups could be created + returns [_AI_Vehicles,_missionAI] otherwise; +*/ +params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_uniforms","_headGear"]; +private["_vehGroup","_patrolVehicle","_vehiclePatrolSpawns","_missionAI","_missiongroups","_AI_Vehicles","_abort","_vehiclePatrolSpawns","_randomVehicle","_return"]; +_missionAI = []; +_missiongroups = []; +_AI_Vehicles = []; +_return = []; +_abort = false; +_vehiclePatrolSpawns= [_coords,_noVehiclePatrols,45,60] call blck_fnc_findPositionsAlongARadius; +{ + _vehGroup = [_x,3,3,_aiDifficultyLevel,_coords,1,2,_uniforms,_headGear] call blck_fnc_spawnGroup; + if (isNull _vehGroup) exitWith {_abort = true;}; + _missiongroups pushback _vehGroup; + _randomVehicle = blck_AIPatrolVehicles call BIS_fnc_selectRandom; + _patrolVehicle = [_coords,_x,_randomVehicle,(_x distance _coords) -5,(_x distance _coords) + 5,_vehGroup] call blck_fnc_spawnVehiclePatrol; + _vehGroup setVariable["groupVehicle",_patrolVehicle,true]; + _AI_Vehicles pushback _patrolVehicle; +}forEach _vehiclePatrolSpawns; +if (blck_debugLevel > 1) then +{ + diag_log format["[blckeagls] missionSpawner:: Vehicle Patrols Spawned: _cords %1 : _missionType %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_missionType,_aiDifficultyLevel,_markerMissionName]; +}; +if (_abort) then +{ + {deleteVehicle _x} forEach _AI_Vehicles; + { + {deleteVehicle _x} forEach (units _x); + deleteGroup _x; + } forEach _missiongroups; + +}; +if !(_abort) then +{ + { + _missionAI append (units _x); + }forEach _missiongroups; + _return = [_missionAI,_AI_Vehicles]; +}; + +_return; \ 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 0c6be39..c1e4aee 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_updateMissionQue.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_updateMissionQue.sqf @@ -30,3 +30,4 @@ if (blck_debugON) then {diag_log format["_fnc_updateMissionQue :: _mission = %1 if (blck_debugON) then {diag_log format ["_fnc_updateMissionQue :: blck_pendingMissions updated to %1",blck_pendingMissions];}; }; }forEach blck_pendingMissions; + diff --git a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf index f000427..79dc696 100644 --- a/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf +++ b/@epochhive/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf @@ -63,3 +63,6 @@ private _vehList = blck_missionVehicles; _veh setFuel 1; }; }forEach _vehList; + + + diff --git a/@epochhive/addons/custom_server/Compiles/blck_functions.sqf b/@epochhive/addons/custom_server/Compiles/blck_functions.sqf index 3cfae31..e36b60a 100644 --- a/@epochhive/addons/custom_server/Compiles/blck_functions.sqf +++ b/@epochhive/addons/custom_server/Compiles/blck_functions.sqf @@ -8,6 +8,7 @@ blck_functionsCompiled = false; // General functions blck_fnc_waitTimer = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_waitTimer.sqf"; +blck_fnc_timedOut = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_timedOut.sqf"; blck_fnc_FindSafePosn = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_findSafePosn.sqf"; blck_fnc_randomPosition = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_randomPosn.sqf";// find a randomPosn. see script for details. blck_fnc_findPositionsAlongARadius = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_findPositionsAlongARadius.sqf"; @@ -24,30 +25,40 @@ 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_missionTimer = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionTimer.sqf"; +blck_fnc_missionStartConditionsMet = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionStartConditionsMet.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"; // blck_fnc_addLiveAItoQue = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_addLiveAItoQue.sqf"; blck_fnc_addObjToQue = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_addObjToQue.sqf"; // -blck_fnc_playerInRange = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_playerInRange.sqf"; +blck_fnc_objectInRange = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_objectInRange.sqf"; +blck_fnc_missionTimer = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionTimer.sqf"; blck_fnc_spawnCrate = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnCrate.sqf"; // Simply spawns a crate of a specified type at a specific position. -blck_fnc_spawnMissionCrates = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnMissionCrates.sqf"; // Spawn loot crates at specific positions relative to the mission center; these will be filled with loot following the parameters in the composition array for the mission +blck_fnc_spawnMissionCrates = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnMissionCrates.sqf"; blck_fnc_cleanupObjects = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_cleanUpObjects.sqf"; blck_fnc_spawnCompositionObjects = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnBaseObjects.sqf"; blck_fnc_spawnRandomLandscape = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnRandomLandscape.sqf"; +blck_fnc_spawnMissionVehiclePatrols = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnMissionVehiclePatrols.sqf"; +blck_fnc_spawnMissionEmplacedWeapons = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnMissionEmplacedWeapons.sqf"; +blck_fnc_spawnMissionAI = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnMissionAI.sqf"; +blck_fnc_spawnMissionLootVehicles = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnMissionLootVehicles.sqf"; +blck_fnc_spawnMissionHeli = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnMissionHeli.sqf"; blck_fnc_addItemToCrate = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_addItemToCrate.sqf"; blck_fnc_loadLootItemsFromArray = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc__loadLootItemsFromArray.sqf"; 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_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. +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_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. +blck_fnc_missionEnd = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionEnd.sqf"; // Reinforcement-related functions blck_fnc_callInReinforcements = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Reinforcements\GMS_fnc_callInReinforcements.sqf"; -blck_fnc_dropReinforcements = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Reinforcements\GMS_fnc_dropReinforcements.sqf"; -blck_fnc_spawnHeliParaCrate = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Reinforcements\GMS_fnc_spawnParaCrate.sqf"; -blck_fnc_spawnParaCrate = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Reinforcements\GMS_fnc_spawnParaUnits.sqf"; +blck_fnc_spawnParaUnits = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Reinforcements\GMS_fnc_spawnParaUnits.sqf"; +blck_fnc_spawnParaCrate = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Reinforcements\GMS_fnc_spawnParaCrate.sqf"; +//blck_fnc_spawnReinforcHeli = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Reinforcements\GMS_fnc_spawnReinforcHeli.sqf"; blck_fnc_sendHeliHome = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Reinforcements\GMS_fnc_sendHeliHome.sqf"; //blck_fnc_spawnHeliPatrol = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Reinforcements\GMS_fnc_spawnParaUnits.sqf"; //blck_fnc_spawnHeliPatrol = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Reinforcements\GMS_fnc_spawnParaUnits.sqf"; diff --git a/@epochhive/addons/custom_server/Compiles/blck_variables.sqf b/@epochhive/addons/custom_server/Compiles/blck_variables.sqf index 300ba4f..8153481 100644 --- a/@epochhive/addons/custom_server/Compiles/blck_variables.sqf +++ b/@epochhive/addons/custom_server/Compiles/blck_variables.sqf @@ -6,8 +6,8 @@ Last modified 10/25/16 */ //blck_variablesLoaded = false; -blck_debugON = false; -blck_debugLevel = 0; // Reserved for certain testing modes. +blck_debugON = true; +blck_debugLevel = 1; // Sets level of detail for debugging info - WIP. blck_minFPS = 10; //////////////////////////////////////////////// diff --git a/@epochhive/addons/custom_server/Configs/blck_configs_epoch.sqf b/@epochhive/addons/custom_server/Configs/blck_configs_epoch.sqf index baf8b68..750c7d7 100644 --- a/@epochhive/addons/custom_server/Configs/blck_configs_epoch.sqf +++ b/@epochhive/addons/custom_server/Configs/blck_configs_epoch.sqf @@ -91,7 +91,7 @@ Last modified 8/1/15 blck_useKilledAIName = true; // When false, the name of the killer (player), weapon and distance are displayed; otherwise the name of the player and AI unit killed are shown. blck_useMines = false; // when true mines are spawned around the mission area. these are cleaned up when a player reaches the crate. Note that this is a default and that mission-specific settings can be defined for each mission using the template blck_useVehiclePatrols = true; // When true vehicles will be spawned at missions and will patrol the mission area. - blck_killEmptyAIVehicles = true; // when true, the AI vehicle will be extensively damaged once all AI have gotten out. + blck_killEmptyAIVehicles = false; // when true, the AI vehicle will be extensively damaged once all AI have gotten out. blck_AIPatrolVehicles = ["B_G_Offroad_01_armed_EPOCH","B_LSV_01_armed_F"]; // Type of vehicle spawned to defend AI bases // Updated for v6.51 diff --git a/@epochhive/addons/custom_server/Configs/blck_custom_config.sqf b/@epochhive/addons/custom_server/Configs/blck_custom_config.sqf index 632daeb..9d0d59d 100644 --- a/@epochhive/addons/custom_server/Configs/blck_custom_config.sqf +++ b/@epochhive/addons/custom_server/Configs/blck_custom_config.sqf @@ -25,15 +25,15 @@ if (blck_debugON) then diag_log "[blckeagls] Debug seting is ON, Custom configurations used"; blck_mainThreadUpdateInterval = 10; - blck_enableOrangeMissions = 1; - blck_enableGreenMissions = 1; - blck_enableRedMissions = 2; + blck_enableOrangeMissions = -1; + blck_enableGreenMissions = -1; + blck_enableRedMissions = 1; blck_enableBlueMissions = 1; blck_cleanupCompositionTimer = 10; // Time after mission completion at which items in the composition are deleted. blck_AliveAICleanUpTime = 10; // Time after mission completion at which any remaining live AI are deleted. - blck_bodyCleanUpTimer = 180; + blck_bodyCleanUpTimer = 10; blck_SpawnEmplaced_Orange = 4; // Number of static weapons at Orange Missions blck_SpawnEmplaced_Green = 3; // Number of static weapons at Green Missions diff --git a/@epochhive/addons/custom_server/Missions/Blue/default.sqf b/@epochhive/addons/custom_server/Missions/Blue/default.sqf index 23e01ec..5d102db 100644 --- a/@epochhive/addons/custom_server/Missions/Blue/default.sqf +++ b/@epochhive/addons/custom_server/Missions/Blue/default.sqf @@ -46,6 +46,6 @@ _reinforcementLootCounts = [_weap,_mags,_optics,0,0,_backpacks]; diag_log format["blueDefault:: _chanceReinforcements = %1 and _chanceLoot = %2", _chanceReinforcements, _chanceLoot]; //diag_log format["blueDefault:: default reinforcement settings are %1",blck_reinforcementsBlue]; -_endCondition = "playerNear"; // Options are "allUnitsKilled", "playerNear", "playerNear" +_endCondition = "playerNear"; // Options are "allUnitsKilled", "playerNear", "allKilledOrPlayerNear" _timeout = -1; #include "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionSpawner.sqf"; diff --git a/@epochhive/addons/custom_server/changeLog.sqf b/@epochhive/addons/custom_server/changeLog.sqf index eb228b4..5acc75d 100644 --- a/@epochhive/addons/custom_server/changeLog.sqf +++ b/@epochhive/addons/custom_server/changeLog.sqf @@ -4,7 +4,10 @@ Loosely based on the AI mission system by blckeagls ver 2.0.2 Contributions by Narines: bug fixes, testing, 'fired' event handler Ideas or code from that by Vampire and KiloSwiss have been used for certain functions. -1/12/17 Version 6.53 Build 24 +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. + +1/7/17 Version 6.53 Build 24 Added a setting blck_baseSkill = 0.7; // This defines the base skil of AI. Increase it to make AI more challenging. Tweaked AI difficulty settings to make missions more difficult. changed - GMS_EH_unitKilled - the event handler now uses precompiled rather than compiled on the fly code. @@ -14,7 +17,7 @@ Tweaked debugging information to reduced unnecessary logging when not in debug-m Disabled the loop sending server fps client-side fixed - GMS_fnc_updateMissionQue was not correctly updating mission information after mission completion. fixed - GMS_fnc_mainThread was not deleted old AI and Vehicles from the arrays used to capture them after mission completion. -changed - calls to GMS_fnc_vehicleMonitor were moved inside the main loop.. +changed - calls to GMS_fnc_vehicleMonitor were moved inside the main loop. 1/3/17 Version 6.51 Build 23 Moved configuration for the client from debug\blckclient.sqf to debug\blckconfig.sqf. @@ -162,4 +165,4 @@ Major Update to Build 5.0 6) The first phase of restructuring of the file structure has been completed. Most code for functions and units has been moved to a compiles directory in Compiles\Units and Compiles\Functions. 7) Some directionality and randomness was added where mission objects are spawned at random locations from an array of objects to give the missions more of a feeling of a perimeter defense where H-barrier and other objects were added. 8) As part of the restructuing, variables were moved from AIFunctions to a separate file. -9) Bugs in routines for cleanup of dead and live AI were fixed. A much simpler system for tracking live AI, dead AI, locations of active and recent missions, was implemented because of the centralization of the mission spawning to a single script +9) Bugs in routines for cleanup of dead and live AI were fixed. A much simpler system for tracking live AI, dead AI, locations of active and recent missions, was implemented because of the centralization of the mission spawning to a single script \ No newline at end of file diff --git a/@epochhive/addons/custom_server/init/blck_init.sqf b/@epochhive/addons/custom_server/init/blck_init.sqf index 0439e3f..0cd4325 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 153d29c..6515ab7 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.53 Build 24"; -_blck_versionDate = "1-12-17 9:00 PM"; +_blck_version = "6.54 Build 27"; +_blck_versionDate = "1-13-17 10:00 PM";