Optimizing leak help?

Zonagle

New Member
Reaction score
1
First question answered, but I have another. Rather than creating an additonal topic, I figured I'd ask it here first, in hopes of obtaining an answer.
This spell is based off Blink. I know some of you may cry at how awful this is coded, but it was my first attempt at a custom spell. Please ignore the leaks, I'm fairly sure I can fix them, it's a problem with the actual spell that I need help with. Oddly enough, it used to work on the map I first created it in, however when I imported it to a new map I ran into a problem. For some reason, when the spell is activated, the unit will Blink to the targetted point, but all of the effects that are meant to happen at CustomBlinkPoint (which should be where I target the blink spell) instead happen at a static point on my map. As such, the pause, damage, and terrain defamation occur at the same point every time I cast the spell. I did remember to create the variable, so it's not that. Any suggestions? Also, any optimization of the code, to be more efficient/MUI would be great.

Spell
Code:
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Custom Blink 
    Actions
        Wait 1.00 seconds
        Unit - Make (Triggering unit) Invulnerable
        Set CustomBlinkPoint = ((Target point of ability being cast) offset by (0.00, 0.00))
        Unit Group - Pick every unit in (Units within 700.00 of CustomBlinkPoint) and do (Actions)
            Loop - Actions
                Unit - Pause (Picked unit)
        Animation - Play (Last created unit)'s birth animation
        Special Effect - Create a special effect at CustomBlinkPoint using Abilities\Spells\Human\FlameStrike\FlameStrike1.mdl
        Special Effect - Create a special effect at CustomBlinkPoint using Abilities\Spells\Human\FlameStrike\FlameStrikeTarget.mdl
        Unit - Create 1 Charge up spell for Neutral Passive at CustomBlinkPoint facing (Position of (Triggering unit))
        Sound - Play ManaFlareLoop <gen> at 100.00% volume, located at CustomBlinkPoint with Z offset 0.00
        Animation - Change (Last created unit)'s animation speed to 6.00% of its original speed
        Wait 1.00 seconds
        Wait 1.75 seconds
        Sound - Play ManaFlareLoop <gen> at 100.00% volume, located at CustomBlinkPoint with Z offset 0.00
        Wait 2.25 seconds
        Unit - Cause (Triggering unit) to damage circular area after 0.50 seconds of radius 700.00 at CustomBlinkPoint, dealing 200.00 damage of attack type Spells and damage type Lightning
        Unit - Create 1 Middle of spell for Neutral Passive at CustomBlinkPoint facing (Position of (Triggering unit))
        Sound - Play Shockwave <gen> at 100.00% volume, located at CustomBlinkPoint with Z offset 0.00
        Environment - Create a 2.00 second Normal ripple deformation at CustomBlinkPoint with starting radius 200.00, ending radius 800.00, and depth 20.00, using 0.50 second ripples spaced 150.00 apart
        Wait 2.00 seconds
        Sound - Stop (Last played sound) Immediately
        Unit - Cause (Triggering unit) to damage circular area after 0.00 seconds of radius 500.00 at (Center of (Playable map area)), dealing 100.00 damage of attack type Spells and damage type Normal
        Unit - Create 1 Middle of spell for Neutral Passive at CustomBlinkPoint facing (Position of (Triggering unit))
        Sound - Play Shockwave <gen> at 100.00% volume, located at CustomBlinkPoint with Z offset 0.00
        Environment - Create a 2.00 second Normal ripple deformation at CustomBlinkPoint with starting radius 200.00, ending radius 800.00, and depth 20.00, using 0.50 second ripples spaced 150.00 apart
        Wait 2.00 seconds
        Sound - Stop (Last played sound) Immediately
        Unit - Cause (Triggering unit) to damage circular area after 0.50 seconds of radius 700.00 at CustomBlinkPoint, dealing 200.00 damage of attack type Spells and damage type Lightning
        Unit - Create 1 Middle of spell for Neutral Passive at CustomBlinkPoint facing (Position of (Triggering unit))
        Sound - Play Shockwave <gen> at 100.00% volume, located at CustomBlinkPoint with Z offset 0.00
        Environment - Create a 2.00 second Normal ripple deformation at CustomBlinkPoint with starting radius 200.00, ending radius 800.00, and depth 20.00, using 0.50 second ripples spaced 150.00 apart
        Wait 2.00 seconds
        Sound - Stop (Last played sound) Immediately
        Unit - Cause (Triggering unit) to damage circular area after 0.50 seconds of radius 700.00 at CustomBlinkPoint, dealing 2000.00 damage of attack type Spells and damage type Divine
        Unit - Create 1 Stomp Effect for Neutral Passive at CustomBlinkPoint facing (Position of (Triggering unit))
        Animation - Change (Last created unit)'s animation speed to 20.00% of its original speed
        Environment - Create a 4.00 second Normal ripple deformation at CustomBlinkPoint with starting radius 200.00, ending radius 1000.00, and depth 120.00, using 0.50 second ripples spaced 150.00 apart
        Environment - Create a 1.00 second Permanent crater deformation at CustomBlinkPoint with radius 400.00 and depth 150.00
        Special Effect - Destroy (Last created special effect)
        Sound - Play ImplosionDie2 <gen> at 100.00% volume, located at CustomBlinkPoint with Z offset 0.00
        Wait 2.00 seconds
        Unit - Make (Triggering unit) Vulnerable
        Unit - Unpause (Triggering unit)
        Unit Group - Pick every unit in (Last created unit group) and do (Actions)
            Loop - Actions
                Unit - Unpause (Picked unit)






