• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Is this a leak?

Status
Not open for further replies.
Level 8
Joined
Jan 8, 2010
Messages
493
Hi! i have been reading into those leak guides, and though i understand that locations leak, the examples i've seen so far are only one-to-one (one unit per point). so i was wondering, this is also a leak right? (unit group and point?), and is there a way to deal with that point leak? because i only understood as far as when a single unit is ordered into a certain point, but not when many units are ordered into random points in a region.

  • Prisoners
    • Events
      • Time - Every 20.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in Prison01 <gen> owned by Player 3 (Teal)) and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Move To (Random point in Prison01 <gen>)
*i was thinking if maybe there is a way to avoid making too many actions just to remove a single point leak.
 
Level 5
Joined
Nov 11, 2009
Messages
172
Yeah this leaks:
  • Prisoners
    • Events
      • Time - Every 20.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in Prison01 <gen> owned by Player 3 (Teal)) and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Move To (Random point in Prison01 <gen>)
To fix it do this:
  • Prisoners
    • Events
      • Time - Every 20.00 seconds of game time
    • Conditions
    • Actions
      • Set TempGroup = Units in Prison01 <gen> owned by Player 3 (Teal)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Move To (Random point in Prison01 <gen>)
      • Custom Script: call DestroyGroup (udg_TempGroup)
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
And the location leak:

  • Prisoners
    • Events
      • Time - Every 20.00 seconds of game time
    • Conditions
    • Actions
      • Set TempGroup = Units in Prison01 <gen> owned by Player 3 (Teal)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Set TempLoc = (Random point in Prison01 <gen>)
          • Unit - Order (Picked unit) to Move To TempLoc
          • Custom Script: call RemoveLocation(udg_TempLoc)
      • Custom Script: call DestroyGroup (udg_TempGroup)
 
Level 8
Joined
Jan 8, 2010
Messages
493
oh, so you can include Custom Scripts inside looping actions? i mean, under the Loop - Actions line. so far what i understood was you must remove things that leak to prevent crashes, and most of the Custom Scripts i found was after the looping actions, so i had no idea until now. thanks Frunck and Maker! :)
 
Level 15
Joined
Aug 31, 2009
Messages
775
No, you must clear the location on every action inside the loop. Because for each and every action of the loop, a new point is created (Random point in the region) - each and every one of these must be removed. By putting the RemoveLocation outside of the loop, then only the last point is removed, leaking all the others.

Therefore, do exactly as Maker described.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Generally it's not a good idea to use waits inside of a loop.

And you do need to remove the location before you set new point using that variable. You definately need to remove the leak inside the loop, not at the end of the trigger.


With this you send every unit to different point.
  • Prisoners
    • Events
      • Time - Every 20.00 seconds of game time
    • Conditions
    • Actions
      • Set TempGroup = Units in Prison01 <gen> owned by Player 3 (Teal)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Set TempLoc = (Random point in Prison01 <gen>)
          • Unit - Order (Picked unit) to Move To TempLoc
          • Custom Script: call RemoveLocation(udg_TempLoc)
      • Custom Script: call DestroyGroup (udg_TempGroup)
With this you send all units to the same point.
  • Prisoners
    • Events
      • Time - Every 20.00 seconds of game time
    • Conditions
    • Actions
      • Set TempLoc = (Random point in Prison01 <gen>)
      • Set TempGroup = Units in Prison01 <gen> owned by Player 3 (Teal)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Move To TempLoc
      • Custom Script: call RemoveLocation(udg_TempLoc)
      • Custom Script: call DestroyGroup (udg_TempGroup)
 
Level 8
Joined
Jan 8, 2010
Messages
493
yup, i wanted the first trigger Maker did, the one where units are sent to different points in the region. that was what i was thinking, if there is a way to make units go to different points inside a Unit Group loop and remove all that random locations, and not make an action for every unit and remove the points for each unit. (mhen that's 344 units total :eek:) so i'll be sticking with what Maker suggested :D
 
Status
Not open for further replies.
Top