• 🏆 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] Trigger leak help

Status
Not open for further replies.
Level 4
Joined
Feb 24, 2018
Messages
71
  • Slitheren
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Slithereen Crush
    • Actions
      • Set Caster = (Triggering unit)
      • Special Effect - Create a special effect at ((Position of Caster) offset by (200.00, 0.00)) using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Create a special effect at ((Position of Caster) offset by (-200.00, 0.00)) using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Create a special effect at ((Position of Caster) offset by (0.00, -200.00)) using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Create a special effect at ((Position of Caster) offset by (0.00, 200.00)) using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Create a special effect at ((Position of Caster) offset by (100.00, 100.00)) using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Create a special effect at ((Position of Caster) offset by (-100.00, -100.00)) using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Create a special effect at ((Position of Caster) offset by (100.00, -100.00)) using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Create a special effect at ((Position of Caster) offset by (-100.00, 100.00)) using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Sound - Play CrushingWaveTarget1 <gen>
I'm making my first W3 map and I was wondering if a trigger like this will leak.If so , how will I fix it ? Thanks
 
Level 6
Joined
Jun 4, 2017
Messages
172
  • Slitheren
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Slithereen Crush
    • Actions
      • Set Caster = (Triggering unit)
      • Special Effect - Create a special effect at ((Position of Caster) offset by (200.00, 0.00)) using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Create a special effect at ((Position of Caster) offset by (-200.00, 0.00)) using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Create a special effect at ((Position of Caster) offset by (0.00, -200.00)) using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Create a special effect at ((Position of Caster) offset by (0.00, 200.00)) using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Create a special effect at ((Position of Caster) offset by (100.00, 100.00)) using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Create a special effect at ((Position of Caster) offset by (-100.00, -100.00)) using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Create a special effect at ((Position of Caster) offset by (100.00, -100.00)) using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Create a special effect at ((Position of Caster) offset by (-100.00, 100.00)) using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Sound - Play CrushingWaveTarget1 <gen>
I'm making my first W3 map and I was wondering if a trigger like this will leak.If so , how will I fix it ? Thanks
Yes, this trigger will leak because every point you created is a memory leak, for fixing it you just have to create a point variable, if you wait 5 minutes i will recreate the trigger for make you an example.
 
  • Slitheren
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Slithereen Crush
    • Actions
      • Set Caster = (Triggering unit)
      • Special Effect - Create a special effect at ((Position of Caster) offset by (200.00, 0.00)) using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Create a special effect at ((Position of Caster) offset by (-200.00, 0.00)) using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Create a special effect at ((Position of Caster) offset by (0.00, -200.00)) using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Create a special effect at ((Position of Caster) offset by (0.00, 200.00)) using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Create a special effect at ((Position of Caster) offset by (100.00, 100.00)) using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Create a special effect at ((Position of Caster) offset by (-100.00, -100.00)) using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Create a special effect at ((Position of Caster) offset by (100.00, -100.00)) using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Create a special effect at ((Position of Caster) offset by (-100.00, 100.00)) using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Sound - Play CrushingWaveTarget1 <gen>
I'm making my first W3 map and I was wondering if a trigger like this will leak.If so , how will I fix it ? Thanks
In addition to RG00's points, special effects are also leaking. You must store them into variables and destroy them.
 
Level 6
Joined
Jun 4, 2017
Messages
172
  • Trigger
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Your ability
    • Actions
      • Set Caster = (Triggering unit)
      • Set SpecialEffectPosition = ((Position of Caster) offset by (200.00, 0.00))
      • Special Effect - Create a special effect at SpecialEffectPosition using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set SpecialEffectPosition = ((Position of Caster) offset by (-200.00, 0.00))
      • Special Effect - Create a special effect at SpecialEffectPosition using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set SpecialEffectPosition = ((Position of Caster) offset by (0.00, -200.00))
      • Special Effect - Create a special effect at SpecialEffectPosition using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set SpecialEffectPosition = ((Position of Caster) offset by (0.00, 200.00))
      • Special Effect - Create a special effect at SpecialEffectPosition using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set SpecialEffectPosition = ((Position of Caster) offset by (100.00, 100.00))
      • Special Effect - Create a special effect at SpecialEffectPosition using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set SpecialEffectPosition = ((Position of Caster) offset by (-100.00, -100.00))
      • Special Effect - Create a special effect at SpecialEffectPosition using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set SpecialEffectPosition = ((Position of Caster) offset by (100.00, -100.00))
      • Special Effect - Create a special effect at SpecialEffectPosition using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set SpecialEffectPosition = ((Position of Caster) offset by (-100.00, 100.00))
      • Special Effect - Create a special effect at SpecialEffectPosition using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_SpecialEffectPosition)
