HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Unit - Remove

01-27-2004, 11:39 PM#1
Jackalope
I heard that using Unit-Remove is not suggested because it doesn't remove the unit from memory like Unit-kill does. Is this true?
01-27-2004, 11:45 PM#2
Draco
Unit - Kill doesnt remove it from memory... If you remove a unit, you can bring it back, like revive it etc.
01-28-2004, 12:25 AM#3
Jackalope
So.. does that mean that every single unit that has been killed (by Unit- kill function or anyother means) is still in the memory, and could this potentially be a problem in a custom map?
01-28-2004, 12:26 AM#4
MysticGeneral
Yes, every unit will stay in the memory, even when using Unit - Kill, and Unit-remove
01-28-2004, 12:42 AM#5
Jackalope
Ok.. so if Unit- Kill doesn't take it out of memory and Unit -Remove doesn't either, then is there any way you can? Can all these units still in the memory potentially build up to the point where your out of memory(or atleast the memory can war3 can handle)? Or is the amount so insignificant that such a problem is virtually unlikely?

Another thing- the Unit - Remove function has the description says that Heros removed with this function cannot be revived, making me think that this does actually remove them from memory.
01-28-2004, 12:56 AM#6
Grater
All this unit-remove/kill stuff has about as much credibility as sacrificing chickens to the b.net god to make your map more popular.

Remove is the best way to remove a unit from memory. There are no problems, possibly once upon a time removing hidden units caused problems but now there is special case code to deal with it in blizzard.j (if you try to remove a live hidden unit, it automatically kills then removes it)

If your worried about dead units taking up memory go to gameplay constants and set Decay Time (sec) - Bones from 88 to something smaller, like 10.
01-28-2004, 01:02 AM#7
Jackalope
Thats all I wanted to know, thanks!
01-28-2004, 01:28 AM#8
Extrarius
Code:
function DeleteUnit takes unit oldUnit returns nothing
//Gets rid of a unit. Try to get it out of memory as best as possible
    call SetUnitOwner(oldUnit, Player(bj_PLAYER_NEUTRAL_EXTRA), false)
    call ShowUnit(oldUnit, false)
    call KillUnit(oldUnit)
    call RemoveUnit(oldUnit)
endfunction
Seems to work pretty well for me in clearing out units. I did the change to player extra to avoid the 'hero has died' messages
01-28-2004, 02:16 AM#9
Hunter0000
Just hide units then explode them, works very well as explode clears them from memory(right?)
01-28-2004, 05:40 AM#10
zotax
Ya, apparently removing units leaks to a certain degree, and only explode totally voids the leaks.
01-28-2004, 06:16 AM#11
Xinlitik
What about timed life? Is that just killing the unit, or is there something about it that makes it different? If not, I need to go through all my triggers and explode. :(
01-28-2004, 03:18 PM#12
BlackSlash
I think Timed Life remove totally unit from memory. anyone can confirm this?
01-28-2004, 03:39 PM#13
chuayw2000
Timed life doesnt remove it totally from memory. I think it waits the no of seconds you specified and then kills a unit.

Is it true when a dead unit that has totally decayed (the body has dissappeared from the ground) is removed from the game? Because I realized that that are not picked up by the Pick unit in regionXYZ function unlike dead units whose corpse are still there.
01-28-2004, 09:12 PM#14
Grater
Remove removes them from memory even better than explode :P. Seriously, try this stuff. Dying units appear to not get removed from memory because they remain for 88 seconds
Also here is a telling little snippet from blizzard.j
Code:
    // Remove or kill the original unit.  It is sometimes unsafe to remove
    // hidden units, so kill the original unit if it was previously hidden.
    if wasHidden then
        call KillUnit(oldUnit)
        call RemoveUnit(oldUnit)
    else
        call RemoveUnit(oldUnit)
    endif
The comment says it all, to get rid of hidden units, kill then remove them.

No-one can really claim to know more about triggers than blizzard themselves. They don't always tell us everything, but it's safe to do as blizzard does in blizzard.j and their maps.