major update; code optimization, bug fixes.

This commit is contained in:
Ghostrider-DbD- 2017-03-20 23:36:35 -04:00
parent 58b0ab74d0
commit 293b58103b
39 changed files with 1657 additions and 467 deletions

View File

@ -0,0 +1,17 @@
//////////////////////////////////////////////////////
// Returns an array of all players on the server
/*
for DBD Clan
By Ghostrider-DBD-
Copyright 2016
Last Modified 2/24/17
*/
/////////////////////////////////////////////////////
private ["_result"];
_result = [];
{
if (isPlayer _x) then { _result pushback _x };
} forEach playableUnits;
_result

View File

@ -1,6 +1,6 @@
/*
By Ghostrider-DbD-
Last modified 1-24-17
Last modified 3-18-17
--------------------------
License
--------------------------
@ -17,10 +17,11 @@ diag_log format["starting _fnc_mainThread with time = %1",diag_tickTime];
diag_log "running DBDServer version of _fnc_mainThread";
#endif
private["_modType","_timer1sec","_timer5sec","_timer20sec","_timer5min"];
private["_modType","_timer1sec","_timer5sec","_timer20sec","_timer5min","_timer5min"];
_timer1sec = diag_tickTime;
_timer5sec = diag_tickTime;
_timer20sec = diag_tickTime;
_timer1min = diag_tickTime;
_timer5min = diag_tickTime;
_modType = [] call blck_fnc_getModType;
while {true} do
@ -35,27 +36,29 @@ while {true} do
#endif
_timer1sec - diag_tickTime;
};
if (diag_tickTime - _timer5sec > 5) then
{
_timer5sec = diag_tickTime;
};
if (diag_tickTime - _timer20sec > 20) then
{
[] call blck_fnc_cleanupAliveAI;
[] call blck_fnc_cleanupObjects;
[] call blck_fnc_cleanupDeadAI;
//[] call blck_fnc_missionGroupMonitor;
_timer20sec = diag_tickTime;
//diag_log format["_mainThread::-->> diag_tickTime = %1",diag_tickTime];
};
if (diag_tickTime - _timer1min > 60) then
{
_timer1min = diag_tickTime;
[] call blck_fnc_spawnPendingMissions;
//[] call blck_fnc_missionGroupMonitor;
if (_modType isEqualTo "Epoch") then
{
[] call blck_fnc_cleanEmptyGroups;
}; // Exile cleans up empty groups automatically so this should not be needed with that mod.
_timer20sec = diag_tickTime;
//diag_log format["_mainThread::-->> diag_tickTime = %1",diag_tickTime];
};
};
if (diag_tickTime - _timer5min > 300) then
{
[] call blck_fnc_timeAcceleration;
if (blck_timeAcceleration) then {[] call blck_fnc_timeAcceleration;};
};
};

View File

@ -8,21 +8,21 @@
*/
/////////////////////////////////////////////////////
private ["_result"];
private ["_result","_players"];
params["_pos","_dist",["_onFootOnly",false]];
_players = call blck_fnc_allPlayers;
_result = false;
if !(_onFootOnly) then
{
{
if ((_x distance2D _pos) < _dist) exitWith {_result = true;};
} forEach allPlayers;
} forEach _players;
};
//diag_log format["_fnc_playerInRange:: -> _pos = %1 and _dist = %2 and _result = %3",_pos,_dist,_result];
if (_onFootOnly) then
{
{
if ( ((_x distance2D _pos) < _dist) && (vehicle _x isEqualTo _x)) exitWith {_result = true;};
} forEach allPlayers;
} forEach _players;
};
_result

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 2/24/17
*/
/////////////////////////////////////////////////////
private ["_result"];
params["_locations","_dist",["_onFootOnly",false]];
_result = false;
{
_result = [_x,_dist,_onFootOnly] call blck_fnc_playerInRange;
if (_result) exitWith {};
} forEach _locations;
_result

View File

@ -12,7 +12,7 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Compiles\blck_defines.hpp";
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_group","_wp","_wpPos","_dis","_arc"];

View File

@ -12,7 +12,7 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Compiles\blck_defines.hpp";
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_group","_wp"];

View File

@ -2,17 +2,17 @@
call as [] call blck_fnc_cleanEmptyGroups;
Deletes any empty groups and thereby prevents errors resulting from createGroup returning nullGroup.
By Ghostrider-DbD-
11/16/16
3/18/17
*/
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;
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 _grp;
//if (blck_debugLevel > 2) then {diag_log "_fnc_cleanEmptyGroups:: -- >> exiting function";};
if (blck_debugLevel > 2) then {diag_log "_fnc_cleanEmptyGroups:: -- >> exiting function";};

View File

@ -15,7 +15,7 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Compiles\blck_defines.hpp";
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
//diag_log format["_fnc_waypointMonitor::-->> running function at diag_tickTime = %1 with blck_fnc_missionGroupMonitor = %2",diag_tickTime,blck_monitoredMissionAIGroups];

View File

@ -17,37 +17,31 @@
private["_dist","_dir","_arc","_xpos","_ypos","_newpos","_wpradius","_wpnum","_oldpos"];
params["_pos","_minDis","_maxDis","_group"];
/*
_pos = _this select 0; // center of the patrol area
_minDis = _this select 1; // minimum distance from the center of a patrol area for waypoints
_maxDis = _this select 2; // maximum distance from the center of a patrol area for waypoints
_group = _this select 3;
*/
_wpradius = 30;
_wpnum = 6;
_oldpos = _pos;
_newpos = _oldpos;
_dir = random 360;
_arc = 360/_wpnum;
//Set up waypoints for our AI
for [{ _x=1 },{ _x < _wpnum },{ _x = _x + 1; }] do {
_dir = _dir + _arc;
if (_dir > 360) then {_dir = _dir - 360;};
while{_oldpos distance2D _newpos < 20}do{
sleep .1;
_dist = (_minDis+(random (_maxDis - _minDis)));
_xpos = (_pos select 0) + sin (_dir) * _dist;
_ypos = (_pos select 1) + cos (_dir) * _dist;
_newpos = [_xpos,_ypos,0];
};
_oldPos = _newpos;
_wp = _group addWaypoint [[_xpos,_ypos,0], _wpradius];
for "_i" from 0 to (_wpnum - 1) do
{
_dir = _dir + _arc;
_dist = (_minDis+(random (_maxDis - _minDis)));
_newpos = _pos getPos [_dist, _arc];
_wp = _group addWaypoint [_newpos, 0];
_wp setWaypointTimeout [1, 1.1, 1.2];
_wp setWaypointType "MOVE";
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "RED";
_wp setWaypointName "move";
_wp = _group addWaypoint [_newpos, 0];
_wp setWaypointTimeout [15,20,25];
_wp setWaypointType "SAD";
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "RED";
_wp setWaypointName "sad";
};
_wp = _group addWaypoint [[_xpos,_ypos,0], _wpradius];
deleteWaypoint [_group, 0];
_group setVariable["wpIndex",0];
_wp = _group addWaypoint [_newpos, _wpradius];
_wp setWaypointType "CYCLE";

View File

@ -19,7 +19,7 @@ private["_numbertospawn","_groupSpawned","_safepos","_weaponList","_useLauncher"
params["_pos", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], "_center", ["_minDist",20], ["_maxDist",35], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear] ];
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 {
@ -29,7 +29,7 @@ if (_numai2 > _numai1) 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;
@ -79,7 +79,10 @@ if !(isNull _groupSpawned) then
_groupSpawned selectLeader (units _groupSpawned select 0);
[_pos,_minDist,_maxDist,_groupSpawned] spawn blck_fnc_setupWaypoints;
//diag_log format["fnc_spawnGroup:: Group spawned was %1 with units of %2",_groupSpawned, units _groupSpawned];
if (blck_debugLevel > 2) then
{
diag_log format["fnc_spawnGroup:: Group spawned was %1 with units of %2",_groupSpawned, units _groupSpawned];
};
} else {
diag_log "_fnc_spawnGroup:: ERROR CONDITION : NULL GROUP CREATED";
};

View File

@ -17,15 +17,15 @@
//diag_log format["_fnc_addMissionToQue:: -- >> _mission - %1",_mission];
// 0 1 2 3 4 5
// [_missionListOrange,_pathOrange,"OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange,]
params["_missionList","_path","_marker","_difficulty","_tMin","_tMax",["_noMissions",1]];
params["_missionList","_path","_marker","_difficulty","_tMin","_tMax",["_noMissions",1],["_allowReinforcements",true]];
for "_i" from 1 to _noMissions do
{
private _waitTime = diag_tickTime + (_tMin) + random((_tMax) - (_tMin));
// 0 1 2 3 4 5 6 7
private _mission = [_missionList,_path,format["%1%2",_marker,_i],_difficulty,_tMin,_tMax,_waitTime,[0,0,0]];
// 0 1 2 3 4 5 6 7 8
private _mission = [_missionList,_path,format["%1%2",_marker,_i],_difficulty,_tMin,_tMax,_waitTime,[0,0,0],_allowReinforcements];
if (blck_debugLevel > 0) then {diag_log format["-fnc_addMissionToQue::-->> _mission = %1",_mission];};
blck_pendingMissions pushback _mission;
};
if (blck_debugLevel > 0) then {diag_log format["_fnc_addMissionToQue:: -- >> Result - blck_pendingMissions = %1",blck_pendingMissions];};
if (blck_debugLevel > 1) then {diag_log format["_fnc_addMissionToQue:: -- >> Result - blck_pendingMissions = %1",blck_pendingMissions];};

View File

