Help: Solving This Memory Leak

Pyropenguins

New Member
Reaction score
4
Trigger:
  • Next
    • Events
      • Conditions
      • Actions
        • Set BlockCheck = False
        • Unit Group - Pick every unit in Chain and do (Actions)
          • Loop - Actions
            • Set PickedPoint = (Position of (Picked unit))
            • Set BigCheck = (Units owned by (Owner of (Triggering unit)) matching ((((Matching unit) is A structure) Equal to True) and ((((Matching unit) is in Chain) Equal to False) and ((Distance between PickedPoint and MatchPoint)) Less than 182.00))))
            • Unit Group - Pick every unit in BigCheck and do (Actions)
              • Loop - Actions
                • Unit Group - Add (Picked unit) to Chain
                • Custom script: call DestroyGroup (udg_BigCheck)
                • Custom script: call RemoveLocation (udg_PickedPoint)
                • Set BlockCheck = True
        • If (BlockCheck Equal to True) then do (Trigger - Run (This trigger) (checking conditions)) else do (Trigger - Run Last <gen> (checking conditions))

I think the leak is the position of matching unit. The problem is: if i do Set MatchPoint = (Position of (Matching Unit)) like this
Trigger:
  • Next
    • Actions
      • Set BlockCheck = False
      • Unit Group - Pick every unit in Chain and do (Actions)
        • Loop - Actions
          • Set PickedPoint = (Position of (Picked unit))
          • Set MatchPoint = (Position of (Matching unit))
          • Set BigCheck = (Units owned by (Owner of (Triggering unit)) matching ((((Matching unit) is A structure) Equal to True) and ((((Matching unit) is in Chain) Equal to False) and ((Distance between PickedPoint and (Position of (Matching unit))) Less than 182.00)

the trigger wont work at all:banghead::banghead::banghead::banghead:
Its gettin frustrating so i was wondering if anyone would help me out.
 

trees123

New Member
Reaction score
6
There's no condition that defines what the matching unit is. You have to make the chain group use the action "All units matching condition" or something along those lines.
 

GetTriggerUnit-

DogEntrepreneur
Reaction score
129
Trigger:
  • Unit Group - Pick every unit in BigCheck and do (Actions)
    • Loop - Actions
      • Unit Group - Add (Picked unit) to Chain
      • Custom script: call DestroyGroup (udg_BigCheck)
      • Custom script: call RemoveLocation (udg_PickedPoint)


Never destroy a group inside of it own loop.
Also remove the location outside of the loop, if there's moar then 1 unit, you ask to remove a non exixsting location -> fail. :eek:
Put it so that it look like that.

Trigger:
  • Actions
    • Unit Group - Pick every unit in BigCheck and do (Actions)
      • Loop - Actions
        • Unit Group - Add (Picked unit) to Chain
    • Custom script: call RemoveLocation (udg_PickedPoint)
    • Custom script: call DestroyGroup (udg_BigCheck)
 

Tom Jones

N/A
Reaction score
437
You need a different approach:
Trigger:
  • Test
    • Events
    • Conditions
    • Actions
      • Set BlockCheck = False
      • Unit Group - Pick every unit in Chain and do (Actions)
        • Loop - Actions
          • Set Point = (Position of (Picked unit))
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 128.00 of Point matching (((Owner of (Matching unit)) Equal to (*Some Player*)) and (((Matching unit) is A structure) Equal to True))) and do (Actions)
            • Loop - Actions
              • Unit Group - Add (Picked unit) to Chain
              • Set BlockCheck = True
          • Custom script: call RemoveLocation(udg_Point)
          • If (BlockCheck Equal to True) then do (Trigger - Run (This trigger) (checking conditions)) else do (Trigger - Run Last <gen> (checking conditions))
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top