• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[General] change sight radius to unit default

Status
Not open for further replies.
Level 12
Joined
Jan 30, 2020
Messages
875
As far as I know, we can change a unit's range by changing its unitweaponrealfield named UNIT_WEAPON_RF_ATTACK_RANGE and the native native BlzGetUnitWeaponRealField takes unit whichUnit, unitweaponrealfield whichField, integer index returns real or with an upgrade.

You can also change the acquisition range with the native native SetUnitAcquireRange takes unit whichUnit, real newAcquireRange returns nothing.

But I can't find anything in the entire common.j related to sight radius.

Maybe using a morphing ability to change the unit to a similar unit with the same sight radius for day/night as the "different unit" you are mentioning would work, but I have not yet tested this.
 
Level 5
Joined
May 10, 2018
Messages
129
As far as I know, we can change a unit's range by changing its unitweaponrealfield named UNIT_WEAPON_RF_ATTACK_RANGE and the native native BlzGetUnitWeaponRealField takes unit whichUnit, unitweaponrealfield whichField, integer index returns real

As far as I've tested, you cannot do it with unitweaponrealfield. Try it.
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
But I can't find anything in the entire common.j related to sight radius.
that is really weird, bc you can do it easily in GUI.

Unit - Set Unit: (Triggering unit)'s Real Field: Sight Radius ('usir') to Value: 300.00

My question was just if there was a way to make it change automatically (without manually triggering it) with the day and night cycles like regular unit vision range.
 
Level 12
Joined
Jan 30, 2020
Messages
875
I indeed missed it while searching common.j library.

But thats strange does UNIT_RF_SIGHT_RADIUS refer to day or night sight radius I have no idea.
As they do not seem to be distinct you might still have to use triggers to change it with night/day cycles.

EDIT :
the real field name for night sight radius is 'usin' and the day is 'usil', and you can't change them with triggers.
I can't find 'usir' anywhere in the object editor but maybe I missed it.
 
Last edited:
Level 21
Joined
Mar 29, 2020
Messages
1,237
a. I'm using patch 1.31.1, not reforged, so maybe that explains the difference.

b. maybe 'usir' was exactly what I am looking for all along - the full sight radius calculation, usil and usin included. I just assumed it was a single value, bc you only enter one numerical value to define it.
 
Level 12
Joined
Jan 30, 2020
Messages
875
Well fun enough these natives don't seem to have changed.

Now you might be right about 'asir', although in all honesty I wouldn't know for sure how it is related to 'usin' and 'usil' exactly.
But in that context, it would be interesting to know the relation, more precisely how both values would be calculated out of asir.

But the fact that you can set arbitrary values in both unit fields makes me wonder...
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
how both values would be calculated out of asir.
I just meant that if you set something to 'usir' of a unit it will automatically switch between 'usin' and 'usil' according to the time of day... no complex calculations needed. Initially I assumed that setting something to the 'usir' of a unit just set it to the current sight radius, and afterwards when time of day changed - the sight radius would remain as the previous value.

should be easy enough to check I guess...
 
Level 12
Joined
Jan 30, 2020
Messages
875
Yes I probably read it a bit too fast :D

Anyways I suppose it will be worth checking this theory because I can't seem to find any easy alternative so far.
Will try that as soon as I can breathe a moment ^^
 
Status
Not open for further replies.
Top