Merge branch 'Experimental'

This commit is contained in:
Chris Cardozo 2020-09-02 11:57:39 -04:00
commit 873026090d
272 changed files with 9541 additions and 7800 deletions

View File

@ -13,26 +13,14 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
if (toLower(blck_modType) isEqualTo "default") exitWith {};
params["_obj","_difficulty"];
if (blck_modType isEqualTo "Exile") then
params["_obj",["_money",-1]];
_money = ([_money] call blck_fnc_getNumberFromRange);
if (blck_debugLevel >= 3) then {[format["_fnc_addmoneyToObject: _money = %1 _obj = %2",_money,_obj]] call blck_fnc_log};
if !(_money <= 0) then
{
switch (_difficulty) do
switch(toLower(blck_modType)) do
{
case "blue":{_obj setVariable["ExileMoney", floor(random([blck_crateMoneyBlue] call blck_fnc_getNumberFromRange)),true];};
case "red":{_obj setVariable["ExileMoney", floor(random([blck_crateMoneyRed] call blck_fnc_getNumberFromRange)),true];};
case "green":{_obj setVariable["ExileMoney", floor(random([blck_crateMoneyGreen] call blck_fnc_getNumberFromRange)),true];};
case "orange":{_obj setVariable["ExileMoney", floor(random([blck_crateMoneyGreen] call blck_fnc_getNumberFromRange)),true];};
case "exile": {_obj setVariable["ExileMoney",_money,true]};
case "epoch": {_obj setVariable["Crypto", _money,true]};
};
};
if (blck_modType isEqualTo "Epoch") then
{
switch (_difficulty) do
{
case "blue":{_obj setVariable["Crypto", floor(random([blck_crateMoneyBlue] call blck_fnc_getNumberFromRange)),true];};
case "red":{_obj setVariable["Crypto", floor(random([blck_crateMoneyRed] call blck_fnc_getNumberFromRange)),true];};
case "green":{_obj setVariable["Crypto", floor(random([blck_crateMoneyGreen] call blck_fnc_getNumberFromRange)),true];};
case "orange":{_obj setVariable["Crypto", floor(random([blck_crateMoneyGreen] call blck_fnc_getNumberFromRange)),true];};
};
};

View File

@ -19,4 +19,4 @@ for "_i" from 1 to (count blck_temporaryMarkers) do
} else {
blck_temporaryMarkers pushBack _m;
};
};
};

View File

@ -21,21 +21,22 @@ private "_markers";
["_markerBrush","GRID"]
];
/*
private _pList =[
"_markerName", // the name used when creating the marker. Must be unique.
"_markerPos",
"_markerLabel",
"_markerColor",
"_markerType", // Use either the name of the icon or "ELLIPSE" or "RECTANGLE" where non-icon markers are used
"_markerSize",
"_markerBrush"
];
for "_i" from 0 to ((count _this) - 1) do
if (blck_debugLevel >= 3) then
{
diag_log format["_fnc_createMarker: parameter %1 = %2",_pList select _i,_this select _i];
};
*/
private _pList =[
"_markerName", // the name used when creating the marker. Must be unique.
"_markerPos",
"_markerLabel",
"_markerColor",
"_markerType", // Use either the name of the icon or "ELLIPSE" or "RECTANGLE" where non-icon markers are used
"_markerSize",
"_markerBrush"
];
for "_i" from 0 to ((count _this) - 1) do
{
diag_log format["_fnc_createMarker: parameter %1 = %2",_pList select _i,_this select _i];
};
};
if (toUpper(_markerType) in ["ELLIPSE","RECTANGLE"]) then // not an Icon ....
{

View File

@ -8,12 +8,18 @@
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/
Notes: cosine acute angle = hypotenuse / opposite. We always know the opposite = 1/2 mapsize so if we pick a random angle, we can calculate distance to edge of map.
Thus, we can have a random direction, calculate distance to the map edge as cos(direction - east/south/west/north angle) * 1/2 mapsize. Then, we can use 1/2 the lenght of the hypotenuse as the search range.
In this way we can reduce the radius of the search by about 1/2 and ensure a wider range of terrain is selected.
However, if we use this approach, we risk having some missions spawn outside the map so much check for that.
It may be quicker just to pick a random angle and use 1/2 map size to search a position obtained by getPos[(1/2 mapSize),random(359)]; to pick that random seed location for the search.
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
if (isNil "blck_locationBlackList") then {blck_locationBlackList = []};
_fn_buildBlacklistedLocationsList = {
params["_minToBases","_minToPlayers","_minToMissions","_minToTowns","_minToRecentMissionLocation"];
/* locations of villages / cities / others already included in blck_locationBlackList so we do not need to add it here. */
@ -40,8 +46,6 @@ _fn_buildBlacklistedLocationsList = {
_blacklistedLocs pushBack [getPosATL _x,_minToBases];
} forEach _bases;
{
_blacklistedLocs pushBack [getPosATL _x,_minToPlayers];
} forEach allPlayers;
@ -50,45 +54,138 @@ _fn_buildBlacklistedLocationsList = {
{
_blacklistedLocs append ([] call blck_fnc_getAllDMSMarkers);
};
//diag_log format["_blacklistedLocs = %1",_blacklistedLocs];
_blacklistedLocs
};
_fnc_nearWater = {
private _result = false;
private _coords = _this select 0;
private _radius = _this select 1;
for "_i" from 0 to 359 step 45 do {
//_checkposition = [(_coords select 0) + (sin(_i)*_radius), (_coords select 1) + (cos(_i)*_radius)];
//_checkposition2 = [(_coords select 0) + (sin(_i)*_radius/2), (_coords select 1) + (cos(_i)*_radius/2)];
//_checkPosition = _coords getPos[_radius, _i];
if (surfaceIsWater (_coords getPos[_radius, _i])) exitWith {
_result = true;
};
};
_result
};
private _minDistToBases = blck_minDistanceToBases;
private _minDistToPlayers = blck_minDistanceToPlayer;
private _minDistToTowns = blck_minDistanceFromTowns;
private _mindistToMissions = blck_MinDistanceFromMission;
private _minToRecentMissionLocation = 200;
private _keyDistances = [_minDistToBases,_minDistToPlayers,_minDistToTowns,_minToRecentMissionLocation];
private _coords = [];
private _blacklistedLocations = [_minDistToBases,_minDistToPlayers,_minDistToTowns,_mindistToMissions,_minToRecentMissionLocation] call _fn_buildBlacklistedLocationsList;
//private _blacklistedLocations = [_minDistToBases,_minDistToPlayers,_minDistToTowns,_mindistToMissions,_minToRecentMissionLocation] call _fn_buildBlacklistedLocationsList;
private _count = 25;
while {_coords isEqualTo [] && _count > 0} do
private _flatCoords = [];
private _slope = 0.15;
private _searchDist = blck_mapRange / 2;
private _timeIn = diag_tickTime;
private _validspot = false;
while { !_validspot} do
{
/*
6-13-20
Notes
increased min distance to objects from 3 to 10
decreased max slope from 5 to 0.5
*/
private _angle = random(359);
private _searchCenter = blck_mapCenter getPos[_searchDist, random(359)];
_coords = [_searchCenter,0,_searchDist,10,0,_slope,0] call BIS_fnc_findSafePos;
_coords = [blck_mapCenter,0,blck_mapRange,10,0,0.5,0,_blacklistedLocations] call BIS_fnc_findSafePos;
/* Check whether the location is flat enough: returns [] if not. */
private _isFlat = _coords isFlatEmpty [20,0,0.5,100,0,false];
if (_coords isEqualTo [] || !(_isFlat isEqualTo [])) then
if (_coords isEqualTo []) then
{
{
//private _range = (_x select 1) * 0.7;
_x set[1,(_x select 1) * 0.75];
} forEach _blackListedLocations;
_count = _count - 1;
_slope = _slope + 0.02;
uiSleep 0.1; // to give the server a chance to handle other jobs for a moment
} else {
//uiSleep 1;
_validspot = true;
if (count _coords > 2) then {
_validspot = false;
};
if(_validspot) then {
if ([_coords,500] call _fnc_nearWater) then {
_validspot = false;
};
};
if(_validspot) then {
_isflat = _coords isFlatEmpty [20,0,0.5,100,0,false];
if (_isflat isequalto []) then {
_validspot = false;
};
};
if(_validspot) then {
{
if (_coords distance _x < blck_MinDistanceFromMission) exitwith {
_validspot = false;
};
} foreach (blck_ActiveMissionCoords);
};
// Check for near Bases
if(_validspot) then {
if (blck_modType isEqualTo "Epoch") then {
{
if (_coords distance _x < blck_minDistanceToBases) exitwith {
_validspot = false;
};
} foreach (missionnamespace getvariable ["Epoch_PlotPoles",[]]);
}
else {
if (blck_modType isEqualTo "Exile") then {
{
if (_coords distance _x < blck_minDistanceToBases) exitwith {
_validspot = false;
};
} foreach (nearestObjects [blck_mapCenter, ["Exile_Construction_Flag_Static"], blck_mapRange + 25000]);
};
};
};
// Check for near Players
if(_validspot) then {
{
if (_coords distance _x < blck_minDistanceToPlayer) exitwith {
_validspot = false;
};
} foreach allplayers;
};
// Check for near locations
if (_validspot) then {
{
if (_coords distance (_x select 0) < (_x select 1)) exitWith {
_validspot = false;
};
} forEach blck_locationBlackList;
};
// Check for DMS missions
if (blck_minDistanceFromDMS > 0 && _validspot) then
{
{
if (_coords distance _x < blck_minDistanceFromDMS) exitWith {
_validspot = false;
};
} forEach ([] call blck_fnc_getAllDMSMarkers);
};
};
//diag_log format["_fnc_findSafePosn: _coords = %1 | _flatCoords = %2 | _searchCenter = %3 | _angle %4 | _count = %5 | _validSpot = %6",_coords,_flatCoords,_searchCenter,_angle,_count,_validspot];
};
if (_coords isEqualTo []) then
{
diag_log format["[blckeagls] <ERROR> Could not find a safe position for a mission, consider reducing values for minimum distances between missions and players, bases, other missions or towns"];
["Could not find a safe position for a mission, consider reducing values for minimum distances between missions and players, bases, other missions or towns","error"] call blck_fnc_log;
} else {
_coords set[2, 0];
//diag_log format["_fnc_findSafePosn: _exit with _coords = %1 | time spent = %2",_coords,diag_tickTime - _timeIn];
};
_coords

View File

@ -0,0 +1,20 @@
/*
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/
*/
params[["_message","Unknown Message"],["_code",""]];
switch (toLower _code) do
{
case "error": {_message = format["[blckeagls] <ERROR> %1",_message]};
case "warning": {_message = format["[blckeagls] <WARNING> %1",_message]};
default {_message = format["[blckeagls] :: %1",_message]};
};
diag_log _message;

View File

@ -10,10 +10,10 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_timer1sec","_timer5sec","_timer20sec","_timer5min","_timer5min"];
private["_timer1sec","_timer5sec","_timer10Sec","_timer20sec","_timer5min","_timer5min"];
_timer1sec = diag_tickTime;
_timer5sec = diag_tickTime;
_timer10Sec = diag_tickTime;
_timer20sec = diag_tickTime;
_timer1min = diag_tickTime;
_timer5min = diag_tickTime;
@ -23,6 +23,7 @@ while {true} do
uiSleep 1;
if (diag_tickTime > _timer1sec) then
{
[] spawn blck_fnc_monitorInitializedMissions;
if (blck_showCountAliveAI) then
{
{
@ -36,12 +37,16 @@ while {true} do
_timer5sec = diag_tickTime + 5;
if (blck_simulationManager isEqualTo blck_useBlckeaglsSimulationManagement) then {[] call blck_fnc_simulationManager};
[] call blck_fnc_sm_staticPatrolMonitor;
[] call blck_fnc_vehicleMonitor;
[] call blck_fnc_vehicleMonitor;
#ifdef GRGserver
[] call blck_fnc_broadcastServerFPS;
#endif
};
if (diag_tickTime > _timer10Sec) then
{
[] call blck_fnc_spawnPendingMissions;
_timer10Sec = diag_tickTime;
};
if (diag_tickTime > _timer20sec) then
{
[] call blck_fnc_scanForPlayersNearVehicles;
@ -52,31 +57,26 @@ while {true} do
if ((diag_tickTime > _timer1min)) then
{
_timer1min = diag_tickTime + 60;
[] call blck_fnc_spawnPendingMissions;
[] call blck_fnc_groupWaypointMonitor;
if (blck_dynamicUMS_MissionsRuning < blck_numberUnderwaterDynamicMissions) then {[] spawn blck_fnc_addDyanamicUMS_Mission};
[] call blck_fnc_groupWaypointMonitor;
[] call blck_fnc_cleanupAliveAI;
[] call blck_fnc_cleanupObjects;
[] call blck_fnc_cleanupDeadAI;
if (blck_useHC) then {[] call blck_fnc_HC_passToHCs};
if (blck_useTimeAcceleration) then {[] call blck_fnc_timeAcceleration};
if (blck_ai_offload_to_client) then {[] call blck_fnc_ai_offloadToClients};
#ifdef blck_debugMode
diag_log format["_fnc_mainThread: active scripts include: %1",diag_activeScripts];
#endif
};
if (diag_tickTime > _timer5min) then
{
diag_log format["[blckeagls] Timstamp %8 |Dynamic Missions Running %1 | UMS Running %2 | Vehicles %3 | Groups %4 | Server FPS %5 | Server Uptime %6 Min | Missions Run %7",blck_missionsRunning,blck_dynamicUMS_MissionsRuning,count blck_monitoredVehicles,count blck_monitoredMissionAIGroups,diag_FPS,floor(diag_tickTime/60),blck_missionsRun, diag_tickTime];
#ifdef blck_debugMode
/*
Syntax:
diag_activeSQFScripts
Return Value:
Array of Arrays - to format [[scriptName, fileName, isRunning, currentLine], ...]:
*/
#endif
[] call blck_fnc_cleanupAliveAI;
[] call blck_fnc_cleanupObjects;
[] call blck_fnc_cleanupDeadAI;
[format["Timstamp %8 |Dynamic Missions Running %1 | UMS Running %2 | Vehicles %3 | Groups %4 | Server FPS %5 | Server Uptime %6 Min | Missions Run %7",
blck_missionsRunning,
blck_dynamicUMS_MissionsRuning,
count blck_monitoredVehicles,
count blck_monitoredMissionAIGroups,
diag_FPS,floor(diag_tickTime/60),
blck_missionsRun,
diag_tickTime]
] call blck_fnc_log;
[] call blck_fnc_cleanEmptyGroups;
_timer5min = diag_tickTime + 300;
};

View File

@ -12,7 +12,6 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
if !(isServer) exitWith {};
params["_msg",["_players",allplayers]];
//diag_log format["AIM.sqf ===] _this = %1 | _msg = %2 | _players = %3",_this,_msg, _players];
{
if (isPlayer _x) then {_msg remoteExec["fn_handleMessage",(owner _x)]};

View File

@ -15,6 +15,7 @@
private["_newX","_newY"];
params["_pos","_range"];
_newX = ((_pos select 0) + (random(_range)) * (selectRandom [1,-1]));
_newY = ((_pos select 1) + (random(_range)) * (selectRandom [1,-1]));

View File

@ -0,0 +1,7 @@
params["_object","_dir"];
switch (typeName _dir) do
{
case "SCALAR": {_object setDir _dir};
case "ARRAY": {_object setVectorDirAndUp _dir};
};

View File

@ -1,20 +0,0 @@
//////////////////////////////////////////////////////
// test if a timeout condition exists.
// [_startTime] call blck_fnc_timedOut
// Returns true (timed out) or false (not timed out)
/*
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["_startTime",["_timeoutTime",blck_MissionTimeout]];
private _return = if ((diag_tickTime - _startTime) > _timeoutTime) then {true} else {false};
_return

View File

@ -14,9 +14,7 @@
// TODO: used for 'unstuck' cases
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
#ifdef blck_debugMode
diag_log "_fnc_changeToMoveWaypoint: blck_debugMode enabled";
#endif
private["_group","_wp","_wpPos","_dis","_arc","_dir","_newPos","_marker","_center","_minDis","_maxDis"];
_group = group _this;
@ -49,23 +47,7 @@ _wp setWaypointLoiterRadius (_group getVariable["wpRadius",30]);
_wp setWaypointLoiterType "CIRCLE";
_wp setWaypointSpeed "LIMITED";
_group setCurrentWaypoint _wp;
diag_log format["_fnc_changeToMoveWaypoint:: -- >> group to update is %1 and new Waypoint position is %2",_group, getWPPos _wp];
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_changeToMoveWaypoint (4/25/17): _this = %1", _this];
diag_log format["_fnc_changeToMoveWaypoint: typeName _this = %1", typeName _this];
diag_log format["_fnc_changeToMoveWaypoint:_group = %1",_group];
diag_log format["_fnc_changeToMoveWaypoint:_group timestamp updated to %1", _group getVariable "timeStamp"];
diag_log format["_fnc_changeToMoveWaypoint:: -- >> wpMode %1 _dir %2 _dis %3 _center %4",_group getVariable["wpMode","random"], _dir, _dis,_center];
diag_log format["_fnc_changeToMoveWaypoint:: -- >> group to update is %1 and new position is %2",_group, _newPos];
diag_log format["_fnc_changeToMoveWaypoint:: -- >> group to update is %1 and new Waypoint position is %2",_group, getWPPos _wp];
diag_log format["_fnc_changeToMoveWaypoint:_group %1 basic waypoint parameters updates", _group getVariable "timeStamp"];
_marker =_group getVariable["wpMarker",""];
_marker setMarkerColor "ColorBlue";
diag_log format["_fnc_changeToMoveWaypoint:: -- >> Waypoint marker for group %1 have been configured as %2",_group, _group getVariable "wpMarker"];
};
#endif
if (_group getVariable["wpPatrolMode",""] isEqualTo "SAD") then
{
#ifdef blck_debugMode

View File

@ -17,7 +17,4 @@ params["_group","_maxTime","_radius"];
if (diag_tickTime > (_group getVariable "timeStamp") + _maxTime) then // || ( (getPos (leader)) distance2d (_group getVariable "patrolCenter") > _radius)) then
{
(leader _group) call blck_fnc_setNextWaypoint;
#ifdef blck_debugMode
if (blck_debugLevel > 1) then {diag_log format["_fnc_checkGroupWaypointStatus: group %1 stuck, waypoint reset",_group];};
#endif
};

View File

@ -9,7 +9,7 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
//diag_log format["_fnc_cleanEmptyGroups: count blck_monitoredMissionAIGroups = %1",count blck_monitoredMissionAIGroups];
for "_i" from 0 to ((count blck_monitoredMissionAIGroups) - 1) do
{
if (_i >= (count blck_monitoredMissionAIGroups)) exitWith {};

View File

@ -22,26 +22,17 @@ _fn_waypointComplete = {
private _done = if (currentWaypoint _group) > (count (waypoints _group)) then {true} else {false};
_done
};
//diag_log format["_fnc_groupWaypointMonitor called at %1 with %2 groups to monitor",diag_tickTime,count blck_monitoredMissionAIGroups];
{
private["_timeStamp","_index","_unit","_soldierType"];
if ( !(_x isEqualTo grpNull) && ({alive _x} count (units _x) > 0) ) then
{
/*
#define blck_turnBackRadiusInfantry 800
#define blck_turnBackRadiusVehicles 1000
#define blck_turnBackRadiusHelis 1000
#define blck_turnBackRadiusJets 1500
*/
//diag_log format["_fn_monitorGroupWaypoints - radii: on foot %1 | vehicle %2 | heli %3 | jet %4",blck_turnBackRadiusInfantry,blck_turnBackRadiusVehicles,blck_turnBackRadiusHelis,blck_turnBackRadiusJets];
_timeStamp = _x getVariable ["timeStamp",0];
if (_timeStamp isEqualTo 0) then
{
_x setVariable["timeStamp",diag_tickTime];
//diag_log format["_fn_monitorGroupWaypoints::--> updating timestamp for group %1 at time %2",_x,diag_tickTime];
};
_soldierType = _x getVariable["soldierType","null"];
//diag_log format["_fn_monitorGroupWaypoints::--> soldierType for group %1 = %2 and timeStamp = %3",_x,_soldierType,_timeStamp];
switch (_soldierType) do
{
case "infantry": {[_x, 60] call blck_fnc_checkgroupwaypointstatus;};
@ -49,6 +40,5 @@ _fn_waypointComplete = {
case "aircraft": {[_x, 90, 1000] call blck_fnc_checkgroupwaypointstatus;};
};
};
//private _updateNeeded = if (diag_tickTime > (_x getVariable "timeStamp") + 60) then
} forEach blck_monitoredMissionAIGroups;

View File

@ -25,15 +25,11 @@ private _leader = _this;
private _pos = _group getVariable "patrolCenter"; // Center of the area to be patroleld.
private _minDis = _group getVariable "minDis"; // minimum distance between waypoints
private _maxDis = _group getVariable "maxDis"; // maximum distance between waypoints
// _group getVariable "timeStamp"; // used to check that waypoints are being completed
//private _wpRadisu _group getVariable "wpRadius"; // Always set to 0 to force groups to move a bit
private _patrolRadius = _group getVariable "patrolRadius"; // radius of the area to be patrolled
private _wpMode = _group getVariable "wpMode"; // The default mode used when the waypoint becomes active https://community.bistudio.com/wiki/AI_Behaviour
//_group getVariable "wpPatrolMode"; // Not used; the idea is to allow two algorythms: randomly select waypoints so groups move back and forth along the perimiter of the patrool area or sequenctioal, hoping along the perimeter
private _wpTimeout = _group getVariable "wpTimeout"; // Here to alow you to have the game engine pause before advancing to the next waypoing. a timout of 10-20 sec is recommended for infantry and land vehicles, and 1 sec for aircraft
private _wpDir = _group getVariable "wpDir"; // Used to note the degrees along the circumference of the patrol area at which the last waypoint was positioned.
private _arc = _group getVariable "wpArc"; // Increment in degrees to be used when advancing the position of the patrol to the next position along the patrol perimeter
//_group getVariable "soldierType"; // infantry, vehicle, air or emplaced. Note that there is no need to have more than one waypoint for emplaced units.
private _wp = [_group,0];
private _nearestEnemy = _leader findNearestEnemy (getPosATL _leader);
private _maxTime = _group getVariable["maxTime",300];

View File

@ -11,10 +11,7 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
if (blck_simulationManager isEqualTo blck_simulationManagementOff) exitWith
{
//diag_log format["_fnc_simulationMonitor: monitoring disabled at %1",diag_tickTime];
};
if (blck_simulationManager isEqualTo blck_simulationManagementOff) exitWith {};
if (blck_simulationManager isEqualTo blck_useDynamicSimulationManagement) exitWith
{
@ -31,7 +28,7 @@ if (blck_simulationManager isEqualTo blck_useDynamicSimulationManagement) exitWi
if (blck_simulationManager isEqualTo blck_useBlckeaglsSimulationManager) then
{
//diag_log format["_fnc_simulationMonitor: evaluating simulation using blckeagls code"];
{
private _group = _x;
private _nearplayer = [position (leader _group),blck_simulationEnabledDistance] call blck_fnc_nearestPlayers;
@ -43,19 +40,16 @@ if (blck_simulationManager isEqualTo blck_useBlckeaglsSimulationManager) then
_x enableSimulationGlobal true;
_x reveal [(_nearplayer select 0),(_group knowsAbout (_nearPlayer select 0)) + 0.001]; // Force simulation on
}forEach units _group;
//diag_log format["_fnc_simulationMonitor: (44) enabling simulation for group %1",_group];
};
}else{
if (simulationEnabled (leader _group)) then
{
{_x enableSimulationGlobal false} forEach units _group;
//diag_log format["_fnc_simulationMonitor: (50) disabling simulation for group %1",_group];
{_x enableSimulationGlobal false} forEach units _group;
};
};
} forEach blck_monitoredMissionAIGroups;
{
// diag_log format["_fnc_simulationManager: _x = %1 | blck_graveyardGroup = %2",_x, units blck_graveyardGroup];
// disable simulation once players have left the area.
private _nearPlayers = [position (_x),blck_simulationEnabledDistance] call blck_fnc_nearestPlayers;
if (simulationEnabled _x) then
@ -63,13 +57,11 @@ if (blck_simulationManager isEqualTo blck_useBlckeaglsSimulationManager) then
if (_nearPlayers isEqualTo []) then
{
_x enableSimulationGlobal false;
//diag_log format["_fnc_simulationMonior: simulation for unit %1 set to FALSE",_unit];
};
} else {
if !(_nearPlayers isEqualTo []) then
{
_x enableSimulationGlobal true;
//diag_log format["_fnc_simulationMonior: simulation for unit %1 set to TRUE",_unit];
_x enableSimulationGlobal true;
};
};
} forEach units blck_graveyardGroup;

View File

@ -16,8 +16,6 @@ private["_numbertospawn","_safepos","_launcherType","_infantryType"];
params[["_group","Error"],"_pos", "_center", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], ["_minDist",30], ["_maxDist",45],["_configureWaypoints",true], ["_uniforms",[]], ["_headGear",[]],["_vests",[]],["_backpacks",[]],["_weaponList",[]],["_sideArms",[]], ["_scuba",false],["_patrolRadius",30]];
if (_weaponList isEqualTo []) then {_weaponList = [_skillLevel] call blck_fnc_selectAILoadout};
if (_sideArms isEqualTo []) then {_sideArms = [_skillLevel] call blck_fnc_selectAISidearms};
if (_uniforms isEqualTo []) then {_uniforms = [_skillLevel] call blck_fnc_selectAIUniforms};
@ -45,17 +43,13 @@ if !(isNull _group) then
_launcherType = "none";
};
private _unitPos = [_pos,3,6] call blck_fnc_findRandomLocationWithinCircle;
[_unitPos,_group,_skillLevel,_uniforms,_headGear,_vests,_backpacks,_launcherType, _weaponList, _sideArms, _scuba] call blck_fnc_spawnUnit;
//diag_log format["_fnc_spawnGroup: _unit %1 spawned at %2 at a distance from the group center of %3 and _vector of %4",_unit,_unitPos,_unitPos distance _pos,_pos getRelDir _unitPos];
};
_group selectLeader ((units _group) select 0);
if (_configureWaypoints) then
{
if (_scuba) then {_infantryType = "scuba"} else {_infantryType = "infantry"};
#define infantryPatrolRadius 30
#define infantryWaypointTimeout [5,7.5,10]
[_pos,_minDist,_maxDist,_group,"random","SAD",_infantryType,_patrolRadius,infantryWaypointTimeout] spawn blck_fnc_setupWaypoints;

View File

@ -25,7 +25,7 @@
_isMagazine = false;
_isBackpack = false;
_quant = 0;
//diag_log format["_fn_addItemToCrate:: -- >> itemInfor = %1",_itemInfo];
if (typeName _itemInfo isEqualTo "STRING") then {_item = _itemInfo; _quant = 1}; // case where only the item descriptor was provided
if (typeName _itemInfo isEqualTo "ARRAY") then {

View File

@ -1,50 +0,0 @@
/*
Adds the basic list of parameters that define a mission such as the marker name, mission list, mission path, AI difficulty, and timer settings, to the arrays that the main thread inspects.
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[
"_missionList", // list of missions to be used for that category (blue, red, gree, orange, etc)
"_path", // path to the folder with the mission.sqf's
"_marker", // a root name for markers used in the mission
"_difficulty",
"_tMin",
"_tMax",
["_noMissions",1]
];
//{diag_log format["_fnc_addMissionToCue: _this %1 = %2",_forEachIndex,_x]} forEach _this;
private["_compiledMission","_compiledMissionsList"];
private _waitTime = diag_tickTime + (_tMin) + random((_tMax) - (_tMin));
private _missionsData = []; // Parameters definine each of the missions for this difficulty are stored as arrays here.
{
private _missionFile = format["\q\addons\custom_server\Missions\%1\%2.sqf",_path,_x];
private _missionCode = compileFinal preprocessFileLinenumbers _missionFile;//return all of the values that define how the mission is spawned as an array of values.
private _data = [] call _missionCode;
_missionsData pushBack _data;
} forEach _missionList;
private _missionCategoryDescriptors = [
_difficulty,
_noMissions, // Max no missions of this category
0, // Number active
_tMin, // Used to calculate waittime in the future
_tMax, // as above
_waitTime, // time at which a mission should be spawned
_missionsData //
];
blck_missionData pushBack _missionCategoryDescriptors;

View File

@ -12,30 +12,42 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
//params["_missionList","_compiledMission","_compiledMissionsList","_waitTime","_mission","_path","_marker","_difficulty","_tMin","_tMax",["_noMissions",1]];
params["_missionList","_path","_marker","_difficulty","_tMin","_tMax",["_noMissions",1]];
private["_compiledMission","_compiledMissionsList"];
_compiledMissionsList = [];
for "_i" from 1 to _noMissions do
if (blck_debugLevel >= 3) then
{
_waitTime = diag_tickTime + (_tMin) + random((_tMax) - (_tMin));
// 0 1 2 3 4 5 6 7 8
//_mission = [_missionList,_path,format["%1%2",_marker,_i],_difficulty,_tMin,_tMax,_waitTime,[0,0,0],_allowReinforcements];
{
//diag_log format["_fnc_addMissionToQue: _x = %1",_x];
_compiledMission = compilefinal preprocessFileLineNumbers format["\q\addons\custom_server\Missions\%1\%2.sqf",_path,_x];
_compiledMissionsList pushBack _compiledMission;
}forEach _missionList;
_mission = [_compiledMissionsList,format["%1%2",_marker,_i],_difficulty,_tMin,_tMax,_waitTime,[0,0,0]];
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then {
diag_log format["-fnc_addMissionToQue::-->> _mission = %1",[/*_mission select 0, */_mission select 1, _mission select 2, _mission select 3, _mission select 4, _mission select 5, _mission select 6]];
};
#endif
//diag_log format["-fnc_addMissionToQue::-->> _mission = %1",[ _mission select 1, _mission select 2, _mission select 3, _mission select 4, _mission select 5, _mission select 6]];
blck_pendingMissions pushback _mission;
diag_log format["_addMissionToQue: _this %1 = %2",_forEachIndex, _this select _forEachIndex];
} forEach _this;
};
private _waitTime = diag_tickTime + (_tMin) + random((_tMax) - (_tMin));
private _missionsData = []; // Parameters definine each of the missions for this difficulty are stored as arrays here.
{
private _missionFile = format["\q\addons\custom_server\Missions\%1\%2.sqf",_path,_x];
private _missionCode = compileFinal preprocessFileLinenumbers _missionFile;//return all of the values that define how the mission is spawned as an array of values
if !(isNil "_missionCode") then
{
private _data = [_marker,_difficulty] call _missionCode;
if !(isNil "_data") then
{
_missionsData pushBack _data;
};
} else {
diag_log format["bad path\mission combination %1",_missionFile];
};
} forEach _missionList;
private _missionCategoryDescriptors = [
_difficulty,
_noMissions, // Max no missions of this category
0, // Number active
_tMin, // Used to calculate waittime in the future
_tMax, // as above
_waitTime, // time at which a mission should be spawned
_missionsData //
];
blck_missionData pushBack _missionCategoryDescriptors;
#ifdef blck_debugMode
if (blck_debugLevel >= 4) then {diag_log format["_fnc_addMissionToQue:: -- >> Result - blck_pendingMissions = %1",blck_pendingMissions];};
#endif

