Detecting buffs on death

jwallstone

New Member
Reaction score
33
When using the event A Unit Dies, can you check for buffs on the unit, or do all the buffs disappear before the trigger runs?

I am trying to do that right now, and for some reason, the unit is killed by a Soul Burn buff, but checking whether the unit has that buff returns false.

By the way, checking Buffs uses GetUnitAbilityLevel. Can I use this to detect the level of the spell that was cast on it? For example, if Soul Burn level 2 was cast on the unit, does GetUnitAbilityLevel return 2 for the buff? Hovering the mouse over the buff certainly seems to suggest that the buff has a level.
 

Squirel

New Member
Reaction score
13
What is the goal of your trigger, someone may be able to suggest a different way to go about it, and plus your description is vague at best...
 

Squirel

New Member
Reaction score
13
I assume that since the dead unit has no buffs, no. What are you trying to do so someone can help you out, maybe suggest an alternate way to achieve your goal.
 

worldofDeath

New Member
Reaction score
47
Here you go this is what your looking for:

A unit that dies cannot have a buff on him so... Youll have to do a trigger that picks every unit in playable map and does these actions like so:

Trigger:
  • Add Every one to group
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff (YOUR BUFF) ) Equal to (==) True
            • Then - Actions
              • Unit Group - Add (Picked unit) to (THIS IS A VARIABLE YOU MAKE)
            • Else - Actions


You can also make it where the unit can only be an allied unit and has this buff.
The variable to set up would be a unit group. After this step is complete then:

Trigger:
  • Some One dies with buff
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in (YOUR VARIABLE GROUP THAT YOU SET UP)) Equal to (==) True
      • ((Dying unit) is A Hero) Equal to (==) True
    • Actions
      • Set Multipoint4[10] = (Position of (Dying unit))
      • Special Effect - Create a special effect at Multipoint4[10] using Objects\Spawnmodels\Undead\UndeadDissipate\UndeadDissipate.mdl


There you go this trigger will make the event that if a unit dies and it is in the unit group(which its only in the unit group if it has that buff) then it will do the following actions. And I just added some extra actions for you.

Hope this helps!
 

jwallstone

New Member
Reaction score
33
Thanks! I was hoping that the Unit Dies event would be triggered before the game destroyed all interesting information about the unit.

I'm trying to get the unit to explode on death (Kaboom!) and I got it to work by attaching an integer to the unit when the Soul Burn is cast on it to indicate that it's marked.

Interestingly, the dummy unit that casts Kaboom can still successfully use that ability on the dying unit during the Action of the "Unit Dies" trigger, so the dying unit is still "around" in some sense.
 

worldofDeath

New Member
Reaction score
47
Forgot to add this. Dont know if you did this but, you have to have a trigger that checks to make sure the unit isnt in the buff any more. The reason it is casted is bec it is an AOE move and does not need a target. Well the target is the area the unit had the buff died. So im glad that worked out. Let me know if you have any other questions.

Trigger:
  • Remove Every one from group
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff (YOUR BUFF) ) Equal to (==) False
            • Then - Actions
              • Unit Group - Remove (Picked unit) from (YOUR GROUP)
            • Else - Actions
 

jwallstone

New Member
Reaction score
33
Thanks for all the help. For now, the ability is designed to last until the unit dies, so I don't need to check if the buff is gone if I stick with this. I realized the need to do so though, if I decide to give it a duration later on.

Since I prefer to stay away from triggers that are always running (i.e. trying to reduce overall trigger executions), I decided I would simply retrieve the elapsed game time and store it on the unit. Then, upon death, double check that the current game time is not past the stored game time + ability duration.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top