HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

detecting corpse usage

08-31-2009, 11:11 AM#1
fX_
so for the 2nd race-building contest i have a race that collects corpses to stitch together a Flesh Giant supreme unit.
i have this special utility building 'Graveyard' that collects the corpses of the fallen from the map. for this ability i have something that indexes corpses when they are at a graveyard so graveyards dont steal from each other. i use AutoIndex and TransportEvents to detect when a corpse is taken from a Graveyard, so it gets 'released' from the graveyard.

the problem is that these methods dont detect when corpses are Cannibalize'd. how can i detect this AND with reference to the object corpse that is eaten?

edit:
also, does anyone know how to manage:create/destroy/adjust instances of triggered ability data when abilities are added/removed/adjusted for units?

also, how to define a corpse?
this is the filter i use:
Collapse JASS:
return IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD)
but this defines also dead gargoyles as corpses... which is wrong... and i end up with 'null corpses' at my yard (lol).
maybe i can make (another) index of decaying units by the EVENT_PLAYER_UNIT_DECAY and GetDecayingUnit() + timer and AutoIndex (if this works with decays). but this is more work than just a filter and id rather do with the latter.
08-31-2009, 01:22 PM#2
Rising_Dusk
Collapse JASS:
function IsUnitCorpse takes unit u returns boolean
    return IsUnitType(u, UNIT_TYPE_DEAD) and GetUnitTypeId(u) != 0
endfunction
The first check is for dead units, the second is to make sure that your unit has not decayed/been removed. Problems arise with units that leave no corpse, but decay, so I recommend you don't have your units do that. I think that mostly covers it, but someone else will probably remember other conflicts that I've forgotten.

Try this on your gargoyles in either case. Maybe their type id's go to 0 on death.

If you just want to detect cannibalize, detect the spell effect event.
08-31-2009, 02:03 PM#3
fX_
doesnt work. gargoyles still pass as corpses.
08-31-2009, 02:15 PM#4
Rising_Dusk
And AutoIndex doesn't show them as having been removed?
08-31-2009, 02:21 PM#5
fX_
that worked

why oh why didnt i just use autoindex (which i already had) haha


edit: that unitId check worked for units used for cannibalize. after they got eaten, their unitIds were 0.
i guess i cna just do a periodic check on buried corpses... for all graveyards. maybe i could just run this check when a cannibalize spell is casted but that would require indexing all cannibalize-based spells...