UNIT_RF_SIGHT_RADIUS
- comment
This field represents a unit's current sight radius. The setter might have special logic, read notes below.
- note
This is a different field 'usir' than in the object editor: 'usid' for day sight and 'usin' for night.
- note
If you read a unit's sight radius via
BlzGetUnitRealField(u, UNIT_RF_SIGHT_RADIUS), it'll return the unit's current sight radius in-game (affected by any bonuses/upgrades they have). So for example, if you have a footman withday sight = 500, night sight = 1000and it is morning, it'll return500. If it is night time, it'll return1000. If it is night time and they have a bonus like goblin night scope, it'll return1500. Just be wary that this will also return intermediary values when it is transitioning from day-to-night and night-to-day. For example, if it is transitioning to night and you read that footman's sight, it would gradually return values from500to1000while the sight is slowly adjusted (e.g.500, 625.45, 776.32, ... 1000).Similarly, when you modify a unit's sight radius with
BlzSetUnitRealField(u, UNIT_RF_SIGHT_RADIUS, value), it sets the unit's current sight radius. It does affect both their day and night sight radius, though. It kinda acts as an additive bonus to the sight radius depending on the difference between their current sight radius andvalue. For example, if the unit's sight radius is currently500(day time) and you runBlzSetUnitRealField(u, UNIT_RF_SIGHT_RADIUS, 750), it'll effectively be like adding a+250 sight radiusbuff to the unit. So when it becomes night time, they'll have1250sight radius instead of1000.- note
The sight radius increases in discrete steps up to a maximum value ~1800. The unit is blind at level 0.
Level Minimum Maximum 0 0 63 1 64 191 2 192 319 3 320 447 4 448 575 5 576 703 6 704 831 7 832 959 8 960 1087 9 1088 1215 10 1216 1343 11 1344 1471 12 1472 1599 13 1600 1727 14 1728 1855 - patch
1.31.0.11889
- Source
- common.j (raise an issue to discuss on Github or submit a PR)
- Source code
constant unitrealfield UNIT_RF_SIGHT_RADIUS = ConvertUnitRealField('usir')