What if the unit is not an ally of the other unit? Or what if he's neutral hostile or magic immune or something. There are lots of reasons why a unit would not have a buff, even though the units around him do.
Justify said:
I don't know in which order triggers are executed,
but if yours was the first, the trigger would detect a death,
while the shield trigger afterwards would heal the unit,
preventing death.
Okay, so then if a unit takes lethal damage you'll want to use hashtables to store a boolean-value to the unit so that it can be referenced from another thread.
Now, have an event that detects when a unit dies. If the dying unit's stored value is
true, then he had the buff before he died. If it is
false, he did not. Better yet, only store a value to the unit if he
does have the buff. This way, if the unit dies you can do:
JASS:
if HaveSavedBoolean( hash, GetHandleId( unit ), GetStringHash("SpecialAura") ) then
call RemoveSavedBoolean( hash, GetHandleId( unit ), StringHash("SpecialAura") )
// execute actions for a dying unit with aura buff
endif
So, if the boolean is not stored to the unit then he does not have the aura-buff, and thus you don't need to do anything. If there is a value there, then remove it from memory (not sure if this is absolutely necessary or not, better safe than sorry) and continue to execute the actions as if the unit had died with the buff.
The down-side of this is it only works when the unit is damaged. If the unit is suddenly killed (via triggers) then it will not work properly.