Fixes for HC connectivity.

This commit is contained in:
Ghostrider-GRG- 2018-04-28 20:31:11 -04:00
parent adb5a7ce3f
commit 69b59323ef
19 changed files with 1013 additions and 43 deletions

View File

@ -65,8 +65,8 @@ while {true} do
//diag_log format["_fnc_mainThread: control returned to _fnc_mainThread from _fnc_addDynamicUMS_Mission at %1",diag_tickTime];
if (blck_useHC) then
{
//diag_log format["_mainThread:: calling blck_fnc_passToHCs at diag_tickTime = %1",diag_tickTime];
[] call blck_fnc_passToHCs;
diag_log format["_mainThread:: calling blck_fnc_passToHCs at diag_tickTime = %1",diag_tickTime];
[] call blck_fnc_HC_passToHCs;
};
#ifdef blck_debugMode

View File

@ -15,8 +15,8 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
/////////////////////////////////////////////////////
params["_startTime",["_timeoutTime",blck_MissionTimout]];
params["_startTime",["_timeoutTime",blck_MissionTimeout]];
private["_return"];
if ((diag_tickTime - _startTime) > _timeoutTime) then {_return = true} else {_return = false};
//diag_log format["fnc_timedOut:: blck_MissionTimout = %2 || _return = %1",_return,blck_MissionTimout];
//diag_log format["fnc_timedOut:: blck_MissionTimeout = %2 || _return = %1",_return,blck_MissionTimeout];
_return;

View File

@ -1,6 +1,7 @@
diag_log format["_fnc_HC_XferGroup:: _this = %1",_this];
private["_group","_client","_unit","_tempEH"];
_group = _this select 0;
blck_HC_monitoredGroups pushBack _group;
_client = clientOwner;
{
_unit = _x;
@ -10,9 +11,9 @@ _client = clientOwner;
_x setVariable["localEH",_localEH,true];
if(_unit != vehicle _unit) then
{
diag_log format["_fnc_HC_XferGroup: _unit %1 is in vehicle %2",_unit, vehicle _unit];
//diag_log format["_fnc_HC_XferGroup: _unit %1 is in vehicle %2",_unit, vehicle _unit];
blck_HC_monitoredVehicles pushBack (vehicle _unit);
diag_log format["_fnc_HC_XferGroup: blck_HC_monitoredVehicles = %1", blck_HC_monitoredVehicles];
//diag_log format["_fnc_HC_XferGroup: blck_HC_monitoredVehicles = %1", blck_HC_monitoredVehicles];
};
}forEach (units _group);
diag_log format["blckHC:: group %1 transferred to HC %1",_group,_client];

View File

@ -0,0 +1,22 @@
/*
blck_fnc_HC_XferGroup = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_XferGroup.sqf";
//blck_fnc_HC_XferVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_XferVehicle.sqf";
blck_fnc_onPlayerDisconnected = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_onPlayerDisconnected.sqf";
//blck_fnc_HC_groupsAssigned = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_groupsAssigned.sqf";
blck_fnc_HCmonitor = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HCmonitor.sqf";
blck_fnc_HC_vehicleMonitor = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_vehicleMonitor.sqf";
blck_fnc_monitorHC = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_monitorHC.sqf";
blck_fnc_passToHCs = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_passToHCs.sqf";
blck_fnc_HC_getListConnected = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_getListConnected.sqf";
blck_fnc_HC_leastBurdened = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_leastBurdened.sqf";
blck_fnc_HC_countGroupsAssigned = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_countGroupsAssigned.sqf";
*/
//blck_fnc_HC_countGroupsAssigned =
params["_HC"];
private["_result"];
_result = {(groupOwner _x) == (owner _HC)} count allGroups;
//diag_log format["_fnc_countGroupsAssigned = %1",_result];
_result

View File

@ -0,0 +1,9 @@
//blck_fnc_HC_getListConnected =
private _hcs = [];
{
if !(_x in _hcs) then {_hcs pushBack _x};
}forEach entities "HeadlessClient_F";
_hcs

View File