@ -17,8 +17,12 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_mines","_objects","_crates","_blck_AllMissionAI","_endMsg","_blck_localMissionMarker","_coords","_mission",["_aborted",false]];
if (blck_debugLevel > 1) then {
diag_log format["_fnc_endMission: _aborted = %1",_aborted];
};
private["_cleanupAliveAITimer","_cleanupCompositionTimer"];
if (blck_useSignalEnd) then
if (blck_useSignalEnd && !_aborted) then
{
//diag_log format["**** Minor\SM1.sqf:: _crate = %1",_crates select 0];
[_crates select 0] spawn blck_fnc_signalEnd;
@ -31,21 +35,28 @@
if (_aborted) then
{
if (blck_debugLevel > 2) then {
diag_log format["_fnc_endMission: Mission Aborted, setting all timers to 0"];
};
_cleanupCompositionTimer = 0;
_cleanupAliveAITimer = 0;
} else {
if (blck_debugLevel > 2) then {
diag_log format["_fnc_endMission: Mission Completed without errors, setting all timers to default values"];
};
_cleanupCompositionTimer = blck_cleanupCompositionTimer;
_cleanupAliveAITimer = blck_AliveAICleanUpTimer;
_cleanupAliveAITimer = blck_AliveAICleanUpTimer;
[["end",_endMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers;
[_blck_localMissionMarker select 1, _markerClass] execVM "debug\missionCompleteMarker.sqf";
};
[_mines] spawn blck_fnc_clearMines;
//diag_log format["_fnc_endMission: (23) _objects = %1",_objects];
[_objects, (_cleanupCompositionTimer)] spawn blck_fnc_addObjToQue;
//diag_log format["_fnc_endMission:: (26) _blck_AllMissionAI = %1",_blck_AllMissionAI];
[_blck_AllMissionAI, (_cleanupAliveAITimer)] 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;
blck_missionsRunning = blck_missionsRunning - 1;

View File

@ -0,0 +1,353 @@
/*
Generic Mission Spawner
for DBD Clan
By Ghostrider-DBD-
Copyright 2016
Last modified 3/18/17
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_AI_Vehicles","_timeOut","_aiDifficultyLevel"];
params["_coords","_mission",["_allowReinforcements",true]];
diag_log format["_missionSpawner (18):: _allowReinforcements = %1",_allowReinforcements];
////////
// set all variables needed for the missions
// data is pulled either from the mission description or from the _mission variable passsed as a parameter
// Deal with situations where some of these variables might not be defined as well.
////////
// _mission params[_missionListOrange,_pathOrange,"OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange];
_markerClass = _mission select 2;
_aiDifficultyLevel = _mission select 3;
if (blck_debugLevel > 0) then {diag_log format["_fnc_mainThread:: -->> _markerClass = %1",_markerClass];};
[_mission,"active",_coords] call blck_fnc_updateMissionQue;
blck_ActiveMissionCoords pushback _coords;
diag_log format["[blckeagls] missionSpawner (17):: Initializing mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
private["_chanceHeliPatrol","_noPara","_reinforcementLootCounts","_chanceLoot","_heliCrew","_loadCratesTiming"];
if (isNil "_markerColor") then {_markerColor = "ColorBlack"};
if (isNil "_markerType") then {_markerType = ["mil_box",[]]};
if (isNil "_timeOut") then {_timeOut = -1;};
if (isNil "_loadCratesTiming") then {_loadCratesTiming = blck_loadCratesTiming}; // valid choices are "atMissionCompletion" and "atMissionSpawn";
private["_useMines","_blck_AllMissionAI","_delayTime","_groupPatrolRadius"];
if (isNil "_useMines") then {_useMines = blck_useMines;};
_objects = [];
_mines = [];
_crates = [];
_aiGroup = [];
_missionAIVehicles = [];
_blck_AllMissionAI = [];
_AI_Vehicles = [];
_blck_localMissionMarker = [_markerClass,_coords,"","",_markerColor,_markerType];
_delayTime = 1;
_groupPatrolRadius = 50;
if (blck_labelMapMarkers select 0) then
{
//diag_log "labeling map markers *****";
_blck_localMissionMarker set [2, _markerMissionName];
};
if !(blck_preciseMapMarkers) then
{
//diag_log "Map marker will be OFFSET from the mission position";
_blck_localMissionMarker set [1,[_coords,75] call blck_fnc_randomPosition];
};
_blck_localMissionMarker set [3,blck_labelMapMarkers select 1]; // Use an arrow labeled with the mission name?
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";};
////////
// All parameters are defined, lets wait until a player is nearby or the mission has timed out
////////
private["_wait","_missionStartTime","_playerInRange","_missionTimedOut"];
_missionStartTime = diag_tickTime;
_playerInRange = false;
_missionTimedOut = false;
_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 > 2) exitWith {_playerInRange = true;};
if ([_coords, blck_TriggerDistance, false] 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 (_missionTimedOut) exitWith
{
// Deal with the case in which the mission timed out.
//["timeOut",_endMsg,_blck_localMissionMarker select 2] call blck_fnc_messageplayers;
blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords];
[_mission,"inactive",[0,0,0]] call blck_fnc_updateMissionQue;
[_blck_localMissionMarker select 0] call compile preprocessfilelinenumbers "debug\deleteMarker.sqf";
_blck_localMissionMarker set [1,[0,0,0]];
_blck_localMissionMarker set [2,""];
[_objects, 0.1] spawn blck_fnc_cleanupObjects;
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (105) Mission Timed Out: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
};
////////
// 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
{
_crates = [_coords,_missionLootBoxes,_loadCratesTiming] call blck_fnc_spawnMissionCrates;
}
else
{
_crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming] call blck_fnc_spawnMissionCrates;
};
if (blck_cleanUpLootChests) then
{
_objects append _crates;
};
//uisleep 2;
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (136) 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;
//uiSleep 1;
};
if (typeName _temp isEqualTo "ARRAY") then
{
_objects append _temp;
};
//diag_log format["_fnc_missionSpawner:: (181)->> _objects = %1",_objects];
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (170) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
uiSleep _delayTime;;
_temp = [_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles;
//uisleep 1;
_crates append _temp;
uiSleep _delayTime;
_abort = false;
_temp = [[],[],false];
_temp = [_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionAI;
//[_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionAI;
if (blck_debugLevel > 2) then {
diag_log format["missionSpawner :: (185) blck_fnc_spawnMissionAI returned a value of _temp = %1",_temp]; uiSleep 1;
};
_abort = _temp select 1;
if (blck_debugLevel > 2) then {
diag_log format["missionSpawner :: (190) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1;
};
if (_abort) exitWith
{
if (blck_debugLevel > 1) then {
diag_log "missionSpawner:: (194) grpNull returned, mission termination criteria met, calling blck_fnc_endMission"
};
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true] call blck_fnc_endMission;
};
if !(_abort) then
{
_blck_AllMissionAI append (_temp select 0);
};
uiSleep _delayTime;
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (202) AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
_temp = [[],[],false];
_abort = false;
if (blck_useVehiclePatrols && (_noVehiclePatrols > 0)) then
{
_temp = [_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear,_markerClass] call blck_fnc_spawnMissionVehiclePatrols;
//[_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear,_markerClass] call blck_fnc_spawnMissionVehiclePatrols;
if (blck_debugLevel > 1) then {
diag_log format["missionSpawner :: (216) blck_fnc_spawnMissionVehiclePatrols returned _temp = %1",_temp];
};
if (typeName _temp isEqualTo "ARRAY") then
{
_abort = _temp select 2;
};
if !(_abort) then
{
_objects append (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (216) Vehicle Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
};
};
if (_abort) exitWith
{
if (blck_debugLevel > 0) then {
diag_log "missionSpawner:: (222) grpNull returned, mission termination criteria met, calling blck_endMission";
};
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true] call blck_fnc_endMission;
};
uiSleep _delayTime;
_temp = [[],[],false];
_abort = false;
if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (234) 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;
if (blck_debugLevel > 2) then
{
diag_log format ["missionSpawner:: (232) blck_fnc_spawnEmplacedWeaponArray returned _temp = %1",_temp];
};
if (typeName _temp isEqualTo "ARRAY") then
{
_abort = _temp select 2;
};
if (blck_debugLevel > 2) then
{
diag_log format ["missionSpawner:: (241) _abort = %1",_abort];
};
if !(_abort) then
{
_objects append (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (253) Static Weapons Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
};
};
if (_abort) exitWith
{
if (blck_debugLevel > 2) then
{
diag_log "missionSpawner:: (261) grpNull ERROR in blck_fnc_spawnEmplacedWeaponArray, mission termination criteria met, calling blck_endMission";
};
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true] call blck_fnc_endMission;
};
if (_allowReinforcements) then
{
_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout;
temp = [];
diag_log format["[blckeagls] missionSpawner:: (268) calling in reinforcements: Current mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
//params["_coords","_aiSkillsLevel","_weapons","_uniforms","_headgear"];
_temp = [_coords,_aiDifficultyLevel,_weaponList,_uniforms,_headGear] call blck_fnc_spawnMissionReinforcements;
if (blck_debugLevel > 2) then
{
diag_log format["missionSpawner:: _temp = %1",_temp];
};
if (typeName _temp isEqualTo "ARRAY") then
{
_abort = _temp select 2;
_objects pushback (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
};
if (_abort) then
{
if (blck_debugLevel > 2) then
{
diag_log "missionSpawner:: (276) grpNul or ERROR in blck_fnc_spawnMissionReinforcements, mission termination criteria met, calling blck_endMission";
};
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true] call blck_fnc_endMission;
};
};
// 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 300};
if ((_endIfPlayerNear) && [_coords,10,true] call blck_fnc_playerInRange) exitWith {};
if ((_endIfAIKilled) && [_blck_AllMissionAI] call blck_fnc_missionAIareDead ) 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];
};
{
// Using a variable attached to the crate rather than the global setting to be sure we do not fill a crate twice.
// the "lootLoaded" loaded should be set to true by the crate filler script so we can use that for our check.
if !(_x getVariable["lootLoaded",false]) then
{
// _crateLoot,_lootCounts are defined above and carry the loot table to be used and the number of items of each category to load
[_x,_crateLoot,_lootCounts] call blck_fnc_fillBoxes;
};
}forEach _crates;
[_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,false] 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

@ -0,0 +1,348 @@
/*
Generic Mission Spawner
for DBD Clan
By Ghostrider-DBD-
Copyright 2016
Last modified 3/18/17
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_AI_Vehicles","_timeOut","_aiDifficultyLevel"];
params["_coords","_mission",["_allowReinforcements",true]];
diag_log format["_missionSpawner (18):: _allowReinforcements = %1",_allowReinforcements];
////////
// set all variables needed for the missions
// data is pulled either from the mission description or from the _mission variable passsed as a parameter
// Deal with situations where some of these variables might not be defined as well.
////////
// _mission params[_missionListOrange,_pathOrange,"OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange];
_markerClass = _mission select 2;
_aiDifficultyLevel = _mission select 3;
if (blck_debugLevel > 0) then {diag_log format["_fnc_mainThread:: -->> _markerClass = %1",_markerClass];};
[_mission,"active",_coords] call blck_fnc_updateMissionQue;
blck_ActiveMissionCoords pushback _coords;
diag_log format["[blckeagls] missionSpawner (17):: Initializing mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
private["_chanceHeliPatrol","_noPara","_reinforcementLootCounts","_chanceLoot","_heliCrew","_loadCratesTiming"];
if (isNil "_markerColor") then {_markerColor = "ColorBlack"};
if (isNil "_markerType") then {_markerType = ["mil_box",[]]};
if (isNil "_timeOut") then {_timeOut = -1;};
if (isNil "_loadCratesTiming") then {_loadCratesTiming = blck_loadCratesTiming}; // valid choices are "atMissionCompletion" and "atMissionSpawn";
private["_useMines","_blck_AllMissionAI","_delayTime","_groupPatrolRadius"];
if (isNil "_useMines") then {_useMines = blck_useMines;};
_objects = [];
_mines = [];
_crates = [];
_aiGroup = [];
_missionAIVehicles = [];
_blck_AllMissionAI = [];
_AI_Vehicles = [];
_blck_localMissionMarker = [_markerClass,_coords,"","",_markerColor,_markerType];
_delayTime = 1;
_groupPatrolRadius = 50;
if (blck_labelMapMarkers select 0) then
{
//diag_log "labeling map markers *****";
_blck_localMissionMarker set [2, _markerMissionName];
};
if !(blck_preciseMapMarkers) then
{
//diag_log "Map marker will be OFFSET from the mission position";
_blck_localMissionMarker set [1,[_coords,75] call blck_fnc_randomPosition];
};
_blck_localMissionMarker set [3,blck_labelMapMarkers select 1]; // Use an arrow labeled with the mission name?
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";};
////////
// All parameters are defined, lets wait until a player is nearby or the mission has timed out
////////
private["_wait","_missionStartTime","_playerInRange","_missionTimedOut"];
_missionStartTime = diag_tickTime;
_playerInRange = false;
_missionTimedOut = false;
_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 > 2) exitWith {_playerInRange = true;};
if ([_coords, blck_TriggerDistance, false] 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 (_missionTimedOut) exitWith
{
// Deal with the case in which the mission timed out.
//["timeOut",_endMsg,_blck_localMissionMarker select 2] call blck_fnc_messageplayers;
blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords];
[_mission,"inactive",[0,0,0]] call blck_fnc_updateMissionQue;
[_blck_localMissionMarker select 0] call compile preprocessfilelinenumbers "debug\deleteMarker.sqf";
_blck_localMissionMarker set [1,[0,0,0]];
_blck_localMissionMarker set [2,""];
[_objects, 0.1] spawn blck_fnc_cleanupObjects;
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (105) Mission Timed Out: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
};
////////
// 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
{
_crates = [_coords,_missionCfg select 2,_loadCratesTiming] call blck_fnc_spawnMissionCrates;
}
else
{
_crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming] call blck_fnc_spawnMissionCrates;
};
if (blck_cleanUpLootChests) then
{
_objects append _crates;
};
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (136) 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
{
_objects append _temp;
};
//diag_log format["_fnc_missionSpawner:: (181)->> _objects = %1",_objects];
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (170) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
uiSleep _delayTime;;
[_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles;
uiSleep _delayTime;
_abort = false;
_temp = [[],[],false];
_temp = [_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionAI;
//[_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionAI;
if (blck_debugLevel > 2) then {
diag_log format["missionSpawner :: (185) blck_fnc_spawnMissionAI returned a value of _temp = %1",_temp]; uiSleep 1;
};
_abort = _temp select 1;
if (blck_debugLevel > 2) then {
diag_log format["missionSpawner :: (190) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1;
};
if (_abort) exitWith
{
if (blck_debugLevel > 1) then {
diag_log "missionSpawner:: (194) grpNull returned, mission termination criteria met, calling blck_fnc_endMission"
};
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true] call blck_fnc_endMission;
};
if !(_abort) then
{
_blck_AllMissionAI append (_temp select 0);
};
uiSleep _delayTime;
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (202) AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
_temp = [[],[],false];
_abort = false;
if (blck_useVehiclePatrols && (_noVehiclePatrols > 0)) then
{
_temp = [_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear,_markerClass] call blck_fnc_spawnMissionVehiclePatrols;
//[_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear,_markerClass] call blck_fnc_spawnMissionVehiclePatrols;
if (blck_debugLevel > 1) then {
diag_log format["missionSpawner :: (216) blck_fnc_spawnMissionVehiclePatrols returned _temp = %1",_temp];
};
if (typeName _temp isEqualTo "ARRAY") then
{
_abort = _temp select 2;
};
if !(_abort) then
{
_objects append (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (216) Vehicle Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
};
};
if (_abort) exitWith
{
if (blck_debugLevel > 0) then {
diag_log "missionSpawner:: (222) grpNull returned, mission termination criteria met, calling blck_endMission";
};
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true] call blck_fnc_endMission;
};
uiSleep _delayTime;
_temp = [[],[],false];
_abort = false;
if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (234) 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;
if (blck_debugLevel > 2) then
{
diag_log format ["missionSpawner:: (232) blck_fnc_spawnEmplacedWeaponArray returned _temp = %1",_temp];
};
if (typeName _temp isEqualTo "ARRAY") then
{
_abort = _temp select 2;
};
if (blck_debugLevel > 2) then
{
diag_log format ["missionSpawner:: (241) _abort = %1",_abort];
};
if !(_abort) then
{
_objects append (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (253) Static Weapons Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
};
};
if (_abort) exitWith
{
if (blck_debugLevel > 2) then
{
diag_log "missionSpawner:: (261) grpNull ERROR in blck_fnc_spawnEmplacedWeaponArray, mission termination criteria met, calling blck_endMission";
};
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true] call blck_fnc_endMission;
};
if (_allowReinforcements) then
{
_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout;
temp = [];
diag_log format["[blckeagls] missionSpawner:: (268) calling in reinforcements: Current mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
//params["_coords","_aiSkillsLevel","_weapons","_uniforms","_headgear"];
_temp = [_coords,_aiDifficultyLevel,_weaponList,_uniforms,_headGear] call blck_fnc_spawnMissionReinforcements;
if (blck_debugLevel > 2) then
{
diag_log format["missionSpawner:: _temp = %1",_temp];
};
if (typeName _temp isEqualTo "ARRAY") then
{
_abort = _temp select 2;
_objects pushback (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
};
if (_abort) then
{
if (blck_debugLevel > 2) then
{
diag_log "missionSpawner:: (276) grpNul or ERROR in blck_fnc_spawnMissionReinforcements, mission termination criteria met, calling blck_endMission";
};
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true] call blck_fnc_endMission;
};
};
// 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 300};
if ((_endIfPlayerNear) && [_coords,10,true] call blck_fnc_playerInRange) exitWith {};
if ((_endIfAIKilled) && [_blck_AllMissionAI] call blck_fnc_missionAIareDead ) 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];
};
{
// Using a variable attached to the crate rather than the global setting to be sure we do not fill a crate twice.
// the "lootLoaded" loaded should be set to true by the crate filler script so we can use that for our check.
if !(_x getVariable["lootLoaded",false]) then
{
// _crateLoot,_lootCounts are defined above and carry the loot table to be used and the number of items of each category to load
[_x,_crateLoot,_lootCounts] call blck_fnc_fillBoxes;
};
}forEach _crates;
[_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,false] 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

@ -3,7 +3,7 @@
for DBD Clan
By Ghostrider-DBD-
Copyright 2016
Last modified 3/14/17
Last modified 3/20/17
--------------------------
License
@ -13,8 +13,9 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private ["_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_AI_Vehicles","_timeOut","_aiDifficultyLevel"];
params["_coords","_mission"];
private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_AI_Vehicles","_timeOut","_aiDifficultyLevel"];
params["_coords","_mission",["_allowReinforcements",true]];
diag_log format["_missionSpawner (18):: _allowReinforcements = %1",_allowReinforcements];
////////
// set all variables needed for the missions
@ -39,7 +40,7 @@ if (isNil "_markerType") then {_markerType = ["mil_box",[]]};
if (isNil "_timeOut") then {_timeOut = -1;};
if (isNil "_loadCratesTiming") then {_loadCratesTiming = blck_loadCratesTiming}; // valid choices are "atMissionCompletion" and "atMissionSpawn";
private["_useMines","_abortMissionSpawner","_blck_AllMissionAI","_delayTime","_groupPatrolRadius"];
private["_useMines","_blck_AllMissionAI","_delayTime","_groupPatrolRadius"];
if (isNil "_useMines") then {_useMines = blck_useMines;};
_objects = [];
@ -118,7 +119,7 @@ if (blck_debugLevel > 0) then
if (count _missionLootBoxes > 0) then
{
_crates = [_coords,_missionCfg select 2,_loadCratesTiming] call blck_fnc_spawnMissionCrates;
_crates = [_coords,_missionLootBoxes,_loadCratesTiming] call blck_fnc_spawnMissionCrates;
}
else
{
@ -131,9 +132,11 @@ if (blck_cleanUpLootChests) then
_objects append _crates;
};
//uisleep 2;
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];
diag_log format["[blckeagls] missionSpawner:: (136) 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
@ -149,7 +152,7 @@ uiSleep _delayTime;
if (_useMines) then
{
_mines = [_coords] call blck_fnc_spawnMines;
uiSleep _delayTime;;
//uiSleep _delayTime;;
};
uiSleep _delayTime;
_temp = [];
@ -158,6 +161,7 @@ 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;
//uiSleep 1;
};
if (typeName _temp isEqualTo "ARRAY") then
{
@ -167,74 +171,144 @@ if (typeName _temp isEqualTo "ARRAY") then
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (166) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
diag_log format["[blckeagls] missionSpawner:: (170) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
uiSleep _delayTime;;
[_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles;
_temp = [_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles;
//uisleep 1;
_crates append _temp;
uiSleep _delayTime;
private ["_infantry"];
[_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionAI;
//_blck_AllMissionAI append (_infantry select 0);
/*
if (_infantry select 1) exitWith // something went wrong spawning groups, abort.
{
[_mines,_objects,_crates_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true] call blck_fnc_endMission;
_abort = false;
_temp = [[],[],false];
_temp = [_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionAI;
//[_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear] call blck_fnc_spawnMissionAI;
if (blck_debugLevel > 2) then {
diag_log format["missionSpawner :: (185) blck_fnc_spawnMissionAI returned a value of _temp = %1",_temp]; uiSleep 1;
};
*/
_abort = _temp select 1;
if (blck_debugLevel > 2) then {
diag_log format["missionSpawner :: (190) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1;
};
if (_abort) exitWith
{
if (blck_debugLevel > 1) then {
diag_log "missionSpawner:: (194) grpNull returned, mission termination criteria met, calling blck_fnc_endMission"
};
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true] call blck_fnc_endMission;
};
if !(_abort) then
{
_blck_AllMissionAI append (_temp select 0);
};
uiSleep _delayTime;
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (189) AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
diag_log format["[blckeagls] missionSpawner:: (202) AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
uisleep _delayTime;
_temp = [[],[],false];
_abort = false;
if (blck_useVehiclePatrols && (_noVehiclePatrols > 0)) then
{
private["_veh"];
_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);
/*
if (_veh select 2) exitWith // somethen went wrong
{
[_mines,_objects,_crates_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true] call blck_fnc_endMission;
}
*/
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];
_temp = [_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear,_markerClass] call blck_fnc_spawnMissionVehiclePatrols;
//[_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear,_markerClass] call blck_fnc_spawnMissionVehiclePatrols;
if (blck_debugLevel > 1) then {
diag_log format["missionSpawner :: (216) blck_fnc_spawnMissionVehiclePatrols returned _temp = %1",_temp];
};
if (typeName _temp isEqualTo "ARRAY") then
{
_abort = _temp select 2;
};
if !(_abort) then
{
_objects append (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (216) Vehicle Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
};
};
if (_abort) exitWith
{
if (blck_debugLevel > 0) then {
diag_log "missionSpawner:: (222) grpNull returned, mission termination criteria met, calling blck_endMission";
};
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true] call blck_fnc_endMission;
};
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];};
_temp = [[],[],false];
_abort = false;
if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (234) 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 (_temp select 2) exitWith // something went wrong
if (blck_debugLevel > 2) then
{
[_mines,_objects,_crates_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true] call blck_fnc_endMission;
diag_log format ["missionSpawner:: (232) blck_fnc_spawnEmplacedWeaponArray returned _temp = %1",_temp];
};
*/
if (typeName _temp isEqualTo "ARRAY") then
{
_abort = _temp select 2;
};
if (blck_debugLevel > 2) then
{
diag_log format ["missionSpawner:: (241) _abort = %1",_abort];
};
if !(_abort) then
{
_objects append (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
if (blck_debugLevel > 0) then
{
diag_log format["[blckeagls] missionSpawner:: (253) Static Weapons Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
};
};
};
if (_abort) exitWith
{
if (blck_debugLevel > 2) then
{
diag_log "missionSpawner:: (261) grpNull ERROR in blck_fnc_spawnEmplacedWeaponArray, mission termination criteria met, calling blck_endMission";
};
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true] call blck_fnc_endMission;
};
_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout;
_reinforcement = [];
diag_log format["[blckeagls] missionSpawner:: calling in reinforcements: Current mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
//params["_coords","_aiSkillsLevel","_weapons","_uniforms","_headgear"];
_reinforcement = [_coords,_aiDifficultyLevel,_weaponList,_uniforms,_headGear] call blck_fnc_spawnMissionReinforcements;
//if (typeName _reinforcement isEqualTo "ARRAY") then {diag_log format["_fnc_missionSpawner (253): blck_fnc_spawnMissionReinforcements returned value of %1",_reinforcement];};
//blck_monitoredMissionAI append _blck_AllMissionAI; // so that we can monitor the status of the groups in the missions.
if (_allowReinforcements) then
{
_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout;
temp = [];
diag_log format["[blckeagls] missionSpawner:: (268) calling in reinforcements: Current mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
//params["_coords","_aiSkillsLevel","_weapons","_uniforms","_headgear"];
_temp = [_coords,_aiDifficultyLevel,_weaponList,_uniforms,_headGear] call blck_fnc_spawnMissionReinforcements;
if (blck_debugLevel > 2) then
{
diag_log format["missionSpawner:: _temp = %1",_temp];
};
if (typeName _temp isEqualTo "ARRAY") then
{
_abort = _temp select 2;
_objects pushback (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
};
if (_abort) then
{
if (blck_debugLevel > 2) then
{
diag_log "missionSpawner:: (276) grpNul or ERROR in blck_fnc_spawnMissionReinforcements, mission termination criteria met, calling blck_endMission";
};
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,true] call blck_fnc_endMission;
};
};
// Trigger for mission end
//diag_log format["[blckeagls] mission Spawner _endCondition = %1",_endCondition];
private["_missionComplete","_endIfPlayerNear","_endIfAIKilled"];
@ -255,7 +329,7 @@ _locations = [_coords] + _crates;
while {_missionComplete isEqualTo -1} do
{
if (blck_debugLevel isEqualTo 3) exitWith {uiSleep 300};
if ((_endIfPlayerNear) && [_coords,10,true] call blck_fnc_playerInRange) exitWith {};
if ((_endIfPlayerNear) && [_locations,10,true] call blck_fnc_playerInRangeArray) exitWith {};
if ((_endIfAIKilled) && [_blck_AllMissionAI] call blck_fnc_missionAIareDead ) 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;
@ -274,6 +348,6 @@ if (blck_debugLevel > 1) then
[_x,_crateLoot,_lootCounts] call blck_fnc_fillBoxes;
};
}forEach _crates;
[_mines,_objects,_crates_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,false] call blck_fnc_endMission;
[_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,false] 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

@ -1,7 +1,7 @@
/*
[_missionEmplacedWeapons,_noEmplacedWeapons,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnEmplacedWeaponArray;
Last modified 3/13/17
Last modified 3/20/17
By Ghostrider-DbD-
--------------------------
@ -14,35 +14,58 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear"];
private["_return","_emplacedWeps","_emplacedAI","_wep","_units","_gunner","_abort"];
private["_return","_emplacedWeps","_emplacedAI","_wep","_units","_gunner","_abort","_pos"];
_emplacedWeps = [];
_emplacedAI = [];
_units = [];
_abort = false;
_pos = [];
//diag_log "_fnc_spawnEmplacedWeaponArray start";
// Define _missionEmplacedWeapons if not already configured.
if (count _missionEmplacedWeapons < 1) then
if (_missionEmplacedWeapons isEqualTo []) then
{
_missionEmplacedWeapons = [_coords,_noEmplacedWeapons,35,50] call blck_fnc_findPositionsAlongARadius;
_missionEmplacedWeaponPositions = [_coords,_noEmplacedWeapons,35,50] call blck_fnc_findPositionsAlongARadius;
diag_log format["_fnc_spawnEmplacedWeaponArray: creating spawn locations: _missionEmplacedWeaponsPositions = %1", _missionEmplacedWeaponPositions];
{
_static = selectRandom blck_staticWeapons;
//diag_log format["_fnc_spawnEmplacedWeaponArray: creating spawn element [%1,%2]",_static,_x];
_missionEmplacedWeapons pushback [_static,_x];
//diag_log format["_fnc_spawnEmplacedWeaponArray: _mi updated to %1",_missionEmplacedWeapons];
} forEach _missionEmplacedWeaponPositions;
};
//diag_log format["_fnc_spawnEmplacedWeaponArray:: (18) _missionEmplacedWeapons = %1", _missionEmplacedWeapons];
//diag_log format["_fnc_spawnEmplacedWeaponArray:: starting static weapon spawner with _missionEmplacedWeapons = %1", _missionEmplacedWeapons];
{
_empGroup = [_x,1,1,_aiDifficultyLevel,_coords,1,2,_uniforms,_headGear] call blck_fnc_spawnGroup;
_pos = _coords vectorAdd (_x select 1);
//diag_log format["_fnc_spawnEmplacedWeaponArray: _coords = %1 | offset = %2 | final _pos = 53",_coords,_x select 1, _pos];
// params["_pos", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], "_center", ["_minDist",20], ["_maxDist",35], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear] ];
_empGroup = [(_x select 1),1,1,_aiDifficultyLevel,(_x select 1),1,2,_uniforms,_headGear] call blck_fnc_spawnGroup;
while {(count (waypoints _empGroup)) > 1} do
{
deleteWaypoint ((waypoints _empGroup) select 0);
};
if (isNull _empGroup) exitWith {_abort = _true};
//diag_log format["_fnc_spawnEmplacedWeaponArray:: typeName _empGroup = %1 and _empGroup = %2",typeName _empGroup, _empGroup];
//diag_log format["_fnc_spawnEmplacedWeaponArray:: typeName _empGroup = %1 and _empGroup = %2 and _x = %3",typeName _empGroup, _empGroup,_x];
// params["_vehType","_pos",["_clearInventory",true]];
_wep = [selectRandom blck_staticWeapons,[0,0,0],false] call blck_fnc_spawnVehicle;
_wep = [(_x select 0),[0,0,0],false] call blck_fnc_spawnVehicle;
//diag_log format["_fnc_spawnEmplacedWeaponArray (23) spawnVehicle returned value of _wep = %1",_wep];
_wep setVariable["DBD_vehType","emplaced"];
_wep setPosATL _x;
_wep setPosATL _pos;
[_wep,false] call blck_fnc_configureMissionVehicle;
_emplacedWeps 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];
_emplacedAI append _units;
//diag_log format["_fnc_spawnEmplacedWeaponArray:: position of emplaced weapon = %1 and targetd position is %2",getPos _wep, _pos];
//diag_log format["_fnc_spawnEmplacedWeaponArray:: _gunner = %1 and crew _wep = %2",_gunner, crew _wep];
_wp = [_empGroup, 0];
_wp setWaypointType "SENTRY";
_wp setWaypointName "sentry";
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "RED";
_wp setWaypointTimeout [10000,11000,12000];
_wp = _empGroup addWaypoint [_pos, 25];
_wp setWaypointType "CYCLE";
} forEach _missionEmplacedWeapons;
blck_missionVehicles append _emplacedWeps;
_return = [_emplacedWeps,_emplacedAI,_abort];

View File

@ -27,23 +27,42 @@
_ResidualUnits = _unitsToSpawn - (_unitsPerGroup * _noAIGroups);
_blck_AllMissionAI = [];
_abort = false;
//diag_log format["_fnc_spawnMissionAI :: _unitsToSpawn %1 ; _unitsPerGroup %2 _ResidualUnits %3",_unitsToSpawn,_unitsPerGroup,_ResidualUnits];
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnMissionAI (30):: _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
if (blck_debugLevel > 2) then
{
diag_log format["missionSpawner: Spawning Groups: _noAIGroups=1"];
};
_newGroup = [_coords,_unitsToSpawn,_unitsToSpawn,_aiDifficultyLevel,_coords,3,18,_uniforms,_headGear] call blck_fnc_spawnGroup;
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionAI (37):: case 1 - > _newGroup = %1",_newGroup];
};
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 {
_abort = true;
}
else
{
_newAI = units _newGroup;
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionAI(41): Spawning Groups: _noAIGroups=1 _newGroup=%1 _newAI = %2",_newGroup, _newAI];
};
_blck_AllMissionAI append _newAI;
};
};
case 2: {
//diag_log format["missionSpawner: Spawning Groups: _noAIGroups=2"]; // spawn groups on either side of the mission area
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionAI(47): Spawning Groups: _noAIGroups=2"]; // spawn groups on either side of the mission area
};
_groupLocations = [_coords,_noAIGroups,15,30] call blck_fnc_findPositionsAlongARadius;
{
private["_adjusttedGroupSize"];
@ -55,48 +74,99 @@
_adjusttedGroupSize = _unitsPerGroup;
};
_newGroup = [_x,_adjusttedGroupSize,_adjusttedGroupSize,_aiDifficultyLevel,_coords,1,12,_uniforms,_headGear] call blck_fnc_spawnGroup;
if (isNull _newGroup) exitWith {_abort = true;};
_newAI = units _newGroup;
_blck_AllMissionAI = _blck_AllMissionAI + _newAI;
//diag_log format["missionSpawner: Spawning 2 Groups: _newGroup=%1 _newAI = %2",_newGroup, _newAI];
if (isNull _newGroup) then
{
_abort = true;
}
else
{
_newAI = units _newGroup;
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionAI(61): case 2: _newGroup=%1",_newGroup];
};
_blck_AllMissionAI append _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"];
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionAI (68): Spawning Groups: _noAIGroups=3"];
};
_newGroup = [_coords,_unitsPerGroup + _ResidualUnits,_unitsPerGroup + _ResidualUnits,_aiDifficultyLevel,_coords,1,12,_uniforms,_headGear] call blck_fnc_spawnGroup;
if (isNull _newGroup) exitWith {_abort = true;};
if (isNull _newGroup) then
{
_abort = true;
}
else
{
_newAI = units _newGroup;
_blck_AllMissionAI = _blck_AllMissionAI + _newAI;
//diag_log format["missionSpawner: Spawning Groups: _noAIGroups=3 _newGroup=%1 _newAI = %2",_newGroup, _newAI];
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionAI (73): Case 3: _newGroup=%1",_newGroup];
};
_blck_AllMissionAI append _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 {_abort = true;};
_newAI = units _newGroup;
_blck_AllMissionAI = _blck_AllMissionAI + _newAI;
//diag_log format["missionSpawner: Spawning 2 Groups:_newGroup=%1 _newAI = %2",_newGroup, _newAI];
if (isNull _newGroup) then
{
_abort = true;
}
else
{
_newAI = units _newGroup;
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionAI(78): Case 3: line 81: _newGroup = %1",_newGroup];
};
_blck_AllMissionAI append _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"];
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionAI (88): case 4:"];
};
_newGroup = [_coords,_unitsPerGroup + _ResidualUnits,_unitsPerGroup + _ResidualUnits,_aiDifficultyLevel,_coords,1,12,_uniforms,_headGear] call blck_fnc_spawnGroup;
if (isNull _newGroup) exitWith {_abort = true};
if (isNull _newGroup) then
{
_abort = true;
};
_newAI = units _newGroup;
_blck_AllMissionAI = _blck_AllMissionAI + _newAI;
//diag_log format["missionSpawner: Spawning Groups: _noAIGroups=%3 _newGroup=%1 _newAI = %2",_newGroup, _newAI,_noAIGroups];
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionAI(92): Spawning Groups: _noAIGroups=1 _newGroup=%1 _newAI = %2",_newGroup, _newAI];
};
_blck_AllMissionAI append _newAI;
_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 {_abort = true;};
_newAI = units _newGroup;
_blck_AllMissionAI = _blck_AllMissionAI + _newAI;
//diag_log format["missionSpawner: Spawning %3 Groups: _newGroup=%1 _newAI = %2",_newGroup, _newAI,_noAIGroups];
if (isNull _newGroup) then
{
_abort = true;
}
else
{
_newAI = units _newGroup;
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionAI(99): _newGroup=%1",_newGroup];
};
_blck_AllMissionAI append _newAI;
};
}forEach _groupLocations;
};
};
private["_return"];
_return = [_blck_AllMissionAI,_abort]
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnMissionAI(133): _abort = %1 | _blck_AllMissionAI = %2",_abort,_blck_AllMissionAI];
};
private["_return"];
_return = [_blck_AllMissionAI,_abort];
_return

View File

@ -2,7 +2,7 @@
Spawn some crates using an array containing crate types and their offsets relative to a reference position and prevent their cleanup.
By Ghostrider-DBD-
Copyright 2016
Last updated 2-24-17
Last updated 3-20-17
--------------------------
License
@ -15,34 +15,27 @@
private ["_objs","_pos","_offset"];
params[ ["_coords", [0,0,0]], ["_crates",[]], ["_loadCrateTiming","atMissionSpawn"] ];
if ((count _coords) == 2) then // assume only X and Y offsets are provided
{
_coords pushback 0;; // calculate the world coordinates
};
_objs = [];
{
_x params["_crateType","_crateOffset","_lootArray","_lootCounts"];
//_offset = _x select 1; // offset relative to _coords at which to spawn the vehicle
if ((count _coords) == 3) then // assume that there is a Z offset provided
{
_pos = [(_coords select 0)+(_crateOffset select 0),(_coords select 1) + (_crateOffset select 1),(_coords select 2)+(_crateOffset select 2)]; // calculate the world coordinates
}
else
{
if ((count _coords) == 2) then // assume only X and Y offsets are provided
{
_pos = [(_coords select 0)+(_crateOffset select 0),(_coords select 1) + (_crateOffset select 1),0]; // calculate the world coordinates
};
};
//_pos = [(_coords select 0)+(_crateOffset select 0),(_coords select 1) + (_crateOffset select 1),(_coords select 2)+(_crateOffset select 2)]; // calculate the world coordinates
//diag_log format["_fnc_spawnMissionCrates: _crateType = %1 | _crateOffset = %2 | _lootArray = %3 | _lootCounts = %4",_crateType,_crateOffset,_lootArray,_lootCounts];
_pos = _coords vectorAdd _crateOffset;
_crate = [_pos,_crateType] call blck_fnc_spawnCrate;
_objs pushback _crate;
if (_loadCrateTiming isEqualTo "atMissionSpawn") then
{
diag_log format["_fnc_spawnMissionCrates::-> loading loot at mission spawn for crate %1",_x];
//diag_log format["_fnc_spawnMissionCrates::-> loading loot at mission spawn for crate %1",_x];
[_crate,_lootArray,_lootCounts] call blck_fnc_fillBoxes;
_crate setVariable["lootLoaded",true];
}
else
{
diag_log format["_fnc_spawnMissionCrates::-> not loading crate loot at this time for crate %1",_x];
//diag_log format["_fnc_spawnMissionCrates::-> not loading crate loot at this time for crate %1",_x];
};
}forEach _crates;

View File

@ -2,7 +2,7 @@
[_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles;
returns _vehs, an array of vehicles spawned.
by Ghostridere-DbD-
1/10/17
3/20/17
--------------------------
License
@ -13,14 +13,29 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_missionLootVehicles"];
params["_missionLootVehicles",["_loadCrateTiming","atMissionSpawn"]];
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;
_x params["_vehType","_vehOffset","_lootArray","_lootCounts"];
//diag_log format["spawnMissionCVehicles: _vehType = %1 | _vehOffset = %2 | _lootArray = %3 | _lootCounts = %4",_vehType,_vehOffset,_lootArray,_lootCounts];
_pos = _coords vectorAdd _vehOffset;
_veh = [_vehType, _pos] call blck_fnc_spawnVehicle;
[_veh] call blck_fnc_emptyObject;
_veh setVehicleLock "UNLOCKED";
{
_veh removeAllEventHandlers _x;
}forEach ["getin","getout"];
if (_loadCrateTiming isEqualTo "atMissionSpawn") then
{
//diag_log format["blck_fnc_spawnMissionLootVehicles::-> loading loot at mission spawn for veh %1",_x];
[_veh,_lootArray,_lootCounts] call blck_fnc_fillBoxes;
_veh setVariable["lootLoaded",true];
}
else
{
//diag_log format["blck_fnc_spawnMissionLootVehicles::-> not loading veh loot at this time for veh %1",_x];
};
_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

View File

@ -14,26 +14,55 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_uniforms","_headGear",["_missionType","unspecified"]];
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnMissionVehiclePatrols:: _coords = %1 | _noVehiclePatrols = %2 | _aiDifficultyLevel = %3 | _missionType = %4",_coords,_noVehiclePatrols,_aiDifficultyLevel,_missionType];
};
private["_vehGroup","_patrolVehicle","_vehiclePatrolSpawns","_missionAI","_missiongroups","_vehicles","_return","_vehiclePatrolSpawns","_randomVehicle","_return","_abort"];
_vehicles = [];
_missionAI = [];
_abort = false;
_vehiclePatrolSpawns= [_coords,_noVehiclePatrols,45,60] call blck_fnc_findPositionsAlongARadius;
_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;};
if (blck_debugLevel > 0) then {diag_log format["_fnc_spawnMissionVehiclePatrols:: -> _missionType = %3 _vehGroup = %1 and units _vehGroup = %2",_vehGroup, units _vehGroup,_missionType];};
if (typename (units _vehGroup) isEqualTo "ARRAY") then
private ["_spawnPos"];
_spawnPos = _x;
_vehGroup = [_spawnPos,3,3,_aiDifficultyLevel,_coords,1,2,_uniforms,_headGear] call blck_fnc_spawnGroup;
if (isNull _vehGroup) exitWith
{
_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];
_vehicles pushback _patrolVehicle;
_missionAI append units _vehGroup;
//diag_log format["_fnc_spawnMissionVehiclePatrols:: -- > _vehicles updated to %1",_vehicles];
_abort = true;
};
}forEach _vehiclePatrolSpawns;
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionVehiclePatrols (40):: -> _missionType = %3 _vehGroup = %1 and units _vehGroup = %2",_vehGroup, units _vehGroup,_missionType];
};
_randomVehicle = selectRandom blck_AIPatrolVehicles;
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionVehiclePatrols:: -> randomly selected vehicle = %1",_randomVehicle];
};
//params["_center","_pos",["_vehType","I_G_Offroad_01_armed_F"],["_minDis",30],["_maxDis",45],["_group",grpNull]];
_patrolVehicle = [_coords,_spawnPos,_randomVehicle,30,45,_vehGroup] call blck_fnc_spawnVehiclePatrol;
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionVehiclePatrols:: - > patrol vehicle spawned was %1",_patrolVehicle];
};
if !(isNull _patrolVehicle) then
{
_vehicles pushback _patrolVehicle;
_missionAI append (units _vehGroup);
};
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionVehiclePatrols:: -- > _vehicles updated to %1",_vehicles];
};
} forEach _vehiclePatrolSpawns;
blck_missionVehicles append _vehicles;
_return = [_vehicles,_missionAI,_abort];
_return = [_vehicles, _missionAI, _abort];
_return

View File

@ -0,0 +1,28 @@
/*
for DBD Clan
By Ghostrider-DBD-
Copyright 2016
Last modified 1/24/17
checks the status of each entry in
*/
if (blck_debugLevel > 1) then {diag_log format["_fnc_spawnPendingMissions:: blck_pendingMissions = %1", blck_pendingMissions];};
private["_coords","_missionName","_missionPath"];
{
if (blck_debugLevel > 2) then {diag_log format["_fnc_spawnPendingMissions:: -- >> _x = %1 and _x select 6 = %2",_x, _x select 6];};
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnPendingMissions:: -- >> blck_missionsRunning = %1 and blck_maxSpawnedMissions = %2 so _canSpawn = %3",blck_missionsRunning,blck_maxSpawnedMissions, (blck_maxSpawnedMissions - blck_missionsRunning)];};
if (_x select 6 > 0) then // The mission is not running, check the time left till it is spawned
{
if (diag_tickTime > (_x select 6) && (blck_missionsRunning < blck_maxSpawnedMissions)) then // time to spawn the mission
{
_coords = [] call blck_fnc_FindSafePosn;
_coords pushback 0;
_missionName = selectRandom (_x select 0);
_missionPath = _x select 1;
[_coords,_x] execVM format["\q\addons\custom_server\Missions\%1\%2.sqf",_missionPath,_missionName];
blck_missionsRunning = blck_missionsRunning + 1;
};
};
}forEach blck_pendingMissions;

View File

@ -2,23 +2,44 @@
for DBD Clan
By Ghostrider-DBD-
Copyright 2016
Last modified 1/24/17
Last modified 3/20/17
checks the status of each entry in
*/
if (blck_debugLevel > 1) then {diag_log format["_fnc_spawnPendingMissions:: blck_pendingMissions = %1", blck_pendingMissions];};
private["_coords","_missionName","_missionPath"];
{
if (blck_debugLevel > 2) then {diag_log format["_fnc_spawnPendingMissions:: -- >> _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
{
if (diag_tickTime > (_x select 6)) then // time to spawn the mission
{
_coords = [] call blck_fnc_FindSafePosn;
_coords pushback 0;
_missionName = selectRandom (_x select 0);
_missionPath = _x select 1;
[_coords,_x] execVM format["\q\addons\custom_server\Missions\%1\%2.sqf",_missionPath,_missionName];
};
diag_log format["_fnc_spawnPendingMissions: -- >> blck_missionsRunning = %1",blck_missionsRunning];
if (blck_missionsRunning >= blck_maxSpawnedMissions) exitWith {
if (blck_debugLevel > 1) then {
diag_log "_fnc_spawnPendingMissions:: --- >> Maximum number of missions is running; function exited without attempting to find a new mission to spawn";
};
}forEach blck_pendingMissions;
};
private["_coords","_missionName","_missionPath","_search","_readyToSpawnQue","_missionToSpawn","_allowReinforcements"];
_readyToSpawnQue = [];
{
if ( (diag_tickTime > (_x select 6)) && ((_x select 6) > 0) ) then
{
_readyToSpawnQue pushback _x;
};
} forEach blck_pendingMissions;
if (count _readyToSpawnQue < 1) exitWith {
if (blck_debugLevel > 1) then {
diag_log "_fnc_spawnPendingMissions:: --- >> There are no missions available to spawn at this time";
};
};
_missionToSpawn = selectRandom _readyToSpawnQue;
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnPendingMissions:: -- >> blck_missionsRunning = %1 and blck_maxSpawnedMissions = %2 so _canSpawn = %3",blck_missionsRunning,blck_maxSpawnedMissions, (blck_maxSpawnedMissions - blck_missionsRunning)];
};
_coords = [] call blck_fnc_FindSafePosn;
_coords pushback 0;
_missionName = selectRandom (_missionToSpawn select 0);
_missionPath = _missionToSpawn select 1;
_allowReinforcements = _missionToSpawn select 8;
[_coords,_missionToSpawn,_allowReinforcements] execVM format["\q\addons\custom_server\Missions\%1\%2.sqf",_missionPath,_missionName];
blck_missionsRunning = blck_missionsRunning + 1;
true

View File

@ -0,0 +1,47 @@
/*
for DBD Clan
By Ghostrider-DBD-
Copyright 2016
Last modified 3/19/17
checks the status of each entry in
*/
if (blck_debugLevel > 1) then {
diag_log format["_fnc_spawnPendingMissions:: blck_pendingMissions = %1", blck_pendingMissions];
diag_log format["_fnc_spawnPendingMissions: -- >> blck_missionsRunning = %1",blck_missionsRunning];
};
if (blck_missionsRunning > blck_maxSpawnedMissions) exitWith {
if (blck_debugLevel > 1) then {
diag_log "_fnc_spawnPendingMissions:: --- >> Maximum number of missions is running; function exited without attempting to find a new mission to spawn";
};
};
private["_coords","_missionName","_missionPath","_readyToSpawnQue","_missionToSpawn","_allowReinforcements","_selectNew","_tries"];
_selectNew = true;
_tries = 0;
while {_selectNew && (_tries < 20)} do
{
_missionToSpawn = selectRandom blck_pendingMissions;
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnPendingMissions: - > checking mission %1 for try %2", _missionToSpawn,_tries];
};
if (diag_tickTime > (_missionToSpawn select 6) && (_missionToSpawn select 6 > 0)) exitWith
{
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnPendingMissions: - > spawning mission %1", _missionToSpawn];
};
_coords = [] call blck_fnc_FindSafePosn;
_coords pushback 0;
_missionName = selectRandom (_missionToSpawn select 0);
_missionPath = _missionToSpawn select 1;
_allowReinforcements = _missionToSpawn select 8;
[_coords,_missionToSpawn,_allowReinforcements] execVM format["\q\addons\custom_server\Missions\%1\%2.sqf",_missionPath,_missionName];
blck_missionsRunning = blck_missionsRunning + 1;
};
_tries = _tries + 1;
};
true

View File

@ -18,22 +18,22 @@ _arr = date call BIS_fnc_sunriseSunsetTime;
_sunrise = _arr select 0;
_sunset = _arr select 1;
_time = dayTime;
//diag_log format["_fnc_Time:: -- > _sunrise = %1 | _sunset = %2 | _time = %3",_sunrise,_sunset,_time];
diag_log format["_fnc_Time:: -- > _sunrise = %1 | _sunset = %2 | _time = %3",_sunrise,_sunset,_time];
// Night
if (_time > (_sunset + 0.5) || _time < (_sunrise - 0.5)) exitWith {
setTimeMultiplier blck_timeAccelerationNight;
//diag_log format["NIGHT TIMGE ADJUSTMENT:: time accel updated to %1; time of day = %2",timeMultiplier,dayTime];
diag_log format["NIGHT TIMGE ADJUSTMENT:: time accel updated to %1; time of day = %2",timeMultiplier,dayTime];
};
// Day
if (_time > (_sunrise + 0.5) && _time < (_sunset - 0.5)) exitWith {
setTimeMultiplier blck_timeAccelerationDay;
//diag_log format["DAYTIME ADJUSTMENT:: time accel updated to %1; time of day = %2",timeMultiplier,dayTime];
diag_log format["DAYTIME ADJUSTMENT:: time accel updated to %1; time of day = %2",timeMultiplier,dayTime];
};
// default
setTimeMultiplier blck_timeAccelerationDusk;
//diag_log format["DUSK ADJUSTMENT:: time accel updated to %1; time of day = %2",timeMultiplier,dayTime];
diag_log format["DUSK ADJUSTMENT:: time accel updated to %1; time of day = %2",timeMultiplier,dayTime];

View File

@ -32,90 +32,133 @@ _helis = _this select 5;
4) configure waypointScript
5) return the _heli that was spawned.
*/
diag_log format["_fnc_spawnMissionHeli (35):: _helis = %1",_helis];
private["_grpPilot","_chopperType","_patrolHeli","_launcherType","_unitPilot","_unitCrew","_mags","_turret","_return"];
_grpPilot = createGroup blck_AI_Side;
if (isNull _grpPilot) exitWith {diag_log "BLCK_ERROR: _fnc_spawnMissionHeli::_->> NULL GROUP Returned";};
_grpParatroops = createGroup blck_AI_Side;
if (_grpParatroops isEqualTo grpNull) exitWith {deleteGroup _grpPilot; diag_log "BLCK_ERROR: _fnc_spawnMissionHeli::_->> NULL GROUP Returned";};
_grpPilot setBehaviour "CARELESS";
_grpPilot setCombatMode "RED";
_grpPilot setSpeedMode "FULL";
_grpPilot allowFleeing 0;
private["_supplyHeli"];
//create helicopter and spawn it
_chopperType = selectRandom _helis;
diag_log format["_fnc_spawnMissionHeli (49):: _chopperType seleted = %1",_chopperType];
_patrolHeli = createVehicle [_chopperType, _coords, [], 90, "FLY"];
[_patrolHeli] call blck_fnc_protectVehicle;
_patrolHeli setFuel 1;
_patrolHeli engineOn true;
_patrolHeli flyInHeight 100;
_patrolHeli setVehicleLock "LOCKED";
_patrolHeli addEventHandler ["GetOut",{(_this select 0) setFuel 0;(_this select 0) setDamage 1;}];
diag_log format["_fnc_spawnMissionHeli (58):: heli %1 spawned",_patrolHeli];
clearWeaponCargoGlobal _patrolHeli;
clearMagazineCargoGlobal _patrolHeli;
clearItemCargoGlobal _patrolHeli;
clearBackpackCargoGlobal _patrolHeli;
_launcherType = "none";
_unitPilot = _grpPilot createUnit ["I_helipilot_F", getPos _patrolHeli, [], 0, "FORM"];
_unitPilot = [[100,100,100],_weapons,_grpPilot,_skillAI,_launcherType,_uniforms,_headGear] call blck_fnc_spawnAI;
_unitPilot setSkill 1;
_unitPilot assignAsDriver _patrolHeli;
_unitPilot moveInDriver _patrolHeli;
_grpPilot selectLeader _unitPilot;
diag_log format["_fnc_spawnMissionHeli (72):: heli spawned pilot added"];
diag_log format["_fnc_spawnMissionHeli (74):: pilot %1 spawned",_unitPilot];
_turrets = allTurrets [_patrolHeli,false];
diag_log "_fnc_spawnMissionHeli (78): preparing to clear out blacklisted turrets";
if (blck_debugLevel > 1) then
{
if ( (_patrolHeli weaponsTurret _x) in blck_blacklisted_heli_weapons) then
diag_log format["_fnc_spawnMissionHeli (75):: _helis = %1",_helis];
};
private["_grpPilot","_chopperType","_patrolHeli","_launcherType","_unitPilot","_unitCrew","_mags","_turret","_return","_abort"];
_abort = false;
_grpPilot = createGroup blck_AI_Side;
if (isNull _grpPilot) then
{
diag_log "BLCK_ERROR: _fnc_spawnMissionHeli::_->> NULL GROUP Returned for _grpPilot";
_abort = true;
};
_grpParatroops = createGroup blck_AI_Side;
if (isNull _grpParatroops) then
{
diag_log "BLCK_ERROR: _fnc_spawnMissionHeli::_->> NULL GROUP Returned for _grpParatroops";
_abort = true;
};
if !(isNull _grpPilot) then
{
_grpPilot setBehaviour "CARELESS";
_grpPilot setCombatMode "RED";
_grpPilot setSpeedMode "FULL";
_grpPilot allowFleeing 0;
private["_supplyHeli"];
//create helicopter and spawn it
_chopperType = selectRandom _helis;
if (blck_debugLevel > 2) then
{
private["_mags","_turret"];
_mags = _patrolHeli magazinesTurret _x;
_turret = _x;
{
_patrolHeli removeMagazines [_x,_turret];
} forEach _mags;
_patrolHeli removeWeaponTurret _turret;
diag_log format["_fnc_spawnMissionHeli (90)::-->> weapon %1 and its ammo removed from heli %2 for turret %3",_patrolHeli weaponsTurret _x,_patrolHeli, _x];
}
else
{
// B_helicrew_F
_unitCrew = [[100,100,100],_weapons,_grpPilot,_skillAI,_launcherType,_uniforms,_headGear] call blck_fnc_spawnAI;
_unitCrew assignAsTurret [_patrolHeli, _x];
_unitCrew moveInTurret [_patrolHeli, _x];
diag_log format["_fnc_spawnMissionHeli (98)::-- >> unit %1 moved into turret %2 of vehicle %3",_unitCrew,_x,_patrolHeli];
diag_log format["_fnc_spawnMissionHeli (66):: _chopperType seleted = %1",_chopperType];
};
}forEach _turrets;
_patrolHeli = createVehicle [_chopperType, _coords, [], 90, "FLY"];
[_patrolHeli] call blck_fnc_protectVehicle;
_patrolHeli setFuel 1;
_patrolHeli engineOn true;
_patrolHeli flyInHeight 100;
_patrolHeli setVehicleLock "LOCKED";
_patrolHeli addEventHandler ["GetOut",{(_this select 0) setFuel 0;(_this select 0) setDamage 1;}];
diag_log format["_fnc_spawnMissionHeli (102)::-->> Heli %1 outfited with a crew numbering %2",_patrolHeli, crew _patrolHeli];
// params["_missionPos","_paraGroup",["_numAI",3],"_skillAI","_weapons","_uniforms","_headGear",["_heli",objNull],_grpParatroops];
//params["_coords","_skillAI","_weapons","_uniforms","_headGear",["_grpParatroops",grpNull],["_heli",objNull]];
[_coords,_skillAI,_weapons,_uniforms,_headGear,_grpParatroops,_patrolHeli] call blck_fnc_spawnMissionParatroops;
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionHeli (76):: heli %1 spawned",_patrolHeli];
};
//set waypoint for helicopter
private["_wpDestination"];
[_grpPilot, 0] setWPPos _coords;
[_grpPilot, 0] setWaypointType "SAD";
[_grpPilot, 0] setWaypointSpeed "NORMAL";
[_grpPilot, 0] setWaypointBehaviour "CARELESS";
[_grpPilot, 0] setWaypointStatements ["true","[group this, 0] setCurrentWaypoint [group this,0];"];
[_grpPilot,0] setWaypointTimeout [100,150,200];
_grpPilot setCurrentWaypoint [_grpPilot,0];
clearWeaponCargoGlobal _patrolHeli;
clearMagazineCargoGlobal _patrolHeli;
clearItemCargoGlobal _patrolHeli;
clearBackpackCargoGlobal _patrolHeli;
diag_log format["_fnc_spawnMissionHeli (116):: initial pilot waypoints set"];
_launcherType = "none";
_unitPilot = _grpPilot createUnit ["I_helipilot_F", getPos _patrolHeli, [], 0, "FORM"];
_unitPilot = [[100,100,100],_weapons,_grpPilot,_skillAI,_launcherType,_uniforms,_headGear] call blck_fnc_spawnAI;
_unitPilot setSkill 1;
_unitPilot assignAsDriver _patrolHeli;
_unitPilot moveInDriver _patrolHeli;
_grpPilot selectLeader _unitPilot;
_return = [_patrolHeli,_grpPilot,_grpParatroops];
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionHeli (90):: pilot %1 spawned",_unitPilot];
};
_turrets = allTurrets [_patrolHeli,false];
if (blck_debugLevel > 2) then
{
diag_log "_fnc_spawnMissionHeli (103): preparing to clear out blacklisted turrets";
};
{
if ( (_patrolHeli weaponsTurret _x) in blck_blacklisted_heli_weapons) then
{
private["_mags","_turret"];
_mags = _patrolHeli magazinesTurret _x;
_turret = _x;
{
_patrolHeli removeMagazines [_x,_turret];
} forEach _mags;
_patrolHeli removeWeaponTurret _turret;
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionHeli (118)::-->> weapon %1 and its ammo removed from heli %2 for turret %3",_patrolHeli weaponsTurret _x,_patrolHeli, _x];
};
}
else
{
// B_helicrew_F
_unitCrew = [[100,100,100],_weapons,_grpPilot,_skillAI,_launcherType,_uniforms,_headGear] call blck_fnc_spawnAI;
_unitCrew assignAsTurret [_patrolHeli, _x];
_unitCrew moveInTurret [_patrolHeli, _x];
diag_log format["_fnc_spawnMissionHeli (12798)::-- >> unit %1 moved into turret %2 of vehicle %3",_unitCrew,_x,_patrolHeli];
};
}forEach _turrets;
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionHeli (133)::-->> Heli %1 outfited with a crew numbering %2",_patrolHeli, crew _patrolHeli];
};
// params["_missionPos","_paraGroup",["_numAI",3],"_skillAI","_weapons","_uniforms","_headGear",["_heli",objNull],_grpParatroops];
//params["_coords","_skillAI","_weapons","_uniforms","_headGear",["_grpParatroops",grpNull],["_heli",objNull]];
if !(isNull _grpParatroops) then
{
[_coords,_skillAI,_weapons,_uniforms,_headGear,_grpParatroops,_patrolHeli] call blck_fnc_spawnMissionParatroops;
};
//set waypoint for helicopter
private["_wpDestination"];
[_grpPilot, 0] setWPPos _coords;
[_grpPilot, 0] setWaypointType "SAD";
[_grpPilot, 0] setWaypointSpeed "NORMAL";
[_grpPilot, 0] setWaypointBehaviour "CARELESS";
[_grpPilot, 0] setWaypointStatements ["true","[group this, 0] setCurrentWaypoint [group this,0];"];
[_grpPilot,0] setWaypointTimeout [100,150,200];
_grpPilot setCurrentWaypoint [_grpPilot,0];
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionHeli (153):: initial pilot waypoints set"];
};
};
private["_ai"];
_ai = (units _grpParatroops) + (units _grpPilot);
_return = [_patrolHeli,_ai,_abort];
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnMissionHeli:: function returning value for _return of %1",_return];
};
_return;

