If dying unit has buff then...

Nenad

~Choco Coronet~ Omnomnom
Reaction score
137
I made a spell that deals damage over time to a unit (based on unholy frenzy). If a unit dies while having this spell (or rather the buff) it should create a dummy unit that will cast the same ability. I made 5 different buffs (for each level of the spell) so that i can check which buff the unit has and set the dummy unit ability level. Here's the trigger:

Trigger:
  • Writihing Pain Chain
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set TempUnit = (Dying unit)
      • Set TempPoint2 = (Position of (Dying unit))
      • Set TempGroup2 = (Units within 400.00 of TempPoint2 matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of Player 1 (Red)) Equal to True)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (TempUnit has buff |cffff0000Writhing Pain|r (1)) Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: a
          • Unit - Create 1 Dummy for Player 1 (Red) at TempPoint facing Default building facing degrees
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Unit - Add Writhing Pain (dummy) to (Last created unit)
          • Unit - Set level of Writhing Pain (dummy) for (Last created unit) to 1
          • Unit - Order (Last created unit) to Undead Necromancer - Unholy Frenzy (Random unit from TempGroup2)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Dying unit) has buff |cffff0000Writhing Pain|r (2)) Equal to True
            • Then - Actions
              • Unit - Create 1 Dummy for Player 1 (Red) at TempPoint facing Default building facing degrees
              • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
              • Unit - Add Writhing Pain (dummy) to (Last created unit)
              • Unit - Set level of Writhing Pain (dummy) for (Last created unit) to 2
              • Unit - Order (Last created unit) to Undead Necromancer - Unholy Frenzy (Random unit from TempGroup)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Dying unit) has buff |cffff0000Writhing Pain|r (3)) Equal to True
                • Then - Actions
                  • Unit - Create 1 Dummy for Player 1 (Red) at TempPoint facing Default building facing degrees
                  • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
                  • Unit - Add Writhing Pain (dummy) to (Last created unit)
                  • Unit - Set level of Writhing Pain (dummy) for (Last created unit) to 3
                  • Unit - Order (Last created unit) to Undead Necromancer - Unholy Frenzy (Random unit from TempGroup)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Dying unit) has buff |cffff0000Writhing Pain|r (4)) Equal to True
                    • Then - Actions
                      • Unit - Create 1 Dummy for Player 1 (Red) at TempPoint facing Default building facing degrees
                      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
                      • Unit - Add Writhing Pain (dummy) to (Last created unit)
                      • Unit - Set level of Writhing Pain (dummy) for (Last created unit) to 4
                      • Unit - Order (Last created unit) to Undead Necromancer - Unholy Frenzy (Random unit from TempGroup)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Dying unit) has buff |cffff0000Writhing Pain|r (5)) Equal to True
                        • Then - Actions
                          • Unit - Create 1 Dummy for Player 1 (Red) at TempPoint facing Default building facing degrees
                          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
                          • Unit - Add Writhing Pain (dummy) to (Last created unit)
                          • Unit - Set level of Writhing Pain (dummy) for (Last created unit) to 5
                          • Unit - Order (Last created unit) to Undead Necromancer - Unholy Frenzy (Random unit from TempGroup)
                        • Else - Actions


