HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

UNIT_TYPE_CORPSE

01-09-2007, 07:12 PM#1
StockBreak
Unfortunately there is no such constant, is there any way to check if a picked unit is a corpse (not a dead unit, but a corpse which could be raised by a necromancer)? Thanks.
01-09-2007, 08:30 PM#2
Rising_Dusk
If a unit does not decay, it auto-removes itself on death.
Therefore if you pick a unit and try GetWidgetLife(YourUnit) < .405 and find it to be true, it is indeed a raisable corpse.
01-09-2007, 09:37 PM#3
StockBreak
Quote:
Originally Posted by Rising_Dusk
If a unit does not decay, it auto-removes itself on death.
Therefore if you pick a unit and try GetWidgetLife(YourUnit) < .405 and find it to be true, it is indeed a raisable corpse.
What is the differences between
Collapse JASS:
constant native GetUnitState takes unit whichUnit, unitstate whichUnitState returns real
and
Collapse JASS:
native GetWidgetLife takes widget whichWidget returns real
(what is a "widget")?
I'll explain better my problem:
I have an AOE spell which takes all the corpses in the area, removes them and create skeletons. When a unit casts it, I check the area and I filter the "dead" units (and this is my problem), then I remove them creating skeleton units, however:
1) It takes also the "just died" units (also those still performing dying animation);
2) It takes heroes too (I could add a filter, but...)!!!

So, my question is, is there any way to detect if a unit is a corpse (the necromancer's Raise Dead performs this check because it doesn't take dying units but only corpses)? Thanks.
01-09-2007, 09:56 PM#4
Rising_Dusk
Collapse JASS:
type unit               extends     widget  // a single unit reference
type destructable       extends     widget
type item               extends     widget
A widget is any of those data-types.

The difference is GetWidgetLife() is shorter to type and it only gets their current life.
You use GetUnitState(...) for max life, current life, current mana, and max mana.
It's a matter of preference.

Quote:
It takes also the "just died" units (also those still performing dying animation);
You could use a dummy spell based upon raise dead and loop the number of units in the area, and just create your skeletons that way if it matters that much.
Though it doesn't exactly NOT make sense, it's still a corpse if it just died.

But no, you cannot get the fleshy-check at all, unless you set a unit's custom value to some number you could check when it finishes its death animation.
Though I wouldn't recommend that, too much hardcoding and too much of a pain.

Quote:
It takes heroes too (I could add a filter, but...)!!!
Add a filter.
01-10-2007, 12:26 PM#5
blu_da_noob
Dummy unit with a 10 range raise dead ability that is created on the corpse might work (remove it instantly after order to prevent it actually casting). Corpses could theoretically be right on top of each other, but what is the chance.... (could work around with a check for other units in 10 range and move them 15 away or something... uh yeah it's workable).
01-10-2007, 04:56 PM#6
StockBreak
Actually I solved the problem using a single "Animate Dead" spell dummy casted and a "unit is summoned" trigger to detect the raise. Thanks btw :)