• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Fixing a Memory Leak

Status
Not open for further replies.
Level 16
Joined
Mar 27, 2011
Messages
1,349
I have a trigger which runs periodically to order units in an areana style map
to move to random points within that area. The trigger:

  • Unit AI
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Set PlayerPatrol = (Units owned by Neutral Hostile)
      • Unit Group - Pick every unit in PlayerPatrol and do (Unit - Order (Picked unit) to Patrol To (Random point in Battle Order <gen>))
      • Custom script: call DestroyGroup (udg_PlayerPatrol)
I think this leaks once for every unit picked. However, This won't work either:

  • Unit AI Copy
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Set PlayerPatrol = (Units owned by Neutral Hostile)
      • Set TempPoint = (Random point in Battle Order <gen>)
      • Unit Group - Pick every unit in PlayerPatrol and do (Unit - Order (Picked unit) to Patrol To TempPoint)
      • Custom script: call DestroyGroup (udg_PlayerPatrol)
      • Custom script: call RemoveLocation (udg_TempPoint)
The problem with that, is that every unit picked goes to the same random point.
I want each unit to have its own generated random point. Could anybody help me please?
 
Status
Not open for further replies.
Top