How do I make this lagless and leakless?Coz the units are trained and when there are a number of them on the map it lags..Maybe its because the loop that checks the picked unit position?
-
Wander and Gather
-

Events
-


Time - Every 1.00 seconds of game time
-
-

Conditions
-

Actions
-


Set Temp_Group = (Units in (Playable map area) matching ((((Matching unit) has buff Wander and Gather ) Equal to True) and ((Unit-type of (Matching unit)) Equal to Gatherer)))
-


Unit Group - Pick every unit in Temp_Group and do (Actions)
-



Loop - Actions
-




Set Temp_Loc = (Position of (Picked unit))
-




Set Temp_Real = 9999999.00
-




Item - Pick every item in (Playable map area) and do (Actions)
-





Loop - Actions
-






Set Temp_Loc2 = (Position of (Picked item))
-






If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-







If - Conditions
-








(Distance between Temp_Loc and Temp_Loc2) Less than Temp_Real
-








(Number of items carried by (Picked unit)) Less than 3
-
-







Then - Actions
-








Set Temp_Item = (Picked item)
-








Set Temp_Real = (Distance between Temp_Loc and Temp_Loc2)
-








Unit - Order (Picked unit) to Right-Click (Picked item)
-
-







Else - Actions
-
-






Custom script: call RemoveLocation(udg_Temp_Loc2)
-
-
-
-
-


Custom script: call RemoveLocation(udg_Temp_Loc)
-


Custom script: call DestroyGroup(udg_Temp_Group)
-
-



