GuardRange
| Flag: | GuardRange |
| File(s): | rules(md).ini |
| Values: | Signed integers: All whole numbers from -2147483648 to 2147483647; in rare cases, only from -32768 to 32767. |
| Default: | the farther one in the Range of primary weapon and secondary weapon |
| Applicable to: | TechnoTypes:
AircraftTypes, BuildingTypes, InfantryTypes and VehicleTypes |
Specifies the range, in cells, that this unit will scan for targets to attack.
Notes
As a special case, GuardRange is also used to determine the 'auto-fill' wall placement distance; the number of cells between which a new wall can be connected to an existing wall (assuming there are no obstructions).
If the GuardRange is greater than the weapon's Range, the unit will attempt to target enemies outside its firing range. However, due to insufficient range, it cannot fire and remains in a perpetual targeting state. In this scenario, you need to add DefaultToGuardArea=yes to make it approach the target.
Bugs/Side-Effects/Unexpected Limitations
If manually specifying this flag instead of using the default rules, the unit's target acquisition will not consider whether the weapon can actually fire at the target. For example, if the current primary weapon has [Projectiles]→SubjectToWalls=yes,
- Under default conditions the target acquisition mechanism will ignore targets blocked by OverlayTypes with Wall=yes.
- However, if the GuardRange is set to the same range as the [Weapons]→Range=, the unit will consider targets behind walls and choose to move around the cover obstruction to initiate attacks.
In vanilla, there is a hard upper limit of 16 cells.
- Starting from Phobos Build#49, this cap can be customized. Refer to #References
References
Starting from Phobos Build#49, MaxGuardRange can be used to customize the hard cap on target scan range (e.g GuardRange or highest weapon range if zero or not set). Refer to Phobos documentation.