• 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] How to check whether all members of a Unit Group have been killed (& not removed)

Status
Not open for further replies.
Level 3
Joined
Apr 10, 2023
Messages
12
Hi,
sorry if this post covers something commonly known or simple, im completely new to mapping :D

Im building a tower defense map where Units come in waves and try to exit the map via a zone (where they get removed from the map and you lose 1 life), basically your standard TD-Map.
Now I want a specific wave to give 1 Lumber to every player if all Units in this wave have been killed. However, I can't figure out how to do that.
I tried using the "UnitGroup (Empty)" condition but obviously this triggers even when models get removed from the map via the exit zone.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
Hello! This is pretty odd but you're one of like 3 new members to ask about TD's in the last few days. Perhaps we can get all of you in the same thread since I imagine there's a lot of similar questions between you guys and it could do you all a lot of good.

Anyway, I don't exactly understand what you mean by this, isn't this what you want?
I tried using the "UnitGroup (Empty)" condition but obviously this triggers even when models get removed from the map via the exit zone.
Also, what are models? Do you mean Units?

Regardless, we'd have to see your triggers to give you a truly proper solution since there's multiple ways of handling this and things will vary depending on how you've structured your existing triggers.

But here's one method that comes to mind which may work for you:

1) Use an Integer variable which starts out at however many units are in this specific Wave. Let's say 20:
  • Set Variable SpecificUnitsRemaining = 20
2) Subtract 1 from this variable every time a unit of the specific type reaches the exit zone:
  • Set Variable SpecificUnitsRemaining = SpecificUnitsRemaining - 1
3) Use an If Then Else action to check the value of this variable after subtracting from it:
  • If all Conditions are true then do Actions
    • Conditions
      • SpecificUnitsRemaining Equal to 0
      • Actions
        • Player Group - Pick every player in Users and do Actions
          • Loop - Actions
            • Player - Add 1 Lumber to (Picked player)
I'm writing the triggers from memory so things may not be 100% exact.
 
Last edited:
Level 3
Joined
Apr 10, 2023
Messages
12
Hello! This is pretty odd but you're one of like 3 new members to ask about TD's in the last few days. Perhaps we can get all of you in the same thread since I imagine there's a lot of similar questions between you guys and it could do you all a lot of good.

Anyway, I don't exactly understand what you mean by this, isn't this what you want?

Also, what are models? Do you mean Units?

Regardless, we'd have to see your triggers to give you a truly proper solution since there's multiple ways of handling this and things will vary depending on how you've structured your existing triggers.

But here's one method that comes to mind which may work for you:

1) Use an Integer variable which starts out at however many units are in this specific Wave. Let's say 20:
  • Set Variable SpecificUnitsRemaining = 20
2) Subtract 1 from this variable every time a unit of the specific type reaches the exit zone:
  • Set Variable SpecificUnitsRemaining = SpecificUnitsRemaining - 1
3) Use an If Then Else action to check the value of this variable after subtracting from it:
  • If all Conditions are true then do Actions
    • Conditions
      • SpecificUnitsRemaining Equal to 0
      • Actions
        • Player Group - Pick every player in Users and do Actions
          • Loop - Actions
            • Player - Add 1 Lumber to (Picked player)
I'm writing the triggers from memory so things may not be 100% exact.
Thanks for the help! I modified your solution a bit to fit my needs and it works like a charm :D
 
Status
Not open for further replies.
Top