Merge branch 'Experimental'

This commit is contained in:
Chris Cardozo 2020-10-10 08:43:45 -04:00
commit 571a65f1e9
62 changed files with 988 additions and 476 deletions

View File

@ -21,10 +21,11 @@ switch (toLower worldName) do
case "taviana": {_mapCenter = [12000,12000,0];_maxDistance = 12000};
case "napf" : {_mapCenter = getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition");_maxDistance = 12000};
case "lythium": {_mapCenter = [10000,10000,0]; _maxDistance = 6000;};
case "vt7": {_mapCenter = [9000,9000,0]; _maxDistance = 9000};
default {_mapCenter = [6000,6000,0]; _maxDistance = 6000;};
};
_evaluate = true;
private _evaluate = true;
while {_evaluate} do
{
_waterPos = [
@ -35,33 +36,14 @@ _evaluate = true;
2, // water mode [2 = water only]
25, // max gradient
0 // shoreMode [0 = anywhere]
] call BIS_fnc_findSafePos;
/*
_priorUMSpositions = +blck_priorDynamicUMS_Missions;
] call BIS_fnc_findSafePos;
if (((getTerrainHeightASL _waterPos) < -4) && (getTerrainHeightASL _waterPos) > -10) then
{
if (diag_tickTime > ((_x select 1) + 1800) then
{
blck_priorDynamicUMS_Missions = blck_priorDynamicUMS_Missions - _x;
} else {
if (_waterPos distance2D (_x select 0) < 2000) exitWith {_evaluate = false};
};
} forEach _priorUMSpositions;
*/
if (_evaluate) then
{
if (abs(getTerrainHeightASL _waterPos) < 30) then
{
if (abs(getTerrainHeightASL _waterPos) > 1) then
{
//_waterMarker = createMarker [format["water mission %1",getTerrainHeightASL _waterPos],_waterPos];
//_waterMarker setMarkerColor "ColorRed";
//_waterMarker setMarkerType "mil_triangle";
//_waterMarker setMarkerText format["Depth %1",getTerrainHeightASL _waterPos];
_evaluate = false;
};
};
_evaluate = false;
};
};
//diag_log format["_findShoreLocation: _waterPos = %1",_waterPos];
_waterPos

View File

@ -15,7 +15,7 @@ if (toLower(blck_modType) isEqualTo "default") exitWith {};
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 (blck_debugLevel >= 3) then {[format["_fnc_addmoneyToObject: _money = %1 _obj = %2",_money,_obj]] call blck_fnc_log};
if !(_money <= 0) then
{
switch(toLower(blck_modType)) do

View File

@ -12,7 +12,7 @@ for "_i" from 1 to (count blck_temporaryMarkers) do
{
if (_i > (count blck_temporaryMarkers)) exitWith {};
private _m = blck_temporaryMarkers deleteAt 0;
_m params["_marker","_deleteAt"];
_m params[["_marker",""],["_deleteAt",0]];
if (diag_tickTime > _deleteAt) then
{
deleteMarker _marker;

View File

@ -99,6 +99,7 @@ while { !_validspot} do
_count = _count - 1;
_slope = _slope + 0.02;
uiSleep 0.1; // to give the server a chance to handle other jobs for a moment
diag_log format["_findSafePosn: _count = %1 | _slope = %2 | _coords = %3",_count,_slope,_coords];
} else {
//uiSleep 1;
@ -175,6 +176,7 @@ while { !_validspot} do
};
};
//diag_log format["_fnc_findSafePosn: _coords = %1 | _flatCoords = %2 | _searchCenter = %3 | _angle %4 | _count = %5 | _validSpot = %6",_coords,_flatCoords,_searchCenter,_angle,_count,_validspot];
};

View File

