diff --git a/@ExileServer/addons/a3_dms/config.sqf b/@ExileServer/addons/a3_dms/config.sqf index ca0e36b..717c3ac 100644 --- a/@ExileServer/addons/a3_dms/config.sqf +++ b/@ExileServer/addons/a3_dms/config.sqf @@ -18,7 +18,7 @@ DMS_DEBUG = false; DMS_TimeBetweenMissions = [600,900]; // [Minimum,Maximum] time between missions (if mission limit is not reached) | DEFAULT: 10-15 mins DMS_MissionTimeOut = [900,1800]; // [Minimum,Maximum] time it will take for a mission to timeout | Default: 15-30 mins - DMS_playerNearRadius = 75; // How close a player has to be to a mission in order to satisfy the "playerNear" mission requirement (can be customized per mission). + DMS_playerNearRadius = 100; // How close a player has to be to a mission in order to satisfy the "playerNear" mission requirement (can be customized per mission). DMS_AI_KillPercent = 100; // The percent amount of AI that need to be killed for "killPercent" mission requirement (NOT IMPLEMENTED) @@ -110,6 +110,7 @@ DMS_DEBUG = false; DMS_AIDistanceCheckFrequency = 60; // How often to check within DMS_fnc_TargetsKilled whether or not the AI is out of the maximum radius. Lower values increase frequency and increase server load, greater values decrease frequency and may cause longer delays for "runaway" AI. DMS_ai_offload_to_client = true; // Offload spawned AI groups to random clients. Helps with server performance. + 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_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/missions/mission_init.sqf b/@ExileServer/addons/a3_dms/missions/mission_init.sqf index 054da75..08c6bed 100644 --- a/@ExileServer/addons/a3_dms/missions/mission_init.sqf +++ b/@ExileServer/addons/a3_dms/missions/mission_init.sqf @@ -24,7 +24,8 @@ if (DMS_DEBUG) then // Set mission frequencies from config DMS_MissionTypesArray = []; { - for "_i" from 1 to (_x select 1) do { + for "_i" from 1 to (_x select 1) do + { DMS_MissionTypesArray pushBack (_x select 0); }; } forEach DMS_MissionTypes; \ No newline at end of file diff --git a/@ExileServer/addons/a3_dms/missions/testmission.sqf b/@ExileServer/addons/a3_dms/missions/testmission.sqf index 203a952..813c580 100644 --- a/@ExileServer/addons/a3_dms/missions/testmission.sqf +++ b/@ExileServer/addons/a3_dms/missions/testmission.sqf @@ -121,7 +121,13 @@ _added = [ [ "kill", - _group + _group, + true + ], + [ + "playerNear", + [_pos,DMS_playerNearRadius], + true ] ], [ diff --git a/@ExileServer/addons/a3_dms/scripts/fn_AILocalityManager.sqf b/@ExileServer/addons/a3_dms/scripts/fn_AILocalityManager.sqf index e7cc826..d75a4a3 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_AILocalityManager.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_AILocalityManager.sqf @@ -9,8 +9,7 @@ if !(DMS_ai_offload_to_client) exitWith {}; { - // Exile already has a group cleanup system, so we'll leave empty groups for it - if (((count (units _x))>1) && {!(_x getVariable ["DMS_LockLocality",false])}) then + if (((count (units _x))>1) && {!((DMS_ai_offload_Only_DMS_AI && {!(_x getVariable ["DMS_SpawnedGroup",false])}) || {(_x getVariable ["DMS_LockLocality",false])})}) then { private ["_leader", "_group", "_owner"]; _leader = leader _x; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_MissionSuccessState.sqf b/@ExileServer/addons/a3_dms/scripts/fn_MissionSuccessState.sqf index 7d2b392..c7c87d7 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_MissionSuccessState.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_MissionSuccessState.sqf @@ -4,58 +4,95 @@ Usage: [ - [_completionType1,_completionArgs1], - [_completionType2,_completionArgs2], + [_completionType1,_completionArgs1,_isAbsoluteCondition], + [_completionType2,_completionArgs2,_isAbsoluteCondition], ... - [_completionTypeN,_completionArgsN] + [_completionTypeN,_completionArgsN,_isAbsoluteCondition] ] call DMS_fnc_MissionSuccessState; */ -if !((typeName _this) == "ARRAY") exitWith +if ((typeName _this) != "ARRAY") exitWith { - diag_log format ["DMS ERROR :: DMS_MissionSuccessState called with invalid parameter: %1",_this]; + diag_log format ["DMS ERROR :: DMS_fnc_MissionSuccessState called with invalid parameter: %1",_this]; }; -private "_success"; +private ["_success", "_exit"]; _success = true; +_exit = false; { - if (!_success) exitWith + if (_exit) exitWith {}; + + try { + private ["_OK","_completionType","_completionArgs","_absoluteWinCondition"]; + + _OK = _x params + [ + ["_completionType", "", [""] ], + ["_completionArgs", [], [[],grpNull] ] + ]; + + if (!_OK) then + { + diag_log format ["DMS ERROR :: DMS_fnc_MissionSuccessState has invalid parameters in: %1",_x]; + throw "ERROR"; + }; + + + _absoluteWinCondition = false; + if (((count _x)>2) && {_x select 2}) then + { + _absoluteWinCondition = true; + }; + + if (!_success && {!_absoluteWinCondition}) then + { + throw format ["Skipping completion check for condition |%1|; Condition is not absolute and a previous condition has already been failed.",_x]; + }; + + if (DMS_DEBUG) then { - diag_log format ["DMS_DEBUG MissionSuccessState :: Mission not yet completed with parameters: %1 | at time %2",_this,diag_tickTime]; + diag_log format ["DMS_DEBUG MissionSuccessState :: Checking completion type %1 with parameter %2. Absolute: %3",_completionType,_completionArgs,_absoluteWinCondition]; }; - }; - private ["_OK","_completionType","_completionArgs"]; + switch (toLower _completionType) do + { + case "kill": + { + _success = _completionArgs call DMS_fnc_TargetsKilled; + }; + /* + case "killpercent": + { + _success = _completionArgs call DMS_fnc_TargetsKilledPercent;//<---TODO + }; + */ + case "playernear": + { + _success = _completionArgs call DMS_fnc_IsPlayerNearby; + }; + default + { + diag_log format ["DMS ERROR :: Invalid completion type (%1) with args: %2",_completionType,_completionArgs]; + throw "ERROR"; + }; + }; - _OK = _x params - [ - ["_completionType", "", [""] ], - ["_completionArgs", [], [[],grpNull] ] - ]; - if (!_OK) exitWith + if (_success && {_absoluteWinCondition}) then + { + _exit = true; + throw format ["Mission completed because of absolute win condition: %1",_x]; + }; + } + catch { - diag_log format ["DMS ERROR :: DMS_MissionSuccessState has invalid parameters in: %1",_x]; - }; - - switch (_completionType) do - { - // Using switch-do so that future cases can be added easily - case "kill": + if (true) then { - _success = _completionArgs call DMS_fnc_TargetsKilled; - }; - case "killPercent": - { - _success = _completionArgs call DMS_fnc_TargetsKilledPercent;//<---TODO - }; - case "playerNear": - { - _success = _completionArgs call DMS_fnc_IsPlayerNearby; + diag_log format ["DMS_DEBUG MissionSuccessState :: %1",_exception]; }; }; } forEach _this; diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf index a9cc607..42601d9 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnAIGroup.sqf @@ -74,6 +74,7 @@ if(_pos_z == 0) then _group = createGroup (missionNamespace getVariable [format ["DMS_%1Side",_side],EAST]); _group setVariable ["DMS_LockLocality",nil]; +_group setVariable ["DMS_SpawnedGroup",true]; for "_i" from 1 to _count do { diff --git a/@ExileServer/addons/a3_dms/scripts/fn_SpawnNonPersistentVehicle.sqf b/@ExileServer/addons/a3_dms/scripts/fn_SpawnNonPersistentVehicle.sqf index 00390aa..2b4b5a8 100644 --- a/@ExileServer/addons/a3_dms/scripts/fn_SpawnNonPersistentVehicle.sqf +++ b/@ExileServer/addons/a3_dms/scripts/fn_SpawnNonPersistentVehicle.sqf @@ -57,6 +57,11 @@ _vehObj setDir (random 360); _vehObj setPosATL _vehpos; _vehObj setVectorUp (surfaceNormal _vehpos); +if (!isNil "RS_VLS") then +{ + [_vehicle] call RS_VLS_sanitizeVehicle; +}; + _vehObj lock 2; _vehObj allowDamage false; _vehObj enableRopeAttach false; diff --git a/README.md b/README.md index 7b9bba7..332599e 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,14 @@ if (!hasInterface && !isServer) then ## Changelog: +#### September 20, 2015 (12:30 AM CST-America): +* NEW CONFIG VALUE: "DMS_ai_offload_Only_DMS_AI" +* You can use "DMS_ai_offload_Only_DMS_AI" to offload only AI spawned by DMS. This should resolve any issues with other mission systems from DMS. +* Increased "DMS_playerNearRadius" from 75 meters to 100 meters. +* You can now define "absolute" mission conditions. If this mission condition is met, it immediately counts the mission as completed. Add "true" after the completion argument to turn it into an "absolute" win condition. +* Added compatibility with RS_VLS by [Rod Serling](https://github.com/Rod-Serling). + + #### September 18, 2015 (6:30 PM CST-America): * NEW CONFIG VALUE: "DMS_HideBox". * Loot vehicles cannot be lifted, pushed, or damaged until the mission is completed successfully. Then the vehicle will be added to the Exile simulation monitor.