@ -0,0 +1,32 @@
/*
blck_fnc_HC_XferGroup = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_XferGroup.sqf";
//blck_fnc_HC_XferVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_XferVehicle.sqf";
blck_fnc_onPlayerDisconnected = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_onPlayerDisconnected.sqf";
//blck_fnc_HC_groupsAssigned = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_groupsAssigned.sqf";
blck_fnc_HCmonitor = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HCmonitor.sqf";
blck_fnc_HC_vehicleMonitor = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_vehicleMonitor.sqf";
blck_fnc_monitorHC = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_monitorHC.sqf";
blck_fnc_passToHCs = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_passToHCs.sqf";
blck_fnc_HC_getListConnected = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_getListConnected.sqf";
blck_fnc_HC_leastBurdened = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_leastBurdened.sqf";
blck_fnc_HC_countGroupsAssigned = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_countGroupsAssigned.sqf";
*/
//blck_fnc_HC_leastBurdened =
params["_HC_List"];
private["_result","_fewestGroupsAssigned","_leastBurdened","_groupsAssigned"];
if (count _HC_List == 0) exitWith {_result = objNull; _result};
_fewestGroupsAssigned = [_HC_List select 0] call blck_fnc_HC_countGroupsAssigned;
_leastBurdened = _HC_List select 0;
{
_groupsAssigned = [_x] call blck_fnc_HC_countGroupsAssigned;
if (_groupsAssigned < _fewestGroupsAssigned) then
{
_leastBurdened = _x;
_fewestGroupsAssigned = _groupsAssigned;
};
}forEach _HC_List;
//diag_log format["_fnc_leastBurdened:: _fewestGroupsAssigned = %1 and _leastBurdened = %2",_fewestGroupsAssigned,_leastBurdened];
_leastBurdened

View File

@ -0,0 +1,15 @@
/*
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";
params["_vehicle"];
[_vehicle] remoteExec ["blck_fnc_monitorVehicleStatus",2];

View File

@ -22,6 +22,7 @@ _vehList = +blck_HC_monitoredVehicles;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then {diag_log format["_fnc_vehicleMonitor:: function called at %1 with _vehList %2 and blck_HC_monitoredVehicles %3",diag_tickTime,_vehList,blck_HC_monitoredVehicles];};
#endif
//diag_log format["_fnc_vehicleMonitor:: function called at %1 with _vehList %2 and blck_HC_monitoredVehicles %3",diag_tickTime,_vehList,blck_HC_monitoredVehicles];
//blck_fnc_releaseVehicleToPlayers
{
/*
@ -31,15 +32,15 @@ if (blck_debugLevel > 2) then {diag_log format["_fnc_vehicleMonitor:: function c
_allCrewDead
_deleteNow
*/
diag_log format["_fnc_vehicleMonitor: evaluating vehicle %1",_x];
//diag_log format["_fnc_vehicleMonitor: evaluating vehicle %1",_x];
_veh = _x; // (purely for clarity at this point, _x could be used just as well)
_isEmplaced = _veh getVariable["DBD_vehType","none"] isEqualTo "emplaced";
_isEmplaced = _veh getVariable["GRG_vehType","none"] isEqualTo "emplaced";
_ownerIsPlayer = if (owner _veh > 2 && !(owner _veh in blck_connectedHCs)) then {true} else {false};
{
diag_log format["_fnc_vehicleMonitor: vehicle %1 crew %2 alive = %3",_veh,_x, alive _x];
//diag_log format["_fnc_vehicleMonitor: vehicle %1 crew %2 alive = %3",_veh,_x, alive _x];
}forEach (crew _veh);
_allCrewDead = if (({alive _x} count (crew _veh)) == 0) then {true} else {false};
diag_log format["_fnc_vehicleMonitor: _allCrewDead = %1",_allCrewDead];
//diag_log format["_fnc_vehicleMonitor: _allCrewDead = %1",_allCrewDead];
_deletenow = false;
if ( (_veh getVariable["blck_DeleteAt",0] > 0) && (diag_tickTime > (_veh getVariable "blck_DeleteAt"))) then {_deleteNow = true};
_missionCompleted = if (_veh getVariable["missionCompleted",0] != 0) then {true} else {false};

