• 🏆 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!

Removing ability issue.

Status
Not open for further replies.
Level 12
Joined
Dec 2, 2016
Messages
733
  • Fel Beast Netted
    • Events
      • Unit - A unit Starts the effect of an ability
      • Unit - A unit Begins casting an ability
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Unit-type of (Target unit of ability being cast)) Equal to Fel Beast
      • (Ability being cast) Equal to Ensnare Main
    • Actions
      • Game - Display to (All players) the text: dsa
      • Unit - Remove Negative buffs from (Target unit of ability being cast)
      • Unit - Remove Ensnare Main from (Target unit of ability being cast)

This doesn't seem to remove the ability, yet is printing "dsa" What am I doing wrong?
 
First of all, starts the effect of an ability is fine alone, the other 2 should not be there.
Second, I am guessing that the Fel beast doesn't have the ability but the caster has it so in order to remove it use this.
  • base.gif
    Fel Beast Netted
    • joinminus.gif
      events.gif
      Events
      • line.gif
        join.gif
        unit.gif
        Unit - A unit Starts the effect of an ability
    • joinminus.gif
      cond.gif
      Conditions
      • line.gif
        join.gif
        if.gif
        (Unit-type of (Target unit of ability being cast)) Equal to Fel Beast
      • line.gif
        joinbottom.gif
        if.gif
        (Ability being cast) Equal to Ensnare Main
    • joinbottomminus.gif
      actions.gif
      Actions
      • empty.gif
        join.gif
        game.gif
        Game - Display to (All players) the text: dsa
      • empty.gif
        join.gif
        unit.gif
        Unit - Remove Negative buffs from (Target unit of ability being cast)
      • empty.gif
        joinbottom.gif
        unit.gif
        Unit - Remove Ensnare Main from (Casting unit)
 
Level 13
Joined
Oct 12, 2016
Messages
769
Basically what your trigger is doing:
Something has the "Ensnare Main" spell.
When this is cast on a Fel Beast, it removes all negative buffs (like Silence, Poison, etc.)
However, it will not remove the Ensnare Main buff, since it triggers at the start of the cast.

What exactly are you trying to do?
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
Removing the buff works, but if you are using ensnare for example, it takes time until the missile reaches the target, so the buff will only be applied some time later.
With instant cast abilities, it might still be the case, that the event fires, before the buff is applied. In that case a 0 second delay usually solves this.
 
Level 12
Joined
Dec 2, 2016
Messages
733
Removing the buff works, but if you are using ensnare for example, it takes time until the missile reaches the target, so the buff will only be applied some time later.
With instant cast abilities, it might still be the case, that the event fires, before the buff is applied. In that case a 0 second delay usually solves this.
kk thx
 
Level 13
Joined
Oct 12, 2016
Messages
769
I want to remove the ensare effect from the target unit of the ability, not the caster.
This is possible. You'll need some unit variables and some indexing with a short wait time.

EDIT:
I tried it out a couple of ways.
Setting the missile speed to 0 for ensnare and removing the missile animation didn't work.
Just tested it out with indexing. This works:
Trigger 1
  • Ensnare Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Unit-type of (Target unit of ability being cast)) Equal to Footman
      • (Ability being cast) Equal to Ensnare (Test)
    • Actions
      • Set IndexMax = (IndexMax + 1)
      • Set IndexUnit[IndexMax] = (Target unit of ability being cast)
      • Set Counter[IndexMax] = 0
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IndexMax Equal to 1
        • Then - Actions
          • Trigger - Turn on Ensnare Counter <gen>
        • Else - Actions
Trigger 2
  • Ensnare Counter
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer IndexCurrent) from 1 to IndexMax, do (Actions)
        • Loop - Actions
          • Set Counter[IndexCurrent] = (Counter[IndexCurrent] + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Counter[IndexCurrent] Equal to 1
            • Then - Actions
              • Unit - Remove Ensnare (Ground) buff from IndexUnit[IndexCurrent]
              • Unit - Remove Ensnare (General) buff from IndexUnit[IndexCurrent]
              • Unit - Remove Ensnare (Air) buff from IndexUnit[IndexCurrent]
              • Set IndexUnit[IndexCurrent] = IndexUnit[IndexMax]
              • Set Counter[IndexCurrent] = Counter[IndexMax]
              • Set IndexMax = (IndexMax - 1)
              • Set IndexCurrent = (IndexCurrent - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • IndexMax Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
I had a footman running around virtually immune to ensnare.
 
Last edited:
Level 12
Joined
Dec 2, 2016
Messages
733
This is possible. You'll need some unit variables and some indexing with a short wait time.

EDIT:
I tried it out a couple of ways.
Setting the missile speed to 0 for ensnare and removing the missile animation didn't work.
Just tested it out with indexing. This works:
Trigger 1
  • Ensnare Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Unit-type of (Target unit of ability being cast)) Equal to Footman
      • (Ability being cast) Equal to Ensnare (Test)
    • Actions
      • Set IndexMax = (IndexMax + 1)
      • Set IndexUnit[IndexMax] = (Target unit of ability being cast)
      • Set Counter[IndexMax] = 0
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IndexMax Equal to 1
        • Then - Actions
          • Trigger - Turn on Ensnare Counter <gen>
        • Else - Actions
Trigger 2
  • Ensnare Counter
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer IndexCurrent) from 1 to IndexMax, do (Actions)
        • Loop - Actions
          • Set Counter[IndexCurrent] = (Counter[IndexCurrent] + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Counter[IndexCurrent] Equal to 1
            • Then - Actions
              • Unit - Remove Ensnare (Ground) buff from IndexUnit[IndexCurrent]
              • Unit - Remove Ensnare (General) buff from IndexUnit[IndexCurrent]
              • Unit - Remove Ensnare (Air) buff from IndexUnit[IndexCurrent]
              • Set IndexUnit[IndexCurrent] = IndexUnit[IndexMax]
              • Set Counter[IndexCurrent] = Counter[IndexMax]
              • Set IndexMax = (IndexMax - 1)
              • Set IndexCurrent = (IndexCurrent - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • IndexMax Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
I had a footman running around virtually immune to ensnare.
Thanks! really appreciate that.
 
Level 13
Joined
Oct 12, 2016
Messages
769
I've got a simpler, more elegant way of doing this after some sleep:
Trigger 1:
  • Ensnare Group
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Footman
    • Actions
      • Unit Group - Add (Triggering unit) to NoEnsnareGroup
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in NoEnsnareGroup) Greater than 0
        • Then - Actions
          • Trigger - Turn on Ensnare Remove <gen>
        • Else - Actions
Trigger 2:
  • Ensnare Remove
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in NoEnsnareGroup and do (Actions)
        • Loop - Actions
          • Unit - Remove Ensnare (Air) buff from (Picked unit)
          • Unit - Remove Ensnare (General) buff from (Picked unit)
          • Unit - Remove Ensnare (Ground) buff from (Picked unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in NoEnsnareGroup) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
It's a lot less complicated, and only needs one variable. Don't remove the unit group, since you need it there to check those units.
 
Status
Not open for further replies.
Top