• 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 rid of decaying units in UnitGroup?

Status
Not open for further replies.
Level 7
Joined
Jun 1, 2009
Messages
125
I've got an issue: UnitGroup always pick up decaying units.

  • Set VariableSet Targets_Group_RED = (Units within 2500.00 of TempPoint[0] matching (((Owner of (Matching unit)) Equal to Player 12 (Brown)) and ((((Matching unit) is invulnerable) Equal to no) and ((((Matching unit) is dead) Equal to no and (((Matching unit) is A structure) Equal to no))))
But whatever I do, decaying units are still in group.

I've tried conditions: IsDead, IsAlive, Health = greater than 0. None of them worked.
 
Level 13
Joined
Feb 5, 2018
Messages
567
Im on phone, so I can't access the editor.
But there should be a boolean condition for decaying unit.

Do you need it for something specific?
 
Level 29
Joined
Sep 26, 2009
Messages
2,596
Not sure why it is not working for you. On an empty map I placed 2 footmen, 2 riflemen and 2 knights, used the triggers below and got expected results - when all are alive, the Check Group trigger creates effect on all 6 units. When I kill footmen and riflemen via Kill Units trigger and then fire the Check Group trigger again, only knights are picked.

Check Group trigger

  • Check Group
    • Events
      • Player - Player 1 (Red) issues Mouse Down event
    • Conditions
    • Actions
      • Game - Display to (All players) the text: ===========
      • Set VariableSet Point = (Position of Knight 0000 <gen>)
      • Set VariableSet UnitGroup = (Units within 2500.00 of Point matching (((Owner of (Matching unit)) Equal to Player 1 (Red)) and ((((Matching unit) is invulnerable) Equal to False) and ((((Matching unit) is dead) Equal to False) and (((Matching unit) is A structure) Equal to False)))).)
      • Unit Group - Pick every unit in UnitGroup and do (Actions)
        • Loop - Actions
          • Game - Display to (All players) the text: (Picked + (Name of (Picked unit)))
          • Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Human\DispelMagic\DispelMagicTarget.mdl
          • Special Effect - Destroy (Last created special effect)

Kill Units trigger

  • Kill Units
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Unit-type of (Picked unit)) Equal to Footman
                  • (Unit-type of (Picked unit)) Equal to Rifleman
            • Then - Actions
              • Unit - Kill (Picked unit)
            • Else - Actions

Perhaps between the time that you pick units into your group and doing something with the group, another trigger is fired and places decaying units in there?

Try to use custom (new) group variable if the issue persists
 
Level 7
Joined
Jun 1, 2009
Messages
125
Remove the units from unit group when they die.

Hmm, I already have it

  • Unit Dies
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
    • Actions
      • If (((Number of units in (Units of type Chaos Tower)) Greater than 0)) then do (Unit Group - Remove (Dying unit) from Targets_Group_RED.) else do (Do nothing)
But I think something went wrong.

Anyway, I've tried your version and it works fine as I've tested yet.

  • Unit Dies
    • Events
      • Unit - A unit owned by Player 12 (Brown) Dies
    • Conditions
    • Actions
      • If (((Dying unit) is in Targets_Group_RED.) Equal to Да) then do (Unit Group - Remove (Dying unit) from Targets_Group_RED.) else do (Do nothing)
Thanks for help guys!
 
Status
Not open for further replies.
Top