• 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 or similiar?

Status
Not open for further replies.
Level 5
Joined
Sep 21, 2005
Messages
119
I was wondering if there was a JASS way to detect this, as I have a problem with my items having doodad models like outland flowers, and when they die, they basically freeze on the map and i can't find any way to remove their "dead" model.. is there a way to do this?

Thanks,
~Gloom
 
Level 5
Joined
Sep 21, 2005
Messages
119
Just so you guys know, this SUPPOSEDLY works, but I don't use newgen, so I can't add it in:

Code:
library Typecast

    globals
        private hashtable ht = InitHashtable()
    endglobals

    function Widget2Item takes widget w returns item
        call SaveWidgetHandle(ht, 0, 0, w)
        return LoadItemHandle(ht, 0, 0)
    endfunction

endlibrary

Add the library


Code:
local widget w

set w = GetLastCreatedItem()   
call TriggerRegisterDeathEvent( gg_Item_Remove, w)

Add this to all the Crop Triggers

Code:
function Item_Remove takes nothing returns nothing
    call RemoveItem(Widget2Item(GetTriggerWidget()))
endfunction

//===========================================================================
function Init_Item_Remove takes nothing returns nothing
    set gg_Item_Remove = CreateTrigger(  )
    call TriggerAddAction( gg_Item_Remove, function Item_Remove )
endfunction

Add this trigger

You should be able to figure it out =]
 
Status
Not open for further replies.
Top