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

Destroying point leak in a Loop?

Status
Not open for further replies.
Level 5
Joined
Jan 23, 2014
Messages
152
Hi just wondering what's the correct way of destroying a point in a loop (in this case the udg_Chidori_Path[0])

Destroying it in every loop like this(the custom code is at the very last line):

  • Chidori Move
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set Chidori_Move = (Chidori_Move + 46.00)
      • Set Chidori_Path[0] = (Chidori_TLoc[0] offset by Chidori_Move towards (Angle from Chidori_TLoc[0] to Chidori_TLoc[1]) degrees)
      • -------- -------------------- --------
      • Unit - Move Chidori_Caster instantly to Chidori_Path[0], facing (Angle from Chidori_TLoc[0] to Chidori_TLoc[1]) degrees
      • Animation - Play Chidori_Caster's walk animation
      • Set Chidori_PathDistance = (Distance between Chidori_Path[0] and Chidori_TLoc[1])
      • -------- -------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Chidori_PathDistance Less than or equal to 30.00
        • Then - Actions
          • Animation - Play Chidori_Caster's attack 2 animation
          • Special Effect - Destroy Chidori_SFX
          • Special Effect - Create a special effect attached to the origin of Chidori_Target using SuperShinyThingy3.mdx
          • Special Effect - Destroy (Last created special effect)
          • Special Effect - Create a special effect attached to the origin of Chidori_Target using Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl
          • Special Effect - Destroy (Last created special effect)
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 400.00 of Chidori_Path[0] matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of Chidori_Caster)) Equal to True) and (((Matching unit) is alive) Equal to True)))) and do (Actions)
            • Loop - Actions
              • Unit - Cause Chidori_Caster to damage (Picked unit), dealing (600.00 + ((2.00 x (Real((Level of Chidori for Chidori_Caster)))) x (Real((Agility of Chidori_Caster (Exclude bonuses)))))) damage of attack type Spells and damage type Lightning
          • -------- -------------------- --------
          • Animation - Change Chidori_Caster's animation speed to 100.00% of its original speed
          • Unit - Unpause Chidori_Caster
          • Unit - Unpause Chidori_Target
          • Set Chidori_Move = 0.00
          • Unit - Turn collision for Chidori_Caster On
          • Custom script: call RemoveLocation (udg_Chidori_TLoc[0])
          • Custom script: call RemoveLocation (udg_Chidori_TLoc[1])
          • Trigger - Turn off (This trigger)
        • Else - Actions
      • Custom script: call RemoveLocation (udg_Chidori_Path[0])
Or destroying it once by placing it in the IF statement:

  • Chidori Move
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set Chidori_Move = (Chidori_Move + 46.00)
      • Set Chidori_Path[0] = (Chidori_TLoc[0] offset by Chidori_Move towards (Angle from Chidori_TLoc[0] to Chidori_TLoc[1]) degrees)
      • -------- -------------------- --------
      • Unit - Move Chidori_Caster instantly to Chidori_Path[0], facing (Angle from Chidori_TLoc[0] to Chidori_TLoc[1]) degrees
      • Animation - Play Chidori_Caster's walk animation
      • Set Chidori_PathDistance = (Distance between Chidori_Path[0] and Chidori_TLoc[1])
      • -------- -------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Chidori_PathDistance Less than or equal to 30.00
        • Then - Actions
          • Animation - Play Chidori_Caster's attack 2 animation
          • Special Effect - Destroy Chidori_SFX
          • Special Effect - Create a special effect attached to the origin of Chidori_Target using SuperShinyThingy3.mdx
          • Special Effect - Destroy (Last created special effect)
          • Special Effect - Create a special effect attached to the origin of Chidori_Target using Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl
          • Special Effect - Destroy (Last created special effect)
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 400.00 of Chidori_Path[0] matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of Chidori_Caster)) Equal to True) and (((Matching unit) is alive) Equal to True)))) and do (Actions)
            • Loop - Actions
              • Unit - Cause Chidori_Caster to damage (Picked unit), dealing (600.00 + ((2.00 x (Real((Level of Chidori for Chidori_Caster)))) x (Real((Agility of Chidori_Caster (Exclude bonuses)))))) damage of attack type Spells and damage type Lightning
          • -------- -------------------- --------
          • Animation - Change Chidori_Caster's animation speed to 100.00% of its original speed
          • Unit - Unpause Chidori_Caster
          • Unit - Unpause Chidori_Target
          • Set Chidori_Move = 0.00
          • Unit - Turn collision for Chidori_Caster On
          • Custom script: call RemoveLocation (udg_Chidori_TLoc[0])
          • Custom script: call RemoveLocation (udg_Chidori_TLoc[1])
          • Custom script: call RemoveLocation (udg_Chidori_Path[0])
          • Trigger - Turn off (This trigger)
        • Else - Actions
 
Level 5
Joined
Jan 23, 2014
Messages
152
Wont there be a leak because I use a lot of points every 0.03 seconds with the same variable name?
 
Level 5
Joined
Jan 23, 2014
Messages
152
Hahaha I just wanted to make sure which method was right. I cant give you rep. It says I must spread some to others. I dunno, I didnt give any to you this past week.
 
Status
Not open for further replies.
Top