Further debugging. All Basic functions Working

Total re-write of spawner for emplaced weapons and vehicle patrols. The
trigger loops that detect when to start or timeout a mission and when a
mission is complete were totally redone. Some functions are now done
using copies of the parrent arrays.
This commit is contained in:
Ghostrider-DbD-
2017-01-23 00:45:37 -05:00
parent a4195086ca
commit 1c4fb03321
19 changed files with 342 additions and 248 deletions

View File

@ -9,10 +9,10 @@ if (blck_debugLevel > 2) then
diag_log format ["_fnc_cleanEmptyGroups:: -- >> group count = %1 ",(count allGroups)];
diag_log format ["_fnc_cleanEmptyGroups:: -- >> Group count AI side = %1", call blck_fnc_groupsOnAISide];
};
private _grp = +allGroups;
{
//diag_log format["_fnc_cleanEmptyGroups:: - >> type of object _x = %1",typeName _x];
if ((count units _x) isEqualTo 0) then {deleteGroup _x};
}forEach allGroups;
}forEach _grp;
//if (blck_debugLevel > 2) then {diag_log "_fnc_cleanEmptyGroups:: -- >> exiting function";};

View File

@ -9,7 +9,8 @@
*/
private ["_timer10Min","_timer1min","_timer5min","_modType","_coords"];
_timer1sec = diag_tickTime;
_timer15sec = diag_tickTime;
_timer5sec = diag_tickTime;
_timer20sec = diag_tickTime;
//_timer1min = diag_tickTime;
_timer5min = diag_tickTime;
//_timer10Min = diag_tickTime;
@ -25,11 +26,11 @@ while {true} do
[] call blck_fnc_vehicleMonitor;
_timer1sec = diag_tickTime;
};
if ((diag_tickTime - _timer15sec) > 15) then
if ((diag_tickTime - _timer5sec) > 5) then
{
//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:: (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];
if (diag_tickTime > (_x select 1) ) then {
@ -41,8 +42,8 @@ while {true} do
if (blck_debugLevel > 1) then {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];
_obj = 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];
@ -55,13 +56,14 @@ while {true} do
if (blck_debugLevel > 1) then {diag_log format["_fnc_mainTread:: blck_oldMissionObjects updated to %1",blck_oldMissionObjects];};
};
}forEach _obj;
diag_log format["_fnc_mainThread:: (59) blck_fnc_cleanupDeadAI = %1", blck_deadAI];
[] call blck_fnc_cleanupDeadAI;
if (_modType isEqualTo "Epoch") then {
[] call blck_fnc_cleanEmptyGroups;
}; // Exile cleans up empty groups automatically so this should not be needed with that mod.
diag_log format["_fnc_mainThread:: (66) blck_pendingMissions = %1", blck_pendingMissions];
{
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
@ -77,7 +79,7 @@ while {true} do
};
};
}forEach blck_pendingMissions;
_timer15sec = diag_tickTime;
_timer5sec = diag_tickTime;
};

View File

@ -0,0 +1,19 @@
//////////////////////////////////////////////////////
// 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/22/17
*/
/////////////////////////////////////////////////////
private ["_result"];
params["_pos","_dist"];
_result = false;
{
if ((_x distance2D _pos) < _dist) exitWith {_result = true;};
} forEach allPlayers;
//diag_log format["_fnc_playerInRange:: -> _pos = %1 and _dist = %2 and _result = %3",_pos,_dist,_result];
_result

View File

@ -1,12 +1,13 @@
//////////////////////////////////////////////////////
// test if a timeout condition exists.
// by Ghostrider-DBD-
// Last modified 1/9/17
// Last modified 1/22/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 );
if ((diag_tickTime - _startTime) > blck_MissionTimout ) then {_return = true} else {_return = false};
//diag_log format["fnc_timedOut:: blck_MissionTimout = %2 || _return = %1",_return,blck_MissionTimout];
_return;

View File

