HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

What is wrong with the Remove... actions ?

08-08-2008, 08:20 PM#1
Troll-Brain
http://www.wc3campaigns.net/showpost...0&postcount=32

Is it paranoia, an old fixed bug or we should still avoid using Remove functions when we can use a Kill.. function ?

Oh and btw create/kill or remove a destructable leaks, that's a fact just test the map i posted in the quoted thread.
08-08-2008, 08:25 PM#2
Pyrogasm
The problem is with H2I()-related systems where a unit with Handle ID X can be removed and then a new unit is created with the same handle id without the system noticing.

However, most systems clean themselves up by checking for unit death events, so this is an acceptable fix:
Collapse JASS:
function RemoveUnitEx takes unit U returns nothing
    call ShowUnit(U, false)
    call KillUnit(U)
endfunction
08-08-2008, 08:32 PM#3
Troll-Brain
Oh ok i understand now, thx.
That is nothing with the functions themselves.

Btw there is a way to find if an unit is removed of the game.
Because she get the order "undefend" and "magicundefense" two times (one for his death and one for his remove (or end of decay ofc).
Ofc only if the unit has the ability, but the ability can be deactivated for the unit owner.
08-08-2008, 08:41 PM#4
Pyrogasm
Quote:
Originally Posted by Troll-Brain
Because she get the order "undefend" and "magicundefense" two times (one for his death and one for his remove (or end of decay ofc).
orly?
08-09-2008, 05:44 AM#5
chobibo
Does it work if you just call RemoveUnit()? I tried it some time ago but I used KillUnit().
08-09-2008, 09:38 AM#6
Troll-Brain
Quote:
Originally Posted by chobibo
Does it work if you just call RemoveUnit()? I tried it some time ago but I used KillUnit().
If you remove the unit she get the order two times.

Quote:
Originally Posted by Pyrogasm
orly?
Yeah really but i've a problem to know if it's a death event or a end of decay time (remove).
I don't find any ability that i can use on ONE corpse.
I tried all the undead abilities but all are area, not single target.
I also tried to use a channel ability but i can't target a corpse ...

And anyway if i found one, then all units death must leave a corpse, but that's not really a problem if you don't want the corpse you can change the unit position when she dead.
But it will be annoying to list all of them ...