From e3d11a0aa54100d9284d558898fe483348aaed64 Mon Sep 17 00:00:00 2001 From: eraser1 Date: Fri, 6 May 2016 22:44:48 -0500 Subject: [PATCH 01/21] Initial Test Branch Commit Lots of optimizations... --- @ExileServer/addons/a3_dms/config.cpp | 8 +- @ExileServer/addons/a3_dms/config.sqf | 33 +++- .../addons/a3_dms/fn_DMS_postInit.sqf | 7 +- @ExileServer/addons/a3_dms/fn_DMS_preInit.sqf | 90 ++------- .../a3_dms/map_configs/chernarus_config.sqf | 8 +- .../a3_dms/scripts/fn_AILocalityManager.sqf | 79 +++----- .../a3_dms/scripts/fn_AddMissionToMonitor.sqf | 14 +- .../scripts/fn_AddMissionToMonitor_Static.sqf | 13 +- .../scripts/fn_BroadcastMissionStatus.sqf | 6 - .../addons/a3_dms/scripts/fn_CalcPos.sqf | 7 +- .../addons/a3_dms/scripts/fn_CleanUp.sqf | 11 +- .../a3_dms/scripts/fn_CleanUpManager.sqf | 2 - .../addons/a3_dms/scripts/fn_CreateMarker.sqf | 35 ++-- .../addons/a3_dms/scripts/fn_FillCrate.sqf | 34 ++-- .../addons/a3_dms/scripts/fn_FindSafePos.sqf | 58 +++--- .../a3_dms/scripts/fn_FindSafePos_InRange.sqf | 16 +- .../a3_dms/scripts/fn_FindSuppressor.sqf | 32 ++-- .../addons/a3_dms/scripts/fn_GetAllUnits.sqf | 8 +- .../addons/a3_dms/scripts/fn_GetCenter.sqf | 43 +++++ .../scripts/fn_GroupReinforcementsManager.sqf | 85 ++++----- .../scripts/fn_HeliParatroopers_Monitor.sqf | 4 +- .../a3_dms/scripts/fn_ImportFromM3E.sqf | 23 +-- .../a3_dms/scripts/fn_ImportFromM3E_3DEN.sqf | 60 ++++++ .../scripts/fn_ImportFromM3E_3DEN_Convert.sqf | 67 +++++++ .../scripts/fn_ImportFromM3E_3DEN_Static.sqf | 59 ++++++ .../scripts/fn_ImportFromM3E_Convert.sqf | 29 ++- .../scripts/fn_ImportFromM3E_Static.sqf | 22 +-- .../addons/a3_dms/scripts/fn_IsNearWater.sqf | 7 +- .../a3_dms/scripts/fn_IsPlayerNearby.sqf | 9 +- .../a3_dms/scripts/fn_IsValidPosition.sqf | 70 +++---- .../a3_dms/scripts/fn_MissionParams.sqf | 10 +- .../a3_dms/scripts/fn_MissionSuccessState.sqf | 11 +- .../scripts/fn_MissionsMonitor_Dynamic.sqf | 106 ++++++++--- .../scripts/fn_MissionsMonitor_Static.sqf | 101 ++++++---- .../addons/a3_dms/scripts/fn_OnKilled.sqf | 68 +++---- .../a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf | 53 +++--- .../a3_dms/scripts/fn_RemoveMarkers.sqf | 10 +- .../a3_dms/scripts/fn_SelectMagazine.sqf | 7 +- .../a3_dms/scripts/fn_SelectMission.sqf | 12 +- .../a3_dms/scripts/fn_SelectOffsetPos.sqf | 3 - .../a3_dms/scripts/fn_SelectRandomVal.sqf | 7 +- .../a3_dms/scripts/fn_SetAILocality.sqf | 19 +- .../a3_dms/scripts/fn_SetGroupBehavior.sqf | 14 +- .../scripts/fn_SetGroupBehavior_Separate.sqf | 6 +- .../a3_dms/scripts/fn_SetRelPositions.sqf | 42 +++++ .../addons/a3_dms/scripts/fn_SpawnAIGroup.sqf | 12 +- .../scripts/fn_SpawnAIGroup_MultiPos.sqf | 16 +- .../a3_dms/scripts/fn_SpawnAISoldier.sqf | 94 ++++++---- .../a3_dms/scripts/fn_SpawnAIStaticMG.sqf | 39 ++-- .../a3_dms/scripts/fn_SpawnAIVehicle.sqf | 12 +- .../a3_dms/scripts/fn_SpawnBanditMission.sqf | 9 +- .../addons/a3_dms/scripts/fn_SpawnCrate.sqf | 9 +- .../scripts/fn_SpawnHeliReinforcement.sqf | 20 +- .../a3_dms/scripts/fn_SpawnMinefield.sqf | 29 +-- .../scripts/fn_SpawnNonPersistentVehicle.sqf | 23 +-- .../scripts/fn_SpawnPersistentVehicle.sqf | 9 +- .../a3_dms/scripts/fn_SpawnStaticMission.sqf | 12 +- .../addons/a3_dms/scripts/fn_SubArr.sqf | 54 ++++++ .../a3_dms/scripts/fn_TargetsKilled.sqf | 12 +- README.md | 176 +++++++++++------- 60 files changed, 1086 insertions(+), 848 deletions(-) create mode 100644 @ExileServer/addons/a3_dms/scripts/fn_GetCenter.sqf create mode 100644 @ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_3DEN.sqf create mode 100644 @ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_3DEN_Convert.sqf create mode 100644 @ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_3DEN_Static.sqf create mode 100644 @ExileServer/addons/a3_dms/scripts/fn_SetRelPositions.sqf create mode 100644 @ExileServer/addons/a3_dms/scripts/fn_SubArr.sqf diff --git a/@ExileServer/addons/a3_dms/config.cpp b/@ExileServer/addons/a3_dms/config.cpp index 898ac8f..12aae08 100644 --- a/@ExileServer/addons/a3_dms/config.cpp +++ b/@ExileServer/addons/a3_dms/config.cpp @@ -4,7 +4,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; - a3_DMS_version = "April 27, 2016"; + a3_DMS_version = "May 6, 2016 (TEST)"; requiredVersion = 1.36; requiredAddons[] = {"exile_client","exile_server_config"}; }; @@ -42,6 +42,7 @@ class CfgFunctions class FindSafePos_InRange {}; class FindSuppressor {}; class GetAllUnits {}; + class GetCenter {}; class GetEmptySeats {}; class GroupReinforcementsManager {}; //class HandleMissionEvents {}; @@ -50,6 +51,9 @@ class CfgFunctions class ImportFromM3E {}; class ImportFromM3E_Convert {}; class ImportFromM3E_Static {}; + class ImportFromM3E_3DEN {}; + class ImportFromM3E_3DEN_Convert {}; + class ImportFromM3E_3DEN_Static {}; class IsPlayerNearby {}; class IsNearWater {}; class IsValidPosition {}; @@ -68,6 +72,7 @@ class CfgFunctions class SetAILocality {}; class SetGroupBehavior {}; class SetGroupBehavior_Separate {}; + class SetRelPositions {}; class SpawnAIGroup {}; class SpawnAIGroup_MultiPos {}; class SpawnAIVehicle {}; @@ -80,6 +85,7 @@ class CfgFunctions class SpawnNonPersistentVehicle {}; class SpawnPersistentVehicle {}; class SpawnStaticMission {}; + class SubArr {}; class TargetsKilled {}; }; }; diff --git a/@ExileServer/addons/a3_dms/config.sqf b/@ExileServer/addons/a3_dms/config.sqf index 34e246b..19ee0e5 100644 --- a/@ExileServer/addons/a3_dms/config.sqf +++ b/@ExileServer/addons/a3_dms/config.sqf @@ -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. - //["saltflats",1], //<--Example (already imported by default on Altis) - //["slums",1] //<--Example (already imported by default on Altis) + //["saltflats",1], //<--Example (already imported by default on Altis in map configs) + //["slums",1] //<--Example (already imported by default on Altis in map configs) //["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) "ItemGPS" ]; + DMS_assault_RandItemCount = 2; // How many random items to add to the AI's inventory. + DMS_assault_RandItems = [ // The random items that will be added to the AI's inventory. + "Exile_Item_Catfood_Cooked", + "Exile_Item_Surstromming_Cooked", + "Exile_Item_PowerDrink", + "Exile_Item_EnergyDrink", + "Exile_Item_Vishpirin", + "Exile_Item_Bandage" + ]; DMS_assault_helmets = [ // Helmets for Assault Class "H_HelmetSpecB_paint1", "H_HelmetIA_camo", @@ -516,6 +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) "Binocular" ]; + DMS_MG_RandItemCount = 3; // How many random items to add to the AI's inventory. + DMS_MG_RandItems = [ // The random items that will be added to the AI's inventory. + "Exile_Item_EMRE", + "Exile_Item_Surstromming_Cooked", + "Exile_Item_PowerDrink", + "Exile_Item_PlasticBottleCoffee", + "Exile_Item_Vishpirin", + "Exile_Item_Instadoc" + ]; DMS_MG_helmets = [ // Helmets for MG Class "H_PilotHelmetHeli_I", "H_PilotHelmetHeli_O", @@ -602,6 +620,13 @@ DMS_SpawnMissions_Scheduled = false; // Whether or not to spawn missions in a sc "Rangefinder", "ItemGPS" ]; + DMS_sniper_RandItemCount = 3; // How many random items to add to the AI's inventory. + DMS_sniper_RandItems = [ // The random items that will be added to the AI's inventory. + "Exile_Item_EMRE", + "Exile_Item_PlasticBottleCoffee", + "Exile_Item_CanOpener", + "Exile_Item_Instadoc" + ]; DMS_sniper_helmets = [ // Helmets for Sniper Class "H_HelmetSpecB_paint1", "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_BBQSandwich_Cooked", "Exile_Item_Catfood_Cooked", - "Exile_Item_DogFood_Cooked" + "Exile_Item_DogFood_Cooked", + "Exile_Item_EMRE", + "Exile_Item_EMRE" ]; DMS_BoxDrinks = [ "Exile_Item_PlasticBottleCoffee", diff --git a/@ExileServer/addons/a3_dms/fn_DMS_postInit.sqf b/@ExileServer/addons/a3_dms/fn_DMS_postInit.sqf index f7b6db8..b04b591 100644 --- a/@ExileServer/addons/a3_dms/fn_DMS_postInit.sqf +++ b/@ExileServer/addons/a3_dms/fn_DMS_postInit.sqf @@ -221,9 +221,12 @@ if (DMS_ShowDifficultyColorLegend) then [_x] call DMS_fnc_SpawnBanditMission; } 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. diff --git a/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf b/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf index 685b346..c2f1e89 100644 --- a/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf +++ b/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf @@ -2,6 +2,7 @@ DMS Pre-init Written by eraser1 (trainwreckdayz.com) */ +#define CALLFILE(FILE) call compile preprocessFileLineNumbers FILE; DMS_HC_Object = objNull; @@ -11,13 +12,21 @@ DMS_Version = getText (configFile >> "CfgPatches" >> "a3_dms" >> "a3_DMS_version //Load main config -call compileFinal preprocessFileLineNumbers "\x\addons\dms\config.sqf"; +CALLFILE("\x\addons\dms\config.sqf"); //Load map-specific configs. Should make it easier for people with multiple servers/maps. One PBO to rule them all... if (DMS_Use_Map_Config) then { - call compileFinal preprocessFileLineNumbers (format ["\x\addons\dms\map_configs\%1_config.sqf",toLower worldName]); + private _file = preprocessFileLineNumbers (format ["\x\addons\dms\map_configs\%1_config.sqf",toLower worldName]); + if (_file isEqualTo "") then + { + 'You need to set the config value "DMS_Use_Map_Config" to false!' call DMS_fnc_DebugLog; + } + else + { + call compile _file; + }; }; DMS_MagRange = DMS_MaximumMagCount - DMS_MinimumMagCount; @@ -29,79 +38,10 @@ DMS_MagRange = DMS_MaximumMagCount - DMS_MinimumMagCount; Slightly modified by eraser1 */ -M3E_fnc_getCenter = -{ - private ['_objects', '_ax', '_ay', '_az', '_xs', '_xc', '_xz', '_ys', '_yc', '_yz', '_zs', '_zc', '_zz']; - _objects = [_this, 0, [], [[]]] call BIS_fnc_param; - _ax = []; - _ay = []; - _az = []; - { - private ['_position']; - _position = getPosATL _x; - _ax pushBack (_position select 0); - _ay pushBack (_position select 1); - _az pushBack (_position select 2); - } foreach _objects; - _xs = 0; - _xc = {_xs = _xs + _x; true} count _ax; - _xz = _xs / _xc; +M3E_fnc_getCenter = DMS_fnc_GetCenter; - _ys = 0; - _yc = {_ys = _ys + _x; true} count _ay; - _yz = _ys / _yc; +M3E_fnc_subArr = DMS_fnc_SubArr; - _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; @@ -110,5 +50,5 @@ DMS_HeliParatrooper_Arr = []; // Initialize mission variables... -call compileFinal preprocessFileLineNumbers "\x\addons\dms\missions\static_init.sqf"; -call compileFinal preprocessFileLineNumbers "\x\addons\dms\missions\mission_init.sqf"; +CALLFILE("\x\addons\dms\missions\static_init.sqf"); +CALLFILE("\x\addons\dms\missions\mission_init.sqf"); diff --git a/@ExileServer/addons/a3_dms/map_configs/chernarus_config.sqf b/@ExileServer/addons/a3_dms/map_configs/chernarus_config.sqf index 33d6648..47e5179 100644 --- a/@ExileServer/addons/a3_dms/map_configs/chernarus_config.sqf +++ b/@ExileServer/addons/a3_dms/map_configs/chernarus_config.sqf @@ -11,7 +11,7 @@ DMS_findSafePosBlacklist = // Making these configs below as strict as possible will help in reducing the number of attempts taken to find a valid position, and as a result, improve performance. -DMS_MinDistFromWestBorder = 250; -DMS_MinDistFromEastBorder = 250; -DMS_MinDistFromSouthBorder = 500; -DMS_MinDistFromNorthBorder = 400; \ No newline at end of file +DMS_MinDistFromWestBorder = 750; +DMS_MinDistFromEastBorder = 2500; +DMS_MinDistFromSouthBorder = 3500; +DMS_MinDistFromNorthBorder = 1000; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_AILocalityManager.sqf b/@ExileServer/addons/a3_dms/scripts/fn_AILocalityManager.sqf index 87ada13..a93f711 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_AILocalityManager.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_AILocalityManager.sqf @@ -2,68 +2,47 @@ DMS_fnc_AILocalityManager Created by Defent and eraser1 - Offloads AI groups to a nearby client or HC in order to improve server performance. + Offloads AI groups to a nearby client in order to improve server performance. */ - -if (!DMS_ai_offload_to_client && {isNull DMS_HC_Object}) exitWith {}; +if (!DMS_ai_offload_to_client) exitWith {}; { if (((count (units _x))>1) && {!((DMS_ai_offload_Only_DMS_AI && {!(_x getVariable ["DMS_SpawnedGroup",false])}) || {(_x getVariable ["DMS_LockLocality",false])})}) then { - private ["_leader", "_group", "_owner"]; - _leader = leader _x; - _group = _x; - _groupOwner = groupOwner _group; + private _leader = leader _x; + private _group = _x; 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 { - (format ["AILocalityManager :: DMS_HC_Object is null! Finding owner for group: %1",_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; - }; + (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; }; }; }; }; -} forEach allGroups; \ No newline at end of file +} forEach allGroups; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor.sqf b/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor.sqf index c096469..4f3dfb2 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor.sqf @@ -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"]; - - -_added = false; - +private _added = false; if !(params [ @@ -82,7 +78,7 @@ exitWith false; }; -_onEndingScripts = if ((count _this)>10) then {_this select 10} else {[[],[],{},{}]}; +private _onEndingScripts = if ((count _this)>10) then {_this select 10} else {[[],[],{},{}]}; try @@ -114,7 +110,7 @@ try throw format["_missionObjs |%1|",_missionObjs]; }; - _mines = + private _mines = if ((count _missionObjs)>3) then { _missionObjs param [3,[],[[]]] @@ -156,7 +152,7 @@ try throw format["_onEndingScripts |%1|",_onEndingScripts]; }; - _arr = + private _arr = [ _pos, _completionInfo, @@ -192,7 +188,7 @@ try if (DMS_MarkerText_ShowAICount) then { - _markerDot = _markers select 0; + private _markerDot = _markers select 0; _markerDot setMarkerText (format ["%1 (%2 %3 remaining)",markerText _markerDot,count _units,DMS_MarkerText_AIName]); }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor_Static.sqf b/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor_Static.sqf index 0fce46b..5e3818c 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor_Static.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor_Static.sqf @@ -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"]; - - -_added = false; +private _added = false; if !(params [ @@ -92,7 +89,7 @@ exitWith false; }; -_onEndingScripts = if ((count _this)>11) then {_this select 11} else {[[],[],{},{}]}; +private _onEndingScripts = if ((count _this)>11) then {_this select 11} else {[[],[],{},{}]}; try @@ -124,7 +121,7 @@ try throw format["_missionObjs |%1|",_missionObjs]; }; - _mines = if ((count _missionObjs)>3) then { _missionObjs param [3,[],[[]]] } else { [] }; + private _mines = if ((count _missionObjs)>3) then { _missionObjs param [3,[],[[]]] } else { [] }; // Don't spawn a minefield if there is one already defined in _missionObjs. if (DMS_SpawnMinefieldForEveryMission && {_mines isEqualTo []}) then @@ -157,7 +154,7 @@ try throw format["_onEndingScripts |%1|",_onEndingScripts]; }; - _arr = + private _arr = [ _pos, _completionInfo, @@ -194,7 +191,7 @@ try if (DMS_MarkerText_ShowAICount_Static) then { - _markerDot = _markers select 0; + private _markerDot = _markers select 0; _markerDot setMarkerText (format ["%1 (%2 %3 remaining)",markerText _markerDot,count (_units call DMS_fnc_GetAllUnits),DMS_MarkerText_AIName]); }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_BroadcastMissionStatus.sqf b/@ExileServer/addons/a3_dms/scripts/fn_BroadcastMissionStatus.sqf index 33e851c..a89b120 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_BroadcastMissionStatus.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_BroadcastMissionStatus.sqf @@ -14,10 +14,6 @@ Returns nothing */ - -private ["_missionName", "_messageInfo", "_titleColor", "_message"]; - - if !(params [ ["_missionName","",[""]], @@ -47,8 +43,6 @@ if !(_message isEqualType "") then if (_message isEqualTo "") exitWith {}; { - private "_args"; - switch (toLower _x) do { case "systemchatrequest": diff --git a/@ExileServer/addons/a3_dms/scripts/fn_CalcPos.sqf b/@ExileServer/addons/a3_dms/scripts/fn_CalcPos.sqf index cb963b7..f4512c8 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_CalcPos.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_CalcPos.sqf @@ -11,11 +11,6 @@ Returns the absolute position from the provided relative position from the provided center position or object. */ - -private ["_pos", "_relPos", "_npos"]; - - - if !(params [ ["_pos","",[[],objNull],[2,3]], @@ -47,4 +42,4 @@ if ((count _relPos)<3) then }; // Script command "vectorAdd" is much faster than adding each element manually. -_pos vectorAdd _relPos \ No newline at end of file +_pos vectorAdd _relPos diff --git a/@ExileServer/addons/a3_dms/scripts/fn_CleanUp.sqf b/@ExileServer/addons/a3_dms/scripts/fn_CleanUp.sqf index 3ae5c9f..af0b6d3 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_CleanUp.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_CleanUp.sqf @@ -14,7 +14,6 @@ _objectOrGroup call DMS_fnc_CleanUp; */ - if (DMS_DEBUG) then { (format ["CleanUp :: CLEANING UP: %1",_this]) call DMS_fnc_DebugLog; @@ -25,14 +24,10 @@ if !(_this isEqualType []) then _this = [_this]; }; -private ["_skippedObjects"]; - -_skippedObjects = []; - +private _skippedObjects = []; { - private ["_parameter"]; - _parameter = _x; + private _parameter = _x; switch (typeName _parameter) do { @@ -95,4 +90,4 @@ _skippedObjects = []; if !(_skippedObjects isEqualTo []) then { DMS_CleanUpList pushBack [_skippedObjects,diag_tickTime,30]; -}; \ No newline at end of file +}; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_CleanUpManager.sqf b/@ExileServer/addons/a3_dms/scripts/fn_CleanUpManager.sqf index 2e32e3a..f639bd5 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_CleanUpManager.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_CleanUpManager.sqf @@ -24,8 +24,6 @@ (format ["CleanUpManager :: Checking Cleaning Status for: %1",_x]) call DMS_fnc_DebugLog; }; - private ["_objs","_timeAddedToList","_timeUntilClean"]; - if !(_x params [ diff --git a/@ExileServer/addons/a3_dms/scripts/fn_CreateMarker.sqf b/@ExileServer/addons/a3_dms/scripts/fn_CreateMarker.sqf index 5f7627b..9d2ba1f 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_CreateMarker.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_CreateMarker.sqf @@ -18,10 +18,6 @@ */ - -private["_pos", "_text", "_difficulty", "_randomMarker", "_num", "_color", "_dot", "_circle", "_dir", "_dis", "_npos"]; - - params [ ["_pos","ERROR",[[]],[2,3]], @@ -37,7 +33,7 @@ if ((_pos isEqualTo "ERROR") || ("_text" isEqualTo "ERROR")) exitWith }; -_randomMarker = +private _randomMarker = if ((count _this)>3) then { _this select 3; @@ -47,16 +43,17 @@ _randomMarker = DMS_MarkerPosRandomization; }; -_num = DMS_MissionCount; +private _num = DMS_MissionCount; -switch (_difficulty) do -{ - case "easy": {_color = "ColorGreen";}; - case "moderate": {_color = "ColorYellow";}; - case "difficult": {_color = "ColorRed";}; - case "hardcore" : {_color = "ColorBlack";}; - default {_color = _difficulty;}; -}; +private _color = + switch (_difficulty) do + { + case "easy": {"ColorGreen";}; + case "moderate": {"ColorYellow";}; + case "difficult": {"ColorRed";}; + case "hardcore" : {"ColorBlack";}; + default {_difficulty;}; + }; if !((toLower _color) in DMS_A3_AllMarkerColors) then { @@ -64,13 +61,13 @@ if !((toLower _color) in DMS_A3_AllMarkerColors) then _color = "ColorRed"; }; -_circle = createMarker [format ["DMS_MissionMarkerCircle%1_%2",_num,round(time)], _pos]; +private _circle = createMarker [format ["DMS_MissionMarkerCircle%1_%2",_num,round(time)], _pos]; _circle setMarkerColor _color; _circle setMarkerShape "ELLIPSE"; _circle setMarkerBrush "Solid"; _circle setMarkerSize [150,150]; -_dot = createMarker [format ["DMS_MissionMarkerDot%1_%2",_num,round(time)], _pos]; +private _dot = createMarker [format ["DMS_MissionMarkerDot%1_%2",_num,round(time)], _pos]; _dot setMarkerColor "ColorBlack"; _dot setMarkerType "mil_dot"; _dot setMarkerText _text; @@ -85,9 +82,9 @@ if (DMS_MarkerText_ShowMissionPrefix) then if (_randomMarker) then { - _dir = random 360; - _dis = DMS_MarkerPosRandomRadius call DMS_fnc_SelectRandomVal; - _npos = _pos getPos [_dis,_dir]; + private _dir = random 360; + private _dis = DMS_MarkerPosRandomRadius call DMS_fnc_SelectRandomVal; + private _npos = _pos getPos [_dis,_dir]; _circle setMarkerPos _npos; _dot setMarkerPos _npos; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf b/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf index ff79760..3d4e896 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf @@ -1,8 +1,8 @@ /* DMS_fnc_FillCrate - Original credit goes to WAI: https://github.com/nerdalertdk/WICKED-AI - Edited by eraser1 + Inspired by WAI: https://github.com/nerdalertdk/WICKED-AI + created by eraser1 Usage: [ @@ -86,10 +86,6 @@ ] */ -private ["_crate","_lootValues","_wepCount","_weps","_itemCount","_items","_backpackCount","_backpacks","_weapon","_ammo","_item","_backpack","_crateValues","_rareLootChance","_marker"]; - - - if (!(params [ ["_crate",objNull,[objNull]], @@ -118,6 +114,8 @@ if (_crate getVariable ["DMS_CrateEnableRope",DMS_EnableBoxMoving]) then if ((_lootValues isEqualType []) && {!((_lootValues select 1) isEqualType {})}) then { + private ["_wepCount", "_weps", "_itemCount", "_items", "_backpackCount", "_backpacks"]; + // Weapons 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 for "_i" from 1 to _wepCount do { - _weapon = selectRandom _weps; - _ammo = _weapon call DMS_fnc_selectMagazine; + private _weapon = selectRandom _weps; + private _ammo = _weapon call DMS_fnc_selectMagazine; if (_weapon isEqualType "") then { _weapon = [_weapon,1]; @@ -183,12 +181,12 @@ if ((_lootValues isEqualType []) && {!((_lootValues select 1) isEqualType {})}) }; - if ((_itemCount > 0) && {count _items>0}) then + if (count _items>0) then { // Add items for "_i" from 1 to _itemCount do { - _item = selectRandom _items; + private _item = selectRandom _items; if (_item isEqualType "") then { _item = [_item,1]; @@ -198,12 +196,12 @@ if ((_lootValues isEqualType []) && {!((_lootValues select 1) isEqualType {})}) }; - if ((_backpackCount > 0) && {count _backpacks>0}) then + if (count _backpacks>0) then { // Add backpacks for "_i" from 1 to _backpackCount do { - _backpack = selectRandom _backpacks; + private _backpack = selectRandom _backpacks; if (_backpack isEqualType "") then { _backpack = [_backpack,1]; @@ -214,7 +212,7 @@ if ((_lootValues isEqualType []) && {!((_lootValues select 1) isEqualType {})}) } else { - _crateValues = + private _crateValues = if (_lootValues isEqualType []) then { (_lootValues select 0) call (_lootValues select 1) @@ -272,7 +270,7 @@ else if (DMS_RareLoot) then { - _rareLootChance = + private _rareLootChance = if ((count _this)>2) then { _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. if (_crate getVariable ["DMS_AllowSmoke", true]) then { - if(DMS_SpawnBoxSmoke && {sunOrMoon == 1}) then + if (DMS_SpawnBoxSmoke && {sunOrMoon == 1}) then { - _marker = "SmokeShellPurple" createVehicle getPosATL _crate; + private _marker = "SmokeShellPurple" createVehicle getPosATL _crate; _marker setPosATL (getPosATL _crate); _marker attachTo [_crate,[0,0,0]]; }; if (DMS_SpawnBoxIRGrenade && {sunOrMoon != 1}) then { - _marker = "B_IRStrobe" createVehicle getPosATL _crate; + private _marker = "B_IRStrobe" createVehicle getPosATL _crate; _marker setPosATL (getPosATL _crate); _marker attachTo [_crate, [0,0,0.5]]; }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos.sqf b/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos.sqf index cf2526a..1d2dc52 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos.sqf @@ -16,12 +16,11 @@ _missionNearLimit, // NUMBER (distance): Minimum distance from another mission. _playerNearLimit, // NUMBER (distance): Minimum distance from a player. _throttleParams // BOOLEAN: Whether or not some of the distance values should be throttled on repeated attempts. - _waterSpawn // (OPTIONAL) BOOLEAN: Whether or not the mission is supposed to spawn on water. Default: false ] call DMS_fnc_findSafePos; */ +#define MAX_ATTEMPTS 5000 - -private ["_nearestObjectMinDistance", "_waterNearLimit", "_minSurfaceNormal", "_spawnZoneNearLimit", "_traderZoneNearLimit", "_missionNearLimit", "_playerNearLimit", "_territoryNearLimit", "_throttleParams", "_waterSpawn", "_isValidSpot", "_attempts", "_pos", "_restriction", "_generatePos", "_presetLocs", "_presetLocsLength"]; +private ["_pos", "_presetLocs", "_attempts"]; params [ @@ -44,14 +43,10 @@ if (!isNil "DMS_DebugMarkers") then 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 { // Shuffle the array so that the positions are selected in random order @@ -59,29 +54,18 @@ if (DMS_UsePredefinedMissionLocations) then _presetLocsLength = count _presetLocs; }; -_generatePos = + +for "_attempts" from 1 to MAX_ATTEMPTS do { - if (DMS_UsePredefinedMissionLocations && {_attempts<=_presetLocsLength}) then - { - _presetLocs select (_attempts - 1) - } - else - { - [DMS_MinMax_X_Coords call DMS_fnc_SelectRandomVal,DMS_MinMax_Y_Coords call DMS_fnc_SelectRandomVal] isFlatEmpty [_nearestObjectMinDistance, 0, 9999, 1, _restriction, _waterSpawn, objNull] - }; -}; - -while {!_isValidSpot} do -{ - _attempts = _attempts+1; - - - _pos = []; - - while {_pos isEqualTo []} do - { - _pos = call _generatePos; - }; + _pos = + if (DMS_UsePredefinedMissionLocations && {_attempts<=_presetLocsLength}) then + { + _presetLocs select (_attempts - 1) + } + else + { + [DMS_MinMax_X_Coords call DMS_fnc_SelectRandomVal,DMS_MinMax_Y_Coords call DMS_fnc_SelectRandomVal] isFlatEmpty [_nearestObjectMinDistance, 0, 9999, 1, 0, _waterSpawn, objNull] + }; /* _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 - { - diag_log format["DMS ERROR :: Number of attempts in DMS_fnc_findSafePos (%1) exceeded maximum number of attempts!",_attempts]; - }; + if (_isValidSpot) exitWith {}; +}; + +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]; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos_InRange.sqf b/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos_InRange.sqf index 609e204..86a5d3f 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos_InRange.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos_InRange.sqf @@ -19,8 +19,6 @@ Returns a position. */ -private ["_centerPos", "_distance", "_posParameters", "_original_x", "_original_y", "_original_Blacklist", "_center_x", "_center_y", "_usePresetOriginal", "_pos"]; - if !(params [ ["_centerPos", 0, [[]], [2,3]], @@ -35,13 +33,13 @@ exitWith }; // Save the original values -_original_x = DMS_MinMax_X_Coords; -_original_y = DMS_MinMax_Y_Coords; -_original_Blacklist = DMS_findSafePosBlacklist; +private _original_x = DMS_MinMax_X_Coords; +private _original_y = DMS_MinMax_Y_Coords; +private _original_Blacklist = DMS_findSafePosBlacklist; // Get the center values -_center_x = _centerPos select 0; -_center_y = _centerPos select 1; +private _center_x = _centerPos select 0; +private _center_y = _centerPos select 1; // Set the restrictions DMS_MinMax_X_Coords = [_center_x - _distanceMax, _center_x + _distanceMax]; @@ -62,11 +60,11 @@ DMS_findSafePosBlacklist = [] }; -_usePresetOriginal = DMS_UsePredefinedMissionLocations; +private _usePresetOriginal = DMS_UsePredefinedMissionLocations; DMS_UsePredefinedMissionLocations = false; // NOW we get the position (hopefully) -_pos = _posParameters call DMS_fnc_findSafePos; +private _pos = _posParameters call DMS_fnc_findSafePos; // Reset the original values DMS_MinMax_X_Coords = _original_x; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_FindSuppressor.sqf b/@ExileServer/addons/a3_dms/scripts/fn_FindSuppressor.sqf index 37d441c..d22cf83 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_FindSuppressor.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_FindSuppressor.sqf @@ -8,43 +8,37 @@ */ -private["_weapon","_result","_weaponName","_rnd338","_rnd93"]; +private _weapon = _this; -_result = ""; -_weapon = _this; +private _weaponName = getText (configFile >> "cfgWeapons" >> _weapon >> "displayName"); -_weaponName = getText (configFile >> "cfgWeapons" >> _weapon >> "displayName"); - switch (true) do { + // Zafir accepts no suppressors :( + case ((_weapon find "Zafir")>-1) : {""}; + case ((_weaponName find "6.5") > -1) : { if (_weapon find "LMG_Mk200" > -1) then { - _result = "muzzle_snds_H_MG"; + "muzzle_snds_H_MG"; } 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 diff --git a/@ExileServer/addons/a3_dms/scripts/fn_GetAllUnits.sqf b/@ExileServer/addons/a3_dms/scripts/fn_GetAllUnits.sqf index 1f60919..61b648a 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_GetAllUnits.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_GetAllUnits.sqf @@ -14,19 +14,15 @@ Returns all living units from a given array of groups or objects. */ -private ["_units"]; - if !(_this isEqualType []) then { _this = [_this]; }; - -_units = []; +private _units = []; { - private ["_parameter"]; - _parameter = _x; + private _parameter = _x; _units append ( diff --git a/@ExileServer/addons/a3_dms/scripts/fn_GetCenter.sqf b/@ExileServer/addons/a3_dms/scripts/fn_GetCenter.sqf new file mode 100644 index 0000000..727cabf --- /dev/null +++ b/@ExileServer/addons/a3_dms/scripts/fn_GetCenter.sqf @@ -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] diff --git a/@ExileServer/addons/a3_dms/scripts/fn_GroupReinforcementsManager.sqf b/@ExileServer/addons/a3_dms/scripts/fn_GroupReinforcementsManager.sqf index cdb832c..96d0495 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_GroupReinforcementsManager.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_GroupReinforcementsManager.sqf @@ -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). */ -private ["_AIGroup", "_reinforcementInfo", "_updateInfo", "_spawnLocations", "_class", "_difficulty", "_side", "_monitorType", "_monitorParams", "_wavesInfo", "_unitsInfo", "_maxReinforcementWaves", "_reinforcementWavesGiven", "_maxReinforcementUnits", "_reinforcementUnitsGiven", "_updateDelay", "_lastUpdated", "_fnc_isDepleted", "_reinforcementsDepleted"]; - // Check ALL the variables - if !(params [ ["_AIGroup", grpNull, [grpNull] ], @@ -198,30 +195,32 @@ _fnc_isDepleted = }; }; -_reinforcementsDepleted = call _fnc_isDepleted; +private _reinforcementsDepleted = call _fnc_isDepleted; if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) then { - private ["_remainingUnits", "_unitsToSpawn"]; + private "_unitsToSpawn"; - 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 + private _remainingUnits = + if (isNull _AIGroup) 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 @@ -233,8 +232,6 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the { case "playernear": { - private ["_posOrObj", "_radius", "_reinforcementCount", "_maxAICount"]; - if !(_monitorParams params [ ["_posOrObj", [], [objNull,[]], [2,3]], @@ -250,7 +247,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the if ([_posOrObj,_radius] call DMS_fnc_IsPlayerNearby) then { - _maxAICount = if ((count _monitorParams)>3) then {_monitorParams param [3, 0, [0]]} else {0}; + private _maxAICount = if ((count _monitorParams)>3) then {_monitorParams param [3, 0, [0]]} else {0}; _unitsToSpawn = _reinforcementCount min ((_maxAICount-_remainingUnits) max 0); }; @@ -258,8 +255,6 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the case "maintain": { - private "_AICount"; - if !(_monitorParams params [ ["_AICount", 0, [0]] @@ -279,8 +274,6 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the case "reinforce": { - private ["_AICount", "_reinforcementCount", "_maxAICount"]; - if !(_monitorParams params [ ["_AICount", 0, [0]], @@ -295,7 +288,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the if (_remainingUnits<_AICount) then { - _maxAICount = if ((count _monitorParams)>2) then {_monitorParams param [2, 0, [0]]} else {_AICount}; + private _maxAICount = if ((count _monitorParams)>2) then {_monitorParams param [2, 0, [0]]} else {_AICount}; _unitsToSpawn = _reinforcementCount min ((_maxAICount-_remainingUnits) max 0); }; @@ -303,8 +296,6 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the case "increasing_resistance": { - private ["_AICount", "_reinforcementCount", "_increment_AICount", "_maxAICount"]; - if !(_monitorParams params [ ["_AICount", 0, [0]], @@ -320,7 +311,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the if (_remainingUnits<_AICount) then { - _maxAICount = if ((count _monitorParams)>3) then {_monitorParams param [3, 0, [0]]} else {_AICount}; + private _maxAICount = if ((count _monitorParams)>3) then {_monitorParams param [3, 0, [0]]} else {_AICount}; _unitsToSpawn = _reinforcementCount min ((_maxAICount-_remainingUnits) max 0); @@ -330,8 +321,6 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the case "increasing_difficulty": { - private ["_AICount", "_reinforcementCount", "_maxAICount"]; - if !(_monitorParams params [ ["_AICount", 0, [0]], @@ -355,7 +344,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the case "hardcore": {"hardcore"}; }; - _maxAICount = if ((count _monitorParams)>3) then {_monitorParams param [3, 0, [0]]} else {_AICount}; + private _maxAICount = if ((count _monitorParams)>3) then {_monitorParams param [3, 0, [0]]} else {_AICount}; _unitsToSpawn = _reinforcementCount min ((_maxAICount-_remainingUnits) max 0); }; @@ -363,8 +352,6 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the case "armed_vehicle": { - private ["_AICount", "_vehClass", "_leaderPos", "_veh"]; - if !(_monitorParams params [ ["_AICount", 0, [0]] @@ -377,11 +364,11 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the if (_remainingUnits<_AICount) then { - _vehClass = if ((count _monitorParams)>1) then {_monitorParams param [1, "", [""]]} else {"random"}; + private _vehClass = if ((count _monitorParams)>1) then {_monitorParams param [1, "", [""]]} else {"random"}; - _leaderPos = getPosATL (leader _AIGroup); + private _leaderPos = getPosATL (leader _AIGroup); - _veh = + private _veh = [ [ if (_spawnLocations isEqualTo []) then {_leaderPos getPos [100+(random 200),random 360]} else {selectRandom _spawnLocations}, @@ -407,8 +394,6 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the case "armed_vehicle_replace": { - private ["_vehicle", "_vehClass", "_leaderPos"]; - if !(_monitorParams params [ ["_vehicle", objNull, [objNull]] @@ -423,9 +408,9 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the { deleteVehicle _vehicle; - _vehClass = if ((count _monitorParams)>1) then {_monitorParams param [1, "", [""]]} else {"random"}; + private _vehClass = if ((count _monitorParams)>1) then {_monitorParams param [1, "", [""]]} else {"random"}; - _leaderPos = getPosATL (leader _AIGroup); + private _leaderPos = getPosATL (leader _AIGroup); _vehicle = [ @@ -455,8 +440,6 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the case "static_gunner": { - private ["_staticGun", "_gunPos", "_staticGunClass"]; - if !(_monitorParams params [ ["_staticGun", objNull, [objNull]], @@ -472,9 +455,9 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the { deleteVehicle _staticGun; - _staticGunClass = if ((count _monitorParams)>1) then {_monitorParams param [1, "", [""]]} else {"random"}; + private _staticGunClass = if ((count _monitorParams)>1) then {_monitorParams param [1, "", [""]]} else {"random"}; - _leaderPos = getPosATL (leader _AIGroup); + private _leaderPos = getPosATL (leader _AIGroup); _staticGun = [ @@ -562,7 +545,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the if ((!isNil "_unitsToSpawn") && {_unitsToSpawn>0}) then { - private ["_spawnPos", "_units", "_spawningLocations"]; + private ["_spawnPos"]; if (_maxReinforcementUnits>0) then { @@ -578,7 +561,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the }; }; - _units = []; + private _units = []; if (_spawnLocations isEqualTo []) then { @@ -593,7 +576,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the else { // Shuffle the original list and make a copy. - _spawningLocations = (_spawnLocations call ExileClient_util_array_shuffle) + []; + private _spawningLocations = (_spawnLocations call ExileClient_util_array_shuffle) + []; _spawnPos = _spawningLocations select 0; // Define it for spawning flares _spawningLocations_count = count _spawningLocations; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_HeliParatroopers_Monitor.sqf b/@ExileServer/addons/a3_dms/scripts/fn_HeliParatroopers_Monitor.sqf index a07ef5b..26fb8c9 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_HeliParatroopers_Monitor.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_HeliParatroopers_Monitor.sqf @@ -70,9 +70,9 @@ if ((_heli distance2D _dropPoint)<200) then { - private["_groupOwner","_AIGroup"]; + private ["_groupOwner"]; - _AIGroup = group _heli; + private _AIGroup = group _heli; // Grab and lock locality to control AI if necessary. if !(local _AIGroup) then diff --git a/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E.sqf b/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E.sqf index 27dbdde..8e91278 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E.sqf @@ -15,9 +15,6 @@ Returns all created objects. */ -private ["_file", "_pos", "_objs", "_export", "_obj", "_objPos"]; - - if !(params [ ["_file","",[""]], @@ -42,20 +39,22 @@ if ((count _pos)<3) then _pos set [2,0]; }; +private _export = call compile preprocessFileLineNumbers (format ["\x\addons\DMS\objects\%1.sqf",_file]); +if ((isNil "_export") || {!(_export isEqualType [])}) exitWith +{ + diag_log format ["DMS ERROR :: Calling DMS_fnc_ImportFromM3E with invalid file/filepath: %1 | _export: %2",_file,_export]; + [] +}; - - -_export = call compile preprocessFileLineNumbers (format ["\x\addons\DMS\objects\%1.sqf",_file]); - -_objs = _export apply +private _objs = _export apply { // Create the object - _obj = createVehicle [_x select 0, [0,0,0], [], 0, "CAN_COLLIDE"]; + private _obj = createVehicle [_x select 0, [0,0,0], [], 0, "CAN_COLLIDE"]; + _obj enableSimulationGlobal false; // Calculate the object's position using provided relative position - _objPos = [_pos,_x select 1] call DMS_fnc_CalcPos; - + private _objPos = [_pos,_x select 1] call DMS_fnc_CalcPos; if (((count _x)>4) && {!(_x select 4)}) then { @@ -69,8 +68,6 @@ _objs = _export apply _obj setPos _objPos; }; - _obj enableSimulationGlobal false; - _obj; }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_3DEN.sqf b/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_3DEN.sqf new file mode 100644 index 0000000..3ffd9cc --- /dev/null +++ b/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_3DEN.sqf @@ -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 diff --git a/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_3DEN_Convert.sqf b/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_3DEN_Convert.sqf new file mode 100644 index 0000000..d793a1d --- /dev/null +++ b/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_3DEN_Convert.sqf @@ -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 diff --git a/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_3DEN_Static.sqf b/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_3DEN_Static.sqf new file mode 100644 index 0000000..0732d29 --- /dev/null +++ b/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_3DEN_Static.sqf @@ -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 diff --git a/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_Convert.sqf b/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_Convert.sqf index 2f40c0a..492abe9 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_Convert.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_Convert.sqf @@ -16,9 +16,6 @@ This function will return all created objects. */ -private ["_file", "_missionPos", "_objs", "_export", "_obj", "_objPos"]; - - if !(params [ ["_file","",[""]], @@ -44,17 +41,21 @@ if ((count _missionPos)<3) then }; +private _export = call compile preprocessFileLineNumbers (format ["\x\addons\DMS\objects\static\%1.sqf",_file]); - - -_export = call compile preprocessFileLineNumbers (format ["\x\addons\DMS\objects\static\%1.sqf",_file]); - -_objs = _export apply +if ((isNil "_export") || {!(_export isEqualType [])}) exitWith { - private ["_obj","_pos"]; - _obj = createVehicle [_x select 0, [0,0,0], [], 0, "CAN_COLLIDE"]; - _pos = _x select 1; - _pos set [2,(_pos select 2)+5000]; + diag_log format ["DMS ERROR :: Calling DMS_fnc_ImportFromM3E_Convert with invalid file/filepath: %1 | _export: %2",_file,_export]; + [] +}; + +private _objs = _export apply +{ + private _obj = createVehicle [_x select 0, [0,0,0], [], 0, "CAN_COLLIDE"]; + _obj enableSimulationGlobal false; + + private _pos = (_x select 1) vectorAdd [0,0,5000]; + if (_x select 4) then { _obj setDir (_x select 2); @@ -66,12 +67,10 @@ _objs = _export apply _obj setVectorDirAndUp (_x select 3); }; - _obj enableSimulationGlobal false; - _obj; }; -[_objs,_missionPos] call DMS_fnc_setRelPositions; +[_objs,_missionPos] call DMS_fnc_SetRelPositions; _objs diff --git a/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_Static.sqf b/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_Static.sqf index 83607ac..f2798bc 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_Static.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_ImportFromM3E_Static.sqf @@ -14,10 +14,6 @@ This function will simply create the objects from a file that was exported from M3Editor, and return a list of those objects. */ -private ["_OK", "_varname", "_file", "_export"]; - - - if !(params [ ["_file","",[""]] @@ -28,7 +24,8 @@ exitWith [] }; -_varname = format ["DMS_StaticBaseSpawned_%1",_file]; +// The next few lines checks to see if the static base has been spawned previously, in order to avoid spawning duplicate objects. +private _varname = format ["DMS_StaticBaseSpawned_%1",_file]; if (missionNamespace getVariable [_varname,false]) exitWith { @@ -38,8 +35,7 @@ if (missionNamespace getVariable [_varname,false]) exitWith missionNamespace setVariable [_varname,true]; - -_export = call compile preprocessFileLineNumbers (format ["\x\addons\DMS\objects\static\%1.sqf",_file]); +private _export = call compile preprocessFileLineNumbers (format ["\x\addons\DMS\objects\static\%1.sqf",_file]); if ((isNil "_export") || {!(_export isEqualType [])}) exitWith { @@ -47,14 +43,12 @@ if ((isNil "_export") || {!(_export isEqualType [])}) exitWith [] }; - -_objs = _export apply +private _objs = _export apply { - private ["_obj","_pos"]; - - _obj = createVehicle [_x select 0, [0,0,0], [], 0, "CAN_COLLIDE"]; - _pos = _x select 1; + private _obj = createVehicle [_x select 0, [0,0,0], [], 0, "CAN_COLLIDE"]; _obj enableSimulationGlobal false; + + private _pos = _x select 1; if (_x select 4) then { @@ -67,8 +61,6 @@ _objs = _export apply _obj setVectorDirAndUp (_x select 3); }; - _obj enableSimulationGlobal false; - _obj; }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_IsNearWater.sqf b/@ExileServer/addons/a3_dms/scripts/fn_IsNearWater.sqf index 0e12290..1d3eff6 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_IsNearWater.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_IsNearWater.sqf @@ -11,8 +11,6 @@ */ -private["_result","_position","_radius"]; - if !(params [ ["_position",[],[[]],[2,3]], @@ -23,11 +21,8 @@ exitWith diag_log format["DMS ERROR :: Calling DMS_fnc_IsNearWater with invalid parameters: %1",_this]; false }; -_position = _this select 0; -_radius = _this select 1; - -_result = false; +private _result = false; try { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_IsPlayerNearby.sqf b/@ExileServer/addons/a3_dms/scripts/fn_IsPlayerNearby.sqf index 962d5e3..8ef1314 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_IsPlayerNearby.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_IsPlayerNearby.sqf @@ -10,9 +10,6 @@ Returns whether or not a player is within "_distance" meters of "_positionOrObject". */ - -private ["_pos", "_dis", "_isNear"]; - if !(params [ @@ -27,7 +24,7 @@ exitWith if (_dis isEqualTo 0) exitWith {false}; -_isNear = false; +private _isNear = false; try { @@ -39,7 +36,7 @@ try }; } forEach (crew _x); } forEach (_pos nearEntities [["Exile_Unit_Player","LandVehicle", "Air", "Ship"], _dis]); - + if (DMS_DEBUG) then { (format ["IsPlayerNearby :: No players within %1 meters of %2!",_dis,_pos]) call DMS_fnc_DebugLog; @@ -55,4 +52,4 @@ catch }; -_isNear; \ No newline at end of file +_isNear; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_IsValidPosition.sqf b/@ExileServer/addons/a3_dms/scripts/fn_IsValidPosition.sqf index 17c5c0d..69aaa9e 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_IsValidPosition.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_IsValidPosition.sqf @@ -11,7 +11,6 @@ _traderZoneNearLimit, // NUMBER (distance): Minimum distance from a trader zone. _missionNearLimit, // NUMBER (distance): Minimum distance from another mission. _playerNearLimit, // NUMBER (distance): Minimum distance from a player. - _waterSpawn // BOOLEAN: Whether or not the mission is supposed to spawn on water. ] call DMS_fnc_IsValidPosition; All parameters except "_pos" are optional. @@ -19,12 +18,6 @@ Returns whether or not the provided position matches the parameters. */ -private ["_pos", "_nearestObjectMinDistance", "_waterNearLimit", "_minSurfaceNormal", "_spawnZoneNearLimit", "_traderZoneNearLimit", "_missionNearLimit", "_playerNearLimit", "_territoryNearLimit", "_waterSpawn", "_isValidPos"]; - - - -_isValidPos = false; - if !(params [ ["_pos", [], [[]], [0,2,3]], @@ -34,15 +27,17 @@ if !(params ["_traderZoneNearLimit", DMS_TraderZoneNearBlacklist,[0] ], ["_missionNearLimit", DMS_MissionNearBlacklist, [0] ], ["_playerNearLimit", DMS_PlayerNearBlacklist, [0] ], - ["_territoryNearLimit", DMS_TerritoryNearBlacklist, [0] ], - ["_waterSpawn", false, [false] ] + ["_territoryNearLimit", DMS_TerritoryNearBlacklist, [0] ] ]) then { diag_log format ["DMS ERROR :: Calling DMS_fnc_isValidPosition with invalid parameters: %1",_this]; + false } else { + private _isValidPos = false; + try { if ((count _pos)<2) then @@ -62,48 +57,30 @@ else }; - // Only do these checks if the mission is supposed to be on land. - if (!_waterSpawn) then + // Check for nearby water + if ((_waterNearLimit>0) && {[_pos,_waterNearLimit] call DMS_fnc_isNearWater}) then { - // Check for nearby water - if ((_waterNearLimit>0) && {[_pos,_waterNearLimit] call DMS_fnc_isNearWater}) then - { - throw ("water"); - }; + throw ("water"); + }; - // Terrain steepness check - // 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. - 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 + // Terrain steepness check + // 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. + if ((_minSurfaceNormal>0) && {_minSurfaceNormal<=1}) then { - // Check to see if the position is actually water. - if !(surfaceIsWater _pos) then + if (((surfaceNormal _pos) select 2)<_minSurfaceNormal) then { - throw ("land"); + throw ("a steep location"); }; - // Check the depth of the water. - if ((getTerrainHeightASL _pos)<-DMS_MinWaterDepth) then + // Check the surrounding area (within 5 meters) + 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; }; }; + + _isValidPos }; - - -_isValidPos; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_MissionParams.sqf b/@ExileServer/addons/a3_dms/scripts/fn_MissionParams.sqf index 24c7034..ad0ec66 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_MissionParams.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_MissionParams.sqf @@ -47,10 +47,10 @@ ] */ -private ["_parsedParams", "_extraParams", "_missionPosition", "_OK", "_posInfo", "_forceSpawn", "_findSafePosParams"]; +private ["_missionPosition"]; -_extraParams = []; +private _extraParams = []; if (isNil "_this") then { @@ -77,7 +77,7 @@ else then { _missionPosition = _posInfo select 0; - _forceSpawn = if ((count _posInfo)>1) then {_posInfo select 1} else {false}; + private _forceSpawn = if ((count _posInfo)>1) then {_posInfo select 1} else {false}; if (!(_missionPosition isEqualType []) || {(count _missionPosition)<2}) then { @@ -131,7 +131,7 @@ else }; }; -_parsedParams = +private _parsedParams = [ _missionPosition, _extraParams @@ -142,4 +142,4 @@ if (DMS_DEBUG) then (format ["MissionParams :: Returning _parsedParams: %1 | Calling params: %2",_parsedParams,_this]) call DMS_fnc_DebugLog; }; -_parsedParams \ No newline at end of file +_parsedParams diff --git a/@ExileServer/addons/a3_dms/scripts/fn_MissionSuccessState.sqf b/@ExileServer/addons/a3_dms/scripts/fn_MissionSuccessState.sqf index abe446d..8bc2840 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_MissionSuccessState.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_MissionSuccessState.sqf @@ -16,19 +16,14 @@ if !(_this isEqualType []) exitWith diag_log format ["DMS ERROR :: DMS_fnc_MissionSuccessState called with invalid parameter: %1",_this]; }; -private ["_success", "_exit"]; - -_success = true; -_exit = false; +private _success = true; +private _exit = false; { if (_exit) exitWith {}; try { - private ["_OK","_completionType","_completionArgs","_absoluteWinCondition"]; - - if !(_x params [ ["_completionType", "", [""] ], @@ -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 { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_MissionsMonitor_Dynamic.sqf b/@ExileServer/addons/a3_dms/scripts/fn_MissionsMonitor_Dynamic.sqf index f4f1034..df5371a 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_MissionsMonitor_Dynamic.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_MissionsMonitor_Dynamic.sqf @@ -34,30 +34,79 @@ A semi-full breakdown can be found in fn_AddMissionToMonitor.sqf */ -private ["_pos", "_completionInfo", "_timeStarted", "_failTime", "_units", "_buildings", "_vehs", "_crate_info_array", "_mines", "_missionName", "_msgWIN", "_msgLose", "_markers", "_missionSide", "_arr", "_cleanupList"]; - - { - _pos = _x select 0; - _completionInfo = _x select 1; - _timeStarted = _x select 2 select 0; - _failTime = _x select 2 select 1; - _units = _x select 3; - _buildings = _x select 4 select 0; - _vehs = _x select 4 select 1; - _crate_info_array = _x select 4 select 2; - _mines = _x select 4 select 3; - _missionName = _x select 5 select 0; - _msgWIN = _x select 5 select 1; - _msgLose = _x select 5 select 2; - _markers = _x select 6; - _missionSide = _x select 7; - _missionDifficulty = _x select 8; - _missionEvents = _x select 9; - _onSuccessScripts = _x select 10 select 0; - _onFailScripts = _x select 10 select 1; - _onMonitorStart = _x select 10 select 2; - _onMonitorEnd = _x select 10 select 3; + if !(_x params + [ + "_pos", + "_completionInfo", + "_timing", + "_units", + "_missionObjs", + "_msgInfo", + "_markers", + "_missionSide", + "_missionDifficulty", + "_missionEvents", + "_missionScripts" + ]) + then + { + DMS_Mission_Arr deleteAt _forEachIndex; + diag_log format ["DMS ERROR :: Invalid Index (%1) in DMS_Mission_Arr: %2",_forEachIndex,_x]; + }; + + + if !(_timing params + [ + "_timeStarted", + "_failTime" + ]) + exitWith + { + DMS_Mission_Arr deleteAt _forEachIndex; + diag_log format ["DMS ERROR :: Invalid _timing (%1) in DMS_Mission_Arr: %2",_timing,_x]; + }; + + + if !(_missionObjs params + [ + "_buildings", + "_vehs", + "_crate_info_array", + "_mines" + ]) + exitWith + { + DMS_Mission_Arr deleteAt _forEachIndex; + diag_log format ["DMS ERROR :: Invalid _missionObjs (%1) in DMS_Mission_Arr: %2",_missionObjs,_x]; + }; + + + if !(_msgInfo params + [ + "_missionName", + "_msgWIN", + "_msgLose" + ]) + exitWith + { + DMS_Mission_Arr deleteAt _forEachIndex; + diag_log format ["DMS ERROR :: Invalid _msgInfo (%1) in DMS_Mission_Arr: %2",_msgInfo,_x]; + }; + + + if !(_missionScripts params + [ + "_onSuccessScripts", + "_onFailScripts", + "_onMonitorStart", + "_onMonitorEnd" + ]) + exitWith + { + DMS_Mission_Arr deleteAt _forEachIndex; + diag_log format ["DMS ERROR :: Invalid _missionScripts (%1) in DMS_Mission_Arr: %2",_missionScripts,_x]; + }; try { @@ -157,14 +206,13 @@ private ["_pos", "_completionInfo", "_timeStarted", "_failTime", "_units", "_bui }; //Nobody is nearby so just cleanup objects from here - _cleanupList = ((_units call DMS_fnc_GetAllUnits)+_buildings+_vehs+_mines); + private _cleanupList = ((_units call DMS_fnc_GetAllUnits)+_buildings+_vehs+_mines); { _cleanupList pushBack (_x select 0); } forEach _crate_info_array; - private["_prev"]; - _prev = DMS_CleanUp_PlayerNearLimit; + private _prev = DMS_CleanUp_PlayerNearLimit; DMS_CleanUp_PlayerNearLimit = 0; // Temporarily set the limit to 0 since we want to delete all the stuff regardless of player presence. _cleanupList call DMS_fnc_CleanUp; @@ -214,10 +262,8 @@ private ["_pos", "_completionInfo", "_timeStarted", "_failTime", "_units", "_bui if (DMS_MarkerText_ShowAICount) then { - private ["_dot", "_text"]; - - _dot = _markers select 0; - _text = missionNamespace getVariable [format ["%1_text",_dot],_missionName]; + private _dot = _markers select 0; + private _text = missionNamespace getVariable [format ["%1_text",_dot],_missionName]; if (DMS_MarkerText_ShowMissionPrefix) then { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_MissionsMonitor_Static.sqf b/@ExileServer/addons/a3_dms/scripts/fn_MissionsMonitor_Static.sqf index 8cfc034..b19e576 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_MissionsMonitor_Static.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_MissionsMonitor_Static.sqf @@ -40,24 +40,21 @@ A semi-full breakdown can be found in fn_AddStaticMissionToMonitor.sqf */ - { - private ["_missionPos", "_completionInfo", "_groupReinforcementsInfo", "_timing", "_inputAIUnits", "_missionObjs", "_msgInfo", "_markers", "_missionSide", "_missionDifficulty", "_missionEvents", "_missionScripts", "_timeStarted", "_failTime", "_buildings", "_vehs", "_crate_info_array", "_mines", "_missionName", "_msgWIN", "_msgLose", "_onSuccessScripts", "_onFailScripts"]; - if !(_x params [ - ["_missionPos", [], [[]], [2,3] ], - ["_completionInfo", [], [[]] ], - ["_groupReinforcementsInfo", [], [[]] ], - ["_timing", [], [[]], [2] ], - ["_inputAIUnits", [], [[]] ], - ["_missionObjs", [], [[]], [4] ], - ["_msgInfo", [], [[]], [3] ], - ["_markers", [], [[]], [DMS_MissionMarkerCount] ], - ["_missionSide", "", [""] ], - ["_missionDifficulty", "", [""] ], - ["_missionEvents", [], [[]] ], - ["_missionScripts", [], [[]], [4] ] + "_missionPos", + "_completionInfo", + "_groupReinforcementsInfo", + "_timing", + "_inputAIUnits", + "_missionObjs", + "_msgInfo", + "_markers", + "_missionSide", + "_missionDifficulty", + "_missionEvents", + "_missionScripts" ]) then { @@ -65,19 +62,58 @@ diag_log format ["DMS ERROR :: Invalid Index (%1) in DMS_StaticMission_Arr: %2",_forEachIndex,_x]; }; - _timeStarted = _timing select 0; - _failTime = _timing select 1; - _buildings = _missionObjs select 0; - _vehs = _missionObjs select 1; - _crate_info_array = _missionObjs select 2; - _mines = _missionObjs select 3; - _missionName = _msgInfo select 0; - _msgWIN = _msgInfo select 1; - _msgLose = _msgInfo select 2; - _onSuccessScripts = _missionScripts select 0; - _onFailScripts = _missionScripts select 1; - _onMonitorStart = _missionScripts select 2; - _onMonitorEnd = _missionScripts select 3; + + if !(_timing params + [ + "_timeStarted", + "_failTime" + ]) + exitWith + { + DMS_StaticMission_Arr deleteAt _forEachIndex; + diag_log format ["DMS ERROR :: Invalid _timing (%1) in DMS_StaticMission_Arr: %2",_timing,_x]; + }; + + + if !(_missionObjs params + [ + "_buildings", + "_vehs", + "_crate_info_array", + "_mines" + ]) + exitWith + { + DMS_StaticMission_Arr deleteAt _forEachIndex; + diag_log format ["DMS ERROR :: Invalid _missionObjs (%1) in DMS_StaticMission_Arr: %2",_missionObjs,_x]; + }; + + + if !(_msgInfo params + [ + "_missionName", + "_msgWIN", + "_msgLose" + ]) + exitWith + { + DMS_StaticMission_Arr deleteAt _forEachIndex; + diag_log format ["DMS ERROR :: Invalid _msgInfo (%1) in DMS_StaticMission_Arr: %2",_msgInfo,_x]; + }; + + + if !(_missionScripts params + [ + "_onSuccessScripts", + "_onFailScripts", + "_onMonitorStart", + "_onMonitorEnd" + ]) + exitWith + { + DMS_StaticMission_Arr deleteAt _forEachIndex; + diag_log format ["DMS ERROR :: Invalid _missionScripts (%1) in DMS_StaticMission_Arr: %2",_missionScripts,_x]; + }; try { @@ -175,8 +211,7 @@ _cleanupList pushBack (_x select 0); } forEach _crate_info_array; - private["_prev"]; - _prev = DMS_CleanUp_PlayerNearLimit; + private _prev = DMS_CleanUp_PlayerNearLimit; DMS_CleanUp_PlayerNearLimit = 0; // Temporarily set the limit to 0 since we want to delete all the stuff regardless of player presence. _cleanupList call DMS_fnc_CleanUp; @@ -218,10 +253,8 @@ if (DMS_MarkerText_ShowAICount_Static) then { - private ["_dot", "_text"]; - - _dot = _markers select 0; - _text = missionNamespace getVariable [format ["%1_text",_dot],_missionName]; + private _dot = _markers select 0; + private _text = missionNamespace getVariable [format ["%1_text",_dot],_missionName]; if (DMS_MarkerText_ShowMissionPrefix) then { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf b/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf index fbe68eb..46c9867 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf @@ -13,28 +13,26 @@ _type // Type of AI: "soldier","static","vehicle","heli", etc. ] call DMS_fnc_OnKilled; */ - - -private ["_unit", "_killer", "_side", "_type", "_launcher", "_launcherVar", "_playerObj", "_removeAll", "_rockets", "_grp", "_grpUnits", "_av", "_memCount", "_gunner", "_driver", "_gunnerIsAlive", "_driverIsAlive", "_grp", "_owner", "_start", "_roadKilled", "_veh", "_boom", "_revealAmount", "_muzzle", "_silencer"]; - - if (DMS_DEBUG) then { (format ["OnKilled :: Logging AI death with parameters: %1",_this]) call DMS_fnc_DebugLog; }; -_unit = _this select 0; -_killer = _this select 1; -_side = _unit getVariable ["DMS_AI_Side", "bandit"]; -_type = _unit getVariable ["DMS_AI_Type", "soldier"]; -_launcher = secondaryWeapon _unit; -_launcherVar = _unit getVariable ["DMS_AI_Launcher",""]; -_playerObj = objNull; +params +[ + "_unit", + "_killer" +]; +private _side = _unit getVariable ["DMS_AI_Side", "bandit"]; +private _type = _unit getVariable ["DMS_AI_Type", "soldier"]; +private _launcher = secondaryWeapon _unit; +private _launcherVar = _unit getVariable ["DMS_AI_Launcher",""]; +private _playerObj = objNull; _unit call ([missionNamespace getVariable [_unit getVariable ["DMS_AI_CustomOnKilledFnc",""],{}]] param [0,{},[{}]]); // Some of the previously used functions work with non-local argument. Some don't. BIS is annoying -_removeAll = +private _removeAll = { {_this removeWeaponGlobal _x;} forEach (weapons _this); {_this unlinkItem _x;} forEach (assignedItems _this); @@ -98,19 +96,19 @@ if(DMS_RemoveNVG) then _unit unlinkItem "NVGoggles"; }; -_grp = group _unit; -_grpUnits = (units _grp) - [_unit]; +private _grp = group _unit; +private _grpUnits = (units _grp) - [_unit]; // Give the AI a new leader if the killed unit was the leader if (!(_grpUnits isEqualTo []) && {(leader _grp) isEqualTo _unit}) then { _grp selectLeader (selectRandom _grpUnits); }; -_av = _unit getVariable ["DMS_AssignedVeh",objNull]; +private _av = _unit getVariable ["DMS_AssignedVeh",objNull]; if (!isNull _av) then { // Determine whether or not the vehicle has any active crew remaining. - _memCount = {[(alive _x),false] select (_unit isEqualTo _x);} count (crew _av); + private _memCount = {[(alive _x),false] select (_unit isEqualTo _x);} count (crew _av); // Destroy the vehicle and add it to cleanup if there are no active crew members of the vehicle. @@ -154,13 +152,13 @@ if (!isNull _av) then // Only check for this stuff for ground vehicles that have guns... if ((_av isKindOf "LandVehicle") && {(count (weapons _av))>0}) then { - _gunner = gunner _av; - _driver = driver _av; + private _gunner = gunner _av; + private _driver = driver _av; // The fact that I have to do this in the FUCKING ONKILLED EVENTHANDLER is a testament to why ArmA will make me die prematurely - _gunnerIsAlive = alive _gunner; - _driverIsAlive = alive _driver; + private _gunnerIsAlive = alive _gunner; + private _driverIsAlive = alive _driver; if (_unit isEqualTo _gunner) then { @@ -177,11 +175,15 @@ if (!isNull _av) then { [_driver,_av,_killer] spawn { - _driver = _this select 0; - _av = _this select 1; - _killer = _this select 2; - _grp = group _driver; - _owner = groupOwner _grp; + params + [ + "_driver", + "_av", + "_killer" + ]; + + private _grp = group _driver; + private _owner = groupOwner _grp; _grp setVariable ["DMS_LockLocality",true]; @@ -227,7 +229,7 @@ if (!isNull _av) then if (_owner!=2) then { - _start = time; + private _start = time; // Controlling AI... yes. I have to do this waitUntil @@ -269,11 +271,11 @@ if (!isNull _av) then }; }; -_roadKilled = false; +private _roadKilled = false; if (isPlayer _killer) then { - _veh = vehicle _killer; + private _veh = vehicle _killer; _playerObj = _killer; @@ -293,7 +295,7 @@ if (isPlayer _killer) 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 setDamage 1; if (DMS_DEBUG) then @@ -316,13 +318,13 @@ if (isPlayer _killer) then // Reveal the killer to the AI units if (DMS_ai_share_info) then { - _revealAmount = 4.0; + private _revealAmount = 4.0; - _muzzle = currentMuzzle _playerObj; + private _muzzle = currentMuzzle _playerObj; if (_muzzle isEqualType "") then { - _silencer = _playerObj weaponAccessories _muzzle select 0; + private _silencer = _playerObj weaponAccessories _muzzle select 0; if (!isNil "_silencer" && {_silencer != ""}) then { _revealAmount = 2.0; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf b/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf index efa54d8..c740cf5 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf @@ -16,8 +16,6 @@ Returns nothing */ -private ["_playerUID", "_playerObj", "_moneyChange", "_AISide", "_AIType", "_repChange", "_roadKilled", "_unitMoney", "_unit", "_unitRespect", "_playerMoney", "_playerRespect", "_unitName", "_msgType", "_msgParams"]; - if !(params [ ["_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 { - _moneyChange = missionNamespace getVariable [format ["DMS_%1_%2_MoneyGain",_AISide,_AIType],0]; - _repChange = missionNamespace getVariable [format ["DMS_%1_%2_RepGain",_AISide,_AIType],0]; - _rankChange = missionNamespace getVariable [format ["DMS_%1_%2_RankGain",_AISide,_AIType],0]; + private _moneyChange = missionNamespace getVariable [format ["DMS_%1_%2_MoneyGain",_AISide,_AIType],0]; + private _repChange = missionNamespace getVariable [format ["DMS_%1_%2_RepGain",_AISide,_AIType],0]; + private _rankChange = missionNamespace getVariable [format ["DMS_%1_%2_RankGain",_AISide,_AIType],0]; // Check for individually defined AI money/respect/rank. - _unitMoney = _unit getVariable ["DMS_AI_Money",""]; - _unitRespect = _unit getVariable ["DMS_AI_Respect",""]; - _unitRank = _unit getVariable ["DMS_AI_Rank",""]; + private _unitMoney = _unit getVariable ["DMS_AI_Money",""]; + private _unitRespect = _unit getVariable ["DMS_AI_Respect",""]; + private _unitRank = _unit getVariable ["DMS_AI_Rank",""]; if !(_unitMoney isEqualTo "") then { @@ -71,10 +69,10 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U if ((_moneyChange!=0) || {_repChange!=0} || {_rankChange!=0}) then { - _playerMoney = _playerObj getVariable ["ExileMoney", 0]; - _playerRespect = _playerObj getVariable ["ExileScore", 0]; - _playerRank = _playerObj getVariable ["ExileHumanity", 0]; - _unitName = name _unit; + private _playerMoney = _playerObj getVariable ["ExileMoney", 0]; + private _playerRespect = _playerObj getVariable ["ExileScore", 0]; + private _playerRank = _playerObj getVariable ["ExileHumanity", 0]; + private _unitName = name _unit; /* if (DMS_DEBUG) then @@ -85,15 +83,15 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U if (_moneyChange!=0) then { - private ["_msgType", "_msgParams", "_distance", "_attributes", "_distanceBonus"]; + private ["_distance"]; // Set client's money // I also make sure that they don't get negative poptabs _playerMoney = (_playerMoney + _moneyChange) max 0; _playerObj setVariable ["ExileMoney",_playerMoney]; - _msgType = "moneyReceivedRequest"; - _msgParams = [str _playerMoney, format ["killed %1",_unitName]]; + private _msgType = "moneyReceivedRequest"; + private _msgParams = [str _playerMoney, format ["killed %1",_unitName]]; if (_moneyChange<0) then { @@ -126,7 +124,7 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U if (_repChange!=0) then { - _attributes = [[format ["KILLED %1",toUpper(_unitName)],_repChange]]; + private _attributes = [[format ["KILLED %1",toUpper(_unitName)],_repChange]]; if (DMS_AIKill_DistanceBonusCoefficient>0) then { @@ -134,7 +132,7 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U if (_distance>DMS_AIKill_DistanceBonusMinDistance) then { - _distanceBonus = floor (_distance * DMS_AIKill_DistanceBonusCoefficient); + private _distanceBonus = floor (_distance * DMS_AIKill_DistanceBonusCoefficient); _attributes pushBack [format ["%1m RANGE BONUS",_distance], _distanceBonus]; _repChange = _repChange + _distanceBonus; @@ -195,22 +193,25 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U if (DMS_Show_Party_Kill_Notification) then { - private ["_group", "_members", "_msg"]; - - _group = group _playerObj; - _members = units _group; + private _group = group _playerObj; + private _members = units _group; if (!(_group isEqualTo ExileGraveyardGroup) && {(count _members)>1}) then { - _msg = format + private _msg = format [ - "%1 killed %2 from %3 meters away and received %4 poptabs, %5 respect and %6 rank.", + "%1 killed %2 from %3 meters away and received %4 poptabs, and %5 respect.", name _playerObj, _unitName, if !(isNil "_distance") then {_distance} else {floor(_unit distance _playerObj)}, _moneyChange, - _repChange, - _rankChange + _repChange ]; + + if (DMS_Enable_RankChange) then + { + _msg = _msg + format[" (+%1 rank)", _rankChange]; + }; + { _msg remoteExecCall ["systemChat", _x]; } forEach _members; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_RemoveMarkers.sqf b/@ExileServer/addons/a3_dms/scripts/fn_RemoveMarkers.sqf index 56196f6..7dd1639 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_RemoveMarkers.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_RemoveMarkers.sqf @@ -12,12 +12,10 @@ ] call DMS_fnc_RemoveMarkers; */ -private ["_markerDot", "_markerCircle", "_status", "_text"]; - -_markerDot = _this select 0 select 0; -_markerCircle = _this select 0 select 1; -_status = _this select 1; -_text = missionNamespace getVariable [format ["%1_text",_markerDot],markerText _markerDot]; +private _markerDot = _this select 0 select 0; +private _markerCircle = _this select 0 select 1; +private _status = _this select 1; +private _text = missionNamespace getVariable [format ["%1_text",_markerDot],markerText _markerDot]; if (DMS_DEBUG) then diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SelectMagazine.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SelectMagazine.sqf index c28f779..9e3d51f 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SelectMagazine.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SelectMagazine.sqf @@ -8,11 +8,8 @@ Apply magazine type filters if needed */ - -private["_result","_ammoArray"]; - -_result = ""; -_ammoArray = getArray (configFile >> "CfgWeapons" >> _this >> "magazines"); +private _result = ""; +private _ammoArray = getArray (configFile >> "CfgWeapons" >> _this >> "magazines"); if (count _ammoArray > 0) then { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SelectMission.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SelectMission.sqf index 27bb118..1a8fe15 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SelectMission.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SelectMission.sqf @@ -5,9 +5,8 @@ Selects/Spawns missions. Takes no arguments, returns nothing. */ -private "_time"; -_time = diag_tickTime; +private _time = diag_tickTime; if (DMS_RunningBMissionCount >= DMS_MaxBanditMissions) then { @@ -25,8 +24,7 @@ if (diag_fps >= DMS_MinServerFPS && {(count allPlayers) >= DMS_MinPlayerCount}) { if (DMS_DynamicMission && {_time - DMS_BMissionLastStart > DMS_BMissionDelay}) then { - private "_mission"; - _mission = selectRandom DMS_BanditMissionTypesArray; + private _mission = selectRandom DMS_BanditMissionTypesArray; if (DMS_DEBUG) then { @@ -44,9 +42,7 @@ if (diag_fps >= DMS_MinServerFPS && {(count allPlayers) >= DMS_MinPlayerCount}) if (DMS_StaticMission && {_time - DMS_StaticMissionLastStart > DMS_StaticMissionDelay}) then { - private ["_mission", "_availableMissions"]; - - _availableMissions = (DMS_StaticMissionTypesArray - DMS_RunningStaticMissions); + private _availableMissions = (DMS_StaticMissionTypesArray - DMS_RunningStaticMissions); if (_availableMissions isEqualTo []) exitWith { @@ -57,7 +53,7 @@ if (diag_fps >= DMS_MinServerFPS && {(count allPlayers) >= DMS_MinPlayerCount}) }; }; - _mission = selectRandom _availableMissions; + private _mission = selectRandom _availableMissions; if (DMS_DEBUG) then { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SelectOffsetPos.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SelectOffsetPos.sqf index 48e987f..d009a03 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SelectOffsetPos.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SelectOffsetPos.sqf @@ -15,9 +15,6 @@ */ -private ["_origin","_dis","_dir","_npos"]; - - if !(params [ ["_origin","",[objNull,[]],[2,3]], diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SelectRandomVal.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SelectRandomVal.sqf index 44950ec..39e37c5 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SelectRandomVal.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SelectRandomVal.sqf @@ -12,9 +12,6 @@ */ -private ["_OK", "_min", "_max", "_return"]; - - if !(params [ ["_min",0,[0]], @@ -25,6 +22,4 @@ exitWith diag_log format ["DMS ERROR :: Calling DMS_fnc_SelectRandomVal with invalid parameters: %1",_this]; }; -_return = _min + random(_max - _min); - -_return \ No newline at end of file +_min + random(_max - _min) diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SetAILocality.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SetAILocality.sqf index 4a9f6d6..845408e 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SetAILocality.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SetAILocality.sqf @@ -15,21 +15,16 @@ Returns true if a viable owner was found, false otherwise. */ -private ["_AI", "_AIType", "_pos", "_exit", "_client", "_swapped"]; - - -_AI = param [0,objNull,[objNull,grpNull]]; +private _AI = param [0,objNull,[objNull,grpNull]]; if (isNull _AI) exitWith { diag_log format ["DMS ERROR :: Calling DMS_SetAILocality with null parameter; _this: %1",_this]; }; +private _AIType = typeName _AI; -_AIType = typeName _AI; - - -_pos = if (_AIType isEqualTo "OBJECT") then {_AI} else {param [1,"",[objNull,[]],[2,3]]}; +private _pos = if (_AIType isEqualTo "OBJECT") then {_AI} else {param [1,"",[objNull,[]],[2,3]]}; if (_pos isEqualTo "") exitWith { @@ -37,8 +32,7 @@ if (_pos isEqualTo "") exitWith }; - -_client = objNull; +private _client = objNull; { if ((alive _x) && {(_x distance2D _pos)<=3000}) exitWith @@ -50,7 +44,7 @@ _client = objNull; if (!isNull _client) then { - _swapped = if (_AIType isEqualTo "OBJECT") then {_AI setOwner (owner _client)} else {_AI setGroupOwner (owner _client)}; + private _swapped = if (_AIType isEqualTo "OBJECT") then {_AI setOwner (owner _client)} else {_AI setGroupOwner (owner _client)}; if (!_swapped) then { @@ -59,8 +53,7 @@ if (!isNull _client) then if (DMS_ai_offload_notifyClient) then { - private "_msg"; - _msg = format ["DMS :: AI %1 |%2| has been offloaded to you.",_AIType,_AI]; + private _msg = format ["DMS :: AI %1 |%2| has been offloaded to you.",_AIType,_AI]; _msg remoteExecCall ["systemChat", _client]; _msg remoteExecCall ["diag_log", _client]; }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SetGroupBehavior.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SetGroupBehavior.sqf index 4d33051..2c31c51 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SetGroupBehavior.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SetGroupBehavior.sqf @@ -13,9 +13,6 @@ Returns true if the call was completed */ -private ["_OK", "_exit", "_group", "_behavior", "_pos", "_difficulty", "_radius", "_npos", "_i", "_wp"]; - - if !(params [ ["_group",grpNull,[grpNull,objNull]], @@ -27,7 +24,7 @@ then diag_log format ["DMS ERROR :: Calling DMS_fnc_SetGroupBehavior with invalid params: %1",_this]; }; -_exit = false; +private _exit = false; try { @@ -52,7 +49,7 @@ catch if (_exit) exitWith {false}; -_behavior = if ((count _this)>3) then {_this select 3;} else {"COMBAT"}; +private _behavior = if ((count _this)>3) then {_this select 3;} else {"COMBAT"}; _group setCombatMode "RED"; @@ -88,7 +85,7 @@ _difficulty = }; }; -_radius = missionNamespace getVariable [format["DMS_AI_WP_Radius_%1",_difficulty],40]; +private _radius = missionNamespace getVariable [format["DMS_AI_WP_Radius_%1",_difficulty],40]; // Remove all previous waypoints @@ -100,8 +97,8 @@ for "_i" from count (waypoints _group) to 1 step -1 do // Add waypoints around the center position. for "_i" from 0 to 359 step 45 do { - _npos = _pos getPos [_radius,_i]; - _wp = _group addWaypoint [_npos,5]; + private _npos = _pos getPos [_radius,_i]; + private _wp = _group addWaypoint [_npos,5]; _wp setWaypointType "MOVE"; }; @@ -109,5 +106,4 @@ _wp = _group addWaypoint [_pos,0]; _wp setWaypointType "CYCLE"; - true diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SetGroupBehavior_Separate.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SetGroupBehavior_Separate.sqf index ec326e0..95d1ac5 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SetGroupBehavior_Separate.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SetGroupBehavior_Separate.sqf @@ -34,13 +34,13 @@ then diag_log format ["DMS ERROR :: Calling DMS_fnc_SetGroupBehavior_Separate with invalid params: %1",_this]; }; -_behavior = if ((count _this)>3) then {_this select 3;} else {"COMBAT"}; +private _behavior = if ((count _this)>3) then {_this select 3;} else {"COMBAT"}; -_tmpGroup = createGroup (side _finalGroup); +private _tmpGroup = createGroup (side _finalGroup); _units joinSilent _tmpGroup; -_return = +private _return = [ _tmpGroup, _pos, diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SetRelPositions.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SetRelPositions.sqf new file mode 100644 index 0000000..06fcca4 --- /dev/null +++ b/@ExileServer/addons/a3_dms/scripts/fn_SetRelPositions.sqf @@ -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; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf index e1b564c..1c2670a 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf @@ -15,7 +15,7 @@ Returns AI Group */ -private ["_OK", "_pos", "_count", "_difficulty", "_class", "_group", "_side", "_customGearSet", "_launcherType", "_launcher", "_unit", "_rocket"]; +private ["_launcherType"]; if !(params @@ -52,7 +52,7 @@ if (_class isEqualType []) then }; -_customGearSet = []; +private _customGearSet = []; if (_class == "custom") then { @@ -87,19 +87,19 @@ if ((!isNil "_launcherType") || {DMS_ai_use_launchers && {DMS_ai_launchers_per_g _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 { if ((random 100)6}) then { _customGearSet = _this select 6; - _useCustomGear = true; }; }; @@ -91,7 +87,7 @@ _difficulty = //Create unit -_unit = _group createUnit [DMS_AI_Classname, _pos, [], 0,"FORM"]; +private _unit = _group createUnit [DMS_AI_Classname, _pos, [], 0,"FORM"]; _unit allowFleeing 0; [_unit] joinSilent _group; @@ -133,9 +129,9 @@ else }; // 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 { @@ -157,6 +153,18 @@ if (!_useCustomGear) then } 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) {_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])); // Make AI effective at night - _nighttime = (sunOrMoon != 1); + private _nighttime = (sunOrMoon != 1); if (_nighttime) then { _unit linkItem "NVGoggles"; @@ -176,7 +184,7 @@ if (!_useCustomGear) 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 selectWeapon _weapon; @@ -198,7 +206,7 @@ if (!_useCustomGear) 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 { _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; }; - _pistols = missionNamespace getVariable [format ["DMS_%1_pistols",_class],[]]; + private _pistols = missionNamespace getVariable [format ["DMS_%1_pistols",_class],[]]; if !(_pistols isEqualTo []) then { - _pistol = selectRandom _pistols; + private _pistol = selectRandom _pistols; [_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 if !(_pistol isEqualTo "") then { @@ -325,6 +311,42 @@ else _unit selectWeapon _weapon; }; + + + // Add magazines and items about half a second after spawning so that backpack inventory can be used reliably. Thanks to second_coming for reporting this issue. + [ + 0.5, + { + params + [ + "_unit", + "_magazines", + "_assignedItems" + ]; + + { + if (_x isEqualType "") then + { + _x = [_x,1]; + }; + _unit addMagazines _x; + } forEach _magazines; + + { + if (_x in ["Binocular","Rangefinder","Laserdesignator","Laserdesignator_02","Laserdesignator_03"]) then + { + _unit addWeapon _x; + } + else + { + _unit linkItem _x; + }; + } forEach _assignedItems; + }, + [_unit,_magazines,_assignedItems], + false, + false + ] call ExileServer_system_thread_addTask; }; { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf index 4997e76..03a1caa 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf @@ -21,9 +21,6 @@ Returns an array of static gun objects. */ -private ["_OK", "_guns", "_pos", "_MGClassInput", "_MGClass", "_gun", "_unit", "_group", "_class", "_difficulty", "_side", "_positions"]; - - if !(params [ ["_positions",[],[[]]], @@ -37,34 +34,35 @@ exitWith diag_log format ["DMS ERROR :: Calling DMS_fnc_SpawnAIStaticMG with invalid parameters: %1",_this]; }; -_MGClassInput = "random"; -if ((count _this)>5) then +private _MGClassInput = + if ((count _this)>5) then + { + param [5]; + } + else + { + "random" + }; + + +private _guns = _positions apply { - _MGClassInput = param [5,"random",[""]]; -}; - - -_guns = []; - -{ - _pos = _x; - - _MGClass = _MGClassInput; + private _MGClass = _MGClassInput; if (_MGClass == "random") then { _MGClass = selectRandom DMS_static_weapons; }; - _gun = createVehicle [_MGClass, [0,0,0], [], 0, "CAN_COLLIDE"]; + private _gun = createVehicle [_MGClass, [0,0,0], [], 0, "CAN_COLLIDE"]; _gun setDir (random 360); - _gun setPosATL _pos; + _gun setPosATL _x; _gun lock 2; _group addVehicle _gun; _guns pushBack _gun; - _unit = [_group,_pos,_class,_difficulty,_side,"Static"] call DMS_fnc_SpawnAISoldier; + private _unit = [_group,_x,_class,_difficulty,_side,"Static"] call DMS_fnc_SpawnAISoldier; _unit moveInGunner _gun; reload _unit; @@ -72,9 +70,10 @@ _guns = []; 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 diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIVehicle.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIVehicle.sqf index d214987..bc59e9b 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIVehicle.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIVehicle.sqf @@ -18,9 +18,6 @@ Returns the spawned vehicle. */ -private ["_OK", "_positions", "_veh", "_spawnPos", "_vehClass", "_driver", "_gunner", "_group", "_class", "_difficulty", "_side", "_crewCount"]; - - if !(params [ ["_positions",[],[[]],[1,2]], @@ -45,7 +42,7 @@ exitWith diag_log format ["DMS ERROR :: Calling DMS_fnc_SpawnAIVehicle with invalid _positions parameters: %1",_positions]; }; -_vehClass = +private _vehClass = if ((count _this)>5) then { 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 engineOn true; _veh lock 2; _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 setVariable ["DMS_AssignedVeh",_veh]; -_crewCount = +private _crewCount = { private _unit = [_group,_spawnPos,_class,_difficulty,_side,"Vehicle"] call DMS_fnc_SpawnAISoldier; _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; }; + _veh diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnBanditMission.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnBanditMission.sqf index 1857976..f647391 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnBanditMission.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnBanditMission.sqf @@ -11,12 +11,7 @@ Simply spawns a mission with the given mission type and passes parameters to it. Returns nothing */ - -private ["_mission", "_parameters"]; - - - -_mission = +private _mission = [ missionNamespace getVariable format [ @@ -31,7 +26,7 @@ if (_mission isEqualTo "no") then } else { - _parameters = if ((count _this)>1) then {_this select 1} else {[]}; + private _parameters = if ((count _this)>1) then {_this select 1} else {[]}; DMS_MissionCount = DMS_MissionCount + 1; DMS_RunningBMissionCount = DMS_RunningBMissionCount + 1; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnCrate.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnCrate.sqf index d3794c2..3392d81 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnCrate.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnCrate.sqf @@ -12,9 +12,6 @@ */ -private ["_crateClassName", "_pos", "_crate"]; - - if !(params [ ["_crateClassName","_crateClassName ERROR",[""]], @@ -32,9 +29,9 @@ if !(isClass (configFile >> "CfgVehicles" >> _crateClassName)) exitWith objNull }; -_spawnATL = if ((count _this)>2) then {_this select 2} else {true}; +private _spawnATL = if ((count _this)>2) then {_this select 2} else {true}; -_crate = createVehicle [_crateClassName,_pos,[], 0, "CAN_COLLIDE"]; +private _crate = createVehicle [_crateClassName,_pos,[], 0, "CAN_COLLIDE"]; _crate setDir (random 360); @@ -61,4 +58,4 @@ if (DMS_HideBox) then _crate hideObjectGlobal true; }; -_crate; \ No newline at end of file +_crate; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnHeliReinforcement.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnHeliReinforcement.sqf index 563b996..80ab9f0 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnHeliReinforcement.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnHeliReinforcement.sqf @@ -21,7 +21,7 @@ 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 @@ -47,7 +47,7 @@ if (isNull _AIGroup) exitWith -1 }; -_heliClass = if ((count _this)>8) then {_this param [8, "", [""]]} else {selectRandom DMS_ReinforcementHelis}; +private _heliClass = if ((count _this)>8) then {_this param [8, "", [""]]} else {selectRandom DMS_ReinforcementHelis}; // Make the AI group local to add passengers. if !(local _AIGroup) then @@ -57,7 +57,7 @@ if !(local _AIGroup) then }; // Get the spawn position for the heli -_spawnPos = +private _spawnPos = if ((count _this)>9) then { _this param [9, [0,0,0], [[]], [2,3]] @@ -86,7 +86,7 @@ _spawnPos set [2,DMS_RHeli_Height]; // Spawn the heli -_heli = createVehicle [_heliClass, _spawnPos, [], 0, "FLY"]; +private _heli = createVehicle [_heliClass, _spawnPos, [], 0, "FLY"]; _heli setFuel 1; _heli engineOn true; _heli lock 2; @@ -95,9 +95,8 @@ _AIGroup addVehicle _heli; // Spawn the AI paratroopers -_units = []; -_paratrooperCount = 0; -_crewCount = +private _paratrooperCount = 0; +private _units = (fullCrew [_heli, "", true]) apply { _x params [ @@ -150,10 +149,9 @@ _crewCount = }; }; }; - _units pushBack _unit; - true -} count (fullCrew [_heli, "", true]); + _unit +}; // Set the heli pilot's behavior. @@ -171,7 +169,7 @@ if !(isNil "_groupOwner") then if (DMS_DEBUG) then { - (format ["SpawnHeliReinforcement :: Created a %1 heli (%2) with %3 crew members at %4 with %5 difficulty to group %6, going to %7. Units: %8",_side,_heliClass,_crewCount+1,_spawnPos,_difficulty,_AIGroup,_dropPoint,_units]) call DMS_fnc_DebugLog; + (format ["SpawnHeliReinforcement :: Created a %1 heli (%2) with %3 crew members at %4 with %5 difficulty to group %6, going to %7. Units: %8",_side,_heliClass,count _units,_spawnPos,_difficulty,_AIGroup,_dropPoint,_units]) call DMS_fnc_DebugLog; }; // Add the necessary information to the monitor. diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf index 02c1ecc..9fe8e24 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf @@ -12,10 +12,7 @@ ] call DMS_fnc_SpawnMinefield; */ -private ["_centerPos", "_difficulty", "_side", "_mines", "_minesInfo", "_AISide", "_mineCount", "_radius", "_randDirOffset", "_sign"]; - - -_mines = []; +private _mines = []; if (DMS_SpawnMinesAroundMissions) then { @@ -49,17 +46,21 @@ if (DMS_SpawnMinesAroundMissions) then }; - _minesInfo = _difficulty; - if (_difficulty isEqualType "") then - { - _minesInfo = missionNamespace getVariable [format ["DMS_MineInfo_%1", _difficulty], [10,50]]; - }; + private _minesInfo = + if (_difficulty isEqualType "") then + { + _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; - _radius = _minesInfo select 1; + private _mineCount = _minesInfo select 0; + private _radius = _minesInfo select 1; for "_i" from 1 to _mineCount do @@ -87,10 +88,10 @@ if (DMS_SpawnMinesAroundMissions) then if (_spawnWarningSign) then { - _randDirOffset = random 45; + private _randDirOffset = random 45; for "_i" from 0 to 359 step 90 do { - _sign = createVehicle ["Land_Sign_Mines_F", [0,0,0], [], 0, "CAN_COLLIDE"]; + private _sign = createVehicle ["Land_Sign_Mines_F", [0,0,0], [], 0, "CAN_COLLIDE"]; _sign setDir (180+_i); _sign setPosATL (_centerPos getPos [_radius+2, _randDirOffset+_i]); _sign setVectorUp [0,0,1]; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnNonPersistentVehicle.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnNonPersistentVehicle.sqf index 58d20c7..6e93746 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnNonPersistentVehicle.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnNonPersistentVehicle.sqf @@ -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) 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. 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 Edited by eraser1 - - Usage: + + Usage: [ _vehicleClass, // STRING: Classname of the vehicle _pos // ARRAY: Position to spawn it at (roughly) @@ -26,9 +26,6 @@ */ -private ["_vehicleClass","_position","_vehpos","_maxDistance","_vehObj"]; - - if !(params [ ["_vehicleClass","",[""]], @@ -46,8 +43,8 @@ if !(isClass (configFile >> "CfgVehicles" >> _vehicleClass)) exitWith objNull }; -_vehpos = []; -_maxDistance = 5; +private _vehpos = []; +private _maxDistance = 5; while{count _vehpos < 1} do { @@ -57,22 +54,22 @@ while{count _vehpos < 1} do _vehpos set [2, 0.1]; -_vehObj = createVehicle [_vehicleClass, _vehpos, [], 0, "CAN_COLLIDE"]; +private _vehObj = createVehicle [_vehicleClass, _vehpos, [], 0, "CAN_COLLIDE"]; clearBackpackCargoGlobal _vehObj; clearItemCargoGlobal _vehObj; clearMagazineCargoGlobal _vehObj; clearWeaponCargoGlobal _vehObj; -if (_vehicleClass isKindOf "I_UGV_01_F") then +if (_vehicleClass isKindOf "I_UGV_01_F") then { createVehicleCrew _vehObj; }; -if (getNumber (configFile >> "CfgSettings" >> "VehicleSpawn" >> "nightVision") isEqualTo 0) then +if (getNumber (configFile >> "CfgSettings" >> "VehicleSpawn" >> "nightVision") isEqualTo 0) then { _vehObj disableNVGEquipment true; }; -if (getNumber (configFile >> "CfgSettings" >> "VehicleSpawn" >> "thermalVision") isEqualTo 0) then +if (getNumber (configFile >> "CfgSettings" >> "VehicleSpawn" >> "thermalVision") isEqualTo 0) then { _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}]; if (_vehObj isKindOf "Helicopter") then { - _vehObj addEventHandler ["RopeAttach", + _vehObj addEventHandler ["RopeAttach", { private "_vehicle"; _vehicle = _this select 2; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnPersistentVehicle.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnPersistentVehicle.sqf index 57dfe31..c293201 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnPersistentVehicle.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnPersistentVehicle.sqf @@ -13,11 +13,7 @@ Returns the created vehicle object. */ - -private ["_vehicleClass", "_pos", "_pinCode", "_vehObj"]; - - -_vehObj = objNull; +private _vehObj = objNull; try { @@ -80,7 +76,7 @@ try throw (format ["invalid STRING _pinCode value (must be 4 digits): %1",_pinCode]); }; - _spawnATL = if ((count _this)>3) then {_this select 3} else {true}; + private _spawnATL = if ((count _this)>3) then {_this select 3} else {true}; // Create and set the vehicle _vehObj = [_vehicleClass,_pos] call DMS_fnc_SpawnNonPersistentVehicle; @@ -114,5 +110,4 @@ catch }; - _vehObj diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnStaticMission.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnStaticMission.sqf index ef6bf75..cfe1f55 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnStaticMission.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnStaticMission.sqf @@ -13,13 +13,9 @@ If the mission returns the string "delay", then DMS will attempt to spawn the mission again in 60 seconds. */ +private _missionType = param [0, selectRandom DMS_StaticMissionTypesArray, [""]]; -private ["_missionType", "_mission", "_parameters", "_return"]; - - -_missionType = param [0, selectRandom DMS_StaticMissionTypesArray, [""]]; - -_mission = +private _mission = [ missionNamespace getVariable format [ @@ -41,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; - _return = _parameters call _mission; + private _return = _parameters call _mission; if ((!isNil "_return") && {_return isEqualTo "delay"}) exitWith { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SubArr.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SubArr.sqf new file mode 100644 index 0000000..b671a5d --- /dev/null +++ b/@ExileServer/addons/a3_dms/scripts/fn_SubArr.sqf @@ -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 diff --git a/@ExileServer/addons/a3_dms/scripts/fn_TargetsKilled.sqf b/@ExileServer/addons/a3_dms/scripts/fn_TargetsKilled.sqf index b213acc..ae904e9 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_TargetsKilled.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_TargetsKilled.sqf @@ -17,18 +17,14 @@ if (_this isEqualTo []) exitWith diag_log "DMS ERROR :: Calling DMS_TargetsKilled with empty array!"; }; -private "_killed"; - -_killed = false; +private _killed = false; try { { - private ["_lastDistanceCheckTime", "_spawnPos"]; - - _lastDistanceCheckTime = _x getVariable ["DMS_LastAIDistanceCheck",time]; - _pos = getPosWorld _x; - _spawnPos = _x getVariable ["DMS_AISpawnPos",0]; + private _lastDistanceCheckTime = _x getVariable ["DMS_LastAIDistanceCheck",time]; + private _pos = getPosWorld _x; + private _spawnPos = _x getVariable ["DMS_AISpawnPos",0]; if ((DMS_MaxAIDistance>0) && {!(_spawnPos isEqualTo 0)} && {((time - _lastDistanceCheckTime)>DMS_AIDistanceCheckFrequency) && {(_pos distance2D _spawnPos)>DMS_MaxAIDistance}}) then { diff --git a/README.md b/README.md index a3fe631..9b1495e 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ after "7 createVehicle" ## infiSTAR: * If you are using infiSTAR and want to keep ```_CGM = true;```, then set ```_UMW = true;```. -* Add ```'O_HMG_01_high_F'``` to "_VehicleWhiteList", as well as any other vehicles you add to DMS that are not whitelisted. +* 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: @@ -151,6 +151,35 @@ ___ ___ # 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): * **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). * Fixed an issue where AI units would be shown in static missions if configured to do so for dynamic missions (at least at first). -### Test Branch (Now Integrated Live): -#### List Of new Config values: - - DMS_SpawnMissions_Scheduled - DMS_AI_WP_Radius_heli - DMS_AI_WP_Radius_heli - DMS_RHeli_Height - DMS_RHeli_MinDistFromDrop - DMS_RHeli_MaxDistFromDrop - DMS_RHeli_MinDistFromPlayers - DMS_RareLootAmount - DMS_ReinforcementHelis - -#### April 20, 2016 (5:45 PM CST-America, RC): -* The new "DMS_fnc_FindSafePos_InRange" function will ignore the config "DMS_UsePredefinedMissionLocations". -* Disable simulation on objects imported from M3Editor. (Thanks to [second_coming](http://www.exilemod.com/profile/60-second_coming/) for the tip) - -#### April 15, 2016 (8:45 PM CST-America, RC): -* Fixed an issue where static weapons would always be destroyed, ignoring other configs. Thanks to [second_coming](http://www.exilemod.com/profile/60-second_coming/)! - -#### April 15, 2016 (9:30 AM CST-America, RC): -* Fixed script error in OnKilled EH when handling a used AI vehicle. - -#### April 14, 2016 (9:20 PM CST-America, RC): -* Fix script error with saltflats. -* "DMS_fnc_AddMissionToMonitor" will no longer convert given AI parameters to a list of objects, so you can now add other units to the mission (within the same group) without much issue. -* Micro-optimizations here and there. -* Fixed an issue with DMS_fnc_GetAllUnits such that it would return an empty list if given a list of AI objects. -* You can now set the maximum limit of paratrooper reinforcements. -* The pilot of the reinforcement heli should now fly away properly if configured to do so. -* Updated group reinforcement manager for compatibility with latest syntax for paratrooper reinforcements (NOTE: UNTESTED). - - -#### March 31, 2016 (6:00 PM CST-America): -* You can now use "setVariable" to define individually on an AI vehicle its "DMS_DestructionChance". EG: ```_vehicle setVariable ["DMS_DestructionChance",100];``` to always destroy a vehicle when its crew is dead. -* "DMS_DestructionChance" values are defaulted to "DMS_AI_destroyStaticWeapon_chance" or "DMS_AI_destroyVehicleChance" for static or regular vehicles, respectively. -* Optimization + code cleanup for "DMS_fnc_SpawnHeliReinforcement". - -#### March 25, 2016 (6:00 PM CST-America): -* **NEW CONFIG VALUES:** - - DMS_AI_WP_Radius_heli - DMS_AI_WP_Radius_heli - DMS_RHeli_Height - DMS_RHeli_MinDistFromDrop - DMS_RHeli_MaxDistFromDrop - DMS_RHeli_MinDistFromPlayers - DMS_RareLootAmount - DMS_ReinforcementHelis -* DMS Version is set in the "config.cpp", and grabbed in pre-init. -* You can now define how much rare loot to spawn. -* Limit # of attempts in "DMS_fnc_FindSafePos" to 5000. -* New function: DMS_fnc_FindSafePos_InRange; Uses "DMS_fnc_FindSafePos" and edits some variables to return a "safe" position within a certain area. -* New function: DMS_fnc_GetEmptySeats; Returns all empty seats in a vehicle. Not used by DMS, I thought I needed it and I realized I didn't afterwards. -* New function: DMS_fnc_HeliParatroopers_Monitor; Monitors helis/aircraft spawned for paratroopers. **NOT YET COMPLETE** -* New function: DMS_fnc_SpawnHeliReinforcement; Spawns a heli/aircraft with paratroopers for reinforcement. **NOT YET COMPLETE** -* New group reinforcement type: "heli_troopers". Changes most likely to come. -* You can now choose whether or not to destroy or simply unlock a used AI vehicle (with a random percentage chance). -* Slight optimizations here and there (more to come). - -#### March 1, 2016 (12:30 AM CST-America): -* Initial Test Branch commit -* **NEW CONFIG VALUE:** DMS_SpawnMissions_Scheduled -* Several optimizations (mostly due to the new scripting commands introduced in 1.56) -* You can now spawn missions in scheduled environment. - -### End "March 1, 2016" Test Branch - - #### February 19, 2016 (5:45 PM CST-America): * Fixed a minor typo with a variable (part of the new Humanity support by DonkeyPunch). @@ -565,7 +525,7 @@ ___ * Debug logs for "DMS_fnc_MissionsMonitor" will only output the mission name and the position, instead of all of the parameters. * "DMS_fnc_IsNearWater" will now check the provided position itself for water. * "DMS_fnc_IsValidPosition" will now do a surfaceNormal check within a 5 meter radius of the provided position as well. -* "_customGearSet" should now actually work for "DMS_fnc_SpawnAISoldier", and the function title comment has been updated for the slightly tweaked syntax. +* ```_customGearSet``` should now actually work for "DMS_fnc_SpawnAISoldier", and the function title comment has been updated for the slightly tweaked syntax. #### October 8, 2015 (7:15 PM CST-America): @@ -596,7 +556,7 @@ ___ * These changes should make it much easier for people to use DMS notification functions for other purposes. * Fixed AI waypoints - the AI should now properly circle the objective at the proper radius. * Tweaked "DMS_AI_WP_Radius_moderate" and "DMS_AI_WP_Radius_difficult" (reduced the radii). Due to the AI pathing fix. -* Fixed a couple typos in "DMS_fnc_SpawnAISoldier". "_customGearSet" should work now (although I'm fairly certain nobody uses it since nobody ever complained :P ) +* Fixed a couple typos in "DMS_fnc_SpawnAISoldier". ```_customGearSet``` should work now (although I'm fairly certain nobody uses it since nobody ever complained :P ) * Improved "DMS_fnc_SpawnNonPersistentVehicle"; Vehicles should no longer spawn jumbled up in most cases (like cardealer). Also, it's updated to the latest Exile methods to ensure that vehicles have no nightvision/thermal if configured to do so in Exile configs. Also added the "MPKilled" EH used by Exile for non-persistent (persistent vehicles already had it). * You can now choose whether or not you want to display the poptabs or respect kill messages when killing an AI with "DMS_Show_Kill_Poptabs_Notification" and "DMS_Show_Kill_Respect_Notification". Both are enabled by default. * Fixed typos in the "OnKilled" EH (didn't really affect anything) @@ -838,3 +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) * Define functions in config.cpp. This resulted in ALL FILES being changed to some degree. * Fixed spawning Binocs and Rangefinders/Designators on AI. + + + +## Previous Test Branch Changes: + +### "March 1, 2016" Test Branch +#### List Of new Config values: + + DMS_SpawnMissions_Scheduled + DMS_AI_WP_Radius_heli + DMS_AI_WP_Radius_heli + DMS_RHeli_Height + DMS_RHeli_MinDistFromDrop + DMS_RHeli_MaxDistFromDrop + DMS_RHeli_MinDistFromPlayers + DMS_RareLootAmount + DMS_ReinforcementHelis + +#### April 20, 2016 (5:45 PM CST-America, RC): +* The new "DMS_fnc_FindSafePos_InRange" function will ignore the config "DMS_UsePredefinedMissionLocations". +* Disable simulation on objects imported from M3Editor. (Thanks to [second_coming](http://www.exilemod.com/profile/60-second_coming/) for the tip) + +#### April 15, 2016 (8:45 PM CST-America, RC): +* Fixed an issue where static weapons would always be destroyed, ignoring other configs. Thanks to [second_coming](http://www.exilemod.com/profile/60-second_coming/)! + +#### April 15, 2016 (9:30 AM CST-America, RC): +* Fixed script error in OnKilled EH when handling a used AI vehicle. + +#### April 14, 2016 (9:20 PM CST-America, RC): +* Fix script error with saltflats. +* "DMS_fnc_AddMissionToMonitor" will no longer convert given AI parameters to a list of objects, so you can now add other units to the mission (within the same group) without much issue. +* Micro-optimizations here and there. +* Fixed an issue with DMS_fnc_GetAllUnits such that it would return an empty list if given a list of AI objects. +* You can now set the maximum limit of paratrooper reinforcements. +* The pilot of the reinforcement heli should now fly away properly if configured to do so. +* Updated group reinforcement manager for compatibility with latest syntax for paratrooper reinforcements (NOTE: UNTESTED). + + +#### March 31, 2016 (6:00 PM CST-America): +* You can now use "setVariable" to define individually on an AI vehicle its "DMS_DestructionChance". EG: ```_vehicle setVariable ["DMS_DestructionChance",100];``` to always destroy a vehicle when its crew is dead. +* "DMS_DestructionChance" values are defaulted to "DMS_AI_destroyStaticWeapon_chance" or "DMS_AI_destroyVehicleChance" for static or regular vehicles, respectively. +* Optimization + code cleanup for "DMS_fnc_SpawnHeliReinforcement". + +#### March 25, 2016 (6:00 PM CST-America): +* **NEW CONFIG VALUES:** + + DMS_AI_WP_Radius_heli + DMS_AI_WP_Radius_heli + DMS_RHeli_Height + DMS_RHeli_MinDistFromDrop + DMS_RHeli_MaxDistFromDrop + DMS_RHeli_MinDistFromPlayers + DMS_RareLootAmount + DMS_ReinforcementHelis +* DMS Version is set in the "config.cpp", and grabbed in pre-init. +* You can now define how much rare loot to spawn. +* Limit # of attempts in "DMS_fnc_FindSafePos" to 5000. +* New function: DMS_fnc_FindSafePos_InRange; Uses "DMS_fnc_FindSafePos" and edits some variables to return a "safe" position within a certain area. +* New function: DMS_fnc_GetEmptySeats; Returns all empty seats in a vehicle. Not used by DMS, I thought I needed it and I realized I didn't afterwards. +* New function: DMS_fnc_HeliParatroopers_Monitor; Monitors helis/aircraft spawned for paratroopers. **NOT YET COMPLETE** +* New function: DMS_fnc_SpawnHeliReinforcement; Spawns a heli/aircraft with paratroopers for reinforcement. **NOT YET COMPLETE** +* New group reinforcement type: "heli_troopers". Changes most likely to come. +* You can now choose whether or not to destroy or simply unlock a used AI vehicle (with a random percentage chance). +* Slight optimizations here and there (more to come). + +#### March 1, 2016 (12:30 AM CST-America): +* Initial Test Branch commit +* **NEW CONFIG VALUE:** DMS_SpawnMissions_Scheduled +* Several optimizations (mostly due to the new scripting commands introduced in 1.56) +* You can now spawn missions in scheduled environment. + +### End "March 1, 2016" Test Branch From 04d263fb8c0c781eb607eb270d930257dbb67780 Mon Sep 17 00:00:00 2001 From: second_coming Date: Thu, 12 May 2016 12:29:02 +0100 Subject: [PATCH 02/21] SC submit v1 --- @ExileServer/addons/a3_dms/config.cpp | 2 +- .../a3_dms/missions/static/occupation.sqf | 288 ++++++++++++++++++ .../a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf | 2 +- .../a3_dms/scripts/fn_SpawnAISoldier.sqf | 2 +- 4 files changed, 291 insertions(+), 3 deletions(-) create mode 100644 @ExileServer/addons/a3_dms/missions/static/occupation.sqf diff --git a/@ExileServer/addons/a3_dms/config.cpp b/@ExileServer/addons/a3_dms/config.cpp index 12aae08..d09b50e 100644 --- a/@ExileServer/addons/a3_dms/config.cpp +++ b/@ExileServer/addons/a3_dms/config.cpp @@ -4,7 +4,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; - a3_DMS_version = "May 6, 2016 (TEST)"; + a3_DMS_version = "May 12, 2016 (TEST)"; requiredVersion = 1.36; requiredAddons[] = {"exile_client","exile_server_config"}; }; diff --git a/@ExileServer/addons/a3_dms/missions/static/occupation.sqf b/@ExileServer/addons/a3_dms/missions/static/occupation.sqf new file mode 100644 index 0000000..0557215 --- /dev/null +++ b/@ExileServer/addons/a3_dms/missions/static/occupation.sqf @@ -0,0 +1,288 @@ +/* + "Occupation" static mission for Altis, Chernarus, Namalsk and Taviana + Created by second_coming +*/ + +private["_wp","_wp2","_wp3"]; + +// For logging purposes +_num = DMS_MissionCount; + + +// Set mission side (only "bandit" is supported for now) +_side = "bandit"; + +// Default config is for Chernarus +_pos = [3810,8887,0]; +_missionName = "Vybor Occupation"; +_msgStart = ['#FFFF00',"Vybor is under martial law! There are reports they have a large weapon cache..."]; +_msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Vybor and secured the cache!"]; +_msgLOSE = ['#FF0000',"The troops have left Vybor, taking the cache with them..."]; + +if (worldName == 'Altis') then +{ + _pos = [12571,14337,0]; + _missionName = "Neochori Occupation"; + _msgStart = ['#FFFF00',"Neochori is under martial law! There are reports they have a large weapon cache..."]; + _msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Neochori and secured the cache!"]; + _msgLOSE = ['#FF0000',"The troops have left Neochori, taking the cache with them..."]; + +}; + +if (worldName == 'Taviana') then +{ + _pos = [14000,12220,0]; + _missionName = "Solibor Occupation"; + _msgStart = ['#FFFF00',"Solibor is under martial law! There are reports they have a large weapon cache..."]; + _msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Solibor and secured the cache!"]; + _msgLOSE = ['#FF0000',"The troops have left Solibor, taking the cache with them..."]; + +}; + +if (worldName == 'Namalsk') then +{ + _pos = [3926,7523,0]; + _missionName = "Norinsk Occupation"; + _msgStart = ['#FFFF00',"Norinsk is under martial law! There are reports they have a large weapon cache..."]; + _msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Norinsk and secured the cache!"]; + _msgLOSE = ['#FF0000',"The troops have left Norinsk, taking the cache with them..."]; + +}; + +diag_log text "[DMS]: Town Occupation Mission Started"; +_sc_xpos = _pos select 0; +_sc_ypos = _pos select 1; + +if ([_pos,DMS_StaticMinPlayerDistance] call DMS_fnc_IsPlayerNearby) exitWith {"delay"}; + + +// Set general mission difficulty +_difficulty = "hardcore"; + + +// Create AI +_AICount = 27; +_group1Count = ceil(_AICount/3); +_group2Count = ceil(_AICount/3); +_group3Count = ceil(_AICount/3); + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Get AI to defend the position +////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +_group = [_pos, _group1Count, _difficulty, "random", _side] call DMS_fnc_SpawnAIGroup; +[ _group,_pos,_difficulty,"COMBAT" ] call DMS_fnc_SetGroupBehavior; + +_buildings = _pos nearObjects ["building", 200]; +{ + _buildingPositions = [_x, 10] call BIS_fnc_buildingPositions; + if(count _buildingPositions > 0) then + { + _y = _x; + // Find Highest Point + _highest = [0,0,0]; + { + if(_x select 2 > _highest select 2) then + { + _highest = _x; + }; + + } foreach _buildingPositions; + _spawnPosition = _highest; + + _i = _buildingPositions find _spawnPosition; + _wp = _group addWaypoint [_spawnPosition,0] ; + _wp setWaypointFormation "Column"; + _wp setWaypointBehaviour "AWARE"; + _wp setWaypointCombatMode "RED"; + _wp setWaypointCompletionRadius 1; + _wp waypointAttachObject _y; + _wp setwaypointHousePosition _i; + _wp setWaypointType "MOVE"; + + }; + +} foreach _buildings; +if(count _buildings > 0 ) then +{ + _wp setWaypointType "CYCLE"; +}; + + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +_group2 = [ _pos, _group2Count, _difficulty, "random", _side] call DMS_fnc_SpawnAIGroup; +[ _group2,_pos,_difficulty,"COMBAT" ] call DMS_fnc_SetGroupBehavior; + +_buildings = _pos nearObjects ["building", 100]; +{ + _buildingPositions = [_x, 10] call BIS_fnc_buildingPositions; + if(count _buildingPositions > 0) then + { + _y = _x; + // Find Highest Point + _highest = [0,0,0]; + { + if(_x select 2 > _highest select 2) then + { + _highest = _x; + }; + + } foreach _buildingPositions; + _spawnPosition = _highest; + + _i = _buildingPositions find _spawnPosition; + _wp2 = _group2 addWaypoint [_spawnPosition,0] ; + _wp2 setWaypointFormation "Column"; + _wp2 setWaypointBehaviour "AWARE"; + _wp2 setWaypointCombatMode "RED"; + _wp2 setWaypointCompletionRadius 1; + _wp2 waypointAttachObject _y; + _wp2 setwaypointHousePosition _i; + _wp2 setWaypointType "MOVE"; + }; + +} foreach _buildings; +if(count _buildings > 0 ) then +{ + _wp2 setWaypointType "CYCLE"; +}; + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +_group3 = [_pos, _group3Count, _difficulty, "random", _side] call DMS_fnc_SpawnAIGroup; +[ _group3,_pos,_difficulty,"COMBAT" ] call DMS_fnc_SetGroupBehavior; + +_buildings = _pos nearObjects ["building", 100]; +{ + _buildingPositions = [_x, 10] call BIS_fnc_buildingPositions; + if(count _buildingPositions > 0) then + { + _y = _x; + // Find Highest Point + _highest = [0,0,0]; + { + if(_x select 2 > _highest select 2) then + { + _highest = _x; + }; + + } foreach _buildingPositions; + _spawnPosition = _highest; + + _i = _buildingPositions find _spawnPosition; + _wp3 = _group2 addWaypoint [_spawnPosition,0] ; + _wp3 setWaypointFormation "Column"; + _wp3 setWaypointBehaviour "AWARE"; + _wp3 setWaypointCombatMode "RED"; + _wp3 setWaypointCompletionRadius 1; + _wp3 waypointAttachObject _y; + _wp3 setwaypointHousePosition _i; + _wp3 setWaypointType "MOVE"; + + }; + +} foreach _buildings; +if(count _buildings > 0 ) then +{ + _wp3 setWaypointType "CYCLE"; +}; + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +// Get the AI to shut the fuck up :) +enableSentences false; +enableRadio false; + +// Create Crate +_crate = ["I_CargoNet_01_ammo_F",_pos] call DMS_fnc_SpawnCrate; + + +// Define mission-spawned AI Units +_missionAIUnits = +[ + [_group,_group2,_group3] +]; + +// Define the group reinforcements +_groupReinforcementsInfo = []; + +// Define mission-spawned objects and loot values +_missionObjs = +[ + [_missionAIUnits], // armed AI vehicle and static gun(s). Note, we don't add the base itself because we don't want to delete it and respawn it if the mission respawns. + [], + [[_crate,[30 + (random 20),100 + (random 40),15 + (random 5)]]] // weapons,items,backpacks +]; + +// Create Markers +_markers = +[ + _pos, + _missionName, + _difficulty +] call DMS_fnc_CreateMarker; + +(_markers select 1) setMarkerSize [500,500]; + +// Record time here (for logging purposes, otherwise you could just put "diag_tickTime" into the "DMS_AddMissionToMonitor" parameters directly) +_time = diag_tickTime; + +// Parse and add mission info to missions monitor +_added = +[ + _pos, + [ + [ + "kill", + [_group,_group2,_group3] + ], + [ + "playerNear", + [_pos,100] + ] + ], + _groupReinforcementsInfo, + [ + _time, + DMS_StaticMissionTimeOut call DMS_fnc_SelectRandomVal + ], + _missionAIUnits, + _missionObjs, + [_missionName,_msgWIN,_msgLOSE], + _markers, + _side, + _difficulty, + [[],[]] +] call DMS_fnc_AddMissionToMonitor_Static; + +// Check to see if it was added correctly, otherwise delete the stuff +if !(_added) exitWith +{ + diag_log format ["DMS ERROR :: Attempt to set up mission %1 with invalid parameters for DMS_fnc_AddMissionToMonitor_Static! Deleting mission objects and resetting DMS_MissionCount.",_missionName]; + + _cleanup = []; + { + _cleanup pushBack _x; + } forEach _missionAIUnits; + + _cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1)); + + { + _cleanup pushBack (_x select 0); + } foreach (_missionObjs select 2); + + _cleanup call DMS_fnc_CleanUp; + + + // Delete the markers directly + {deleteMarker _x;} forEach _markers; + + + // Reset the mission count + DMS_MissionCount = DMS_MissionCount - 1; +}; + + +// Notify players +[_missionName,_msgStart] call DMS_fnc_BroadcastMissionStatus; + + +(format ["MISSION: (%1) :: Mission #%2 started at %3 with %4 AI units and %5 difficulty at time %6",_missionName,_num,_pos,_AICount,_difficulty,_time]) call DMS_fnc_DebugLog; \ No newline at end of file diff --git a/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf b/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf index c740cf5..cadd1c5 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf @@ -97,7 +97,7 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U { // Change message for players when they're actually LOSING poptabs _msgType = "notificationRequest"; - _msgParams = ["Whoops",[format ["Lost %1 poptabs from running over a %2 AI!",abs _moneyChange,_AIType]]]; + _msgParams = ["Whoops",[format ["Lost %1 poptabs for killing %2 AI!",abs _moneyChange,_AIType]]]; //changed wording, negative result is not necessarily a roadkill // With the error message the money value won't be updated on the client, so I just directly PVC the value. ExileClientPlayerMoney = _playerMoney; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf index 520e3da..415b046 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf @@ -129,7 +129,7 @@ else }; // Unit name -_unit setName format["[DMS %1 %2 %3]",toUpper _side,_class,floor(random 1000)]; +//_unit setName format["[DMS %1 %2 %3]",toUpper _side,_class,floor(random 1000)]; if (_customGearSet isEqualTo []) then { From b7d039e5d547410b78db37bdf5e6cd9b4a405840 Mon Sep 17 00:00:00 2001 From: second_coming Date: Thu, 12 May 2016 12:30:03 +0100 Subject: [PATCH 03/21] SC submit v2 --- @ExileServer/addons/a3_dms/config.sqf | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/@ExileServer/addons/a3_dms/config.sqf b/@ExileServer/addons/a3_dms/config.sqf index 19ee0e5..000bdf9 100644 --- a/@ExileServer/addons/a3_dms/config.sqf +++ b/@ExileServer/addons/a3_dms/config.sqf @@ -21,7 +21,7 @@ DMS_Use_Map_Config = true; // Whether or not to use config overwrites specific t For any questions regarding map-specific configs, please leave a reply in the DMS thread on the Exile forums. */ -DMS_Enable_RankChange = false; // Whether or not to use Rank Changes. +DMS_Enable_RankChange = false; // Whether or not to use Rank Changes. (Required 'true' if using Occupation) /* I am sharing this upgrade to all. If you utilize GR8 Humanity (fully compatible) or a custom version of a ranking system(simple variable changes), this will allow your players to score +/- for Bandit and Hero kills as well as a custom Survivor Faction added to DMS as well. You can still utilize the HERO / BANDIT / SURVIVOR respect and poptab settings for gameplay :) ENJOY! DONKEYPUNCH.INFO! */ @@ -215,26 +215,26 @@ DMS_SpawnMissions_Scheduled = false; // Whether or not to spawn missions in a sc ]; - DMS_StaticMissionTypes = [ // List of STATIC missions with spawn chances. - //["saltflats",1], //<--Example (already imported by default on Altis in map configs) - //["slums",1] //<--Example (already imported by default on Altis in map configs) - + DMS_StaticMissionTypes = [ // List of STATIC missions with spawn chances. + //["saltflats",1] //<--Example (already imported by default on Altis in map configs) + //["slums",1] //<--Example (already imported by default on Altis in map configs) + //["occupation",1] //<--Example //["sectorB",1] //<--Example for Taviana ]; - DMS_BasesToImportOnServerStart = [ // List of static bases to import on server startup (spawned post-init). This will reduce the amount of work the server has to do when it actually spawns static missions, and players won't be surprised when a base suddenly pops up. You can also include any other M3E-exported bases to spawn here. + DMS_BasesToImportOnServerStart = [ // List of static bases to import on server startup (spawned post-init). This will reduce the amount of work the server has to do when it actually spawns static missions, and players won't be surprised when a base suddenly pops up. You can also include any other M3E-exported bases to spawn here. //"saltflatsbase", //<--Example (already imported by default on Altis) - //"slums_objects" //<--Example (already imported by default on Altis) + //"slums_objects" //<--Example (already imported by default on Altis) ]; DMS_BanditMissionsOnServerStart = [ //"construction" //<-- Example ]; - DMS_StaticMissionsOnServerStart = [ // List of STATIC missions with spawn chances. - //"saltflats", //<--Example - //"slums //<--Example - + DMS_StaticMissionsOnServerStart = [ // List of STATIC missions with spawn chances. + //"saltflats" //<--Example + //"slums" //<--Example + //"occupation" //<--Example //"sectorB" //<--Example for Taviana ]; From bcc099583bfd0608033d655e1e0839453f5e4726 Mon Sep 17 00:00:00 2001 From: second_coming Date: Thu, 12 May 2016 19:13:45 +0100 Subject: [PATCH 04/21] SC submit v3 --- @ExileServer/addons/a3_dms/config.sqf | 3 ++- @ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/@ExileServer/addons/a3_dms/config.sqf b/@ExileServer/addons/a3_dms/config.sqf index 000bdf9..016e3bb 100644 --- a/@ExileServer/addons/a3_dms/config.sqf +++ b/@ExileServer/addons/a3_dms/config.sqf @@ -253,7 +253,8 @@ DMS_SpawnMissions_Scheduled = false; // Whether or not to spawn missions in a sc /* AI Settings */ DMS_AI_Classname = "O_recon_F"; // Since some of you wanted this... - + DMS_AI_UseRealNames = true; // true if you want Arma assigned real names, false if you want random DMS assigned unit numbers + DMS_Show_Kill_Poptabs_Notification = true; // Whether or not to show the poptabs gained/lost message on the player's screen when killing an AI. (It will still change the player's money, it just won't show the "Money Received" notification) DMS_Show_Kill_Respect_Notification = true; // Whether or not to show the "Frag Message" on the player's screen when killing an AI. (It will still change the player's respect, it just won't show the "AI Killed" frag message) DMS_Show_Kill_Rank_Notification = true; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf index 415b046..257d997 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf @@ -128,8 +128,11 @@ else }; }; -// Unit name -//_unit setName format["[DMS %1 %2 %3]",toUpper _side,_class,floor(random 1000)]; +// Set random DMS unit names if you don't want Arma assigned (real names) +if !(DMS_AI_UseRealNames) then +{ + _unit setName format["[DMS %1 %2 %3]",toUpper _side,_class,floor(random 1000)]; +}; if (_customGearSet isEqualTo []) then { From 218d65b8a0181322c2b4200ba8740026db8fb94d Mon Sep 17 00:00:00 2001 From: eraser1 Date: Sun, 15 May 2016 13:55:18 -0500 Subject: [PATCH 05/21] Fixes + micro-optimizations --- @ExileServer/addons/a3_dms/config.cpp | 2 +- @ExileServer/addons/a3_dms/config.sqf | 9 +-- @ExileServer/addons/a3_dms/fn_DMS_preInit.sqf | 11 ++- .../a3_dms/scripts/fn_AILocalityManager.sqf | 5 +- .../addons/a3_dms/scripts/fn_FillCrate.sqf | 73 ++++++++++--------- .../addons/a3_dms/scripts/fn_FindSafePos.sqf | 9 ++- .../scripts/fn_GroupReinforcementsManager.sqf | 4 +- .../scripts/fn_HeliParatroopers_Monitor.sqf | 7 +- .../a3_dms/scripts/fn_MissionParams.sqf | 11 ++- .../addons/a3_dms/scripts/fn_OnKilled.sqf | 22 +++--- .../a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf | 4 +- .../a3_dms/scripts/fn_SelectMission.sqf | 2 +- .../addons/a3_dms/scripts/fn_SpawnAIGroup.sqf | 9 ++- .../scripts/fn_SpawnAIGroup_MultiPos.sqf | 10 +-- .../a3_dms/scripts/fn_SpawnAIStaticMG.sqf | 4 +- .../scripts/fn_SpawnHeliReinforcement.sqf | 6 +- .../a3_dms/scripts/fn_SpawnMinefield.sqf | 6 +- .../a3_dms/scripts/fn_SpawnStaticMission.sqf | 2 +- README.md | 5 ++ 19 files changed, 103 insertions(+), 98 deletions(-) diff --git a/@ExileServer/addons/a3_dms/config.cpp b/@ExileServer/addons/a3_dms/config.cpp index 12aae08..6537e84 100644 --- a/@ExileServer/addons/a3_dms/config.cpp +++ b/@ExileServer/addons/a3_dms/config.cpp @@ -4,7 +4,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; - a3_DMS_version = "May 6, 2016 (TEST)"; + a3_DMS_version = "May 15, 2016 (TEST)"; requiredVersion = 1.36; requiredAddons[] = {"exile_client","exile_server_config"}; }; diff --git a/@ExileServer/addons/a3_dms/config.sqf b/@ExileServer/addons/a3_dms/config.sqf index 19ee0e5..1793772 100644 --- a/@ExileServer/addons/a3_dms/config.sqf +++ b/@ExileServer/addons/a3_dms/config.sqf @@ -6,13 +6,6 @@ */ -// Enables debug logging in DMS functions. -// Logs will be written in the RPT, and if you have infiSTAR's "ARMA_LOG" DLL loaded, it will also produce logs in the server directory. -// If you have mARMA by maca134, DMS will also utilize mARMA logs. -// This will produce A LOT of logs, so make sure you leave it to false unless you know what you're doing. -DMS_DEBUG = false; - - DMS_Use_Map_Config = true; // Whether or not to use config overwrites specific to the map. /* @@ -240,7 +233,7 @@ DMS_SpawnMissions_Scheduled = false; // Whether or not to spawn missions in a sc - DMS_findSafePosBlacklist = [ // For BIS_fnc_findSafePos position blacklist info refer to: http://www.exilemod.com/topic/61-dms-defents-mission-system/?page=18#comment-31190 + DMS_findSafePosBlacklist = [ // For position blacklist info refer to: http://www.exilemod.com/topic/61-dms-defents-mission-system/?do=findComment&comment=31190 // An example is given in the altis_config.sqf (it blacklists the salt flats). /* // Blacklists most of the Northern Taviana Volcano diff --git a/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf b/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf index c2f1e89..313bbfa 100644 --- a/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf +++ b/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf @@ -4,7 +4,13 @@ */ #define CALLFILE(FILE) call compile preprocessFileLineNumbers FILE; -DMS_HC_Object = objNull; +// Enables debug logging in DMS functions. !!!NOTE:!!! You must uncomment the line above if you want DMS to even check whether or not debug mode is enabled! +// Logs will be written in the RPT, and if you have infiSTAR's "ARMA_LOG" DLL loaded, it will also produce logs in the server directory. +// If you have mARMA by maca134, DMS will also utilize mARMA logs. +// This will produce A LOT of logs, so make sure you leave it to false unless you know what you're doing. +DMS_DEBUG = false; + + DMS_CleanUpList = []; @@ -42,6 +48,9 @@ M3E_fnc_getCenter = DMS_fnc_GetCenter; M3E_fnc_subArr = DMS_fnc_SubArr; +// Because I fucked up the name on first implementation and don't want to mess anybody up who didn't realize to change every occurence of "DMS_MaxSurfaceNormal" to "DMS_MinSurfaceNormal". +DMS_MaxSurfaceNormal = DMS_MinSurfaceNormal; + DMS_AttemptsUntilThrottle = DMS_AttemptsUntilThrottle + 1; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_AILocalityManager.sqf b/@ExileServer/addons/a3_dms/scripts/fn_AILocalityManager.sqf index a93f711..bc611fd 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_AILocalityManager.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_AILocalityManager.sqf @@ -21,8 +21,9 @@ if (!DMS_ai_offload_to_client) exitWith {}; private _groupOwner = groupOwner _group; private _ownerObj = objNull; + private _isLocal = local _group; - if !(local _group) then // Only check for the group owner in players if it doesn't belong to the server. + if !(_isLocal) then // Only check for the group owner in players if it doesn't belong to the server. { { if (_groupOwner isEqualTo (owner _x)) exitWith @@ -33,7 +34,7 @@ if (!DMS_ai_offload_to_client) exitWith {}; }; // 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 + if (((isNull _ownerObj) || {(_ownerObj distance2D _leader)>3500}) && {!([_group,_leader] call DMS_fnc_SetAILocality)} && {!_isLocal}) then { // Reset locality to the server _group setGroupOwner 2; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf b/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf index 3d4e896..dabd81a 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf @@ -114,46 +114,52 @@ if (_crate getVariable ["DMS_CrateEnableRope",DMS_EnableBoxMoving]) then if ((_lootValues isEqualType []) && {!((_lootValues select 1) isEqualType {})}) then { - private ["_wepCount", "_weps", "_itemCount", "_items", "_backpackCount", "_backpacks"]; - // Weapons - if ((_lootValues select 0) isEqualType []) then - { - _wepCount = (_lootValues select 0) select 0; - _weps = (_lootValues select 0) select 1; - } - else - { - _wepCount = _lootValues select 0; - _weps = DMS_boxWeapons; - }; + private _wepValues = _lootValues select 0; + private _wepCount = 0; + private _weps = + if (_wepValues isEqualType []) then + { + _wepCount = _wepValues select 0; + _wepValues select 1 + } + else + { + _wepCount = _wepValues; + DMS_boxWeapons + }; // Items - if ((_lootValues select 1) isEqualType []) then - { - _itemCount = (_lootValues select 1) select 0; - _items = (_lootValues select 1) select 1; - } - else - { - _itemCount = _lootValues select 1; - _items = DMS_boxItems; - }; + private _itemValues = _lootValues select 1; + private _itemCount = 0; + private _items = + if (_itemValues isEqualType []) then + { + _itemCount = _itemValues select 0; + _itemValues select 1 + } + else + { + _itemCount = _itemValues; + DMS_boxItems + }; // Backpacks - if ((_lootValues select 2) isEqualType []) then - { - _backpackCount = (_lootValues select 2) select 0; - _backpacks = (_lootValues select 2) select 1; - } - else - { - _backpackCount = _lootValues select 2; - _backpacks = DMS_boxBackpacks; - }; - + private _backpackValues = _lootValues select 2; + private _backpackCount = 0; + private _backpacks = + if ((_backpackValues) isEqualType []) then + { + _backpackCount = _backpackValues select 0; + _backpackValues select 1 + } + else + { + _backpackCount = _backpackValues; + DMS_boxBackpacks + }; if (DMS_DEBUG) then { @@ -260,7 +266,6 @@ else _crate addBackpackCargoGlobal _x; } forEach _backpacks; - if (DMS_DEBUG) then { (format["FillCrate :: Filled crate %1 (at %5) with weapons |%2|, items |%3|, and backpacks |%4|",_crate, _weps, _items, _backpacks, getPosATL _crate]) call DMS_fnc_DebugLog; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos.sqf b/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos.sqf index 1d2dc52..08ea615 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos.sqf @@ -20,8 +20,6 @@ */ #define MAX_ATTEMPTS 5000 -private ["_pos", "_presetLocs", "_attempts"]; - params [ ["_nearestObjectMinDistance", 25, [0] ], @@ -45,6 +43,7 @@ DMS_DebugMarkers = []; private _isValidSpot = false; +private _presetLocs = []; private _presetLocsLength = 0; if (DMS_UsePredefinedMissionLocations) then @@ -55,6 +54,8 @@ if (DMS_UsePredefinedMissionLocations) then }; +private _pos = []; + for "_attempts" from 1 to MAX_ATTEMPTS do { _pos = @@ -64,7 +65,7 @@ for "_attempts" from 1 to MAX_ATTEMPTS do } else { - [DMS_MinMax_X_Coords call DMS_fnc_SelectRandomVal,DMS_MinMax_Y_Coords call DMS_fnc_SelectRandomVal] isFlatEmpty [_nearestObjectMinDistance, 0, 9999, 1, 0, _waterSpawn, objNull] + [DMS_MinMax_X_Coords call DMS_fnc_SelectRandomVal,DMS_MinMax_Y_Coords call DMS_fnc_SelectRandomVal] isFlatEmpty [_nearestObjectMinDistance, 0, 9999, 1, 0, -1, objNull] }; /* @@ -97,7 +98,7 @@ for "_attempts" from 1 to MAX_ATTEMPTS do if (_isValidSpot) exitWith {}; }; -if (_attempts isEqualTo MAX_ATTEMPTS) exitWith +if !(_isValidSpot) exitWith { diag_log format["DMS ERROR :: Number of attempts in DMS_fnc_findSafePos (%1) reached maximum number of attempts!",MAX_ATTEMPTS]; }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_GroupReinforcementsManager.sqf b/@ExileServer/addons/a3_dms/scripts/fn_GroupReinforcementsManager.sqf index 96d0495..980a815 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_GroupReinforcementsManager.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_GroupReinforcementsManager.sqf @@ -545,7 +545,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the if ((!isNil "_unitsToSpawn") && {_unitsToSpawn>0}) then { - private ["_spawnPos"]; + private _spawnPos = []; if (_maxReinforcementUnits>0) then { @@ -583,7 +583,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the // Add extra spawning locations if there are not enough. for "_i" from 0 to (_unitsToSpawn-_spawningLocations_count-1) do { - _spawningLocations pushBack (_spawningLocations select floor(random(_spawningLocations_count+_i))); + _spawningLocations pushBack (selectRandom _spawningLocations); }; // Now to spawn the AI... diff --git a/@ExileServer/addons/a3_dms/scripts/fn_HeliParatroopers_Monitor.sqf b/@ExileServer/addons/a3_dms/scripts/fn_HeliParatroopers_Monitor.sqf index 26fb8c9..d09e0f4 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_HeliParatroopers_Monitor.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_HeliParatroopers_Monitor.sqf @@ -70,7 +70,7 @@ if ((_heli distance2D _dropPoint)<200) then { - private ["_groupOwner"]; + private _groupOwner = []; private _AIGroup = group _heli; @@ -89,8 +89,7 @@ { /* moveOut _unit; - private ["_parachute", "_dir"]; - _parachute = createVehicle ["Steerable_Parachute_F", (getPosATL _unit), [], 0, "CAN_COLLIDE"]; + private _parachute = createVehicle ["Steerable_Parachute_F", (getPosATL _unit), [], 0, "CAN_COLLIDE"]; _parachute setDir (getDir _unit); _parachute enableSimulationGlobal true; @@ -149,7 +148,7 @@ // Revert and unlock locality if necessary. - if !(isNil "_groupOwner") then + if !(_groupOwner isEqualTo []) then { _AIGroup setGroupOwner _groupOwner; _AIGroup setVariable ["DMS_LockLocality", false]; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_MissionParams.sqf b/@ExileServer/addons/a3_dms/scripts/fn_MissionParams.sqf index ad0ec66..5ffebd1 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_MissionParams.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_MissionParams.sqf @@ -47,8 +47,7 @@ ] */ -private ["_missionPosition"]; - +private _missionPosition = []; private _extraParams = []; @@ -62,7 +61,7 @@ if (isNil "_this") then // Simply use generated position with default values. _missionPosition = [ - 25,DMS_WaterNearBlacklist,DMS_MaxSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist,DMS_ThrottleBlacklists + 25,DMS_WaterNearBlacklist,DMS_MinSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist,DMS_ThrottleBlacklists ] call DMS_fnc_FindSafePos; } else @@ -71,7 +70,7 @@ else { if (params [ - ["_findSafePosParams",[25,DMS_WaterNearBlacklist,DMS_MaxSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist,DMS_ThrottleBlacklists],[[]]], + ["_findSafePosParams",[25,DMS_WaterNearBlacklist,DMS_MinSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist,DMS_ThrottleBlacklists],[[]]], ["_posInfo",[],[[]],[1,2]] ]) then @@ -98,7 +97,7 @@ else _missionPosition set [2,0]; }; - if (!_forceSpawn && {!([_missionPosition,DMS_WaterNearBlacklist,DMS_MaxSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist] call DMS_fnc_IsValidPosition)}) then + if (!_forceSpawn && {!([_missionPosition,DMS_WaterNearBlacklist,DMS_MinSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist] call DMS_fnc_IsValidPosition)}) then { if (DMS_DEBUG) then { @@ -124,7 +123,7 @@ else { _missionPosition = [ - 25,DMS_WaterNearBlacklist,DMS_MaxSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist,DMS_ThrottleBlacklists + 25,DMS_WaterNearBlacklist,DMS_MinSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist,DMS_ThrottleBlacklists ] call DMS_fnc_FindSafePos; _extraParams = _this; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf b/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf index 46c9867..0ad65ac 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_OnKilled.sqf @@ -50,12 +50,12 @@ moveOut _unit; _unit removeAllEventHandlers "HandleDamage"; // Remove gear according to configs -if (DMS_clear_AI_body && {(random 100) <= DMS_clear_AI_body_chance}) then +if ((_unit getVariable ["DMS_clear_AI_body",DMS_clear_AI_body]) && {(random 100) <= (_unit getVariable ["DMS_clear_AI_body_chance",DMS_clear_AI_body_chance])}) then { _unit call _removeAll; }; -if (DMS_ai_remove_launchers && {(_launcherVar != "") || {_launcher != ""}}) then +if ((_unit getVariable ["DMS_ai_remove_launchers",DMS_ai_remove_launchers]) && {(_launcherVar != "") || {_launcher != ""}}) then { // Because arma is stupid sometimes if (_launcher isEqualTo "") then @@ -91,7 +91,7 @@ if (DMS_ai_remove_launchers && {(_launcherVar != "") || {_launcher != ""}}) then } forEach (magazines _unit); }; -if(DMS_RemoveNVG) then +if (_unit getVariable ["DMS_RemoveNVG",DMS_RemoveNVG]) then { _unit unlinkItem "NVGoggles"; }; @@ -188,9 +188,9 @@ if (!isNull _av) then _grp setVariable ["DMS_LockLocality",true]; // The AI has to be local in order for these commands to work, so I reset locality, just because it's really difficult to deal with otherwise - if (_owner!=2) then + if !(_owner in [2,0]) then { - diag_log format ["Temporarily setting owner of %1 to server from %2. Success: %3",_grp,_owner,_grp setGroupOwner 2]; + diag_log format ["DMS Seat Switcher :: Temporarily setting owner of %1 to server from %2. Success: %3",_grp,_owner,_grp setGroupOwner 2]; }; sleep 5+(random 3); // 5 to 8 seconds delay after gunner death @@ -227,7 +227,7 @@ if (!isNull _av) then (format["OnKilled :: Switched driver of AI Vehicle (%1) to gunner.",typeOf _av]) call DMS_fnc_DebugLog; }; - if (_owner!=2) then + if !(_owner in [2,0]) then { private _start = time; @@ -261,7 +261,7 @@ if (!isNull _av) then sleep 15; - diag_log format ["Resetting ownership of %1 to %2. Success: %3",_grp,_owner,_grp setGroupOwner _owner]; + diag_log format ["DMS Seat Switcher :: Resetting ownership of %1 to %2. Success: %3",_grp,_owner,_grp setGroupOwner _owner]; }; _grp setVariable ["DMS_LockLocality",false]; @@ -293,7 +293,7 @@ if (isPlayer _killer) then _roadKilled = true; - if (DMS_explode_onRoadkill) then + if (_unit getVariable ["DMS_explode_onRoadkill",DMS_explode_onRoadkill]) then { private _boom = createVehicle ["SLAMDirectionalMine_Wire_Ammo", [0,0,100], [], 0, "CAN_COLLIDE"]; _boom setPosATL (getPosATL _playerObj); @@ -306,7 +306,7 @@ if (isPlayer _killer) then // Remove gear from roadkills if configured to do so - if (DMS_remove_roadkill && {(random 100) <= DMS_remove_roadkill_chance}) then + if ((_unit getVariable ["DMS_remove_roadkill",DMS_remove_roadkill]) && {(random 100) <= (_unit getVariable ["DMS_remove_roadkill_chance",DMS_remove_roadkill_chance])}) then { _unit call _removeAll; }; @@ -316,7 +316,7 @@ if (isPlayer _killer) then // Reveal the killer to the AI units - if (DMS_ai_share_info) then + if (_unit getVariable ["DMS_ai_share_info",DMS_ai_share_info]) then { private _revealAmount = 4.0; @@ -333,7 +333,7 @@ if (isPlayer _killer) then { - if ((alive _x) && {!(isPlayer _x) && {(_x distance2D _unit) <= DMS_ai_share_info_distance}}) then + if ((alive _x) && {!(isPlayer _x) && {(_x distance2D _unit) <= (_unit getVariable ["DMS_ai_share_info_distance",DMS_ai_share_info_distance])}}) then { _x reveal [_killer, _revealAmount max (_x knowsAbout _playerObj)]; }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf b/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf index c740cf5..82eb346 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf @@ -83,7 +83,7 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U if (_moneyChange!=0) then { - private ["_distance"]; + private _distance = []; // Set client's money // I also make sure that they don't get negative poptabs @@ -202,7 +202,7 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U "%1 killed %2 from %3 meters away and received %4 poptabs, and %5 respect.", name _playerObj, _unitName, - if !(isNil "_distance") then {_distance} else {floor(_unit distance _playerObj)}, + if (_distance isEqualTo []) then {floor(_unit distance _playerObj)} else {_distance}, _moneyChange, _repChange ]; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SelectMission.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SelectMission.sqf index 1a8fe15..e62a6cb 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SelectMission.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SelectMission.sqf @@ -46,7 +46,7 @@ if (diag_fps >= DMS_MinServerFPS && {(count allPlayers) >= DMS_MinPlayerCount}) if (_availableMissions isEqualTo []) exitWith { - DMS_StaticMissionLastStart = _time; + DMS_StaticMissionLastStar if (DMS_DEBUG) then { (format ["SelectMission :: No available missions! Running missions: %1", DMS_RunningStaticMissions]) call DMS_fnc_DebugLog; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf index 1c2670a..0e87300 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf @@ -15,8 +15,6 @@ Returns AI Group */ -private ["_launcherType"]; - if !(params [ @@ -44,6 +42,9 @@ if (DMS_DEBUG) then (format["SpawnAIGroup :: Spawning %1 %2 %3 AI at %4 with %5 difficulty.",_count,_class,_side,_pos,_difficulty]) call DMS_fnc_DebugLog; }; + +private _launcherType = ""; + // if soldier have AT/AA weapons if (_class isEqualType []) then { @@ -80,9 +81,9 @@ for "_i" from 1 to _count do }; // An AI will definitely spawn with a launcher if you define type -if ((!isNil "_launcherType") || {DMS_ai_use_launchers && {DMS_ai_launchers_per_group>0}}) then +if ((DMS_ai_use_launchers && {DMS_ai_launchers_per_group>0}) || {!_launcherType isEqualTo ""}) then { - if (isNil "_launcherType") then + if (_launcherType isEqualTo "") then { _launcherType = "AT"; }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf index f263b1e..341885d 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf @@ -23,9 +23,6 @@ Returns AI Group */ -private ["_launcherType"]; - - if !(params [ ["_positions","_positions ERROR",[[]]], @@ -60,6 +57,9 @@ if (DMS_DEBUG) then (format["SpawnAIGroup_MultiPos :: Spawning %1 %2 %3 AI at positions %4 with %5 difficulty.",_count,_class,_side,_positions,_difficulty]) call DMS_fnc_DebugLog; }; + +private _launcherType = ""; + // if soldier have AT/AA weapons if (_class isEqualType []) then { @@ -97,9 +97,9 @@ for "_i" from 1 to _count do }; // An AI will definitely spawn with a launcher if you define type -if ((!isNil "_launcherType") || {DMS_ai_use_launchers && {DMS_ai_launchers_per_group>0}}) then +if ((DMS_ai_use_launchers && {DMS_ai_launchers_per_group>0}) || {!_launcherType isEqualTo ""}) then { - if (isNil "_launcherType") then + if (_launcherType isEqualTo "") then { _launcherType = "AT"; }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf index 03a1caa..6fff976 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf @@ -37,7 +37,7 @@ exitWith private _MGClassInput = if ((count _this)>5) then { - param [5]; + _this select 5 } else { @@ -60,8 +60,6 @@ private _guns = _positions apply _group addVehicle _gun; - _guns pushBack _gun; - private _unit = [_group,_x,_class,_difficulty,_side,"Static"] call DMS_fnc_SpawnAISoldier; _unit moveInGunner _gun; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnHeliReinforcement.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnHeliReinforcement.sqf index 80ab9f0..843a00c 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnHeliReinforcement.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnHeliReinforcement.sqf @@ -21,9 +21,6 @@ Returns the index of the paratrooper info in "DMS_HeliParatrooper_Arr", -1 on error. */ -private ["_pilot", "_paratrooperCount", "_unit", "_cargoIndex"]; - - if !(params [ ["_AIGroup", 0, [grpNull]], @@ -114,7 +111,7 @@ private _units = (fullCrew [_heli, "", true]) apply _unit = [_AIGroup,_spawnPos,_class,_difficulty,_side,"Vehicle"] call DMS_fnc_SpawnAISoldier; _unit moveInDriver _heli; _unit setVariable ["DMS_AssignedVeh",_heli]; - _pilot = _unit; + _unit setDestination [_dropPoint, "VEHICLE PLANNED", true]; }; case "commander"; @@ -155,7 +152,6 @@ private _units = (fullCrew [_heli, "", true]) apply // Set the heli pilot's behavior. -_pilot setDestination [_dropPoint, "VEHICLE PLANNED", true]; _heli flyInHeight DMS_RHeli_Height; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf index 9fe8e24..b39a8df 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf @@ -65,10 +65,8 @@ if (DMS_SpawnMinesAroundMissions) then for "_i" from 1 to _mineCount do { - private ["_minePos", "_mine"]; - - _minePos = _centerPos getPos [random _radius,random 360]; - _mine = createMine ["ATMine", [0,0,0], [], 0]; + private _minePos = _centerPos getPos [random _radius,random 360]; + private _mine = createMine ["ATMine", [0,0,0], [], 0]; // Fixes players shooting the mine and causing premature 'splosions if (DMS_BulletProofMines) then diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnStaticMission.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnStaticMission.sqf index cfe1f55..61dcd5d 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnStaticMission.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnStaticMission.sqf @@ -48,6 +48,7 @@ try DMS_MissionCount = DMS_MissionCount - 1; // This will cause mission spawning to run in scheduled, but that should be a fairly minor issue. [60, DMS_fnc_SpawnStaticMission, [_missionType], false] call ExileServer_system_thread_addTask; + if (DMS_DEBUG) then { (format ["SpawnStaticMission :: Mission ""%1"" requested delay",_missionType]) call DMS_fnc_DebugLog; @@ -58,7 +59,6 @@ try DMS_StaticMissionLastStart = diag_tickTime; DMS_RunningStaticMissions pushBack _missionType; - if (DMS_DEBUG) then { (format ["SpawnStaticMission :: Spawned mission %1 with parameters (%2) | DMS_StaticMissionDelay set to %3 seconds", _missionType, _parameters, DMS_StaticMissionDelay]) call DMS_fnc_DebugLog; diff --git a/README.md b/README.md index 9b1495e..b798e28 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,7 @@ ___ - [Valthos from The Altis Project](https://www.thealtisproject.co.uk/) - [Flowrider from Optimum Gaming](http://www.optimum-multigaming.com/) - [CEN from ATD Gaming](http://atdgaming.com/) +- [second coming from ExileYorkshire](http://exileyorkshire.co.uk/) ___ @@ -153,6 +154,10 @@ ___ # Changelog: ### Test Branch: +#### May 14, 2016 (2:00 PM CST-America): +* More Micro-optimizations. +* Fixed a lot of various errors from the last test branch update. + #### May 6, 2016 (10:45 PM CST-America): * **NEW CONFIG VALUES:** From 146ad20edc87858e826e96883fce9d960a7f6e6c Mon Sep 17 00:00:00 2001 From: eraser1 Date: Mon, 16 May 2016 10:55:43 -0500 Subject: [PATCH 06/21] Derp --- @ExileServer/addons/a3_dms/config.cpp | 2 +- @ExileServer/addons/a3_dms/missions/static/occupation.sqf | 8 +++++--- @ExileServer/addons/a3_dms/scripts/fn_FindSafePos.sqf | 2 +- README.md | 6 +++++- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/@ExileServer/addons/a3_dms/config.cpp b/@ExileServer/addons/a3_dms/config.cpp index 6537e84..e602e23 100644 --- a/@ExileServer/addons/a3_dms/config.cpp +++ b/@ExileServer/addons/a3_dms/config.cpp @@ -4,7 +4,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; - a3_DMS_version = "May 15, 2016 (TEST)"; + a3_DMS_version = "May 16, 2016 (TEST)"; requiredVersion = 1.36; requiredAddons[] = {"exile_client","exile_server_config"}; }; diff --git a/@ExileServer/addons/a3_dms/missions/static/occupation.sqf b/@ExileServer/addons/a3_dms/missions/static/occupation.sqf index 5b0d63a..d1228c0 100644 --- a/@ExileServer/addons/a3_dms/missions/static/occupation.sqf +++ b/@ExileServer/addons/a3_dms/missions/static/occupation.sqf @@ -6,7 +6,7 @@ private["_wp","_wp2","_wp3","_pos","_missionName","_msgStart","_msgWIN","_msgLOSE"]; // For logging purposes -_num = DMS_MissionCount; +private _num = DMS_MissionCount; // Set mission side (only "bandit" is supported for now) @@ -291,5 +291,7 @@ if !(_added) exitWith // Notify players [_missionName,_msgStart] call DMS_fnc_BroadcastMissionStatus; - -(format ["MISSION: (%1) :: Mission #%2 started at %3 with %4 AI units and %5 difficulty at time %6",_missionName,_num,_pos,_AICount,_difficulty,_time]) call DMS_fnc_DebugLog; +if (DMS_DEBUG) then +{ + (format ["MISSION: (%1) :: Mission #%2 started at %3 with %4 AI units and %5 difficulty at time %6",_missionName,_num,_pos,_AICount,_difficulty,_time]) call DMS_fnc_DebugLog; +}; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos.sqf b/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos.sqf index 08ea615..49984cc 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos.sqf @@ -65,7 +65,7 @@ for "_attempts" from 1 to MAX_ATTEMPTS do } else { - [DMS_MinMax_X_Coords call DMS_fnc_SelectRandomVal,DMS_MinMax_Y_Coords call DMS_fnc_SelectRandomVal] isFlatEmpty [_nearestObjectMinDistance, 0, 9999, 1, 0, -1, objNull] + [DMS_MinMax_X_Coords call DMS_fnc_SelectRandomVal,DMS_MinMax_Y_Coords call DMS_fnc_SelectRandomVal] isFlatEmpty [_nearestObjectMinDistance, 0, -1, 1, -1, false, objNull] }; /* diff --git a/README.md b/README.md index a2517c6..69f6dda 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,11 @@ ___ # Changelog: ### Test Branch: -#### May 14, 2016 (2:00 PM CST-America): +#### May 16, 2016 (11:00 AM CST-America): +* Occupation will now print debug logs only if DMS_DEBUG is enabled. +* Fixed an error with fn_FindSafePos. + +#### May 15, 2016 (2:00 PM CST-America): * **NEW CONFIG VALUES:** DMS_AI_UseRealNames From 1244550ded67ed0af06b1e13b26a8cc81b3b90fc Mon Sep 17 00:00:00 2001 From: eraser1 Date: Mon, 16 May 2016 17:41:33 -0500 Subject: [PATCH 07/21] Derp #2 --- @ExileServer/addons/a3_dms/config.cpp | 2 +- @ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf | 2 +- .../addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf | 2 +- README.md | 3 +++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/@ExileServer/addons/a3_dms/config.cpp b/@ExileServer/addons/a3_dms/config.cpp index e602e23..7f567e5 100644 --- a/@ExileServer/addons/a3_dms/config.cpp +++ b/@ExileServer/addons/a3_dms/config.cpp @@ -4,7 +4,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; - a3_DMS_version = "May 16, 2016 (TEST)"; + a3_DMS_version = "May 16, 2016 (TESTv2)"; requiredVersion = 1.36; requiredAddons[] = {"exile_client","exile_server_config"}; }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf index 0e87300..c95caa3 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf @@ -81,7 +81,7 @@ for "_i" from 1 to _count do }; // An AI will definitely spawn with a launcher if you define type -if ((DMS_ai_use_launchers && {DMS_ai_launchers_per_group>0}) || {!_launcherType isEqualTo ""}) then +if ((DMS_ai_use_launchers && {DMS_ai_launchers_per_group>0}) || {!(_launcherType isEqualTo "")}) then { if (_launcherType isEqualTo "") then { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf index 341885d..ea653f4 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf @@ -97,7 +97,7 @@ for "_i" from 1 to _count do }; // An AI will definitely spawn with a launcher if you define type -if ((DMS_ai_use_launchers && {DMS_ai_launchers_per_group>0}) || {!_launcherType isEqualTo ""}) then +if ((DMS_ai_use_launchers && {DMS_ai_launchers_per_group>0}) || {!(_launcherType isEqualTo "")}) then { if (_launcherType isEqualTo "") then { diff --git a/README.md b/README.md index 69f6dda..91da71c 100644 --- a/README.md +++ b/README.md @@ -154,6 +154,9 @@ ___ # Changelog: ### Test Branch: +#### May 16, 2016 (11:00 AM CST-America): +* Fixed an error in fn_SpawnAIGroup (and MultiPos variant) + #### May 16, 2016 (11:00 AM CST-America): * Occupation will now print debug logs only if DMS_DEBUG is enabled. * Fixed an error with fn_FindSafePos. From 725487340e80f376b471c87ba4f84436f2bdeb22 Mon Sep 17 00:00:00 2001 From: eraser1 Date: Sun, 22 May 2016 00:05:16 -0500 Subject: [PATCH 08/21] ArmA AI need some ICE... --- @ExileServer/addons/a3_dms/config.cpp | 2 +- @ExileServer/addons/a3_dms/config.sqf | 7 ++ .../addons/a3_dms/fn_DMS_postInit.sqf | 7 ++ @ExileServer/addons/a3_dms/fn_DMS_preInit.sqf | 1 + .../a3_dms/objects/static/saltflatsbase.sqf | 3 +- .../a3_dms/scripts/fn_AILocalityManager.sqf | 2 +- .../a3_dms/scripts/fn_FreezeManager.sqf | 67 +++++++++++++++++++ README.md | 19 ++++-- 8 files changed, 99 insertions(+), 9 deletions(-) create mode 100644 @ExileServer/addons/a3_dms/scripts/fn_FreezeManager.sqf diff --git a/@ExileServer/addons/a3_dms/config.cpp b/@ExileServer/addons/a3_dms/config.cpp index 7f567e5..bbfe86d 100644 --- a/@ExileServer/addons/a3_dms/config.cpp +++ b/@ExileServer/addons/a3_dms/config.cpp @@ -4,7 +4,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; - a3_DMS_version = "May 16, 2016 (TESTv2)"; + a3_DMS_version = "May 22, 2016 (TEST)"; requiredVersion = 1.36; requiredAddons[] = {"exile_client","exile_server_config"}; }; diff --git a/@ExileServer/addons/a3_dms/config.sqf b/@ExileServer/addons/a3_dms/config.sqf index 6e4da66..4be267e 100644 --- a/@ExileServer/addons/a3_dms/config.sqf +++ b/@ExileServer/addons/a3_dms/config.sqf @@ -337,6 +337,13 @@ DMS_SpawnMissions_Scheduled = false; // Whether or not to spawn missions in a sc DMS_ai_offload_Only_DMS_AI = false; // Do you use other mission systems on your server but still want to offload AI? You should probably enable this then, unless you have tested it for compatibility. DMS_ai_offload_notifyClient = false; // Notify the client when AI has been offloaded to the client. + DMS_ai_allowFreezing = true; // Whether or not to "freeze" AI that are a certain distance away from players (and therefore inactive). + DMS_ai_freeze_Only_DMS_AI = false; // Whether or not to "freeze" AI that are not spawned by DMS. + DMS_ai_freezingDistance = 3500; // If there are no players within this distance of the leader of an AI group, then the AI group will be "frozen". + DMS_ai_unfreezingDistance = 3500; // If there are players within this distance of the leader of an AI group, then the AI group will be "un-frozen". + DMS_ai_offloadOnUnfreeze = true; // Whether or not to offload AI to clients once they have been "un-frozen". NOTE: This config will be ignored if "DMS_ai_offload_to_client" is set to false. + DMS_ai_freezeCheckingDelay = 30; // How often (in seconds) DMS will check whether to freeze/un-freeze AI. + DMS_ai_share_info = true; // Share info about killer DMS_ai_share_info_distance = 300; // The distance killer's info will be shared to other AI diff --git a/@ExileServer/addons/a3_dms/fn_DMS_postInit.sqf b/@ExileServer/addons/a3_dms/fn_DMS_postInit.sqf index b04b591..27193f9 100644 --- a/@ExileServer/addons/a3_dms/fn_DMS_postInit.sqf +++ b/@ExileServer/addons/a3_dms/fn_DMS_postInit.sqf @@ -93,6 +93,11 @@ if ((isClass (configFile >> "CfgPatches" >> "Ryanzombies")) && {!DMS_ai_offload_ DMS_ai_offload_Only_DMS_AI = true; }; +if !(DMS_ai_offload_to_client) then +{ + DMS_ai_offloadOnUnfreeze = false; +}; + DMS_A3_AllMarkerColors = []; @@ -232,6 +237,8 @@ if (DMS_StaticMission) then // Add heli paratroopers monitor to the thread system. [5, DMS_fnc_HeliParatroopers_Monitor, [], true] call ExileServer_system_thread_addTask; +// Add "freeze" monitor to the thread system. +[DMS_ai_freezeCheckingDelay, DMS_fnc_FreezeManager, [], true] call ExileServer_system_thread_addTask; diff --git a/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf b/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf index 313bbfa..bc6e987 100644 --- a/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf +++ b/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf @@ -56,6 +56,7 @@ DMS_AttemptsUntilThrottle = DMS_AttemptsUntilThrottle + 1; DMS_HelisToClean = []; DMS_HeliParatrooper_Arr = []; +DMS_FrozenAIGroups = []; // Initialize mission variables... diff --git a/@ExileServer/addons/a3_dms/objects/static/saltflatsbase.sqf b/@ExileServer/addons/a3_dms/objects/static/saltflatsbase.sqf index 19895f8..24b1c08 100644 --- a/@ExileServer/addons/a3_dms/objects/static/saltflatsbase.sqf +++ b/@ExileServer/addons/a3_dms/objects/static/saltflatsbase.sqf @@ -262,7 +262,6 @@ ["Land_HBarrier_5_F",[23495.8,18860.2,0],91.8182,[[0.999497,-0.0317285,0],[0,-0,1]],false], ["Land_HBarrier_5_F",[23495.7,18855.7,0],91.8182,[[0.999497,-0.0317285,0],[0,-0,1]],false], ["Land_Wreck_Hunter_F",[23338,18860.7,0],181.364,[[-0.0238044,-0.999717,0],[-0,0,1]],false], - ["Land_Wreck_Heli_Attack_01_F",[23279,18478,0],150.909,[[0.486198,-0.873849,0],[0,-0,1]],false], ["Land_CncBarrier_stripes_F",[23228.8,18448,0],343.182,[[-0.289332,0.957229,0],[0,0,1]],false], ["Land_Wreck_HMMWV_F",[23229.5,18446.4,0],214.091,[[-0.560509,-0.828148,0],[-0,0,1]],false], ["Land_Cargo_House_V2_ruins_F",[23280.9,18484.3,0],206.984,[[-0.477745,-0.861692,0.171015],[-0.0955405,0.244475,0.964937]],false], @@ -691,4 +690,4 @@ ["Land_HBarrierBig_F",[23202.9,18486.2,0],89.8719,[[0.999997,0.00223477,0],[0,0,1]],false], ["Land_HBarrierBig_F",[23206.1,18481.3,0],2.90385,[[0.0506604,0.998716,0],[0,0,1]],false], ["Land_HBarrierBig_F",[23209.4,18481.2,0],180.43,[[-0.00751282,-0.999972,0],[-0,0,1]],false] -]; \ No newline at end of file +]; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_AILocalityManager.sqf b/@ExileServer/addons/a3_dms/scripts/fn_AILocalityManager.sqf index bc611fd..a693c79 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_AILocalityManager.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_AILocalityManager.sqf @@ -8,7 +8,7 @@ if (!DMS_ai_offload_to_client) exitWith {}; { - if (((count (units _x))>1) && {!((DMS_ai_offload_Only_DMS_AI && {!(_x getVariable ["DMS_SpawnedGroup",false])}) || {(_x getVariable ["DMS_LockLocality",false])})}) then + if (((count (units _x))>1) && {!(_x getVariable ["DMS_LockLocality",false])} && {!(DMS_ai_offload_Only_DMS_AI && {!(_x getVariable ["DMS_SpawnedGroup",false])})}) then { private _leader = leader _x; private _group = _x; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_FreezeManager.sqf b/@ExileServer/addons/a3_dms/scripts/fn_FreezeManager.sqf new file mode 100644 index 0000000..fcc9e77 --- /dev/null +++ b/@ExileServer/addons/a3_dms/scripts/fn_FreezeManager.sqf @@ -0,0 +1,67 @@ +/* + DMS_fnc_FreezeManager + Created by eraser1 + + Determines which AI groups (if any) to "freeze" in order to improve server performance, and will "un-freeze" frozen AI when a player is nearby. + This function will also offload AI after "un-freezing" if configured to do so. + + NOTE: If you want this function to ignore a specific group, then you can set the variable "DMS_AllowFreezing" on the group to false. + eg: _group setVariable ["DMS_AllowFreezing",false] +*/ + +if !(DMS_ai_allowFreezing) exitWith {}; + +private _recentlyUnfrozen = []; + +{ + if (isNull _x) then + { + diag_log format["DMS ERROR :: Null Group found in DMS_FrozenAIGroups! Index: %1",_forEachIndex]; + DMS_FrozenAIGroups deleteAt _forEachIndex; + } + else + { + private _leader = leader _x; + if ([_leader,DMS_ai_unfreezingDistance] call DMS_fnc_IsPlayerNearby) then + { + {_x enableSimulationGlobal true} forEach (units _x); + _recentlyUnfrozen pushBack _x; + + if (DMS_ai_offloadOnUnfreeze) then + { + [_group, _leader] call DMS_fnc_SetAILocality; + }; + + if (DMS_DEBUG) then + { + format["FreezeManager :: Un-froze AI Group: %1",_x] call DMS_fnc_DebugLog; + }; + + DMS_FrozenAIGroups deleteAt _forEachIndex; + }; + }; +} forEach DMS_FrozenAIGroups; + + +{ + if (((count (units _x))>1) && {_x getVariable ["DMS_AllowFreezing",true]} && {!(DMS_ai_freeze_Only_DMS_AI && {!(_x getVariable ["DMS_SpawnedGroup",false])})}) then + { + private _leader = leader _x; + private _group = _x; + + if ((!isNull _leader) && {alive _leader} && {!(isPlayer _leader)} && {!([_leader,DMS_ai_freezingDistance] call DMS_fnc_IsPlayerNearby)}) then + { + {_x enableSimulationGlobal false} forEach (units _group); + DMS_FrozenAIGroups pushBack _group; + + // So that we don't check this group for freezing later on. + _group setVariable ["DMS_AllowFreezing",false]; + }; + }; +} forEach allGroups; + + +// NOW we allow them to be frozen again, so we avoid checking for nearby players TWICE on a group(s) that has just been un-frozen. +{ + _x setVariable ["DMS_AllowFreezing", true]; +} forEach _recentlyUnfrozen; diff --git a/README.md b/README.md index 91da71c..197b8b6 100644 --- a/README.md +++ b/README.md @@ -127,11 +127,6 @@ ___ ___ # Roadmap: -#### Continuous Optimization + Improvements. -* ~~Implement the ability to "freeze" and "unfreeze" AI when there are no players nearby to improve performance. This will be under testing with a few selected server owners/community members. If you would like to participate in testing, please send a PM to [eraser1 on Exile Forums](http://www.exilemod.com/profile/96-eraser1/).~~ _This feature is slated for a future date_ - -#### AI Heli Paratroopers/air support. - #### Convoy Mission: * Regularly update marker position. * Implement function(s) for AI pathing. @@ -146,6 +141,7 @@ ___ * Spawning in a trader on mission completion ([Trillseeker82](http://www.exilemod.com/topic/61-dms-defents-mission-system/?do=findComment&comment=43932)). This might be done after the next Exile update due to the trader system overhaul :) #### Full Headless Client Support. +* AI will still be offloaded to clients (ideally); strictly DMS functions will be handled by the HC. @@ -154,6 +150,18 @@ ___ # Changelog: ### Test Branch: +#### May 22, 2016 (12:00 AM CST-America): +* **NEW CONFIG VALUES:** + DMS_ai_allowFreezing + DMS_ai_freeze_Only_DMS_AI + DMS_ai_freezingDistance + DMS_ai_unfreezingDistance + DMS_ai_offloadOnUnfreeze + DMS_ai_freezeCheckingDelay +* Removed a "Land_Wreck_Heli_Attack_01_F" from saltflats (it creates server threads) +* Adjusted logic in "AILocalityManager": the variable "DMS_LockLocality" on a group should now be considered even if "DMS_ai_offload_Only_DMS_AI" is set to false. +* You can now "freeze"/"un-freeze" AI! This has been a long-awaited feature for DMS. Using it should grant major performance benefits when you have lots of AI around the map that are inactive. + #### May 16, 2016 (11:00 AM CST-America): * Fixed an error in fn_SpawnAIGroup (and MultiPos variant) @@ -196,6 +204,7 @@ ___ +### Main Branch #### April 27, 2016 (6:45 PM CST-America): * **NEW CONFIG VALUES** From b2e2424777f673f9011091a6af45c3b95cea323c Mon Sep 17 00:00:00 2001 From: second_coming Date: Sun, 22 May 2016 13:09:58 +0100 Subject: [PATCH 09/21] Update config.cpp FreezeManager missing from definitions --- @ExileServer/addons/a3_dms/config.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/@ExileServer/addons/a3_dms/config.cpp b/@ExileServer/addons/a3_dms/config.cpp index bbfe86d..4debdb6 100644 --- a/@ExileServer/addons/a3_dms/config.cpp +++ b/@ExileServer/addons/a3_dms/config.cpp @@ -41,6 +41,7 @@ class CfgFunctions class FindSafePos {}; class FindSafePos_InRange {}; class FindSuppressor {}; + class FreezeManager {}; class GetAllUnits {}; class GetCenter {}; class GetEmptySeats {}; From c4a9b3f1b2560ee98d41204d813e8feeae56ba8e Mon Sep 17 00:00:00 2001 From: eraser1 Date: Sun, 22 May 2016 15:15:38 -0500 Subject: [PATCH 10/21] Fixes + Additions --- @ExileServer/addons/a3_dms/config.cpp | 3 +- @ExileServer/addons/a3_dms/config.sqf | 1 + .../a3_dms/scripts/fn_FindSuppressor.sqf | 4 ++- .../a3_dms/scripts/fn_FreezeManager.sqf | 12 ++++--- .../addons/a3_dms/scripts/fn_FreezeToggle.sqf | 33 +++++++++++++++++++ .../addons/a3_dms/scripts/fn_SpawnAIGroup.sqf | 5 +++ .../scripts/fn_SpawnAIGroup_MultiPos.sqf | 5 +++ .../a3_dms/scripts/fn_SpawnAISoldier.sqf | 2 +- .../a3_dms/scripts/fn_SpawnAIStaticMG.sqf | 5 +++ .../a3_dms/scripts/fn_SpawnAIVehicle.sqf | 11 +++++++ README.md | 11 +++++++ 11 files changed, 85 insertions(+), 7 deletions(-) create mode 100644 @ExileServer/addons/a3_dms/scripts/fn_FreezeToggle.sqf diff --git a/@ExileServer/addons/a3_dms/config.cpp b/@ExileServer/addons/a3_dms/config.cpp index 4debdb6..e6c54d8 100644 --- a/@ExileServer/addons/a3_dms/config.cpp +++ b/@ExileServer/addons/a3_dms/config.cpp @@ -4,7 +4,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; - a3_DMS_version = "May 22, 2016 (TEST)"; + a3_DMS_version = "May 22, 2016 (2) (TEST)"; requiredVersion = 1.36; requiredAddons[] = {"exile_client","exile_server_config"}; }; @@ -42,6 +42,7 @@ class CfgFunctions class FindSafePos_InRange {}; class FindSuppressor {}; class FreezeManager {}; + class FreezeToggle {}; class GetAllUnits {}; class GetCenter {}; class GetEmptySeats {}; diff --git a/@ExileServer/addons/a3_dms/config.sqf b/@ExileServer/addons/a3_dms/config.sqf index 4be267e..ae52452 100644 --- a/@ExileServer/addons/a3_dms/config.sqf +++ b/@ExileServer/addons/a3_dms/config.sqf @@ -343,6 +343,7 @@ DMS_SpawnMissions_Scheduled = false; // Whether or not to spawn missions in a sc DMS_ai_unfreezingDistance = 3500; // If there are players within this distance of the leader of an AI group, then the AI group will be "un-frozen". DMS_ai_offloadOnUnfreeze = true; // Whether or not to offload AI to clients once they have been "un-frozen". NOTE: This config will be ignored if "DMS_ai_offload_to_client" is set to false. DMS_ai_freezeCheckingDelay = 30; // How often (in seconds) DMS will check whether to freeze/un-freeze AI. + DMS_ai_freezeOnSpawn = true; // Whether or not to freeze an AI group when initially spawned. DMS_ai_share_info = true; // Share info about killer DMS_ai_share_info_distance = 300; // The distance killer's info will be shared to other AI diff --git a/@ExileServer/addons/a3_dms/scripts/fn_FindSuppressor.sqf b/@ExileServer/addons/a3_dms/scripts/fn_FindSuppressor.sqf index d22cf83..188c4f4 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_FindSuppressor.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_FindSuppressor.sqf @@ -16,7 +16,7 @@ private _weaponName = getText (configFile >> "cfgWeapons" >> _weapon >> "displa switch (true) do { // Zafir accepts no suppressors :( - case ((_weapon find "Zafir")>-1) : {""}; + //case ((_weapon find "Zafir")>-1) : {""}; case ((_weaponName find "6.5") > -1) : { @@ -41,4 +41,6 @@ switch (true) do 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) : {selectRandom ["muzzle_snds_93mmg","muzzle_snds_93mmg_tan"]}; + + default {""}; }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_FreezeManager.sqf b/@ExileServer/addons/a3_dms/scripts/fn_FreezeManager.sqf index fcc9e77..3074056 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_FreezeManager.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_FreezeManager.sqf @@ -24,12 +24,12 @@ private _recentlyUnfrozen = []; private _leader = leader _x; if ([_leader,DMS_ai_unfreezingDistance] call DMS_fnc_IsPlayerNearby) then { - {_x enableSimulationGlobal true} forEach (units _x); + [_x,false] call DMS_fnc_FreezeToggle; _recentlyUnfrozen pushBack _x; if (DMS_ai_offloadOnUnfreeze) then { - [_group, _leader] call DMS_fnc_SetAILocality; + [_x, _leader] call DMS_fnc_SetAILocality; }; if (DMS_DEBUG) then @@ -51,8 +51,12 @@ private _recentlyUnfrozen = []; if ((!isNull _leader) && {alive _leader} && {!(isPlayer _leader)} && {!([_leader,DMS_ai_freezingDistance] call DMS_fnc_IsPlayerNearby)}) then { - {_x enableSimulationGlobal false} forEach (units _group); - DMS_FrozenAIGroups pushBack _group; + [_group,true] call DMS_fnc_FreezeToggle; + + if (DMS_DEBUG) then + { + format["FreezeManager :: Froze AI Group: %1",_group] call DMS_fnc_DebugLog; + }; // So that we don't check this group for freezing later on. _group setVariable ["DMS_AllowFreezing",false]; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_FreezeToggle.sqf b/@ExileServer/addons/a3_dms/scripts/fn_FreezeToggle.sqf new file mode 100644 index 0000000..1d9199b --- /dev/null +++ b/@ExileServer/addons/a3_dms/scripts/fn_FreezeToggle.sqf @@ -0,0 +1,33 @@ +/* + DMS_fnc_FreezeToggle + created by eraser1 + + Usage: + [ + _group, // GROUP: The AI Group to be frozen + _freeze // BOOL: "true" if you want to freeze, false if you want to un-freeze + ] call DMS_fnc_FreezeToggle; + + Freezes/un-freezes a specified group. +*/ + +if !(params +[ + "_group", + "_freeze" +]) exitWith +{ + diag_log format["DMS ERROR :: Calling DMS_fnc_FreezeToggle with invalid parameters: %1",_this]; +}; + +if (_freeze) then +{ + {_x enableSimulationGlobal false} forEach (units _group); + _group setVariable ["DMS_isGroupFrozen",true]; + DMS_FrozenAIGroups pushBack _group; +} +else +{ + {_x enableSimulationGlobal true} forEach (units _group); + _group setVariable ["DMS_isGroupFrozen",false]; +}; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf index c95caa3..52e490c 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf @@ -122,6 +122,11 @@ _group setFormation "WEDGE"; [_group,_pos,_difficulty,"COMBAT"] call DMS_fnc_SetGroupBehavior; +if (DMS_ai_freezeOnSpawn) then +{ + [_group,true] call DMS_fnc_FreezeToggle; +}; + diag_log format ["DMS_SpawnAIGroup :: Spawned %1 AI at %2.",_count,_pos]; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf index ea653f4..01f635a 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf @@ -138,6 +138,11 @@ _group setFormation "WEDGE"; [_group,_positions select 0,_difficulty,"COMBAT"] call DMS_fnc_SetGroupBehavior; +if (DMS_ai_freezeOnSpawn) then +{ + [_group,true] call DMS_fnc_FreezeToggle; +}; + diag_log format ["DMS_SpawnAIGroup_MultiPos :: Spawned %1 AI using positions parameter: %2.",_count,_positions]; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf index 257d997..cda8d1d 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf @@ -210,7 +210,7 @@ if (_customGearSet isEqualTo []) then if((random 100) <= (missionNamespace getVariable [format["DMS_%1_suppressor_chance",_class],0])) then { private _suppressor = _weapon call DMS_fnc_FindSuppressor; - if(_suppressor != "") then + if (_suppressor != "") then { _unit addPrimaryWeaponItem _suppressor; }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf index 6fff976..6515ccf 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf @@ -66,6 +66,11 @@ private _guns = _positions apply reload _unit; _unit setVariable ["DMS_AssignedVeh",_gun]; + if (_group getVariable ["DMS_isGroupFrozen",false]) then + { + _unit enableSimulationGlobal false; + }; + if (DMS_DEBUG) then { (format ["SpawnAIStaticMG :: Created unit %1 at %2 as static gunner in %3",_unit,_x,_gun]) call DMS_fnc_DebugLog; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIVehicle.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIVehicle.sqf index bc59e9b..68cfb5e 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIVehicle.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIVehicle.sqf @@ -65,15 +65,26 @@ _veh lock 2; _group addVehicle _veh; +private _toFreeze = _group getVariable ["DMS_isGroupFrozen",false]; + private _driver = [_group,_spawnPos,_class,_difficulty,_side,"Vehicle"] call DMS_fnc_SpawnAISoldier; _driver moveInDriver _veh; _driver setVariable ["DMS_AssignedVeh",_veh]; +if (_toFreeze) then +{ + _driver enableSimulationGlobal false; +}; + private _crewCount = { private _unit = [_group,_spawnPos,_class,_difficulty,_side,"Vehicle"] call DMS_fnc_SpawnAISoldier; _unit moveInTurret [_veh, _x]; _unit setVariable ["DMS_AssignedVeh",_veh]; + if (_toFreeze) then + { + _unit enableSimulationGlobal false; + }; true } count (allTurrets [_veh, true]); diff --git a/README.md b/README.md index 197b8b6..120b6ee 100644 --- a/README.md +++ b/README.md @@ -150,6 +150,17 @@ ___ # Changelog: ### Test Branch: +#### May 22, 2016 (3:15 PM CST-America): +* **NEW CONFIG VALUES:** + DMS_ai_freezeOnSpawn +* Added the ability to freeze AI groups immediately upon spawn. +* Units spawned to a group that has been frozen should now also be frozen. +* Fixed an issue where "FindSuppressor" would return a boolean instead of empty string. +* Fixed an issue with undefined variable when "DMS_ai_offloadOnUnfreeze" was set to true. +* Added debug message when a group is frozen. +* Created a new function "DMS_fnc_FreezeToggle" that actually handles freezing/unfreezing. +* DMS will now apply a variable "DMS_isGroupFrozen" to groups that are frozen. + #### May 22, 2016 (12:00 AM CST-America): * **NEW CONFIG VALUES:** DMS_ai_allowFreezing From e0dc8c874d3e4f3a8ed17c657f9359c353d6ebc2 Mon Sep 17 00:00:00 2001 From: eraser1 Date: Mon, 6 Jun 2016 22:47:15 -0500 Subject: [PATCH 11/21] Release Candidate! --- @ExileServer/addons/a3_dms/config.cpp | 3 +- @ExileServer/addons/a3_dms/config.sqf | 3 +- .../addons/a3_dms/fn_DMS_postInit.sqf | 33 +------ @ExileServer/addons/a3_dms/fn_DMS_preInit.sqf | 58 +++++++++++++ .../a3_dms/scripts/fn_AILocalityManager.sqf | 2 +- .../a3_dms/scripts/fn_AddMissionToMonitor.sqf | 20 ++--- .../scripts/fn_AddMissionToMonitor_Static.sqf | 22 ++--- .../scripts/fn_BroadcastMissionStatus.sqf | 6 +- .../addons/a3_dms/scripts/fn_CalcPos.sqf | 4 +- .../a3_dms/scripts/fn_CleanUpManager.sqf | 6 +- .../addons/a3_dms/scripts/fn_FillCrate.sqf | 10 +-- .../a3_dms/scripts/fn_FindSafePos_InRange.sqf | 8 +- .../a3_dms/scripts/fn_FindSuppressor.sqf | 40 ++------- .../a3_dms/scripts/fn_FreezeManager.sqf | 37 ++++---- .../scripts/fn_GroupReinforcementsManager.sqf | 72 ++++++++-------- .../scripts/fn_HeliParatroopers_Monitor.sqf | 6 +- .../addons/a3_dms/scripts/fn_IsNearWater.sqf | 4 +- .../a3_dms/scripts/fn_IsPlayerNearby.sqf | 4 +- .../a3_dms/scripts/fn_IsPosBlacklisted.sqf | 85 +++++++++++++++++++ .../a3_dms/scripts/fn_IsValidPosition.sqf | 20 ++--- .../a3_dms/scripts/fn_MissionSuccessState.sqf | 4 +- .../a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf | 10 +-- .../a3_dms/scripts/fn_SelectOffsetPos.sqf | 8 +- .../a3_dms/scripts/fn_SelectRandomVal.sqf | 4 +- .../a3_dms/scripts/fn_SetGroupBehavior.sqf | 6 +- .../scripts/fn_SetGroupBehavior_Separate.sqf | 8 +- .../a3_dms/scripts/fn_SetRelPositions.sqf | 4 +- .../addons/a3_dms/scripts/fn_SpawnAIGroup.sqf | 10 +-- .../scripts/fn_SpawnAIGroup_MultiPos.sqf | 10 +-- .../a3_dms/scripts/fn_SpawnAISoldier.sqf | 12 +-- .../a3_dms/scripts/fn_SpawnAIStaticMG.sqf | 10 +-- .../a3_dms/scripts/fn_SpawnAIVehicle.sqf | 20 ++--- .../addons/a3_dms/scripts/fn_SpawnCrate.sqf | 4 +- .../scripts/fn_SpawnHeliReinforcement.sqf | 16 ++-- .../a3_dms/scripts/fn_SpawnMinefield.sqf | 6 +- .../scripts/fn_SpawnNonPersistentVehicle.sqf | 4 +- .../scripts/fn_SpawnPersistentVehicle.sqf | 6 +- .../addons/a3_dms/scripts/fn_SubArr.sqf | 4 +- README.md | 15 +++- 39 files changed, 347 insertions(+), 257 deletions(-) create mode 100644 @ExileServer/addons/a3_dms/scripts/fn_IsPosBlacklisted.sqf diff --git a/@ExileServer/addons/a3_dms/config.cpp b/@ExileServer/addons/a3_dms/config.cpp index e6c54d8..4c460d9 100644 --- a/@ExileServer/addons/a3_dms/config.cpp +++ b/@ExileServer/addons/a3_dms/config.cpp @@ -4,7 +4,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; - a3_DMS_version = "May 22, 2016 (2) (TEST)"; + a3_DMS_version = "June 6, 2016 (RC1)"; requiredVersion = 1.36; requiredAddons[] = {"exile_client","exile_server_config"}; }; @@ -57,6 +57,7 @@ class CfgFunctions class ImportFromM3E_3DEN_Convert {}; class ImportFromM3E_3DEN_Static {}; class IsPlayerNearby {}; + class IsPosBlacklisted {}; class IsNearWater {}; class IsValidPosition {}; class MissionParams {}; diff --git a/@ExileServer/addons/a3_dms/config.sqf b/@ExileServer/addons/a3_dms/config.sqf index ae52452..d09a021 100644 --- a/@ExileServer/addons/a3_dms/config.sqf +++ b/@ExileServer/addons/a3_dms/config.sqf @@ -52,7 +52,6 @@ DMS_SpawnMissions_Scheduled = false; // Whether or not to spawn missions in a sc DMS_AI_KillPercent = 100; // The percent amount of AI that need to be killed for "killPercent" mission requirement (NOT IMPLEMENTED) /*Mission Marker settings*/ - DMS_MissionMarkerCount = 2; // If you modify your CreateMarker and have multiple markers, you probably want to change this. *cough*Vish*cough* DMS_ShowDifficultyColorLegend = true; // Whether or not to show a "color legend" at the bottom left of the map that shows which color corresponds to which difficulty. I know it's not very pretty, meh. DMS_MarkerText_ShowMissionPrefix = true; // Whether or not to place a prefix before the mission marker text. Enable this if your players get confused by the marker names :P DMS_MarkerText_MissionPrefix = "Mission:"; // The text displayed before the mission name in the mission marker. @@ -240,6 +239,8 @@ DMS_SpawnMissions_Scheduled = false; // Whether or not to spawn missions in a sc [[11375,16170],[14302,18600]], [[13300,14670],[14875,16170]] */ + + //[[2350,4680],100] // This random example blacklists any position within 100 meters of coordinates "[2350,4680]" ]; /* Mission System Settings */ diff --git a/@ExileServer/addons/a3_dms/fn_DMS_postInit.sqf b/@ExileServer/addons/a3_dms/fn_DMS_postInit.sqf index 27193f9..710cf7c 100644 --- a/@ExileServer/addons/a3_dms/fn_DMS_postInit.sqf +++ b/@ExileServer/addons/a3_dms/fn_DMS_postInit.sqf @@ -121,40 +121,9 @@ if !((toLower DMS_MissionMarkerLoseDotColor) in DMS_A3_AllMarkerColors) then -// Create and send Client Functions using compileFinal for security. -DMS_CLIENT_fnc_spawnDynamicText = compileFinal -(" -[ - _this, - 0, - safeZoneY, - "+str DMS_dynamicText_Duration+", - "+str DMS_dynamicText_FadeTime+", - 0, - 24358+round(random 5) -] spawn BIS_fnc_dynamicText; -"); +// Send Client Functions using compileFinal for security. publicVariable "DMS_CLIENT_fnc_spawnDynamicText"; - -DMS_CLIENT_fnc_spawnTextTiles = compileFinal -(" -[ - parseText _this, - [ - 0, - safeZoneY, - 1, - 1 - ], - [10,10], - "+str DMS_textTiles_Duration+", - "+str DMS_textTiles_FadeTime+", - 0 -] spawn BIS_fnc_textTiles; -"); publicVariable "DMS_CLIENT_fnc_spawnTextTiles"; - -DMS_CLIENT_fnc_hintSilent = compileFinal "hintSilent parsetext format['%1',_this];"; publicVariable "DMS_CLIENT_fnc_hintSilent"; publicVariable "DMS_Version"; diff --git a/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf b/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf index bc6e987..e5d4a1a 100644 --- a/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf +++ b/@ExileServer/addons/a3_dms/fn_DMS_preInit.sqf @@ -59,6 +59,64 @@ DMS_HeliParatrooper_Arr = []; DMS_FrozenAIGroups = []; + +DMS_CLIENT_fnc_spawnDynamicText = compileFinal +(" +if (isNil 'DMS_CLIENT_DynamicText_inProgress') then +{ + DMS_CLIENT_DynamicText_inProgress = true; + _this spawn + { + [ + _this, + 0, + safeZoneY, + "+str DMS_dynamicText_Duration+", + "+str DMS_dynamicText_FadeTime+", + 0, + 24358 + ] call BIS_fnc_dynamicText; + DMS_CLIENT_DynamicText_inProgress = nil; + }; +} +else +{ + ["+str (DMS_dynamicText_Duration+DMS_dynamicText_FadeTime) +",{_this call DMS_CLIENT_fnc_spawnDynamicText},_this,false,false] call ExileClient_system_thread_addTask; +}; +"); + +DMS_CLIENT_fnc_spawnTextTiles = compileFinal +(" +if (isNil 'DMS_CLIENT_TextTiles_inProgress') then +{ + DMS_CLIENT_TextTiles_inProgress = true; + _this spawn + { + [ + parseText _this, + [ + 0, + safeZoneY, + 1, + 1 + ], + [10,10], + "+str DMS_textTiles_Duration+", + "+str DMS_textTiles_FadeTime+", + 0 + ] call BIS_fnc_textTiles; + DMS_CLIENT_TextTiles_inProgress = nil; + }; +} +else +{ + ["+str (DMS_textTiles_Duration+DMS_textTiles_FadeTime) +",{_this call DMS_CLIENT_fnc_spawnTextTiles},_this,false,false] call ExileClient_system_thread_addTask; +}; +"); + +DMS_CLIENT_fnc_hintSilent = compileFinal "hintSilent parsetext format['%1',_this];"; + + // Initialize mission variables... CALLFILE("\x\addons\dms\missions\static_init.sqf"); CALLFILE("\x\addons\dms\missions\mission_init.sqf"); diff --git a/@ExileServer/addons/a3_dms/scripts/fn_AILocalityManager.sqf b/@ExileServer/addons/a3_dms/scripts/fn_AILocalityManager.sqf index a693c79..56f4def 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_AILocalityManager.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_AILocalityManager.sqf @@ -12,7 +12,7 @@ if (!DMS_ai_offload_to_client) exitWith {}; { private _leader = leader _x; private _group = _x; - if ((!isNull _leader) && {(alive _leader) && {!isPlayer _leader}}) then + if !(isPlayer _leader) then { if (DMS_DEBUG) then { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor.sqf b/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor.sqf index 4f3dfb2..5ec43ba 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor.sqf @@ -61,16 +61,16 @@ private _added = false; if !(params [ - ["_pos","",[[]],[2,3]], - ["_completionInfo","",[[]]], - ["_timeOutInfo","",[[]],[1,2]], - ["_units","",[[]]], - ["_missionObjs","",[[]],[3,4]], - ["_messages","",[[]],[3]], - ["_markers","",[[]],[DMS_MissionMarkerCount]], - ["_side","bandit",[""]], - ["_difficulty","moderate",[""]], - ["_missionEvents",[],[[]]] + "_pos", + "_completionInfo", + "_timeOutInfo", + "_units", + "_missionObjs", + "_messages", + "_markers", + "_side", + "_difficulty", + "_missionEvents" ]) exitWith { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor_Static.sqf b/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor_Static.sqf index 5e3818c..91707ed 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor_Static.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_AddMissionToMonitor_Static.sqf @@ -71,17 +71,17 @@ private _added = false; if !(params [ - ["_pos","",[[]],[2,3]], - ["_completionInfo","",[[]]], - ["_groupReinforcementsInfo","",[[]]], - ["_timeOutInfo","",[[]],[1,2]], - ["_units","",[[]]], - ["_missionObjs","",[[]],[3,4]], - ["_messages","",[[]],[3]], - ["_markers","",[[]],[DMS_MissionMarkerCount]], - ["_side","bandit",[""]], - ["_difficulty","moderate",[""]], - ["_missionEvents",[],[[]]] + "_pos", + "_completionInfo", + "_groupReinforcementsInfo", + "_timeOutInfo", + "_units", + "_missionObjs", + "_messages", + "_markers", + "_side", + "_difficulty", + "_missionEvents" ]) exitWith { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_BroadcastMissionStatus.sqf b/@ExileServer/addons/a3_dms/scripts/fn_BroadcastMissionStatus.sqf index a89b120..e6341f9 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_BroadcastMissionStatus.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_BroadcastMissionStatus.sqf @@ -16,8 +16,8 @@ if !(params [ - ["_missionName","",[""]], - ["_messageInfo",[],[[]],[2]] + "_missionName", + "_messageInfo" ]) exitWith { @@ -27,7 +27,7 @@ exitWith _messageInfo params [ ["_titleColor","#FFFF00",[""]], - ["_message","",[""]] + "_message" ]; if (DMS_DEBUG) then diff --git a/@ExileServer/addons/a3_dms/scripts/fn_CalcPos.sqf b/@ExileServer/addons/a3_dms/scripts/fn_CalcPos.sqf index f4512c8..4526c4e 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_CalcPos.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_CalcPos.sqf @@ -13,8 +13,8 @@ if !(params [ - ["_pos","",[[],objNull],[2,3]], - ["_relPos","",[[]],[2,3]] + "_pos", + "_relPos" ]) exitWith { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_CleanUpManager.sqf b/@ExileServer/addons/a3_dms/scripts/fn_CleanUpManager.sqf index f639bd5..9c2578f 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_CleanUpManager.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_CleanUpManager.sqf @@ -27,9 +27,9 @@ if !(_x params [ - ["_objs",[objNull],[objNull,[],grpNull]], - ["_timeAddedToList",diag_tickTime,[0]], - ["_timeUntilClean",DMS_CompletedMissionCleanupTime,[0]] + "_objs", + "_timeAddedToList", + "_timeUntilClean" ]) then { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf b/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf index dabd81a..97a4236 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_FillCrate.sqf @@ -88,8 +88,8 @@ if (!(params [ - ["_crate",objNull,[objNull]], - ["_lootValues","",[0,"",[]],[2,3]] + "_crate", + "_lootValues" ]) || {isNull _crate}) @@ -230,9 +230,9 @@ else if !((_crateValues params [ - ["_weps", [], [[]]], - ["_items", [], [[]]], - ["_backpacks", [], [[]]] + "_weps", + "_items", + "_backpacks" ])) exitWith { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos_InRange.sqf b/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos_InRange.sqf index 86a5d3f..9f6f95c 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos_InRange.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_FindSafePos_InRange.sqf @@ -21,10 +21,10 @@ if !(params [ - ["_centerPos", 0, [[]], [2,3]], - ["_distanceMin", 0, [0]], - ["_distanceMax", 0, [0]], - ["_posParameters", 0, [[]]] + "_centerPos", + "_distanceMin", + "_distanceMax", + "_posParameters" ]) exitWith { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_FindSuppressor.sqf b/@ExileServer/addons/a3_dms/scripts/fn_FindSuppressor.sqf index 188c4f4..644b1e9 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_FindSuppressor.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_FindSuppressor.sqf @@ -8,39 +8,13 @@ */ -private _weapon = _this; +private _compatibleMuzzles = getArray (configfile >> "CfgWeapons" >> _this >> "WeaponSlotsInfo" >> "MuzzleSlot" >> "compatibleItems"); -private _weaponName = getText (configFile >> "cfgWeapons" >> _weapon >> "displayName"); - - -switch (true) do +if (_compatibleMuzzles isEqualTo []) then { - // Zafir accepts no suppressors :( - //case ((_weapon find "Zafir")>-1) : {""}; - - case ((_weaponName find "6.5") > -1) : - { - if (_weapon find "LMG_Mk200" > -1) then - { - "muzzle_snds_H_MG"; - } - else - { - "muzzle_snds_H"; - }; - }; - - case ((_weaponName find "5.56") > -1) : {"muzzle_snds_M"}; - - case ((_weaponName find "7.62") > -1) : {"muzzle_snds_B"}; - - case ((_weaponName find ".45") > -1) : {"muzzle_snds_acp"}; - - case ((_weaponName find "9 mm") > -1) : {"muzzle_snds_L"}; - - 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) : {selectRandom ["muzzle_snds_93mmg","muzzle_snds_93mmg_tan"]}; - - default {""}; + "" // Return an empty string if there are no compatible muzzles/suppressors +} +else +{ + selectRandom _compatibleMuzzles // Choose a random muzzle/suppressor (this is actually faster than selecting the first one) }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_FreezeManager.sqf b/@ExileServer/addons/a3_dms/scripts/fn_FreezeManager.sqf index 3074056..a88843f 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_FreezeManager.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_FreezeManager.sqf @@ -9,8 +9,6 @@ eg: _group setVariable ["DMS_AllowFreezing",false] */ -if !(DMS_ai_allowFreezing) exitWith {}; - private _recentlyUnfrozen = []; { @@ -43,26 +41,29 @@ private _recentlyUnfrozen = []; } forEach DMS_FrozenAIGroups; +if (DMS_ai_allowFreezing) then { - if (((count (units _x))>1) && {_x getVariable ["DMS_AllowFreezing",true]} && {!(DMS_ai_freeze_Only_DMS_AI && {!(_x getVariable ["DMS_SpawnedGroup",false])})}) then - { - private _leader = leader _x; - private _group = _x; + { + if (((count (units _x))>1) && {_x getVariable ["DMS_AllowFreezing",true]} && {!(DMS_ai_freeze_Only_DMS_AI && {!(_x getVariable ["DMS_SpawnedGroup",false])})}) then + { + private _leader = leader _x; + private _group = _x; - if ((!isNull _leader) && {alive _leader} && {!(isPlayer _leader)} && {!([_leader,DMS_ai_freezingDistance] call DMS_fnc_IsPlayerNearby)}) then - { - [_group,true] call DMS_fnc_FreezeToggle; + if (!(isPlayer _leader) && {!([_leader,DMS_ai_freezingDistance] call DMS_fnc_IsPlayerNearby)}) then + { + [_group,true] call DMS_fnc_FreezeToggle; - if (DMS_DEBUG) then - { - format["FreezeManager :: Froze AI Group: %1",_group] call DMS_fnc_DebugLog; - }; + if (DMS_DEBUG) then + { + format["FreezeManager :: Froze AI Group: %1",_group] call DMS_fnc_DebugLog; + }; - // So that we don't check this group for freezing later on. - _group setVariable ["DMS_AllowFreezing",false]; - }; - }; -} forEach allGroups; + // So that we don't check this group for freezing later on. + _group setVariable ["DMS_AllowFreezing",false]; + }; + }; + } forEach allGroups; +}; // NOW we allow them to be frozen again, so we avoid checking for nearby players TWICE on a group(s) that has just been un-frozen. diff --git a/@ExileServer/addons/a3_dms/scripts/fn_GroupReinforcementsManager.sqf b/@ExileServer/addons/a3_dms/scripts/fn_GroupReinforcementsManager.sqf index 980a815..b6ecddc 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_GroupReinforcementsManager.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_GroupReinforcementsManager.sqf @@ -111,15 +111,15 @@ // Check ALL the variables if !(params [ - ["_AIGroup", grpNull, [grpNull] ], - ["_reinforcementInfo", [], [[]], [2] ], - ["_updateInfo", [], [[]], [2] ], - ["_spawnLocations", [], [[]] ], - ["_class", "", [""] ], - ["_difficulty", "", [""] ], - ["_side", "", [""] ], - ["_monitorType", "", [""] ], - ["_monitorParams", [], [[]] ] + "_AIGroup", + "_reinforcementInfo", + "_updateInfo", + "_spawnLocations", + "_class", + "_difficulty", + "_side", + "_monitorType", + "_monitorParams" ]) exitWith { @@ -130,8 +130,8 @@ exitWith if !(_reinforcementInfo params [ - ["_wavesInfo", [], [[]]], - ["_unitsInfo", [], [[]]] + "_wavesInfo", + "_unitsInfo" ]) exitWith { @@ -142,8 +142,8 @@ exitWith if !(_wavesInfo params [ - ["_maxReinforcementWaves", -1, [0]], - ["_reinforcementWavesGiven", 0, [0]] + "_maxReinforcementWaves", + "_reinforcementWavesGiven" ]) exitWith { @@ -154,8 +154,8 @@ exitWith if !(_unitsInfo params [ - ["_maxReinforcementUnits", -1, [0]], - ["_reinforcementUnitsGiven", 0, [0]] + "_maxReinforcementUnits", + "_reinforcementUnitsGiven" ]) exitWith { @@ -166,8 +166,8 @@ exitWith if !(_updateInfo params [ - ["_updateDelay", 300, [0]], - ["_lastUpdated", 0, [0]] + "_updateDelay", + "_lastUpdated" ]) exitWith { @@ -234,9 +234,9 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the { if !(_monitorParams params [ - ["_posOrObj", [], [objNull,[]], [2,3]], - ["_radius", 0, [0]], - ["_reinforcementCount", 0, [0]] + "_posOrObj", + "_radius", + "_reinforcementCount" ]) exitWith { @@ -257,7 +257,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the { if !(_monitorParams params [ - ["_AICount", 0, [0]] + "_AICount" ]) exitWith { @@ -276,8 +276,8 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the { if !(_monitorParams params [ - ["_AICount", 0, [0]], - ["_reinforcementCount", 0, [0]] + "_AICount", + "_reinforcementCount" ]) exitWith { @@ -298,9 +298,9 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the { if !(_monitorParams params [ - ["_AICount", 0, [0]], - ["_reinforcementCount", 0, [0]], - ["_increment_AICount", 0, [0]] + "_AICount", + "_reinforcementCount", + "_increment_AICount" ]) exitWith { @@ -323,8 +323,8 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the { if !(_monitorParams params [ - ["_AICount", 0, [0]], - ["_reinforcementCount", 0, [0]] + "_AICount", + "_reinforcementCount" ]) exitWith { @@ -354,7 +354,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the { if !(_monitorParams params [ - ["_AICount", 0, [0]] + "_AICount" ]) exitWith { @@ -396,7 +396,7 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the { if !(_monitorParams params [ - ["_vehicle", objNull, [objNull]] + "_vehicle" ]) exitWith { @@ -442,8 +442,8 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the { if !(_monitorParams params [ - ["_staticGun", objNull, [objNull]], - ["_gunPos", [], [[]], [2,3]] + "_staticGun", + "_gunPos" ]) exitWith { @@ -488,10 +488,10 @@ if (!_reinforcementsDepleted && {(diag_tickTime-_lastUpdated)>_updateDelay}) the { if !(_monitorParams params [ - ["_AICount",0,[0]], - ["_ejectFFVGunners",false,[false]], - ["_maxJumpers",0,[0]], - ["_remainAsGunship", 0, [false]] + "_AICount", + "_ejectFFVGunners", + "_maxJumpers", + "_remainAsGunship" ]) exitWith { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_HeliParatroopers_Monitor.sqf b/@ExileServer/addons/a3_dms/scripts/fn_HeliParatroopers_Monitor.sqf index d09e0f4..adc5b38 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_HeliParatroopers_Monitor.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_HeliParatroopers_Monitor.sqf @@ -46,9 +46,9 @@ { if !(_x params [ - ["_heli", objNull, [objNull]], - ["_dropPoint", 0, [[], objNull], [2,3]], - ["_remainAsGunship", false, [false]] + "_heli", + "_dropPoint", + "_remainAsGunship" ]) exitWith { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_IsNearWater.sqf b/@ExileServer/addons/a3_dms/scripts/fn_IsNearWater.sqf index 1d3eff6..20d1595 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_IsNearWater.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_IsNearWater.sqf @@ -13,8 +13,8 @@ if !(params [ - ["_position",[],[[]],[2,3]], - ["_radius",0,[0]] + "_position", + "_radius" ]) exitWith { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_IsPlayerNearby.sqf b/@ExileServer/addons/a3_dms/scripts/fn_IsPlayerNearby.sqf index 8ef1314..078801e 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_IsPlayerNearby.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_IsPlayerNearby.sqf @@ -13,8 +13,8 @@ if !(params [ - ["_pos", "", [objNull,[]], [2,3]], - ["_dis", 0, [0]] + "_pos", + "_dis" ]) exitWith { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_IsPosBlacklisted.sqf b/@ExileServer/addons/a3_dms/scripts/fn_IsPosBlacklisted.sqf new file mode 100644 index 0000000..fa81b4c --- /dev/null +++ b/@ExileServer/addons/a3_dms/scripts/fn_IsPosBlacklisted.sqf @@ -0,0 +1,85 @@ +/* + DMS_fnc_IsPosBlacklisted + Created by eraser1 + + Usage: + [ + _pos, + [ + _blacklist1, + _blacklist2, + ... + _blacklistN + ] + ] call DMS_fnc_IsPosBlacklisted; + + A blacklist can be in the form: + [[x1,y1],[x2,y2]] + where x1 is LESS than x2, and y1 is LESS than y2 + + or, + [[x,y],radius] + where any position within "radius" meters of position "x,y" is blacklisted. + + Returns true if the given position is blacklisted. +*/ + + +if !(params +[ + "_pos", + "_blacklists" +]) exitWith +{ + diag_log format ["DMS ERROR :: Calling DMS_fnc_IsPosBlacklisted with invalid parameters: %1",_this]; +}; + + +try +{ + { + _x params + [ + "_blacklist_pos", + "_blacklist_parameter" + ]; + + if (_blacklist_parameter isEqualType 0) then + { + if ((_pos distance2D _blacklist_pos) <= _blacklist_parameter) throw _x; + } + else + { + _pos params + [ + "_pos_x", + "_pos_y" + ]; + + _blacklist_pos params + [ + "_minX", + "_minY" + ]; + + _blacklist_parameter params + [ + "_maxX", + "_maxY" + ]; + + if ((_pos_x >= _minX) && {_pos_x <= _maxX} && {_pos_y >= _minY} && {_pos_y <= _maxY}) throw _x; + }; + } forEach _blacklists; + + false +} +catch +{ + if (DMS_DEBUG) then + { + format["Position |%1| is blacklisted by blacklist parameter |%2|. All provided blacklists: %3",_pos,_exception,_blacklists] call DMS_fnc_DebugLog; + }; + + true +}; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_IsValidPosition.sqf b/@ExileServer/addons/a3_dms/scripts/fn_IsValidPosition.sqf index 69aaa9e..4eb6cf7 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_IsValidPosition.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_IsValidPosition.sqf @@ -20,14 +20,14 @@ if !(params [ - ["_pos", [], [[]], [0,2,3]], - ["_waterNearLimit", DMS_WaterNearBlacklist, [0] ], - ["_minSurfaceNormal", DMS_MinSurfaceNormal, [0] ], - ["_spawnZoneNearLimit", DMS_SpawnZoneNearBlacklist, [0] ], - ["_traderZoneNearLimit", DMS_TraderZoneNearBlacklist,[0] ], - ["_missionNearLimit", DMS_MissionNearBlacklist, [0] ], - ["_playerNearLimit", DMS_PlayerNearBlacklist, [0] ], - ["_territoryNearLimit", DMS_TerritoryNearBlacklist, [0] ] + "_pos", + "_waterNearLimit", + "_minSurfaceNormal", + "_spawnZoneNearLimit", + "_traderZoneNearLimit", + "_missionNearLimit", + "_playerNearLimit", + "_territoryNearLimit" ]) then { @@ -51,7 +51,7 @@ else }; - if (!(DMS_findSafePosBlacklist isEqualTo []) && {([_pos, DMS_findSafePosBlacklist] call BIS_fnc_isPosBlacklisted)}) then + if (!(DMS_findSafePosBlacklist isEqualTo []) && {([_pos, DMS_findSafePosBlacklist] call DMS_fnc_IsPosBlacklisted)}) then { throw ("a blacklisted position"); }; @@ -153,6 +153,6 @@ else (format ["IsValidPosition :: Position %1 is too close to %2!",_pos,_exception]) call DMS_fnc_DebugLog; }; }; - + _isValidPos }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_MissionSuccessState.sqf b/@ExileServer/addons/a3_dms/scripts/fn_MissionSuccessState.sqf index 8bc2840..f7bd720 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_MissionSuccessState.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_MissionSuccessState.sqf @@ -26,8 +26,8 @@ private _exit = false; { if !(_x params [ - ["_completionType", "", [""] ], - ["_completionArgs", [], [[],grpNull] ] + "_completionType", + "_completionArgs" ]) then { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf b/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf index e30ba9b..05385bb 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf @@ -18,11 +18,11 @@ if !(params [ - ["_playerObj", objNull, [objNull] ], - ["_unit", objNull, [objNull] ], - ["_AISide", "", [""] ], - ["_AIType", "", [""] ], - ["_roadKilled", false, [false] ] + "_playerObj", + "_unit", + "_AISide", + "_AIType", + "_roadKilled" ]) exitWith { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SelectOffsetPos.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SelectOffsetPos.sqf index d009a03..16f35d3 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SelectOffsetPos.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SelectOffsetPos.sqf @@ -11,15 +11,15 @@ Returns a new position offset from the provided position with the provided distance and direction. Position provided is at ground level in AGL - This function has been deprecated by the new functionality of the "getPos" command (https://community.bistudio.com/wiki/getPos). This function has been updated for efficiency and compatibility. + This function has been deprecated by the new functionality of the "getPos" command (https://community.bistudio.com/wiki/getPos). This function has been updated for efficiency and retained for compatibility. */ if !(params [ - ["_origin","",[objNull,[]],[2,3]], - ["_dis",0,[0]], - ["_dir",0,[0]] + "_origin", + "_dis", + "_dir" ]) exitWith { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SelectRandomVal.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SelectRandomVal.sqf index 39e37c5..5948c37 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SelectRandomVal.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SelectRandomVal.sqf @@ -14,8 +14,8 @@ if !(params [ - ["_min",0,[0]], - ["_max",0,[0]] + "_min", + "_max" ]) exitWith { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SetGroupBehavior.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SetGroupBehavior.sqf index 2c31c51..50c26be 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SetGroupBehavior.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SetGroupBehavior.sqf @@ -15,9 +15,9 @@ if !(params [ - ["_group",grpNull,[grpNull,objNull]], - ["_pos",[0,0,0],[[]],[2,3]], - ["_difficulty","moderate",[""]] + "_group", + "_pos", + "_difficulty" ]) then { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SetGroupBehavior_Separate.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SetGroupBehavior_Separate.sqf index 95d1ac5..485a9ad 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SetGroupBehavior_Separate.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SetGroupBehavior_Separate.sqf @@ -24,10 +24,10 @@ if !(params [ - ["_units",[],[[]]], - ["_finalGroup",grpNull,[grpNull]], - ["_pos",[0,0,0],[[]],[2,3]], - ["_difficulty","moderate",[""]] + "_units", + "_finalGroup", + "_pos", + "_difficulty" ]) then { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SetRelPositions.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SetRelPositions.sqf index 06fcca4..9868d1c 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SetRelPositions.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SetRelPositions.sqf @@ -18,8 +18,8 @@ if !(params [ - ["_objects", [], [[]]], - ["_newCPos", [], [[]],[3]] + "_objects", + "_newCPos" ]) exitWith { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf index 52e490c..7657f54 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf @@ -18,11 +18,11 @@ if !(params [ - ["_pos","_pos ERROR",[[]],[3]], - ["_count","_count ERROR",[0]], - ["_difficulty","_difficulty ERROR",[""]], - ["_class","_class ERROR",[""]], - ["_side","_side ERROR",[""]] + "_pos", + "_count", + "_difficulty", + "_class", + "_side" ]) exitWith { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf index 01f635a..cd0796b 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf @@ -25,11 +25,11 @@ if !(params [ - ["_positions","_positions ERROR",[[]]], - ["_count","_count ERROR",[0]], - ["_difficulty","_difficulty ERROR",[""]], - ["_class","_class ERROR",[""]], - ["_side","_side ERROR",[""]] + "_positions", + "_count", + "_difficulty", + "_class", + "_side" ]) exitWith { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf index cda8d1d..9cee6d7 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf @@ -37,12 +37,12 @@ private _unarmed = false; if !(params [ - ["_group",grpNull,[grpNull]], - ["_pos",[0,0,0],[[]],[3]], - ["_class","random",[""]], - ["_difficulty","random",[""]], - ["_side","bandit",[""]], - ["_type","soldier",[""]] + "_group", + "_pos", + "_class", + "_difficulty", + "_side", + "_type" ]) then { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf index 6515ccf..4f369e2 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIStaticMG.sqf @@ -23,11 +23,11 @@ if !(params [ - ["_positions",[],[[]]], - ["_group",grpNull,[grpNull]], - ["_class","random",[""]], - ["_difficulty","static",[""]], - ["_side","bandit",[""]] + "_positions", + "_group", + "_class", + "_difficulty", + "_side" ]) exitWith { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIVehicle.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIVehicle.sqf index 68cfb5e..baefa00 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIVehicle.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIVehicle.sqf @@ -20,11 +20,11 @@ if !(params [ - ["_positions",[],[[]],[1,2]], - ["_group",grpNull,[grpNull]], - ["_class","random",[""]], - ["_difficulty","static",[""]], - ["_side","bandit",[""]] + "_positions", + "_group", + "_class", + "_difficulty", + "_side" ]) exitWith { @@ -32,15 +32,7 @@ exitWith }; -// Using another params-exitwith structure just for _spawnPos because it's pretty important... -if !(_positions params -[ - ["_spawnPos",[],[[]],[2,3]] -]) -exitWith -{ - diag_log format ["DMS ERROR :: Calling DMS_fnc_SpawnAIVehicle with invalid _positions parameters: %1",_positions]; -}; +_spawnPos = _positions select 0; private _vehClass = if ((count _this)>5) then diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnCrate.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnCrate.sqf index 3392d81..afeff63 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnCrate.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnCrate.sqf @@ -14,8 +14,8 @@ if !(params [ - ["_crateClassName","_crateClassName ERROR",[""]], - ["_pos","_pos ERROR",[[]],[3]] + "_crateClassName", + "_pos" ]) exitWith { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnHeliReinforcement.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnHeliReinforcement.sqf index 843a00c..794a17a 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnHeliReinforcement.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnHeliReinforcement.sqf @@ -23,14 +23,14 @@ if !(params [ - ["_AIGroup", 0, [grpNull]], - ["_class", 0, [""]], - ["_difficulty", 0, [""]], - ["_side", 0, [""]], - ["_dropPoint", 0, [[],objNull], [2,3]], - ["_ejectFFVGunners", 0, [false]], - ["_maxJumpers",0,[0]], - ["_remainAsGunship", 0, [false]] + "_AIGroup", + "_class", + "_difficulty", + "_side", + "_dropPoint", + "_ejectFFVGunners", + "_maxJumpers", + "_remainAsGunship" ]) exitWith { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf index b39a8df..3872659 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf @@ -18,9 +18,9 @@ if (DMS_SpawnMinesAroundMissions) then { if !(params [ - ["_centerPos","",[[]],[2,3]], - ["_difficulty","",["",[]],[2]], - ["_side","",[""]] + "_centerPos", + "_difficulty", + "_side" ]) exitWith { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnNonPersistentVehicle.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnNonPersistentVehicle.sqf index 6e93746..c647332 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnNonPersistentVehicle.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnNonPersistentVehicle.sqf @@ -28,8 +28,8 @@ if !(params [ - ["_vehicleClass","",[""]], - ["_position","",[[]],[2,3]] + "_vehicleClass", + "_position" ]) exitWith { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnPersistentVehicle.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnPersistentVehicle.sqf index c293201..3b581eb 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnPersistentVehicle.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnPersistentVehicle.sqf @@ -19,9 +19,9 @@ try { if !(params [ - ["_vehicleClass","",[""]], - ["_pos",[],[[]],[2,3]], - ["_pinCode","",[0,""]] + "_vehicleClass", + "_pos", + "_pinCode" ]) then { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SubArr.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SubArr.sqf index b671a5d..921c280 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SubArr.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SubArr.sqf @@ -22,8 +22,8 @@ if !(params [ - ["_a1", [], [[]]], - ["_a2", [], [[]]] + "_a1", + "_a2" ]) exitWith { diff --git a/README.md b/README.md index 120b6ee..3a63a89 100644 --- a/README.md +++ b/README.md @@ -94,9 +94,9 @@ If you are using Vilayer or some other GameServer hosting service, and/or the ab **DMS does not currently support headless client. Do not attempt to use HC with DMS unless you know what you are doing.** ## Troubleshooting: -DMS won't spawn missions? Check RPT for config errors or make sure PBO is packed correctly by unpacking it and ensuring the folder structure is "\x\addons\a3_DMS\...". +If you're having any issues with DMS, check your RPT for errors and make sure PBO is packed correctly by unpacking it and ensuring the folder structure is "\x\addons\a3_DMS\...". -If you can't figure it out, leave a post on [the DMS thread on exile forums](http://www.exilemod.com/topic/61-dms-defents-mission-system/?do=findComment&comment=242). **Make sure to include your RPT, config.sqf, as well as any changed files.** +If you can't figure it out, leave a post on [the DMS thread on exile forums](http://www.exilemod.com/topic/61-dms-defents-mission-system/?do=findComment&comment=242). **Make sure to include your RPT, config.sqf, as well as any changed files. Please use [pastebin](http://pastebin.com/), spoilers, or something similar; DO NOT PASTE EVERYTHING DIRECTLY INTO THE POST (without putting it in a spoiler)** ___ @@ -104,6 +104,7 @@ ___ ### Authors: - [Defent](https://github.com/Defent) from [NumenaDayZ](http://numenadayz.com/). - [eraser1](https://github.com/eraser1) from [TrainwreckDayZ](http://www.trainwreckdayz.com/home). +- [secondcoming](https://github.com/secondcoming) from [ExileYorkshire](http://exileyorkshire.co.uk/). ### Thanks: @@ -122,7 +123,6 @@ ___ - [Valthos from The Altis Project](https://www.thealtisproject.co.uk/) - [Flowrider from Optimum Gaming](http://www.optimum-multigaming.com/) - [CEN from ATD Gaming](http://atdgaming.com/) -- [second coming from ExileYorkshire](http://exileyorkshire.co.uk/) ___ @@ -150,6 +150,15 @@ ___ # Changelog: ### Test Branch: +#### June 6, 2016 (10:45 PM CST-America) **Release Candidate 1**: +* New function: DMS_fnc_IsPosBlacklisted (optimized replacement for "BIS_fnc_IsPosBlacklisted") +* Config value "DMS_findSafePosBlacklist" now supports the ability to blacklist within a certain distance of a given position. +* "DMS_CLIENT" functions are now compiled in pre-init (broadcasting is still done in post-init). +* Notifications from "textTilesRequest" and "dynamicTextRequest" should no longer "stack" on each other; if two missions spawn right after another, the second mission notification will be delayed at least until the first one completes. +* More Micro-optimizations on most functions; parameters passed to DMS functions will no longer be checked to see if they are the right type, etc. It was determined that they didn't really provide any benefit, as most errors either don't trigger the "params" error, or the error is simply reiterated elsewhere. +* "DMS_fnc_FindSuppressor" has been overhauled; it simply checks the configs for the provided weapon classname to return a random muzzle/suppressor classname. Consequently, the function is smaller, faster, and perfectly compatible with any weapon. +* The "freeze manager" will now unfreeze AI if needed regardless of setting "DMS_ai_allowFreezing" to false. + #### May 22, 2016 (3:15 PM CST-America): * **NEW CONFIG VALUES:** DMS_ai_freezeOnSpawn From f0b7be5d8fd810bebf451b973db370d1de2033e1 Mon Sep 17 00:00:00 2001 From: eraser1 Date: Tue, 7 Jun 2016 11:17:02 -0500 Subject: [PATCH 12/21] Small stuff --- @ExileServer/addons/a3_dms/config.cpp | 3 +-- @ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf | 3 ++- .../addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf | 3 ++- README.md | 4 ++++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/@ExileServer/addons/a3_dms/config.cpp b/@ExileServer/addons/a3_dms/config.cpp index 4c460d9..9c0226e 100644 --- a/@ExileServer/addons/a3_dms/config.cpp +++ b/@ExileServer/addons/a3_dms/config.cpp @@ -4,7 +4,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; - a3_DMS_version = "June 6, 2016 (RC1)"; + a3_DMS_version = "June 7, 2016 (RC1.1)"; requiredVersion = 1.36; requiredAddons[] = {"exile_client","exile_server_config"}; }; @@ -49,7 +49,6 @@ class CfgFunctions class GroupReinforcementsManager {}; //class HandleMissionEvents {}; class HeliParatroopers_Monitor {}; - //class HeliPatrol {}; class ImportFromM3E {}; class ImportFromM3E_Convert {}; class ImportFromM3E_Static {}; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf index 7657f54..2701ed8 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf @@ -89,6 +89,7 @@ if ((DMS_ai_use_launchers && {DMS_ai_launchers_per_group>0}) || {!(_launcherType }; private _units = units _group; + private _launchers = missionNamespace getVariable [format ["DMS_AI_wep_launchers_%1",_launcherType],["launch_NLAW_F"]]; for "_i" from 0 to (((DMS_ai_launchers_per_group min _count)-1) max 0) do { @@ -96,7 +97,7 @@ if ((DMS_ai_use_launchers && {DMS_ai_launchers_per_group>0}) || {!(_launcherType { private _unit = _units select _i; - private _launcher = (selectRandom (missionNamespace getVariable [format ["DMS_AI_wep_launchers_%1",_launcherType],["launch_NLAW_F"]])); + private _launcher = selectRandom _launchers; removeBackpackGlobal _unit; _unit addBackpack "B_Carryall_mcamo"; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf index cd0796b..4377a01 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup_MultiPos.sqf @@ -105,6 +105,7 @@ if ((DMS_ai_use_launchers && {DMS_ai_launchers_per_group>0}) || {!(_launcherType }; private _units = units _group; + private _launchers = missionNamespace getVariable [format ["DMS_AI_wep_launchers_%1",_launcherType],["launch_NLAW_F"]]; for "_i" from 0 to (((DMS_ai_launchers_per_group min _count)-1) max 0) do { @@ -112,7 +113,7 @@ if ((DMS_ai_use_launchers && {DMS_ai_launchers_per_group>0}) || {!(_launcherType { private _unit = _units select _i; - private _launcher = (selectRandom (missionNamespace getVariable [format ["DMS_AI_wep_launchers_%1",_launcherType],["launch_NLAW_F"]])); + private _launcher = selectRandom _launchers; removeBackpackGlobal _unit; _unit addBackpack "B_Carryall_mcamo"; diff --git a/README.md b/README.md index 3a63a89..4d66bf4 100644 --- a/README.md +++ b/README.md @@ -150,12 +150,16 @@ ___ # Changelog: ### Test Branch: +#### June 7, 2016 (11:15 PM CST-America) **Release Candidate 1.1**: +* Slight optimization of SpawnAIGroup functions (if you have launchers enabled). + #### June 6, 2016 (10:45 PM CST-America) **Release Candidate 1**: * New function: DMS_fnc_IsPosBlacklisted (optimized replacement for "BIS_fnc_IsPosBlacklisted") * Config value "DMS_findSafePosBlacklist" now supports the ability to blacklist within a certain distance of a given position. * "DMS_CLIENT" functions are now compiled in pre-init (broadcasting is still done in post-init). * Notifications from "textTilesRequest" and "dynamicTextRequest" should no longer "stack" on each other; if two missions spawn right after another, the second mission notification will be delayed at least until the first one completes. * More Micro-optimizations on most functions; parameters passed to DMS functions will no longer be checked to see if they are the right type, etc. It was determined that they didn't really provide any benefit, as most errors either don't trigger the "params" error, or the error is simply reiterated elsewhere. +* Removed config value "DMS_MissionMarkerCount" * "DMS_fnc_FindSuppressor" has been overhauled; it simply checks the configs for the provided weapon classname to return a random muzzle/suppressor classname. Consequently, the function is smaller, faster, and perfectly compatible with any weapon. * The "freeze manager" will now unfreeze AI if needed regardless of setting "DMS_ai_allowFreezing" to false. From 3fc778110cbb36d614cc6df70a658821fff99ffe Mon Sep 17 00:00:00 2001 From: eraser1 Date: Fri, 10 Jun 2016 01:00:12 -0500 Subject: [PATCH 13/21] Add Tanoa map config Should have done this sooner... --- .../addons/a3_dms/map_configs/tanoa_config.sqf | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 @ExileServer/addons/a3_dms/map_configs/tanoa_config.sqf diff --git a/@ExileServer/addons/a3_dms/map_configs/tanoa_config.sqf b/@ExileServer/addons/a3_dms/map_configs/tanoa_config.sqf new file mode 100644 index 0000000..ee971eb --- /dev/null +++ b/@ExileServer/addons/a3_dms/map_configs/tanoa_config.sqf @@ -0,0 +1,13 @@ +/* + Custom configs for Tanoa. + Created by eraser1 + + All of these configs exist in the main config. The configs below will simply override any config from the main config. + Explanations to all of these configs also exist in the main config. +*/ + + +DMS_MinDistFromWestBorder = 2000; // Exclude the 3 small islands +DMS_MinDistFromEastBorder = 1700; // Mostly ocean and mountains in that area +DMS_MinDistFromSouthBorder = 1500; // Exclude "Tuadua Island" +DMS_MinDistFromNorthBorder = 2500; // Exclude the northern islands and airfields From 62a6cba4a5f066e7b9cda97978fb80b7ea14ea50 Mon Sep 17 00:00:00 2001 From: eraser1 Date: Fri, 10 Jun 2016 13:02:20 -0500 Subject: [PATCH 14/21] Add a minor comment --- @ExileServer/addons/a3_dms/scripts/fn_IsPosBlacklisted.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/@ExileServer/addons/a3_dms/scripts/fn_IsPosBlacklisted.sqf b/@ExileServer/addons/a3_dms/scripts/fn_IsPosBlacklisted.sqf index fa81b4c..ead0790 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_IsPosBlacklisted.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_IsPosBlacklisted.sqf @@ -15,11 +15,11 @@ A blacklist can be in the form: [[x1,y1],[x2,y2]] - where x1 is LESS than x2, and y1 is LESS than y2 + where x1 is LESS than x2, and y1 is LESS than y2. This method is SLOWER. or, [[x,y],radius] - where any position within "radius" meters of position "x,y" is blacklisted. + where any position within "radius" meters of position "x,y" is blacklisted. This method is FASTER. Returns true if the given position is blacklisted. */ From 8683a16fdc5fbd19ebdf621bc0a78ba7978b5dec Mon Sep 17 00:00:00 2001 From: eraser1 Date: Sun, 12 Jun 2016 03:15:09 -0500 Subject: [PATCH 15/21] Can't stop fiddling with stuff... --- .../addons/a3_dms/scripts/fn_CreateMarker.sqf | 3 +++ .../a3_dms/scripts/fn_IsPosBlacklisted.sqf | 26 +++++-------------- README.md | 5 ++++ 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/@ExileServer/addons/a3_dms/scripts/fn_CreateMarker.sqf b/@ExileServer/addons/a3_dms/scripts/fn_CreateMarker.sqf index 9d2ba1f..47e09fa 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_CreateMarker.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_CreateMarker.sqf @@ -55,11 +55,14 @@ private _color = default {_difficulty;}; }; +/* +// Don't think this is really needed if !((toLower _color) in DMS_A3_AllMarkerColors) then { diag_log format ["DMS ERROR :: Color ""%1"" is not a valid marker color! Switching to ""ColorRed""",_color]; _color = "ColorRed"; }; +*/ private _circle = createMarker [format ["DMS_MissionMarkerCircle%1_%2",_num,round(time)], _pos]; _circle setMarkerColor _color; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_IsPosBlacklisted.sqf b/@ExileServer/addons/a3_dms/scripts/fn_IsPosBlacklisted.sqf index ead0790..fcef326 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_IsPosBlacklisted.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_IsPosBlacklisted.sqf @@ -50,25 +50,13 @@ try } else { - _pos params - [ - "_pos_x", - "_pos_y" - ]; - - _blacklist_pos params - [ - "_minX", - "_minY" - ]; - - _blacklist_parameter params - [ - "_maxX", - "_maxY" - ]; - - if ((_pos_x >= _minX) && {_pos_x <= _maxX} && {_pos_y >= _minY} && {_pos_y <= _maxY}) throw _x; + if + ( + ((_pos select 0) >= (_blacklist_pos select 0)) && // if x is greater than x1 and + {(_pos select 0) <= (_blacklist_parameter select 0)} && // if x is less than x2 and + {(_pos select 1) >= (_blacklist_pos select 1)} && // if y is greater than y1 and + {(_pos select 1) <= (_blacklist_parameter select 1)} // if y is less than y2 + ) throw _x; // blacklisted }; } forEach _blacklists; diff --git a/README.md b/README.md index 4d66bf4..328ea1a 100644 --- a/README.md +++ b/README.md @@ -150,6 +150,11 @@ ___ # Changelog: ### Test Branch: +#### June 12, 2016 (3:15 AM CST-America) **Release Candidate 1.2**: +* Removed the marker color check in "DMS_fnc_CreateMarker". Invalid marker colors are up to server owners to detect. +* Micro-optimized "DMS_fnc_IsPosBlacklisted" for the rectangular blacklist case; also rearranged the statements to be clearer and easier to understand. + + #### June 7, 2016 (11:15 PM CST-America) **Release Candidate 1.1**: * Slight optimization of SpawnAIGroup functions (if you have launchers enabled). From a0a8a885a6f476fa3e2d5e1ac9e13dd2483754d1 Mon Sep 17 00:00:00 2001 From: eraser1 Date: Sun, 12 Jun 2016 03:15:28 -0500 Subject: [PATCH 16/21] ugh, github --- @ExileServer/addons/a3_dms/config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/@ExileServer/addons/a3_dms/config.cpp b/@ExileServer/addons/a3_dms/config.cpp index 9c0226e..3a736ae 100644 --- a/@ExileServer/addons/a3_dms/config.cpp +++ b/@ExileServer/addons/a3_dms/config.cpp @@ -4,7 +4,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; - a3_DMS_version = "June 7, 2016 (RC1.1)"; + a3_DMS_version = "June 12, 2016 (RC1.2)"; requiredVersion = 1.36; requiredAddons[] = {"exile_client","exile_server_config"}; }; From 281902e610afbaeb4efac9eb1a5f3f08740fb2fb Mon Sep 17 00:00:00 2001 From: eraser1 Date: Mon, 13 Jun 2016 18:24:03 -0500 Subject: [PATCH 17/21] i --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 328ea1a..a60a847 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ after "7 createVehicle" ## 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. From 456c6f84e846b719a745f27aa55f322feb2fc645 Mon Sep 17 00:00:00 2001 From: second_coming Date: Thu, 16 Jun 2016 11:50:11 +0100 Subject: [PATCH 18/21] Occupation mission - added Tanoa config --- .../addons/a3_dms/missions/static/occupation.sqf | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/@ExileServer/addons/a3_dms/missions/static/occupation.sqf b/@ExileServer/addons/a3_dms/missions/static/occupation.sqf index d1228c0..d8f5989 100644 --- a/@ExileServer/addons/a3_dms/missions/static/occupation.sqf +++ b/@ExileServer/addons/a3_dms/missions/static/occupation.sqf @@ -50,6 +50,15 @@ switch (toLower worldName) do _msgLOSE = ['#FF0000',"The troops have left Norinsk, taking the cache with them..."]; }; + case "tanoa": + { + _pos = [11685,2666,0]; + _missionName = "Lijnhaven Occupation"; + _msgStart = ['#FFFF00',"Lijnhaven is under martial law! There are reports they have a large weapon cache..."]; + _msgWIN = ['#0080FF',"Convicts have successfully assaulted the town of Lijnhaven and secured the cache!"]; + _msgLOSE = ['#FF0000',"The troops have left Lijnhaven, taking the cache with them..."]; + }; + default { diag_log format["DMS ERROR :: Attempting to run occupation with unsupported map: %1",worldName]; From e1f9a446042b3a973914a70ff43c95c438678bba Mon Sep 17 00:00:00 2001 From: eraser1 Date: Thu, 16 Jun 2016 13:53:54 -0500 Subject: [PATCH 19/21] Fix --- @ExileServer/addons/a3_dms/missions/bandit/mercbase.sqf | 2 +- @ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf | 2 +- README.md | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/@ExileServer/addons/a3_dms/missions/bandit/mercbase.sqf b/@ExileServer/addons/a3_dms/missions/bandit/mercbase.sqf index 5e6b146..2cd6422 100644 --- a/@ExileServer/addons/a3_dms/missions/bandit/mercbase.sqf +++ b/@ExileServer/addons/a3_dms/missions/bandit/mercbase.sqf @@ -130,7 +130,7 @@ _msgWIN = ['#0080ff',"Convicts have successfully assaulted the Mercenary Base an _msgLOSE = ['#FF0000',"Seems like the Mercenaries packed up and drove away..."]; // Define mission name (for map marker and logging) -_missionName = "Mercenary Base"; +_missionName = "Mercenary Outpost"; // Create Markers _markers = diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf index 3872659..44156a1 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnMinefield.sqf @@ -49,7 +49,7 @@ if (DMS_SpawnMinesAroundMissions) then private _minesInfo = if (_difficulty isEqualType "") then { - _minesInfo = missionNamespace getVariable [format ["DMS_MineInfo_%1", _difficulty], [10,50]]; + missionNamespace getVariable [format ["DMS_MineInfo_%1", _difficulty], [10,50]]; } else { diff --git a/README.md b/README.md index a60a847..acf6251 100644 --- a/README.md +++ b/README.md @@ -150,6 +150,11 @@ ___ # Changelog: ### Test Branch: +#### June 16, 2016 (1:55 PM CST-America) **Release Candidate 1.3**: +* Renamed the "mercbase.sqf" mission title to "Mercenary Outpost" to avoid confusion with the salt flats mission. +* Fixed an issue with fn_SpawnMineField.sqf (thanks to CEN for providing important info) + + #### June 12, 2016 (3:15 AM CST-America) **Release Candidate 1.2**: * Removed the marker color check in "DMS_fnc_CreateMarker". Invalid marker colors are up to server owners to detect. * Micro-optimized "DMS_fnc_IsPosBlacklisted" for the rectangular blacklist case; also rearranged the statements to be clearer and easier to understand. From 1f78dce76adc353feecab9cf21f1e149335e9100 Mon Sep 17 00:00:00 2001 From: eraser1 Date: Mon, 20 Jun 2016 16:12:06 -0500 Subject: [PATCH 20/21] Hopefully final RC --- @ExileServer/addons/a3_dms/config.cpp | 3 +- @ExileServer/addons/a3_dms/config.sqf | 3 +- .../addons/a3_dms/fn_DMS_postInit.sqf | 3 ++ .../a3_dms/map_configs/tanoa_config.sqf | 8 +-- .../addons/a3_dms/scripts/fn_AddWeapon.sqf | 52 +++++++++++++++++++ .../addons/a3_dms/scripts/fn_IsNearWater.sqf | 2 +- .../a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf | 17 +++--- .../a3_dms/scripts/fn_SpawnAISoldier.sqf | 33 ++++++------ README.md | 6 +++ 9 files changed, 95 insertions(+), 32 deletions(-) create mode 100644 @ExileServer/addons/a3_dms/scripts/fn_AddWeapon.sqf diff --git a/@ExileServer/addons/a3_dms/config.cpp b/@ExileServer/addons/a3_dms/config.cpp index 3a736ae..249319a 100644 --- a/@ExileServer/addons/a3_dms/config.cpp +++ b/@ExileServer/addons/a3_dms/config.cpp @@ -4,7 +4,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; - a3_DMS_version = "June 12, 2016 (RC1.2)"; + a3_DMS_version = "June 20, 2016 (RC1.5)"; requiredVersion = 1.36; requiredAddons[] = {"exile_client","exile_server_config"}; }; @@ -30,6 +30,7 @@ class CfgFunctions file = "\x\addons\dms\scripts"; class AddMissionToMonitor {}; class AddMissionToMonitor_Static {}; + class AddWeapon {}; class AILocalityManager {}; class BroadcastMissionStatus {}; class CalcPos {}; diff --git a/@ExileServer/addons/a3_dms/config.sqf b/@ExileServer/addons/a3_dms/config.sqf index d09a021..4d83649 100644 --- a/@ExileServer/addons/a3_dms/config.sqf +++ b/@ExileServer/addons/a3_dms/config.sqf @@ -628,7 +628,8 @@ DMS_SpawnMissions_Scheduled = false; // Whether or not to spawn missions in a sc "Exile_Item_EMRE", "Exile_Item_PlasticBottleCoffee", "Exile_Item_CanOpener", - "Exile_Item_Instadoc" + "Exile_Item_Instadoc", + "Exile_Item_DuctTape" ]; DMS_sniper_helmets = [ // Helmets for Sniper Class "H_HelmetSpecB_paint1", diff --git a/@ExileServer/addons/a3_dms/fn_DMS_postInit.sqf b/@ExileServer/addons/a3_dms/fn_DMS_postInit.sqf index 710cf7c..94d97a5 100644 --- a/@ExileServer/addons/a3_dms/fn_DMS_postInit.sqf +++ b/@ExileServer/addons/a3_dms/fn_DMS_postInit.sqf @@ -129,6 +129,9 @@ publicVariable "DMS_CLIENT_fnc_hintSilent"; publicVariable "DMS_Version"; +format["DMS_Version: %1",DMS_Version] remoteExecCall ["diag_log", -2, "DMS_LogVersion_JIP_ID"]; + + // Add the weighted predefined locations to the list of predefined locations { diff --git a/@ExileServer/addons/a3_dms/map_configs/tanoa_config.sqf b/@ExileServer/addons/a3_dms/map_configs/tanoa_config.sqf index ee971eb..4497775 100644 --- a/@ExileServer/addons/a3_dms/map_configs/tanoa_config.sqf +++ b/@ExileServer/addons/a3_dms/map_configs/tanoa_config.sqf @@ -7,7 +7,7 @@ */ -DMS_MinDistFromWestBorder = 2000; // Exclude the 3 small islands -DMS_MinDistFromEastBorder = 1700; // Mostly ocean and mountains in that area -DMS_MinDistFromSouthBorder = 1500; // Exclude "Tuadua Island" -DMS_MinDistFromNorthBorder = 2500; // Exclude the northern islands and airfields +DMS_MinDistFromWestBorder = 1300; +DMS_MinDistFromEastBorder = 800; +DMS_MinDistFromSouthBorder = 1500; +DMS_MinDistFromNorthBorder = 1900; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_AddWeapon.sqf b/@ExileServer/addons/a3_dms/scripts/fn_AddWeapon.sqf new file mode 100644 index 0000000..9675f62 --- /dev/null +++ b/@ExileServer/addons/a3_dms/scripts/fn_AddWeapon.sqf @@ -0,0 +1,52 @@ +/* + DMS_fnc_AddWeapon + created by eraser1 - based off of BIS_fnc_AddWeapon + + Description: + Add a weapon to a unit with the right magazines. Magazine class is obtained from the weapon's config. + + Usage: + [ + _unit, // unit that is issued new equipment + _weapon, // weapon classname + _magazineCount, // number of magazines + _magClassname // (Optional): index of magazine class in weapon's config (default 0) OR magazine classname + ] call DMS_fnc_AddWeapon; + + Nothing is returned +*/ + +if (params +[ + "_unit", + "_weapon", + "_magazineCount" +]) +then +{ + //Add magazines + if (_magazineCount > 0) then + { + private _magazine = + if ((count _this) > 3) then + { + _this select 3 + } + else + { + (getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines")) select 0 + }; + + for "_i" from 1 to _magazineCount do + { + _unit addMagazine _magazine; + }; + }; + + //Add weapon + _unit addWeapon _weapon; +} +else +{ + diag_log format["DMS ERROR :: Calling DMS_fnc_AddWeapon with invalid parameters: %1",_this]; +}; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_IsNearWater.sqf b/@ExileServer/addons/a3_dms/scripts/fn_IsNearWater.sqf index 20d1595..2ba6e8c 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_IsNearWater.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_IsNearWater.sqf @@ -22,7 +22,7 @@ exitWith false }; -private _result = false; +private _result = false; try { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf b/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf index 05385bb..cb2860d 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_PlayerAwardOnAIKill.sqf @@ -169,17 +169,14 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U }; //DONKEYPUNCH CUSTOM KILL RANK CHANGE FOR AI KILL - if (DMS_Enable_RankChange) then + if (DMS_Enable_RankChange && {_rankChange!=0}) then { - if (_rankChange!=0) then - { - _playerRank = (_playerRank+_rankChange); - _killer setVariable ["ExileHumanity",_playerRank]; - format["modifyAccountHumanity:%1:%2",_rankChange,getPlayerUID _killer] call ExileServer_system_database_query_fireAndForget; - ExileClientPlayerHumanity = _playerRank; - (owner _playerObj) publicVariableClient "ExileClientPlayerHumanity"; - ExileClientPlayerHumanity = nil; - }; + _playerRank = (_playerRank+_rankChange); + _killer setVariable ["ExileHumanity",_playerRank]; + format["modifyAccountHumanity:%1:%2",_rankChange,getPlayerUID _killer] call ExileServer_system_database_query_fireAndForget; + ExileClientPlayerHumanity = _playerRank; + (owner _playerObj) publicVariableClient "ExileClientPlayerHumanity"; + ExileClientPlayerHumanity = nil; }; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf index 9cee6d7..07f067c 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAISoldier.sqf @@ -89,7 +89,6 @@ _difficulty = //Create unit private _unit = _group createUnit [DMS_AI_Classname, _pos, [], 0,"FORM"]; _unit allowFleeing 0; -[_unit] joinSilent _group; // Remove existing gear {_unit removeWeaponGlobal _x;} forEach (weapons _unit); @@ -156,11 +155,18 @@ if (_customGearSet isEqualTo []) then } forEach (missionNamespace getVariable [format ["DMS_%1_equipment",_class],[]]); + // Clothes + _unit addHeadgear (selectRandom (missionNamespace getVariable [format ["DMS_%1_helmets",_class],DMS_assault_helmets])); + _unit forceAddUniform (selectRandom (missionNamespace getVariable [format ["DMS_%1_clothes",_class],DMS_assault_clothes])); + _unit addVest (selectRandom (missionNamespace getVariable [format ["DMS_%1_vests",_class],DMS_assault_vests])); + _unit addBackpackGlobal (selectRandom (missionNamespace getVariable [format ["DMS_%1_backpacks",_class],DMS_assault_backpacks])); + + // Random items that can be added to the unit's inventory, such as food, meds, etc. private _randItemCount = missionNamespace getVariable [format ["DMS_%1_RandItemCount",_class],0]; if (_randItemCount>0) then { - private _randItems = missionNamespace getVariable [format ["DMS_%1_RandItems",_class],0]; + private _randItems = missionNamespace getVariable [format ["DMS_%1_RandItems",_class],["Exile_Item_PlasticBottleFreshWater"]]; for "_i" from 1 to _randItemCount do { _unit addItem (selectRandom _randItems); @@ -171,13 +177,6 @@ if (_customGearSet isEqualTo []) then // Items (Loot stuff that goes in uniform/vest/backpack) {_unit addItem _x;} forEach (missionNamespace getVariable [format ["DMS_%1_items",_class],[]]); - - // Clothes - _unit addHeadgear (selectRandom (missionNamespace getVariable [format ["DMS_%1_helmets",_class],DMS_assault_helmets])); - _unit forceAddUniform (selectRandom (missionNamespace getVariable [format ["DMS_%1_clothes",_class],DMS_assault_clothes])); - _unit addVest (selectRandom (missionNamespace getVariable [format ["DMS_%1_vests",_class],DMS_assault_vests])); - _unit addBackpackGlobal (selectRandom (missionNamespace getVariable [format ["DMS_%1_backpacks",_class],DMS_assault_backpacks])); - // Make AI effective at night private _nighttime = (sunOrMoon != 1); if (_nighttime) then @@ -188,7 +187,7 @@ if (_customGearSet isEqualTo []) then if (!_unarmed) then { 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 DMS_fnc_AddWeapon; _unit selectWeapon _weapon; @@ -216,6 +215,7 @@ if (_customGearSet isEqualTo []) then }; }; + /* // In case spawn position is water if (DMS_ai_enable_water_equipment && {surfaceIsWater _pos}) then { @@ -224,14 +224,15 @@ if (_customGearSet isEqualTo []) then _unit forceAddUniform "U_O_Wetsuit"; _unit addVest "V_RebreatherIA"; _unit addGoggles "G_Diving"; - [_unit, "arifle_SDAR_F", 4 + floor(random 3), "20Rnd_556x45_UW_mag"] call BIS_fnc_addWeapon; + [_unit, "arifle_SDAR_F", 4 + floor(random 3), "20Rnd_556x45_UW_mag"] call DMS_fnc_AddWeapon; }; + */ private _pistols = missionNamespace getVariable [format ["DMS_%1_pistols",_class],[]]; if !(_pistols isEqualTo []) then { private _pistol = selectRandom _pistols; - [_unit, _pistol, 2 + floor(random 2)] call BIS_fnc_addWeapon; + [_unit, _pistol, 2 + floor(random 2)] call DMS_fnc_AddWeapon; }; // Infinite Ammo @@ -288,14 +289,14 @@ else if !(_launcher isEqualTo "") then { - [_unit, _launcher, 0] call BIS_fnc_addWeapon; + _unit addWeapon _launcher; }; // Add pistol and attachments if !(_pistol isEqualTo "") then { - [_unit, _pistol, 0] call BIS_fnc_addWeapon; + _unit addWeapon _pistol; { _unit addHandgunItem _x; @@ -306,7 +307,7 @@ else // Add gun and attachments if !(_weapon isEqualTo "") then { - [_unit, _weapon, 0] call BIS_fnc_addWeapon; + _unit addWeapon _weapon; { _unit addPrimaryWeaponItem _x; @@ -420,5 +421,7 @@ if (DMS_DEBUG) then }; +[_unit] joinSilent _group; + _unit diff --git a/README.md b/README.md index acf6251..3ba181c 100644 --- a/README.md +++ b/README.md @@ -150,6 +150,12 @@ ___ # Changelog: ### Test Branch: +#### June 16, 2016 (1:55 PM CST-America) **Release Candidate 1.5**: +* New function: DMS_fnc_AddWeapon. More efficient version of BIS_fnc_AddWeapon, and removed almost all error-checking. +* DMS will now log the DMS version to the client RPT on login. +* Fixed a couple issues in fn_SpawnAISoldier.sqf. +* Updated Tanoa config, missions should now be (somewhat) less likely to spawn in the center valley of the main island. + #### June 16, 2016 (1:55 PM CST-America) **Release Candidate 1.3**: * Renamed the "mercbase.sqf" mission title to "Mercenary Outpost" to avoid confusion with the salt flats mission. * Fixed an issue with fn_SpawnMineField.sqf (thanks to CEN for providing important info) From 1612432859a89b6445d44100be1ab3e386707ebd Mon Sep 17 00:00:00 2001 From: eraser1 Date: Fri, 24 Jun 2016 17:53:04 -0500 Subject: [PATCH 21/21] a --- @ExileServer/addons/a3_dms/config.sqf | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/@ExileServer/addons/a3_dms/config.sqf b/@ExileServer/addons/a3_dms/config.sqf index 4d83649..a29d3ee 100644 --- a/@ExileServer/addons/a3_dms/config.sqf +++ b/@ExileServer/addons/a3_dms/config.sqf @@ -1,8 +1,12 @@ /* - A lot of these configs are influenced by WAI :P - https://github.com/nerdalertdk/WICKED-AI + Main DMS Config File Created by eraser1 + Several revisions and additions have been made by community members. + + + A lot of these configs are influenced by WAI :P + https://github.com/nerdalertdk/WICKED-AI */