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

[Trigger] Question about unit group

Status
Not open for further replies.
Level 8
Joined
Sep 24, 2007
Messages
300
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • AstroJumpLevel Equal to 1
    • Then - Actions
      • Unit Group - Pick every unit in (Units within 400.00 of (Position of (Casting unit))) and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to AstroJumpUnitGroup
          • Unit Group - Remove (Casting unit) from AstroJumpUnitGroup
          • Advanced - Slide (Picked unit) using (Facing of (Casting unit)) degrees angle with a starting velocity of 20.00 and kill destructables in the way True
          • Unit - Create 1 DummyAstroJump for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing (270.0) degrees
          • Unit - Add a 3.50 second Generic expiration timer to (Last created unit)
          • Unit - Order (Last created unit) to Follow (Casting unit)
    • Else - Actions
It's simple. I add all units within 400 AOE of casting unit to unit group AstroJumpUnitGroup and then I remove Caster from unit group so it won't slide.

The problem is in Slide action. I must select all units in AstroJumpUnitGroup to slide, not Picked unit. The problem is, that I can't find function that would select all units in unit group. I only found "Find first unit in unit group" and "Random unit in unit group".

I need to select all from unit group of them, not only 1.


+rep to the person who helps me
Ty in advance
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
Seems pretty simple to me.
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • AstroJumpLevel Equal to 1
    • Then - Actions
      • Unit Group - Pick every unit in (Units within 400.00 of (Position of (Casting unit))) and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to AstroJumpUnitGroup
      • Unit Group - Remove (Casting unit) from AstroJumpUnitGroup
      • Unit Group - Pick every unit in AstroJumpUnitGroup and do (Actions)
        • Loop - Actions
          • Advanced - Slide (Picked unit) using (Facing of (Casting unit)) degrees angle with a starting velocity of 20.00 and kill destructables in the way True
      • Unit - Create 1 DummyAstroJump for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing (270.0) degrees
      • Unit - Add a 3.50 second Generic expiration timer to (Last created unit)
      • Unit - Order (Last created unit) to Follow (Casting unit)
    • Else - Actions
 
Level 25
Joined
Jun 5, 2008
Messages
2,573
That trigger leaks he needs 2 more variables:

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • AstroJumpLevel Equal to 1
  • Then - Actions
    • Set Position1 = Positions of (Casting unit)
    • Set Unit Group1 = Units within 400 of Position1
    • Unit Group - Pick every unit in Unit Group1 and do (Actions)
    • Loop - Actions
    • Unit Group - Add (Picked unit) to AstroJumpUnitGroup
    • Unit Group - Remove (Casting unit) from AstroJumpUnitGroup
    • Unit Group - Pick every unit in AstroJumpUnitGroup and do (Actions)
      • Loop - Actions
        • Advanced - Slide (Picked unit) using (Facing of (Casting unit)) degrees angle with a starting velocity of 20.00 and kill destructables in the way True
        • Unit - Create 1 DummyAstroJump for (Owner of (Casting unit)) at Position1 facing Default building facing (270.0) degrees
        • Unit - Add a 3.50 second Generic expiration timer to (Last created unit)
        • Unit - Order (Last created unit) to Follow (Casting unit)
  • Custom script: call DestroyGroup(udg_Unit Group1)
  • Custom script: call RemoveLocation(udg_Position1)
  • Else - Actions
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
I've said this in a couple of other threads too: I'm not the anti-leak king. I help finding a solution to the problem, and here the problem is not solving leaks, it's ordering a Unit Group. People should know to make their triggers leakless, and if they don't know how to they should ask someone for help with that or ask them to do it for them.

Sorry I have to post this, but this is about the 2nd or 3rd time somebody posts that my trigger isn't good because it leaks, while I see 90% of the trigger solutions given on this forum causing leaks and nobody complaining about those.
So as I said before: If you need help with making triggers leakless, ask specificly for help or somebody to do it for you. If not asked, people can assume they don't need help there.
 
Status
Not open for further replies.
Top