HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

IsUnitInGame?

11-19-2007, 11:53 PM#1
midiway
Wich condition should I use to know if certain unit is in game?

I don't want to know if it's dead, I want to know if it wasn't removed from the game or his corpse was removed because the alive unit reference is the same from the dead corpse (!!!) from this unit....
11-20-2007, 03:06 AM#2
Vexorian
You are gonna have to think of something different since this is mostly calling for trouble.

But if you insist, do GetUnitTypeId, it returns 0 if the unit does not exist.
11-20-2007, 04:25 AM#3
grim001
It's fine as long as you maintain a reference to the unit in a global until you've done this check.
11-20-2007, 07:12 PM#4
midiway
Well, I'm getting the unit reference through GetHandleUnit from a timer.
So GetUnitTypeId( GetHandleUnit( timer, "field" ) ) is safe?
11-20-2007, 08:41 PM#5
rain9441
There is no safe way to use gamecache to store a unit and check if the unit is still in play.

Any method you use will not be 100% dependable.
11-20-2007, 09:09 PM#6
grim001
Don't use gamecache for something like that.
11-21-2007, 12:53 PM#7
midiway
Until I don´t find any issue using GameCache I will use Vex sugestion


Thks to all