• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Movement type comparison issue in spell

Status
Not open for further replies.
Level 7
Joined
Sep 10, 2022
Messages
101
Hi, I have another stupid question. I have an ability that must target all ground units, but it does not work on turtles (I don't know why, I have ground type classification check, but maybe turtles are not ground units because they have movement type "amphibious").
So I decided to add an additional check, that compares target unit type movement. The problem is that I do not know what integer field corresponds to "amphibious", "foot" etc...
I assumed that 0 corresponds to None, 1 to Foot, etc., so amphibious is 6. Did not work.
Then I assumed that numeration starts with 1, so None is, and amphibious is 7. Did not work. (Then I found out in a forum that numeration starts with zero).

I checked with hydras targets - it is all the same. So the checks do not work on all amphibious. At the same time, it works well for trolls, ogres etc..

The conditions:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (strike_target is invulnerable) Equal to Нет
      • (strike_target is alive) Equal to Да
      • (strike_target belongs to an enemy of strike_cause_player.) Equal to Да
      • Or - Any (Conditions) are true
        • Conditions
          • (strike_target is A ground unit) Equal to Да
          • (Unit: strike_target's Integer Field: Type ('umvt')) Equal to 1
          • (Unit: strike_target's Integer Field: Type ('umvt')) Equal to 2
          • (Unit: strike_target's Integer Field: Type ('umvt')) Equal to 5
          • (Unit: strike_target's Integer Field: Type ('umvt')) Equal to 6
      • unit_mana Greater than 0.00

What should I do?
 
Level 7
Joined
Sep 10, 2022
Messages
101
Can you not just check if it's a Flying/Ground unit:
  • Conditions
    • (strike_target is a Ground unit) equal to True
  • Conditions
    • (strike_target is a Flying unit) equal to False
Ohhh well, I deleted all movement type comparisons, deleted ground comparison and instead of ground comparison added flying. Now it works, but I wonder what was wrong.
Maybe just the Ground condition is buggy... or "OR - Any Condition" did bad.
 
Level 29
Joined
Sep 26, 2009
Messages
2,595
This is a strange numeration
This is an often used pattern in programming called Bit Flags. Except for "None = 0", all those numbers are of power of two. The base remains same (2) but the exponent is increasing (i.e. 2^0, 2^1, 2^2, ... 2^5). It's often used to have a single variable represent multiple states. In this case, it seems that Blizz originally intended to allow units to have multiple movement types (e.g. choosing both "Foot" and "Float" would act as "Amphibious"), but ultimately dropped the idea.
 
Level 7
Joined
Sep 10, 2022
Messages
101
This is an often used pattern in programming called Bit Flags. Except for "None = 0", all those numbers are of power of two. The base remains same (2) but the exponent is increasing (i.e. 2^0, 2^1, 2^2, ... 2^5). It's often used to have a single variable represent multiple states. In this case, it seems that Blizz originally intended to allow units to have multiple movement types (e.g. choosing both "Foot" and "Float" would act as "Amphibious"), but ultimately dropped the idea.
Wow, haven't noticed it uses the power of two.
 
Status
Not open for further replies.
Top