You will also need for complete removing every memory leak the custom script at the end, that will remove the point stored in that variable. Tell me if there is something that you didn't understand :).

In addition to RG00's points, special effects are also leaking. You must store them into variables and destroy them.
Right, sorry I forgot to say that too XD
 
  • Trigger
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Your ability
    • Actions
      • Set Caster = (Triggering unit)
      • Set SpecialEffectPosition = ((Position of Caster) offset by (200.00, 0.00))
      • Special Effect - Create a special effect at SpecialEffectPosition using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set SpecialEffectPosition = ((Position of Caster) offset by (-200.00, 0.00))
      • Special Effect - Create a special effect at SpecialEffectPosition using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set SpecialEffectPosition = ((Position of Caster) offset by (0.00, -200.00))
      • Special Effect - Create a special effect at SpecialEffectPosition using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set SpecialEffectPosition = ((Position of Caster) offset by (0.00, 200.00))
      • Special Effect - Create a special effect at SpecialEffectPosition using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set SpecialEffectPosition = ((Position of Caster) offset by (100.00, 100.00))
      • Special Effect - Create a special effect at SpecialEffectPosition using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set SpecialEffectPosition = ((Position of Caster) offset by (-100.00, -100.00))
      • Special Effect - Create a special effect at SpecialEffectPosition using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set SpecialEffectPosition = ((Position of Caster) offset by (100.00, -100.00))
      • Special Effect - Create a special effect at SpecialEffectPosition using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set SpecialEffectPosition = ((Position of Caster) offset by (-100.00, 100.00))
      • Special Effect - Create a special effect at SpecialEffectPosition using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_SpecialEffectPosition)
You will also need for complete removing every memory leak the custom script at the end, that will remove the point stored in that variable. Tell me if there is something that you didn't understand :).


Right, sorry I forgot to say that too XD
Well, this way the effects won't be created if you destroy them instantly. I think he should destroy them after the spell finishes, or he could use a loop trigger/action and destroy them instantly.

And you store every effect into variables without removing it's location, therefore I think you should put custom script after every effect.
 
Level 6
Joined
Jun 4, 2017
Messages
172
Well, this way the effects won't be created if you destroy them instantly. I think he should destroy them after the spell finishes, or he could use a loop trigger/action and destroy them instantly.

And you store every effect into variables without removing it's location, therefore I think you should put custom script after every effect.
The effects will be created, they will be created and they will immediately play the death animation, I tested that and it worked.
About removing the location after the effect, I'm not sure, I think the variable overwrite the previous value that it had, I think.
 
Level 13
Joined
May 10, 2009
Messages
868
In your case, you wouldn't notice anything different, because "Crushing Wave Damage" model has only one animation, which is its death. However, if you are using a model that has Birth, Stand, and Death animations, destroying it would force its death animation to be played. Sometimes you'll find yourself wanting a special effect to last for a couple of seconds prior to destroying it (for projectiles, buffs, etc).
 
Level 15
Joined
Jul 9, 2008
Messages
1,552
  • Trigger
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Your ability
    • Actions
      • Set Caster = (Triggering unit)
      • Set SpecialEffectPosition = ((Position of Caster) offset by (200.00, 0.00))
      • Special Effect - Create a special effect at SpecialEffectPosition using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set SpecialEffectPosition = ((Position of Caster) offset by (-200.00, 0.00))
      • Special Effect - Create a special effect at SpecialEffectPosition using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set SpecialEffectPosition = ((Position of Caster) offset by (0.00, -200.00))
      • Special Effect - Create a special effect at SpecialEffectPosition using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set SpecialEffectPosition = ((Position of Caster) offset by (0.00, 200.00))
      • Special Effect - Create a special effect at SpecialEffectPosition using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set SpecialEffectPosition = ((Position of Caster) offset by (100.00, 100.00))
      • Special Effect - Create a special effect at SpecialEffectPosition using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set SpecialEffectPosition = ((Position of Caster) offset by (-100.00, -100.00))
      • Special Effect - Create a special effect at SpecialEffectPosition using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set SpecialEffectPosition = ((Position of Caster) offset by (100.00, -100.00))
      • Special Effect - Create a special effect at SpecialEffectPosition using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set SpecialEffectPosition = ((Position of Caster) offset by (-100.00, 100.00))
      • Special Effect - Create a special effect at SpecialEffectPosition using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_SpecialEffectPosition)
You will also need for complete removing every memory leak the custom script at the end, that will remove the point stored in that variable. Tell me if there is something that you didn't understand :).


Right, sorry I forgot to say that too XD

This still leaks muiliple locations
When using off sets u want a point variable that u can destroy and off set from that. Also u want to destroy the variable before using it agian overrighting it will also cause leaks
 