View File

@ -17,11 +17,12 @@
params["_coords","_skillAI","_weapons","_uniforms","_headGear",["_grpParatroops",grpNull],["_heli",objNull]];
private["_grpParatroops","_chanceParatroops"];
private["_grpParatroops","_chanceParatroops","_aborted","_return"];
_aiSkillsLevel = toLower _aiSkillsLevel;
_chanceParatroops = 0;
_noPara = 0;
_aborted = false;
if (_aiSkillsLevel isEqualTo "blue") then {
if (blck_debugON) then {diag_log "_fnc_spawnMissionParatroops: BLUE difficulty settings applied";};
@ -38,27 +39,43 @@ if (_aiSkillsLevel isEqualTo "orange") then {
_chanceParatroops = blck_chanceParaOrange;
_noPara = blck_noParaOrange;
};
if (_aiSkillsLevel isEqualTo "red") then
{
if (_aiSkillsLevel isEqualTo "red") then {
if (blck_debugON) then {diag_log "_fnc_spawnMissionParatroops: RED difficulty settings applied";};
_chanceParatroops = blck_chanceParaRed;
_noPara = blck_noParaRed;
};
if (blck_debugON) then {diag_log format["_fnc_spawnMissionParatroops (47): _numAI %1 |_chanceParatroops %2",_noPara,_chanceParatroops];};
if (blck_debugON) then {diag_log format["_fnc_spawnMissionParatroops (48): _coords %1 | _numAI %2 | _skillAI %3 | _grpParatroops %4 | _heli",_coords,_skillAI,_grpParatroops,_heli];};
if (isNull _grpParatroops) then
{
_grpParatroops = createGroup blck_AI_Side;
if (blck_debugON) then {diag_log format["_fnc_spawnMissionParatroops (53):No group passed as a parameter, _grpParatroops %4 created",_grpParatroops];};
};
if (blck_debugLevel > 2) then {diag_log format["_fnc_spawnMissionParatroops (47): _chanceParatroops %1",_chanceParatroops];};
if (blck_debugLevel > 2) then {diag_log format["_fnc_spawnMissionParatroops (48): _coords %1 | _numAI %2 | _skillAI %3 | _grpParatroops %4 | _heli %5",_coords,_noPara,_skillAI,_grpParatroops,_heli];};
if (isNull _grpParatroops) exitWith {diag_log "BLCK_ERROR: _fnc_spawnMissionParatroops (56)::_->> NULL GROUP Returned";};
if (random(1) < _chanceParatroops) then
if ( (random(1) < _chanceParatroops)) then
{
if (blck_debugON) then {diag_log format["_fnc_spawnMissionParatroops (58): function running and group %1 successfully created; now calling blck_fnc_spawnParaUnits",_grpParatroops];};
if (isNull _grpParatroops) then
{
_grpParatroops = createGroup blck_AI_Side;
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionParatroops (53):No group passed as a parameter, _grpParatroops %4 created",_grpParatroops];
};
};
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionParatroops (58): function running and group %1 successfully created; now calling blck_fnc_spawnParaUnits",_grpParatroops];
};
//params["_missionPos","_paraGroup",["_numAI",3],"_skillAI","_weapons","_uniforms","_headGear",["_heli",objNull]];
[_coords,_grpParatroops,_noPara,_skillAI,_weapons,_uniforms,_headGear,_heli] spawn blck_fnc_spawnParaUnits;
_aborted = [_coords,_grpParatroops,_noPara,_skillAI,_weapons,_uniforms,_headGear,_heli] call blck_fnc_spawnParaUnits;
//diag_log format["_fnc_spawnMissionParatroops: blck_fnc_spawnParaUnits returned a value of %1",_aborted];
};
_grpParatroops;
diag_log format["_fnc_spawnMissionParatroops: _aborted = %1",_aborted];
if (_aborted) then
{
_return = [[],true];
} else {
_return = [(units _grpParatroops),false];
};
diag_log format["_fnc_spawnMissionParatroops:-> _return = %1 | _abort = %2",_return,_aborted];
_return

