A unit dies condition

Level 9
Jun 10, 2013
Greetings :D In my trigger there's an attacking unit and an attacked unit,

when the attacking unit attacks the attacked unit they both get a buff buffA/buffB now I need a condition that if the attacking unit with buffA dies then remove buffB from the attacked unit and vice versa for the attacking unit.

However I've got no idea how to go about triggering this thus any help would be greatly appreciated :).
Wc3 basic Buffs get dispelled on death -> can't be used on death Event for the dying unit.
You'll need some workaround, to indentify a unit beeing affected.

If previous posts didn't help you or are to inaccurate. A more complex solution might be appropriate, but only needed if this effect can be fired by more than one Unit.

  • If only one Unit can trigger this effect You just need to make a Reference to the Source (which is an unique Unit) and a Group (Victims).

If more than one Unit " " " " ->
This is an n-possible Attackers to m-possible Attacked problem. The problem is to know who Attacked who and vice vers.

  • You could create an dynamic Attacker-Attacked association, might be a little bit hard but would be the most accurate to be honest.
  • or use a custom Buff System which keeps a reference to the Buff-Source and make the sources to the other Unit, don't know which System does that but surely one does.
  • or use an Unit Indexer and Create an Attacker Attacked Group for each Unit to keep the associations of Attackers and Attacked.
Level 9
Jun 10, 2013
Event: A unit dies
if Dying unit has buffA, then remove buffB from Killing unit
elseif or Dying unit has buffB, then remove buffA from Killing unit
that would worked if it involved only the attacking and attacked unit but if a third unit came and killed the attacking unit (that has buffA) then the attacked unit would still have buffB :/

or use a custom Buff System which keeps a reference to the Buff-Source and make the sources to the other Unit, don't know which System does that but surely one does

I think I need that but i'm not sure, what ever route you think is best i'll go with that (your the expert :D)
Last edited:
Ok, What you have to do to use that system.

Object Editor:
  • Copie: One Buff Spellbook and Rename it. Contains the Buff
  • Copie: One Bonus Spellbock ""; contains the effect-Abilities
  • Copie: One Buff-Placer-Ability; Rename it. Inser it into your new Buff Spellbock.
  • Copie: One Buff, Rename and Modyfy it. Inser it into the Buff-Placer
  • Create your Effect-Abilites and inser them into the Bonus Spellbook
  • I guess you have to do that twice, cause you will need, A Buff for the Attacker and one for the Attacked.
The Spellbooks are hidden in the UI.

To Triggers:
  • Copie the Buff System - Folder
  • Copie the Bloodlust Trigger; Change its Event to Unit attacked and Condition whatever the Attacker/Attacked has to be/have. Change the Book References to the ones you created. Change the Buffing/Buffed unit. Copie the whole Block Inser it below and Switch Buffer/Buffing unit and change the Books.
  • Create a New Trigger- Event on Death- Condition: dying level of Buff BookA/BookB > 0;
  • with that code
    • On death
      • Ereignisse
        • Unit - A unit dies
      • Bedingungen
        • Or - Any (Conditions) are true
          • Bedingungen
            • (Level of Attacker (Buff Book) for (Triggering unit)) not 0
            • (Level of Attacked (Buff Book) for (Triggering unit)) not 0
      • Aktionen
        • For each (Integer Dispell_IntegerA) from 1 to BS_Index2, do (Actions)
          • Schleifen - Aktionen
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Bedingungen
                • BS_Buffing_Unit[Dispell_IntegerA] Gleich (Triggering unit)
                • Or - Any (Conditions) are true
                  • Bedingungen
                    • BS_Buff_Ability[Dispell_IntegerA] Gleich Attacked (Buff Book)
                    • BS_Buff_Ability[Dispell_IntegerA] Gleich Attacker (Buff Book)
              • Then - Actions
                • Set BS_Buff_Duration[Dispell_IntegerA] = 0.00
              • Else - Actions

Dr Super Good

Spell Reviewer
Level 62
Jan 18, 2005
To some extent you can intercept a unit before death, when it becomes doomed to die. The Unit is Damaged event fires after the damage is scheduled but before it is actually dealt. This means you can detect when fatal damage is being issued while the unit is still alive and has buffs. This obviously needs to be factored into any trigger made damage absorb spells. It will not detect suicides, when a unit dies due to loss of life (negative regeneration, direct HP modification) rather than damage.