• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Event - item dies??

Status
Not open for further replies.
Level 7
Joined
May 3, 2007
Messages
210
Not directly, there is EVENT_WIDGET_DEATH, which item extends a widget, but that still references a unit in the actual triggerregisterevent. In order to know when an item dies you're going to have to save the item in a Cache or using GetHandleId, either whenever it is referenced by the normal item events (Acquired, droped, used, pawned, etc) or when it is attacked (Unit issue order object), or when you yourself place it.

Then when a unit attacks the given item you can check its health, and when you return 0 its dead. You can check for its life using GetWidgetLife(). There are probably multiple ways of generating a reference for every item, saving, and then checking the reference, but that's how it will have to be done.

I'm sorry I completely lied to you:

JASS:
>

native TriggerRegisterDeathEvent takes trigger whichTrigger, widget whichWidget returns event

<

This event does register the death of a widget. Albiet you still have to reference the given item specifically.

There is also this: http://www.wc3c.net/showthread.php?t=105971&highlight=Item+Death
 
Last edited:
Status
Not open for further replies.
Top