So I'm pretty new to removing leaks, and I was wondering if this is the fastest and most efficient way of doing it? If it is, a simple yes is enough, if not, I would be grateful for any assistance.

Old Code:
SPWN 1 AI movement 1
Events
Unit - A unit enters Spawn 1 <gen>
Conditions
(Owner of (Triggering unit)) Equal to Player 12 (Brown)
Actions
Unit Group - Order (Units in Spawn 1 <gen>) to Attack-Move To (Center of Attackers attack point <gen>)

Changed to

New Code:
SPWN 1 AI movement 1
Events
Unit - A unit enters Spawn 1 <gen>
Conditions
(Owner of (Triggering unit)) Equal to Player 12 (Brown)
Actions
Set Temp_point = (Center of Attackers attack point <gen>)
Set Temp_group = (Units in Spawn 1 <gen>)
Unit Group - Order Temp_group to Attack-Move To Temp_point
Custom script: call RemoveLocation (udg_Temp_point)
Custom script: call DestroyGroup (udg_Temp_group)
 

Romek

Super Moderator
Reaction score
964
Yes :)
 

Romek

Super Moderator
Reaction score
964
Darn, I was hoping for a faster method, ah well. It's going to take awhile to change all of my movement triggers, there's at least 50+
you could just copy and paste the trigger, and edit the 'set' actions.
Although, you should get used to making leak-free triggers anyway, instead of making them leaky, then fix them :)
 

Samael88

Evil always finds a way
Reaction score
181
Please, use a codetag istead of the spoiler, it becomes much easier to read the code when it is in code tags. The codetag button is the # next to the quote and J in the panel.
 

Zonagle

New Member
Reaction score
1
Please, use a codetag istead of the spoiler, it becomes much easier to read the code when it is in code tags. The codetag button is the # next to the quote and J in the panel.
Done, do you have any suggestions on what the problem might be?
 

Samael88

Evil always finds a way
Reaction score
181
It may be that one second wait at the start.
Do you have any other triggers using that point- variable?

And just for the sake of doing everything by the book:
Remove the trigger from the new map.
Load the old map.
Go into editor preferances and check the box about automatically creating new variables when importing triggers.
The import the trigger again. Just if you already did not do this:thup:
 

Zonagle

New Member
Reaction score
1
It may be that one second wait at the start.
Do you have any other triggers using that point- variable?

And just for the sake of doing everything by the book:
Remove the trigger from the new map.
Load the old map.
Go into editor preferances and check the box about automatically creating new variables when importing triggers.
The import the trigger again. Just if you already did not do this:thup:

1) Nope, it's unique to that trigger only.
2) I did not, I copy the trigger and created the variable. I didn't see there'd be much difference since it's just a point. However, it's worth a shot, I'll edit the results in a moment.
 

vypur85

Hibernate
Reaction score
803
> I didn't see there'd be much difference

'Target point of ability being cast' does not exist after wait. Set the point variable before the wait (which is the problem addressed by Post#9.


Code:
    Actions
        Set CustomBlinkPoint = ((Target point of ability being cast) offset by (0.00, 0.00))
        Wait 1.00 seconds
        Unit - Make (Triggering unit) Invulnerable
        Unit Group - Pick every unit in (Units within 700.00 of CustomBlinkPoint) and do (Actions)
            Loop - Actions
                Unit - Pause (Picked unit)
        Animation - Play (Last created unit)'s birth animation
        ...

But this might not solve every problem. Haven't look through the trigger entirely.
 

Zonagle

New Member
Reaction score
1
> I didn't see there'd be much difference

'Target point of ability being cast' does not exist after wait. Set the point variable before the wait (which is the problem addressed by Post#9.


Code:
    Actions
        Set CustomBlinkPoint = ((Target point of ability being cast) offset by (0.00, 0.00))
        Wait 1.00 seconds
        Unit - Make (Triggering unit) Invulnerable
        Unit Group - Pick every unit in (Units within 700.00 of CustomBlinkPoint) and do (Actions)
            Loop - Actions
                Unit - Pause (Picked unit)
        Animation - Play (Last created unit)'s birth animation
        ...

But this might not solve every problem. Haven't look through the trigger entirely.

Alright, thanks, I'll try changing it.
Edit: That worked, changing those two around fixed point problem, thanks again Samael88 and vypur85.
 

Xorifelse

I'd love to elaborate about discussions...........
Reaction score
87
Darn, I was hoping for a faster method, ah well. It's going to take awhile to change all of my movement triggers, there's at least 50+ (In over 3 maps, that is).

A faster method of code execution or.. a faster method of making things like this in GUI?
Because there are of course faster methods, actually much faster for either code execution and making things like this, but you have to know Jass for this.

Locations are just made for GUI, they are slow and inefficient and leak.
Using the X,Y coordinates ( only accessible in Jass using the normal editor ) you don't create leaks, and you use the direct native instead of calling functions like you do in GUI all the time.
 

Samael88

Evil always finds a way
Reaction score
181
Using the X,Y coordinates ( only accessible in Jass using the normal editor ) you don't create leaks

That is possible in GUI to, there is a getX and getY function, but it is as you said not a native function, but also it is possible to make it in gui to.
The only thing missing in GUI is setX and setY. Those are not able in normal GUI:p
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top