UnitHasBuff not working.

Zalinian

New Member
Reaction score
0
I'm trying to have a trigger detect if a unit has a specific buff, but it fails to work even when the unit really has the buff. I've narrowed the problem down to this small bit.
The spell cast gives the Test Shield 1 buff on its target, and I need to be able to start detecting the buff from right after the spell is casted.

Trigger:
  • Buff Test
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to (==) Test Shield 1
    • Actions
      • Set temp_unit = (Target unit of ability being cast)
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (temp_unit has buff Test Shield 1 ) Equal to (==) True
          • Then - Actions
            • Game - Display to (All players) the text: has the buff
          • Else - Actions
            • Do nothing
 

canons200

New Member
Reaction score
50
some spell such as flame skill "require" some time before the buff is attached to the unit, so maybe you can change to other spell or use the action wait for 1 second
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
The problem isn't detecting the buff: you can't get the target of an ability with the Finishes Casting event. Try Starts The Effect Of...
 

Zalinian

New Member
Reaction score
0
Edit: Ok I got it to work with starts the effect and a 0.25sec delay. Thanks for help.

End Code:
Trigger:
  • Buff Test
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (==) Test Shield 1
    • Actions
      • Set temp_unit = (Target unit of ability being cast)
      • Wait 0.25 seconds
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (temp_unit has buff Test Shield 1 ) Equal to (==) True
          • Then - Actions
            • Game - Display to (All players) the text: has the buff
          • Else - Actions
            • Do nothing
 

Psiblade94122

In need of sleep
Reaction score
138
btw.... considering that the buff name and the ability name is the same... why would you need to detect the buff that the casting ability is placing? Woudent it be alot easier to just detect the spell being cast?

I mean, think about it
Lets say you cast cripple
Cripple induces cripple to the target

Why would you need to detect the buff when you can detect the ability that makes the buff (especally so since your using unit starts the effect of).
 
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