• 🏆 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] New to locals, does this leak?

Status
Not open for further replies.
Level 24
Joined
Feb 9, 2009
Messages
1,787
I only have a casual sense of Locals and was curious if this [GUI] trigger in anyway leaks.
First and foremost need to know if this trigger i've done leaks but secondary to that if there is a more efficient way of doing this or transforming this into JASS I'd love to hear it.
Trigger in question:

  • FRee Cast Individual Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Custom script: local effect udg_sfx
      • Custom script: local integer udg_Counter
      • Set VariableSet FRee_A_Unit[0] = (Triggering unit)
      • For each (Integer Counter) from 1 to 3, do (Actions)
        • Loop - Actions
          • Set VariableSet FRee_A_Point[0] = (Position of FRee_A_Unit[0])
          • Set VariableSet FRee_A_Point[1] = (FRee_A_Point[0] offset by 90.00 towards (Facing of FRee_A_Unit[0]) degrees.)
          • Special Effect - Create a special effect at FRee_A_Point[0] using war3mapImported\Reapers Claws Red.mdx
          • Custom script: set udg_sfx = GetLastCreatedEffectBJ()
          • Special Effect - Set Orientation of sfx to yaw: (Radians((Facing of FRee_A_Unit[0]))), pitch: 0.00, roll: (Radians((350.00 - (45.00 x (Real(Counter))))))
          • Special Effect - Set Height of sfx to: (90.00 + (Position - Z of FRee_A_Unit[0]))
          • Special Effect - Destroy sfx
          • Custom script: set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units within 225.00 of FRee_A_Point[1].) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Picked unit) Not equal to FRee_A_Unit[0]
                  • ((Picked unit) is alive) Equal to True
                • Then - Actions
                  • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Cause FRee_A_Unit[0] to damage (Picked unit), dealing (7.00 + ((((Max life of (Picked unit)) - (Life of (Picked unit))) x 0.12) + ((Real((Strength of FRee_A_Unit[0] (Include bonuses)))) x 0.33))) damage of attack type Spells and damage type Normal
                  • Unit - Set life of FRee_A_Unit[0] to ((Life of FRee_A_Unit[0]) + ((7.00 + ((((Max life of FRee_A_Unit[0]) - (Life of (Picked unit))) x 0.12) + ((Real((Strength of FRee_A_Unit[0] (Include bonuses)))) x 0.33))) x 0.10))
                • Else - Actions
          • Custom script: call RemoveLocation(udg_FRee_A_Point[1])
          • Custom script: call RemoveLocation(udg_FRee_A_Point[0])
          • Custom script: set udg_sfx = null
          • Wait 0.15 seconds
      • Custom script: set udg_Counter = 0

Thank you for taking the time to read this.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
You're leaking Free_A_Point[0] twice and Free_A_Point[1] three times.

Also, I assume you want to Destroy sfx AFTER the Wait which you aren't doing.

Is this trigger meant to be MUI?


Also, I attached two maps that I created which contain systems for destroying Special Effects in GUI.

Delayed Destroy Effect is the simple and easy to use version while Controlled Effects requires a bit more user configuration but has more options.
 

Attachments

  • Delayed Destroy Effect.w3m
    16.5 KB · Views: 26
  • Controlled Effects v.1.w3m
    18.5 KB · Views: 27
Last edited:
Level 24
Joined
Feb 9, 2009
Messages
1,787
@Uncle
>You're leaking Free_A_Point[0] twice and Free_A_Point[1] three times.
Ah now that I look it over I left Removelocation[0] out of the loop, edited it to be in the same place as [1]
How would I go about removing the other leaks?

>Also, I assume you want to Destroy sfx AFTER the Wait which you aren't doing.
Negative, it's just to delay the effect slightly

>Is this trigger meant to be MUI?
That's what I'm trying to find out, and from the leaks you're describing clearly i'm missing something.
How can I make it leakless and MUI while maintaining one trigger?

>Also, I attached two maps that I created which contain systems for destroying Special Effects in GUI.
>Delayed Destroy Effect is the simple and easy to use version while Controlled Effects requires a bit more user configuration but has more options.

I will definitely check these out.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
Oh my mistake, I see now you want it to run 3 times over the course of 0.45 seconds.

If you want it to be precise you should avoid this setup entirely. But that's your call, Waits can work but they'll give you mixed results when playing online, albeit small. For precision you could use a Timer and some indexing techniques to run the effects of the ability once every 0.15 seconds for 0.45 seconds.

For MUI purposes, get rid of FRee_A_Unit[0] as this can change during the Wait, say if another unit were to cast the same ability during that time.

Luckily, Triggering Unit acts as a local variable, so you can use it without any issues. It's the only Event Response that works like this.
 
Level 24
Joined
Feb 9, 2009
Messages
1,787
Ah marvelous, and in the case of the variable I can just change it to a local?
Thank you Uncle.

Here's the resulting effect by the way, using mythic's newest upload:
12315115.gif
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
You need to get rid of the variable entirely and use Triggering Unit instead. You can't use shadowed global variables in Conditions so it wouldn't work in your Pick every unit function anywyay.

And nice, that looks sweet :D

I think it'd look even better if you increased the Dread Lord's animation speed a bit during the animation.
 
Status
Not open for further replies.
Top