Uncle
Warcraft Moderator
- Joined
- Aug 10, 2018
- Messages
- 6,539
Hello, I was reading about leaks and I didn't quite fully grasp when I should null a Unit variable and other Object variables.
Here are some examples of what I'm currently doing:
Here are some examples of what I'm currently doing:
-
Example 1
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Animate Dead
-
Actions
- Set TempUnit[0] = (Casting unit)
- Unit - Set life of TempUnit[0] to 100.00%
- Set TempUnit[0] = No unit
-
Events
-
Example 2
-
Events
- Time - Every 1.00 seconds of game time
- Conditions
-
Actions
- Set TempPoint[0] = (Center of (Playable map area))
-
Unit Group - Pick every unit in (Units within 500.00 of TempPoint[0]) and do (Actions)
-
Loop - Actions
- Set TempUnit[0] = (Picked unit)
- Unit - Set life of TempUnit[0] to 100.00%
- Set TempUnit[0] = No unit
-
Loop - Actions
- Custom script: call RemoveLocation (udg_TempPoint[0])
-
Events
-
Example 3
-
Events
- Time - Every 0.03 seconds of game time
- Conditions
-
Actions
- Set Poseidon_TWElapsedTime[Spell_Array] = (Poseidon_TWElapsedTime[Spell_Array] + 0.03)
- Set TempPoint[0] = (Position of Poseidon_TWDummy[Spell_Array])
- Special Effect - Create a special effect at TempPoint[0] using Objects\Spawnmodels\Naga\NagaDeath\NagaDeath.mdl
- Special Effect - Destroy (Last created special effect)
- Custom script: call RemoveLocation (udg_TempPoint[0])
- -------- end --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Poseidon_TWElapsedTime[Spell_Array] Equal to 3.00
-
Then - Actions
- Unit - Kill Poseidon_TWDummy[Spell_Array]
- Set Poseidon_TWDummy[Spell_Array] = No unit
- Else - Actions
-
If - Conditions
-
Events