Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

If unit loses buff?

Discussion in 'Triggers & Scripts' started by Dinodin, Feb 12, 2010.

  1. Dinodin

    Dinodin

    Joined:
    Jul 19, 2007
    Messages:
    538
    Resources:
    2
    Maps:
    2
    Resources:
    2
    Is there anyway to make a trigger that stuns an unit if it loses a specific buff? I really need this to a spell, pls help!
     
  2. ED_Reborn

    ED_Reborn

    Joined:
    Jan 9, 2010
    Messages:
    85
    Resources:
    0
    Resources:
    0
    There is no event detecting this.

    The closest you could come would be checking for the buff every (something) seconds. Kinda inefficient but I think it would be the only way.

    As for the stun you would have to make a dummy caster cast a custom spell with a stun in it.
     
    Last edited: Feb 12, 2010
  3. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,128
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    Well, the specific buff is of an ability, right? What's its duration? Get it, and do this:
    • Trigger
    • Events
      • Map Initialization
    • Conditions
    • Actions
      • Hashtable - Create a Hashtable
      • Set Hashtable = Last created Hashtable

    • Trigger1
    • Events
      • Unit - A unit starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to X
    • Actions
      • Hashtable - Save Timer1 as (Key(duration)) of (Key(Target unit of ability being cast)) in Hashtable
      • Countdown Timer - Start (Load (Key(duration) of (Key(Target unit of ability being cast)) in Hashtable) as a one-shot timer that will expire in 5.00 seconds [Change 5.00 to the duration of the spell]
      • Hashtable - Save (Target unit of ability being cast) as (Key(unit)) of (Key(Last started timer) in Hashtable
      • Hashtable - Save (Triggering unit) as (Key(unit1)) of (Key(Last started timer) in Hashtable

    • Trigger2
    • Events
      • Time - Timer1 expires
    • Conditions
      • ((Load (Key(unit)) of (Key(Expiring timer)) from Hashtable) has (your buff)) Equal to False
    • Actions
      • Set Point1 = (Position of (Load (Key(unit)) of (Key(Expiring Timer)) from Hashtable)
      • Unit - Create 1 dummy for (Owner of (Load (Key(unit1)) of (Key(Expiring Timer)) from Hashtable) at Point1 facing default building degrees
      • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Load (Key(unit)) of (Key(Expiring Timer)) from Hashtable)
      • Unit - Add a 1.00 seconds Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation (udg_Point1)
      • Hashtable - Clear all child hashtables of child (Key(Load (Key(unit)) of (Key(Expiring Timer)))) in Hashtable
      • Hashtable - Clear all child hashtables of child (Key(Expiring Timer)) in Hashtable
     
  4. Maximilianx

    Maximilianx

    Joined:
    Oct 14, 2008
    Messages:
    334
    Resources:
    0
    Resources:
    0
    And if that unit gets purged? It will lose it's buff but not be stunned for a few more seconds, a much faster periodic timer detecting whether the unit still has the buff is the most efficient way to do it. Creating a dummy to cast a stun on the target and destroying the timer when the buff is lost.
     
  5. tjordell

    tjordell

    Joined:
    Jan 25, 2009
    Messages:
    554
    Resources:
    5
    Icons:
    1
    Spells:
    4
    Resources:
    5
    Well do this then

    • Trigger
    • Events
      • Map Initialization
    • Conditions
    • Actions
      • Hashtable - Create a Hashtable
      • Set Hashtable = Last created Hashtable

    • Trigger1
    • Events
      • Unit - A unit starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to X
    • Actions
      • Hashtable - Save Timer1 as (Key(duration)) of (Key(Target unit of ability being cast)) in Hashtable
      • Countdown Timer - Start (Load (Key(duration) of (Key(Target unit of ability being cast)) in Hashtable) as a one-shot timer that will expire in 5.00 seconds [Change 5.00 to the duration of the spell]
      • Hashtable - Save (Target unit of ability being cast) as (Key(unit)) of (Key(Last started timer) in Hashtable
      • Hashtable - Save (Triggering unit) as (Key(unit1)) of (Key(Last started timer) in Hashtable

    • Trigger2
    • Events
      • Time - Timer1 expires
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Or - Any (Conditions) are true
      • Conditions
        • (Ability being cast) Equal to Purge
        • ((Load (Key(unit)) of (Key(Expiring timer)) from Hashtable) has (your buff)) Equal to True
    • Actions
      • Set Point1 = (Position of (Load (Key(unit)) of (Key(Expiring Timer)) from Hashtable)
      • Unit - Create 1 dummy for (Owner of (Load (Key(unit1)) of (Key(Expiring Timer)) from Hashtable) at Point1 facing default building degrees
      • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Load (Key(unit)) of (Key(Expiring Timer)) from Hashtable)
      • Unit - Add a 1.00 seconds Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation (udg_Point1)
      • Hashtable - Clear all child hashtables of child (Key(Load (Key(unit)) of (Key(Expiring Timer)))) in Hashtable
      • Hashtable - Clear all child hashtables of child (Key(Expiring Timer)) in Hashtable
     
  6. DarkAngelAzazel

    DarkAngelAzazel

    Joined:
    Sep 14, 2008
    Messages:
    1,308
    Resources:
    0
    Resources:
    0
    Just detect when the ability is cast:

    Then add the targeted unit to a unit group:

    Use a ~0.3 periodic timer to check which units in that unit group still have the buff
     
  7. Dinodin

    Dinodin

    Joined:
    Jul 19, 2007
    Messages:
    538
    Resources:
    2
    Maps:
    2
    Resources:
    2
    Can anyone pls help me get this to work in my map? I've tried to do it but my map just becomes buggy. If u wanna help message me and I'll send the map.
     
  8. Dinodin

    Dinodin

    Joined:
    Jul 19, 2007
    Messages:
    538
    Resources:
    2
    Maps:
    2
    Resources:
    2
    Anyone pls??? I really can't get it to work in my map...