View File

@ -12,60 +12,41 @@
*/
params["_missionPos","_paraGroup","_numAI","_skillAI","_weapons","_uniforms","_headGear",["_heli",objNull]];
private["_arc","_dir","_spawnPos","_chute","_unit","_launcherType"];
private["_arc","_dir","_spawnPos","_chute","_unit","_launcherType","_aborted"];
_aborted = false;
diag_log format["_fnc_spawnParaUnits (17)::_missionPos %1 | _paraGroup %2 | _numAI %3 | _skillAI %4 | _heli = %5",_missionPos,_paraGroup,_numAI,_skillAI,_heli];
_launcherType = "none";
private ["_arc","_spawnPos"];
_arc = 45;
_dir = 0;
_pos = _missionPos;
for "_i" from 1 to _numAI do
if (isNull _paraGroup) then
{
if (_heli isKindOf "Air") then {_pos = getPos _heli};
_spawnPos = _pos getPos[1.5,_dir];
_chute = createVehicle ["Steerable_Parachute_F", [100, 100, 200], [], 0, "FLY"];
[_chute] call blck_fnc_protectVehicle;
_unit = [[_spawnPos select 0, _spawnPos select 1, 100],_weapons,_paraGroup,_skillAI,_launcherType,_uniforms,_headGear] call blck_fnc_spawnAI;
_chute setPos [_spawnPos select 0, _spawnPos select 1, 125]; //(_offset select 2) - 10];
_unit assignAsDriver _chute;
_unit moveInDriver _chute;
_unit allowDamage true;
_dir = _dir + _arc;
diag_log format["_fnc_spawnParaUnits:: spawned unit %1, at location %2 and vehicle _unit %1",_unit,getPos _unit, vehicle _unit];
uiSleep 2;
};
_paraGroup selectLeader ((units _paraGroup) select 0);
//params["_pos","_minDis","_maxDis","_group"];
[_missionPos,10,20,_paraGroup] call blck_fnc_setupWaypoints;
diag_log "_fnc_spawnParaUnits (44): All Units spawned";
/*
diag_log "_fnc_spawnParaUnits:: waiting for paratroops to land";
private["_troopsOnGround"];
params["_group"];
_troopsOnGround = false;
while {!_troopsOnGround} do
{
_troopsOnGround = true;
_aborted = true;
} else {
_launcherType = "none";
private ["_arc","_spawnPos"];
_arc = 45;
_dir = 0;
_pos = _missionPos;
for "_i" from 1 to _numAI do
{
diag_log format["reinforments:: Tracking Paratroops unit %1 position %4 altitue %2 velocity %3 attachedTo %4",_x, (getPos _x select 2), (velocity _x select 2), getPosATL _x, attachedTo _x];
if ( (getPosATL _x select 2) < 0.1) then {
if (surfaceIsWater (position _x)) then {
diag_log format["_fnc_spawnParaUnits:: unit %1 at %2 deleted",_x, getPos _x];
[_x] call blck_fnc_deleteAI;
};
}
else
{_troopsOnGround = false;};
}forEach units _paraGroup;
uiSleep 5;
};
if (_heli isKindOf "Air") then {_pos = getPos _heli};
_spawnPos = _pos getPos[1.5,_dir];
_chute = createVehicle ["Steerable_Parachute_F", [100, 100, 200], [], 0, "FLY"];
[_chute] call blck_fnc_protectVehicle;
_unit = [[_spawnPos select 0, _spawnPos select 1, 100],_weapons,_paraGroup,_skillAI,_launcherType,_uniforms,_headGear] call blck_fnc_spawnAI;
_chute setPos [_spawnPos select 0, _spawnPos select 1, 125]; //(_offset select 2) - 10];
_unit assignAsDriver _chute;
_unit moveInDriver _chute;
_unit allowDamage true;
_dir = _dir + _arc;
diag_log format["_fnc_spawnParaUnits:: spawned unit %1, at location %2 and vehicle _unit %1",_unit,getPos _unit, vehicle _unit];
uiSleep 2;
};
_paraGroup selectLeader ((units _paraGroup) select 0);
//params["_pos","_minDis","_maxDis","_group"];
[_missionPos,10,20,_paraGroup] call blck_fnc_setupWaypoints;
diag_log "_fnc_spawnParaUnits (44): All Units spawned";
};
diag_log format["_fnc_spawnParaUnits: _aborted = %1",_aborted];
_aborted;
diag_log "spawnParatroops:: All Units on the Ground";
*/

