HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

KillUnit() == RemoveUnit()?

08-16-2011, 05:47 AM#1
Ignitedstar
Wasn't there confirmation that KillUnit() does the same thing as RemoveUnit()? Argh, I remember that thread being made talking about it, but I can't find it. Maybe it didn't take place on wc3c.net.

I want to know because KillUnit makes a unit play their death animation whereas RemoveUnit makes them disappear from the game completely. This has its ups and downs, but I primarily want to make sure that whenever I use KillUnit on a dummy unit that needs to play their death animation (for spells), I'm not leaking a unit because they're not actually gone. I know that heroes are technically stored in the game because they can be resurrected. I believe using RemoveUnit on a hero will actually get rid of them forever. A problem for heroes, perhaps. For units, not necessarily a problem.

Am I right on this or wrong? Or a third option?
08-16-2011, 09:07 AM#2
Anitarf
KillUnit is not the same as RemoveUnit. The latter removes the unit from the game (and thus memory) immediately while the former just kills the unit. However, WC3 automatically removes dead units from the game once they decay (or immediately after death if the units don't decay), so KillUnit still doesn't "leak".
08-16-2011, 04:22 PM#3
Bribe
Also, if you set the unit's death time to 0 and set its status to "can't raise, does not decay"
your KillUnit calls will play the animation but also immediately remove the unit.
08-16-2011, 10:24 PM#4
Frostic
RemoveUnit removes the unit from the game permanently. You can't get that unit back. KillUnit kills the unit, but allows you to be resurrected by spells like the paladin's ultimate. Also, if you remove a hero, you cannot revive him. If you kill the hero however, you can.
08-17-2011, 07:13 PM#5
Ignitedstar
Cool. Thanks a lot, guys.

Quote:
Originally Posted by Bribe
Also, if you set the unit's death time to 0 and set its status to "can't raise, does not decay"
your KillUnit calls will play the animation but also immediately remove the unit.
A question here. Warcraft 3 has the tendency to believe in some instances that zero is equal to infinity. Is this one of those cases? And if so, will I be able to obtain this effect if the Death Time is .01 seconds?
08-18-2011, 08:19 AM#6
Bribe
In this case 0 is 0. I've used it myself for dummy units :P
08-18-2011, 07:37 PM#7
Ignitedstar
Nice to know. Thanks.
08-19-2011, 01:30 AM#8
Toadcop
killunit is the way to go, never remove them this can cause random bugs.
08-19-2011, 03:46 AM#9
Nuclear Arbitor
Toadcop would know, the music talks too him threw the vodka haze while he works on his arena.