DMS_Exile/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf
eraser1 9b8e4e1573 Static Missions! And MORE!
* ** NEW CONFIG VALUES:

|DMS_MaxStaticMissions|
|DMS_TimeToFirstStaticMission|
|DMS_TimeBetweenStaticMissions|
|DMS_StaticMissionTimeOut|
|DMS_StaticMissionTimeoutResetRange|
|DMS_StaticMinPlayerDistance|
|DMS_UsePredefinedMissionLocations|
|DMS_PredefinedMissionLocations|
|DMS_MinDistFromWestBorder|
|DMS_MinDistFromEastBorder|
|DMS_MinDistFromSouthBorder|
|DMS_MinDistFromNorthBorder|
|DMS_StaticMissionTypes|
**
* Added new value "DMS_Version".
* ** "DMS_fnc_SpawnAIStatic" is now "DMS_fnc_SpawnAIStaticMG";
donthasslethehoff, mercbase, and testmission have been updated with the
new names**
* DMS will now check to make sure that marker colors passed to
fn_CreateMarker are valid marker colors.
* You can now control how far away from each border a mission will spawn
(each border is separate: west, east, south, north). All "supported"
maps have config values adjusted in "map_configs".
* New salt flats base by [Darth Rogue from
SOA](http://soldiersofanarchy.net/).
* **IMPLEMENTED STATIC MISSIONS (initial version). "saltflats" is
currently the only static mission for Altis ONLY. However, it shouldn't
be too difficult to export it to other maps (once positions have been
adjusted). **
* Fixed a couple of outdated/inaccurate function documentation comments.
* **FINALLY REMOVED THE Default Value "-1" PARAMS RPT SPAM. I FOUND IT.
YESSSSS**
* Fixed fn_CleanUp producing debug logs even with debug disabled.
* Fixed the CleanUp list not Cleaning Up after itself (hah!).
* Added diag_tickTime and DMS_Version to debug logs.
* You can now define a custom function for DMS_FillCrate. It will be
passed params from _lootValues select 0. ** I haven't tested this at
all. Just keep that in mind ;) **
* You can now manually define mission spawning locations into an array,
and that array will be used to find a location. Each location will still
be checked for validity, and if no valid positions are found from the
list, a random one is then generated using the normal method. ** I
didn't test this part at all either :P **
* fn_FindSafePos should be even more efficient now, and even more
controllable.
* Quite a few new functions; most notably: fn_GroupReinforcementsManager
* fn_GroupReinforcementsManager is used by static missions to provide
reinforcements for AI once they fall below a certain threshold (and/or
any other parameters you provide). Make sure to check out the function
documentation and give any suggestions for new reinforcement types!
* New function "DMS_fnc_ImportFromM3E_Static" will simply import a base
from the provided file (under static). No conversion to relative
position or anything. Simply spawning, positioning, and disabling
simulation.
* Removed the check for being outside map edges from fn_isValidPosition.
* "hardcore" AI will now be even more difficult ;)
2015-10-30 21:18:58 -05:00

140 lines
3.6 KiB
Plaintext

/*
DMS Pre-init
Written by eraser1 (trainwreckdayz.com)
*/
DMS_HC_Object = objNull;
DMS_CleanUpList = [];
//Load main config
call compileFinal preprocessFileLineNumbers "\x\addons\dms\config.sqf";
//Load map-specific configs. Should make it easier for people with multiple servers/maps. One PBO to rule them all...
if (DMS_Use_Map_Config) then
{
call compileFinal preprocessFileLineNumbers (format ["\x\addons\dms\map_configs\%1_config.sqf",toLower worldName]);
};
// Some custom maps don't have the proper safePos config entries.
// If you are using one and you have an issue with mission spawns, please create an issue on GitHub or post a comment in the DMS thread.
switch (toLower worldName) do
{
case "altis": // [16000,16000] w/ radius of 16000 works well for Altis
{
DMS_MapCenterPos = [16000,16000];
DMS_MapRadius = 16000;
};
case "bornholm": // Thanks to thirdhero for testing this info
{
DMS_MapCenterPos = [11265,11265];
DMS_MapRadius = 12000;
};
case "esseker": // Thanks to Flowrider for this info
{
DMS_MapCenterPos = [6275,6350];
DMS_MapRadius = 5000;
};
case "tavi": // Thanks to JamieKG for this info
{
DMS_MapCenterPos = [12800,12800];
DMS_MapRadius = 12800;
};
default // Use "worldSize" to determine map center/radius (not always very nice).
{
private "_middle";
_middle = worldSize/2;
DMS_MapCenterPos = [_middle,_middle];
DMS_MapRadius = _middle;
};
};
// Since we use primarily ATL
DMS_MapCenterPos set [2,0];
/*
Original Functions from
http://maca134.co.uk/portfolio/m3editor-arma-3-map-editor/
Slightly modified by eraser1
*/
M3E_fnc_getCenter =
{
private ['_objects', '_ax', '_ay', '_az', '_xs', '_xc', '_xz', '_ys', '_yc', '_yz', '_zs', '_zc', '_zz'];
_objects = [_this, 0, [], [[]]] call BIS_fnc_param;
_ax = [];
_ay = [];
_az = [];
{
private ['_position'];
_position = getPosATL _x;
_ax pushBack (_position select 0);
_ay pushBack (_position select 1);
_az pushBack (_position select 2);
} foreach _objects;
_xs = 0;
_xc = {_xs = _xs + _x; true} count _ax;
_xz = _xs / _xc;
_ys = 0;
_yc = {_ys = _ys + _x; true} count _ay;
_yz = _ys / _yc;
_zs = 0;
_zc = {_zs = _zs + _x; true} count _az;
_zz = _zs / _zc;
[_xz, _yz, _zz]
};
M3E_fnc_subArr =
{
private ['_a1', '_a2', '_a3'];
_a1 = [_this, 0, [], [[]]] call BIS_fnc_param;
_a2 = [_this, 1, [], [[]]] call BIS_fnc_param;
if (count _a1 == 0 || {count _a2 == 0}) exitWith {[]};
if (count _a1 != count _a2) exitWith {[]};
_a3 = [];
{
_a3 pushBack ((_a1 select _foreachindex) - (_a2 select _foreachindex));
} foreach _a1;
_a3
};
DMS_fnc_setRelPositions =
{
private ['_OK','_objects','_newCPos','_center'];
_OK = params
[
["_objects", [], [[]]],
["_newCPos", [], [[]],[3]]
];
if (!_OK) exitWith
{
diag_log format ["DMS ERROR :: Calling DMS_fnc_setRelPositions with invalid parameters: %1",_this];
};
_center = [_objects] call M3E_fnc_getCenter;
{
private ['_relpos','_objPos'];
_relpos = [getPosATL _x, _center] call M3E_fnc_subArr;
_objPos = [_newCPos,_relpos] call DMS_fnc_CalcPos;
_x setPosATL _objPos;
//diag_log format ["Setting %1 at %2; %3 is the relpos from original center %4, reapplied to new center %5",typeOf _x,_objPos,_relpos,_center,_newCPos];
} foreach _objects;
};
// Because I fucked up the name on first implementation and don't want to mess anybody up who didn't realize to change every occurence of "DMS_MaxSurfaceNormal" to "DMS_MinSurfaceNormal".
DMS_MaxSurfaceNormal = DMS_MinSurfaceNormal;
DMS_AttemptsUntilThrottle = DMS_AttemptsUntilThrottle + 1;