View File

@ -20,47 +20,69 @@ _weapons = _this select 2;
_uniforms = _this select 3;
_headgear = _this select 4;
private["_chanceHeliPatrol","_return","_paratroops","_missionHelis"];
private["_chanceHeliPatrol","_return","_temp","_missionHelis"];
if (blck_debugON) then {diag_log format["_fnc_spawnMissionReinforcements (34): Script Starting with _aiSkillsLevel = %1",_aiSkillsLevel]}
if (blck_debugON) then {diag_log format["_fnc_spawnMissionReinforcements (25): Script Starting with _aiSkillsLevel = %1",_aiSkillsLevel]};
_aiSkillsLevel = toLower _aiSkillsLevel;
if (_aiSkillsLevel isEqualTo "blue") then {
if (blck_debugON) then {diag_log "_fnc_spawnMissionReinforcements (38): BLUE difficulty settings applied";};
if (blck_debugON) then {diag_log "_fnc_spawnMissionReinforcements (29): BLUE difficulty settings applied";};
_chanceHeliPatrol = blck_chanceHeliPatrolBlue;
_missionHelis = blck_patrolHelisBlue;
};
if (_aiSkillsLevel isEqualTo "green") then {
if (blck_debugON) then {diag_log "_fnc_spawnMissionReinforcements (43): GREEN difficulty settings applied";};
if (blck_debugON) then {diag_log "_fnc_spawnMissionReinforcements (34): GREEN difficulty settings applied";};
_chanceHeliPatrol = blck_chanceHeliPatrolGreen;
_missionHelis = blck_patrolHelisGreen;
};
if (_aiSkillsLevel isEqualTo "orange") then {
if (blck_debugON) then {diag_log "_fnc_spawnMissionReinforcements (48): ORANGE difficulty settings applied";};
if (blck_debugON) then {diag_log "_fnc_spawnMissionReinforcements (39): ORANGE difficulty settings applied";};
_chanceHeliPatrol = blck_chanceHeliPatrolOrange;
_missionHelis = blck_patrolHelisOrange;
};
if (_aiSkillsLevel isEqualTo "red") then
{
if (blck_debugON) then {diag_log "_fnc_spawnMissionReinforcements (54): RED difficulty settings applied";};
if (blck_debugON) then {diag_log "_fnc_spawnMissionReinforcements (46): RED difficulty settings applied";};
_chanceHeliPatrol = blck_chanceHeliPatrolRed;
_missionHelis = blck_patrolHelisRed;
};
if (blck_debugON) then {diag_log format["_fnc_spawnMissionReinforcements (59): Variables defined: _chanceHeliPatrol %1 | _missionHelis %2",_chanceHeliPatrol,_missionHelis];};
if (blck_debugLevel > 1) then {diag_log format["_fnc_spawnMissionReinforcements (50): Variables defined: _chanceHeliPatrol %1 | _missionHelis %2",_chanceHeliPatrol,_missionHelis];};
if (random (1) < _chanceHeliPatrol) then
if ( (_chanceHeliPatrol > 0) && (random (1) < _chanceHeliPatrol) ) then // if helipatrols are 'enabled' then paratroops will only drop if a heli spawns.
// The chance that they drop is linked to the value for them for that difficulty _aiSkillsLevel
//see _fnc_spannMissionParatroops for how this is handled.
{
_temp = [objNull,[],false];
//params["_coords","_aiSkillsLevel",,"_weapons","_uniforms","_headgear""_helis"];
if (blck_debugON) then {diag_log "_fnc_spawnMissionReinforcements (64): calling _fnc_spawnMissionHeli to spawn heli and paratroops";};
_return = [_coords,_aiSkillsLevel,_weapons,_uniforms,_headgear,_missionHelis] call blck_fnc_spawnMissionHeli;
if (blck_debugON) then {diag_log format["_fnc_spawnMissionReinforcements (66): blck_fnc_spawnMissionHeli returned value of %1 for _return",_return];};
if (blck_debugLevel > 2) then
{
diag_log "_fnc_spawnMissionReinforcements (64): calling _fnc_spawnMissionHeli to spawn heli and paratroops";
};
_temp = [_coords,_aiSkillsLevel,_weapons,_uniforms,_headgear,_missionHelis] call blck_fnc_spawnMissionHeli;
if (typeName _temp isEqualTo "ARRAY") then
{
_return = [_temp select 0, _temp select 1, _temp select 2];
}
else
{
_return = [objNull, [], true];
};
if (blck_debugLevel > 2) then {diag_log format["_fnc_spawnMissionReinforcements (66): blck_fnc_spawnMissionHeli returned value of %1 for _return",_return];};
} else {
if (blck_debugON) then {diag_log "_fnc_spawnMissionReinforcements (68): calling _fnc_spawnMissionParatroops to spawn para reinforcements";};
if (blck_debugLevel > 2) then {diag_log "_fnc_spawnMissionReinforcements (68): calling _fnc_spawnMissionParatroops to spawn para reinforcements";};
_temp = [objNull,[],false];
// params["_coords","_skillAI","_weapons","_uniforms","_headgear"];
_paratroops = [_coords,_aiSkillsLevel,_weapons,_uniforms,_headgear] call blck_fnc_spawnMissionParatroops;
if (blck_debugON) then {diag_log format["_fnc_spawnMissionReinforcements (71):: blck_fnc_spawnMissionParatroops returned value for _paratroops of %1",_paratroops];};
_return = [objNull, _paratroops];
_temp = [_coords,_aiSkillsLevel,_weapons,_uniforms,_headgear] call blck_fnc_spawnMissionParatroops;
if (blck_debugLevel > 2) then {
diag_log format["_fnc_spawnMissionReinforcements (71):: blck_fnc_spawnMissionParatroops returned value for _paratroops of %1",_temp];
};
if (typeName _temp isEqualTo "ARRAY") then
{
_return = [objNull, _temp select 0 /*units*/, _temp select 1 /*true/false*/];
} else {
_return = [objNull, [],true];
};
};
if (blck_debugLevel > 0) then {diag_log format["_fnc_spawnMissionReinforcements (74):: _return = %1",_return];};
if (blck_debugLevel > 1) then {diag_log format["_fnc_spawnMissionReinforcements (74):: _return = %1",_return];};
_return