@ -9,9 +9,9 @@
private["_numbertospawn","_groupSpawned","_safepos","_weaponList","_useLauncher","_launcherType"];
params["_pos", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], "_center", ["_minDist",20], ["_maxDist",35], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear] ];
if (blck_debugLevel > 1) then
if (blck_debugLevel > 2) then
{
diag_log format["[blckeagls] _fnc_spawnGroup called parameters: _numai1 %1, _numbai2 %2, _skillLevel %3, _center %4",_numai1,_numai2,_skillLevel,_center];
//diag_log format["[blckeagls] _fnc_spawnGroup called parameters: _numai1 %1, _numbai2 %2, _skillLevel %3, _center %4",_numai1,_numai2,_skillLevel,_center];
};
//Spawns correct number of AI
if (_numai2 > _numai1) then {
@ -19,9 +19,9 @@ if (_numai2 > _numai1) then {
} else {
_numbertospawn = _numai2;
};
if (blck_debugLevel > 1) then
if (blck_debugLevel > 2) then
{
diag_log format["spawnGroup.sqf: _numbertospawn = %1",_numbertospawn];
//diag_log format["spawnGroup.sqf: _numbertospawn = %1",_numbertospawn];
};
_groupSpawned = createGroup blck_AI_Side;

View File

@ -20,7 +20,7 @@ params["_objects"];
[_x] call blck_fnc_deleteAI;
}forEach _crew;
};
deleteVehicle _x;
_x setVariable["blck_DeleteAt",0]; // Schedule it to be deleted by fnc_vehicleMonitor immediately
};
} forEach _objects;

View File

@ -0,0 +1,35 @@
/*
[_mines,_objects,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission] call blck_fnc_endMission;
schedules deletion of all remaining alive AI and mission objects.
Updates the mission que.
Updates mission markers.
By Ghostrider-DbD-
1/22/17
*/
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 > 1) then
{
diag_log format["[blckeagls] _fnc_endMission:: (18) SignalEnd called: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
};
params["_mines","_objects","_blck_AllMissionAI","_endMsg","_blck_localMissionMarker","_coords","_mission"];
[_mines] spawn blck_fnc_clearMines;
diag_log format["_fnc_endMission: (23) _objects = %1",_objects];
uisleep 0.1;
[_objects, blck_cleanupCompositionTimer] spawn blck_fnc_addObjToQue;
diag_log format["_fnc_endMission:: (26) _blck_AllMissionAI = %1",_blck_AllMissionAI];
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, _markerClass] execVM "debug\missionCompleteMarker.sqf";
[_blck_localMissionMarker select 0] execVM "debug\deleteMarker.sqf";
blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords];
blck_recentMissionCoords pushback [_coords,diag_tickTime];
diag_log format["_fnc_endMission:: (34) _mission = %1",_mission];
[_mission,"inactive",[0,0,0]] call blck_fnc_updateMissionQue;

View File