However, nothing happens ( i added the game message to see if the if/then/else trigger fires, but it doesn't). Is this because the unit dies so it no longer has the buff? Or am i doing something wrong? Any suggestions on making the spell work?

Edit: It's a bit messy cause i was changing stuff just for level 1, so ignore the level 2 3 4 5 for now
 

NoobImbaPro

You can change this now in User CP.
Reaction score
60
don't put if/then/else actions under else actions, try and tell me what's happening then
 

Nenad

~Choco Coronet~ Omnomnom
Reaction score
137
don't put if/then/else actions under else actions, try and tell me what's happening then

Is there a reason not to? And i don't see how you missed my lengthy explanation, but here it is again:

I have an edited Unholy frenzy spell. I also have 5 different buffs for each level of the spell. When a unit dies under the effects of this spell, a dummy unit will be created and this dummy will cast the dummy version of this spell to a random target around the dying unit (if there is any) effectively chaining the spell. However, the problem is in the condition, as the dying unit has writhing pain buff does not fire off the actions.

> Is this because the unit dies so it no longer has the buff?

Yes.
Dead units have no buffs.

Anyway to go around this then?
 

Executor

I see you
Reaction score
57
You could add all with level one buff in a group, all with level two buff in a group ...etc. and check on death if the unit was in such a group. But you would have to use timers etc. to check if the buff's gone ..

Did you try the unit hp drop benath real value event, maybe this fires before the unit death.

Another method would be the "unit takes damage" event and check if the dealt damage would kill the unit.
 

NoobImbaPro

You can change this now in User CP.
Reaction score
60
Trigger:
  • Writihing Pain Chain
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set TempUnit = (Dying unit)
      • Set TempPoint2 = (Position of (Dying unit))
      • Set TempGroup2 = (Units within 400.00 of TempPoint2 matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of Player 1 (Red)) Equal to True)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (TempUnit has buff |cffff0000Writhing Pain|r (1)) Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: a
          • Unit - Create 1 Dummy for Player 1 (Red) at TempPoint facing Default building facing degrees
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Unit - Add Writhing Pain (dummy) to (Last created unit)
          • Unit - Set level of Writhing Pain (dummy) for (Last created unit) to 1
          • Unit - Order (Last created unit) to Undead Necromancer - Unholy Frenzy (Random unit from TempGroup2)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Dying unit) has buff |cffff0000Writhing Pain|r (2)) Equal to True
        • Then - Actions
          • Unit - Create 1 Dummy for Player 1 (Red) at TempPoint facing Default building facing degrees
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Unit - Add Writhing Pain (dummy) to (Last created unit)
          • Unit - Set level of Writhing Pain (dummy) for (Last created unit) to 2
          • Unit - Order (Last created unit) to Undead Necromancer - Unholy Frenzy (Random unit from TempGroup)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Dying unit) has buff |cffff0000Writhing Pain|r (3)) Equal to True
        • Then - Actions
          • Unit - Create 1 Dummy for Player 1 (Red) at TempPoint facing Default building facing degrees
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Unit - Add Writhing Pain (dummy) to (Last created unit)
          • Unit - Set level of Writhing Pain (dummy) for (Last created unit) to 3
          • Unit - Order (Last created unit) to Undead Necromancer - Unholy Frenzy (Random unit from TempGroup)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Dying unit) has buff |cffff0000Writhing Pain|r (4)) Equal to True
        • Then - Actions
          • Unit - Create 1 Dummy for Player 1 (Red) at TempPoint facing Default building facing degrees
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Unit - Add Writhing Pain (dummy) to (Last created unit)
          • Unit - Set level of Writhing Pain (dummy) for (Last created unit) to 4
          • Unit - Order (Last created unit) to Undead Necromancer - Unholy Frenzy (Random unit from TempGroup)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Dying unit) has buff |cffff0000Writhing Pain|r (5)) Equal to True
        • Then - Actions
          • Unit - Create 1 Dummy for Player 1 (Red) at TempPoint facing Default building facing degrees
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Unit - Add Writhing Pain (dummy) to (Last created unit)
          • Unit - Set level of Writhing Pain (dummy) for (Last created unit) to 5
          • Unit - Order (Last created unit) to Undead Necromancer - Unholy Frenzy (Random unit from TempGroup)
        • Else - Actions


Like this? Warcraft GUI can't do that with all these else actions
Use that in your teiggers from now on and not under else actions

When you add a buff to them set them in a group and then pick it and check if they died or not
 

Bogrim

y hello thar
Reaction score
154
The problem is that all buffs are wiped when the unit dies. There are two ways of working around this:

1. Add the unit to a unit group and remove it when the buff duration expires. Then check if the unit is in the group.

2. Use a Damage Detection System and check if the damage exceeds the unit's remaining health. This will allow you to detect buffs before the unit dies.
 

Nenad

~Choco Coronet~ Omnomnom
Reaction score
137
Thanks for all the help guys, however, i decided to use another spell as this one didn't fit the map ^^

+rep to all who helped though ^^
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top