• 🏆 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!

[Solved] Did I fix this location leak properly?

Status
Not open for further replies.
Level 8
Joined
Mar 2, 2014
Messages
132
  • Kalegos Dragonspawn
    • Events
      • Unit - Kalecgos Aspect of Magic (LB) 0413 <gen> Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Summon Dragonspawn (Kalecgos)
    • Actions
      • Set VariableSet DS = (Center of Dragonflight spawn <gen>)
      • Unit - Create 1 Blue Dragonspawn Overseer for Player 10 (Light Blue) at DS facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_DS)
      • Set VariableSet DS = (Center of Dragonflight spawn <gen>)
      • Unit - Create 2 Blue Dragonspawn Sorcerer for Player 10 (Light Blue) at DS facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_DS)
      • Set VariableSet DS = (Center of Dragonflight spawn <gen>)
      • Unit - Create 3 Blue Dragonspawn Warrior for Player 10 (Light Blue) at DS facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_DS)
      • Set VariableSet DS = (Center of Dragonflight spawn <gen>)
      • Unit - Create 3 Blue Dragonspawn Apprentice for Player 10 (Light Blue) at DS facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_DS)
      • Set VariableSet DS = (Center of Dragonflight spawn <gen>)
      • Unit - Create 3 Blue Dragonspawn Meddler for Player 10 (Light Blue) at DS facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_DS)
So now it does not leak at all right?
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
yes, that does not leak, but it is kind of pointless.
The point variable is simply a set of [x,y,z] coordinates. With that in mind, it is kind of redundant to set the DS variable multiple times and clean it up if each time the DS variable points to same coordinates.

You can simplify it as this:
  • Kalegos Dragonspawn
    • Events
      • Unit - Kalecgos Aspect of Magic (LB) 0413 <gen> Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Summon Dragonspawn (Kalecgos)
    • Actions
      • Set VariableSet DS = (Center of Dragonflight spawn <gen>)
      • Unit - Create 1 Blue Dragonspawn Overseer for Player 10 (Light Blue) at DS facing Default building facing degrees
      • Unit - Create 2 Blue Dragonspawn Sorcerer for Player 10 (Light Blue) at DS facing Default building facing degrees
      • Unit - Create 3 Blue Dragonspawn Warrior for Player 10 (Light Blue) at DS facing Default building facing degrees
      • Unit - Create 3 Blue Dragonspawn Apprentice for Player 10 (Light Blue) at DS facing Default building facing degrees
      • Unit - Create 3 Blue Dragonspawn Meddler for Player 10 (Light Blue) at DS facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_DS)
 
Status
Not open for further replies.
Top