[Solved] sfx on dead unit

Status
Not open for further replies.

Kazeon

Hosted Project: EC
Level 34
Joined
Oct 12, 2011
Messages
3,450
hey guys, how's going? :grin:

I have a question here. You know that when we create a sfx on a unit like
  • Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
then if the unit dies, the sfx disappeared right? but now the question is, if we don't destroy the sfx, will that causes leaks?

thnks for any help..
 
You need to destroy the special effect attached to the unit, but I don't know if the special effect is already destroyed when the unit is dead :D.

But when I do destroying the effect attached to the unit before it gets died and I've used a memory leaks checker the result is no leaks in the special effect.
 
I'm no Purge but I'll give you my two cents...

It seems illogical to me to think that just because the unit dies the effect is destroyed. I would assume any and all effects will stay in the memory until they are discarded.

Instead of creating the special effects I recommend using an item ability and just have it create the attachment where you want it.
 
death != destruction

When a unit dies, that does not affect attached effects. When it decays/is destructed/removed, ofc the effect won't be visible any longer because it's model-dependent and the unit does not provide data like about its position any longer. Yes, it would make sense to automatically destroy attached effects as the unit disappears. No, Blizzard does not do it.

Anyway, it's easy to write wrapper functions for unit-attached sfx, to map the sfxs to the unit and vice-versa. Then you only need to catch the deallocation of a unit (which you should already have for thousands of other purposes), like from the unit indexing resource, and destroy all listed effects under the unit.
 
Status
Not open for further replies.
Back
Top