• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] sfx on dead unit

Status
Not open for further replies.

Kazeon

Hosted Project: EC
Level 33
Joined
Oct 12, 2011
Messages
3,449
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..
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
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.
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
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.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
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.
Top