@ -0,0 +1,179 @@
// self explanatory. Checks to see if the position is in either a black listed location or near a player spawn.
// As written this relies on BIS_fnc_findSafePos to ensure that the spawn point is not on water or an excessively steep slope.
//
/*
for ghostridergaming
By Ghostrider [GRG]
Copyright 2016
--------------------------
License
--------------------------
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
http://creativecommons.org/licenses/by-nc-sa/4.0/
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private _startTime = diag_tickTime;
private _minDistFromBases = blck_minDistanceToBases;
private _minDistFromMission = blck_MinDistanceFromMission;
private _minDistanceFromTowns = blck_minDistanceFromTowns;
private _minDistanceFromPlayers = blck_minDistanceToPlayer;
private _weightBlckList = 0.95;
private _weightBases = 0.9;
private _weightMissions = 0.8;
private _weightTowns = 0.7;
private _weightPlayers = 0.6;
private _weightRecentMissions = 0.6;
private _minDistanceRecentMissions = 500;
// remove any recent mission locations that have timed out
for "_i" from 1 to (count blck_recentMissionCoords) do
{
if (_i > (count blck_recentMissionCoords)) exitWith {};
private _oldMission = blck_recentMissionCoords deleteAt 0;
if (diag_tickTime < ((_oldMission select 1) + 900)) then
{
blck_recentMissionCoords pushBack _oldMission;
};
};
private _waterMode = 0;
private _shoreMode = 0;
private _maxGrad = 0.20;
private _minObjDist = 30;
private _searchDist = blck_mapRange / 2;
private _coords = [];
private _findNew = true;
private _tries = 0;
while {_coords isEqualTo []} do
{
_findNew = false;
_coords = [];
// [center, minDist, maxDist, objDist, waterMode, maxGrad, shoreMode, blacklistPos, defaultPos] call BIS_fnc_findSafePos
while {_coords isEqualTo [] && _tries < 500} do
{
private _searchCenter = blck_mapCenter getPos[_searchDist, random(359)];
_coords = [_searchCenter,0,_searchDist,_minObjDist,_waterMode,_maxGrad,_shoreMode] call BIS_fnc_findSafePos;
_tries = _tries + 1;
//[format["_fnc_findSafePosn(57): _tries = %1 | _coords = %2",_tries,_coords]] call blck_fnc_log;
};
{
//diag_log format["_fnc_findSafePosn(67): _recentMissionCoords %1 = %2",_forEachIndex,_x];
if (((_x select 0) distance2D _coords) < _minDistanceRecentMissions) then
{
_findNew = true;
if (blck_debugLevel >= 3) then {[format["_findSafePosn(68): too close to recent missions"]] call blck_fnc_log};
};
}forEach blck_recentMissionCoords;
//diag_log format["_fnc_findSafePosn (61): _coords = %1 | _tries = %2 | count blck_locationBlackList = %1",_coords,_tries, count blck_locationBlackList];
{
//diag_log format["_fnc_findSafePosn (77): location _x = %1",_x];
if ( ((_x select 0) distance2D _coords) < (_x select 1)) exitWith
{
_findNew = true;
if (blck_debugLevel >= 3) then {[format["_findSafePosn(77): too close to blacklisted position _coords = %1 | blacklisted pos = %2 | dist to blacklisted pos = %3",_coords,_x select 0, _x select 1]] call blck_fnc_log};
};
} forEach blck_locationBlackList;
if !(_findNew) then
{
{
if ( (_x distance2D _coords) < _minDistFromMission) exitWith
{
_findNew = true;
if (blck_debugLevel >= 3) then {[format["_findSafePosn(87): too close to active mission"]] call blck_fnc_log};
};
} forEach blck_ActiveMissionCoords;
};
if !(_findNew) then
{
private _poles = [];
if (blck_modType isEqualTo "Epoch") then {_poles = allMissionObjects "PlotPole_EPOCH"};
if (blck_modType isEqualTo "Exile") then {_poles = allMissionObjects "Exile_Construction_Flag_Static"};
//diag_log format["_fnc_findSafePosn: count _poles = %1 | _poles = %2",count _poles,_poles];
{
if ((_x distance2D _coords) < blck_minDistanceToBases) then
{
_findNew = true;
if (blck_debugLevel >= 3) then {[format["_findSafePosn(98): too close to bases"]] call blck_fnc_log};
};
}forEach _poles;
};
if !(_findNew) then
{
{
_townPos = [((locationPosition _x) select 0), ((locationPosition _x) select 1), 0];
if (_townPos distance2D _coords < blck_minDistanceFromTowns) exitWith {
_findNew = true;
if (blck_debugLevel >= 3) then {[format["_findSafePosn(109): too close to towns/cities"]] call blck_fnc_log};
};
} forEach blck_townLocations;
};
if !(_findNew) then
{
{
if (isPlayer _x && (_x distance2D _coords) < blck_minDistanceToPlayer) then
{
_findNew = true;
if (blck_debugLevel >= 3) then {[format["_findSafePosn(120): too close to player"]] call blck_fnc_log};
};
}forEach playableUnits;
};
if !(_findNew) then
{
// test for water nearby
for [{_i=0}, {_i<360}, {_i=_i+20}] do
{
//_xpos = (_coords select 0) + sin (_i) * _dist;
//_ypos = (_coords select 1) + cos (_i) * _dist;
//_newPos = [_xpos,_ypos,0];
if (surfaceIsWater (_coords getPos[50,_i])) exitWith
{
_findNew = true;
if (blck_debugLevel >= 3) then {[format["_findSafePosn(137): too close to water"]] call blck_fnc_log};
};
};
};
if !(_findNew) then {
_isflat = _coords isFlatEmpty [20,0,0.5,100,0,false];
if (_isflat isequalto []) then {
_findNew = true;
if (blck_debugLevel >= 3) then {[format["_findSafePosn(146): position NOT flat"]] call blck_fnc_log};
} else {
if (blck_debugLevel >= 3) then {[format["_findSafePosn(150): _coords changed from %1 to %2 (the flattest)",_coords,_isFlat]] call blck_fnc_log};
_coords = ASLToATL _isFlat;
};
};
if (_findNew) then
{
_minDistFromMission = _minDistFromMission * _weightMissions;
_minDistFromBases = _minDistFromBases * _weightBases;
_minDistanceFromPlayers = _minDistanceFromPlayers * _weightPlayers;
_minDistanceFromTowns = _minDistanceFromTowns * _weightTowns;
_minDistanceRecentMissions = _minDistanceRecentMissions * _weightRecentMissions;
_coords = [];
};
[format["_fnc_findSafePosn(140) end of cycle logging: _tries = %1 | _coords = %2 | _findNew = %3",_tries,_coords,_findNew]] call blck_fnc_log;
};
if ((count _coords) > 2) then
{
private["_temp"];
_temp = [_coords select 0, _coords select 1];
_coords = _temp;
};
[format["_fnc_findSafePosn(148) final logging: _elapsedTime %3 | _tries = %1 | _coords = %2",_tries,_coords,diag_tickTime - _startTime]] call blck_fnc_log;
_coords;

View File

@ -11,27 +11,32 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
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;
_timer2sec = diag_tickTime + 2;
_timer5sec = diag_tickTime + 5;
_timer10Sec = diag_tickTime + 10;
_timer20sec = diag_tickTime + 20;
_timer1min = diag_tickTime + 10;
_timer5min = diag_tickTime + 300;
while {true} do
{
uiSleep 1;
if (diag_tickTime > _timer1sec) then
if (diag_tickTime > _timer2sec) then
{
[] spawn blck_fnc_monitorInitializedMissions;
//if !(blck_initializationInProgress) then
[] spawn blck_fnc_monitorInitializedMissions;
if (blck_showCountAliveAI) then
{
{
_x call blck_fnc_updateMarkerAliveCount;
} forEach blck_missionLabelMarkers;
};
_timer1sec = diag_tickTime + 1;
_timer2sec = diag_tickTime + 2;
};
if (diag_tickTime > _timer5sec) then
{
_timer5sec = diag_tickTime + 5;
@ -46,18 +51,16 @@ while {true} do
{
[] call blck_fnc_spawnPendingMissions;
_timer10Sec = diag_tickTime;
};
if (diag_tickTime > _timer20sec) then
{
[] call blck_fnc_scanForPlayersNearVehicles;
[] call GMS_fnc_cleanupTemporaryMarkers;
[] call GMS_fnc_updateCrateSignals;
_timer20sec = diag_tickTime + 20;
};
if ((diag_tickTime > _timer1min)) then
{
_timer1min = diag_tickTime + 60;
_timer1min = diag_tickTime + 10;
[] call blck_fnc_restoreHiddenObjects;
[] call blck_fnc_groupWaypointMonitor;
[] call blck_fnc_cleanupAliveAI;
[] call blck_fnc_cleanupObjects;
@ -68,15 +71,29 @@ while {true} do
};
if (diag_tickTime > _timer5min) then
{
[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]
_activeScripts = diag_activeScripts;
[
format["Timstamp %8 |Dynamic Missions Running %1 | Vehicles %2 | Groups %3 | Missions Run %4 | Server FPS %5 | Server Uptime %6 Min",
blck_missionsRunning,
count blck_monitoredVehicles,
count blck_monitoredMissionAIGroups,
blck_missionsRun,
diag_FPS,floor(diag_tickTime/60),
diag_tickTime
]
] call blck_fnc_log;
[
format["count diag_activeSQFScripts %1 | Threads [spawned %2, execVM %3] | monitorThreads %4",
count diag_activeSQFScripts,
_activeScripts select 0,
_activeScripts select 1,
blck_activeMonitorThreads
]
] call blck_fnc_log;
{
[format["file %1 | running %2",(_x select 1),(_x select 2)]] call blck_fnc_log;
} forEach diag_activeSQFScripts;
[] call blck_fnc_cleanEmptyGroups;
_timer5min = diag_tickTime + 300;
};

View File

@ -0,0 +1,25 @@
/*
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";
for "_i" from 1 to (count blck_hiddenTerrainObjects) do
{
if (_i > (count blck_hiddenTerrainObjects)) exitWith {};
private _el = blck_hiddenTerrainObjects deleteAt 0;
_el params["_obj","_timeout"];
if (diag_tickTime > _timeOut) then
{
{_x hideObjectGlobal false} forEach _obj;
} else {
blck_hiddenTerrainObjects pushBack _el;
};
};

View File

@ -19,13 +19,16 @@
for "_i" from 1 to (count blck_oldMissionObjects) do {
if (_i <= count blck_oldMissionObjects) then {
private _oldObjs = blck_oldMissionObjects deleteAt 0;
_oldObjs params ["_missionCenter","_objarr","_timer"];
_oldObjs params [["_missionCenter",[0,0,0]],["_objarr",[]],["_timer",0]];
if (diag_tickTime > _timer) then
{
private _nearplayer = [_missionCenter,800] call blck_fnc_nearestPlayers;
if (_nearPlayer isEqualTo []) then
{
{deleteVehicle _x}forEach _objarr;
{
if (typeName _x isEqualTo "OBJECT") then {deleteVehicle _x};
if (typeName _x isEqualTo "STRING") then {deleteVehicle (objectFromNetId _x)};
} forEach _objarr;
} else {
blck_oldMissionObjects pushback _oldObjs;
};

View File

@ -15,9 +15,11 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp"
_fn_missionCleanup = {
params["_coords","_mines","_objects","_blck_AllMissionAI","_markerName","_cleanupAliveAITimer","_cleanupCompositionTimer",["_isScubaMission",false]];
params["_coords","_mines","_objects","_hiddenObjects","_blck_AllMissionAI","_markerName","_cleanupAliveAITimer","_cleanupCompositionTimer",["_isScubaMission",false]];
[_mines] call blck_fnc_clearMines;
blck_oldMissionObjects pushback [_coords,_objects, (diag_tickTime + _cleanupCompositionTimer)];
blck_hiddenTerrainObjects pushBack[_hiddenObjects,(diag_tickTime + _cleanupCompositionTimer)];
blck_liveMissionAI pushback [_coords,_blck_AllMissionAI, (diag_tickTime + _cleanupAliveAITimer)];
blck_missionsRunning = blck_missionsRunning - 1;
blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords];
@ -42,6 +44,7 @@ params[
"_coords",
"_mines",
"_objects",
"_hiddenObjects",
"_crates",
"_blck_AllMissionAI",
"_endMsg",
@ -68,13 +71,13 @@ switch (_endCondition) do
if (local _x) then {deleteVehicle _x};
}forEach _crates;
[_coords,_mines,_objects,_blck_AllMissionAI,_markerName,cleanupAliveAITimer,cleanupCompositionTimer,_isScubaMission] call _fn_missionCleanup;
[_coords,_mines,_objects,_hiddenObjects,_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;
};
case 1: { // Normal End
if (blck_useSignalEnd) then
{
[_crates select 0] spawn blck_fnc_signalEnd;
[_crates select 0,150] spawn blck_fnc_signalEnd;
{
_x enableRopeAttach true;
}forEach _crates;
@ -102,7 +105,7 @@ switch (_endCondition) do
};
} forEach _vehicles;
[_coords,_mines,_objects,_blck_AllMissionAI,_markerName,blck_AliveAICleanUpTimer,blck_cleanupCompositionTimer,_isScubaMission] call _fn_missionCleanup;
[_coords,_mines,_objects,_hiddenObjects,_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
@ -112,7 +115,7 @@ switch (_endCondition) do
} 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;
[_coords,_mines,_objects,_hiddenObjects,_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
@ -123,7 +126,7 @@ switch (_endCondition) do
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;
[_coords,_mines,_objects,_hiddenObjects,_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;
};
@ -135,7 +138,17 @@ switch (_endCondition) do
if (local _x) then {deleteVehicle _x};
}forEach _crates;
[_coords,_mines,_objects,_blck_AllMissionAI,_markerName,cleanupAliveAITimer,cleanupCompositionTimer,_isScubaMission] call _fn_missionCleanup;
[_coords,_mines,_objects,_hiddenObjects,_blck_AllMissionAI,_markerName,cleanupAliveAITimer,cleanupCompositionTimer,_isScubaMission] call _fn_missionCleanup;
};
case 5: {
#define cleanupCompositionTimer 0
#define cleanupAliveAITimer 0
{
if (local _x) then {deleteVehicle _x};
}forEach _crates;
[_coords,_mines,_objects,_hiddenObjects,_blck_AllMissionAI,_markerName,cleanupAliveAITimer,cleanupCompositionTimer,_isScubaMission] call _fn_missionCleanup;
};
};

View File

@ -40,7 +40,7 @@ if !(isNull _group) then
_building = createVehicle[_bldClassName,[0,0,0],[],0,"CAN_COLLIDE"];
_building setPosATL (_bldRelPos vectorAdd _center);
_building setDir _bldDir;
_buildingsSpawned pushBack _building;
_buildingsSpawned pushBack (netID _building);
_staticsSpawned = [_building,_group,_statics,_men,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,"none",_weaponList,_sideArms] call blck_fnc_spawnGarrisonInsideBuilding_ATL;
}forEach _garrisonedBuilding_ATLsystem;
};

View File

@ -22,6 +22,10 @@ params["_center",
["_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};
@ -36,13 +40,27 @@ if !(isNull _group) then
{
{
// ["Land_Unfinished_Building_02_F",[-21.8763,-45.978,-0.00213432],0,true,true,0.67,3,[],4],
_x params["_bldClassName","_bldRelPos","_bldDir","_s","_d","_p","_noStatics","_typesStatics","_noUnits"];
if (_typesStatics isEqualTo []) then {_typesStatics = ["B_HMG_01_high_F"]};
_x params["_bldClassName","_bldRelPos","_bldDir","_allowDamage","_enableSimulation","_probabilityOfGarrision","_noStatics","_typesStatics","_noUnits"];
if (_typesStatics isEqualTo []) then {_typesStatics = blck_staticWeapons};
_building = createVehicle[_bldClassName,[0,0,0],[],0,"CAN_COLLIDE"];
_buildingsSpawned pushBack _building;
_buildingsSpawned pushBack (netID _building);
_building setPosATL (_bldRelPos vectorAdd _center);
[_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;
_staticsSpawned = [
_building,
_group,
_noStatics,
_typesStatics,
_noUnits,
_aiDifficultyLevel,
_uniforms,
_headGear,
_vests,
_backpacks,
"none",
_weaponList,
_sideArms
] call blck_fnc_spawnGarrisonInsideBuilding_relPos;
}forEach _garrisonedBuilding_relPosSystem;
};
_return = [_group,_buildingsSpawned,_staticsSpawned];

View File

@ -7,7 +7,7 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private ["_coords","_coordArray","_return"];
params["_missionCategoryDescriptors","_missionParameters"];
params["_missionCategoryDescriptors","_missionParameters","_missionCount"];
_missionCategoryDescriptors params [
"_difficulty",
"_noMissions", // Max no missions of this category
@ -50,9 +50,11 @@ _missionParameters params[
"_garrisonedBuildings_BuildingPosnSystem",
"_garrisonedBuilding_ATLsystem",
"_missionLandscape",
"_simpleObjects",
"_missionLootBoxes",
"_missionLootVehicles",
"_missionPatrolVehicles",
"_submarinePatrols",
"_submarinePatrolParameters",
"_airPatrols",
"_noVehiclePatrols",
@ -64,6 +66,7 @@ _missionParameters params[
"_maxNoAI",
"_noAIGroups",
"_missionGroups",
"_scubaPatrols",
"_scubaGroupParameters",
"_hostageConfig",
"_enemyLeaderConfig",
@ -100,15 +103,17 @@ if !(_defaultMissionLocations isEqualTo []) then
_coords = [] call blck_fnc_findShoreLocation;
} else {
_coords = [] call blck_fnc_findSafePosn;
};
};
if (_coords isEqualTo []) exitWith
{
[format["No Safe Mission Spawn Position Found to spawn Mission %1",_markerMissionName],'warning'] call blck_fnc_log;
false;
};
if (blck_debugLevel >= 3) then {diag_log format["_fnc_initializeMission: _markerMissionName = %1 | _coords = %2",_markerMissionName,_coords]};
blck_ActiveMissionCoords pushback _coords;
blck_missionsRunning = blck_missionsRunning + 1;
@ -141,17 +146,37 @@ if (blck_debugLevel >= 3) then
"_markerBrush"
];
};
private _markers = [_markerName,_markerPos,_markerMissionName,_markerColor,_markerType,_markerSize,_markerBrush] call blck_fnc_createMissionMarkers;
if !(toLower (_markerType) in ["ellipse","rectangle"] || isClass(configFile >> "CfgMarkers" >> _markerType)) then
{
[format["_markerType set to 'ELLIPSE': Illegal marker type %1 used for mission %2 of difficulty %3",_markerType,_markerMissionName,_difficulty],"warning"] call blck_fnc_log;
_markerType = "ELLIPSE";
_markerSize = [200,200];
_markerBrush = "SOLID";
_markerMissionName = "Invalid Marker Parameters";
_missionParameters set [1,_markerMissionName];
};
if !(isClass(configFile >> "CfgMarkerColors" >> _markerColor)) then
{
[format["_markerColor set to 'default': Illegal color %1 used for mission %2 of difficulty %3",_markerColor,_markerMissionName,_difficulty],"warning"] call blck_fnc_log;
_markerColor = "DEFAULT";
_markerMissionName = "Invalid Marker Parameters";
_missionParameters set [1,_markerMissionName];
};
private _markers = [format["%1:%2",_markerName,_missionCount],_markerPos,_markerMissionName,_markerColor,_markerType,_markerSize,_markerBrush] call blck_fnc_createMissionMarkers;
if (blck_debugLevel >= 3) then {[format["_initializeMissions (167): _marker = %1 | _markerMissionName = %2 | _difficulty = %3",_markers,_markerMissionName,_difficulty]] call blck_fnc_log};
/*
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};
private _objects = [];
private _hiddenObjects = [];
private _mines = [];
private _crates = [];
private _missionAIVehicles = [];
@ -159,9 +184,12 @@ private _blck_AllMissionAI = [];
private _AI_Vehicles = [];
private _assetSpawned = objNull;
private _missionData = [_coords,_mines,_objects,_crates, _blck_AllMissionAI,_assetSpawned,_missionAIVehicles,_markers];
private _missionData = [_coords,_mines,_objects,_hiddenObjects,_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;
if (blck_debugON) then
{
[format["Mission Marker = %1 | Marker Position = %2 | _coords = %3",_markers,_markerPos,_coords]] call blck_fnc_log;
};
true

View File

@ -15,9 +15,10 @@
#define delayTime 1
private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_assetKilledMsg","_enemyLeaderConfig",
"_AI_Vehicles","_timeOut","_aiDifficultyLevel","_missionPatrolVehicles","_missionGroups","_loadCratesTiming","_spawnCratesTiming","_assetSpawned","_hostageConfig",
"_chanceHeliPatrol","_noPara","_chanceLoot","_heliCrew","_loadCratesTiming","_useMines","_blck_AllMissionAI","_delayTime","_groupPatrolRadius",
"_chanceHeliPatrol","_noPara","_chanceLoot","_heliCrew","_loadCratesTiming","_useMines","_blck_AllMissionAI","_delayTime","_groupPatrolRadius","_simpleObjects",
"_wait","_missionStartTime","_playerInRange","_missionTimedOut","_temp","_patrolVehicles","_vehToSpawn","_noChoppers","_chancePara","_paraSkill","_marker","_vehicleCrewCount",
"_defaultMissionLocations","_garrisonedbuildings_buildingposnsystem","_garrisonedBuilding_ATLsystem", "_isScubaMission","_markerlabel","_missionLootBoxes","_airpatrols"];
"_defaultMissionLocations","_garrisonedbuildings_buildingposnsystem","_garrisonedBuilding_ATLsystem", "_isScubaMission","_markerlabel","_missionLootBoxes","_airpatrols",
"_submarinePatrols","_scubaPatrols"];
params["_markerName",["_aiDifficultyLevel","Red"]];
if (isNil "_markerLabel") then {_markerLabel = _markerMissionName};
@ -54,7 +55,9 @@ if (isNil "_garrisonedBuilding_ATLsystem") then {_garrisonedBuilding_ATLsystem =
if (isNil "_garrisonedBuildings_BuildingPosnSystem") then {_garrisonedBuildings_BuildingPosnSystem = []};
if (isNil "_vehicleCrewCount") then {_vehicleCrewCount = [_aiDifficultyLevel] call GMS_fnc_selectVehicleCrewCount};
if (isNil "_airpatrols") then {_airpatrols = []};
if (isNil "_submarinePatrols") then {_submarinePatrols = 0};
if (isNil "_submarinePatrolParameters") then {_submarinePatrolParameters = []};
if (isNil "_scubaPatrols") then {_scubaPatrols = 0};
if (isNil "_scubagroupparameters") then {_scubagroupparameters = []};
if (isNil "_markerMissionName") then {
diag_log format["_fnc_missionSpawner: _markerMissionName not defined, using default value"];
@ -66,6 +69,7 @@ if (isNil "_lootCratePositions") then {_lootCratePositions = []};
if (isNil "_isScubaMission") then {_isScubaMission = false};
if (isNil "_missionLootBoxes") then {_missionLootBoxes = []};
if (isNil "_defaultMissionLocations") then {_defaultMissionLocations = []};
if (isNil "_simpleObjects") then {_simpleObjects = []};
if !(_defaultMissionLocations isEqualTo []) then
{
_coords = selectRandom _defaultMissionLocations;
@ -106,9 +110,11 @@ private _table = [
_garrisonedBuildings_BuildingPosnSystem,
_garrisonedBuilding_ATLsystem,
_missionLandscape,
_simpleObjects,
_missionLootBoxes,
_missionLootVehicles,
_missionPatrolVehicles,
_submarinePatrols, // Added Build 227
_submarinePatrolParameters,
_airPatrols,
_noVehiclePatrols,
@ -120,6 +126,7 @@ private _table = [
_maxNoAI,
_noAIGroups,
_missionGroups,
_scubaPatrols, // Added Build 227
_scubaGroupParameters,
_hostageConfig,
_enemyLeaderConfig,

View File

@ -3,6 +3,13 @@
by Ghostrider-GRG-
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
#define missionData 4
#define noActive 2
#define waitTime 5
blck_activeMonitorThreads = blck_activeMonitorThreads + 1;
for "_i" from 1 to (count blck_activeMissionsList) do
{
@ -16,14 +23,10 @@ for "_i" from 1 to (count blck_activeMissionsList) do
"_missionTimeoutAt", // 1
"_triggered", // 2
"_spawnPara", // 3
"_missionData", // 6
"_missionParameters" // 7
"_missionData", // 4
"_missionParameters" // 5
];
#define noActive 2
#define waitTime 5
#define missionData 6
_missionCategoryDescriptors params [
"_difficulty",
"_noMissions", // Max no missions of this category
@ -33,11 +36,20 @@ for "_i" from 1 to (count blck_activeMissionsList) do
"_waitTime", // time at which a mission should be spawned
"_missionsData" //
];
//_missionData = [_coords,_mines,_objects,_hiddenObjects,_crates,_blck_AllMissionAI,_assetSpawned,_missionAIVehicles,_markers];
_missionData params [
"_coords",
"_mines",
"_objects",
"_hiddenObjects",
"_crates",
"_blck_AllMissionAI",
"_assetSpawned",
"_missionAIVehicles",
"_markers"
];
// 0 1 2 3 4 5 6 7 8
_missionData params ["_coords","_mines","_objects","_crates","_blck_AllMissionAI","_assetSpawned","_missionAIVehicles","_markers"];
_missionParameters params[
_missionParameters params[
"_markerName",
"_markerMissionName",
"_endMsg",
@ -53,9 +65,11 @@ _missionParameters params[
"_garrisonedBuildings_BuildingPosnSystem",
"_garrisonedBuilding_ATLsystem",
"_missionLandscape",
"_simpleObjects",
"_missionLootBoxes",
"_missionLootVehicles",
"_missionPatrolVehicles",
"_submarinePatrols",
"_submarinePatrolParameters",
"_airPatrols",
"_noVehiclePatrols",
@ -67,6 +81,7 @@ _missionParameters params[
"_maxNoAI",
"_noAIGroups",
"_missionGroups",
"_scubaPatrols",
"_scubaGroupParameters",
"_hostageConfig",
"_enemyLeaderConfig",
@ -91,7 +106,7 @@ _missionParameters params[
"_loadCratesTiming",
"_endCondition",
"_isScubaMission"
];
];
private _playerInRange = [_coords, blck_TriggerDistance, false] call blck_fnc_playerInRange;
#define delayTime 1
@ -118,12 +133,13 @@ _missionParameters params[
switch (_monitorAction) do
{
// Handle Timeout
case -1:
{
//[format["_fnc_monitorInitializedMissions: mission timed out: %1",_el]] call blck_fnc_log;
_missionCategoryDescriptors set[noActive, _noActive - 1];
[_coords,_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_markers,markerPos (_markers select 1),_markerName,_markerMissionName, -1] call blck_fnc_endMission;
[_coords,_mines,_objects,_hiddenObjects,_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
@ -158,23 +174,41 @@ _missionParameters params[
_temp = [_coords, _missionLandscape] call blck_fnc_spawnCompositionObjects;
};
_objects append _temp;
_objects append (_temp select 0);
_hiddenObjects append (_temp select 1);
uiSleep delayTime;
_temp = [_coords,_simpleObjects,true] call blck_fnc_spawnSimpleObjects;
_objects append _temp;
try {
_temp = [_coords, _minNoAI,_maxNoAI,_noAIGroups,_missionGroups,_difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionAI;
_temp = [_coords, _minNoAI,_maxNoAI,_noAIGroups,_missionGroups,_difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,_isScubaMission] call blck_fnc_spawnMissionAI;
_temp params["_ai","_abort"];
if (_abort) throw 1;
_blck_AllMissionAI append (_ai);
uiSleep delayTime;
if !(_scubaGroupParameters isEqualTo [] || _scubaPatrols > 0) then
{
//_umsUniforms = blck_UMS_uniforms;
//_umsHeadgear = blck_UMS_headgear;
//_umsWeapons = blck_UMS_weapons;
//_umsVests = blck_UMS_vests;
_temp = [_coords, _minNoAI,_maxNoAI,_scubaPatrols,_scubaGroupParameters,_difficulty,blck_UMS_uniforms,blck_UMS_headgear,blck_UMS_vests,_backpacks,blck_UMS_weapons,_sideArms,true] call blck_fnc_spawnMissionAI;
_temp params["_ai","_abort"];
if (_abort) throw 1;
_blck_AllMissionAI append (_ai);
};
uiSleep delayTime;
if !(_hostageConfig isEqualTo []) then
{
_temp = [_coords,_hostageConfig] call blck_fnc_spawnHostage;
if (_temp isEqualTo grpNull) then {throw 1} else
{
_assetSpawned = _temp select 0;
_missionData set[5,_assetSpawned];
_objects pushBack (_temp select 1);
_blck_AllMissionAI pushBack _assetSpawned;
};
@ -186,7 +220,6 @@ _missionParameters params[
if (_temp isEqualTo grpNull) then {throw 1} else
{
_assetSpawned = _temp select 0;
_missiondata set[5,_assetSpawned];
_objects pushBack (_temp select 1);
_blck_AllMissionAI pushBack _assetSpawned;
};
@ -199,11 +232,18 @@ _missionParameters params[
{
if (random(1) < _chanceHeliPatrol) then
{
_temp = [_coords,_difficulty,_missionHelis,_uniforms,_headGear,_vests,_backpacks,_weaponList, _sideArms,"none"] call blck_fnc_spawnMissionHeli;
private _xaxis = _coords select 0;
private _yaxis = _coords select 1;
private _zaxis = 100;
private _offset = 15 * _i;
_temp = [[_xaxis + _offset,_yaxis + _offset, _zaxis + _offset],_difficulty,_missionHelis,_uniforms,_headGear,_vests,_backpacks,_weaponList, _sideArms,"none"] call blck_fnc_spawnMissionHeli;
if (typeName _temp isEqualTo "ARRAY") then
{
blck_monitoredVehicles pushBack (_temp select 0);
_missionAIVehicles pushBack (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
//diag_log format["_monitorInitializeMissions(238): _temp select 0 = %1",_temp select 0];
//diag_log format["_monitorInitializedMissions(239): _temp select 1 = %1",_temp select 1];
} else {
if (typeName _temp isEqualTo "GROUP") then
{
@ -215,7 +255,7 @@ _missionParameters params[
};
uisleep 3;
if (count _garrisonedBuilding_ATLsystem > 0) then // Note that there is no error checking here for nulGroups
if !(_garrisonedBuilding_ATLsystem isEqualTo []) 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;
if (_temp isEqualTo grpNull) then {throw 1} else
@ -228,8 +268,9 @@ _missionParameters params[
};
uiSleep 3;
if (count _garrisonedBuildings_BuildingPosnSystem > 0) then
if !(_garrisonedBuildings_BuildingPosnSystem isEqualTo []) then
{
// params["_building","_group",["_noStatics",0],["_typesStatics",blck_staticWeapons],["_noUnits",0],["_aiDifficultyLevel","Red"], ["_uniforms",[]],["_headGear",[]],["_vests",[]],["_backpacks",[]],["_launcher","none"],["_weaponList",[]],["_sideArms",[]]];
private _temp = [_coords, _garrisonedBuildings_BuildingPosnSystem, _difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_garrisonBuilding_RelPosSystem;
if (_temp isEqualTo grpNull) then {throw 1} else
// TODO: add error checks for grpNull to the RelPosSystem
@ -239,37 +280,45 @@ _missionParameters params[
_blck_AllMissionAI append (units (_temp select 0));
};
};
uiSleep 15;
uiSleep 5;
private _userelativepos = true;
private _noEmplacedWeapons = [_noEmplacedWeapons] call blck_fnc_getNumberFromRange;
if (blck_useStatic && ((_noEmplacedWeapons > 0) || count _missionEmplacedWeapons > 0)) then
private _emplacedWeaponsThisMission = [_noEmplacedWeapons] call blck_fnc_getNumberFromRange;
if (blck_useStatic && ((_emplacedWeaponsThisMission > 0) || !(_missionEmplacedWeapons isEqualTo []))) then
// TODO: add error checks for grpNull to the emplaced weapon spawner
{
private _temp = [_coords,_missionEmplacedWeapons,_userelativepos,_noEmplacedWeapons,_difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnEmplacedWeaponArray;
private _temp = [_coords,_missionEmplacedWeapons,_userelativepos,_emplacedWeaponsThisMission,_difficulty,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnEmplacedWeaponArray;
if (_temp isEqualTo grpNull) then {throw 1} else
{
_objects append (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
};
};
uisleep 10;
uisleep 5;
private _noVehiclePatrols = [_noVehiclePatrols] call blck_fnc_getNumberFromRange;
if (blck_useVehiclePatrols && ((_noVehiclePatrols > 0) || count _missionPatrolVehicles > 0)) then
private _noPatrols = [_noVehiclePatrols] call blck_fnc_getNumberFromRange;
if (blck_useVehiclePatrols && ((_noPatrols > 0) || !(_missionPatrolVehicles isEqualTo []))) then
{
_temp = [_coords,_noVehiclePatrols,_difficulty,_missionPatrolVehicles,_userelativepos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,false,_vehicleCrewCount] call blck_fnc_spawnMissionVehiclePatrols;
_temp = [_coords,_noPatrols,_difficulty,_missionPatrolVehicles,_userelativepos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,false,_vehicleCrewCount] call blck_fnc_spawnMissionVehiclePatrols;
// TODO: add grpNull checks to missionVehicleSpawner
if (_temp isEqualTo grpNull) then {throw 1} else
{
_patrolVehicles = _temp select 0;
_blck_AllMissionAI append (_temp select 1);
};
if (_temp isEqualTo grpNull) throw 1;
_missionAIVehicles append (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
};
uiSleep delayTime;
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 (blck_useVehiclePatrols && ((_submarinePatrols > 0) || !(_submarinePatrolParameters isEqualTo []))) then
{
_temp = [_coords,_noPatrols,_difficulty,_submarinePatrolParameters,_userelativepos,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms,_isScubaMission,_vehicleCrewCount] call blck_fnc_spawnMissionVehiclePatrols;
// TODO: add grpNull checks to missionVehicleSpawner
if (_temp isEqualTo grpNull) throw 1;
_missionAIVehicles append (_temp select 0);
_blck_AllMissionAI append (_temp select 1);
};
uiSleep delayTime;
if (_spawnCratesTiming in ["atMissionSpawnGround","atMissionSpawnAir"]) then
{
if (_missionLootBoxes isEqualTo []) then
@ -293,8 +342,6 @@ _missionParameters params[
} forEach _crates;
};
};
_missionData set[2,_objects];
_missionData set[3,_crates];
uiSleep delayTime;
@ -307,11 +354,12 @@ _missionParameters params[
_x setVariable["crateSpawnPos", (getPos _x)];
} forEach _crates;
private _spawnPara = if (random(1) < _chancePara) then {true} else {false};
_missionData = [_coords,_mines,_objects,_crates, _blck_AllMissionAI,_assetSpawned,_missionAIVehicles,_markers];
_missionData = [_coords,_mines,_objects,_hiddenObjects,_crates,_blck_AllMissionAI,_assetSpawned,_missionAIVehicles,_markers];
_el set[missionData, _missionData];
// Everything spawned withouth serous errors so lets keep the mission active for future monitoring
// Everything spawned withouth serious errors so lets keep the mission active for future monitoring
blck_activeMissionsList pushBack _el;
}
@ -321,7 +369,7 @@ _missionParameters params[
if (_exception isEqualTo 1) then
{
_missionCategoryDescriptors set[noActive, _noActive - 1];
[_coords,_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_markers,markerPos (_markers select 1),_markerName,_markerMissionName, 1] call blck_fnc_endMission;
[_coords,_mines,_objects,_hiddenObjects,_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;
};
};
@ -348,6 +396,7 @@ _missionParameters params[
};
try {
if (blck_debugLevel >= 4) throw 5;
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
@ -419,7 +468,7 @@ _missionParameters params[
} forEach _crates;
};
_missionData = [_coords,_mines,_objects,_crates, _blck_AllMissionAI,_assetSpawned,_missionAIVehicles,_markers];
_missionData = [_coords,_mines,_objects,_hiddenObjects,_crates, _blck_AllMissionAI,_assetSpawned,_missionAIVehicles,_markers];
_el set[missionData, _missionData];
@ -432,6 +481,7 @@ _missionParameters params[
switch (_exception) do
{
case 1: { // Normal Mission End
//diag_log format["_monitorInitializedMissions: Normal mission end"];
if (_spawnCratesTiming in ["atMissionEndGround","atMissionEndAir"]) then
{
if (!(_secureAsset) || (_secureAsset && (alive _assetSpawned))) then
@ -489,7 +539,7 @@ _missionParameters params[
[_assetSpawned,selectRandom(_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]])] remoteExec["switchMove",-2];
};
};
[_coords,_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_markers,markerPos (_markers select 1),_markerName,_markerMissionName, _exception] call blck_fnc_endMission;
[_coords,_mines,_objects,_hiddenObjects,_crates,_blck_AllMissionAI,_endMsg,_markers,markerPos (_markers select 1),_markerName,_markerMissionName, _exception] call blck_fnc_endMission;
_waitTime = diag_tickTime + _tMin + random(_tMax - _tMin);
_missionCategoryDescriptors set [noActive,_noActive - 1];
@ -497,14 +547,17 @@ _missionParameters params[
};
case 2: { // Abort, crate moved.
_endMsg = "Crate Removed from Mission Site Before Mission Completion: Mission Aborted";
[_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;
[_coords,_mines,_objects,_hiddenObjects,_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
[_coords,_mines,_objects,_crates,_blck_AllMissionAI,_assetKilledMsg,_markers,markerPos (_markers select 1),_markerName,_markerMissionName, _exception] call blck_fnc_endMission;
[_coords,_mines,_objects,_hiddenObjects,_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
};
case 5: {
[_coords,_mines,_objects,_hiddenObjects,_crates,_blck_AllMissionAI,_assetKilledMsg,_markers,markerPos (_markers select 1),_markerName,_markerMissionName, _exception] call blck_fnc_endMission;
}
};
};
};
@ -513,4 +566,7 @@ _missionParameters params[
blck_activeMissionsList pushBack _el;
};
};
};
blck_activeMonitorThreads = blck_activeMonitorThreads - 1;

View File

@ -14,8 +14,6 @@
private ["_start","_maxHeight","_smokeShell","_light","_lightSource"];
params[["_crate",objNull],["_time",60]];
if (isNull _crate) exitWith {};
_start = diag_tickTime;
_smokeShell = selectRandom ["SmokeShellOrange","SmokeShellBlue","SmokeShellPurple","SmokeShellRed","SmokeShellGreen","SmokeShellYellow"];
_lightSource = selectRandom ["Chemlight_green","Chemlight_red","Chemlight_yellow","Chemlight_blue"];
@ -29,4 +27,5 @@ if(sunOrMoon < 0.2) then
_light setPosATL (getPosATL _crate);
_light attachTo [_crate,[0,0,(0.55)]];
};
blck_illuminatedCrates pushBack [_crate,_smoke,_light,_smokeShell,_lightSource,diag_tickTime + 120, diag_tickTime + 300];

View File

@ -40,5 +40,5 @@ _smoke setVariable ["LAST_CHECK", (diag_tickTime + 14400)];
_smoke setPos _posWreck;
_smoke attachto [_fire, [0,0,1.5]];
_objs = [_fire,_smoke];
_objs = [netID _fire,netID _smoke];
_objs

View File

@ -1,48 +0,0 @@
/*
Spawn objects from an array using offsects from a central location.
The code provided by M3Editor EDEN has been addapted to add checks for vehicles, should they be present.
Returns an array of spawned objects.
--------------------------
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["_center","_objects"];
if (count _center == 2) then {_center pushBack 0};
private ["_newObjs","_sim","_dam","_obj","_spawnPos"];
_newObjs = [];
_obj = createVehicle ["RoadCone_L_F", _coords]; // To designate the mission center
_obj allowDamage true;
_obj enableSimulation false;
_obj enableSimulationGlobal false;
_obj enableDynamicSimulation false;
_newObjs pushBack _obj;
{
if (typeName (_x select 3) isEqualTo "ARRAY") then // assum simulation and damage settings are defined in the old way as [bool,bool]
{
_sim = (_x select 3) select 0;
_dam = (_x select 3) select 1;
};
if (typeName (_x select 3) isEqualTo "BOOL") then // assume simulation and damage settings are defined in the new way as , bool, bool, ...
{
_sim = _x select 3;
_dam = _x select 4;
};
_obj = createVehicle[(_x select 0),_center vectorAdd (_x select 1),[],0,"CAN_COLLIDE"];
_newObjs pushback _obj;
[_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
{
[_obj] call blck_fnc_configureMissionVehicle;
};
} forEach _objects;
_newObjs

View File

@ -0,0 +1,55 @@
/*
--------------------------
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["_center","_objects"];
private ["_dam","_sim"];
if (count _center == 2) then {_center pushBack 0};
private _newObjs = [];
private _hiddenObjs = [];
{
_x params["_className","_relPos","_dir","_booleans"];
if (typeName (_booleans) isEqualTo "ARRAY") then // assum simulation and damage settings are defined in the old way as [bool,bool]
{
_dam = (_booleans) select 0;
_sim = (_booleans) select 1;
};
if ((typeName _booleans) isEqualTo "BOOL") then // assume simulation and damage settings are defined in the new way as , bool, bool, ...
{
_sim = _x select 4;
_dam = _x select 3;
};
private _objPos = _center vectorAdd _relPos;
if (_className isKindOf "House" && blck_hideRocksAndPlants) then
{
private _shrubs = nearestTerrainObjects[_objPos,["TREE", "SMALL TREE", "BUSH","FENCE", "WALL","ROCK"], sizeOf _className];
if !(_shrubs isEqualTo []) then
{
_hiddenObjs append _shrubs;
{_x hideObjectGlobal true} forEach _shrubs;
};
};
_obj = createVehicle[_className,[0,0,0],[],0,"CAN_COLLIDE"];
_obj setPosATL _objPos;
_newObjs pushback (netID _obj);
[_obj, _dir] call blck_fnc_setDirUp;
_obj setVectorUp [0,0,1];
_obj enableDynamicSimulation _sim;
_obj allowDamage _dam;
if ((typeOf _obj) isKindOf "LandVehicle" || (typeOf _obj) isKindOf "Air" || (typeOf _obj) isKindOf "Ship") then
{
[_obj] call blck_fnc_configureMissionVehicle;
};
} forEach _objects;
[_newObjs,_hiddenObjs];

View File

@ -27,18 +27,23 @@ _units = [];
_abort = false;
_pos = [];
// Define _missionEmplacedWeapons if not already configured.
if (_missionEmplacedWeapons isEqualTo []) then
private _emplacedWepData = +_missionEmplacedWeapons;
//diag_log format["_spawnEmplacedWeaponArray(30): _noEmplacedWeapons = %1 | _emplacedWepData = %2",_noEmplacedWeapons,_emplacedWepData];
// Define _emplacedWepData if not already configured.
if (_emplacedWepData isEqualTo []) then
{
_missionEmplacedWeaponPositions = [_coords,_noEmplacedWeapons,35,50] call blck_fnc_findPositionsAlongARadius;
private _wepPositions = [_coords,_noEmplacedWeapons,35,50] call blck_fnc_findPositionsAlongARadius;
{
_static = selectRandom blck_staticWeapons;
_missionEmplacedWeapons pushback [_static,_x];
} forEach _missionEmplacedWeaponPositions;
_emplacedWepData pushback [_static,_x];
} forEach _wepPositions;
_useRelativePos = false;
};
//diag_log format["_spawnEmplacedWeaponArray(45): _noEmplacedWeapons = %1 | _emplacedWepData = %2",_noEmplacedWeapons,_emplacedWepData];
{
if (_useRelativePos) then
{
@ -77,7 +82,7 @@ if (_missionEmplacedWeapons isEqualTo []) then
_return = grpNull;
["createGroup returned grpNull","warning"] call blck_fnc_log;
};
} forEach _missionEmplacedWeapons;
} forEach _emplacedWepData;
if !(_abort) then
{
blck_monitoredVehicles append _emplacedWeps;

View File

@ -10,7 +10,37 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_building","_group",["_noStatics",0],["_typesStatics",blck_staticWeapons],["_noUnits",0],["_aiDifficultyLevel","Red"], ["_uniforms",[]],["_headGear",[]],["_vests",[]],["_backpacks",[]],["_launcher","none"],["_weaponList",[]],["_sideArms",[]]];
/*
_building,
_group,
_noStatics,
_typesStatics,
_noUnits,
_aiDifficultyLevel,
_uniforms,
_headGear,
_vests,
_backpacks,
"none",
_weaponList,
_sideArms
*/
params[
"_building",
"_group",
["_noStatics",0],
["_typesStatics",blck_staticWeapons],
["_noUnits",0],
["_aiDifficultyLevel","Red"],
["_uniforms",[]],
["_headGear",[]],
["_vests",[]],
["_backpacks",[]],
["_launcher","none"],
["_weaponList",[]],
["_sideArms",[]]
];
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};
@ -19,18 +49,20 @@ if (_vests isEqualTo []) then {_vests = [_aiDifficultyLevel] call blck_fnc_
if (_backpacks isEqualTo []) then {_backpacks = [_aiDifficultyLevel] call blck_fnc_selectAIBackpacks};
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 _allBldPsn = ([_building] call BIS_fnc_buildingPositions) call BIS_fnc_arrayShuffle;
private _countBldPsn = count _allBldPsn;
private _statics = _noStatics min ceil(_countBldPsn/2);
private _units = _countBldPsn - _statics;
diag_log format["_fnc_spawnGarrisonInsideBuilding_relPos: _statics = %1 | _units = %2 | count _allBldPsn = %3 | _allBldPsn %4",_statics,_units,count _allBldPsn,_allBldPsn];
private _staticsSpawned = [];
private _locsUsed = [];
uiSleep 1;
for "_i" from 1 to _statics do
{
_pos = selectRandom _allBldPsn;
_allBldPsn = _allBldPsn - [_pos];
if (_allBldPsn isEqualTo []) exitWith {};
_pos = _allBldPsn deleteAt 0;
diag_log format["_fnc_spawnGarrisonInsideBuilding_relPos: _pos = %1",_pos];
_locsUsed pushBack _pos;
_staticClassName = selectRandom _typesStatics;
_obj = [_staticClassName, [0,0,0]] call blck_fnc_spawnVehicle;
_obj setVariable["GRG_vehType","emplaced"];
@ -39,12 +71,20 @@ for "_i" from 1 to _statics do
_unit = [[0,0,0],_group,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_launcher,_weaponList,_sideArms,false,true] call blck_fnc_spawnUnit;
_unit moveInGunner _obj;
};
private _infantryPos = _allBldPsn;
for "_i" from 1 to _units do
{
_pos = selectRandom _allBldPsn;
_allBldPsn = _allBldPsn - [_pos];
if (_allBldPsn isEqualTo []) exitWith {};
_pos = _allBldPsn deleteAt 0;
_unit = [[0,0,0],_group,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_launcher,_weaponList,_sideArms,false,true] call blck_fnc_spawnUnit;
_unit setPosATL _pos;
{
_wp = _group addWaypoint [_x, 0];
_wp setWaypointType "MOVE";
_wp setWaypointCompletionRadius 0;
_wp waypointAttachObject _building;
_wp setWaypointHousePosition _foreachindex;
_wp setWaypointTimeout [15, 20, 30];
} forEach (_building buildingPos -1);
};
_staticsSpawned

View File

@ -22,22 +22,25 @@ 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};
private["_vehGroup","_vehiclePatrolSpawns","_missionAI","_missiongroups","_vehicles","_return","_vehiclePatrolSpawns","_vehicle","_return","_abort","_spawnPos","_v"];
_vehicles = [];
_missionAI = [];
_abort = false;
if (_missionPatrolVehicles isEqualTo []) then
private["_spawnPos","_return"];
private _vehicles = [];
private _missionAI = [];
private _abort = false;
private _patrolsThisMission = +_missionPatrolVehicles;
//diag_log format["_spawnMissionVehiclePatrols(30): _noVehiclePatrols = %1 | _patrolsThisMission = %2",_noVehiclePatrols,_patrolsThisMission];
if (_patrolsThisMission isEqualTo []) then
{
_useRelativePos = false;
_vehiclePatrolSpawns = [_coords,_noVehiclePatrols,45,60] call blck_fnc_findPositionsAlongARadius;
private _spawnLocations = [_coords,_noVehiclePatrols,45,60] call blck_fnc_findPositionsAlongARadius;
//diag_log format["_spawnMissionVehiclePatrols (35): _spawnLocations = %1",_spawnLocations];
{
_v = [_skillAI] call blck_fnc_selectPatrolVehicle;
_missionPatrolVehicles pushBack [_v, _x];
}forEach _vehiclePatrolSpawns;
private _v = [_skillAI] call blck_fnc_selectPatrolVehicle;
_patrolsThisMission pushBack [_v, _x];
diag_log format["_spawnMissionVehiclePatrols(36): _v = %1 | _patrolsThisMission = %2",_v,_patrolsThisMission];
}forEach _spawnLocations;
};
//diag_log format["_spawnMissionVehiclePatrols(42): _patrolsThisMission = %1",_patrolsThisMission];
#define configureWaypoints false
{
if (_useRelativePos) then
@ -46,16 +49,16 @@ if (_missionPatrolVehicles isEqualTo []) then
} else {
_spawnPos = _x select 1;
};
_vehicle = _x select 0;
_vehGroup = [blck_AI_Side,true] call blck_fnc_createGroup;
private _vehicle = _x select 0;
private _vehGroup = [blck_AI_Side,true] call blck_fnc_createGroup;
_patrolVehicle = objNull;
if !(isNull _vehGroup) then
{
_vehGroup setVariable["soldierType","vehicle"];
[_vehGroup,_spawnPos,_coords,_crewCount,_crewCount,_skillAI,1,2,false,_uniforms, _headGear,_vests,_backpacks,_weaponList,_sideArms,_isScubaGroup] call blck_fnc_spawnGroup;
_missionAI append (units _vehGroup);
blck_monitoredMissionAIGroups pushBack _vehGroup;
_spawnPos = _spawnPos findEmptyPosition[0,50,_vehicle];;
#define useWaypoints true
_patrolVehicle = [_coords,_spawnPos,_vehicle,40,60,_vehGroup,useWaypoints,_crewCount] call blck_fnc_spawnVehiclePatrol;
@ -66,7 +69,8 @@ if (_missionPatrolVehicles isEqualTo []) then
} else {
_abort = true;
};
} forEach _missionPatrolVehicles;
} forEach _patrolsThisMission;
if !(_abort) then
{
blck_monitoredVehicles append _vehicles;

View File

@ -17,10 +17,10 @@ if (blck_missionsRunning >= blck_maxSpawnedMissions) exitWith {};
if (_noActiveMissions < _maxNoMissions && diag_tickTime > _waitTime && blck_missionsRunning < blck_maxSpawnedMissions) then
{
blck_dynamicMissionsSpawned = blck_dynamicMissionsSpawned + 1;
// time to reset timers and spawn something.
private _wt = diag_tickTime + _tmin + (random(_tMax - _tMin));
private _missionInitialized = [_x,selectRandom _missionsData] call blck_fnc_initializeMission;
private _missionInitialized = [_x,selectRandom _missionsData,blck_dynamicMissionsSpawned] call blck_fnc_initializeMission;
if (blck_debugLevel >= 3) then
{
if !(_missionInitialized) then

View File

@ -13,30 +13,33 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_coords","_missionLandscape",["_min",3],["_max",15],["_nearest",1]];
private["_objects","_wreck","_dir","_dirOffset"];
#define maxObjectSpawnRadius 25
#define minObjectSpawnRadius 15
private _objectSpawnRange = maxObjectSpawnRadius - minObjectSpawnRadius;
_objects = [];
_wreck = createVehicle ["RoadCone_L_F", _coords]; // To designate the mission center
_wreck allowDamage true;
_wreck enableSimulation false;
_wreck enableSimulationGlobal false;
_wreck enableDynamicSimulation false;
_objects pushBack _wreck;
{
private _newObjs = [];
private _hiddenObjs = [];
private _dir = random(360);
private _radius = minObjectSpawnRadius + random(maxObjectSpawnRadius);
_wreck = createVehicle[_x, _coords getPos[_radius,_dir], [], 2];
_wreck allowDamage true;
_wreck enableSimulation false;
_wreck enableSimulationGlobal false;
_wreck enableDynamicSimulation false;
_wreck setDir (_wreck getRelDir _coords);
_objects pushback _wreck;
{
private _spawnPos = _coords getPos[minObjectSpawnRadius + random(maxObjectSpawnRadius), random(359)];
private _objClassName = _x;
if (_objClassName isKindOf "House" && blck_hideRocksAndPlants) then
{
private _shrubs = nearestTerrainObjects[_spawnPos,["TREE", "SMALL TREE", "BUSH","FENCE", "WALL","ROCK"], sizeOf _objClassName];
if !(_shrubs isEqualTo []) then
{
_hiddenObjs append _shrubs;
{_x hideObjectGlobal true} forEach _shrubs;
};
};
private _obj = createVehicle[_x, _spawnPos, [], 2];
_obj allowDamage true;
_obj enableSimulation false;
_obj enableSimulationGlobal false;
_obj enableDynamicSimulation false;
_obj setDir (_obj getRelDir _coords);
_newObjs pushback (netID _obj);
sleep 0.1;
} forEach _missionLandscape;
_objects
[_newObjs,_hiddenObjs]

View File

@ -0,0 +1,23 @@
/*
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["_center","_objects","_relative"];
private _spawnedObjects = [];
{
_x params["_className","_relPos","_dir","_booleans"];
private _objPos = _center vectorAdd _relPos;
private _obj = createSimpleObject [_className,ATLToASL _objPos];
_obj setDir _dir;
_obj setVectorUp [0,0,1];
_spawnedObjects pushBack _obj;
} forEach _objects;
_spawnedObjects

View File

@ -18,7 +18,8 @@
if (diag_tickTime > _unit getVariable ["blck_cleanupAt",0]) then
{
if (_nearplayer isequalto []) then {
if (_nearplayer isequalto []) then
{
{
deleteVehicle _x;
}forEach nearestObjects [getPos _unit,["WeaponHolderSimulated","GroundWeapoonHolder"],3];

View File

@ -12,7 +12,7 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
private ["_i","_weap","_skin","_unit","_skillLevel","_aiSkills","_launcherRound","_index","_ammoChoices","_optics","_pointers","_muzzles","_underbarrel","_legalOptics"];
private ["_i","_weap","_unit","_skillLevel","_aiSkills","_launcherRound","_index","_ammoChoices","_optics","_pointers","_muzzles","_underbarrel","_legalOptics"];
params["_pos","_aiGroup",["_skillLevel","red"],["_uniforms", []],["_headGear",[]],["_vests",[]],["_backpacks",[]],["_Launcher","none"],["_weaponList",[]],["_sideArms",[]],["_scuba",false],["_garrison",false]];
if (_weaponList isEqualTo []) then {_weaponList = [_skillLevel] call blck_fnc_selectAILoadout};
@ -60,11 +60,6 @@ if (_scuba) then
_unit swiminDepth (([_pos] call blck_fnc_findWaterDepth) / 2);
};
_skin = "";
_counter = 1;
_unit forceAddUniform (selectRandom _uniforms);
//Sets AI Tactics
_unit enableAI "ALL";
if(_garrison) then
@ -75,6 +70,14 @@ _unit allowDammage true;
_unit setBehaviour "COMBAT";
_unit setunitpos "AUTO";
if (surfaceIsWater (getPos _unit)) then
{
_uniforms = blck_UMS_uniforms;
_headGear = blck_UMS_headgear;
_weaponList = blck_UMS_weapons;
_vests = blck_UMS_vests;
};
_unit forceAddUniform (selectRandom _uniforms);
if !(_headGear isEqualTo []) then
{
_unit addHeadgear (selectRandom _headGear);
@ -89,18 +92,17 @@ _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)};
if (random 1 < 0.4) then {_unit addPrimaryWeaponItem (selectRandom _muzzles)};
if (random 1 < 0.4) then {_unit addPrimaryWeaponItem (selectRandom _underbarrel)};
if (random 1 < 0.4) then {_unit addPrimaryWeaponItem (selectRandom ([_weap, 101] call BIS_fnc_compatibleItems))}; // muzzles
if (random 1 < 0.4) then {_unit addPrimaryWeaponItem (selectRandom ([_weap, 201] call BIS_fnc_compatibleItems))}; // optics
if (random 1 < 0.4) then {_unit addPrimaryWeaponItem (selectRandom ([_weap, 301] call BIS_fnc_compatibleItems))}; // pointers
if (random 1 < 0.4) then {_unit addPrimaryWeaponItem (selectRandom ([_weap, 302] call BIS_fnc_compatibleItems))}; // underbarrel
if ((count(getArray (configFile >> "cfgWeapons" >> _weap >> "muzzles"))) > 1) then
{
_unit addMagazine "1Rnd_HE_Grenade_shell";
@ -124,6 +126,7 @@ if (round(random 10) <= 5) then
_unit addItem selectRandom blck_specialItems;
};
/*
if ( !(_Launcher isEqualTo "none") && !(_backpacks isEqualTo [])) then
{
_unit addWeaponGlobal _Launcher;
@ -139,6 +142,26 @@ if ( !(_Launcher isEqualTo "none") && !(_backpacks isEqualTo [])) then
_unit addBackpack selectRandom _backpacks;
};
};
*/
if !(_backpacks isEqualTo []) then
{
if (_Launcher isEqualTo "none") then
{
if ( random (1) < blck_chanceBackpack) then
{
_unit addBackpack selectRandom _backpacks;
};
} else {
_unit addWeaponGlobal _Launcher;
_unit addBackpack (selectRandom _backpacks);
private _mags = getArray (configFile >> "CfgWeapons" >> _Launcher >> "magazines");
for "_i" from 1 to 3 do
{
_unit addItemToBackpack (_mags select 0); // call BIS_fnc_selectRandom;
};
_unit setVariable["Launcher",_launcher,true];
};
};
if(sunOrMoon < 0.2 && blck_useNVG)then
{

View File

@ -12,15 +12,50 @@
*/
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
params["_vehType","_pos",["_special","NONE"],["_radius",30]];
params["_vehType",["_pos",[]],["_special","NONE"],["_radius",30]];
private _veh = createVehicle[_vehType, _pos, [], _radius, _special];
if (count _pos == 2) then {
_pos pushBack 0;
[format["_fnc_spawnVehicle(20): _pos had only 2 parameters, new value = %1",_pos],'warning'] call blck_fnc_log;
};
if (_pos isEqualTo []) then
{
[format["_fnc_spawnVehicle(20): _pos undefined, now set to [0,0,0]"],'warning'] call blck_fnc_log;
};
_veh setVectorUp surfaceNormal position _veh;
_veh allowDamage true;
_veh enableRopeAttach true;
_veh setVariable["blck_vehicle",true];
[_veh] call blck_fnc_protectVehicle;
[_veh] call blck_fnc_emptyObject;
if (_vehType isKindOf "Plane") then {
private _pos = [_pos select 0, _pos select 1, ((getPos _veh) select 2) + 400];
_veh setPosATL _pos;
// adapted from: https://community.bistudio.com/wiki/setVelocity
private _vel = velocity _veh;
private _dir = direction _veh;
#define speedIncr 150
_veh setVelocity [
(_vel select 0) + (sin _dir * speedIncr),
(_vel select 1) + (cos _dir * speedIncr),
(_vel select 2)
];
_veh flyInHeightASL [200,100,400];
};
if (_vehType isKindOf "Helicopter") then
{
private _pos = [_pos select 0, _pos select 1, ((getPos _veh) select 2) + 100];
_veh setPosATL _pos;
private _vel = velocity _veh;
private _dir = direction _veh;
#define speedIncr 25
_veh setVelocity [
(_vel select 0) + (sin _dir * speedIncr),
(_vel select 1) + (cos _dir * speedIncr),
(_vel select 2)
];
_veh flyInHeightASL [200,100,400];
};
_veh

View File

@ -15,9 +15,8 @@
private _functions = [
// General functions
["blck_fnc_waitTimer","\q\addons\custom_server\Compiles\Functions\GMS_fnc_waitTimer.sqf"],
//["blck_fnc_timedOut","\q\addons\custom_server\Compiles\Functions\GMS_fnc_timedOut.sqf"],
["blck_fnc_FindSafePosn","\q\addons\custom_server\Compiles\Functions\GMS_fnc_findSafePosn.sqf"],
["blck_fnc_findSafePosn_2","\q\addons\custom_server\Compiles\Functions\GMS_fnc_findSafePosn_2.sqf"],
["blck_fnc_restoreHiddenObjects","\q\addons\custom_server\Compiles\Functions\GMS_fnc_restoreHiddenObjects.sqf"],
["blck_fnc_FindSafePosn","\q\addons\custom_server\Compiles\Functions\GMS_fnc_findSafePosn_4.sqf"],
["blck_fnc_randomPosition","\q\addons\custom_server\Compiles\Functions\GMS_fnc_randomPosn.sqf"], // find a randomPosn. see script for details.
["blck_fnc_findPositionsAlongARadius","\q\addons\custom_server\Compiles\Functions\GMS_fnc_findPositionsAlongARadius.sqf"],
["blck_fnc_giveTakeCrypto","\q\addons\custom_server\Compiles\Functions\GMS_fnc_giveTakeCrypto.sqf"],
@ -75,7 +74,7 @@ private _functions = [
["blck_fnc_spawnCrate","\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnCrate.sqf"], // Simply spawns a crate of a specified type at a specific position.
["blck_fnc_spawnMissionCrates","\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnMissionCrates.sqf"],
["blck_fnc_cleanupObjects","\q\addons\custom_server\Compiles\Missions\GMS_fnc_cleanUpObjects.sqf"],
["blck_fnc_spawnCompositionObjects","\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnBaseObjects.sqf"],
["blck_fnc_spawnCompositionObjects","\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnCompositionObjects.sqf"],
["blck_fnc_spawnRandomLandscape","\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnRandomLandscape.sqf"],
["blck_fnc_spawnMissionVehiclePatrols","\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnMissionVehiclePatrols.sqf"],
["blck_fnc_spawnEmplacedWeaponArray","\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnEmplacedWeaponArray.sqf"],
@ -118,6 +117,7 @@ private _functions = [
["blck_fnc_sm_AddGroupToArray", "\q\addons\custom_server\Compiles\Missions\GMS_fnc_sm_AddGroupToArray.sqf"],
["blck_fnc_initializeMission", "\q\addons\custom_server\Compiles\Missions\GMS_fnc_initializeMission.sqf"],
["blck_fnc_monitorInitializedMissions","\q\addons\custom_server\Compiles\Missions\GMS_fnc_monitorInitializedMissions.sqf"],
["blck_fnc_spawnSimpleObjects","\q\addons\custom_server\Compiles\Missions\GMS_fnc_spawnSimpleObjects.sqf"],
// Group-related functions
["blck_fnc_spawnGroup","\q\addons\custom_server\Compiles\Groups\GMS_fnc_spawnGroup.sqf"], // Spawn a single group and populate it with AI units]

View File

@ -26,6 +26,7 @@ blck_TriggerDistance = 1500;
////////////////////////////////////////////////
// Do Not Touch Anything Below This Line
///////////////////////////////////////////////
blck_townLocations = []; //nearestLocations [blck_mapCenter, ["NameCity","NameCityCapital"], 30000];
blck_ActiveMissionCoords = [];
blck_recentMissionCoords = [];
@ -33,6 +34,7 @@ blck_monitoredVehicles = [];
blck_livemissionai = [];
blck_monitoredMissionAIGroups = []; // Used to track groups in active missions for whatever purpose
blck_oldMissionObjects = [];
blck_hiddenTerrainObjects = [];
blck_pendingMissions = [];
blck_missionsRunning = 0;
blck_missionsRun = 0;
@ -45,13 +47,13 @@ blck_temporaryMarkers = [];
blck_illuminatedCrates = []; // [crate,duration,freq of replacement]
blck_mainThreadUpdateInterval = 60;
blck_revealMode = "detailed"; //""basic" /*group or vehicle level reveals*/,detailed /*unit by unit reveals*/";
blck_dynamicMissionsSpawned = 0;
blck_spawnerMode = 1;
blck_missionData = [];
blck_activeMissionsList = [];
blck_initializedMissionsList = [];
blck_blackListedLocations = []; // [ [marker, time]]
blck_activeMonitorThreads = 0;
blck_validEndStates = ["allUnitsKilled", "playerNear", "allKilledOrPlayerNear","assetSecured"];
blck_validLootSpawnTimings = ["atMissionSpawnGround","atMissionSpawnAir","atMissionEndGround","atMissionEndAir"];
blck_validLootLoadTimings = ["atMissionCompletion", "atMissionSpawn"];

View File

@ -14,11 +14,11 @@
#include "\q\addons\custom_server\Configs\blck_defines.hpp"
#include "\q\addons\custom_server\init\build.sqf"
/*
changing any of these variables may break the mission systemChat
changing any of these variables may break the mission system
*/
blck_locationBlackList = []; // Do not touch ...
blck_debugON = false; // Do not touch ...
blck_debugLevel = 0; // Do not touch ...
blck_debugON = false; // should be set to false; ...
blck_debugLevel = 0; // should be set to 0 ...
#ifdef blck_milServer
if (true) exitWith
{
@ -45,7 +45,8 @@
blck_spawnMapAddons = false; // When true map addons will be spawned based on parameters define in custum_server\MapAddons\MapAddons_init.sqf
blck_spawnStaticLootCrates = false; // When true, static loot crates will be spawned and loaded with loot as specified in custom_server\SLS\SLS_init_Epoch.sqf (or its exile equivalent).
blck_simulationManager = blck_useBlckeaglsSimulationManager;
//diag_log format["[blckeagls] blck_configs: blck_simulationManager = %1",blck_simulationManager];
blck_hideRocksAndPlants = true; // When true, any rocks, trees or bushes under enterable buildings will be 'hidden'
/*
blck_simulationManagementOff - no simulation management occurs
blck_useBlckeaglsSimulationManager - simulation is enabled/disabled by periodic checks for nearby players; a 'wake' function is included when a units simulation is turned on

View File

@ -27,7 +27,8 @@
blck_spawnMapAddons = true; // When true map addons will be spawned based on parameters define in custum_server\MapAddons\MapAddons_init.sqf
blck_spawnStaticLootCrates = true; // When true, static loot crates will be spawned and loaded with loot as specified in custom_server\SLS\SLS_init_Epoch.sqf (or its exile equivalent).
blck_simulationManager = blck_useBlckeaglsSimulationManagement;
//diag_log format["[blckeagls] blck_configs: blck_simulationManager = %1",blck_simulationManager];
blck_hideRocksAndPlants = true; // When true, any rocks, trees or bushes under enterable buildings will be 'hidden'
// Note that you can define map-specific variants in custom_server\configs\blck_custom_config.sqf
blck_useTimeAcceleration = true; // When true, time acceleration will be periodically updated based on amount of daylight at that time according to the values below.
blck_timeAccelerationDay = 2; // Daytime time accelearation

View File

@ -43,6 +43,6 @@ switch (toLower worldName) do
case "lingor":{blck_mapCenter = [4400, 4400, 0];blck_mapRange = 4400;};
case "takistan":{blck_mapCenter = [5500, 6500, 0];blck_mapRange = 5000;};
case "lythium":{blck_mapCenter = [10000,10000,0];blck_mapRange = 8500;};
case "vt7": {_mapCenter = [9000,9000,0]; _maxDistance = 9000};
case "vt7": {blck_mapCenter = [9000,9000,0]; blck_mapRange = 9000};
default {blck_mapCenter = [6322,7801,0]; blck_mapRange = 6000};
};

View File

@ -107,7 +107,7 @@ switch (blck_simulationManager) do
if ( !(blck_debugON) && (blck_debugLevel isEqualTo 0)) then
{
waitUntil{{isPlayer _x}count allPlayers > 0};
["]Player Connected, spawning missions"] call blck_fnc_log;
["Player Connected, spawning missions"] call blck_fnc_log;
} else {
["Debug mode ON, proceding without players"] call blck_fnc_log;
};
@ -163,9 +163,6 @@ private _other = ["NameLocal"] call _fn_setupLocationType;
private _airport = ["Airport"] call _fn_setupLocationType;
blck_townLocations = _villages + _cites + _capitals + _marine + _other + _airport;
{
blck_locationBlackList pushBack [locationPosition _x, blck_minDistanceFromTowns];
} forEach blck_townLocations;
//Start the mission timers
if (blck_enableOrangeMissions > 0) then

View File

@ -1,4 +1,4 @@
#define blck_buildNumber 218
#define blck_versionNumber 7.00
#define blck_buildDate "8-29-20"
#define blck_buildNumber 230 // Address issues with cleanup of objects
#define blck_versionNumber 7.02
#define blck_buildDate "10-5-20"

View File

@ -8,17 +8,16 @@ params["_u",["_category","House"]];
private _pos = getPosASL _u;
private _building = objNull;
private _surfacesAbove = lineInterSectsSurfaces [_pos, [_pos select 0, _pos select 1, (_pos select 2) + 100],_u,_u,true,10];
//diag_log format["_surfacesAbove = %1",_surfacesAbove];
{
if ((_x select 2) isKindOf _category && !(_x isEqualTo _u)) exitWith {_building = (_x select 2)};
} forEach _surfacesAbove;
if (_building isEqualTo objNull) then
{
private _surfacesBelow = lineInterSectsSurfaces [_pos, [_pos select 0, _pos select 1, (_pos select 2) - 10],_u,_u,true,100];
//diag_log format["_surfacesBelow = %1",_surfacesBelow];
{
if ((_x select 2) isKindOf _category && !(_x isEqualTo _u)) exitWith {_building = (_x select 2)};
} forEach _surfacesBelow;
};
//diag_log format["_fn_buildingContainer: _u = %1 | _building = %2",_u,_building];
_building

View File

@ -1,34 +0,0 @@
#define oddsOfGarrison 0.67
#define maxGarrisonStatics 3
#define maxGarrisonUnits 4
#define typesGarrisonStatics [] // When empty a static will be randomly chosen from the defaults for blckeagls
#define garrisonMarkerObject "Sign_Sphere100cm_F" // This can be anything you like. I find this large sphere easy to see and convenient.
#define unitMarkerObject "Sign_Arrow_Direction_Green_F" // This can be anything. I chose this arrow type because it allows you to easily indicate direction.
_helpers = allMissionObjects garrisonMarkerObject;
//diag_log format["_helpers = %1",_helpers];
{
if ( (typeOf _x) isEqualTo garrisonMarkerObject) then
{
private _isInside = [_x] call _fn_isInside;
if (_isInside) then
{
_building = [_x] call _fn_buildingContainer;
blck_garrisonedBuildings pushbackunique _building;
blck_garrisonedBuildings pushbackunique _x;
// data structure ["building Classname",[/*building pos*/],/*building dir*/,/*odds of garrison*/, /*Max Statics*/,/*types statics*/,/*max units*/],
// 1 2 3 4 5 6 7 8 9
_line = format[' ["%1",%2,%3,%4,%5,%6,%7,%8,%9]',typeOf _building,(getPosATL _building) vectorDiff CENTER,getDir _building, 'true','true',oddsOfGarrison,maxGarrisonStatics,typesGarrisonStatics,maxGarrisonUnits];
systemChat _line;
//diag_log _line;
if (_forEachIndex == 0) then
{
_cb = _cb + format["%1%2",endl,_line];
} else {
_cb = _cb + format[",%1%2",endl,_line];
};
};
};
} forEach _helpers;

View File

@ -1,9 +1,12 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
private _building = _this select 0;
private _CENTER = _this select 1;
params["_building","_center"];
private _pos = getPosATL _building;
private _garrisonedBuildings = missionNamespace getVariable["blck_garrisonedBuildings",[]];
private _count = 0;
@ -13,6 +16,7 @@ private _buildingGarrisonATL = [];
private _configuredStatics = [];
private _configuredUnits = [];
private _statics = nearestObjects[getPosATL _building,["StaticWeapon"],sizeOf (typeOf _building)];
private _units = nearestObjects[getPosATL _building,["Man"],sizeOf (typeOf _building)] select {(vehicle _x) isEqualTo _x};
private _lineBreak = toString [10];
{
@ -20,11 +24,9 @@ private _lineBreak = toString [10];
{
private _isInside = [_x] call blck3DEN_fnc_isInside;
private _container = [_x] call blck3DEN_fnc_buildingContainer;
//diag_log format["evaluating building %1 static %2 isInside = %3 container = %4",_building,_x,_isInside,_container];
if (_isInside && (_container isEqualTo _building)) then
{
_configuredStatics pushBackUnique _x;
//diag_log format["Building %1 | buildingPos %2 | _pos %3",typeOf _x, getPosATL _x,_pos];
_staticsText pushBack [format['%1',typeOf _x],(getPosATL _x) vectorDiff (_pos),getDir _x];
};
};
@ -32,7 +34,6 @@ private _lineBreak = toString [10];
_staticsText joinString _lineBreak;
// Since this is run from the editor we do not have to worry about units running off from their original locations
private _units = nearestObjects[getPosATL _building,["Man"],sizeOf (typeOf _building)] select {(vehicle _x) isEqualTo _x};
{
if !(_x in _configuredUnits) then
{
@ -47,20 +48,28 @@ private _units = nearestObjects[getPosATL _building,["Man"],sizeOf (typeOf _buil
} forEach _units;
_unitsText joinString _lineBreak;
//diag_log format["_staticsText for building %1 = %2",_building,_staticsText];
//diag_log format["_unitsText for building %1 = %2",_building,_unitsText];
if !((_staticsText isEqualTo []) && (_unitsText isEqualTo [])) then
{
private _allowDamage = (_building get3DENAttribute "allowDamage") select 0;
private _enableSimulation = (_building get3DENAttribute "enableSimulation") select 0;
diag_log format["_configureGarrisonATL: _building %1 | damage %2 | simulation %3",_allowDamage,_enableSimulation];
_buildingGarrisonATL = [
format["%1",
typeOf _building],
(getPosATL _building) vectorDiff _pos,
(getPosATL _building) vectorDiff _center,
getDir _building,
true,
true,
_allowDamage,
_enableSimulation,
_staticsText,
_unitsText
];
};
//diag_log format["_buildingGarrisonATL = %1",_buildingGarrisonATL];
[_buildingGarrisonATL,_configuredStatics,_configuredUnits]
private "_return";
if (_buildingGarrisonATL isEqualTo []) then
{
_return = [];
} else {
_return = [_buildingGarrisonATL,_configuredStatics,_configuredUnits];
};
_return

View File

@ -1,4 +1,9 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_object"];
@ -10,5 +15,4 @@ _p2 = _bbr select 1;
_height = abs ((_p2 select 2) - (_p1 select 2));
_marker setPosATL [_markerPos select 0, _markerPos select 1, (_markerPos select 2) + _height];
_object setVariable ["marker",_marker];
diag_log format["_createGarrisonMarker: _object = %1 | _marker = %2 | _height = %3",_object,_marker,_height];
true

View File

@ -1,4 +1,9 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_object"];

View File

@ -1,4 +1,9 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_message"];
// As found in fn_3DENExportTerrainBuilder.sqf

View File

@ -1,7 +1,13 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_state"];
all3DENEntities params ["_objects"];
_objects = _objects select {_x getVariable["garrisoned",false]};
diag_log format["displayGarrisonMarkers: _state = %2 | _objects = %1",_objects,_state];
missionNameSpace setVariable["blck_displayGarrisonMarkerOn",_state];
{
if (_state) then // if the request was to show the markers then ....

View File

@ -1,8 +1,13 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_state"];
all3DENEntities params ["_objects"];
_objects = _objects select {_x getVariable ["lootVehicle",false]};
diag_log format["displayLootMarkers: _state = %2 | _objects = %1",_objects,_state];
missionNamespace setVariable["blck_displayLootMarkerOn",_state];
{
if (_state) then // if the request was to show the markers then ....

View File

@ -1,4 +1,9 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_end"];
missionNamespace setVariable["blck_endMessage",_end];

View File

@ -1,4 +1,9 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
private _objects = get3DENSelected "object";
private "_message";
diag_log format["getGarrisonInfo: _object = %1",format["%1",_object]];

View File

@ -1,7 +1,10 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
private _objects = get3DENSelected "object" select {(typeOf _x) isKindOf "Car" || (typeOf _x) isKindOf "Ship" || (typeOf _x) isKindOf "ThingX"};
private "_message";

View File

@ -8,5 +8,4 @@
private _u = _this select 0;
private _isInfantry = if ((_u isKindOf "Man") && (vehicle _u) isEqualTo _u) then {true} else {false};
//diag_log format["_fn_isInfantry: _isInfantry = %1",_isInfantry];
_isInfantry

View File

@ -1,3 +1,9 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_object"];
if !(_object getVariable["marker",""] isEqualTo "") then
{

View File

@ -1,9 +1,12 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_object"];
if !(_object getvariable["marker",""] isEqualTo "") then
{
[_object] call blck3DEN_fnc_removeMarker;
_object setVariable ["marker",nil];
//_object setVariable ["lootVehicle",nil];
//_object setVariable ["garrisoned",nil];
};

View File

@ -1,4 +1,9 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_object"];
_object removeAllEventHandlers "UnregisteredFromWorld3DEN";

View File

@ -1,6 +1,13 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
params["_state"];
private _markersStateON = missionNamespace getVariable["blck_displayGarrisonMarkerOn",false];
[false] call blck3DEN_fnc_displayGarrisonMarkers;
private _objects = get3DENSelected "object" select {(typeOf _x) isKindOf "House"};
private "_message";
if (_objects isEqualTo []) exitWith
@ -8,6 +15,7 @@ if (_objects isEqualTo []) exitWith
_message = "Select one or more buildings to configure";
systemChat _message;
diag_log _message;
[_message,"Status"] call BIS_fnc_3DENShowMessage;
};
{
@ -24,10 +32,16 @@ if (_objects isEqualTo []) exitWith
};
} else {
_message = format["Object type %1 ignored: only enterable buildings can be garrisoned",typeOf _x];
systemChat _x;
diag_log _x;
systemChat _message;
diag_log _message;
[_message,"Status"] call BIS_fnc_3DENShowMessage;
};
} forEach _objects;
_message = format["Garrison State of %1 buildings updated to %2",count _objects,_state];
systemChat _message;
if (_markersStateON) then
{
[true] call blck3DEN_fnc_displayGarrisonMarkers;
};
[_message,"Status"] call BIS_fnc_3DENShowMessage;

View File

@ -8,6 +8,8 @@
*/
params["_state"];
private _markerStateON = missionNameSpace getVariable["blck_displayLootMarkerOn",false];
[false] call blck3DEN_fnc_displayLootMarkers;
private "_message";
private _objects = get3DENSelected "object" select {(typeOf _x) isKindOf "Car" || (typeOf _x) isKindOf "Ship"}; //
if (_objects isEqualTo []) exitWith
@ -38,5 +40,10 @@ if (_objects isEqualTo []) exitWith
systemChat _message;
};
} forEach _objects;
if (_markerStateON) then
{
[true] call blck3DEN_fnc_displayLootMarkers;
};
_message = format["Loot Vehicle State of %1 objects updated to %2",count _objects,_state];
systemChat _m;

View File

@ -1,4 +1,9 @@
/*
blckeagls 3EDEN Editor Plugin
by Ghostrider-GRG-
Copyright 2020
*/
private _objects = get3DENSelected "object";
private _markers select {(typeOf _x) = _markerType};
{

View File

@ -1,16 +1,11 @@
private _objects = get3DENSelected "object" select {(typeOf _x) isKindOf "Car" || (typeOf _x) isKindOf "Ship"}; //
if (count _objects == 1) then
all3DENEntities params ["_objects"];
{
private _obj = _objects select 0;
private _marker = create3DENEntity ["object","Sign_Arrow_Blue_F",getPos _obj];
private _bbr = boundingBoxReal vehicle player;
_p1 = _bbr select 0;
_p2 = _bbr select 1;
_height = abs ((_p2 select 2) - (_p1 select 2));
_markerPos = getPos _marker;
_marker setPosATL [_markerPos select 0, _markerPos select 1, (_markerPos select 2) + _height];
} else {
systemChat "no vehicles selected";
};
diag_log format [
"classname %1 | position %2 | direction %3 | isSimple = %4",
(_x get3DENAttribute "ItemClass") select 0,
(_x get3DENAttribute "position") select 0,
((_x get3DENAttribute "rotation") select 0) select 2,
(_x get3DENAttribute "objectIsSimple") select 0
];
} forEach _objects;

View File

@ -23,26 +23,6 @@ lootVehicleVariableName = getText(configFile >> "CfgBlck3DEN" >> "configs" >> "
buildingPosGarrisonVariableName = getText(configFile >> "CfgBlck3DEN" >> "configs" >> "buildingPosGarrisonVariableName");
buildingATLGarrisionVariableName = getText(configFile >> "CfgBlck3DEN" >> "configs" >> "buildingATLGarrisionVariableName");
/*
{
diag_log format["param %1 = %2",_forEachIndex,_x];
} forEach [
objectAtMissionCenter,
blck_minAI,
blck_maxAI,
minPatrolRadius,
maxPatrolRadius,
maxVehiclePatrolRadius,
aircraftPatrolRadius,
oddsOfGarison,
maxGarrisonStatics,
typesGarrisonStatics,
blck_MissionDifficulty,
lootVehicleVariableName,
buildingPosGarrisonVariableName,
buildingATLGarrisionVariableName
];*/
CENTER = [0,0,0];
diag_log format["Dynamic Export called at %1",diag_tickTime];
@ -87,8 +67,8 @@ if (isNil "blck_missionEndCondition") then
Look for an object defined in CfgBlck3DEN \ configs \ that marks the center of the mission
and set the coords of the center if such an object is found
*/
private _centerMarkers = allMissionObjects objectAtMissionCenter;
all3DENEntities params ["_objects","_groups","_triggers","_systems","_waypoints","_markers","_layers","_comments"];
private _centerMarkers = _objects select {(typeOf _x) isEqualTo objectAtMissionCenter};
diag_log format["_centerMarkers = %1",_centerMarkers];
if !(_centerMarkers isEqualTo []) then
{
@ -99,13 +79,6 @@ if !(_centerMarkers isEqualTo []) then
diag_log format["Place such an object or a marker to ensure the mission is accurately stored and spawned"];
};
all3DENEntities params ["_objects","_groups","_triggers","_systems","_waypoints","_markers","_layers","_comments"];
private _units = [];
{
{
if (vehicle _x isEqualTo _x) then {_units pushBack _x};
} forEach (units _x);
} forEach _groups;
private["_m1","_markerPos","_markerType","_markerShape","_markerColor","_markerText","_markerBrush","_markerSize","_markerAlpha"];
/*
@ -115,11 +88,11 @@ if !(_markers isEqualTo []) then
{
_m1 = _markers select 0;
_markerType = (_m1 get3DENAttribute "itemClass") select 0;
_markerShape = (_m1 get3DENAttribute "markerType") select 0;
//_markerShape = (_m1 get3DENAttribute "markerType") select 0;
_markerColor = (_m1 get3DENAttribute "baseColor") select 0;
_markerText = (_m1 get3DENAttribute "text") select 0;
if !(_markerText isEqualTo "") then {blck_dynamicmarkerMissionName = _markerText};
_markerBrush = (_m1 get3DENAttribute "markerBrush") select 0;
_markerBrush = (_m1 get3DENAttribute "brush") select 0;
_markerPos = (_m1 get3DENAttribute "position") select 0;
_markerSize = (_m1 get3DENAttribute "size2") select 0;
_markerText = (_m1 get3DENAttribute "text") select 0;
@ -136,11 +109,11 @@ if !(_markers isEqualTo []) then
diag_log format["<WARNING> More than one marker was found; only the first marker was processed"];
};
} else {
_markerType = "mil_square";
_markerShape = "null";
_markerSize = "[0,0]";
_markerType = "ELLIPSE";
//_markerShape = "ELLIPSE";
_markerSize = "[250,250]";
_markerColor = "COLORRED";
_markerBrush = "null";
_markerBrush = "SOLID";
if !(_objects isEqualTo []) then
{
CENTER = getPosATL (_objects select 0);
@ -149,7 +122,6 @@ if !(_markers isEqualTo []) then
};
diag_log format["<WARNING> No marker was found, using default values and position for mission center position"];
};
diag_log format["_m1 = %1 | _type = %2 | _shape = %3 | _size = %4 | _color = %5 | _brush = %6 | _text = %7",_m1,_markerType,_markerShape,_markerSize,_markerColor,_markerBrush,_markerText];
if (CENTER isEqualTo [0,0,0]) then
{
@ -162,7 +134,7 @@ private _garisonedStatics = [];
private _garisonedUnits = [];
private _landscape = _objects select{
!(isSimpleObject _x) &&
!((_x get3DENAttribute "objectIsSimple") select 0) &&
((typeOf _x) isKindOf "Static" || ( (typeOf _x) isKindOf "ThingX")) &&
!((typeOf _x) isKindOf "ReammoBox_F") &&
!(_x getVariable["isLootContainer",false]) &&
@ -170,51 +142,80 @@ private _landscape = _objects select{
};
private _garisonedPos = [];
private _helpers = _objects select {((typeOf _x) isEqualTo garisonMarkerObject)};
diag_log format["_exportDynamic (152): count _landscape = %1",count _landscape];
for "_i" from 1 to (count _landscape) do
{
if (_x getVariable["garrisoned",false]) then
if (isNull _building) exitWith {};
private _building = _landscape deleteAt 0;
if (_building getVariable["garrisoned",false]) then
{
_garisonedBuildings pushbackunique _building;
// data structure ["building Classname",[/*building pos*/],/*building dir*/,/*odds of garrison*/, /*Max Statics*/,/*types statics*/,/*max units*/],
// 1 2 3 4 5 6 7 8 9
_garisonedPos pushBack format[' [" %1",%2,%3,%4,%5,%6,%7,%8,%9]',typeOf _building,(getPosATL _building) vectorDiff CENTER,getDir _building, 'true','true',oddsOfGarrison,maxGarrisonStatics,typesGarrisonStatics,maxGarrisonUnits];
private _allowDamage = (_building get3DENAttribute "allowDamage") select 0;
private _enableSimulation = (_building get3DENAttribute "enableSimulation") select 0;
diag_log format["_exportDynamic-garisonedPos: _building %1 | damage %2 | simulation %3",_building,_allowDamage,_enableSimulation];
/*
// From blck_fnc_garrisonBuilding_RelPosSystem
// ["Land_Unfinished_Building_02_F",[-21.8763,-45.978,-0.00213432],0,true,true,0.67,3,[],4],
_x params["_bldClassName","_bldRelPos","_bldDir","_s","_d","_p","_noStatics","_typesStatics","_noUnits"];
*/
_garisonedPos pushBack format[' ["%1",%2,%3,%4,%5,%6,%7,%8,%9]',
typeOf _building,
(getPosATL _building) vectorDiff CENTER,
getDir _building,
_allowDamage,
_enableSimulation,
oddsOfGarrison,
maxGarrisonStatics,
typesGarrisonStatics,
maxGarrisonUnits];
} else {
_landscape pushBack _building;
};
} forEach _landscape;
//diag_log format["CENTER = %1 | _landscape = %2",CENTER,_landscape];
};
private _garrisonATL = [];
diag_log format["_exportDynamic (169): count _landscape = %1",count _landscape];
for "_i" from 1 to (count _landscape) do
{
_atl = [_x,CENTER] call blck3DEN_fnc_configureGarrisonATL;
// format["_fnc_exportDynamic: _building = %1 | _atl = %2",_x,_atl];
//diag_log format["_fnc_exportDynamic: typeName _atl = %1",typeName _atl];
if (typeName _atl isEqualTo "STRING") then {diag_log format["_fnc_exportDynamic: length _atl = %1 | _atl = '' is %2",count _atl, _atl isEqualTo ""]};
if !(_atl isEqualTo []) then {
if !((_atl select 0) isEqualTo []) then
{
if (isNull _building) exitWith {};
private _building = _landscape deleteAt 0;
_atl = [_building,CENTER] call blck3DEN_fnc_configureGarrisonATL;
if (_atl isEqualTo []) then {
_landscape pushBack _building;
} else {
_garrisonATL pushBack (format[" %1",_atl select 0]);
_garisonedBuildings pushBack _x;
_garisonedBuildings pushBack _building;
_garisonedStatics append (_atl select 1);
_garisonedUnits append (_atl select 2)
//diag_log format["_fnc_exportDynamic: garrisoned building added: %1",_atl];
};
_garisonedUnits append (_atl select 2);
};
} forEach _landscape;
};
diag_log format["_garrisonATL = %1",_garrisonATL];
diag_log format["_exportDynamic (185): count _landscape = %1",count _landscape];
private _missionLandscape = [];
for "_i" from 1 to (count _landscape) do
{
if !(_x in _garisonedBuildings) then
private _building = _landscape deleteAt 0;
if (isNull _building) exitWith {};
if !(_building getVariable["marker",false]) then
{
_missionLandscape pushBack format[' ["%1",%2,%3,%4,%5]',typeOf _x,(getPosATL _x) vectorDiff CENTER,getDir _x, 'true','true'];
private _allowDamage = (_building get3DENAttribute "allowDamage") select 0;
private _enableSimulation = (_building get3DENAttribute "enableSimulation") select 0;
diag_log format["typeOf _x = %1 | damage = %2 | simulation = %3",typeOf _building,_allowDamage,_enableSimulatoin];
_missionLandscape pushBack format[' ["%1",%2,%3,%4,%5]',typeOf _building,(getPosATL _building) vectorDiff CENTER,getDir _building, _allowDamage,_enableSimulation];
};
}forEach _landscape;
};
private _simpleObjects = _objects select {isSimpleObject _x};
private _simpleObjects = _objects select {(_x get3DENAttribute "objectIsSimple") select 0};
diag_log format["_simpleObjects = %1",_simpleObjects];
private _missionSimpleObjects = [];
{
_missionSimpleObjects pushBack format[' ["%1",%2,%3,%4,%5]',typeOf _x,(getPosATL _x) vectorDiff CENTER,getDir _x, 'true','true'];
private _object = format[' ["%1",%2,%3]',
(_x get3DENAttribute "ItemClass") select 0,
((_x get3DENAttribute "position") select 0) vectorDiff CENTER,
((_x get3DENAttribute "rotation") select 0) select 2
];
diag_log format["_object = %1",_object];
_missionSimpleObjects pushBack _object;
} forEach _simpleObjects;
private _missionLootVehicles = [];
@ -232,7 +233,7 @@ _missionPatrolVehicles = [];
private _patrolVehicles = _objects select {
(((typeOf _x) isKindOf "Car") || ((typeOf _x) isKindOf "Tank") || ((typeOf _x) isKindOf "Ship")) &&
!((typeOf _x) isKindOf "SDV_01_base_F") &&
!(_x in _lootVehicles)
!(_x getVariable["lootvehicle",false])
};
diag_log format["_patrolVehicles = %1",_patrolVehicles];
{
@ -275,6 +276,12 @@ private _infantry = _units select {
};
diag_log format["_garisonedUnits = %1",_garisonedUnits];
diag_log format["_infantry = %1",_infantry];
private _units = [];
{
{
if (vehicle _x isEqualTo _x) then {_units pushBack _x};
} forEach (units _x);
} forEach _groups;
_infantryGroups = [];
{
_infantryGroups pushBack format[' [%1,%2,%3,"%4",%5,%6]',(getPosATL _x) vectorDiff CENTER,blck_minAI,blck_maxAI,blck_MissionDifficulty,minPatrolRadius,maxPatrolRadius];
@ -339,7 +346,7 @@ _lines pushback (_missionLandscape joinString (format [",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "_simpleObjects = [";
_lines pushback (_simpleObjects joinString (format [",%1", _lineBreak]));
_lines pushback (_missionSimpleObjects joinString (format [",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "_missionLootVehicles = [";
@ -407,6 +414,8 @@ _lines pushBack format["_maxNoAI = blck_MaxAI_%1;",blck_MissionDifficulty];
_lines pushBack format["_noAIGroups = blck_AIGrps_%1;",blck_MissionDifficulty];
_lines pushBack format["_noVehiclePatrols = blck_SpawnVeh_%1;",blck_MissionDifficulty];
_lines pushBack format["_noEmplacedWeapons = blck_SpawnEmplaced_%1;",blck_MissionDifficulty];
_lines pushBack "_submarinePatrols = 0; // Default number of submarine patrols at pirate missions";
_lines pushBack "_scubaPatrols = 0; // Default number of scuba diver patrols at pirate missions";
_lines pushBack "";
_lines pushBack '#include "\q\addons\custom_server\Compiles\Missions\GMS_fnc_missionSpawner.sqf";';

View File

@ -89,11 +89,11 @@ if !(_markers isEqualTo []) then
{
_m1 = _markers select 0;
_markerType = (_m1 get3DENAttribute "itemClass") select 0;
_markerShape = (_m1 get3DENAttribute "markerType") select 0;
//_markerShape = (_m1 get3DENAttribute "markerType") select 0;
_markerColor = (_m1 get3DENAttribute "baseColor") select 0;
_markerText = (_m1 get3DENAttribute "text") select 0;
if !(_markerText isEqualTo "") then {blck_dynamicmarkerMissionName = _markerText};
_markerBrush = (_m1 get3DENAttribute "markerBrush") select 0;
_markerBrush = (_m1 get3DENAttribute "brush") select 0;
_markerPos = (_m1 get3DENAttribute "position") select 0;
_markerSize = (_m1 get3DENAttribute "size2") select 0;
_markerText = (_m1 get3DENAttribute "text") select 0;
@ -103,7 +103,7 @@ if !(_markers isEqualTo []) then
*/
} else {
_markerType = "mil_square";
_markerShape = "";
//_markerShape = "";
_markerSize = [0,0];
_markerColor = "COLORRED";
_markerBrush = "";
@ -116,7 +116,7 @@ private _garisonedStatics = [];
private _garisonedUnits = [];
private _landscape = _objects select{
!(isSimpleObject _x) &&
!((_x get3DENAttribute "objectIsSimple") select 0) &&
((typeOf _x) isKindOf "Static") &&
!((typeOf _x) isKindOf "Helper")
};
@ -124,14 +124,20 @@ private _landscape = _objects select{
diag_log format["CENTER = %1 | _landscape = %2","ignored",_landscape];
private _missionLandscape = [];
{
_missionLandscape pushBack format[' ["%1",%2,%3,%4]',typeOf _x,(getPosATL _x),[vectorDir _x,vectorUp _x], [true,true]];
private _allowDamage = (_x get3DENAttribute "allowDamage") select 0;
private _enableSimulation = (_x get3DENAttribute "enableSimulation") select 0;
_missionLandscape pushBack format[' ["%1",%2,%3,%4]',typeOf _x,(getPosATL _x),[vectorDir _x,vectorUp _x], [_allowDamage,_enableSimulation]];
}forEach _landscape;
private _simpleObjects = _objects select {isSimpleObject _x};
private _simpleObjects = _objects select {(_x get3DENAttribute "objectIsSimple") select 0};
diag_log format["_simpleObjects = %1",_simpleObjects];
private _missionSimpleObjects = [];
{
_missionSimpleObjects pushBack format[' ["%1",%2,%3,%4,%5]',typeOf _x,(getPosATL _x),[vectorDir _x,vectorUp _x], 'true','true'];
_missionSimpleObjects pushBack format[' ["%1",%2,%3]',
(_x get3DENAttribute "ItemClass") select 0,
((_x get3DENAttribute "position") select 0),
((_x get3DENAttribute "rotation") select 0) select 2
];
} forEach _simpleObjects;
private _missionLootVehicles = [];
@ -247,7 +253,7 @@ _lines pushback (_missionLandscape joinString (format [",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "_simpleObjects = [";
_lines pushback (_simpleObjects joinString (format [",%1", _lineBreak]));
_lines pushback (_missionSimpleObjects joinString (format [",%1", _lineBreak]));
_lines pushBack "];";
_lines pushBack "";
_lines pushBack "_missionLootVehicles = [";
@ -285,7 +291,6 @@ _lines pushBack "";
_lines pushBack "/*";
_lines pushBack " Use the parameters below to customize your mission - see the template or blck_configs.sqf for details about each them";
_lines pushBack "*/";
_linse pushBack "_useMines = blck_useMines;";
_lines pushBack "_uniforms = blck_SkinList;";
_lines pushBack "_headgear = blck_headgear;";

View File

@ -1,21 +0,0 @@
Variables to define
marker parameters
Marker Text
Mission start message
Mission end message
Mission level
To pull units:
private _units = allUnits;
To pull objects:
_center = allMissionObejcts "RoadCone_L_F";
_buildings = allMissionObjects "Building";
_things = allMissionObjects "ThingX";
_baseObjects = _buildings append _things;
_static = allMissionObejcts "StaticWeapon";
_vehicles = allMissionObejcts "Car" + allMissionObejcts "Tank" + allMissionObejcts "Ship";
_air = allMissionObejcts "Air";

View File

@ -52,8 +52,8 @@ class CfgBlck3DEN
class CfgVersion
{
version = 1.0;
build = 4;
date = "09/5/20";
build = 8;
date = "10/05/20";
};
};

View File

@ -47,6 +47,7 @@ class CfgFunctions
class about {};
class buildingContainer {};
class configureGarrisonATL {};
class createLootMarker {};
class createGarrisonMarker {};
class display {};
@ -54,11 +55,6 @@ class CfgFunctions
class displayLootMarkers {};
class getGarrisonInfo {};
class getLootVehicleInfo {};
//class getMissionGarrisonInfo {};
//class getMissionLootVehicleInfo {};
class help {};
class initializeAttributes {};
class isInfantry {};
class isInside {};
class loadCratesTiming {};
class onDrag {};
@ -71,10 +67,6 @@ class CfgFunctions
class setLootVehicle {};
class setSpawnLocations {};
class spawnCratesTiming {};
//class endMessage {};
//class startMessage {};
//class configureGarrisonATL {};
class versionInfo {};
};
};

View File

@ -0,0 +1,7 @@
Features:
Exports static or dynamic missions preformated in .sqf code. Simply paste the output of the editor into a new .sqf file, edit entires to refine mission parameters and add the name of the mission file to GMS_missionLists.
Captures simple objects, sets allow dammage and allow similation according to editor settings, and captures marker configurations.

View File

@ -9,17 +9,24 @@ Many thanks for new Coding and ideas from Grahame.
Significant Changes:
=====================
7.00 Build 218
7.02 Build 230
New: Option to hide bushes and trees that happen to be under the location in which an enterable building is spawned
blck_hideRocksAndPlants = true; // When true, any rocks, trees or bushes under enterable buildings will be 'hidden'
New: Added support for simple objects. Note that these can be exported by the editor tool now.
New: Option to drop crates on a parachute at mission spawn which adds some randomness to where crates end up.
blck_spawnCratesTiming = "atMissionSpawnAir";
New: You can now add money to crates at static missions by defining the following parameter in your .sqf for the mission.
_crateMoney = 10000;
// this can be a value or a range such as [1000,10000];
this can be a value or a range such as [1000,10000];
a random amount of money from 0 to the maximum defined will be added.
New: Added checks and logging for invalid marker types and colors; default values are now provided.
New: Added some basic error checking and logging for incorrect entries for some key settings.
New: 3DEN Editor plugin exports missions as .sqf formated text ready to paste into a file.
@ -27,16 +34,20 @@ New: 3DEN Editor plugin exports missions as .sqf formated text ready to paste in
Fixed: Don and Hostage missions could not be completed
Fixed: Missions tended to spawn all at once
Fixed: vehicles are spawned at a safe spot which should reduce unintended explosions
Fixed: Vehicles sometimes blew up on spawn. vehicles are spawned at a safe spot which should reduce unintended explosions
Fixed: Missions sometimes spawned on steep hillsides.
Fixed: Vehicles sometimes blew up on spawn.
Fixed: Missions were not distributed over the entire map. The scripts now pick a random quadrant to search thus ensuring broader distribution of mission locations.
Fixed: Money was not added to crates at dynamic missions
Fixed: Markers were not shown if more than once instance of a mission was spawned.
Fixed: No subs or scuba units were spawned at dynamic UMS missions.
Fixed: Jets crashed at spawn in.
Changed: Timers for spawning missions adjusted a bit to space out spawn/timeouts a bit more.
Changed: The system has been upgreaded to a state-based system, meaning only one script (GMS_fnc_mainThread)is running once all missions are initialized.
Changed: a lot of debugging was removed.
Changed: The system has been upgraded to a state-based system, meaning only one script (GMS_fnc_mainThread)is running once all missions are initialized.
Changed: a lot of debugging code was removed.
Changed: List of missions for dynamic Underwater missions was moved to \Missions\GMS_missionLIsts.sqf
Changed: Units spawned where the surface is water are spawned with UMS gear now.
Changed: Added some CBA compatability (Thanks to porkeid for the fixes)
6.98 Build 206
FIXED: few minor bug fixes.
@ -59,12 +70,6 @@ Removed: some debugging and map sepcific settings from blck_custom_config.sqf
Changed: some code for finding locations for a new mission.
Added: all blckeagls map markers have the same prefix: "blckeagls_marker"
6.96 Build 199
Added support for Arma servers not running Epoch or Exile
@ -117,8 +122,6 @@ Added offloading of AI to clients
// TODO: set to false before release
blck_limit_ai_offload_to_blckeagls = true; // when true, only groups spawned by blckeagls are evaluated.
Fixed - Vehicle unlock when empty of crew through adding a getOut event handler.
Code for spawning vehicles redone to reduced redundancy.
Monitoring of groups refined to route mission groups that have left the mission area back to it.
@ -241,7 +244,7 @@ Added: A new mission completion condition for hostage and captive missions.
Added: Mission crates can now be spawned on the ground or in the air at mission completion.
blck_spawnCratesTiming sets the default for all missions.
blck_spawnCratesTiming = "atMissionEndAir"; // Choices: "atMissionSpawnGround","atMissionStartAir","atMissionEndGround","atMissionEndAir".
blck_spawnCratesTiming = "atMissionEndAir"; // Choices: "atMissionSpawnGround","atMissionSpawnAir","atMissionEndGround","atMissionEndAir".
Define _spawnCratesTiming to set this parameter for a particular mission.
_spawnCratesTiming = "atMissionEndAir";
See the hostage1.sqf mission as an example.