Ralle
Owner
- Joined
- Oct 6, 2004
- Messages
- 10,183
For a structured tutorial on the matter, read this.
Hello guys!
Credit to: Wolverabid, PurplePoot, Silvenon, Paskovich
I want to make a list of things that leak and ways to fix them.
Dynamic Unit Groups
Dynamic Locations
If there is a function, like (Position of (Unit)) or (Center of (Region)), it will leak.
Player Groups
Special Effects
Note: Creating a special effect and destroying it directly afterwards will still show the effect.
Terrain Deformations
Things That Always Leak
Hello guys!
Credit to: Wolverabid, PurplePoot, Silvenon, Paskovich
I want to make a list of things that leak and ways to fix them.
Dynamic Unit Groups
This trigger will instantly destroy dynamically generated unit groups.
Another way to avoid a group leak is to store the group into a variable, and then destroy it manually.
This is useful if you want to use the group more than once in the trigger.
-
Trigger
-
Events
- Event
-
Conditions
- Conditions
-
Actions
- Custom script: set bj_wantDestroyGroup = true
- Unit Group - Pick every unit in (Playable Map Area) and do (Unit - Hide (Picked unit))
-
Events
- Set GroupVar = Pick every unit in (Playable Map Area)
- Unit Group - Pick every unit in GroupVar and do (Unit - Hide (Picked unit))
- Custom script: call DestroyGroup(udg_GroupVar)
Dynamic Locations
- Unit - Create 1 unit at Somewhere
- Set loc = Somewhere
- Unit - Create 1 unit at loc
- Custom script: call RemoveLocation(udg_loc)
Player Groups
Player Groups leak also, but those are really rare. The fix:
Note: (All Players) does not leak, and destroying it may cause problems.
-
Player Group
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Some Spell
-
Actions
- Set PlayerGroup = (All enemies of Player 1 (Red))
- Player Group - Pick every player in PlayerGroup and do (Do nothing)
- Custom script: call DestroyForce(udg_PlayerGroup)
-
Events
Special Effects
-
Special Effect
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Some Spell
-
Actions
- Set Point = (Position of (Triggering unit))
- Special Effect - Create a special effect at Point using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
- Special Effect - Destroy (Last created special effect)
- Custom script: call RemoveLocation(udg_Point)
-
Events
Terrain Deformations
These create a small but permanent leak, so having far too many of them may cause some performance issues.
Spells like Shockwave and Hoof Stomp create terrain deformations, so do not over-use them.
Spells like Shockwave and Hoof Stomp create terrain deformations, so do not over-use them.
Things That Always Leak
Never use these functions:
- Unit Group - Pick all units of type Footman and do...
- Camera - Pan Camera as needed...
Last edited: