Initial Test Branch Commit

Lots of optimizations...
This commit is contained in:
eraser1 2016-05-06 22:44:48 -05:00
parent 38627c5e28
commit e3d11a0aa5
60 changed files with 1086 additions and 848 deletions

View File

@ -4,7 +4,7 @@ class CfgPatches
{ {
units[] = {}; units[] = {};
weapons[] = {}; weapons[] = {};
a3_DMS_version = "April 27, 2016"; a3_DMS_version = "May 6, 2016 (TEST)";
requiredVersion = 1.36; requiredVersion = 1.36;
requiredAddons[] = {"exile_client","exile_server_config"}; requiredAddons[] = {"exile_client","exile_server_config"};
}; };
@ -42,6 +42,7 @@ class CfgFunctions
class FindSafePos_InRange {}; class FindSafePos_InRange {};
class FindSuppressor {}; class FindSuppressor {};
class GetAllUnits {}; class GetAllUnits {};
class GetCenter {};
class GetEmptySeats {}; class GetEmptySeats {};
class GroupReinforcementsManager {}; class GroupReinforcementsManager {};
//class HandleMissionEvents {}; //class HandleMissionEvents {};
@ -50,6 +51,9 @@ class CfgFunctions
class ImportFromM3E {}; class ImportFromM3E {};
class ImportFromM3E_Convert {}; class ImportFromM3E_Convert {};
class ImportFromM3E_Static {}; class ImportFromM3E_Static {};
class ImportFromM3E_3DEN {};
class ImportFromM3E_3DEN_Convert {};
class ImportFromM3E_3DEN_Static {};
class IsPlayerNearby {}; class IsPlayerNearby {};
class IsNearWater {}; class IsNearWater {};
class IsValidPosition {}; class IsValidPosition {};
@ -68,6 +72,7 @@ class CfgFunctions
class SetAILocality {}; class SetAILocality {};
class SetGroupBehavior {}; class SetGroupBehavior {};
class SetGroupBehavior_Separate {}; class SetGroupBehavior_Separate {};
class SetRelPositions {};
class SpawnAIGroup {}; class SpawnAIGroup {};
class SpawnAIGroup_MultiPos {}; class SpawnAIGroup_MultiPos {};
class SpawnAIVehicle {}; class SpawnAIVehicle {};
@ -80,6 +85,7 @@ class CfgFunctions
class SpawnNonPersistentVehicle {}; class SpawnNonPersistentVehicle {};
class SpawnPersistentVehicle {}; class SpawnPersistentVehicle {};
class SpawnStaticMission {}; class SpawnStaticMission {};
class SubArr {};
class TargetsKilled {}; class TargetsKilled {};
}; };
}; };

View File

@ -216,8 +216,8 @@ DMS_SpawnMissions_Scheduled = false; // Whether or not to spawn missions in a sc
DMS_StaticMissionTypes = [ // List of STATIC missions with spawn chances. DMS_StaticMissionTypes = [ // List of STATIC missions with spawn chances.
//["saltflats",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) //["slums",1] //<--Example (already imported by default on Altis in map configs)
//["sectorB",1] //<--Example for Taviana //["sectorB",1] //<--Example for Taviana
]; ];
@ -441,6 +441,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) DMS_assault_equipment = [ // Equipment for Assault Class AI (stuff that goes in toolbelt slots)
"ItemGPS" "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 DMS_assault_helmets = [ // Helmets for Assault Class
"H_HelmetSpecB_paint1", "H_HelmetSpecB_paint1",
"H_HelmetIA_camo", "H_HelmetIA_camo",
@ -516,6 +525,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) DMS_MG_equipment = [ // Equipment for MG Class AI (stuff that goes in toolbelt slots)
"Binocular" "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 DMS_MG_helmets = [ // Helmets for MG Class
"H_PilotHelmetHeli_I", "H_PilotHelmetHeli_I",
"H_PilotHelmetHeli_O", "H_PilotHelmetHeli_O",
@ -602,6 +620,13 @@ DMS_SpawnMissions_Scheduled = false; // Whether or not to spawn missions in a sc
"Rangefinder", "Rangefinder",
"ItemGPS" "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"
];
DMS_sniper_helmets = [ // Helmets for Sniper Class DMS_sniper_helmets = [ // Helmets for Sniper Class
"H_HelmetSpecB_paint1", "H_HelmetSpecB_paint1",
"H_HelmetIA_camo", "H_HelmetIA_camo",
@ -779,7 +804,9 @@ DMS_SpawnMissions_Scheduled = false; // Whether or not to spawn missions in a sc
"Exile_Item_ChristmasTinner_Cooked", "Exile_Item_ChristmasTinner_Cooked",
"Exile_Item_BBQSandwich_Cooked", "Exile_Item_BBQSandwich_Cooked",
"Exile_Item_Catfood_Cooked", "Exile_Item_Catfood_Cooked",
"Exile_Item_DogFood_Cooked" "Exile_Item_DogFood_Cooked",
"Exile_Item_EMRE",
"Exile_Item_EMRE"
]; ];
DMS_BoxDrinks = [ DMS_BoxDrinks = [
"Exile_Item_PlasticBottleCoffee", "Exile_Item_PlasticBottleCoffee",

View File

@ -221,9 +221,12 @@ if (DMS_ShowDifficultyColorLegend) then
[_x] call DMS_fnc_SpawnBanditMission; [_x] call DMS_fnc_SpawnBanditMission;
} forEach DMS_BanditMissionsOnServerStart; } forEach DMS_BanditMissionsOnServerStart;
if (DMS_StaticMission) then
{ {
[_x] call DMS_fnc_SpawnStaticMission; {
} forEach DMS_StaticMissionsOnServerStart; [_x] call DMS_fnc_SpawnStaticMission;
} forEach DMS_StaticMissionsOnServerStart;
};
// Add heli paratroopers monitor to the thread system. // Add heli paratroopers monitor to the thread system.

View File

@ -2,6 +2,7 @@
DMS Pre-init DMS Pre-init
Written by eraser1 (trainwreckdayz.com) Written by eraser1 (trainwreckdayz.com)
*/ */
#define CALLFILE(FILE) call compile preprocessFileLineNumbers FILE;
DMS_HC_Object = objNull; DMS_HC_Object = objNull;
@ -11,13 +12,21 @@ DMS_Version = getText (configFile >> "CfgPatches" >> "a3_dms" >> "a3_DMS_version
//Load main config //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... //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 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; DMS_MagRange = DMS_MaximumMagCount - DMS_MinimumMagCount;
@ -29,79 +38,10 @@ DMS_MagRange = DMS_MaximumMagCount - DMS_MinimumMagCount;
Slightly modified by eraser1 Slightly modified by eraser1
*/ */
M3E_fnc_getCenter = M3E_fnc_getCenter = DMS_fnc_GetCenter;
{
private ['_objects', '_ax', '_ay', '_az', '_xs', '_xc', '_xz', '_ys', '_yc', '_yz', '_zs', '_zc', '_zz'];
_objects = [_this, 0, [], [[]]] call BIS_fnc_param;
_ax = [];
_ay = [];
_az = [];
{
private ['_position'];
_position = getPosATL _x;
_ax pushBack (_position select 0);
_ay pushBack (_position select 1);
_az pushBack (_position select 2);
} foreach _objects;
_xs = 0;
_xc = {_xs = _xs + _x; true} count _ax;
_xz = _xs / _xc;
_ys = 0; M3E_fnc_subArr = DMS_fnc_SubArr;
_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;
};
// 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_AttemptsUntilThrottle = DMS_AttemptsUntilThrottle + 1;
@ -110,5 +50,5 @@ DMS_HeliParatrooper_Arr = [];
// Initialize mission variables... // Initialize mission variables...
call compileFinal preprocessFileLineNumbers "\x\addons\dms\missions\static_init.sqf"; CALLFILE("\x\addons\dms\missions\static_init.sqf");
call compileFinal preprocessFileLineNumbers "\x\addons\dms\missions\mission_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. // 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_MinDistFromWestBorder = 750;
DMS_MinDistFromEastBorder = 250; DMS_MinDistFromEastBorder = 2500;
DMS_MinDistFromSouthBorder = 500; DMS_MinDistFromSouthBorder = 3500;
DMS_MinDistFromNorthBorder = 400; DMS_MinDistFromNorthBorder = 1000;

View File

@ -2,68 +2,47 @@
DMS_fnc_AILocalityManager DMS_fnc_AILocalityManager
Created by Defent and eraser1 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) exitWith {};
if (!DMS_ai_offload_to_client && {isNull DMS_HC_Object}) 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) && {!((DMS_ai_offload_Only_DMS_AI && {!(_x getVariable ["DMS_SpawnedGroup",false])}) || {(_x getVariable ["DMS_LockLocality",false])})}) then
{ {
private ["_leader", "_group", "_owner"]; private _leader = leader _x;
_leader = leader _x; private _group = _x;
_group = _x;
_groupOwner = groupOwner _group;
if ((!isNull _leader) && {(alive _leader) && {!isPlayer _leader}}) then if ((!isNull _leader) && {(alive _leader) && {!isPlayer _leader}}) then
{ {
if (isNull DMS_HC_Object) then if (DMS_DEBUG) then
{ {
(format ["AILocalityManager :: Finding owner for group: %1",_group]) call DMS_fnc_DebugLog;
};
private _groupOwner = groupOwner _group;
private _ownerObj = objNull;
if !(local _group) then // Only check for the group owner in players if it doesn't belong to the server.
{
{
if (_groupOwner isEqualTo (owner _x)) exitWith
{
_ownerObj = _x;
};
} forEach allPlayers;
};
// 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)} && {!(local _group)}) then
{
// Reset locality to the server
_group setGroupOwner 2;
if (DMS_DEBUG) then if (DMS_DEBUG) then
{ {
(format ["AILocalityManager :: DMS_HC_Object is null! Finding owner for group: %1",_group]) call DMS_fnc_DebugLog; (format ["AILocalityManager :: Current owner of group %1 is too far away and no other viable owner found; resetting ownership to the server.",_group]) call DMS_fnc_DebugLog;
};
_owner = objNull;
if !(local _group) 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;
};
} forEach allPlayers;
};
if ((isNull _owner) || {(_owner distance2D _leader)>3500}) then
{
if !([_group,_leader] call DMS_fnc_SetAILocality) then
{
if !(local _group) then
{
_group setGroupOwner 2;
if (DMS_DEBUG) then
{
(format ["AILocalityManager :: Current owner of group %1 is too far away and no other viable owner found; resetting ownership to the server.",_group]) call DMS_fnc_DebugLog;
};
};
};
};
}
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; } forEach allGroups;

View File

@ -57,11 +57,7 @@
*/ */
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"]; private _added = false;
_added = false;
if !(params if !(params
[ [
@ -82,7 +78,7 @@ exitWith
false; false;
}; };
_onEndingScripts = if ((count _this)>10) then {_this select 10} else {[[],[],{},{}]}; private _onEndingScripts = if ((count _this)>10) then {_this select 10} else {[[],[],{},{}]};
try try
@ -114,7 +110,7 @@ try
throw format["_missionObjs |%1|",_missionObjs]; throw format["_missionObjs |%1|",_missionObjs];
}; };
_mines = private _mines =
if ((count _missionObjs)>3) then if ((count _missionObjs)>3) then
{ {
_missionObjs param [3,[],[[]]] _missionObjs param [3,[],[[]]]
@ -156,7 +152,7 @@ try
throw format["_onEndingScripts |%1|",_onEndingScripts]; throw format["_onEndingScripts |%1|",_onEndingScripts];
}; };
_arr = private _arr =
[ [
_pos, _pos,
_completionInfo, _completionInfo,
@ -192,7 +188,7 @@ try
if (DMS_MarkerText_ShowAICount) then 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]); _markerDot setMarkerText (format ["%1 (%2 %3 remaining)",markerText _markerDot,count _units,DMS_MarkerText_AIName]);
}; };

View File

@ -67,10 +67,7 @@
*/ */
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"]; private _added = false;
_added = false;
if !(params if !(params
[ [
@ -92,7 +89,7 @@ exitWith
false; false;
}; };
_onEndingScripts = if ((count _this)>11) then {_this select 11} else {[[],[],{},{}]}; private _onEndingScripts = if ((count _this)>11) then {_this select 11} else {[[],[],{},{}]};
try try
@ -124,7 +121,7 @@ try
throw format["_missionObjs |%1|",_missionObjs]; 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. // Don't spawn a minefield if there is one already defined in _missionObjs.
if (DMS_SpawnMinefieldForEveryMission && {_mines isEqualTo []}) then if (DMS_SpawnMinefieldForEveryMission && {_mines isEqualTo []}) then
@ -157,7 +154,7 @@ try
throw format["_onEndingScripts |%1|",_onEndingScripts]; throw format["_onEndingScripts |%1|",_onEndingScripts];
}; };
_arr = private _arr =
[ [
_pos, _pos,
_completionInfo, _completionInfo,
@ -194,7 +191,7 @@ try
if (DMS_MarkerText_ShowAICount_Static) then 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]); _markerDot setMarkerText (format ["%1 (%2 %3 remaining)",markerText _markerDot,count (_units call DMS_fnc_GetAllUnits),DMS_MarkerText_AIName]);
}; };

View File

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

View File

