HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Do all Special Effects leak?

02-26-2005, 08:17 AM#1
aaero
As noted in the thread title, I'm curious to find out if all special effects leak, even the ones that "destroy themselves" - that is, any special effect that disappears after a given amount of time.

I'm going to go ahead and guess yes after some tests I performed that made it look like that might be the case, but guesses just don't do it for me.

Anyone know for sure?
02-26-2005, 09:23 AM#2
Raptor--
Quote:
Originally Posted by aaero
As noted in the thread title, I'm curious to find out if all special effects leak, even the ones that "destroy themselves" - that is, any special effect that disappears after a given amount of time.

I'm going to go ahead and guess yes after some tests I performed that made it look like that might be the case, but guesses just don't do it for me.

Anyone know for sure?

all special effects, even ones that 'animate out' take up memory until they are destroyed

simply destroy those types of special effects the moment you create them, it will still play until completion
02-26-2005, 09:39 AM#3
Ant
Yup in special effect heavy maps the performance can go from good to horrid in half an hour.

What I do is use a special effects array (if you remove them once they are played, then they don't show for long, I think. Actually i haven't tried) and for each special effect created, i set it to array[pointer] and increment the pointer, then when the pointer reaches a number like 50, I destroy all special effects from the array and set hte pointer to 0.

Or you could make it so when the pointer reachs 100, you set it to 0 and destroy arrays 0 to 50. Then when it reaches 50 u destroy effects 51 to 100.
02-26-2005, 12:31 PM#4
Anitarf
So far, all the special effects I ever used were of the kind that can be destroyed right after they are created. Most effects just have one animation, and that animation always plays till the end before the effect dissapears.

I suppose it's different if you use non-effect models for effects: for example, if you used a projectile, buff or unit model, which has it's birth, stand and death animations, for your special effect, then the moment it got destroyed, it would just play it's death animation and then dissapear. If you wanted it to stand there for some time before doing that, you couldn't get rid of it so easily, you would have to store it somewhere and destroy it at the right time. Of course, there are advantages to this, such as the flexibility of such effects, that can have any lenght, as opposed to "fixed" effects that always last only as long as their single animation does.
02-26-2005, 07:19 PM#5
aaero
Wow, great responses. It's especially useful to know that I can just destroy it after I create it because, well, here take a look.

Code:
Nuke Effect
    Events
        Unit - A unit Dies
    Conditions
        (Unit-type of (Triggering unit)) Equal to Airship
    Actions
        Set pntTempPoint = (Position of (Triggering unit))
        Special Effect - Create a special effect at pntTempPoint using Abilities\Spells\Human\FlameStrike\FlameStrike1.mdl
        For each (Integer B) from 1 to 3, do (Actions)
            Loop - Actions
                For each (Integer A) from 0 to 3, do (Actions)
                    Loop - Actions
                        Special Effect - Create a special effect at (pntTempPoint offset by ((Real((Integer B))) x 100.00) towards ((Real((Integer A))) x 50.00) degrees) using Abilities\Spells\Human\FlameStrike\FlameStrike1.mdl
                        Special Effect - Create a special effect at (pntTempPoint offset by ((Real((Integer B))) x -100.00) towards ((Real((Integer A))) x 50.00) degrees) using Abilities\Spells\Human\FlameStrike\FlameStrike1.mdl

Yeah, who wants to create an array to store all those just to destroy in five seconds. I'll tell you who doesn't: me. Sadly, I have to, because Anitarf hit the nail on the head. The FlameStrike model appears to have a variety of animations, so destroying it instantly causes, well, the effect to not happen.

I know how to fix it and already have though, I was just being lazy and hoping I wouldn't have to clean up my code.
02-27-2005, 01:25 AM#6
Ant
-.- an array to store those would just be about four lines.

Set SpecialEffectArray[pointer] to last created special effect.
Set pointer = pointer + 1

And put that after the special effect creation events.
02-27-2005, 01:50 AM#7
aaero
Yeah that's basically what I did Ant, only without the pointer variable. I got a little bit lazy and used global variables, so it will leak if another instance of the trigger starts running while this is running, but I'm ok with that since this code will only run a maximum of 30 times in a given game (and it will probably never run at the same time anyway).
02-27-2005, 08:31 AM#8
Raptor--
Quote:
Originally Posted by aaero
Yeah that's basically what I did Ant, only without the pointer variable. I got a little bit lazy and used global variables, so it will leak if another instance of the trigger starts running while this is running, but I'm ok with that since this code will only run a maximum of 30 times in a given game (and it will probably never run at the same time anyway).


well i'm pretty sure u can just create a function with some local variables that basically creates the effect, waits 5 seconds, then destroys the effect
and since its local u can have as many as you want going and they'll all function independently
02-27-2005, 06:20 PM#9
aaero
Yeah I could, but

Quote:
got a little bit lazy


stopped me from that. I've never declared a local array before and I wasn't in the mood to look up how for such a minute detail :).

Thanks for the concern though all - but don't worry, it's working and I'm OK with the small chance for a small leak.