Detecting if a unit is dead

Laiev

Hey Listen!!
Reaction score
188
>> I've also heard that 0.405 is better than 0, is this true?

The reason is because an unit die when life become 0.405 and not 0

[ljass]GetUnitState(GetTriggerUnit(), UNIT_STATE_LIFE) > 0.405 //never use it lol[/ljass]
[ljass]GetWidgetLife(GetTriggerUnit()) > 0.405 //good and fast but can bug if you increase the life of unit when he's death[/ljass]
[ljass]IsUnitType(GetTriggerUnit(), UNIT_TYPE_DEAD) //idk... not too bad and not too good[/ljass]
[ljass]UnitAlive(GetTriggerUnit()) //better in my opnion[/ljass]
 

Tamisrah

Active Member
Reaction score
16
So GetWidgetLife is faster than GetUnitState or is it just fast on it own?
Most of the time I do use "GetUnitState(GetTriggerUnit(), UNIT_STATE_LIFE) > 0.405".
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Yupp, quite a lot faster, and easier to use too ;)

Though the AI native [ljass]UnitAlive(whichUnit)[/ljass] is even better :D
 

Laiev

Hey Listen!!
Reaction score
188
i'm with komaqtion but remember, you need to declare it in your code

[ljass]native UnitAlive takes unit id returns boolean[/ljass]
 

Bribe

vJass errors are legion
Reaction score
67
There is a problem with using UnitAlive with Vexorian's map optimizer.

If you have the option "shorten function names" enabled, the stupid optimizer shortens the name of the native, as well, which makes it unable to function when you try to play the map later. Lame.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top