Here is a leakless version of the trigger:

  • Actions
    • -------- Set temp_point2 to the position of the casting unit --------
    • Set temp_point2 = (Position of (Triggering unit))
    • -------- ----------------------------- --------
    • -------- Set temp_point as offset of temp_point2 and clear leaks --------
    • Set temp_point = (temp_point2 offset by (200.00, 0.00))
    • Special Effect - Create a special effect at temp_point using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
    • Special Effect - Destroy (Last created special effect)
    • Custom script: call RemoveLocation(udg_temp_point)
    • -------- ----------------------------- --------
    • Set temp_point = (temp_point2 offset by (-200.00, 0.00))
    • Special Effect - Create a special effect at temp_point using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
    • Special Effect - Destroy (Last created special effect)
    • Custom script: call RemoveLocation(udg_temp_point)
    • -------- ----------------------------- --------
    • Set temp_point = (temp_point2 offset by (0.00, -200.00))
    • Special Effect - Create a special effect at temp_point using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
    • Special Effect - Destroy (Last created special effect)
    • Custom script: call RemoveLocation(udg_temp_point)
    • -------- ----------------------------- --------
    • Set temp_point = (temp_point2 offset by (0.00, 200.00))
    • Special Effect - Create a special effect at temp_point using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
    • Special Effect - Destroy (Last created special effect)
    • Custom script: call RemoveLocation(udg_temp_point)
    • -------- ----------------------------- --------
    • Set temp_point = (temp_point2 offset by (100.00, 100.00))
    • Special Effect - Create a special effect at temp_point using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
    • Special Effect - Destroy (Last created special effect)
    • Custom script: call RemoveLocation(udg_temp_point)
    • -------- ----------------------------- --------
    • Set temp_point = (temp_point2 offset by (-100.00, -100.00))
    • Special Effect - Create a special effect at temp_point using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
    • Special Effect - Destroy (Last created special effect)
    • Custom script: call RemoveLocation(udg_temp_point)
    • -------- ----------------------------- --------
    • Set temp_point = (temp_point2 offset by (100.00, -100.00))
    • Special Effect - Create a special effect at temp_point using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
    • Special Effect - Destroy (Last created special effect)
    • Custom script: call RemoveLocation(udg_temp_point)
    • -------- ----------------------------- --------
    • Set temp_point = (temp_point2 offset by (-100.00, 100.00))
    • Special Effect - Create a special effect at temp_point using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
    • Special Effect - Destroy (Last created special effect)
    • Custom script: call RemoveLocation(udg_temp_point)
    • -------- ----------------------------- --------
    • -------- Finally, we destroy temp_point2 to avoid a leak --------
    • Custom script: call RemoveLocation(udg_temp_point2)
 
Last edited:
Which does not work... You mixed up temp_point2 and temp_point.
Gaaah, I've fixed it now. Didn't want to save the untitled map and mess up my recent files list T_T

If only we could declare local variables in GUI so I wouldn't be accustomed to using bad naming conventions just to avoid having 1000 global variables :wscrolleyes:
 
That depends. If you use them on all your spells, you might encounter a situation in which some code is ocurring in the middle of another block of code that uses the variables. If you want an 100% safe way to use these variables for all your spells, you might want to look into shadowed globals Things You Should Know When Using Triggers / GUI (section 2, chapter 1, subchapter 1)

If you think there is no risk of data collision (different code blocks that use these variables will never execute while another one is executed), then feel free to always use these variables. Remember that doing things that can trigger events (such as killing a unit) may cause these collisions.
 
Level 6
Joined
Jun 4, 2017
Messages
172
When using off sets u want a point variable that u can destroy and off set from that.
I didn't think about that, sorry.
Also u want to destroy the variable before using it agian overrighting it will also cause leaks
Thank you, I always thought that variables could overwrite their previous value, well, that was a mistake. I think I'll have to go fix some triggers in my maps now that I know that.
Thanks ! I want also to play a sound at the end of the trigger but for some reason 3D sounds aren't working.Do you know why ?
Check if you set the sound as a 3D sound in the audio editor, this could be the issue.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Thanks ! I want also to play a sound at the end of the trigger but for some reason 3D sounds aren't working.Do you know why ?
There are a variety of reasons this can happen. First the sound must be made to be a 3D sound. Then one has to adjust the volume and cutoffs so it makes sense. Even still it might not be audible if the cut-offs are set such that it is near impossible to be in range of. Also if too many other 3D sounds occur it might be drowned out/skipped due to performance limitations.
 
Level 12
Joined
Mar 24, 2011
Messages
1,082
Just a quick question/suggestion, why not use offset by distance & angle instead of X & Y?

You could put it into a loop making it about 8 times shorter and easier to read and maintain?
If you want a square instead of circle (as it is done now) just use 2 loops instead of 1, one for the sides and one for the points.

Ned out.
 
Status
Not open for further replies.
Top