• 🏆 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!

Need help with variables

Status
Not open for further replies.
Level 1
Joined
Oct 21, 2016
Messages
4
    • Unit Group - Pick every unit within 200.00 of Temp_Point matching (((Matching unit is Alive) equal to true) and ((matching unit is an enemy of (owner of (triggering unit)) equal to true) and ((matching unit is a building) Not equal to true)) and Do Actions
I have this unit group action, wich works, however instead of a constant 200 range i want to change the range acording to the level of the ability being cast.
I tried making a variable, Frostbite_Aoe, and set Frostbite_Aoe[0]=0,Frostbite_Aoe[1]= The aoe of the ability on level 1,Frostbite_Aoe[2]= The aoe of the ability on level 2, Frostbite_Aoe[3]= The aoe of the ability on level 3, ETC.

Now heres the problem, i can't put a variable in the place of the 200 value.
The Variable type is intreger and i set it to array.
Should i choose a difrent type of variable than integer, or is what trying just impossible?
If anyone knows tell me!
 
Level 11
Joined
Jun 2, 2004
Messages
849
The reason we don't always just use reals is mostly because they're inaccurate. You can't accurately represent some numbers on a computer (like 1/3), only approximate them to a "reasonable" accuracy, and this occasionally has noticeable errors.

Another reason to have integers is for some low level computer stuff (like array indexing) which if you know how computers work, wouldn't make sense with reals, but that's a bit more complicated.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
The reason we don't always just use reals is mostly because they're inaccurate. You can't accurately represent some numbers on a computer (like 1/3), only approximate them to a "reasonable" accuracy, and this occasionally has noticeable errors.
Its mostly because they are slower to compute than integers as they are more complex.

Another reason to have integers is for some low level computer stuff (like array indexing) which if you know how computers work, wouldn't make sense with reals, but that's a bit more complicated.
One could create an instruction set that implicitly converts floats to integer values when using them as index or other whole number needing things. However it would have many issues and would almost certainly be slower.

It shouldnt be noticeable.
For most purposes it is not noticeable. However for others it is.
 
Level 11
Joined
Jun 2, 2004
Messages
849
For wc3 in particular, it gets noticeable with very high health/mana values. A while back I was using extremely high max mana units (mostly to just hide the mana numbers under the portrait), and was getting significant errors when tracking how much mana they spent on spells (a 100 mana spell would end up costing something like 64 mana). Fixed by reducing their max to more sane values.
 
Status
Not open for further replies.
Top