View File

@ -14,12 +14,12 @@
private["_veh","_modType"];
params["_vehType","_pos",["_clearInventory",true]];
//if (blck_debugLevel > 2) then {diag_log format["spawnVehicle.sqf: _this = %1",_this];};
if (blck_debugLevel > 2) then {diag_log format["spawnVehicle.sqf: _vehType = %1 | _pos = %2",_vehType,_pos];};
_veh = createVehicle[_vehType, _pos, [], 0, "NONE"];
[_veh] call blck_fnc_protectVehicle;
if (blck_debugLevel > 2) then {diag_log format["spawnVehicle.sqf:: vehicle spawned is %1",_veh];};
// params["_veh",["_clearInventory",true]];
[_veh,_clearInventory] call blck_fnc_configureMissionVehicle;
//diag_log format["spawnVehicle:: returning parameter _veh = %1",_veh];
diag_log format["spawnVehicle:: returning parameter _veh = %1",_veh];
_veh

View File

@ -15,60 +15,82 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_vehType","_safepos","_veh"];
params["_center","_pos",["_vehType","I_G_Offroad_01_armed_F"],["_minDis",30],["_maxDis",45],["_group",grpNull] ];
//_pos Center of the mission area
params["_center","_pos",["_vehType","I_G_Offroad_01_armed_F"],["_minDis",30],["_maxDis",45],["_group",grpNull]];
//_center Center of the mission area - this is usuall the position treated as the center by the mission spawner. Vehicles will patrol the perimeter of the mission area.
// _pos the approximate spawn point for the vehicle
//_vehType = [_this,1,"I_G_Offroad_01_armed_F"] call BIS_fnc_param;
//_minDis = minimum distance from the center of the mission for vehicle waypoints
//_maxDis = maximum distance from the center of the mission for vehicle waypoints
//_groupForVehiclePatrol = The group with which to man the vehicle
if (isNull _group) exitWith {diag_log "[blckeagls] ERROR CONDITION:-->> NULL-GROUP Provided to _fnc_spawnVehiclePatrol"; objNull;};
//diag_log format["_fnc_spawnVehiclePatrol::->> _group = %1",_group];
_safepos = [_pos,0,25,0,0,20,0] call BIS_fnc_findSafePos;
_veh = [_vehType,_safepos] call blck_fnc_spawnVehicle;
//diag_log format["spawnVehiclePatrol:: vehicle spawned is %1 of typeof %2",_veh, typeOf _veh];
private["_unitNumber"];
_unitNumber = 0;
if (blck_debugLevel > 2) then
{
switch (_unitNumber) do
diag_log format["_fnc_spawnVehiclePatrol:: _center = %1 | _pos = %2 | _vehType = %3 | _group = %4",_center,_pos,_vehType,_group];
};
if !(isNull _group) then
{ // exitWith {diag_log "[blckeagls] ERROR CONDITION:-->> NULL-GROUP Provided to _fnc_spawnVehiclePatrol"; objNull;};
_veh = [_vehType,_pos] call blck_fnc_spawnVehicle;
if (blck_debugLevel > 2) then
{
diag_log format["spawnVehiclePatrol:: vehicle spawned is %1 of typeof %2",_veh, typeOf _veh];
};
private["_unitNumber"];
_unitNumber = 0;
{
switch (_unitNumber) do
{
case 0: {_x moveingunner _veh;};
case 1: {_x moveindriver _veh;};
default {_x moveInCargo _veh;};
};
_unitNumber = _unitNumber + 1;
}forEach (units _group);
while {(count (waypoints _group)) > 0} do
{
deleteWaypoint ((waypoints _group) select 0);
};
_count = 5;
_start = _center getDir _pos;
_angle = _start;
_sign = selectRandom [1, -1];
_arc = _sign * 360/_count;
for "_i" from 1 to _count do
{
_angle = _angle + _arc;
_p2 = _center getPos [(_minDis + random(_maxDis - _minDis)),_angle];
if (_i isEqualTo 1) then
{
case 0: {_x moveingunner _veh;};
case 1: {_x moveindriver _veh;};
default {_x moveInCargo _veh;};
_wp = [_group, 0];
_wp setWaypointPosition [_p2, 25];
} else {
_wp = _group addWaypoint [_p2, 25];
};
_unitNumber = _unitNumber + 1;
}forEach (units _group);
while {(count (waypoints _group)) > 0} do
{
deleteWaypoint ((waypoints _group) select 0);
_wp setWaypointType "MOVE";
_wp setWaypointName "move";
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "RED";
_wp setWaypointTimeout [1,1.1,1.2];
_wp = _group addWaypoint [_p2, 25];
_wp setWaypointType "SENTRY";
_wp setWaypointName "sentry";
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "RED";
_wp setWaypointTimeout [10,17.5,25];
_wp
};
_wp = _group addWaypoint [_pos, 25];
_wp setWaypointType "CYCLE";
_group setVariable["wpIndex",0];
};
_count = 5;
_start = _center getDir _pos;
_angle = _start;
_sign = selectRandom [1, -1];
_arc = _sign * 360/_count;
for "_i" from 1 to _count do
if (blck_debugLevel > 1) then
{
_angle = _angle + _arc;
_p2 = _center getPos [(_minDis + random(_maxDis - _minDis)),_angle];
_wp = _group addWaypoint [_p2, 25];
_wp setWaypointType "MOVE";
_wp setWaypointName "move";
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "RED";
_wp = _group addWaypoint [_p2, 25];
_wp setWaypointType "SENTRY";
_wp setWaypointName "sentry";
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "RED";
_wp setWaypointTimeout [10,17.5,25];
diag_log format["_fnc_spawnVehiclePatrol::->> _veh = %1",_veh];
};
_wp = _group addWaypoint [_pos, 25];
_wp setWaypointType "CYCLE";
_veh

