• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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,408
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