View File

@ -1,27 +1,38 @@
/*
vehicles = count blck_HC_monitoredVehicles;
*/
diag_log "_fnc_HCmonitor.sqf";
diag_log "_fnc_HC_monitor.sqf";
_blckGroups = 0;
_otherGroups = 0;
_totalGroups = 0;
_timerOneSec =0;
_timerSixtySec = 0;
_timer3min = 0;
while {true} do
{
if (diag_tickTime > _timerOneSec) then
{
_timerOneSec = diag_tickTime;
_timerOneSec = diag_tickTime + 1;
[] call blck_fnc_HC_vehicleMonitor;
};
if (diag_tickTime > _timerSixtySec) then
{
_timerSixtySec = diag_tickTime;
_blckGroups = {_x getVariable["blck_group",false] && (groupOwner _x isEqualTo clientOwner)} count allGroups;
_totalGroups = {(groupOwner _x) isEqualTo clientOwner} count allGroups;
_totalGroups = _blckGroups + _otherGroups;
diag_log format["blckHC:: headless client %1 at diag_tickTime running %3 fps",clientOwner,diag_tickTime,diag_fps];
diag_log format["blckHC:: headless client %1 _blckGroups = %1 and _otherGroups = %2",_blckGroups,_otherGroups];
_timerSixtySec = diag_tickTime + 60;
private _theGroups = blck_HC_monitoredGroups;
{
if (isNull _x) then {blck_HC_monitoredGroups = blck_HC_monitoredGroups - [_x]};
if ( {alive _x} count (units _x) == 0) then { blck_HC_monitoredGroups = blck_HC_monitoredGroups - [_x]};
} forEach _theGroups;
//_blckGroups = count blck_HC_monitoredGroups;
//_totalGroups = {(groupOwner _x) isEqualTo clientOwner} count allGroups;
//_totalGroups = _blckGroups + _otherGroups;
//diag_log format["blckHC:: headless client %1 ",_blckGroups,_otherGroups];
};
if (diag_tickTime > _timer3min) then
{
_timer3min = diag_tickTime _ 300;
diag_log format["blckHC:: headless client %1 | time stamp %2 | %3 fps | _blckGroups = %4 _otherGroups = %5 | vehicles %6",clientOwner,diag_tickTime,diag_fps, count blck_HC_monitoredGroups,{ ((groupOwner _x) isEqualTo clientOwner) && !(_x getVariable["blck_group",true])} count allGroups, count blck_HC_monitoredVehicles ];
};
uiSleep 1;
};

View File

