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

Removing units in order

Level 12
Joined
May 7, 2008
Messages
334
Title may be misleading, but I'm trying to achieve the following:

The map has around 8 heroes that are already preplaced in testmap enviroment.

I also assigned each Hero its own circle (Dummy Unit with Locust) that needs to be removed once the Hero is picked.

I know of a way to remove them with bunch of if / then / else statements, but nothing else comes to my mind in how to solve it.

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Unit-type of (Target unit of ability being cast)) Equal to Hero_Type[1]
    • Then - Actions
      • Unit - Remove Hero_Circle[1] from the game
    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Target unit of ability being cast)) Equal to Hero_Type[2]
        • Then - Actions
          • Unit - Remove Hero_Circle[2] from the game
        • Else - Actions
          • etc...
 
Level 20
Joined
Aug 29, 2012
Messages
837
You can use a loop for that kind of stuff I think
  • Actions
    • For each (Integer A) from 1 to 8, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of (Target unit of ability being cast)) Equal to Hero_Type[Integer A]
          • Then - Actions
            • Unit - Remove Hero_Circle[[Integer A] from the game
          • Else - Actions
 
Level 12
Joined
May 7, 2008
Messages
334
You can use a loop for that kind of stuff I think
  • Actions
    • For each (Integer A) from 1 to 8, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of (Target unit of ability being cast)) Equal to Hero_Type[Integer A]
          • Then - Actions
            • Unit - Remove Hero_Circle[[Integer A] from the game
          • Else - Actions

Yep that would do the trick, simple and easy!

Thanks.
 
Top