View File

@ -1,17 +0,0 @@
/*
for DBD Clan
By Ghostrider-DBD-
Copyright 2016
Last Modified 3-14-17
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#define modUsed true
//#define DBDserver 1
#define wpModeMove

View File

@ -2,7 +2,7 @@
AI Mission for Epoch Mod for Arma 3
By Ghostrider
Functions and global variables used by the mission system.
Last modified 3/14/17
Last modified 3/20/17
--------------------------
License
@ -14,7 +14,6 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
//blck_functionsCompiled = false;
//#define DBDserver 1
// 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";
@ -28,12 +27,15 @@ blck_fnc_getModType = compileFinal preprocessFileLineNumbers "\q\addons\custom_
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";
blck_fnc_playerInRangeArray = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_playerInRangeArray.sqf"; // GMS_fnc_playerInRangeArray
blck_fnc_mainThread = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_mainThread.sqf";
blck_fnc_allPlayers = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_allPlayers.sqf";
#ifdef DBDserver
blck_fnc_broadcastServerFPS = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_broadcastServerFPS.sqf";
diag_log "blck_functions loaded using DBDServer settings ---- >>>> ";
#endif
// 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
@ -45,7 +47,7 @@ blck_fnc_updateMissionQue = compileFinal preprocessFileLineNumbers "\q\addons\
blck_fnc_spawnPendingMissions = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnPendingMissions.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_missionTimer = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionTimer.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";
blck_fnc_cleanupObjects = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_cleanUpObjects.sqf";

View File

@ -12,8 +12,8 @@
*/
#include"\q\addons\custom_server\Configs\blck_defines.hpp";
blck_debugON = true;
blck_debugLevel = 3; // Sets level of detail for debugging info - WIP.
blck_debugON = false;
blck_debugLevel = 0; // Sets level of detail for debugging info - WIP.
blck_minFPS = 10;
////////////////////////////////////////////////
@ -29,6 +29,7 @@ blck_monitoredMissionAIGroups = []; // Used to track groups in active missions
blck_liveMissionAIGroups = []; // Used to track groups assigned to completed missions for eventual cleanup.
blck_oldMissionObjects = [];
blck_pendingMissions = [];
blck_missionsRunning = 0;
blck_activeMissions = [];
blck_deadAI = [];
blck_missionVehicles = [];

View File

