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

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