// 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"];
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"];