Hi,
I'm creating a unit which can possess corpses. It has an ability which targets the closest available (as in not claimed for possession by another unit with the same ability) corpse in an AoE around itself, then causes the unit to beeline for the corpse, whereupon both the unit and the corpse are destroyed and a skeleton is spawned. When the skeleton is destroyed, the original unit is returned, with the unit's original health, and with the Enter Corpse spell put on cooldown.
It works fine, except it doesn't work on corpses coming out of the Graveyard's Create Corpse ability.
My current code to filter for skeletons is "GetUnitState(u, UNIT_STATE_LIFE) <= 0". If true, it's a corpse, if not, it's not. Obviously, this filter is insufficient.
What's the most efficient way to group together ALL corpses (and only corpses) in an AoE, regardless of how they're spawned?
Thanks.
I'm creating a unit which can possess corpses. It has an ability which targets the closest available (as in not claimed for possession by another unit with the same ability) corpse in an AoE around itself, then causes the unit to beeline for the corpse, whereupon both the unit and the corpse are destroyed and a skeleton is spawned. When the skeleton is destroyed, the original unit is returned, with the unit's original health, and with the Enter Corpse spell put on cooldown.
It works fine, except it doesn't work on corpses coming out of the Graveyard's Create Corpse ability.
My current code to filter for skeletons is "GetUnitState(u, UNIT_STATE_LIFE) <= 0". If true, it's a corpse, if not, it's not. Obviously, this filter is insufficient.
What's the most efficient way to group together ALL corpses (and only corpses) in an AoE, regardless of how they're spawned?
Thanks.