| 08-16-2011, 05:47 AM | #1 |
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 |
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 |
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 |
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 | |
Cool. Thanks a lot, guys. Quote:
|
| 08-18-2011, 08:19 AM | #6 |
In this case 0 is 0. I've used it myself for dummy units :P |
| 08-18-2011, 07:37 PM | #7 |
Nice to know. Thanks. |
| 08-19-2011, 01:30 AM | #8 |
killunit is the way to go, never remove them this can cause random bugs. |
| 08-19-2011, 03:46 AM | #9 |
Toadcop would know, the music talks too him threw the vodka haze while he works on his arena. |
