HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Why is RemoveUnit evil?

06-16-2009, 12:18 PM#1
Flame_Phoenix
So in one of my spells i explain I want to avoid RemoveUnit because it is evil.... however no longer remember why ...
so if anyone could help =P
06-16-2009, 01:00 PM#2
Seshiro
Because a removed unit doesn't trigger onDeath, where most Indexing Utils fire, and it doesn't remove units from groups, but sets them to null, so FirstOfGroup(g) would return null, even if there are still units in teh group!

Greez
06-16-2009, 01:10 PM#3
Captain Griffen
The first reason Seshiro gave is now, with stuff like AutoIndex, inaccurate.

The second reason was never a reason, relating to FirstOfGroup, was never a reason, since if you were suffering that, then you're doing it wrong. Plus GroupRefresh now makes it easy in those cases where you're doing it badly to avoid doing it wrong without any hassle...
06-16-2009, 01:15 PM#4
ToukoAozaki
All the problem here will be solved once native hooking comes into play.

Quote:
The second reason was never a reason, relating to FirstOfGroup, was never a reason, since if you were suffering that, then you're doing it wrong. Plus GroupRefresh now makes it easy in those cases where you're doing it badly to avoid doing it wrong without any hassle...

I agree with the point that using FirstOfGroup in such case is usually a bad practice. But anyway, back to the original complaint, GroupRefresh is not bulletproof. You can't call that every time before doing anything, and bugs still can happen unless you do it. That's because removing units can happen literally anytime, and ghost units take place instantly (once execution ends).....
06-16-2009, 02:08 PM#5
Vexorian
With that logic it was never evil.

RemoveUnit is evil precisely because you need things like that to make other things work.
06-16-2009, 03:02 PM#6
Flame_Phoenix
Mmm so it is evil only because it sets the unit null and it doesn't remove it from groups right?
I thought it was connected to "ghost handles", or maybe it is and I am just to newb to make the link between those two things. =P
06-16-2009, 03:07 PM#7
Opossum
afaik "ghost units" are just what you just described: Units that stay in groups as a null unit when removed and thus making exitwhen FirstOfGroup(g) == null and similar things bug.
06-16-2009, 03:57 PM#8
Flame_Phoenix
So, is there a way to remove a dead corpse from a game, without using "RemoveUnit" ??
06-16-2009, 04:01 PM#9
moyack
killing it, and if it has decay, wait 88 seconds and the game will take care of it.
06-16-2009, 04:36 PM#10
Flame_Phoenix
Quote:
killing it, and if it has decay, wait 88 seconds and the game will take care of it.
That is the problem my friend ... how do I kill a unit that is already dead ? I can't ...
The spell in cause acts on a dead body. After acting, I would like the dead body to go away, but that doesn't happen... not without remove unit =S
06-16-2009, 04:53 PM#11
Iron_Doors
Quote:
Originally Posted by Flame_Phoenix
That is the problem my friend ... how do I kill a unit that is already dead ? I can't ...
The spell in cause acts on a dead body. After acting, I would like the dead body to go away, but that doesn't happen... not without remove unit =S

Either hide it and move it somewhere out of reach of spells, or use some ability like raise dead that gets rid of corpses.
06-16-2009, 05:02 PM#12
Opossum
UnitSuspendDecay(u, false) might work on trigger-created corpses. You could try that.
06-16-2009, 06:10 PM#13
Flame_Phoenix
Quote:
Either hide it and move it somewhere out of reach of spells, or use some ability like raise dead that gets rid of corpses.
Arrghhhh =S
Thx God I have a special zone that is used for nothingness but ... I would prefer to avoid it =S
Quote:
UnitSuspendDecay(u, false) might work on trigger-created corpses. You could try that.
The corpses are created by units who die naturally =(
06-16-2009, 07:27 PM#14
0zyx0
There is a gameplay constant, I believe, that sets the time in which a unit is removed from the game after death. Or else I am mixing it all up with an object editor data field. Anyway, I am sure there is a field where you can select 'can raise, does decay', and stuff like that. You could use that field in combination with the chaos ability, if it works.

However, I am not sure about, even if it works, if it would solve your problem.
06-16-2009, 08:24 PM#15
Alevice
why not explode the unit?
shouldnt that prevent corpse creation?