BlzSetUnitIntegerField

Parameters
whichUnit unit
whichField unitintegerfield
value integer
comment

Changes a unit's stats integer field.

There're quirks when changing stats, some values don't apply immediately and some don't work at all, likely due to how the game engine uses them. Example:

BlzSetUnitIntegerField(unit, UNIT_IF_HIT_POINTS_REGENERATION_TYPE)

Regeneration type values are as follows:

  • 0 - Never
  • 1 - Always
  • 2 - Only on blight
  • 4 - Only at night

Changing the regeneration type at runtime WILL NOT work, even if true is returned (false positive).

For vision, it appears changing them to a specific value does not immediately change it. Instead, it will change over time to approach and reach said value. However, if one wishes to decrease the vision range, and the initial vision range is greater than 1800, the vision will remain at 1800. Thus, one must change it first to 1800, then to the desired value. Otherwise, vision change works as intended. One cannot increase vision beyond 1800.

Going into a fountain of life will not increase a unit's hp regeneration rate. Modifying regeneration rate is instant.

note

Many fields don't work at all.

patch

1.31.0.11889

return type
boolean
Source code
native BlzSetUnitIntegerField                      takes unit whichUnit, unitintegerfield whichField, integer value returns boolean
Source
common.j
wc3modding.com
BlzSetUnitIntegerField