@ -121,6 +121,9 @@
///////////////////////////////
// Paratroop Settings
// AI paratrooper reinforcement paramters
// The behavior of these can be linked to some degree to the spawning of patrolling helis.
// For example, if you always want a helicopter to spawn paratroops set the value 1.
// If you never want helicopters to spawn them set the value to 0.
blck_chanceParaBlue = 0.2; // [0 - 1] set to 0 to deactivate and 1 to always have paratroops spawn over the center of the mission.
blck_noParaBlue = 3; // [1-N]
@ -131,7 +134,7 @@
blck_noParaGreen = 4;
blck_chanceParaOrange = 0.5;
blck_chanceParaOrange = 4;
blck_noParaOrange = 4;
// Supplemental Loot Parameters.
@ -171,6 +174,13 @@
// Enable / Disable Missions
////////////////////
// Maximum number of missions shown on the map at any one time.
#ifdef DBDserver
blck_maxSpawnedMissions = 6;
#else
blck_maxSpawnedMissions = 4;
#endif
//Set to -1 to disable. Values of 2 or more force the mission spawner to spawn copies of that mission - this feature is not recommended because you may run out of available groups.
blck_enableOrangeMissions = 1;
blck_enableGreenMissions = 1;

View File

@ -94,12 +94,12 @@ if (blck_debugON || (blck_debugLevel isEqualTo 3)) then
blck_timeAccelerationDusk = 6; // Dawn/dusk time accelearation
blck_mainThreadUpdateInterval = 10;
blck_enableOrangeMissions = 0;
blck_enableGreenMissions = 0;
blck_enableOrangeMissions = 1;
blck_enableGreenMissions = 1;
blck_enableRedMissions = 1;
blck_enableBlueMissions = 1;
blck_enableHunterMissions = 0;
blck_enableScoutsMissions = 0;
blck_enableHunterMissions = 1;
blck_enableScoutsMissions = 1;
blck_maxCrashSites = 0;
blck_enabeUnderwaterMissions = -1;
@ -119,23 +119,28 @@ if (blck_debugON || (blck_debugLevel isEqualTo 3)) then
blck_SpawnVeh_Red = 2;
blck_TMin_Blue = 7;
blck_TMin_Red = 30;
blck_TMin_Green = 23;
blck_TMin_Orange = 20;
blck_TMin_Hunter = 15;
blck_TMin_Red = 10;
blck_TMin_Green = 13;
blck_TMin_Orange = 16;
blck_TMin_Hunter = 20;
blck_TMin_Scouts = 20;
blck_TMin_Crashes = 5;
//Maximum Spawn time between missions in seconds
blck_TMax_Blue = 12;
blck_TMax_Red = 40;
blck_TMax_Green = 38;
blck_TMax_Orange = 31;
blck_TMax_Hunter = 40;
blck_TMax_Scouts = 45;
blck_TMax_Red = 15;
blck_TMax_Green = 17;
blck_TMax_Orange = 21;
blck_TMax_Hunter = 22;
blck_TMax_Scouts = 22;
blck_TMax_Crashes = 15;
//blck_MissionTimout = 120; // 40 min
//blck_MinAI_Blue = 2;
//blck_MaxAI_Blue = 4;
//blck_AIGrps_Blue = 4;
/*
blck_SkillsBlue = [
["aimingAccuracy",0.01],
["aimingShake",0.01],
@ -148,7 +153,7 @@ if (blck_debugON || (blck_debugLevel isEqualTo 3)) then
["commanding",0.8],
["general",1.00]
];
*/
};

View File

@ -17,13 +17,37 @@ _markerType = ["ELIPSE",[175,175],"GRID"];
_markerColor = "ColorBlue";
_markerMissionName = "Bandit Patrol";
_missionLandscapeMode = "precise"; // acceptable values are "none","random","precise"
_missionLandscape = []; // list of objects to spawn as landscape
_missionLandscape = [
["Flag_AAF_F",[0,0,0],0,[false,false]],
["Land_dp_transformer_F",[1.698242,-10.4668,-0.00763702],271.32,1,0,[],"","",true,false],
["Land_Wreck_BRDM2_F",[1.37012,13.498,0.00109863],184.487,0.00819469,0.830999,[],"","",true,false],
["Land_BagBunker_Small_F",[18.4512,-3.66406,0.00780487],305.003,1,0,[],"","",true,false],
["Land_Cargo_HQ_V1_F",[-20.1367,11.7539,0],90.8565,1,0,[],"","",true,false],
["Land_BagBunker_Small_F",[-22.707,-3.75586,-0.0130234],44.9901,1,0,[],"","",true,false],
["Land_Cargo_House_V1_F",[24.3584,7.45313,0.00111389],91.6329,1,0,[],"","",true,false],
["StorageBladder_01_fuel_forest_F",[1.29492,29.3184,0.000999451],179.65,1,0,[],"","",true,false],
["Land_GarbageBags_F",[-9.45996,31.252,0.02005],184.595,1,0,[],"","",true,false],
["Land_GarbageBags_F",[-13.0459,32.668,-0.0283051],184.595,1,0,[],"","",true,false],
["Land_GarbageBags_F",[-11.5957,33.125,-0.598007],184.595,1,0,[],"","",true,false],
["Land_GarbageBags_F",[-8.98145,34.5801,-0.00514221],184.592,1,0,[],"","",true,false],
["Land_Addon_02_V1_ruins_F",[24.8369,24.6582,-0.00820923],90.9637,1,0,[],"","",true,false],
["Land_GarbageBags_F",[-10.9443,35.0449,0.577057],184.592,1,0,[],"","",true,false],
["Land_Cargo20_military_green_F",[14.6533,32.9004,0.000480652],90.0989,1,0,[],"","",true,false],
["Land_BagBunker_Small_F",[-23.0186,28.6738,-0.0271301],120.012,1,0,[],"","",true,false],
["Land_BagBunker_Small_F",[37.1504,34.5742,0.0146866],255,1,0,[],"","",true,false]
]; // list of objects to spawn as landscape; // list of objects to spawn as landscape
_missionLootBoxes = [
["Box_NATO_Wps_F",_crateLoot,[0,0,0]], // Standard loot crate with standard loadout
["Land_PaperBox_C_EPOCH",_crateLoot,[-5,-5,0]], // No Weapons, Magazines, or optics; 10 each construction supplies and food/drink items, 3 backpacks
["Land_CargoBox_V1_F",_crateLoot,[7, 5.4,0]]]; // Parameters are "Box Item Code", array defining the loot to be spawned, and position.
_missionLootVehicles = [["I_G_Offroad_01_armed_F","I_G_Offroad_01_armed_F"]]; // Parameters are "Box Item Code", array defining the loot to be spawned, and position.
_missionEmplacedWeapons = []; // can be used to define the precise placement of static weapons [[1,2,3] /*loc 1*/, [2,3,4] /*loc 2*/]; if blank random locations will be used
["Box_NATO_Wps_F",[3,-3,0],_crateLoot,[4,10,2,5,5,1]], // Standard loot crate with standard loadout
["Land_PaperBox_C_EPOCH",[-4,-3,0],_crateLoot,[0,0,0,10,10,3]], // No Weapons, Magazines, or optics; 10 each construction supplies and food/drink items, 3 backpacks
["Land_CargoBox_V1_F",[3,4,0],_crateLoot,[0,10,2,5,5,1]]
]; // Parameters are "Box Item Code", array defining the loot to be spawned, and position.
// blck_lootCountsBlue= [4,12,3,6,6,1];
_missionLootVehicles = [
["I_G_Offroad_01_armed_F",[-8,8,0],_crateLoot,[0,10,2,5,5,1]],
["I_G_Offroad_01_armed_F",[8,17,0],_crateLoot,[0,10,2,5,5,1]]
]; // Parameters are "vehiclel type", offset relative to mission center, loot array, items to load from each category of the loot array.
// ["B_HMG_01_high_F"/*,"B_GMG_01_high_F","O_static_AT_F"*/];
_missionEmplacedWeapons = [["B_HMG_01_high_F",[-10,-15,0]],["B_GMG_01_high_F",[10,12,0]],["O_static_AT_F",[-10,10,0]]]; // can be used to define the type and precise placement of static weapons [["wep",[1,2,3]] /*loc 1*/, [2,3,4] /*loc 2*/]; if blank random locations will be used
_minNoAI = blck_MinAI_Blue;
_maxNoAI = blck_MaxAI_Blue;
_noAIGroups = blck_AIGrps_Blue;
@ -31,9 +55,9 @@ _noVehiclePatrols = blck_SpawnVeh_Blue;
_noEmplacedWeapons = blck_SpawnEmplaced_Blue;
_uniforms = blck_SkinList;
_headgear = blck_headgear;
_chanceReinforcements = blck_reinforcementsBlue select 0;
_noPara = blck_reinforcementsBlue select 1;
_helipatrol = blck_reinforcementsBlue select 2;
// _chanceReinforcements = blck_reinforcementsBlue select 0;
//_noPara = blck_reinforcementsBlue select 1;
//_helipatrol = blck_reinforcementsBlue select 2;
_endCondition = "playerNear"; // Options are "allUnitsKilled", "playerNear", "playerNear"
_timeout = -1;
#include "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionSpawner.sqf";

View File

@ -4,6 +4,38 @@ Loosely based on the AI mission system by blckeagls ver 2.0.2
Contributions by Narines: bug fixes, testing, infinite ammo fix.
Ideas or code from that by Vampire and KiloSwiss have been used for certain functions.
3/18/17 Version 6.58 Build 44
[Fixed] Time acceleration was not working.
[Fixed] blck_timeAcceleration now determines if time acceleration is activated.
[Fixed] The mission described by default2 in the blue missions folder now spawns correctly.
You can use this as a guide for how to place loot crates or static weapons at specific locations like inside or on top of structures.
Loot vehicles are now spawned correctly.
Loot crates positioned at specific locations are now spawned correctely.
static weapons to be spawned at specified positions are now spawned correctly.
That mission is disabled by default.
[Added] option to disable time acceleration (blck_timeAcceleration = true; line 30 of blck_config.sqf)
[Added] options to have armed heli's patrolling the missions and for them to drop AI.
[Added] options to have paratroops drop over missions as an alternative to the above.
[Added] Code optimization for GMS_fnc_spawnMissionAI.sqf and several other AI spawning scripts.
Added] Formalizing exception handling for the case in which a createGroup request returns grpNull.
If this happens during mission spawning the mission will be aborted and all mission objects and AI will be deleted.
This should prevent the mission system from crashing causing no further missions to spawn.
[Changed] Coding improvements for waypoint generation.
Tried a new approach to generating waypoints to make AI more aggressive without the overhead of the last method.
[Added] a new configuration that sets a cap on the maximum number of spawned missions.
blck_maxSpawnedMissions = 4; // Line 181 of blck_configs.sqf
[Changed] Redid the mission spawner to spawn one random mission every 1 min for mission for which timers say they can be spoawned.
This will continue until the cap is reached then randomly select a mission from those that are ready to be respawned to be spawned next.
If you want the various missions to have an equal chance of being spawned at all times, give the the timers for blue, red, green and red timers the same values for Min and Max.
[Chaged] logic for detecting whether a player is near the mission center or loot crates to test if a player is near any of an array of location or objects.
[Added] a function blck_fnc_allPlayers which returns an array of allPlayers (as a temporizing fix till BIS patches the allPlayers function.
To Do - consider moving back to storing AI in a group-based manner (doable easily, needs testing).
Build a template for static missions (planned for Ver 6.60).
Write a static mission spawning routine (planned for Ver 6.60).
3/17/17 Version 6.58 Build 43
Reverted back to v6.56 build 39 then:
[Added] a Hit event handler to make AI more responsive. All AI in the group to which the hit AI belongs are informed of the shooter's location.

View File

@ -7,7 +7,7 @@
To Vampire, KiloSwiss, blckeagls, theFUCHS, lazylink, Mark311 and Buttface (Face) who wrote the pionering mission and roaming AI systems upon which this one is based and who's code is used with modification in some parts of this addon.
By Ghostrider-DbD
Last Modified 3-14-17
Last Modified 3-18-17
--------------------------
License
--------------------------
@ -120,13 +120,13 @@ if (blck_enableBlueMissions > 0) then
if (blck_enableScoutsMissions > 0) then
{
//[_missionListScouts,_pathScouts,"ScoutsMarker","red",blck_TMin_Scouts,blck_TMax_Scouts] spawn blck_fnc_missionTimer;
[_missionListScouts,_pathScouts,"ScoutsMarker","red",blck_TMin_Scouts,blck_TMax_Scouts,blck_enableScoutsMissions] call blck_fnc_addMissionToQue;
[_missionListScouts,_pathScouts,"ScoutsMarker","red",blck_TMin_Scouts,blck_TMax_Scouts,blck_enableScoutsMissions, false] call blck_fnc_addMissionToQue;
};
if (blck_enableHunterMissions > 0) then
{
//[_missionListHunters,_pathHunters,"HunterMarker","green",blck_TMin_Hunter,blck_TMax_Hunter] spawn blck_fnc_missionTimer;
// params["_missionList","_path","_marker","_difficulty","_tMin","_tMax","_noMissions"];
[_missionListHunters,_pathHunters,"HunterMarker","green",blck_TMin_Hunter,blck_TMax_Hunter,blck_enableHunterMissions] call blck_fnc_addMissionToQue;
[_missionListHunters,_pathHunters,"HunterMarker","green",blck_TMin_Hunter,blck_TMax_Hunter,blck_enableHunterMissions, false] call blck_fnc_addMissionToQue;
};
// Running new version of Crash sites.

View File

@ -1,3 +1,3 @@
private ["_version","_versionDate"];
_blck_version = "6.58 Build 43";
_blck_versionDate = "3-18-17 8:00 AM";
_blck_version = "6.58 Build 44";
_blck_versionDate = "3-18-17 8:00 PM";