• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Leaks?

Status
Not open for further replies.
Level 5
Joined
Mar 13, 2008
Messages
126
Have I removed all leaks well or should I change something??
  • Healing Wave
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Healing Wave
    • Actions
      • Wait 0.10 game-time seconds
      • Set CasterPoint = (Position of (Triggering unit))
      • Set Wave_Points[(Player number of (Owner of (Triggering unit)))] = CasterPoint
      • Set Wave_Angls[(Player number of (Owner of (Triggering unit)))] = (Facing of (Triggering unit))
      • For each (Integer A) from 1 to 7, do (Actions)
        • Loop - Actions
          • Special Effect - Destroy Effect1[(Player number of (Owner of (Triggering unit)))]
          • Special Effect - Destroy Effect2[(Player number of (Owner of (Triggering unit)))]
          • Special Effect - Destroy Effect3[(Player number of (Owner of (Triggering unit)))]
          • Set Wave_Points[(Player number of (Owner of (Triggering unit)))] = (Wave_Points[(Player number of (Owner of (Triggering unit)))] offset by 150.00 towards Wave_Angls[(Player number of (Owner of (Triggering unit)))] degrees)
          • Special Effect - Create a special effect at Wave_Points[(Player number of (Owner of (Triggering unit)))] using Abilities\Spells\Other\Charm\CharmTarget.mdl
          • Set Effect1[(Player number of (Owner of (Triggering unit)))] = (Last created special effect)
          • Special Effect - Create a special effect at (Wave_Points[(Player number of (Owner of (Triggering unit)))] offset by 100.00 towards (Wave_Angls[(Player number of (Owner of (Triggering unit)))] + 90.00) degrees) using Abilities\Spells\Other\Charm\CharmTarget.mdl
          • Set Effect2[(Player number of (Owner of (Triggering unit)))] = (Last created special effect)
          • Special Effect - Create a special effect at (Wave_Points[(Player number of (Owner of (Triggering unit)))] offset by 100.00 towards (Wave_Angls[(Player number of (Owner of (Triggering unit)))] + 270.00) degrees) using Abilities\Spells\Other\Charm\CharmTarget.mdl
          • Set Effect3[(Player number of (Owner of (Triggering unit)))] = (Last created special effect)
          • Set HealingUnits = (Units within 200.00 of Wave_Points[(Player number of (Owner of (Triggering unit)))] matching (((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to True))
          • Unit Group - Pick every unit in HealingUnits and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) has buff Healed ) Equal to True
                • Then - Actions
                  • Do nothing
                • Else - Actions
                  • If (((Picked unit) is dead) Equal to True) then do (Skip remaining actions) else do (Do nothing)
                  • If (((Picked unit) is Mechanical) Equal to True) then do (Skip remaining actions) else do (Do nothing)
                  • If ((Unit-type of (Picked unit)) Equal to Paladin) then do (Skip remaining actions) else do (Do nothing)
                  • Unit - Create 1 Wave Caster for (Owner of (Triggering unit)) at Wave_Points[(Player number of (Owner of (Triggering unit)))] facing Default building facing degrees
                  • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                  • If ((Level of Healing Wave for (Triggering unit)) Greater than or equal to 1) then do (Unit - Add Dummy Buff Adder to (Last created unit)) else do (Do nothing)
                  • Unit - Order (Last created unit) to Orc Shaman - Bloodlust (Picked unit)
                  • Unit - Create 1 Wave Caster for (Owner of (Triggering unit)) at Wave_Points[(Player number of (Owner of (Triggering unit)))] facing Default building facing degrees
                  • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                  • If ((Level of Healing Wave for (Triggering unit)) Equal to 1) then do (Unit - Add Wave Heal (Level 1) to (Last created unit)) else do (Do nothing)
                  • If ((Level of Healing Wave for (Triggering unit)) Equal to 2) then do (Unit - Add Wave Heal (Level 2) to (Last created unit)) else do (Do nothing)
                  • If ((Level of Healing Wave for (Triggering unit)) Equal to 3) then do (Unit - Add Wave Heal (Level 3) to (Last created unit)) else do (Do nothing)
                  • Unit - Order (Last created unit) to Human Paladin - Holy Light (Picked unit)
      • Wait 0.10 seconds
      • Custom script: call RemoveLocation(udg_Wave_Points[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
      • Custom script: call DestroyGroup(udg_HealingUnits)
      • Custom script: call RemoveLocation(udg_CasterPoint)
      • Special Effect - Destroy Effect1[(Player number of (Owner of (Triggering unit)))]
      • Special Effect - Destroy Effect2[(Player number of (Owner of (Triggering unit)))]
      • Special Effect - Destroy Effect3[(Player number of (Owner of (Triggering unit)))]
 
Level 5
Joined
Mar 13, 2008
Messages
126
then don't visit GUI topic -.-
i don't care about waits and those i can fix it later, my main concern are leaks.
Wave_Points are removed for the owners of triggering player but what about HealingUnits and CasterPoint???
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
When you use polar offsets (some_point offset by some_value towards some_angle) both of the points must be initialized to not leak.
  • Set PointVar1 = some location
  • Set PointVar2 = PointVar1 offset by some_value towards some_angle
  • do something
I do not see what's the point of CasterPoint, you can just set it into Wave_Points from the start.

You do not need those waits (waits are evil, try to avoid them when not necessary) as they wait a value you can hardly even see with your eyes.

You do not need the Do Nothing, never use them.

Why are you using inside-if's when you can just put them in the main if statement ?

Why are you destroying effects which are already destroyed ? (remove either of those)

You don't need arrays for this as it is instant (if you remove the waits which you should).
 
Status
Not open for further replies.
Top