1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  4. Travel to distant realms and encounter scenes unknown to the common folk. The Greatest of Adventures is upon us with the 8th Cinematic Contest. Join in on a fun ride.
    Dismiss Notice
  5. The 18th Icon Contest is ON! Choose any ingame unit and give him/her Hero abilities. Good luck to all.
    Dismiss Notice
  6. Contestants are to create a scene set in the Stone Age. Come and see what you can come up with. We wish you the best of luck!
    Dismiss Notice
  7. Colour outside the lines! Techtree Contest #13 is a go. The contest is optionally paired.
    Dismiss Notice
  8. Greetings cerebrates, our Swarm needs new spawners that will have numerous children. Join the HIVE's 31st Modeling Contest - Spawners and Spawned! The contest is optionally paired.
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
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:
    492
    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,127
    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,309
    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:
    492
    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:
    492
    Resources:
    2
    Maps:
    2
    Resources:
    2
    Anyone pls??? I really can't get it to work in my map...