• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Remove buff problem

Status
Not open for further replies.
Level 4
Joined
Sep 6, 2012
Messages
88
Hi everyone !

I have a spell based on Cripple, and I create a trigger so that:

-If the target has no Cripple buff, the spell applies the buff.
-If the target has Cripple buff, the buff is removed and the target is damaged.

Here's the trigger:

  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Cripple
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • ((Target unit of ability being cast) has buff Cripple ) Equal to True
      • Then - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Level of Cripple for (Triggering unit)) Equal to 1
          • Then - Actions
            • Set Temp_Real = ((Life of (Target unit of ability being cast)) x 0.40)
            • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) x 0.60)
          • Else - Actions
            • Set Temp_Real = ((Life of (Target unit of ability being cast)) x 0.80)
            • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) x 0.20)
        • Unit - Remove Cripple buff from (Target unit of ability being cast)
      • Else - Actions
However, as I test the trigger, targets get damaged, but the buff isn't removed. Anyone can help me solve this problem ?

Thank you very much !
 
its because the newly casted cripple adds the buff after that event fires...

and your spell actually works because of that fact... because if the buff is added before that event, then it will always deal damage + remove buff...

so the thing that makes your spell work is also the one that causes your problems... :)

a workaround is to use another buff-placer + dummy casters... so like you have Cripple1 and Cripple2...

Cripple1 will be the ability your unit has, it won't have any buff and effects (so preferably, base it on Channel)
Cripple2 will be the ability for the dummy caster, it will have the buff and all the cripple effects

now when you cast cripple1, check if it has the cripple2 buff, if yes, then do your actions...

if it doesn't have the buff, create the dummy caster and make it cast cripple2 to the target...
 
Status
Not open for further replies.
Top