View File

@ -16,8 +16,6 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
//diag_log format["_fnc_cleanUpObjects: time %1 | count blck_oldMissionObjects %2",diag_tickTime,count blck_oldMissionObjects];
for "_i" from 1 to (count blck_oldMissionObjects) do {
if (_i <= count blck_oldMissionObjects) then {
private _oldObjs = blck_oldMissionObjects deleteAt 0;
@ -27,7 +25,6 @@ for "_i" from 1 to (count blck_oldMissionObjects) do {
private _nearplayer = [_missionCenter,800] call blck_fnc_nearestPlayers;
if (_nearPlayer isEqualTo []) then
{
//diag_log format["_fnc_cleanUpObjects: _nearPlayer = %1 | _missionCenter = %2 | _objarr = %3",_nearplayer,_missionCenter,_objarr];
{deleteVehicle _x}forEach _objarr;
} else {
blck_oldMissionObjects pushback _oldObjs;

View File

@ -14,8 +14,7 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params ["_mines"];
//_mines = _this select 0; // array containing the mines to be deleted
//diag_log format["deleting %1 mines----- >>>> ", count _mines];
{
deleteVehicle _x;
} forEach _mines;

View File

@ -13,5 +13,4 @@
params["_crate"];
private _result = if ((_crate distance (_crate getVariable["crateSpawnPos",[0,0,0]])) > 10) then {true} else {false};
//diag_log format["_fn_crateMoved:: _crate %1 | crateSpawnPos %2 | _result = %3",_crate,_result];
_result;

View File

@ -13,12 +13,10 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp"
private["_cleanupAliveAITimer","_cleanupCompositionTimer","_isScubaMission"];
_fn_missionCleanup = {
params["_coords","_mines","_objects","_blck_AllMissionAI","_markerName","_cleanupAliveAITimer","_cleanupCompositionTimer",["_isScubaMission",false]];
[_mines] call blck_fnc_clearMines;
//[_coords,_objects, _cleanupCompositionTimer] call blck_fnc_addObjToQue;
blck_oldMissionObjects pushback [_coords,_objects, (diag_tickTime + _cleanupCompositionTimer)];
blck_liveMissionAI pushback [_coords,_blck_AllMissionAI, (diag_tickTime + _cleanupAliveAITimer)];
blck_missionsRunning = blck_missionsRunning - 1;
@ -55,68 +53,90 @@ params[
["_vehicles",[]],
["_isScubaMission",false]
];
/*
private _param = ["_coords","_mines","_objects","_crates","_blck_AllMissionAI","_endMsg","_markers","_markerPos","_markerName","_markerLabel","_endCondition","_vehicles","_isScubaMission"];
{
diag_log format["_fnc_endMission: parameter %1 named %2 = %3",_forEachIndex,_param select _forEachIndex,_x];
} forEach _this;
*/
{
[_x] call blck_fnc_deleteMarker;
}forEach (_markers);
if (_endCondition > 0) exitWith // Mision aborted for some reason
{
#define cleanupCompositionTimer 0
#define cleanupAliveAITimer 0
// params["_coords","_mines","_objects","_blck_AllMissionAI","_markerName","_cleanupAliveAITimer","_cleanupCompositionTimer",["_isScubaMission",false]];
[_coords,_mines,_objects,_blck_AllMissionAI,_markerName,cleanupAliveAITimer,cleanupCompositionTimer,_isScubaMission] call _fn_missionCleanup;
/*
{
if (local _x) then {deleteVehicle _x};
}forEach _crates;
*/
{
if (local _x) then {deleteVehicle _x};
}forEach _vehicles;
};
if (_endCondition <= 0) then // Normal Mission End State
switch (_endCondition) do
{
case -1: {
#define cleanupCompositionTimer 0
#define cleanupAliveAITimer 0
{
if (local _x) then {deleteVehicle _x};
}forEach _crates;
if (blck_useSignalEnd) then
{
[_crates select 0] spawn blck_fnc_signalEnd;
{
_x enableRopeAttach true;
}forEach _crates;
[_coords,_mines,_objects,_blck_AllMissionAI,_markerName,cleanupAliveAITimer,cleanupCompositionTimer,_isScubaMission] call _fn_missionCleanup;
[format["Mission <TIMED OUT> | _coords %1 : _markerClass %2 : _markerMissionName %3",_coords,_markerName,_markerLabel]] call blck_fnc_log;
};
diag_log format["_fnc_endMission (93) _endMsg = %1 | _markerLabel = %2",_endMsg,_markerLabel];
if (_endCondition == 0) then {[["end",_endMsg,_markerLabel]] call blck_fnc_messageplayers;};
if (_endCondition == -1) then {[["warning",_endMsg,_markerLabel]] call blck_fnc_messageplayers;};
[_markerPos, _markerName] spawn blck_fnc_missionCompleteMarker;
{
if !(_x getVariable["lootLoaded",false] || _endCondition == 1) then // dont load loot if the asset was killed
{
case 1: { // Normal End
if (blck_useSignalEnd) then
{
[_crates select 0] spawn blck_fnc_signalEnd;
{
_x enableRopeAttach true;
}forEach _crates;
};
[["end",_endMsg,_markerLabel]] call blck_fnc_messageplayers;
[_x,_crateLoot,_lootCounts] call blck_fnc_fillBoxes;
};
}forEach _crates;
[_markerPos, _markerName] spawn blck_fnc_missionCompleteMarker;
{
if !(_x getVariable["lootLoaded",false] || _endCondition == 1) then // dont load loot if the asset was killed
{
[_x,_crateLoot,_lootCounts] call blck_fnc_fillBoxes;
};
}forEach _crates;
{
private ["_v","_posnVeh"];
_posnVeh = blck_monitoredVehicles find _x; // returns -1 if the vehicle is not in the array else returns 0-(count blck_monitoredVehicles -1)
if (_posnVeh >= 0) then
{
(blck_monitoredVehicles select _posnVeh) setVariable ["missionCompleted", diag_tickTime];
} else {
_x setVariable ["missionCompleted", diag_tickTime];
blck_monitoredVehicles pushback _x;
};
} forEach _vehicles;
// params["_coords","_mines","_objects","_blck_AllMissionAI","_markerName","_cleanupAliveAITimer","_cleanupCompositionTimer",["_isScubaMission",false]];
[_coords,_mines,_objects,_blck_AllMissionAI,_markerName,blck_AliveAICleanUpTimer,blck_cleanupCompositionTimer,_isScubaMission] call _fn_missionCleanup;
{
private ["_v","_posnVeh"];
_posnVeh = blck_monitoredVehicles find _x; // returns -1 if the vehicle is not in the array else returns 0-(count blck_monitoredVehicles -1)
if (_posnVeh >= 0) then
{
(blck_monitoredVehicles select _posnVeh) setVariable ["missionCompleted", diag_tickTime];
} else {
_x setVariable ["missionCompleted", diag_tickTime];
blck_monitoredVehicles pushback _x;
};
} forEach _vehicles;
[_coords,_mines,_objects,_blck_AllMissionAI,_markerName,blck_AliveAICleanUpTimer,blck_cleanupCompositionTimer,_isScubaMission] call _fn_missionCleanup;
[format["Mission Completed | _coords %1 : _markerClass %2 : _markerMissionName %3",_coords,_markerName,_markerLabel]] call blck_fnc_log;
};
case 2: { // Aborted for moving a crate
{
if ( _x distance (_x getVariable ["crateSpawnPos", (getPos _x)]) > max_distance_crate_moved_uncompleted_mission)then {deleteVehicle _x};
} forEach _crates;
#define illegalCrateMoveMsg "Crate moved before mission completed"
[["warming",illegalCrateMoveMsg,_markerLabel]] call blck_fnc_messageplayers;
[_coords,_mines,_objects,_blck_AllMissionAI,_markerName,cleanupAliveAITimer,cleanupCompositionTimer,_isScubaMission] call _fn_missionCleanup;
[format["Mission Aborted <CRATE MOVED> | _coords %1 : _markerClass %2 : _markerMissionName %3",_coords,_markerName,_markerLabel]] call blck_fnc_log;
};
case 3: { // Mision aborted for killing an asset
#define cleanupCompositionTimer 0
#define cleanupAliveAITimer 0
{
if (local _x) then {deleteVehicle _x};
}forEach _crates;
[["warning",_endMsg,_markerLabel]] call blck_fnc_messageplayers;
[_coords,_mines,_objects,_blck_AllMissionAI,_markerName,cleanupAliveAITimer,cleanupCompositionTimer,_isScubaMission] call _fn_missionCleanup;
[format["Mission Aborted <ASSET KILLED> | _coords %1 : _markerClass %2 : _markerMissionName %3",_coords,_markerName,_markerLabel]] call blck_fnc_log;
};
case 4: {
#define cleanupCompositionTimer 0
#define cleanupAliveAITimer 0
{
if (local _x) then {deleteVehicle _x};
}forEach _crates;
[_coords,_mines,_objects,_blck_AllMissionAI,_markerName,cleanupAliveAITimer,cleanupCompositionTimer,_isScubaMission] call _fn_missionCleanup;
};
};
_endCondition
blck_missionsRun = blck_missionsRun + 1;

View File

@ -14,25 +14,19 @@
private["_a1","_item","_diff","_tries"];
params["_crate","_boxLoot","_itemCnts"];
//diag_log format["_fnc_fillBoxes: _this = %1",_this];
#ifdef blck_debugMode
{
diag_log format["_fnc_fillBoxes: _this select %1 = %2",_foreachindex, _this select _foreachindex];
}foreach _this;
#endif
_itemCnts params["_wepCnt","_magCnt","_opticsCnt","_materialsCnt","_itemCnt","_bkcPckCnt"];
_boxLoot params["_weapons","_magazines","_optics","_materials","_items","_backpacks"];
//diag_log format["_fnc_fillBoxes: _weapons = %1",_weapons];
if !(_weapons isEqualTo []) then
{
_tries = [_wepCnt] call blck_fnc_getNumberFromRange;
//diag_log format["_fnc_fillBoxes (31): loading %1 weapons",_tries];
// Add some randomly selected weapons and corresponding magazines
for "_i" from 0 to (_tries - 1) do
{
_item = selectRandom _weapons;
//diag_log format["_fnc_fillBoxes with weapons: _item = %1",_item];
if (typeName _item isEqualTo "ARRAY") then // Check whether weapon name is part of an array that might also specify an ammo to use
{
_crate addWeaponCargoGlobal [_item select 0,1]; // if yes then assume the first element in the array is the weapon name
@ -51,16 +45,15 @@
};
};
//diag_log format["_fnc_fillBoxes: _magazines = %1",_magazines];
if !(_magazines isEqualTo []) then
{
_tries = [_magCnt] call blck_fnc_getNumberFromRange;
//diag_log format["_fnc_fillBoxes (26): loading %1 magazines",_tries];
// Add Magazines, grenades, and 40mm GL shells
for "_i" from 0 to (_tries - 1) do
{
_item = selectRandom _magazines;
//diag_log format["_fnc_fillBoxes with magazines: _item = %1",_item];
if (typeName _item isEqualTo "ARRAY") then
{
_diff = (_item select 2) - (_item select 1); // Take difference between max and min number of items to load and randomize based on this value
@ -73,16 +66,15 @@
};
};
//diag_log format["_fnc_fillBoxes: _optics = %1",_optics];
if !(_optics isEqualTo []) then
{
_tries = [_opticsCnt] call blck_fnc_getNumberFromRange;
//diag_log format["_fnc_fillBoxes (72): loading %1 optics",_tries];
// Add Optics
for "_i" from 0 to (_tries - 1) do
{
_item = selectRandom _optics;
//diag_log format["_fnc_fillBoxes with optics: _item = %1",_item];
if (typeName _item isEqualTo "ARRAY") then
{
_diff = (_item select 2) - (_item select 1);
@ -95,16 +87,15 @@
};
};
//diag_log format["_fnc_fillBoxes: _materials = %1",_materials];
if !(_materials isEqualTo []) then
{
_tries = [_materialsCnt] call blck_fnc_getNumberFromRange;
//diag_log format["_fnc_fillBoxes (92): loading %1 materials",_materialsCnt];
// Add materials (cindar, mortar, electrical parts etc)
for "_i" from 0 to (_tries - 1) do
{
_item = selectRandom _materials;
//diag_log format["_fnc_fillBoxes with materials: _item = %1",_item];
if (typeName _item isEqualTo "ARRAY") then
{
_diff = (_item select 2) - (_item select 1);
@ -117,16 +108,14 @@
};
};
//diag_log format["_fnc_fillBoxes: _items = %1",_items];
if !(_items isEqualTo []) then
{
_tries = [_itemCnt] call blck_fnc_getNumberFromRange;
//diag_log format["_fnc_fillBoxes (112): loading %1 items",_itemCnt];
// Add Items (first aid kits, multitool bits, vehicle repair kits, food and drinks)
for "_i" from 0 to (_tries - 1) do
{
_item = selectRandom _items;
//diag_log format["_fnc_fillBoxes with items: _item = %1",_item];
if (typeName _item isEqualTo "ARRAY") then
{
_diff = (_item select 2) - (_item select 1);
@ -139,15 +128,13 @@
};
};
//diag_log format["_fnc_fillBoxes: _backpacks = %1",_backpacks];
if !(_backpacks isEqualTo []) then
{
_tries = [_bkcPckCnt] call blck_fnc_getNumberFromRange;
//diag_log format["_fnc_fillBoxes (132): loading %1 backpacks",_tries];
for "_i" from 0 to (_tries - 1) do
{
_item = selectRandom _backpacks;
//diag_log format["_fnc_fillBoxes with backpacks: _item = %1",_item];
if (typeName _item isEqualTo "ARRAY") then
{
_diff = (_item select 2) - (_item select 1);
@ -159,6 +146,3 @@
};
};
};
//diag_log "_fnc_fillBoxes <END>";
//diag_log format["testCrateLoading: crate inventory = %1",getItemCargo _crate];
//diag_log "_fnc_fillBoxes <END>";

View File

@ -28,12 +28,6 @@ if (_headGear isEqualTo []) then {_headGear = [_aiDifficultyLevel] call blck_f
if (_vests isEqualTo []) then {_vests = [_aiDifficultyLevel] call blck_fnc_selectAIVests};
if (_backpacks isEqualTo []) then {_backpacks = [_aiDifficultyLevel] call blck_fnc_selectAIBackpacks};
/*
{
diag_log format["_fnc_garrisonBuilding_ATLsystem: _this %1 = %2",_forEachIndex,_this select _forEachIndex];
}forEach _this;
*/
private["_group","_buildingsSpawned","_staticsSpawned","_g","_building","_return"];
_buildingsSpawned = [];
_staticsSpawned = [];
@ -41,25 +35,15 @@ _group = [blck_AI_Side,true] call blck_fnc_createGroup;
if !(isNull _group) then
{
{
_g = _x;
/*
{
diag_log format["_g %1 = %2",_forEachIndex,_g select _forEachIndex];
}forEach _g;
*/
// ["Land_Unfinished_Building_02_F",[-28.3966,34.8145,-0.00268841],0,true,true,[["B_HMG_01_high_F",[-5.76953,1.16504,7.21168],360]],[]],
_g = _x;
_x params["_bldClassName","_bldRelPos","_bldDir","_s","_d","_statics","_men"];
//diag_log format["_bldClassName = %1 | _bldRelPos = %2 | _bldDir = %3",_bldClassName,_bldRelPos,_bldDir];
_building = createVehicle[_bldClassName,[0,0,0],[],0,"CAN_COLLIDE"];
_building setPosATL (_bldRelPos vectorAdd _center);
_building setDir _bldDir;
_buildingsSpawned pushBack _building;
// params["_building","_group","_statics","_men",["_aiDifficultyLevel","Red"], ["_uniforms",[]],["_headGear",[]],["_vests",[]],["_backpacks",[]],["_launcher","none"],["_weaponList",[]],["_sideArms",[]]];
_staticsSpawned = [_building,_group,_statics,_men,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,"none",_weaponList,_sideArms] call blck_fnc_spawnGarrisonInsideBuilding_ATL;
}forEach _garrisonedBuilding_ATLsystem;
};
//{
//diag_log format["__fnc_garrisonBuilding_ATLsystem: %2 = %1",_x select 1, _x select 0];
//}forEach [ [_buildingsSpawned,"Buildings"],[_staticsSpawned,"Statics"]];
_return = [_group,_buildingsSpawned,_staticsSpawned];
_return

View File

@ -11,7 +11,8 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_center","_garrisonedBuilding_relPosSystem",
params["_center",
"_garrisonedBuilding_relPosSystem",
["_aiDifficultyLevel","Red"],
["_uniforms",[]],
["_headGear",[]],
@ -20,11 +21,7 @@ params["_center","_garrisonedBuilding_relPosSystem",
["_weaponList",[]],
["_sideArms",[]]
];
/*
{
diag_log format["_fnc_garrisonBuilding_relPosSystem: _this %1 = %2",_forEachIndex,_this select _forEachIndex];
}forEach _this;
*/
if (_weaponList isEqualTo []) then {_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout};
if (_sideArms isEqualTo []) then {_sideArms = [_aiDifficultyLevel] call blck_fnc_selectAISidearms};
if (_uniforms isEqualTo []) then {_uniforms = [_aiDifficultyLevel] call blck_fnc_selectAIUniforms};
@ -38,14 +35,13 @@ _group = [blck_AI_Side,true] call blck_fnc_createGroup;
if !(isNull _group) then
{
{
_g = _x;
// ["Land_Unfinished_Building_02_F",[-21.8763,-45.978,-0.00213432],0,true,true,0.67,3,[],4],
_g params["_bldClassName","_bldRelPos","_bldDir","_s","_d","_p","_noStatics","_typesStatics","_noUnits"];
_x params["_bldClassName","_bldRelPos","_bldDir","_s","_d","_p","_noStatics","_typesStatics","_noUnits"];
if (_typesStatics isEqualTo []) then {_typesStatics = ["B_HMG_01_high_F"]};
_building = createVehicle[_bldClassName,[0,0,0],[],0,"CAN_COLLIDE"];
_buildingsSpawned pushBack _building;
_building setPosATL (_bldRelPos vectorAdd _center);
_building setDir _bldDir;
[_building, _bldDir] call blck_fnc_setDirUp;
_staticsSpawned = [_building,_group,_noStatics,_typesStatics,_noUnits,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,"none",_weaponList,_sideArms] call blck_fnc_spawnGarrisonInsideBuilding_relPos;
}forEach _garrisonedBuilding_relPosSystem;
};

View File

@ -6,12 +6,8 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private ["_coords","_coordArray","_return"];
params["_missionCategoryDescriptors","_missionParameters"];
_missionCategoryDescriptors params [
"_difficulty",
"_noMissions", // Max no missions of this category
@ -22,87 +18,30 @@ params["_missionCategoryDescriptors","_missionParameters"];
"_missionsData" //
];
/*
if (blck_debugLevel >= 3) then
{
diag_log format["fnc_initializeMission: _missionCategoryDescriptors:%1 = %2",_x,_missionCategoryDescriptors select _forEachIndex];
} forEach [
"_difficulty",
"_noMissions", // Max no missions of this category
"_noActive", // Number active
"_tMin", // Used to calculate waittime in the future
"_tMax", // as above
"_waitTime", // time at which a mission should be spawned
"_missionsData" //
];
*/
{
diag_log format["_initializeMission: _missionCategoryDescriptors %1 = %2",_forEachIndex, _missionCategoryDescriptors];
} forEach [
"_difficulty",
"_noMissions", // Max no missions of this category
"_noActive", // Number active
"_tMin", // Used to calculate waittime in the future
"_tMax", // as above
"_waitTime", // time at which a mission should be spawned
"_missionsData" //
];
};
if (_noActive > _noMissions) exitWith {if (blck_debugOn) then {}};
_missionParameters params[
"_defaultMissionLocations", // 1
"_crateLoot", // 2
"_lootCounts", // 3
"_startMsg", // 4
"_endMsg", // 5
"_markerMissionName", // 6 "Scouts";
"_markerType", // 7 "mil_triangle"
"_markerColor", // 8 ColorBlue
"_markerSize", // 9 [200,200] for ELLIPSE and rectangle markers only
"_markerBrush", // 10 "GRID", for ELLIPSE and rectangle markers only
"_missionLandscapeMode", // 11
"_garrisonedBuildings_BuildingPosnSystem",
"_garrisonedBuilding_ATLsystem", // 13
"_missionLandscape", // 14
"_missionLootBoxes", // 15
"_missionLootVehicles", // 16
"_missionPatrolVehicles", // 17
"_submarinePatrolParameters", // 18
"_airPatrols", // 19
"_noVehiclePatrols", // 20
"_vehicleCrewCount", // 21
"_missionEmplacedWeapons", // 22
"_noEmplacedWeapons", // 23
"_missionLootVehicles", // 24
"_useMines", // 25
"_minNoAI", // 26
"_maxNoAI",
"_noAIGroups",
"_missionGroups",
"_scubaGroupParameters",
"_hostageConfig",
"_enemyLeaderConfig",
"_uniforms",
"_headgear",
"_vests",
"_backpacks",
"_weaponList",
"_sideArms",
"_chanceHeliPatrol",
"_noChoppers",
"_missionHelis",
"_chancePara",
"_noPara",
"_paraTriggerDistance",
"_paraSkill",
"_chanceLoot",
"_paraLoot",
"_paraLootCounts",
"_spawnCratesTiming",
"_loadCratesTiming",
"_endCondition",
"_isScubaMission"
];
/*
{
diag_log format["fnc_initializeMission: _missionParameters:%1 = %2",_x,_missionParameters select _forEachIndex];
} forEach [
"_defaultMissionLocations", // 1
"_crateLoot", // 2
"_lootCounts", // 3
"_startMsg", // 2
"_endMsg", // 3
"_markerMissionName",
"_markerName",
"_markerMissionName",
"_endMsg",
"_startMsg",
"_defaultMissionLocations",
"_crateLoot",
"_lootCounts",
"_markerType",
"_markerColor",
"_markerSize",
@ -120,7 +59,6 @@ _missionParameters params[
"_vehicleCrewCount",
"_missionEmplacedWeapons",
"_noEmplacedWeapons",
"_missionLootVehicles",
"_useMines",
"_minNoAI",
"_maxNoAI",
@ -129,6 +67,7 @@ _missionParameters params[
"_scubaGroupParameters",
"_hostageConfig",
"_enemyLeaderConfig",
"_assetKilledMsg",
"_uniforms",
"_headgear",
"_vests",
@ -150,8 +89,7 @@ _missionParameters params[
"_endCondition",
"_isScubaMission"
];
*/
//diag_log format["_fnc_initializeMission: _isScubaMission = %1",_isScubaMission];
_coordsArray = [];
if !(_defaultMissionLocations isEqualTo []) then
{
@ -165,46 +103,51 @@ if !(_defaultMissionLocations isEqualTo []) then
};
};
//diag_log format["_fnc_initializeMission: _coords = %1",_coords];
//uiSleep 1;
if (_coords isEqualTo []) exitWith
{
//diag_log format['_fnc_initializeMission: no safe location found, defering initialization'];
false;
};
//diag_log format["_fnc_initializeMission(160): _defaultMissionLocations = %3 | _markerMissionName = %1 | _coords = %2",_markerMissionName,_coords,_defaultMissionLocations];
blck_ActiveMissionCoords pushback _coords;
blck_missionsRunning = blck_missionsRunning + 1;
blck_missionsRun = blck_missionsRun + 1;
//diag_log format["_initializeMission (164): Total Dyanamic Land and UMS Run = %1 | total Dynamic and UMS Missions Running = %2", blck_missionsRun,blck_missionsRunning];
private _markers = [];
/*
Handle map markers
*/
private _markerName = format["%1:%2",_markerMissionName,blck_missionsRun];
//diag_log format["_initializeMission: _markerName = %1",_markerName];
private "_missionMarkerPosition";
private "_markerPos";
if (blck_labelMapMarkers select 0) then
{
_missionMarkerPosition = _coords;
_markerPos = _coords;
};
if !(blck_preciseMapMarkers) then
{
_missionMarkerPosition = [_coords,75] call blck_fnc_randomPosition;
_markerPos = [_coords,75] call blck_fnc_randomPosition;
};
private _markerData = [_markerType,_markerColor,_markerSize,_markerBrush];
private _markers = [_markerName,_coords,_markerMissionName,_markerColor,_markerType,_markerSize,_markerBrush] call blck_fnc_createMarker;
_markers params["_mainMarker",["_labelMarker",""]];
if (blck_debugLevel >= 3) then
{
{
diag_log format["_initializeMission: %1 = %2",_x,_markerData select _forEachIndex];
} forEach [
"_markerType",
"_markerColor",
"_markerSize",
"_markerBrush"
];
};
private _markers = [_markerName,_markerPos,_markerMissionName,_markerColor,_markerType,_markerSize,_markerBrush] call blck_fnc_createMissionMarkers;
/*
Send a message to players.
*/
[["start",_startMsg,_markerMissionName]] call blck_fnc_messageplayers;
private _missionTimeoutAt = diag_tickTime + blck_MissionTimeout;
private _triggered = 0;
private _spawnPara = if (random(1) < _chancePara) then {true} else {false};
@ -216,7 +159,9 @@ private _blck_AllMissionAI = [];
private _AI_Vehicles = [];
private _assetSpawned = objNull;
private _missionData = [_coords,_mines,_objects,_crates, _blck_AllMissionAI,_assetSpawned,_missionAIVehicles,_mainMarker,_labelMarker];
private _missionData = [_coords,_mines,_objects,_crates, _blck_AllMissionAI,_assetSpawned,_missionAIVehicles,_markers];
blck_activeMissionsList pushBack [_missionCategoryDescriptors,_missionTimeoutAt,_triggered,_spawnPara,_missionData,_missionParameters];
[format["Initialized Mission %1 | description %2 | difficulty %3 at %4",_markerName, _markerMissionName, _difficulty, diag_tickTime]] call blck_fnc_log;
true

View File

@ -11,7 +11,6 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private _crate = _this select 0;
[_crate,(_crate getVariable "lootArray"),(_crate getVariable "lootCounts")] call blck_fnc_fillBoxes;
[_crate, _crate getVariable "difficulty"] call blck_fnc_addMoneyToObject;
_crate setVariable["lootLoaded",true];

View File

@ -17,20 +17,16 @@ private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_mission
"_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","_paraSkill","_marker","_vehicleCrewCount",
"_defaultMissionLocations","_garrisonedbuildings_buildingposnsystem","_garrisonedBuilding_ATLsystem", "_isScubaMission","_markerlabel","_missionLootBoxes"];
"_defaultMissionLocations","_garrisonedbuildings_buildingposnsystem","_garrisonedBuilding_ATLsystem", "_isScubaMission","_markerlabel","_missionLootBoxes","_airpatrols"];
params["_coords","_markerName","_aiDifficultyLevel"];
params["_markerName",["_aiDifficultyLevel","Red"]];
if (isNil "_markerLabel") then {_markerLabel = _markerMissionName};
[_markerName, "active",_coords] call blck_fnc_updateMissionQue;
diag_log format["[blckeagls] missionSpawner (17):: Initializing mission: _cords %1 : _markerName %2 : _aiDifficultyLevel %3",_coords,_markerName,_aiDifficultyLevel,_markerLabel];
if (isNil "_assetKilledMsg") then {_assetKilledMsg = ""};
if (isNil "_markerColor") then {_markerColor = "ColorBlack"};
if (isNil "_markerType") then {_markerType = ["mil_box",[]]};
if (isNil "_markerSize") then {_markerSize = []};
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 "_spawnCratesTiming") then {_spawnCratesTiming = blck_spawnCratesTiming}; // Choices: "atMissionSpawnGround","atMissionSpawnAir","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 = []};
@ -59,7 +55,6 @@ if (isNil "_garrisonedBuildings_BuildingPosnSystem") then {_garrisonedBuildings_
if (isNil "_vehicleCrewCount") then {_vehicleCrewCount = [_aiDifficultyLevel] call GMS_fnc_selectVehicleCrewCount};
if (isNil "_airpatrols") then {_airpatrols = []};
if (isNil "_submarinePatrolParameters") then {_submarinePatrolParameters = []};
if (isNil "_scubagroupparameters") then {_scubagroupparameters = []};
if (isNil "_markerMissionName") then {
diag_log format["_fnc_missionSpawner: _markerMissionName not defined, using default value"];
@ -68,516 +63,87 @@ if (isNil "_markerMissionName") then {
if (isNil "_noLootCrates") then {_noLootCrates = 1};
if (isNil "_lootCrates") then {_lootCrates = blck_crateTypes};
if (isNil "_lootCratePositions") then {_lootCratePositions = []};
if (isNil "_isScubaMission") then {_isScubaMission = false};
if (isNil "_missionLootBoxes") then {_missionLootBoxes = []};
private "_temp";
// If the mission is to be spawned at pre-defined coordinates then select one from the array that defines them
// otherwise use the _coords that were passed to the script in _this
if (isNil "_defaultMissionLocations") then {_defaultMissionLocations = []};
if !(_defaultMissionLocations isEqualTo []) then
{
_coords = selectRandom _defaultMissionLocations;
};
_markerType params["_markerType",["_markersize",[250,250]],["_markerBrush","GRID"]];
private _paraSkill = _aiDifficultyLevel;
blck_ActiveMissionCoords pushback _coords;
blck_missionsRunning = blck_missionsRunning + 1;
//diag_log format["_fnc_missionSpawner: count blck_ActiveMissionCoords = %1 | blck_ActiveMissionCoords = %2",count blck_ActiveMissionCoords,blck_ActiveMissionCoords];
_objects = [];
_mines = [];
_crates = [];
_aiGroup = [];
_missionAIVehicles = [];
_blck_AllMissionAI = [];
_AI_Vehicles = [];
#define delayTime 1
#define useRelativePos true
#ifdef blck_debugMode
diag_log "_missionSpawner: All variables initialized";
#endif
private _markerPos = _coords;
if !(blck_preciseMapMarkers) then
if !(_spawnCratesTiming in blck_validLootSpawnTimings) then
{
private _markerPos = [_coords,75] call blck_fnc_randomPosition;
//diag_log format["_fnc_missionSpawner (110): _markerPos = %1",_markerPos];
} ;
[["start",_startMsg,_markerMissionName]] call blck_fnc_messageplayers;
_markerType params["_type",["_size",[250,250]],["_brush","GRID"]];
_markers = [_markerName,_markerPos,_markerMissionName,_markerColor,_type,_size,_brush] call blck_fnc_createMissionMarkers;
#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) _markers = %1",_markers];};
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
[format['Invalid crate spawn timing %1 found in mission %2 :: default value "atMissionSpawnGround" used',_spawnCratesTiming,_markerMissionName],"<WARNING>"] call blck_fnc_log;
_spawnCratesTiming = "atMissionSpawnGround";
};
if !(_loadCratesTiming in blck_validLootLoadTimings) then
{
//#ifdef blck_debugMode
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 > 3) 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 - blck_MissionTimeout = %4 | _missionStartTime = %1 | time = %2 | timeout = %3",_missionStartTime, diag_tickTime, [_missionStartTime,blck_MissionTimeout] call blck_fnc_timedOut,blck_MissionTimeout];
};
#endif
[format['Invalid crate loading timing %1 found in mission %2 :: default "atMissionSpawn" value used',_loadCratesTiming,_markerMissionName],"<WARNING>"] call blck_fnc_log;
_loadCratesTiming = "atMissionSpawn";
};
if !(_endCondition in blck_validEndStates) then
{
[format['Invalid mission end condition %1 found in mission %2 :: default value "allKilledOrPlayerNear"; used',_endCondition,_markerMissionName],"<WARNING>"] call blck_fnc_log;
_endCondition = "allKilledOrPlayerNear";
};
if (_missionTimedOut) exitWith
{
diag_log format["_fnc_missionSpawner (187): mission timed out: _markerName %1 | _markerLabel %2 | time %3",_markerName,_markerLabel,diag_tickTime];
[_coords,_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_markers,_markerPos,_markerName,_markerMissionName, 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 : _markerName %2 : _aiDifficultyLevel %3 _markerLabel %4",_coords,_markerName,_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 {
_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:: (219) Landscape spawned: _cords %1 : _markerName %2 : _aiDifficultyLevel %3 _markerLabel %4",_coords,_markerName,_aiDifficultyLevel,_markerLabel];
};
#endif
uiSleep delayTime;
_abort = false;
_temp = [];
_temp = [_coords, _minNoAI,_maxNoAI,_noAIGroups,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionAI;
_abort = _temp select 1;
if !(_abort) then
{
_blck_AllMissionAI append (_temp select 0);
};
//diag_log format["[blckeagls] missionSpawner:: (236) missionAI spawned: _markerName %1 : _markerLabel %2 : count _blck_AllMissionAI = %3",_markerName,_markerLabel, count _blck_AllMissionAI];
if !(_scubaGroupParameters isEqualTo []) then
{
#define isScubaMission true
private _temp = [_coords, _minNoAI,_maxNoAI,count _scubaGroupParameters,_scubaGroupParameters,_aiDifficultyLevel,blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,[],blck_UMS_weapons,[],_isScubaMission] call blck_fnc_spawnMissionAI;
uiSleep 2;
_abort = _temp select 1;
if !(_abort) then
{
_blck_AllMissionAI append (_temp select 0);
};
};
_assetSpawned = objNull;
if !(_hostageConfig isEqualTo []) then
{
_temp = [_coords,_hostageConfig] call blck_fnc_spawnHostage;
_assetSpawned = _temp select 0;
_objects pushBack (_temp select 1);
_blck_AllMissionAI pushBack _assetSpawned;
};
if !(_enemyLeaderConfig isEqualTo []) then
{
_temp = [_coords,_enemyLeaderConfig] call blck_fnc_spawnLeader;
_assetSpawned = _temp select 0;
_objects pushBack (_temp select 1);
_blck_AllMissionAI pushBack _assetSpawned;
};
uiSleep delayTime;
_temp = [[],[],false];
_abort = false;
// Deal with helicopter patrols
_temp = [];
_noChoppers = [_noChoppers] call blck_fnc_getNumberFromRange;
if (_noChoppers > 0) then
{
for "_i" from 1 to (_noChoppers) do
{
if (random(1) < _chanceHeliPatrol) then
{
_temp = [_coords,_aiDifficultyLevel,_missionHelis,_uniforms,_headGear,_vests,_backpacks,_weaponList, _sideArms,"none"] call blck_fnc_spawnMissionHeli;
if (typeName _temp isEqualTo "ARRAY") then
{
_abort = _temp select 2;
if !(_abort) then
{
blck_monitoredVehicles pushBack (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
};
};
};
};
};
uisleep 3;
if !(_garrisonedBuilding_ATLsystem isEqualTo []) then
{
_temp = [_coords, _garrisonedBuilding_ATLsystem, _aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_garrisonBuilding_ATLsystem;
_objects append (_temp select 1);
blck_monitoredVehicles append (_temp select 2);
_blck_AllMissionAI append (units (_temp select 0));
};
uiSleep 3;
if !(_garrisonedBuildings_BuildingPosnSystem isEqualTo []) then
{
_temp = [_coords, _garrisonedBuildings_BuildingPosnSystem, _aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_garrisonBuilding_RelPosSystem;
_objects append (_temp select 1);
blck_monitoredVehicles append (_temp select 2);
_blck_AllMissionAI append (units (_temp select 0));
};
uiSleep 15;
private["_noEmplacedToSpawn"];
_noEmplacedToSpawn = [_noEmplacedWeapons] call blck_fnc_getNumberFromRange;
if (blck_useStatic && (_noEmplacedToSpawn > 0)) then
{
_temp = [_coords,_missionEmplacedWeapons,useRelativePos,_noEmplacedToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnEmplacedWeaponArray;
_temp params ["_emplacedObjects","_units","_abort"];
_objects append _emplacedObjects;
_blck_AllMissionAI append _units;
};
_vehToSpawn = [_noVehiclePatrols] call blck_fnc_getNumberFromRange;
if (blck_useVehiclePatrols && ((_vehToSpawn > 0) || !(_missionPatrolVehicles isEqualTo []) )) then
{
_temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_missionPatrolVehicles,useRelativePos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,false,_vehicleCrewCount] call blck_fnc_spawnMissionVehiclePatrols;
_temp params ["_patrolVehicles","_units","_abort"];
_blck_AllMissionAI append _units;
};
// Spawn any submarine patrols
if (blck_useVehiclePatrols && !(_submarinePatrolParameters isEqualTo []) ) then
{
_temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_submarinePatrolParameters,true,_umsUniforms,_umsHeadgear,_umsVests,[],_umsWeapons,[],isScubaMission] call blck_fnc_spawnMissionVehiclePatrols;
_missionAIVehicles append (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
};
uiSleep delayTime;
if (_spawnCratesTiming isEqualTo "atMissionSpawnGround") then
{
if !(_missionLootBoxes isEqualTo []) 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;
};
};
uiSleep delayTime;;
if !(_missionLootVehicles isEqualTo []) then
{
_temp = [_coords,_missionLootVehicles,_loadCratesTiming,0] call blck_fnc_spawnMissionLootVehicles;
_crates append _temp;
};
if (_noPara > 0 && (random(1) < _chancePara) && _paraTriggerDistance == 0) 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;
};
};
};
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
{
blck_missionLabelMarkers pushBack [_markers select 1,_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["_minNoAliveForCompletion","_result","_minPercentageKilled"];
_minNoAliveForCompletion = (count _blck_AllMissionAI) - (round(blck_killPercentage * (count _blck_AllMissionAI)));
if (_secureAsset) then {_minNoAliveForCompletion = _minNoAliveForCompletion + 1};
while {_missionComplete isEqualTo -1} do
{
#ifdef blck_debugMode
if (blck_debugLevel > 3) 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
{
if (({alive _x} count _blck_AllMissionAI) <= _minNoAliveForCompletion) then {_missionComplete = 1};
};
if (_spawnCratesTiming isEqualTo "atMissionSpawnGround") then
{
{
private _d = _x distance (_x getVariable ["crateSpawnPos",_coords]);
if (_d > 25) exitWith
{
_missionComplete = 1;
_crateStolen = true;
};
}forEach _crates;
};
if (_secureAsset) then
{
if !(alive _assetSpawned) then
{
_missionComplete = 1;
[_assetSpawned] remoteExec["GMS_fnc_clearAllActions",-2, true];
} else {
if (({alive _x} count _blck_AllMissionAI) <= _minNoAliveForCompletion) then
{
if ((_assetSpawned getVariable["blck_unguarded",0]) isEqualTo 0) then
{
_assetSpawned setVariable["blck_unguarded",1,true];
};
if ((_assetSpawned getVariable["blck_AIState",0]) isEqualTo 1) then
{
_missionComplete = 1;
_assetSpawned allowdamage false;
[_assetSpawned] remoteExec["GMS_fnc_clearAllActions",-2, true];
};
};
};
};
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
{
[_coords,_mines,_objects,_crates, _blck_AllMissionAI,"Crate Removed from Mission Site Before Mission Completion: Mission Aborted",_markers,_markerPos,_markerName,_markerLabel, 2] call blck_fnc_endMission;
};
if (_spawnCratesTiming in ["atMissionEndGround","atMissionEndAir"]) then
{
if (!(_secureAsset) || (_secureAsset && (alive _assetSpawned))) then
{
if !(_missionLootBoxes isEqualTo []) 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;
};
if (blck_cleanUpLootChests) then
{
_objects append _crates;
};
};
};
if (_spawnCratesTiming isEqualTo "atMissionSpawnGround" && _loadCratesTiming isEqualTo "atMissionCompletion") then
{
if (!(_secureAsset) || (_secureAsset && (alive _assetSpawned))) then
{
{
[_x] call blck_fnc_loadMissionCrate;
} forEach _crates;
};
};
private["_result"];
if (_secureAsset && (alive _assetSpawned)) then
{
if (_assetSpawned getVariable["assetType",0] isEqualTo 1) then
{
_assetSpawned setVariable["GMSAnimations",[""],true];
[_assetSpawned,""] remoteExec["switchMove",-2];;
uiSleep 0.1;
_assetSpawned enableAI "ALL";
private _newPos = (getPos _assetSpawned) getPos [1000, random(360)];
(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
{
[_assetSpawned,""] remoteExec["switchMove",-2];
_assetSpawned setVariable["GMSAnimations",_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]],true];
[_assetSpawned,selectRandom(_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]])] remoteExec["switchMove",-2];
};
};
if (_secureAsset && !(alive _assetSpawned)) then
{
[_coords,_mines,_objects,_crates,_blck_AllMissionAI,_assetKilledMsg,_markers,_markerPos,_markerName,_markerLabel, -1] call blck_fnc_endMission;
};
if (!(_secureAsset) || (_secureAsset && (alive _assetSpawned))) then
{
[_coords,_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_markers,_markerPos,_markerName,_markerLabel, 0] call blck_fnc_endMission;
};
diag_log format["_fnc_missionSpawner (643) Mission Completed | _cords %1 : _markerName %2 : _aiDifficultyLevel %3 _markerLabel %4",_coords,_markerName,_aiDifficultyLevel,_markerLabel];
blck_missionsRun = blck_missionsRun + 1;
diag_log format["_fnc_missionSpawner (644): Total Dyanamic Land and UMS Run = %1", blck_missionsRun];
private _table = [
_markerName,
_markerMissionName, // Name used for setMarkerText and also for the root name for all markers
_endMsg,
_startMsg,
_defaultMissionLocations,
_crateLoot,
_lootCounts,
_markerType,
_markerColor,
_markerSize,
_markerBrush,
_missionLandscapeMode,
_garrisonedBuildings_BuildingPosnSystem,
_garrisonedBuilding_ATLsystem,
_missionLandscape,
_missionLootBoxes,
_missionLootVehicles,
_missionPatrolVehicles,
_submarinePatrolParameters,
_airPatrols,
_noVehiclePatrols,
_vehicleCrewCount,
_missionEmplacedWeapons,
_noEmplacedWeapons,
_useMines,
_minNoAI,
_maxNoAI,
_noAIGroups,
_missionGroups,
_scubaGroupParameters,
_hostageConfig,
_enemyLeaderConfig,
_assetKilledMsg,
_uniforms,
_headgear,
_vests,
_backpacks,
_weaponList,
_sideArms,
_chanceHeliPatrol,
_noChoppers,
_missionHelis,
_chancePara,
_noPara,
_paraTriggerDistance,
_paraSkill,
_chanceLoot,
_paraLoot,
_paraLootCounts,
_spawnCratesTiming,
_loadCratesTiming,
_endCondition,
_isScubaMission
];
_table

View File

@ -2,7 +2,7 @@
GMS_fnc_monitorInitializedMissions
by Ghostrider-GRG-
*/
//diag_log format["fnc_monitorInitializedMissions: time = %1 | count blck_activeMissionsList %2 | blck_activeMissionsList %3",diag_tickTime,count blck_activeMissionsList,blck_activeMissionsList];
for "_i" from 1 to (count blck_activeMissionsList) do
{
@ -10,8 +10,7 @@ for "_i" from 1 to (count blck_activeMissionsList) do
// Select a mission category (blue, red, green , etd)
private _el = blck_activeMissionsList deleteAt 0;
//diag_log format["fnc_monitorInitializedMissions: _el = %1",_el];
//blck_activeMissionsList pushBack [_missionCategoryDescriptors,_missionTimeoutAt,_triggered,_spawnPara,_missionData,_missionParameters];
_el params [
"_missionCategoryDescriptors", // 0
"_missionTimeoutAt", // 1
@ -20,29 +19,7 @@ for "_i" from 1 to (count blck_activeMissionsList) do
"_missionData", // 6
"_missionParameters" // 7
];
/*
{
diag_log format["_fnc_monitorInitializedMissions: _el:%1 = %2",_x, _el select _forEachIndex];
} forEach [
"_missionCategoryDescriptors", // 0
"_missionTimeoutAt", // 1
"_triggered", // 2
"_spawnPara", // 3
"_missionData", // 6
"_missionParameters" // 7
];
*/
/*
private _missionCategoryDescriptors = [
_difficulty,
_noMissions, // Max no missions of this category
0, // Number active
_tMin, // Used to calculate waittime in the future
_tMax, // as above
_waitTime, // time at which a mission should be spawned
_missionsData //
];
*/
#define noActive 2
#define waitTime 5
#define missionData 6
@ -56,84 +33,65 @@ for "_i" from 1 to (count blck_activeMissionsList) do
"_waitTime", // time at which a mission should be spawned
"_missionsData" //
];
/*
{
diag_log format["fnc_monitorInitializeMission: _missionCategoryDescriptors:%1 = %2",_x,_missionCategoryDescriptors select _forEachIndex];
} forEach [
"_difficulty",
"_noMissions", // Max no missions of this category
"_noActive", // Number active
"_tMin", // Used to calculate waittime in the future
"_tMax", // as above
"_waitTime", // time at which a mission should be spawned
"_missionsData" //
];
*/
#define setMissionData _missionData = [_coords,_mines,_objects,_crates, _blck_AllMissionAI,_assetSpawned,_missionAIVehicles,_mainMarker,_labelMarker];
//private _missionData = [_coords,_mines,_objects,_crates, _blck_AllMissionAI,_assetSpawned,_missionAIVehicles,_mainMarker,_labelMarker];
// 0 1 2 3 4 5 6 7 8
_missionData params ["_coords","_mines","_objects","_crates","_blck_AllMissionAI","_assetSpawned","_missionAIVehicles","_mainMarker","_labelMarker"];
/*
{
diag_log format["_fnc_monitorInitializedMissions (79): _missionData:%1 = %2",_x, _missionData select _forEachIndex];
} forEach ["_coords","_mines","_objects","_crates","_blck_AllMissionAI","_assetSpawned","_missionAIVehicles","_mainMarker","_labelMarker"];
*/
_missionData params ["_coords","_mines","_objects","_crates","_blck_AllMissionAI","_assetSpawned","_missionAIVehicles","_markers"];
_missionParameters params[
"_defaultMissionLocations",
"_crateLoot", // 0
"_lootCounts", // 1
"_startMsg", // 2
"_endMsg", // 3
"_markerMissionName",
"_markerType",
"_markerColor",
"_markerSize",
"_markerBrush",
"_missionLandscapeMode",
"_garrisonedBuildings_BuildingPosnSystem",
"_garrisonedBuilding_ATLsystem",
"_missionLandscape",
"_missionLootBoxes",
"_missionLootVehicles",
"_missionPatrolVehicles",
"_submarinePatrolParameters",
"_airPatrols",
"_noVehiclePatrols",
"_vehicleCrewCount",
"_missionEmplacedWeapons",
"_noEmplacedToSpawn",
"_missionLootVehicles",
"_useMines",
"_minNoAI",
"_maxNoAI",
"_noAIGroups",
"_missionGroups",
"_scubaGroupParameters",
"_hostageConfig",
"_enemyLeaderConfig",
"_uniforms",
"_headgear",
"_vests",
"_backpacks",
"_weaponList",
"_sideArms",
"_chanceHeliPatrol",
"_noChoppers",
"_missionHelis",
"_chancePara",
"_noPara",
"_paraTriggerDistance",
"_paraSkill",
"_chanceLoot",
"_paraLoot",
"_paraLootCounts",
"_spawnCratesTiming",
"_loadCratesTiming",
"_endCondition",
"_isScubaMission"
];
_missionParameters params[
"_markerName",
"_markerMissionName",
"_endMsg",
"_startMsg",
"_defaultMissionLocations",
"_crateLoot",
"_lootCounts",
"_markerType",
"_markerColor",
"_markerSize",
"_markerBrush",
"_missionLandscapeMode",
"_garrisonedBuildings_BuildingPosnSystem",
"_garrisonedBuilding_ATLsystem",
"_missionLandscape",
"_missionLootBoxes",
"_missionLootVehicles",
"_missionPatrolVehicles",
"_submarinePatrolParameters",
"_airPatrols",
"_noVehiclePatrols",
"_vehicleCrewCount",
"_missionEmplacedWeapons",
"_noEmplacedWeapons",
"_useMines",
"_minNoAI",
"_maxNoAI",
"_noAIGroups",
"_missionGroups",
"_scubaGroupParameters",
"_hostageConfig",
"_enemyLeaderConfig",
"_assetKilledMsg",
"_uniforms",
"_headgear",
"_vests",
"_backpacks",
"_weaponList",
"_sideArms",
"_chanceHeliPatrol",
"_noChoppers",
"_missionHelis",
"_chancePara",
"_noPara",
"_paraTriggerDistance",
"_paraSkill",
"_chanceLoot",
"_paraLoot",
"_paraLootCounts",
"_spawnCratesTiming",
"_loadCratesTiming",
"_endCondition",
"_isScubaMission"
];
private _playerInRange = [_coords, blck_TriggerDistance, false] call blck_fnc_playerInRange;
#define delayTime 1
@ -157,34 +115,25 @@ for "_i" from 1 to (count blck_activeMissionsList) do
_monitorAction = 1;
};
};
//diag_log format["_monitorInitializedMissions(149): _triggered = %1 | _monitorAction = %2",_triggered,_monitorAction];
private _blck_localMissionMarker = [_markerType,_coords,"","",_markerColor,_markerType];
switch (_monitorAction) do
{
// Handle Timeout
case -1:
{
diag_log format["_fnc_monitorInitializedMissions: mission timed out: %1",_el];
//[format["_fnc_monitorInitializedMissions: mission timed out: %1",_el]] call blck_fnc_log;
_missionCategoryDescriptors set[noActive, _noActive - 1];
// params ["_mines","_objects","_crates","_blck_AllMissionAI","_endMsg","_mainMarker","_labelMarker","_markerClass","_coords",["_endCondition",0]]
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_mainMarker,_labelMarker,_markerType,_coords,1] call blck_fnc_endMission;
[_coords,_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_markers,markerPos (_markers select 1),_markerName,_markerMissionName, -1] call blck_fnc_endMission;
};
// Handle mission waiting to be triggerd and player is within the range to trigger
case 0:
{
if (blck_debugLevel >= 3) then
{
diag_log format["_fnc_moniorInitializedMissions: blck_debugLevel == 3, spawning objects for mission %1",_el];
} else {
//diag_log format["_fnc_moniorInitializedMissions: mission TRIGGERED by player: spawning objects for mission %1",_el];
};
#define triggered 2
#define timedOut 1
_el set[triggered,1];
_el set[timedOut,diag_tickTime + 240];
//diag_log format["_fnc_monitorInitializedMissions (167): spawning smoking wrecks as needed: blck_smokeAtMissions == %1",blck_SmokeAtMissions];
private["_temp"];
if (blck_SmokeAtMissions select 0) then // spawn a fire and smoke near the crate
{
@ -196,14 +145,12 @@ for "_i" from 1 to (count blck_activeMissionsList) do
};
};
//diag_log format["_fnc_monitorInitializedMissions (193): spawning mines as needed: _useMines == %1",_useMines];
if (_useMines) then
{
_mines = [_coords] call blck_fnc_spawnMines;
uiSleep delayTime;
};
//diag_log format["_fnc_monitorInitializedMissions (200): spawning landscape as needed: _missionLandscapeMode = %1 | _missionLandscape = %2",_missionLandscapeMode,_missionLandscape];
if (_missionLandscapeMode isEqualTo "random") then
{
_temp = [_coords,_missionLandscape, 3, 15, 2] call blck_fnc_spawnRandomLandscape;
@ -215,31 +162,24 @@ for "_i" from 1 to (count blck_activeMissionsList) do
uiSleep delayTime;
try {
//diag_log format["_fnc_monitorInitializedMissions (213): spawning AI Patrols as needed: _missionGroups == %1",_missionGroups];
_temp = [_coords, _minNoAI,_maxNoAI,_noAIGroups,_missionGroups,_difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionAI;
_temp params["_ai","_abort"];
if (_abort) throw 1;
_blck_AllMissionAI append (_ai);
uiSleep delayTime;
//diag_log format["_fnc_monitorInitializedMissions (220): spawning hostages as needed: _hostageConfig == %1",_hostageConfig];
//private ["_assetSpawned"];
if !(_hostageConfig isEqualTo []) then
{
_temp = [_coords,_hostageConfig] call blck_fnc_spawnHostage;
if (_temp isEqualTo grpNull) then {throw 1} else
{
_assetSpawned = _temp select 0;
// 0 1 2 3 4 5 6 7
// _missionData params ["_coords","_mines","_objects","_crates","_blck_AllMissionAI","_assetSpawned","_mainMarker","_labelMarker"];
_missionData set[5,_assetSpawned];
_objects pushBack (_temp select 1);
_blck_AllMissionAI pushBack _assetSpawned;
};
};
//diag_log format["_fnc_monitorInitializedMissions (234): spawning leaders as needed: _enemyLeaderConfig == %1",_enemyLeaderConfig];
if !(_enemyLeaderConfig isEqualTo []) then
{
private _temp = [_coords,_enemyLeaderConfig] call blck_fnc_spawnLeader;
@ -252,7 +192,6 @@ for "_i" from 1 to (count blck_activeMissionsList) do
};
};
//diag_log format["_fnc_monitorInitializedMissions (248): spawning chopers as needed: _noChoppers = %1 | _chanceHeliPatrol = %2 | _missionHelis = %3",_noChoppers,_chanceHeliPatrol,_missionHelis];
private _noChoppers = [_noChoppers] call blck_fnc_getNumberFromRange;
if (_noChoppers > 0) then
{
@ -276,7 +215,6 @@ for "_i" from 1 to (count blck_activeMissionsList) do
};
uisleep 3;
//diag_log format["_fnc_monitorInitializedMissions (271): spawning garrisons using ATL coordinate system as needed: _garrisonedBuilding_ATLsystem == %1",_garrisonedBuilding_ATLsystem];
if (count _garrisonedBuilding_ATLsystem > 0) then // Note that there is no error checking here for nulGroups
{
private _temp = [_coords, _garrisonedBuilding_ATLsystem, _difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_garrisonBuilding_ATLsystem;
@ -290,7 +228,6 @@ for "_i" from 1 to (count blck_activeMissionsList) do
};
uiSleep 3;
//diag_log format["_fnc_monitorInitializedMissions (285): spawning garrisons using relative coordinate system as needed: _garrisonedBuildings_BuildingPosnSystem == %1",_garrisonedBuildings_BuildingPosnSystem];
if (count _garrisonedBuildings_BuildingPosnSystem > 0) then
{
private _temp = [_coords, _garrisonedBuildings_BuildingPosnSystem, _difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_garrisonBuilding_RelPosSystem;
@ -305,13 +242,12 @@ for "_i" from 1 to (count blck_activeMissionsList) do
uiSleep 15;
private _userelativepos = true;
//diag_log format["_fnc_monitorInitializedMissions (300): spawning static turrets needed: _noEmplacedToSpawn == %1 | _missionEmplacedWeapons = %2",_noEmplacedToSpawn,_missionEmplacedWeapons];
private _noEmplacedToSpawn = [_noEmplacedToSpawn] call blck_fnc_getNumberFromRange;
if (blck_useStatic && ((_noEmplacedToSpawn > 0) || count _missionEmplacedWeapons > 0)) then
private _noEmplacedWeapons = [_noEmplacedWeapons] call blck_fnc_getNumberFromRange;
if (blck_useStatic && ((_noEmplacedWeapons > 0) || count _missionEmplacedWeapons > 0)) then
// TODO: add error checks for grpNull to the emplaced weapon spawner
{
private _temp = [_coords,_missionEmplacedWeapons,_userelativepos,_noEmplacedToSpawn,_difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnEmplacedWeaponArray;
private _temp = [_coords,_missionEmplacedWeapons,_userelativepos,_noEmplacedWeapons,_difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnEmplacedWeaponArray;
if (_temp isEqualTo grpNull) then {throw 1} else
{
_objects append (_temp select 0);
@ -320,7 +256,6 @@ for "_i" from 1 to (count blck_activeMissionsList) do
};
uisleep 10;
//diag_log format["_fnc_monitorInitializedMissions (316): spawning patrol vehicles as needed: _noVehiclePatrols == %1 | _missionPatrolVehicles = %2",_noVehiclePatrols,_missionPatrolVehicles];
private _noVehiclePatrols = [_noVehiclePatrols] call blck_fnc_getNumberFromRange;
if (blck_useVehiclePatrols && ((_noVehiclePatrols > 0) || count _missionPatrolVehicles > 0)) then
{
@ -333,8 +268,9 @@ for "_i" from 1 to (count blck_activeMissionsList) do
};
};
uiSleep delayTime;
if (_spawnCratesTiming isEqualTo "atMissionSpawnGround") then
if (blck_debugLevel >= 3) then {diag_log format["monitorInitializedMissions: _spawnCrateTiming = %1 _loadCratesTiming = %2 | _markerMissionName = %3",_spawnCratesTiming,_loadCratesTiming, _markerMissionName]};
if (blck_debugLevel >= 3) then {diag_log format["monitorInitializedMissions: _missionLootBoxes = %1",_missionLootBoxes]};
if (_spawnCratesTiming in ["atMissionSpawnGround","atMissionSpawnAir"]) then
{
if (_missionLootBoxes isEqualTo []) then
{
@ -349,6 +285,13 @@ for "_i" from 1 to (count blck_activeMissionsList) do
{
_objects append _crates;
};
if (_loadCratesTiming isEqualTo "atMissionSpawn") then
{
private _crateMoney = missionNamespace getVariable (format["blck_crateMoney%1",_difficulty]);
{
[_x,_crateMoney] call blck_fnc_addMoneyToObject;
} forEach _crates;
};
};
_missionData set[2,_objects];
_missionData set[3,_crates];
@ -357,21 +300,20 @@ for "_i" from 1 to (count blck_activeMissionsList) do
if (blck_showCountAliveAI) then
{
[_mainMarker,_labelMarker,_markerMissionName,_blck_AllMissionAI] call blck_fnc_updateMarkerAliveCount;
blck_missionLabelMarkers pushBack [_markers select 1,_markerMissionName,_blck_AllMissionAI];
};
{
_x setVariable["crateSpawnPos", (getPos _x)];
} forEach _crates;
private _spawnPara = if (random(1) < _chancePara) then {true} else {false};
setMissionData // code defined above
//{diag_log format["_monotirInitializedMissions:(371) _missiondata %1 = %2",_forEachIndex,_x]} forEach _missionData;
_missionData = [_coords,_mines,_objects,_crates, _blck_AllMissionAI,_assetSpawned,_missionAIVehicles,_markers];
_el set[missionData, _missionData];
// Everything spawned withouth serous errors so lets keep the mission active for future monitoring
blck_activeMissionsList pushBack _el;
//diag_log format["_fnc_monitorInitializedMissions (366): all objects, men and vehicles spawened, blck_activeMissionsList= %1", blck_activeMissionsList];
}
catch
@ -379,20 +321,24 @@ for "_i" from 1 to (count blck_activeMissionsList) do
if (_exception isEqualTo 1) then
{
_missionCategoryDescriptors set[noActive, _noActive - 1];
// params ["_mines","_objects","_crates","_blck_AllMissionAI","_endMsg","_mainMarker","_labelMarker","_markerClass","_coords",["_endCondition",0]]
[_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_mainMarker,_labelMarker,_markerType,_coords, 1] call blck_fnc_endMission;
diag_log format["[blkeagls] <WARNING> grpNull returned by one or more critical functions, mission spawning aborted!"];
[_coords,_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_markers,markerPos (_markers select 1),_markerName,_markerMissionName, 1] call blck_fnc_endMission;
["Critial Error returned by one or more critical functions, mission spawning aborted!",'error'] call blck_fnc_log;
};
};
};
case 1:
{
//diag_log format["_fnc_moniorInitializedMissions(398): evaluating status of mission %1 | _missionTimeoutAt = %2 | time = %3 | _crates = %4",_el,_missionTimeoutAt,diag_tickTime,_crates];
private _missionComplete = -1;
private _crateStolen = -1;
private ["_secureAsset","_endIfPlayerNear","_endIfAIKilled"];
/*
"_endCondition",
*/
_secureAsset = false;
_endIfPlayerNear = true;
_endIfAIKilled = true;
switch (_endCondition) do
{
case "playerNear": {_secureAsset = false; _endIfPlayerNear = true;_endIfAIKilled = false;};
@ -400,49 +346,22 @@ for "_i" from 1 to (count blck_activeMissionsList) do
case "allKilledOrPlayerNear": {_secureAsset = false; _endIfPlayerNear = true;_endIfAIKilled = true;};
case "assetSecured": {_secureAsset = true; _endIfPlayerNear = false; _endIfAIKilled = false;};
};
if (blck_showCountAliveAI) then
{
[_mainMarker,_labelMarker,_markerMissionName,_blck_AllMissionAI] call blck_fnc_updateMarkerAliveCount;
};
try {
if (blck_debugLevel == 5) throw 1;
if (blck_debugLevel == 6) then {
diag_log format["_fnc_monitorInitializedMissions: mission ended, condition CRATE MOVED, mission %1",_el];
throw 2;
};
if (blck_debugLevel == 7) then
{
diag_log format["_fnc_monitorInitializedMissions: mission ended, condition simulated death of asset, mission %1",_el];
throw 3;
};
private _playerIsNear = [_crates,20,true] call blck_fnc_playerInRangeArray;
private _minNoAliveForCompletion = (count _blck_AllMissionAI) - (round(blck_killPercentage * (count _blck_AllMissionAI)));
private _aiKilled = if (({alive _x} count _blck_AllMissionAI) <= _minNoAliveForCompletion) then {true} else {false}; // mission complete
//diag_log format["_fnc_monitorInitializedMissions (404): _playerIsNear = %1 | _aiKilled = %2 | _crates = %3",_playerIsNear,_aiKilled,_crates];
if (_endIfPlayerNear) then
{
//diag_log format["_fnc_monitorInitializedMissions: mission ended, condition player near, mission %1",_el];
if (_playerIsNear) throw 1; // mission complete
};
if (_endIfAIKilled) then
{
//diag_log format["_fnc_monitorInitializedMissions: mission ended, condition AI Killed, mission %1",_el];
if (_aiKilled) throw 1;
};
if (_spawnCratesTiming isEqualTo "atMissionSpawnGround") then
{
{
private _d = _x distance (_x getVariable ["crateSpawnPos",_coords]);
if (_d > 25) then
{
//diag_log format["_fnc_monitorInitializedMissions: mission ended, condition CRATE MOVED, mission %1",_el];
throw 2;
}; // crate moved illegally
}forEach _crates;
};
if (_spawnPara) then
{
if ([_coords,_paraTriggerDistance,true] call blck_fnc_playerInRange) then
@ -458,7 +377,7 @@ for "_i" from 1 to (count blck_activeMissionsList) do
};
if (random(1) < _chanceLoot) then
{
private _extraCrates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_paraLoot,_paraLootCounts]], "atMissionSpawn","atMissionStartAir", "start", _difficulty] call blck_fnc_spawnMissionCrates;
private _extraCrates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_paraLoot,_paraLootCounts]], "atMissionSpawn","atMissionSpawnAir", "start", _difficulty] call blck_fnc_spawnMissionCrates;
if (blck_cleanUpLootChests) then
{
_objects append _extraCrates;
@ -472,21 +391,18 @@ for "_i" from 1 to (count blck_activeMissionsList) do
{
if !(alive _assetSpawned) then
{
diag_log format["_line 498 asset %1 killed throwing error with code 3",_assetSpawned];
throw 3;
} else {
diag_log format["line 501: asset alive, count _blck_AllMissionAI = %1",count _blck_AllMissionAI];
if (({alive _x} count _blck_AllMissionAI) <= _minNoAliveForCompletion) then
if (({alive _x} count _blck_AllMissionAI) <= (_minNoAliveForCompletion + 1)) then
{
if ((_assetSpawned getVariable["blck_unguarded",0]) isEqualTo 0) then
{
_assetSpawned setVariable["blck_unguarded",1,true];
diag_log format["_assetSpawned: blck_unguarded updated to 1 for asset %1",_assetSpawned];
};
if ((_assetSpawned getVariable["blck_AIState",0]) isEqualTo 1) then
{
diag_log format["_assetSpawned: blck_AIState updated to 1 for asset %1",_assetSpawned];
_assetSpawned allowdamage false;
[_assetSpawned] remoteExec["GMS_fnc_clearAllActions",-2, true];
throw 1;
@ -495,13 +411,15 @@ for "_i" from 1 to (count blck_activeMissionsList) do
};
};
if (blck_debugLevel > 3 && diag_tickTime > _missionTimeoutAt) then
private _moved = false;
if ((_spawnCratesTiming isEqualTo "atMissionSpawnGround") && blck_crateMoveAllowed) then
{
diag_log format["_monitoInitializeMissions: debugLevel == 3, mission triggered, timout condition reached, ending mission"];
throw 1;
{
if ( _x distance (_x getVariable ["crateSpawnPos", (getPos _x)]) > max_distance_crate_moved_uncompleted_mission) throw 2;
} forEach _crates;
};
setMissionData // Code defined above
_missionData = [_coords,_mines,_objects,_crates, _blck_AllMissionAI,_assetSpawned,_missionAIVehicles,_markers];
_el set[missionData, _missionData];
@ -511,7 +429,6 @@ for "_i" from 1 to (count blck_activeMissionsList) do
catch // catch all conditions that cause the mission to end.
{
//diag_log format["_fnc_monitorInitializeMissions (507): _exception = %1",_exception];
switch (_exception) do
{
case 1: { // Normal Mission End
@ -532,21 +449,25 @@ for "_i" from 1 to (count blck_activeMissionsList) do
{
_objects append _crates;
};
private _crateMoney = missionNamespace getVariable (format["blck_crateMoney%1",_difficulty]);
{
[_x,_crateMoney] call blck_fnc_addMoneyToObject;
} forEach _crates;
};
};
if (_spawnCratesTiming isEqualTo "atMissionSpawnGround" && _loadCratesTiming isEqualTo "atMissionCompletion") then
if (_spawnCratesTiming in ["atMissionSpawnGround","atMissionSpawnAir"] && _loadCratesTiming isEqualTo "atMissionCompletion") then
{
if (!(_secureAsset) || (_secureAsset && (alive _assetSpawned))) then
{
private _crateMoney = missionNamespace getVariable (format["blck_crateMoney%1",_difficulty]);
{
[_x] call blck_fnc_loadMissionCrate;
[_x] call blck_fnc_loadMissionCrate;
[_x,_crateMoney] call blck_fnc_addMoneyToObject;
} forEach _crates;
};
};
_blck_localMissionMarker set [2, _markerMissionName];
if (_secureAsset && (alive _assetSpawned)) then
{
if (_assetSpawned getVariable["assetType",0] isEqualTo 1) then
@ -568,54 +489,22 @@ for "_i" from 1 to (count blck_activeMissionsList) do
[_assetSpawned,selectRandom(_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]])] remoteExec["switchMove",-2];
};
};
diag_log format["_fnc_monitorInitializedMissions (430) calling <_fnc_endMission> | _cords %1 : _markerType %2 : _difficulty %3 _markerMissionName %4",_coords,_markerType,_difficulty,_markerMissionName];
// params ["_mines","_objects","_crates","_blck_AllMissionAI","_endMsg","_mainMarker","_labelMarker","_markerClass","_coords",["_endCondition",0]];
[_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_mainMarker,_labelMarker,_markerType,_coords, 0] call blck_fnc_endMission;
//diag_log format["_fnc_monitorInitializedMissions (430) Mission Completed | _cords %1 : _markerType %2 : _difficulty %3 _markerMissionName %4",_coords,_markerType,_difficulty,_markerMissionName];
[_coords,_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_markers,markerPos (_markers select 1),_markerName,_markerMissionName, _exception] call blck_fnc_endMission;
_waitTime = diag_tickTime + _tMin + random(_tMax - _tMin);
/*
_missionCategoryDescriptors params [
//"_marker",
"_difficulty", 0
"_noMissions", 1 // Max no missions of this category
"_noActive", 2 // Number active
//"_timesSpawned", // times spawned, useful for keeping unique markers
"_tMin", 3 // Used to calculate waittime in the future
"_tMax", 4 // as above
"_waitTime", 5 // time at which a mission should be spawned
"_missionsData" //
];
*/
_missionCategoryDescriptors set [noActive,_noActive - 1];
_missionCategoryDescriptors set [waitTime,_waitTime];
/*
{
diag_log format["_fnc_monitorInitializedMissions (570): _missionCategoryDescriptors parameter %1 = %2",_x,_missionCategoryDescriptors select _forEachIndex];
} forEach [
//"_marker",
"_difficulty",
"_noMissions", // Max no missions of this category
"_noActive", // Number active
//"_timesSpawned", // times spawned, useful for keeping unique markers
"_tMin", // Used to calculate waittime in the future
"_tMax", // as above
"_waitTime", // time at which a mission should be spawned
"_missionsData" //
];
*/
};
case 2: { // Abort, crate moved.
//[_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_mainMarker,_labelMarker,_markerType,_coords, 0]
[_mines,_objects,_crates, _blck_AllMissionAI,"Crate Removed from Mission Site Before Mission Completion: Mission Aborted",_mainMarker,_labelMarker,_markerType,_coords,2] call blck_fnc_endMission;
_endMsg = "Crate Removed from Mission Site Before Mission Completion: Mission Aborted";
[_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_mainMarker,_labelMarker,_markerType,_coords, 0] call blck_fnc_endMission;
[_coords,_mines,_objects,_crates, _blck_AllMissionAI,"Crate Removed from Mission Site Before Mission Completion: Mission Aborted",_markers,markerPos (_markers select 1),_markerName,_markerMissionName, _exception] call blck_fnc_endMission;
};
case 3: { // Abort, key asset killed
diag_log format["Asset Killed, aborting mission"];
#define missionAbort 1
//[_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_mainMarker,_labelMarker,_markerType,_coords, 0]
[_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_mainMarker,_labelMarker,_markerType,_coords, missionAbort] call blck_fnc_endMission;
[_coords,_mines,_objects,_crates,_blck_AllMissionAI,_assetKilledMsg,_markers,markerPos (_markers select 1),_markerName,_markerMissionName, _exception] call blck_fnc_endMission;
};
case 4: { // Reserved for grpNull errors in the future
};
};
};
};
@ -624,4 +513,4 @@ for "_i" from 1 to (count blck_activeMissionsList) do
blck_activeMissionsList pushBack _el;
};
};
};
};

View File

@ -12,7 +12,7 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_aiDifficultyLevel"]; //[["_aiDifficultyLevel",selectRandom["Red","Green"]]];
//diag_log format["_fnc_selectAISidearms: _aiDifficultyLevel = %1",_aiDifficultyLevel];
private["_sideArms"];
switch (toLower (_aiDifficultyLevel)) do
{

View File

@ -19,5 +19,5 @@ switch (toLower(_diff)) do
case "green": {_count = blck_vehCrew_green};
case "orange": {_count = blck_vehCrew_orange};
};
///diag_log format["_fnc_selectVehicleCrewCount: _count set to %1",_count];
_count

View File

@ -16,7 +16,7 @@ private ["_start","_maxHeight","_smokeShell","_light","_lightSource"];
params[["_crate",objNull],["_time",60]];
if (isNull _crate) exitWith {};
_start = diag_tickTime;
//diag_log format["signalEnd.sqf: _this = %1, _crate = %2",_this, _crate];
_smokeShell = selectRandom ["SmokeShellOrange","SmokeShellBlue","SmokeShellPurple","SmokeShellRed","SmokeShellGreen","SmokeShellYellow"];
_lightSource = selectRandom ["Chemlight_green","Chemlight_red","Chemlight_yellow","Chemlight_blue"];
_light = objNull;

View File

@ -1,81 +0,0 @@
/*
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";
//diag_log "[blckeagls] GMS_fnc_sm_init_functions.sqf <Defining Variables and Compiling Functions>";
//blck_sm_Groups = [];
blck_sm_Infantry = [];
blck_sm_Vehicles = [];
blck_sm_Aircraft = [];
blck_sm_Emplaced = [];
blck_sm_scubaGroups = [];
blck_sm_surfaceShips = [];
blck_sm_submarines = [];
blck_sm_lootContainers = [];
blck_sm_garrisonBuildings_ASL = [];
blcl_sm_garrisonBuilding_relPos = [];
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_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_AddEmplaced = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_AddEmplaced.sqf";
*/
// TODO: Delte soon
private _functions = [
//["blck_fnc_sm_monitorStaticUnits","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorStaticPatrols.sqf"],
["blck_fnc_sm_monitorInfantry","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorInfantry.sqf"],
["blck_fnc_sm_monitorScuba","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorScuba.sqf"],
["blck_fnc_sm_monitorVehicles","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorVehicles.sqf"],
["blck_fnc_sm_monitorAircraft","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorAircraft.sqf"],
["blck_fnc_sm_monitorShips","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorShips.sqf"],
["blck_fnc_sm_monitorSubs","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorSubs.sqf"],
["blck_fnc_sm_monitorEmplaced","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorEmplaced.sqf"],
["blck_fnc_sm_monitorGarrisonsASL","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorGarrisonsASL.sqf"],
["blck_fnc_sm_monitorGarrisons_relPos","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_monitorGarrisons_relPos.sqf"],
["blck_fnc_sm_spawnVehiclePatrol","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnVehiclePatrol.sqf"],
["blck_fnc_sm_spawnAirPatrol","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnAirPatrol.sqf"],
["blck_fnc_sm_spawnEmplaced","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnEmplaced.sqf"],
// ["blck_fnc_sm_spawnInfantryPatrol","\q\addons\custom_server\Missions\Static\Code\GMS_sm_spawnInfantryPatrol.sqf"],
["blck_fnc_sm_staticPatrolMonitor","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_staticPatrolMonitor.sqf"],
// ["blck_fnc_sm_checkForPlayerNearMission","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_checkForPlayerNearMission.sqf"],
["blck_fnc_sm_spawnAirPatrols","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnAirPatrols.sqf"],
["blck_fnc_sm_spawnEmplaceds","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnEmplaced.sqf"],
["blck_fnc_sm_spawnInfantryPatrols","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnInfantryPatrols.sqf"],
["blck_fnc_sm_spawnLootContainers","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnLootContainers.sqf"],
["blck_fnc_sm_spawnObjects","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnObjects.sqf"],
["blck_fnc_sm_spawnVehiclePatrols","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnVehiclePatrols.sqf"],
["blck_fnc_sm_spawnBuildingGarrison_ASL","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnBuildingGarrisonASL.sqf"],
["blck_fnc_sm_spawnBuildingGarrison_relPos","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnBuildingGarrison_relPos.sqf"],
["blck_fnc_sm_spawnObjectASLVectorDirUp","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_spawnObjectASLVectorDirUp.sqf"],
["blck_fnc_spawnScubaGroup","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_spawnScubaGroup.sqf"],
["blck_fnc_spawnSDVPatrol","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_spawnSDVPatrol.sqf"],
["blck_fnc_spawnSurfacePatrol","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_spawnSurfacePatrol.sqf"],
//["blck_fnc_sm_AddScubaGroup","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_AddScubaGroup.sqf"],
//["blck_fnc_sm_AddSurfaceVehicle","\q\addons\custom_server\Missions\Static\Code\GMS_fnc_sm_AddSurfaceVehicle.sqf"],
["blck_fnc_sm_AddSDVVehicle","\q\addons\custom_server\Missions\Static\Code\GMS_sm_AddSDVVehicle.sqf"]
];
{
_x params ["_name","_path"];
missionnamespace setvariable [_name,compileFinal preprocessFileLineNumbers _path];
} foreach _functions;
diag_log "[blckeagls] GMS_sm_init_functions.sqf <Variables Defined and Functions Loaded>";
/*
blck_fnc_spawnScubaGroup = compileFinal preprocessFileLineNumbers "q\addons\custom_server\Missions\UMS\code\GMS_fnc_spawnScubaGroup.sqf";
blck_fnc_spawnSDVPatrol = compileFinal preprocessFileLineNumbers "q\addons\custom_server\Missions\UMS\code\GMS_fnc_spawnSDVPatrol.sqf";
blck_fnc_spawnSurfacePatrol = compileFinal preprocessFileLineNumbers "q\addons\custom_server\Missions\UMS\code\GMS_fnc_spawnSurfacePatrol.sqf";
blck_fnc_sm_AddScubaGroup = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\UMS\code\GMS_sm_AddScubaGroup.sqf";
blck_fnc_sm_AddSurfaceVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\UMS\code\GMS_sm_AddSurfaceVehicle.sqf";
blck_fnc_sm_AddSDVVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Missions\UMS\code\GMS_sm_AddSDVVehicle.sqf";

View File

@ -28,7 +28,7 @@ if (isNil "_aiGroupParameters") then {_aiGroupParameters = []};
if (isNil "_missionEmplacedWeapons") then {_missionEmplacedWeapons = []};
if (isNil "_vehiclePatrolParameters") then {_vehiclePatrolParameters = []};
if (isNil "_missionLootVehicles") then {_missionLootVehicles = []};
if (isNil "_crateMoney") then {_crateMoney = 0};
_markerClass = format["static%1",floor(random(1000000))];
_blck_localMissionMarker = [_markerClass,_missionCenter,"","",_markerColor,_markerType];
if (blck_labelMapMarkers select 0) then
@ -43,25 +43,6 @@ _blck_localMissionMarker set [3,blck_labelMapMarkers select 1]; // Use an arrow
[_blck_localMissionMarker] call blck_fnc_spawnMarker;
[_missionLandscape] call blck_fnc_sm_spawnObjects;
{
//diag_log format["processing _garrisonedBuilding_ASL %1 which = %2",_forEachIndex,_x];
// ["Land_i_House_Big_02_V2_F",[23650.3,18331.9,3.19],[[0,1,0],[0,0,1]],[true,true],"Red",
_x params["_buildingClassName","_buildingPosnASL","_buildingVectorDirUp","_buildingDamSim","_aiDifficulty","_staticsASL","_unitsASL","_respawnTimer","_noRespawns"];
private _building = [_buildingClassName,_buildingPosnASL,_buildingVectorDirUp,_buildingDamSim] call blck_fnc_sm_spawnObjectASLVectorDirUp;
[blck_sm_garrisonBuildings_ASL,[_building,_aiDifficulty,_staticsASL,_unitsASL,_respawnTimer,_noRespawns]] call blck_fnc_sm_AddGroupToArray;
//diag_log format["_fnc_sm_initializeMission: blck_sm_garrisonBuildings_ASL updated to: %1",blck_sm_garrisonBuildings_ASL];
}forEach _garrisonedBuilding_ASLsystem;
// blcl_sm_garrisonBuilding_relPos
{
//diag_log format["processing _garrisonedBuilding_relPos %1 which = %2",_forEachIndex,_x];
_x params["_buildingClassName","_buildingPosnASL","_buildingVectorDirUp","_buildingDamSim","_aiDifficulty","_p","_noStatics","_typesStatics","_noUnits","_respawnTimer","_noRespawns"];
private _building = [_buildingClassName,_buildingPosnASL,_buildingVectorDirUp,_buildingDamSim] call blck_fnc_sm_spawnObjectASLVectorDirUp;
[blcl_sm_garrisonBuilding_relPos,[_building,_aiDifficulty,_noStatics,_typesStatics,_noUnits,_respawnTimer,_noRespawns]] call blck_fnc_sm_AddGroupToArray;
//diag_log format["_fnc_sm_initializeMission: blcl_sm_garrisonBuilding_relPos updated to: %1",blcl_sm_garrisonBuilding_relPos];
}forEach _garrisonedBuildings_BuildingPosnSystem;
{
[blck_sm_Aircraft,_x] call blck_fnc_sm_AddGroupToArray;
@ -82,7 +63,7 @@ _blck_localMissionMarker set [3,blck_labelMapMarkers select 1]; // Use an arrow
uiSleep 30;
// spawn loot chests
[_missionLootBoxes,_missionCenter] call blck_fnc_sm_spawnLootContainers;
[_missionLootVehicles,_missionCenter] call blck_fnc_sm_spawnLootContainers;
diag_log format["[blckeagls] Static Mission Spawner: Mission %1 spawned",_mission];
[_missionLootBoxes,_missionCenter,_crateMoney] call blck_fnc_sm_spawnLootContainers;
[_missionLootVehicles,_missionCenter,_crateMoney] call blck_fnc_sm_spawnLootContainers;
[format["Static Mission Spawner: Mission %1 spawned",_mission]] call blck_fnc_log;

View File

@ -70,4 +70,4 @@ _blck_localMissionMarker set [3,blck_labelMapMarkers select 1]; // Use an arrow
// spawn loot chests
[_missionLootBoxes,_missionCenter] call blck_fnc_sm_spawnLootContainers;
diag_log format["[blckeagls] UMS Mission Spawner: Static UMS Mission %1 spawned",_mission];
[format["UMS Mission Spawner: Static UMS Mission %1 spawned",_mission]] call blck_fnc_log;

View File

@ -11,7 +11,7 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_mode","_sm_groups","_pos","_element"];
if (blck_fnc_sm_spawnBuildingGarrison_relPos isEqualTo []) exitWith {};
_sm_groups = +blcl_sm_garrisonBuilding_relPos;
_sm_groups = +blck_sm_garrisonBuilding_relPos;
{
_x params["_groupParameters","_group","_groupSpawned","_timesSpawned","_respawnAt"];

View File

@ -1,11 +1,10 @@
params["_building","_aiDifficultyLevel","_statics","_units"];
//diag_log format["_fnc_sm_spawnBuildingGarrisonASL: handling _building = %1 | at location = %2",_building,position _building];
private _group = [blck_AI_Side,true] call blck_fnc_createGroup;
if !(isNull _group) then
{
//params["_building","_group","_statics","_men","_aiDifficultyLevel","_uniforms","_headGear","_vests","_backpacks",["_launcher","none"],"_weaponList","_sideArms"];
[_building,_group,_statics,_units,_aiDifficultyLevel] call blck_fnc_spawnGarrisonInsideBuilding_ATL;
};
_group

View File

@ -19,38 +19,28 @@ _units = [];
_abort = false;
_pos = [];
//diag_log format["_sm_spawnEmplaced <Line 26>:: _missionEmplacedWeapons = %1",_missionEmplacedWeapons];
// Define _missionEmplacedWeapons if not already configured.
if (_missionEmplacedWeapons isEqualTo []) then
{
_missionEmplacedWeaponPositions = [_coords,_noEmplacedWeapons,35,50] call blck_fnc_findPositionsAlongARadius;
{
_static = selectRandom blck_staticWeapons;
//diag_log format["_fnc_spawnEmplacedWeaponArray: creating spawn element [%1,%2]",_static,_x];
_missionEmplacedWeapons pushback [_static,_coords vectorAdd _x,_aiDifficultyLevel];
//diag_log format["_fnc_spawnEmplacedWeaponArray: _mi updated to %1",_missionEmplacedWeapons];
} forEach _missionEmplacedWeaponPositions;
};
//diag_log format["_sm_spawnEmplaced<Line 38>:: _missionEmplacedWeapons = %1",_missionEmplacedWeapons];
{
_wepnClassName = _x select 0;
_pos = _x select 1;
_difficulty = _x select 2;
// params["_pos", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], "_center", ["_minDist",20], ["_maxDist",35], ["_uniforms",blck_SkinList], ["_headGear",blck_headgear] ];
private _empGroup = [blck_AI_Side,true] call blck_fnc_createGroup;
if !(_empGroup) then
{
[_empGroup,_pos,1,1,_difficulty,_pos,1,2,_uniforms,_headGear,false] call blck_fnc_spawnGroup;
_empGroup setcombatmode "RED";
_empGroup setBehaviour "COMBAT";
// // params["_pos","_minDis","_maxDis","_group",["_mode","random"],["_wpPatrolMode","SAFE"],["_soldierType","null"],["_patrolRadius",30],["_wpTimeout",[5.0,7.5,10]]];
// Not sure of the value of giving waypoints here
//[_pos,0.01,0.02,_empGroup,"random","SAD","emplaced"] spawn blck_fnc_setupWaypoints;
//if (isNull _empGroup) exitWith {_abort = _true};
_wep = [_wepnClassName,[0,0,0],false] call blck_fnc_spawnVehicle;
//_empGroup setVariable["groupVehicle",_wep];
//_wep setVariable["vehicleGroup",_empGroup];
_wep = [_wepnClassName,[0,0,0],"NONE",0] call blck_fnc_spawnVehicle;
_wep setVariable["GRG_vehType","emplaced"];
_wep setPosATL _pos;
[_wep,false] call blck_fnc_configureMissionVehicle;

View File

@ -19,34 +19,24 @@ _units = [];
_abort = false;
_pos = [];
//diag_log format["_sm_spawnEmplaced <Line 26>:: _missionEmplacedWeapons = %1",_missionEmplacedWeapons];
// Define _missionEmplacedWeapons if not already configured.
if (_missionEmplacedWeapons isEqualTo []) then
{
_missionEmplacedWeaponPositions = [_coords,_noEmplacedWeapons,35,50] call blck_fnc_findPositionsAlongARadius;
{
_static = selectRandom blck_staticWeapons;
//diag_log format["_fnc_spawnEmplacedWeaponArray: creating spawn element [%1,%2]",_static,_x];
_missionEmplacedWeapons pushback [_static,_coords vectorAdd _x,_aiDifficultyLevel];
//diag_log format["_fnc_spawnEmplacedWeaponArray: _mi updated to %1",_missionEmplacedWeapons];
} forEach _missionEmplacedWeaponPositions;
};
//diag_log format["_sm_spawnEmplaced<Line 38>:: _missionEmplacedWeapons = %1",_missionEmplacedWeapons];
{
_wepnClassName = _x select 0;
_pos = _x select 1;
_difficulty = _x select 2;
/// params["_pos", "_center", _numai1, _numai2, _skillLevel, _minDist, _maxDist, _configureWaypoints, _uniforms, _headGear,_vests,_backpacks,_weaponList,_sideArms, _scuba ];
__empGroup = [_pos,_pos,1,1,_difficulty,1,2,false,_uniforms,_headGear] call blck_fnc_spawnGroup;
_empGroup setcombatmode "RED";
_empGroup setBehaviour "COMBAT";
// Not sure of the value of giving waypoints here.
//[_pos,0.01,0.02,_empGroup,"random","SAD","emplaced"] spawn blck_fnc_setupWaypoints;
//if (isNull _empGroup) exitWith {_abort = _true};
_wep = [_wepnClassName,[0,0,0],false] call blck_fnc_spawnVehicle;
//_empGroup setVariable["groupVehicle",_wep];
//_wep setVariable["vehicleGroup",_empGroup];
_wep = [_wepnClassName,[0,0,0]] call blck_fnc_spawnVehicle;
_wep setVariable["GRG_vehType","emplaced"];
_wep setPosATL _pos;
[_wep,false] call blck_fnc_configureMissionVehicle;

View File

@ -27,13 +27,9 @@ _backpacks = [_aiDifficultyLevel] call blck_fnc_selectAIBackpacks;
if !(_patrols isEqualTo []) then
{
{
//diag_log format["_sm_spawnInfantryPatrols.sqf:: _x = %1",_x];
// Use the pre-defined spawn positions and other parameters for each group.
// [[22819.4,16929.5,5.33892],"red",4, 75]
_x params ["_pos","_difficulty","_noAI","_patrolRadius"];
private _group = [blck_AI_Side,true] call blck_fnc_createGroup;
// params[["_group","Error"],"_pos", "_center", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], ["_minDist",30], ["_maxDist",45],["_configureWaypoints",true], ["_uniforms",[]], ["_headGear",[]],["_vests",[]],["_backpacks",[]],
// ["_weaponList",[]],["_sideArms",[]], ["_scuba",false],["_patrolRadius",30]];
#define setupWaypoints true
if !(isNull _group) then
{

View File

@ -10,7 +10,7 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_objectDescriptors","_coords"];
params["_objectDescriptors","_coords",["_money",-1]];
if !(_objectDescriptors isEqualTo []) then
{ // Spawn loot crates where specified in _objects using the information for loot parameters provided for each location.
@ -18,6 +18,14 @@ if !(_objectDescriptors isEqualTo []) then
// data within the descriptor for each loot crate is organized as follows (not that the _allowDamageSim is included just for backward compatibilty but is not used
_x params["_crateClassName","_cratePosASL","_vectorDirUp","_allowDamageSim","_crateLoot","_lootCounts"];
private _crate = [_cratePosASL, _crateClassName] call blck_fnc_spawnCrate;
if (blck_debugLevel >= 3) then
{
[format["_fnc_sm_initializeMission: _money = %1",_money]] call blck_fnc_log;
};
if (_money > 0) then
{
[_crate,_money] call blck_fnc_addMoneyToObject;
};
[_crate, _crateLoot,_lootCounts] call blck_fnc_fillBoxes;
} forEach _objectDescriptors;
}
@ -26,6 +34,10 @@ else
{
_crateType = selectRandom blck_crateTypes;
_crate = [_coords,_crateType] call blck_fnc_spawnCrate;
if !(_money == -1) then
{
[_crate,_money] call blck_fnc_addMoneyToObject;
};
[_crate,blck_BoxLoot_Red,blck_lootCountsGreen] call blck_fnc_fillBoxes;
};

View File

@ -16,7 +16,7 @@ params["_vehicleDescriptors","_coords"];
{
// data within the descriptor for each loot vehicle is organized as follows (not that the _allowDamageSim is included just for backward compatibilty but is not used)
_x params["_vehcleClassName","_posATL","_vectorDirUp","_allowDamageSim","_loot","_lootCounts"];
private _veh = [_vehcleClassName,_posATL] call blck_fnc_spawnVehicle;
private _veh = [_vehcleClassName,_posATL,"NONE",30] call blck_fnc_spawnVehicle;
[_veh, _loot,_lootCounts] call blck_fnc_fillBoxes;
} forEach _vehicleDescriptors;

View File

@ -18,27 +18,18 @@ uiSleep 10; // Let the objects 'settle' before placing anything on or around the
// Spawn Air Patrols
// params["_airPatrols","_noAirPatrols","_heliTypes","_center","_difficulty","_uniforms","_headGear"];
[_airPatrols,_noAirPatrols,_aircraftTypes,_missionCenter,_difficulty,_uniforms,_headgear,_weapons] call blck_fnc_sm_spawnAirPatrols;
//uiSleep 1;
// Spawn Vehicle Patrols
// params["_coords","_noVehiclePatrols","_vehiclePatrolSpawns","_aiDifficultyLevel","_uniforms","_headGear",["_missionType","unspecified"]];
[_missionCenter,_noVehiclePatrols,_vehiclePatrolParameters,_difficulty,_uniforms,_headGear] call blck_fnc_sm_spawnVehiclePatrols;
//uiSleep 1;
// spawn infantry
// params["_patrols","_coords",["_minNoAI",3],["_maxNoAI",6],["_aiDifficultyLevel","red"],["_weapons",blck_WeaponList_Orange],["_uniforms",blck_SkinList],["_headGear",blck_BanditHeadgear]];
[_aiGroupParameters, _missionCenter,_minNoAI,_maxNoAI,_difficulty,_weapons,_uniforms,_headGear] call blck_fnc_sm_spawnInfantryPatrols;
//uiSleep 1;
// spawn loot vehicles
// params["_objects","_coords","_loot","_lootCounts"];
[_missionLootVehicles,_missionCenter,_crateLoot,_lootCounts] call blck_fnc_sm_spawnLootContainers;
// Spawn static weapons
// params["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear"];
[_missionEmplacedWeapons,_noEmplacedWeapons,_difficulty,_missionCenter,_uniforms,_headGear] call blck_fnc_sm_spawnEmplaceds;
// spawn loot chests
@ -47,5 +38,4 @@ uiSleep 10; // Let the objects 'settle' before placing anything on or around the
_blck_localMissionMarker = ["",_missionCenter,"","",_markerColor,_markerType];
[_blck_localMissionMarker] call blck_fnc_spawnMarker;
diag_log format["[blckeagls] Static Mission Spawner: Mission %1 spawned",_mission];

View File

@ -13,15 +13,14 @@
params["_coords","_noVehiclePatrols","_vehiclePatrolSpawns","_aiDifficultyLevel"];
private["_vehGroup","_patrolVehicle","_missionAI","_missiongroups","_vehicles","_return","_vehiclePatrolSpawns","_randomVehicle","_return","_abort"];
private ["_weaponList","_sideArms","_uniforms","_headgear","_vests","_backpacks"];
private["_vehGroup","_patrolVehicle","_missionAI","_missiongroups","_vehicles","_return","_vehiclePatrolSpawns","_randomVehicle","_return","_abort",
"_weaponList","_sideArms","_uniforms","_headgear","_vests","_backpacks"];
if (_vehiclePatrolSpawns isEqualTo []) then
{
private["_spawnPoints","_vehType"];
_spawnPoints = [_coords,_noVehiclePatrols,75,100] call blck_fnc_findPositionsAlongARadius;
{
// ["Vehicle Class Name", position[x,y,z], AI Skill [blue, red, green, orange],patrol radius [0 for static units], respawn time [seconds]]
#define vehiclePatrolRadius 150
#define vehicleRespawnTime 900
_vehType = selectRandom blck_AIPatrolVehicles;
@ -48,6 +47,7 @@ if (_vehiclePatrolSpawns isEqualTo []) then
#define useWaypoints true
_patrolVehicle = [_spawnPos,_spawnPos,_vehicle,_patrolRadius,_patrolRadius,_vehGroup,useWaypoints,[difficulty] call blck_fnc_selectVehicleCrewCount,_patrolRadius] call blck_fnc_spawnVehiclePatrol; // Check whether we should pass the group; looks like we should.
};
} forEach _vehiclePatrolSpawns;

View File

@ -11,7 +11,6 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
//diag_log format["_fnc_staticPatrolMonitor called at %1",diag_tickTime];
[] call blck_fnc_sm_monitorInfantry;
[] call blck_fnc_sm_monitorScuba;
[] call blck_fnc_sm_monitorVehicles;
@ -19,7 +18,5 @@
[] call blck_fnc_sm_monitorEmplaced;
[] call blck_fnc_sm_monitorShips;
[] call blck_fnc_sm_monitorSubs;
//[] call blck_fnc_sm_monitorGarrisonsASL;
//[] call blck_fnc_sm_monitorGarrisons_relPos;

View File

@ -12,54 +12,33 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
_wreckSelected = selectRandom ["Land_Wreck_Car2_F","Land_Wreck_Car3_F","Land_Wreck_Car_F","Land_Wreck_Offroad2_F","Land_Wreck_Offroad_F","Land_Tyres_F","Land_Pallets_F","Land_MetalBarrel_F"];
params["_pos","_mode",["_maxDist",12],["_wreckChoices",_wreckSelected],["_addFire",false]];
private ["_objs","_wreckSelected","_smokeType","_fire","_posFire","_posWreck","_smoke","_dis","_minDis","_maxDis","_closest","_wrecks"];
_objs = [];
// http://www.antihelios.de/EK/Arma/index.htm
_wrecks = ["Land_Wreck_Car2_F","Land_Wreck_Car3_F","Land_Wreck_Car_F","Land_Wreck_Offroad2_F","Land_Wreck_Offroad_F","Land_Tyres_F","Land_Pallets_F","Land_MetalBarrel_F"];
params["_pos","_mode",["_maxDist",12],["_wreckChoices",_wrecks],["_addFire",false]];
_wreckSelected = selectRandom _wreckChoices;
//_smokeTrail = "test_EmptyObjectForSmoke"; // "options are "test_EmptyObjectForFireBig", "test_EmptyObjectForSmoke"
_smokeType = if(_addFire) then {"test_EmptyObjectForFireBig"} else {"test_EmptyObjectForSmoke"};
_smokeType = if(_addFire) then {"test_EmptyObjectForFireBig"} else {"test_EmptyObjectForSmoke"};
switch (_mode) do {
case "none": {if (true) exitWith {};};
case "none": {_minDis = 0; _maxDis = 1; _closest = 1;};
case "center": {_minDis = 5; _maxDis = 15; _closest = 5;};
case "random": {_minDis = 15; _maxDis = 50; _closest = 10;};
default {_minDis = 5; _maxDis = 15; _closest = 5;};
};
_dis = 0;
//_posWreck = [_pos, 0, 30, 10, 0, 20, 0] call BIS_fnc_findSafePos; // Position the wreck within 30 meters of the position and 5 meters away from the nearest object
// _minDis and _maxDis determine the spacing between the smoking item and the loot crate.
_minDis = 5; // Minimum distance of
//_maxDis = 50;
_closest = 10;
private _posWreck = [_pos, _minDis, 50, _closest, 0, 20, 0] call BIS_fnc_findSafePos; // find a safe spot near the location passed in the call
while {_dis < _maxDist} do
{
_posWreck = [_pos, _minDis, 50, _closest, 0, 20, 0] call BIS_fnc_findSafePos; // find a safe spot near the location passed in the call
_dis = _posWreck distance _pos;
};
// spawn a wreck near the mission center
_fire = createVehicle [_wreckSelected, [0,0,0], [], 0, "can_collide"];
_fire setVariable ["LAST_CHECK", (diag_tickTime + 14400)];
_fire setPos _posWreck;
_fire setDir random(360);
//https://community.bistudio.com/wiki/setVectorUp
//_fire setVectorUp surfaceNormal position _fire;
// spawn asmoke or fire source near the wreck and attach it.
_smoke = createVehicle [_smokeType, [0,0,0], [], 0, "can_collide"]; // "test_EmptyObjectForSmoke" createVehicle _posFire;
_smoke = createVehicle [_smokeType, [0,0,0], [], 0, "can_collide"];
_smoke setVariable ["LAST_CHECK", (diag_tickTime + 14400)];
_smoke setPos _posWreck;
_smoke attachto [_fire, [0,0,1]];
_smoke attachto [_fire, [0,0,1.5]];
_objs = _objs + [_fire,_smoke];
//diag_log format ["--smokeAtCrate.sqf:: _objs = %1",_objs];
_objs = [_fire,_smoke];
_objs

View File

@ -34,13 +34,9 @@ _newObjs pushBack _obj;
_dam = _x select 4;
};
//diag_log format["_fnc_spawnBaseObjects: className %1 | _center %2 | _offset %3 | element %4",_x select 0,_center,_x select 1,_forEachIndex];
_obj = createVehicle[(_x select 0),_center vectorAdd (_x select 1),[],0,"CAN_COLLIDE"];
//diag_log format["_fnc_spawnBaseObjects::-->> _x = %1 | _obj = %2",_x,_obj];
_newObjs pushback _obj;
_obj setDir (_x select 2);
[_obj, (_x select 2)] call blck_fnc_setDirUp;
_obj enableDynamicSimulation _sim;
_obj allowDamage _dam;
if ((typeOf _obj) isKindOf "LandVehicle" || (typeOf _obj) isKindOf "Air" || (typeOf _obj) isKindOf "Sea") then

View File

@ -10,27 +10,22 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private ["_crate"];
params["_coords",["_crateType","Box_NATO_Wps_F"],["_crateDir",0]];
_crate = createVehicle [_crateType,[0,0,0],[], 2, "NONE"];
private _cratePos = _coords findEmptyPosition[15,25,_crateType];
_crate = createVehicle [_crateType,_coords,[], 0, "NONE"];
_crate setVariable ["LAST_CHECK", 100000];
_crate allowDamage false;
_crate enableRopeAttach false;
[_crate] call blck_fnc_emptyObject;
_crate setPosATL [_coords select 0, _coords select 1, (_coords select 2) + 0.25];
_crate setDir _crateDir;
//_crate setVectorUp [0,0,1];
[_crate, _crateDir] call blck_fnc_setDirUp;
_crate setVectorUp surfaceNormal position _crate;
// the function to have a lightsource on underwater objects needs work.
if ((_coords select 2) < 0 || surfaceIsWater (_coords)) then
{
private["_lantern","_bbr","_p1","_p2","_maxHeight"];
//_lantern = createVehicle ["PortableHelipadLight_01_red_F", [0,0,0],[],0,"CAN_COLLIDE"];// Land_Camping_Light_F
//_lantern enableSimulationGlobal true;
//_lantern switchLight "on";
_light = "#lightpoint" createVehicle (getPos _crate);
_light setLightDayLight true;
_light setLightBrightness 1.0;
@ -40,7 +35,6 @@ if ((_coords select 2) < 0 || surfaceIsWater (_coords)) then
_p1 = _bbr select 0;
_p2 = _bbr select 1;
_maxHeight = abs ((_p2 select 2) - (_p1 select 2));
//diag_log format["_fnc_spawnCrate: _bbr = %1 | _maxHeight = %2",_bbr,_maxHeight];
_light attachTo [_crate, [0,0,(_maxHeight + 0.5)]];
};
_crate;

View File

@ -20,12 +20,6 @@ if (_backpacks isEqualTo []) then {_backpacks = [_aiDifficultyLevel] call blc
if (_weaponList isEqualTo []) then {_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout};
if (_sideArms isEqualTo []) then {[_aiDifficultyLevel] call blck_fnc_selectAISidearms};
/*
{
diag_log format["_fnc_spawnEmplacedWeaponArray: _this %1 varName %2 = %3",_forEachIndex,_x,_this select _forEachIndex];
} forEach ["_coords","_missionEmplacedWeapons","_useRelativePos","_noEmplacedWeapons","_aiDifficultyLevel"];
*/
private["_return","_emplacedWeps","_emplacedAI","_wep","_units","_gunner","_abort","_pos","_mode","_useRelativePos","_useRelativePos"];
_emplacedWeps = [];
_emplacedAI = [];
@ -58,8 +52,7 @@ if (_missionEmplacedWeapons isEqualTo []) then
#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 ];
private _empGroup = [blck_AI_Side,true] call blck_fnc_createGroup;
if !(isNull _empGroup) then
{
@ -82,7 +75,7 @@ if (_missionEmplacedWeapons isEqualTo []) then
} else {
_abort = true;
_return = grpNull;
diag_log format["[blckeagls] <WARNING> createGroup returned grpNull"];
["createGroup returned grpNull","warning"] call blck_fnc_log;
};
} forEach _missionEmplacedWeapons;
if !(_abort) then

View File

@ -26,10 +26,8 @@ _staticsSpawned = [];
_obj = [_staticClassName, [0,0,0]] call blck_fnc_spawnVehicle;
_obj setVariable["GRG_vehType","emplaced"];
_staticsSpawned pushBack _obj;
//diag_log format["_fnc_spawnGarrisonInsideBuilding_ATL: _obj = %1 | _staticsSpawned = %2",_obj,_staticsSpawned];
_obj setPosATL (_staticRelPos vectorAdd getPosATL _building);
_obj setDir _staticDir;
//diag_log format["_fnc_spawnGarrisonInsideBuilding_ATL: _obj = %1 | getPosATL _obj = %2",_obj,getPosATL _obj];
_unit = [[0,0,0],_group,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_launcher,_weaponList,_sideArms,false,true] call blck_fnc_spawnUnit;
_unit moveInGunner _obj;
}forEach _statics;

