• 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.

[General] How to put 2 types of units in unit group without leaks and bugs?

Status
Not open for further replies.
OK, what will be the best way to destroy the pets of the hunter after he dies?

I try this, but does not work.
  • if hunter dies his pets die
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Hunter
    • Actions
      • Set Hunter_Pets_Temp_Gr = (Units in (Playable map area) matching ((((Unit-type of (Matching unit)) Equal to Misha (Level 1)) and ((Unit-type of (Matching unit)) Equal to Spider)) and (((Matching unit) is A structure) Equal to False)))
      • Unit Group - Pick every unit in Hunter_Pets_Temp_Gr and do (Actions)
        • Loop - Actions
          • Unit - Make (Picked unit) Explode on death
          • Unit - Kill (Picked unit)
      • Custom script: call DestroyGroup(udg_Hunter_Pets_Temp_Gr)
Or maybe I have to destroy every unit alone?
I tried this with 'and' and 'or'.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
You don't need structure thing.You are checking for bears and spiders anyway.You need to use "or" a unit can't be both footman and grunt at the same time.

Also you better only kill pets owned by that player.

  • Pets
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Footman
    • Actions
      • Set HunterPets = (Units owned by (Owner of (Dying unit)) matching (((Unit-type of (Matching unit)) Equal to Footman) or ((Unit-type of (Matching unit)) Equal to Footman)))
      • Unit Group - Pick every unit in HunterPets and do (Actions)
        • Loop - Actions
          • Unit - Explode (Picked unit)
      • Custom script: call DestroyGroup(udg_HunterPets)
Edit: When did you post :O
 
Sorry, that doesn't make much sense.

No, no it doesn't. I read the trigger wrong.

Edit:
Then just use
HunterPets = Matching unit equal to unit type Misha AND Matching unit equal to unit type Spider AND Owner of Matching unit equal to Owner of dying unit.
Pick every unit in HunterPets
Loop -
Explode the mofos
 
Status
Not open for further replies.
Top