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

Killing units made by triggers in region.

Status
Not open for further replies.
Level 1
Joined
Aug 17, 2010
Messages
4
I'm having an issue where after i spawn 3 units within a region named "battlefield" I am unable to kill them.

I have no idea how to go about this. From what I know, units spawned with triggers are read only and make it impossible to add them to a unit group. Thus, all of the ways I know of getting rid of multiple units are void. The only way I can think of doing it is assigning each created unit to a variable after it has been spawned and then kill them by referencing the variable. This seems a little excessive though. I'm hoping someone can tell me an easier way.x

Edit: Sadly aware that I posted in the wrong section.
 
Level 11
Joined
Aug 6, 2009
Messages
697
I'm having an issue where after i spawn 3 units within a region named "battlefield" I am unable to kill them.

I have no idea how to go about this. From what I know, units spawned with triggers are read only and make it impossible to add them to a unit group. Thus, all of the ways I know of getting rid of multiple units are void. The only way I can think of doing it is assigning each created unit to a variable after it has been spawned and then kill them by referencing the variable. This seems a little excessive though. I'm hoping someone can tell me an easier way.x

Edit: Sadly aware that I posted in the wrong section.

Alright well I tried to do what you were doing and here is what I came up with
(note it does work but it lags)
  • Events
    • Time - Every 10.00 seconds of game time
  • Conditions
  • Actions
    • For each (Integer B) from 1 to 15, do (Actions)
      • Loop - Actions
        • Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
        • Set Unit = (Last created unit)
        • Unit Group - Add Unit to UnitGroup
    • Wait 5.00 seconds
    • For each (Integer A) from 1 to 15, do (Actions)
      • Loop - Actions
        • Unit Group - Pick every unit in UnitGroup and do (Actions)
          • Loop - Actions
            • Unit Group - Pick every unit in UnitGroup and do (Unit - Kill (Random unit from UnitGroup))
            • Set Unit = (Dying unit)
            • Unit Group - Remove Unit from UnitGroup
 
Status
Not open for further replies.
Top