Leaky Special Effect trigger.

XDogg

New Member
Reaction score
0
Ok I have a trigger like so:

Trigger:
  • Bomb Level 1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Bomb 1-8
      • (Level of Bomb 1-8 for (Triggering unit)) Equal to 1
    • Actions
      • Set MyLocation = (Position of (Triggering unit))
      • Unit - Create 1 Blast Bomb 1 for (Owner of (Triggering unit)) at MyLocation facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_MyLocation)
      • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
      • Special Effect - Create a special effect attached to the overhead of (Last created unit) using Abilities\Spells\Orc\AncestralSpirit\AncestralSpiritCaster.mdl



So When I added a
- Special Effect - Destroy (Last created special effect)

It instantly removes the special effect not showing anything.



So I tried to cure it this way:

Trigger:
  • Bomb Level 1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Bomb 1-8
      • (Level of Bomb 1-8 for (Triggering unit)) Equal to 1
    • Actions
      • Set MyLocation = (Position of (Triggering unit))
      • Unit - Create 1 Blast Bomb 1 for (Owner of (Triggering unit)) at MyLocation facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_MyLocation)
      • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
      • Special Effect - Create a special effect attached to the overhead of (Last created unit) using Abilities\Spells\Orc\AncestralSpirit\AncestralSpiritCaster.mdl
      • Wait until (((Last created unit) is dead) Equal to True), checking every 1.00 seconds
      • Special Effect - Destroy (Last created special effect)



Leak Check still sees it as leaking (telling me to add Special Effect - Destroy (Last created special effect)), but I think it's fixed not sure... If it's still leaking any advise as to how to get this working leak free?


EDITED

Hrmm It said this is leakfree...

Trigger:
  • Bomb Level 1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Bomb 1-8
      • (Level of Bomb 1-8 for (Triggering unit)) Equal to 1
    • Actions
      • Set MyLocation = (Position of (Triggering unit))
      • Unit - Create 1 Blast Bomb 1 for (Owner of (Triggering unit)) at MyLocation facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_MyLocation)
      • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
      • Special Effect - Create a special effect attached to the overhead of (Last created unit) using Abilities\Spells\Orc\AncestralSpirit\AncestralSpiritCaster.mdl
      • Set LastEffect = (Last created special effect)
      • Wait until (((Last created unit) is dead) Equal to True), checking every 1.00 seconds
      • Special Effect - Destroy LastEffect



But dont I have to do a custom script to remove LastEffect varible?
 

Azlier

Old World Ghost
Reaction score
461
Both of those triggers are going to leak. You need a local effect.

Use the third trigger, but add this line to to top of your trigger:
JASS:
local effect udg_LastEffect

I think that works. I hear mixed reports about shadowing working.
 

Komaqtion

You can change this now in User CP.
Reaction score
469
I'm quite sure that shadowing doesn't work with the latest patch...

But, please try it out ;)

Otherwise, you could add this as the first line:
Trigger:
  • Custom script: local effect e


Then this instead of the "Create Special Effect" action:
Trigger:
  • Custom script: set e = AddSpecialEffectTarget("Abilities\\Spells\\Orc\\AncestralSpirit\\AncestralSpiritCaster.mdl", bj_lastCreatedUnit, "overhead")


Then this after the wait:
Trigger:
  • Custom script: call DestroyEffect(e)


Though, I'm a bit against using too many custom scripts in GUI...
 
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