@ -0,0 +1,91 @@
//if (!isServer) exitWith {};
/*
blck_fnc_countGroupsAssigned = {
params["_HC"];
private["_result"];
_result = {(groupOwner _x) == (owner _HC)} count allGroups;
//diag_log format["_fnc_countGroupsAssigned = %1",_result];
_result
};
blck_fnc_leastBurdened = {
params["_HC_List"];
private["_result","_fewestGroupsAssigned","_leastBurdened","_groupsAssigned"];
if (count _HC_List == 0) exitWith {_result = objNull; _result};
_fewestGroupsAssigned = [_HC_List select 0] call blck_fnc_countGroupsAssigned;
_leastBurdened = _HC_List select 0;
{
_groupsAssigned = [_x] call blck_fnc_countGroupsAssigned;
if (_groupsAssigned < _fewestGroupsAssigned) then
{
_leastBurdened = _x;
_fewestGroupsAssigned = _groupsAssigned;
};
}forEach _HC_List;
//diag_log format["_fnc_leastBurdened:: _fewestGroupsAssigned = %1 and _leastBurdened = %2",_fewestGroupsAssigned,_leastBurdened];
_leastBurdened
};
blck_fnc_getListConnectedHCs = {
private _hcs = [];
{
if !(_x in _hcs) then {_hcs pushBack _x};
}forEach entities "HeadlessClient_F";
_hcs
};
*/
diag_log format["_fnc_passToHCs:: function called at server time %1",diag_tickTime];
private["_numTransfered","_clientId","_allGroups","_groupsOwned","_idHC","_id","_swap","_rc"];
blck_connectedHCs = call blck_fnc_HC_getListConnected;
diag_log format["_fnc_passToHCs:: blck_connectedHCs = %1 | count _HCs = %2 | server FPS = %3",blck_connectedHCs,count blck_connectedHCs,diag_fps];
if ( (count blck_connectedHCs) > 0) then
{
_idHC = [blck_connectedHCs] call blck_fnc_HC_leastBurdened;
diag_log format["passToHCs: evaluating passTos for HC %1 || owner HC = %2",_idHC, owner _idHC];
{
// Pass the AI
_numTransfered = 0;
if (_x getVariable["blck_group",false]) then
{
if ((leader _x) != vehicle (leader _x)) then
{
private _v = vehicle (leader _x);
blck_monitoredVehicles = blck_monitoredVehicles - [_v];
};
//diag_log format["group belongs to blckeagls mission system so time to transfer it"];
if ((typeName _x) isEqualTo "GROUP") then
{
_id = groupOwner _x;
//diag_log format["Owner of group %1 is %2",_x,_id];
if (_id > 2) then
{
//diag_log format["group %1 is already assigned to an HC with _id of %2",_x,_id];
_swap = false;
} else {
diag_log format["group %1 should be moved to HC %2 with _idHC %3",_x,_idHC];
_x setVariable["owner",owner _idHC];
_rc = _x setGroupOwner (owner _idHC);
[_x] remoteExec["blck_fnc_HC_XferGroup",_idHC];
if ( _rc ) then
{
_numTransfered = _numTransfered + 1;
diag_log format["group %1 transferred to %2",_x, groupOwner _x];
} else {
diag_log format["something went wrong with the transfer of group %1",_x];
};
};
};
} else {
//diag_log format["group %1 does not belong to blckeagls mission system",_x];
};
} forEach (allGroups);
diag_log format["_passToHCs:: %1 groups transferred to HC %2",_numTransfered,_idHC];
_numTransfered = 0;
// Note : the owner of a vehicle is the owner of the driver so vehicles are automatically transferred to the HC when the group to which the driver is assigned is transferred.
} else {
#ifdef blck_debugMode
if (blck_debugLevel > 2) then {diag_log "_fnc_passToHCs:: No headless clients connected"};
#endif
};

View File

@ -159,7 +159,9 @@ _missionTimedOut = false;
_wait = true;
#ifdef blck_debugMode
if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (90) starting mission trigger loop"};
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
@ -170,7 +172,7 @@ while {_wait} do
#endif
if ([_coords, blck_TriggerDistance, false] call blck_fnc_playerInRange) exitWith {_playerInRange = true;};
if ([_missionStartTime,blck_MissionTimout] call blck_fnc_timedOut) exitWith {_missionTimedOut = true;};
if ([_missionStartTime,blck_MissionTimeout] call blck_fnc_timedOut) exitWith {_missionTimedOut = true;};
uiSleep 5;
#ifdef blck_debugMode
@ -178,7 +180,7 @@ while {_wait} do
{
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_MissionTimout] call blck_fnc_timedOut];
diag_log format["missionSpawner:: Trigger Loop - timeout = %1", [_missionStartTime,blck_MissionTimeout] call blck_fnc_timedOut];
};
#endif
};
@ -187,15 +189,6 @@ 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;
/*
// Deal with the case in which the mission timed out.
blck_recentMissionCoords pushback [_coords,diag_tickTime];
blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords];
[_markerClass, "inactive",[0,0,0]] call blck_fnc_updateMissionQue;
blck_missionsRunning = blck_missionsRunning - 1;
[_blck_localMissionMarker select 0] call blck_fnc_deleteMarker;
[_objects, 0.1] spawn blck_fnc_cleanupObjects;
*/
};
////////

View File

