DMS_Exile/@ExileServer/addons/a3_dms/scripts/fn_MissionParams.sqf
eraser1 70fae7bc44 Merry Xmas :D
* **NEW CONFIG VALUES:**

DMS_SpawnFlareOnReinforcements
DMS_MissionMarkerWinDot_Type
DMS_MissionMarkerLoseDot_Type
DMS_EnableBoxMoving
DMS_BasesToImportOnServerStart
DMS_AI_Classname
DMS_AI_AimCoef_easy
DMS_AI_AimCoef_moderate
DMS_AI_AimCoef_difficult
DMS_AI_AimCoef_hardcore
DMS_AI_EnableStamina_easy
DMS_AI_EnableStamina_moderate
DMS_AI_EnableStamina_difficult
DMS_AI_EnableStamina_hardcore
DMS_AI_destroyStaticWeapon
DMS_AI_destroyStaticWeapon_chance
DMS_ai_SupportedRandomClasses
DMS_random_non_assault_AI
DMS_random_non_MG_AI
DMS_random_non_sniper_AI
* Please check out the new config values in config.sqf to see what they
do :)
* Fixed issue with "thieves" mission (and DMS-spawned persistent
vehicles in general). Big thank you to [JamieKG from Eternal
Gamer](http://eternal-gamer.com/) and Torndeco.
* **New static mission: "slums"**
* Credit for the base goes to [William from Refugees of the
Fallen](http://refugeesofthefallen.enjin.com/)
* Spawns 2 crates at 2 different locations from a list of 5 locations.
* No AI vehicles, only infantry (introduces Close Quarters Combat)
* Added to Altis by default.
* Static bases can now be imported on server startup instead of mission
spawns. Enabled by default for saltflats and slums.
* Increased "DMS_MissionTimeoutResetRange" from 1000 to 1500.
* Removed the Navid from config (MG AI and box weapons).
* Edited panthera3_config to reduce SpawnZoneNear and TraderZoneNear
blacklists.
* Edited "blackhawkdown" and "donthasslethehoff" missions to use a
slightly different heli wreck classname.
* Increased marker circle diameter for saltflats mission to 750 meters.
* Moved "DMS_Version" variable assignment to pre-init.
* Moved Map Center and Map Radius assignments to post-init.
* Added support for 2 new optional parameters: _onMonitorStart and
_onMonitorEnd, run before and after the Mission Monitor checks the
mission, but AFTER "Mission Success State" is checked.
* Mines should now be deleted when a mission fails.
* Script optimizations for almost all functions using new command(s)
introduced in ArmA v1.54, as well as improved technique(s).
* "ExileServer_system_garbageCollector_deleteObject" is now used to
actually delete items by DMS_fnc_CleanUp.
* AI and vehicle cleanup should now be completely handled by Exile.
* Added support for mARMA logging.
* **You can now disable the movement/lifting of loot crates after the
mission is complete using "DMS_EnableBoxMoving".**
* Added some debug code to DMS_fnc_FindSafePos and
DMS_fnc_IsValidPosition (commented out by default)
* New group reinforcement type "increasing_difficulty".
* DMS_fnc_IsNearWater now checks for invalid parameter(s).
* DMS_fnc_PlayerAwardOnAIKill now checks for roadkill values AFTER
unit-defined respect/tabs.
* You can now define different marker types for mission
completion/failure using "DMS_MissionMarkerWinDot_Type" and
"DMS_MissionMarkerLoseDot_Type" respectively.
* "DMS_fnc_SetGroupBehavior" can now take a unit as parameter as well.
It will also now return true if behavior was changed, false otherwise.
* "DMS_fnc_SpawnAIGroup" and "DMS_fnc_SpawnAIGroup_MultiPos" now
supports the definition of custom gear sets.
* Improved function documentation for "DMS_fnc_SpawnAIGroup",
"DMS_fnc_SpawnAIGroup_MultiPos", and "DMS_fnc_SpawnAISoldier".
* "DMS_fnc_SpawnAISoldier" now supports multiple different random AI
class presets. This means that you can define a certain "random" class
preset, but have it select from a specially defined list that excludes
classes that you don't want.
* Added default values to certain "missionNameSpace getVariable"s in
DMS_fnc_SpawnAISoldier to prevent script errors in the event of invalid
definitions.
* Slight logic tweak/fix to DMS_fnc_TargetsKilled (it shouldn't throw
errors when there aren't any).
2015-12-24 13:45:20 -06:00

145 lines
5.5 KiB
Plaintext

/*
DMS_fnc_MissionParams
Created by eraser1
Takes input of any argument and converts it into a standard format for DMS missions.
It will use provided mission position requirements (if they exist) and simply return a position that matches the requirements.
If arguments provided do not have the mission position information, index 0 of the returned array will be an empty array.
Any other passed values (other than empty array "[]") will be added to the end of the returned array.
Usage:
[
_findSafePosParams, // ARRAY: If a new mission position has to be generated, these values are passed to "DMS_fnc_FindSafePos" if the provided _missionPosition is improperly defined, or if it doesn't have to spawn at the provided position and that position is invalid.
[
_missionPosition, // ARRAY (position ATL): Defines where the mission will spawn
_forceSpawn // (OPTIONAL) BOOL: Whether or not to force the mission to spawn at that location. Setting "_forceSpawn" to true means that the "DMS_fnc_IsValidPosition" check will be skipped, and the provided _missionPosition will be used regardless.
],
[
_extraParam_1, // (OPTIONAL) ANY: Extra parameter(s) that may be used by the mission.
_extraParam_2, // (OPTIONAL) ANY: Extra parameter(s) that may be used by the mission.
...
_extraParam_N // (OPTIONAL) ANY: Extra parameter(s) that may be used by the mission.
]
] call DMS_fnc_MissionParams;
or
_extraParams call DMS_fnc_MissionParams; // This will simply cause the function to use the default values for "DMS_fnc_FindSafePos" to generate a mission position. The "_extraParam" will be added to the back.
NOTE: If you pass an array with more than 1 element as an argument, the array must be in the form of the first example or the example below, or else you may get unexpected results.
If you want to pass some _extraParams as an array but spawn the mission at a random (valid) position, then call it as:
[
_findSafePosParams,
[
[],
],
_extraParams_ARRAY
] call DMS_fnc_MissionParams;
Returns an array in the form
[
_missionPos,
_extraParams
]
*/
private ["_parsedParams", "_extraParams", "_missionPosition", "_OK", "_posInfo", "_forceSpawn", "_findSafePosParams"];
_extraParams = [];
if (isNil "_this") then
{
if (DMS_DEBUG) then
{
(format ["MissionParams :: Calling with nil parameter; Setting _missionPosition to generated position with default values."]) call DMS_fnc_DebugLog;
};
// 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
] call DMS_fnc_FindSafePos;
}
else
{
if ((_this isEqualType []) && {(count _this)>1}) then
{
if (params
[
["_findSafePosParams",[25,DMS_WaterNearBlacklist,DMS_MaxSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist,DMS_ThrottleBlacklists],[[]]],
["_posInfo",[],[[]],[1,2]]
])
then
{
_missionPosition = _posInfo select 0;
_forceSpawn = if ((count _posInfo)>1) then {_posInfo select 1} else {false};
if (!(_missionPosition isEqualType []) || {(count _missionPosition)<2}) then
{
// Empty array means that you want to generate a mission position.
if !(_missionPosition isEqualTo []) then
{
diag_log format ["DMS ERROR :: Calling MissionParams with invalid _missionPosition: %1 | Generating new one with _findSafePosParams: %2",_missionPosition,_findSafePosParams];
};
// Passed _missionPosition parameter is invalid, so we just find a position the regular way.
_missionPosition = _findSafePosParams call DMS_fnc_FindSafePos;
}
else
{
// Make sure z-pos is defined.
if ((count _missionPosition) isEqualTo 2) then
{
_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 (DMS_DEBUG) then
{
(format ["MissionParams :: Finding new position as provided non-mandatory _missionPosition (%1) is invalid. Finding new position.",_missionPosition]) call DMS_fnc_DebugLog;
};
// Passed _missionPosition parameter is not mandatory and doesn't meet requirements, so we just find a new position.
_missionPosition = _findSafePosParams call DMS_fnc_FindSafePos;
};
};
// Assign "_extraParams" if they exist.
_extraParams = if ((count _this)>2) then {_this select 2} else {[]};
}
else
{
diag_log format ["DMS ERROR :: Calling MissionParams with invalid _findSafePosParams or _posInfo: %1 | Generating _missionPosition with _findSafePosParams params: %2. Setting _this as _extraParams: %3",_posInfo,_findSafePosParams,_this];
_missionPosition = _findSafePosParams call DMS_fnc_FindSafePos;
_extraParams = _this;
};
}
else
{
_missionPosition =
[
25,DMS_WaterNearBlacklist,DMS_MaxSurfaceNormal,DMS_SpawnZoneNearBlacklist,DMS_TraderZoneNearBlacklist,DMS_MissionNearBlacklist,DMS_PlayerNearBlacklist,DMS_TerritoryNearBlacklist,DMS_ThrottleBlacklists
] call DMS_fnc_FindSafePos;
_extraParams = _this;
};
};
_parsedParams =
[
_missionPosition,
_extraParams
];
if (DMS_DEBUG) then
{
(format ["MissionParams :: Returning _parsedParams: %1 | Calling params: %2",_parsedParams,_this]) call DMS_fnc_DebugLog;
};
_parsedParams