Merge pull request #43 from Defent/Test

Merge Test to Live
This commit is contained in:
eraser1 2016-06-24 17:53:55 -05:00 committed by GitHub
commit 89613844d7
68 changed files with 2098 additions and 1189 deletions

View File

@ -4,7 +4,7 @@ class CfgPatches
{
units[] = {};
weapons[] = {};
a3_DMS_version = "April 27, 2016";
a3_DMS_version = "June 20, 2016 (RC1.5)";
requiredVersion = 1.36;
requiredAddons[] = {"exile_client","exile_server_config"};
};
@ -30,6 +30,7 @@ class CfgFunctions
file = "\x\addons\dms\scripts";
class AddMissionToMonitor {};
class AddMissionToMonitor_Static {};
class AddWeapon {};
class AILocalityManager {};
class BroadcastMissionStatus {};
class CalcPos {};
@ -41,16 +42,22 @@ class CfgFunctions
class FindSafePos {};
class FindSafePos_InRange {};
class FindSuppressor {};
class FreezeManager {};
class FreezeToggle {};
class GetAllUnits {};
class GetCenter {};
class GetEmptySeats {};
class GroupReinforcementsManager {};
//class HandleMissionEvents {};
class HeliParatroopers_Monitor {};
//class HeliPatrol {};
class ImportFromM3E {};
class ImportFromM3E_Convert {};
class ImportFromM3E_Static {};
class ImportFromM3E_3DEN {};
class ImportFromM3E_3DEN_Convert {};
class ImportFromM3E_3DEN_Static {};
class IsPlayerNearby {};
class IsPosBlacklisted {};
class IsNearWater {};
class IsValidPosition {};
class MissionParams {};
@ -68,6 +75,7 @@ class CfgFunctions
class SetAILocality {};
class SetGroupBehavior {};
class SetGroupBehavior_Separate {};
class SetRelPositions {};
class SpawnAIGroup {};
class SpawnAIGroup_MultiPos {};
class SpawnAIVehicle {};
@ -80,6 +88,7 @@ class CfgFunctions
class SpawnNonPersistentVehicle {};
class SpawnPersistentVehicle {};
class SpawnStaticMission {};
class SubArr {};
class TargetsKilled {};
};
};

View File

