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

Unit Group Question

Status
Not open for further replies.
Alright, I'm a basic GUI user. What I'm trying to do is that when all the units of a Unit Group are dead, it will turn on the trigger that moves a unit to a certain area.

  • Map Init
    • Events
      • Map Initialization
    • Conditions
    • Actions
      • Unit Group - Add Unit to Unit Group Name
      • Unit Group - Add Unit
      • I repeat that to as many units will be in the Unit Group.
      • Unit Group - Pick every unit in (Unit Group) and do (Hide - (Picked Unit))
Here's the trigger I do to make them appear:

  • Quest Finish
    • Events
      • Unit - A Unit Dies
    • Conditions
    • Actions
      • Quest - Quest Stuff
      • Unit Group - Pick every unit in (Unit Group) and do (Unhide - (Picked Unit))
  • Quest 2 Finish
    • Events
      • Unit/Unit Group - A trigger that says that All Units in (Unit Group) have died
    • Conditions
    • Actions
      • Unit - Move (Unit) to center of (Region)
      • Quest - The other stuff.
[EDIT]
Please reply, I'm very desperate for an answer...
 
Last edited:
Level 16
Joined
May 1, 2008
Messages
1,605
Moin moin dude =)

I hope I understand you correctly, if yes maybe you can try something like that.

After you added all units into your unitgroup you can do this:
  • Actions:
    • Set TempInteger = (Number of units in TempGroup)
( TempGroup is an UnitGroup variable )
( TempInteger is an Integer variable )

Now you can use this trigger:
  • Trigger002
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in TempGroup) Equal to (==) True
    • Actions
      • Unit Group - Remove (Triggering unit) from TempGroup
      • Set TempInteger = (TempInteger - 1)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • TempInteger Equal to (==) 0
          • Then - Actions
            • -------- Your actions here --------
          • Else - Actions
( This trigger decrease the TempInteger by 1 if a unit dies that is in your unit group and if the TempInteger is 0 ( so all units in the group are dead ) you can use your action )

Edit: I don't know if you now it, but when I look at your trigger you got UnitGroup Leaks. So for this, there are 2 ways to avoid those:
1) before you pick every unit in a unit group you can type:
  • Custom script: set bj_wantDestroyGroup = true
2) After you pick every unit in a unit group and after you done all the actions you can type:
  • Custom script: call DestroyGroup(udg_TempGroup)
Greetings
~ The Bomb King - Dr. Boom
 
Status
Not open for further replies.
Top