Special Effect Leak

Status
Not open for further replies.
Level 7
Joined
May 11, 2010
Messages
278
  • Spawn warning loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set TempPoint = (Center of (Playable map area))
      • Special Effect - Create a special effect at TempPoint using Abilities\Spells\Orc\AncestralSpirit\AncestralSpiritCaster.mdl
      • Custom script: call RemoveLocation(udg_TempPoint)
I presume that this leaks, as i'm not using
  • Special Effect - Destroy (Last created special effect)
at the end.

However, when i put the destroy function in, the effect doesn't play.
According to Things That Leak this shouldn't be the case. Help me out here?
 
I think it should be something like this:

When you do this
  • Special Effect - Create a special effect at TempPoint using Effect.mdl
  • Special Effect - Destroy (Last created special effect)
the effect plays its death animation.
So if you want it to stay for a while save it in variable and start a timer which would expire in (Whatever time you find it appropriate to play a nice animation and dissapear) and destroy it.
 
Uurgh, more triggers >.< oh well, thanks!

I believe this should do it.

  • Spawn warning loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set TempPoint = (Center of (Playable map area))
      • Special Effect - Create a special effect at TempPoint using Abilities\Spells\Orc\AncestralSpirit\AncestralSpiritCaster.mdl
      • Hashtable - Save Handle Of(Last created special effect) as 0 of 1 in BatSpawnTable
      • Countdown Timer - Start effecttimer as a One-shot timer that will expire in 0.99 seconds
      • Custom script: call RemoveLocation(udg_TempPoint)
  • Spawn effect clear
    • Events
      • Time - effecttimer expires
    • Conditions
    • Actions
      • Special Effect - Destroy (Load 0 of 1 in BatSpawnTable)
 
  • trail loop
    • Events
      • Time - Every 1 seconds of game time
    • Conditions
    • Actions
      • Set point = ...
      • Special Effect - Create a special effect at point using Abilities\Spells\Undead\PlagueCloud\PlagueCloudCaster.mdl
      • Trigger - Run timer <gen> (ignoring conditions)
      • Custom script: call RemoveLocation(udg_point)
  • timer
    • Events
    • Conditions
    • Actions
      • Custom script: local effect e = bj_lastCreatedEffect
      • Wait 1.00 game-time seconds
      • Custom script: call DestroyEffect(e)
      • Custom script: set e = null
 
I am 95% sure that's not the best solution and the exact explanation. Someone with more experience and actual knowledge should add some comments.
I think it sounds like a fairly good solution. However, further input from tohers would be appreciated.
Nedio95 is correct.

Hashtables are slow and aren't meant to do this kind of stuff.
Using hashtables as a means to clean leaks is pretty overkill.

Here is an alternative option (only 1 trigger needed, but you do need a new variable - I will call it "TempSfx", a special effect variable):
  • Trigger
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: local effect udg_TempSfx
      • Set TempPoint = (Center of (Playable map area))
      • Special Effect - Create a special effect at TempPoint using Abilities\Spells\Orc\AncestralSpirit\AncestralSpiritCaster.mdl
      • Set TempSfx = (Last created special effect)
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Wait 0.90 game-time seconds
      • Special Effect - Destroy TempSfx
      • Custom script: set udg_TempSfx = null
 
That's why we have Timed SFX System...
Some SFX has more than 1 animation, that is why you should not destroy it immediately as it won't play the animation completely.
But some SFX has only 1 animation, even if you destroy it immediately, it will play its animation until it completes.

The hard ones is for SFX with more than 1 animation (usually: birth, stand, death)
 
Status
Not open for further replies.
Back
Top