Changes listed under description
Added ability to pull AI loadouts from CfgPricine (Epoch). Consolidated code that defines AI Loadout and Airpatrol parameters based on difficulty. Added code to despawn static AI patrols and track the # of ai alive when infantry are despawned.
This commit is contained in:
parent
b27d10ac0c
commit
b0b0764e54
@ -10,7 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
|
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
|
||||||
|
|
||||||
params["_msg",["_players",playableUnits]];
|
params["_msg",["_players",allplayers]];
|
||||||
#ifdef blck_debugMode
|
#ifdef blck_debugMode
|
||||||
if (blck_debugLevel > 1) then {diag_log format["AIM.sqf ===] _this = %1 | _msg = %2 | _players = %3",_this,_msg, _players];};
|
if (blck_debugLevel > 1) then {diag_log format["AIM.sqf ===] _this = %1 | _msg = %2 | _players = %3",_this,_msg, _players];};
|
||||||
#endif
|
#endif
|
||||||
|
@ -17,11 +17,12 @@
|
|||||||
|
|
||||||
private ["_result"];
|
private ["_result"];
|
||||||
|
|
||||||
|
/*
|
||||||
_result = [];
|
_result = [];
|
||||||
{
|
{
|
||||||
if (isPlayer _x && alive _x) then { _result pushback _x };
|
if (isPlayer _x && alive _x) then { _result pushback _x };
|
||||||
} forEach playableUnits;
|
} forEach allPlayers;
|
||||||
|
*/
|
||||||
//_result = allPlayers;
|
_result = allPlayers;
|
||||||
|
|
||||||
_result
|
_result
|
||||||
|
@ -0,0 +1,658 @@
|
|||||||
|
/*
|
||||||
|
Dynamic Mission Spawner (over-ground missions)
|
||||||
|
By Ghostrider GRG
|
||||||
|
Copyright 2016
|
||||||
|
|
||||||
|
--------------------------
|
||||||
|
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";
|
||||||
|
#define delayTime 1
|
||||||
|
private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_assetKilledMsg","_enemyLeaderConfig",
|
||||||
|
"_AI_Vehicles","_timeOut","_aiDifficultyLevel","_missionPatrolVehicles","_missionGroups","_loadCratesTiming","_spawnCratesTiming","_assetSpawned","_hostageConfig",
|
||||||
|
"_chanceHeliPatrol","_noPara","_chanceLoot","_heliCrew","_loadCratesTiming","_useMines","_blck_AllMissionAI","_delayTime","_groupPatrolRadius",
|
||||||
|
"_wait","_missionStartTime","_playerInRange","_missionTimedOut","_temp","_patrolVehicles","_vehToSpawn","_noChoppers","_chancePara","_marker"];
|
||||||
|
|
||||||
|
params["_coords","_markerClass","_aiDifficultyLevel"];
|
||||||
|
|
||||||
|
////////
|
||||||
|
// 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["OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange];
|
||||||
|
//_markerClass = _mission select 0;
|
||||||
|
// _aiDifficultyLevel = _mission select 1;
|
||||||
|
|
||||||
|
[_markerClass, "active",_coords] call blck_fnc_updateMissionQue;
|
||||||
|
blck_ActiveMissionCoords pushback _coords;
|
||||||
|
blck_missionsRunning = blck_missionsRunning + 1;
|
||||||
|
diag_log format["[blckeagls] missionSpawner (17):: Initializing mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
|
||||||
|
|
||||||
|
if (isNil "_assetKilledMsg") then {_assetKilledMsg = ""};
|
||||||
|
if (isNil "_markerColor") then {_markerColor = "ColorBlack"};
|
||||||
|
if (isNil "_markerType") then {_markerType = ["mil_box",[]]};
|
||||||
|
//if (isNil "_timeOut") then {_timeOut = -1;};
|
||||||
|
if (isNil "_endCondition") then {_endCondition = blck_missionEndCondition}; // Options are "allUnitsKilled", "playerNear", "allKilledOrPlayerNear"};
|
||||||
|
if (isNil "_spawnCratesTiming") then {_spawnCratesTiming = blck_spawnCratesTiming}; // Choices: "atMissionSpawnGround","atMissionStartAir","atMissionEndGround","atMissionEndAir".
|
||||||
|
if (isNil "_loadCratesTiming") then {_loadCratesTiming = blck_loadCratesTiming}; // valid choices are "atMissionCompletion" and "atMissionSpawn";
|
||||||
|
if (isNil "_missionPatrolVehicles") then {_missionPatrolVehicles = []};
|
||||||
|
if (isNil "_missionGroups") then {_missionGroups = []};
|
||||||
|
if (isNil "_hostageConfig") then {_hostageConfig = []};
|
||||||
|
if (isNil "_enemyLeaderConfig") then {_enemyLeaderConfig = []};
|
||||||
|
if (isNil "_useMines") then {_useMines = blck_useMines;};
|
||||||
|
if (isNil "_weaponList") then {_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout};
|
||||||
|
if (isNil "_sideArms") then {_sideArms = [_aiDifficultyLevel] call blck_fnc_selectAISidearms};
|
||||||
|
if (isNil "_uniforms") then {_uniforms = [_aiDifficultyLevel] call blck_fnc_selectAIUniforms};
|
||||||
|
if (isNil "_headGear") then {_headGear = [_aiDifficultyLevel] call blck_fnc_selectAIHeadgear};
|
||||||
|
if (isNil "_vests") then {_vests = [_aiDifficultyLevel] call blck_fnc_selectAIVests};
|
||||||
|
if (isNil "_backpacks") then {_backpacks = [_aiDifficultyLevel] call blck_fnc_selectAIBackpacks};
|
||||||
|
if (isNil "_chanceHeliPatrol") then
|
||||||
|
{
|
||||||
|
switch (toLower(_aiDifficultyLevel)) do
|
||||||
|
{
|
||||||
|
case "blue": {_chanceHeliPatrol = blck_chanceHeliPatrolBlue};
|
||||||
|
case "red": {_chanceHeliPatrol = blck_chanceHeliPatrolRed};
|
||||||
|
case "green": {_chanceHeliPatrol = blck_chanceHeliPatrolGreen};
|
||||||
|
case "orange": {_chanceHeliPatrol = blck_chanceHeliPatrolOrange};
|
||||||
|
default {_chanceHeliPatrol = 0};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if (isNil "_noChoppers") then
|
||||||
|
{
|
||||||
|
switch (toLower(_aiDifficultyLevel)) do
|
||||||
|
{
|
||||||
|
case "blue": {_noChoppers = blck_noPatrolHelisBlue};
|
||||||
|
case "red": {_noChoppers = blck_noPatrolHelisRed};
|
||||||
|
case "green": {_noChoppers = blck_noPatrolHelisGreen};
|
||||||
|
case "orange": {_noChoppers = blck_noPatrolHelisOrange};
|
||||||
|
default {_noChoppers = 0};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if (isNil "_chancePara") then
|
||||||
|
{
|
||||||
|
switch (toLower (_aiDifficultyLevel)) do
|
||||||
|
{
|
||||||
|
case "blue": {_chancePara = blck_chanceParaBlue};
|
||||||
|
case "red": {_chancePara = blck_chanceParaRed};
|
||||||
|
case "green": {_chancePara = blck_chanceParaGreen};
|
||||||
|
case "orange": {_chancePara = blck_chanceParaOrange};
|
||||||
|
default {_chancePara = 0};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if (isNil "_missionHelis") then
|
||||||
|
{
|
||||||
|
switch (toLower (_aiDifficultyLevel)) do
|
||||||
|
{
|
||||||
|
case "blue": {_missionHelis = blck_patrolHelisBlue};
|
||||||
|
case "red": {_missionHelis = blck_patrolHelisRed};
|
||||||
|
case "green": {_missionHelis = blck_patrolHelisGreen};
|
||||||
|
case "orange": {_missionHelis = blck_patrolHelisOrange};
|
||||||
|
default {_missionHelis = blck_patrolHelisBlue};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if (isNil "_noPara") then
|
||||||
|
{
|
||||||
|
switch (toLower (_aiDifficultyLevel)) do
|
||||||
|
{
|
||||||
|
case "blue": {_noPara = blck_noParaBlue};
|
||||||
|
case "red": {_noPara = blck_noParaRed};
|
||||||
|
case "green": {_noPara = blck_noParaGreen};
|
||||||
|
case "orange": {_noPara = blck_noParaOrange};
|
||||||
|
default {_noPara = 0};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if (isNil "_chanceLoot") then {_chanceLoot = 1.0}; //0.5};
|
||||||
|
if (isNil "_paraTriggerDistance") then {_paraTriggerDistance = 400;};
|
||||||
|
if (isNil "_paraLoot") then {_paraLoot = blck_BoxLoot_Green};
|
||||||
|
if (isNil "_paraLootCounts") then {_paraLootCounts = blck_lootCountsRed};
|
||||||
|
|
||||||
|
|
||||||
|
_objects = [];
|
||||||
|
_mines = [];
|
||||||
|
_crates = [];
|
||||||
|
_aiGroup = [];
|
||||||
|
_missionAIVehicles = [];
|
||||||
|
_blck_AllMissionAI = [];
|
||||||
|
_AI_Vehicles = [];
|
||||||
|
_blck_localMissionMarker = [_markerClass,_coords,"","",_markerColor,_markerType];
|
||||||
|
#define delayTime 1
|
||||||
|
//_groupPatrolRadius = 50;
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
diag_log "_missionSpawner: All variables initialized";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
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?
|
||||||
|
[["start",_startMsg,_markerMissionName]] call blck_fnc_messageplayers;
|
||||||
|
_marker = [_blck_localMissionMarker] call blck_fnc_spawnMarker;
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (145) message players and spawn a mission marker";};
|
||||||
|
if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (146) _marker = %1",_marker];};
|
||||||
|
if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (147) waiting for player to trigger the mission";};
|
||||||
|
#endif
|
||||||
|
////////
|
||||||
|
// All parameters are defined, lets wait until a player is nearby or the mission has timed out
|
||||||
|
////////
|
||||||
|
|
||||||
|
_missionStartTime = diag_tickTime;
|
||||||
|
_playerInRange = false;
|
||||||
|
_missionTimedOut = false;
|
||||||
|
_wait = true;
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 0) then {
|
||||||
|
diag_log "missionSpawner:: (90) starting mission trigger loop"};
|
||||||
|
diag_log format["missionSpawner (163) blck_MissionTimeout = %1", blck_MissionTimeout];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
while {_wait} do
|
||||||
|
{
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
//diag_log "missionSpawner:: top of mission trigger loop";
|
||||||
|
if (blck_debugLevel > 2) exitWith {_playerInRange = true;diag_log "_fnc_missionSpawner (168): player trigger loop triggered by scripting";};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if ([_coords, blck_TriggerDistance, false] call blck_fnc_playerInRange) exitWith {_playerInRange = true;};
|
||||||
|
if ([_missionStartTime,blck_MissionTimeout] call blck_fnc_timedOut) exitWith {_missionTimedOut = true;};
|
||||||
|
uiSleep 5;
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 2) then
|
||||||
|
{
|
||||||
|
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,blck_MissionTimeout] call blck_fnc_timedOut];
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_missionTimedOut) exitWith
|
||||||
|
{
|
||||||
|
diag_log format["_fnc_missionSpawner (187): mission timed out"];
|
||||||
|
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission;
|
||||||
|
};
|
||||||
|
|
||||||
|
////////
|
||||||
|
// Spawn the mission objects, loot chest, and AI
|
||||||
|
////////
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 0) then
|
||||||
|
{
|
||||||
|
diag_log format["[blckeagls] missionSpawner:: (200) -- >> Mission tripped: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
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;
|
||||||
|
_temp = [];
|
||||||
|
|
||||||
|
if (_missionLandscapeMode isEqualTo "random") then
|
||||||
|
{
|
||||||
|
_temp = [_coords,_missionLandscape, 3, 15, 2] call blck_fnc_spawnRandomLandscape;
|
||||||
|
} else {
|
||||||
|
params["_center","_objects"];
|
||||||
|
_temp = [_coords, _missionLandscape] call blck_fnc_spawnCompositionObjects;
|
||||||
|
};
|
||||||
|
if (typeName _temp isEqualTo "ARRAY") then
|
||||||
|
{
|
||||||
|
_objects append _temp;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 0) then
|
||||||
|
{
|
||||||
|
diag_log format["[blckeagls] missionSpawner:: (237) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uiSleep delayTime;;
|
||||||
|
|
||||||
|
_temp = [_coords,_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles;
|
||||||
|
//uisleep 1;
|
||||||
|
_crates append _temp;
|
||||||
|
|
||||||
|
uiSleep delayTime;
|
||||||
|
|
||||||
|
_abort = false;
|
||||||
|
_temp = [[],[],false];
|
||||||
|
|
||||||
|
// params["_coords",_minNoAI,_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests",_backpacks,_weapons,sideArms,_isScubaGroup];
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
private _params = [_coords,_minNoAI,_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms];
|
||||||
|
{
|
||||||
|
diag_log format["_fnc_missionSpawner: _param %1 label %2 = %3",_forEachIndex, _x, _params select _forEachIndex];
|
||||||
|
}forEach ["_coords","_minNoAI","_maxNoAI","_missionGroups","_aiDifficultyLevel","_uniforms","_headgear","_vests","_backpacks","_weaponList","_sideArms"];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_temp = [_coords, _minNoAI,_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionAI;
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 2) then {
|
||||||
|
diag_log format["missionSpawner :: (264) 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 :: (269) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (_abort) exitWith
|
||||||
|
{
|
||||||
|
if (blck_debugLevel > 1) then {
|
||||||
|
diag_log "missionSpawner:: (277) grpNull returned, mission termination criteria met, calling blck_fnc_endMission"
|
||||||
|
};
|
||||||
|
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission;
|
||||||
|
};
|
||||||
|
if !(_abort) then
|
||||||
|
{
|
||||||
|
_blck_AllMissionAI append (_temp select 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 0) then
|
||||||
|
{
|
||||||
|
diag_log format["[blckeagls] missionSpawner:: (288) AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_assetSpawned = objNull;
|
||||||
|
if !(_hostageConfig isEqualTo []) then
|
||||||
|
{
|
||||||
|
_assetSpawned = [_coords,_hostageConfig] call blck_fnc_spawnHostage;
|
||||||
|
//diag_log format["_fnc_missionSpawner: _assetSpawned = %1",_assetSpawned];
|
||||||
|
_blck_AllMissionAI pushBack _assetSpawned;
|
||||||
|
};
|
||||||
|
|
||||||
|
if !(_enemyLeaderConfig isEqualTo []) then
|
||||||
|
{
|
||||||
|
_assetSpawned = [_coords,_enemyLeaderConfig] call blck_fnc_spawnLeader;
|
||||||
|
//diag_log format["_fnc_missionSpawner: _assetSpawned = %1",_assetSpawned];
|
||||||
|
_blck_AllMissionAI pushBack _assetSpawned;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel >= 1) then {
|
||||||
|
diag_log format["_fnc_missionSpawner: _assetSpawned = %1",_assetSpawned];
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uiSleep delayTime;
|
||||||
|
_temp = [[],[],false];
|
||||||
|
_abort = false;
|
||||||
|
|
||||||
|
_vehToSpawn = [_noVehiclePatrols] call blck_fnc_getNumberFromRange;
|
||||||
|
if (blck_useVehiclePatrols && ((_vehToSpawn > 0) || count _missionPatrolVehicles > 0)) then
|
||||||
|
{
|
||||||
|
#define useRelativePos true
|
||||||
|
//params[_coords,_noVehiclePatrols,_aiDifficultyLevel,_missionPatrolVehicles,_useRelativePos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms, _isScubaGroup];
|
||||||
|
//_temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_missionPatrolVehicles] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
_temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_missionPatrolVehicles,useRelativePos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
|
||||||
|
if (typeName _temp isEqualTo "ARRAY") then
|
||||||
|
{
|
||||||
|
_abort = _temp select 2;
|
||||||
|
};
|
||||||
|
if !(_abort) then
|
||||||
|
{
|
||||||
|
_patrolVehicles = _temp select 0;
|
||||||
|
_blck_AllMissionAI append (_temp select 1);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_abort) exitWith
|
||||||
|
{
|
||||||
|
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission;
|
||||||
|
};
|
||||||
|
|
||||||
|
uiSleep delayTime;
|
||||||
|
_temp = [[],[],false];
|
||||||
|
_abort = false;
|
||||||
|
|
||||||
|
// Deal with helicopter patrols
|
||||||
|
_temp = [];
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 1) then
|
||||||
|
{
|
||||||
|
diag_log format["[blckeagls] missionSpawner:: (351) calling in heli patrol: Current mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_noChoppers = [_noChoppers] call blck_fnc_getNumberFromRange;
|
||||||
|
//_noPara = [_noPara] call blck_fnc_getNumberFromRange;
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 1) then {diag_log format["_missionSpawner(322):: _noChoppers = %1 && _chancePara = %2",_noChoppers,_chancePara]};
|
||||||
|
#endif
|
||||||
|
if (_noChoppers > 0) then
|
||||||
|
{
|
||||||
|
for "_i" from 1 to (_noChoppers) do
|
||||||
|
{
|
||||||
|
if (random(1) < _chanceHeliPatrol) then
|
||||||
|
{
|
||||||
|
//_temp = [_coords,_missionHelis,spawnHeli,_aiDifficultyLevel,_chancePara,_noPara,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionReinforcements;
|
||||||
|
_temp = [_coords,_aiDifficultyLevel,_missionHelis,_uniforms,_headGear,_vests,_backpacks,"none",_weaponList, _sideArms] call blck_fnc_spawnMissionHeli;
|
||||||
|
|
||||||
|
if (typeName _temp isEqualTo "ARRAY") then
|
||||||
|
{
|
||||||
|
_abort = _temp select 2;
|
||||||
|
blck_monitoredVehicles pushBack (_temp select 0);
|
||||||
|
_blck_AllMissionAI append (_temp select 1);
|
||||||
|
};
|
||||||
|
if (_abort) then
|
||||||
|
{
|
||||||
|
_objects pushback (_temp select 0);
|
||||||
|
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////
|
||||||
|
// Spawn Crates and Emplaced Weapons Last to try to force them to correct positions relative to spawned buildinga or other objects.
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (389) preparing to spawn emplaced weapons for _coords %4 | _markerClass %3 | blck_useStatic = %1 | _noEmplacedWeapons = %2",blck_useStatic,_noEmplacedWeapons,_markerClass,_coords];};
|
||||||
|
#endif
|
||||||
|
uiSleep 15;
|
||||||
|
private["_noEmplacedToSpawn"];
|
||||||
|
_noEmplacedToSpawn = [_noEmplacedWeapons] call blck_fnc_getNumberFromRange;
|
||||||
|
//diag_log format["_fnc_missionSpawner: -> _noEmplacedToSpawn = %1 | blck_useStatic = %2",_noEmplacedToSpawn,blck_useStatic];
|
||||||
|
if (blck_useStatic && (_noEmplacedToSpawn > 0)) then
|
||||||
|
{
|
||||||
|
// _params = ["_coords","_missionEmplacedWeapons","_useRelativePos","_noEmplacedWeapons","_aiDifficultyLevel","_uniforms","_headGear","_vests","_backpacks","_weaponList","_sideArms"];
|
||||||
|
// _temp = [_missionEmplacedWeapons,_noEmplacedToSpawn,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnEmplacedWeaponArray;
|
||||||
|
_temp = [_coords,_missionEmplacedWeapons,useRelativePos,_noEmplacedToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnEmplacedWeaponArray;
|
||||||
|
|
||||||
|
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 (_abort) exitWith
|
||||||
|
{
|
||||||
|
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission;
|
||||||
|
};
|
||||||
|
uiSleep delayTime;
|
||||||
|
if (_spawnCratesTiming isEqualTo "atMissionSpawnGround") then
|
||||||
|
{
|
||||||
|
if (count _missionLootBoxes > 0) then
|
||||||
|
{
|
||||||
|
_crates = [_coords,_missionLootBoxes,_loadCratesTiming, _spawnCratesTiming, "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming, _spawnCratesTiming, "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
if (blck_cleanUpLootChests) then
|
||||||
|
{
|
||||||
|
_objects append _crates;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if (_noPara > 0 && (random(1) < _chancePara) && _paraTriggerDistance == 0) then
|
||||||
|
{
|
||||||
|
diag_log format["_fnc_missionSpawner (436): spawning %1 paraunits at mission spawn",_noPara];
|
||||||
|
private _paratroops = [_coords,_noPara,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnParaUnits;
|
||||||
|
if !(isNull _paratroops) then
|
||||||
|
{
|
||||||
|
_blck_AllMissionAI append (units _paratroops);
|
||||||
|
};
|
||||||
|
if (random(1) < _chanceLoot) then
|
||||||
|
{
|
||||||
|
diag_log format["_fnc_missionSpawner (446): spawning supplemental loot with _chanceLoot = %1",_chanceLoot];
|
||||||
|
private _extraCrates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_paraLoot,_paraLootCounts]], "atMissionSpawn","atMissionStartAir", "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates;
|
||||||
|
if (blck_cleanUpLootChests) then
|
||||||
|
{
|
||||||
|
_objects append _extraCrates;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// Define Triggers for mission end
|
||||||
|
private["_missionComplete","_endIfPlayerNear","_endIfAIKilled","_secureAsset","_crateStolen","_locations"];
|
||||||
|
_missionComplete = -1;
|
||||||
|
_startTime = diag_tickTime;
|
||||||
|
|
||||||
|
switch (_endCondition) do
|
||||||
|
{
|
||||||
|
case "playerNear": {_secureAsset = false; _endIfPlayerNear = true;_endIfAIKilled = false;};
|
||||||
|
case "allUnitsKilled": {_secureAsset = false; _endIfPlayerNear = false;_endIfAIKilled = true;};
|
||||||
|
case "allKilledOrPlayerNear": {_secureAsset = false; _endIfPlayerNear = true;_endIfAIKilled = true;};
|
||||||
|
case "assetSecured": {_secureAsset = true; _endIfPlayerNear = false; _endIfAIKilled = false;};
|
||||||
|
};
|
||||||
|
//diag_log format["_fnc_missionSpawner: _secureAsset = %1",_secureAsset];
|
||||||
|
if (blck_showCountAliveAI) then
|
||||||
|
{
|
||||||
|
if !(_marker isEqualTo "") then
|
||||||
|
{
|
||||||
|
[_marker,_markerMissionName,_blck_AllMissionAI] call blck_fnc_updateMarkerAliveCount;
|
||||||
|
blck_missionMarkers pushBack [_marker,_markerMissionName,_blck_AllMissionAI];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_crateStolen = false;
|
||||||
|
_locations = [_coords];
|
||||||
|
private _spawnPara = if (random(1) < _chancePara) then {true} else {false};
|
||||||
|
{
|
||||||
|
_locations pushback (getPos _x);
|
||||||
|
_x setVariable["crateSpawnPos", (getPos _x)];
|
||||||
|
} forEach _crates;
|
||||||
|
|
||||||
|
private["_thresholdPercentageKilled","_result","_minPercentageKilled"];
|
||||||
|
_thresholdPercentageKilled = (1-blck_killPercentage);
|
||||||
|
while {_missionComplete isEqualTo -1} do
|
||||||
|
{
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 2) exitWith {uiSleep blck_triggerLoopCompleteTime;diag_log "_missionSpawner (492) scripted Mission End blck_debugLevel = 3";};
|
||||||
|
#endif
|
||||||
|
if (_endIfPlayerNear) then
|
||||||
|
{
|
||||||
|
if ([_locations,20,true] call blck_fnc_playerInRangeArray) then {_missionComplete = 1};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_endIfAIKilled) then
|
||||||
|
{
|
||||||
|
_result = [_blck_AllMissionAI,1] call blck_fnc_countAliveAI;
|
||||||
|
// _result is an array of [no alive, total spawned];
|
||||||
|
//private _noneAlive = if (_result select 0 isEqualTo 0) then {true} else {false};
|
||||||
|
//private _aiCountBelowThreshold = if ( (_result select 0)/(_result select 1) < _thresholdPercentageKilled) then {true} else {false};
|
||||||
|
//diag_log format["_fnc_missionSpawner: _noneAlive = %1 | _result = %2 | PercentageKilled = %3",_noneAlive,_result,(_result select 0)/(_result select 1)];
|
||||||
|
if ((_result select 0) < 1 || ((_result select 0)/(_result select 1)) < _thresholdPercentageKilled ) then {_missionComplete = 1};
|
||||||
|
};
|
||||||
|
if (_spawnCratesTiming isEqualTo "atMissionSpawn") then
|
||||||
|
{
|
||||||
|
{
|
||||||
|
if ({[_x] call blck_fnc_crateMoved} count _crates > 0) exitWith
|
||||||
|
{
|
||||||
|
_missionComplete = 1;
|
||||||
|
_crateStolen = true;
|
||||||
|
};
|
||||||
|
}forEach _crates;
|
||||||
|
};
|
||||||
|
if (_secureAsset) then
|
||||||
|
{
|
||||||
|
if !(alive _assetSpawned) then
|
||||||
|
{
|
||||||
|
_missionComplete = 1
|
||||||
|
} else {
|
||||||
|
//if (_assetSpawned getVariable["blck_AIState",0] > 0 && (({alive _x} count _blck_AllMissionAI) isEqualTo 1)) then {_missionComplete = 1};
|
||||||
|
_result = [_blck_AllMissionAI, 1] call blck_fnc_countAliveAI;
|
||||||
|
// _result is an array of [no alive, total spawned];
|
||||||
|
//private _noneAlive = if (_result select 0 isEqualTo 0) then {true} else {false};
|
||||||
|
//private _aiCountBelowThreshold = if ((_result select 0)/(_result select 1) < _thresholdPercentageKilled) then {true} else {false};
|
||||||
|
//diag_log format["_fnc_missionSpawner: _noneAlive = %1 | _result = %2 | PercentageKilled = %3",_noneAlive,_result,(_result select 0)/(_result select 1)];
|
||||||
|
if (((_result select 0)/(_result select 1)) < 0.18) then
|
||||||
|
{
|
||||||
|
if (_assetSpawned getVariable["blck_unguarded",0] isEqualTo 0) then {_assetSpawned setVariable["blck_unguarded",1,true]};
|
||||||
|
if ((_assetSpawned getVariable["blck_AIState",0] > 0)) then {
|
||||||
|
_missionComplete = 1:
|
||||||
|
_assetSpawned allowdamage false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if (_spawnPara) then
|
||||||
|
{
|
||||||
|
|
||||||
|
if ([_coords,_paraTriggerDistance,true] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
_spawnPara = false; // The player gets one try to spawn these.
|
||||||
|
if (random(1) < _chancePara) then //
|
||||||
|
{
|
||||||
|
private _paratroops = [_coords,_noPara,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnParaUnits;
|
||||||
|
if !(isNull _paratroops) then
|
||||||
|
{
|
||||||
|
_blck_AllMissionAI append (units _paratroops);
|
||||||
|
};
|
||||||
|
if (random(1) < _chanceLoot) then
|
||||||
|
{
|
||||||
|
private _extraCrates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_paraLoot,_paraLootCounts]], "atMissionSpawn","atMissionStartAir", "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates;
|
||||||
|
if (blck_cleanUpLootChests) then
|
||||||
|
{
|
||||||
|
_objects append _extraCrates;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
uiSleep 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_crateStolen) exitWith
|
||||||
|
{
|
||||||
|
diag_log format["missionSpawner:: (542) Crate Stolen Callening _fnc_endMission - > players near = %1 and ai alive = %2 and crates stolen = %3",[_locations,10,true] call blck_fnc_playerInRangeArray, {alive _x} count _blck_AllMissionAI, _crateStolen];
|
||||||
|
[_mines,_objects,_crates, _blck_AllMissionAI,"Crate Removed from Mission Site Before Mission Completion: Mission Aborted",_blck_localMissionMarker,_coords,_markerClass, 2] call blck_fnc_endMission;
|
||||||
|
};
|
||||||
|
|
||||||
|
if ((_secureAsset) && !(alive _assetSpawned)) exitWith
|
||||||
|
{
|
||||||
|
[_mines,_objects,_crates, _blck_AllMissionAI,_assetKilledMsg,_blck_localMissionMarker,_coords,_markerClass, 2] call blck_fnc_endMission;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_spawnCratesTiming in ["atMissionEndGround","atMissionEndAir"]) then
|
||||||
|
{
|
||||||
|
if (count _missionLootBoxes > 0) then
|
||||||
|
{
|
||||||
|
_crates = [_coords,_missionLootBoxes,_loadCratesTiming,_spawnCratesTiming, "end", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming,_spawnCratesTiming, "end", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 0) then {diag_log format["_fnc_missionSpawner (531): _crates = %1", _crates]};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (blck_cleanUpLootChests) then
|
||||||
|
{
|
||||||
|
_objects append _crates;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 0) then {diag_log format["[blckeagls] missionSpawner:: (428) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]};
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_spawnCratesTiming isEqualTo "atMissionSpawnGround" && _loadCratesTiming isEqualTo "atMissionCompletion") then
|
||||||
|
{
|
||||||
|
{
|
||||||
|
[_x] call blck_fnc_loadMissionCrate;
|
||||||
|
} forEach _crates;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 0) then
|
||||||
|
{
|
||||||
|
diag_log format["[blckeagls] missionSpawner:: (586) Mission completion criteria fulfilled: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
|
||||||
|
diag_log format["missionSpawner :: (587) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled];
|
||||||
|
diag_log format["[blckeagls] missionSpawner:: (588) calling endMission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
private["_result"];
|
||||||
|
// Force passing the mission name for informational purposes.
|
||||||
|
_blck_localMissionMarker set [2, _markerMissionName];
|
||||||
|
if (blck_showCountAliveAI) then
|
||||||
|
{
|
||||||
|
_marker setMarkerText format["%1: All AI Dead",_markerMissionName];
|
||||||
|
{
|
||||||
|
if ((_x select 1) isEqualTo _markerMissionName) exitWith{blck_missionMarkers deleteAt _forEachIndex};
|
||||||
|
}forEach blck_missionMarkers;
|
||||||
|
};
|
||||||
|
|
||||||
|
//diag_log format["_fnc_missionSpawner (557) Build 123: _secureAsset = %1 | {alive _assetSpawned} = %2 | assetType = %3",_secureAsset,alive _assetSpawned, _assetSpawned getVariable["assetType",-1]];
|
||||||
|
|
||||||
|
if (_assetSpawned getVariable["assetType",0] isEqualTo 1) then
|
||||||
|
{
|
||||||
|
//diag_log "Processing Mission End for Hostage Rescue";
|
||||||
|
_assetSpawned setCaptive false;
|
||||||
|
_assetSpawned setVariable["GMSAnimations",[""],true];
|
||||||
|
[_assetSpawned,""] remoteExec["switchMove",-2];;
|
||||||
|
uiSleep 0.1;
|
||||||
|
_assetSpawned enableAI "ALL";
|
||||||
|
private _newPos = (getPos _assetSpawned) getPos [1000, random(360)];
|
||||||
|
//diag_log format["processing domove for hostage with current pos = %1 and new pos = %2",getPos _assetSpawned, _newPos];
|
||||||
|
(group _assetSpawned) setCurrentWaypoint [group _assetSpawned, 0];
|
||||||
|
[group _assetSpawned,0] setWaypointPosition [_newPos,0];
|
||||||
|
[group _assetSpawned,0] setWaypointType "MOVE";
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_assetSpawned getVariable["assetType",0] isEqualTo 2) then
|
||||||
|
{
|
||||||
|
//diag_log format["Processing Mission End for Arrest of Leader %1 with endAnimation %2",_assetSpawned,_assetSpawned getVariable["endAnimation",""]];
|
||||||
|
[_assetSpawned,""] remoteExec["switchMove",-2];
|
||||||
|
_assetSpawned setVariable["GMSAnimations",_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]],true];
|
||||||
|
[_assetSpawned,selectRandom(_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]])] remoteExec["switchMove",-2];
|
||||||
|
};
|
||||||
|
|
||||||
|
//diag_log format["_fnc_missionSpawner (579) Build 123: <calling blck_fnc_endMission> _secureAsset = %1 | {alive _assetSpawned} = %2 | assetType = %3",_secureAsset,alive _assetSpawned, _assetSpawned getVariable["assetType",-1]];
|
||||||
|
|
||||||
|
_result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 0] call blck_fnc_endMission;
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 2) then {diag_log format["[blckeagls] missionSpawner:: (507)end of mission: blck_fnc_endMission has returned control to _fnc_missionSpawner"]};
|
||||||
|
#endif
|
||||||
|
diag_log format["_fnc_missionSpawner (643) Mission Completed | _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
|
||||||
|
blck_missionsRun = blck_missionsRun + 1;
|
||||||
|
diag_log format["_fnc_missionSpawner (644): Total Dyanamic Land and UMS Run = %1", blck_missionsRun];
|
@ -0,0 +1,712 @@
|
|||||||
|
/*
|
||||||
|
Dynamic Mission Spawner (over-ground missions)
|
||||||
|
By Ghostrider GRG
|
||||||
|
Copyright 2016
|
||||||
|
|
||||||
|
--------------------------
|
||||||
|
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";
|
||||||
|
#define delayTime 1
|
||||||
|
private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_assetKilledMsg","_enemyLeaderConfig",
|
||||||
|
"_AI_Vehicles","_timeOut","_aiDifficultyLevel","_missionPatrolVehicles","_missionGroups","_loadCratesTiming","_spawnCratesTiming","_assetSpawned","_hostageConfig",
|
||||||
|
"_chanceHeliPatrol","_noPara","_chanceLoot","_heliCrew","_loadCratesTiming","_useMines","_blck_AllMissionAI","_delayTime","_groupPatrolRadius",
|
||||||
|
"_wait","_missionStartTime","_playerInRange","_missionTimedOut","_temp","_patrolVehicles","_vehToSpawn","_noChoppers","_chancePara","_marker"];
|
||||||
|
|
||||||
|
params["_coords","_markerClass","_aiDifficultyLevel"];
|
||||||
|
|
||||||
|
////////
|
||||||
|
// 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["OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange];
|
||||||
|
//_markerClass = _mission select 0;
|
||||||
|
// _aiDifficultyLevel = _mission select 1;
|
||||||
|
|
||||||
|
[_markerClass, "active",_coords] call blck_fnc_updateMissionQue;
|
||||||
|
blck_ActiveMissionCoords pushback _coords;
|
||||||
|
blck_missionsRunning = blck_missionsRunning + 1;
|
||||||
|
diag_log format["[blckeagls] missionSpawner (17):: Initializing mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
|
||||||
|
|
||||||
|
if (isNil "_assetKilledMsg") then {_assetKilledMsg = ""};
|
||||||
|
if (isNil "_markerColor") then {_markerColor = "ColorBlack"};
|
||||||
|
if (isNil "_markerType") then {_markerType = ["mil_box",[]]};
|
||||||
|
//if (isNil "_timeOut") then {_timeOut = -1;};
|
||||||
|
if (isNil "_endCondition") then {_endCondition = blck_missionEndCondition}; // Options are "allUnitsKilled", "playerNear", "allKilledOrPlayerNear"};
|
||||||
|
if (isNil "_spawnCratesTiming") then {_spawnCratesTiming = blck_spawnCratesTiming}; // Choices: "atMissionSpawnGround","atMissionStartAir","atMissionEndGround","atMissionEndAir".
|
||||||
|
if (isNil "_loadCratesTiming") then {_loadCratesTiming = blck_loadCratesTiming}; // valid choices are "atMissionCompletion" and "atMissionSpawn";
|
||||||
|
if (isNil "_missionPatrolVehicles") then {_missionPatrolVehicles = []};
|
||||||
|
if (isNil "_missionGroups") then {_missionGroups = []};
|
||||||
|
if (isNil "_hostageConfig") then {_hostageConfig = []};
|
||||||
|
if (isNil "_enemyLeaderConfig") then {_enemyLeaderConfig = []};
|
||||||
|
if (isNil "_useMines") then {_useMines = blck_useMines;};
|
||||||
|
if (isNil "_weaponList") then {_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout};
|
||||||
|
if (isNil "_sideArms") then
|
||||||
|
{
|
||||||
|
switch (toLower (_aiDifficultyLevel)) do
|
||||||
|
{
|
||||||
|
case "blue": {_sideArms = blck_Pistols_blue};
|
||||||
|
case "red": {_sideArms = blck_Pistols_red};
|
||||||
|
case "green": {_sideArms = blck_Pistols_green};
|
||||||
|
case "orange": {_sideArms = blck_Pistols_orange};
|
||||||
|
default {_sideArms = blck_Pistols};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (isNil "_uniforms") then
|
||||||
|
{
|
||||||
|
switch (toLower (_aiDifficultyLevel)) do
|
||||||
|
{
|
||||||
|
case "blue": {_uniforms = blck_SkinList_blue};
|
||||||
|
case "red": {_uniforms = blck_SkinList_red};
|
||||||
|
case "green": {_uniforms = blck_SkinList_green};
|
||||||
|
case "orange": {_uniforms = blck_SkinList_orange};
|
||||||
|
default {_uniforms = blck_SkinList};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (isNil "_headGear") then
|
||||||
|
{
|
||||||
|
switch (toLower (_aiDifficultyLevel)) do
|
||||||
|
{
|
||||||
|
case "blue": {_headGear = blck_headgear_blue};
|
||||||
|
case "red": {_headGear = blck_headgear_red};
|
||||||
|
case "green": {_headGear = blck_headgear_green};
|
||||||
|
case "orange": {_headGear = blck_headgear_orange};
|
||||||
|
default {_headGear = blck_headgear};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (isNil "_vests") then
|
||||||
|
{
|
||||||
|
switch (toLower (_aiDifficultyLevel)) do
|
||||||
|
{
|
||||||
|
case "blue": {_vests = blck_vests_blue};
|
||||||
|
case "red": {_vests = blck_vests_red};
|
||||||
|
case "green": {_vests = blck_vests_green};
|
||||||
|
case "orange": {_vests = blck_vests_orange};
|
||||||
|
default {_vests = blck_vests};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (isNil "_backpacks") then
|
||||||
|
{
|
||||||
|
switch (toLower (_aiDifficultyLevel)) do
|
||||||
|
{
|
||||||
|
case "blue": {_backpacks = blck_backpacks_blue};
|
||||||
|
case "red": {_backpacks = blck_backpacks_red};
|
||||||
|
case "green": {_backpacks = blck_backpacks_green};
|
||||||
|
case "orange": {_backpacks = blck_backpacks_orange};
|
||||||
|
default {_backpacks = blck_backpacks};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if (isNil "_chanceHeliPatrol") then
|
||||||
|
{
|
||||||
|
switch (toLower(_aiDifficultyLevel)) do
|
||||||
|
{
|
||||||
|
case "blue": {_chanceHeliPatrol = blck_chanceHeliPatrolBlue};
|
||||||
|
case "red": {_chanceHeliPatrol = blck_chanceHeliPatrolRed};
|
||||||
|
case "green": {_chanceHeliPatrol = blck_chanceHeliPatrolGreen};
|
||||||
|
case "orange": {_chanceHeliPatrol = blck_chanceHeliPatrolOrange};
|
||||||
|
default {_chanceHeliPatrol = 0};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if (isNil "_noChoppers") then
|
||||||
|
{
|
||||||
|
switch (toLower(_aiDifficultyLevel)) do
|
||||||
|
{
|
||||||
|
case "blue": {_noChoppers = blck_noPatrolHelisBlue};
|
||||||
|
case "red": {_noChoppers = blck_noPatrolHelisRed};
|
||||||
|
case "green": {_noChoppers = blck_noPatrolHelisGreen};
|
||||||
|
case "orange": {_noChoppers = blck_noPatrolHelisOrange};
|
||||||
|
default {_noChoppers = 0};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if (isNil "_chancePara") then
|
||||||
|
{
|
||||||
|
switch (toLower (_aiDifficultyLevel)) do
|
||||||
|
{
|
||||||
|
case "blue": {_chancePara = blck_chanceParaBlue};
|
||||||
|
case "red": {_chancePara = blck_chanceParaRed};
|
||||||
|
case "green": {_chancePara = blck_chanceParaGreen};
|
||||||
|
case "orange": {_chancePara = blck_chanceParaOrange};
|
||||||
|
default {_chancePara = 0};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if (isNil "_missionHelis") then
|
||||||
|
{
|
||||||
|
switch (toLower (_aiDifficultyLevel)) do
|
||||||
|
{
|
||||||
|
case "blue": {_missionHelis = blck_patrolHelisBlue};
|
||||||
|
case "red": {_missionHelis = blck_patrolHelisRed};
|
||||||
|
case "green": {_missionHelis = blck_patrolHelisGreen};
|
||||||
|
case "orange": {_missionHelis = blck_patrolHelisOrange};
|
||||||
|
default {_missionHelis = blck_patrolHelisBlue};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if (isNil "_noPara") then
|
||||||
|
{
|
||||||
|
switch (toLower (_aiDifficultyLevel)) do
|
||||||
|
{
|
||||||
|
case "blue": {_noPara = blck_noParaBlue};
|
||||||
|
case "red": {_noPara = blck_noParaRed};
|
||||||
|
case "green": {_noPara = blck_noParaGreen};
|
||||||
|
case "orange": {_noPara = blck_noParaOrange};
|
||||||
|
default {_noPara = 0};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if (isNil "_chanceLoot") then {_chanceLoot = 1.0}; //0.5};
|
||||||
|
if (isNil "_paraTriggerDistance") then {_paraTriggerDistance = 400;};
|
||||||
|
if (isNil "_paraLoot") then {_paraLoot = blck_BoxLoot_Green};
|
||||||
|
if (isNil "_paraLootCounts") then {_paraLootCounts = blck_lootCountsRed};
|
||||||
|
|
||||||
|
|
||||||
|
_objects = [];
|
||||||
|
_mines = [];
|
||||||
|
_crates = [];
|
||||||
|
_aiGroup = [];
|
||||||
|
_missionAIVehicles = [];
|
||||||
|
_blck_AllMissionAI = [];
|
||||||
|
_AI_Vehicles = [];
|
||||||
|
_blck_localMissionMarker = [_markerClass,_coords,"","",_markerColor,_markerType];
|
||||||
|
#define delayTime 1
|
||||||
|
//_groupPatrolRadius = 50;
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
diag_log "_missionSpawner: All variables initialized";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
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?
|
||||||
|
[["start",_startMsg,_markerMissionName]] call blck_fnc_messageplayers;
|
||||||
|
_marker = [_blck_localMissionMarker] call blck_fnc_spawnMarker;
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (145) message players and spawn a mission marker";};
|
||||||
|
if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (146) _marker = %1",_marker];};
|
||||||
|
if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (147) waiting for player to trigger the mission";};
|
||||||
|
#endif
|
||||||
|
////////
|
||||||
|
// All parameters are defined, lets wait until a player is nearby or the mission has timed out
|
||||||
|
////////
|
||||||
|
|
||||||
|
_missionStartTime = diag_tickTime;
|
||||||
|
_playerInRange = false;
|
||||||
|
_missionTimedOut = false;
|
||||||
|
_wait = true;
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 0) then {
|
||||||
|
diag_log "missionSpawner:: (90) starting mission trigger loop"};
|
||||||
|
diag_log format["missionSpawner (163) blck_MissionTimeout = %1", blck_MissionTimeout];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
while {_wait} do
|
||||||
|
{
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
//diag_log "missionSpawner:: top of mission trigger loop";
|
||||||
|
if (blck_debugLevel > 2) exitWith {_playerInRange = true;diag_log "_fnc_missionSpawner (168): player trigger loop triggered by scripting";};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if ([_coords, blck_TriggerDistance, false] call blck_fnc_playerInRange) exitWith {_playerInRange = true;};
|
||||||
|
if ([_missionStartTime,blck_MissionTimeout] call blck_fnc_timedOut) exitWith {_missionTimedOut = true;};
|
||||||
|
uiSleep 5;
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 2) then
|
||||||
|
{
|
||||||
|
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,blck_MissionTimeout] call blck_fnc_timedOut];
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_missionTimedOut) exitWith
|
||||||
|
{
|
||||||
|
diag_log format["_fnc_missionSpawner (187): mission timed out"];
|
||||||
|
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission;
|
||||||
|
};
|
||||||
|
|
||||||
|
////////
|
||||||
|
// Spawn the mission objects, loot chest, and AI
|
||||||
|
////////
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 0) then
|
||||||
|
{
|
||||||
|
diag_log format["[blckeagls] missionSpawner:: (200) -- >> Mission tripped: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
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;
|
||||||
|
_temp = [];
|
||||||
|
|
||||||
|
if (_missionLandscapeMode isEqualTo "random") then
|
||||||
|
{
|
||||||
|
_temp = [_coords,_missionLandscape, 3, 15, 2] call blck_fnc_spawnRandomLandscape;
|
||||||
|
} else {
|
||||||
|
params["_center","_objects"];
|
||||||
|
_temp = [_coords, _missionLandscape] call blck_fnc_spawnCompositionObjects;
|
||||||
|
};
|
||||||
|
if (typeName _temp isEqualTo "ARRAY") then
|
||||||
|
{
|
||||||
|
_objects append _temp;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 0) then
|
||||||
|
{
|
||||||
|
diag_log format["[blckeagls] missionSpawner:: (237) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uiSleep delayTime;;
|
||||||
|
|
||||||
|
_temp = [_coords,_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles;
|
||||||
|
//uisleep 1;
|
||||||
|
_crates append _temp;
|
||||||
|
|
||||||
|
uiSleep delayTime;
|
||||||
|
|
||||||
|
_abort = false;
|
||||||
|
_temp = [[],[],false];
|
||||||
|
|
||||||
|
// params["_coords",_minNoAI,_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests",_backpacks,_weapons,sideArms,_isScubaGroup];
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
private _params = [_coords,_minNoAI,_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms];
|
||||||
|
{
|
||||||
|
diag_log format["_fnc_missionSpawner: _param %1 label %2 = %3",_forEachIndex, _x, _params select _forEachIndex];
|
||||||
|
}forEach ["_coords","_minNoAI","_maxNoAI","_missionGroups","_aiDifficultyLevel","_uniforms","_headgear","_vests","_backpacks","_weaponList","_sideArms"];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_temp = [_coords, _minNoAI,_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionAI;
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 2) then {
|
||||||
|
diag_log format["missionSpawner :: (264) 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 :: (269) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (_abort) exitWith
|
||||||
|
{
|
||||||
|
if (blck_debugLevel > 1) then {
|
||||||
|
diag_log "missionSpawner:: (277) grpNull returned, mission termination criteria met, calling blck_fnc_endMission"
|
||||||
|
};
|
||||||
|
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission;
|
||||||
|
};
|
||||||
|
if !(_abort) then
|
||||||
|
{
|
||||||
|
_blck_AllMissionAI append (_temp select 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 0) then
|
||||||
|
{
|
||||||
|
diag_log format["[blckeagls] missionSpawner:: (288) AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_assetSpawned = objNull;
|
||||||
|
if !(_hostageConfig isEqualTo []) then
|
||||||
|
{
|
||||||
|
_assetSpawned = [_coords,_hostageConfig] call blck_fnc_spawnHostage;
|
||||||
|
//diag_log format["_fnc_missionSpawner: _assetSpawned = %1",_assetSpawned];
|
||||||
|
_blck_AllMissionAI pushBack _assetSpawned;
|
||||||
|
};
|
||||||
|
|
||||||
|
if !(_enemyLeaderConfig isEqualTo []) then
|
||||||
|
{
|
||||||
|
_assetSpawned = [_coords,_enemyLeaderConfig] call blck_fnc_spawnLeader;
|
||||||
|
//diag_log format["_fnc_missionSpawner: _assetSpawned = %1",_assetSpawned];
|
||||||
|
_blck_AllMissionAI pushBack _assetSpawned;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel >= 1) then {
|
||||||
|
diag_log format["_fnc_missionSpawner: _assetSpawned = %1",_assetSpawned];
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uiSleep delayTime;
|
||||||
|
_temp = [[],[],false];
|
||||||
|
_abort = false;
|
||||||
|
|
||||||
|
_vehToSpawn = [_noVehiclePatrols] call blck_fnc_getNumberFromRange;
|
||||||
|
if (blck_useVehiclePatrols && ((_vehToSpawn > 0) || count _missionPatrolVehicles > 0)) then
|
||||||
|
{
|
||||||
|
#define useRelativePos true
|
||||||
|
//params[_coords,_noVehiclePatrols,_aiDifficultyLevel,_missionPatrolVehicles,_useRelativePos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms, _isScubaGroup];
|
||||||
|
//_temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_missionPatrolVehicles] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
_temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_missionPatrolVehicles,useRelativePos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
|
||||||
|
if (typeName _temp isEqualTo "ARRAY") then
|
||||||
|
{
|
||||||
|
_abort = _temp select 2;
|
||||||
|
};
|
||||||
|
if !(_abort) then
|
||||||
|
{
|
||||||
|
_patrolVehicles = _temp select 0;
|
||||||
|
_blck_AllMissionAI append (_temp select 1);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_abort) exitWith
|
||||||
|
{
|
||||||
|
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission;
|
||||||
|
};
|
||||||
|
|
||||||
|
uiSleep delayTime;
|
||||||
|
_temp = [[],[],false];
|
||||||
|
_abort = false;
|
||||||
|
|
||||||
|
// Deal with helicopter patrols
|
||||||
|
_temp = [];
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 1) then
|
||||||
|
{
|
||||||
|
diag_log format["[blckeagls] missionSpawner:: (351) calling in heli patrol: Current mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_noChoppers = [_noChoppers] call blck_fnc_getNumberFromRange;
|
||||||
|
//_noPara = [_noPara] call blck_fnc_getNumberFromRange;
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 1) then {diag_log format["_missionSpawner(322):: _noChoppers = %1 && _chancePara = %2",_noChoppers,_chancePara]};
|
||||||
|
#endif
|
||||||
|
if (_noChoppers > 0) then
|
||||||
|
{
|
||||||
|
for "_i" from 1 to (_noChoppers) do
|
||||||
|
{
|
||||||
|
if (random(1) < _chanceHeliPatrol) then
|
||||||
|
{
|
||||||
|
//_temp = [_coords,_missionHelis,spawnHeli,_aiDifficultyLevel,_chancePara,_noPara,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionReinforcements;
|
||||||
|
_temp = [_coords,_aiDifficultyLevel,_missionHelis,_uniforms,_headGear,_vests,_backpacks,"none",_weaponList, _sideArms] call blck_fnc_spawnMissionHeli;
|
||||||
|
|
||||||
|
if (typeName _temp isEqualTo "ARRAY") then
|
||||||
|
{
|
||||||
|
_abort = _temp select 2;
|
||||||
|
blck_monitoredVehicles pushBack (_temp select 0);
|
||||||
|
_blck_AllMissionAI append (_temp select 1);
|
||||||
|
};
|
||||||
|
if (_abort) then
|
||||||
|
{
|
||||||
|
_objects pushback (_temp select 0);
|
||||||
|
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////
|
||||||
|
// Spawn Crates and Emplaced Weapons Last to try to force them to correct positions relative to spawned buildinga or other objects.
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (389) preparing to spawn emplaced weapons for _coords %4 | _markerClass %3 | blck_useStatic = %1 | _noEmplacedWeapons = %2",blck_useStatic,_noEmplacedWeapons,_markerClass,_coords];};
|
||||||
|
#endif
|
||||||
|
uiSleep 15;
|
||||||
|
private["_noEmplacedToSpawn"];
|
||||||
|
_noEmplacedToSpawn = [_noEmplacedWeapons] call blck_fnc_getNumberFromRange;
|
||||||
|
//diag_log format["_fnc_missionSpawner: -> _noEmplacedToSpawn = %1 | blck_useStatic = %2",_noEmplacedToSpawn,blck_useStatic];
|
||||||
|
if (blck_useStatic && (_noEmplacedToSpawn > 0)) then
|
||||||
|
{
|
||||||
|
// _params = ["_coords","_missionEmplacedWeapons","_useRelativePos","_noEmplacedWeapons","_aiDifficultyLevel","_uniforms","_headGear","_vests","_backpacks","_weaponList","_sideArms"];
|
||||||
|
// _temp = [_missionEmplacedWeapons,_noEmplacedToSpawn,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnEmplacedWeaponArray;
|
||||||
|
_temp = [_coords,_missionEmplacedWeapons,useRelativePos,_noEmplacedToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnEmplacedWeaponArray;
|
||||||
|
|
||||||
|
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 (_abort) exitWith
|
||||||
|
{
|
||||||
|
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission;
|
||||||
|
};
|
||||||
|
uiSleep delayTime;
|
||||||
|
if (_spawnCratesTiming isEqualTo "atMissionSpawnGround") then
|
||||||
|
{
|
||||||
|
if (count _missionLootBoxes > 0) then
|
||||||
|
{
|
||||||
|
_crates = [_coords,_missionLootBoxes,_loadCratesTiming, _spawnCratesTiming, "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming, _spawnCratesTiming, "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
if (blck_cleanUpLootChests) then
|
||||||
|
{
|
||||||
|
_objects append _crates;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if (_noPara > 0 && (random(1) < _chancePara) && _paraTriggerDistance == 0) then
|
||||||
|
{
|
||||||
|
diag_log format["_fnc_missionSpawner (436): spawning %1 paraunits at mission spawn",_noPara];
|
||||||
|
private _paratroops = [_coords,_noPara,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnParaUnits;
|
||||||
|
if !(isNull _paratroops) then
|
||||||
|
{
|
||||||
|
_blck_AllMissionAI append (units _paratroops);
|
||||||
|
};
|
||||||
|
if (random(1) < _chanceLoot) then
|
||||||
|
{
|
||||||
|
diag_log format["_fnc_missionSpawner (446): spawning supplemental loot with _chanceLoot = %1",_chanceLoot];
|
||||||
|
private _extraCrates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_paraLoot,_paraLootCounts]], "atMissionSpawn","atMissionStartAir", "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates;
|
||||||
|
if (blck_cleanUpLootChests) then
|
||||||
|
{
|
||||||
|
_objects append _extraCrates;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// Define Triggers for mission end
|
||||||
|
private["_missionComplete","_endIfPlayerNear","_endIfAIKilled","_secureAsset","_crateStolen","_locations"];
|
||||||
|
_missionComplete = -1;
|
||||||
|
_startTime = diag_tickTime;
|
||||||
|
|
||||||
|
switch (_endCondition) do
|
||||||
|
{
|
||||||
|
case "playerNear": {_secureAsset = false; _endIfPlayerNear = true;_endIfAIKilled = false;};
|
||||||
|
case "allUnitsKilled": {_secureAsset = false; _endIfPlayerNear = false;_endIfAIKilled = true;};
|
||||||
|
case "allKilledOrPlayerNear": {_secureAsset = false; _endIfPlayerNear = true;_endIfAIKilled = true;};
|
||||||
|
case "assetSecured": {_secureAsset = true; _endIfPlayerNear = false; _endIfAIKilled = false;};
|
||||||
|
};
|
||||||
|
//diag_log format["_fnc_missionSpawner: _secureAsset = %1",_secureAsset];
|
||||||
|
if (blck_showCountAliveAI) then
|
||||||
|
{
|
||||||
|
if !(_marker isEqualTo "") then
|
||||||
|
{
|
||||||
|
[_marker,_markerMissionName,_blck_AllMissionAI] call blck_fnc_updateMarkerAliveCount;
|
||||||
|
blck_missionMarkers pushBack [_marker,_markerMissionName,_blck_AllMissionAI];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
_crateStolen = false;
|
||||||
|
_locations = [_coords];
|
||||||
|
private _spawnPara = if (random(1) < _chancePara) then {true} else {false};
|
||||||
|
{
|
||||||
|
_locations pushback (getPos _x);
|
||||||
|
_x setVariable["crateSpawnPos", (getPos _x)];
|
||||||
|
} forEach _crates;
|
||||||
|
|
||||||
|
private["_thresholdPercentageKilled","_result","_minPercentageKilled"];
|
||||||
|
_thresholdPercentageKilled = (1-blck_killPercentage);
|
||||||
|
while {_missionComplete isEqualTo -1} do
|
||||||
|
{
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 2) exitWith {uiSleep blck_triggerLoopCompleteTime;diag_log "_missionSpawner (492) scripted Mission End blck_debugLevel = 3";};
|
||||||
|
#endif
|
||||||
|
if (_endIfPlayerNear) then
|
||||||
|
{
|
||||||
|
if ([_locations,20,true] call blck_fnc_playerInRangeArray) then {_missionComplete = 1};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_endIfAIKilled) then
|
||||||
|
{
|
||||||
|
_result = [_blck_AllMissionAI,1] call blck_fnc_countAliveAI;
|
||||||
|
// _result is an array of [no alive, total spawned];
|
||||||
|
//private _noneAlive = if (_result select 0 isEqualTo 0) then {true} else {false};
|
||||||
|
//private _aiCountBelowThreshold = if ( (_result select 0)/(_result select 1) < _thresholdPercentageKilled) then {true} else {false};
|
||||||
|
//diag_log format["_fnc_missionSpawner: _noneAlive = %1 | _result = %2 | PercentageKilled = %3",_noneAlive,_result,(_result select 0)/(_result select 1)];
|
||||||
|
if ((_result select 0) < 1 || ((_result select 0)/(_result select 1)) < _thresholdPercentageKilled ) then {_missionComplete = 1};
|
||||||
|
};
|
||||||
|
if (_spawnCratesTiming isEqualTo "atMissionSpawn") then
|
||||||
|
{
|
||||||
|
{
|
||||||
|
if ({[_x] call blck_fnc_crateMoved} count _crates > 0) exitWith
|
||||||
|
{
|
||||||
|
_missionComplete = 1;
|
||||||
|
_crateStolen = true;
|
||||||
|
};
|
||||||
|
}forEach _crates;
|
||||||
|
};
|
||||||
|
if (_secureAsset) then
|
||||||
|
{
|
||||||
|
if !(alive _assetSpawned) then
|
||||||
|
{
|
||||||
|
_missionComplete = 1
|
||||||
|
} else {
|
||||||
|
//if (_assetSpawned getVariable["blck_AIState",0] > 0 && (({alive _x} count _blck_AllMissionAI) isEqualTo 1)) then {_missionComplete = 1};
|
||||||
|
_result = [_blck_AllMissionAI, 1] call blck_fnc_countAliveAI;
|
||||||
|
// _result is an array of [no alive, total spawned];
|
||||||
|
//private _noneAlive = if (_result select 0 isEqualTo 0) then {true} else {false};
|
||||||
|
//private _aiCountBelowThreshold = if ((_result select 0)/(_result select 1) < _thresholdPercentageKilled) then {true} else {false};
|
||||||
|
//diag_log format["_fnc_missionSpawner: _noneAlive = %1 | _result = %2 | PercentageKilled = %3",_noneAlive,_result,(_result select 0)/(_result select 1)];
|
||||||
|
if (((_result select 0)/(_result select 1)) < 0.18) then
|
||||||
|
{
|
||||||
|
if (_assetSpawned getVariable["blck_unguarded",0] isEqualTo 0) then {_assetSpawned setVariable["blck_unguarded",1,true]};
|
||||||
|
if ((_assetSpawned getVariable["blck_AIState",0] > 0)) then {
|
||||||
|
_missionComplete = 1:
|
||||||
|
_assetSpawned allowdamage false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if (_spawnPara) then
|
||||||
|
{
|
||||||
|
|
||||||
|
if ([_coords,_paraTriggerDistance,true] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
_spawnPara = false; // The player gets one try to spawn these.
|
||||||
|
if (random(1) < _chancePara) then //
|
||||||
|
{
|
||||||
|
private _paratroops = [_coords,_noPara,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnParaUnits;
|
||||||
|
if !(isNull _paratroops) then
|
||||||
|
{
|
||||||
|
_blck_AllMissionAI append (units _paratroops);
|
||||||
|
};
|
||||||
|
if (random(1) < _chanceLoot) then
|
||||||
|
{
|
||||||
|
private _extraCrates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_paraLoot,_paraLootCounts]], "atMissionSpawn","atMissionStartAir", "start", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates;
|
||||||
|
if (blck_cleanUpLootChests) then
|
||||||
|
{
|
||||||
|
_objects append _extraCrates;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
uiSleep 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_crateStolen) exitWith
|
||||||
|
{
|
||||||
|
diag_log format["missionSpawner:: (542) Crate Stolen Callening _fnc_endMission - > players near = %1 and ai alive = %2 and crates stolen = %3",[_locations,10,true] call blck_fnc_playerInRangeArray, {alive _x} count _blck_AllMissionAI, _crateStolen];
|
||||||
|
[_mines,_objects,_crates, _blck_AllMissionAI,"Crate Removed from Mission Site Before Mission Completion: Mission Aborted",_blck_localMissionMarker,_coords,_markerClass, 2] call blck_fnc_endMission;
|
||||||
|
};
|
||||||
|
|
||||||
|
if ((_secureAsset) && !(alive _assetSpawned)) exitWith
|
||||||
|
{
|
||||||
|
[_mines,_objects,_crates, _blck_AllMissionAI,_assetKilledMsg,_blck_localMissionMarker,_coords,_markerClass, 2] call blck_fnc_endMission;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_spawnCratesTiming in ["atMissionEndGround","atMissionEndAir"]) then
|
||||||
|
{
|
||||||
|
if (count _missionLootBoxes > 0) then
|
||||||
|
{
|
||||||
|
_crates = [_coords,_missionLootBoxes,_loadCratesTiming,_spawnCratesTiming, "end", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming,_spawnCratesTiming, "end", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 0) then {diag_log format["_fnc_missionSpawner (531): _crates = %1", _crates]};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (blck_cleanUpLootChests) then
|
||||||
|
{
|
||||||
|
_objects append _crates;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 0) then {diag_log format["[blckeagls] missionSpawner:: (428) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]};
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_spawnCratesTiming isEqualTo "atMissionSpawnGround" && _loadCratesTiming isEqualTo "atMissionCompletion") then
|
||||||
|
{
|
||||||
|
{
|
||||||
|
[_x] call blck_fnc_loadMissionCrate;
|
||||||
|
} forEach _crates;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 0) then
|
||||||
|
{
|
||||||
|
diag_log format["[blckeagls] missionSpawner:: (586) Mission completion criteria fulfilled: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
|
||||||
|
diag_log format["missionSpawner :: (587) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled];
|
||||||
|
diag_log format["[blckeagls] missionSpawner:: (588) calling endMission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
private["_result"];
|
||||||
|
// Force passing the mission name for informational purposes.
|
||||||
|
_blck_localMissionMarker set [2, _markerMissionName];
|
||||||
|
if (blck_showCountAliveAI) then
|
||||||
|
{
|
||||||
|
_marker setMarkerText format["%1: All AI Dead",_markerMissionName];
|
||||||
|
{
|
||||||
|
if ((_x select 1) isEqualTo _markerMissionName) exitWith{blck_missionMarkers deleteAt _forEachIndex};
|
||||||
|
}forEach blck_missionMarkers;
|
||||||
|
};
|
||||||
|
|
||||||
|
//diag_log format["_fnc_missionSpawner (557) Build 123: _secureAsset = %1 | {alive _assetSpawned} = %2 | assetType = %3",_secureAsset,alive _assetSpawned, _assetSpawned getVariable["assetType",-1]];
|
||||||
|
|
||||||
|
if (_assetSpawned getVariable["assetType",0] isEqualTo 1) then
|
||||||
|
{
|
||||||
|
//diag_log "Processing Mission End for Hostage Rescue";
|
||||||
|
_assetSpawned setCaptive false;
|
||||||
|
_assetSpawned setVariable["GMSAnimations",[""],true];
|
||||||
|
[_assetSpawned,""] remoteExec["switchMove",-2];;
|
||||||
|
uiSleep 0.1;
|
||||||
|
_assetSpawned enableAI "ALL";
|
||||||
|
private _newPos = (getPos _assetSpawned) getPos [1000, random(360)];
|
||||||
|
//diag_log format["processing domove for hostage with current pos = %1 and new pos = %2",getPos _assetSpawned, _newPos];
|
||||||
|
(group _assetSpawned) setCurrentWaypoint [group _assetSpawned, 0];
|
||||||
|
[group _assetSpawned,0] setWaypointPosition [_newPos,0];
|
||||||
|
[group _assetSpawned,0] setWaypointType "MOVE";
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_assetSpawned getVariable["assetType",0] isEqualTo 2) then
|
||||||
|
{
|
||||||
|
//diag_log format["Processing Mission End for Arrest of Leader %1 with endAnimation %2",_assetSpawned,_assetSpawned getVariable["endAnimation",""]];
|
||||||
|
[_assetSpawned,""] remoteExec["switchMove",-2];
|
||||||
|
_assetSpawned setVariable["GMSAnimations",_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]],true];
|
||||||
|
[_assetSpawned,selectRandom(_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]])] remoteExec["switchMove",-2];
|
||||||
|
};
|
||||||
|
|
||||||
|
//diag_log format["_fnc_missionSpawner (579) Build 123: <calling blck_fnc_endMission> _secureAsset = %1 | {alive _assetSpawned} = %2 | assetType = %3",_secureAsset,alive _assetSpawned, _assetSpawned getVariable["assetType",-1]];
|
||||||
|
|
||||||
|
_result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 0] call blck_fnc_endMission;
|
||||||
|
|
||||||
|
#ifdef blck_debugMode
|
||||||
|
if (blck_debugLevel > 2) then {diag_log format["[blckeagls] missionSpawner:: (507)end of mission: blck_fnc_endMission has returned control to _fnc_missionSpawner"]};
|
||||||
|
#endif
|
||||||
|
diag_log format["_fnc_missionSpawner (643) Mission Completed | _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName];
|
||||||
|
blck_missionsRun = blck_missionsRun + 1;
|
||||||
|
diag_log format["_fnc_missionSpawner (644): Total Dyanamic Land and UMS Run = %1", blck_missionsRun];
|
@ -47,124 +47,20 @@ if (isNil "_hostageConfig") then {_hostageConfig = []};
|
|||||||
if (isNil "_enemyLeaderConfig") then {_enemyLeaderConfig = []};
|
if (isNil "_enemyLeaderConfig") then {_enemyLeaderConfig = []};
|
||||||
if (isNil "_useMines") then {_useMines = blck_useMines;};
|
if (isNil "_useMines") then {_useMines = blck_useMines;};
|
||||||
if (isNil "_weaponList") then {_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout};
|
if (isNil "_weaponList") then {_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout};
|
||||||
if (isNil "_sideArms") then
|
if (isNil "_sideArms") then {_sideArms = [_aiDifficultyLevel] call blck_fnc_selectAISidearms};
|
||||||
{
|
if (isNil "_uniforms") then {_uniforms = [_aiDifficultyLevel] call blck_fnc_selectAIUniforms};
|
||||||
switch (toLower (_aiDifficultyLevel)) do
|
if (isNil "_headGear") then {_headGear = [_aiDifficultyLevel] call blck_fnc_selectAIHeadgear};
|
||||||
{
|
if (isNil "_vests") then {_vests = [_aiDifficultyLevel] call blck_fnc_selectAIVests};
|
||||||
case "blue": {_sideArms = blck_Pistols_blue};
|
if (isNil "_backpacks") then {_backpacks = [_aiDifficultyLevel] call blck_fnc_selectAIBackpacks};
|
||||||
case "red": {_sideArms = blck_Pistols_red};
|
if (isNil "_chanceHeliPatrol") then {_chanceHeliPatrol = [_aiDifficultyLevel] call blck_fnc_selectChanceHeliPatrol};
|
||||||
case "green": {_sideArms = blck_Pistols_green};
|
if (isNil "_noChoppers") then {_noChoppers = [_aiDifficultyLevel] call blck_fnc_selectNumberAirPatrols};
|
||||||
case "orange": {_sideArms = blck_Pistols_orange};
|
if (isNil "_chancePara") then {_chancePara = [_aiDifficultyLevel] call blck_fnc_selectChanceParatroops};
|
||||||
default {_sideArms = blck_Pistols};
|
if (isNil "_missionHelis") then {_missionHelis = [_aiDifficultyLevel] call blck_fnc_selectMissionHelis};
|
||||||
};
|
if (isNil "_noPara") then {_noPara = [_aiDifficultyLevel] call blck_fnc_selectNumberParatroops};
|
||||||
};
|
|
||||||
|
|
||||||
if (isNil "_uniforms") then
|
|
||||||
{
|
|
||||||
switch (toLower (_aiDifficultyLevel)) do
|
|
||||||
{
|
|
||||||
case "blue": {_uniforms = blck_SkinList_blue};
|
|
||||||
case "red": {_uniforms = blck_SkinList_red};
|
|
||||||
case "green": {_uniforms = blck_SkinList_green};
|
|
||||||
case "orange": {_uniforms = blck_SkinList_orange};
|
|
||||||
default {_uniforms = blck_SkinList};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
if (isNil "_headGear") then
|
|
||||||
{
|
|
||||||
switch (toLower (_aiDifficultyLevel)) do
|
|
||||||
{
|
|
||||||
case "blue": {_headGear = blck_headgear_blue};
|
|
||||||
case "red": {_headGear = blck_headgear_red};
|
|
||||||
case "green": {_headGear = blck_headgear_green};
|
|
||||||
case "orange": {_headGear = blck_headgear_orange};
|
|
||||||
default {_headGear = blck_headgear};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
if (isNil "_vests") then
|
|
||||||
{
|
|
||||||
switch (toLower (_aiDifficultyLevel)) do
|
|
||||||
{
|
|
||||||
case "blue": {_vests = blck_vests_blue};
|
|
||||||
case "red": {_vests = blck_vests_red};
|
|
||||||
case "green": {_vests = blck_vests_green};
|
|
||||||
case "orange": {_vests = blck_vests_orange};
|
|
||||||
default {_vests = blck_vests};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
if (isNil "_backpacks") then
|
|
||||||
{
|
|
||||||
switch (toLower (_aiDifficultyLevel)) do
|
|
||||||
{
|
|
||||||
case "blue": {_backpacks = blck_backpacks_blue};
|
|
||||||
case "red": {_backpacks = blck_backpacks_red};
|
|
||||||
case "green": {_backpacks = blck_backpacks_green};
|
|
||||||
case "orange": {_backpacks = blck_backpacks_orange};
|
|
||||||
default {_backpacks = blck_backpacks};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
if (isNil "_chanceHeliPatrol") then
|
|
||||||
{
|
|
||||||
switch (toLower(_aiDifficultyLevel)) do
|
|
||||||
{
|
|
||||||
case "blue": {_chanceHeliPatrol = blck_chanceHeliPatrolBlue};
|
|
||||||
case "red": {_chanceHeliPatrol = blck_chanceHeliPatrolRed};
|
|
||||||
case "green": {_chanceHeliPatrol = blck_chanceHeliPatrolGreen};
|
|
||||||
case "orange": {_chanceHeliPatrol = blck_chanceHeliPatrolOrange};
|
|
||||||
default {_chanceHeliPatrol = 0};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
if (isNil "_noChoppers") then
|
|
||||||
{
|
|
||||||
switch (toLower(_aiDifficultyLevel)) do
|
|
||||||
{
|
|
||||||
case "blue": {_noChoppers = blck_noPatrolHelisBlue};
|
|
||||||
case "red": {_noChoppers = blck_noPatrolHelisRed};
|
|
||||||
case "green": {_noChoppers = blck_noPatrolHelisGreen};
|
|
||||||
case "orange": {_noChoppers = blck_noPatrolHelisOrange};
|
|
||||||
default {_noChoppers = 0};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
if (isNil "_chancePara") then
|
|
||||||
{
|
|
||||||
switch (toLower (_aiDifficultyLevel)) do
|
|
||||||
{
|
|
||||||
case "blue": {_chancePara = blck_chanceParaBlue};
|
|
||||||
case "red": {_chancePara = blck_chanceParaRed};
|
|
||||||
case "green": {_chancePara = blck_chanceParaGreen};
|
|
||||||
case "orange": {_chancePara = blck_chanceParaOrange};
|
|
||||||
default {_chancePara = 0};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
if (isNil "_missionHelis") then
|
|
||||||
{
|
|
||||||
switch (toLower (_aiDifficultyLevel)) do
|
|
||||||
{
|
|
||||||
case "blue": {_missionHelis = blck_patrolHelisBlue};
|
|
||||||
case "red": {_missionHelis = blck_patrolHelisRed};
|
|
||||||
case "green": {_missionHelis = blck_patrolHelisGreen};
|
|
||||||
case "orange": {_missionHelis = blck_patrolHelisOrange};
|
|
||||||
default {_missionHelis = blck_patrolHelisBlue};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
if (isNil "_noPara") then
|
|
||||||
{
|
|
||||||
switch (toLower (_aiDifficultyLevel)) do
|
|
||||||
{
|
|
||||||
case "blue": {_noPara = blck_noParaBlue};
|
|
||||||
case "red": {_noPara = blck_noParaRed};
|
|
||||||
case "green": {_noPara = blck_noParaGreen};
|
|
||||||
case "orange": {_noPara = blck_noParaOrange};
|
|
||||||
default {_noPara = 0};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
if (isNil "_chanceLoot") then {_chanceLoot = 1.0}; //0.5};
|
if (isNil "_chanceLoot") then {_chanceLoot = 1.0}; //0.5};
|
||||||
if (isNil "_paraTriggerDistance") then {_paraTriggerDistance = 400;};
|
if (isNil "_paraTriggerDistance") then {_paraTriggerDistance = 400;};
|
||||||
if (isNil "_paraLoot") then {_paraLoot = blck_BoxLoot_Green};
|
if (isNil "_paraLoot") then {_paraLoot = blck_BoxLoot_Green}; // Add diffiiculty based settings
|
||||||
if (isNil "_paraLootCounts") then {_paraLootCounts = blck_lootCountsRed};
|
if (isNil "_paraLootCounts") then {_paraLootCounts = blck_lootCountsRed}; // Add difficulty based settings
|
||||||
|
|
||||||
|
|
||||||
_objects = [];
|
_objects = [];
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
params["_aiDifficultyLevel"];
|
||||||
|
private["_chancePara"];
|
||||||
|
switch (toLower (_aiDifficultyLevel)) do
|
||||||
|
{
|
||||||
|
case "blue": {_chancePara = blck_chanceParaBlue};
|
||||||
|
case "red": {_chancePara = blck_chanceParaRed};
|
||||||
|
case "green": {_chancePara = blck_chanceParaGreen};
|
||||||
|
case "orange": {_chancePara = blck_chanceParaOrange};
|
||||||
|
default {_chancePara = blck_chanceParaRed};
|
||||||
|
};
|
||||||
|
_chancePara
|
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
params["_aiDifficultyLevel"];
|
||||||
|
private["_backpacks"];
|
||||||
|
switch (toLower (_aiDifficultyLevel)) do
|
||||||
|
{
|
||||||
|
case "blue": {_backpacks = blck_backpacks_blue};
|
||||||
|
case "red": {_backpacks = blck_backpacks_red};
|
||||||
|
case "green": {_backpacks = blck_backpacks_green};
|
||||||
|
case "orange": {_backpacks = blck_backpacks_orange};
|
||||||
|
default {_backpacks = blck_backpacks};
|
||||||
|
};
|
||||||
|
_backpacks
|
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
params["_aiDifficultyLevel"];
|
||||||
|
private["_headgear"];
|
||||||
|
switch (toLower (_aiDifficultyLevel)) do
|
||||||
|
{
|
||||||
|
case "blue": {_headGear = blck_headgear_blue};
|
||||||
|
case "red": {_headGear = blck_headgear_red};
|
||||||
|
case "green": {_headGear = blck_headgear_green};
|
||||||
|
case "orange": {_headGear = blck_headgear_orange};
|
||||||
|
default {_headGear = blck_headgear};
|
||||||
|
};
|
||||||
|
_headgear
|
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
params["_aiDifficultyLevel"];
|
||||||
|
private["_sideArms"];
|
||||||
|
switch (toLower (_aiDifficultyLevel)) do
|
||||||
|
{
|
||||||
|
case "blue": {_sideArms = blck_Pistols_blue};
|
||||||
|
case "red": {_sideArms = blck_Pistols_red};
|
||||||
|
case "green": {_sideArms = blck_Pistols_green};
|
||||||
|
case "orange": {_sideArms = blck_Pistols_orange};
|
||||||
|
default {_sideArms = blck_Pistols};
|
||||||
|
};
|
||||||
|
_sideArms
|
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
params["_aiDifficultyLevel"];
|
||||||
|
private["_uniforms"];
|
||||||
|
switch (toLower (_aiDifficultyLevel)) do
|
||||||
|
{
|
||||||
|
case "blue": {_uniforms = blck_SkinList_blue};
|
||||||
|
case "red": {_uniforms = blck_SkinList_red};
|
||||||
|
case "green": {_uniforms = blck_SkinList_green};
|
||||||
|
case "orange": {_uniforms = blck_SkinList_orange};
|
||||||
|
default {_uniforms = blck_SkinList};
|
||||||
|
};
|
||||||
|
_uniforms
|
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
params["_aiDifficultyLevel"];
|
||||||
|
private["_vests"];
|
||||||
|
switch (toLower (_aiDifficultyLevel)) do
|
||||||
|
{
|
||||||
|
case "blue": {_vests = blck_vests_blue};
|
||||||
|
case "red": {_vests = blck_vests_red};
|
||||||
|
case "green": {_vests = blck_vests_green};
|
||||||
|
case "orange": {_vests = blck_vests_orange};
|
||||||
|
default {_vests = blck_vests};
|
||||||
|
};
|
||||||
|
_vests
|
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
params["_aiDifficultyLevel"];
|
||||||
|
private["_chanceHeliPatrol"];
|
||||||
|
switch (toLower(_aiDifficultyLevel)) do
|
||||||
|
{
|
||||||
|
case "blue": {_chanceHeliPatrol = blck_chanceHeliPatrolBlue};
|
||||||
|
case "red": {_chanceHeliPatrol = blck_chanceHeliPatrolRed};
|
||||||
|
case "green": {_chanceHeliPatrol = blck_chanceHeliPatrolGreen};
|
||||||
|
case "orange": {_chanceHeliPatrol = blck_chanceHeliPatrolOrange};
|
||||||
|
default {_chanceHeliPatrol = 0};
|
||||||
|
};
|
||||||
|
_chanceHeliPatrol
|
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
params["_aiDifficultyLevel"];
|
||||||
|
private["_missionHelis"];
|
||||||
|
switch (toLower (_aiDifficultyLevel)) do
|
||||||
|
{
|
||||||
|
case "blue": {_missionHelis = blck_patrolHelisBlue};
|
||||||
|
case "red": {_missionHelis = blck_patrolHelisRed};
|
||||||
|
case "green": {_missionHelis = blck_patrolHelisGreen};
|
||||||
|
case "orange": {_missionHelis = blck_patrolHelisOrange};
|
||||||
|
default {_missionHelis = blck_patrolHelisBlue};
|
||||||
|
};
|
||||||
|
_missionHelis
|
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
params["_aiDifficultyLevel"];
|
||||||
|
private["_noChoppers"];
|
||||||
|
switch (toLower (_aiDifficultyLevel)) do
|
||||||
|
{
|
||||||
|
case "blue": {_noChoppers = blck_noPatrolHelisBlue};
|
||||||
|
case "red": {_noChoppers = blck_noPatrolHelisRed};
|
||||||
|
case "green": {_noChoppers = blck_noPatrolHelisGreen};
|
||||||
|
case "orange": {_noChoppers = blck_noPatrolHelisOrange};
|
||||||
|
default {_noChoppers = 0};
|
||||||
|
};
|
||||||
|
_noChoppers
|
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
params["_aiDifficultyLevel"];
|
||||||
|
private["_noPara"];
|
||||||
|
switch (toLower (_aiDifficultyLevel)) do
|
||||||
|
{
|
||||||
|
case "blue": {_noPara = blck_noParaBlue};
|
||||||
|
case "red": {_noPara = blck_noParaRed};
|
||||||
|
case "green": {_noPara = blck_noParaGreen};
|
||||||
|
case "orange": {_noPara = blck_noParaOrange};
|
||||||
|
default {_noPara = 0};
|
||||||
|
};
|
||||||
|
_noPara
|
@ -80,7 +80,7 @@ if (blck_useKillMessages) then
|
|||||||
};
|
};
|
||||||
_message =_message + _killstreakMsg;
|
_message =_message + _killstreakMsg;
|
||||||
//diag_log format["[blck] unit killed message is %1",_message,""];
|
//diag_log format["[blck] unit killed message is %1",_message,""];
|
||||||
[["aikilled",_message,"victory"],playableUnits] call blck_fnc_messageplayers;
|
[["aikilled",_message,"victory"],allPlayers] call blck_fnc_messageplayers;
|
||||||
};
|
};
|
||||||
|
|
||||||
[_unit,_killer] call blck_fnc_rewardKiller;
|
[_unit,_killer] call blck_fnc_rewardKiller;
|
||||||
|
@ -1,9 +1,23 @@
|
|||||||
|
/*
|
||||||
|
Delete a unit.
|
||||||
|
by Ghostrider
|
||||||
|
Last updated 1/22/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";
|
||||||
|
|
||||||
params["_veh"];
|
params["_veh"];
|
||||||
//diag_log format["blck_fnc_deleteAIvehicle: _veh %1 deleted",_veh];
|
//diag_log format["blck_fnc_deleteAIvehicle: _veh %1 deleted",_veh];
|
||||||
{
|
{
|
||||||
_veh removeAllEventHandlers _x;
|
_veh removeAllEventHandlers _x;
|
||||||
}forEach ["Hit","HitPart","GetIn","GetOut","Fired","FiredNear","HandleDamage","Reloaded"];
|
}forEach ["Hit","HitPart","GetIn","GetOut","Fired","FiredNear","HandleDamage","Reloaded"];
|
||||||
|
{
|
||||||
|
_veh removeAllMPEventHandlers _x;
|
||||||
|
}forEach ["MPHit","MPKilled"];
|
||||||
blck_monitoredVehicles = blck_monitoredVehicles - [_veh];
|
blck_monitoredVehicles = blck_monitoredVehicles - [_veh];
|
||||||
deleteVehicle _veh;
|
deleteVehicle _veh;
|
||||||
|
@ -50,6 +50,17 @@ blck_fnc_MessagePlayers = compileFinal preprocessFileLineNumbers "\q\addons\cus
|
|||||||
|
|
||||||
// Mission-related functions
|
// Mission-related functions
|
||||||
blck_fnc_selectAILoadout = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_selectAILoadout.sqf";
|
blck_fnc_selectAILoadout = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_selectAILoadout.sqf";
|
||||||
|
blck_fnc_selectAISidearms = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_selectAISidearms.sqf";
|
||||||
|
blck_fnc_selectAIUniforms = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_selectAIUniforms.sqf";
|
||||||
|
blck_fnc_selectAIHeadgear = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_selectAIHeadgear.sqf";
|
||||||
|
blck_fnc_selectAIVests = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_selectAIVests.sqf";
|
||||||
|
blck_fnc_selectAIBackpacks = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_selectAIBackpacks.sqf";
|
||||||
|
blck_fnc_selectChanceHeliPatrol = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_selectChanceHeliPatrol.sqf";
|
||||||
|
blck_fnc_selectMissionHelis = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_selectMissionHelis.sqf";
|
||||||
|
blck_fnc_selectNumberAirPatrols = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_selectNumberAirPatrols.sqf";
|
||||||
|
blck_fnc_selectNumberParatroops = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_selectNumberParatroops.sqf";
|
||||||
|
blck_fnc_selectChanceParatroops = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_selecctChanceParatroops.sqf";
|
||||||
|
|
||||||
blck_fnc_addMissionToQue = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_addMissionToQue.sqf"; //
|
blck_fnc_addMissionToQue = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_addMissionToQue.sqf"; //
|
||||||
blck_fnc_updateMissionQue = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_updateMissionQue.sqf"; //
|
blck_fnc_updateMissionQue = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_updateMissionQue.sqf"; //
|
||||||
blck_fnc_spawnPendingMissions = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnPendingMissions.sqf"; //
|
blck_fnc_spawnPendingMissions = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnPendingMissions.sqf"; //
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
#include"\q\addons\custom_server\Configs\blck_defines.hpp";
|
#include"\q\addons\custom_server\Configs\blck_defines.hpp";
|
||||||
|
|
||||||
blck_debugON = false;
|
blck_debugON = true;
|
||||||
blck_debugLevel = 0; // Sets level of detail for debugging info - WIP.
|
blck_debugLevel = 0; // Sets level of detail for debugging info - WIP.
|
||||||
blck_minFPS = 8;
|
blck_minFPS = 8;
|
||||||
|
|
||||||
|
@ -281,6 +281,7 @@
|
|||||||
blck_minimumPatrolRadius = 22; // AI will patrol within a circle with radius of approximately min-max meters. note that because of the way waypoints are completed they may more more or less than this distance.
|
blck_minimumPatrolRadius = 22; // AI will patrol within a circle with radius of approximately min-max meters. note that because of the way waypoints are completed they may more more or less than this distance.
|
||||||
blck_maximumPatrolRadius = 35;
|
blck_maximumPatrolRadius = 35;
|
||||||
|
|
||||||
|
|
||||||
//This defines how long after an AI dies that it's body disappears.
|
//This defines how long after an AI dies that it's body disappears.
|
||||||
blck_bodyCleanUpTimer = 60*40; // time in seconds after which dead AI bodies are deleted
|
blck_bodyCleanUpTimer = 60*40; // time in seconds after which dead AI bodies are deleted
|
||||||
// Each time an AI is killed, the location of the killer will be revealed to all AI within this range of the killed AI, set to -1 to disable
|
// Each time an AI is killed, the location of the killer will be revealed to all AI within this range of the killed AI, set to -1 to disable
|
||||||
@ -350,7 +351,7 @@
|
|||||||
waitUntil {(isNil "blck_configsEpochLoaded") isEqualTo false;};
|
waitUntil {(isNil "blck_configsEpochLoaded") isEqualTo false;};
|
||||||
waitUntil{blck_configsEpochLoaded};
|
waitUntil{blck_configsEpochLoaded};
|
||||||
blck_configsEpochLoaded = nil;
|
blck_configsEpochLoaded = nil;
|
||||||
diag_log "[blckeagles] Running getTraderCitiesEpoch to get location of trader cities";
|
//diag_log "[blckeagles] Running getTraderCitiesEpoch to get location of trader cities";
|
||||||
execVM "\q\addons\custom_server\Compiles\Functions\GMS_fnc_getTraderCitesEpoch.sqf";
|
execVM "\q\addons\custom_server\Compiles\Functions\GMS_fnc_getTraderCitesEpoch.sqf";
|
||||||
};
|
};
|
||||||
if (_modType isEqualTo "Exile") then
|
if (_modType isEqualTo "Exile") then
|
||||||
@ -362,4 +363,12 @@
|
|||||||
blck_configsExileLoaded = nil;
|
blck_configsExileLoaded = nil;
|
||||||
if (blck_blacklistTraderCities || blck_blacklistSpawns || blck_listConcreteMixerZones) then {execVM "\q\addons\custom_server\Compiles\Functions\GMS_fnc_getTraderCitesExile.sqf";};
|
if (blck_blacklistTraderCities || blck_blacklistSpawns || blck_listConcreteMixerZones) then {execVM "\q\addons\custom_server\Compiles\Functions\GMS_fnc_getTraderCitesExile.sqf";};
|
||||||
};
|
};
|
||||||
|
if (true /*blck_useConfigsGeneratedLoadouts*/) then
|
||||||
|
{
|
||||||
|
diag_log format["[blckeagles] Dynamic Configs Enabled"];
|
||||||
|
execVM "\q\addons\custom_server\Configs\blck_dynamicConfigs.sqf";
|
||||||
|
waitUntil {(isNil "blck_configsExileLoaded") isEqualTo false;};
|
||||||
|
waitUntil{blck_dynamicConfigsLoaded};
|
||||||
|
blck_dynamicConfigsLoaded = nil;
|
||||||
|
};
|
||||||
blck_configsLoaded = true;
|
blck_configsLoaded = true;
|
||||||
|
@ -47,6 +47,10 @@ AI WEAPONS, UNIFORMS, VESTS AND GEAR
|
|||||||
|
|
||||||
blck_allowSalesAtBlackMktTraders = true; // Allow vehicles to be sold at Halvjes black market traders.
|
blck_allowSalesAtBlackMktTraders = true; // Allow vehicles to be sold at Halvjes black market traders.
|
||||||
|
|
||||||
|
// When true, AI loadouts will be set from the class names in CfgPricing rather than the settings in the mod-specific configuration files
|
||||||
|
blck_useConfigsGeneratedLoadouts = true;
|
||||||
|
blck_maximumItemPriceInAI_Loadouts = 100;
|
||||||
|
|
||||||
_blck_lightlyArmed_ARMA3 = [
|
_blck_lightlyArmed_ARMA3 = [
|
||||||
"B_G_Offroad_01_armed_F",
|
"B_G_Offroad_01_armed_F",
|
||||||
"O_G_Offroad_01_armed_F",
|
"O_G_Offroad_01_armed_F",
|
||||||
@ -674,7 +678,11 @@ for examples of how you can do this see \Major\Compositions.sqf
|
|||||||
["Heal_EPOCH",1,2],["Defib_EPOCH",1,2],["Repair_EPOCH",1,4],["FAK",1,4],["VehicleRepair",1,3],["Rangefinder",1,3],["ItemJade",1,2],["ItemQuartz",1,2],["ItemRuby",1,2],["ItemSapphire",1,2],
|
["Heal_EPOCH",1,2],["Defib_EPOCH",1,2],["Repair_EPOCH",1,4],["FAK",1,4],["VehicleRepair",1,3],["Rangefinder",1,3],["ItemJade",1,2],["ItemQuartz",1,2],["ItemRuby",1,2],["ItemSapphire",1,2],
|
||||||
["ItemKiloHemp",1,2],["ItemRuby",1,2],["ItemSilverBar",1,2],["ItemEmerald",1,2],["ItemTopaz",1,2],["ItemOnyx",1,2],["ItemSapphire",1,2],["ItemAmethyst",1,2],
|
["ItemKiloHemp",1,2],["ItemRuby",1,2],["ItemSilverBar",1,2],["ItemEmerald",1,2],["ItemTopaz",1,2],["ItemOnyx",1,2],["ItemSapphire",1,2],["ItemAmethyst",1,2],
|
||||||
["ItemSodaRbull",1,3],["ItemSodaOrangeSherbet",1,3],["ItemSodaPurple",1,3],["ItemSodaMocha",1,3],["ItemSodaBurst",1,3],
|
["ItemSodaRbull",1,3],["ItemSodaOrangeSherbet",1,3],["ItemSodaPurple",1,3],["ItemSodaMocha",1,3],["ItemSodaBurst",1,3],
|
||||||
["CookedChicken_EPOCH",1,3],["CookedGoat_EPOCH",1,3],["CookedSheep_EPOCH",1,3],["FoodSnooter",1,3],["FoodMeeps",1,3],["FoodBioMeat",1,3],["ItemTuna",1,3],["ItemSeaBass",1,3],["ItemTrout",1,3]
|
["CookedChicken_EPOCH",1,3],["CookedGoat_EPOCH",1,3],["CookedSheep_EPOCH",1,3],["FoodSnooter",1,3],["FoodMeeps",1,3],["FoodBioMeat",1,3],["ItemTuna",1,3],["ItemSeaBass",1,3],["ItemTrout",1,3],
|
||||||
|
"Towelette" , "ItemVitamins", "morphine_epoch", "iodide_pills_epoch", "adrenaline_epoch",
|
||||||
|
"caffeinepills_epoch", "orlistat_epoch", "ItemCanteen_Empty", "ItemCanteen_Clean", "ItemBottlePlastic_Empty",
|
||||||
|
"ItemBottlePlastic_Clean", "atropine_epoch", "ItemWaterPurificationTablets", "ItemPainKillers", "ItemDefibrillator",
|
||||||
|
"ItemBloodBag_Empty", "ItemBloodBag_Full", "ItemAntibiotic", "nanite_cream_epoch", "nanite_pills_epoch"
|
||||||
],
|
],
|
||||||
[ // Backpacks
|
[ // Backpacks
|
||||||
["B_AssaultPack_dgtl",1,2],["B_AssaultPack_khk",1,2],["B_AssaultPack_mcamo",1,2],["B_AssaultPack_ocamo",1,2],["B_AssaultPack_rgr",1,2],["B_AssaultPack_sgg",1,2],
|
["B_AssaultPack_dgtl",1,2],["B_AssaultPack_khk",1,2],["B_AssaultPack_mcamo",1,2],["B_AssaultPack_ocamo",1,2],["B_AssaultPack_rgr",1,2],["B_AssaultPack_sgg",1,2],
|
||||||
@ -798,7 +806,11 @@ for examples of how you can do this see \Major\Compositions.sqf
|
|||||||
["Heal_EPOCH",1,2],["Defib_EPOCH",1,2],["Repair_EPOCH",1,2],["FAK",1,2],["FAK",1,2],["FAK",1,2],["FAK",1,2],["FAK",1,2],["FAK",1,2],["VehicleRepair",1,3],["Rangefinder",1,3],
|
["Heal_EPOCH",1,2],["Defib_EPOCH",1,2],["Repair_EPOCH",1,2],["FAK",1,2],["FAK",1,2],["FAK",1,2],["FAK",1,2],["FAK",1,2],["FAK",1,2],["VehicleRepair",1,3],["Rangefinder",1,3],
|
||||||
["ItemKiloHemp",1,2],["ItemRuby",1,2],["ItemSilverBar",1,2],["ItemGoldBar10oz",1,2],
|
["ItemKiloHemp",1,2],["ItemRuby",1,2],["ItemSilverBar",1,2],["ItemGoldBar10oz",1,2],
|
||||||
["ItemSodaRbull",1,3],["ItemSodaOrangeSherbet",1,3],["ItemSodaPurple",1,3],["ItemSodaMocha",1,3],["ItemSodaBurst",1,3],
|
["ItemSodaRbull",1,3],["ItemSodaOrangeSherbet",1,3],["ItemSodaPurple",1,3],["ItemSodaMocha",1,3],["ItemSodaBurst",1,3],
|
||||||
["CookedChicken_EPOCH",1,3],["CookedGoat_EPOCH",1,3],["CookedSheep_EPOCH",1,3],["FoodSnooter",1,3],["FoodMeeps",1,3],["FoodBioMeat",1,3],["ItemTuna",1,3],["ItemSeaBass",1,3],["ItemTrout",1,3]
|
["CookedChicken_EPOCH",1,3],["CookedGoat_EPOCH",1,3],["CookedSheep_EPOCH",1,3],["FoodSnooter",1,3],["FoodMeeps",1,3],["FoodBioMeat",1,3],["ItemTuna",1,3],["ItemSeaBass",1,3],["ItemTrout",1,3],
|
||||||
|
"Towelette" , "ItemVitamins", "morphine_epoch", "iodide_pills_epoch", "adrenaline_epoch",
|
||||||
|
"caffeinepills_epoch", "orlistat_epoch", "ItemCanteen_Empty", "ItemCanteen_Clean", "ItemBottlePlastic_Empty",
|
||||||
|
"ItemBottlePlastic_Clean", "atropine_epoch", "ItemWaterPurificationTablets", "ItemPainKillers", "ItemDefibrillator",
|
||||||
|
"ItemBloodBag_Empty", "ItemBloodBag_Full", "ItemAntibiotic", "nanite_cream_epoch", "nanite_pills_epoch"
|
||||||
],
|
],
|
||||||
[ // Backpacks
|
[ // Backpacks
|
||||||
["B_AssaultPack_dgtl",1,2],["B_AssaultPack_khk",1,2],["B_AssaultPack_mcamo",1,2],["B_AssaultPack_ocamo",1,2],["B_AssaultPack_rgr",1,2],["B_AssaultPack_sgg",1,2],
|
["B_AssaultPack_dgtl",1,2],["B_AssaultPack_khk",1,2],["B_AssaultPack_mcamo",1,2],["B_AssaultPack_ocamo",1,2],["B_AssaultPack_rgr",1,2],["B_AssaultPack_sgg",1,2],
|
||||||
@ -919,7 +931,11 @@ for examples of how you can do this see \Major\Compositions.sqf
|
|||||||
[//Items
|
[//Items
|
||||||
["Heal_EPOCH",1,2],["Defib_EPOCH",1,2],["Repair_EPOCH",1,2],["FAK",1,5],["VehicleRepair",1,5],
|
["Heal_EPOCH",1,2],["Defib_EPOCH",1,2],["Repair_EPOCH",1,2],["FAK",1,5],["VehicleRepair",1,5],
|
||||||
["ItemSodaRbull",1,3],["ItemSodaOrangeSherbet",1,3],["ItemSodaPurple",1,3],["ItemSodaMocha",1,3],["ItemSodaBurst",1,3],
|
["ItemSodaRbull",1,3],["ItemSodaOrangeSherbet",1,3],["ItemSodaPurple",1,3],["ItemSodaMocha",1,3],["ItemSodaBurst",1,3],
|
||||||
["CookedChicken_EPOCH",1,3],["CookedGoat_EPOCH",1,3],["CookedSheep_EPOCH",1,3],["FoodSnooter",1,3],["FoodMeeps",1,3],["FoodBioMeat",1,3],["ItemTuna",1,3],["ItemSeaBass",1,3],["ItemTrout",1,3]
|
["CookedChicken_EPOCH",1,3],["CookedGoat_EPOCH",1,3],["CookedSheep_EPOCH",1,3],["FoodSnooter",1,3],["FoodMeeps",1,3],["FoodBioMeat",1,3],["ItemTuna",1,3],["ItemSeaBass",1,3],["ItemTrout",1,3],
|
||||||
|
"Towelette" , "ItemVitamins", "morphine_epoch", "iodide_pills_epoch", "adrenaline_epoch",
|
||||||
|
"caffeinepills_epoch", "orlistat_epoch", "ItemCanteen_Empty", "ItemCanteen_Clean", "ItemBottlePlastic_Empty",
|
||||||
|
"ItemBottlePlastic_Clean", "atropine_epoch", "ItemWaterPurificationTablets", "ItemPainKillers", "ItemDefibrillator",
|
||||||
|
"ItemBloodBag_Empty", "ItemBloodBag_Full", "ItemAntibiotic", "nanite_cream_epoch", "nanite_pills_epoch"
|
||||||
],
|
],
|
||||||
[ // Backpacks
|
[ // Backpacks
|
||||||
["B_AssaultPack_dgtl",0,2],["B_AssaultPack_khk",0,2],["B_AssaultPack_mcamo",0,2],["B_AssaultPack_ocamo",0,2],["B_AssaultPack_rgr",0,2],["B_AssaultPack_sgg",0,2],
|
["B_AssaultPack_dgtl",0,2],["B_AssaultPack_khk",0,2],["B_AssaultPack_mcamo",0,2],["B_AssaultPack_ocamo",0,2],["B_AssaultPack_rgr",0,2],["B_AssaultPack_sgg",0,2],
|
||||||
@ -1038,7 +1054,11 @@ for examples of how you can do this see \Major\Compositions.sqf
|
|||||||
["ItemSodaRbull",1,3],["ItemSodaOrangeSherbet",1,3],["ItemSodaPurple",1,3],["ItemSodaMocha",1,3],["ItemSodaBurst",1,3],["ItemSodaAlpineDude",1,3],
|
["ItemSodaRbull",1,3],["ItemSodaOrangeSherbet",1,3],["ItemSodaPurple",1,3],["ItemSodaMocha",1,3],["ItemSodaBurst",1,3],["ItemSodaAlpineDude",1,3],
|
||||||
["CookedChicken_EPOCH",1,3],["CookedGoat_EPOCH",1,3],["CookedSheep_EPOCH",1,3],
|
["CookedChicken_EPOCH",1,3],["CookedGoat_EPOCH",1,3],["CookedSheep_EPOCH",1,3],
|
||||||
["FoodSnooter",1,3],["FoodMeeps",1,3],["FoodBioMeat",1,3],["ItemTuna",1,3],["ItemSeaBass",1,3],["ItemTrout",1,3],["ItemPowderMilk",1,3],["ItemRicebox",1,3],
|
["FoodSnooter",1,3],["FoodMeeps",1,3],["FoodBioMeat",1,3],["ItemTuna",1,3],["ItemSeaBass",1,3],["ItemTrout",1,3],["ItemPowderMilk",1,3],["ItemRicebox",1,3],
|
||||||
["ItemCereals",1,3],["krypto_candy_epoch",1,3],["ItemBakedBeans",1,3],["HotAxeSauce_epoch",1,3]
|
["ItemCereals",1,3],["krypto_candy_epoch",1,3],["ItemBakedBeans",1,3],["HotAxeSauce_epoch",1,3],
|
||||||
|
"Towelette" , "ItemVitamins", "morphine_epoch", "iodide_pills_epoch", "adrenaline_epoch",
|
||||||
|
"caffeinepills_epoch", "orlistat_epoch", "ItemCanteen_Empty", "ItemCanteen_Clean", "ItemBottlePlastic_Empty",
|
||||||
|
"ItemBottlePlastic_Clean", "atropine_epoch", "ItemWaterPurificationTablets", "ItemPainKillers", "ItemDefibrillator",
|
||||||
|
"ItemBloodBag_Empty", "ItemBloodBag_Full", "ItemAntibiotic", "nanite_cream_epoch", "nanite_pills_epoch"
|
||||||
],
|
],
|
||||||
[ // Backpacks
|
[ // Backpacks
|
||||||
["B_AssaultPack_dgtl",0,2],["B_AssaultPack_khk",0,2],["B_AssaultPack_mcamo",0,2],["B_AssaultPack_ocamo",0,2],["B_AssaultPack_rgr",0,2],["B_AssaultPack_sgg",0,2],
|
["B_AssaultPack_dgtl",0,2],["B_AssaultPack_khk",0,2],["B_AssaultPack_mcamo",0,2],["B_AssaultPack_ocamo",0,2],["B_AssaultPack_rgr",0,2],["B_AssaultPack_sgg",0,2],
|
||||||
|
@ -45,8 +45,13 @@ AI WEAPONS, UNIFORMS, VESTS AND GEAR
|
|||||||
blck_crateMoneyRed = [175, 300];
|
blck_crateMoneyRed = [175, 300];
|
||||||
blck_crateMoneyGreen = [300, 500];
|
blck_crateMoneyGreen = [300, 500];
|
||||||
blck_crateMoneyOrange = [500, 750];
|
blck_crateMoneyOrange = [500, 750];
|
||||||
|
|
||||||
blck_allowSalesAtBlackMktTraders = true; // Allow vehicles to be sold at Halvjes black market traders.
|
blck_allowSalesAtBlackMktTraders = true; // Allow vehicles to be sold at Halvjes black market traders.
|
||||||
|
|
||||||
|
// When true, AI loadouts will be set from the class names in CfgPricing rather than the settings in the mod-specific configuration files
|
||||||
|
blck_useConfigsGeneratedLoadouts = true;
|
||||||
|
blck_maximumItemPriceInAI_Loadouts = 100;
|
||||||
|
|
||||||
_blck_lightlyArmed_ARMA3 = [
|
_blck_lightlyArmed_ARMA3 = [
|
||||||
"B_G_Offroad_01_armed_F",
|
"B_G_Offroad_01_armed_F",
|
||||||
"O_G_Offroad_01_armed_F",
|
"O_G_Offroad_01_armed_F",
|
||||||
|
@ -55,6 +55,10 @@ AI WEAPONS, UNIFORMS, VESTS AND GEAR
|
|||||||
blck_crateMoneyGreen = [300, 500];
|
blck_crateMoneyGreen = [300, 500];
|
||||||
blck_crateMoneyOrange = [500, 750];
|
blck_crateMoneyOrange = [500, 750];
|
||||||
|
|
||||||
|
// When true, AI loadouts will be set from the class names in CfgPricing rather than the settings in the mod-specific configuration files
|
||||||
|
blck_useConfigsGeneratedLoadouts = true;
|
||||||
|
blck_maximumItemPriceInAI_Loadouts = 1000;
|
||||||
|
|
||||||
_blck_armed_vehicles_Exile = [
|
_blck_armed_vehicles_Exile = [
|
||||||
"Exile_Car_BTR40_MG_Green",
|
"Exile_Car_BTR40_MG_Green",
|
||||||
"Exile_Car_HMMWV_M134_Green",
|
"Exile_Car_HMMWV_M134_Green",
|
||||||
|
@ -47,6 +47,10 @@ AI WEAPONS, UNIFORMS, VESTS AND GEAR
|
|||||||
blck_crateMoneyGreen = [300, 500];
|
blck_crateMoneyGreen = [300, 500];
|
||||||
blck_crateMoneyOrange = [500, 750];
|
blck_crateMoneyOrange = [500, 750];
|
||||||
|
|
||||||
|
// When true, AI loadouts will be set from the class names in CfgPricing rather than the settings in the mod-specific configuration files
|
||||||
|
blck_useConfigsGeneratedLoadouts = true;
|
||||||
|
blck_maximumItemPriceInAI_Loadouts = 1000;
|
||||||
|
|
||||||
_blck_armed_vehicles_Exile = [
|
_blck_armed_vehicles_Exile = [
|
||||||
"Exile_Car_BTR40_MG_Green",
|
"Exile_Car_BTR40_MG_Green",
|
||||||
"Exile_Car_HMMWV_M134_Green",
|
"Exile_Car_HMMWV_M134_Green",
|
||||||
|
@ -367,4 +367,12 @@
|
|||||||
blck_configsExileLoaded = nil;
|
blck_configsExileLoaded = nil;
|
||||||
if (blck_blacklistTraderCities || blck_blacklistSpawns || blck_listConcreteMixerZones) then {execVM "\q\addons\custom_server\Compiles\Functions\GMS_fnc_getTraderCitesExile.sqf";};
|
if (blck_blacklistTraderCities || blck_blacklistSpawns || blck_listConcreteMixerZones) then {execVM "\q\addons\custom_server\Compiles\Functions\GMS_fnc_getTraderCitesExile.sqf";};
|
||||||
};
|
};
|
||||||
|
if (blck_useConfigsGeneratedLoadouts) then
|
||||||
|
{
|
||||||
|
diag_log format["[blckeagles] Dynamic Configs Enabled"];
|
||||||
|
execVM "\q\addons\custom_server\Configs\blck_dynamicConfigs.sqf";
|
||||||
|
waitUntil {(isNil "blck_configsExileLoaded") isEqualTo false;};
|
||||||
|
waitUntil{blck_dynamicConfigsLoaded};
|
||||||
|
blck_dynamicConfigsLoaded = nil;
|
||||||
|
};
|
||||||
blck_configsLoaded = true;
|
blck_configsLoaded = true;
|
||||||
|
222
@GMS/addons/custom_server/Configs/blck_dynamicConfigs.sqf
Normal file
222
@GMS/addons/custom_server/Configs/blck_dynamicConfigs.sqf
Normal file
@ -0,0 +1,222 @@
|
|||||||
|
/*
|
||||||
|
for ghostridergaming
|
||||||
|
By Ghostrider [GRG]
|
||||||
|
Copyright 2016
|
||||||
|
|
||||||
|
--------------------------
|
||||||
|
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";
|
||||||
|
|
||||||
|
blck_blacklistedVests = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
blck_blacklistedUniforms = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
blck_blacklistedBackpacks = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
blck_blacklistedHeadgear = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
blck_blacklistedPrimaryWeapons = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
blck_blacklistedSecondaryWeapons = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
blck_blacklistedLaunchersAndSwingWeapons = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
blck_blacklistedOptics = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
blck_blacklistedAttachments = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
blck_blacklistedItems = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
blck_headgearList = [];
|
||||||
|
blck_SkinList = [];
|
||||||
|
blck_vests = [];
|
||||||
|
blck_backpacks = [];
|
||||||
|
blck_Pistols = [];
|
||||||
|
blck_primaryWeapons = [];
|
||||||
|
//blck_throwable = [];
|
||||||
|
|
||||||
|
_allWeaponRoots = ["Pistol","Rifle","Launcher"];
|
||||||
|
_allWeaponTypes = ["AssaultRifle","MachineGun","SniperRifle","Shotgun","Rifle","Pistol","SubmachineGun","Handgun","MissileLauncher","RocketLauncher","Throw","GrenadeCore"];
|
||||||
|
_addedBaseNames = [];
|
||||||
|
_allBannedWeapons = [];
|
||||||
|
_wpnAR = []; //Assault Rifles
|
||||||
|
_wpnARG = []; //Assault Rifles with GL
|
||||||
|
_wpnLMG = []; //Light Machine Guns
|
||||||
|
_wpnSMG = []; //Sub Machine Guns
|
||||||
|
_wpnDMR = []; //Designated Marksman Rifles
|
||||||
|
_wpnLauncher = [];
|
||||||
|
_wpnSniper = []; //Sniper rifles
|
||||||
|
_wpnHandGun = []; //HandGuns/Pistols
|
||||||
|
_wpnShotGun = []; //Shotguns
|
||||||
|
_wpnThrow = []; // throwables
|
||||||
|
_wpnUnknown = []; //Misc
|
||||||
|
_wpnUnderbarrel = [];
|
||||||
|
_wpnMagazines = [];
|
||||||
|
_wpnOptics = [];
|
||||||
|
_wpnPointers = [];
|
||||||
|
_wpnMuzzles = [];
|
||||||
|
_allBannedWearables = [];
|
||||||
|
_uniforms = [];
|
||||||
|
_headgear = [];
|
||||||
|
_glasses = [];
|
||||||
|
_masks = [];
|
||||||
|
_backpacks = [];
|
||||||
|
_vests = [];
|
||||||
|
_goggles = [];
|
||||||
|
_NVG = [];
|
||||||
|
_misc = [];
|
||||||
|
_baseClasses = [];
|
||||||
|
|
||||||
|
_classnameList = [];
|
||||||
|
diag_log format["blck_modType = %1",blck_modType];
|
||||||
|
if (blck_modType isEqualTo "Epoch") then
|
||||||
|
{
|
||||||
|
_classnameList = (missionConfigFile >> "CfgPricing" ) call BIS_fnc_getCfgSubClasses;
|
||||||
|
};
|
||||||
|
if (blck_modType isEqualTo "Exile") then
|
||||||
|
{
|
||||||
|
_classnameList = (missionConfigFile >> "CfgExileArsenal" ) call BIS_fnc_getCfgSubClasses;
|
||||||
|
};
|
||||||
|
diag_log format["_fnc_dynamicConfigsConfigurator: count _classnameList = %1",count _classnameList];
|
||||||
|
{
|
||||||
|
private _temp = [_x] call bis_fnc_itemType;
|
||||||
|
//diag_log _temp;
|
||||||
|
_itemCategory = _temp select 0;
|
||||||
|
_itemType = _temp select 1;
|
||||||
|
_price = 1000000;
|
||||||
|
if (blck_modType isEqualTo "Epoch") then
|
||||||
|
{
|
||||||
|
_price = getNumber(missionConfigFile >> "CfgPricing" >> _x >> "price");
|
||||||
|
};
|
||||||
|
if (blck_modType isEqualTo "Exile") then
|
||||||
|
{
|
||||||
|
_price = getNumber(missionConfigFile >> "CfgExileArsenal" >> _x >> "price");
|
||||||
|
};
|
||||||
|
//diag_log format["_fnc_dynamicConfigsConfigurator: _price = %1",_price];
|
||||||
|
if (_price < blck_maximumItemPriceInAI_Loadouts) then
|
||||||
|
{
|
||||||
|
//if (_itemCategory != "") then {diag_log format["_fnc_dynamicConfigsConfigurator: _itemCategory = %1 | _itemType = %2",_itemCategory,_itemType]};
|
||||||
|
if (_itemCategory isEqualTo "Weapon") then
|
||||||
|
{
|
||||||
|
switch (_itemType) do
|
||||||
|
{
|
||||||
|
case "AssaultRifle": {if !(_x in blck_blacklistedSecondaryWeapons) then {_wpnAR pushBack _x}};
|
||||||
|
case "MachineGun": {if !(_x in blck_blacklistedSecondaryWeapons) then {_wpnLMG pushBack _x}};
|
||||||
|
case "SubmachineGun": {if !(_x in blck_blacklistedSecondaryWeapons) then {_wpnSMG pushBack _x}};
|
||||||
|
case "Shotgun": {if !(_x in blck_blacklistedSecondaryWeapons) then {_wpnShotGun pushBack _x}};
|
||||||
|
case "Rifle": {if !(_x in blck_blacklistedSecondaryWeapons) then {_wpnAR pushBack _x}};
|
||||||
|
case "SniperRifle": {if !(_x in blck_blacklistedSecondaryWeapons) then {_wpnSniper pushBack _x}};
|
||||||
|
case "Handgun": {if !(_x in blck_blacklistedSecondaryWeapons) then {_wpnHandGun pushBack _x}};
|
||||||
|
case "Launcher": {if !(_x in blck_blacklistedLaunchersAndSwingWeapons) then {_wpnLauncher pushBack _x}};
|
||||||
|
case "RocketLauncher": {if !(_x in blck_blacklistedLaunchersAndSwingWeapons) then {_wpnLauncher pushBack _x}};
|
||||||
|
case "Throw": {if !(_x in blck_blacklistedItems) then {_wpnThrow pushBack _x}};
|
||||||
|
//case "": {if !(_x in ) then { pushBack _x}};
|
||||||
|
//case "": {if !(_x in ) then { pushBack _x}};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_itemCategory isEqualTo "Item") then
|
||||||
|
{
|
||||||
|
//diag_log format["Evaluating Item class name %1",_x];
|
||||||
|
switch (_itemType) do
|
||||||
|
{
|
||||||
|
case "AccessoryMuzzle": {if !(_x in blck_blacklistedAttachments) then {_wpnMuzzles pushBack _x}};
|
||||||
|
case "AccessoryPointer": {if !(_x in blck_blacklistedAttachments) then {_wpnPointers pushBack _x}};
|
||||||
|
case "AccessorySights": {if !(_x in blck_blacklistedOptics) then {_wpnOptics pushBack _x}};
|
||||||
|
case "AccessoryBipod": {if !(_x in blck_blacklistedAttachments) then {_wpnUnderbarrel pushBack _x}};
|
||||||
|
case "Binocular": {if !(_x in blck_blacklistedItems) then {_misc pushBack _x}};
|
||||||
|
case "Compass": {if !(_x in blck_blacklistedItems) then {_misc pushBack _x}};
|
||||||
|
case "GPS": {if !(_x in blck_blacklistedItems) then {_misc pushBack _x}};
|
||||||
|
case "NVGoggles": {if !(_x in blck_blacklistedItems) then {_NVG pushBack _x}};
|
||||||
|
//case "": {if !(_x in ) then { pushBack _x}};
|
||||||
|
//case "": {if !(_x in ) then { pushBack _x}};
|
||||||
|
//case "": {if !(_x in ) then { pushBack _x}};
|
||||||
|
//case "": {if !(_x in ) then { pushBack _x}};
|
||||||
|
//case "": {if !(_x in ) then { pushBack _x}};
|
||||||
|
//case "": {if !(_x in ) then { pushBack _x}};
|
||||||
|
//case "": {if !(_x in ) then { pushBack _x}};
|
||||||
|
//case "": {if !(_x in ) then { pushBack _x}};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
if (_itemCategory isEqualTo "Equipment") then
|
||||||
|
{
|
||||||
|
//diag_log format["Evaluating Equipment class name %1",_x];
|
||||||
|
switch (_itemType) do
|
||||||
|
{
|
||||||
|
case "Glasses": {if !(_x in blck_blacklistedItems) then {_glasses pushBack _x}};
|
||||||
|
case "Headgear": {if !(_x in blck_blacklistedHeadgear) then {_headgear pushBack _x}};
|
||||||
|
case "Vest": {if !(_x in blck_blacklistedVests) then {_vests pushBack _x}};
|
||||||
|
case "Uniform": {if !(_x in blck_blacklistedUniforms) then {_uniforms pushBack _x}};
|
||||||
|
case "Backpack": {if !(_x in blck_blacklistedBackpacks) then {_backpacks pushBack _x}};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _classnameList;
|
||||||
|
|
||||||
|
blck_primaryWeapons = _wpnAR + _wpnLMG + _wpnSMG + _wpnShotGun + _wpnSniper;
|
||||||
|
blck_WeaponList_Blue = blck_primaryWeapons;
|
||||||
|
blck_WeaponList_Red = blck_primaryWeapons;
|
||||||
|
blck_WeaponList_Green = blck_primaryWeapons;
|
||||||
|
blck_WeaponList_Orange = blck_primaryWeapons;
|
||||||
|
|
||||||
|
blck_pistols = _wpnHandGun;
|
||||||
|
blck_Pistols_blue = blck_Pistols;
|
||||||
|
blck_Pistols_red = blck_Pistols;
|
||||||
|
blck_Pistols_green = blck_Pistols;
|
||||||
|
blck_Pistols_orange = blck_Pistols;
|
||||||
|
|
||||||
|
blck_headgearList = _headgear;
|
||||||
|
blck_headgear_blue = blck_headgearList;
|
||||||
|
blck_headgear_red = blck_headgearList;
|
||||||
|
blck_headgear_green = blck_headgearList;
|
||||||
|
blck_headgear_orange = blck_headgearList;
|
||||||
|
|
||||||
|
blck_SkinList = _uniforms;
|
||||||
|
blck_SkinList_blue = blck_SkinList;
|
||||||
|
blck_SkinList_red = blck_SkinList;
|
||||||
|
blck_SkinList_green = blck_SkinList;
|
||||||
|
blck_SkinList_orange = blck_SkinList;
|
||||||
|
|
||||||
|
blck_vests = _vests;
|
||||||
|
blck_vests_blue = blck_vests;
|
||||||
|
blck_vests_red = blck_vests;
|
||||||
|
blck_vests_green = blck_vests;
|
||||||
|
blck_vests_orange = blck_vests;
|
||||||
|
|
||||||
|
blck_backpacks = _backpacks;
|
||||||
|
blck_backpacks_blue = blck_backpacks;
|
||||||
|
blck_backpacks_red = blck_backpacks;
|
||||||
|
blck_backpacks_green = blck_backpacks;
|
||||||
|
blck_backpacks_orange = blck_backpacks;
|
||||||
|
|
||||||
|
blck_explosives = _wpnThrow;
|
||||||
|
|
||||||
|
blck_configsLoaded = true;
|
@ -12,6 +12,7 @@
|
|||||||
//diag_log format["_sm_addAircraft: _this = %5",_this];
|
//diag_log format["_sm_addAircraft: _this = %5",_this];
|
||||||
params["_aircraftPatrol"];
|
params["_aircraftPatrol"];
|
||||||
//diag_log format["_sm_addAircraft: _aircraftPatrol = %1",_aircraftPatrol];
|
//diag_log format["_sm_addAircraft: _aircraftPatrol = %1",_aircraftPatrol];
|
||||||
blck_sm_Aircraft pushBack [_aircraftPatrol,grpNull,0];
|
//blck_sm_Aircraft pushBack [_aircraftPatrol,grpNull,0];
|
||||||
|
[blck_sm_Aircraft,_aircraftPatrol] call blck_fnc_sm_AddGroupToArray;
|
||||||
//diag_log format["_sm_addAircraft: updated blck_sm_Aircraft = %1",blck_sm_Aircraft];
|
//diag_log format["_sm_addAircraft: updated blck_sm_Aircraft = %1",blck_sm_Aircraft];
|
||||||
true
|
true
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
|
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
|
||||||
|
|
||||||
params["_emplacedWeapon"];
|
params["_emplacedWeapon"];
|
||||||
blck_sm_Emplaced pushBack [_emplacedWeapon,grpNull,0];
|
//blck_sm_Emplaced pushBack [_emplacedWeapon,grpNull,0];
|
||||||
|
[blck_sm_Emplaced,_emplacedWeapon] call blck_fnc_sm_AddGroupToArray;
|
||||||
//diag_log format["_sm_AddEmplaced::-> _emplacedWeapon = %1, blck_sm_Emplaced = %2",_emplacedWeapon,blck_sm_Emplaced];
|
//diag_log format["_sm_AddEmplaced::-> _emplacedWeapon = %1, blck_sm_Emplaced = %2",_emplacedWeapon,blck_sm_Emplaced];
|
||||||
true
|
true
|
@ -11,6 +11,8 @@
|
|||||||
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
|
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
|
||||||
|
|
||||||
params["_group"];
|
params["_group"];
|
||||||
blck_sm_Groups pushBack [_group,grpNull,0];
|
|
||||||
|
//blck_sm_Groups pushBack [_group,grpNull,0];
|
||||||
|
[blck_sm_Groups,_group] call blck_fnc_sm_AddGroupToArray;
|
||||||
//diag_log format["_sm_AddGroup:: blck_sm_Groups = %1",blck_sm_Groups];
|
//diag_log format["_sm_AddGroup:: blck_sm_Groups = %1",blck_sm_Groups];
|
||||||
true
|
true
|
@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
by Ghostrider [GRG]
|
||||||
|
|
||||||
|
--------------------------
|
||||||
|
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";
|
||||||
|
params["_array","_patrolInformation"];
|
||||||
|
waitUntil {blck_sm_monitoring isEqualTo 0};
|
||||||
|
_array pushBack [
|
||||||
|
_patrolInformation,
|
||||||
|
grpNull,
|
||||||
|
0, // spawned at
|
||||||
|
0, // respawn at
|
||||||
|
0 // last time a player was nearby
|
||||||
|
];
|
||||||
|
_array
|
@ -11,5 +11,6 @@
|
|||||||
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
|
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
|
||||||
|
|
||||||
params["_vehicle"];
|
params["_vehicle"];
|
||||||
blck_sm_Vehicles pushBack [_vehicle,grpNull,0];
|
//blck_sm_Vehicles pushBack [_vehicle,grpNull,0];
|
||||||
|
[blck_sm_Vehicles,_vehicle] call blck_fnc_sm_AddGroupToArray;
|
||||||
true
|
true
|
@ -20,6 +20,8 @@ blck_sm_submarines = [];
|
|||||||
|
|
||||||
blck_sm_lootContainers = [];
|
blck_sm_lootContainers = [];
|
||||||
|
|
||||||
|
blck_fnc_sm_AddGroupToArray = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_AddGroupToArray.sqf";
|
||||||
|
|
||||||
blck_fnc_sm_AddGroup = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_AddGroup.sqf";
|
blck_fnc_sm_AddGroup = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_AddGroup.sqf";
|
||||||
blck_fnc_sm_AddVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_AddVehicle.sqf";
|
blck_fnc_sm_AddVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_AddVehicle.sqf";
|
||||||
blck_fnc_sm_AddAircraft = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_AddAircraft.sqf";
|
blck_fnc_sm_AddAircraft = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_AddAircraft.sqf";
|
||||||
|
@ -0,0 +1,300 @@
|
|||||||
|
/*
|
||||||
|
by Ghostrider [GRG]
|
||||||
|
for ghostridergaming
|
||||||
|
12/5/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";
|
||||||
|
_fnc_updateGroupSpawnTimerFields = {
|
||||||
|
diag_log format["_fnc_updateGroupSpawnTimerFields::-> _this = %1",_this];
|
||||||
|
params["_array","_element",["_group",grpNull],["_spawnedAt",0]];
|
||||||
|
private _index = _array find _element;
|
||||||
|
_element set[1,_group];
|
||||||
|
_element set[2,_spawnedAt];
|
||||||
|
_array set[_index,_element];
|
||||||
|
};
|
||||||
|
private _triggerRange = 1000;
|
||||||
|
_fnc_evaluateSpawnedGroups = {
|
||||||
|
params["_patrolsArray"];
|
||||||
|
private _localpatrolsArray = +_patrolsArray;
|
||||||
|
{
|
||||||
|
// _x = [ [[22819.4,16929.5,5.33892],""red"",4,75,30], R Alpha 1-1,-1,0]"
|
||||||
|
_x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
|
// [[22819.4,16929.5,5.33892],""red"",4,75,30]
|
||||||
|
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
|
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: _x = %1",_x];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: units alive in group %1 = %2",_group, {alive _x} count (units _group)];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: _respawnInterval = %1",_respawnInterval];
|
||||||
|
if (_spawnedAt > 0) then
|
||||||
|
{
|
||||||
|
if (({alive _x} count (units _group) == 0)) then
|
||||||
|
{
|
||||||
|
diag_log format["all units in patrol %1 are dead | _respawnInterval = %2",_x,_respawnInterval];
|
||||||
|
if ((_respawnInterval != 0)) then // a group was spawned and all units are dead and we should respawn them after a certain interval
|
||||||
|
{
|
||||||
|
//[_patrolsArray,_x,grpNull,0,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupRepawnTimerFields;
|
||||||
|
private _index = _patrolsArray find _element;
|
||||||
|
private _element = _x;
|
||||||
|
_element set[1,grpNull];
|
||||||
|
_element set[2,0];
|
||||||
|
_element set[3,(diag_tickTime + _respawnInterval)];
|
||||||
|
_patrolsArray set[_index,_element];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups | element updated to %1",_element];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: _patrolsArray updated to %1",_patrolsArray];
|
||||||
|
};
|
||||||
|
if (_respawnInterval == 0) then // a group was spawned and all units are dead but we should not do a respawn
|
||||||
|
{
|
||||||
|
_patrolsArray deleteAt (_patrolsArray find _x);
|
||||||
|
diag_log format["patrol %1 deleted from static patrol cue",_x];
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
if ({alive _x} count (units _group) > 0) then
|
||||||
|
{
|
||||||
|
// Case where a player is near and we need to update the time stamp.
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
private _index = _patrolsArray find _x;
|
||||||
|
_x set[4, diag_tickTime];
|
||||||
|
_patrolsArray set[_index,_x];
|
||||||
|
diag_log format["player near static group for element %1 timestamp updated to %2",_x, _x select 4];
|
||||||
|
} else {
|
||||||
|
// Case where no player is near and we need to test if the patrol should be de-spawned.
|
||||||
|
if ((diag_tickTime - _lastTimePlayerNear) > blck_sm_groupDespawnTime) then
|
||||||
|
{
|
||||||
|
diag_log format["despawning static group %1",_x];
|
||||||
|
private _index = _patrolsArray find _x;
|
||||||
|
_groupParameters set[2,{alive _x} count (units _group)];
|
||||||
|
_element = _x;
|
||||||
|
_element set[0,_groupParameters];
|
||||||
|
_element set[1,grpNull];
|
||||||
|
_element set[2,0];
|
||||||
|
_element set[3,(diag_tickTime + _respawnInterval)];
|
||||||
|
_patrolsArray set[_index,_element];
|
||||||
|
{
|
||||||
|
if (vehicle _x != _x) then {[vehicle _x] call blck_fnc_deleteAIVehicle};
|
||||||
|
[_x] call blck_fnc_deleteAI;
|
||||||
|
} forEach (units _group);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _localpatrolsArray;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
blck_sm_monitoring = 1;
|
||||||
|
_sm_groups = +blck_sm_Groups;
|
||||||
|
{
|
||||||
|
_x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
|
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
|
//diag_log format["<_sm_monitorStaticUnits::Group spawning routine:: _units = %1 | _x = %2 |_forEachIndex = %3",_units,_x,_forEachIndex];
|
||||||
|
//private _groupSpawned = false;
|
||||||
|
//diag_log format["there are %1 players in range",{_pos distance2D _x < _triggerRange} count allPlayers];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ((isNull _group)) then
|
||||||
|
{
|
||||||
|
diag_log format["testing if patrol %1 should be spawned | _spawnedAt = %2",_x,_spawnedAt];
|
||||||
|
diag_log format["_spawnedAt = %1 | _respawnAt = %2 | _respawnInterval = %3",_spawnedAt,_respawnAt, _respawnInterval];
|
||||||
|
if ( ((_spawnedAt == 0) && (_respawnAt == 0)) || ((diag_tickTime > _respawnAt) && (_respawnInterval > 0)) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static group spawner] evaluating _x = %1 ",_x];
|
||||||
|
_numAI = [_units] call blck_fnc_getNumberFromRange;
|
||||||
|
//diag_log format["[blckeagls static group spawner] _units = %1 and _numAI = %2",_units,_numAI];
|
||||||
|
// // params["_pos", "_center", _numai1, _numai2, _skillLevel, _minDist, _maxDist, _configureWaypoints, _uniforms, _headGear,_vests,_backpacks,_weaponList,_sideArms, _scuba ];
|
||||||
|
_group = [_pos,_pos,_numAI,_numAI,_difficulty,_patrolRadius-2,_patrolRadius,true] call blck_fnc_spawnGroup;
|
||||||
|
//diag_log format["[blckeagls static group spawner] _group %1",_group];
|
||||||
|
[blck_sm_Groups,_x,_group,diag_tickTime] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
diag_log format["_sm_monitorStaticUnits | spawn Group step :: blck_sm_Groups updated to %1",blck_sm_Groups];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_groups;
|
||||||
|
[blck_sm_Groups] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
|
_sm_scubaGroups = +blck_sm_scubaGroups;
|
||||||
|
{
|
||||||
|
|
||||||
|
// [ [px, py, pz] /* position*/, "difficulty", 4 /*Number to Spawn*/, 150 /*radius of patrol*/, _respawnInterval, _group, _spawnAt]
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
|
//diag_log format["<_sm_monitorScubaUnits:: _group = %1 | _x = %2 |_forEachIndex = %3",_group,_x,_forEachIndex];
|
||||||
|
private _groupSpawned = false;
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ((isNull _group) && (diag_tickTime > _spawnAt) && (_spawnAt != -1)) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static scubaGroup spawner] evaluating _x = %1 ",_x];
|
||||||
|
_numAI = [_units] call blck_fnc_getNumberFromRange;
|
||||||
|
//diag_log format["[blckeagls static scubaGroup spawning routine] _units = %1 and _numAI = %2",_units,_numAI];
|
||||||
|
//params["_pos", "_numUnits", ["_skillLevel","red"], "_center", ["_minDist",20], ["_maxDist",35], ["_uniforms",blck_UMS_uniforms], ["_headGear",blck_UMS_headgear],["_configureWaypoints",true],["_weapons",blck_UMS_weapons],["_vests",blck_UMS_vests]];
|
||||||
|
_group = [_pos,_difficulty,_units,_patrolRadius] call blck_fnc_spawnScubaGroup;
|
||||||
|
//diag_log format["[blckeagls static scubaGroup spawner] _group %1",_group];
|
||||||
|
[blck_sm_scubaGroups,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn Group step :: blck_sm_Groups updated to %1",blck_sm_Groups];
|
||||||
|
};
|
||||||
|
if (!(_groupSpawned) && (isNull _group) && (_spawnAt == -1) && (_respawnInterval > 0)) then // a group was spawned and all units are dead and we should rspawn them after a certain interval
|
||||||
|
{
|
||||||
|
[blck_sm_scubaGroups,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set scubaGroup respawn time step :: blck_sm_Groups updated to %1",blck_sm_scubaGroups];
|
||||||
|
};
|
||||||
|
if (!(_groupSpawned) && (isNull _group) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead but we should not do a respawn
|
||||||
|
{
|
||||||
|
blck_sm_scubaGroups deleteAt (blck_sm_scubaGroups find _x);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_scubaGroups;
|
||||||
|
|
||||||
|
_sm_Emplaced = +blck_sm_Emplaced;
|
||||||
|
{
|
||||||
|
// ["B_G_Mortar_01_F",[22944.3,16820.5,3.14243],"green",0,0,_group,_spawnAt]
|
||||||
|
//diag_log format["_sm_monitorEmplacedUnits::-> _x = %1",_x];
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static Emplaced spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty];
|
||||||
|
// params["_coords","_missionEmplacedWeapons","_useRelativePos","_noEmplacedWeapons","_aiDifficultyLevel",["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols]];
|
||||||
|
_group = [_pos,[_groupParameters],false,1,_difficulty] call blck_fnc_spawnEmplacedWeaponArray;
|
||||||
|
[blck_sm_Emplaced,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Emplaced updated to %1",blck_sm_Emplaced];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
[blck_sm_Emplaced,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Emplaced updated to %1",blck_sm_Emplaced];
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0)) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
blck_sm_Emplaced deleteAt (blck_sm_Emplaced find _x);
|
||||||
|
};
|
||||||
|
|
||||||
|
}forEach _sm_Emplaced;
|
||||||
|
|
||||||
|
_sm_Vehicles = +blck_sm_Vehicles;
|
||||||
|
{
|
||||||
|
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt],
|
||||||
|
//diag_log format["_sm_monitorVehicles::-> _x = %1",_x];
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_vehicleType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_isScubaGroup",false]];
|
||||||
|
_return = [_pos,1,_difficulty,[_groupParameters],false] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
// _return = [_vehicles, _missionAI, _abort];
|
||||||
|
_group = group (_return select 1 select 0);
|
||||||
|
[blck_sm_Vehicles,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
[blck_sm_Vehicles,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
blck_sm_Vehicles deleteAt (blck_sm_Vehicles find _x);
|
||||||
|
};
|
||||||
|
}forEach _sm_Vehicles;
|
||||||
|
|
||||||
|
_sm_surfaceVehicles = +blck_sm_surfaceShips;
|
||||||
|
{
|
||||||
|
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt],
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static vehiclePatrol spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty];
|
||||||
|
[_pos,1,_difficulty,[_groupParameters],false] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
_return params ["_vehicles", "_missionAI", "_abort"];
|
||||||
|
_group = group (_missionAI select 0);
|
||||||
|
[blck_sm_surfaceShips,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
[blck_sm_surfaceShips,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
blck_sm_surfaceShips deleteAt (blck_sm_surfaceShips find _x);
|
||||||
|
};
|
||||||
|
}forEach _sm_surfaceVehicles;
|
||||||
|
|
||||||
|
_sm_SDVVehicles = +blck_sm_submarines;
|
||||||
|
{
|
||||||
|
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt],
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static sub patrol spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty];
|
||||||
|
//params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_isScubaGroup",false]];
|
||||||
|
_return = [_pos,1,_difficulty,[_groupParameters],false,blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,blck_backpacks,blck_UMS_weapons,blck_Pistols,true] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
_return params ["_vehicles", "_missionAI", "_abort"];
|
||||||
|
_group = group (_missionAI select 0);
|
||||||
|
[blck_sm_submarines,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
[blck_sm_submarines,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
blck_sm_submarines deleteAt (blck_sm_submarines find _x);
|
||||||
|
};
|
||||||
|
}forEach _sm_SDVVehicles;
|
||||||
|
|
||||||
|
_sm_Aircraft = +blck_sm_Aircraft;
|
||||||
|
{
|
||||||
|
// ["Exile_Chopper_Huey_Armed_Green",[22923.4,16953,3.19],"red",1000,0],
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_aircraftType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (isNull _group) && (diag_tickTime > _spawnAt) && (_spawnAt != -1)) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
_weapon = [toLower _difficulty] call blck_fnc_selectAILoadout;
|
||||||
|
//params["_coords","_skillAI","_helis",["_uniforms", blck_SkinList],["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_Launcher","none"],["_weaponList",[]],["_sideArms",[]]]
|
||||||
|
//diag_log format["[blckeagls static aircraftePatrol spawner] _weapon = %1 and _difficulty = %2",_weapon,_difficulty];
|
||||||
|
_return = [_pos,_difficulty,[_aircraftType]] call blck_fnc_spawnMissionHeli; // Allow the spawner to fit the default AI Loadouts for blckeagls; revisit at a later time when custom uniforms are set up for these AI.
|
||||||
|
//diag_log format["[blckeagls] static aircraftePatrol spawner -> _return = %1",_return];
|
||||||
|
_return params ["_patrolHeli","_ai","_abort"];
|
||||||
|
_group = group (_ai select 0);
|
||||||
|
[blck_sm_Aircraft,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Aircraft updated to %1",blck_sm_Aircraft];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ( (isNull _group) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
[blck_sm_Aircraft,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Aircraft updated to %1",blck_sm_Aircraft];
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
blck_sm_Aircraft deleteAt (blck_sm_Aircraft find _x);
|
||||||
|
};
|
||||||
|
}forEach _sm_Aircraft;
|
||||||
|
blck_sm_monitoring = 0;
|
@ -0,0 +1,325 @@
|
|||||||
|
/*
|
||||||
|
by Ghostrider [GRG]
|
||||||
|
for ghostridergaming
|
||||||
|
12/5/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";
|
||||||
|
_fnc_updateGroupSpawnTimerFields = {
|
||||||
|
diag_log format["_fnc_updateGroupSpawnTimerFields::-> _this = %1",_this];
|
||||||
|
params["_array","_element",["_group",grpNull],["_spawnedAt",0]];
|
||||||
|
private _index = _array find _element;
|
||||||
|
_element set[1,_group];
|
||||||
|
_element set[2,_spawnedAt];
|
||||||
|
_array set[_index,_element];
|
||||||
|
};
|
||||||
|
private _triggerRange = 1000;
|
||||||
|
_fnc_evaluateSpawnedGroups = {
|
||||||
|
params["_aiType","_patrolsArray"];
|
||||||
|
private _localpatrolsArray = +_patrolsArray;
|
||||||
|
{
|
||||||
|
// _x = [ [[22819.4,16929.5,5.33892],""red"",4,75,30], R Alpha 1-1,-1,0]"
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: _x = %1",_x];
|
||||||
|
_x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
|
if !(isNull _group) then
|
||||||
|
{
|
||||||
|
// [[22819.4,16929.5,5.33892],""red"",4,75,30]
|
||||||
|
//_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: typeName _groupParameters select 0 = %1",typeName (_groupParameters select 0)];
|
||||||
|
private["_pos","_difficulty","_units","_patrolRadius","_respawnInterval","_vehicleType"];
|
||||||
|
if (_aiType isEqualTo "onFoot") then {
|
||||||
|
//_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"]
|
||||||
|
_pos = _groupParameters select 0;
|
||||||
|
_difficulty = _groupParameters select 1;
|
||||||
|
_units = _groupParameters select 2;
|
||||||
|
_patrolRadius = _groupParameters select 3;
|
||||||
|
_respawnInterval = _groupParameters select 4;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_aiType isEqualTo "inVehicle") then
|
||||||
|
{
|
||||||
|
//_groupParameters params["_vehicleType","_pos","_difficulty","_patrolRadius","_respawnInterval"]};
|
||||||
|
_vehicleType = _groupParameters select 0;
|
||||||
|
_pos = _groupParameters select 1;
|
||||||
|
_difficulty = _groupParameters select 2;
|
||||||
|
_patrolRadius = _groupParameters select 3;
|
||||||
|
_respawnInterval = _groupParameters select 4;
|
||||||
|
};
|
||||||
|
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: _groupParameters = %1",_groupParameters];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: _pos = %1 | _difficulty = %2 | _patrolRadius = %3 | _respawnInterval = %4",_pos,_difficulty,_patrolRadius,_respawnInterval];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: units alive in group %1 = %2",_group, {alive _x} count (units _group)];
|
||||||
|
//diag_log format["_fnc_evaluateSpawnedGroups: _respawnInterval = %1",_respawnInterval];
|
||||||
|
if (_spawnedAt > 0) then
|
||||||
|
{
|
||||||
|
if (({alive _x} count (units _group) == 0)) then
|
||||||
|
{
|
||||||
|
diag_log format["all units in patrol %1 are dead | _respawnInterval = %2",_x,_respawnInterval];
|
||||||
|
if ((_respawnInterval != 0)) then // a group was spawned and all units are dead and we should respawn them after a certain interval
|
||||||
|
{
|
||||||
|
//[_patrolsArray,_x,grpNull,0,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupRepawnTimerFields;
|
||||||
|
private _index = _patrolsArray find _element;
|
||||||
|
private _element = _x;
|
||||||
|
_element set[1,grpNull];
|
||||||
|
_element set[2,0];
|
||||||
|
_element set[3,(diag_tickTime + _respawnInterval)];
|
||||||
|
_patrolsArray set[_index,_element];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups | element updated to %1",_element];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: _patrolsArray updated to %1",_patrolsArray];
|
||||||
|
};
|
||||||
|
if (_respawnInterval == 0) then // a group was spawned and all units are dead but we should not do a respawn
|
||||||
|
{
|
||||||
|
_patrolsArray deleteAt (_patrolsArray find _x);
|
||||||
|
diag_log format["patrol %1 deleted from static patrol cue",_x];
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
if ({alive _x} count (units _group) > 0) then
|
||||||
|
{
|
||||||
|
// Case where a player is near and we need to update the time stamp.
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
private _index = _patrolsArray find _x;
|
||||||
|
_x set[4, diag_tickTime];
|
||||||
|
_patrolsArray set[_index,_x];
|
||||||
|
diag_log format["player near static group for element %1 timestamp updated to %2",_x, _x select 4];
|
||||||
|
} else {
|
||||||
|
// Case where no player is near and we need to test if the patrol should be de-spawned.
|
||||||
|
if ((diag_tickTime - _lastTimePlayerNear) > blck_sm_groupDespawnTime) then
|
||||||
|
{
|
||||||
|
diag_log format["despawning static group %1",_x];
|
||||||
|
private _index = _patrolsArray find _x;
|
||||||
|
_groupParameters set[2,{alive _x} count (units _group)];
|
||||||
|
_element = _x;
|
||||||
|
_element set[0,_groupParameters];
|
||||||
|
_element set[1,grpNull];
|
||||||
|
_element set[2,0];
|
||||||
|
_element set[3,(diag_tickTime + _respawnInterval)];
|
||||||
|
_patrolsArray set[_index,_element];
|
||||||
|
{
|
||||||
|
if (vehicle _x != _x) then {[vehicle _x] call blck_fnc_deleteAIVehicle};
|
||||||
|
[_x] call blck_fnc_deleteAI;
|
||||||
|
} forEach (units _group);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _localpatrolsArray;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
blck_sm_monitoring = 1;
|
||||||
|
_sm_groups = +blck_sm_Groups;
|
||||||
|
{
|
||||||
|
_x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
|
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
|
//diag_log format["<_sm_monitorStaticUnits::Group spawning routine:: _units = %1 | _x = %2 |_forEachIndex = %3",_units,_x,_forEachIndex];
|
||||||
|
//private _groupSpawned = false;
|
||||||
|
//diag_log format["there are %1 players in range",{_pos distance2D _x < _triggerRange} count allPlayers];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ((isNull _group)) then
|
||||||
|
{
|
||||||
|
diag_log format["testing if patrol %1 should be spawned | _spawnedAt = %2",_x,_spawnedAt];
|
||||||
|
diag_log format["_spawnedAt = %1 | _respawnAt = %2 | _respawnInterval = %3",_spawnedAt,_respawnAt, _respawnInterval];
|
||||||
|
if ( ((_spawnedAt == 0) && (_respawnAt == 0)) || ((diag_tickTime > _respawnAt) && (_respawnInterval > 0)) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static group spawner] evaluating _x = %1 ",_x];
|
||||||
|
_numAI = [_units] call blck_fnc_getNumberFromRange;
|
||||||
|
//diag_log format["[blckeagls static group spawner] _units = %1 and _numAI = %2",_units,_numAI];
|
||||||
|
// // params["_pos", "_center", _numai1, _numai2, _skillLevel, _minDist, _maxDist, _configureWaypoints, _uniforms, _headGear,_vests,_backpacks,_weaponList,_sideArms, _scuba ];
|
||||||
|
_group = [_pos,_pos,_numAI,_numAI,_difficulty,_patrolRadius-2,_patrolRadius,true] call blck_fnc_spawnGroup;
|
||||||
|
diag_log format["[blckeagls static group spawner] _group %1",_group];
|
||||||
|
[blck_sm_Groups,_x,_group,diag_tickTime] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
diag_log format["_sm_monitorStaticUnits | spawn Group step :: blck_sm_Groups updated to %1",blck_sm_Groups];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_groups;
|
||||||
|
["onFoot",blck_sm_Groups] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
|
_sm_scubaGroups = +blck_sm_scubaGroups;
|
||||||
|
{
|
||||||
|
|
||||||
|
// [ [px, py, pz] /* position*/, "difficulty", 4 /*Number to Spawn*/, 150 /*radius of patrol*/, _respawnInterval, _group, _spawnAt]
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
|
//diag_log format["<_sm_monitorScubaUnits:: _group = %1 | _x = %2 |_forEachIndex = %3",_group,_x,_forEachIndex];
|
||||||
|
private _groupSpawned = false;
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ((isNull _group) && (diag_tickTime > _spawnAt) && (_spawnAt != -1)) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static scubaGroup spawner] evaluating _x = %1 ",_x];
|
||||||
|
_numAI = [_units] call blck_fnc_getNumberFromRange;
|
||||||
|
//diag_log format["[blckeagls static scubaGroup spawning routine] _units = %1 and _numAI = %2",_units,_numAI];
|
||||||
|
//params["_pos", "_numUnits", ["_skillLevel","red"], "_center", ["_minDist",20], ["_maxDist",35], ["_uniforms",blck_UMS_uniforms], ["_headGear",blck_UMS_headgear],["_configureWaypoints",true],["_weapons",blck_UMS_weapons],["_vests",blck_UMS_vests]];
|
||||||
|
_group = [_pos,_difficulty,_units,_patrolRadius] call blck_fnc_spawnScubaGroup;
|
||||||
|
//diag_log format["[blckeagls static scubaGroup spawner] _group %1",_group];
|
||||||
|
[blck_sm_scubaGroups,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn Group step :: blck_sm_Groups updated to %1",blck_sm_Groups];
|
||||||
|
};
|
||||||
|
if (!(_groupSpawned) && (isNull _group) && (_spawnAt == -1) && (_respawnInterval > 0)) then // a group was spawned and all units are dead and we should rspawn them after a certain interval
|
||||||
|
{
|
||||||
|
[blck_sm_scubaGroups,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set scubaGroup respawn time step :: blck_sm_Groups updated to %1",blck_sm_scubaGroups];
|
||||||
|
};
|
||||||
|
if (!(_groupSpawned) && (isNull _group) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead but we should not do a respawn
|
||||||
|
{
|
||||||
|
blck_sm_scubaGroups deleteAt (blck_sm_scubaGroups find _x);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_scubaGroups;
|
||||||
|
|
||||||
|
_sm_Emplaced = +blck_sm_Emplaced;
|
||||||
|
{
|
||||||
|
// ["B_G_Mortar_01_F",[22944.3,16820.5,3.14243],"green",0,0,_group,_spawnAt]
|
||||||
|
//diag_log format["_sm_monitorEmplacedUnits::-> _x = %1",_x];
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static Emplaced spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty];
|
||||||
|
// params["_coords","_missionEmplacedWeapons","_useRelativePos","_noEmplacedWeapons","_aiDifficultyLevel",["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols]];
|
||||||
|
_group = [_pos,[_groupParameters],false,1,_difficulty] call blck_fnc_spawnEmplacedWeaponArray;
|
||||||
|
[blck_sm_Emplaced,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Emplaced updated to %1",blck_sm_Emplaced];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
[blck_sm_Emplaced,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Emplaced updated to %1",blck_sm_Emplaced];
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0)) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
blck_sm_Emplaced deleteAt (blck_sm_Emplaced find _x);
|
||||||
|
};
|
||||||
|
|
||||||
|
}forEach _sm_Emplaced;
|
||||||
|
|
||||||
|
_sm_Vehicles = +blck_sm_Vehicles;
|
||||||
|
{
|
||||||
|
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt],
|
||||||
|
//diag_log format["_sm_monitorVehicles::-> _x = %1",_x];
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_vehicleType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_isScubaGroup",false]];
|
||||||
|
_return = [_pos,1,_difficulty,[_groupParameters],false] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
// _return = [_vehicles, _missionAI, _abort];
|
||||||
|
_group = group (_return select 1 select 0);
|
||||||
|
[blck_sm_Vehicles,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
[blck_sm_Vehicles,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
blck_sm_Vehicles deleteAt (blck_sm_Vehicles find _x);
|
||||||
|
};
|
||||||
|
}forEach _sm_Vehicles;
|
||||||
|
|
||||||
|
_sm_surfaceVehicles = +blck_sm_surfaceShips;
|
||||||
|
{
|
||||||
|
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt],
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static vehiclePatrol spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty];
|
||||||
|
[_pos,1,_difficulty,[_groupParameters],false] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
_return params ["_vehicles", "_missionAI", "_abort"];
|
||||||
|
_group = group (_missionAI select 0);
|
||||||
|
[blck_sm_surfaceShips,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
[blck_sm_surfaceShips,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
blck_sm_surfaceShips deleteAt (blck_sm_surfaceShips find _x);
|
||||||
|
};
|
||||||
|
}forEach _sm_surfaceVehicles;
|
||||||
|
|
||||||
|
_sm_SDVVehicles = +blck_sm_submarines;
|
||||||
|
{
|
||||||
|
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt],
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static sub patrol spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty];
|
||||||
|
//params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_isScubaGroup",false]];
|
||||||
|
_return = [_pos,1,_difficulty,[_groupParameters],false,blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,blck_backpacks,blck_UMS_weapons,blck_Pistols,true] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
_return params ["_vehicles", "_missionAI", "_abort"];
|
||||||
|
_group = group (_missionAI select 0);
|
||||||
|
[blck_sm_submarines,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
[blck_sm_submarines,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
blck_sm_submarines deleteAt (blck_sm_submarines find _x);
|
||||||
|
};
|
||||||
|
}forEach _sm_SDVVehicles;
|
||||||
|
|
||||||
|
_sm_Aircraft = +blck_sm_Aircraft;
|
||||||
|
{
|
||||||
|
// ["Exile_Chopper_Huey_Armed_Green",[22923.4,16953,3.19],"red",1000,0],
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_aircraftType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (isNull _group) && (diag_tickTime > _spawnAt) && (_spawnAt != -1)) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
_weapon = [toLower _difficulty] call blck_fnc_selectAILoadout;
|
||||||
|
//params["_coords","_skillAI","_helis",["_uniforms", blck_SkinList],["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_Launcher","none"],["_weaponList",[]],["_sideArms",[]]]
|
||||||
|
//diag_log format["[blckeagls static aircraftePatrol spawner] _weapon = %1 and _difficulty = %2",_weapon,_difficulty];
|
||||||
|
_return = [_pos,_difficulty,[_aircraftType]] call blck_fnc_spawnMissionHeli; // Allow the spawner to fit the default AI Loadouts for blckeagls; revisit at a later time when custom uniforms are set up for these AI.
|
||||||
|
//diag_log format["[blckeagls] static aircraftePatrol spawner -> _return = %1",_return];
|
||||||
|
_return params ["_patrolHeli","_ai","_abort"];
|
||||||
|
_group = group (_ai select 0);
|
||||||
|
[blck_sm_Aircraft,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Aircraft updated to %1",blck_sm_Aircraft];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ( (isNull _group) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
[blck_sm_Aircraft,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Aircraft updated to %1",blck_sm_Aircraft];
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
blck_sm_Aircraft deleteAt (blck_sm_Aircraft find _x);
|
||||||
|
};
|
||||||
|
}forEach _sm_Aircraft;
|
||||||
|
blck_sm_monitoring = 0;
|
@ -0,0 +1,321 @@
|
|||||||
|
/*
|
||||||
|
by Ghostrider [GRG]
|
||||||
|
for ghostridergaming
|
||||||
|
12/5/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";
|
||||||
|
#define onFoot 1
|
||||||
|
#define inVehicle 2
|
||||||
|
|
||||||
|
_fnc_updateGroupSpawnTimerFields = {
|
||||||
|
diag_log format["_fnc_updateGroupSpawnTimerFields::-> _this = %1",_this];
|
||||||
|
params["_array","_element",["_group",grpNull],["_spawnedAt",0]];
|
||||||
|
private _index = _array find _element;
|
||||||
|
_element set[1,_group];
|
||||||
|
_element set[2,_spawnedAt];
|
||||||
|
_array set[_index,_element];
|
||||||
|
};
|
||||||
|
private _triggerRange = 1000;
|
||||||
|
_fnc_evaluateSpawnedGroups = {
|
||||||
|
params["_aiType","_patrolsArray"];
|
||||||
|
private _localpatrolsArray = +_patrolsArray;
|
||||||
|
{
|
||||||
|
// _x = [ [[22819.4,16929.5,5.33892],""red"",4,75,30], R Alpha 1-1,-1,0]"
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: _x = %1",_x];
|
||||||
|
_x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
|
if !(isNull _group) then
|
||||||
|
{
|
||||||
|
// [[22819.4,16929.5,5.33892],""red"",4,75,30]
|
||||||
|
//_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: typeName _groupParameters select 0 = %1",typeName (_groupParameters select 0)];
|
||||||
|
private["_pos","_difficulty","_units","_patrolRadius","_respawnInterval","_vehicleType"];
|
||||||
|
if (_aiType isEqualTo onFoot) then {
|
||||||
|
//_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"]
|
||||||
|
_pos = _groupParameters select 0;
|
||||||
|
_difficulty = _groupParameters select 1;
|
||||||
|
_units = _groupParameters select 2;
|
||||||
|
_patrolRadius = _groupParameters select 3;
|
||||||
|
_respawnInterval = _groupParameters select 4;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_aiType isEqualTo inVehicle) then
|
||||||
|
{
|
||||||
|
//_groupParameters params["_vehicleType","_pos","_difficulty","_patrolRadius","_respawnInterval"]};
|
||||||
|
_vehicleType = _groupParameters select 0;
|
||||||
|
_pos = _groupParameters select 1;
|
||||||
|
_difficulty = _groupParameters select 2;
|
||||||
|
_patrolRadius = _groupParameters select 3;
|
||||||
|
_respawnInterval = _groupParameters select 4;
|
||||||
|
};
|
||||||
|
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: _groupParameters = %1",_groupParameters];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: _pos = %1 | _difficulty = %2 | _patrolRadius = %3 | _respawnInterval = %4",_pos,_difficulty,_patrolRadius,_respawnInterval];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: units alive in group %1 = %2",_group, {alive _x} count (units _group)];
|
||||||
|
//diag_log format["_fnc_evaluateSpawnedGroups: _respawnInterval = %1",_respawnInterval];
|
||||||
|
if (_spawnedAt > 0) then
|
||||||
|
{
|
||||||
|
if (({alive _x} count (units _group) == 0)) then
|
||||||
|
{
|
||||||
|
diag_log format["all units in patrol %1 are dead | _respawnInterval = %2",_x,_respawnInterval];
|
||||||
|
if ((_respawnInterval != 0)) then // a group was spawned and all units are dead and we should respawn them after a certain interval
|
||||||
|
{
|
||||||
|
//[_patrolsArray,_x,grpNull,0,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupRepawnTimerFields;
|
||||||
|
private _index = _patrolsArray find _element;
|
||||||
|
private _element = _x;
|
||||||
|
_element set[1,grpNull];
|
||||||
|
_element set[2,0];
|
||||||
|
_element set[3,(diag_tickTime + _respawnInterval)];
|
||||||
|
_patrolsArray set[_index,_element];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups | element updated to %1",_element];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: _patrolsArray updated to %1",_patrolsArray];
|
||||||
|
};
|
||||||
|
if (_respawnInterval == 0) then // a group was spawned and all units are dead but we should not do a respawn
|
||||||
|
{
|
||||||
|
_patrolsArray deleteAt (_patrolsArray find _x);
|
||||||
|
diag_log format["patrol %1 deleted from static patrol cue",_x];
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
if ({alive _x} count (units _group) > 0) then
|
||||||
|
{
|
||||||
|
// Case where a player is near and we need to update the time stamp.
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
private _index = _patrolsArray find _x;
|
||||||
|
_x set[4, diag_tickTime];
|
||||||
|
_patrolsArray set[_index,_x];
|
||||||
|
diag_log format["player near static group for element %1 timestamp updated to %2",_x, _x select 4];
|
||||||
|
} else {
|
||||||
|
// Case where no player is near and we need to test if the patrol should be de-spawned.
|
||||||
|
if ((diag_tickTime - _lastTimePlayerNear) > blck_sm_groupDespawnTime) then
|
||||||
|
{
|
||||||
|
diag_log format["despawning static group %1",_x];
|
||||||
|
private _index = _patrolsArray find _x;
|
||||||
|
_groupParameters set[2,{alive _x} count (units _group)];
|
||||||
|
_element = _x;
|
||||||
|
_element set[0,_groupParameters];
|
||||||
|
_element set[1,grpNull];
|
||||||
|
_element set[2,0];
|
||||||
|
_element set[3,(diag_tickTime + _respawnInterval)];
|
||||||
|
_patrolsArray set[_index,_element];
|
||||||
|
{
|
||||||
|
if (vehicle _x != _x) then {[vehicle _x] call blck_fnc_deleteAIVehicle};
|
||||||
|
[_x] call blck_fnc_deleteAI;
|
||||||
|
} forEach (units _group);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _localpatrolsArray;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
blck_sm_monitoring = 1;
|
||||||
|
_sm_groups = +blck_sm_Groups;
|
||||||
|
{
|
||||||
|
_x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
|
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
|
//diag_log format["<_sm_monitorStaticUnits::Group spawning routine:: _units = %1 | _x = %2 |_forEachIndex = %3",_units,_x,_forEachIndex];
|
||||||
|
//private _groupSpawned = false;
|
||||||
|
//diag_log format["there are %1 players in range",{_pos distance2D _x < _triggerRange} count allPlayers];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ((isNull _group)) then
|
||||||
|
{
|
||||||
|
//diag_log format["testing if patrol %1 should be spawned | _spawnedAt = %2",_x,_spawnedAt];
|
||||||
|
//diag_log format["_spawnedAt = %1 | _respawnAt = %2 | _respawnInterval = %3",_spawnedAt,_respawnAt, _respawnInterval];
|
||||||
|
if ( ((_spawnedAt == 0) && (_respawnAt == 0)) || ((diag_tickTime > _respawnAt) && (_respawnInterval > 0)) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static group spawner] evaluating _x = %1 ",_x];
|
||||||
|
_numAI = [_units] call blck_fnc_getNumberFromRange;
|
||||||
|
//diag_log format["[blckeagls static group spawner] _units = %1 and _numAI = %2",_units,_numAI];
|
||||||
|
// // params["_pos", "_center", _numai1, _numai2, _skillLevel, _minDist, _maxDist, _configureWaypoints, _uniforms, _headGear,_vests,_backpacks,_weaponList,_sideArms, _scuba ];
|
||||||
|
_group = [_pos,_pos,_numAI,_numAI,_difficulty,_patrolRadius-2,_patrolRadius,true] call blck_fnc_spawnGroup;
|
||||||
|
//diag_log format["[blckeagls static group spawner] _group %1",_group];
|
||||||
|
[blck_sm_Groups,_x,_group,diag_tickTime] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
diag_log format["_sm_monitorStaticUnits | spawn Group step :: blck_sm_Groups updated to %1",blck_sm_Groups];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_groups;
|
||||||
|
[onFoot,blck_sm_Groups] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
|
|
||||||
|
_sm_Vehicles = +blck_sm_Vehicles;
|
||||||
|
{
|
||||||
|
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt],
|
||||||
|
//diag_log format["_sm_monitorVehicles::-> _x = %1",_x];
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_vehicleType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_isScubaGroup",false]];
|
||||||
|
_return = [_pos,1,_difficulty,[_groupParameters],false] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
// _return = [_vehicles, _missionAI, _abort];
|
||||||
|
_group = group (_return select 1 select 0);
|
||||||
|
[blck_sm_Vehicles,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_Vehicles;
|
||||||
|
[inVehicle,blck_sm_Vehicles] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
|
_sm_scubaGroups = +blck_sm_scubaGroups;
|
||||||
|
{
|
||||||
|
|
||||||
|
// [ [px, py, pz] /* position*/, "difficulty", 4 /*Number to Spawn*/, 150 /*radius of patrol*/, _respawnInterval, _group, _spawnAt]
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
|
//diag_log format["<_sm_monitorScubaUnits:: _group = %1 | _x = %2 |_forEachIndex = %3",_group,_x,_forEachIndex];
|
||||||
|
private _groupSpawned = false;
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ((isNull _group) && (diag_tickTime > _spawnAt) && (_spawnAt != -1)) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static scubaGroup spawner] evaluating _x = %1 ",_x];
|
||||||
|
_numAI = [_units] call blck_fnc_getNumberFromRange;
|
||||||
|
//diag_log format["[blckeagls static scubaGroup spawning routine] _units = %1 and _numAI = %2",_units,_numAI];
|
||||||
|
//params["_pos", "_numUnits", ["_skillLevel","red"], "_center", ["_minDist",20], ["_maxDist",35], ["_uniforms",blck_UMS_uniforms], ["_headGear",blck_UMS_headgear],["_configureWaypoints",true],["_weapons",blck_UMS_weapons],["_vests",blck_UMS_vests]];
|
||||||
|
_group = [_pos,_difficulty,_units,_patrolRadius] call blck_fnc_spawnScubaGroup;
|
||||||
|
//diag_log format["[blckeagls static scubaGroup spawner] _group %1",_group];
|
||||||
|
[blck_sm_scubaGroups,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn Group step :: blck_sm_Groups updated to %1",blck_sm_Groups];
|
||||||
|
};
|
||||||
|
if (!(_groupSpawned) && (isNull _group) && (_spawnAt == -1) && (_respawnInterval > 0)) then // a group was spawned and all units are dead and we should rspawn them after a certain interval
|
||||||
|
{
|
||||||
|
[blck_sm_scubaGroups,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set scubaGroup respawn time step :: blck_sm_Groups updated to %1",blck_sm_scubaGroups];
|
||||||
|
};
|
||||||
|
if (!(_groupSpawned) && (isNull _group) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead but we should not do a respawn
|
||||||
|
{
|
||||||
|
blck_sm_scubaGroups deleteAt (blck_sm_scubaGroups find _x);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_scubaGroups;
|
||||||
|
|
||||||
|
_sm_Emplaced = +blck_sm_Emplaced;
|
||||||
|
{
|
||||||
|
// ["B_G_Mortar_01_F",[22944.3,16820.5,3.14243],"green",0,0,_group,_spawnAt]
|
||||||
|
//diag_log format["_sm_monitorEmplacedUnits::-> _x = %1",_x];
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static Emplaced spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty];
|
||||||
|
// params["_coords","_missionEmplacedWeapons","_useRelativePos","_noEmplacedWeapons","_aiDifficultyLevel",["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols]];
|
||||||
|
_group = [_pos,[_groupParameters],false,1,_difficulty] call blck_fnc_spawnEmplacedWeaponArray;
|
||||||
|
[blck_sm_Emplaced,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Emplaced updated to %1",blck_sm_Emplaced];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
[blck_sm_Emplaced,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Emplaced updated to %1",blck_sm_Emplaced];
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0)) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
blck_sm_Emplaced deleteAt (blck_sm_Emplaced find _x);
|
||||||
|
};
|
||||||
|
|
||||||
|
}forEach _sm_Emplaced;
|
||||||
|
|
||||||
|
_sm_surfaceVehicles = +blck_sm_surfaceShips;
|
||||||
|
{
|
||||||
|
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt],
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static vehiclePatrol spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty];
|
||||||
|
[_pos,1,_difficulty,[_groupParameters],false] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
_return params ["_vehicles", "_missionAI", "_abort"];
|
||||||
|
_group = group (_missionAI select 0);
|
||||||
|
[blck_sm_surfaceShips,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
[blck_sm_surfaceShips,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
blck_sm_surfaceShips deleteAt (blck_sm_surfaceShips find _x);
|
||||||
|
};
|
||||||
|
}forEach _sm_surfaceVehicles;
|
||||||
|
|
||||||
|
_sm_SDVVehicles = +blck_sm_submarines;
|
||||||
|
{
|
||||||
|
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt],
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static sub patrol spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty];
|
||||||
|
//params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_isScubaGroup",false]];
|
||||||
|
_return = [_pos,1,_difficulty,[_groupParameters],false,blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,blck_backpacks,blck_UMS_weapons,blck_Pistols,true] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
_return params ["_vehicles", "_missionAI", "_abort"];
|
||||||
|
_group = group (_missionAI select 0);
|
||||||
|
[blck_sm_submarines,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
[blck_sm_submarines,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
blck_sm_submarines deleteAt (blck_sm_submarines find _x);
|
||||||
|
};
|
||||||
|
}forEach _sm_SDVVehicles;
|
||||||
|
|
||||||
|
_sm_Aircraft = +blck_sm_Aircraft;
|
||||||
|
{
|
||||||
|
// ["Exile_Chopper_Huey_Armed_Green",[22923.4,16953,3.19],"red",1000,0],
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_aircraftType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (isNull _group) && (diag_tickTime > _spawnAt) && (_spawnAt != -1)) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
_weapon = [toLower _difficulty] call blck_fnc_selectAILoadout;
|
||||||
|
//params["_coords","_skillAI","_helis",["_uniforms", blck_SkinList],["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_Launcher","none"],["_weaponList",[]],["_sideArms",[]]]
|
||||||
|
//diag_log format["[blckeagls static aircraftePatrol spawner] _weapon = %1 and _difficulty = %2",_weapon,_difficulty];
|
||||||
|
_return = [_pos,_difficulty,[_aircraftType]] call blck_fnc_spawnMissionHeli; // Allow the spawner to fit the default AI Loadouts for blckeagls; revisit at a later time when custom uniforms are set up for these AI.
|
||||||
|
//diag_log format["[blckeagls] static aircraftePatrol spawner -> _return = %1",_return];
|
||||||
|
_return params ["_patrolHeli","_ai","_abort"];
|
||||||
|
_group = group (_ai select 0);
|
||||||
|
[blck_sm_Aircraft,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Aircraft updated to %1",blck_sm_Aircraft];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ( (isNull _group) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
[blck_sm_Aircraft,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Aircraft updated to %1",blck_sm_Aircraft];
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
blck_sm_Aircraft deleteAt (blck_sm_Aircraft find _x);
|
||||||
|
};
|
||||||
|
}forEach _sm_Aircraft;
|
||||||
|
blck_sm_monitoring = 0;
|
@ -0,0 +1,290 @@
|
|||||||
|
/*
|
||||||
|
by Ghostrider [GRG]
|
||||||
|
for ghostridergaming
|
||||||
|
12/5/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";
|
||||||
|
#define onFoot 1
|
||||||
|
#define inVehicle 2
|
||||||
|
|
||||||
|
_fnc_updateGroupSpawnTimerFields = {
|
||||||
|
diag_log format["_fnc_updateGroupSpawnTimerFields::-> _this = %1",_this];
|
||||||
|
params["_array","_element",["_group",grpNull],["_spawnedAt",0]];
|
||||||
|
private _index = _array find _element;
|
||||||
|
_element set[1,_group];
|
||||||
|
_element set[2,_spawnedAt];
|
||||||
|
_array set[_index,_element];
|
||||||
|
};
|
||||||
|
private _triggerRange = 1000;
|
||||||
|
_fnc_evaluateSpawnedGroups = {
|
||||||
|
params["_aiType","_patrolsArray"];
|
||||||
|
private _localpatrolsArray = +_patrolsArray;
|
||||||
|
{
|
||||||
|
// _x = [ [[22819.4,16929.5,5.33892],""red"",4,75,30], R Alpha 1-1,-1,0]"
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: _x = %1",_x];
|
||||||
|
_x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
|
if !(isNull _group) then
|
||||||
|
{
|
||||||
|
// [[22819.4,16929.5,5.33892],""red"",4,75,30]
|
||||||
|
//_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
|
//diag_log format["_fnc_evaluateSpawnedGroups: typeName _groupParameters select 0 = %1",typeName (_groupParameters select 0)];
|
||||||
|
private["_pos","_difficulty","_units","_patrolRadius","_respawnInterval","_vehicleType"];
|
||||||
|
if (_aiType isEqualTo onFoot) then {
|
||||||
|
//_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"]
|
||||||
|
_pos = _groupParameters select 0;
|
||||||
|
_difficulty = _groupParameters select 1;
|
||||||
|
_units = _groupParameters select 2;
|
||||||
|
_patrolRadius = _groupParameters select 3;
|
||||||
|
_respawnInterval = _groupParameters select 4;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_aiType isEqualTo inVehicle) then
|
||||||
|
{
|
||||||
|
//_groupParameters params["_vehicleType","_pos","_difficulty","_patrolRadius","_respawnInterval"]};
|
||||||
|
_vehicleType = _groupParameters select 0;
|
||||||
|
_pos = _groupParameters select 1;
|
||||||
|
_difficulty = _groupParameters select 2;
|
||||||
|
_patrolRadius = _groupParameters select 3;
|
||||||
|
_respawnInterval = _groupParameters select 4;
|
||||||
|
};
|
||||||
|
|
||||||
|
//diag_log format["_fnc_evaluateSpawnedGroups: _groupParameters = %1",_groupParameters];
|
||||||
|
//diag_log format["_fnc_evaluateSpawnedGroups: _pos = %1 | _difficulty = %2 | _patrolRadius = %3 | _respawnInterval = %4",_pos,_difficulty,_patrolRadius,_respawnInterval];
|
||||||
|
//diag_log format["_fnc_evaluateSpawnedGroups: units alive in group %1 = %2",_group, {alive _x} count (units _group)];
|
||||||
|
//diag_log format["_fnc_evaluateSpawnedGroups: _respawnInterval = %1",_respawnInterval];
|
||||||
|
if (_spawnedAt > 0) then
|
||||||
|
{
|
||||||
|
if (({alive _x} count (units _group) == 0)) then
|
||||||
|
{
|
||||||
|
diag_log format["all units in patrol %1 are dead | _respawnInterval = %2",_x,_respawnInterval];
|
||||||
|
if ((_respawnInterval != 0)) then // a group was spawned and all units are dead and we should respawn them after a certain interval
|
||||||
|
{
|
||||||
|
//[_patrolsArray,_x,grpNull,0,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupRepawnTimerFields;
|
||||||
|
private _index = _patrolsArray find _element;
|
||||||
|
private _element = _x;
|
||||||
|
_element set[1,grpNull];
|
||||||
|
_element set[2,0];
|
||||||
|
_element set[3,(diag_tickTime + _respawnInterval)];
|
||||||
|
_patrolsArray set[_index,_element];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups | element updated to %1",_element];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: _patrolsArray updated to %1",_patrolsArray];
|
||||||
|
};
|
||||||
|
if (_respawnInterval == 0) then // a group was spawned and all units are dead but we should not do a respawn
|
||||||
|
{
|
||||||
|
_patrolsArray deleteAt (_patrolsArray find _x);
|
||||||
|
diag_log format["patrol %1 deleted from static patrol cue",_x];
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
if ({alive _x} count (units _group) > 0) then
|
||||||
|
{
|
||||||
|
// Case where a player is near and we need to update the time stamp.
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
private _index = _patrolsArray find _x;
|
||||||
|
_x set[4, diag_tickTime];
|
||||||
|
_patrolsArray set[_index,_x];
|
||||||
|
diag_log format["player near static group for element %1 timestamp updated to %2",_x, _x select 4];
|
||||||
|
} else {
|
||||||
|
// Case where no player is near and we need to test if the patrol should be de-spawned.
|
||||||
|
if ((diag_tickTime - _lastTimePlayerNear) > blck_sm_groupDespawnTime) then
|
||||||
|
{
|
||||||
|
diag_log format["despawning static group %1",_x];
|
||||||
|
private _index = _patrolsArray find _x;
|
||||||
|
_groupParameters set[2,{alive _x} count (units _group)];
|
||||||
|
_element = _x;
|
||||||
|
_element set[0,_groupParameters];
|
||||||
|
_element set[1,grpNull];
|
||||||
|
_element set[2,0];
|
||||||
|
_element set[3,(diag_tickTime + _respawnInterval)];
|
||||||
|
_patrolsArray set[_index,_element];
|
||||||
|
{
|
||||||
|
if (vehicle _x != _x) then {[vehicle _x] call blck_fnc_deleteAIVehicle};
|
||||||
|
[_x] call blck_fnc_deleteAI;
|
||||||
|
} forEach (units _group);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _localpatrolsArray;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
blck_sm_monitoring = 1;
|
||||||
|
_sm_groups = +blck_sm_Groups;
|
||||||
|
{
|
||||||
|
_x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
|
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
|
//diag_log format["<_sm_monitorStaticUnits::Group spawning routine:: _units = %1 | _x = %2 |_forEachIndex = %3",_units,_x,_forEachIndex];
|
||||||
|
//private _groupSpawned = false;
|
||||||
|
//diag_log format["there are %1 players in range",{_pos distance2D _x < _triggerRange} count allPlayers];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ((isNull _group)) then
|
||||||
|
{
|
||||||
|
//diag_log format["testing if patrol %1 should be spawned | _spawnedAt = %2",_x,_spawnedAt];
|
||||||
|
//diag_log format["_spawnedAt = %1 | _respawnAt = %2 | _respawnInterval = %3",_spawnedAt,_respawnAt, _respawnInterval];
|
||||||
|
if ( ((_spawnedAt == 0) && (_respawnAt == 0)) || ((diag_tickTime > _respawnAt) && (_respawnInterval > 0)) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static group spawner] evaluating _x = %1 ",_x];
|
||||||
|
_numAI = [_units] call blck_fnc_getNumberFromRange;
|
||||||
|
//diag_log format["[blckeagls static group spawner] _units = %1 and _numAI = %2",_units,_numAI];
|
||||||
|
// // params["_pos", "_center", _numai1, _numai2, _skillLevel, _minDist, _maxDist, _configureWaypoints, _uniforms, _headGear,_vests,_backpacks,_weaponList,_sideArms, _scuba ];
|
||||||
|
_group = [_pos,_pos,_numAI,_numAI,_difficulty,_patrolRadius-2,_patrolRadius,true] call blck_fnc_spawnGroup;
|
||||||
|
//diag_log format["[blckeagls static group spawner] _group %1",_group];
|
||||||
|
[blck_sm_Groups,_x,_group,diag_tickTime] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn Group step :: blck_sm_Groups updated to %1",blck_sm_Groups];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_groups;
|
||||||
|
[onFoot,blck_sm_Groups] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
|
|
||||||
|
_sm_Vehicles = +blck_sm_Vehicles;
|
||||||
|
{
|
||||||
|
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt],
|
||||||
|
//diag_log format["_sm_monitorVehicles::-> _x = %1",_x];
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_vehicleType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_isScubaGroup",false]];
|
||||||
|
_return = [_pos,1,_difficulty,[_groupParameters],false] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
// _return = [_vehicles, _missionAI, _abort];
|
||||||
|
_group = group (_return select 1 select 0);
|
||||||
|
[blck_sm_Vehicles,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_Vehicles;
|
||||||
|
[inVehicle,blck_sm_Vehicles] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
|
_sm_Aircraft = +blck_sm_Aircraft;
|
||||||
|
{
|
||||||
|
// ["Exile_Chopper_Huey_Armed_Green",[22923.4,16953,3.19],"red",1000,0],
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_aircraftType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (isNull _group) && (diag_tickTime > _spawnAt) && (_spawnAt != -1)) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
_weapon = [toLower _difficulty] call blck_fnc_selectAILoadout;
|
||||||
|
//params["_coords","_skillAI","_helis",["_uniforms", blck_SkinList],["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_Launcher","none"],["_weaponList",[]],["_sideArms",[]]]
|
||||||
|
//diag_log format["[blckeagls static aircraftePatrol spawner] _weapon = %1 and _difficulty = %2",_weapon,_difficulty];
|
||||||
|
_return = [_pos,_difficulty,[_aircraftType]] call blck_fnc_spawnMissionHeli; // Allow the spawner to fit the default AI Loadouts for blckeagls; revisit at a later time when custom uniforms are set up for these AI.
|
||||||
|
diag_log format["[blckeagls] static aircraftePatrol spawner -> _return = %1",_return];
|
||||||
|
_return params ["_patrolHeli","_ai","_abort"];
|
||||||
|
_group = group (_ai select 0);
|
||||||
|
[blck_sm_Aircraft,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Aircraft updated to %1",blck_sm_Aircraft];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_Aircraft;
|
||||||
|
[inVehicle,blck_sm_Aircraft] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
|
_sm_Emplaced = +blck_sm_Emplaced;
|
||||||
|
{
|
||||||
|
// ["B_G_Mortar_01_F",[22944.3,16820.5,3.14243],"green",0,0,_group,_spawnAt]
|
||||||
|
//diag_log format["_sm_monitorEmplacedUnits::-> _x = %1",_x];
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static Emplaced spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty];
|
||||||
|
// params["_coords","_missionEmplacedWeapons","_useRelativePos","_noEmplacedWeapons","_aiDifficultyLevel",["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols]];
|
||||||
|
_group = [_pos,[_groupParameters],false,1,_difficulty] call blck_fnc_spawnEmplacedWeaponArray;
|
||||||
|
[blck_sm_Emplaced,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Emplaced updated to %1",blck_sm_Emplaced];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_Emplaced;
|
||||||
|
[inVehicle,blck_sm_Emplaced] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
|
_sm_scubaGroups = +blck_sm_scubaGroups;
|
||||||
|
{
|
||||||
|
|
||||||
|
// [ [px, py, pz] /* position*/, "difficulty", 4 /*Number to Spawn*/, 150 /*radius of patrol*/, _respawnInterval, _group, _spawnAt]
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
|
//diag_log format["<_sm_monitorScubaUnits:: _group = %1 | _x = %2 |_forEachIndex = %3",_group,_x,_forEachIndex];
|
||||||
|
private _groupSpawned = false;
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ((isNull _group) && (diag_tickTime > _spawnAt) && (_spawnAt != -1)) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static scubaGroup spawner] evaluating _x = %1 ",_x];
|
||||||
|
_numAI = [_units] call blck_fnc_getNumberFromRange;
|
||||||
|
//diag_log format["[blckeagls static scubaGroup spawning routine] _units = %1 and _numAI = %2",_units,_numAI];
|
||||||
|
//params["_pos", "_numUnits", ["_skillLevel","red"], "_center", ["_minDist",20], ["_maxDist",35], ["_uniforms",blck_UMS_uniforms], ["_headGear",blck_UMS_headgear],["_configureWaypoints",true],["_weapons",blck_UMS_weapons],["_vests",blck_UMS_vests]];
|
||||||
|
_group = [_pos,_difficulty,_units,_patrolRadius] call blck_fnc_spawnScubaGroup;
|
||||||
|
//diag_log format["[blckeagls static scubaGroup spawner] _group %1",_group];
|
||||||
|
[blck_sm_scubaGroups,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn Group step :: blck_sm_Groups updated to %1",blck_sm_Groups];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_scubaGroups;
|
||||||
|
[onFoot,blck_sm_scubaGroups] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
|
_sm_surfaceVehicles = +blck_sm_surfaceShips;
|
||||||
|
{
|
||||||
|
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt],
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static vehiclePatrol spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty];
|
||||||
|
[_pos,1,_difficulty,[_groupParameters],false] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
_return params ["_vehicles", "_missionAI", "_abort"];
|
||||||
|
_group = group (_missionAI select 0);
|
||||||
|
[blck_sm_surfaceShips,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_surfaceVehicles;
|
||||||
|
[inVehicle,blck_sm_surfaceShips] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
|
_sm_SDVVehicles = +blck_sm_submarines;
|
||||||
|
{
|
||||||
|
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt],
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static sub patrol spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty];
|
||||||
|
//params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_isScubaGroup",false]];
|
||||||
|
_return = [_pos,1,_difficulty,[_groupParameters],false,blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,blck_backpacks,blck_UMS_weapons,blck_Pistols,true] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
_return params ["_vehicles", "_missionAI", "_abort"];
|
||||||
|
_group = group (_missionAI select 0);
|
||||||
|
[blck_sm_submarines,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
[blck_sm_submarines,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
blck_sm_submarines deleteAt (blck_sm_submarines find _x);
|
||||||
|
};
|
||||||
|
}forEach _sm_SDVVehicles;
|
||||||
|
[inVehicle,blck_sm_submarines] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
|
blck_sm_monitoring = 0;
|
@ -0,0 +1,300 @@
|
|||||||
|
/*
|
||||||
|
by Ghostrider [GRG]
|
||||||
|
for ghostridergaming
|
||||||
|
12/5/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";
|
||||||
|
_fnc_updateGroupSpawnTimerFields = {
|
||||||
|
diag_log format["_fnc_updateGroupSpawnTimerFields::-> _this = %1",_this];
|
||||||
|
params["_array","_element",["_group",grpNull],["_spawnedAt",0]];
|
||||||
|
private _index = _array find _element;
|
||||||
|
_element set[1,_group];
|
||||||
|
_element set[2,_spawnedAt];
|
||||||
|
_array set[_index,_element];
|
||||||
|
};
|
||||||
|
private _triggerRange = 1000;
|
||||||
|
_fnc_evaluateSpawnedGroups = {
|
||||||
|
params["_patrolsArray"];
|
||||||
|
private _localpatrolsArray = +_patrolsArray;
|
||||||
|
{
|
||||||
|
// _x = [ [[22819.4,16929.5,5.33892],""red"",4,75,30], R Alpha 1-1,-1,0]"
|
||||||
|
_x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
|
// [[22819.4,16929.5,5.33892],""red"",4,75,30]
|
||||||
|
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
|
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: _x = %1",_x];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: units alive in group %1 = %2",_group, {alive _x} count (units _group)];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: _respawnInterval = %1",_respawnInterval];
|
||||||
|
if (_spawnedAt > 0) then
|
||||||
|
{
|
||||||
|
if (({alive _x} count (units _group) == 0)) then
|
||||||
|
{
|
||||||
|
diag_log format["all units in patrol %1 are dead | _respawnInterval = %2",_x,_respawnInterval];
|
||||||
|
if ((_respawnInterval != 0)) then // a group was spawned and all units are dead and we should respawn them after a certain interval
|
||||||
|
{
|
||||||
|
//[_patrolsArray,_x,grpNull,0,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupRepawnTimerFields;
|
||||||
|
private _index = _patrolsArray find _element;
|
||||||
|
private _element = _x;
|
||||||
|
_element set[1,grpNull];
|
||||||
|
_element set[2,0];
|
||||||
|
_element set[3,(diag_tickTime + _respawnInterval)];
|
||||||
|
_patrolsArray set[_index,_element];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups | element updated to %1",_element];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: _patrolsArray updated to %1",_patrolsArray];
|
||||||
|
};
|
||||||
|
if (_respawnInterval == 0) then // a group was spawned and all units are dead but we should not do a respawn
|
||||||
|
{
|
||||||
|
_patrolsArray deleteAt (_patrolsArray find _x);
|
||||||
|
diag_log format["patrol %1 deleted from static patrol cue",_x];
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
if ({alive _x} count (units _group) > 0) then
|
||||||
|
{
|
||||||
|
// Case where a player is near and we need to update the time stamp.
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
private _index = _patrolsArray find _x;
|
||||||
|
_x set[4, diag_tickTime];
|
||||||
|
_patrolsArray set[_index,_x];
|
||||||
|
diag_log format["player near static group for element %1 timestamp updated to %2",_x, _x select 4];
|
||||||
|
} else {
|
||||||
|
// Case where no player is near and we need to test if the patrol should be de-spawned.
|
||||||
|
if ((diag_tickTime - _lastTimePlayerNear) > blck_sm_groupDespawnTime) then
|
||||||
|
{
|
||||||
|
diag_log format["despawning static group %1",_x];
|
||||||
|
private _index = _patrolsArray find _x;
|
||||||
|
_groupParameters set[2,{alive _x} count (units _group)];
|
||||||
|
_element = _x;
|
||||||
|
_element set[0,_groupParameters];
|
||||||
|
_element set[1,grpNull];
|
||||||
|
_element set[2,0];
|
||||||
|
_element set[3,(diag_tickTime + _respawnInterval)];
|
||||||
|
_patrolsArray set[_index,_element];
|
||||||
|
{
|
||||||
|
if (vehicle _x != _x) then {[vehicle _x] call blck_fnc_deleteAIVehicle};
|
||||||
|
[_x] call blck_fnc_deleteAI;
|
||||||
|
} forEach (units _group);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _localpatrolsArray;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
blck_sm_monitoring = 1;
|
||||||
|
_sm_groups = +blck_sm_Groups;
|
||||||
|
{
|
||||||
|
_x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
|
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
|
//diag_log format["<_sm_monitorStaticUnits::Group spawning routine:: _units = %1 | _x = %2 |_forEachIndex = %3",_units,_x,_forEachIndex];
|
||||||
|
//private _groupSpawned = false;
|
||||||
|
//diag_log format["there are %1 players in range",{_pos distance2D _x < _triggerRange} count allPlayers];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ((isNull _group)) then
|
||||||
|
{
|
||||||
|
diag_log format["testing if patrol %1 should be spawned | _spawnedAt = %2",_x,_spawnedAt];
|
||||||
|
diag_log format["_spawnedAt = %1 | _respawnAt = %2 | _respawnInterval = %3",_spawnedAt,_respawnAt, _respawnInterval];
|
||||||
|
if ( ((_spawnedAt == 0) && (_respawnAt == 0)) || ((diag_tickTime > _respawnAt) && (_respawnInterval > 0)) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static group spawner] evaluating _x = %1 ",_x];
|
||||||
|
_numAI = [_units] call blck_fnc_getNumberFromRange;
|
||||||
|
//diag_log format["[blckeagls static group spawner] _units = %1 and _numAI = %2",_units,_numAI];
|
||||||
|
// // params["_pos", "_center", _numai1, _numai2, _skillLevel, _minDist, _maxDist, _configureWaypoints, _uniforms, _headGear,_vests,_backpacks,_weaponList,_sideArms, _scuba ];
|
||||||
|
_group = [_pos,_pos,_numAI,_numAI,_difficulty,_patrolRadius-2,_patrolRadius,true] call blck_fnc_spawnGroup;
|
||||||
|
//diag_log format["[blckeagls static group spawner] _group %1",_group];
|
||||||
|
[blck_sm_Groups,_x,_group,diag_tickTime] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
diag_log format["_sm_monitorStaticUnits | spawn Group step :: blck_sm_Groups updated to %1",blck_sm_Groups];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_groups;
|
||||||
|
[blck_sm_Groups] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
|
_sm_scubaGroups = +blck_sm_scubaGroups;
|
||||||
|
{
|
||||||
|
|
||||||
|
// [ [px, py, pz] /* position*/, "difficulty", 4 /*Number to Spawn*/, 150 /*radius of patrol*/, _respawnInterval, _group, _spawnAt]
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
|
//diag_log format["<_sm_monitorScubaUnits:: _group = %1 | _x = %2 |_forEachIndex = %3",_group,_x,_forEachIndex];
|
||||||
|
private _groupSpawned = false;
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ((isNull _group) && (diag_tickTime > _spawnAt) && (_spawnAt != -1)) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static scubaGroup spawner] evaluating _x = %1 ",_x];
|
||||||
|
_numAI = [_units] call blck_fnc_getNumberFromRange;
|
||||||
|
//diag_log format["[blckeagls static scubaGroup spawning routine] _units = %1 and _numAI = %2",_units,_numAI];
|
||||||
|
//params["_pos", "_numUnits", ["_skillLevel","red"], "_center", ["_minDist",20], ["_maxDist",35], ["_uniforms",blck_UMS_uniforms], ["_headGear",blck_UMS_headgear],["_configureWaypoints",true],["_weapons",blck_UMS_weapons],["_vests",blck_UMS_vests]];
|
||||||
|
_group = [_pos,_difficulty,_units,_patrolRadius] call blck_fnc_spawnScubaGroup;
|
||||||
|
//diag_log format["[blckeagls static scubaGroup spawner] _group %1",_group];
|
||||||
|
[blck_sm_scubaGroups,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn Group step :: blck_sm_Groups updated to %1",blck_sm_Groups];
|
||||||
|
};
|
||||||
|
if (!(_groupSpawned) && (isNull _group) && (_spawnAt == -1) && (_respawnInterval > 0)) then // a group was spawned and all units are dead and we should rspawn them after a certain interval
|
||||||
|
{
|
||||||
|
[blck_sm_scubaGroups,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set scubaGroup respawn time step :: blck_sm_Groups updated to %1",blck_sm_scubaGroups];
|
||||||
|
};
|
||||||
|
if (!(_groupSpawned) && (isNull _group) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead but we should not do a respawn
|
||||||
|
{
|
||||||
|
blck_sm_scubaGroups deleteAt (blck_sm_scubaGroups find _x);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_scubaGroups;
|
||||||
|
|
||||||
|
_sm_Emplaced = +blck_sm_Emplaced;
|
||||||
|
{
|
||||||
|
// ["B_G_Mortar_01_F",[22944.3,16820.5,3.14243],"green",0,0,_group,_spawnAt]
|
||||||
|
//diag_log format["_sm_monitorEmplacedUnits::-> _x = %1",_x];
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static Emplaced spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty];
|
||||||
|
// params["_coords","_missionEmplacedWeapons","_useRelativePos","_noEmplacedWeapons","_aiDifficultyLevel",["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols]];
|
||||||
|
_group = [_pos,[_groupParameters],false,1,_difficulty] call blck_fnc_spawnEmplacedWeaponArray;
|
||||||
|
[blck_sm_Emplaced,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Emplaced updated to %1",blck_sm_Emplaced];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
[blck_sm_Emplaced,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Emplaced updated to %1",blck_sm_Emplaced];
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0)) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
blck_sm_Emplaced deleteAt (blck_sm_Emplaced find _x);
|
||||||
|
};
|
||||||
|
|
||||||
|
}forEach _sm_Emplaced;
|
||||||
|
|
||||||
|
_sm_Vehicles = +blck_sm_Vehicles;
|
||||||
|
{
|
||||||
|
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt],
|
||||||
|
//diag_log format["_sm_monitorVehicles::-> _x = %1",_x];
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_vehicleType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_isScubaGroup",false]];
|
||||||
|
_return = [_pos,1,_difficulty,[_groupParameters],false] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
// _return = [_vehicles, _missionAI, _abort];
|
||||||
|
_group = group (_return select 1 select 0);
|
||||||
|
[blck_sm_Vehicles,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
[blck_sm_Vehicles,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
blck_sm_Vehicles deleteAt (blck_sm_Vehicles find _x);
|
||||||
|
};
|
||||||
|
}forEach _sm_Vehicles;
|
||||||
|
|
||||||
|
_sm_surfaceVehicles = +blck_sm_surfaceShips;
|
||||||
|
{
|
||||||
|
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt],
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static vehiclePatrol spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty];
|
||||||
|
[_pos,1,_difficulty,[_groupParameters],false] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
_return params ["_vehicles", "_missionAI", "_abort"];
|
||||||
|
_group = group (_missionAI select 0);
|
||||||
|
[blck_sm_surfaceShips,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
[blck_sm_surfaceShips,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
blck_sm_surfaceShips deleteAt (blck_sm_surfaceShips find _x);
|
||||||
|
};
|
||||||
|
}forEach _sm_surfaceVehicles;
|
||||||
|
|
||||||
|
_sm_SDVVehicles = +blck_sm_submarines;
|
||||||
|
{
|
||||||
|
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt],
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static sub patrol spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty];
|
||||||
|
//params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_isScubaGroup",false]];
|
||||||
|
_return = [_pos,1,_difficulty,[_groupParameters],false,blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,blck_backpacks,blck_UMS_weapons,blck_Pistols,true] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
_return params ["_vehicles", "_missionAI", "_abort"];
|
||||||
|
_group = group (_missionAI select 0);
|
||||||
|
[blck_sm_submarines,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
[blck_sm_submarines,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
blck_sm_submarines deleteAt (blck_sm_submarines find _x);
|
||||||
|
};
|
||||||
|
}forEach _sm_SDVVehicles;
|
||||||
|
|
||||||
|
_sm_Aircraft = +blck_sm_Aircraft;
|
||||||
|
{
|
||||||
|
// ["Exile_Chopper_Huey_Armed_Green",[22923.4,16953,3.19],"red",1000,0],
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_aircraftType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (isNull _group) && (diag_tickTime > _spawnAt) && (_spawnAt != -1)) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
_weapon = [toLower _difficulty] call blck_fnc_selectAILoadout;
|
||||||
|
//params["_coords","_skillAI","_helis",["_uniforms", blck_SkinList],["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_Launcher","none"],["_weaponList",[]],["_sideArms",[]]]
|
||||||
|
//diag_log format["[blckeagls static aircraftePatrol spawner] _weapon = %1 and _difficulty = %2",_weapon,_difficulty];
|
||||||
|
_return = [_pos,_difficulty,[_aircraftType]] call blck_fnc_spawnMissionHeli; // Allow the spawner to fit the default AI Loadouts for blckeagls; revisit at a later time when custom uniforms are set up for these AI.
|
||||||
|
//diag_log format["[blckeagls] static aircraftePatrol spawner -> _return = %1",_return];
|
||||||
|
_return params ["_patrolHeli","_ai","_abort"];
|
||||||
|
_group = group (_ai select 0);
|
||||||
|
[blck_sm_Aircraft,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Aircraft updated to %1",blck_sm_Aircraft];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ( (isNull _group) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
[blck_sm_Aircraft,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Aircraft updated to %1",blck_sm_Aircraft];
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
blck_sm_Aircraft deleteAt (blck_sm_Aircraft find _x);
|
||||||
|
};
|
||||||
|
}forEach _sm_Aircraft;
|
||||||
|
blck_sm_monitoring = 0;
|
@ -0,0 +1,293 @@
|
|||||||
|
/*
|
||||||
|
by Ghostrider [GRG]
|
||||||
|
for ghostridergaming
|
||||||
|
12/5/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 _triggerRange = 1000;
|
||||||
|
_fnc_evaluateSpawnedGroups = {
|
||||||
|
params["_patrolsArray"];
|
||||||
|
private _localpatrolsArray = +_patrolsArray;
|
||||||
|
{
|
||||||
|
// _x = [ [[22819.4,16929.5,5.33892],""red"",4,75,30], R Alpha 1-1,-1,0]"
|
||||||
|
_x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
|
// [[22819.4,16929.5,5.33892],""red"",4,75,30]
|
||||||
|
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
|
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: _x = %1",_x];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: units alive in group %1 = %2",_group, {alive _x} count (units _group)];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: _respawnInterval = %1",_respawnInterval];
|
||||||
|
if (_spawnedAt > 0) then
|
||||||
|
{
|
||||||
|
if (({alive _x} count (units _group) == 0)) then
|
||||||
|
{
|
||||||
|
diag_log format["all units in patrol %1 are dead | _respawnInterval = %2",_x,_respawnInterval];
|
||||||
|
if ((_respawnInterval != 0)) then // a group was spawned and all units are dead and we should respawn them after a certain interval
|
||||||
|
{
|
||||||
|
//[_patrolsArray,_x,grpNull,0,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupRepawnTimerFields;
|
||||||
|
private _index = _patrolsArray find _element;
|
||||||
|
private _element = _x;
|
||||||
|
_element set[1,grpNull];
|
||||||
|
_element set[2,0];
|
||||||
|
_element set[3,(diag_tickTime + _respawnInterval)];
|
||||||
|
_patrolsArray set[_index,_element];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups | element updated to %1",_element];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: _patrolsArray updated to %1",_patrolsArray];
|
||||||
|
};
|
||||||
|
if (_respawnInterval == 0) then // a group was spawned and all units are dead but we should not do a respawn
|
||||||
|
{
|
||||||
|
_patrolsArray deleteAt (_patrolsArray find _x);
|
||||||
|
diag_log format["patrol %1 deleted from static patrol cue",_x];
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
if ({alive _x} count (units _group) > 0) then
|
||||||
|
{
|
||||||
|
// Case where a player is near and we need to update the time stamp.
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
private _index = _patrolsArray find _x;
|
||||||
|
_x set[4, diag_tickTime];
|
||||||
|
_patrolsArray set[_index,_x];
|
||||||
|
diag_log format["player near static group for element %1 timestamp updated to ",_x, _x select 4];
|
||||||
|
} else {
|
||||||
|
// Case where no player is near and we need to test if the patrol should be de-spawned.
|
||||||
|
if ((diag_tickTime - _lastTimePlayerNear) > blck_sm_groupDespawnTime) then
|
||||||
|
{
|
||||||
|
diag_log format["despawning static group %1",_x];
|
||||||
|
private _index = _patrolsArray find _x;
|
||||||
|
_groupParameters set[2,{alive _x} count (units _group)];
|
||||||
|
_element = _x;
|
||||||
|
_element set[0,_groupParameters];
|
||||||
|
_element set[1,grpNull];
|
||||||
|
_element set[2,0];
|
||||||
|
_element set[3,(diag_tickTime + _respawnInterval)];
|
||||||
|
_patrolsArray set[_index,_element];
|
||||||
|
{
|
||||||
|
if (vehicle _x != _x) then {[vehicle _x] call blck_fnc_deleteAIVehicle};
|
||||||
|
[_x] call blck_fnc_deleteAI;
|
||||||
|
} forEach (units _group);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _localpatrolsArray;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
blck_sm_monitoring = 1;
|
||||||
|
_sm_groups = +blck_sm_Groups;
|
||||||
|
{
|
||||||
|
_x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
|
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
|
//diag_log format["<_sm_monitorStaticUnits::Group spawning routine:: _units = %1 | _x = %2 |_forEachIndex = %3",_units,_x,_forEachIndex];
|
||||||
|
//private _groupSpawned = false;
|
||||||
|
//diag_log format["there are %1 players in range",{_pos distance2D _x < _triggerRange} count allPlayers];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ((isNull _group)) then
|
||||||
|
{
|
||||||
|
diag_log format["testing if patrol %1 should be spawned | _spawnedAt = %2",_x,_spawnedAt];
|
||||||
|
diag_log format["_spawnedAt = %1 | _respawnAt = %2 | _respawnInterval = %3",_spawnedAt,_respawnAt, _respawnInterval];
|
||||||
|
if ( ((_spawnedAt == 0) && (_respawnAt == 0)) || ((diag_tickTime > _respawnAt) && (_respawnInterval > 0)) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static group spawner] evaluating _x = %1 ",_x];
|
||||||
|
_numAI = [_units] call blck_fnc_getNumberFromRange;
|
||||||
|
//diag_log format["[blckeagls static group spawner] _units = %1 and _numAI = %2",_units,_numAI];
|
||||||
|
// // params["_pos", "_center", _numai1, _numai2, _skillLevel, _minDist, _maxDist, _configureWaypoints, _uniforms, _headGear,_vests,_backpacks,_weaponList,_sideArms, _scuba ];
|
||||||
|
_group = [_pos,_pos,_numAI,_numAI,_difficulty,_patrolRadius-2,_patrolRadius,true] call blck_fnc_spawnGroup;
|
||||||
|
//diag_log format["[blckeagls static group spawner] _group %1",_group];
|
||||||
|
[blck_sm_Groups,_x,_group,diag_tickTime] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
diag_log format["_sm_monitorStaticUnits | spawn Group step :: blck_sm_Groups updated to %1",blck_sm_Groups];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_groups;
|
||||||
|
[blck_sm_Groups] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
|
_sm_scubaGroups = +blck_sm_scubaGroups;
|
||||||
|
{
|
||||||
|
|
||||||
|
// [ [px, py, pz] /* position*/, "difficulty", 4 /*Number to Spawn*/, 150 /*radius of patrol*/, _respawnInterval, _group, _spawnAt]
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
|
//diag_log format["<_sm_monitorScubaUnits:: _group = %1 | _x = %2 |_forEachIndex = %3",_group,_x,_forEachIndex];
|
||||||
|
private _groupSpawned = false;
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ((isNull _group) && (diag_tickTime > _spawnAt) && (_spawnAt != -1)) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static scubaGroup spawner] evaluating _x = %1 ",_x];
|
||||||
|
_numAI = [_units] call blck_fnc_getNumberFromRange;
|
||||||
|
//diag_log format["[blckeagls static scubaGroup spawning routine] _units = %1 and _numAI = %2",_units,_numAI];
|
||||||
|
//params["_pos", "_numUnits", ["_skillLevel","red"], "_center", ["_minDist",20], ["_maxDist",35], ["_uniforms",blck_UMS_uniforms], ["_headGear",blck_UMS_headgear],["_configureWaypoints",true],["_weapons",blck_UMS_weapons],["_vests",blck_UMS_vests]];
|
||||||
|
_group = [_pos,_difficulty,_units,_patrolRadius] call blck_fnc_spawnScubaGroup;
|
||||||
|
//diag_log format["[blckeagls static scubaGroup spawner] _group %1",_group];
|
||||||
|
[blck_sm_scubaGroups,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn Group step :: blck_sm_Groups updated to %1",blck_sm_Groups];
|
||||||
|
};
|
||||||
|
if (!(_groupSpawned) && (isNull _group) && (_spawnAt == -1) && (_respawnInterval > 0)) then // a group was spawned and all units are dead and we should rspawn them after a certain interval
|
||||||
|
{
|
||||||
|
[blck_sm_scubaGroups,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set scubaGroup respawn time step :: blck_sm_Groups updated to %1",blck_sm_scubaGroups];
|
||||||
|
};
|
||||||
|
if (!(_groupSpawned) && (isNull _group) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead but we should not do a respawn
|
||||||
|
{
|
||||||
|
blck_sm_scubaGroups deleteAt (blck_sm_scubaGroups find _x);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_scubaGroups;
|
||||||
|
|
||||||
|
_sm_Emplaced = +blck_sm_Emplaced;
|
||||||
|
{
|
||||||
|
// ["B_G_Mortar_01_F",[22944.3,16820.5,3.14243],"green",0,0,_group,_spawnAt]
|
||||||
|
//diag_log format["_sm_monitorEmplacedUnits::-> _x = %1",_x];
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static Emplaced spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty];
|
||||||
|
// params["_coords","_missionEmplacedWeapons","_useRelativePos","_noEmplacedWeapons","_aiDifficultyLevel",["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols]];
|
||||||
|
_group = [_pos,[_groupParameters],false,1,_difficulty] call blck_fnc_spawnEmplacedWeaponArray;
|
||||||
|
[blck_sm_Emplaced,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Emplaced updated to %1",blck_sm_Emplaced];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
[blck_sm_Emplaced,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Emplaced updated to %1",blck_sm_Emplaced];
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0)) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
blck_sm_Emplaced deleteAt (blck_sm_Emplaced find _x);
|
||||||
|
};
|
||||||
|
|
||||||
|
}forEach _sm_Emplaced;
|
||||||
|
|
||||||
|
_sm_Vehicles = +blck_sm_Vehicles;
|
||||||
|
{
|
||||||
|
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt],
|
||||||
|
//diag_log format["_sm_monitorVehicles::-> _x = %1",_x];
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_vehicleType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_isScubaGroup",false]];
|
||||||
|
_return = [_pos,1,_difficulty,[_groupParameters],false] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
// _return = [_vehicles, _missionAI, _abort];
|
||||||
|
_group = group (_return select 1 select 0);
|
||||||
|
[blck_sm_Vehicles,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
[blck_sm_Vehicles,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
blck_sm_Vehicles deleteAt (blck_sm_Vehicles find _x);
|
||||||
|
};
|
||||||
|
}forEach _sm_Vehicles;
|
||||||
|
|
||||||
|
_sm_surfaceVehicles = +blck_sm_surfaceShips;
|
||||||
|
{
|
||||||
|
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt],
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static vehiclePatrol spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty];
|
||||||
|
[_pos,1,_difficulty,[_groupParameters],false] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
_return params ["_vehicles", "_missionAI", "_abort"];
|
||||||
|
_group = group (_missionAI select 0);
|
||||||
|
[blck_sm_surfaceShips,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
[blck_sm_surfaceShips,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
blck_sm_surfaceShips deleteAt (blck_sm_surfaceShips find _x);
|
||||||
|
};
|
||||||
|
}forEach _sm_surfaceVehicles;
|
||||||
|
|
||||||
|
_sm_SDVVehicles = +blck_sm_submarines;
|
||||||
|
{
|
||||||
|
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt],
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static sub patrol spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty];
|
||||||
|
//params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_isScubaGroup",false]];
|
||||||
|
_return = [_pos,1,_difficulty,[_groupParameters],false,blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,blck_backpacks,blck_UMS_weapons,blck_Pistols,true] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
_return params ["_vehicles", "_missionAI", "_abort"];
|
||||||
|
_group = group (_missionAI select 0);
|
||||||
|
[blck_sm_submarines,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
[blck_sm_submarines,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
blck_sm_submarines deleteAt (blck_sm_submarines find _x);
|
||||||
|
};
|
||||||
|
}forEach _sm_SDVVehicles;
|
||||||
|
|
||||||
|
_sm_Aircraft = +blck_sm_Aircraft;
|
||||||
|
{
|
||||||
|
// ["Exile_Chopper_Huey_Armed_Green",[22923.4,16953,3.19],"red",1000,0],
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_aircraftType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (isNull _group) && (diag_tickTime > _spawnAt) && (_spawnAt != -1)) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
_weapon = [toLower _difficulty] call blck_fnc_selectAILoadout;
|
||||||
|
//params["_coords","_skillAI","_helis",["_uniforms", blck_SkinList],["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_Launcher","none"],["_weaponList",[]],["_sideArms",[]]]
|
||||||
|
//diag_log format["[blckeagls static aircraftePatrol spawner] _weapon = %1 and _difficulty = %2",_weapon,_difficulty];
|
||||||
|
_return = [_pos,_difficulty,[_aircraftType]] call blck_fnc_spawnMissionHeli; // Allow the spawner to fit the default AI Loadouts for blckeagls; revisit at a later time when custom uniforms are set up for these AI.
|
||||||
|
//diag_log format["[blckeagls] static aircraftePatrol spawner -> _return = %1",_return];
|
||||||
|
_return params ["_patrolHeli","_ai","_abort"];
|
||||||
|
_group = group (_ai select 0);
|
||||||
|
[blck_sm_Aircraft,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Aircraft updated to %1",blck_sm_Aircraft];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ( (isNull _group) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
[blck_sm_Aircraft,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Aircraft updated to %1",blck_sm_Aircraft];
|
||||||
|
};
|
||||||
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead
|
||||||
|
{
|
||||||
|
blck_sm_Aircraft deleteAt (blck_sm_Aircraft find _x);
|
||||||
|
};
|
||||||
|
}forEach _sm_Aircraft;
|
||||||
|
blck_sm_monitoring = 0;
|
@ -10,61 +10,241 @@
|
|||||||
http://creativecommons.org/licenses/by-nc-sa/4.0/
|
http://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||||
*/
|
*/
|
||||||
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
|
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
|
||||||
|
#define onFoot 1
|
||||||
|
#define inVehicle 2
|
||||||
|
#define groupParameters 0
|
||||||
|
#define patrolGroup 1
|
||||||
|
#define spawnedAt 2
|
||||||
|
#define respawnAt 3
|
||||||
|
#define lastTimePlayerNear 4
|
||||||
|
|
||||||
private _triggerRange = 2000;
|
|
||||||
_fnc_updateGroupSpawnTimerFields = {
|
_fnc_updateGroupSpawnTimerFields = {
|
||||||
//diag_log format["_fnc_updateGroupSpawnTimerFields::-> _this = %1",_this];
|
diag_log format["_fnc_updateGroupSpawnTimerFields::-> _this = %1",_this];
|
||||||
params["_array","_element",["_group",grpNull],["_spawnTime",0]];
|
params["_array","_element",["_group",grpNull],["_spawnedAt",0]];
|
||||||
private["_index"];
|
private _index = _array find _element;
|
||||||
_index = _array find _element;
|
_element set[patrolGroup,_group];
|
||||||
_element set[1,_group];
|
_element set[spawnedAt,_spawnedAt];
|
||||||
_element set[2,_spawnTime];
|
|
||||||
_array set[_index,_element];
|
_array set[_index,_element];
|
||||||
};
|
};
|
||||||
|
|
||||||
private["_group","_groupParameters","_numAI","_return"];
|
triggerRange = 1000;
|
||||||
|
|
||||||
|
_fnc_evaluateSpawnedGroups = {
|
||||||
|
params["_aiType","_patrolsArray"];
|
||||||
|
private _localpatrolsArray = +_patrolsArray;
|
||||||
|
{
|
||||||
|
// _x = [ [[22819.4,16929.5,5.33892],""red"",4,75,30], R Alpha 1-1,-1,0]"
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: time = %2 | _x = %1",_x,diag_tickTime];
|
||||||
|
_x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
|
// [[22819.4,16929.5,5.33892],""red"",4,75,30]
|
||||||
|
//_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: typeName _groupParameters select 0 = %1",typeName (_groupParameters select 0)];
|
||||||
|
private["_pos","_difficulty","_units","_patrolRadius","_respawnInterval","_vehicleType"];
|
||||||
|
if (_aiType isEqualTo onFoot) then {
|
||||||
|
//_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"]
|
||||||
|
_pos = _groupParameters select 0;
|
||||||
|
_difficulty = _groupParameters select 1;
|
||||||
|
_units = _groupParameters select 2;
|
||||||
|
_patrolRadius = _groupParameters select 3;
|
||||||
|
_respawnInterval = _groupParameters select 4;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_aiType isEqualTo inVehicle) then
|
||||||
|
{
|
||||||
|
//_groupParameters params["_vehicleType","_pos","_difficulty","_patrolRadius","_respawnInterval"]};
|
||||||
|
_vehicleType = _groupParameters select 0;
|
||||||
|
_pos = _groupParameters select 1;
|
||||||
|
_difficulty = _groupParameters select 2;
|
||||||
|
_patrolRadius = _groupParameters select 3;
|
||||||
|
_respawnInterval = _groupParameters select 4;
|
||||||
|
};
|
||||||
|
if !(isNull _group) then
|
||||||
|
{
|
||||||
|
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: _groupParameters = %1",_groupParameters];
|
||||||
|
//diag_log format["_fnc_evaluateSpawnedGroups: _pos = %1 | _difficulty = %2 | _patrolRadius = %3 | _respawnInterval = %4",_pos,_difficulty,_patrolRadius,_respawnInterval];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: units alive in group %1 = %2",_group, {alive _x} count (units _group)];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: _respawnInterval = %1",_respawnInterval];
|
||||||
|
if (_spawnedAt > 0) then
|
||||||
|
{
|
||||||
|
if (({alive _x} count (units _group) == 0)) then
|
||||||
|
{
|
||||||
|
diag_log format["all units in patrol %1 are dead | _respawnInterval = %2",_x,_respawnInterval];
|
||||||
|
if ((_respawnInterval != 0)) then // a group was spawned and all units are dead and we should respawn them after a certain interval
|
||||||
|
{
|
||||||
|
//[_patrolsArray,_x,grpNull,0,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupRepawnTimerFields;
|
||||||
|
private _index = _patrolsArray find _element;
|
||||||
|
private _element = _x;
|
||||||
|
// _x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
|
_element set[patrolGroup,grpNull];
|
||||||
|
//_element set[2,0];
|
||||||
|
if (_respawnInterval > 0) then {_element set[respawnAt,(diag_tickTime + _respawnInterval)]};
|
||||||
|
_patrolsArray set[_index,_element];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups | element updated to %1",_element];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: _patrolsArray updated to %1",_patrolsArray];
|
||||||
|
};
|
||||||
|
if (_respawnInterval == 0) then // a group was spawned and all units are dead but we should not do a respawn
|
||||||
|
{
|
||||||
|
_patrolsArray deleteAt (_patrolsArray find _x);
|
||||||
|
diag_log format["patrol %1 deleted from static patrol cue",_x];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if ({alive _x} count (units _group) > 0) then
|
||||||
|
{
|
||||||
|
// Case where a player is near and we need to update the time stamp.
|
||||||
|
if ([_pos,triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
private _index = _patrolsArray find _x;
|
||||||
|
// _x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
|
_x set[lastTimePlayerNear, diag_tickTime];
|
||||||
|
_patrolsArray set[_index,_x];
|
||||||
|
diag_log format["player near static group for element %1 timestamp updated to %2",_x, _x select lastTimePlayerNear];
|
||||||
|
} else {
|
||||||
|
// Case where no player is near and we need to test if the patrol should be de-spawned.
|
||||||
|
if ((diag_tickTime - _lastTimePlayerNear) > blck_sm_groupDespawnTime) then
|
||||||
|
{
|
||||||
|
// _x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
|
diag_log format["despawning static group %1",_x];
|
||||||
|
private _index = _patrolsArray find _x;
|
||||||
|
_groupParameters set[2,{alive _x} count (units _group)];
|
||||||
|
_element = _x;
|
||||||
|
_element set[groupParameters,_groupParameters];
|
||||||
|
_element set[patrolGroup,grpNull];
|
||||||
|
//_element set[2,0];
|
||||||
|
_element set[respawnAt,(diag_tickTime + _respawnInterval)];
|
||||||
|
_patrolsArray set[_index,_element];
|
||||||
|
{
|
||||||
|
if (vehicle _x != _x) then {[vehicle _x] call blck_fnc_deleteAIVehicle};
|
||||||
|
[_x] call blck_fnc_deleteAI;
|
||||||
|
} forEach (units _group);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
if (_respawnInterval == 0 && _spawnedAt > 0) then // a group was spawned and all units are dead but we should not do a respawn
|
||||||
|
{
|
||||||
|
_patrolsArray deleteAt (_patrolsArray find _x);
|
||||||
|
diag_log format["patrol %1 deleted from static patrol cue",_x];
|
||||||
|
};
|
||||||
|
if (_respawnInterval > 0 && _spawnedAt > 0 && _respawnAt == 0) then
|
||||||
|
{
|
||||||
|
// _x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
|
private _index = _patrolsArray find _x;
|
||||||
|
_element = _x;
|
||||||
|
_element set[spawnedAt,0];
|
||||||
|
_element set[respawnAt,(diag_tickTime + _respawnInterval)];
|
||||||
|
_patrolsArray set[_index,_element];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _localpatrolsArray;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
blck_sm_monitoring = 1;
|
||||||
_sm_groups = +blck_sm_Groups;
|
_sm_groups = +blck_sm_Groups;
|
||||||
{
|
{
|
||||||
|
_x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
// [ [px, py, pz] /* position*/, "difficulty", 4 /*Number to Spawn*/, 150 /*radius of patrol*/, _respawnTime, _group, _spawnAt]
|
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
_x params["_groupParameters","_group","_spawnAt"];
|
diag_log format["<_sm_monitorStaticUnits::Group spawning routine:: _units = %1 | _x = %2 |_forEachIndex = %3",_units,_x,_forEachIndex];
|
||||||
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnTime"];
|
//private _groupSpawned = false;
|
||||||
//diag_log format["<_sm_monitorStaticUnits::Group spawning routine:: _units = %1 | _x = %2 |_forEachIndex = %3",_units,_x,_forEachIndex];
|
diag_log format["there are %1 players in range",{_pos distance2D _x < triggerRange} count allPlayers];
|
||||||
private _groupSpawned = false;
|
if ([_pos,triggerRange] call blck_fnc_playerInRange) then
|
||||||
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
|
||||||
{
|
{
|
||||||
if ((isNull _group) && (diag_tickTime > _spawnAt) && (_spawnAt != -1)) then // no group has been spawned, spawn one.
|
if ((isNull _group)) then
|
||||||
{
|
{
|
||||||
//diag_log format["[blckeagls static group spawner] evaluating _x = %1 ",_x];
|
diag_log format["testing if patrol %1 should be spawned | _spawnedAt = %2",_x,_spawnedAt];
|
||||||
|
diag_log format["_spawnedAt = %1 | _respawnAt = %2 | _respawnInterval = %3",_spawnedAt,_respawnAt, _respawnInterval];
|
||||||
|
if ( ((_spawnedAt == 0) && (_respawnAt == 0)) || ((diag_tickTime > _respawnAt) && (_respawnAt > 0)) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
diag_log format["[blckeagls static group spawner] evaluating _x = %1 ",_x];
|
||||||
_numAI = [_units] call blck_fnc_getNumberFromRange;
|
_numAI = [_units] call blck_fnc_getNumberFromRange;
|
||||||
//diag_log format["[blckeagls static group spawner] _units = %1 and _numAI = %2",_units,_numAI];
|
diag_log format["[blckeagls static group spawner] _units = %1 and _numAI = %2",_units,_numAI];
|
||||||
// // params["_pos", "_center", _numai1, _numai2, _skillLevel, _minDist, _maxDist, _configureWaypoints, _uniforms, _headGear,_vests,_backpacks,_weaponList,_sideArms, _scuba ];
|
// // params["_pos", "_center", _numai1, _numai2, _skillLevel, _minDist, _maxDist, _configureWaypoints, _uniforms, _headGear,_vests,_backpacks,_weaponList,_sideArms, _scuba ];
|
||||||
_group = [_pos,_pos,_numAI,_numAI,_difficulty,_patrolRadius-2,_patrolRadius,true] call blck_fnc_spawnGroup;
|
_group = [_pos,_pos,_numAI,_numAI,_difficulty,_patrolRadius-2,_patrolRadius,true] call blck_fnc_spawnGroup;
|
||||||
//diag_log format["[blckeagls static group spawner] _group %1",_group];
|
diag_log format["[blckeagls static group spawner] _group %1",_group];
|
||||||
[blck_sm_Groups,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
[blck_sm_Groups,_x,_group,diag_tickTime] call _fnc_updateGroupSpawnTimerFields;
|
||||||
//diag_log format["_sm_monitorStaticUnits | spawn Group step :: blck_sm_Groups updated to %1",blck_sm_Groups];
|
diag_log format["_sm_monitorStaticUnits | spawn Group step :: blck_sm_Groups updated to %1",blck_sm_Groups];
|
||||||
};
|
};
|
||||||
if (!(_groupSpawned) && (isNull _group) && (_spawnAt == -1) && (_respawnTime > 0)) then // a group was spawned and all units are dead and we should rspawn them after a certain interval
|
|
||||||
{
|
|
||||||
[blck_sm_Groups,_x,_group,(diag_tickTime + _respawnTime)] call _fnc_updateGroupSpawnTimerFields;
|
|
||||||
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Groups updated to %1",blck_sm_Groups];
|
|
||||||
};
|
|
||||||
if (!(_groupSpawned) && (isNull _group) && (_spawnAt == -1) && (_respawnTime == 0) ) then // a group was spawned and all units are dead but we should not do a respawn
|
|
||||||
{
|
|
||||||
blck_sm_Groups deleteAt (blck_sm_Groups find _x);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}forEach _sm_groups;
|
}forEach _sm_groups;
|
||||||
|
[onFoot,blck_sm_Groups] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
|
|
||||||
|
_sm_Vehicles = +blck_sm_Vehicles;
|
||||||
|
{
|
||||||
|
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt],
|
||||||
|
//diag_log format["_sm_monitorVehicles::-> _x = %1",_x];
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_vehicleType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_isScubaGroup",false]];
|
||||||
|
_return = [_pos,1,_difficulty,[_groupParameters],false] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
// _return = [_vehicles, _missionAI, _abort];
|
||||||
|
_group = group (_return select 1 select 0);
|
||||||
|
[blck_sm_Vehicles,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_Vehicles;
|
||||||
|
[inVehicle,blck_sm_Vehicles] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
|
_sm_Aircraft = +blck_sm_Aircraft;
|
||||||
|
{
|
||||||
|
// ["Exile_Chopper_Huey_Armed_Green",[22923.4,16953,3.19],"red",1000,0],
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_aircraftType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (isNull _group) && (diag_tickTime > _spawnAt) && (_spawnAt != -1)) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
_weapon = [toLower _difficulty] call blck_fnc_selectAILoadout;
|
||||||
|
//params["_coords","_skillAI","_helis",["_uniforms", blck_SkinList],["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_Launcher","none"],["_weaponList",[]],["_sideArms",[]]]
|
||||||
|
//diag_log format["[blckeagls static aircraftePatrol spawner] _weapon = %1 and _difficulty = %2",_weapon,_difficulty];
|
||||||
|
_return = [_pos,_difficulty,[_aircraftType]] call blck_fnc_spawnMissionHeli; // Allow the spawner to fit the default AI Loadouts for blckeagls; revisit at a later time when custom uniforms are set up for these AI.
|
||||||
|
diag_log format["[blckeagls] static aircraftePatrol spawner -> _return = %1",_return];
|
||||||
|
_return params ["_patrolHeli","_ai","_abort"];
|
||||||
|
_group = group (_ai select 0);
|
||||||
|
[blck_sm_Aircraft,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Aircraft updated to %1",blck_sm_Aircraft];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_Aircraft;
|
||||||
|
[inVehicle,blck_sm_Aircraft] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
|
_sm_Emplaced = +blck_sm_Emplaced;
|
||||||
|
{
|
||||||
|
// ["B_G_Mortar_01_F",[22944.3,16820.5,3.14243],"green",0,0,_group,_spawnAt]
|
||||||
|
//diag_log format["_sm_monitorEmplacedUnits::-> _x = %1",_x];
|
||||||
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
|
_groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static Emplaced spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty];
|
||||||
|
// params["_coords","_missionEmplacedWeapons","_useRelativePos","_noEmplacedWeapons","_aiDifficultyLevel",["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols]];
|
||||||
|
_group = [_pos,[_groupParameters],false,1,_difficulty] call blck_fnc_spawnEmplacedWeaponArray;
|
||||||
|
[blck_sm_Emplaced,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Emplaced updated to %1",blck_sm_Emplaced];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_Emplaced;
|
||||||
|
[inVehicle,blck_sm_Emplaced] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
_sm_scubaGroups = +blck_sm_scubaGroups;
|
_sm_scubaGroups = +blck_sm_scubaGroups;
|
||||||
{
|
{
|
||||||
|
|
||||||
// [ [px, py, pz] /* position*/, "difficulty", 4 /*Number to Spawn*/, 150 /*radius of patrol*/, _respawnTime, _group, _spawnAt]
|
// [ [px, py, pz] /* position*/, "difficulty", 4 /*Number to Spawn*/, 150 /*radius of patrol*/, _respawnInterval, _group, _spawnAt]
|
||||||
_x params["_groupParameters","_group","_spawnAt"];
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnTime"];
|
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
//diag_log format["<_sm_monitorScubaUnits:: _group = %1 | _x = %2 |_forEachIndex = %3",_group,_x,_forEachIndex];
|
//diag_log format["<_sm_monitorScubaUnits:: _group = %1 | _x = %2 |_forEachIndex = %3",_group,_x,_forEachIndex];
|
||||||
private _groupSpawned = false;
|
private _groupSpawned = false;
|
||||||
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
if ([_pos,triggerRange] call blck_fnc_playerInRange) then
|
||||||
{
|
{
|
||||||
if ((isNull _group) && (diag_tickTime > _spawnAt) && (_spawnAt != -1)) then // no group has been spawned, spawn one.
|
if ((isNull _group) && (diag_tickTime > _spawnAt) && (_spawnAt != -1)) then // no group has been spawned, spawn one.
|
||||||
{
|
{
|
||||||
@ -77,82 +257,16 @@ _sm_scubaGroups = +blck_sm_scubaGroups;
|
|||||||
[blck_sm_scubaGroups,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
[blck_sm_scubaGroups,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
||||||
//diag_log format["_sm_monitorStaticUnits | spawn Group step :: blck_sm_Groups updated to %1",blck_sm_Groups];
|
//diag_log format["_sm_monitorStaticUnits | spawn Group step :: blck_sm_Groups updated to %1",blck_sm_Groups];
|
||||||
};
|
};
|
||||||
if (!(_groupSpawned) && (isNull _group) && (_spawnAt == -1) && (_respawnTime > 0)) then // a group was spawned and all units are dead and we should rspawn them after a certain interval
|
|
||||||
{
|
|
||||||
[blck_sm_scubaGroups,_x,_group,(diag_tickTime + _respawnTime)] call _fnc_updateGroupSpawnTimerFields;
|
|
||||||
//diag_log format["_sm_monitorStaticUnits | set scubaGroup respawn time step :: blck_sm_Groups updated to %1",blck_sm_scubaGroups];
|
|
||||||
};
|
|
||||||
if (!(_groupSpawned) && (isNull _group) && (_spawnAt == -1) && (_respawnTime == 0) ) then // a group was spawned and all units are dead but we should not do a respawn
|
|
||||||
{
|
|
||||||
blck_sm_scubaGroups deleteAt (blck_sm_scubaGroups find _x);
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}forEach _sm_scubaGroups;
|
}forEach _sm_scubaGroups;
|
||||||
|
[onFoot,blck_sm_scubaGroups] call _fnc_evaluateSpawnedGroups;
|
||||||
_sm_Emplaced = +blck_sm_Emplaced;
|
|
||||||
{
|
|
||||||
// ["B_G_Mortar_01_F",[22944.3,16820.5,3.14243],"green",0,0,_group,_spawnAt]
|
|
||||||
//diag_log format["_sm_monitorEmplacedUnits::-> _x = %1",_x];
|
|
||||||
_x params["_groupParameters","_group","_spawnAt"];
|
|
||||||
_groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnTime"];
|
|
||||||
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
|
||||||
{
|
|
||||||
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
|
||||||
{
|
|
||||||
//diag_log format["[blckeagls static Emplaced spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty];
|
|
||||||
// params["_coords","_missionEmplacedWeapons","_useRelativePos","_noEmplacedWeapons","_aiDifficultyLevel",["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols]];
|
|
||||||
_group = [_pos,[_groupParameters],false,1,_difficulty] call blck_fnc_spawnEmplacedWeaponArray;
|
|
||||||
[blck_sm_Emplaced,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
|
||||||
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Emplaced updated to %1",blck_sm_Emplaced];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnTime > 0) ) then // a group was spawned and all units are dead
|
|
||||||
{
|
|
||||||
[blck_sm_Emplaced,_x,_group,(diag_tickTime + _respawnTime)] call _fnc_updateGroupSpawnTimerFields;
|
|
||||||
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Emplaced updated to %1",blck_sm_Emplaced];
|
|
||||||
};
|
|
||||||
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnTime == 0)) then // a group was spawned and all units are dead
|
|
||||||
{
|
|
||||||
blck_sm_Emplaced deleteAt (blck_sm_Emplaced find _x);
|
|
||||||
};
|
|
||||||
|
|
||||||
}forEach _sm_Emplaced;
|
|
||||||
|
|
||||||
_sm_Vehicles = +blck_sm_Vehicles;
|
|
||||||
{
|
|
||||||
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt],
|
|
||||||
//diag_log format["_sm_monitorVehicles::-> _x = %1",_x];
|
|
||||||
_x params["_groupParameters","_group","_spawnAt"];
|
|
||||||
_groupParameters params["_vehicleType","_pos","_difficulty","_patrolRadius","_respawnTime"];
|
|
||||||
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
|
||||||
{
|
|
||||||
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
|
||||||
{
|
|
||||||
//params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_isScubaGroup",false]];
|
|
||||||
_return = [_pos,1,_difficulty,[_groupParameters],false] call blck_fnc_spawnMissionVehiclePatrols;
|
|
||||||
// _return = [_vehicles, _missionAI, _abort];
|
|
||||||
_group = group (_return select 1 select 0);
|
|
||||||
[blck_sm_Vehicles,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
|
||||||
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnTime > 0) ) then // a group was spawned and all units are dead
|
|
||||||
{
|
|
||||||
[blck_sm_Vehicles,_x,_group,(diag_tickTime + _respawnTime)] call _fnc_updateGroupSpawnTimerFields;
|
|
||||||
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
|
||||||
};
|
|
||||||
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnTime == 0) ) then // a group was spawned and all units are dead
|
|
||||||
{
|
|
||||||
blck_sm_Vehicles deleteAt (blck_sm_Vehicles find _x);
|
|
||||||
};
|
|
||||||
}forEach _sm_Vehicles;
|
|
||||||
|
|
||||||
_sm_surfaceVehicles = +blck_sm_surfaceShips;
|
_sm_surfaceVehicles = +blck_sm_surfaceShips;
|
||||||
{
|
{
|
||||||
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt],
|
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt],
|
||||||
_x params["_groupParameters","_group","_spawnAt"];
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
_groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnTime"];
|
_groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
if ([_pos,triggerRange] call blck_fnc_playerInRange) then
|
||||||
{
|
{
|
||||||
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
{
|
{
|
||||||
@ -164,23 +278,15 @@ _sm_surfaceVehicles = +blck_sm_surfaceShips;
|
|||||||
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnTime > 0) ) then // a group was spawned and all units are dead
|
|
||||||
{
|
|
||||||
[blck_sm_surfaceShips,_x,_group,(diag_tickTime + _respawnTime)] call _fnc_updateGroupSpawnTimerFields;
|
|
||||||
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
|
||||||
};
|
|
||||||
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnTime == 0) ) then // a group was spawned and all units are dead
|
|
||||||
{
|
|
||||||
blck_sm_surfaceShips deleteAt (blck_sm_surfaceShips find _x);
|
|
||||||
};
|
|
||||||
}forEach _sm_surfaceVehicles;
|
}forEach _sm_surfaceVehicles;
|
||||||
|
[inVehicle,blck_sm_surfaceShips] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
_sm_SDVVehicles = +blck_sm_submarines;
|
_sm_SDVVehicles = +blck_sm_submarines;
|
||||||
{
|
{
|
||||||
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt],
|
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt],
|
||||||
_x params["_groupParameters","_group","_spawnAt"];
|
_x params["_groupParameters","_group","_spawnAt"];
|
||||||
_groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnTime"];
|
_groupParameters params["_weapType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
if ([_pos,triggerRange] call blck_fnc_playerInRange) then
|
||||||
{
|
{
|
||||||
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
if ( (_group isEqualTo grpNull) && (diag_tickTime > _spawnAt) && (_spawnAt != -1) ) then // no group has been spawned, spawn one.
|
||||||
{
|
{
|
||||||
@ -193,44 +299,16 @@ _sm_SDVVehicles = +blck_sm_submarines;
|
|||||||
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnTime > 0) ) then // a group was spawned and all units are dead
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval > 0) ) then // a group was spawned and all units are dead
|
||||||
{
|
{
|
||||||
[blck_sm_submarines,_x,_group,(diag_tickTime + _respawnTime)] call _fnc_updateGroupSpawnTimerFields;
|
[blck_sm_submarines,_x,_group,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupSpawnTimerFields;
|
||||||
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
};
|
};
|
||||||
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnTime == 0) ) then // a group was spawned and all units are dead
|
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnInterval == 0) ) then // a group was spawned and all units are dead
|
||||||
{
|
{
|
||||||
blck_sm_submarines deleteAt (blck_sm_submarines find _x);
|
blck_sm_submarines deleteAt (blck_sm_submarines find _x);
|
||||||
};
|
};
|
||||||
}forEach _sm_SDVVehicles;
|
}forEach _sm_SDVVehicles;
|
||||||
|
[inVehicle,blck_sm_submarines] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
_sm_Aircraft = +blck_sm_Aircraft;
|
blck_sm_monitoring = 0;
|
||||||
{
|
|
||||||
// ["Exile_Chopper_Huey_Armed_Green",[22923.4,16953,3.19],"red",1000,0],
|
|
||||||
_x params["_groupParameters","_group","_spawnAt"];
|
|
||||||
_groupParameters params["_aircraftType","_pos","_difficulty","_patrolRadius","_respawnTime"];
|
|
||||||
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
|
||||||
{
|
|
||||||
if ( (isNull _group) && (diag_tickTime > _spawnAt) && (_spawnAt != -1)) then // no group has been spawned, spawn one.
|
|
||||||
{
|
|
||||||
_weapon = [toLower _difficulty] call blck_fnc_selectAILoadout;
|
|
||||||
//params["_coords","_skillAI","_helis",["_uniforms", blck_SkinList],["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_Launcher","none"],["_weaponList",[]],["_sideArms",[]]]
|
|
||||||
//diag_log format["[blckeagls static aircraftePatrol spawner] _weapon = %1 and _difficulty = %2",_weapon,_difficulty];
|
|
||||||
_return = [_pos,_difficulty,[_aircraftType]] call blck_fnc_spawnMissionHeli; // Allow the spawner to fit the default AI Loadouts for blckeagls; revisit at a later time when custom uniforms are set up for these AI.
|
|
||||||
//diag_log format["[blckeagls] static aircraftePatrol spawner -> _return = %1",_return];
|
|
||||||
_return params ["_patrolHeli","_ai","_abort"];
|
|
||||||
_group = group (_ai select 0);
|
|
||||||
[blck_sm_Aircraft,_x,_group,-1] call _fnc_updateGroupSpawnTimerFields;
|
|
||||||
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Aircraft updated to %1",blck_sm_Aircraft];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
if ( (isNull _group) && (_spawnAt == -1) && (_respawnTime > 0) ) then // a group was spawned and all units are dead
|
|
||||||
{
|
|
||||||
[blck_sm_Aircraft,_x,_group,(diag_tickTime + _respawnTime)] call _fnc_updateGroupSpawnTimerFields;
|
|
||||||
//diag_log format["_sm_monitorStaticUnits | set Group respawn time step :: blck_sm_Aircraft updated to %1",blck_sm_Aircraft];
|
|
||||||
};
|
|
||||||
if ( (_group isEqualTo grpNull) && (_spawnAt == -1) && (_respawnTime == 0) ) then // a group was spawned and all units are dead
|
|
||||||
{
|
|
||||||
blck_sm_Aircraft deleteAt (blck_sm_Aircraft find _x);
|
|
||||||
};
|
|
||||||
}forEach _sm_Aircraft;
|
|
@ -0,0 +1,259 @@
|
|||||||
|
/*
|
||||||
|
by Ghostrider [GRG]
|
||||||
|
for ghostridergaming
|
||||||
|
12/5/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";
|
||||||
|
diag_log format["Running _fnc_sm_monitorStaticUnits at Time = %1",diag_tickTime];
|
||||||
|
_fnc_updateGroupSpawnTimerFields = {
|
||||||
|
diag_log format["_fnc_updateGroupSpawnTimerFields::-> _this = %1",_this];
|
||||||
|
params["_array","_element",["_group",grpNull],["_spawnedAt",0]];
|
||||||
|
private _index = _array find _element;
|
||||||
|
_element set[1,_group];
|
||||||
|
_element set[2,_spawnedAt];
|
||||||
|
_array set[_index,_element];
|
||||||
|
};
|
||||||
|
private _triggerRange = 1000;
|
||||||
|
_fnc_evaluateSpawnedGroups = {
|
||||||
|
params["_patrolsArray"];
|
||||||
|
private _localpatrolsArray = +_patrolsArray;
|
||||||
|
{
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: _x = %1",_x];
|
||||||
|
// _x = [ [[22819.4,16929.5,5.33892],""red"",4,75,30], R Alpha 1-1,-1,0]"
|
||||||
|
_x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
|
// [[22819.4,16929.5,5.33892],""red"",4,75,30]
|
||||||
|
if !(isNull _group) then
|
||||||
|
{
|
||||||
|
if (isArray _groupParameters select 0) then {_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"]};
|
||||||
|
if (isText _groupParameters select 0) then {_groupParameters params["_vehicleType","_pos","_difficulty","_patrolRadius","_respawnInterval"]
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: units alive in group %1 = %2",_group, {alive _x} count (units _group)];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: _respawnInterval = %1",_respawnInterval];
|
||||||
|
if (_spawnedAt > 0) then
|
||||||
|
{
|
||||||
|
if (({alive _x} count (units _group) == 0)) then
|
||||||
|
{
|
||||||
|
diag_log format["all units in patrol %1 are dead | _respawnInterval = %2",_x,_respawnInterval];
|
||||||
|
if ((_respawnInterval != 0)) then // a group was spawned and all units are dead and we should respawn them after a certain interval
|
||||||
|
{
|
||||||
|
//[_patrolsArray,_x,grpNull,0,(diag_tickTime + _respawnInterval)] call _fnc_updateGroupRepawnTimerFields;
|
||||||
|
private _index = _patrolsArray find _element;
|
||||||
|
private _element = _x;
|
||||||
|
_element set[1,grpNull];
|
||||||
|
_element set[2,0];
|
||||||
|
_element set[3,(diag_tickTime + _respawnInterval)];
|
||||||
|
_patrolsArray set[_index,_element];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups | element updated to %1",_element];
|
||||||
|
diag_log format["_fnc_evaluateSpawnedGroups: _patrolsArray updated to %1",_patrolsArray];
|
||||||
|
};
|
||||||
|
if (_respawnInterval == 0) then // a group was spawned and all units are dead but we should not do a respawn
|
||||||
|
{
|
||||||
|
_patrolsArray deleteAt (_patrolsArray find _x);
|
||||||
|
diag_log format["patrol %1 deleted from static patrol cue",_x];
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
if ({alive _x} count (units _group) > 0) then
|
||||||
|
{
|
||||||
|
// Case where a player is near and we need to update the time stamp.
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
private _index = _patrolsArray find _x;
|
||||||
|
_x set[4, diag_tickTime];
|
||||||
|
_patrolsArray set[_index,_x];
|
||||||
|
diag_log format["player near static group for element %1 timestamp updated to %2",_x, _x select 4];
|
||||||
|
} else {
|
||||||
|
// Case where no player is near and we need to test if the patrol should be de-spawned.
|
||||||
|
if ((diag_tickTime - _lastTimePlayerNear) > blck_sm_groupDespawnTime) then
|
||||||
|
{
|
||||||
|
diag_log format["despawning static mission group %1",_x];
|
||||||
|
private _index = _patrolsArray find _x;
|
||||||
|
if (isArray _groupParameters select 0) then
|
||||||
|
{
|
||||||
|
_groupParameters set[2,{alive _x} count (units _group)];
|
||||||
|
};
|
||||||
|
_element = _x;
|
||||||
|
_element set[0,_groupParameters];
|
||||||
|
_element set[1,grpNull];
|
||||||
|
_element set[2,0];
|
||||||
|
_element set[3,(diag_tickTime + _respawnInterval)];
|
||||||
|
_patrolsArray set[_index,_element];
|
||||||
|
{
|
||||||
|
if (vehicle _x != _x) then {[vehicle _x] call blck_fnc_deleteAIVehicle};
|
||||||
|
[_x] call blck_fnc_deleteAI;
|
||||||
|
} forEach (units _group);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} forEach _localpatrolsArray;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
blck_sm_monitoring = 1;
|
||||||
|
_sm_groups = +blck_sm_Groups;
|
||||||
|
{
|
||||||
|
diag_log format["monitoring blck_sm_Groups: _x = %1",_x];
|
||||||
|
_x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
|
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
|
//diag_log format["<_sm_monitorStaticUnits::Group spawning routine:: _units = %1 | _x = %2 |_forEachIndex = %3",_units,_x,_forEachIndex];
|
||||||
|
//private _groupSpawned = false;
|
||||||
|
//diag_log format["there are %1 players in range",{_pos distance2D _x < _triggerRange} count allPlayers];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ((isNull _group)) then
|
||||||
|
{
|
||||||
|
diag_log format["testing if patrol %1 should be spawned | _spawnedAt = %2",_x,_spawnedAt];
|
||||||
|
diag_log format["_spawnedAt = %1 | _respawnAt = %2 | _respawnInterval = %3",_spawnedAt,_respawnAt, _respawnInterval];
|
||||||
|
if ( ((_spawnedAt == 0) && (_respawnAt == 0)) || ((diag_tickTime > _respawnAt) && (_respawnInterval > 0)) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static group spawner] evaluating _x = %1 ",_x];
|
||||||
|
_numAI = [_units] call blck_fnc_getNumberFromRange;
|
||||||
|
//diag_log format["[blckeagls static group spawner] _units = %1 and _numAI = %2",_units,_numAI];
|
||||||
|
// // params["_pos", "_center", _numai1, _numai2, _skillLevel, _minDist, _maxDist, _configureWaypoints, _uniforms, _headGear,_vests,_backpacks,_weaponList,_sideArms, _scuba ];
|
||||||
|
_group = [_pos,_pos,_numAI,_numAI,_difficulty,_patrolRadius-2,_patrolRadius,true] call blck_fnc_spawnGroup;
|
||||||
|
//diag_log format["[blckeagls static group spawner] _group %1",_group];
|
||||||
|
[blck_sm_Groups,_x,_group,diag_tickTime] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
diag_log format["_sm_monitorStaticUnits | spawn Group step :: blck_sm_Groups updated to %1",blck_sm_Groups];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_groups;
|
||||||
|
[blck_sm_Groups] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
|
_sm_Vehicles = +blck_sm_Vehicles;
|
||||||
|
{
|
||||||
|
diag_log format["_sm_monitorVehicles::-> _x = %1",_x];
|
||||||
|
_x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
|
// ["B_G_Offroad_01_armed_F",[22809.5,16699.2,8.78706],"green", 600,90]
|
||||||
|
_groupParameters params["_vehicleType","_pos","_difficulty","_patrolRadius","_respawnInterval"];
|
||||||
|
diag_log format["_fnc_sm_monitorStaticUnits: vehicle spawn position = %1",_pos];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( ((_spawnedAt == 0) && (_respawnAt == 0)) || ((diag_tickTime > _respawnAt) && (_respawnInterval > 0)) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//params["_coords","_noVehiclePatrols","_aiDifficultyLevel","_missionPatrolVehicles",["_useRelativePos",true],["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols], ["_isScubaGroup",false]];
|
||||||
|
_return = [_pos,1,_difficulty,[_groupParameters],false] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
// _return = [_vehicles, _missionAI, _abort];
|
||||||
|
_group = group (_return select 1 select 0);
|
||||||
|
[blck_sm_Vehicles,_x,_group,diag_tickTime] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_Vehicles;
|
||||||
|
[blck_sm_Vehicles] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
|
_sm_Emplaced = +blck_sm_Emplaced;
|
||||||
|
{
|
||||||
|
// ["B_G_Mortar_01_F",[22944.3,16820.5,3.14243],"green",0,0,_group,_spawnAt]
|
||||||
|
//diag_log format["_sm_monitorEmplacedUnits::-> _x = %1",_x];
|
||||||
|
_x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
|
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( ((_spawnedAt == 0) && (_respawnAt == 0)) || ((diag_tickTime > _respawnAt) && (_respawnInterval > 0)) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static Emplaced spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty];
|
||||||
|
// params["_coords","_missionEmplacedWeapons","_useRelativePos","_noEmplacedWeapons","_aiDifficultyLevel",["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols]];
|
||||||
|
_return = [_pos,[_groupParameters],false,1,_difficulty] call blck_fnc_spawnEmplacedWeaponArray;
|
||||||
|
// _return = [_emplacedWeps,_emplacedAI,_abort];
|
||||||
|
// Make an assumption that only one emplaced weapon is spawned so that the group of the first AI in the list returned is the group we should monitor.
|
||||||
|
_group = group((_return select 1) select 0);
|
||||||
|
[blck_sm_Emplaced,_x,_group,diag_tickTime] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Emplaced updated to %1",blck_sm_Emplaced];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_Emplaced;
|
||||||
|
[blck_sm_Emplaced] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
|
_sm_Aircraft = +blck_sm_Aircraft;
|
||||||
|
{
|
||||||
|
// ["Exile_Chopper_Huey_Armed_Green",[22923.4,16953,3.19],"red",1000,0],
|
||||||
|
_x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
|
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( ((_spawnedAt == 0) && (_respawnAt == 0)) || ((diag_tickTime > _respawnAt) && (_respawnInterval > 0)) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
_weapon = [toLower _difficulty] call blck_fnc_selectAILoadout;
|
||||||
|
//params["_coords","_skillAI","_helis",["_uniforms", blck_SkinList],["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_Launcher","none"],["_weaponList",[]],["_sideArms",[]]]
|
||||||
|
//diag_log format["[blckeagls static aircraftePatrol spawner] _weapon = %1 and _difficulty = %2",_weapon,_difficulty];
|
||||||
|
_return = [_pos,_difficulty,[_aircraftType]] call blck_fnc_spawnMissionHeli; // Allow the spawner to fit the default AI Loadouts for blckeagls; revisit at a later time when custom uniforms are set up for these AI.
|
||||||
|
//diag_log format["[blckeagls] static aircraftePatrol spawner -> _return = %1",_return];
|
||||||
|
//_return params ["_patrolHeli","_ai","_abort"];
|
||||||
|
_group = group((_return select 1) select 0);
|
||||||
|
[blck_sm_Aircraft,_x,_group,diag_tickTime] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Aircraft updated to %1",blck_sm_Aircraft];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_Aircraft;
|
||||||
|
[blck_sm_Aircraft] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
|
_sm_surfaceVehicles = +blck_sm_surfaceShips;
|
||||||
|
{
|
||||||
|
// ["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red",600,0,_group,_spawnAt],
|
||||||
|
_x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
|
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( ((_spawnedAt == 0) && (_respawnAt == 0)) || ((diag_tickTime > _respawnAt) && (_respawnInterval > 0)) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static vehiclePatrol spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty];
|
||||||
|
_return = [_pos,1,_difficulty,[_groupParameters],false] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
//_return params ["_vehicles", "_missionAI", "_abort"];
|
||||||
|
_group = group((_return select 1) select 0);
|
||||||
|
[blck_sm_surfaceShips,_x,_group,diag_tickTime] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_surfaceVehicles;
|
||||||
|
[blck_sm_surfaceShips] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
|
_sm_SDVVehicles = +blck_sm_submarines;
|
||||||
|
{
|
||||||
|
_x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
|
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( ((_spawnedAt == 0) && (_respawnAt == 0)) || ((diag_tickTime > _respawnAt) && (_respawnInterval > 0)) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static sub patrol spawner] _weapType = %1 and _difficulty = %2",_weapType,_difficulty];
|
||||||
|
_return = [_pos,1,_difficulty,[_groupParameters],false,blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,blck_backpacks,blck_UMS_weapons,blck_Pistols,true] call blck_fnc_spawnMissionVehiclePatrols;
|
||||||
|
//_return params ["_vehicles", "_missionAI", "_abort"];
|
||||||
|
_group = group((_return select 1) select 0);
|
||||||
|
[blck_sm_submarines,_x,_group,diag_tickTime] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn emplaced step :: blck_sm_Vehicles updated to %1",blck_sm_Vehicles];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_SDVVehicles;
|
||||||
|
[blck_sm_submarines] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
|
_sm_scubaGroups = +blck_sm_scubaGroups;
|
||||||
|
{
|
||||||
|
_x params["_groupParameters","_group","_spawnedAt","_respawnAt","_lastTimePlayerNear"];
|
||||||
|
_groupParameters params["_pos","_difficulty","_units","_patrolRadius","_respawnInterval"];
|
||||||
|
//diag_log format["<_sm_monitorScubaUnits:: _group = %1 | _x = %2 |_forEachIndex = %3",_group,_x,_forEachIndex];
|
||||||
|
if ([_pos,_triggerRange] call blck_fnc_playerInRange) then
|
||||||
|
{
|
||||||
|
if ( ((_spawnedAt == 0) && (_respawnAt == 0)) || ((diag_tickTime > _respawnAt) && (_respawnInterval > 0)) ) then // no group has been spawned, spawn one.
|
||||||
|
{
|
||||||
|
//diag_log format["[blckeagls static scubaGroup spawner] evaluating _x = %1 ",_x];
|
||||||
|
_numAI = [_units] call blck_fnc_getNumberFromRange;
|
||||||
|
//diag_log format["[blckeagls static scubaGroup spawning routine] _units = %1 and _numAI = %2",_units,_numAI];
|
||||||
|
//params["_pos", "_numUnits", ["_skillLevel","red"], "_center", ["_minDist",20], ["_maxDist",35], ["_uniforms",blck_UMS_uniforms], ["_headGear",blck_UMS_headgear],["_configureWaypoints",true],["_weapons",blck_UMS_weapons],["_vests",blck_UMS_vests]];
|
||||||
|
_group = [_pos,_difficulty,_units,_patrolRadius] call blck_fnc_spawnScubaGroup;
|
||||||
|
//diag_log format["[blckeagls static scubaGroup spawner] _group %1",_group];
|
||||||
|
[blck_sm_scubaGroups,_x,_group,diag_tickTime] call _fnc_updateGroupSpawnTimerFields;
|
||||||
|
//diag_log format["_sm_monitorStaticUnits | spawn Group step :: blck_sm_Groups updated to %1",blck_sm_Groups];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}forEach _sm_scubaGroups;
|
||||||
|
[blck_sm_scubaGroups] call _fnc_evaluateSpawnedGroups;
|
||||||
|
|
||||||
|
blck_sm_monitoring = 0;
|
@ -15,7 +15,7 @@ private ["_staticMissions"];
|
|||||||
|
|
||||||
_staticMissions = [
|
_staticMissions = [
|
||||||
// [mod (Epoch, Exile), map (Altis, Tanoa etc), mission center, eg [10445,2014,0], filename.sqf (name of static mission template for that mission)];
|
// [mod (Epoch, Exile), map (Altis, Tanoa etc), mission center, eg [10445,2014,0], filename.sqf (name of static mission template for that mission)];
|
||||||
//["Epoch","Altis","staticMissionExample2_Epoch.sqf"],
|
["Epoch","Altis","staticMissionExample2_Epoch.sqf"],
|
||||||
["Exile","Altis","staticMissionExample2_Exile.sqf"]
|
["Exile","Altis","staticMissionExample2_Exile.sqf"]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -18,33 +18,23 @@
|
|||||||
#include "\q\addons\custom_server\Missions\Static\GMS_StaticMissions_Lists.sqf";
|
#include "\q\addons\custom_server\Missions\Static\GMS_StaticMissions_Lists.sqf";
|
||||||
|
|
||||||
private["_mod","_map","_missionMod","_missionMap","_missionLocation","_missionDataFile"];
|
private["_mod","_map","_missionMod","_missionMap","_missionLocation","_missionDataFile"];
|
||||||
//diag_log "[blckeagls] GMS_StaticMissions_init.sqf <Getting Mod Type>";
|
blck_sm_monitoring = 0;
|
||||||
_mod = toLower(call blck_fnc_getModType);
|
blck_sm_groupDespawnTime = 30;
|
||||||
//diag_log format["[blckeagls] GMS_StaticMissions_init.sqf <mod type = %1>",_mod];
|
|
||||||
|
|
||||||
//diag_log format["[blckeagls] GMS_StaticMissions_init <_staticMissions> = %1",_staticMissions];
|
|
||||||
//diag_log "[blckeagls] GMS_StaticMissions_init.sqf <Getting map name>";
|
|
||||||
_map = toLower worldName;
|
_map = toLower worldName;
|
||||||
//diag_log format["[blckeagls] GMS_StaticMissions_init.sqf <map name = %1>",_map];
|
|
||||||
//diag_log format["[blckeagls] GMS_StaticMissions_init.sqf <_staticMissions = %1>",_staticMissions];
|
|
||||||
{
|
{
|
||||||
//diag_log format["[blckeagls] GMS_StaticMissions_init.sqf <Evaluating Mission = %1>",_x];
|
|
||||||
//diag_log format["[blckeagls] GMS_StaticMissions_init.sqf <worldName = %1 | _mod = %2>",_map,_mod];
|
|
||||||
if ((_map) isEqualTo toLower(_x select 1)) then
|
if ((_map) isEqualTo toLower(_x select 1)) then
|
||||||
{
|
{
|
||||||
if ((_mod isEqualTo "epoch") && (toLower(_x select 0) isEqualTo "epoch")) then
|
if ((blck_ModType isEqualTo "Epoch") && (toLower(_x select 0) isEqualTo "epoch")) then
|
||||||
{
|
{
|
||||||
|
|
||||||
call compilefinal preprocessFileLineNumbers format["\q\addons\custom_server\Missions\Static\missions\%1",(_x select 2)];
|
call compilefinal preprocessFileLineNumbers format["\q\addons\custom_server\Missions\Static\missions\%1",(_x select 2)];
|
||||||
};
|
};
|
||||||
|
|
||||||
if ((_mod isEqualTo "exile") && (toLower(_x select 0) isEqualTo "exile")) then
|
if ((blck_ModType isEqualTo "Exile") && (toLower(_x select 0) isEqualTo "exile")) then
|
||||||
{
|
{
|
||||||
call compilefinal preprocessFileLineNumbers format["\q\addons\custom_server\Missions\Static\missions\%1",(_x select 2)];
|
call compilefinal preprocessFileLineNumbers format["\q\addons\custom_server\Missions\Static\missions\%1",(_x select 2)];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
uiSleep 1;
|
uiSleep 1;
|
||||||
}forEach _staticMissions;
|
}forEach _staticMissions;
|
||||||
|
|
||||||
diag_log "[blckeagls] GMS_StaticMissions Initialized.sqf <Loaded>";
|
diag_log "[blckeagls] GMS_StaticMissions Initialized.sqf <Loaded>";
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ _noEmplacedWeapons = blck_SpawnEmplaced_Red; // Modified as needed; can be a num
|
|||||||
// Note that this value is ignored if you define static weapon positions and types in the array below.
|
// Note that this value is ignored if you define static weapon positions and types in the array below.
|
||||||
_missionEmplacedWeapons = [
|
_missionEmplacedWeapons = [
|
||||||
//["B_G_Mortar_01_F",[22867.3,16809.1,3.17968],"red",0,0],
|
//["B_G_Mortar_01_F",[22867.3,16809.1,3.17968],"red",0,0],
|
||||||
//["B_HMG_01_high_F",[22944.3,16820.5,3.14243],"green",0,0]
|
///["B_HMG_01_high_F",[22944.3,16820.5,3.14243],"green",0,0]
|
||||||
]; // example [ ["emplacedClassName",[px, py, pz] /* position to spawn weapon */, difficulty /* difficulty of AI manning weapon (blue, red etc)] ];
|
]; // example [ ["emplacedClassName",[px, py, pz] /* position to spawn weapon */, difficulty /* difficulty of AI manning weapon (blue, red etc)] ];
|
||||||
// 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
|
// 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
|
||||||
// If the number of possible locations exceeds the number of emplaced weapons specified above then only some of the locations in the array will have emplaced weapons spawned.
|
// If the number of possible locations exceeds the number of emplaced weapons specified above then only some of the locations in the array will have emplaced weapons spawned.
|
||||||
@ -104,15 +104,15 @@ _aiGroupParameters = [
|
|||||||
//[[22849,16720.4,7.33123],"red",4, 75,9000],
|
//[[22849,16720.4,7.33123],"red",4, 75,9000],
|
||||||
//[[22832.9,16805.6,4.59315],"red",4, 75,900],
|
//[[22832.9,16805.6,4.59315],"red",4, 75,900],
|
||||||
//[[22909.8,16778.6,3.19144],"red",4, 75,900],
|
//[[22909.8,16778.6,3.19144],"red",4, 75,900],
|
||||||
//[[22819.4,16929.5,5.33892],"red",4, 75,900],
|
//[[22809.4,16929.5,5.33892],"blue",1, 75,0],
|
||||||
[[22819.4,16929.5,5.33892],"red",4, 75,900]
|
[[22819.4,16929.5,5.33892],"red",1, 75, 90]
|
||||||
];
|
];
|
||||||
|
|
||||||
_noVehiclePatrols = blck_SpawnVeh_Red; // Modified as needed; can be a numberic value (e.g. 3) or range presented as [2,4];
|
_noVehiclePatrols = blck_SpawnVeh_Red; // Modified as needed; can be a numberic value (e.g. 3) or range presented as [2,4];
|
||||||
// Note that this value is ignored if you define vehicle patrols in the array below.
|
// Note that this value is ignored if you define vehicle patrols in the array below.
|
||||||
_vehiclePatrolParameters = [
|
_vehiclePatrolParameters = [
|
||||||
//["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"red", 600,900],
|
//["B_G_Offroad_01_armed_F",[22819.4,16929.5,3.17413],"green",600,0],
|
||||||
["B_G_Offroad_01_repair_F",[22809.5,16699.2,8.78706],"green", 600,90]
|
//["B_G_Offroad_01_armed_F",[22809.5,16699.2,8.78706],"orange",600,90]
|
||||||
]; //[ ["vehicleClassName",[px,py,pz] /* center of patrol area */, difficulty /* blue, red etc*/, patrol radius] ]
|
]; //[ ["vehicleClassName",[px,py,pz] /* center of patrol area */, difficulty /* blue, red etc*/, patrol radius] ]
|
||||||
// When this array is empty, vehicle patrols will be scattered randomely around the mission.
|
// When this array is empty, vehicle patrols will be scattered randomely around the mission.
|
||||||
// Allows you to define the location of the center of the patrol, vehicle type spawned, radius to patrol, and AI difficulty (blue, red, green etc).
|
// Allows you to define the location of the center of the patrol, vehicle type spawned, radius to patrol, and AI difficulty (blue, red, green etc).
|
||||||
@ -121,8 +121,8 @@ _aircraftTypes = blck_patrolHelisRed; // You can use one of the pre-defined li
|
|||||||
_noAirPatrols = blck_noPatrolHelisRed; // You can use one of the pre-defined values or a custom one. acceptable values are integers (1,2,3) or a range such as [2,4];
|
_noAirPatrols = blck_noPatrolHelisRed; // You can use one of the pre-defined values or a custom one. acceptable values are integers (1,2,3) or a range such as [2,4];
|
||||||
// Note: this value is ignored if you specify air patrols in the array below.
|
// Note: this value is ignored if you specify air patrols in the array below.
|
||||||
_airPatrols = [
|
_airPatrols = [
|
||||||
["Exile_Chopper_Huey_Armed_Green",[22923.4,16953,3.19],"red",1000,900]//,
|
//["Exile_Chopper_Huey_Armed_Green",[22923.4,16953,3.19],"red",1000,900]//,
|
||||||
//[selectRandom _aircraftTypes,[22830.2,16618.1,11.4549],"green",1000,0]
|
//[selectRandom _aircraftTypes,[22830.2,16618.1,11.4549],"green",1000,90]
|
||||||
];
|
];
|
||||||
// Change _useMines to true/false below to enable mission-specific settings.
|
// Change _useMines to true/false below to enable mission-specific settings.
|
||||||
_useMines = blck_useMines; // Set to false if you have vehicles patrolling nearby.
|
_useMines = blck_useMines; // Set to false if you have vehicles patrolling nearby.
|
||||||
|
@ -39,64 +39,19 @@ if (isNil "_vests") then {_vests = blck_vests};
|
|||||||
if (isNil "_backpacks") then {_backpacks = blck_backpacks};
|
if (isNil "_backpacks") then {_backpacks = blck_backpacks};
|
||||||
//diag_log format["_fnc_missionSpawner: -> blck_backpacks = %1", blck_backpacks];
|
//diag_log format["_fnc_missionSpawner: -> blck_backpacks = %1", blck_backpacks];
|
||||||
//diag_log format["_fnc_missionSpawner: -> _backpacks = %1",_backpacks];
|
//diag_log format["_fnc_missionSpawner: -> _backpacks = %1",_backpacks];
|
||||||
if (isNil "_uniforms") then {_uniforms = blck_SkinList};
|
if (isNil "_weaponList") then {_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout};
|
||||||
if (isNil "_headGear") then {_headgear = blck_headgear};
|
if (isNil "_sideArms") then {_sideArms = [_aiDifficultyLevel] call blck_fnc_selectAISidearms};
|
||||||
|
if (isNil "_uniforms") then {_uniforms = [_aiDifficultyLevel] call blck_fnc_selectAIUniforms};
|
||||||
|
if (isNil "_headGear") then {_headGear = [_aiDifficultyLevel] call blck_fnc_selectAIHeadgear};
|
||||||
|
if (isNil "_vests") then {_vests = [_aiDifficultyLevel] call blck_fnc_selectAIVests};
|
||||||
|
if (isNil "_backpacks") then {_backpacks = [_aiDifficultyLevel] call blck_fnc_selectAIBackpacks};
|
||||||
|
|
||||||
|
if (isNil "_chanceHeliPatrol") then {_chanceHeliPatrol = [_aiDifficultyLevel] call blck_fnc_selectChanceHeliPatrol};
|
||||||
|
if (isNil "_noChoppers") then {_noChoppers = [_aiDifficultyLevel] call blck_fnc_selectNumberAirPatrols};
|
||||||
|
if (isNil "_chancePara") then {_chancePara = [_aiDifficultyLevel] call blck_fnc_selectChanceParatroops};
|
||||||
|
if (isNil "_missionHelis") then {_missionHelis = [_aiDifficultyLevel] call blck_fnc_selectMissionHelis};
|
||||||
|
if (isNil "_noPara") then {_noPara = [_aiDifficultyLevel] call blck_fnc_selectNumberParatroops};
|
||||||
|
|
||||||
if (isNil "_chanceHeliPatrol") then
|
|
||||||
{
|
|
||||||
switch (toLower(_aiDifficultyLevel)) do
|
|
||||||
{
|
|
||||||
case "blue": {_chanceHeliPatrol = blck_chanceHeliPatrolBlue};
|
|
||||||
case "red": {_chanceHeliPatrol = blck_chanceHeliPatrolRed};
|
|
||||||
case "green": {_chanceHeliPatrol = blck_chanceHeliPatrolGreen};
|
|
||||||
case "orange": {_chanceHeliPatrol = blck_chanceHeliPatrolOrange};
|
|
||||||
default {_chanceHeliPatrol = 0};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
if (isNil "_noChoppers") then
|
|
||||||
{
|
|
||||||
switch (toLower(_aiDifficultyLevel)) do
|
|
||||||
{
|
|
||||||
case "blue": {_noChoppers = blck_noPatrolHelisBlue};
|
|
||||||
case "red": {_noChoppers = blck_noPatrolHelisRed};
|
|
||||||
case "green": {_noChoppers = blck_noPatrolHelisGreen};
|
|
||||||
case "orange": {_noChoppers = blck_noPatrolHelisOrange};
|
|
||||||
default {_noChoppers = 0};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
if (isNil "_chancePara") then
|
|
||||||
{
|
|
||||||
switch (toLower (_aiDifficultyLevel)) do
|
|
||||||
{
|
|
||||||
case "blue": {_chancePara = blck_chanceParaBlue};
|
|
||||||
case "red": {_chancePara = blck_chanceParaRed}};
|
|
||||||
case "green": {_chancePara = blck_chanceParaGreen};
|
|
||||||
case "orange": {_chancePara = blck_chanceParaOrange;
|
|
||||||
default {_chancePara = 0};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
if (isNil "_missionHelis") then
|
|
||||||
{
|
|
||||||
switch (toLower (_aiDifficultyLevel)) do
|
|
||||||
{
|
|
||||||
case "blue": {_missionHelis = blck_patrolHelisBlue};
|
|
||||||
case "red": {_missionHelis = blck_patrolHelisRed};
|
|
||||||
case "green": {_missionHelis = blck_patrolHelisGreen};
|
|
||||||
case "orange": {_missionHelis = blck_patrolHelisOrange};
|
|
||||||
default {_missionHelis = blck_patrolHelisBlue};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
if (isNil "_noPara") then
|
|
||||||
{
|
|
||||||
switch (toLower (_aiDifficultyLevel)) do
|
|
||||||
{
|
|
||||||
case "blue": {_noPara = blck_noParaBlue};
|
|
||||||
case "red": {_noPara = blck_noParaRed};
|
|
||||||
case "green": {_noPara = blck_noParaGreen};
|
|
||||||
case "orange": {_noPara = blck_noParaOrange};
|
|
||||||
default {_noPara = 0};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
if (isNil "_chanceLoot") then {_chanceLoot = 0};
|
if (isNil "_chanceLoot") then {_chanceLoot = 0};
|
||||||
if (isNil "_paraTriggerDistance") then {_paraTriggerDistance = 400;};
|
if (isNil "_paraTriggerDistance") then {_paraTriggerDistance = 400;};
|
||||||
if (isNil "_paraLoot") then {_paraLoot = blck_BoxLoot_Blue};
|
if (isNil "_paraLoot") then {_paraLoot = blck_BoxLoot_Blue};
|
||||||
|
@ -32,6 +32,9 @@ waitUntil{blck_functionsCompiled};
|
|||||||
blck_functionsCompiled = nil;
|
blck_functionsCompiled = nil;
|
||||||
diag_log format["[blckeagls] debug mode settings:blck_debugON = %1 blck_debugLevel = %2",blck_debugON,blck_debugLevel];
|
diag_log format["[blckeagls] debug mode settings:blck_debugON = %1 blck_debugLevel = %2",blck_debugON,blck_debugLevel];
|
||||||
|
|
||||||
|
blck_modType = call blck_fnc_getModType;
|
||||||
|
publicVariable "blck_modType";
|
||||||
|
|
||||||
execVM "\q\addons\custom_server\Configs\blck_configs.sqf";
|
execVM "\q\addons\custom_server\Configs\blck_configs.sqf";
|
||||||
|
|
||||||
waitUntil {(isNil "blck_configsLoaded") isEqualTo false;};
|
waitUntil {(isNil "blck_configsLoaded") isEqualTo false;};
|
||||||
@ -65,7 +68,7 @@ diag_log format["blckeagls] waiting for players to join ---- >>>>"];
|
|||||||
|
|
||||||
if !(blck_debugON || (blck_debugLevel isEqualTo 0)) then
|
if !(blck_debugON || (blck_debugLevel isEqualTo 0)) then
|
||||||
{
|
{
|
||||||
waitUntil{{isPlayer _x}count playableUnits > 0};
|
waitUntil{{isPlayer _x}count allPlayers > 0};
|
||||||
diag_log "[blckeagls] Player Connected, spawning missions";
|
diag_log "[blckeagls] Player Connected, spawning missions";
|
||||||
} else {
|
} else {
|
||||||
diag_log "[blckeagls] spawning Missions";
|
diag_log "[blckeagls] spawning Missions";
|
||||||
@ -121,9 +124,6 @@ if (blck_enableBlueMissions > 0) then
|
|||||||
[_missionListBlue,_pathBlue,"BlueMarker","blue",blck_TMin_Blue,blck_TMax_Blue,blck_enableBlueMissions] call blck_fnc_addMissionToQue;
|
[_missionListBlue,_pathBlue,"BlueMarker","blue",blck_TMin_Blue,blck_TMax_Blue,blck_enableBlueMissions] call blck_fnc_addMissionToQue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
blck_modType = call blck_fnc_getModType;
|
|
||||||
publicVariable "blck_modType";
|
|
||||||
// start the main thread for the mission system which monitors missions running and stuff to be cleaned up
|
// start the main thread for the mission system which monitors missions running and stuff to be cleaned up
|
||||||
[] spawn blck_fnc_mainThread;
|
[] spawn blck_fnc_mainThread;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
private ["_version","_versionDate"];
|
private ["_version","_versionDate"];
|
||||||
blck_version = "6.82 Build 136";
|
blck_version = "6.83 Build 138";
|
||||||
_blck_version = blck_version;
|
_blck_version = blck_version;
|
||||||
_blck_versionDate = "6-8-18 5:00 PM";
|
_blck_versionDate = "6-11-18 5:00 PM";
|
||||||
blck_pvs_version = _blck_version;
|
blck_pvs_version = _blck_version;
|
||||||
publicVariable blck_pvs_version;
|
publicVariable blck_pvs_version;
|
||||||
|
Loading…
Reference in New Issue
Block a user