@ -0,0 +1,640 @@
/*
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 = blck_Pistols};
if (isNil "_vests") then {_vests = blck_vests};
if (isNil "_backpacks") then {_backpacks = blck_backpacks};
//diag_log format["_fnc_missionSpawner: -> blck_backpacks = %1", blck_backpacks];
//diag_log format["_fnc_missionSpawner: -> _backpacks = %1",_backpacks];
if (isNil "_uniforms") then {_uniforms = blck_SkinList};
if (isNil "_headGear") then {_headgear = blck_headgear};
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_Red};
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_missionTimout = %1", blck_MissionTimout];
#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_MissionTimout] 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_MissionTimout] 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;};
};
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};
//diag_log format["_fnc_missionSpawner (477): _spawnPara = %1 | _chancePara = %2",_spawnPara,_chancePara];
{
_locations pushback (getPos _x);
_x setVariable["crateSpawnPos", (getPos _x)];
} forEach _crates;
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,10,true] call blck_fnc_playerInRangeArray) then {_missionComplete = 1};
};
if (_endIfAIKilled) then
{
if (({alive _x} count _blck_AllMissionAI) < 1) 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};
};
};
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 2;
};
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];

View File

@ -109,7 +109,7 @@ if (blck_debugLevel > 1) then
};
#endif
_wep setVariable["DBD_vehType","emplaced"];
_wep setVariable["GRG_vehType","emplaced"];
_wep setPos _pos;
[_wep,false] call blck_fnc_configureMissionVehicle;
_emplacedWeps pushback _wep;

View File

@ -0,0 +1,140 @@
/*
[_missionEmplacedWeapons,_noEmplacedWeapons,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnEmplacedWeaponArray;
Last modified 4/27/17
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["_coords","_missionEmplacedWeapons","_useRelativePos","_noEmplacedWeapons","_aiDifficultyLevel",["_uniforms",blck_SkinList], ["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_weaponList",[]],["_sideArms",blck_Pistols]];
#ifdef blck_debugMode
if (blck_debugLevel >=2) then
{
private _params = ["_coords","_missionEmplacedWeapons","_useRelativePos","_noEmplacedWeapons","_aiDifficultyLevel","_uniforms","_headGear","_vests","_backpacks","_weaponList","_sideArms"];
{
diag_log format["blck_fnc_spawnEmplacedWeaponArray:: param %1 | isEqualTo %2 | _forEachIndex %3",_params select _forEachIndex,_this select _forEachIndex, _forEachIndex];
}forEach _this;
};
#endif
private["_return","_emplacedWeps","_emplacedAI","_wep","_units","_gunner","_abort","_pos","_mode","_useRelativePos","_useRelativePos"];
_emplacedWeps = [];
_emplacedAI = [];
_units = [];
_abort = false;
_pos = [];
#ifdef blck_debugMode
//diag_log "_fnc_spawnEmplacedWeaponArray start";
#endif
// Define _missionEmplacedWeapons if not already configured.
if (_missionEmplacedWeapons isEqualTo []) then
{
_missionEmplacedWeaponPositions = [_coords,_noEmplacedWeapons,35,50] call blck_fnc_findPositionsAlongARadius;
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnEmplacedWeaponArray(38): creating random spawn locations: _missionEmplacedWeaponsPositions = %1", _missionEmplacedWeaponPositions];
};
#endif
{
_static = selectRandom blck_staticWeapons;
//diag_log format["_fnc_spawnEmplacedWeaponArray: creating spawn element [%1,%2]",_static,_x];
_missionEmplacedWeapons pushback [_static,_x];
//diag_log format["_fnc_spawnEmplacedWeaponArray: _mi updated to %1",_missionEmplacedWeapons];
} forEach _missionEmplacedWeaponPositions;
_useRelativePos = false;
};
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnEmplacedWeaponArray(52):: starting static weapon spawner with _missionEmplacedWeapons = %1", _missionEmplacedWeapons];
};
#endif
{
if (_useRelativePos) then
{
_pos = _coords vectorAdd (_x select 1);
} else {
_pos = (_x select 1);
};
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnEmplacedWeaponArray(67):: _coords = %1 | offset = %2 | final _pos = %3",_coords,_x select 1, _pos];
};
#endif
#define configureWaypoints false
#define minAI 1
#define maxAI 1
#define minDist 1
#define maxDist 2
/// // params["_pos", "_center", _numai1, _numai2, _skillLevel, _minDist, _maxDist, _configureWaypoints, _uniforms, _headGear,_vests,_backpacks,_weaponList,_sideArms, _scuba ];
_empGroup = [(_x select 1),_pos,minAI,maxAI,_aiDifficultyLevel,minDist,maxDist,configureWaypoints,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnGroup;
_empGroup setcombatmode "RED";
_empGroup setBehaviour "COMBAT";
[(_x select 1),0.01,0.02,_empGroup,"random","SAD","emplaced"] spawn blck_fnc_setupWaypoints;
if (isNull _empGroup) exitWith {_abort = _true};
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnEmplacedWeaponArray(82):: typeName _empGroup = %1 and _empGroup = %2 and _x = %3",typeName _empGroup, _empGroup,_x];
};
#endif
// params["_vehType","_pos",["_clearInventory",true]];
_wep = [(_x select 0),[0,0,0],false] call blck_fnc_spawnVehicle;
//_wep addEventHandler["HandleDamage",{ [_this] call compile preprocessFileLineNumbers blck_EH_AIVehicle_HandleDamage}];
_wep addMPEventHandler["MPHit",{ [_this] call compile preprocessFileLineNumbers blck_EH_AIVehicle_HandleDamage}];
_empGroup setVariable["groupVehicle",_wep];
_wep setVariable["vehicleGroup",_empGroup];
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnEmplacedWeaponArray (94) spawnVehicle returned value of _wep = %1",_wep];
};
#endif
_wep setVariable["DBD_vehType","emplaced"];
_wep setPos _pos;
[_wep,false] call blck_fnc_configureMissionVehicle;
_emplacedWeps pushback _wep;
_units = units _empGroup;
_gunner = _units select 0;
_gunner moveingunner _wep;
_emplacedAI append _units;
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnEmplacedWeaponArray(110):: position of emplaced weapon = %1 and targetd position is %2",getPos _wep, _pos];
diag_log format["_fnc_spawnEmplacedWeaponArray(111):: _gunner = %1 and crew _wep = %2",_gunner, crew _wep];
};
#endif
} forEach _missionEmplacedWeapons;
blck_monitoredVehicles append _emplacedWeps;
_return = [_emplacedWeps,_emplacedAI,_abort];
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnEmplacedWeaponArray:: returning with _return = _emplacedWeps = %1",_return];
};
#endif
_return

View File

@ -0,0 +1,14 @@
/*
By Ghostrider [GRG]
Copyright 2016
Scans vehicles local to the machine the script is run on.
--------------------------
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["_vehicle"];

View File

@ -17,7 +17,7 @@
diag_log "Vehicle Decommisioning handler activated";
params["_veh"];
if (_veh getVariable["DBD_vehType","none"] isEqualTo "emplaced") then // Deal with a static weapon
if (_veh getVariable["GRG_vehType","none"] isEqualTo "emplaced") then // Deal with a static weapon
{
if (blck_killEmptyStaticWeapons) then
{

View File

@ -1,7 +1,7 @@
/*
By Ghostrider [GRG]
Copyright 2016
Scans vehicles local to the machine the script is run on.
--------------------------
License
--------------------------
@ -23,7 +23,7 @@ _vehList = +blck_monitoredVehicles;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then {diag_log format["_fnc_vehicleMonitor:: function called at %1 with _vehList %2 and blck_monitoredVehicles %3",diag_tickTime,_vehList,blck_monitoredVehicles];};
#endif
diag_log format["_fnc_vehicleMonitor:: function called at %1 with _vehList %2 and blck_monitoredVehicles %3",diag_tickTime,_vehList,blck_monitoredVehicles];
{
/*
Determine state of vehicle
@ -34,13 +34,8 @@ if (blck_debugLevel > 2) then {diag_log format["_fnc_vehicleMonitor:: function c
*/
//diag_log format["_fnc_vehicleMonitor: evaluating vehicle %1",_x];
_veh = _x; // (purely for clarity at this point, _x could be used just as well)
_isEmplaced = _veh getVariable["DBD_vehType","none"] isEqualTo "emplaced";
_isEmplaced = _veh getVariable["GRG_vehType","none"] isEqualTo "emplaced";
_ownerIsPlayer = if (owner _veh > 2 && !(owner _veh in blck_connectedHCs)) then {true} else {false};
/*
{
diag_log format["_fnc_vehicleMonitor: vehicle %1 crew %2 alive = %3",_veh,_x, alive _x];
}forEach (crew _veh);
*/
_allCrewDead = if (({alive _x} count (crew _veh)) == 0) then {true} else {false};
//diag_log format["_fnc_vehicleMonitor: _allCrewDead = %1",_allCrewDead];
_deletenow = false;

