Memory Leaks

Man-o-Bomb

New Member
Reaction score
30
Im new using custom scripts to destroy memory leaks.
But my map starts lagging like crazy, so if anyone could look this trigger through, it would help alot.
Code:
Move Waves
    Events
        Time - Every 0.01 seconds of game time
    Conditions
    Actions
        Set Temp_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Tidal Wave) and ((Owner of (Matching unit)) Equal to Neutral Hostile)))
        Unit Group - Pick every unit in Temp_Group and do (Actions)
            Loop - Actions
                Set Temp_Point = ((Position of (Picked unit)) offset by 3.00 towards 0.00 degrees)
                Unit - Move (Picked unit) instantly to Temp_Point, facing 0.00 degrees
                Custom script:   call RemoveLocation (udg_Temp_Point)
                Custom script:   call DestroyGroup (udg_Temp_Group)
                Set Temp_Group = (Units within 100.00 of (Position of (Picked unit)))
                Unit Group - Pick every unit in Temp_Group and do (Actions)
                    Loop - Actions
                        Set Temp_Point = ((Position of (Picked unit)) offset by 3.00 towards 0.00 degrees)
                        Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 3.00 towards 0.00 degrees), facing Default building facing degrees
                        Custom script:   call RemoveLocation (udg_Temp_Point)
                        Custom script:   call DestroyGroup (udg_Temp_Group)
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Code:
                Set Temp_Point = ((Position of (Picked unit)) offset by 3.00 towards 0.00 degrees)

Code:
                Set Temp_Group = (Units within 100.00 of (Position of (Picked unit)))

Code:
                        Set Temp_Point = ((Position of (Picked unit)) offset by 3.00 towards 0.00 degrees)

Code:
                        Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 3.00 towards 0.00 degrees), facing Default building facing degrees

Position of (Picked Unit) leaks in each of those calls.

Also:
Code:
                Custom script:   call DestroyGroup (udg_Temp_Group)

You probably don't want to destoy that group inside the group-loop.
 

Man-o-Bomb

New Member
Reaction score
30
Code:
Move Waves
    Events
        Time - Every 0.01 seconds of game time
    Conditions
    Actions
        Set Temp_Group = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Tidal Wave) and ((Owner of (Matching unit)) Equal to Neutral Hostile)))
        Unit Group - Pick every unit in Temp_Group and do (Actions)
            Loop - Actions
                Set Temp_Point = ((Position of (Picked unit)) offset by 3.00 towards 0.00 degrees)
                Unit - Move (Picked unit) instantly to Temp_Point, facing 0.00 degrees
                Custom script:   call RemoveLocation (udg_Temp_Point)
                Set Temp_Group = (Units within 100.00 of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Not equal to Tidal Wave))
                Unit Group - Pick every unit in Temp_Group and do (Actions)
                    Loop - Actions
                        Set Temp_Point = ((Position of (Picked unit)) offset by 3.00 towards 0.00 degrees)
                        Unit - Move (Picked unit) instantly to Temp_Point, facing (Facing of (Picked unit)) degrees
                        Custom script:   call RemoveLocation (udg_Temp_Point)
        Custom script:   call DestroyGroup (udg_Temp_Group)
Like that?
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
You're overwriting the variable inside the loop, so you'll have to use another one for the second unit group.
 

TideOfChaos

New Member
Reaction score
25
Also, running the Trigger every 0.01 seconds is a no no.

Trust me, if you change that to even 0.02 you are halving the amount of times the Trigger will run each seconds. It will help alot.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top