View File

@ -17,29 +17,25 @@ if (_uniforms isEqualTo []) then {_uniforms = [_aiDifficultyLevel] call blck_f
if (_headGear isEqualTo []) then {_headGear = [_aiDifficultyLevel] call blck_fnc_selectAIHeadgear};
if (_vests isEqualTo []) then {_vests = [_aiDifficultyLevel] call blck_fnc_selectAIVests};
if (_backpacks isEqualTo []) then {_backpacks = [_aiDifficultyLevel] call blck_fnc_selectAIBackpacks};
//if (_typesStatics isEqualTo []) then {_typesStatics = blck_staticWeapons};
private["_staticsSpawned","_allBldPsn","_allBldPsn","_floor","_ceil","_statics","_units","_unit","_obj","_staticClassName","_usedBldPsn","_pos","_obj"];
_allBldPsn = [_building] call BIS_fnc_buildingPositions;
_usedBldPsn = [];
_floor = floor((count _allBldPsn)/2);
_ceil = ceil((count _allBldPsn)/2);
_statics = if (_ceil > _noStatics) then {_noStatics} else {_ceil};
_units = if (_floor > _noUnits) then {_noUnits} else {_floor};
_staticsSpawned = [];
private["_unit","_obj","_staticClassName","_usedBldPsn","_pos","_obj"];
private _allBldPsn = [_building] call BIS_fnc_buildingPositions;
private _usedBldPsn = [];
private _floor = floor((count _allBldPsn)/2);
private _ceil = ceil((count _allBldPsn)/2);
private _statics = if (_ceil > _noStatics) then {_noStatics} else {_ceil};
private _units = if (_floor > _noUnits) then {_noUnits} else {_floor};
private _staticsSpawned = [];
uiSleep 1;
for "_i" from 1 to _statics do
{
diag_log format["_fnc_spawnGarrisonInsideBuilding_relPos: _x = %1",_x];
_pos = selectRandom _allBldPsn;
_allBldPsn = _allBldPsn - [_pos];
_staticClassName = selectRandom _typesStatics;
_obj = [_staticClassName, [0,0,0], true] call blck_fnc_spawnVehicle;
_obj = [_staticClassName, [0,0,0]] call blck_fnc_spawnVehicle;
_obj setVariable["GRG_vehType","emplaced"];
_staticsSpawned pushBack _obj;
diag_log format["_fnc_spawnGarrisonInsideBuilding_relPos: _obj = %1 | _staticsSpawned = %2",_obj,_staticsSpawned];
_obj setPosATL _pos; // (_pos vectorAdd (getPosATL _building));
diag_log format["static weapon %1 placed in building %2 located at %4 at postion %3",_obj,_building,_pos, getPosATL _building];
_unit = [[0,0,0],_group,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_launcher,_weaponList,_sideArms,false,true] call blck_fnc_spawnUnit;
_unit moveInGunner _obj;
};
@ -48,7 +44,6 @@ for "_i" from 1 to _units do
{
_pos = selectRandom _allBldPsn;
_allBldPsn = _allBldPsn - [_pos];
// ["_pos","_aiGroup",["_aiDifficultyLevel","red"],["_uniforms", []],["_headGear",[]],["_vests",[]],["_backpacks",[]],["_Launcher","none"],["_weaponList",[]],["_sideArms",[]],["_scuba",false],["_garrison",false]];
_unit = [[0,0,0],_group,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_launcher,_weaponList,_sideArms,false,true] call blck_fnc_spawnUnit;
_unit setPosATL _pos;
};

View File

@ -32,13 +32,10 @@ for "_i" from 1 to _noMines/2 do
_xpos = (_pos select 0) + sin (_dir) * _radius;
_ypos = (_pos select 1) + cos (_dir) * _radius;
_posMine = [_xpos,_ypos,0];
//_posMine = [[_xpos,_ypos,0],0,10,_closest,0,20,0] call BIS_fnc_findSafePos; // find a random loc
_mine = createMine ["ATMine", _posMine, [], 0];
_mine setVariable ["LAST_CHECK", (diag_tickTime + 14400)];
_mine setPos _posMine;
//https://community.bistudio.com/wiki/setVectorUp
_minesPlaced = _minesPlaced + [_mine];
//diag_log format["[spawnMines.sqf] mine # %2 spawned at %1",_posMine,_i];
};
_dir = _dir + _incr;
};

