How to check if Unit is a Ward??

Bloodydood

New Member
Reaction score
14
Either have the condition written in Jass or check unit-type in GUI. Boolean classification checks in GUI don't seem to have Ward in the list.
 

ertaboy356b

Old School Gamer
Reaction score
86
I can write in Jass..

for mechanical unit, its UNIT_TYPE_MECHANICAL...
ward doesn't have a constant..

Any other suggestions?
 

jwallstone

New Member
Reaction score
33
This is a known problem: it is impossible directly.

The only way is a workaround, like: give every ward unit another dummy ability in the object editor. Check for that ability instead.
 

OMGedDude

New Member
Reaction score
5
I'm not sure whether this works or not, but if a ward counts as a summoned unit, then you could check if its a summoned unit and its movement speed is equal to 0.
 

ZugZugZealot

New Member
Reaction score
33
Here's one method of giving units custom classifications abusing Unit-Type Score Value...

Trigger:
  • CustomClassification
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • -------- Get Custom Classifications --------
      • Set tempInteger = (Point-value of (Unit-type of (Triggering unit)))
      • For each (Integer A) from 0 to 9, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • tempInteger Greater than or equal to 512
            • Then - Actions
              • Set tempBinBools[(9 - (Integer A))] = True
              • Set tempInteger = (tempInteger - 512)
            • Else - Actions
          • -------- End If --------
          • Set tempInteger = (tempInteger x 2)
      • -------- End Loop --------
      • -------- Classifications Acquired --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • tempBinBools[0] Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: This unit is a ward!
        • Else - Actions
      • -------- End If --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • tempBinBools[1] Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: Unit is Monkey!
        • Else - Actions
      • -------- End If --------


The math uses a bit of binary to it... Here's a table that displays the "value" of each classification.

JASS:
tempBinBools  [0]   [1]   [2]   [3]   [4]
               1     2     4     8    16

              [5]   [6]   [7]   [8]   [9]
              32    64    128   256   512


So in this case Ward being [0] has the classification value of 1, and Monkey being [1] having the classification value of 2. In order to apply them both, you just simply add their values up; so you would set the Unit-Type Point Value to be 3.
 

Jesus4Lyf

Good Idea™
Reaction score
397
Here's a real solution :):
Make an ability that can only target wards. (Or can't target wards.)
Try dummy casting that ability on the unit (issue target order).
If it succeeds, it is a ward (or if it fails if you made it so that it cannot target wards).
(Issue orders return a boolean - true for success, false for failure.)

Edit:
Just read the post above mine. Well, the end of it.
"So in this case Ward being [0] has the classification value of 1, and Monkey being [1]..."
I lol'd at how off topic you sounded.
 

ZugZugZealot

New Member
Reaction score
33
Just read the post above mine. Well, the end of it.
"So in this case Ward being [0] has the classification value of 1, and Monkey being [1]..."
I lol'd at how off topic you sounded.
I needed another custom classification to demonstrate how to use multiple classifications within the Score Value of a unit type; "Monkey" was the first thing that popped in my head.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top