@ -88,9 +88,9 @@ if !(blck_preciseMapMarkers) then
_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?
if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (91) message players and spawn a mission marker";};
[["start",_startMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers;
[_blck_localMissionMarker] execVM "debug\spawnMarker.sqf";
if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (94) waiting for player to trigger the mission";};
////////
@ -101,22 +101,22 @@ private["_wait","_missionStartTime","_playerInRange","_missionTimedOut"];
_missionStartTime = diag_tickTime;
_playerInRange = false;
_missionTimedOut = false;
_wait = false;
if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (105) starting mission trigger loop";};
_wait = true;
if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (105) starting mission trigger loop"};
while {_wait} do
{
diag_log "missionSpawner:: top of mission trigger loop";
if (blck_debugLevel isEqualTo 3) exitWith {_wait = false;_playerInRange = true;};
if ({isPlayer _x && _x distance2D _coords < blck_TriggerDistance} count allPlayers > 0) exitWith {_wait = false;_playerInRange = true;};
if ((diag_tickTime - _missionStartTime) > blck_MissionTimout) exitWith {_wait = false;_missionTimedOut = true;};
uiSleep 10;
diag_log format["missionSpawner:: Trigger Loop - blck_debugLevel = %1 and _coords = %2",blck_debugLevel, _coords];
diag_log format["missionSpawner:: Trigger Loop - players in range = %1",{isPlayer _x && _x distance2D _coords < blck_TriggerDistance} count allPlayers];
diag_log format["missionSpawner:: Trigger Loop - timeout = %1", (diag_tickTime - _missionStartTime) > blck_MissionTimout];
//diag_log "missionSpawner:: top of mission trigger loop";
if (blck_debugLevel > 2) exitWith {_playerInRange = true;};
if ([_coords, blck_TriggerDistance] call blck_fnc_playerInRange) exitWith {_playerInRange = true;};
if ([_missionStartTime] call blck_fnc_timedOut) exitWith {_missionTimedOut = true;};
uiSleep 5;
//diag_log format["missionSpawner:: Trigger Loop - blck_debugLevel = %1 and _coords = %2",blck_debugLevel, _coords];
//diag_log format["missionSpawner:: Trigger Loop - players in range = %1",{isPlayer _x && _x distance2D _coords < blck_TriggerDistance} count allPlayers];
//diag_log format["missionSpawner:: Trigger Loop - timeout = %1", [_missionStartTime] call blck_fnc_timedOut];
};
if ((diag_tickTime - _missionStartTime) > blck_MissionTimout) exitWith
if (_missionTimedOut) exitWith
{
// Deal with the case in which the mission timed out.
//["timeOut",_endMsg,_blck_localMissionMarker select 2] call blck_fnc_messageplayers;
@ -132,198 +132,161 @@ if ((diag_tickTime - _missionStartTime) > blck_MissionTimout) exitWith
};
};
if (true) then
////////
// Spawn the mission objects, loot chest, and AI
////////
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (112) -- >> Mission tripped: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
if (count _missionLootBoxes > 0) then
{
////////
// 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];
};
_crates = [_coords,_missionCfg select 2] call blck_fnc_spawnMissionCrates;
}
else
{
_crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]]] call blck_fnc_spawnMissionCrates;
if (count _missionLootBoxes > 0) then
{
_crates = [_coords,_missionCfg select 2/* array of crates*/] call blck_fnc_spawnMissionCrates;
}
else
{
_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_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (131) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
private ["_temp"];
if (blck_SmokeAtMissions select 0) then // spawn a fire and smoke near the crate
{
_temp = [_coords,blck_SmokeAtMissions select 1] call blck_fnc_smokeAtCrates;
if (typeName _temp isEqualTo "ARRAY") then
{
_objects append _temp;
};
};
uiSleep _delayTime;
if (_useMines) then
{
_mines = [_coords] call blck_fnc_spawnMines;
uiSleep _delayTime;;
};
uiSleep _delayTime;
_temp = [];
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;
};
if (typeName _temp isEqualTo "ARRAY") then
};
// un-comment this if you want crates cleaned up when the rest of the mission objects are removed.
//_objects append _crates;
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (131) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
private ["_temp"];
if (blck_SmokeAtMissions select 0) then // spawn a fire and smoke near the crate
{
_temp = [_coords,blck_SmokeAtMissions select 1] call blck_fnc_smokeAtCrates;
if (typeName _temp isEqualTo "ARRAY") then
{
_objects append _temp;
};
//diag_log format["_fnc_missionSpawner:: (181)->> _objects = %1",_objects];
if (blck_debugON) then
{
diag_log format["[blckeagls] missionSpawner:: (166) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
uiSleep _delayTime;;
[_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles;
uiSleep _delayTime;
private ["_infantry"];
_infantry = [_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionAI;
//diag_log format["missionSpawner:: (211) -> _infantry = %1",_infantry];
if (typeName _infantry isEqualto "ARRAY") then
{
_blck_AllMissionAI append _infantry;
};
uiSleep _delayTime;
if (blck_debugON) then
{
diag_log format["[blckeagls] missionSpawner:: AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
uisleep _delayTime;
if (blck_useVehiclePatrols && (_noVehiclePatrols > 0)) then
{
private["_veh"];
uiSleep 1;
_veh = [_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear,_markerClass] call blck_fnc_spawnMissionVehiclePatrols;
diag_log format["missionSpawner :: (230) _veh = %1",_veh];
_objects append (_veh select 0);
_blck_AllMissionAI append (_veh select 1);
uiSleep _delayTime;
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: Vehicle Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
};
uiSleep _delayTime;
private {"_temp"];
if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (213) preparing to spawn emplaced weapons for _markerClass %3:: blck_useStatic = %1 and _noEmplacedWeapons = %2",blck_useStatic,_noEmplacedWeapons,_markerClass];};
if (blck_useStatic && (_noEmplacedWeapons > 0)) then
{
_temp = [_missionEmplacedWeapons,_noEmplacedWeapons,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnEmplacedWeaponArray;
diag_log format ["missionSpawner:: (246) value returned for _temp = %1",_temp];
};
if ((random(1) < _chanceReinforcements)) then
{
_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout;
private["_grpReinforcements"];
_grpReinforcements = grpNull;
//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 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
if !(_grpReinforcements isEqualTo grpNull) then
{
_blck_AllMissionAI = _blck_AllMissionAI + (units _grpReinforcements);
//diag_log format["missionSpawner:: _grpReinforcements = %1",_grpReinforcements];
};
};
// Trigger for mission end
//diag_log format["[blckeagls] mission Spawner _endCondition = %1",_endCondition];
private["_missionComplete"];
_missionComplete = -1;
_endIfPlayerNear = false;
_endIfAIKilled = false;
_startTime = diag_tickTime;
_missionTimedOut = false;
switch (_endCondition) do
{
case "playerNear": {_endIfPlayerNear = true;};
case "allUnitsKilled": {_endIfAIKilled = true;};
case "allKilledOrPlayerNear": {_endIfPlayerNear = true;_endIfAIKilled = true;};
};
//diag_log format["missionSpawner :: _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled];
private["_locations"];
_locations = [_coords] + _crates;
//diag_log format["missionSpawner:: Waiting for player to satisfy mission end criteria of _endIfPlayerNear %1 with _endIfAIKilled %2",_endIfPlayerNear,_endIfAIKilled];
while {_missionComplete isEqualTo -1} do
{
if (blck_debugLevel isEqualTo 3) then
{
uiSleep 300;
_missionComplete = 1;
} else {
if (_endIfPlayerNear) then {
if ( { (isPlayer _x) && ([_x,_locations,20] call blck_fnc_objectInRange) && (vehicle _x == _x) } count allPlayers > 0) then {
_missionComplete = 1;
};
};
if (_endIfAIKilled) then {
if (({alive _x} count _blck_AllMissionAI) < 1 ) then {
_missionComplete = 1;
};
};
uiSleep 2;
};
};
if (blck_debugLevel > 1) then
{
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
{
//diag_log format["**** Minor\SM1.sqf:: _crate = %1",_crates select 0];
[_crates select 0] spawn blck_fnc_signalEnd;
if (blck_debugLevel > 1) then
{
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;
//diag_log format["missionSpawner:: (473) _objects = %1",_objects];
uisleep 0.1;
[_objects, blck_cleanupCompositionTimer] spawn blck_fnc_addObjToQue;
//diag_log format["missionSpawner:: (476) _blck_AllMissionAI = %1",_blck_AllMissionAI];
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, _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:: (357)end of mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
uiSleep _delayTime;
if (_useMines) then
{
_mines = [_coords] call blck_fnc_spawnMines;
uiSleep _delayTime;;
};
uiSleep _delayTime;
_temp = [];
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;
};
if (typeName _temp isEqualTo "ARRAY") then
{
_objects append _temp;
};
//diag_log format["_fnc_missionSpawner:: (181)->> _objects = %1",_objects];
if (blck_debugON) then
{
diag_log format["[blckeagls] missionSpawner:: (166) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
uiSleep _delayTime;;
[_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles;
uiSleep _delayTime;
private ["_infantry"];
_infantry = [_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionAI;
//diag_log format["missionSpawner:: (201) -> _infantry = %1",_infantry];
if (typeName _infantry isEqualto "ARRAY") then
{
_blck_AllMissionAI append _infantry;
};
uiSleep _delayTime;
if (blck_debugON) then
{
diag_log format["[blckeagls] missionSpawner:: (210) AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
uisleep _delayTime;
if (blck_useVehiclePatrols && (_noVehiclePatrols > 0)) then
{
private["_veh"];
uiSleep 1;
_veh = [_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear,_markerClass] call blck_fnc_spawnMissionVehiclePatrols;
//diag_log format["missionSpawner :: (219) _veh = %1",_veh];
_objects append (_veh select 0);
_blck_AllMissionAI append (_veh select 1);
uiSleep _delayTime;
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (225) Vehicle Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
};
uiSleep _delayTime;
private ["_temp"];
if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (213) preparing to spawn emplaced weapons for _markerClass %3:: blck_useStatic = %1 and _noEmplacedWeapons = %2",blck_useStatic,_noEmplacedWeapons,_markerClass];};
if (blck_useStatic && (_noEmplacedWeapons > 0)) then
{
_temp = [_missionEmplacedWeapons,_noEmplacedWeapons,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnEmplacedWeaponArray;
//diag_log format ["missionSpawner:: (246) value returned for _temp = %1",_temp];
_objects append (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
};
if ((random(1) < _chanceReinforcements)) then
{
_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout;
private["_grpReinforcements"];
_grpReinforcements = grpNull;
//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 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
if !(_grpReinforcements isEqualTo grpNull) then
{
_blck_AllMissionAI = _blck_AllMissionAI + (units _grpReinforcements);
//diag_log format["missionSpawner:: _grpReinforcements = %1",_grpReinforcements];
};
};
// Trigger for mission end
//diag_log format["[blckeagls] mission Spawner _endCondition = %1",_endCondition];
private["_missionComplete","_endIfPlayerNear","_endIfAIKilled"];
_missionComplete = -1;
_startTime = diag_tickTime;
switch (_endCondition) do
{
case "playerNear": {_endIfPlayerNear = true;_endIfAIKilled = false;};
case "allUnitsKilled": {_endIfPlayerNear = false;_endIfAIKilled = true;};
case "allKilledOrPlayerNear": {_endIfPlayerNear = true;_endIfAIKilled = true;};
};
//diag_log format["missionSpawner :: (269) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled];
private["_locations"];
_locations = [_coords] + _crates;
//diag_log format["missionSpawner:: Waiting for player to satisfy mission end criteria of _endIfPlayerNear %1 with _endIfAIKilled %2",_endIfPlayerNear,_endIfAIKilled];
while {_missionComplete isEqualTo -1} do
{
if (blck_debugLevel isEqualTo 3) exitWith {uiSleep 120};
if ((_endIfPlayerNear) && [_coords,20] call blck_fnc_playerInRange) exitWith {};
if ((_endIfAIKilled) && ({alive _x} count _blck_AllMissionAI) < 1 ) exitWith {};
//diag_log format["missionSpawner:: (283) missionCompleteLoop - > players near = %1 and ai alive = %2",[_coords,20] call blck_fnc_playerInRange, {alive _x} count _blck_AllMissionAI];
uiSleep 2;
};
if (blck_debugLevel > 1) then
{
diag_log format["[blckeagls] missionSpawner:: (288) Mission completion criteria fulfilled: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
[_mines,_objects,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission] call blck_fnc_endMission;
diag_log format["[blckeagls] missionSpawner:: (292)end of mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];

View File

@ -4,27 +4,37 @@
*/
params["_missionEmplacedWeapons","_noEmplacedWeapons"];
private["_return","_emplacedWeps","_wep"];
params["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear"];
private["_return","_emplacedWeps","_emplacedAI","_wep","_units","_gunner"];
_emplacedWeps = [];
diag_log "_fnc_spawnEmplacedWeaponArray start";
_emplacedAI = [];
_units = [];
//diag_log "_fnc_spawnEmplacedWeaponArray start";
// Define _missionEmplacedWeapons if not already configured.
if (count _missionEmplacedWeapons < 1) then
{
_missionEmplacedWeapons = [_coords,_noEmplacedWeapons,35,50] call blck_fnc_findPositionsAlongARadius;
};
diag_log format["_fnc_spawnEmplacedWeaponArray:: _missionEmplacedWeapons = %1", _missionEmplacedWeapons];
//diag_log format["_fnc_spawnEmplacedWeaponArray:: (18) _missionEmplacedWeapons = %1", _missionEmplacedWeapons];
{
_empGroup = [_x,1,1,_aiDifficultyLevel,_coords,1,2,_uniforms,_headGear] call blck_fnc_spawnGroup;
//diag_log format["_fnc_spawnEmplacedWeaponArray:: typeName _empGroup = %1 and _empGroup = %2",typeName _empGroup, _empGroup];
// params["_vehType","_pos",["_clearInventory",true]];
_wep = [selectRandom blck_staticWeapons,[0,0,0],false] call blck_fnc_spawnVehicle;
diag_log format["_fnc_spawnMissionEmplacedWeapons (33) spawnVehicle returned value of _wep = %1",_wep];
//diag_log format["_fnc_spawnEmplacedWeaponArray (23) spawnVehicle returned value of _wep = %1",_wep];
_wep setVariable["DBD_vehType","emplaced"];
_wep setPosATL _x;
[_wep,false] call blck_fnc_configureMissionVehicle;
_emplacedWeps pushback _wep;
blck_missionVehicles pushback _wep;
_units = units _empGroup;
_gunner = _units select 0;
_gunner moveingunner _wep;
_emplacedAI append (units _empGroup);
//diag_log format["_fnc_spawnEmplacedWeaponArray:: position of emplaced weapon = %1 and position of _x is %2",getPos _wep, _x];
//diag_log format["_fnc_spawnEmplacedWeaponArray:: _gunner = %1 and crew _wep = %2",_gunner, crew _wep];
} forEach _missionEmplacedWeapons;
_return = _emplacedWeps;
diag_log format["_fnc_spawnEmplacedWeaponArray:: returning with _return = _emplacedWeps = %1",_return];
_return = [_emplacedWeps,_emplacedAI];
//diag_log format["_fnc_spawnEmplacedWeaponArray:: returning with _return = _emplacedWeps = %1",_return];
_return

View File

@ -18,18 +18,13 @@ _vehiclePatrolSpawns= [_coords,_noVehiclePatrols,45,60] call blck_fnc_findPositi
{
_randomVehicle = selectRandom blck_AIPatrolVehicles;
_patrolVehicle = [_coords,_x,_randomVehicle,(_x distance _coords) -5,(_x distance _coords) + 5,_vehGroup] call blck_fnc_spawnVehiclePatrol;
diag_log format["_fnc_spawnMissionVehiclePatrols:: - > patrol vehicle spawned was %1 with type of %2",_patrolVehicle,_randomVehicle];
_vehGroup setVariable["groupVehicle",_patrolVehicle,true];
//diag_log format["_fnc_spawnMissionVehiclePatrols:: - > patrol vehicle spawned was %1 with type of %2",_patrolVehicle,_randomVehicle];
_vehicles pushback _patrolVehicle;
_missionAI append units _vehGroup;
diag_log format["_fnc_spawnMissionVehiclePatrols:: -- > _vehicles updated to %1",_vehicles];
//diag_log format["_fnc_spawnMissionVehiclePatrols:: -- > _vehicles updated to %1",_vehicles];
};
}forEach _vehiclePatrolSpawns;
if (blck_debugLevel > 1) then
{
diag_log format["[blckeagls] _fnc_spawnMissionVehiclePatrols :: Vehicle Patrols Spawned: _coords %1 : _missionType %2 : _aiDifficultyLevel %3",_coords,_aiDifficultyLevel];
};
blck_missionVehicles append _vehicles;
_return = [_vehicles,_missionAI];
_return

View File

@ -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/22/2017
*/
/////////////////////////////////////////////////////
private ["_result"];
params["_obj1","_objList","_minDist"];
//_obj1 : player or other object
// _objList : array of objects
//_minDist : distance within which the function would return true;
_result = false;
{
if ((_x distance2D _obj1) < _minDist) exitWith {_result = true;};
} forEach _objList;
diag_log format["objectInRange.sqf: _obj1 = %1, _objList = %2 _minDist = %3 _result = %4",_obj1,_objList,_minDist,_result];
_result

View File

@ -0,0 +1,48 @@
/*
[_missionEmplacedWeapons,_noEmplacedWeapons,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnMissionEmplacedWeapons;
*/
params["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear",["_missionType","unspecified"]];
private ["_emplacedGroup","_emplacedAI","_precise","_pos","_emplaced","_emp","_gunner","_staticWeap"];
_emplacedAI = [];
_staticWeap = [];
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;
_precise = false;
if (blck_debugLevel > 1) then {diag_log "_fnc_spawnMissionEmplacedWeapons:: -->> no spawn points specified, using spawns along a radius";
};
diag_log format["_fnc_spawnMissionEmplacedWeapons:: (19) _missionType = %2 _missionEmplacedWeapons updated to %1",_missionEmplacedWeapons,_missionType];
{
diag_log format["_fnc_spawnMissionEmplacedWeapons:: (21) spawning group to man emplaced weapon"];
_emplacedGroup = [_x,1,1,_aiDifficultyLevel,[0,0,0],1,2,_uniforms,_headGear] call blck_fnc_spawnGroup;
diag_log format["_fnc_spawnMissionEmplacedWeapons:: (23) group spawned = %1",_emplacedGroup];
_emplacedAI append (units _emplacedGroup);
diag_log format["_fnc_spawnMissionEmplacedWeapons:: (24) _emplacedAI updated to = %1",_emplacedAI];
diag_log format["_fnc_spawnMissionEmplacedWeapons:: (26) spawning emplaced weapon"];
if (_precise) then
{
_pos = _x;
} else {
_pos = [_x,5,10,0,0,20,0] call BIS_fnc_findSafePos;
};
_emp = [selectRandom blck_staticWeapons,_pos,false] call blck_fnc_spawnVehicle;
diag_log format["_fnc_spawnMissionEmplacedWeapons (33) spawnVehicle returned value of _emp = %1",_emp];
_emp setVariable["DBD_vehType","emplaced"];
_emp setPosATL _pos;
[_emp,false] call blck_fnc_configureMissionVehicle;
_gunner = (units _emplacedGroup) select 0;
_gunner moveingunner _emp;
_staticWeap pushback _emp;
diag_log format["_fnc_spawnMissionEmplacedWeapons:: (28) emplaced weapon _wep = %1",_wep];
}forEach _missionEmplacedWeapons;
_emplaced = [_staticWeap, _emplacedAI];
_emplaced

View File

@ -1,6 +1,6 @@
/*
Delete alive AI.
Now called from the main thread which tracks the time elapsed so that we no longer need to wait a proscribed period of time (see changes on lines 9 and 12)
Now called from the main thread which tracks the time elapsed so that we no longer spawn a wait timer for each completed mission.
by Ghostrider
Last updated 1/22/17
*/
@ -8,7 +8,7 @@
params["_aiList"];
{
if (blck_debugLevel > 2) then {diag_log format["_fnc_cleanupAliveAI:: -> deleteing AI Unit %1",_x];};
//if (blck_debugLevel > 2) then {diag_log format["_fnc_cleanupAliveAI:: -> deleteing AI Unit %1",_x];};
[_x] call blck_fnc_deleteAI;
}forEach _aiList;

View File

@ -5,7 +5,7 @@
*/
private["_aiList","_ai"];
_aiList = blck_deadAI;
_aiList = +blck_deadAI;
{
if ( diag_tickTime > _x getVariable ["blck_cleanupAt",0] ) then // DBD_DeleteAITimer
{

View File

@ -7,7 +7,7 @@
private["_ai","_group"];
params["_unit"];
if (blck_debugLevel > 2) then {diag_log format["_fnc_deleteAI::-> deleting unit = %1",_unit];};
//if (blck_debugLevel > 2) then {diag_log format["_fnc_deleteAI::-> deleting unit = %1",_unit];};
{
_unit removeAllEventHandlers _x;

View File

@ -22,7 +22,6 @@ diag_log format["_fnc_spawnEmplacedWeapon:: (17) weapon _%1 spawned at %2 using
if (_precise) then {_emp setPosATL _pos];
_gunner = (units _emplacedGroup) select 0;
_gunner moveingunner _emp;
[_emp,false] call blck_fnc_configureMissionVehicle;
waitUntil { count crew _emp > 0};
blck_missionVehicles pushback _emp;
if (blck_debugLevel > 1) then {diag_log format["spawnEmplaced.sqf: (24) _missionType %3 || Emplaced weapon %1 spawned at position %2",_emp,getPosATL _emp,_missionType];

View File

@ -21,7 +21,6 @@ if (_modType isEqualTo "Epoch") then
};
// params["_veh",["_clearInventory",true]];
[_veh,_clearInventory] call blck_fnc_configureMissionVehicle;
diag_log format["spawnVehicle:: returning parameter _veh = %1",_veh];
_veh

View File

@ -10,7 +10,7 @@
private ["_veh","_vehList"];
_vehList = blck_missionVehicles;
if (blck_debugLevel > 2) then {diag_log format["_fnc_vehicleMonitor:: function called with blck_missionVehicles = %1",_vehList];};
if (blck_debugLevel > 1) then {diag_log format["_fnc_vehicleMonitor:: function called with blck_missionVehicles = %1",_vehList];};
{
_veh = _x;
if (_veh getVariable["blck_DeleteAt",0] > 0) then
@ -25,7 +25,7 @@ if (blck_debugLevel > 2) then {diag_log format["_fnc_vehicleMonitor:: function c
{
if (_veh getVariable["DBD_vehType","none"] isEqualTo "emplaced") then
{
if (blck_debugOn) then
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_vehicleMonitor:: case of destroyed where vehicle = %1",_veh];
};
@ -34,7 +34,7 @@ if (blck_debugLevel > 2) then {diag_log format["_fnc_vehicleMonitor:: function c
}else {
if (blck_killEmptyAIVehicles) then
{
if (blck_debugOn) then
if (blck_debugLevel > ) then
{
diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle destroyed where vehicle = %1",_veh];
};
@ -51,7 +51,7 @@ if (blck_debugLevel > 2) then {diag_log format["_fnc_vehicleMonitor:: function c
_veh setVehicleLock "UNLOCKED" ;
_veh setVariable["releasedToPlayers",true];
[_veh] call blck_fnc_emptyObject;
if (blck_debugOn) then
if (blck_debugLevel > ) then
{
diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle released to players where vehicle = %1",_veh];
};

View File

@ -18,7 +18,7 @@ blck_fnc_timeAcceleration = compileFinal preprocessFileLineNumbers "\q\addons\c
blck_fnc_getModType = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_getModType.sqf"; // Test if Epoch or Exile is loaded
blck_fnc_groupsOnAISide = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_GroupsOnAISide.sqf"; // Returns the number of groups on the side used by AI
blck_fnc_emptyObject = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_emptyObject.sqf";
blck_fnc_playerInRange = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_playerInRange.sqf";
// Player-related functions
blck_fnc_rewardKiller = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Units\GMS_fnc_rewardKiller.sqf";
blck_fnc_MessagePlayers = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_AIM.sqf"; // Send messages to players regarding Missions
@ -30,7 +30,7 @@ blck_fnc_addMissionToQue = compileFinal preprocessFileLineNumbers "\q\addons\c
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_objectInRange = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_objectInRange.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";
@ -50,7 +50,7 @@ blck_fnc_smokeAtCrates = compileFinal preprocessFileLineNumbers "\q\addons\custo
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_missionEnd = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionEnd.sqf";
blck_fnc_endMission = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_endMission.sqf";
// Reinforcement-related functions
blck_fnc_callInReinforcements = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Reinforcements\GMS_fnc_callInReinforcements.sqf";