2015-08-28 21:52:56 +00:00
/*
2015-09-05 03:40:00 +00:00
DMS_fnc_TargetsKilled
2015-08-28 21:52:56 +00:00
Created by eraser1
Usage:
[
_unit,
_group,
_object
2015-09-05 03:40:00 +00:00
] call DMS_fnc_TargetsKilled;
2015-08-28 21:52:56 +00:00
Will accept non-array argument of group, unit, or object.
*/
2015-12-24 19:45:20 +00:00
if !(_this isEqualType []) then
2015-08-28 21:52:56 +00:00
{
_this = [_this];
};
if (_this isEqualTo []) exitWith
{
diag_log "DMS ERROR :: Calling DMS_TargetsKilled with empty array!";
};
private "_killed";
_killed = false;
try
{
{
2015-12-24 19:45:20 +00:00
if (_x isEqualType objNull) then
2015-08-28 21:52:56 +00:00
{
2015-12-24 19:45:20 +00:00
if (!isNull _x && {alive _x}) then
{
private ["_lastDistanceCheckTime", "_spawnPos"];
2015-09-20 20:26:08 +00:00
2015-12-24 19:45:20 +00:00
_lastDistanceCheckTime = _x getVariable ["DMS_LastAIDistanceCheck",time];
_pos = getPosWorld _x;
_spawnPos = _x getVariable ["DMS_AISpawnPos",_pos];
2015-09-20 20:26:08 +00:00
2015-12-24 19:45:20 +00:00
if ((DMS_MaxAIDistance>0) && {((time - _lastDistanceCheckTime)>DMS_AIDistanceCheckFrequency) && {(_pos distance2D _spawnPos)>DMS_MaxAIDistance}}) then
{
_x setDamage 1;
diag_log format ["Killed a runaway unit! |%1| was more than %2m away from its spawn position %3!",_x,DMS_MaxAIDistance,_x getVariable "DMS_AISpawnPos"];
}
else
{
throw _x;
};
2015-09-17 03:37:17 +00:00
};
2015-08-28 21:52:56 +00:00
}
else
{
2015-12-24 19:45:20 +00:00
if !(_x isEqualType grpNull) exitWith
2015-08-28 21:52:56 +00:00
{
diag_log format ["DMS ERROR :: %1 is neither OBJECT nor GROUP!",_x];
};
{
2015-09-20 20:26:08 +00:00
if (alive _x) then
2015-08-28 21:52:56 +00:00
{
2015-09-20 20:26:08 +00:00
private ["_lastDistanceCheckTime", "_spawnPos"];
_lastDistanceCheckTime = _x getVariable ["DMS_LastAIDistanceCheck",time];
_pos = getPosWorld _x;
_spawnPos = _x getVariable ["DMS_AISpawnPos",_pos];
if ((DMS_MaxAIDistance>0) && {((time - _lastDistanceCheckTime)>DMS_AIDistanceCheckFrequency) && {(_pos distance2D _spawnPos)>DMS_MaxAIDistance}}) then
{
_x setDamage 1;
diag_log format ["Killed a runaway unit! |%1| was more than %2m away from its spawn position %3!",_x,DMS_MaxAIDistance,_x getVariable "DMS_AISpawnPos"];
}
else
{
throw _x;
};
2015-08-28 21:52:56 +00:00
};
2015-09-04 16:35:19 +00:00
} forEach (units _x);
2015-08-28 21:52:56 +00:00
};
2015-09-04 16:35:19 +00:00
} forEach _this;
2015-08-28 21:52:56 +00:00
_killed = true;
}
catch
{
I know... it's been over a week... gimme a break
#### October 17, 2015 (2:30 PM CST-America):
* **NEW CONFIG VALUES**:
|DMS_TimeToFirstMission|
|DMS_ShowDifficultyColorLegend|
|DMS_TerritoryNearBlacklist|
|DMS_MinSurfaceNormal| (Used to be DMS_MaxSurfaceNormal, simply renamed)
|DMS_ai_launchers_per_group|
* **UPDATING ALL OF YOUR MISSION FILES IS HIGHLY RECOMMENDED UNLESS YOU
KNOW WHAT YOU'RE DOING**
* RENAMED "DMS_MaxSurfaceNormal" to "DMS_MinSurfaceNormal". I must have
been very tired when I named it...
* DMS_MinSurfaceNormal is now 0.9 by default, but will be 0.95 for Altis
and Bornholm (since they're relatively large/flat maps). Esseker is
still 0.85. If you want to convert DMS_MinSurfaceNormal to degrees, you
would take the arc-cosine of the surfaceNormal, and that will give you
the degrees from horizontal. For example, arccos(0.9) is about 25
degrees. Google: "arccos(0.9) in degrees"
* Tweaked and rebalanced "DMS_BanditMissionTypes". Most of the spawn
chances are the same, they're just reduced in order to prevent the
creation of arrays that are far larger than they need to be.
* You can now manually define how long it takes for the first mission to
spawn after a restart.
* DMS will now by default create markers on the bottom left of the map
to show which colors correspond to which difficulty. It isn't very
pretty, but it gets the point across.
* DMS will now manually calculate the center of the map and its radius,
if it isn't preconfigured by DMS.
* You can now specify the vehicles to spawn for missions: "bandits",
"cardealer", "construction", "donthasslethehoff", and "thieves".
* You can now specify the spawning location of any mission (and whether
or not to use an alternative location if the provided location is
invalid). This will allow for easy integration of DMS into admin tools.
* Added support for scripts to be executed on mission completion or
mission failure (this will allow you to have "multi-part" missions,
where you would simply spawn the next part of the mission if the
previous is completed).
* Restructured DMS_DEBUG from the previous patch in favor of a more
"optimized" method.
* DMS_fnc_findSafePos is completely overhauled; DMS no longer uses
"BIS_fnc_findSafePos". It also now throttles minSurfaceNormal on
repeated failure. You can now determine whether or not the mission
should spawn on water (however, I don't suggest you use this function
for water spawns yet).
* You can also now define a minimum distance from other territories for
missions.
* DMS_fnc_IsValidPosition will now check for water depth if the provided
position is meant to be checked as a "water spawn". It will now also
check for nearby missions from A3XAI or VEMF (untested).
* DMS_fnc_IsValidPosition now checks whether or not the position is
outside of the map borders.
* DMS_fnc_SelectOffsetPos will now return the 3rd element of the
provided position as-is.
* You can now have multiple AI within a group with a launcher.
* AI now have a 5-second godmode after spawning.
* You can now spawn a crate using ASL pos. DMS_fnc_SpawnCrate will also
make sure that the provided classname is valid.
* Just like SpawnCrate, "DMS_fnc_SpawnNonPersistentVehicle" and
"DMS_fnc_SpawnPersistentVehicle" will now make sure that the provided
classname is valid.
* "DMS_fnc_SpawnPersistentVehicle" now supports ASL spawning.
* Added support for [Rod Serling's](https://github.com/Rod-Serling) AVS.
* General optimization.
2015-10-17 19:39:07 +00:00
if (DMS_DEBUG) then
{
(format ["TargetsKilled :: %1 is still alive! All of %2 are not yet killed!",_exception,_this]) call DMS_fnc_DebugLog;
};
2015-08-28 21:52:56 +00:00
};
_killed;