• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[Solved] GUI triggerer come in : Unit group leak, need fast reply!

Status
Not open for further replies.
Level 17
Joined
Jan 21, 2010
Messages
2,111
I make a spell, that spell is kind of locust swarm, but with triggered damage and unit
What i want to ask is
1. I make 3 unit group call (gui version)
This:
  • Unit group - pick every unit in (unit within bla of bla bla [1]) and do (action)
How i prevent group leak, or the unit group it self didn't leaked?
 
store it to a variable
  • Actions
    • Set UnitGroup = (Units within 512.00 of (Center of (Playable map area)))
    • Unit Group - Pick every unit in UnitGroup and do (Actions)
      • Loop - Actions
        • Unit - Kill (Picked unit)
    • Custom script: call DestroyGroup(udg_UnitGroup)

Yeah that's the really overkill method. The only reason to do this is if you run into a situation where you have to reference that group more than once or you run into the "two birds with one stone" paradox.

  • -------- Normal use --------
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick all...
    • Loop - Actions
      • -------- Fine --------
  • -------- But this --------
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick all units in (Units in range of (Random unit from (Units...
    • Loop - Actions
      • -------- Uh oh, only one of these groups is gonna get destroyed here --------
 
Well you can't destroy them at once, you have to set the extra ones to variables and destroy them one by one afterwards. For example, a solution to the problem above would be to do this:

  • Custom script: set bj_wantDestroyGroup = true
  • Set TempUnit = (Random unit from (Units...
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick all units in (Units in range of TempUnit...
    • Loop - Actions
 
Well you can't destroy them at once, you have to set the extra ones to variables and destroy them one by one afterwards. For example, a solution to the problem above would be to do this:

  • Custom script: set bj_wantDestroyGroup = true
  • Set TempUnit = (Random unit from (Units...
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick all units in (Units in range of TempUnit...
    • Loop - Actions

so, judging from the statement above, the tempunit is destroyed first, then the Unitgroup below
 
Status
Not open for further replies.
Back
Top