- Joined
- May 16, 2020
- Messages
- 660
Hi guys, I have two uncertainties about removing leaks:
First, I found this trigger where the maker removes the group 2x, both within the trigger and at the end. I always thought it's enough to remove it just 1x at the end. Which one is correct?
Secondly, how can I avoid leaks if I cannot delete a group within a loop, because otherwise I would lose the information which is necessary for the next loop?
Take this example:
Is there a solution for this?
First, I found this trigger where the maker removes the group 2x, both within the trigger and at the end. I always thought it's enough to remove it just 1x at the end. Which one is correct?
-
Dual Breath
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Dual Breath
-
Actions
- Set VariableSet DB_Caster = (Triggering unit)
- Set VariableSet DB_CasterPos = (Position of DB_Caster)
- Unit - Create 1 Dummy Unit for (Owner of DB_Caster) at DB_CasterPos facing Default building facing degrees
- Custom script: call RemoveLocation (udg_DB_CasterPos)
- Unit - Add Dual Breath Dummy to (Last created unit)
- Unit - Set level of Dual Breath Dummy for (Last created unit) to (Level of Dual Breath for DB_Caster)
- Set VariableSet DB_TargetPos = (Target point of ability being cast)
- Unit - Order (Last created unit) to Neutral Brewmaster - Breath Of Fire DB_TargetPos
- Custom script: call DestroyGroup (udg_DB_Group)
- Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
- Wait 0.27 seconds
- Set VariableSet DB_MapCenter = (Center of (Playable map area))
- Set VariableSet DB_Group = (Units in (Playable map area) matching (((Matching unit) has buff Dual Breath ) Equal to True))
-
Unit Group - Pick every unit in DB_Group and do (Actions)
-
Loop - Actions
- Unit - Create 1 Dummy Unit for (Owner of DB_Caster) at DB_MapCenter facing Default building facing degrees
- Unit - Add Dual Breath Slow to (Last created unit)
- Unit - Set level of Dual Breath Slow for (Last created unit) to (Level of Dual Breath for DB_Caster)
- Unit - Order (Last created unit) to Undead Lich - Frost Nova (Picked unit)
- Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
-
Loop - Actions
- Custom script: call RemoveLocation (udg_DB_MapCenter)
- Custom script: call DestroyGroup (udg_DB_Group)
-
Events
Secondly, how can I avoid leaks if I cannot delete a group within a loop, because otherwise I would lose the information which is necessary for the next loop?
Take this example:
-
TimeLock Learn
-
Events
- Unit - A unit Learns a skill
-
Conditions
- (Learned Hero Skill) Equal to Time Lock
- (Learned skill level) Equal to 1
-
Actions
- Trigger - Turn on TimeLock Start again <gen>
-
Events
-
TimeLock Start again
-
Events
- Game - DamageModifierEvent becomes Equal to 1.00
-
Conditions
- (Level of Time Lock for DamageEventSource) Greater than 0
-
Actions
- Trigger - Turn on TimeLock Loop <gen>
- Custom script: set udg_TimeLock_LockedUnits = CreateGroup()
- Trigger - Turn off (This trigger)
-
Events
-
TimeLock Loop
-
Events
- Time - Every 0.05 seconds of game time
- Conditions
-
Actions
- Set VariableSet TimeLock_GroupAddFreeze = (Units in (Playable map area) matching (((Matching unit) has buff Time Lock (Pause)) Equal to True))
-
Unit Group - Pick every unit in TimeLock_GroupAddFreeze and do (Actions)
-
Loop - Actions
- Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Undead\AbsorbMana\AbsorbManaBirthMissile.mdl
- Special Effect - Destroy (Last created special effect)
- Animation - Change (Picked unit)'s animation speed to 0.00% of its original speed
- Unit Group - Add (Picked unit) to TimeLock_LockedUnits
-
Loop - Actions
- Custom script: call DestroyGroup(udg_TimeLock_GroupAddFreeze)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (TimeLock_LockedUnits is empty) Equal to True
-
Then - Actions
- Custom script: call DestroyGroup(udg_TimeLock_LockedUnits)
- Trigger - Turn on TimeLock Start again <gen>
- Trigger - Turn off (This trigger)
-
Else - Actions
-
Unit Group - Pick every unit in TimeLock_LockedUnits and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Picked unit) has buff Time Lock (Pause)) Equal to False
-
Then - Actions
- Animation - Change (Picked unit)'s animation speed to 100.00% of its original speed
- Unit Group - Remove (Picked unit) from TimeLock_LockedUnits.
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (TimeLock_LockedUnits is empty) Equal to True
-
Then - Actions
- Custom script: call DestroyGroup(udg_TimeLock_LockedUnits)
- Trigger - Turn on TimeLock Start again <gen>
- Trigger - Turn off (This trigger)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
Unit Group - Pick every unit in TimeLock_LockedUnits and do (Actions)
-
If - Conditions
-
Events
Is there a solution for this?
Last edited: