I found the trigger that creates the footmen and showed you the solution in my last post. Using food for this is like using any other Integer value, but less flexible.
The basic of leaks: Wc3 creates a handle for anything you create during triggers. If you don't remove it, it will be stored but will be useless and stack up as lag.
- Whenever you use a Point reference like
· Position of Unit · Random Point in Region · Center of Region... You're creating a point with X and Y coordinates, and you have to clean it after using it. The way to do this is
1- Create a Point type variable.
2- Before using the point you need in the trigger, you declare it into the variable
-
Set Point = Center of YourRegion
3- When you stop using that point in the trigger, you clean it.
-
Custom Script: call RemoveLocation(udg_Point)
4- NOTE: If you're going to use a different location on your trigger, you have to destroy the first one before adding a new value. They don't overwrite. If you need to work with another point without destroying the first one, create another Point variable and destroy it when you don't need it anymore.
As you can see, I used "udg_Point" and not just "Point". It's because GUI interface shows you the variable name, but the variable code/script is followed by "udg_", no matter the variable type.
- Whenever you work with a Player Group like
· Display to (Player group (Pllayer 1)) the text message · Pick ever player in (Players current status is playing)... You need to create a new group to handle that group of players (even if it's only 1). So you have to do the same you did with the point: Create a "Player Group" variable type, and destroy after using it.
1- Create a Player Group type variable.
2- Before using the Player Group you need in the trigger, you declare it into the variable
-
Set PGroup = (Player Group (Player 1))
3- When you stop using that player group in the trigger, you clean it.
-
Custom Script: call DestroyForce(udg_PGroup)
4- The same note for the point applies for this.
- You already know special effect leaks. You have to destroy them inmediatly after creating them. If you add a "wait" action before, you may create another special effect within that "wait" time, and destroying "Last created special effect" may not remove the first one, since it no longer was the last.
See this action:
-
(((Region centered at (Player start location) with size (384.00, 384.00)) contains (Random unit from (Units owned by Player of type Barracks))) Equal to True) then do (Unit - Create 1 Footman for Player at (Player start location) facing Default building facing degrees) else do (Do nothing)
· (Region centered at (Player start location) with size (384.00, 384.00) · The region does not exist, so, the game creates it just for this action, even if the trigger runs again, it will create it again. The same with the point "Player Start Location".
· (Random unit from (Units owned by Player of type Barracks))) · It involves 3 groups: (Random units from (Units owned by Player ( Units of Type Barracks))) · There are 3 leaks every 15 seconds for each player.
· (Unit - Create 1 Footman for Player at (Player start location) · Again, Player Start Location doesn't exist.
For points use: "call RemoveLocation(udg_YourVariableName)"
For player groups use: "call DestroyForce(udg_YourVariableName)"
For Unit Groups use: "call DestroyGroup((udg_YourVariableName)"
For UnitGroups you can also use: "set bj_wantDestroyGroup = true" before the"Pick every unit" action.
There are tons of guides, threats and webs that gives you information about Wc3 leaks and how to fix them. After a while you'll get the hang of it.