@ -11,11 +11,6 @@
Returns the absolute position from the provided relative position from the provided center position or object. Returns the absolute position from the provided relative position from the provided center position or object.
*/ */
private ["_pos", "_relPos", "_npos"];
if !(params if !(params
[ [
["_pos","",[[],objNull],[2,3]], ["_pos","",[[],objNull],[2,3]],
@ -47,4 +42,4 @@ if ((count _relPos)<3) then
}; };
// Script command "vectorAdd" is much faster than adding each element manually. // Script command "vectorAdd" is much faster than adding each element manually.
_pos vectorAdd _relPos _pos vectorAdd _relPos

View File

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

View File

@ -24,8 +24,6 @@
(format ["CleanUpManager :: Checking Cleaning Status for: %1",_x]) call DMS_fnc_DebugLog; (format ["CleanUpManager :: Checking Cleaning Status for: %1",_x]) call DMS_fnc_DebugLog;
}; };
private ["_objs","_timeAddedToList","_timeUntilClean"];
if !(_x params if !(_x params
[ [

View File

@ -18,10 +18,6 @@
*/ */
private["_pos", "_text", "_difficulty", "_randomMarker", "_num", "_color", "_dot", "_circle", "_dir", "_dis", "_npos"];
params params
[ [
["_pos","ERROR",[[]],[2,3]], ["_pos","ERROR",[[]],[2,3]],
@ -37,7 +33,7 @@ if ((_pos isEqualTo "ERROR") || ("_text" isEqualTo "ERROR")) exitWith
}; };
_randomMarker = private _randomMarker =
if ((count _this)>3) then if ((count _this)>3) then
{ {
_this select 3; _this select 3;
@ -47,16 +43,17 @@ _randomMarker =
DMS_MarkerPosRandomization; DMS_MarkerPosRandomization;
}; };
_num = DMS_MissionCount; private _num = DMS_MissionCount;
switch (_difficulty) do private _color =
{ switch (_difficulty) do
case "easy": {_color = "ColorGreen";}; {
case "moderate": {_color = "ColorYellow";}; case "easy": {"ColorGreen";};
case "difficult": {_color = "ColorRed";}; case "moderate": {"ColorYellow";};
case "hardcore" : {_color = "ColorBlack";}; case "difficult": {"ColorRed";};
default {_color = _difficulty;}; case "hardcore" : {"ColorBlack";};
}; default {_difficulty;};
};
if !((toLower _color) in DMS_A3_AllMarkerColors) then if !((toLower _color) in DMS_A3_AllMarkerColors) then
{ {
@ -64,13 +61,13 @@ if !((toLower _color) in DMS_A3_AllMarkerColors) then
_color = "ColorRed"; _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 setMarkerColor _color;
_circle setMarkerShape "ELLIPSE"; _circle setMarkerShape "ELLIPSE";
_circle setMarkerBrush "Solid"; _circle setMarkerBrush "Solid";
_circle setMarkerSize [150,150]; _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 setMarkerColor "ColorBlack";
_dot setMarkerType "mil_dot"; _dot setMarkerType "mil_dot";
_dot setMarkerText _text; _dot setMarkerText _text;
@ -85,9 +82,9 @@ if (DMS_MarkerText_ShowMissionPrefix) then
if (_randomMarker) then if (_randomMarker) then
{ {
_dir = random 360; private _dir = random 360;
_dis = DMS_MarkerPosRandomRadius call DMS_fnc_SelectRandomVal; private _dis = DMS_MarkerPosRandomRadius call DMS_fnc_SelectRandomVal;
_npos = _pos getPos [_dis,_dir]; private _npos = _pos getPos [_dis,_dir];
_circle setMarkerPos _npos; _circle setMarkerPos _npos;
_dot setMarkerPos _npos; _dot setMarkerPos _npos;

View File

@ -1,8 +1,8 @@
/* /*
DMS_fnc_FillCrate DMS_fnc_FillCrate
Original credit goes to WAI: https://github.com/nerdalertdk/WICKED-AI Inspired by WAI: https://github.com/nerdalertdk/WICKED-AI
Edited by eraser1 created by eraser1
Usage: Usage:
[ [
@ -86,10 +86,6 @@
] ]
*/ */
private ["_crate","_lootValues","_wepCount","_weps","_itemCount","_items","_backpackCount","_backpacks","_weapon","_ammo","_item","_backpack","_crateValues","_rareLootChance","_marker"];
if (!(params if (!(params
[ [
["_crate",objNull,[objNull]], ["_crate",objNull,[objNull]],
@ -118,6 +114,8 @@ if (_crate getVariable ["DMS_CrateEnableRope",DMS_EnableBoxMoving]) then
if ((_lootValues isEqualType []) && {!((_lootValues select 1) isEqualType {})}) then if ((_lootValues isEqualType []) && {!((_lootValues select 1) isEqualType {})}) then
{ {
private ["_wepCount", "_weps", "_itemCount", "_items", "_backpackCount", "_backpacks"];
// Weapons // Weapons
if ((_lootValues select 0) isEqualType []) then if ((_lootValues select 0) isEqualType []) then
{ {
@ -163,13 +161,13 @@ if ((_lootValues isEqualType []) && {!((_lootValues select 1) isEqualType {})})
}; };
if ((_wepCount>0) && {count _weps>0}) then if (count _weps>0) then
{ {
// Add weapons + mags // Add weapons + mags
for "_i" from 1 to _wepCount do for "_i" from 1 to _wepCount do
{ {
_weapon = selectRandom _weps; private _weapon = selectRandom _weps;
_ammo = _weapon call DMS_fnc_selectMagazine; private _ammo = _weapon call DMS_fnc_selectMagazine;
if (_weapon isEqualType "") then if (_weapon isEqualType "") then
{ {
_weapon = [_weapon,1]; _weapon = [_weapon,1];
@ -183,12 +181,12 @@ if ((_lootValues isEqualType []) && {!((_lootValues select 1) isEqualType {})})
}; };
if ((_itemCount > 0) && {count _items>0}) then if (count _items>0) then
{ {
// Add items // Add items
for "_i" from 1 to _itemCount do for "_i" from 1 to _itemCount do
{ {
_item = selectRandom _items; private _item = selectRandom _items;
if (_item isEqualType "") then if (_item isEqualType "") then
{ {
_item = [_item,1]; _item = [_item,1];
@ -198,12 +196,12 @@ if ((_lootValues isEqualType []) && {!((_lootValues select 1) isEqualType {})})
}; };
if ((_backpackCount > 0) && {count _backpacks>0}) then if (count _backpacks>0) then
{ {
// Add backpacks // Add backpacks
for "_i" from 1 to _backpackCount do for "_i" from 1 to _backpackCount do
{ {
_backpack = selectRandom _backpacks; private _backpack = selectRandom _backpacks;
if (_backpack isEqualType "") then if (_backpack isEqualType "") then
{ {
_backpack = [_backpack,1]; _backpack = [_backpack,1];
@ -214,7 +212,7 @@ if ((_lootValues isEqualType []) && {!((_lootValues select 1) isEqualType {})})
} }
else else
{ {
_crateValues = private _crateValues =
if (_lootValues isEqualType []) then if (_lootValues isEqualType []) then
{ {
(_lootValues select 0) call (_lootValues select 1) (_lootValues select 0) call (_lootValues select 1)
@ -272,7 +270,7 @@ else
if (DMS_RareLoot) then if (DMS_RareLoot) then
{ {
_rareLootChance = private _rareLootChance =
if ((count _this)>2) then if ((count _this)>2) then
{ {
_this param [2,DMS_RareLootChance,[0]] _this param [2,DMS_RareLootChance,[0]]
@ -300,16 +298,16 @@ if (DMS_RareLoot) then
// You can choose if you want to enable/disable smoke individually using setVariable. // You can choose if you want to enable/disable smoke individually using setVariable.
if (_crate getVariable ["DMS_AllowSmoke", true]) then 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 setPosATL (getPosATL _crate);
_marker attachTo [_crate,[0,0,0]]; _marker attachTo [_crate,[0,0,0]];
}; };
if (DMS_SpawnBoxIRGrenade && {sunOrMoon != 1}) then if (DMS_SpawnBoxIRGrenade && {sunOrMoon != 1}) then
{ {
_marker = "B_IRStrobe" createVehicle getPosATL _crate; private _marker = "B_IRStrobe" createVehicle getPosATL _crate;
_marker setPosATL (getPosATL _crate); _marker setPosATL (getPosATL _crate);
_marker attachTo [_crate, [0,0,0.5]]; _marker attachTo [_crate, [0,0,0.5]];
}; };

View File

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

View File

@ -19,8 +19,6 @@
Returns a position. Returns a position.
*/ */
private ["_centerPos", "_distance", "_posParameters", "_original_x", "_original_y", "_original_Blacklist", "_center_x", "_center_y", "_usePresetOriginal", "_pos"];
if !(params if !(params
[ [
["_centerPos", 0, [[]], [2,3]], ["_centerPos", 0, [[]], [2,3]],
@ -35,13 +33,13 @@ exitWith
}; };
// Save the original values // Save the original values
_original_x = DMS_MinMax_X_Coords; private _original_x = DMS_MinMax_X_Coords;
_original_y = DMS_MinMax_Y_Coords; private _original_y = DMS_MinMax_Y_Coords;
_original_Blacklist = DMS_findSafePosBlacklist; private _original_Blacklist = DMS_findSafePosBlacklist;
// Get the center values // Get the center values
_center_x = _centerPos select 0; private _center_x = _centerPos select 0;
_center_y = _centerPos select 1; private _center_y = _centerPos select 1;
// Set the restrictions // Set the restrictions
DMS_MinMax_X_Coords = [_center_x - _distanceMax, _center_x + _distanceMax]; 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; DMS_UsePredefinedMissionLocations = false;
// NOW we get the position (hopefully) // NOW we get the position (hopefully)
_pos = _posParameters call DMS_fnc_findSafePos; private _pos = _posParameters call DMS_fnc_findSafePos;
// Reset the original values // Reset the original values
DMS_MinMax_X_Coords = _original_x; DMS_MinMax_X_Coords = _original_x;

View File

@ -8,43 +8,37 @@
*/ */
private["_weapon","_result","_weaponName","_rnd338","_rnd93"]; private _weapon = _this;
_result = ""; private _weaponName = getText (configFile >> "cfgWeapons" >> _weapon >> "displayName");
_weapon = _this;
_weaponName = getText (configFile >> "cfgWeapons" >> _weapon >> "displayName");
switch (true) do switch (true) do
{ {
// Zafir accepts no suppressors :(
case ((_weapon find "Zafir")>-1) : {""};
case ((_weaponName find "6.5") > -1) : case ((_weaponName find "6.5") > -1) :
{ {
if (_weapon find "LMG_Mk200" > -1) then if (_weapon find "LMG_Mk200" > -1) then
{ {
_result = "muzzle_snds_H_MG"; "muzzle_snds_H_MG";
} }
else else
{ {
_result = "muzzle_snds_H"; "muzzle_snds_H";
}; };
}; };
case ((_weaponName find "5.56") > -1) : {_result = "muzzle_snds_M";}; case ((_weaponName find "5.56") > -1) : {"muzzle_snds_M"};
case ((_weaponName find "7.62") > -1) : {_result = "muzzle_snds_B";}; case ((_weaponName find "7.62") > -1) : {"muzzle_snds_B"};
case ((_weaponName find ".45") > -1) : {_result = "muzzle_snds_acp";}; case ((_weaponName find ".45") > -1) : {"muzzle_snds_acp"};
case ((_weaponName find "9 mm") > -1) : {_result = "muzzle_snds_L";}; case ((_weaponName find "9 mm") > -1) : {"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 ".338") > -1) : {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"];}; case ((_weaponName find "9.3 mm") > -1) : {selectRandom ["muzzle_snds_93mmg","muzzle_snds_93mmg_tan"]};
}; };
// Zafir accepts no suppressors :(
if ((_weapon find "Zafir")>-1) then {_result = "";};
_result

View File

@ -14,19 +14,15 @@
Returns all living units from a given array of groups or objects. Returns all living units from a given array of groups or objects.
*/ */
private ["_units"];
if !(_this isEqualType []) then if !(_this isEqualType []) then
{ {
_this = [_this]; _this = [_this];
}; };
private _units = [];
_units = [];
{ {
private ["_parameter"]; private _parameter = _x;
_parameter = _x;
_units append _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,10 +108,7 @@
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). 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 // Check ALL the variables
if !(params if !(params
[ [
["_AIGroup", grpNull, [grpNull] ], ["_AIGroup", grpNull, [grpNull] ],
@ -198,30 +195,32 @@ _fnc_isDepleted =
}; };
}; };
_reinforcementsDepleted = call _fnc_isDepleted; private _reinforcementsDepleted = call _fnc_isDepleted;
if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) then if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) then
{ {
private ["_remainingUnits", "_unitsToSpawn"]; private "_unitsToSpawn";
if (isNull _AIGroup) then 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];
if (DMS_DEBUG) then
{ {
(format ["GroupReinforcementsManager :: Group provided was null! Created new group for ""%1"" side: %2",_side, _AIGroup]) call DMS_fnc_DebugLog; // The group (presumably) lost all units and got deleted, so we create a new group using the given side and continue with that.
_AIGroup = createGroup (missionNamespace getVariable [format ["DMS_%1Side",_side],EAST]);
_this set [0, _AIGroup];
if (DMS_DEBUG) then
{
(format ["GroupReinforcementsManager :: Group provided was null! Created new group for ""%1"" side: %2",_side, _AIGroup]) call DMS_fnc_DebugLog;
};
0
}
else
{
{alive _x} count (units _AIGroup);
}; };
}
else
{
_remainingUnits = {alive _x} count (units _AIGroup);
};
if (DMS_DEBUG) then if (DMS_DEBUG) then
@ -233,8 +232,6 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
{ {
case "playernear": case "playernear":
{ {
private ["_posOrObj", "_radius", "_reinforcementCount", "_maxAICount"];
if !(_monitorParams params if !(_monitorParams params
[ [
["_posOrObj", [], [objNull,[]], [2,3]], ["_posOrObj", [], [objNull,[]], [2,3]],
@ -250,7 +247,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
if ([_posOrObj,_radius] call DMS_fnc_IsPlayerNearby) then 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); _unitsToSpawn = _reinforcementCount min ((_maxAICount-_remainingUnits) max 0);
}; };
@ -258,8 +255,6 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
case "maintain": case "maintain":
{ {
private "_AICount";
if !(_monitorParams params if !(_monitorParams params
[ [
["_AICount", 0, [0]] ["_AICount", 0, [0]]
@ -279,8 +274,6 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
case "reinforce": case "reinforce":
{ {
private ["_AICount", "_reinforcementCount", "_maxAICount"];
if !(_monitorParams params if !(_monitorParams params
[ [
["_AICount", 0, [0]], ["_AICount", 0, [0]],
@ -295,7 +288,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
if (_remainingUnits<_AICount) then 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); _unitsToSpawn = _reinforcementCount min ((_maxAICount-_remainingUnits) max 0);
}; };
@ -303,8 +296,6 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
case "increasing_resistance": case "increasing_resistance":
{ {
private ["_AICount", "_reinforcementCount", "_increment_AICount", "_maxAICount"];
if !(_monitorParams params if !(_monitorParams params
[ [
["_AICount", 0, [0]], ["_AICount", 0, [0]],
@ -320,7 +311,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
if (_remainingUnits<_AICount) then 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); _unitsToSpawn = _reinforcementCount min ((_maxAICount-_remainingUnits) max 0);
@ -330,8 +321,6 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
case "increasing_difficulty": case "increasing_difficulty":
{ {
private ["_AICount", "_reinforcementCount", "_maxAICount"];
if !(_monitorParams params if !(_monitorParams params
[ [
["_AICount", 0, [0]], ["_AICount", 0, [0]],
@ -355,7 +344,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
case "hardcore": {"hardcore"}; 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); _unitsToSpawn = _reinforcementCount min ((_maxAICount-_remainingUnits) max 0);
}; };
@ -363,8 +352,6 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
case "armed_vehicle": case "armed_vehicle":
{ {
private ["_AICount", "_vehClass", "_leaderPos", "_veh"];
if !(_monitorParams params if !(_monitorParams params
[ [
["_AICount", 0, [0]] ["_AICount", 0, [0]]
@ -377,11 +364,11 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
if (_remainingUnits<_AICount) then 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}, if (_spawnLocations isEqualTo []) then {_leaderPos getPos [100+(random 200),random 360]} else {selectRandom _spawnLocations},
@ -407,8 +394,6 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
case "armed_vehicle_replace": case "armed_vehicle_replace":
{ {
private ["_vehicle", "_vehClass", "_leaderPos"];
if !(_monitorParams params if !(_monitorParams params
[ [
["_vehicle", objNull, [objNull]] ["_vehicle", objNull, [objNull]]
@ -423,9 +408,9 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
{ {
deleteVehicle _vehicle; 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 = _vehicle =
[ [
@ -455,8 +440,6 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
case "static_gunner": case "static_gunner":
{ {
private ["_staticGun", "_gunPos", "_staticGunClass"];
if !(_monitorParams params if !(_monitorParams params
[ [
["_staticGun", objNull, [objNull]], ["_staticGun", objNull, [objNull]],
@ -472,9 +455,9 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
{ {
deleteVehicle _staticGun; 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 = _staticGun =
[ [
@ -562,7 +545,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
if ((!isNil "_unitsToSpawn") && {_unitsToSpawn>0}) then if ((!isNil "_unitsToSpawn") && {_unitsToSpawn>0}) then
{ {
private ["_spawnPos", "_units", "_spawningLocations"]; private ["_spawnPos"];
if (_maxReinforcementUnits>0) then if (_maxReinforcementUnits>0) then
{ {
@ -578,7 +561,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
}; };
}; };
_units = []; private _units = [];
if (_spawnLocations isEqualTo []) then if (_spawnLocations isEqualTo []) then
{ {
@ -593,7 +576,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the
else else
{ {
// Shuffle the original list and make a copy. // 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 _spawnPos = _spawningLocations select 0; // Define it for spawning flares
_spawningLocations_count = count _spawningLocations; _spawningLocations_count = count _spawningLocations;

View File

@ -70,9 +70,9 @@
if ((_heli distance2D _dropPoint)<200) then 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. // Grab and lock locality to control AI if necessary.
if !(local _AIGroup) then if !(local _AIGroup) then

View File

@ -15,9 +15,6 @@
Returns all created objects. Returns all created objects.
*/ */
private ["_file", "_pos", "_objs", "_export", "_obj", "_objPos"];
if !(params if !(params
[ [
["_file","",[""]], ["_file","",[""]],
@ -42,20 +39,22 @@ if ((count _pos)<3) then
_pos set [2,0]; _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];
[]
};
private _objs = _export apply
_export = call compile preprocessFileLineNumbers (format ["\x\addons\DMS\objects\%1.sqf",_file]);
_objs = _export apply
{ {
// Create the object // 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 // 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 if (((count _x)>4) && {!(_x select 4)}) then
{ {
@ -69,8 +68,6 @@ _objs = _export apply
_obj setPos _objPos; _obj setPos _objPos;
}; };
_obj enableSimulationGlobal false;
_obj; _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. This function will return all created objects.
*/ */
private ["_file", "_missionPos", "_objs", "_export", "_obj", "_objPos"];
if !(params if !(params
[ [
["_file","",[""]], ["_file","",[""]],
@ -44,17 +41,21 @@ if ((count _missionPos)<3) then
}; };
private _export = call compile preprocessFileLineNumbers (format ["\x\addons\DMS\objects\static\%1.sqf",_file]);
if ((isNil "_export") || {!(_export isEqualType [])}) exitWith
_export = call compile preprocessFileLineNumbers (format ["\x\addons\DMS\objects\static\%1.sqf",_file]);
_objs = _export apply
{ {
private ["_obj","_pos"]; diag_log format ["DMS ERROR :: Calling DMS_fnc_ImportFromM3E_Convert with invalid file/filepath: %1 | _export: %2",_file,_export];
_obj = createVehicle [_x select 0, [0,0,0], [], 0, "CAN_COLLIDE"]; []
_pos = _x select 1; };
_pos set [2,(_pos select 2)+5000];
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 if (_x select 4) then
{ {
_obj setDir (_x select 2); _obj setDir (_x select 2);
@ -66,12 +67,10 @@ _objs = _export apply
_obj setVectorDirAndUp (_x select 3); _obj setVectorDirAndUp (_x select 3);
}; };
_obj enableSimulationGlobal false;
_obj; _obj;
}; };
[_objs,_missionPos] call DMS_fnc_setRelPositions; [_objs,_missionPos] call DMS_fnc_SetRelPositions;
_objs _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. 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 if !(params
[ [
["_file","",[""]] ["_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 if (missionNamespace getVariable [_varname,false]) exitWith
{ {
@ -38,8 +35,7 @@ if (missionNamespace getVariable [_varname,false]) exitWith
missionNamespace setVariable [_varname,true]; missionNamespace setVariable [_varname,true];
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]);
if ((isNil "_export") || {!(_export isEqualType [])}) exitWith if ((isNil "_export") || {!(_export isEqualType [])}) exitWith
{ {
@ -47,14 +43,12 @@ if ((isNil "_export") || {!(_export isEqualType [])}) exitWith
[] []
}; };
private _objs = _export apply
_objs = _export apply
{ {
private ["_obj","_pos"]; private _obj = createVehicle [_x select 0, [0,0,0], [], 0, "CAN_COLLIDE"];
_obj = createVehicle [_x select 0, [0,0,0], [], 0, "CAN_COLLIDE"];
_pos = _x select 1;
_obj enableSimulationGlobal false; _obj enableSimulationGlobal false;
private _pos = _x select 1;
if (_x select 4) then if (_x select 4) then
{ {
@ -67,8 +61,6 @@ _objs = _export apply
_obj setVectorDirAndUp (_x select 3); _obj setVectorDirAndUp (_x select 3);
}; };
_obj enableSimulationGlobal false;
_obj; _obj;
}; };

View File

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

View File

@ -10,9 +10,6 @@
Returns whether or not a player is within "_distance" meters of "_positionOrObject". Returns whether or not a player is within "_distance" meters of "_positionOrObject".
*/ */
private ["_pos", "_dis", "_isNear"];
if !(params if !(params
[ [
@ -27,7 +24,7 @@ exitWith
if (_dis isEqualTo 0) exitWith {false}; if (_dis isEqualTo 0) exitWith {false};
_isNear = false; private _isNear = false;
try try
{ {
@ -39,7 +36,7 @@ try
}; };
} forEach (crew _x); } forEach (crew _x);
} forEach (_pos nearEntities [["Exile_Unit_Player","LandVehicle", "Air", "Ship"], _dis]); } forEach (_pos nearEntities [["Exile_Unit_Player","LandVehicle", "Air", "Ship"], _dis]);
if (DMS_DEBUG) then if (DMS_DEBUG) then
{ {
(format ["IsPlayerNearby :: No players within %1 meters of %2!",_dis,_pos]) call DMS_fnc_DebugLog; (format ["IsPlayerNearby :: No players within %1 meters of %2!",_dis,_pos]) call DMS_fnc_DebugLog;
@ -55,4 +52,4 @@ catch
}; };
_isNear; _isNear;

View File

@ -11,7 +11,6 @@
_traderZoneNearLimit, // NUMBER (distance): Minimum distance from a trader zone. _traderZoneNearLimit, // NUMBER (distance): Minimum distance from a trader zone.
_missionNearLimit, // NUMBER (distance): Minimum distance from another mission. _missionNearLimit, // NUMBER (distance): Minimum distance from another mission.
_playerNearLimit, // NUMBER (distance): Minimum distance from a player. _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; ] call DMS_fnc_IsValidPosition;
All parameters except "_pos" are optional. All parameters except "_pos" are optional.
@ -19,12 +18,6 @@
Returns whether or not the provided position matches the parameters. 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 if !(params
[ [
["_pos", [], [[]], [0,2,3]], ["_pos", [], [[]], [0,2,3]],
@ -34,15 +27,17 @@ if !(params
["_traderZoneNearLimit", DMS_TraderZoneNearBlacklist,[0] ], ["_traderZoneNearLimit", DMS_TraderZoneNearBlacklist,[0] ],
["_missionNearLimit", DMS_MissionNearBlacklist, [0] ], ["_missionNearLimit", DMS_MissionNearBlacklist, [0] ],
["_playerNearLimit", DMS_PlayerNearBlacklist, [0] ], ["_playerNearLimit", DMS_PlayerNearBlacklist, [0] ],
["_territoryNearLimit", DMS_TerritoryNearBlacklist, [0] ], ["_territoryNearLimit", DMS_TerritoryNearBlacklist, [0] ]
["_waterSpawn", false, [false] ]
]) ])
then then
{ {
diag_log format ["DMS ERROR :: Calling DMS_fnc_isValidPosition with invalid parameters: %1",_this]; diag_log format ["DMS ERROR :: Calling DMS_fnc_isValidPosition with invalid parameters: %1",_this];
false
} }
else else
{ {
private _isValidPos = false;
try try
{ {
if ((count _pos)<2) then if ((count _pos)<2) then
@ -62,48 +57,30 @@ else
}; };
// Only do these checks if the mission is supposed to be on land. // Check for nearby water
if (!_waterSpawn) then if ((_waterNearLimit>0) && {[_pos,_waterNearLimit] call DMS_fnc_isNearWater}) then
{ {
// Check for nearby water throw ("water");
if ((_waterNearLimit>0) && {[_pos,_waterNearLimit] call DMS_fnc_isNearWater}) then };
{
throw ("water");
};
// Terrain steepness check // Terrain steepness check
// 0 surfacenormal means completely vertical, 1 surfaceNormal means completely flat and horizontal. // 0 surfacenormal means completely vertical, 1 surfaceNormal means completely flat and horizontal.
// Take the arccos of the surfaceNormal to determine how many degrees it is from the horizontal. In SQF: {acos ((surfaceNormal _pos) select 2)}. Don't forget to define _pos. // Take the arccos of the surfaceNormal to determine how many degrees it is from the horizontal. In SQF: {acos ((surfaceNormal _pos) select 2)}. Don't forget to define _pos.
if ((_minSurfaceNormal>0) && {_minSurfaceNormal<=1}) then if ((_minSurfaceNormal>0) && {_minSurfaceNormal<=1}) then
{
if (((surfaceNormal _pos) select 2)<_minSurfaceNormal) then
{
throw ("a steep location");
};
// Check the surrounding area (within 5 meters)
private "_dir";
for "_dir" from 0 to 359 step 45 do
{
if (((surfaceNormal (_pos getPos [5,_dir])) select 2)<_minSurfaceNormal) then
{
throw ("a nearby steep location");
};
};
};
}
else
{ {
// Check to see if the position is actually water. if (((surfaceNormal _pos) select 2)<_minSurfaceNormal) then
if !(surfaceIsWater _pos) then
{ {
throw ("land"); throw ("a steep location");
}; };
// Check the depth of the water. // Check the surrounding area (within 5 meters)
if ((getTerrainHeightASL _pos)<-DMS_MinWaterDepth) then private "_dir";
for "_dir" from 0 to 359 step 45 do
{ {
throw ("shallow water"); if (((surfaceNormal (_pos getPos [5,_dir])) select 2)<_minSurfaceNormal) then
{
throw ("a nearby steep location");
};
}; };
}; };
@ -176,7 +153,6 @@ else
(format ["IsValidPosition :: Position %1 is too close to %2!",_pos,_exception]) call DMS_fnc_DebugLog; (format ["IsValidPosition :: Position %1 is too close to %2!",_pos,_exception]) call DMS_fnc_DebugLog;
}; };
}; };
_isValidPos
}; };
_isValidPos;

View File

@ -47,10 +47,10 @@
] ]
*/ */
private ["_parsedParams", "_extraParams", "_missionPosition", "_OK", "_posInfo", "_forceSpawn", "_findSafePosParams"]; private ["_missionPosition"];
_extraParams = []; private _extraParams = [];
if (isNil "_this") then if (isNil "_this") then
{ {
@ -77,7 +77,7 @@ else
then then
{ {
_missionPosition = _posInfo select 0; _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 if (!(_missionPosition isEqualType []) || {(count _missionPosition)<2}) then
{ {
@ -131,7 +131,7 @@ else
}; };
}; };
_parsedParams = private _parsedParams =
[ [
_missionPosition, _missionPosition,
_extraParams _extraParams
@ -142,4 +142,4 @@ if (DMS_DEBUG) then
(format ["MissionParams :: Returning _parsedParams: %1 | Calling params: %2",_parsedParams,_this]) call DMS_fnc_DebugLog; (format ["MissionParams :: Returning _parsedParams: %1 | Calling params: %2",_parsedParams,_this]) call DMS_fnc_DebugLog;
}; };
_parsedParams _parsedParams

View File

@ -16,19 +16,14 @@ if !(_this isEqualType []) exitWith
diag_log format ["DMS ERROR :: DMS_fnc_MissionSuccessState called with invalid parameter: %1",_this]; diag_log format ["DMS ERROR :: DMS_fnc_MissionSuccessState called with invalid parameter: %1",_this];
}; };
private ["_success", "_exit"]; private _success = true;
private _exit = false;
_success = true;
_exit = false;
{ {
if (_exit) exitWith {}; if (_exit) exitWith {};
try try
{ {
private ["_OK","_completionType","_completionArgs","_absoluteWinCondition"];
if !(_x params if !(_x params
[ [
["_completionType", "", [""] ], ["_completionType", "", [""] ],
@ -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 if (!_success && {!_absoluteWinCondition}) then
{ {

View File

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

View File

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

View File

@ -13,28 +13,26 @@
_type // Type of AI: "soldier","static","vehicle","heli", etc. _type // Type of AI: "soldier","static","vehicle","heli", etc.
] call DMS_fnc_OnKilled; ] 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 if (DMS_DEBUG) then
{ {
(format ["OnKilled :: Logging AI death with parameters: %1",_this]) call DMS_fnc_DebugLog; (format ["OnKilled :: Logging AI death with parameters: %1",_this]) call DMS_fnc_DebugLog;
}; };
_unit = _this select 0; params
_killer = _this select 1; [
_side = _unit getVariable ["DMS_AI_Side", "bandit"]; "_unit",
_type = _unit getVariable ["DMS_AI_Type", "soldier"]; "_killer"
_launcher = secondaryWeapon _unit; ];
_launcherVar = _unit getVariable ["DMS_AI_Launcher",""]; private _side = _unit getVariable ["DMS_AI_Side", "bandit"];
_playerObj = objNull; 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,{},[{}]]); _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 // 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 removeWeaponGlobal _x;} forEach (weapons _this);
{_this unlinkItem _x;} forEach (assignedItems _this); {_this unlinkItem _x;} forEach (assignedItems _this);
@ -98,19 +96,19 @@ if(DMS_RemoveNVG) then
_unit unlinkItem "NVGoggles"; _unit unlinkItem "NVGoggles";
}; };
_grp = group _unit; private _grp = group _unit;
_grpUnits = (units _grp) - [_unit]; private _grpUnits = (units _grp) - [_unit];
// Give the AI a new leader if the killed unit was the leader // Give the AI a new leader if the killed unit was the leader
if (!(_grpUnits isEqualTo []) && {(leader _grp) isEqualTo _unit}) then if (!(_grpUnits isEqualTo []) && {(leader _grp) isEqualTo _unit}) then
{ {
_grp selectLeader (selectRandom _grpUnits); _grp selectLeader (selectRandom _grpUnits);
}; };
_av = _unit getVariable ["DMS_AssignedVeh",objNull]; private _av = _unit getVariable ["DMS_AssignedVeh",objNull];
if (!isNull _av) then if (!isNull _av) then
{ {
// Determine whether or not the vehicle has any active crew remaining. // 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. // 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... // Only check for this stuff for ground vehicles that have guns...
if ((_av isKindOf "LandVehicle") && {(count (weapons _av))>0}) then if ((_av isKindOf "LandVehicle") && {(count (weapons _av))>0}) then
{ {
_gunner = gunner _av; private _gunner = gunner _av;
_driver = driver _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 // 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; private _gunnerIsAlive = alive _gunner;
_driverIsAlive = alive _driver; private _driverIsAlive = alive _driver;
if (_unit isEqualTo _gunner) then if (_unit isEqualTo _gunner) then
{ {
@ -177,11 +175,15 @@ if (!isNull _av) then
{ {
[_driver,_av,_killer] spawn [_driver,_av,_killer] spawn
{ {
_driver = _this select 0; params
_av = _this select 1; [
_killer = _this select 2; "_driver",
_grp = group _driver; "_av",
_owner = groupOwner _grp; "_killer"
];
private _grp = group _driver;
private _owner = groupOwner _grp;
_grp setVariable ["DMS_LockLocality",true]; _grp setVariable ["DMS_LockLocality",true];
@ -227,7 +229,7 @@ if (!isNull _av) then
if (_owner!=2) then if (_owner!=2) then
{ {
_start = time; private _start = time;
// Controlling AI... yes. I have to do this // Controlling AI... yes. I have to do this
waitUntil waitUntil
@ -269,11 +271,11 @@ if (!isNull _av) then
}; };
}; };
_roadKilled = false; private _roadKilled = false;
if (isPlayer _killer) then if (isPlayer _killer) then
{ {
_veh = vehicle _killer; private _veh = vehicle _killer;
_playerObj = _killer; _playerObj = _killer;
@ -293,7 +295,7 @@ if (isPlayer _killer) then
if (DMS_explode_onRoadkill) then if (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 setPosATL (getPosATL _playerObj);
_boom setDamage 1; _boom setDamage 1;
if (DMS_DEBUG) then if (DMS_DEBUG) then
@ -316,13 +318,13 @@ if (isPlayer _killer) then
// Reveal the killer to the AI units // Reveal the killer to the AI units
if (DMS_ai_share_info) then if (DMS_ai_share_info) then
{ {
_revealAmount = 4.0; private _revealAmount = 4.0;
_muzzle = currentMuzzle _playerObj; private _muzzle = currentMuzzle _playerObj;
if (_muzzle isEqualType "") then if (_muzzle isEqualType "") then
{ {
_silencer = _playerObj weaponAccessories _muzzle select 0; private _silencer = _playerObj weaponAccessories _muzzle select 0;
if (!isNil "_silencer" && {_silencer != ""}) then if (!isNil "_silencer" && {_silencer != ""}) then
{ {
_revealAmount = 2.0; _revealAmount = 2.0;

View File

@ -16,8 +16,6 @@
Returns nothing Returns nothing
*/ */
private ["_playerUID", "_playerObj", "_moneyChange", "_AISide", "_AIType", "_repChange", "_roadKilled", "_unitMoney", "_unit", "_unitRespect", "_playerMoney", "_playerRespect", "_unitName", "_msgType", "_msgParams"];
if !(params if !(params
[ [
["_playerObj", objNull, [objNull] ], ["_playerObj", objNull, [objNull] ],
@ -32,18 +30,18 @@ exitWith
}; };
_playerUID = getPlayerUID _playerObj; private _playerUID = getPlayerUID _playerObj;
if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_Unit_Player"}}) then if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_Unit_Player"}}) then
{ {
_moneyChange = missionNamespace getVariable [format ["DMS_%1_%2_MoneyGain",_AISide,_AIType],0]; private _moneyChange = missionNamespace getVariable [format ["DMS_%1_%2_MoneyGain",_AISide,_AIType],0];
_repChange = missionNamespace getVariable [format ["DMS_%1_%2_RepGain",_AISide,_AIType],0]; private _repChange = missionNamespace getVariable [format ["DMS_%1_%2_RepGain",_AISide,_AIType],0];
_rankChange = missionNamespace getVariable [format ["DMS_%1_%2_RankGain",_AISide,_AIType],0]; private _rankChange = missionNamespace getVariable [format ["DMS_%1_%2_RankGain",_AISide,_AIType],0];
// Check for individually defined AI money/respect/rank. // Check for individually defined AI money/respect/rank.
_unitMoney = _unit getVariable ["DMS_AI_Money",""]; private _unitMoney = _unit getVariable ["DMS_AI_Money",""];
_unitRespect = _unit getVariable ["DMS_AI_Respect",""]; private _unitRespect = _unit getVariable ["DMS_AI_Respect",""];
_unitRank = _unit getVariable ["DMS_AI_Rank",""]; private _unitRank = _unit getVariable ["DMS_AI_Rank",""];
if !(_unitMoney isEqualTo "") then if !(_unitMoney isEqualTo "") then
{ {
@ -71,10 +69,10 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U
if ((_moneyChange!=0) || {_repChange!=0} || {_rankChange!=0}) then if ((_moneyChange!=0) || {_repChange!=0} || {_rankChange!=0}) then
{ {
_playerMoney = _playerObj getVariable ["ExileMoney", 0]; private _playerMoney = _playerObj getVariable ["ExileMoney", 0];
_playerRespect = _playerObj getVariable ["ExileScore", 0]; private _playerRespect = _playerObj getVariable ["ExileScore", 0];
_playerRank = _playerObj getVariable ["ExileHumanity", 0]; private _playerRank = _playerObj getVariable ["ExileHumanity", 0];
_unitName = name _unit; private _unitName = name _unit;
/* /*
if (DMS_DEBUG) then if (DMS_DEBUG) then
@ -85,15 +83,15 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U
if (_moneyChange!=0) then if (_moneyChange!=0) then
{ {
private ["_msgType", "_msgParams", "_distance", "_attributes", "_distanceBonus"]; private ["_distance"];
// Set client's money // Set client's money
// I also make sure that they don't get negative poptabs // I also make sure that they don't get negative poptabs
_playerMoney = (_playerMoney + _moneyChange) max 0; _playerMoney = (_playerMoney + _moneyChange) max 0;
_playerObj setVariable ["ExileMoney",_playerMoney]; _playerObj setVariable ["ExileMoney",_playerMoney];
_msgType = "moneyReceivedRequest"; private _msgType = "moneyReceivedRequest";
_msgParams = [str _playerMoney, format ["killed %1",_unitName]]; private _msgParams = [str _playerMoney, format ["killed %1",_unitName]];
if (_moneyChange<0) then if (_moneyChange<0) then
{ {
@ -126,7 +124,7 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U
if (_repChange!=0) then 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 if (DMS_AIKill_DistanceBonusCoefficient>0) then
{ {
@ -134,7 +132,7 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U
if (_distance>DMS_AIKill_DistanceBonusMinDistance) then 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]; _attributes pushBack [format ["%1m RANGE BONUS",_distance], _distanceBonus];
_repChange = _repChange + _distanceBonus; _repChange = _repChange + _distanceBonus;
@ -195,22 +193,25 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U
if (DMS_Show_Party_Kill_Notification) then if (DMS_Show_Party_Kill_Notification) then
{ {
private ["_group", "_members", "_msg"]; private _group = group _playerObj;
private _members = units _group;
_group = group _playerObj;
_members = units _group;
if (!(_group isEqualTo ExileGraveyardGroup) && {(count _members)>1}) then 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, name _playerObj,
_unitName, _unitName,
if !(isNil "_distance") then {_distance} else {floor(_unit distance _playerObj)}, if !(isNil "_distance") then {_distance} else {floor(_unit distance _playerObj)},
_moneyChange, _moneyChange,
_repChange, _repChange
_rankChange
]; ];
if (DMS_Enable_RankChange) then
{
_msg = _msg + format[" (+%1 rank)", _rankChange];
};
{ {
_msg remoteExecCall ["systemChat", _x]; _msg remoteExecCall ["systemChat", _x];
} forEach _members; } forEach _members;

View File

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

View File

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

View File

@ -5,9 +5,8 @@
Selects/Spawns missions. Takes no arguments, returns nothing. Selects/Spawns missions. Takes no arguments, returns nothing.
*/ */
private "_time";
_time = diag_tickTime; private _time = diag_tickTime;
if (DMS_RunningBMissionCount >= DMS_MaxBanditMissions) then 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 if (DMS_DynamicMission && {_time - DMS_BMissionLastStart > DMS_BMissionDelay}) then
{ {
private "_mission"; private _mission = selectRandom DMS_BanditMissionTypesArray;
_mission = selectRandom DMS_BanditMissionTypesArray;
if (DMS_DEBUG) then 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 if (DMS_StaticMission && {_time - DMS_StaticMissionLastStart > DMS_StaticMissionDelay}) then
{ {
private ["_mission", "_availableMissions"]; private _availableMissions = (DMS_StaticMissionTypesArray - DMS_RunningStaticMissions);
_availableMissions = (DMS_StaticMissionTypesArray - DMS_RunningStaticMissions);
if (_availableMissions isEqualTo []) exitWith 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 if (DMS_DEBUG) then
{ {

View File

@ -15,9 +15,6 @@
*/ */
private ["_origin","_dis","_dir","_npos"];
if !(params if !(params
[ [
["_origin","",[objNull,[]],[2,3]], ["_origin","",[objNull,[]],[2,3]],

View File

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

View File

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

View File

@ -13,9 +13,6 @@
Returns true if the call was completed Returns true if the call was completed
*/ */
private ["_OK", "_exit", "_group", "_behavior", "_pos", "_difficulty", "_radius", "_npos", "_i", "_wp"];
if !(params if !(params
[ [
["_group",grpNull,[grpNull,objNull]], ["_group",grpNull,[grpNull,objNull]],
@ -27,7 +24,7 @@ then
diag_log format ["DMS ERROR :: Calling DMS_fnc_SetGroupBehavior with invalid params: %1",_this]; diag_log format ["DMS ERROR :: Calling DMS_fnc_SetGroupBehavior with invalid params: %1",_this];
}; };
_exit = false; private _exit = false;
try try
{ {
@ -52,7 +49,7 @@ catch
if (_exit) exitWith {false}; 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"; _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 // 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. // Add waypoints around the center position.
for "_i" from 0 to 359 step 45 do for "_i" from 0 to 359 step 45 do
{ {
_npos = _pos getPos [_radius,_i]; private _npos = _pos getPos [_radius,_i];
_wp = _group addWaypoint [_npos,5]; private _wp = _group addWaypoint [_npos,5];
_wp setWaypointType "MOVE"; _wp setWaypointType "MOVE";
}; };
@ -109,5 +106,4 @@ _wp = _group addWaypoint [_pos,0];
_wp setWaypointType "CYCLE"; _wp setWaypointType "CYCLE";
true true

View File

@ -34,13 +34,13 @@ then
diag_log format ["DMS ERROR :: Calling DMS_fnc_SetGroupBehavior_Separate with invalid params: %1",_this]; 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; _units joinSilent _tmpGroup;
_return = private _return =
[ [
_tmpGroup, _tmpGroup,
_pos, _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", [], [[]],[3]]
])
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,7 +15,7 @@
Returns AI Group Returns AI Group
*/ */
private ["_OK", "_pos", "_count", "_difficulty", "_class", "_group", "_side", "_customGearSet", "_launcherType", "_launcher", "_unit", "_rocket"]; private ["_launcherType"];
if !(params if !(params
@ -52,7 +52,7 @@ if (_class isEqualType []) then
}; };
_customGearSet = []; private _customGearSet = [];
if (_class == "custom") then if (_class == "custom") then
{ {
@ -87,19 +87,19 @@ if ((!isNil "_launcherType") || {DMS_ai_use_launchers && {DMS_ai_launchers_per_g
_launcherType = "AT"; _launcherType = "AT";
}; };
_units = units _group; private _units = units _group;
for "_i" from 0 to (((DMS_ai_launchers_per_group min _count)-1) max 0) do 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 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 (missionNamespace getVariable [format ["DMS_AI_wep_launchers_%1",_launcherType],["launch_NLAW_F"]]));
removeBackpackGlobal _unit; removeBackpackGlobal _unit;
_unit addBackpack "B_Carryall_mcamo"; _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; [_unit, _launcher, DMS_AI_launcher_ammo_count,_rocket] call BIS_fnc_addWeapon;

View File

@ -23,7 +23,7 @@
Returns AI Group Returns AI Group
*/ */
private ["_OK", "_positions", "_count", "_difficulty", "_class", "_side", "_positionsCount", "_launcherType", "_group", "_unit", "_units", "_i", "_launcher", "_rocket"]; private ["_launcherType"];
if !(params if !(params
@ -40,7 +40,7 @@ exitWith
grpNull grpNull
}; };
_positionsCount = count _positions; private _positionsCount = count _positions;
if (_positionsCount<1) exitWith if (_positionsCount<1) exitWith
{ {
@ -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_LockLocality",nil];
_group setVariable ["DMS_SpawnedGroup",true]; _group setVariable ["DMS_SpawnedGroup",true];
@ -93,7 +93,7 @@ _group setVariable ["DMS_Group_Side", _side];
for "_i" from 1 to _count do 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 // An AI will definitely spawn with a launcher if you define type
@ -104,19 +104,19 @@ if ((!isNil "_launcherType") || {DMS_ai_use_launchers && {DMS_ai_launchers_per_g
_launcherType = "AT"; _launcherType = "AT";
}; };
_units = units _group; private _units = units _group;
for "_i" from 0 to (((DMS_ai_launchers_per_group min _count)-1) max 0) do 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 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 (missionNamespace getVariable [format ["DMS_AI_wep_launchers_%1",_launcherType],["launch_NLAW_F"]]));
removeBackpackGlobal _unit; removeBackpackGlobal _unit;
_unit addBackpack "B_Carryall_mcamo"; _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; [_unit, _launcher, DMS_AI_launcher_ammo_count,_rocket] call BIS_fnc_addWeapon;

View File

@ -32,11 +32,8 @@
Returns AI Unit 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"]; private _customGearSet = [];
private _unarmed = false;
_useCustomGear = false;
_unarmed = false;
if !(params if !(params
[ [
@ -56,7 +53,6 @@ else
if ((_class == "custom") && {(count _this)>6}) then if ((_class == "custom") && {(count _this)>6}) then
{ {
_customGearSet = _this select 6; _customGearSet = _this select 6;
_useCustomGear = true;
}; };
}; };
@ -91,7 +87,7 @@ _difficulty =
//Create unit //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 allowFleeing 0;
[_unit] joinSilent _group; [_unit] joinSilent _group;
@ -133,9 +129,9 @@ else
}; };
// Unit name // Unit name
_unit setName format["[DMS %1 %2 Unit %3]",toUpper _side,_class,floor(random 1000)]; _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 if !(_class in DMS_ai_SupportedClasses) exitWith
{ {
@ -157,6 +153,18 @@ if (!_useCustomGear) then
} forEach (missionNamespace getVariable [format ["DMS_%1_equipment",_class],[]]); } forEach (missionNamespace getVariable [format ["DMS_%1_equipment",_class],[]]);
// 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],0];
for "_i" from 1 to _randItemCount do
{
_unit addItem (selectRandom _randItems);
};
};
// Items (Loot stuff that goes in uniform/vest/backpack) // Items (Loot stuff that goes in uniform/vest/backpack)
{_unit addItem _x;} forEach (missionNamespace getVariable [format ["DMS_%1_items",_class],[]]); {_unit addItem _x;} forEach (missionNamespace getVariable [format ["DMS_%1_items",_class],[]]);
@ -168,7 +176,7 @@ if (!_useCustomGear) then
_unit addBackpackGlobal (selectRandom (missionNamespace getVariable [format ["DMS_%1_backpacks",_class],DMS_assault_backpacks])); _unit addBackpackGlobal (selectRandom (missionNamespace getVariable [format ["DMS_%1_backpacks",_class],DMS_assault_backpacks]));
// Make AI effective at night // Make AI effective at night
_nighttime = (sunOrMoon != 1); private _nighttime = (sunOrMoon != 1);
if (_nighttime) then if (_nighttime) then
{ {
_unit linkItem "NVGoggles"; _unit linkItem "NVGoggles";
@ -176,7 +184,7 @@ if (!_useCustomGear) then
if (!_unarmed) then if (!_unarmed) then
{ {
_weapon = selectRandom (missionNamespace getVariable [format ["DMS_%1_weps",_class],DMS_assault_weps]); private _weapon = selectRandom (missionNamespace getVariable [format ["DMS_%1_weps",_class],DMS_assault_weps]);
[_unit, _weapon, 6 + floor(random 3)] call BIS_fnc_addWeapon; [_unit, _weapon, 6 + floor(random 3)] call BIS_fnc_addWeapon;
_unit selectWeapon _weapon; _unit selectWeapon _weapon;
@ -198,7 +206,7 @@ if (!_useCustomGear) then
if((random 100) <= (missionNamespace getVariable [format["DMS_%1_suppressor_chance",_class],0])) then if((random 100) <= (missionNamespace getVariable [format["DMS_%1_suppressor_chance",_class],0])) then
{ {
_suppressor = _weapon call DMS_fnc_FindSuppressor; private _suppressor = _weapon call DMS_fnc_FindSuppressor;
if(_suppressor != "") then if(_suppressor != "") then
{ {
_unit addPrimaryWeaponItem _suppressor; _unit addPrimaryWeaponItem _suppressor;
@ -216,10 +224,10 @@ if (!_useCustomGear) then
[_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 BIS_fnc_addWeapon;
}; };
_pistols = missionNamespace getVariable [format ["DMS_%1_pistols",_class],[]]; private _pistols = missionNamespace getVariable [format ["DMS_%1_pistols",_class],[]];
if !(_pistols isEqualTo []) then if !(_pistols isEqualTo []) then
{ {
_pistol = selectRandom _pistols; private _pistol = selectRandom _pistols;
[_unit, _pistol, 2 + floor(random 2)] call BIS_fnc_addWeapon; [_unit, _pistol, 2 + floor(random 2)] call BIS_fnc_addWeapon;
}; };
@ -281,28 +289,6 @@ else
}; };
// 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 // Add pistol and attachments
if !(_pistol isEqualTo "") then if !(_pistol isEqualTo "") then
{ {
@ -325,6 +311,42 @@ else
_unit selectWeapon _weapon; _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;
}; };
{ {

View File

@ -21,9 +21,6 @@
Returns an array of static gun objects. Returns an array of static gun objects.
*/ */
private ["_OK", "_guns", "_pos", "_MGClassInput", "_MGClass", "_gun", "_unit", "_group", "_class", "_difficulty", "_side", "_positions"];
if !(params if !(params
[ [
["_positions",[],[[]]], ["_positions",[],[[]]],
@ -37,34 +34,35 @@ exitWith
diag_log format ["DMS ERROR :: Calling DMS_fnc_SpawnAIStaticMG with invalid parameters: %1",_this]; diag_log format ["DMS ERROR :: Calling DMS_fnc_SpawnAIStaticMG with invalid parameters: %1",_this];
}; };
_MGClassInput = "random"; private _MGClassInput =
if ((count _this)>5) then if ((count _this)>5) then
{
param [5];
}
else
{
"random"
};
private _guns = _positions apply
{ {
_MGClassInput = param [5,"random",[""]]; private _MGClass = _MGClassInput;
};
_guns = [];
{
_pos = _x;
_MGClass = _MGClassInput;
if (_MGClass == "random") then if (_MGClass == "random") then
{ {
_MGClass = selectRandom DMS_static_weapons; _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 setDir (random 360);
_gun setPosATL _pos; _gun setPosATL _x;
_gun lock 2; _gun lock 2;
_group addVehicle _gun; _group addVehicle _gun;
_guns pushBack _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; _unit moveInGunner _gun;
reload _unit; reload _unit;
@ -72,9 +70,10 @@ _guns = [];
if (DMS_DEBUG) then 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 if (DMS_DEBUG) then

View File

@ -18,9 +18,6 @@
Returns the spawned vehicle. Returns the spawned vehicle.
*/ */
private ["_OK", "_positions", "_veh", "_spawnPos", "_vehClass", "_driver", "_gunner", "_group", "_class", "_difficulty", "_side", "_crewCount"];
if !(params if !(params
[ [
["_positions",[],[[]],[1,2]], ["_positions",[],[[]],[1,2]],
@ -45,7 +42,7 @@ exitWith
diag_log format ["DMS ERROR :: Calling DMS_fnc_SpawnAIVehicle with invalid _positions parameters: %1",_positions]; diag_log format ["DMS ERROR :: Calling DMS_fnc_SpawnAIVehicle with invalid _positions parameters: %1",_positions];
}; };
_vehClass = private _vehClass =
if ((count _this)>5) then if ((count _this)>5) then
{ {
param [5,"random",[""]] param [5,"random",[""]]
@ -61,18 +58,18 @@ if (_vehClass == "random") then
}; };
_veh = createVehicle [_vehClass, _spawnPos, [], 0, "NONE"]; private _veh = createVehicle [_vehClass, _spawnPos, [], 0, "NONE"];
_veh setFuel 1; _veh setFuel 1;
_veh engineOn true; _veh engineOn true;
_veh lock 2; _veh lock 2;
_group addVehicle _veh; _group addVehicle _veh;
_driver = [_group,_spawnPos,_class,_difficulty,_side,"Vehicle"] call DMS_fnc_SpawnAISoldier; private _driver = [_group,_spawnPos,_class,_difficulty,_side,"Vehicle"] call DMS_fnc_SpawnAISoldier;
_driver moveInDriver _veh; _driver moveInDriver _veh;
_driver setVariable ["DMS_AssignedVeh",_veh]; _driver setVariable ["DMS_AssignedVeh",_veh];
_crewCount = private _crewCount =
{ {
private _unit = [_group,_spawnPos,_class,_difficulty,_side,"Vehicle"] call DMS_fnc_SpawnAISoldier; private _unit = [_group,_spawnPos,_class,_difficulty,_side,"Vehicle"] call DMS_fnc_SpawnAISoldier;
_unit moveInTurret [_veh, _x]; _unit moveInTurret [_veh, _x];
@ -86,4 +83,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; (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 _veh

View File

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

View File

@ -12,9 +12,6 @@
*/ */
private ["_crateClassName", "_pos", "_crate"];
if !(params if !(params
[ [
["_crateClassName","_crateClassName ERROR",[""]], ["_crateClassName","_crateClassName ERROR",[""]],
@ -32,9 +29,9 @@ if !(isClass (configFile >> "CfgVehicles" >> _crateClassName)) exitWith
objNull 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); _crate setDir (random 360);
@ -61,4 +58,4 @@ if (DMS_HideBox) then
_crate hideObjectGlobal true; _crate hideObjectGlobal true;
}; };
_crate; _crate;

View File

@ -21,7 +21,7 @@
Returns the index of the paratrooper info in "DMS_HeliParatrooper_Arr", -1 on error. 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"]; private ["_pilot", "_paratrooperCount", "_unit", "_cargoIndex"];
if !(params if !(params
@ -47,7 +47,7 @@ if (isNull _AIGroup) exitWith
-1 -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. // Make the AI group local to add passengers.
if !(local _AIGroup) then if !(local _AIGroup) then
@ -57,7 +57,7 @@ if !(local _AIGroup) then
}; };
// Get the spawn position for the heli // Get the spawn position for the heli
_spawnPos = private _spawnPos =
if ((count _this)>9) then if ((count _this)>9) then
{ {
_this param [9, [0,0,0], [[]], [2,3]] _this param [9, [0,0,0], [[]], [2,3]]
@ -86,7 +86,7 @@ _spawnPos set [2,DMS_RHeli_Height];
// Spawn the heli // Spawn the heli
_heli = createVehicle [_heliClass, _spawnPos, [], 0, "FLY"]; private _heli = createVehicle [_heliClass, _spawnPos, [], 0, "FLY"];
_heli setFuel 1; _heli setFuel 1;
_heli engineOn true; _heli engineOn true;
_heli lock 2; _heli lock 2;
@ -95,9 +95,8 @@ _AIGroup addVehicle _heli;
// Spawn the AI paratroopers // Spawn the AI paratroopers
_units = []; private _paratrooperCount = 0;
_paratrooperCount = 0; private _units = (fullCrew [_heli, "", true]) apply
_crewCount =
{ {
_x params _x params
[ [
@ -150,10 +149,9 @@ _crewCount =
}; };
}; };
}; };
_units pushBack _unit;
true _unit
} count (fullCrew [_heli, "", true]); };
// Set the heli pilot's behavior. // Set the heli pilot's behavior.
@ -171,7 +169,7 @@ if !(isNil "_groupOwner") then
if (DMS_DEBUG) 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. // Add the necessary information to the monitor.

View File

@ -12,10 +12,7 @@
] call DMS_fnc_SpawnMinefield; ] call DMS_fnc_SpawnMinefield;
*/ */
private ["_centerPos", "_difficulty", "_side", "_mines", "_minesInfo", "_AISide", "_mineCount", "_radius", "_randDirOffset", "_sign"]; private _mines = [];
_mines = [];
if (DMS_SpawnMinesAroundMissions) then if (DMS_SpawnMinesAroundMissions) then
{ {
@ -49,17 +46,21 @@ if (DMS_SpawnMinesAroundMissions) then
}; };
_minesInfo = _difficulty; private _minesInfo =
if (_difficulty isEqualType "") then if (_difficulty isEqualType "") then
{ {
_minesInfo = missionNamespace getVariable [format ["DMS_MineInfo_%1", _difficulty], [10,50]]; _minesInfo = 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; private _mineCount = _minesInfo select 0;
_radius = _minesInfo select 1; private _radius = _minesInfo select 1;
for "_i" from 1 to _mineCount do for "_i" from 1 to _mineCount do
@ -87,10 +88,10 @@ if (DMS_SpawnMinesAroundMissions) then
if (_spawnWarningSign) then if (_spawnWarningSign) then
{ {
_randDirOffset = random 45; private _randDirOffset = random 45;
for "_i" from 0 to 359 step 90 do 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 setDir (180+_i);
_sign setPosATL (_centerPos getPos [_radius+2, _randDirOffset+_i]); _sign setPosATL (_centerPos getPos [_radius+2, _randDirOffset+_i]);
_sign setVectorUp [0,0,1]; _sign setVectorUp [0,0,1];

View File

@ -6,14 +6,14 @@
It will also apply all regular Exile EventHandlers, as well as an additional "RopeAttach" EventHandler that will enable simulation on a vehicle that is about to be lifted to prevent issues. (Only for helis) It will also apply all regular Exile EventHandlers, as well as an additional "RopeAttach" EventHandler that will enable simulation on a vehicle that is about to be lifted to prevent issues. (Only for helis)
The vehicle is LOCKED, has godmode, disabled simulation, and is not able to be slingloaded on spawn. The vehicle is LOCKED, has godmode, disabled simulation, and is not able to be slingloaded on spawn.
NOTE: This function only takes ATL, and will not necessarily spawn directly on the given pos. It will attempt to find a clear position for the given vehicle, and then spawn it at the "clear" position. NOTE: This function only takes ATL, and will not necessarily spawn directly on the given pos. It will attempt to find a clear position for the given vehicle, and then spawn it at the "clear" position.
If you want the vehicle to be placed precisely at the position provided, you will have to do a setPosXXX at that position on the vehicle after spawning. If you want the vehicle to be placed precisely at the position provided, you will have to do a setPosXXX at that position on the vehicle after spawning.
Created by Zupa Created by Zupa
Edited by eraser1 Edited by eraser1
Usage: Usage:
[ [
_vehicleClass, // STRING: Classname of the vehicle _vehicleClass, // STRING: Classname of the vehicle
_pos // ARRAY: Position to spawn it at (roughly) _pos // ARRAY: Position to spawn it at (roughly)
@ -26,9 +26,6 @@
*/ */
private ["_vehicleClass","_position","_vehpos","_maxDistance","_vehObj"];
if !(params if !(params
[ [
["_vehicleClass","",[""]], ["_vehicleClass","",[""]],
@ -46,8 +43,8 @@ if !(isClass (configFile >> "CfgVehicles" >> _vehicleClass)) exitWith
objNull objNull
}; };
_vehpos = []; private _vehpos = [];
_maxDistance = 5; private _maxDistance = 5;
while{count _vehpos < 1} do while{count _vehpos < 1} do
{ {
@ -57,22 +54,22 @@ while{count _vehpos < 1} do
_vehpos set [2, 0.1]; _vehpos set [2, 0.1];
_vehObj = createVehicle [_vehicleClass, _vehpos, [], 0, "CAN_COLLIDE"]; private _vehObj = createVehicle [_vehicleClass, _vehpos, [], 0, "CAN_COLLIDE"];
clearBackpackCargoGlobal _vehObj; clearBackpackCargoGlobal _vehObj;
clearItemCargoGlobal _vehObj; clearItemCargoGlobal _vehObj;
clearMagazineCargoGlobal _vehObj; clearMagazineCargoGlobal _vehObj;
clearWeaponCargoGlobal _vehObj; clearWeaponCargoGlobal _vehObj;
if (_vehicleClass isKindOf "I_UGV_01_F") then if (_vehicleClass isKindOf "I_UGV_01_F") then
{ {
createVehicleCrew _vehObj; createVehicleCrew _vehObj;
}; };
if (getNumber (configFile >> "CfgSettings" >> "VehicleSpawn" >> "nightVision") isEqualTo 0) then if (getNumber (configFile >> "CfgSettings" >> "VehicleSpawn" >> "nightVision") isEqualTo 0) then
{ {
_vehObj disableNVGEquipment true; _vehObj disableNVGEquipment true;
}; };
if (getNumber (configFile >> "CfgSettings" >> "VehicleSpawn" >> "thermalVision") isEqualTo 0) then if (getNumber (configFile >> "CfgSettings" >> "VehicleSpawn" >> "thermalVision") isEqualTo 0) then
{ {
_vehObj disableTIEquipment true; _vehObj disableTIEquipment true;
}; };
@ -90,7 +87,7 @@ _vehObj addMPEventHandler ["MPKilled", { if !(isServer) exitWith {}; _this call
_vehObj addEventHandler ["GetIn", {_this call ExileServer_object_vehicle_event_onGetIn}]; _vehObj addEventHandler ["GetIn", {_this call ExileServer_object_vehicle_event_onGetIn}];
if (_vehObj isKindOf "Helicopter") then if (_vehObj isKindOf "Helicopter") then
{ {
_vehObj addEventHandler ["RopeAttach", _vehObj addEventHandler ["RopeAttach",
{ {
private "_vehicle"; private "_vehicle";
_vehicle = _this select 2; _vehicle = _this select 2;

View File

@ -13,11 +13,7 @@
Returns the created vehicle object. Returns the created vehicle object.
*/ */
private _vehObj = objNull;
private ["_vehicleClass", "_pos", "_pinCode", "_vehObj"];
_vehObj = objNull;
try try
{ {
@ -80,7 +76,7 @@ try
throw (format ["invalid STRING _pinCode value (must be 4 digits): %1",_pinCode]); 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 // Create and set the vehicle
_vehObj = [_vehicleClass,_pos] call DMS_fnc_SpawnNonPersistentVehicle; _vehObj = [_vehicleClass,_pos] call DMS_fnc_SpawnNonPersistentVehicle;
@ -114,5 +110,4 @@ catch
}; };
_vehObj _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. 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"]; private _mission =
_missionType = param [0, selectRandom DMS_StaticMissionTypesArray, [""]];
_mission =
[ [
missionNamespace getVariable format missionNamespace getVariable format
[ [
@ -41,11 +37,11 @@ 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; DMS_MissionCount = DMS_MissionCount + 1;
_return = _parameters call _mission; private _return = _parameters call _mission;
if ((!isNil "_return") && {_return isEqualTo "delay"}) exitWith if ((!isNil "_return") && {_return isEqualTo "delay"}) exitWith
{ {

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!"; diag_log "DMS ERROR :: Calling DMS_TargetsKilled with empty array!";
}; };
private "_killed"; private _killed = false;
_killed = false;
try try
{ {
{ {
private ["_lastDistanceCheckTime", "_spawnPos"]; private _lastDistanceCheckTime = _x getVariable ["DMS_LastAIDistanceCheck",time];
private _pos = getPosWorld _x;
_lastDistanceCheckTime = _x getVariable ["DMS_LastAIDistanceCheck",time]; private _spawnPos = _x getVariable ["DMS_AISpawnPos",0];
_pos = getPosWorld _x;
_spawnPos = _x getVariable ["DMS_AISpawnPos",0];
if ((DMS_MaxAIDistance>0) && {!(_spawnPos isEqualTo 0)} && {((time - _lastDistanceCheckTime)>DMS_AIDistanceCheckFrequency) && {(_pos distance2D _spawnPos)>DMS_MaxAIDistance}}) then if ((DMS_MaxAIDistance>0) && {!(_spawnPos isEqualTo 0)} && {((time - _lastDistanceCheckTime)>DMS_AIDistanceCheckFrequency) && {(_pos distance2D _spawnPos)>DMS_MaxAIDistance}}) then
{ {

176
README.md
View File

@ -76,7 +76,7 @@ after "7 createVehicle"
## infiSTAR: ## infiSTAR:
* If you are using infiSTAR and want to keep ```_CGM = true;```, then set ```_UMW = true;```. * 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. * 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: ### Vilayer or other Game Server Providers Instructions:
@ -151,6 +151,35 @@ ___
___ ___
# Changelog: # Changelog:
### Test Branch:
#### 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
#### April 27, 2016 (6:45 PM CST-America): #### April 27, 2016 (6:45 PM CST-America):
* **NEW CONFIG VALUES** * **NEW CONFIG VALUES**
@ -180,75 +209,6 @@ ___
* Disable simulation on objects imported from M3Editor. (Thanks to [second_coming](http://www.exilemod.com/profile/60-second_coming/) for the tip). * 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). * 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): #### February 19, 2016 (5:45 PM CST-America):
* Fixed a minor typo with a variable (part of the new Humanity support by DonkeyPunch). * Fixed a minor typo with a variable (part of the new Humanity support by DonkeyPunch).
@ -565,7 +525,7 @@ ___
* Debug logs for "DMS_fnc_MissionsMonitor" will only output the mission name and the position, instead of all of the parameters. * 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_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. * "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): #### October 8, 2015 (7:15 PM CST-America):
@ -596,7 +556,7 @@ ___
* These changes should make it much easier for people to use DMS notification functions for other purposes. * 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. * 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. * 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). * 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. * 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) * Fixed typos in the "OnKilled" EH (didn't really affect anything)
@ -838,3 +798,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) * 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. * Define functions in config.cpp. This resulted in ALL FILES being changed to some degree.
* Fixed spawning Binocs and Rangefinders/Designators on AI. * 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