ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

TargetDistanceCoefficientDefault

From ModEnc
Jump to: navigation, search
Tiberian Dawn The Covert Operations Red Alert Counterstrike Aftermath Tiberian Sun Firestorm HyperPatch Red Alert 2 Yuri's Revenge Ares Generals Zero Hour Tiberium Wars Kane's Wrath
Flag: TargetDistanceCoefficientDefault
File(s): rules(md).ini
Values: ERROR – No value types set! Please edit this page and fix the Flag template!
Applicable to: General


TargetDistanceCoefficientDefault specifies the threat rating scan range globally in General section. TechnoTypes (units/infantries etc.) can override this global value with TargetDistanceCoefficient in their sections. Enemy target selection is affected depending upon if the enemy object is inside the scan range or outside the scan range. The effect of this threat rating is only witnessed in cases where the subject is free to choose its target and applies to cases like the AI script actions of Attack TargetType (0,n). Vanilla game rules(md).ini has this value set to -10. This value is a kind of percentage of the map size (longest length from corner to corner) which can be converted to number of cells for scan range. For the lower negative values like -10, it more or less evens out at specific number of cell range for various map sizes. For the largest negative number of -1, the range covers the entire map except few cells short of the map size.

Values and its cells ranges:

-11                         about 35 cells (or closer to 1/11th map size)
-10                         about 39 cells (or closer to 1/10th map size)
-9                          about 43 cells (or closer to 1/9th map size)
-8                          about 49 cells (or closer to 1/8th map size)
-7                          about 1/7th map size
-6                          about 1/6th map size 
-5                          few cells short of 20% map size
-4                          few cells short of 25% map size 
-3                          few cells short of 1/3rd map size
-2                          few cells short of half of map size
-1                          few cells short of entire map size, decimal negatives like -0.1 or -0.9 are same as -1
0 and above                 no range

Effect on AI Script actions of Attack TargetType (0,n) in TS/RA2/YR games

Target selection when the objects are outside the threat rating scan range:

When the enemy objects are outside threat rating scan range, select the object which was built first. Built first unit could mean, the target could be one of starting units, if those are not present then it could be the free units that comes with buildings like harvesters. In pre-placed units/structures, the first built is the first in their respective lists in the map files. After the first selected target is destroyed, next target will be evaluated again based on whether any of the enemy objects falls within the scan range or not. Any value in SpecialThreatValue does not affect the target selection when those fall outside the scan range.

On 0,1 (Attack anything) - Attack the first unit/aircraft/infantry/building produced by the enemy in that order. Meaning if no unit exists then the first aircraft produced by that enemy and so on.

On 0,2 (Attack buildings) - Attack the first building produced by the enemy.

On 0,5 (Attack vehicles) - Attack the first unit produced by the enemy.

Similar is the case for other Attack TargetType (0,n) script actions.

Target selection when any enemy object(s) is/are within the threat rating scan range:

When the enemy objects are available within the threat rating scan range, select the nearest. If more than 1 object are equidistant, then give preference to the object with SpecialThreatValue=1. In equidistant case, if both the objects have same value in SpecialThreatValue then select the one which was built first by the enemy. After the first selected target is destroyed, next target will be evaluated again based on whether any of the enemy objects falls within the scan range or not.


When there are objects both inside and outside the threat rating scan range, the case of within scan range applies. These 0,n script action are repetitive in nature, meaning that after the first selected target is destroyed, the team members will go on to select the next target based on the scan range.

Irrespective of what values other threat rating coefficient flags hold like MyEffectivenessCoefficientDefault, there is no effect seen when making target selection due to the strength, threat posed, weapon range/damage etc. of these enemy objects.