• 🏆 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] Problem with leaks

Status
Not open for further replies.
Level 3
Joined
Oct 28, 2016
Messages
22
Hello, I created a passive ability which creates a bomb after passing of X distance. The problem is leaking. Altough I removed as much leaks as possible, the hero with that ability causes hard lags problems since 20+ min.

Here is the part of trigger which makes the system "after passing X distance":

Events - every 0.03s
Actions:
Set NM_X = (X of NM_point[1])
Set NM_Y = (Y of NM_point[1])
Custom Script: Call RemoveLocation (udg_NM_point[1])
Set NM_point[2] = Point(NM_X, NM_Y)
Set NM_point[1] = (Position of MyHero)
Set NM_dist = (NM_dist + Distance between NM_point[1], NM_point[2])
Custom Script: Call RemoveLocation (udg_NM_point[1])

Whole Triggers: (thanks to Dehua_Darbuya for posting me the English GUI code!)
  • NM init
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Nova Moves for Paladin 0000 <gen>) Greater than or equal to 1
        • Then - Actions
          • Set NM_temploc1 = (Position of Paladin 0000 <gen>)
          • Set NM_temploc2 = (NM_temploc1 offset by (30.00, -20.00))
          • Floating Text - Create floating text that reads IIIII at NM_temploc2 with Z offset 0.00, using font size 5.50, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Custom script: call RemoveLocation (udg_NM_temploc1)
          • Custom script: call RemoveLocation (udg_NM_temploc2)
          • Set NM_text = (Last created floating text)
          • Floating Text - Hide NM_text for (All players)
          • Floating Text - Show NM_text for (Player group((Owner of Paladin 0000 <gen>)))
          • Set NM_point[1] = (Position of Paladin 0000 <gen>)
          • Set NM_required[1] = 3300.00
          • Set NM_required[2] = 3100.00
          • Set NM_required[3] = 2900.00
          • Set NM_required[4] = 2700.00
          • Set NM_required[5] = 2500.00
          • Trigger - Turn on NM loop <gen>
          • Trigger - Turn on NM textmove <gen>
          • Trigger - Turn on NM explode activate <gen>
          • Trigger - Turn off (This trigger)
        • Else - Actions
  • NM loop
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Set NM_X = (X of NM_point[1])
      • Set NM_Y = (Y of NM_point[1])
      • Custom script: call RemoveLocation (udg_NM_point [1])
      • Set NM_point[2] = (Point(NM_X, NM_Y))
      • Set NM_point[1] = (Position of Paladin 0000 <gen>)
      • Set NM_dist = (NM_dist + (Distance between NM_point[1] and NM_point[2]))
      • Custom script: call RemoveLocation (udg_NM_point [2])
      • Set NM_temptext = <Empty String>
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • NM_dist Greater than or equal to ((NM_required[(Level of Nova Moves for Paladin 0000 <gen>)] / 5.00) x (Real((Integer A))))
            • Then - Actions
              • Set NM_temptext = (NM_temptext + |cffFF0000I|r)
            • Else - Actions
              • Set NM_temptext = (NM_temptext + I)
      • Floating Text - Change text of NM_text to NM_temptext using font size 5.50
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • NM_dist Greater than or equal to NM_required[(Level of Nova Moves for Paladin 0000 <gen>)]
        • Then - Actions
          • Set NM_dist = 0.00
          • Set NM_temploc1 = (Position of Paladin 0000 <gen>)
          • Unit - Create 1 Rifleman for (Owner of Paladin 0000 <gen>) at NM_temploc1 facing Default building facing degrees
          • Unit - Add a 60.00 second Generic expiration timer to (Last created unit)
          • Unit Group - Add (Last created unit) to NM_dummygroup
          • Unit - Create 1 Peasant for (Owner of Paladin 0000 <gen>) at NM_temploc1 facing Default building facing degrees
          • Custom script: call RemoveLocation (udg_NM_temploc1)
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Animation - Change (Last created unit)'s size to (150.00%, 150.00%, 150.00%) of its original size
          • Special Effect - Create a special effect attached to the origin of (Last created unit) using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
        • Else - Actions
  • NM textmove
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Set NM_temploc1 = (Position of Paladin 0000 <gen>)
      • Set NM_temploc2 = (NM_temploc1 offset by (30.00, -20.00))
      • Floating Text - Change the position of NM_text to NM_temploc2 with Z offset 0.00
      • Custom script: call RemoveLocation (udg_NM_temploc1)
      • Custom script: call RemoveLocation (udg_NM_temploc2)
  • NM explode activate
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) is in NM_dummygroup) Equal to True
    • Actions
      • Unit - Order (Attacking unit) to Human Mountain King - Thunder Clap
      • Set NM_temploc2 = (Position of (Attacking unit))
      • Set NM_tempgroup = (Units within 175.00 of NM_temploc2 matching (((((Matching unit) belongs to an enemy of (Owner of (Attacking unit))) Equal to True) and (((Matching unit) is alive) Equal to True)) and (((Matching unit) is A structure) Equal to False)))
      • Unit Group - Pick every unit in NM_tempgroup and do (Actions)
        • Loop - Actions
          • Unit - Cause Paladin 0000 <gen> to damage (Picked unit), dealing ((Max life of (Picked unit)) x 0.12) damage of attack type Spells and damage type Normal
      • Special Effect - Create a special effect at NM_temploc2 using Abilities\Spells\Other\Incinerate\FireLordDeathExplode.mdl
      • Custom script: call RemoveLocation (udg_NM_temploc2)
      • Custom script: call DestroyGroup (udg_NM_tempgroup)
      • Wait 0.50 seconds
      • Unit - Remove (Attacking unit) from the game