View File

@ -20,7 +20,6 @@ blck_fnc_FindSafePosn = compileFinal preprocessFileLineNumbers "\q\addons\custo
blck_fnc_randomPosition = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_randomPosn.sqf";// find a randomPosn. see script for details.
blck_fnc_findPositionsAlongARadius = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_findPositionsAlongARadius.sqf";
blck_fnc_giveTakeCrypto = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_giveTakeCrypto.sqf";
blck_fnc_monitorHC = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_monitorHC.sqf";
blck_fnc_timeAcceleration = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\TimeAccel\GMS_fnc_Time.sqf";
blck_fnc_getModType = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_getModType.sqf"; // Test if Epoch or Exile is loaded
blck_fnc_groupsOnAISide = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_GroupsOnAISide.sqf"; // Returns the number of groups on the side used by AI
@ -32,7 +31,6 @@ blck_fnc_allPlayers = compileFinal preprocessFileLineNumbers "\q\addons\custom_
blck_fnc_addItemToCrate = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_addItemToCrate.sqf";
blck_fnc_loadLootItemsFromArray = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_loadLootItemsFromArray.sqf";
blck_fnc_getNumberFromRange = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_getNumberFromRange.sqf";
blck_fnc_passToHCs = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_passToHCs.sqf";
blck_fnc_spawnMarker = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_spawnMarker.sqf";
blck_fnc_missionCompleteMarker = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_missionCompleteMarker.sqf";
blck_fnc_deleteMarker = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\Functions\GMS_fnc_deleteMarker.sqf";
@ -142,8 +140,13 @@ blck_fnc_HC_XferGroup = compileFinal preprocessFileLineNumbers "\q\addons\custo
//blck_fnc_HC_XferVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_XferVehicle.sqf";
blck_fnc_onPlayerDisconnected = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_onPlayerDisconnected.sqf";
//blck_fnc_HC_groupsAssigned = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_groupsAssigned.sqf";
blck_fnc_HCmonitor = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HCmonitor.sqf";
blck_fnc_HC_monitor = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HCmonitor.sqf";
blck_fnc_HC_vehicleMonitor = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_vehicleMonitor.sqf";
//blck_fnc_HC_monitorHC = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_monitorHC.sqf";
blck_fnc_HC_passToHCs = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_passToHCs.sqf";
blck_fnc_HC_getListConnected = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_getListConnected.sqf";
blck_fnc_HC_leastBurdened = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_leastBurdened.sqf";
blck_fnc_HC_countGroupsAssigned = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_countGroupsAssigned.sqf";
onPlayerDisconnected {[_name,_owner] call blck_fnc_onPlayerDisconnected;};
diag_log "[blckeagls] Functions Loaded";

View File

@ -34,7 +34,10 @@ blck_activeMissions = [];
blck_deadAI = [];
blck_connectedHCs = [];
blck_missionMarkers = [];
blck_groupsOnHC = [];
blck_vehiclesOnHC = [];
blck_HC_monitoredVehicles = [];
blck_HC_monitoredGroups = [];
#ifdef useDynamicSimulation
"Group" setDynamicSimulationDistance 1800;
enableDynamicSimulationSystem true;