View File

@ -17,7 +17,6 @@ _fnc_dropMissionCrates = {
_markers = [];
{
// params["_pos","_crate",["_crateVisualMarker",true],["_dropHeight", 150]];
[(getPos _x), _x, true, 150] call blck_fnc_paraDropObject;
} forEach _crates;
@ -26,7 +25,6 @@ _fnc_dropMissionCrates = {
{
uiSleep 1;
{
// (((getPos _crate) select 2) < 3)
if ((getPos _x) select 2 < 5) then
{
_airborneCrates = _airborneCrates - [_x];
@ -36,12 +34,9 @@ _fnc_dropMissionCrates = {
_location = getPos _x;
_blck_localMissionMarker = [format["crateMarker%1%2",_location select 0, _location select 1],_location,"","","ColorBlack",["mil_dot",[]]];
_marker = [_blck_localMissionMarker] call blck_fnc_spawnMarker;
//_markers pushBack _marker;
blck_temporaryMarkers pushBack [_marker,diag_tickTime + 300];
//uiSleep 0.5;
_curPosCrate = getPos _x;
_x setPos [_curPosCrate select 0, _curPosCrate select 1, 0.3];
//_x setVectorDirAndUp[[0,1,0],[0,0,1]];
};
} forEach _crates;
};
@ -63,7 +58,7 @@ private _cratesSpawned = [];
private _pos = _coords vectorAdd _crateOffset;
private _crate = [_pos,_crateType] call blck_fnc_spawnCrate;
_crate setDir _crateDir;
[_crate, _crateDir] call blck_fnc_setDirUp;
_crate setVariable["lootArray",_lootArray];
_crate setVariable["lootCounts",_lootCounts];
_crate setVariable["difficulty",_difficulty];
@ -72,19 +67,10 @@ private _cratesSpawned = [];
[_crate] call blck_fnc_loadMissionCrate;
};
_cratesSpawned pushback _crate;
#define blck_debugMode
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then
{
_marker = createMarker [format["crateMarker%1",random(1000000)], _pos];
_marker setMarkerType "mil_triangle";
_marker setMarkerColor "colorGreen";
_crate setVariable["crateMarker",_marker];
};
#endif
}forEach _cratesToSpawn;
if (_spawnCrateTiming in ["atMissionEndAir","atMissionStartAir"]) then
if (_spawnCrateTiming in ["atMissionEndAir","atMissionSpawnAir"]) then
{
[_cratesSpawned] spawn _fnc_dropMissionCrates;
};

View File

@ -16,21 +16,13 @@ if (count _coords isEqualTo 2) then {_coords pushBack 0};
private _vehs = [];
{
_x params["_vehType","_vehOffset",["_dir",0],"_lootArray","_lootCounts"];
//diag_log format["spawnMissionCVehicles: _vehType = %1 | _vehOffset = %2 | _lootCounts = %4 | _dir %5 | _lock %6 | _lootArray = %3 ",_vehType,_vehOffset,_lootArray,_lootCounts,_dir,_lock];
private _pos =_coords vectorAdd _vehOffset;
_veh = [_vehType, _pos] call blck_fnc_spawnVehicle;
if (typeName _dir isEqualTo "SCALAR") then
{
_veh setDir _dir;
};
if (typeName _dir isEqualTo "ARRAY") then
{
_veh setVectorDirAndUp _dir;
};
[_veh, _dir] call blck_fnc_setDirUp;
_veh lock _lock;
if (_loadCrateTiming isEqualTo "atMissionSpawn") then
{
//diag_log format["blck_fnc_spawnMissionLootVehicles::-> loading loot at mission spawn for veh %1",_x];
[_veh,_lootArray,_lootCounts] call blck_fnc_fillBoxes;
_veh setVariable["lootLoaded",true];
};

View File

@ -28,7 +28,7 @@ private["_vehGroup","_vehiclePatrolSpawns","_missionAI","_missiongroups","_vehic
_vehicles = [];
_missionAI = [];
_abort = false;
//diag_log format["fnc_spawnMissionVehiclePatrols(29): _missionPatrolVehicles = %1",_missionPatrolVehicles];
if (_missionPatrolVehicles isEqualTo []) then
{
_useRelativePos = false;
@ -37,7 +37,6 @@ if (_missionPatrolVehicles isEqualTo []) then
_v = [_skillAI] call blck_fnc_selectPatrolVehicle;
_missionPatrolVehicles pushBack [_v, _x];
}forEach _vehiclePatrolSpawns;
//diag_log format["fnc_spawnMissionVehiclePatrols(38): _missionPatrolVehicles updated to %1",_missionPatrolVehicles];
};
#define configureWaypoints false
{

View File

@ -1,8 +1,3 @@
/*
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
checks the status of each entry in
/*
By Ghostrider [GRG]
--------------------------
@ -16,30 +11,29 @@
if (blck_missionsRunning >= blck_maxSpawnedMissions) exitWith {};
private["_coords","_compiledMission","_search","_readyToSpawnQue","_missionToSpawn","_allowReinforcements"];
_readyToSpawnQue = [];
{
if ( (diag_tickTime > (_x select 5)) && ((_x select 5) > 0) ) then
{
private _missionCategoryDescriptors = _x;
_missionCategoryDescriptors params["_difficulty","_maxNoMissions","_noActiveMissions","_tMin","_tMax","_waitTime","_missionsData"];
if (_noActiveMissions < _maxNoMissions && diag_tickTime > _waitTime && blck_missionsRunning < blck_maxSpawnedMissions) then
{
_readyToSpawnQue pushback _x;
// time to reset timers and spawn something.
private _wt = diag_tickTime + _tmin + (random(_tMax - _tMin));
private _missionInitialized = [_x,selectRandom _missionsData] call blck_fnc_initializeMission;
if (blck_debugLevel >= 3) then
{
if !(_missionInitialized) then
{
[format["fnc_spawnPendingMissions: _missionInitialized = %1",_missionInitialized],"warning"] call blck_fnc_log;
};
};
if (_missionInitialized) then
{
#define waitTime 5
#define noActive 2
_x set[waitTime, _wt]; // _x here is the _missionCategoryDescriptors being evaluated
_x set[noActive, _noActiveMissions + 1];
};
};
} forEach blck_pendingMissions;
if (count _readyToSpawnQue > 0) then
{
_missionToSpawn = selectRandom _readyToSpawnQue;
_coords = [] call blck_fnc_FindSafePosn;
if (_coords isEqualTo []) exitWith
{
diag_log format["[blckagls] fnc_spawnPendingMissions: <ERROR> _fnc_findSafePosn could not find a location for this mission; consider reducing distances between players, bases, missions or towns."];
};
_compiledMission = selectRandom (_missionToSpawn select 0);
_missionMarker = _missionToSpawn select 1;
_missionDifficulty = _missionToSpawn select 2;
[_coords,_missionMarker,_missionDifficulty] spawn _compiledMission;
};
true
} forEach blck_missionData;

View File

@ -26,6 +26,7 @@ _wreck enableSimulationGlobal false;
_wreck enableDynamicSimulation false;
_objects pushBack _wreck;
{
private _dir = random(360);
private _radius = minObjectSpawnRadius + random(maxObjectSpawnRadius);
_wreck = createVehicle[_x, _coords getPos[_radius,_dir], [], 2];

View File

@ -15,10 +15,7 @@
#define UMS_sidearms []
params["_group","_pos",["_skillLevel","red"],["_numUnits",6],["_patrolRadius",15]];
//{diag_log format["_fnc_spawnScubaGroup: _this select %1 = %2",_foreachindex,_x]} forEach _this;
//params[["_group","Error"],"_pos", "_center", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], ["_minDist",30], ["_maxDist",45],["_configureWaypoints",true],
//["_uniforms",[]], ["_headGear",[]],["_vests",[]],["_backpacks",[]],["_weaponList",[]],["_sideArms",[]], ["_scuba",false],["_patrolRadius",30]];
[_group,_pos,_pos,_numUnits,_numUnits,_skillLevel, _patrolRadius - 2, _patrolRadius, configureWaypoints, blck_UMS_uniforms, blck_UMS_headgear, blck_UMS_vests, UMS_backpacks, blck_UMS_weapons, UMS_sidearms, isScubaGroup] call blck_fnc_spawnGroup;

View File

@ -10,15 +10,14 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
// ["B_SDV_01_F",[22584.9,15304.8,-6.14801],"red",4, 75,0],
params["_SDV","_pos","_difficulty","_numAI","_patrolRadius","_respawnTime"];
//diag_log format["_fnc_spawnSurfacePatrol: _this = %1",_this];
private _group = [blck_AI_Side,true] call blck_fnc_createGroup;
private _vehicle = objNull;
if !(isNull _group) then
{
[_group,_pos,_numAI,_numAI,_difficulty,_pos,_patrolRadius - 2,_patrolRadius,blck_UMS_uniforms,blck_UMS_headgear,true,blck_UMS_weapons,blck_UMS_vests,true] call blck_fnc_spawnGroup;
// params["_center","_pos",["_vehType","I_G_Offroad_01_armed_F"],["_minDis",30],["_maxDis",45],["_group",grpNull]];
_vehicle = [_pos,_pos,_vehType,_minDis,_maxDis,_group] call blck_fnc_spawnVehiclePatrol;
};
_vehicle

View File

@ -13,6 +13,7 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_mission","_status",["_coords",[0,0,0]] ];
// _mission is the name used to identify the marker associated with that particular mission. it is a unique identifier.
#ifdef blck_debugMode
if (blck_debugLevel > 3) then {diag_log format["_fnc_updateMissionQue :: _mission = %1 | _status = %2 | _coords = %3",_mission,_status,_coords];};
@ -23,23 +24,14 @@ private["_index","_element","_waitTime"];
if (_mission isEqualTo (_x select 1)) exitWith
{
_index = _forEachIndex;
//diag_log format["_fnc_updateMissionQue: match found at _forEachIndex %1 for _mission with _x = %2",_forEachIndex,_x select 1];
};
}forEach blck_pendingMissions;
//_index = blck_pendingMissions find _mission;
if (_index > -1) then
{
#ifdef blck_debugMode
if (blck_debuglevel > 4) then {diag_log format ["_fnc_updateMissionQue :: blck_pendingMissions began as %1",blck_pendingMissions];};
#endif
_element = blck_pendingMissions select _index;
#ifdef blck_debugMode
if (blck_debuglevel > 3) then {diag_log format["_fnc_updateMissionQue:: -- >> _element before update = %1",_element];};
#endif
// 0 1 2 3 4 5 6
//_mission = [_missionList,format["%1%2",_marker,_i],_difficulty,_tMin,_tMax,_waitTime,[0,0,0]];
if (toLower(_status) isEqualTo "active") then {
_element set[5, -1];
_element set[6,_coords];
@ -51,15 +43,7 @@ if (_index > -1) then
_element set [6,[0,0,0]];
};
#ifdef blck_debugMode
if (blck_debuglevel > 2) then {diag_log format["_fnc_updateMissionQue:: -- >> _element after update = %1",_element];};
#endif
blck_pendingMissions set [_index, _element];
#ifdef blck_debugMode
if (blck_debuglevel > 4) then {diag_log format ["_fnc_updateMissionQue :: blck_pendingMissions after update = %1",blck_pendingMissions];};
#endif
};

View File

@ -12,5 +12,4 @@
params["_group"];
blck_sm_scubaGroups pushBack [_group,grpNull,0];
//diag_log format["_sm_AddScubaGroup:: blck_sm_scubaGroups = %1",blck_sm_scubaGroups];
true

View File

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

View File

@ -7,7 +7,6 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
//diag_log format["_EH_AIHit: _this = %1",_this];
if (isServer) then {_this call blck_fnc_processAIHit};

View File

@ -27,7 +27,6 @@
Introduced with Arma 3 version 1.65
gunner: Object - gunner, whose weapons are fired
*/
//#include "\q\addons\custom_server\Configs\blck_defines.hpp";
//if (isServer) then {_this remoteExec ["blck_fnc_processAIKill",2]};
//if (local (_this select 0)) then {_this call blck_fnc_processAIFiredNear};
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
_this call blck_fnc_processAIFiredNear

View File

@ -25,6 +25,6 @@ private ["_unit","_killer","_group","_deleteAI_At"];
_unit = _this select 0;
_source = _this select 3;
if (isPlayer _source) then {
[_unit,_source] call GRMS_fnc_alertGroup;
if !(isPlayer _source) then {
_unit setDamage 0;
};

View File

@ -21,9 +21,5 @@
#define unit _this select 0
#define newMagazine _this select 3 select 0
(unit) addMagazine (newMagazine);
#ifdef blck_debugMode
if (blck_debugLevel > 2) then {
diag_log format["_EH_unitWeaponReloaded:: one magazine of type %1 added to inventory of unit %2",_mag,(_this select 3 select 0)];
};
#endif

View File

@ -14,11 +14,11 @@
params[["_unit",objNull],["_target",objNull]];
if (isNull _unit) exitWith {};
//diag_log format["_fnc_alertGroupUnits: _unit = %1 | _target = %2",_unit,_target];
{
_x reveal [_target,(_x knowsAbout _target) + (_unit getVariable ["intelligence",1])];
_x doSuppressiveFire _target;
if (random(1) < -.33) then {_x reveal [_target,(_x knowsAbout _target) + random(_unit getVariable ["intelligence",1]) ]};
//_x doSuppressiveFire _target;
}forEach (units (group _unit));
//leader(group _target) doSuppressiveFire _target;
leader(group _target) doSuppressiveFire _target;

View File

@ -12,12 +12,20 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private["_nearbyGroups","_intelligence"];
params["_unit","_killer",["_searchRadius",300]];
private _nearbyGroups = allGroups select{(_unit distance (leader _x) < _searchRadius)};
{
private _group = _x;
if (_group isEqualTo (group _unit)) then
{
_x reveal[_killer,(_x knowsAbout _killer) + (_x getVariable ["intelligence",1])];
[_unit,_killer] call blck_fnc_allertGroupUnits;
} else {
if (random(1) < 0.33) then
{
_x reveal[_killer,(_x knowsAbout _killer) + random(_x getVariable["intelligence",1])];
};
}forEach (units _group);
}forEach _nearbyGroups;

View File

@ -13,9 +13,9 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_unit","_killer"];
private["_units"];
private "_units";
if (toLower(blck_modType) isEqualTo "epoch") then {_units = _unit nearEntities ["I_Soldier_EPOCH", (_unit getVariable ["alertDist",300])]};
if !(toLower(blck_modType) isEqualTo "epoch") then {_units = _unit nearEntities ["i_g_soldier_unarmed_f", (_unit getVariable ["alertDist",300])]};
{
_x reveal[_killer, (_x knowsAbout _killer) + (_unit getVariable ["intelligence",1])]
_x reveal[_killer, (_x knowsAbout _killer) + random(_unit getVariable ["intelligence",1])]
}forEach _units;

View File

@ -12,13 +12,15 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params[["_target",objNull]];
//diag_log format["_fnc_alertNearbyVehicles: _target = %1 | typeName _target = %2",_target,typeName _target];
if (isnull _target) exitWith {};
private _nearestVehicles = (nearestObjects [getPos _target,["Car","Truck","Tank","Ship"],300]);
if (_nearestVehicles isEqualTo []) exitWith {};
private _nearestVehicle = _nearestVehicles select 0;
//diag_log format["_fnc_alertNearbyVehicles: _target = %1 | _nearestVehicle = %2",_target,_nearestVehicle];
[(crew _nearestVehicle) select 0,_target] call blck_fnc_alertGroupUnits;
if !(isnull _target) then
{
private _nearestVehicles = (nearestObjects [getPos _target,["Car","Tank","Ship","Air"],300]);
if !(_nearestVehicles isEqualTo []) then
{
if (random(1) < 0.33) then {[(crew (_nearestVehicles select 0)) select 0,_target] call blck_fnc_alertGroupUnits};
};
};

View File

@ -15,5 +15,5 @@
params["_group"];
private _nearbyGroup = [group _unit] call blck_fnc_findNearestGroup;
{
_x reveal[_killer,(_x knowsAbout _killer) + (_unit getVariable ["intelligence",1])];
_x reveal[_killer,(_x knowsAbout _killer) + random(_unit getVariable ["intelligence",1])];
}forEach (units _nearbyGroup);

View File

@ -10,12 +10,12 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
//diag_log format["_fnc_cleanupaliveAI: called at %1 | count %2 | blck_liveMissionAI = %3",diag_ticktime,count blck_liveMissionAI,blck_liveMissionAI];
for "_i" from 1 to (count blck_liveMissionAI) do {
if ((_i) <= count blck_liveMissionAI) then {
_units = blck_liveMissionAI deleteAt 0;
_units params ["_missionCenter","_unitsarr","_timer"];
//diag_log format["_fnc_cleanupAliveAI: _units = %4 | _missionCenter %1 | typeName _unitsArr = %2 | _unitsarr = %3",_missionCenter,typeName _unitsArr, _unitsarr,_units];
if (diag_tickTime > _timer) then
{
private _nearplayer = [_missionCenter,800] call blck_fnc_nearestPlayers;

View File

@ -11,17 +11,14 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
//diag_log format["fnc_cleanupDeadAI: (partially deactivated) time %1 | count blck_deadAI %2",diag_tickTime,count blck_deadAI];
{
private _unit = _x;
if (_unit getVariable["blck_cleanupAt",0] isEqualTo 0) then {_unit setVariable["blck_cleanupAt",diag_tickTime + blck_bodyCleanUpTimer]};
private _nearplayer = [position _unit,800] call blck_fnc_nearestPlayers;
//diag_log format["fnc_cleanupDeadAI: _unit = %1 | blck_cleanupat = %2 | _nearPlayer = %3",_unit, _unit getVariable["blck_cleanupAt",0],_nearPlayer];
if (diag_tickTime > _unit getVariable ["blck_cleanupAt",0]) then
{
if (_nearplayer isequalto []) then {
//diag_log format["_fnc_cleanupDeadAI: handling deletion of unit %1",_unit];
{
deleteVehicle _x;
}forEach nearestObjects [getPos _unit,["WeaponHolderSimulated","GroundWeapoonHolder"],3];

View File

@ -14,8 +14,6 @@
private["_ai","_group"];
params["_unit"];
//if (blck_debugLevel > 2) then {diag_log format["_fnc_deleteAI::-> deleting unit = %1",_unit];};
{
_unit removeAllEventHandlers _x;
}forEach ["reloaded"];
@ -23,7 +21,6 @@ params["_unit"];
_unit removeAllMPEventHandlers _x;
} forEach ["MPKilled","MPHit"];
_group = (group _unit);
[_unit] joinSilent grpNull;
deleteVehicle _unit;
if (count units _group isEqualTo 0) then
{

View File

@ -11,12 +11,11 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_character","_center","_characterBuildingConfigs"];
//diag_log format["_fnc_placeCharacterInBuilding: _characterBuildingConfigs = %1",_characterBuildingConfigs];
private ["_obj"];
if !(_characterBuildingConfigs isEqualTo []) then
{
_obj = createVehicle[(_characterBuildingConfigs select 0),_center vectorAdd (_characterBuildingConfigs select 1),[],0,"CAN_COLLIDE"];
//diag_log format["_fnc_placeCharacterInBuilding: _obj = %1",_obj];
_obj setDir (_characterBuildingConfigs select 2);
_obj allowDamage true;
_obj enableDynamicSimulation true;

View File

@ -13,43 +13,35 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
if !(isServer) exitWith {};
private ["_unit","_instigator","_group","_wp"];
_unit = _this select 0 select 0;
_instigator = _this select 0 select 3;
//diag_log format["_fnc_processAIHit:(19): _units = %1 and _instigator = %2 units damage is %3",_unit,_instigator, damage _unit];
(_this select 0) params["_unit","_causedBy","_damage","_instigator"];
if !(isPlayer _instigator) exitWith
{
_unit setDamage ( (damage _unit) - _damage);
};
//diag_log format["_fnc_processAIHit: evaluating case of ai not alive"];
if (!(alive _unit)) exitWith {
//diag_log format["_fnc_processAIHit: _unit %1 is dead",_unit];
[_unit, _instigator] call blck_fnc_processAIKill;
};
//diag_log format["_fnc_processAIHit: evaluating case of damage > 0.95"];
if (damage _unit > 0.95) exitWith {
//diag_log format["_fnc_processAIHit: _unit %1 extensively damagged",_unit];
_unit setDamage 1.2; [_unit, _instigator] call blck_fnc_processAIKill;
};
//diag_log format["_fnc_processAIHit: evaluating case of killer not player"];
if !(isPlayer _instigator) exitWith {
//diag_log format["_fnc_procesAIHit: _instigator %1 not player",_instigator];
};
//diag_log format["_processAIHit: calling [_unit,_instigator] call blck_fnc_alertGroupUnits with _unit = %1 and _instigator = %2",_unit,_instigator];
[_unit,_instigator,50] call GMS_fnc_alertNearbyGroups;
[_instigator] call blck_fnc_alertNearbyVehicles;
//diag_log format["_fnc_processAIHit: updating group and waypoint settings"];
_group = group _unit;
_wp = [_group, currentWaypoint _group];
_wp setWaypointBehaviour "COMBAT";
_group setCombatMode "RED";
_wp setWaypointCombatMode "RED";
//diag_log format["_fnc_processAIHit: determining if prior heal has occured"];
if (_unit getVariable ["hasHealed",false]) exitWith {
//diag_log format["_fnc_processAIHit: _unit %1 has already healed one",_unit];
};
//diag_log format["_fnc_processAIHit: no prior heal so evaluate whether one is needed"];
if ((damage _unit) > 0.2 ) then
if (_unit getVariable ["hasHealed",false]) exitWith {};
if ((damage _unit) > 0.5 ) then
{
//diag_log format["_EH_AIHit::-->> Healing unit %1",_unit];
_unit setVariable["hasHealed",true,true];
if (blck_useSmokeWhenHealing) then
{
@ -58,8 +50,6 @@ if ((damage _unit) > 0.2 ) then
_unit addItem "FAK";
_unit action ["HealSoldierSelf", _unit];
_unit setDamage 0;
//uiSleep 1;
if ("FAK" in (items _unit)) then {_unit removeItem "FAK"};
//_unit removeItem "FAK";
};

View File

@ -9,7 +9,7 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
// TODO: check that emplaced weapons that should be deleted are added to the scheduler.
// assumptions: this is always and only run on the server regardless if th event is triggered on an HC or other client.
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
@ -42,7 +42,6 @@ if (count(units (group _unit)) isEqualTo 0) then
deleteGroup _group;
};
//diag_log format["_fnc_processAIKill: unit linked to crew of vehicle %1 | typeOf (vehicle _unit = %2)",vehicle _unit,typeOf (vehicle _unit)];
if !((vehicle _unit) isKindOf "Man") then
{
[_unit, ["Eject", vehicle _unit]] remoteExec ["action",(owner _unit)];
@ -58,8 +57,6 @@ _wp setWaypointBehaviour "COMBAT";
(group _unit) setCombatMode "RED";
_wp setWaypointCombatMode "RED";
if ([_unit,_killer] call blck_fnc_processIlleagalAIKills) then {
[_unit,_killer] call GMS_fnc_handlePlayerUpdates;
[_unit,_killer] call blck_fnc_handlePlayerUpdates;
};

View File

@ -13,26 +13,12 @@
See https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#FiredNear for details on this event handler.
this addEventHandler ["FiredNear", {
params ["_unit", "_firer", "_distance", "_weapon", "_muzzle", "_mode", "_ammo", "_gunner"];
}];
unit: Object - Object the event handler is assigned to
firer: Object - Object which fires a weapon near the unit
distance: Number - Distance in meters between the unit and firer (max. distance ~69m)
weapon: String - Fired weapon
muzzle: String - Muzzle that was used
mode: String - Current mode of the fired weapon
ammo: String - Ammo used
Introduced with Arma 3 version 1.65
gunner: Object - gunner, whose weapons are fired
*/
//#include "\q\addons\custom_server\Configs\blck_defines.hpp";
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_unit","_firedBy"];
//if ((side _unit) isEqualTo (side _firedBy) exitWith {}; // nearyby friendly fire
(group _unit) setBehaviour "COMBAT";
(group _unit) setCombatMode "RED";
diag_log format["_fnc_processAIfiredNear: _unit %1 knows %2 about _firedBy %3",_unit, _unit knowsAbout _firedBy,_firedBy];
diag_log format["_fnc_processAIfiredNear: owner _unit = %1 | local _unit = %2",owner _unit, local _unit];

View File

@ -10,17 +10,11 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
// assumptions:
// 1) if the muzzle that killed the AI was forbbiden then the kill does not count
// 2) if the vehicle the player was in when the player killed the AI, the kill does not count.
// data to check: blck_forbidenVehicles
// and blck_forbidenVehicleGuns
// blck_VK_RunoverDamage
// blck_RunGear
private["_missionType","_wasRunover","_launcher","_legal"];
params["_unit","_killer"];
_legal = true;
if (vehicle _killer == _killer) exitWith {true};
// Player not in vehicle, no further checks needed.
if (_killer == (driver (vehicle _killer))) then // If the killer is also the driver then the killer must have run the AI over
{
@ -43,13 +37,8 @@ if (_killer == (driver (vehicle _killer))) then // If the killer is also the dr
[vehicle _killer] call GMS_fnc_applyVehicleDamagePenalty;
[_killer] call GMS_fnc_msgIED;
_legal = false;
diag_log format[
"_fnc_processIlleagalKills: _legal = %1 | (typeOf (vehicle _killer)) in blck_forbidenVehicles = %2 | (currentWeapon _killer) in blck_forbidenVehicleGuns) = %3",
_legal,(typeOf (vehicle _killer)) in blck_forbidenVehicles,
(currentWeapon _killer) in blck_forbidenVehicleGuns
];
};
};
};
//diag_log format["_fnc_testForIllegalKills: _legal = %1",_legal];
_legal

View File

@ -12,13 +12,11 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_unit"];
//diag_log format["+--+ removing NVG for unit %1",_unit];
if (blck_useNVG) then
{
if (_unit getVariable ["hasNVG",false]) then
{
_unit unassignitem "NVGoggles"; _unit removeweapon "NVGoggles";
};
};

View File

@ -11,8 +11,6 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
// Self explanatory
// [_group, _skill] call blck_setSkill;
params ["_unit","_skillsArrray"];
private["_skillLevel"];
{

View File

@ -13,14 +13,6 @@ params["_coords","_charConfigs"];
private["_char","_charGroup"];
_charConfigs params["_classname","_posn","_dir","_simDamg","_animations","_headgear","_uniforms"];
#ifdef blck_debugMode
{
diag_log format["_fnc_spawnchar: _forEachIndex = %1 | _x = %2",_forEachIndex,_x];
}forEach _charConfigs;
diag_log format["_fnc_spawnchar: _this = %1",_this];
diag_log format["_fnc_spawnchar _classname = %1 | _posn = %2 | _dir = %3 | _animations = %4",_classname,_posn,_dir,_animations];
#endif
_charGroup = createGroup [blck_AI_Side, true];
_char = _charGroup createUnit [_classname,[0,0,0], [], 0, "NONE"];
_char setCaptive true;

View File

@ -17,7 +17,6 @@ _hostage remoteExec["GMS_fnc_initHostage", -2, true];
_hostage setVariable["assetType",1,true];
_building = [_hostage,_coords,_hostageConfigs select 7] call blck_fnc_placeCharacterInBuilding;
_result = [_hostage,_building];
//diag_log format["_fnd_spawnHostage: _result = %1",_result];
_result

View File

@ -16,9 +16,7 @@ _leader = [_coords, _leaderConfigs] call blck_fnc_spawnCharacter;
_leader remoteExec["GMS_fnc_initLeader", -2, true];
_leader setVariable["assetType",2,true];
_leader setVariable["endAnimation",["Acts_CivilShocked_1"],true];
//diag_log format["_fnc_spawnLeader: _leaderConfigs = %1",_leaderConfigs];
_building = [_leader,_coords,_leaderConfigs select 7] call blck_fnc_placeCharacterInBuilding;
//diag_log format["_fnc_spawnLeader: _building = %1",_building];
_result = [_leader,_building];
_result

View File

@ -30,7 +30,6 @@ private _params = ["_pos","_numAI","_skillAI"];
}forEach _params;
#endif
_paraGroup = [blck_AI_Side,true] call blck_fnc_createGroup;
//diag_log format["_fnc_spawnParaUnits: _paraGroup = %1",_paraGroup];
#define infantryPatrolRadius 30
#define infantryWaypointTimeout [5,7.5,10]
[_pos,20,30,_paraGroup,"random","SAD","paraUnits",infantryPatrolRadius,infantryWaypointTimeout] call blck_fnc_setupWaypoints;
@ -45,24 +44,15 @@ for "_i" from 1 to _numAI do
_spawnPos = _pos getPos[1,_dir];
_chute = createVehicle ["Steerable_Parachute_F", [_spawnPos select 0, _spawnPos select 1, 250], [], 0, "FLY"];
[_chute] call blck_fnc_protectVehicle;
// ["_pos","_aiGroup",["_skillLevel","red"],["_uniforms", blck_SkinList],["_headGear",blck_headgear],["_vests",blck_vests],["_backpacks",blck_backpacks],["_Launcher","none"],["_weaponList",[]],["_sideArms",[]],["_scuba",false]];
_unit = [getPos _chute,_paraGroup,_skillAI,_uniforms,_headGear,_vests,_backpacks,launcherType,_weapons,_sideArms,_isScuba] call blck_fnc_spawnUnit;
#ifdef blck_debugMode
diag_log format["_fnc_spawnParaUnits: unit %1 = %2 dropping in chute %3",_i,_unit,_chute];
#endif
//_chute setPos [_spawnPos select 0, _spawnPos select 1, 125]; //(_offset select 2) - 10];
_unit assignAsDriver _chute;
_unit moveInDriver _chute;
//_unit allowDamage true;
_unit setVariable["chute",_chute];
_dir = _dir + _arc;
uiSleep 2;
};
blck_monitoredMissionAIGroups pushback _paraGroup;
_paraGroup

View File

@ -22,19 +22,10 @@ if (_headGear isEqualTo []) then {_headGear = [_skillLevel] call blck_fnc_sele
if (_vests isEqualTo []) then {_vests = [_skillLevel] call blck_fnc_selectAIVests};
if (_backpacks isEqualTo []) then {_backpacks = [_skillLevel] call blck_fnc_selectAIBackpacks};
#ifdef blck_debugMode
if (blck_debugLevel >= 2) then
{
private _params = ["_pos","_aiGroup","_skillLevel","_uniforms","_headGear","_vests","_backpacks","_Launcher","_weaponList","_sideArms","_scuba","_garrison"]; //"_weaponList", "_Launcher"
{
diag_log format["_fnc_spawnUnit::-> _this select %1 (%2) = %3",_forEachIndex, _params select _forEachIndex, _this select _forEachIndex];
}forEach _this;
};
#endif
if (isNull _aiGroup) exitWith {diag_log "[blckeagls] ERROR CONDITION:-->> NULL-GROUP Provided to _fnc_spawnUnit"};
if (isNull _aiGroup) exitWith {["NULL-GROUP Provided to _fnc_spawnUnit"] call blck_fnc_log};
_unit = ObjNull;
//private _unitType = "";
if (blck_modType isEqualTo "Epoch") then
{
"I_Soldier_EPOCH" createUnit [_pos, _aiGroup, "_unit = this", blck_baseSkill, "COLONEL"];
@ -46,7 +37,6 @@ if (blck_modType isEqualTo "Epoch") then
case "green":{_unit setVariable["Crypto",6 + floor(random(blck_maxMoneyGreen)),true];};
case "orange":{_unit setVariable["Crypto",8 + floor(random(blck_maxMoneyOrange)),true];};
};
//diag_log format["_fnc_spawnUnit: for unit %1 Crypto set to %2",_unit,_unit getVariable "Crypto"];
};
if !(blck_modType isEqualTo "Epoch") then
{
@ -58,11 +48,10 @@ if !(blck_modType isEqualTo "Epoch") then
case "green":{_unit setVariable["ExileMoney",6 + floor(random(blck_maxMoneyGreen)),true];};
case "orange":{_unit setVariable["ExileMoney",8 + floor(random(blck_maxMoneyOrange)),true];};
};
//diag_log format["_fnc_spawnUnit: for unit %1 ExileMoney set to %2",_unit,_unit getVariable "ExileMoney"];
};
// findEmptyPosition [minDistance, maxDistance, vehicleType]
private _tempPos = _pos findEmptyPosition [0.1, 3, typeOf _unit];
//diag_log format["_fnc_spawnUnit: _pos = %1 | _tempPos = %2",_pos,_tempPos];
if !(_tempPos isEqualTo []) then {_unit setPos _tempPos};
[_unit] call blck_fnc_removeGear;
@ -74,18 +63,8 @@ if (_scuba) then
_skin = "";
_counter = 1;
while {_skin isEqualTo "" && _counter < 10} do
{
_unit forceAddUniform (selectRandom _uniforms);
_skin = uniform _unit;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnUnit::-->> for unit _unit % uniform is %2",_unit, uniform _unit];
};
#endif
_counter = _counter + 1;
};
_unit forceAddUniform (selectRandom _uniforms);
//Sets AI Tactics
_unit enableAI "ALL";
if(_garrison) then
@ -99,23 +78,24 @@ _unit setunitpos "AUTO";
if !(_headGear isEqualTo []) then
{
_unit addHeadgear (selectRandom _headGear);
//diag_log format["Headgear for unit %1 = %2",_unit, headgear _unit];
};
if !(_vests isEqualTo []) then
{
_unit addVest (selectRandom _vests);
//diag_log format["Vest for unit %1 = %2",_unit, vest _unit];
};
if (_weaponList isEqualTo []) then {_weaponList = call blck_fnc_selectAILoadout};
_weap = selectRandom _weaponList;
_unit addWeaponGlobal _weap;
_ammoChoices = getArray (configFile >> "CfgWeapons" >> _weap >> "magazines");
_unit addMagazines[selectRandom _ammochoices,3];
_optics = getArray (configfile >> "CfgWeapons" >> _weap >> "WeaponSlotsInfo" >> "CowsSlot" >> "compatibleItems");
_pointers = getArray (configFile >> "CfgWeapons" >> _weap >> "WeaponSlotsInfo" >> "PointerSlot" >> "compatibleItems");
_muzzles = getArray (configFile >> "CfgWeapons" >> _weap >> "WeaponSlotsInfo" >> "MuzzleSlot" >> "compatibleItems");
_underbarrel = getArray (configFile >> "CfgWeapons" >> _weap >> "WeaponSlotsInfo" >> "UnderBarrelSlot" >> "compatibleItems");
if (random 1 < 0.4) then {_unit addPrimaryWeaponItem (selectRandom _muzzles)};
if (random 1 < 0.4) then {_unit addPrimaryWeaponItem (selectRandom _optics)};
if (random 1 < 0.4) then {_unit addPrimaryWeaponItem (selectRandom _pointers)};
@ -129,7 +109,6 @@ if ((count(getArray (configFile >> "cfgWeapons" >> _weap >> "muzzles"))) > 1) th
if !(_sideArms isEqualTo []) then
{
_weap = selectRandom _sideArms;
//diag_log format["[spawnUnit.sqf] _weap os %1",_weap];
_unit addWeaponGlobal _weap;
_ammoChoices = getArray (configFile >> "CfgWeapons" >> _weap >> "magazines");
_unit addMagazines [selectRandom _ammoChoices, 2];
@ -142,10 +121,9 @@ for "_i" from 1 to (1+floor(random(4))) do
// Add First Aid or Grenade 50% of the time
if (round(random 10) <= 5) then
{
//diag_log format["spawnUnit.sqf] -- Item is %1", _item];
_unit addItem selectRandom blck_specialItems;
};
//diag_log format["_spawnUnit: _Launcher = %1",_Launcher];
if ( !(_Launcher isEqualTo "none") && !(_backpacks isEqualTo [])) then
{
_unit addWeaponGlobal _Launcher;
@ -173,7 +151,7 @@ else
};
_unit addWeapon selectRandomWeighted["",4,"Binocular",3,"Rangefinder",1];
//_unit addEventHandler ["HandleDamage",{_this call blck_EH_handleDamage;}];
_unit addEventHandler ["FiredNear",{_this call blck_EH_AIfiredNear;}];
_unit addEventHandler ["Reloaded", {_this call blck_EH_unitWeaponReloaded;}];
_unit addMPEventHandler ["MPKilled", {[(_this select 0), (_this select 1)] call blck_EH_AIKilled;}];

View File

@ -15,12 +15,10 @@ private ["_veh","_instigator","_group","_wp"];
_veh = _this select 0;
_instigator = _this select 3;
//diag_log format["_fnc_HandleAIVehicleHit: _veh = %1 | _instigator = %2",_veh,_instigator];
if (!(isPlayer _instigator)) exitWith {};
_crew = crew _veh;
_group = group (_crew select 0);
[_crew select 0,_instigator,50] call GMS_fnc_alertNearbyGroups;
//diag_log format["_fnc_handleAIVehicleHit: calling blck_fnc_alertNearbyVehicles with _instigator = %1",_instigator];
[_instigator] call blck_fnc_alertNearbyVehicles;
_group setBehaviour "COMBAT";
_wp = [_group, currentWaypoint _group];

View File

@ -13,11 +13,9 @@
params["_veh"];
if (blck_killEmptyStaticWeapons) then
{
//diag_log format["_processAIKill: disabling static %1 and setting its delete time",_veh];
_veh setDamage 1;
_veh setVariable["blck_deleteAtTime",diag_tickTime + 60,true];
}else {
//diag_log format["_processAIKill: releasing static %1 to players and setting a default delete timer",_veh];
[_veh] call blck_fnc_releaseVehicleToPlayers; //Call this from _processAIKill
_veh setVariable["blck_DeleteAt",diag_tickTime + blck_vehicleDeleteTimer,true];
};

View File

@ -9,37 +9,29 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
//diag_log format["_fnc_handleEmptyVehicle: _this = %1",_this];
params["_veh"];
//diag_log format["_fnc_handleEmptyVehicle: vehicle %1 | count(crew _veh) = %2 | typoeOf _veh = %3 | description _veh = %4",_veh,count(crew _veh),typeOf _veh,gettext(configFile >> 'cfgWeapons' >> typeOf _veh >> 'displayName')];
if (isServer) then
{
if ({alive _x} count (crew _veh) == 0 || crew(_veh) isEqualTo []) then
{
//diag_log format["_fnc_handleEmptyVehicle: no units alive in vehicle %1",_veh, typeOf _veh,gettext (configFile >> 'cfgWeapons' >> typeOf _veh >> 'displayName')];
// TODO: Make sure this variable is properly set on all vehicles.
if (_veh getVariable["GRG_vehType","none"] isEqualTo "emplaced") then
{
//diag_log format["_fnc_handleEmptyVehicle: emplaced weapon %1 being handled",_veh];
if (blck_killEmptyStaticWeapons) then
{
//diag_log format["_fnc_handleEmptyVehicle: disabling static %1 and setting its delete time",_veh];
_veh setDamage 1;
_veh setVariable["blck_deleteAtTime",diag_tickTime + 60,true];
}else {
//diag_log format["_fnc_handleEmptyVehicle: releasing static %1 to players and setting a default delete timer",_veh];
[_veh] call blck_fnc_releaseVehicleToPlayers; //Call this from _processAIKill
_veh setVariable["blck_deleteAtTime",diag_tickTime + blck_vehicleDeleteTimer,true];
};
} else {
if (blck_killEmptyAIVehicles) then
{
//diag_log format["_fnc_handleEmptyVehicle: disabling vehicle %1 and setting a delete time",_veh];
_veh setDamage 0.7;
_veh setFuel 0;
_veh setVariable["blck_deleteAtTime",diag_tickTime + 60];
} else {
//diag_log format["_fnc_handleEmptyVehicle: releasing vehicle %1 to players and setting a default delete timer",_veh];
_veh setVariable["blck_deleteAtTime",diag_tickTime + blck_vehicleDeleteTimer,true];
[_veh] call blck_fnc_releaseVehicleToPlayers;
};

View File

@ -9,18 +9,6 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
/*
this addEventHandler ["GetOut", {
params ["_vehicle", "_role", "_unit", "_turret"];
}];
vehicle: Object - Vehicle the event handler is assigned to
role: String - Can be either "driver", "gunner" or "cargo"
unit: Object - Unit that left the vehicle
Introduced with Arma 3 version 1.36
turret: Array - turret path
*/
//diag_log format["_fnc_handleAIgetOut: _this = %1",_this];
#define veh _this select 0
if ((isServer) || local (veh)) then {[veh] call blck_fnc_checkForEmptyVehicle};

View File

@ -8,46 +8,16 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
/*
_loadVehicleCrew
Expects the group has units and they are configured
*/
if (isNil "blck_blacklisted_vehicle_weapons") then {blck_blacklisted_vehicle_weapons = []};
params["_veh","_group",["_crewCount",4]];
private _units = units _group;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_loadVehicleCrew: _veh = %1 | _group = %2 | group units = %4 | _crewCount = %3",_veh,_group,_crewCount, units _group];
};
#endif
for "_i" from 1 to _crewCount do
{
if (_units isEqualTo []) exitWith {};
_crew = _units deleteAt 0;
/*
Note that in documentation for the moveinAny command the order seats are filled is:
driver
commander
gunner
other turrets
cargo
https://community.bistudio.com/wiki/moveInAny
*/
_crew moveInAny _veh;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_loadVehicleCrew: loaded unit %1 into vehicle %2",_crew,_veh];
diag_log format["_fnc_loadVehicleCrew: new crew for vehicle %1 = %2",_veh, crew _veh];
};
#endif
};
{deleteVehicle _x} forEach _units;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_loadVehicleCrew: _veh = %1 | crew = %2 | driver = %3",_veh,crew _veh,driver _veh];
};
#endif

View File

@ -11,19 +11,16 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private ["_veh","_killer","_group","_wp"];
//diag_log format["_fnc_processAIVehicleKill: _this = %1",_this];
params["_veh","_killer","_killer"];
//params["_veh","_killer"];
params["_veh","_killer","_killer"];
{
_veh removealleventhandlers _x;
} forEach ["GetIn","GetOut","fired","hit","hitpart","reloaded","dammaged","HandleDamage"];
{
_veh removeAllMPEventHandlers _x;
} forEach ["MPHit","MPKilled"];
//diag_log format["_fnc_processAIVehicleKill: _this = %1",_this];
//diag_log format["_fnc_processAIVehicleKill:: _veh = %1 and _killer = %2 units damage is %3",_veh,_killer, damage _veh];
if (!(isPlayer _killer)) exitWith {};

View File

@ -9,11 +9,10 @@
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
// assummptions: since this is called after an AI Killed event that always runs on the server we can assume this code will too.
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_veh"];
//diag_log format["_fnc_releaseVehicleToPlayers: _veh = %1",_veh];
[_veh] call blck_fnc_unlockVehicle;
{
_veh removealleventhandlers _x;

View File

@ -19,9 +19,9 @@ _nearbyPlayers = [position _vehicle, _vehicle getVariable["blck_vehicleSearchRan
_cansee = [objNull, "VIEW"] checkVisibility [eyePos _x, _player];
if (_cansee > 0) then
{
//_knowledgeGained = (_searchRadius - (_x distance _groupLeader))/_searchRadius;
_knowledgeGained = (_searchRadius - (_x distance _groupLeader))/_searchRadius;
_knowsAbout = _x knowsAbout _player;
_groupLeader reveal [_x, _knowsAbout + _kno_canseewledgeGained];
_groupLeader reveal [_x, _knowsAbout + _knowledgeGained];
};
}foreEach crew _vehicle;
};

View File

@ -10,13 +10,10 @@ _pilot = (units _grpPilot) select 0;
_heli = vehicle _pilot;
diag_log "reinforcements deployed:: send heli back to spawn";
[[_heli], 300 /* 5 min*/] spawn blck_fnc_addObjToQue;
// select a random location abotu 2K from the mission
_spawnVector = round(random(360));
_spawnDistance = 2000;
_pos = getPos _heli;
// Use the new functionality of getPos
// https://community.bistudio.com/wiki/getPos
_home = _pos getPos [_spawnDistance,_spawnVector];
// Send the heli back to base
@ -31,6 +28,4 @@ _grpPilot = group this;
[_grpPilot,0] setWaypointTimeout [0.5,0.5,0.5];
diag_log "reinforcements:: sending Heli Home";

View File

@ -14,23 +14,10 @@
private["_veh"];
params["_vehType","_pos",["_crewCount",4]];
#ifdef blck_debugMode
if (blck_debugLevel > 1) then {diag_log format["spawnVehicle.sqf: _vehType = %1 | _pos = %2",_vehType,_pos];};
#endif
private _veh = [_vehType,_pos] call blck_fnc_spawnVehicle;
_veh setVariable["blck_vehicleSearchRadius",blck_playerDetectionRangeSurfaceVehicle];
_veh setVariable["blck_vehiclePlayerDetectionOdds",blck_vehiclePlayerDetectionOdds];
#ifdef blck_debugMode
if (blck_debugLevel > 1) then {diag_log format["spawnVehicle.sqf:: vehicle spawned is %1",_veh];};
#endif
// params["_veh",["_clearInventory",true]];
[_veh,_clearInventory] call blck_fnc_configureMissionVehicle;
//[_veh,_group,_crewCount] call blck_fnc_loadVehicleCrew;
#ifdef blck_debugMode
if (blck_debugLevel > 1) then {diag_log format["spawnVehicle:: returning parameter _veh = %1",_veh];};
#endif
_veh

View File

@ -21,8 +21,6 @@ if (_backpacks isEqualTo []) then {_backpacks = [_skillAI] call blck_fnc_sele
if (_weaponList isEqualTo []) then {_weaponList = [_skillAI] call blck_fnc_selectAILoadout};
if (_sideArms isEqualTo []) then {[_skillAI] call blck_fnc_selectAISidearms};
// params["_pos", "_center", ["_numai1",5], ["_numai2",10], ["_skillLevel","red"], ["_minDist",30], ["_maxDist",45],["_configureWaypoints",true], ["_uniforms",[]],
//["_headGear",[]],["_vests",[]],["_backpacks",[]],["_weaponList",[]],["_sideArms",[]], ["_scuba",false]];
switch (toLower(_skillAI)) do
{
case "blue": {_minDist = 150;_maxDist = blck_maxPatrolRadiusHelisBlue};
@ -48,13 +46,6 @@ if !(isNull _grpPilot) then
_grpPilot setVariable["arc",0];
_grpPilot setVariable["wpRadius",0];
_grpPilot setVariable["wpMode","SAD"];
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionHeli - max radii are: blue %1 | red %2 | green %3 | orange %4",blck_maxPatrolRadiusHelisBlue,blck_maxPatrolRadiusHelisRed,blck_maxPatrolRadiusHelisGreen,blck_maxPatrolRadiusHelisOrange];
diag_log format["_fnc_spawnMissionHeli(59): _skillAI = %1 | _minDist = %2 | _maxDist = %3",_skillAI,_minDist,_maxDist];
};
#endif
#define aircraftPatrolRadius 800
#define aircraftWaypointTimeout [1,1.5,2]
@ -68,52 +59,17 @@ if !(isNull _grpPilot) then
} else {
_chopperType = _helis
};
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnMissionHeli(59): _skillAI = %1 | _minDist = %2 | _maxDist = %3",_skillAI,_minDist,_maxDist];
diag_log format["_fnc_spawnMissionHeli (78):: _chopperType selected = %1",_chopperType];
};
#endif
//_patrolHeli = createVehicle [_chopperType, _coords, [], 90, "FLY"];
_patrolHeli = [_chopperType,_coords,"FLY"] call blck_fnc_spawnVehicle;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionHeli (75): _patrolHeli = %1 | getPosATL _patrolHeli = %2",_patrolHeli,getposATL _patrolHeli];
};
#endif
[_patrolHeli,2] call blck_fnc_configureMissionVehicle;
//_patrolHeli setVariable["blck_vehicle",true];
_patrolHeli setVariable["blck_vehicleSearchRadius",blck_playerDetectionRangeAir];
_patrolHeli setVariable["blck_vehiclePlayerDetectionOdds",blck_vehiclePlayerDetectionOdds];
//_patrolHeli addEventHandler["GetOut",{_this remoteExec["blck_EH_vehicleGetOut",2]}];
//[_patrolHeli] call blck_fnc_protectVehicle;
_patrolHeli setFuel 1;
_patrolHeli engineOn true;
_patrolHeli flyInHeight 100;
//_patrolHeli setVehicleLock "LOCKED";
// params["_veh","_group",["_crewCount",4]];
[_patrolHeli,_grpPilot,_crewCount] call blck_fnc_loadVehicleCrew;
#ifdef blck_debugMode
if (blck_debugLevel > 1) then
{
diag_log format["_fnc_spawnMissionHeli (93):: heli %1 spawned with crew count of %2 | desired crew count = %3",_patrolHeli,count(crew _patrolHeli),_crewCount];
diag_log format["_fnc_spawnMissionHeli (89): _patrolHeli = %1 | getPosATL _patrolHeli = %2 | driver _patrolHeli = %4",_patrolHeli,getposATL _patrolHeli,driver _patrolHeli];
diag_log format["_fnc_spawnMissionHeli (133)::-->> Heli %1 outfited with a crew numbering %2",_patrolHeli, crew _patrolHeli];
};
#endif
};
//diag_log format["[blckeagls] _fnc_spawnMissionHeli:: _patrolHeli %1 | _grpPilot %2 | _abort %3",_patrolHeli,_grpPilot,_abort];
_return = [_patrolHeli,units _grpPilot,_abort];
#ifdef blck_debugMode
if (blck_debugLevel > 0) then
{
diag_log format["_fnc_spawnMissionHeli:: function returning value for _return of %1",_return];
};
#endif
_return;

View File

@ -24,75 +24,32 @@ _noPara = 0;
_aborted = false;
if (_skillAI isEqualTo "blue") then {
#ifdef blck_debugMode
if (blck_debugON) then {diag_log "_fnc_spawnMissionParatroops: BLUE difficulty settings applied";};
#endif
_chanceParatroops = blck_chanceParaBlue;
_noPara = blck_noParaBlue;
};
if (_skillAI isEqualTo "green") then {
#ifdef blck_debugMode
if (blck_debugON) then {diag_log "_fnc_spawnMissionParatroops: GREEN difficulty settings applied";};
#endif
_chanceParatroops = blck_chanceParaGreen;
_noPara = blck_noParaGreen;
};
if (_skillAI isEqualTo "orange") then {
#ifdef blck_debugMode
if (blck_debugON) then {diag_log "_fnc_spawnMissionParatroops: ORANGE difficulty settings applied";};
#endif
_chanceParatroops = blck_chanceParaOrange;
_noPara = blck_noParaOrange;
};
if (_skillAI isEqualTo "red") then {
#ifdef blck_debugMode
if (blck_debugON) then {diag_log "_fnc_spawnMissionParatroops: RED difficulty settings applied";};
#endif
_chanceParatroops = blck_chanceParaRed;
_noPara = blck_noParaRed;
};
#ifdef blck_debugMode
if (blck_debugLevel > 2) then {diag_log format["_fnc_spawnMissionParatroops (47): _chanceParatroops %1",_chanceParatroops];};
if (blck_debugLevel > 2) then {diag_log format["_fnc_spawnMissionParatroops (48): _coords %1 | _numAI %2 | _skillAI %3 | _grpParatroops %4 | _heli %5",_coords,_noPara,_skillAI,_grpParatroops,_heli];};
#endif
if ( (random(1) < _chanceParatroops)) then
{
if (isNull _grpParatroops) then
{
_grpParatroops = createGroup blck_AI_Side;
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionParatroops (53):No group passed as a parameter, _grpParatroops %4 created",_grpParatroops];
};
#endif
};
#ifdef blck_debugMode
if (blck_debugLevel > 2) then
{
diag_log format["_fnc_spawnMissionParatroops (58): function running and group %1 successfully created; now calling blck_fnc_spawnParaUnits",_grpParatroops];
};
#endif
//params["_missionPos","_paraGroup",["_numAI",3],"_skillAI","_weapons","_uniforms","_headGear",["_heli",objNull]];
_aborted = [_coords,_grpParatroops,_noPara,_skillAI,_weapons,_uniforms,_headGear,_heli] call blck_fnc_spawnParaUnits;
//diag_log format["_fnc_spawnMissionParatroops: blck_fnc_spawnParaUnits returned a value of %1",_aborted];
};
#ifdef blck_debugMode
diag_log format["_fnc_spawnMissionParatroops: _aborted = %1",_aborted];
#endif
if (_aborted) then
{
_return = [[],true];
@ -100,9 +57,5 @@ if (_aborted) then
_return = [(units _grpParatroops),false];
};
#ifdef blck_debugMode
diag_log format["_fnc_spawnMissionParatroops:-> _return = %1 | _abort = %2",_return,_aborted];
#endif
_return

Some files were not shown because too many files have changed in this diff Show More