mirror of
https://github.com/Defent/DMS_Exile.git
synced 2024-08-30 16:52:12 +00:00
afb4833a65
#### September 13, 2015 (11:45 PM CST-America): * NEW CONFIG VALUES: DMS_MaxAIDistance and DMS_AIDistanceCheckFrequency * You can now use the above config values to kill AI that flee from their spawn position. Only "Soldier" AI will be killed. * Removed "O_HMG_01_F" from AI Static Weapons. AI were pretty useless on it... unless the AI were facing the right direction. * Reduced AI count and removed the "playerNear" parameter from testmission for easier testing. * NEW: When an AI vehicle gunner is killed, and the driver is still alive, after a little delay, the driver is then switched to the gunner seat. You should no longer have AI vehicles with a dead gunner that's driving around aimlessly :) There is a 5-8 second delay to simulate reaction time. Then the driver is ejected, then after 1.5 seconds the AI is then forced into the gunner seat. * NOTE: The above feature only works when the AI is still local (not offloaded). If the AI is offloaded, the AI is simply ejected and becomes a foot soldier. * AI assigned vehicles are destroyed when the crew is empty. Simulation is also disabled on them. * Reduced some of the "params" RPT spam, from DMS_fnc_SetGroupBehavior. * Tweaked AI Vehicle spawning logic. The AI are initially assigned to a temporary group and then behavior is set, then they join the assigned group to prevent overriding behavior of other ground units. * Non-persistent vehicles should now be fit properly to the terrain.
74 lines
1.8 KiB
Plaintext
74 lines
1.8 KiB
Plaintext
/*
|
|
DMS_fnc_TargetsKilled
|
|
Created by eraser1
|
|
|
|
Usage:
|
|
[
|
|
_unit,
|
|
_group,
|
|
_object
|
|
] call DMS_fnc_TargetsKilled;
|
|
|
|
Will accept non-array argument of group, unit, or object.
|
|
*/
|
|
|
|
if ((typeName _this) in ["GROUP","OBJECT"]) then
|
|
{
|
|
_this = [_this];
|
|
};
|
|
|
|
if (_this isEqualTo []) exitWith
|
|
{
|
|
diag_log "DMS ERROR :: Calling DMS_TargetsKilled with empty array!";
|
|
};
|
|
|
|
private "_killed";
|
|
|
|
_killed = false;
|
|
|
|
try
|
|
{
|
|
{
|
|
if (((typeName _x) == "OBJECT") && {!isNull _x && {alive _x}}) then
|
|
{
|
|
// It only seems long... but it's only evaluating 3 conditions.
|
|
if ((DMS_MaxAIDistance>0) && {((time - (_x getVariable ["DMS_LastAIDistanceCheck",time]))>DMS_AIDistanceCheckFrequency) && {((getPosWorld _x) distance2D (_x getVariable ["DMS_AISpawnPos",getPosWorld _x]))>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;
|
|
};
|
|
}
|
|
else
|
|
{
|
|
if ((typeName _x) != "GROUP") exitWith
|
|
{
|
|
diag_log format ["DMS ERROR :: %1 is neither OBJECT nor GROUP!",_x];
|
|
};
|
|
{
|
|
if ((DMS_MaxAIDistance>0) && {((time - (_x getVariable ["DMS_LastAIDistanceCheck",time]))>DMS_AIDistanceCheckFrequency) && {((getPosWorld _x) distance2D (_x getVariable ["DMS_AISpawnPos",getPosWorld _x]))>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;
|
|
};
|
|
} forEach (units _x);
|
|
};
|
|
} forEach _this;
|
|
|
|
_killed = true;
|
|
}
|
|
catch
|
|
{
|
|
if (DMS_DEBUG) then {
|
|
diag_log format ["DMS_DEBUG TargetsKilled :: %1 is still alive! All of %2 are not yet killed!",_exception,_this];
|
|
};
|
|
};
|
|
|
|
_killed; |