Any ideas to remove all leaks? :)
Thanks for reading :p
 
Last edited:

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
Leaks
call RemoveUnit( GetAttacker() )
call AddSpecialEffectLocBJ( udg_NM_temploc2, "Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl" )


I just gave it a very quick look through and those are the only ones I could find.
You make it much more difficult by posting it in GUI JASS since it's harder to read than normal JASS.
 
Level 3
Joined
Oct 28, 2016
Messages
22
Leaks
call RemoveUnit( GetAttacker() )
call AddSpecialEffectLocBJ( udg_NM_temploc2, "Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl" )


I just gave it a very quick look through and those are the only ones I could find.
You make it much more difficult by posting it in GUI JASS since it's harder to read than normal JASS.

How can I "unleak" the "Remove Attacking unit"? Also, is there a way to destroy a special effect without waiting?

I'll post a simple simulation of that spell below
 

Attachments

  • testspell.w3x
    21.7 KB · Views: 49
Level 8
Joined
Jan 28, 2016
Messages
486
Also, is there a way to destroy a special effect without waiting?

Most special effects will still play their animation even if you destroy them instantly. For example:

  • GUI SFX
    • Events
    • Conditions
    • Actions
      • Special Effect - Create a special effect at NM_temploc2 using Abilities\Spells\Other\Incinerate\FireLordDeathExplode.mdl
      • Special Effect - Destroy (Last created special effect)
JASS:
    //When using the Jass natives, double backslashes are needed instead of single backslashes like in GUI
    call DestroyEffect( AddSpecialEffect( "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl", x, y ) )
 
Most special effects will still play their animation even if you destroy them instantly. For example:

  • GUI SFX
    • Events
    • Conditions
    • Actions
      • Special Effect - Create a special effect at NM_temploc2 using Abilities\Spells\Other\Incinerate\FireLordDeathExplode.mdl
      • Special Effect - Destroy (Last created special effect)
JASS:
    //When using the Jass natives, double backslashes are needed instead of single backslashes like in GUI
    call DestroyEffect( AddSpecialEffect( "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl", x, y ) )

One less leak to deal with in the map, and it's gonna be fine...
 
Level 8
Joined
Jan 28, 2016
Messages
486
One less leak to deal with in the map, and it's gonna be fine...

Haha, you gotta start somewhere! Also I didn't realise there was more code than the first couple of functions. :p

