• 🏆 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] Fixing Leaks

Status
Not open for further replies.
Level 3
Joined
Dec 20, 2017
Messages
13
Hi, I recently started working on a map (about 2-3 days ago) and I just can't seem to get my head around leaks. Could someone please tell me where this leaks and how to fix it? This is what I've come up with on my own.

1. Special effect creation might leak. Not sure if "Position of Shockwave Caster" Leaks. I do use a variable, but I'm not sure if it leaks anyway. Does using polar offset leak twice? I think I read that somewhere.

2. I'm about 100% sure the "Unit Group - Pick every unit in (Units within 325...)" leaks at least once. But I'm not sure how to fix it. Does it leak the position as well?

3. Are there any more leaks than these?

hQegjUs.png

Thanks for the help in advance, appreciated! :)

PS: This is my first post. How do people upload the load the code directly without using a screenshot?
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
Could someone please tell me where this leaks and how to fix it?
Either one of these tutorials should answer your questions:
Special effect creation might leak.
You are destroying the effect, so no it does not.

Not sure if "Position of Shockwave Caster" Leaks. I do use a variable, but I'm not sure if it leaks anyway.
It does leak, and you aren't using a variable.

Does using polar offset leak twice? I think I read that somewhere.
Polar offset creates two locations, but saying it leaks twice is a bit misleading. Leaks only occur if you overwrite the variables that leak such as locations, and unit groups, with other information.

I'm about 100% sure the "Unit Group - Pick every unit in (Units within 325...)" leaks at least once. But I'm not sure how to fix it. Does it leak the position as well?
Yes it does. You are also leaking two locations inside it.

Are there any more leaks than these?
  • When you create the special effect, you leak two locations.
  • The unit group leaks
  • When you create the unit group, you leak two locations.

This is my first post. How do people upload the load the code directly without using a screenshot?
How To Post Your Trigger
 
Level 3
Joined
Dec 20, 2017
Messages
13
Wow, thanks for all the very detailed help. I've hopefully succeeded in giving you the reputation you deserve. As a side note, i've already read those links (and a few others) but reading them again really helped, I think i've got the leaks now. :)

  • New shockwave
    • Events
      • Time - Every (800.00 / 10500.00) seconds of game time
    • Conditions
    • Actions
      • If (Loopie Equal to 0) then do (Set TEMP_POINT = (Position of Shockwave_Caster)) else do (Do nothing)
      • Set Loopie = (Loopie + 1)
      • Set TEMP_POINT2 = (TEMP_POINT offset by (80.00 x (Real(Loopie))) towards (Angle from TEMP_POINT to Shockwave_Target) degrees)
      • Special Effect - Create a special effect at TEMP_POINT2 using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set TEMP_GROUP = (Units within 325.00 of TEMP_POINT2)
      • Unit Group - Pick every unit in TEMP_GROUP and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • True Equal to ((Owner of (Picked unit)) is an enemy of Player 1 (Red))
              • ((Picked unit) is in ShockwaveDMG) Not equal to True
              • (Picked unit) Not equal to Shockwave_Caster
            • Then - Actions
              • Unit Group - Add (Picked unit) to ShockwaveDMG
              • Unit - Cause Shockwave_Caster to damage (Picked unit), dealing (3.00 x (Real((Strength of Shockwave_Caster (Include bonuses))))) damage of attack type Hero and damage type Enhanced
            • Else - Actions
              • Do nothing
      • Custom script: call DestroyGroup(udg_TEMP_GROUP)
      • Custom script: call RemoveLocation(udg_TEMP_POINT2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Loopie Equal to 10
        • Then - Actions
          • Set Loopie = 0
          • Trigger - Turn off (This trigger)
          • Custom script: call RemoveLocation(udg_TEMP_POINT)
          • Custom script: call RemoveLocation(udg_Shockwave_Target)
          • Unit Group - Pick every unit in ShockwaveDMG and do (Unit Group - Remove (Picked unit) from ShockwaveDMG)
        • Else - Actions
          • Do nothing
So... Sorry for having you guys double checking my code. But is this leak-free and/or does it contain an excessive amount of variables?


Another question of leaks
So when you write the following code:

  • Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
Now the "Facing default building facing degrees" probably doesn't leak because it's a number (so not a handle), the number of footmen is also a number. I guess "Player 1 (Red)" is also stored as a number, no? But why doesn't the "unit-type" part leak (The one that has the value "Footman")? Is it because we can always refer to it?
 
Last edited:
Level 3
Joined
Dec 20, 2017
Messages
13
Thanks for the *blunt* (to say the least :wink:) criticism.

The trigger is supposed to damage units in a line following the path of Cairne's shockwave (and as you guessed there is another trigger turning this one on when Cairne casts shockwave). Since I don't know how to damage in a line and want to do it about the same time the shockwave hits them I made it damage in lots of small circles to approximate the line. It also adds the visual effect and automatically turns of after 10 times. (I wanted to use "wait" first but the minimum wait is too big).

Thanks for all the help yet again. Sadly I can't rep you in another 17 hours^^
 
Status
Not open for further replies.
Top