@ -1,18 +1,15 @@
/*
A lot of these configs are influenced by WAI :P
https://github.com/nerdalertdk/WICKED-AI
Main DMS Config File
Created by eraser1
Several revisions and additions have been made by community members.
A lot of these configs are influenced by WAI :P
https://github.com/nerdalertdk/WICKED-AI
*/
// Enables debug logging in DMS functions.
// Logs will be written in the RPT, and if you have infiSTAR's "ARMA_LOG" DLL loaded, it will also produce logs in the server directory.
// If you have mARMA by maca134, DMS will also utilize mARMA logs.
// This will produce A LOT of logs, so make sure you leave it to false unless you know what you're doing.
DMS_DEBUG = false;
DMS_Use_Map_Config = true; // Whether or not to use config overwrites specific to the map.
/*
@ -21,7 +18,7 @@ DMS_Use_Map_Config = true; // Whether or not to use config overwrites specific t
For any questions regarding map-specific configs, please leave a reply in the DMS thread on the Exile forums.
*/
DMS_Enable_RankChange = false; // Whether or not to use Rank Changes.
DMS_Enable_RankChange = false; // Whether or not to use Rank Changes. (Required 'true' if using Occupation)
/*
I am sharing this upgrade to all. If you utilize GR8 Humanity (fully compatible) or a custom version of a ranking system(simple variable changes), this will allow your players to score +/- for Bandit and Hero kills as well as a custom Survivor Faction added to DMS as well. You can still utilize the HERO / BANDIT / SURVIVOR respect and poptab settings for gameplay :) ENJOY! DONKEYPUNCH.INFO!
*/
@ -59,7 +56,6 @@ DMS_SpawnMissions_Scheduled = false; // Whether or not to spawn missions in a sc
DMS_AI_KillPercent = 100; // The percent amount of AI that need to be killed for "killPercent" mission requirement (NOT IMPLEMENTED)
/*Mission Marker settings*/
DMS_MissionMarkerCount = 2; // If you modify your CreateMarker and have multiple markers, you probably want to change this. *cough*Vish*cough*
DMS_ShowDifficultyColorLegend = true; // Whether or not to show a "color legend" at the bottom left of the map that shows which color corresponds to which difficulty. I know it's not very pretty, meh.
DMS_MarkerText_ShowMissionPrefix = true; // Whether or not to place a prefix before the mission marker text. Enable this if your players get confused by the marker names :P
DMS_MarkerText_MissionPrefix = "Mission:"; // The text displayed before the mission name in the mission marker.
@ -216,9 +212,9 @@ DMS_SpawnMissions_Scheduled = false; // Whether or not to spawn missions in a sc
DMS_StaticMissionTypes = [ // List of STATIC missions with spawn chances.
//["saltflats",1], //<--Example (already imported by default on Altis)
//["slums",1] //<--Example (already imported by default on Altis)
//["saltflats",1] //<--Example (already imported by default on Altis in map configs)
//["slums",1] //<--Example (already imported by default on Altis in map configs)
//["occupation",1] //<--Example
//["sectorB",1] //<--Example for Taviana
];
@ -232,27 +228,30 @@ DMS_SpawnMissions_Scheduled = false; // Whether or not to spawn missions in a sc
];
DMS_StaticMissionsOnServerStart = [ // List of STATIC missions with spawn chances.
//"saltflats", //<--Example
//"slums //<--Example
//"saltflats" //<--Example
//"slums" //<--Example
//"occupation" //<--Example
//"sectorB" //<--Example for Taviana
];
DMS_findSafePosBlacklist = [ // For BIS_fnc_findSafePos position blacklist info refer to: http://www.exilemod.com/topic/61-dms-defents-mission-system/?page=18#comment-31190
DMS_findSafePosBlacklist = [ // For position blacklist info refer to: http://www.exilemod.com/topic/61-dms-defents-mission-system/?do=findComment&comment=31190
// An example is given in the altis_config.sqf (it blacklists the salt flats).
/*
// Blacklists most of the Northern Taviana Volcano
[[11375,16170],[14302,18600]],
[[13300,14670],[14875,16170]]
*/
//[[2350,4680],100] // This random example blacklists any position within 100 meters of coordinates "[2350,4680]"
];
/* Mission System Settings */
/* AI Settings */
DMS_AI_Classname = "O_recon_F"; // Since some of you wanted this...
DMS_AI_UseRealNames = true; // true if you want Arma assigned real names, false if you want random DMS assigned unit numbers
DMS_Show_Kill_Poptabs_Notification = true; // Whether or not to show the poptabs gained/lost message on the player's screen when killing an AI. (It will still change the player's money, it just won't show the "Money Received" notification)
DMS_Show_Kill_Respect_Notification = true; // Whether or not to show the "Frag Message" on the player's screen when killing an AI. (It will still change the player's respect, it just won't show the "AI Killed" frag message)
@ -343,6 +342,14 @@ DMS_SpawnMissions_Scheduled = false; // Whether or not to spawn missions in a sc
DMS_ai_offload_Only_DMS_AI = false; // Do you use other mission systems on your server but still want to offload AI? You should probably enable this then, unless you have tested it for compatibility.
DMS_ai_offload_notifyClient = false; // Notify the client when AI has been offloaded to the client.
DMS_ai_allowFreezing = true; // Whether or not to "freeze" AI that are a certain distance away from players (and therefore inactive).
DMS_ai_freeze_Only_DMS_AI = false; // Whether or not to "freeze" AI that are not spawned by DMS.
DMS_ai_freezingDistance = 3500; // If there are no players within this distance of the leader of an AI group, then the AI group will be "frozen".
DMS_ai_unfreezingDistance = 3500; // If there are players within this distance of the leader of an AI group, then the AI group will be "un-frozen".
DMS_ai_offloadOnUnfreeze = true; // Whether or not to offload AI to clients once they have been "un-frozen". NOTE: This config will be ignored if "DMS_ai_offload_to_client" is set to false.
DMS_ai_freezeCheckingDelay = 30; // How often (in seconds) DMS will check whether to freeze/un-freeze AI.
DMS_ai_freezeOnSpawn = true; // Whether or not to freeze an AI group when initially spawned.
DMS_ai_share_info = true; // Share info about killer
DMS_ai_share_info_distance = 300; // The distance killer's info will be shared to other AI
@ -441,6 +448,15 @@ DMS_SpawnMissions_Scheduled = false; // Whether or not to spawn missions in a sc
DMS_assault_equipment = [ // Equipment for Assault Class AI (stuff that goes in toolbelt slots)
"ItemGPS"
];
DMS_assault_RandItemCount = 2; // How many random items to add to the AI's inventory.
DMS_assault_RandItems = [ // The random items that will be added to the AI's inventory.
"Exile_Item_Catfood_Cooked",
"Exile_Item_Surstromming_Cooked",
"Exile_Item_PowerDrink",
"Exile_Item_EnergyDrink",
"Exile_Item_Vishpirin",
"Exile_Item_Bandage"
];
DMS_assault_helmets = [ // Helmets for Assault Class
"H_HelmetSpecB_paint1",
"H_HelmetIA_camo",
@ -516,6 +532,15 @@ DMS_SpawnMissions_Scheduled = false; // Whether or not to spawn missions in a sc
DMS_MG_equipment = [ // Equipment for MG Class AI (stuff that goes in toolbelt slots)
"Binocular"
];
DMS_MG_RandItemCount = 3; // How many random items to add to the AI's inventory.
DMS_MG_RandItems = [ // The random items that will be added to the AI's inventory.
"Exile_Item_EMRE",
"Exile_Item_Surstromming_Cooked",
"Exile_Item_PowerDrink",
"Exile_Item_PlasticBottleCoffee",
"Exile_Item_Vishpirin",
"Exile_Item_Instadoc"
];
DMS_MG_helmets = [ // Helmets for MG Class
"H_PilotHelmetHeli_I",
"H_PilotHelmetHeli_O",
@ -602,6 +627,14 @@ DMS_SpawnMissions_Scheduled = false; // Whether or not to spawn missions in a sc
"Rangefinder",
"ItemGPS"
];
DMS_sniper_RandItemCount = 3; // How many random items to add to the AI's inventory.
DMS_sniper_RandItems = [ // The random items that will be added to the AI's inventory.
"Exile_Item_EMRE",
"Exile_Item_PlasticBottleCoffee",
"Exile_Item_CanOpener",
"Exile_Item_Instadoc",
"Exile_Item_DuctTape"
];
DMS_sniper_helmets = [ // Helmets for Sniper Class
"H_HelmetSpecB_paint1",
"H_HelmetIA_camo",
@ -779,7 +812,9 @@ DMS_SpawnMissions_Scheduled = false; // Whether or not to spawn missions in a sc
"Exile_Item_ChristmasTinner_Cooked",
"Exile_Item_BBQSandwich_Cooked",
"Exile_Item_Catfood_Cooked",
"Exile_Item_DogFood_Cooked"
"Exile_Item_DogFood_Cooked",
"Exile_Item_EMRE",
"Exile_Item_EMRE"
];
DMS_BoxDrinks = [
"Exile_Item_PlasticBottleCoffee",

View File

@ -93,6 +93,11 @@ if ((isClass (configFile >> "CfgPatches" >> "Ryanzombies")) && {!DMS_ai_offload_
DMS_ai_offload_Only_DMS_AI = true;
};
if !(DMS_ai_offload_to_client) then
{
DMS_ai_offloadOnUnfreeze = false;
};
DMS_A3_AllMarkerColors = [];
@ -116,45 +121,17 @@ if !((toLower DMS_MissionMarkerLoseDotColor) in DMS_A3_AllMarkerColors) then
// Create and send Client Functions using compileFinal for security.
DMS_CLIENT_fnc_spawnDynamicText = compileFinal
("
[
_this,
0,
safeZoneY,
"+str DMS_dynamicText_Duration+",
"+str DMS_dynamicText_FadeTime+",
0,
24358+round(random 5)
] spawn BIS_fnc_dynamicText;
");
// Send Client Functions using compileFinal for security.
publicVariable "DMS_CLIENT_fnc_spawnDynamicText";
DMS_CLIENT_fnc_spawnTextTiles = compileFinal
("
[
parseText _this,
[
0,
safeZoneY,
1,
1
],
[10,10],
"+str DMS_textTiles_Duration+",
"+str DMS_textTiles_FadeTime+",
0
] spawn BIS_fnc_textTiles;
");
publicVariable "DMS_CLIENT_fnc_spawnTextTiles";
DMS_CLIENT_fnc_hintSilent = compileFinal "hintSilent parsetext format['%1',_this];";
publicVariable "DMS_CLIENT_fnc_hintSilent";
publicVariable "DMS_Version";
format["DMS_Version: %1",DMS_Version] remoteExecCall ["diag_log", -2, "DMS_LogVersion_JIP_ID"];
// Add the weighted predefined locations to the list of predefined locations
{
@ -221,14 +198,19 @@ if (DMS_ShowDifficultyColorLegend) then
[_x] call DMS_fnc_SpawnBanditMission;
} forEach DMS_BanditMissionsOnServerStart;
if (DMS_StaticMission) then
{
{
[_x] call DMS_fnc_SpawnStaticMission;
} forEach DMS_StaticMissionsOnServerStart;
} forEach DMS_StaticMissionsOnServerStart;
};
// Add heli paratroopers monitor to the thread system.
[5, DMS_fnc_HeliParatroopers_Monitor, [], true] call ExileServer_system_thread_addTask;
// Add "freeze" monitor to the thread system.
[DMS_ai_freezeCheckingDelay, DMS_fnc_FreezeManager, [], true] call ExileServer_system_thread_addTask;

View File

@ -2,8 +2,15 @@
DMS Pre-init
Written by eraser1 (trainwreckdayz.com)
*/
#define CALLFILE(FILE) call compile preprocessFileLineNumbers FILE;
// Enables debug logging in DMS functions. !!!NOTE:!!! You must uncomment the line above if you want DMS to even check whether or not debug mode is enabled!
// Logs will be written in the RPT, and if you have infiSTAR's "ARMA_LOG" DLL loaded, it will also produce logs in the server directory.
// If you have mARMA by maca134, DMS will also utilize mARMA logs.
// This will produce A LOT of logs, so make sure you leave it to false unless you know what you're doing.
DMS_DEBUG = false;
DMS_HC_Object = objNull;
DMS_CleanUpList = [];
@ -11,13 +18,21 @@ DMS_Version = getText (configFile >> "CfgPatches" >> "a3_dms" >> "a3_DMS_version
//Load main config
call compileFinal preprocessFileLineNumbers "\x\addons\dms\config.sqf";
CALLFILE("\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]);
private _file = preprocessFileLineNumbers (format ["\x\addons\dms\map_configs\%1_config.sqf",toLower worldName]);
if (_file isEqualTo "") then
{
'You need to set the config value "DMS_Use_Map_Config" to false!' call DMS_fnc_DebugLog;
}
else
{
call compile _file;
};
};
DMS_MagRange = DMS_MaximumMagCount - DMS_MinimumMagCount;
@ -29,86 +44,79 @@ DMS_MagRange = DMS_MaximumMagCount - DMS_MinimumMagCount;
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;
M3E_fnc_getCenter = DMS_fnc_GetCenter;
_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) vectorDiff _center;
_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;
};
M3E_fnc_subArr = DMS_fnc_SubArr;
// 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;
DMS_HelisToClean = [];
DMS_HeliParatrooper_Arr = [];
DMS_FrozenAIGroups = [];
DMS_CLIENT_fnc_spawnDynamicText = compileFinal
("
if (isNil 'DMS_CLIENT_DynamicText_inProgress') then
{
DMS_CLIENT_DynamicText_inProgress = true;
_this spawn
{
[
_this,
0,
safeZoneY,
"+str DMS_dynamicText_Duration+",
"+str DMS_dynamicText_FadeTime+",
0,
24358
] call BIS_fnc_dynamicText;
DMS_CLIENT_DynamicText_inProgress = nil;
};
}
else
{
["+str (DMS_dynamicText_Duration+DMS_dynamicText_FadeTime) +",{_this call DMS_CLIENT_fnc_spawnDynamicText},_this,false,false] call ExileClient_system_thread_addTask;
};
");
DMS_CLIENT_fnc_spawnTextTiles = compileFinal
("
if (isNil 'DMS_CLIENT_TextTiles_inProgress') then
{
DMS_CLIENT_TextTiles_inProgress = true;
_this spawn
{
[
parseText _this,
[
0,
safeZoneY,
1,
1
],
[10,10],
"+str DMS_textTiles_Duration+",
"+str DMS_textTiles_FadeTime+",
0
] call BIS_fnc_textTiles;
DMS_CLIENT_TextTiles_inProgress = nil;
};
}
else
{
["+str (DMS_textTiles_Duration+DMS_textTiles_FadeTime) +",{_this call DMS_CLIENT_fnc_spawnTextTiles},_this,false,false] call ExileClient_system_thread_addTask;
};
");
DMS_CLIENT_fnc_hintSilent = compileFinal "hintSilent parsetext format['%1',_this];";
// Initialize mission variables...
call compileFinal preprocessFileLineNumbers "\x\addons\dms\missions\static_init.sqf";
call compileFinal preprocessFileLineNumbers "\x\addons\dms\missions\mission_init.sqf";
CALLFILE("\x\addons\dms\missions\static_init.sqf");
CALLFILE("\x\addons\dms\missions\mission_init.sqf");

View File

@ -11,7 +11,7 @@ DMS_findSafePosBlacklist =
// Making these configs below as strict as possible will help in reducing the number of attempts taken to find a valid position, and as a result, improve performance.
DMS_MinDistFromWestBorder = 250;
DMS_MinDistFromEastBorder = 250;
DMS_MinDistFromSouthBorder = 500;
DMS_MinDistFromNorthBorder = 400;
DMS_MinDistFromWestBorder = 750;
DMS_MinDistFromEastBorder = 2500;
DMS_MinDistFromSouthBorder = 3500;
DMS_MinDistFromNorthBorder = 1000;

View File

@ -0,0 +1,13 @@
/*
Custom configs for Tanoa.
Created by eraser1
All of these configs exist in the main config. The configs below will simply override any config from the main config.
Explanations to all of these configs also exist in the main config.
*/
DMS_MinDistFromWestBorder = 1300;
DMS_MinDistFromEastBorder = 800;
DMS_MinDistFromSouthBorder = 1500;
DMS_MinDistFromNorthBorder = 1900;

View File

@ -130,7 +130,7 @@ _msgWIN = ['#0080ff',"Convicts have successfully assaulted the Mercenary Base an
_msgLOSE = ['#FF0000',"Seems like the Mercenaries packed up and drove away..."];
// Define mission name (for map marker and logging)
_missionName = "Mercenary Base";
_missionName = "Mercenary Outpost";
// Create Markers
_markers =

View File

@ -0,0 +1,306 @@
/*
"Occupation" static mission for Altis, Chernarus, Namalsk and Taviana
Created by second_coming
*/
private["_wp","_wp2","_wp3","_pos","_missionName","_msgStart","_msgWIN","_msgLOSE"];
// For logging purposes
private _num = DMS_MissionCount;
// Set mission side (only "bandit" is supported for now)
_side = "bandit";
switch (toLower worldName) do
{
case "chernarus":
{
_pos = [3810,8887,0];
_missionName = "Vybor Occupation";
_msgStart = ['#FFFF00',"Vybor is under martial law! There are reports they have a large weapon cache..."];
_msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Vybor and secured the cache!"];
_msgLOSE = ['#FF0000',"The troops have left Vybor, taking the cache with them..."];
};
case "altis":
{
_pos = [12571,14337,0];
_missionName = "Neochori Occupation";
_msgStart = ['#FFFF00',"Neochori is under martial law! There are reports they have a large weapon cache..."];
_msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Neochori and secured the cache!"];
_msgLOSE = ['#FF0000',"The troops have left Neochori, taking the cache with them..."];
};
case "taviana":
{
_pos = [14000,12220,0];
_missionName = "Solibor Occupation";
_msgStart = ['#FFFF00',"Solibor is under martial law! There are reports they have a large weapon cache..."];
_msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Solibor and secured the cache!"];
_msgLOSE = ['#FF0000',"The troops have left Solibor, taking the cache with them..."];
};
case "namalsk":
{
_pos = [3926,7523,0];
_missionName = "Norinsk Occupation";
_msgStart = ['#FFFF00',"Norinsk is under martial law! There are reports they have a large weapon cache..."];
_msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Norinsk and secured the cache!"];
_msgLOSE = ['#FF0000',"The troops have left Norinsk, taking the cache with them..."];
};
case "tanoa":
{
_pos = [11685,2666,0];
_missionName = "Lijnhaven Occupation";
_msgStart = ['#FFFF00',"Lijnhaven is under martial law! There are reports they have a large weapon cache..."];
_msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Lijnhaven and secured the cache!"];
_msgLOSE = ['#FF0000',"The troops have left Lijnhaven, taking the cache with them..."];
};
default
{
diag_log format["DMS ERROR :: Attempting to run occupation with unsupported map: %1",worldName];
};
};
if (isNil "_pos") exitWith {};
if ([_pos,DMS_StaticMinPlayerDistance] call DMS_fnc_IsPlayerNearby) exitWith {"delay"};
diag_log text "[DMS]: Town Occupation Mission Started";
// Set general mission difficulty
_difficulty = "hardcore";
// Create AI
_AICount = 27;
_group1Count = ceil(_AICount/3);
_group2Count = ceil(_AICount/3);
_group3Count = ceil(_AICount/3);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Get AI to defend the position
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
_group = [_pos, _group1Count, _difficulty, "random", _side] call DMS_fnc_SpawnAIGroup;
[ _group,_pos,_difficulty,"COMBAT" ] call DMS_fnc_SetGroupBehavior;
_buildings = _pos nearObjects ["building", 200];
{
_buildingPositions = [_x, 10] call BIS_fnc_buildingPositions;
if(count _buildingPositions > 0) then
{
_y = _x;
// Find Highest Point
_highest = [0,0,0];
{
if(_x select 2 > _highest select 2) then
{
_highest = _x;
};
} foreach _buildingPositions;
_spawnPosition = _highest;
_i = _buildingPositions find _spawnPosition;
_wp = _group addWaypoint [_spawnPosition,0] ;
_wp setWaypointFormation "Column";
_wp setWaypointBehaviour "AWARE";
_wp setWaypointCombatMode "RED";
_wp setWaypointCompletionRadius 1;
_wp waypointAttachObject _y;
_wp setwaypointHousePosition _i;
_wp setWaypointType "MOVE";
};
} foreach _buildings;
if(count _buildings > 0 ) then
{
_wp setWaypointType "CYCLE";
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
_group2 = [ _pos, _group2Count, _difficulty, "random", _side] call DMS_fnc_SpawnAIGroup;
[ _group2,_pos,_difficulty,"COMBAT" ] call DMS_fnc_SetGroupBehavior;
_buildings = _pos nearObjects ["building", 100];
{
_buildingPositions = [_x, 10] call BIS_fnc_buildingPositions;
if(count _buildingPositions > 0) then
{
_y = _x;
// Find Highest Point
_highest = [0,0,0];
{
if(_x select 2 > _highest select 2) then
{
_highest = _x;
};
} foreach _buildingPositions;
_spawnPosition = _highest;
_i = _buildingPositions find _spawnPosition;
_wp2 = _group2 addWaypoint [_spawnPosition,0] ;
_wp2 setWaypointFormation "Column";
_wp2 setWaypointBehaviour "AWARE";
_wp2 setWaypointCombatMode "RED";
_wp2 setWaypointCompletionRadius 1;
_wp2 waypointAttachObject _y;
_wp2 setwaypointHousePosition _i;
_wp2 setWaypointType "MOVE";
};
} foreach _buildings;
if(count _buildings > 0 ) then
{
_wp2 setWaypointType "CYCLE";
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
_group3 = [_pos, _group3Count, _difficulty, "random", _side] call DMS_fnc_SpawnAIGroup;
[ _group3,_pos,_difficulty,"COMBAT" ] call DMS_fnc_SetGroupBehavior;
_buildings = _pos nearObjects ["building", 100];
{
_buildingPositions = [_x, 10] call BIS_fnc_buildingPositions;
if(count _buildingPositions > 0) then
{
_y = _x;
// Find Highest Point
_highest = [0,0,0];
{
if(_x select 2 > _highest select 2) then
{
_highest = _x;
};
} foreach _buildingPositions;
_spawnPosition = _highest;
_i = _buildingPositions find _spawnPosition;
_wp3 = _group2 addWaypoint [_spawnPosition,0] ;
_wp3 setWaypointFormation "Column";
_wp3 setWaypointBehaviour "AWARE";
_wp3 setWaypointCombatMode "RED";
_wp3 setWaypointCompletionRadius 1;
_wp3 waypointAttachObject _y;
_wp3 setwaypointHousePosition _i;
_wp3 setWaypointType "MOVE";
};
} foreach _buildings;
if(count _buildings > 0 ) then
{
_wp3 setWaypointType "CYCLE";
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Get the AI to shut the fuck up :)
enableSentences false;
enableRadio false;
// Create Crate
_crate = ["I_CargoNet_01_ammo_F",_pos] call DMS_fnc_SpawnCrate;
// Define mission-spawned AI Units
_missionAIUnits =
[
[_group,_group2,_group3]
];
// Define the group reinforcements
_groupReinforcementsInfo = [];
// Define mission-spawned objects and loot values
_missionObjs =
[
[_missionAIUnits], // armed AI vehicle and static gun(s). Note, we don't add the base itself because we don't want to delete it and respawn it if the mission respawns.
[],
[[_crate,[30 + (random 20),100 + (random 40),15 + (random 5)]]] // weapons,items,backpacks
];
// Create Markers
_markers =
[
_pos,
_missionName,
_difficulty
] call DMS_fnc_CreateMarker;
(_markers select 1) setMarkerSize [500,500];
// Record time here (for logging purposes, otherwise you could just put "diag_tickTime" into the "DMS_AddMissionToMonitor" parameters directly)
_time = diag_tickTime;
// Parse and add mission info to missions monitor
_added =
[
_pos,
[
[
"kill",
[_group,_group2,_group3]
],
[
"playerNear",
[_pos,100]
]
],
_groupReinforcementsInfo,
[
_time,
DMS_StaticMissionTimeOut call DMS_fnc_SelectRandomVal
],
_missionAIUnits,
_missionObjs,
[_missionName,_msgWIN,_msgLOSE],
_markers,
_side,
_difficulty,
[[],[]]
] call DMS_fnc_AddMissionToMonitor_Static;
// Check to see if it was added correctly, otherwise delete the stuff
if !(_added) exitWith
{
diag_log format ["DMS ERROR :: Attempt to set up mission %1 with invalid parameters for DMS_fnc_AddMissionToMonitor_Static! Deleting mission objects and resetting DMS_MissionCount.",_missionName];
_cleanup = [];
{
_cleanup pushBack _x;
} forEach _missionAIUnits;
_cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
{
_cleanup pushBack (_x select 0);
} foreach (_missionObjs select 2);
_cleanup call DMS_fnc_CleanUp;
// Delete the markers directly
{deleteMarker _x;} forEach _markers;
// Reset the mission count
DMS_MissionCount = DMS_MissionCount - 1;
};
// Notify players
[_missionName,_msgStart] call DMS_fnc_BroadcastMissionStatus;
if (DMS_DEBUG) then
{
(format ["MISSION: (%1) :: Mission #%2 started at %3 with %4 AI units and %5 difficulty at time %6",_missionName,_num,_pos,_AICount,_difficulty,_time]) call DMS_fnc_DebugLog;
};

View File

@ -262,7 +262,6 @@
["Land_HBarrier_5_F",[23495.8,18860.2,0],91.8182,[[0.999497,-0.0317285,0],[0,-0,1]],false],
["Land_HBarrier_5_F",[23495.7,18855.7,0],91.8182,[[0.999497,-0.0317285,0],[0,-0,1]],false],
["Land_Wreck_Hunter_F",[23338,18860.7,0],181.364,[[-0.0238044,-0.999717,0],[-0,0,1]],false],
["Land_Wreck_Heli_Attack_01_F",[23279,18478,0],150.909,[[0.486198,-0.873849,0],[0,-0,1]],false],
["Land_CncBarrier_stripes_F",[23228.8,18448,0],343.182,[[-0.289332,0.957229,0],[0,0,1]],false],
["Land_Wreck_HMMWV_F",[23229.5,18446.4,0],214.091,[[-0.560509,-0.828148,0],[-0,0,1]],false],
["Land_Cargo_House_V2_ruins_F",[23280.9,18484.3,0],206.984,[[-0.477745,-0.861692,0.171015],[-0.0955405,0.244475,0.964937]],false],

View File

@ -2,47 +2,41 @@
DMS_fnc_AILocalityManager
Created by Defent and eraser1
Offloads AI groups to a nearby client or HC in order to improve server performance.
Offloads AI groups to a nearby client in order to improve server performance.
*/
if (!DMS_ai_offload_to_client && {isNull DMS_HC_Object}) exitWith {};
if (!DMS_ai_offload_to_client) exitWith {};
{
if (((count (units _x))>1) && {!((DMS_ai_offload_Only_DMS_AI && {!(_x getVariable ["DMS_SpawnedGroup",false])}) || {(_x getVariable ["DMS_LockLocality",false])})}) then
if (((count (units _x))>1) && {!(_x getVariable ["DMS_LockLocality",false])} && {!(DMS_ai_offload_Only_DMS_AI && {!(_x getVariable ["DMS_SpawnedGroup",false])})}) then
{
private ["_leader", "_group", "_owner"];
_leader = leader _x;
_group = _x;
_groupOwner = groupOwner _group;
if ((!isNull _leader) && {(alive _leader) && {!isPlayer _leader}}) then
{
if (isNull DMS_HC_Object) then
private _leader = leader _x;
private _group = _x;
if !(isPlayer _leader) then
{
if (DMS_DEBUG) then
{
(format ["AILocalityManager :: DMS_HC_Object is null! Finding owner for group: %1",_group]) call DMS_fnc_DebugLog;
(format ["AILocalityManager :: Finding owner for group: %1",_group]) call DMS_fnc_DebugLog;
};
private _groupOwner = groupOwner _group;
private _ownerObj = objNull;
private _isLocal = local _group;
_owner = objNull;
if !(local _group) then // Only check for the group owner in players if it doesn't belong to the server.
if !(_isLocal) then // Only check for the group owner in players if it doesn't belong to the server.
{
{
if (_groupOwner isEqualTo (owner _x)) exitWith
{
_owner = _x;
_ownerObj = _x;
};
} forEach allPlayers;
};
if ((isNull _owner) || {(_owner distance2D _leader)>3500}) then
{
if !([_group,_leader] call DMS_fnc_SetAILocality) then
{
if !(local _group) then
// If the owner doesn't exist or is too far away... Attempt to set a new player owner, and if none are found... and if the group doesn't belong to the server...
if (((isNull _ownerObj) || {(_ownerObj distance2D _leader)>3500}) && {!([_group,_leader] call DMS_fnc_SetAILocality)} && {!_isLocal}) then
{
// Reset locality to the server
_group setGroupOwner 2;
if (DMS_DEBUG) then
@ -52,18 +46,4 @@ if (!DMS_ai_offload_to_client && {isNull DMS_HC_Object}) exitWith {};
};
};
};
}
else
{
if !(_groupOwner isEqualTo (owner DMS_HC_Object)) then
{
_transferSuccess = _group setGroupOwner (owner DMS_HC_Object);
if (DMS_DEBUG) then
{
(format ["AILocalityManager :: Setting ownership of group %1 to HC (%2). Success: %3",_group,DMS_HC_Object,_transferSuccess]) call DMS_fnc_DebugLog;
};
};
};
};
};
} forEach allGroups;

View File

@ -57,24 +57,20 @@
*/
private ["_added", "_pos", "_onEndingScripts", "_completionInfo", "_timeOutInfo", "_units", "_missionObjs", "_mines", "_difficulty", "_side", "_messages", "_markers", "_arr", "_timeStarted", "_timeUntilFail", "_buildings", "_vehs", "_crate_info_array", "_missionName", "_msgWIN", "_msgLose", "_markerDot", "_markerCircle", "_missionEvents", "_onSuccessScripts", "_onFailScripts"];
_added = false;
private _added = false;
if !(params
[
["_pos","",[[]],[2,3]],
["_completionInfo","",[[]]],
["_timeOutInfo","",[[]],[1,2]],
["_units","",[[]]],
["_missionObjs","",[[]],[3,4]],
["_messages","",[[]],[3]],
["_markers","",[[]],[DMS_MissionMarkerCount]],
["_side","bandit",[""]],
["_difficulty","moderate",[""]],
["_missionEvents",[],[[]]]
"_pos",
"_completionInfo",
"_timeOutInfo",
"_units",
"_missionObjs",
"_messages",
"_markers",
"_side",
"_difficulty",
"_missionEvents"
])
exitWith
{
@ -82,7 +78,7 @@ exitWith
false;
};
_onEndingScripts = if ((count _this)>10) then {_this select 10} else {[[],[],{},{}]};
private _onEndingScripts = if ((count _this)>10) then {_this select 10} else {[[],[],{},{}]};
try
@ -114,7 +110,7 @@ try
throw format["_missionObjs |%1|",_missionObjs];
};
_mines =
private _mines =
if ((count _missionObjs)>3) then
{
_missionObjs param [3,[],[[]]]
@ -156,7 +152,7 @@ try
throw format["_onEndingScripts |%1|",_onEndingScripts];
};
_arr =
private _arr =
[
_pos,
_completionInfo,
@ -192,7 +188,7 @@ try
if (DMS_MarkerText_ShowAICount) then
{
_markerDot = _markers select 0;
private _markerDot = _markers select 0;
_markerDot setMarkerText (format ["%1 (%2 %3 remaining)",markerText _markerDot,count _units,DMS_MarkerText_AIName]);
};

View File

@ -67,24 +67,21 @@
*/
private ["_added", "_pos", "_onEndingScripts", "_completionInfo", "_timeOutInfo", "_units", "_missionObjs", "_mines", "_difficulty", "_side", "_messages", "_markers", "_arr", "_timeStarted", "_timeUntilFail", "_buildings", "_vehs", "_crate_info_array", "_missionName", "_msgWIN", "_msgLose", "_markerDot", "_markerCircle", "_missionEvents", "_onSuccessScripts", "_onFailScripts"];
_added = false;
private _added = false;
if !(params
[
["_pos","",[[]],[2,3]],
["_completionInfo","",[[]]],
["_groupReinforcementsInfo","",[[]]],
["_timeOutInfo","",[[]],[1,2]],
["_units","",[[]]],
["_missionObjs","",[[]],[3,4]],
["_messages","",[[]],[3]],
["_markers","",[[]],[DMS_MissionMarkerCount]],
["_side","bandit",[""]],
["_difficulty","moderate",[""]],
["_missionEvents",[],[[]]]
"_pos",
"_completionInfo",
"_groupReinforcementsInfo",
"_timeOutInfo",
"_units",
"_missionObjs",
"_messages",
"_markers",
"_side",
"_difficulty",
"_missionEvents"
])
exitWith
{
@ -92,7 +89,7 @@ exitWith
false;
};
_onEndingScripts = if ((count _this)>11) then {_this select 11} else {[[],[],{},{}]};
private _onEndingScripts = if ((count _this)>11) then {_this select 11} else {[[],[],{},{}]};
try
@ -124,7 +121,7 @@ try
throw format["_missionObjs |%1|",_missionObjs];
};
_mines = if ((count _missionObjs)>3) then { _missionObjs param [3,[],[[]]] } else { [] };
private _mines = if ((count _missionObjs)>3) then { _missionObjs param [3,[],[[]]] } else { [] };
// Don't spawn a minefield if there is one already defined in _missionObjs.
if (DMS_SpawnMinefieldForEveryMission && {_mines isEqualTo []}) then
@ -157,7 +154,7 @@ try
throw format["_onEndingScripts |%1|",_onEndingScripts];
};
_arr =
private _arr =
[
_pos,
_completionInfo,
@ -194,7 +191,7 @@ try
if (DMS_MarkerText_ShowAICount_Static) then
{
_markerDot = _markers select 0;
private _markerDot = _markers select 0;
_markerDot setMarkerText (format ["%1 (%2 %3 remaining)",markerText _markerDot,count (_units call DMS_fnc_GetAllUnits),DMS_MarkerText_AIName]);
};

View File

@ -0,0 +1,52 @@
/*
DMS_fnc_AddWeapon
created by eraser1 - based off of BIS_fnc_AddWeapon
Description:
Add a weapon to a unit with the right magazines. Magazine class is obtained from the weapon's config.
Usage:
[
_unit, // <object> unit that is issued new equipment
_weapon, // <string> weapon classname
_magazineCount, // <scalar> number of magazines
_magClassname // (Optional): <scalar> index of magazine class in weapon's config (default 0) OR <string> magazine classname
] call DMS_fnc_AddWeapon;
Nothing is returned
*/
if (params
[
"_unit",
"_weapon",
"_magazineCount"
])
then
{
//Add magazines
if (_magazineCount > 0) then
{
private _magazine =
if ((count _this) > 3) then
{
_this select 3
}
else
{
(getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines")) select 0
};
for "_i" from 1 to _magazineCount do
{
_unit addMagazine _magazine;
};
};
//Add weapon
_unit addWeapon _weapon;
}
else
{
diag_log format["DMS ERROR :: Calling DMS_fnc_AddWeapon with invalid parameters: %1",_this];
};

View File

@ -14,14 +14,10 @@
Returns nothing
*/
private ["_missionName", "_messageInfo", "_titleColor", "_message"];
if !(params
[
["_missionName","",[""]],
["_messageInfo",[],[[]],[2]]
"_missionName",
"_messageInfo"
])
exitWith
{
@ -31,7 +27,7 @@ exitWith
_messageInfo params
[
["_titleColor","#FFFF00",[""]],
["_message","",[""]]
"_message"
];
if (DMS_DEBUG) then
@ -47,8 +43,6 @@ if !(_message isEqualType "") then
if (_message isEqualTo "") exitWith {};
{
private "_args";
switch (toLower _x) do
{
case "systemchatrequest":

View File

@ -11,15 +11,10 @@
Returns the absolute position from the provided relative position from the provided center position or object.
*/
private ["_pos", "_relPos", "_npos"];
if !(params
[
["_pos","",[[],objNull],[2,3]],
["_relPos","",[[]],[2,3]]
"_pos",
"_relPos"
])
exitWith
{

View File

@ -14,7 +14,6 @@
_objectOrGroup call DMS_fnc_CleanUp;
*/
if (DMS_DEBUG) then
{
(format ["CleanUp :: CLEANING UP: %1",_this]) call DMS_fnc_DebugLog;
@ -25,14 +24,10 @@ if !(_this isEqualType []) then
_this = [_this];
};
private ["_skippedObjects"];
_skippedObjects = [];
private _skippedObjects = [];
{
private ["_parameter"];
_parameter = _x;
private _parameter = _x;
switch (typeName _parameter) do
{

View File

@ -24,14 +24,12 @@
(format ["CleanUpManager :: Checking Cleaning Status for: %1",_x]) call DMS_fnc_DebugLog;
};
private ["_objs","_timeAddedToList","_timeUntilClean"];
if !(_x params
[
["_objs",[objNull],[objNull,[],grpNull]],
["_timeAddedToList",diag_tickTime,[0]],
["_timeUntilClean",DMS_CompletedMissionCleanupTime,[0]]
"_objs",
"_timeAddedToList",
"_timeUntilClean"
])
then
{

View File

@ -18,10 +18,6 @@
*/
private["_pos", "_text", "_difficulty", "_randomMarker", "_num", "_color", "_dot", "_circle", "_dir", "_dis", "_npos"];
params
[
["_pos","ERROR",[[]],[2,3]],
@ -37,7 +33,7 @@ if ((_pos isEqualTo "ERROR") || ("_text" isEqualTo "ERROR")) exitWith
};
_randomMarker =
private _randomMarker =
if ((count _this)>3) then
{
_this select 3;
@ -47,30 +43,34 @@ _randomMarker =
DMS_MarkerPosRandomization;
};
_num = DMS_MissionCount;
private _num = DMS_MissionCount;
switch (_difficulty) do
{
case "easy": {_color = "ColorGreen";};
case "moderate": {_color = "ColorYellow";};
case "difficult": {_color = "ColorRed";};
case "hardcore" : {_color = "ColorBlack";};
default {_color = _difficulty;};
};
private _color =
switch (_difficulty) do
{
case "easy": {"ColorGreen";};
case "moderate": {"ColorYellow";};
case "difficult": {"ColorRed";};
case "hardcore" : {"ColorBlack";};
default {_difficulty;};
};
/*
// Don't think this is really needed
if !((toLower _color) in DMS_A3_AllMarkerColors) then
{
diag_log format ["DMS ERROR :: Color ""%1"" is not a valid marker color! Switching to ""ColorRed""",_color];
_color = "ColorRed";
};
*/
_circle = createMarker [format ["DMS_MissionMarkerCircle%1_%2",_num,round(time)], _pos];
private _circle = createMarker [format ["DMS_MissionMarkerCircle%1_%2",_num,round(time)], _pos];
_circle setMarkerColor _color;
_circle setMarkerShape "ELLIPSE";
_circle setMarkerBrush "Solid";
_circle setMarkerSize [150,150];
_dot = createMarker [format ["DMS_MissionMarkerDot%1_%2",_num,round(time)], _pos];
private _dot = createMarker [format ["DMS_MissionMarkerDot%1_%2",_num,round(time)], _pos];
_dot setMarkerColor "ColorBlack";
_dot setMarkerType "mil_dot";
_dot setMarkerText _text;
@ -85,9 +85,9 @@ if (DMS_MarkerText_ShowMissionPrefix) then
if (_randomMarker) then
{
_dir = random 360;
_dis = DMS_MarkerPosRandomRadius call DMS_fnc_SelectRandomVal;
_npos = _pos getPos [_dis,_dir];
private _dir = random 360;
private _dis = DMS_MarkerPosRandomRadius call DMS_fnc_SelectRandomVal;
private _npos = _pos getPos [_dis,_dir];
_circle setMarkerPos _npos;
_dot setMarkerPos _npos;

View File

@ -1,8 +1,8 @@
/*
DMS_fnc_FillCrate
Original credit goes to WAI: https://github.com/nerdalertdk/WICKED-AI
Edited by eraser1
Inspired by WAI: https://github.com/nerdalertdk/WICKED-AI
created by eraser1
Usage:
[
@ -86,14 +86,10 @@
]
*/
private ["_crate","_lootValues","_wepCount","_weps","_itemCount","_items","_backpackCount","_backpacks","_weapon","_ammo","_item","_backpack","_crateValues","_rareLootChance","_marker"];
if (!(params
[
["_crate",objNull,[objNull]],
["_lootValues","",[0,"",[]],[2,3]]
"_crate",
"_lootValues"
])
||
{isNull _crate})
@ -119,57 +115,65 @@ if (_crate getVariable ["DMS_CrateEnableRope",DMS_EnableBoxMoving]) then
if ((_lootValues isEqualType []) && {!((_lootValues select 1) isEqualType {})}) then
{
// Weapons
if ((_lootValues select 0) isEqualType []) then
private _wepValues = _lootValues select 0;
private _wepCount = 0;
private _weps =
if (_wepValues isEqualType []) then
{
_wepCount = (_lootValues select 0) select 0;
_weps = (_lootValues select 0) select 1;
_wepCount = _wepValues select 0;
_wepValues select 1
}
else
{
_wepCount = _lootValues select 0;
_weps = DMS_boxWeapons;
_wepCount = _wepValues;
DMS_boxWeapons
};
// Items
if ((_lootValues select 1) isEqualType []) then
private _itemValues = _lootValues select 1;
private _itemCount = 0;
private _items =
if (_itemValues isEqualType []) then
{
_itemCount = (_lootValues select 1) select 0;
_items = (_lootValues select 1) select 1;
_itemCount = _itemValues select 0;
_itemValues select 1
}
else
{
_itemCount = _lootValues select 1;
_items = DMS_boxItems;
_itemCount = _itemValues;
DMS_boxItems
};
// Backpacks
if ((_lootValues select 2) isEqualType []) then
private _backpackValues = _lootValues select 2;
private _backpackCount = 0;
private _backpacks =
if ((_backpackValues) isEqualType []) then
{
_backpackCount = (_lootValues select 2) select 0;
_backpacks = (_lootValues select 2) select 1;
_backpackCount = _backpackValues select 0;
_backpackValues select 1
}
else
{
_backpackCount = _lootValues select 2;
_backpacks = DMS_boxBackpacks;
_backpackCount = _backpackValues;
DMS_boxBackpacks
};
if (DMS_DEBUG) then
{
(format["FillCrate :: Filling %4 with %1 guns, %2 items and %3 backpacks",_wepCount,_itemCount,_backpackCount,_crate]) call DMS_fnc_DebugLog;
};
if ((_wepCount>0) && {count _weps>0}) then
if (count _weps>0) then
{
// Add weapons + mags
for "_i" from 1 to _wepCount do
{
_weapon = selectRandom _weps;
_ammo = _weapon call DMS_fnc_selectMagazine;
private _weapon = selectRandom _weps;
private _ammo = _weapon call DMS_fnc_selectMagazine;
if (_weapon isEqualType "") then
{
_weapon = [_weapon,1];
@ -183,12 +187,12 @@ if ((_lootValues isEqualType []) && {!((_lootValues select 1) isEqualType {})})
};
if ((_itemCount > 0) && {count _items>0}) then
if (count _items>0) then
{
// Add items
for "_i" from 1 to _itemCount do
{
_item = selectRandom _items;
private _item = selectRandom _items;
if (_item isEqualType "") then
{
_item = [_item,1];
@ -198,12 +202,12 @@ if ((_lootValues isEqualType []) && {!((_lootValues select 1) isEqualType {})})
};
if ((_backpackCount > 0) && {count _backpacks>0}) then
if (count _backpacks>0) then
{
// Add backpacks
for "_i" from 1 to _backpackCount do
{
_backpack = selectRandom _backpacks;
private _backpack = selectRandom _backpacks;
if (_backpack isEqualType "") then
{
_backpack = [_backpack,1];
@ -214,7 +218,7 @@ if ((_lootValues isEqualType []) && {!((_lootValues select 1) isEqualType {})})
}
else
{
_crateValues =
private _crateValues =
if (_lootValues isEqualType []) then
{
(_lootValues select 0) call (_lootValues select 1)
@ -226,9 +230,9 @@ else
if !((_crateValues params
[
["_weps", [], [[]]],
["_items", [], [[]]],
["_backpacks", [], [[]]]
"_weps",
"_items",
"_backpacks"
]))
exitWith
{
@ -262,7 +266,6 @@ else
_crate addBackpackCargoGlobal _x;
} forEach _backpacks;
if (DMS_DEBUG) then
{
(format["FillCrate :: Filled crate %1 (at %5) with weapons |%2|, items |%3|, and backpacks |%4|",_crate, _weps, _items, _backpacks, getPosATL _crate]) call DMS_fnc_DebugLog;
@ -272,7 +275,7 @@ else
if (DMS_RareLoot) then
{
_rareLootChance =
private _rareLootChance =
if ((count _this)>2) then
{
_this param [2,DMS_RareLootChance,[0]]
@ -300,16 +303,16 @@ if (DMS_RareLoot) then
// You can choose if you want to enable/disable smoke individually using setVariable.
if (_crate getVariable ["DMS_AllowSmoke", true]) then
{
if(DMS_SpawnBoxSmoke && {sunOrMoon == 1}) then
if (DMS_SpawnBoxSmoke && {sunOrMoon == 1}) then
{
_marker = "SmokeShellPurple" createVehicle getPosATL _crate;
private _marker = "SmokeShellPurple" createVehicle getPosATL _crate;
_marker setPosATL (getPosATL _crate);
_marker attachTo [_crate,[0,0,0]];
};
if (DMS_SpawnBoxIRGrenade && {sunOrMoon != 1}) then
{
_marker = "B_IRStrobe" createVehicle getPosATL _crate;
private _marker = "B_IRStrobe" createVehicle getPosATL _crate;
_marker setPosATL (getPosATL _crate);
_marker attachTo [_crate, [0,0,0.5]];
};

View File

@ -16,12 +16,9 @@
_missionNearLimit, // NUMBER (distance): Minimum distance from another mission.
_playerNearLimit, // NUMBER (distance): Minimum distance from a player.
_throttleParams // BOOLEAN: Whether or not some of the distance values should be throttled on repeated attempts.
_waterSpawn // (OPTIONAL) BOOLEAN: Whether or not the mission is supposed to spawn on water. Default: false
] call DMS_fnc_findSafePos;
*/
private ["_nearestObjectMinDistance", "_waterNearLimit", "_minSurfaceNormal", "_spawnZoneNearLimit", "_traderZoneNearLimit", "_missionNearLimit", "_playerNearLimit", "_territoryNearLimit", "_throttleParams", "_waterSpawn", "_isValidSpot", "_attempts", "_pos", "_restriction", "_generatePos", "_presetLocs", "_presetLocsLength"];
#define MAX_ATTEMPTS 5000
params
[
@ -44,14 +41,11 @@ if (!isNil "DMS_DebugMarkers") then
DMS_DebugMarkers = [];
*/
private _isValidSpot = false;
_waterSpawn = if ((count _this)>9) then {_this select 9} else {false};
private _presetLocs = [];
private _presetLocsLength = 0;
_isValidSpot = false;
_attempts = 0;
_restriction = if (_waterSpawn) then {2} else {0};
_presetLocsLength = 0;
if (DMS_UsePredefinedMissionLocations) then
{
// Shuffle the array so that the positions are selected in random order
@ -59,28 +53,19 @@ if (DMS_UsePredefinedMissionLocations) then
_presetLocsLength = count _presetLocs;
};
_generatePos =
private _pos = [];
for "_attempts" from 1 to MAX_ATTEMPTS do
{
_pos =
if (DMS_UsePredefinedMissionLocations && {_attempts<=_presetLocsLength}) then
{
_presetLocs select (_attempts - 1)
}
else
{
[DMS_MinMax_X_Coords call DMS_fnc_SelectRandomVal,DMS_MinMax_Y_Coords call DMS_fnc_SelectRandomVal] isFlatEmpty [_nearestObjectMinDistance, 0, 9999, 1, _restriction, _waterSpawn, objNull]
};
};
while {!_isValidSpot} do
{
_attempts = _attempts+1;
_pos = [];
while {_pos isEqualTo []} do
{
_pos = call _generatePos;
[DMS_MinMax_X_Coords call DMS_fnc_SelectRandomVal,DMS_MinMax_Y_Coords call DMS_fnc_SelectRandomVal] isFlatEmpty [_nearestObjectMinDistance, 0, -1, 1, -1, false, objNull]
};
/*
@ -108,12 +93,14 @@ while {!_isValidSpot} do
};
};
_isValidSpot = [_pos, _waterNearLimit, _minSurfaceNormal, _spawnZoneNearLimit, _traderZoneNearLimit, _missionNearLimit, _playerNearLimit, _territoryNearLimit, _waterSpawn] call DMS_fnc_IsValidPosition;
_isValidSpot = [_pos, _waterNearLimit, _minSurfaceNormal, _spawnZoneNearLimit, _traderZoneNearLimit, _missionNearLimit, _playerNearLimit, _territoryNearLimit] call DMS_fnc_IsValidPosition;
if (_attempts>5000) exitWith
{
diag_log format["DMS ERROR :: Number of attempts in DMS_fnc_findSafePos (%1) exceeded maximum number of attempts!",_attempts];
};
if (_isValidSpot) exitWith {};
};
if !(_isValidSpot) exitWith
{
diag_log format["DMS ERROR :: Number of attempts in DMS_fnc_findSafePos (%1) reached maximum number of attempts!",MAX_ATTEMPTS];
};
_pos set [2,0];

View File

@ -19,14 +19,12 @@
Returns a position.
*/
private ["_centerPos", "_distance", "_posParameters", "_original_x", "_original_y", "_original_Blacklist", "_center_x", "_center_y", "_usePresetOriginal", "_pos"];
if !(params
[
["_centerPos", 0, [[]], [2,3]],
["_distanceMin", 0, [0]],
["_distanceMax", 0, [0]],
["_posParameters", 0, [[]]]
"_centerPos",
"_distanceMin",
"_distanceMax",
"_posParameters"
])
exitWith
{
@ -35,13 +33,13 @@ exitWith
};
// Save the original values
_original_x = DMS_MinMax_X_Coords;
_original_y = DMS_MinMax_Y_Coords;
_original_Blacklist = DMS_findSafePosBlacklist;
private _original_x = DMS_MinMax_X_Coords;
private _original_y = DMS_MinMax_Y_Coords;
private _original_Blacklist = DMS_findSafePosBlacklist;
// Get the center values
_center_x = _centerPos select 0;
_center_y = _centerPos select 1;
private _center_x = _centerPos select 0;
private _center_y = _centerPos select 1;
// Set the restrictions
DMS_MinMax_X_Coords = [_center_x - _distanceMax, _center_x + _distanceMax];
@ -62,11 +60,11 @@ DMS_findSafePosBlacklist =
[]
};
_usePresetOriginal = DMS_UsePredefinedMissionLocations;
private _usePresetOriginal = DMS_UsePredefinedMissionLocations;
DMS_UsePredefinedMissionLocations = false;
// NOW we get the position (hopefully)
_pos = _posParameters call DMS_fnc_findSafePos;
private _pos = _posParameters call DMS_fnc_findSafePos;
// Reset the original values
DMS_MinMax_X_Coords = _original_x;

View File

@ -8,43 +8,13 @@
*/
private["_weapon","_result","_weaponName","_rnd338","_rnd93"];
private _compatibleMuzzles = getArray (configfile >> "CfgWeapons" >> _this >> "WeaponSlotsInfo" >> "MuzzleSlot" >> "compatibleItems");
_result = "";
_weapon = _this;
_weaponName = getText (configFile >> "cfgWeapons" >> _weapon >> "displayName");
switch (true) do
if (_compatibleMuzzles isEqualTo []) then
{
case ((_weaponName find "6.5") > -1) :
{
if (_weapon find "LMG_Mk200" > -1) then
{
_result = "muzzle_snds_H_MG";
}
else
{
_result = "muzzle_snds_H";
};
};
case ((_weaponName find "5.56") > -1) : {_result = "muzzle_snds_M";};
case ((_weaponName find "7.62") > -1) : {_result = "muzzle_snds_B";};
case ((_weaponName find ".45") > -1) : {_result = "muzzle_snds_acp";};
case ((_weaponName find "9 mm") > -1) : {_result = "muzzle_snds_L";};
case ((_weaponName find ".338") > -1) : {_result = selectRandom ["muzzle_snds_338_black","muzzle_snds_338_green","muzzle_snds_338_sand"];};
case ((_weaponName find "9.3 mm") > -1) : {_result = selectRandom ["muzzle_snds_93mmg","muzzle_snds_93mmg_tan"];};
"" // Return an empty string if there are no compatible muzzles/suppressors
}
else
{
selectRandom _compatibleMuzzles // Choose a random muzzle/suppressor (this is actually faster than selecting the first one)
};
// Zafir accepts no suppressors :(
if ((_weapon find "Zafir")>-1) then {_result = "";};
_result

View File

@ -0,0 +1,72 @@
/*
DMS_fnc_FreezeManager
Created by eraser1
Determines which AI groups (if any) to "freeze" in order to improve server performance, and will "un-freeze" frozen AI when a player is nearby.
This function will also offload AI after "un-freezing" if configured to do so.
NOTE: If you want this function to ignore a specific group, then you can set the variable "DMS_AllowFreezing" on the group to false.
eg: _group setVariable ["DMS_AllowFreezing",false]
*/
private _recentlyUnfrozen = [];
{
if (isNull _x) then
{
diag_log format["DMS ERROR :: Null Group found in DMS_FrozenAIGroups! Index: %1",_forEachIndex];
DMS_FrozenAIGroups deleteAt _forEachIndex;
}
else
{
private _leader = leader _x;
if ([_leader,DMS_ai_unfreezingDistance] call DMS_fnc_IsPlayerNearby) then
{
[_x,false] call DMS_fnc_FreezeToggle;
_recentlyUnfrozen pushBack _x;
if (DMS_ai_offloadOnUnfreeze) then
{
[_x, _leader] call DMS_fnc_SetAILocality;
};
if (DMS_DEBUG) then
{
format["FreezeManager :: Un-froze AI Group: %1",_x] call DMS_fnc_DebugLog;
};
DMS_FrozenAIGroups deleteAt _forEachIndex;
};
};
} forEach DMS_FrozenAIGroups;
if (DMS_ai_allowFreezing) then
{
{
if (((count (units _x))>1) && {_x getVariable ["DMS_AllowFreezing",true]} && {!(DMS_ai_freeze_Only_DMS_AI && {!(_x getVariable ["DMS_SpawnedGroup",false])})}) then
{
private _leader = leader _x;
private _group = _x;
if (!(isPlayer _leader) && {!([_leader,DMS_ai_freezingDistance] call DMS_fnc_IsPlayerNearby)}) then
{
[_group,true] call DMS_fnc_FreezeToggle;
if (DMS_DEBUG) then
{
format["FreezeManager :: Froze AI Group: %1",_group] call DMS_fnc_DebugLog;
};
// So that we don't check this group for freezing later on.
_group setVariable ["DMS_AllowFreezing",false];
};
};
} forEach allGroups;
};
// NOW we allow them to be frozen again, so we avoid checking for nearby players TWICE on a group(s) that has just been un-frozen.
{
_x setVariable ["DMS_AllowFreezing", true];
} forEach _recentlyUnfrozen;

View File

@ -0,0 +1,33 @@
/*
DMS_fnc_FreezeToggle
created by eraser1
Usage:
[
_group, // GROUP: The AI Group to be frozen
_freeze // BOOL: "true" if you want to freeze, false if you want to un-freeze
] call DMS_fnc_FreezeToggle;
Freezes/un-freezes a specified group.
*/
if !(params
[
"_group",
"_freeze"
]) exitWith
{
diag_log format["DMS ERROR :: Calling DMS_fnc_FreezeToggle with invalid parameters: %1",_this];
};
if (_freeze) then
{
{_x enableSimulationGlobal false} forEach (units _group);
_group setVariable ["DMS_isGroupFrozen",true];
DMS_FrozenAIGroups pushBack _group;
}
else
{
{_x enableSimulationGlobal true} forEach (units _group);
_group setVariable ["DMS_isGroupFrozen",false];
};

View File

@ -14,19 +14,15 @@
Returns all living units from a given array of groups or objects.
*/
private ["_units"];
if !(_this isEqualType []) then
{
_this = [_this];
};
_units = [];
private _units = [];
{
private ["_parameter"];
_parameter = _x;
private _parameter = _x;
_units append
(

View File

@ -0,0 +1,43 @@
/*
DMS_fnc_GetCenter
Originally created by Maca134 for the M3Editor
Adapted by eraser1
Usage:
[
[
_object1,
_object2,
...
_objectN
]
] call DMS_fnc_GetCenter;
Calculates and returns the approximate center co-ordinates (in PositionATL) for a list of objects.
*/
private _objects = _this param [0, [], [[]]];
private _ax = [];
private _ay = [];
private _az = [];
{
private _position = getPosASL _x;
_ax pushBack (_position select 0);
_ay pushBack (_position select 1);
_az pushBack (_position select 2);
} foreach _objects;
private _xs = 0;
private _xc = {_xs = _xs + _x; true} count _ax;
private _xz = _xs / _xc;
private _ys = 0;
private _yc = {_ys = _ys + _x; true} count _ay;
private _yz = _ys / _yc;
private _zs = 0;
private _zc = {_zs = _zs + _x; true} count _az;
private _zz = _zs / _zc;
ASLToATL [_xz, _yz, _zz]

View File

@ -108,21 +108,18 @@
Returns whether or not reinforcement waves or units given exceeds/matches maximum wave or unit reinforcements. If true, then no more reinforcements will be spawned (so the passed info should be deleted from the available reinforcements list).
*/
private ["_AIGroup", "_reinforcementInfo", "_updateInfo", "_spawnLocations", "_class", "_difficulty", "_side", "_monitorType", "_monitorParams", "_wavesInfo", "_unitsInfo", "_maxReinforcementWaves", "_reinforcementWavesGiven", "_maxReinforcementUnits", "_reinforcementUnitsGiven", "_updateDelay", "_lastUpdated", "_fnc_isDepleted", "_reinforcementsDepleted"];
// Check ALL the variables
if !(params
[
["_AIGroup", grpNull, [grpNull] ],
["_reinforcementInfo", [], [[]], [2] ],
["_updateInfo", [], [[]], [2] ],
["_spawnLocations", [], [[]] ],
["_class", "", [""] ],
["_difficulty", "", [""] ],
["_side", "", [""] ],
["_monitorType", "", [""] ],
["_monitorParams", [], [[]] ]
"_AIGroup",
"_reinforcementInfo",
"_updateInfo",
"_spawnLocations",
"_class",
"_difficulty",
"_side",
"_monitorType",
"_monitorParams"
])
exitWith
{
@ -133,8 +130,8 @@ exitWith
if !(_reinforcementInfo params
[
["_wavesInfo", [], [[]]],
["_unitsInfo", [], [[]]]
"_wavesInfo",
"_unitsInfo"
])
exitWith
{
@ -145,8 +142,8 @@ exitWith
if !(_wavesInfo params
[
["_maxReinforcementWaves", -1, [0]],
["_reinforcementWavesGiven", 0, [0]]
"_maxReinforcementWaves",
"_reinforcementWavesGiven"
])
exitWith
{
@ -157,8 +154,8 @@ exitWith
if !(_unitsInfo params
[
["_maxReinforcementUnits", -1, [0]],
["_reinforcementUnitsGiven", 0, [0]]
"_maxReinforcementUnits",
"_reinforcementUnitsGiven"
])
exitWith
{
@ -169,8 +166,8 @@ exitWith
if !(_updateInfo params
[
["_updateDelay", 300, [0]],
["_lastUpdated", 0, [0]]
"_updateDelay",
"_lastUpdated"
])
exitWith
{
@ -198,16 +195,16 @@ _fnc_isDepleted =
};
};
_reinforcementsDepleted = call _fnc_isDepleted;
private _reinforcementsDepleted = call _fnc_isDepleted;
if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) then
{
private ["_remainingUnits", "_unitsToSpawn"];
private "_unitsToSpawn";
private _remainingUnits =
if (isNull _AIGroup) then
{
// The group (presumably) lost all units and got deleted, so we create a new group using the given side and continue with that.
_remainingUnits = 0;
_AIGroup = createGroup (missionNamespace getVariable [format ["DMS_%1Side",_side],EAST]);
_this set [0, _AIGroup];
@ -217,10 +214,12 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
{
(format ["GroupReinforcementsManager :: Group provided was null! Created new group for ""%1"" side: %2",_side, _AIGroup]) call DMS_fnc_DebugLog;
};
0
}
else
{
_remainingUnits = {alive _x} count (units _AIGroup);
{alive _x} count (units _AIGroup);
};
@ -233,13 +232,11 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
{
case "playernear":
{
private ["_posOrObj", "_radius", "_reinforcementCount", "_maxAICount"];
if !(_monitorParams params
[
["_posOrObj", [], [objNull,[]], [2,3]],
["_radius", 0, [0]],
["_reinforcementCount", 0, [0]]
"_posOrObj",
"_radius",
"_reinforcementCount"
])
exitWith
{
@ -250,7 +247,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
if ([_posOrObj,_radius] call DMS_fnc_IsPlayerNearby) then
{
_maxAICount = if ((count _monitorParams)>3) then {_monitorParams param [3, 0, [0]]} else {0};
private _maxAICount = if ((count _monitorParams)>3) then {_monitorParams param [3, 0, [0]]} else {0};
_unitsToSpawn = _reinforcementCount min ((_maxAICount-_remainingUnits) max 0);
};
@ -258,11 +255,9 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
case "maintain":
{
private "_AICount";
if !(_monitorParams params
[
["_AICount", 0, [0]]
"_AICount"
])
exitWith
{
@ -279,12 +274,10 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
case "reinforce":
{
private ["_AICount", "_reinforcementCount", "_maxAICount"];
if !(_monitorParams params
[
["_AICount", 0, [0]],
["_reinforcementCount", 0, [0]]
"_AICount",
"_reinforcementCount"
])
exitWith
{
@ -295,7 +288,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
if (_remainingUnits<_AICount) then
{
_maxAICount = if ((count _monitorParams)>2) then {_monitorParams param [2, 0, [0]]} else {_AICount};
private _maxAICount = if ((count _monitorParams)>2) then {_monitorParams param [2, 0, [0]]} else {_AICount};
_unitsToSpawn = _reinforcementCount min ((_maxAICount-_remainingUnits) max 0);
};
@ -303,13 +296,11 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
case "increasing_resistance":
{
private ["_AICount", "_reinforcementCount", "_increment_AICount", "_maxAICount"];
if !(_monitorParams params
[
["_AICount", 0, [0]],
["_reinforcementCount", 0, [0]],
["_increment_AICount", 0, [0]]
"_AICount",
"_reinforcementCount",
"_increment_AICount"
])
exitWith
{
@ -320,7 +311,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
if (_remainingUnits<_AICount) then
{
_maxAICount = if ((count _monitorParams)>3) then {_monitorParams param [3, 0, [0]]} else {_AICount};
private _maxAICount = if ((count _monitorParams)>3) then {_monitorParams param [3, 0, [0]]} else {_AICount};
_unitsToSpawn = _reinforcementCount min ((_maxAICount-_remainingUnits) max 0);
@ -330,12 +321,10 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
case "increasing_difficulty":
{
private ["_AICount", "_reinforcementCount", "_maxAICount"];
if !(_monitorParams params
[
["_AICount", 0, [0]],
["_reinforcementCount", 0, [0]]
"_AICount",
"_reinforcementCount"
])
exitWith
{
@ -355,7 +344,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
case "hardcore": {"hardcore"};
};
_maxAICount = if ((count _monitorParams)>3) then {_monitorParams param [3, 0, [0]]} else {_AICount};
private _maxAICount = if ((count _monitorParams)>3) then {_monitorParams param [3, 0, [0]]} else {_AICount};
_unitsToSpawn = _reinforcementCount min ((_maxAICount-_remainingUnits) max 0);
};
@ -363,11 +352,9 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
case "armed_vehicle":
{
private ["_AICount", "_vehClass", "_leaderPos", "_veh"];
if !(_monitorParams params
[
["_AICount", 0, [0]]
"_AICount"
])
exitWith
{
@ -377,11 +364,11 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
if (_remainingUnits<_AICount) then
{
_vehClass = if ((count _monitorParams)>1) then {_monitorParams param [1, "", [""]]} else {"random"};
private _vehClass = if ((count _monitorParams)>1) then {_monitorParams param [1, "", [""]]} else {"random"};
_leaderPos = getPosATL (leader _AIGroup);
private _leaderPos = getPosATL (leader _AIGroup);
_veh =
private _veh =
[
[
if (_spawnLocations isEqualTo []) then {_leaderPos getPos [100+(random 200),random 360]} else {selectRandom _spawnLocations},
@ -407,11 +394,9 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
case "armed_vehicle_replace":
{
private ["_vehicle", "_vehClass", "_leaderPos"];
if !(_monitorParams params
[
["_vehicle", objNull, [objNull]]
"_vehicle"
])
exitWith
{
@ -423,9 +408,9 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
{
deleteVehicle _vehicle;
_vehClass = if ((count _monitorParams)>1) then {_monitorParams param [1, "", [""]]} else {"random"};
private _vehClass = if ((count _monitorParams)>1) then {_monitorParams param [1, "", [""]]} else {"random"};
_leaderPos = getPosATL (leader _AIGroup);
private _leaderPos = getPosATL (leader _AIGroup);
_vehicle =
[
@ -455,12 +440,10 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
case "static_gunner":
{
private ["_staticGun", "_gunPos", "_staticGunClass"];
if !(_monitorParams params
[
["_staticGun", objNull, [objNull]],
["_gunPos", [], [[]], [2,3]]
"_staticGun",
"_gunPos"
])
exitWith
{
@ -472,9 +455,9 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
{
deleteVehicle _staticGun;
_staticGunClass = if ((count _monitorParams)>1) then {_monitorParams param [1, "", [""]]} else {"random"};
private _staticGunClass = if ((count _monitorParams)>1) then {_monitorParams param [1, "", [""]]} else {"random"};
_leaderPos = getPosATL (leader _AIGroup);
private _leaderPos = getPosATL (leader _AIGroup);
_staticGun =
[
@ -505,10 +488,10 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
{
if !(_monitorParams params
[
["_AICount",0,[0]],
["_ejectFFVGunners",false,[false]],
["_maxJumpers",0,[0]],
["_remainAsGunship", 0, [false]]
"_AICount",
"_ejectFFVGunners",
"_maxJumpers",
"_remainAsGunship"
])
exitWith
{
@ -562,7 +545,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
if ((!isNil "_unitsToSpawn") && {_unitsToSpawn>0}) then
{
private ["_spawnPos", "_units", "_spawningLocations"];
private _spawnPos = [];
if (_maxReinforcementUnits>0) then
{
@ -578,7 +561,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
};
};
_units = [];
private _units = [];
if (_spawnLocations isEqualTo []) then
{
@ -593,14 +576,14 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
else
{
// Shuffle the original list and make a copy.
_spawningLocations = (_spawnLocations call ExileClient_util_array_shuffle) + [];
private _spawningLocations = (_spawnLocations call ExileClient_util_array_shuffle) + [];
_spawnPos = _spawningLocations select 0; // Define it for spawning flares
_spawningLocations_count = count _spawningLocations;
// Add extra spawning locations if there are not enough.
for "_i" from 0 to (_unitsToSpawn-_spawningLocations_count-1) do
{
_spawningLocations pushBack (_spawningLocations select floor(random(_spawningLocations_count+_i)));
_spawningLocations pushBack (selectRandom _spawningLocations);
};
// Now to spawn the AI...

View File

@ -46,9 +46,9 @@
{
if !(_x params
[
["_heli", objNull, [objNull]],
["_dropPoint", 0, [[], objNull], [2,3]],
["_remainAsGunship", false, [false]]
"_heli",
"_dropPoint",
"_remainAsGunship"
])
exitWith
{
@ -70,9 +70,9 @@
if ((_heli distance2D _dropPoint)<200) then
{
private["_groupOwner","_AIGroup"];
private _groupOwner = [];
_AIGroup = group _heli;
private _AIGroup = group _heli;
// Grab and lock locality to control AI if necessary.
if !(local _AIGroup) then
@ -89,8 +89,7 @@
{
/*
moveOut _unit;
private ["_parachute", "_dir"];
_parachute = createVehicle ["Steerable_Parachute_F", (getPosATL _unit), [], 0, "CAN_COLLIDE"];
private _parachute = createVehicle ["Steerable_Parachute_F", (getPosATL _unit), [], 0, "CAN_COLLIDE"];
_parachute setDir (getDir _unit);
_parachute enableSimulationGlobal true;
@ -149,7 +148,7 @@
// Revert and unlock locality if necessary.
if !(isNil "_groupOwner") then
if !(_groupOwner isEqualTo []) then
{
_AIGroup setGroupOwner _groupOwner;
_AIGroup setVariable ["DMS_LockLocality", false];

View File

@ -15,9 +15,6 @@
Returns all created objects.
*/
private ["_file", "_pos", "_objs", "_export", "_obj", "_objPos"];
if !(params
[
["_file","",[""]],
@ -42,20 +39,22 @@ if ((count _pos)<3) then
_pos set [2,0];
};
private _export = call compile preprocessFileLineNumbers (format ["\x\addons\DMS\objects\%1.sqf",_file]);
if ((isNil "_export") || {!(_export isEqualType [])}) exitWith
{
diag_log format ["DMS ERROR :: Calling DMS_fnc_ImportFromM3E with invalid file/filepath: %1 | _export: %2",_file,_export];
[]
};
_export = call compile preprocessFileLineNumbers (format ["\x\addons\DMS\objects\%1.sqf",_file]);
_objs = _export apply
private _objs = _export apply
{
// Create the object
_obj = createVehicle [_x select 0, [0,0,0], [], 0, "CAN_COLLIDE"];
private _obj = createVehicle [_x select 0, [0,0,0], [], 0, "CAN_COLLIDE"];
_obj enableSimulationGlobal false;
// Calculate the object's position using provided relative position
_objPos = [_pos,_x select 1] call DMS_fnc_CalcPos;
private _objPos = [_pos,_x select 1] call DMS_fnc_CalcPos;
if (((count _x)>4) && {!(_x select 4)}) then
{
@ -69,8 +68,6 @@ _objs = _export apply
_obj setPos _objPos;
};
_obj enableSimulationGlobal false;
_obj;
};

View File

@ -0,0 +1,60 @@
/*
DMS_fnc_ImportFromM3E_3DEN
Created by eraser1
Check out M3 Editor - 3DEN: https://github.com/maca134/m3e_3den/releases
Usage:
[
_file, // String: The filename (or filepath under the objects folder) that contains the exported M3E objects
_center // Object or Array (PositionATL): Center position
] call DMS_fnc_ImportFromM3E_3DEN;
This function is should be used with the "Export Objects (Relative)" command.
Returns all created objects.
*/
if !(params
[
["_file","",[""]],
["_center","",[[],objNull],[2,3]]
])
exitWith
{
diag_log format ["DMS ERROR :: Calling DMS_fnc_ImportFromM3E with invalid parameters: %1",_this];
[]
};
// Get the position if an object was supplied instead of position
if (_center isEqualType objNull) then
{
_center = getPosATL _center;
};
// Set the center pos to 0 if it isn't defined
if ((count _center)<3) then
{
_center set [2,0];
};
private _export = call compile preprocessFileLineNumbers (format ["\x\addons\DMS\objects\%1.sqf",_file]);
if ((isNil "_export") || {!(_export isEqualType [])}) exitWith
{
diag_log format ["DMS ERROR :: Calling DMS_fnc_ImportFromM3E with invalid file/filepath: %1 | _export: %2",_file,_export];
[]
};
private _objs = _export apply
{
private _object = (_x select 0) createVehicle [0,0,0];
_object setDir (_x select 2);
_object setPosATL (_center vectorAdd (_x select 1));
_object enableSimulationGlobal ((_x select 3) select 0);
_object allowDamage ((_x select 3) select 1);
};
_objs

View File

@ -0,0 +1,67 @@
/*
DMS_fnc_ImportFromM3E_3DEN_Convert
Created by eraser1
Check out M3 Editor - 3DEN: https://github.com/maca134/m3e_3den/releases
Usage:
[
_file, // String: The filename (or filepath under the objects folder) that contains the exported M3E objects
_missionPos // Object or Array: Center position
] call DMS_fnc_ImportFromM3E_3DEN_Convert;
This function will take a file exported from M3Editor, convert it into relative position, then place the objects from the converted relative positions.
Use this function if you don't know how to get the relative position, and you only have the exported static positions.
This function will return all created objects.
*/
if !(params
[
["_file","",[""]],
["_missionPos","",[[],objNull],[2,3]]
])
exitWith
{
diag_log format ["DMS ERROR :: Calling DMS_fnc_ImportFromM3E_Convert with invalid parameters: %1",_this];
[]
};
// Get the position if an object was supplied instead of position
if (_missionPos isEqualType objNull) then
{
_missionPos = getPosATL _missionPos;
};
// Set the center pos to 0 if it isn't defined
if ((count _missionPos)<3) then
{
_missionPos set [2,0];
};
private _export = call compile preprocessFileLineNumbers (format ["\x\addons\DMS\objects\static\%1.sqf",_file]);
if ((isNil "_export") || {!(_export isEqualType [])}) exitWith
{
diag_log format ["DMS ERROR :: Calling DMS_fnc_ImportFromM3E_Convert with invalid file/filepath: %1 | _export: %2",_file,_export];
[]
};
private _objs = _export apply
{
private _object = (_x select 0) createVehicle [0,0,0];
_object setPosASL ((_x select 1) vectorAdd [0,0,5000]);
_object setVectorDirAndUp (_x select 2);
_object enableSimulationGlobal ((_x select 3) select 0);
_object allowDamage ((_x select 3) select 1);
_object;
};
[_objs,_missionPos] call DMS_fnc_SetRelPositions;
_objs

View File

@ -0,0 +1,59 @@
/*
DMS_fnc_ImportFromM3E_3DEN_Static
Created by eraser1
Check out M3 Editor - 3DEN: https://github.com/maca134/m3e_3den/releases
Usage:
[
_file // String: The filename (or filepath under the objects folder) that contains the exported M3E objects
] call DMS_fnc_ImportFromM3E_3DEN_Static;
_file call DMS_fnc_ImportFromM3E_3DEN_Static; // This also works
This function will simply create the objects from a file that was exported from M3Editor, and return a list of those objects.
*/
if !(params
[
["_file","",[""]]
])
exitWith
{
diag_log format ["DMS ERROR :: Calling DMS_fnc_ImportFromM3E_Static with invalid parameters: %1",_this];
[]
};
// The next few lines checks to see if the static base has been spawned previously, in order to avoid spawning duplicate objects.
private _varname = format ["DMS_StaticBaseSpawned_%1",_file];
if (missionNamespace getVariable [_varname,false]) exitWith
{
diag_log format ["DMS ERROR :: Attempting to spawn static base with file ""%1"" after it has already been spawned!",_file];
};
missionNamespace setVariable [_varname,true];
private _export = call compile preprocessFileLineNumbers (format ["\x\addons\DMS\objects\static\%1.sqf",_file]);
if ((isNil "_export") || {!(_export isEqualType [])}) exitWith
{
diag_log format ["DMS ERROR :: Calling DMS_fnc_ImportFromM3E_Static with invalid file/filepath: %1 | _export: %2",_file,_export];
[]
};
private _objs = _export apply
{
private _object = (_x select 0) createVehicle [0,0,0];
_object setPosASL (_x select 1);
_object setVectorDirAndUp (_x select 2);
_object enableSimulationGlobal ((_x select 3) select 0);
_object allowDamage ((_x select 3) select 1);
_object;
};
_objs

View File

@ -16,9 +16,6 @@
This function will return all created objects.
*/
private ["_file", "_missionPos", "_objs", "_export", "_obj", "_objPos"];
if !(params
[
["_file","",[""]],
@ -44,17 +41,21 @@ if ((count _missionPos)<3) then
};
private _export = call compile preprocessFileLineNumbers (format ["\x\addons\DMS\objects\static\%1.sqf",_file]);
_export = call compile preprocessFileLineNumbers (format ["\x\addons\DMS\objects\static\%1.sqf",_file]);
_objs = _export apply
if ((isNil "_export") || {!(_export isEqualType [])}) exitWith
{
private ["_obj","_pos"];
_obj = createVehicle [_x select 0, [0,0,0], [], 0, "CAN_COLLIDE"];
_pos = _x select 1;
_pos set [2,(_pos select 2)+5000];
diag_log format ["DMS ERROR :: Calling DMS_fnc_ImportFromM3E_Convert with invalid file/filepath: %1 | _export: %2",_file,_export];
[]
};
private _objs = _export apply
{
private _obj = createVehicle [_x select 0, [0,0,0], [], 0, "CAN_COLLIDE"];
_obj enableSimulationGlobal false;
private _pos = (_x select 1) vectorAdd [0,0,5000];
if (_x select 4) then
{
_obj setDir (_x select 2);
@ -66,12 +67,10 @@ _objs = _export apply
_obj setVectorDirAndUp (_x select 3);
};
_obj enableSimulationGlobal false;
_obj;
};
[_objs,_missionPos] call DMS_fnc_setRelPositions;
[_objs,_missionPos] call DMS_fnc_SetRelPositions;
_objs

View File

@ -14,10 +14,6 @@
This function will simply create the objects from a file that was exported from M3Editor, and return a list of those objects.
*/
private ["_OK", "_varname", "_file", "_export"];
if !(params
[
["_file","",[""]]
@ -28,7 +24,8 @@ exitWith
[]
};
_varname = format ["DMS_StaticBaseSpawned_%1",_file];
// The next few lines checks to see if the static base has been spawned previously, in order to avoid spawning duplicate objects.
private _varname = format ["DMS_StaticBaseSpawned_%1",_file];
if (missionNamespace getVariable [_varname,false]) exitWith
{
@ -38,8 +35,7 @@ if (missionNamespace getVariable [_varname,false]) exitWith
missionNamespace setVariable [_varname,true];
_export = call compile preprocessFileLineNumbers (format ["\x\addons\DMS\objects\static\%1.sqf",_file]);
private _export = call compile preprocessFileLineNumbers (format ["\x\addons\DMS\objects\static\%1.sqf",_file]);
if ((isNil "_export") || {!(_export isEqualType [])}) exitWith
{
@ -47,15 +43,13 @@ if ((isNil "_export") || {!(_export isEqualType [])}) exitWith
[]
};
_objs = _export apply
private _objs = _export apply
{
private ["_obj","_pos"];
_obj = createVehicle [_x select 0, [0,0,0], [], 0, "CAN_COLLIDE"];
_pos = _x select 1;
private _obj = createVehicle [_x select 0, [0,0,0], [], 0, "CAN_COLLIDE"];
_obj enableSimulationGlobal false;
private _pos = _x select 1;
if (_x select 4) then
{
_obj setDir (_x select 2);
@ -67,8 +61,6 @@ _objs = _export apply
_obj setVectorDirAndUp (_x select 3);
};
_obj enableSimulationGlobal false;
_obj;
};

View File

@ -11,23 +11,18 @@
*/
private["_result","_position","_radius"];
if !(params
[
["_position",[],[[]],[2,3]],
["_radius",0,[0]]
"_position",
"_radius"
])
exitWith
{
diag_log format["DMS ERROR :: Calling DMS_fnc_IsNearWater with invalid parameters: %1",_this];
false
};
_position = _this select 0;
_radius = _this select 1;
_result = false;
private _result = false;
try
{

View File

@ -11,13 +11,10 @@
Returns whether or not a player is within "_distance" meters of "_positionOrObject".
*/
private ["_pos", "_dis", "_isNear"];
if !(params
[
["_pos", "", [objNull,[]], [2,3]],
["_dis", 0, [0]]
"_pos",
"_dis"
])
exitWith
{
@ -27,7 +24,7 @@ exitWith
if (_dis isEqualTo 0) exitWith {false};
_isNear = false;
private _isNear = false;
try
{

View File

@ -0,0 +1,73 @@
/*
DMS_fnc_IsPosBlacklisted
Created by eraser1
Usage:
[
_pos,
[
_blacklist1,
_blacklist2,
...
_blacklistN
]
] call DMS_fnc_IsPosBlacklisted;
A blacklist can be in the form:
[[x1,y1],[x2,y2]]
where x1 is LESS than x2, and y1 is LESS than y2. This method is SLOWER.
or,
[[x,y],radius]
where any position within "radius" meters of position "x,y" is blacklisted. This method is FASTER.
Returns true if the given position is blacklisted.
*/
if !(params
[
"_pos",
"_blacklists"
]) exitWith
{
diag_log format ["DMS ERROR :: Calling DMS_fnc_IsPosBlacklisted with invalid parameters: %1",_this];
};
try
{
{
_x params
[
"_blacklist_pos",
"_blacklist_parameter"
];
if (_blacklist_parameter isEqualType 0) then
{
if ((_pos distance2D _blacklist_pos) <= _blacklist_parameter) throw _x;
}
else
{
if
(
((_pos select 0) >= (_blacklist_pos select 0)) && // if x is greater than x1 and
{(_pos select 0) <= (_blacklist_parameter select 0)} && // if x is less than x2 and
{(_pos select 1) >= (_blacklist_pos select 1)} && // if y is greater than y1 and
{(_pos select 1) <= (_blacklist_parameter select 1)} // if y is less than y2
) throw _x; // blacklisted
};
} forEach _blacklists;
false
}
catch
{
if (DMS_DEBUG) then
{
format["Position |%1| is blacklisted by blacklist parameter |%2|. All provided blacklists: %3",_pos,_exception,_blacklists] call DMS_fnc_DebugLog;
};
true
};

View File

@ -11,7 +11,6 @@
_traderZoneNearLimit, // NUMBER (distance): Minimum distance from a trader zone.
_missionNearLimit, // NUMBER (distance): Minimum distance from another mission.
_playerNearLimit, // NUMBER (distance): Minimum distance from a player.
_waterSpawn // BOOLEAN: Whether or not the mission is supposed to spawn on water.
] call DMS_fnc_IsValidPosition;
All parameters except "_pos" are optional.
@ -19,30 +18,26 @@
Returns whether or not the provided position matches the parameters.
*/
private ["_pos", "_nearestObjectMinDistance", "_waterNearLimit", "_minSurfaceNormal", "_spawnZoneNearLimit", "_traderZoneNearLimit", "_missionNearLimit", "_playerNearLimit", "_territoryNearLimit", "_waterSpawn", "_isValidPos"];
_isValidPos = false;
if !(params
[
["_pos", [], [[]], [0,2,3]],
["_waterNearLimit", DMS_WaterNearBlacklist, [0] ],
["_minSurfaceNormal", DMS_MinSurfaceNormal, [0] ],
["_spawnZoneNearLimit", DMS_SpawnZoneNearBlacklist, [0] ],
["_traderZoneNearLimit", DMS_TraderZoneNearBlacklist,[0] ],
["_missionNearLimit", DMS_MissionNearBlacklist, [0] ],
["_playerNearLimit", DMS_PlayerNearBlacklist, [0] ],
["_territoryNearLimit", DMS_TerritoryNearBlacklist, [0] ],
["_waterSpawn", false, [false] ]
"_pos",
"_waterNearLimit",
"_minSurfaceNormal",
"_spawnZoneNearLimit",
"_traderZoneNearLimit",
"_missionNearLimit",
"_playerNearLimit",
"_territoryNearLimit"
])
then
{
diag_log format ["DMS ERROR :: Calling DMS_fnc_isValidPosition with invalid parameters: %1",_this];
false
}
else
{
private _isValidPos = false;
try
{
if ((count _pos)<2) then
@ -56,15 +51,12 @@ else
};
if (!(DMS_findSafePosBlacklist isEqualTo []) && {([_pos, DMS_findSafePosBlacklist] call BIS_fnc_isPosBlacklisted)}) then
if (!(DMS_findSafePosBlacklist isEqualTo []) && {([_pos, DMS_findSafePosBlacklist] call DMS_fnc_IsPosBlacklisted)}) then
{
throw ("a blacklisted position");
};
// Only do these checks if the mission is supposed to be on land.
if (!_waterSpawn) then
{
// Check for nearby water
if ((_waterNearLimit>0) && {[_pos,_waterNearLimit] call DMS_fnc_isNearWater}) then
{
@ -91,21 +83,6 @@ else
};
};
};
}
else
{
// Check to see if the position is actually water.
if !(surfaceIsWater _pos) then
{
throw ("land");
};
// Check the depth of the water.
if ((getTerrainHeightASL _pos)<-DMS_MinWaterDepth) then
{
throw ("shallow water");
};
};
{
@ -176,7 +153,6 @@ else
(format ["IsValidPosition :: Position %1 is too close to %2!",_pos,_exception]) call DMS_fnc_DebugLog;
};
};
_isValidPos
};
_isValidPos;

View File

@ -47,10 +47,9 @@
]
*/
private ["_parsedParams", "_extraParams", "_missionPosition", "_OK", "_posInfo", "_forceSpawn", "_findSafePosParams"];
private _missionPosition = [];
_extraParams = [];
private _extraParams = [];
if (isNil "_this") then
{
@ -62,7 +61,7 @@ if (isNil "_this") then
// Simply use generated position with default values.
_missionPosition =
[
25,DMS_WaterNearBlacklist,DMS_MaxSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist,DMS_ThrottleBlacklists
25,DMS_WaterNearBlacklist,DMS_MinSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist,DMS_ThrottleBlacklists
] call DMS_fnc_FindSafePos;
}
else
@ -71,13 +70,13 @@ else
{
if (params
[
["_findSafePosParams",[25,DMS_WaterNearBlacklist,DMS_MaxSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist,DMS_ThrottleBlacklists],[[]]],
["_findSafePosParams",[25,DMS_WaterNearBlacklist,DMS_MinSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist,DMS_ThrottleBlacklists],[[]]],
["_posInfo",[],[[]],[1,2]]
])
then
{
_missionPosition = _posInfo select 0;
_forceSpawn = if ((count _posInfo)>1) then {_posInfo select 1} else {false};
private _forceSpawn = if ((count _posInfo)>1) then {_posInfo select 1} else {false};
if (!(_missionPosition isEqualType []) || {(count _missionPosition)<2}) then
{
@ -98,7 +97,7 @@ else
_missionPosition set [2,0];
};
if (!_forceSpawn && {!([_missionPosition,DMS_WaterNearBlacklist,DMS_MaxSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist] call DMS_fnc_IsValidPosition)}) then
if (!_forceSpawn && {!([_missionPosition,DMS_WaterNearBlacklist,DMS_MinSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist] call DMS_fnc_IsValidPosition)}) then
{
if (DMS_DEBUG) then
{
@ -124,14 +123,14 @@ else
{
_missionPosition =
[
25,DMS_WaterNearBlacklist,DMS_MaxSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist,DMS_ThrottleBlacklists
25,DMS_WaterNearBlacklist,DMS_MinSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist,DMS_ThrottleBlacklists
] call DMS_fnc_FindSafePos;
_extraParams = _this;
};
};
_parsedParams =
private _parsedParams =
[
_missionPosition,
_extraParams

View File

@ -16,23 +16,18 @@ if !(_this isEqualType []) exitWith
diag_log format ["DMS ERROR :: DMS_fnc_MissionSuccessState called with invalid parameter: %1",_this];
};
private ["_success", "_exit"];
_success = true;
_exit = false;
private _success = true;
private _exit = false;
{
if (_exit) exitWith {};
try
{
private ["_OK","_completionType","_completionArgs","_absoluteWinCondition"];
if !(_x params
[
["_completionType", "", [""] ],
["_completionArgs", [], [[],grpNull] ]
"_completionType",
"_completionArgs"
])
then
{
@ -41,7 +36,7 @@ _exit = false;
};
_absoluteWinCondition = if ((count _x)>2) then {_x select 2} else {false};
private _absoluteWinCondition = if ((count _x)>2) then {_x select 2} else {false};
if (!_success && {!_absoluteWinCondition}) then
{

View File

@ -34,30 +34,79 @@
A semi-full breakdown can be found in fn_AddMissionToMonitor.sqf
*/
private ["_pos", "_completionInfo", "_timeStarted", "_failTime", "_units", "_buildings", "_vehs", "_crate_info_array", "_mines", "_missionName", "_msgWIN", "_msgLose", "_markers", "_missionSide", "_arr", "_cleanupList"];
{
_pos = _x select 0;
_completionInfo = _x select 1;
_timeStarted = _x select 2 select 0;
_failTime = _x select 2 select 1;
_units = _x select 3;
_buildings = _x select 4 select 0;
_vehs = _x select 4 select 1;
_crate_info_array = _x select 4 select 2;
_mines = _x select 4 select 3;
_missionName = _x select 5 select 0;
_msgWIN = _x select 5 select 1;
_msgLose = _x select 5 select 2;
_markers = _x select 6;
_missionSide = _x select 7;
_missionDifficulty = _x select 8;
_missionEvents = _x select 9;
_onSuccessScripts = _x select 10 select 0;
_onFailScripts = _x select 10 select 1;
_onMonitorStart = _x select 10 select 2;
_onMonitorEnd = _x select 10 select 3;
if !(_x params
[
"_pos",
"_completionInfo",
"_timing",
"_units",
"_missionObjs",
"_msgInfo",
"_markers",
"_missionSide",
"_missionDifficulty",
"_missionEvents",
"_missionScripts"
])
then
{
DMS_Mission_Arr deleteAt _forEachIndex;
diag_log format ["DMS ERROR :: Invalid Index (%1) in DMS_Mission_Arr: %2",_forEachIndex,_x];
};
if !(_timing params
[
"_timeStarted",
"_failTime"
])
exitWith
{
DMS_Mission_Arr deleteAt _forEachIndex;
diag_log format ["DMS ERROR :: Invalid _timing (%1) in DMS_Mission_Arr: %2",_timing,_x];
};
if !(_missionObjs params
[
"_buildings",
"_vehs",
"_crate_info_array",
"_mines"
])
exitWith
{
DMS_Mission_Arr deleteAt _forEachIndex;
diag_log format ["DMS ERROR :: Invalid _missionObjs (%1) in DMS_Mission_Arr: %2",_missionObjs,_x];
};
if !(_msgInfo params
[
"_missionName",
"_msgWIN",
"_msgLose"
])
exitWith
{
DMS_Mission_Arr deleteAt _forEachIndex;
diag_log format ["DMS ERROR :: Invalid _msgInfo (%1) in DMS_Mission_Arr: %2",_msgInfo,_x];
};
if !(_missionScripts params
[
"_onSuccessScripts",
"_onFailScripts",
"_onMonitorStart",
"_onMonitorEnd"
])
exitWith
{
DMS_Mission_Arr deleteAt _forEachIndex;
diag_log format ["DMS ERROR :: Invalid _missionScripts (%1) in DMS_Mission_Arr: %2",_missionScripts,_x];
};
try
{
@ -157,14 +206,13 @@ private ["_pos", "_completionInfo", "_timeStarted", "_failTime", "_units", "_bui
};
//Nobody is nearby so just cleanup objects from here
_cleanupList = ((_units call DMS_fnc_GetAllUnits)+_buildings+_vehs+_mines);
private _cleanupList = ((_units call DMS_fnc_GetAllUnits)+_buildings+_vehs+_mines);
{
_cleanupList pushBack (_x select 0);
} forEach _crate_info_array;
private["_prev"];
_prev = DMS_CleanUp_PlayerNearLimit;
private _prev = DMS_CleanUp_PlayerNearLimit;
DMS_CleanUp_PlayerNearLimit = 0; // Temporarily set the limit to 0 since we want to delete all the stuff regardless of player presence.
_cleanupList call DMS_fnc_CleanUp;
@ -214,10 +262,8 @@ private ["_pos", "_completionInfo", "_timeStarted", "_failTime", "_units", "_bui
if (DMS_MarkerText_ShowAICount) then
{
private ["_dot", "_text"];
_dot = _markers select 0;
_text = missionNamespace getVariable [format ["%1_text",_dot],_missionName];
private _dot = _markers select 0;
private _text = missionNamespace getVariable [format ["%1_text",_dot],_missionName];
if (DMS_MarkerText_ShowMissionPrefix) then
{

View File

@ -40,24 +40,21 @@
A semi-full breakdown can be found in fn_AddStaticMissionToMonitor.sqf
*/
{
private ["_missionPos", "_completionInfo", "_groupReinforcementsInfo", "_timing", "_inputAIUnits", "_missionObjs", "_msgInfo", "_markers", "_missionSide", "_missionDifficulty", "_missionEvents", "_missionScripts", "_timeStarted", "_failTime", "_buildings", "_vehs", "_crate_info_array", "_mines", "_missionName", "_msgWIN", "_msgLose", "_onSuccessScripts", "_onFailScripts"];
if !(_x params
[
["_missionPos", [], [[]], [2,3] ],
["_completionInfo", [], [[]] ],
["_groupReinforcementsInfo", [], [[]] ],
["_timing", [], [[]], [2] ],
["_inputAIUnits", [], [[]] ],
["_missionObjs", [], [[]], [4] ],
["_msgInfo", [], [[]], [3] ],
["_markers", [], [[]], [DMS_MissionMarkerCount] ],
["_missionSide", "", [""] ],
["_missionDifficulty", "", [""] ],
["_missionEvents", [], [[]] ],
["_missionScripts", [], [[]], [4] ]
"_missionPos",
"_completionInfo",
"_groupReinforcementsInfo",
"_timing",
"_inputAIUnits",
"_missionObjs",
"_msgInfo",
"_markers",
"_missionSide",
"_missionDifficulty",
"_missionEvents",
"_missionScripts"
])
then
{
@ -65,19 +62,58 @@
diag_log format ["DMS ERROR :: Invalid Index (%1) in DMS_StaticMission_Arr: %2",_forEachIndex,_x];
};
_timeStarted = _timing select 0;
_failTime = _timing select 1;
_buildings = _missionObjs select 0;
_vehs = _missionObjs select 1;
_crate_info_array = _missionObjs select 2;
_mines = _missionObjs select 3;
_missionName = _msgInfo select 0;
_msgWIN = _msgInfo select 1;
_msgLose = _msgInfo select 2;
_onSuccessScripts = _missionScripts select 0;
_onFailScripts = _missionScripts select 1;
_onMonitorStart = _missionScripts select 2;
_onMonitorEnd = _missionScripts select 3;
if !(_timing params
[
"_timeStarted",
"_failTime"
])
exitWith
{
DMS_StaticMission_Arr deleteAt _forEachIndex;
diag_log format ["DMS ERROR :: Invalid _timing (%1) in DMS_StaticMission_Arr: %2",_timing,_x];
};
if !(_missionObjs params
[
"_buildings",
"_vehs",
"_crate_info_array",
"_mines"
])
exitWith
{
DMS_StaticMission_Arr deleteAt _forEachIndex;
diag_log format ["DMS ERROR :: Invalid _missionObjs (%1) in DMS_StaticMission_Arr: %2",_missionObjs,_x];
};
if !(_msgInfo params
[
"_missionName",
"_msgWIN",
"_msgLose"
])
exitWith
{
DMS_StaticMission_Arr deleteAt _forEachIndex;
diag_log format ["DMS ERROR :: Invalid _msgInfo (%1) in DMS_StaticMission_Arr: %2",_msgInfo,_x];
};
if !(_missionScripts params
[
"_onSuccessScripts",
"_onFailScripts",
"_onMonitorStart",
"_onMonitorEnd"
])
exitWith
{
DMS_StaticMission_Arr deleteAt _forEachIndex;
diag_log format ["DMS ERROR :: Invalid _missionScripts (%1) in DMS_StaticMission_Arr: %2",_missionScripts,_x];
};
try
{
@ -175,8 +211,7 @@
_cleanupList pushBack (_x select 0);
} forEach _crate_info_array;
private["_prev"];
_prev = DMS_CleanUp_PlayerNearLimit;
private _prev = DMS_CleanUp_PlayerNearLimit;
DMS_CleanUp_PlayerNearLimit = 0; // Temporarily set the limit to 0 since we want to delete all the stuff regardless of player presence.
_cleanupList call DMS_fnc_CleanUp;
@ -218,10 +253,8 @@
if (DMS_MarkerText_ShowAICount_Static) then
{
private ["_dot", "_text"];
_dot = _markers select 0;
_text = missionNamespace getVariable [format ["%1_text",_dot],_missionName];
private _dot = _markers select 0;
private _text = missionNamespace getVariable [format ["%1_text",_dot],_missionName];
if (DMS_MarkerText_ShowMissionPrefix) then
{

View File

@ -13,28 +13,26 @@
_type // Type of AI: "soldier","static","vehicle","heli", etc.
] call DMS_fnc_OnKilled;
*/
private ["_unit", "_killer", "_side", "_type", "_launcher", "_launcherVar", "_playerObj", "_removeAll", "_rockets", "_grp", "_grpUnits", "_av", "_memCount", "_gunner", "_driver", "_gunnerIsAlive", "_driverIsAlive", "_grp", "_owner", "_start", "_roadKilled", "_veh", "_boom", "_revealAmount", "_muzzle", "_silencer"];
if (DMS_DEBUG) then
{
(format ["OnKilled :: Logging AI death with parameters: %1",_this]) call DMS_fnc_DebugLog;
};
_unit = _this select 0;
_killer = _this select 1;
_side = _unit getVariable ["DMS_AI_Side", "bandit"];
_type = _unit getVariable ["DMS_AI_Type", "soldier"];
_launcher = secondaryWeapon _unit;
_launcherVar = _unit getVariable ["DMS_AI_Launcher",""];
_playerObj = objNull;
params
[
"_unit",
"_killer"
];
private _side = _unit getVariable ["DMS_AI_Side", "bandit"];
private _type = _unit getVariable ["DMS_AI_Type", "soldier"];
private _launcher = secondaryWeapon _unit;
private _launcherVar = _unit getVariable ["DMS_AI_Launcher",""];
private _playerObj = objNull;
_unit call ([missionNamespace getVariable [_unit getVariable ["DMS_AI_CustomOnKilledFnc",""],{}]] param [0,{},[{}]]);
// Some of the previously used functions work with non-local argument. Some don't. BIS is annoying
_removeAll =
private _removeAll =
{
{_this removeWeaponGlobal _x;} forEach (weapons _this);
{_this unlinkItem _x;} forEach (assignedItems _this);
@ -52,12 +50,12 @@ moveOut _unit;
_unit removeAllEventHandlers "HandleDamage";
// Remove gear according to configs
if (DMS_clear_AI_body && {(random 100) <= DMS_clear_AI_body_chance}) then
if ((_unit getVariable ["DMS_clear_AI_body",DMS_clear_AI_body]) && {(random 100) <= (_unit getVariable ["DMS_clear_AI_body_chance",DMS_clear_AI_body_chance])}) then
{
_unit call _removeAll;
};
if (DMS_ai_remove_launchers && {(_launcherVar != "") || {_launcher != ""}}) then
if ((_unit getVariable ["DMS_ai_remove_launchers",DMS_ai_remove_launchers]) && {(_launcherVar != "") || {_launcher != ""}}) then
{
// Because arma is stupid sometimes
if (_launcher isEqualTo "") then
@ -93,24 +91,24 @@ if (DMS_ai_remove_launchers && {(_launcherVar != "") || {_launcher != ""}}) then
} forEach (magazines _unit);
};
if(DMS_RemoveNVG) then
if (_unit getVariable ["DMS_RemoveNVG",DMS_RemoveNVG]) then
{
_unit unlinkItem "NVGoggles";
};
_grp = group _unit;
_grpUnits = (units _grp) - [_unit];
private _grp = group _unit;
private _grpUnits = (units _grp) - [_unit];
// Give the AI a new leader if the killed unit was the leader
if (!(_grpUnits isEqualTo []) && {(leader _grp) isEqualTo _unit}) then
{
_grp selectLeader (selectRandom _grpUnits);
};
_av = _unit getVariable ["DMS_AssignedVeh",objNull];
private _av = _unit getVariable ["DMS_AssignedVeh",objNull];
if (!isNull _av) then
{
// Determine whether or not the vehicle has any active crew remaining.
_memCount = {[(alive _x),false] select (_unit isEqualTo _x);} count (crew _av);
private _memCount = {[(alive _x),false] select (_unit isEqualTo _x);} count (crew _av);
// Destroy the vehicle and add it to cleanup if there are no active crew members of the vehicle.
@ -154,13 +152,13 @@ if (!isNull _av) then
// Only check for this stuff for ground vehicles that have guns...
if ((_av isKindOf "LandVehicle") && {(count (weapons _av))>0}) then
{
_gunner = gunner _av;
_driver = driver _av;
private _gunner = gunner _av;
private _driver = driver _av;
// The fact that I have to do this in the FUCKING ONKILLED EVENTHANDLER is a testament to why ArmA will make me die prematurely
_gunnerIsAlive = alive _gunner;
_driverIsAlive = alive _driver;
private _gunnerIsAlive = alive _gunner;
private _driverIsAlive = alive _driver;
if (_unit isEqualTo _gunner) then
{
@ -177,18 +175,22 @@ if (!isNull _av) then
{
[_driver,_av,_killer] spawn
{
_driver = _this select 0;
_av = _this select 1;
_killer = _this select 2;
_grp = group _driver;
_owner = groupOwner _grp;
params
[
"_driver",
"_av",
"_killer"
];
private _grp = group _driver;
private _owner = groupOwner _grp;
_grp setVariable ["DMS_LockLocality",true];
// The AI has to be local in order for these commands to work, so I reset locality, just because it's really difficult to deal with otherwise
if (_owner!=2) then
if !(_owner in [2,0]) then
{
diag_log format ["Temporarily setting owner of %1 to server from %2. Success: %3",_grp,_owner,_grp setGroupOwner 2];
diag_log format ["DMS Seat Switcher :: Temporarily setting owner of %1 to server from %2. Success: %3",_grp,_owner,_grp setGroupOwner 2];
};
sleep 5+(random 3); // 5 to 8 seconds delay after gunner death
@ -225,9 +227,9 @@ if (!isNull _av) then
(format["OnKilled :: Switched driver of AI Vehicle (%1) to gunner.",typeOf _av]) call DMS_fnc_DebugLog;
};
if (_owner!=2) then
if !(_owner in [2,0]) then
{
_start = time;
private _start = time;
// Controlling AI... yes. I have to do this
waitUntil
@ -259,7 +261,7 @@ if (!isNull _av) then
sleep 15;
diag_log format ["Resetting ownership of %1 to %2. Success: %3",_grp,_owner,_grp setGroupOwner _owner];
diag_log format ["DMS Seat Switcher :: Resetting ownership of %1 to %2. Success: %3",_grp,_owner,_grp setGroupOwner _owner];
};
_grp setVariable ["DMS_LockLocality",false];
@ -269,11 +271,11 @@ if (!isNull _av) then
};
};
_roadKilled = false;
private _roadKilled = false;
if (isPlayer _killer) then
{
_veh = vehicle _killer;
private _veh = vehicle _killer;
_playerObj = _killer;
@ -291,9 +293,9 @@ if (isPlayer _killer) then
_roadKilled = true;
if (DMS_explode_onRoadkill) then
if (_unit getVariable ["DMS_explode_onRoadkill",DMS_explode_onRoadkill]) then
{
_boom = createVehicle ["SLAMDirectionalMine_Wire_Ammo", [0,0,100], [], 0, "CAN_COLLIDE"];
private _boom = createVehicle ["SLAMDirectionalMine_Wire_Ammo", [0,0,100], [], 0, "CAN_COLLIDE"];
_boom setPosATL (getPosATL _playerObj);
_boom setDamage 1;
if (DMS_DEBUG) then
@ -304,7 +306,7 @@ if (isPlayer _killer) then
// Remove gear from roadkills if configured to do so
if (DMS_remove_roadkill && {(random 100) <= DMS_remove_roadkill_chance}) then
if ((_unit getVariable ["DMS_remove_roadkill",DMS_remove_roadkill]) && {(random 100) <= (_unit getVariable ["DMS_remove_roadkill_chance",DMS_remove_roadkill_chance])}) then
{
_unit call _removeAll;
};
@ -314,15 +316,15 @@ if (isPlayer _killer) then
// Reveal the killer to the AI units
if (DMS_ai_share_info) then
if (_unit getVariable ["DMS_ai_share_info",DMS_ai_share_info]) then
{
_revealAmount = 4.0;
private _revealAmount = 4.0;
_muzzle = currentMuzzle _playerObj;
private _muzzle = currentMuzzle _playerObj;
if (_muzzle isEqualType "") then
{
_silencer = _playerObj weaponAccessories _muzzle select 0;
private _silencer = _playerObj weaponAccessories _muzzle select 0;
if (!isNil "_silencer" && {_silencer != ""}) then
{
_revealAmount = 2.0;
@ -331,7 +333,7 @@ if (isPlayer _killer) then
{
if ((alive _x) && {!(isPlayer _x) && {(_x distance2D _unit) <= DMS_ai_share_info_distance}}) then
if ((alive _x) && {!(isPlayer _x) && {(_x distance2D _unit) <= (_unit getVariable ["DMS_ai_share_info_distance",DMS_ai_share_info_distance])}}) then
{
_x reveal [_killer, _revealAmount max (_x knowsAbout _playerObj)];
};

View File

@ -16,15 +16,13 @@
Returns nothing
*/
private ["_playerUID", "_playerObj", "_moneyChange", "_AISide", "_AIType", "_repChange", "_roadKilled", "_unitMoney", "_unit", "_unitRespect", "_playerMoney", "_playerRespect", "_unitName", "_msgType", "_msgParams"];
if !(params
[
["_playerObj", objNull, [objNull] ],
["_unit", objNull, [objNull] ],
["_AISide", "", [""] ],
["_AIType", "", [""] ],
["_roadKilled", false, [false] ]
"_playerObj",
"_unit",
"_AISide",
"_AIType",
"_roadKilled"
])
exitWith
{
@ -32,18 +30,18 @@ exitWith
};
_playerUID = getPlayerUID _playerObj;
private _playerUID = getPlayerUID _playerObj;
if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_Unit_Player"}}) then
{
_moneyChange = missionNamespace getVariable [format ["DMS_%1_%2_MoneyGain",_AISide,_AIType],0];
_repChange = missionNamespace getVariable [format ["DMS_%1_%2_RepGain",_AISide,_AIType],0];
_rankChange = missionNamespace getVariable [format ["DMS_%1_%2_RankGain",_AISide,_AIType],0];
private _moneyChange = missionNamespace getVariable [format ["DMS_%1_%2_MoneyGain",_AISide,_AIType],0];
private _repChange = missionNamespace getVariable [format ["DMS_%1_%2_RepGain",_AISide,_AIType],0];
private _rankChange = missionNamespace getVariable [format ["DMS_%1_%2_RankGain",_AISide,_AIType],0];
// Check for individually defined AI money/respect/rank.
_unitMoney = _unit getVariable ["DMS_AI_Money",""];
_unitRespect = _unit getVariable ["DMS_AI_Respect",""];
_unitRank = _unit getVariable ["DMS_AI_Rank",""];
private _unitMoney = _unit getVariable ["DMS_AI_Money",""];
private _unitRespect = _unit getVariable ["DMS_AI_Respect",""];
private _unitRank = _unit getVariable ["DMS_AI_Rank",""];
if !(_unitMoney isEqualTo "") then
{
@ -71,10 +69,10 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U
if ((_moneyChange!=0) || {_repChange!=0} || {_rankChange!=0}) then
{
_playerMoney = _playerObj getVariable ["ExileMoney", 0];
_playerRespect = _playerObj getVariable ["ExileScore", 0];
_playerRank = _playerObj getVariable ["ExileHumanity", 0];
_unitName = name _unit;
private _playerMoney = _playerObj getVariable ["ExileMoney", 0];
private _playerRespect = _playerObj getVariable ["ExileScore", 0];
private _playerRank = _playerObj getVariable ["ExileHumanity", 0];
private _unitName = name _unit;
/*
if (DMS_DEBUG) then
@ -85,21 +83,21 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U
if (_moneyChange!=0) then
{
private ["_msgType", "_msgParams", "_distance", "_attributes", "_distanceBonus"];
private _distance = [];
// Set client's money
// I also make sure that they don't get negative poptabs
_playerMoney = (_playerMoney + _moneyChange) max 0;
_playerObj setVariable ["ExileMoney",_playerMoney];
_msgType = "moneyReceivedRequest";
_msgParams = [str _playerMoney, format ["killed %1",_unitName]];
private _msgType = "moneyReceivedRequest";
private _msgParams = [str _playerMoney, format ["killed %1",_unitName]];
if (_moneyChange<0) then
{
// Change message for players when they're actually LOSING poptabs
_msgType = "notificationRequest";
_msgParams = ["Whoops",[format ["Lost %1 poptabs from running over a %2 AI!",abs _moneyChange,_AIType]]];
_msgParams = ["Whoops",[format ["Lost %1 poptabs for killing %2 AI!",abs _moneyChange,_AIType]]]; //changed wording, negative result is not necessarily a roadkill
// With the error message the money value won't be updated on the client, so I just directly PVC the value.
ExileClientPlayerMoney = _playerMoney;
@ -126,7 +124,7 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U
if (_repChange!=0) then
{
_attributes = [[format ["KILLED %1",toUpper(_unitName)],_repChange]];
private _attributes = [[format ["KILLED %1",toUpper(_unitName)],_repChange]];
if (DMS_AIKill_DistanceBonusCoefficient>0) then
{
@ -134,7 +132,7 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U
if (_distance>DMS_AIKill_DistanceBonusMinDistance) then
{
_distanceBonus = floor (_distance * DMS_AIKill_DistanceBonusCoefficient);
private _distanceBonus = floor (_distance * DMS_AIKill_DistanceBonusCoefficient);
_attributes pushBack [format ["%1m RANGE BONUS",_distance], _distanceBonus];
_repChange = _repChange + _distanceBonus;
@ -171,9 +169,7 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U
};
//DONKEYPUNCH CUSTOM KILL RANK CHANGE FOR AI KILL
if (DMS_Enable_RankChange) then
{
if (_rankChange!=0) then
if (DMS_Enable_RankChange && {_rankChange!=0}) then
{
_playerRank = (_playerRank+_rankChange);
_killer setVariable ["ExileHumanity",_playerRank];
@ -182,7 +178,6 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U
(owner _playerObj) publicVariableClient "ExileClientPlayerHumanity";
ExileClientPlayerHumanity = nil;
};
};
if (DMS_DEBUG) then
@ -195,22 +190,25 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U
if (DMS_Show_Party_Kill_Notification) then
{
private ["_group", "_members", "_msg"];
_group = group _playerObj;
_members = units _group;
private _group = group _playerObj;
private _members = units _group;
if (!(_group isEqualTo ExileGraveyardGroup) && {(count _members)>1}) then
{
_msg = format
private _msg = format
[
"%1 killed %2 from %3 meters away and received %4 poptabs, %5 respect and %6 rank.",
"%1 killed %2 from %3 meters away and received %4 poptabs, and %5 respect.",
name _playerObj,
_unitName,
if !(isNil "_distance") then {_distance} else {floor(_unit distance _playerObj)},
if (_distance isEqualTo []) then {floor(_unit distance _playerObj)} else {_distance},
_moneyChange,
_repChange,
_rankChange
_repChange
];
if (DMS_Enable_RankChange) then
{
_msg = _msg + format[" (+%1 rank)", _rankChange];
};
{
_msg remoteExecCall ["systemChat", _x];
} forEach _members;

View File

@ -12,12 +12,10 @@
] call DMS_fnc_RemoveMarkers;
*/
private ["_markerDot", "_markerCircle", "_status", "_text"];
_markerDot = _this select 0 select 0;
_markerCircle = _this select 0 select 1;
_status = _this select 1;
_text = missionNamespace getVariable [format ["%1_text",_markerDot],markerText _markerDot];
private _markerDot = _this select 0 select 0;
private _markerCircle = _this select 0 select 1;
private _status = _this select 1;
private _text = missionNamespace getVariable [format ["%1_text",_markerDot],markerText _markerDot];
if (DMS_DEBUG) then

View File

@ -8,11 +8,8 @@
Apply magazine type filters if needed
*/
private["_result","_ammoArray"];
_result = "";
_ammoArray = getArray (configFile >> "CfgWeapons" >> _this >> "magazines");
private _result = "";
private _ammoArray = getArray (configFile >> "CfgWeapons" >> _this >> "magazines");
if (count _ammoArray > 0) then
{

View File

@ -5,9 +5,8 @@
Selects/Spawns missions. Takes no arguments, returns nothing.
*/
private "_time";
_time = diag_tickTime;
private _time = diag_tickTime;
if (DMS_RunningBMissionCount >= DMS_MaxBanditMissions) then
{
@ -25,8 +24,7 @@ if (diag_fps >= DMS_MinServerFPS && {(count allPlayers) >= DMS_MinPlayerCount})
{
if (DMS_DynamicMission && {_time - DMS_BMissionLastStart > DMS_BMissionDelay}) then
{
private "_mission";
_mission = selectRandom DMS_BanditMissionTypesArray;
private _mission = selectRandom DMS_BanditMissionTypesArray;
if (DMS_DEBUG) then
{
@ -44,9 +42,7 @@ if (diag_fps >= DMS_MinServerFPS && {(count allPlayers) >= DMS_MinPlayerCount})
if (DMS_StaticMission && {_time - DMS_StaticMissionLastStart > DMS_StaticMissionDelay}) then
{
private ["_mission", "_availableMissions"];
_availableMissions = (DMS_StaticMissionTypesArray - DMS_RunningStaticMissions);
private _availableMissions = (DMS_StaticMissionTypesArray - DMS_RunningStaticMissions);
if (_availableMissions isEqualTo []) exitWith
{
@ -57,7 +53,7 @@ if (diag_fps >= DMS_MinServerFPS && {(count allPlayers) >= DMS_MinPlayerCount})
};
};
_mission = selectRandom _availableMissions;
private _mission = selectRandom _availableMissions;
if (DMS_DEBUG) then
{

View File

@ -11,18 +11,15 @@
Returns a new position offset from the provided position with the provided distance and direction. Position provided is at ground level in AGL
This function has been deprecated by the new functionality of the "getPos" command (https://community.bistudio.com/wiki/getPos). This function has been updated for efficiency and compatibility.
This function has been deprecated by the new functionality of the "getPos" command (https://community.bistudio.com/wiki/getPos). This function has been updated for efficiency and retained for compatibility.
*/
private ["_origin","_dis","_dir","_npos"];
if !(params
[
["_origin","",[objNull,[]],[2,3]],
["_dis",0,[0]],
["_dir",0,[0]]
"_origin",
"_dis",
"_dir"
])
exitWith
{

View File

@ -12,19 +12,14 @@
*/
private ["_OK", "_min", "_max", "_return"];
if !(params
[
["_min",0,[0]],
["_max",0,[0]]
"_min",
"_max"
])
exitWith
{
diag_log format ["DMS ERROR :: Calling DMS_fnc_SelectRandomVal with invalid parameters: %1",_this];
};
_return = _min + random(_max - _min);
_return
_min + random(_max - _min)

View File

@ -15,21 +15,16 @@
Returns true if a viable owner was found, false otherwise.
*/
private ["_AI", "_AIType", "_pos", "_exit", "_client", "_swapped"];
_AI = param [0,objNull,[objNull,grpNull]];
private _AI = param [0,objNull,[objNull,grpNull]];
if (isNull _AI) exitWith
{
diag_log format ["DMS ERROR :: Calling DMS_SetAILocality with null parameter; _this: %1",_this];
};
private _AIType = typeName _AI;
_AIType = typeName _AI;
_pos = if (_AIType isEqualTo "OBJECT") then {_AI} else {param [1,"",[objNull,[]],[2,3]]};
private _pos = if (_AIType isEqualTo "OBJECT") then {_AI} else {param [1,"",[objNull,[]],[2,3]]};
if (_pos isEqualTo "") exitWith
{
@ -37,8 +32,7 @@ if (_pos isEqualTo "") exitWith
};
_client = objNull;
private _client = objNull;
{
if ((alive _x) && {(_x distance2D _pos)<=3000}) exitWith
@ -50,7 +44,7 @@ _client = objNull;
if (!isNull _client) then
{
_swapped = if (_AIType isEqualTo "OBJECT") then {_AI setOwner (owner _client)} else {_AI setGroupOwner (owner _client)};
private _swapped = if (_AIType isEqualTo "OBJECT") then {_AI setOwner (owner _client)} else {_AI setGroupOwner (owner _client)};
if (!_swapped) then
{
@ -59,8 +53,7 @@ if (!isNull _client) then
if (DMS_ai_offload_notifyClient) then
{
private "_msg";
_msg = format ["DMS :: AI %1 |%2| has been offloaded to you.",_AIType,_AI];
private _msg = format ["DMS :: AI %1 |%2| has been offloaded to you.",_AIType,_AI];
_msg remoteExecCall ["systemChat", _client];
_msg remoteExecCall ["diag_log", _client];
};

View File

@ -13,21 +13,18 @@
Returns true if the call was completed
*/
private ["_OK", "_exit", "_group", "_behavior", "_pos", "_difficulty", "_radius", "_npos", "_i", "_wp"];
if !(params
[
["_group",grpNull,[grpNull,objNull]],
["_pos",[0,0,0],[[]],[2,3]],
["_difficulty","moderate",[""]]
"_group",
"_pos",
"_difficulty"
])
then
{
diag_log format ["DMS ERROR :: Calling DMS_fnc_SetGroupBehavior with invalid params: %1",_this];
};
_exit = false;
private _exit = false;
try
{
@ -52,7 +49,7 @@ catch
if (_exit) exitWith {false};
_behavior = if ((count _this)>3) then {_this select 3;} else {"COMBAT"};
private _behavior = if ((count _this)>3) then {_this select 3;} else {"COMBAT"};
_group setCombatMode "RED";
@ -88,7 +85,7 @@ _difficulty =
};
};
_radius = missionNamespace getVariable [format["DMS_AI_WP_Radius_%1",_difficulty],40];
private _radius = missionNamespace getVariable [format["DMS_AI_WP_Radius_%1",_difficulty],40];
// Remove all previous waypoints
@ -100,8 +97,8 @@ for "_i" from count (waypoints _group) to 1 step -1 do
// Add waypoints around the center position.
for "_i" from 0 to 359 step 45 do
{
_npos = _pos getPos [_radius,_i];
_wp = _group addWaypoint [_npos,5];
private _npos = _pos getPos [_radius,_i];
private _wp = _group addWaypoint [_npos,5];
_wp setWaypointType "MOVE";
};
@ -109,5 +106,4 @@ _wp = _group addWaypoint [_pos,0];
_wp setWaypointType "CYCLE";
true

View File

@ -24,23 +24,23 @@
if !(params
[
["_units",[],[[]]],
["_finalGroup",grpNull,[grpNull]],
["_pos",[0,0,0],[[]],[2,3]],
["_difficulty","moderate",[""]]
"_units",
"_finalGroup",
"_pos",
"_difficulty"
])
then
{
diag_log format ["DMS ERROR :: Calling DMS_fnc_SetGroupBehavior_Separate with invalid params: %1",_this];
};
_behavior = if ((count _this)>3) then {_this select 3;} else {"COMBAT"};
private _behavior = if ((count _this)>3) then {_this select 3;} else {"COMBAT"};
_tmpGroup = createGroup (side _finalGroup);
private _tmpGroup = createGroup (side _finalGroup);
_units joinSilent _tmpGroup;
_return =
private _return =
[
_tmpGroup,
_pos,

View File

@ -0,0 +1,42 @@
/*
DMS_fnc_SetRelPositions
Created by eraser1
Usage:
[
[
_object1,
_object2,
...
_objectN
],
_newCenterPos
] call DMS_fnc_SetRelPositions;
This function will move a list of objects to a new location by calculating their center position, then their relative position from the center, and then place them in their corresponding relative positions in the new location.
*/
if !(params
[
"_objects",
"_newCPos"
])
exitWith
{
diag_log format ["DMS ERROR :: Calling DMS_fnc_setRelPositions with invalid parameters: %1",_this];
};
private _center = [_objects] call DMS_fnc_GetCenter;
{
private _relpos = (getPosATL _x) vectorDiff _center;
private _objPos = [_newCPos,_relpos] call DMS_fnc_CalcPos;
_x setPosATL _objPos;
if (DMS_DEBUG) then
{
format ["Setting %1 at %2; %3 is the relpos from original center %4, reapplied to new center %5",typeOf _x,_objPos,_relpos,_center,_newCPos] call DMS_fnc_DebugLog;
};
} foreach _objects;

View File

@ -15,16 +15,14 @@
Returns AI Group
*/
private ["_OK", "_pos", "_count", "_difficulty", "_class", "_group", "_side", "_customGearSet", "_launcherType", "_launcher", "_unit", "_rocket"];
if !(params
[
["_pos","_pos ERROR",[[]],[3]],
["_count","_count ERROR",[0]],
["_difficulty","_difficulty ERROR",[""]],
["_class","_class ERROR",[""]],
["_side","_side ERROR",[""]]
"_pos",
"_count",
"_difficulty",
"_class",
"_side"
])
exitWith
{
@ -44,6 +42,9 @@ if (DMS_DEBUG) then
(format["SpawnAIGroup :: Spawning %1 %2 %3 AI at %4 with %5 difficulty.",_count,_class,_side,_pos,_difficulty]) call DMS_fnc_DebugLog;
};
private _launcherType = "";
// if soldier have AT/AA weapons
if (_class isEqualType []) then
{
@ -52,7 +53,7 @@ if (_class isEqualType []) then
};
_customGearSet = [];
private _customGearSet = [];
if (_class == "custom") then
{
@ -80,26 +81,27 @@ for "_i" from 1 to _count do
};
// An AI will definitely spawn with a launcher if you define type
if ((!isNil "_launcherType") || {DMS_ai_use_launchers && {DMS_ai_launchers_per_group>0}}) then
if ((DMS_ai_use_launchers && {DMS_ai_launchers_per_group>0}) || {!(_launcherType isEqualTo "")}) then
{
if (isNil "_launcherType") then
if (_launcherType isEqualTo "") then
{
_launcherType = "AT";
};
_units = units _group;
private _units = units _group;
private _launchers = missionNamespace getVariable [format ["DMS_AI_wep_launchers_%1",_launcherType],["launch_NLAW_F"]];
for "_i" from 0 to (((DMS_ai_launchers_per_group min _count)-1) max 0) do
{
if ((random 100)<DMS_ai_use_launchers_chance) then
{
_unit = _units select _i;
private _unit = _units select _i;
_launcher = (selectRandom (missionNamespace getVariable [format ["DMS_AI_wep_launchers_%1",_launcherType],["launch_NLAW_F"]]));
private _launcher = selectRandom _launchers;
removeBackpackGlobal _unit;
_unit addBackpack "B_Carryall_mcamo";
_rocket = _launcher call DMS_fnc_selectMagazine;
private _rocket = _launcher call DMS_fnc_selectMagazine;
[_unit, _launcher, DMS_AI_launcher_ammo_count,_rocket] call BIS_fnc_addWeapon;
@ -121,6 +123,11 @@ _group setFormation "WEDGE";
[_group,_pos,_difficulty,"COMBAT"] call DMS_fnc_SetGroupBehavior;
if (DMS_ai_freezeOnSpawn) then
{
[_group,true] call DMS_fnc_FreezeToggle;
};
diag_log format ["DMS_SpawnAIGroup :: Spawned %1 AI at %2.",_count,_pos];

View File

@ -23,16 +23,13 @@
Returns AI Group
*/
private ["_OK", "_positions", "_count", "_difficulty", "_class", "_side", "_positionsCount", "_launcherType", "_group", "_unit", "_units", "_i", "_launcher", "_rocket"];
if !(params
[
["_positions","_positions ERROR",[[]]],
["_count","_count ERROR",[0]],
["_difficulty","_difficulty ERROR",[""]],
["_class","_class ERROR",[""]],
["_side","_side ERROR",[""]]
"_positions",
"_count",
"_difficulty",
"_class",
"_side"
])
exitWith
{
@ -40,7 +37,7 @@ exitWith
grpNull
};
_positionsCount = count _positions;
private _positionsCount = count _positions;
if (_positionsCount<1) exitWith
{
@ -60,6 +57,9 @@ if (DMS_DEBUG) then
(format["SpawnAIGroup_MultiPos :: Spawning %1 %2 %3 AI at positions %4 with %5 difficulty.",_count,_class,_side,_positions,_difficulty]) call DMS_fnc_DebugLog;
};
private _launcherType = "";
// if soldier have AT/AA weapons
if (_class isEqualType []) then
{
@ -85,7 +85,7 @@ if (_class == "custom") then
_group = createGroup (missionNamespace getVariable [format ["DMS_%1Side",_side],EAST]);
private _group = createGroup (missionNamespace getVariable [format ["DMS_%1Side",_side],EAST]);
_group setVariable ["DMS_LockLocality",nil];
_group setVariable ["DMS_SpawnedGroup",true];
@ -93,30 +93,31 @@ _group setVariable ["DMS_Group_Side", _side];
for "_i" from 1 to _count do
{
_unit = [_group,_positions select (_i % _positionsCount),_class,_difficulty,_side,"Soldier",_customGearSet] call DMS_fnc_SpawnAISoldier;
private _unit = [_group,_positions select (_i % _positionsCount),_class,_difficulty,_side,"Soldier",_customGearSet] call DMS_fnc_SpawnAISoldier;
};
// An AI will definitely spawn with a launcher if you define type
if ((!isNil "_launcherType") || {DMS_ai_use_launchers && {DMS_ai_launchers_per_group>0}}) then
if ((DMS_ai_use_launchers && {DMS_ai_launchers_per_group>0}) || {!(_launcherType isEqualTo "")}) then
{
if (isNil "_launcherType") then
if (_launcherType isEqualTo "") then
{
_launcherType = "AT";
};
_units = units _group;
private _units = units _group;
private _launchers = missionNamespace getVariable [format ["DMS_AI_wep_launchers_%1",_launcherType],["launch_NLAW_F"]];
for "_i" from 0 to (((DMS_ai_launchers_per_group min _count)-1) max 0) do
{
if ((random 100)<DMS_ai_use_launchers_chance) then
{
_unit = _units select _i;
private _unit = _units select _i;
_launcher = (selectRandom (missionNamespace getVariable [format ["DMS_AI_wep_launchers_%1",_launcherType],["launch_NLAW_F"]]));
private _launcher = selectRandom _launchers;
removeBackpackGlobal _unit;
_unit addBackpack "B_Carryall_mcamo";
_rocket = _launcher call DMS_fnc_selectMagazine;
private _rocket = _launcher call DMS_fnc_selectMagazine;
[_unit, _launcher, DMS_AI_launcher_ammo_count,_rocket] call BIS_fnc_addWeapon;
@ -138,6 +139,11 @@ _group setFormation "WEDGE";
[_group,_positions select 0,_difficulty,"COMBAT"] call DMS_fnc_SetGroupBehavior;
if (DMS_ai_freezeOnSpawn) then
{
[_group,true] call DMS_fnc_FreezeToggle;
};
diag_log format ["DMS_SpawnAIGroup_MultiPos :: Spawned %1 AI using positions parameter: %2.",_count,_positions];

View File

@ -32,20 +32,17 @@
Returns AI Unit
*/
private ["_OK", "_useCustomGear", "_unarmed", "_class", "_type", "_unit", "_side", "_nighttime", "_weapon", "_muzzle", "_suppressor", "_pistols", "_pistol", "_customGearSet", "_helmet", "_uniform", "_vest", "_backpack", "_launcher", "_magazines", "_weaponAttachments", "_pistolAttachments", "_assignedItems", "_difficulty", "_skillArray"];
_useCustomGear = false;
_unarmed = false;
private _customGearSet = [];
private _unarmed = false;
if !(params
[
["_group",grpNull,[grpNull]],
["_pos",[0,0,0],[[]],[3]],
["_class","random",[""]],
["_difficulty","random",[""]],
["_side","bandit",[""]],
["_type","soldier",[""]]
"_group",
"_pos",
"_class",
"_difficulty",
"_side",
"_type"
])
then
{
@ -56,7 +53,6 @@ else
if ((_class == "custom") && {(count _this)>6}) then
{
_customGearSet = _this select 6;
_useCustomGear = true;
};
};
@ -91,9 +87,8 @@ _difficulty =
//Create unit
_unit = _group createUnit [DMS_AI_Classname, _pos, [], 0,"FORM"];
private _unit = _group createUnit [DMS_AI_Classname, _pos, [], 0,"FORM"];
_unit allowFleeing 0;
[_unit] joinSilent _group;
// Remove existing gear
{_unit removeWeaponGlobal _x;} forEach (weapons _unit);
@ -132,10 +127,13 @@ else
};
};
// Unit name
_unit setName format["[DMS %1 %2 Unit %3]",toUpper _side,_class,floor(random 1000)];
// Set random DMS unit names if you don't want Arma assigned (real names)
if !(DMS_AI_UseRealNames) then
{
_unit setName format["[DMS %1 %2 %3]",toUpper _side,_class,floor(random 1000)];
};
if (!_useCustomGear) then
if (_customGearSet isEqualTo []) then
{
if !(_class in DMS_ai_SupportedClasses) exitWith
{
@ -157,18 +155,30 @@ if (!_useCustomGear) then
} forEach (missionNamespace getVariable [format ["DMS_%1_equipment",_class],[]]);
// Items (Loot stuff that goes in uniform/vest/backpack)
{_unit addItem _x;} forEach (missionNamespace getVariable [format ["DMS_%1_items",_class],[]]);
// Clothes
_unit addHeadgear (selectRandom (missionNamespace getVariable [format ["DMS_%1_helmets",_class],DMS_assault_helmets]));
_unit forceAddUniform (selectRandom (missionNamespace getVariable [format ["DMS_%1_clothes",_class],DMS_assault_clothes]));
_unit addVest (selectRandom (missionNamespace getVariable [format ["DMS_%1_vests",_class],DMS_assault_vests]));
_unit addBackpackGlobal (selectRandom (missionNamespace getVariable [format ["DMS_%1_backpacks",_class],DMS_assault_backpacks]));
// Random items that can be added to the unit's inventory, such as food, meds, etc.
private _randItemCount = missionNamespace getVariable [format ["DMS_%1_RandItemCount",_class],0];
if (_randItemCount>0) then
{
private _randItems = missionNamespace getVariable [format ["DMS_%1_RandItems",_class],["Exile_Item_PlasticBottleFreshWater"]];
for "_i" from 1 to _randItemCount do
{
_unit addItem (selectRandom _randItems);
};
};
// Items (Loot stuff that goes in uniform/vest/backpack)
{_unit addItem _x;} forEach (missionNamespace getVariable [format ["DMS_%1_items",_class],[]]);
// Make AI effective at night
_nighttime = (sunOrMoon != 1);
private _nighttime = (sunOrMoon != 1);
if (_nighttime) then
{
_unit linkItem "NVGoggles";
@ -176,8 +186,8 @@ if (!_useCustomGear) then
if (!_unarmed) then
{
_weapon = selectRandom (missionNamespace getVariable [format ["DMS_%1_weps",_class],DMS_assault_weps]);
[_unit, _weapon, 6 + floor(random 3)] call BIS_fnc_addWeapon;
private _weapon = selectRandom (missionNamespace getVariable [format ["DMS_%1_weps",_class],DMS_assault_weps]);
[_unit, _weapon, 6 + floor(random 3)] call DMS_fnc_AddWeapon;
_unit selectWeapon _weapon;
@ -198,13 +208,14 @@ if (!_useCustomGear) then
if((random 100) <= (missionNamespace getVariable [format["DMS_%1_suppressor_chance",_class],0])) then
{
_suppressor = _weapon call DMS_fnc_FindSuppressor;
if(_suppressor != "") then
private _suppressor = _weapon call DMS_fnc_FindSuppressor;
if (_suppressor != "") then
{
_unit addPrimaryWeaponItem _suppressor;
};
};
/*
// In case spawn position is water
if (DMS_ai_enable_water_equipment && {surfaceIsWater _pos}) then
{
@ -213,14 +224,15 @@ if (!_useCustomGear) then
_unit forceAddUniform "U_O_Wetsuit";
_unit addVest "V_RebreatherIA";
_unit addGoggles "G_Diving";
[_unit, "arifle_SDAR_F", 4 + floor(random 3), "20Rnd_556x45_UW_mag"] call BIS_fnc_addWeapon;
[_unit, "arifle_SDAR_F", 4 + floor(random 3), "20Rnd_556x45_UW_mag"] call DMS_fnc_AddWeapon;
};
*/
_pistols = missionNamespace getVariable [format ["DMS_%1_pistols",_class],[]];
private _pistols = missionNamespace getVariable [format ["DMS_%1_pistols",_class],[]];
if !(_pistols isEqualTo []) then
{
_pistol = selectRandom _pistols;
[_unit, _pistol, 2 + floor(random 2)] call BIS_fnc_addWeapon;
private _pistol = selectRandom _pistols;
[_unit, _pistol, 2 + floor(random 2)] call DMS_fnc_AddWeapon;
};
// Infinite Ammo
@ -277,36 +289,14 @@ else
if !(_launcher isEqualTo "") then
{
[_unit, _launcher, 0] call BIS_fnc_addWeapon;
_unit addWeapon _launcher;
};
// Add Magazines before weapon so that gun will be loaded
{
if (_x isEqualType "") then
{
_x = [_x,1];
};
_unit addMagazines _x;
} forEach _magazines;
// Add items
{
if (_x in ["Binocular","Rangefinder","Laserdesignator","Laserdesignator_02","Laserdesignator_03"]) then
{
_unit addWeapon _x;
}
else
{
_unit linkItem _x;
};
} forEach _assignedItems;
// Add pistol and attachments
if !(_pistol isEqualTo "") then
{
[_unit, _pistol, 0] call BIS_fnc_addWeapon;
_unit addWeapon _pistol;
{
_unit addHandgunItem _x;
@ -317,7 +307,7 @@ else
// Add gun and attachments
if !(_weapon isEqualTo "") then
{
[_unit, _weapon, 0] call BIS_fnc_addWeapon;
_unit addWeapon _weapon;
{
_unit addPrimaryWeaponItem _x;
@ -325,6 +315,42 @@ else
_unit selectWeapon _weapon;
};
// Add magazines and items about half a second after spawning so that backpack inventory can be used reliably. Thanks to second_coming for reporting this issue.
[
0.5,
{
params
[
"_unit",
"_magazines",
"_assignedItems"
];
{
if (_x isEqualType "") then
{
_x = [_x,1];
};
_unit addMagazines _x;
} forEach _magazines;
{
if (_x in ["Binocular","Rangefinder","Laserdesignator","Laserdesignator_02","Laserdesignator_03"]) then
{
_unit addWeapon _x;
}
else
{
_unit linkItem _x;
};
} forEach _assignedItems;
},
[_unit,_magazines,_assignedItems],
false,
false
] call ExileServer_system_thread_addTask;
};
{
@ -395,5 +421,7 @@ if (DMS_DEBUG) then
};
[_unit] joinSilent _group;
_unit

View File

@ -21,60 +21,62 @@
Returns an array of static gun objects.
*/
private ["_OK", "_guns", "_pos", "_MGClassInput", "_MGClass", "_gun", "_unit", "_group", "_class", "_difficulty", "_side", "_positions"];
if !(params
[
["_positions",[],[[]]],
["_group",grpNull,[grpNull]],
["_class","random",[""]],
["_difficulty","static",[""]],
["_side","bandit",[""]]
"_positions",
"_group",
"_class",
"_difficulty",
"_side"
])
exitWith
{
diag_log format ["DMS ERROR :: Calling DMS_fnc_SpawnAIStaticMG with invalid parameters: %1",_this];
};
_MGClassInput = "random";
if ((count _this)>5) then
private _MGClassInput =
if ((count _this)>5) then
{
_this select 5
}
else
{
"random"
};
private _guns = _positions apply
{
_MGClassInput = param [5,"random",[""]];
};
_guns = [];
{
_pos = _x;
_MGClass = _MGClassInput;
private _MGClass = _MGClassInput;
if (_MGClass == "random") then
{
_MGClass = selectRandom DMS_static_weapons;
};
_gun = createVehicle [_MGClass, [0,0,0], [], 0, "CAN_COLLIDE"];
private _gun = createVehicle [_MGClass, [0,0,0], [], 0, "CAN_COLLIDE"];
_gun setDir (random 360);
_gun setPosATL _pos;
_gun setPosATL _x;
_gun lock 2;
_group addVehicle _gun;
_guns pushBack _gun;
_unit = [_group,_pos,_class,_difficulty,_side,"Static"] call DMS_fnc_SpawnAISoldier;
private _unit = [_group,_x,_class,_difficulty,_side,"Static"] call DMS_fnc_SpawnAISoldier;
_unit moveInGunner _gun;
reload _unit;
_unit setVariable ["DMS_AssignedVeh",_gun];
if (_group getVariable ["DMS_isGroupFrozen",false]) then
{
_unit enableSimulationGlobal false;
};
if (DMS_DEBUG) then
{
(format ["SpawnAIStaticMG :: Created unit %1 at %2 as static gunner in %3",_unit,_pos,_gun]) call DMS_fnc_DebugLog;
(format ["SpawnAIStaticMG :: Created unit %1 at %2 as static gunner in %3",_unit,_x,_gun]) call DMS_fnc_DebugLog;
};
} forEach _positions;
_gun
};
if (DMS_DEBUG) then

View File

@ -18,16 +18,13 @@
Returns the spawned vehicle.
*/
private ["_OK", "_positions", "_veh", "_spawnPos", "_vehClass", "_driver", "_gunner", "_group", "_class", "_difficulty", "_side", "_crewCount"];
if !(params
[
["_positions",[],[[]],[1,2]],
["_group",grpNull,[grpNull]],
["_class","random",[""]],
["_difficulty","static",[""]],
["_side","bandit",[""]]
"_positions",
"_group",
"_class",
"_difficulty",
"_side"
])
exitWith
{
@ -35,17 +32,9 @@ exitWith
};
// Using another params-exitwith structure just for _spawnPos because it's pretty important...
if !(_positions params
[
["_spawnPos",[],[[]],[2,3]]
])
exitWith
{
diag_log format ["DMS ERROR :: Calling DMS_fnc_SpawnAIVehicle with invalid _positions parameters: %1",_positions];
};
_spawnPos = _positions select 0;
_vehClass =
private _vehClass =
if ((count _this)>5) then
{
param [5,"random",[""]]
@ -61,22 +50,33 @@ if (_vehClass == "random") then
};
_veh = createVehicle [_vehClass, _spawnPos, [], 0, "NONE"];
private _veh = createVehicle [_vehClass, _spawnPos, [], 0, "NONE"];
_veh setFuel 1;
_veh engineOn true;
_veh lock 2;
_group addVehicle _veh;
_driver = [_group,_spawnPos,_class,_difficulty,_side,"Vehicle"] call DMS_fnc_SpawnAISoldier;
private _toFreeze = _group getVariable ["DMS_isGroupFrozen",false];
private _driver = [_group,_spawnPos,_class,_difficulty,_side,"Vehicle"] call DMS_fnc_SpawnAISoldier;
_driver moveInDriver _veh;
_driver setVariable ["DMS_AssignedVeh",_veh];
_crewCount =
if (_toFreeze) then
{
_driver enableSimulationGlobal false;
};
private _crewCount =
{
private _unit = [_group,_spawnPos,_class,_difficulty,_side,"Vehicle"] call DMS_fnc_SpawnAISoldier;
_unit moveInTurret [_veh, _x];
_unit setVariable ["DMS_AssignedVeh",_veh];
if (_toFreeze) then
{
_unit enableSimulationGlobal false;
};
true
} count (allTurrets [_veh, true]);
@ -86,4 +86,5 @@ if (DMS_DEBUG) then
(format ["SpawnAIVehicle :: Created a %1 armed vehicle (%2) with %3 crew members at %4 with %5 difficulty to group %6.",_side,_vehClass,_crewCount+1,_spawnPos,_difficulty,_group]) call DMS_fnc_DebugLog;
};
_veh

View File

@ -11,12 +11,7 @@
Simply spawns a mission with the given mission type and passes parameters to it. Returns nothing
*/
private ["_mission", "_parameters"];
_mission =
private _mission =
[
missionNamespace getVariable format
[
@ -31,7 +26,7 @@ if (_mission isEqualTo "no") then
}
else
{
_parameters = if ((count _this)>1) then {_this select 1} else {[]};
private _parameters = if ((count _this)>1) then {_this select 1} else {[]};
DMS_MissionCount = DMS_MissionCount + 1;
DMS_RunningBMissionCount = DMS_RunningBMissionCount + 1;

View File

@ -12,13 +12,10 @@
*/
private ["_crateClassName", "_pos", "_crate"];
if !(params
[
["_crateClassName","_crateClassName ERROR",[""]],
["_pos","_pos ERROR",[[]],[3]]
"_crateClassName",
"_pos"
])
exitWith
{
@ -32,9 +29,9 @@ if !(isClass (configFile >> "CfgVehicles" >> _crateClassName)) exitWith
objNull
};
_spawnATL = if ((count _this)>2) then {_this select 2} else {true};
private _spawnATL = if ((count _this)>2) then {_this select 2} else {true};
_crate = createVehicle [_crateClassName,_pos,[], 0, "CAN_COLLIDE"];
private _crate = createVehicle [_crateClassName,_pos,[], 0, "CAN_COLLIDE"];
_crate setDir (random 360);

View File

@ -21,19 +21,16 @@
Returns the index of the paratrooper info in "DMS_HeliParatrooper_Arr", -1 on error.
*/
private ["_heliClass", "_groupOwner", "_spawnPos", "_heli", "_pilot", "_units", "_crewCount", "_paratrooperCount", "_unit", "_cargoIndex"];
if !(params
[
["_AIGroup", 0, [grpNull]],
["_class", 0, [""]],
["_difficulty", 0, [""]],
["_side", 0, [""]],
["_dropPoint", 0, [[],objNull], [2,3]],
["_ejectFFVGunners", 0, [false]],
["_maxJumpers",0,[0]],
["_remainAsGunship", 0, [false]]
"_AIGroup",
"_class",
"_difficulty",
"_side",
"_dropPoint",
"_ejectFFVGunners",
"_maxJumpers",
"_remainAsGunship"
])
exitWith
{
@ -47,7 +44,7 @@ if (isNull _AIGroup) exitWith
-1
};
_heliClass = if ((count _this)>8) then {_this param [8, "", [""]]} else {selectRandom DMS_ReinforcementHelis};
private _heliClass = if ((count _this)>8) then {_this param [8, "", [""]]} else {selectRandom DMS_ReinforcementHelis};
// Make the AI group local to add passengers.
if !(local _AIGroup) then
@ -57,7 +54,7 @@ if !(local _AIGroup) then
};
// Get the spawn position for the heli
_spawnPos =
private _spawnPos =
if ((count _this)>9) then
{
_this param [9, [0,0,0], [[]], [2,3]]
@ -86,7 +83,7 @@ _spawnPos set [2,DMS_RHeli_Height];
// Spawn the heli
_heli = createVehicle [_heliClass, _spawnPos, [], 0, "FLY"];
private _heli = createVehicle [_heliClass, _spawnPos, [], 0, "FLY"];
_heli setFuel 1;
_heli engineOn true;
_heli lock 2;
@ -95,9 +92,8 @@ _AIGroup addVehicle _heli;
// Spawn the AI paratroopers
_units = [];
_paratrooperCount = 0;
_crewCount =
private _paratrooperCount = 0;
private _units = (fullCrew [_heli, "", true]) apply
{
_x params
[
@ -115,7 +111,7 @@ _crewCount =
_unit = [_AIGroup,_spawnPos,_class,_difficulty,_side,"Vehicle"] call DMS_fnc_SpawnAISoldier;
_unit moveInDriver _heli;
_unit setVariable ["DMS_AssignedVeh",_heli];
_pilot = _unit;
_unit setDestination [_dropPoint, "VEHICLE PLANNED", true];
};
case "commander";
@ -150,14 +146,12 @@ _crewCount =
};
};
};
_units pushBack _unit;
true
} count (fullCrew [_heli, "", true]);
_unit
};
// Set the heli pilot's behavior.
_pilot setDestination [_dropPoint, "VEHICLE PLANNED", true];
_heli flyInHeight DMS_RHeli_Height;
@ -171,7 +165,7 @@ if !(isNil "_groupOwner") then
if (DMS_DEBUG) then
{
(format ["SpawnHeliReinforcement :: Created a %1 heli (%2) with %3 crew members at %4 with %5 difficulty to group %6, going to %7. Units: %8",_side,_heliClass,_crewCount+1,_spawnPos,_difficulty,_AIGroup,_dropPoint,_units]) call DMS_fnc_DebugLog;
(format ["SpawnHeliReinforcement :: Created a %1 heli (%2) with %3 crew members at %4 with %5 difficulty to group %6, going to %7. Units: %8",_side,_heliClass,count _units,_spawnPos,_difficulty,_AIGroup,_dropPoint,_units]) call DMS_fnc_DebugLog;
};
// Add the necessary information to the monitor.

View File

@ -12,18 +12,15 @@
] call DMS_fnc_SpawnMinefield;
*/
private ["_centerPos", "_difficulty", "_side", "_mines", "_minesInfo", "_AISide", "_mineCount", "_radius", "_randDirOffset", "_sign"];
_mines = [];
private _mines = [];
if (DMS_SpawnMinesAroundMissions) then
{
if !(params
[
["_centerPos","",[[]],[2,3]],
["_difficulty","",["",[]],[2]],
["_side","",[""]]
"_centerPos",
"_difficulty",
"_side"
])
exitWith
{
@ -49,25 +46,27 @@ if (DMS_SpawnMinesAroundMissions) then
};
_minesInfo = _difficulty;
private _minesInfo =
if (_difficulty isEqualType "") then
{
_minesInfo = missionNamespace getVariable [format ["DMS_MineInfo_%1", _difficulty], [10,50]];
missionNamespace getVariable [format ["DMS_MineInfo_%1", _difficulty], [10,50]];
}
else
{
_difficulty
};
_AISide = missionNamespace getVariable [format ["DMS_%1Side", _side], EAST];
private _AISide = missionNamespace getVariable [format ["DMS_%1Side", _side], EAST];
_mineCount = _minesInfo select 0;
_radius = _minesInfo select 1;
private _mineCount = _minesInfo select 0;
private _radius = _minesInfo select 1;
for "_i" from 1 to _mineCount do
{
private ["_minePos", "_mine"];
_minePos = _centerPos getPos [random _radius,random 360];
_mine = createMine ["ATMine", [0,0,0], [], 0];
private _minePos = _centerPos getPos [random _radius,random 360];
private _mine = createMine ["ATMine", [0,0,0], [], 0];
// Fixes players shooting the mine and causing premature 'splosions
if (DMS_BulletProofMines) then
@ -87,10 +86,10 @@ if (DMS_SpawnMinesAroundMissions) then
if (_spawnWarningSign) then
{
_randDirOffset = random 45;
private _randDirOffset = random 45;
for "_i" from 0 to 359 step 90 do
{
_sign = createVehicle ["Land_Sign_Mines_F", [0,0,0], [], 0, "CAN_COLLIDE"];
private _sign = createVehicle ["Land_Sign_Mines_F", [0,0,0], [], 0, "CAN_COLLIDE"];
_sign setDir (180+_i);
_sign setPosATL (_centerPos getPos [_radius+2, _randDirOffset+_i]);
_sign setVectorUp [0,0,1];

View File

@ -26,13 +26,10 @@
*/
private ["_vehicleClass","_position","_vehpos","_maxDistance","_vehObj"];
if !(params
[
["_vehicleClass","",[""]],
["_position","",[[]],[2,3]]
"_vehicleClass",
"_position"
])
exitWith
{
@ -46,8 +43,8 @@ if !(isClass (configFile >> "CfgVehicles" >> _vehicleClass)) exitWith
objNull
};
_vehpos = [];
_maxDistance = 5;
private _vehpos = [];
private _maxDistance = 5;
while{count _vehpos < 1} do
{
@ -57,7 +54,7 @@ while{count _vehpos < 1} do
_vehpos set [2, 0.1];
_vehObj = createVehicle [_vehicleClass, _vehpos, [], 0, "CAN_COLLIDE"];
private _vehObj = createVehicle [_vehicleClass, _vehpos, [], 0, "CAN_COLLIDE"];
clearBackpackCargoGlobal _vehObj;
clearItemCargoGlobal _vehObj;

View File

@ -13,19 +13,15 @@
Returns the created vehicle object.
*/
private ["_vehicleClass", "_pos", "_pinCode", "_vehObj"];
_vehObj = objNull;
private _vehObj = objNull;
try
{
if !(params
[
["_vehicleClass","",[""]],
["_pos",[],[[]],[2,3]],
["_pinCode","",[0,""]]
"_vehicleClass",
"_pos",
"_pinCode"
])
then
{
@ -80,7 +76,7 @@ try
throw (format ["invalid STRING _pinCode value (must be 4 digits): %1",_pinCode]);
};
_spawnATL = if ((count _this)>3) then {_this select 3} else {true};
private _spawnATL = if ((count _this)>3) then {_this select 3} else {true};
// Create and set the vehicle
_vehObj = [_vehicleClass,_pos] call DMS_fnc_SpawnNonPersistentVehicle;
@ -114,5 +110,4 @@ catch
};
_vehObj

View File

@ -13,13 +13,9 @@
If the mission returns the string "delay", then DMS will attempt to spawn the mission again in 60 seconds.
*/
private _missionType = param [0, selectRandom DMS_StaticMissionTypesArray, [""]];
private ["_missionType", "_mission", "_parameters", "_return"];
_missionType = param [0, selectRandom DMS_StaticMissionTypesArray, [""]];
_mission =
private _mission =
[
missionNamespace getVariable format
[
@ -41,17 +37,18 @@ try
};
_parameters = if ((count _this)>1) then {_this select 1} else {[]};
private _parameters = if ((count _this)>1) then {_this select 1} else {[]};
DMS_MissionCount = DMS_MissionCount + 1;
_return = _parameters call _mission;
private _return = _parameters call _mission;
if ((!isNil "_return") && {_return isEqualTo "delay"}) exitWith
{
DMS_MissionCount = DMS_MissionCount - 1;
// This will cause mission spawning to run in scheduled, but that should be a fairly minor issue.
[60, DMS_fnc_SpawnStaticMission, [_missionType], false] call ExileServer_system_thread_addTask;
if (DMS_DEBUG) then
{
(format ["SpawnStaticMission :: Mission ""%1"" requested delay",_missionType]) call DMS_fnc_DebugLog;
@ -62,7 +59,6 @@ try
DMS_StaticMissionLastStart = diag_tickTime;
DMS_RunningStaticMissions pushBack _missionType;
if (DMS_DEBUG) then
{
(format ["SpawnStaticMission :: Spawned mission %1 with parameters (%2) | DMS_StaticMissionDelay set to %3 seconds", _missionType, _parameters, DMS_StaticMissionDelay]) call DMS_fnc_DebugLog;

View File

@ -0,0 +1,54 @@
/*
DMS_fnc_SubArr
Originally created by Maca134 for the M3Editor
Adapted by eraser1
Usage:
[
[
_num1,
_num2,
_num3
],
[
_num4,
_num5,
_num6
]
] call DMS_fnc_SubArr;
Subtracts the values of two arrays from each other and returns a new array with those values.
*/
if !(params
[
"_a1",
"_a2"
])
exitWith
{
diag_log format["DMS ERROR :: Calling DMS_fnc_SubArr with invalid parameters: %1",_this];
};
private _a1_len = count _a1;
private _a2_len = count _a2;
if (_a1_len == 0 || {_a2_len == 0}) exitWith
{
diag_log format["DMS ERROR :: Calling DMS_fnc_SubArr with an empty array! _this: %1", _this];
[]
};
if (_a1_len != _a2_len2) exitWith
{
diag_log format["DMS ERROR :: Calling DMS_fnc_SubArr with arrays that have unequal lengths! _this: %1", _this];
[]
};
private _a3 = [];
{
_a3 pushBack (_x - (_a2 select _forEachIndex));
} forEach _a1;
_a3

View File

@ -17,18 +17,14 @@ if (_this isEqualTo []) exitWith
diag_log "DMS ERROR :: Calling DMS_TargetsKilled with empty array!";
};
private "_killed";
_killed = false;
private _killed = false;
try
{
{
private ["_lastDistanceCheckTime", "_spawnPos"];
_lastDistanceCheckTime = _x getVariable ["DMS_LastAIDistanceCheck",time];
_pos = getPosWorld _x;
_spawnPos = _x getVariable ["DMS_AISpawnPos",0];
private _lastDistanceCheckTime = _x getVariable ["DMS_LastAIDistanceCheck",time];
private _pos = getPosWorld _x;
private _spawnPos = _x getVariable ["DMS_AISpawnPos",0];
if ((DMS_MaxAIDistance>0) && {!(_spawnPos isEqualTo 0)} && {((time - _lastDistanceCheckTime)>DMS_AIDistanceCheckFrequency) && {(_pos distance2D _spawnPos)>DMS_MaxAIDistance}}) then
{

257
README.md
View File

@ -75,8 +75,8 @@ after "7 createVehicle"
## infiSTAR:
* If you are using infiSTAR and want to keep ```_CGM = true;```, then set ```_UMW = true;```.
* Add ```'O_HMG_01_high_F'``` to "_VehicleWhiteList", as well as any other vehicles you add to DMS that are not whitelisted.
* If you are using infiSTAR and want to keep ```CGM = true;```, then set ```UMW = true;```.
* Add ```'O_HMG_01_high_F'``` to ```_VehicleWhiteList```, as well as any other vehicles you add to DMS that are not whitelisted.
### Vilayer or other Game Server Providers Instructions:
@ -94,9 +94,9 @@ If you are using Vilayer or some other GameServer hosting service, and/or the ab
**DMS does not currently support headless client. Do not attempt to use HC with DMS unless you know what you are doing.**
## Troubleshooting:
DMS won't spawn missions? Check RPT for config errors or make sure PBO is packed correctly by unpacking it and ensuring the folder structure is "\x\addons\a3_DMS\...".
If you're having any issues with DMS, check your RPT for errors and make sure PBO is packed correctly by unpacking it and ensuring the folder structure is "\x\addons\a3_DMS\...".
If you can't figure it out, leave a post on [the DMS thread on exile forums](http://www.exilemod.com/topic/61-dms-defents-mission-system/?do=findComment&comment=242). **Make sure to include your RPT, config.sqf, as well as any changed files.**
If you can't figure it out, leave a post on [the DMS thread on exile forums](http://www.exilemod.com/topic/61-dms-defents-mission-system/?do=findComment&comment=242). **Make sure to include your RPT, config.sqf, as well as any changed files. Please use [pastebin](http://pastebin.com/), spoilers, or something similar; DO NOT PASTE EVERYTHING DIRECTLY INTO THE POST (without putting it in a spoiler)**
___
@ -104,6 +104,7 @@ ___
### Authors:
- [Defent](https://github.com/Defent) from [NumenaDayZ](http://numenadayz.com/).
- [eraser1](https://github.com/eraser1) from [TrainwreckDayZ](http://www.trainwreckdayz.com/home).
- [secondcoming](https://github.com/secondcoming) from [ExileYorkshire](http://exileyorkshire.co.uk/).
### Thanks:
@ -126,11 +127,6 @@ ___
___
# Roadmap:
#### Continuous Optimization + Improvements.
* ~~Implement the ability to "freeze" and "unfreeze" AI when there are no players nearby to improve performance. This will be under testing with a few selected server owners/community members. If you would like to participate in testing, please send a PM to [eraser1 on Exile Forums](http://www.exilemod.com/profile/96-eraser1/).~~ _This feature is slated for a future date_
#### AI Heli Paratroopers/air support.
#### Convoy Mission:
* Regularly update marker position.
* Implement function(s) for AI pathing.
@ -145,12 +141,110 @@ ___
* Spawning in a trader on mission completion ([Trillseeker82](http://www.exilemod.com/topic/61-dms-defents-mission-system/?do=findComment&comment=43932)). This might be done after the next Exile update due to the trader system overhaul :)
#### Full Headless Client Support.
* AI will still be offloaded to clients (ideally); strictly DMS functions will be handled by the HC.
___
# Changelog:
### Test Branch:
#### June 16, 2016 (1:55 PM CST-America) **Release Candidate 1.5**:
* New function: DMS_fnc_AddWeapon. More efficient version of BIS_fnc_AddWeapon, and removed almost all error-checking.
* DMS will now log the DMS version to the client RPT on login.
* Fixed a couple issues in fn_SpawnAISoldier.sqf.
* Updated Tanoa config, missions should now be (somewhat) less likely to spawn in the center valley of the main island.
#### June 16, 2016 (1:55 PM CST-America) **Release Candidate 1.3**:
* Renamed the "mercbase.sqf" mission title to "Mercenary Outpost" to avoid confusion with the salt flats mission.
* Fixed an issue with fn_SpawnMineField.sqf (thanks to CEN for providing important info)
#### June 12, 2016 (3:15 AM CST-America) **Release Candidate 1.2**:
* Removed the marker color check in "DMS_fnc_CreateMarker". Invalid marker colors are up to server owners to detect.
* Micro-optimized "DMS_fnc_IsPosBlacklisted" for the rectangular blacklist case; also rearranged the statements to be clearer and easier to understand.
#### June 7, 2016 (11:15 PM CST-America) **Release Candidate 1.1**:
* Slight optimization of SpawnAIGroup functions (if you have launchers enabled).
#### June 6, 2016 (10:45 PM CST-America) **Release Candidate 1**:
* New function: DMS_fnc_IsPosBlacklisted (optimized replacement for "BIS_fnc_IsPosBlacklisted")
* Config value "DMS_findSafePosBlacklist" now supports the ability to blacklist within a certain distance of a given position.
* "DMS_CLIENT" functions are now compiled in pre-init (broadcasting is still done in post-init).
* Notifications from "textTilesRequest" and "dynamicTextRequest" should no longer "stack" on each other; if two missions spawn right after another, the second mission notification will be delayed at least until the first one completes.
* More Micro-optimizations on most functions; parameters passed to DMS functions will no longer be checked to see if they are the right type, etc. It was determined that they didn't really provide any benefit, as most errors either don't trigger the "params" error, or the error is simply reiterated elsewhere.
* Removed config value "DMS_MissionMarkerCount"
* "DMS_fnc_FindSuppressor" has been overhauled; it simply checks the configs for the provided weapon classname to return a random muzzle/suppressor classname. Consequently, the function is smaller, faster, and perfectly compatible with any weapon.
* The "freeze manager" will now unfreeze AI if needed regardless of setting "DMS_ai_allowFreezing" to false.
#### May 22, 2016 (3:15 PM CST-America):
* **NEW CONFIG VALUES:**
DMS_ai_freezeOnSpawn
* Added the ability to freeze AI groups immediately upon spawn.
* Units spawned to a group that has been frozen should now also be frozen.
* Fixed an issue where "FindSuppressor" would return a boolean instead of empty string.
* Fixed an issue with undefined variable when "DMS_ai_offloadOnUnfreeze" was set to true.
* Added debug message when a group is frozen.
* Created a new function "DMS_fnc_FreezeToggle" that actually handles freezing/unfreezing.
* DMS will now apply a variable "DMS_isGroupFrozen" to groups that are frozen.
#### May 22, 2016 (12:00 AM CST-America):
* **NEW CONFIG VALUES:**
DMS_ai_allowFreezing
DMS_ai_freeze_Only_DMS_AI
DMS_ai_freezingDistance
DMS_ai_unfreezingDistance
DMS_ai_offloadOnUnfreeze
DMS_ai_freezeCheckingDelay
* Removed a "Land_Wreck_Heli_Attack_01_F" from saltflats (it creates server threads)
* Adjusted logic in "AILocalityManager": the variable "DMS_LockLocality" on a group should now be considered even if "DMS_ai_offload_Only_DMS_AI" is set to false.
* You can now "freeze"/"un-freeze" AI! This has been a long-awaited feature for DMS. Using it should grant major performance benefits when you have lots of AI around the map that are inactive.
#### May 16, 2016 (11:00 AM CST-America):
* Fixed an error in fn_SpawnAIGroup (and MultiPos variant)
#### May 16, 2016 (11:00 AM CST-America):
* Occupation will now print debug logs only if DMS_DEBUG is enabled.
* Fixed an error with fn_FindSafePos.
#### May 15, 2016 (2:00 PM CST-America):
* **NEW CONFIG VALUES:**
DMS_AI_UseRealNames
* More Micro-optimizations.
* Fixed a lot of various errors from the last test branch update.
* Integrated Exile Occupation by second coming :)
#### May 6, 2016 (10:45 PM CST-America):
* **NEW CONFIG VALUES:**
DMS_assault_RandItemCount
DMS_assault_RandItems
DMS_MG_RandItemCount
DMS_MG_RandItems
DMS_sniper_RandItemCount
DMS_sniper_RandItems
* New functions: DMS_fnc_ImportFromM3E_3DEN, DMS_fnc_ImportFromM3E_3DEN_Convert, DMS_fnc_ImportFromM3E_3DEN_Static.
* Functions that were previously defined in preinit with regular code brackets ("GetCenter", "SetRelPositions", and "SubArr") are now defined as DMS functions (instead of M3E functions before) and have their own files.
* "M3E" functions are still defined in DMS pre-init for compatibility with external code.
* You can now allow a set of random inventory items that are given to AI. Amount and item types can be set per-class.
* "DMS_StaticMissionsOnServerStart" will only be used if "DMS_StaticMission" is set to true. In other words, no static missions will be spawned on server start if you don't use static missions.
* DMS will now issue an error if you set "DMS_Use_Map_Config" for map without a config. Hopefully this resolves an issue where the server wouldn't start if you tried to load a map config from a file that didn't exist.
* Adjusted map config for chernarus: Missions should no longer spawn near map borders.
* Micro-optimizations for almost all DMS functions (using the new functionality of "private", which is faster than the previous). Also, some variables that weren't previously defined as private are now fixed.
* Removed legacy HC (headless client) support from "DMS_fnc_AILocalityManager".
* Major optimizations for DMS_fnc_FindSafePos
* Removed the useless ```_waterSpawn``` parameter from "FindSafePos" and "IsValidPosition". DMS is currently only used on land, a dedicated function for finding valid water spawns will come if/when needed.
* All of the "Import" functions now check for invalid exports.
* When using a "custom gear set", magazines and items are added about 0.5 seconds after the AI is spawned in order to account for an issue where the backpack isn't used (because it isn't added fast enough?). (Thanks to [second_coming](http://www.exilemod.com/profile/60-second_coming/) for the report)
* NOTE: I didn't test any of this stuff, and there's LOTS of code changes. Do not be surprised if everything is broke! :p
### Main Branch
#### April 27, 2016 (6:45 PM CST-America):
* **NEW CONFIG VALUES**
@ -180,75 +274,6 @@ ___
* Disable simulation on objects imported from M3Editor. (Thanks to [second_coming](http://www.exilemod.com/profile/60-second_coming/) for the tip).
* Fixed an issue where AI units would be shown in static missions if configured to do so for dynamic missions (at least at first).
### Test Branch (Now Integrated Live):
#### List Of new Config values:
DMS_SpawnMissions_Scheduled
DMS_AI_WP_Radius_heli
DMS_AI_WP_Radius_heli
DMS_RHeli_Height
DMS_RHeli_MinDistFromDrop
DMS_RHeli_MaxDistFromDrop
DMS_RHeli_MinDistFromPlayers
DMS_RareLootAmount
DMS_ReinforcementHelis
#### April 20, 2016 (5:45 PM CST-America, RC):
* The new "DMS_fnc_FindSafePos_InRange" function will ignore the config "DMS_UsePredefinedMissionLocations".
* Disable simulation on objects imported from M3Editor. (Thanks to [second_coming](http://www.exilemod.com/profile/60-second_coming/) for the tip)
#### April 15, 2016 (8:45 PM CST-America, RC):
* Fixed an issue where static weapons would always be destroyed, ignoring other configs. Thanks to [second_coming](http://www.exilemod.com/profile/60-second_coming/)!
#### April 15, 2016 (9:30 AM CST-America, RC):
* Fixed script error in OnKilled EH when handling a used AI vehicle.
#### April 14, 2016 (9:20 PM CST-America, RC):
* Fix script error with saltflats.
* "DMS_fnc_AddMissionToMonitor" will no longer convert given AI parameters to a list of objects, so you can now add other units to the mission (within the same group) without much issue.
* Micro-optimizations here and there.
* Fixed an issue with DMS_fnc_GetAllUnits such that it would return an empty list if given a list of AI objects.
* You can now set the maximum limit of paratrooper reinforcements.
* The pilot of the reinforcement heli should now fly away properly if configured to do so.
* Updated group reinforcement manager for compatibility with latest syntax for paratrooper reinforcements (NOTE: UNTESTED).
#### March 31, 2016 (6:00 PM CST-America):
* You can now use "setVariable" to define individually on an AI vehicle its "DMS_DestructionChance". EG: ```_vehicle setVariable ["DMS_DestructionChance",100];``` to always destroy a vehicle when its crew is dead.
* "DMS_DestructionChance" values are defaulted to "DMS_AI_destroyStaticWeapon_chance" or "DMS_AI_destroyVehicleChance" for static or regular vehicles, respectively.
* Optimization + code cleanup for "DMS_fnc_SpawnHeliReinforcement".
#### March 25, 2016 (6:00 PM CST-America):
* **NEW CONFIG VALUES:**
DMS_AI_WP_Radius_heli
DMS_AI_WP_Radius_heli
DMS_RHeli_Height
DMS_RHeli_MinDistFromDrop
DMS_RHeli_MaxDistFromDrop
DMS_RHeli_MinDistFromPlayers
DMS_RareLootAmount
DMS_ReinforcementHelis
* DMS Version is set in the "config.cpp", and grabbed in pre-init.
* You can now define how much rare loot to spawn.
* Limit # of attempts in "DMS_fnc_FindSafePos" to 5000.
* New function: DMS_fnc_FindSafePos_InRange; Uses "DMS_fnc_FindSafePos" and edits some variables to return a "safe" position within a certain area.
* New function: DMS_fnc_GetEmptySeats; Returns all empty seats in a vehicle. Not used by DMS, I thought I needed it and I realized I didn't afterwards.
* New function: DMS_fnc_HeliParatroopers_Monitor; Monitors helis/aircraft spawned for paratroopers. **NOT YET COMPLETE**
* New function: DMS_fnc_SpawnHeliReinforcement; Spawns a heli/aircraft with paratroopers for reinforcement. **NOT YET COMPLETE**
* New group reinforcement type: "heli_troopers". Changes most likely to come.
* You can now choose whether or not to destroy or simply unlock a used AI vehicle (with a random percentage chance).
* Slight optimizations here and there (more to come).
#### March 1, 2016 (12:30 AM CST-America):
* Initial Test Branch commit
* **NEW CONFIG VALUE:** DMS_SpawnMissions_Scheduled
* Several optimizations (mostly due to the new scripting commands introduced in 1.56)
* You can now spawn missions in scheduled environment.
### End "March 1, 2016" Test Branch
#### February 19, 2016 (5:45 PM CST-America):
* Fixed a minor typo with a variable (part of the new Humanity support by DonkeyPunch).
@ -565,7 +590,7 @@ ___
* Debug logs for "DMS_fnc_MissionsMonitor" will only output the mission name and the position, instead of all of the parameters.
* "DMS_fnc_IsNearWater" will now check the provided position itself for water.
* "DMS_fnc_IsValidPosition" will now do a surfaceNormal check within a 5 meter radius of the provided position as well.
* "_customGearSet" should now actually work for "DMS_fnc_SpawnAISoldier", and the function title comment has been updated for the slightly tweaked syntax.
* ```_customGearSet``` should now actually work for "DMS_fnc_SpawnAISoldier", and the function title comment has been updated for the slightly tweaked syntax.
#### October 8, 2015 (7:15 PM CST-America):
@ -596,7 +621,7 @@ ___
* These changes should make it much easier for people to use DMS notification functions for other purposes.
* Fixed AI waypoints - the AI should now properly circle the objective at the proper radius.
* Tweaked "DMS_AI_WP_Radius_moderate" and "DMS_AI_WP_Radius_difficult" (reduced the radii). Due to the AI pathing fix.
* Fixed a couple typos in "DMS_fnc_SpawnAISoldier". "_customGearSet" should work now (although I'm fairly certain nobody uses it since nobody ever complained :P )
* Fixed a couple typos in "DMS_fnc_SpawnAISoldier". ```_customGearSet``` should work now (although I'm fairly certain nobody uses it since nobody ever complained :P )
* Improved "DMS_fnc_SpawnNonPersistentVehicle"; Vehicles should no longer spawn jumbled up in most cases (like cardealer). Also, it's updated to the latest Exile methods to ensure that vehicles have no nightvision/thermal if configured to do so in Exile configs. Also added the "MPKilled" EH used by Exile for non-persistent (persistent vehicles already had it).
* You can now choose whether or not you want to display the poptabs or respect kill messages when killing an AI with "DMS_Show_Kill_Poptabs_Notification" and "DMS_Show_Kill_Respect_Notification". Both are enabled by default.
* Fixed typos in the "OnKilled" EH (didn't really affect anything)
@ -838,3 +863,75 @@ ___
* Decreased default amount of money/respect gain on AI kills (Used to be 100 poptabs and 25 respect, it is now 50 poptabs and 10 respect)
* Define functions in config.cpp. This resulted in ALL FILES being changed to some degree.
* Fixed spawning Binocs and Rangefinders/Designators on AI.
## Previous Test Branch Changes:
### "March 1, 2016" Test Branch
#### List Of new Config values:
DMS_SpawnMissions_Scheduled
DMS_AI_WP_Radius_heli
DMS_AI_WP_Radius_heli
DMS_RHeli_Height
DMS_RHeli_MinDistFromDrop
DMS_RHeli_MaxDistFromDrop
DMS_RHeli_MinDistFromPlayers
DMS_RareLootAmount
DMS_ReinforcementHelis
#### April 20, 2016 (5:45 PM CST-America, RC):
* The new "DMS_fnc_FindSafePos_InRange" function will ignore the config "DMS_UsePredefinedMissionLocations".
* Disable simulation on objects imported from M3Editor. (Thanks to [second_coming](http://www.exilemod.com/profile/60-second_coming/) for the tip)
#### April 15, 2016 (8:45 PM CST-America, RC):
* Fixed an issue where static weapons would always be destroyed, ignoring other configs. Thanks to [second_coming](http://www.exilemod.com/profile/60-second_coming/)!
#### April 15, 2016 (9:30 AM CST-America, RC):
* Fixed script error in OnKilled EH when handling a used AI vehicle.
#### April 14, 2016 (9:20 PM CST-America, RC):
* Fix script error with saltflats.
* "DMS_fnc_AddMissionToMonitor" will no longer convert given AI parameters to a list of objects, so you can now add other units to the mission (within the same group) without much issue.
* Micro-optimizations here and there.
* Fixed an issue with DMS_fnc_GetAllUnits such that it would return an empty list if given a list of AI objects.
* You can now set the maximum limit of paratrooper reinforcements.
* The pilot of the reinforcement heli should now fly away properly if configured to do so.
* Updated group reinforcement manager for compatibility with latest syntax for paratrooper reinforcements (NOTE: UNTESTED).
#### March 31, 2016 (6:00 PM CST-America):
* You can now use "setVariable" to define individually on an AI vehicle its "DMS_DestructionChance". EG: ```_vehicle setVariable ["DMS_DestructionChance",100];``` to always destroy a vehicle when its crew is dead.
* "DMS_DestructionChance" values are defaulted to "DMS_AI_destroyStaticWeapon_chance" or "DMS_AI_destroyVehicleChance" for static or regular vehicles, respectively.
* Optimization + code cleanup for "DMS_fnc_SpawnHeliReinforcement".
#### March 25, 2016 (6:00 PM CST-America):
* **NEW CONFIG VALUES:**
DMS_AI_WP_Radius_heli
DMS_AI_WP_Radius_heli
DMS_RHeli_Height
DMS_RHeli_MinDistFromDrop
DMS_RHeli_MaxDistFromDrop
DMS_RHeli_MinDistFromPlayers
DMS_RareLootAmount
DMS_ReinforcementHelis
* DMS Version is set in the "config.cpp", and grabbed in pre-init.
* You can now define how much rare loot to spawn.
* Limit # of attempts in "DMS_fnc_FindSafePos" to 5000.
* New function: DMS_fnc_FindSafePos_InRange; Uses "DMS_fnc_FindSafePos" and edits some variables to return a "safe" position within a certain area.
* New function: DMS_fnc_GetEmptySeats; Returns all empty seats in a vehicle. Not used by DMS, I thought I needed it and I realized I didn't afterwards.
* New function: DMS_fnc_HeliParatroopers_Monitor; Monitors helis/aircraft spawned for paratroopers. **NOT YET COMPLETE**
* New function: DMS_fnc_SpawnHeliReinforcement; Spawns a heli/aircraft with paratroopers for reinforcement. **NOT YET COMPLETE**
* New group reinforcement type: "heli_troopers". Changes most likely to come.
* You can now choose whether or not to destroy or simply unlock a used AI vehicle (with a random percentage chance).
* Slight optimizations here and there (more to come).
#### March 1, 2016 (12:30 AM CST-America):
* Initial Test Branch commit
* **NEW CONFIG VALUE:** DMS_SpawnMissions_Scheduled
* Several optimizations (mostly due to the new scripting commands introduced in 1.56)
* You can now spawn missions in scheduled environment.
### End "March 1, 2016" Test Branch