@ChubbyQuiche I downloaded your test map and posted the triggers below in English. I didn't get around to solving the problem but at least now others can see your GUI code and hopefully help you out. You can edit your original post and add these there as well.

  • NM init
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Nova Moves for Paladin 0000 <gen>) Greater than or equal to 1
        • Then - Actions
          • Set NM_temploc1 = (Position of Paladin 0000 <gen>)
          • Set NM_temploc2 = (NM_temploc1 offset by (30.00, -20.00))
          • Floating Text - Create floating text that reads IIIII at NM_temploc2 with Z offset 0.00, using font size 5.50, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Custom script: call RemoveLocation (udg_NM_temploc1)
          • Custom script: call RemoveLocation (udg_NM_temploc2)
          • Set NM_text = (Last created floating text)
          • Floating Text - Hide NM_text for (All players)
          • Floating Text - Show NM_text for (Player group((Owner of Paladin 0000 <gen>)))
          • Set NM_point[1] = (Position of Paladin 0000 <gen>)
          • Set NM_required[1] = 3300.00
          • Set NM_required[2] = 3100.00
          • Set NM_required[3] = 2900.00
          • Set NM_required[4] = 2700.00
          • Set NM_required[5] = 2500.00
          • Trigger - Turn on NM loop <gen>
          • Trigger - Turn on NM textmove <gen>
          • Trigger - Turn on NM explode activate <gen>
          • Trigger - Turn off (This trigger)
        • Else - Actions
  • NM loop
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Set NM_X = (X of NM_point[1])
      • Set NM_Y = (Y of NM_point[1])
      • Custom script: call RemoveLocation (udg_NM_point [1])
      • Set NM_point[2] = (Point(NM_X, NM_Y))
      • Set NM_point[1] = (Position of Paladin 0000 <gen>)
      • Set NM_dist = (NM_dist + (Distance between NM_point[1] and NM_point[2]))
      • Custom script: call RemoveLocation (udg_NM_point [2])
      • Set NM_temptext = <Empty String>
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • NM_dist Greater than or equal to ((NM_required[(Level of Nova Moves for Paladin 0000 <gen>)] / 5.00) x (Real((Integer A))))
            • Then - Actions
              • Set NM_temptext = (NM_temptext + |cffFF0000I|r)
            • Else - Actions
              • Set NM_temptext = (NM_temptext + I)
      • Floating Text - Change text of NM_text to NM_temptext using font size 5.50
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • NM_dist Greater than or equal to NM_required[(Level of Nova Moves for Paladin 0000 <gen>)]
        • Then - Actions
          • Set NM_dist = 0.00
          • Set NM_temploc1 = (Position of Paladin 0000 <gen>)
          • Unit - Create 1 Rifleman for (Owner of Paladin 0000 <gen>) at NM_temploc1 facing Default building facing degrees
          • Unit - Add a 60.00 second Generic expiration timer to (Last created unit)
          • Unit Group - Add (Last created unit) to NM_dummygroup
          • Unit - Create 1 Peasant for (Owner of Paladin 0000 <gen>) at NM_temploc1 facing Default building facing degrees
          • Custom script: call RemoveLocation (udg_NM_temploc1)
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Animation - Change (Last created unit)'s size to (150.00%, 150.00%, 150.00%) of its original size
          • Special Effect - Create a special effect attached to the origin of (Last created unit) using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
        • Else - Actions
  • NM textmove
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Set NM_temploc1 = (Position of Paladin 0000 <gen>)
      • Set NM_temploc2 = (NM_temploc1 offset by (30.00, -20.00))
      • Floating Text - Change the position of NM_text to NM_temploc2 with Z offset 0.00
      • Custom script: call RemoveLocation (udg_NM_temploc1)
      • Custom script: call RemoveLocation (udg_NM_temploc2)
  • NM explode activate
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) is in NM_dummygroup) Equal to True
    • Actions
      • Unit - Order (Attacking unit) to Human Mountain King - Thunder Clap
      • Set NM_temploc2 = (Position of (Attacking unit))
      • Set NM_tempgroup = (Units within 175.00 of NM_temploc2 matching (((((Matching unit) belongs to an enemy of (Owner of (Attacking unit))) Equal to True) and (((Matching unit) is alive) Equal to True)) and (((Matching unit) is A structure) Equal to False)))
      • Unit Group - Pick every unit in NM_tempgroup and do (Actions)
        • Loop - Actions
          • Unit - Cause Paladin 0000 <gen> to damage (Picked unit), dealing ((Max life of (Picked unit)) x 0.12) damage of attack type Spells and damage type Normal
      • Special Effect - Create a special effect at NM_temploc2 using Abilities\Spells\Other\Incinerate\FireLordDeathExplode.mdl
      • Custom script: call RemoveLocation (udg_NM_temploc2)
      • Custom script: call DestroyGroup (udg_NM_tempgroup)
      • Wait 0.50 seconds
      • Unit - Remove (Attacking unit) from the game
 
I looked into your map, and optimized a lot of the triggers found inside.

Here is the map with the updated codes :wink:

Sorry about it being in JASS though.

EDIT:

I accidentally destroyed a group which does not contain anything. Changes made.

EDIT #2:

Oops, I should have suggested which parts of the code should be fixed, and not fix it manually.
 

Attachments

  • testspell.w3x
    20.9 KB · Views: 45
Last edited:
Level 3
Joined
Oct 28, 2016
Messages
22
I looked into your map, and optimized a lot of the triggers found inside.

Here is the map with the updated codes :wink:

Sorry about it being in JASS though.

EDIT:

I accidentally destroyed a group which does not contain anything. Changes made.

EDIT #2:

Oops, I should have suggested which parts of the code should be fixed, and not fix it manually.

Thanks, it doesn't seem leaky anymore :)
Although the floating text is kinda bugged, it flies away and dosen't change its color when being charged :( I'll try to fix it :p

EDIT: thanks a lot for that GUI code, I've just now noticed it :)
 
Last edited:
Status
Not open for further replies.
Top