• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Cooldown Detection and Attack Type Detection

Status
Not open for further replies.
Level 4
Joined
Feb 25, 2010
Messages
73
Greetings people

-I am doing a Hero Arena and i am doing a Lich hero with some custom abilities. I am having problems to do his Ult, however. The ult consists in a Passive ability. When the Lich 'dies', he soon returns to life (like Reincarnation).

I simply did a custom Reincarnation spell, however, i want to do some more things: when this 'custom reincarnation' is NOT on cooldown, the hero gains Bonus Armor and Bonus Magic Resistance. So, how you can think, if it is on cooldown, the bonuses are lost (until the spell is 'charged' again).

How i can do that? There is a method to detect the cooldown of a ability?

-Another question: there is a way to detect a 'attack type'? I am doing a spell that allow the hero to reflect the damage taken back to the unit source of the damage. However, i want the hero reflects ONLY RANGED ATTACKS AND/OR TARGETED SPELLS. There is a way to do that and detect the attack types?


Thanks for now :thumbs_up:
 
Level 9
Joined
Sep 28, 2004
Messages
365
An example. I didn't put in the trigger on how to add armor/magic resist. That is totally up to you as there are many ways to do that. But just to give you an basic idea, also its MUI:

  • Reincarnation
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Unit-type of (Triggering unit)) Equal to Footman
      • (Level of Reincarnation for (Triggering unit)) Greater than 0
    • Actions
      • -------- Set this to the same amount as your ability --------
      • Set cooldown = 60.00
      • -------- This will always be 0 as we count the current time of cooldown --------
      • Set current_Cooldown = 0.00
      • -------- Storing to hashtable --------
      • Hashtable - Save cooldown as (Key cd) of (Key (Triggering unit)) in hashtable
      • Hashtable - Save current_Cooldown as (Key ccd) of (Key (Triggering unit)) in hashtable
      • Unit Group - Add (Triggering unit) to cooldown_Group
      • Trigger - Turn on Cooldown <gen>
      • -------- Remove armor, magic resist --------
  • Cooldown
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in cooldown_Group and do (Actions)
        • Loop - Actions
          • Set cooldown = (Load (Key cd) of (Key (Picked unit)) from hashtable)
          • Set current_Cooldown = (Load (Key ccd) of (Key (Picked unit)) from hashtable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • current_Cooldown Less than cooldown
            • Then - Actions
              • -------- Increament Time --------
              • Hashtable - Save (current_Cooldown + 0.03) as (Key ccd) of (Key (Picked unit)) in hashtable
            • Else - Actions
              • -------- Cooldown ended --------
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in hashtable
              • Unit Group - Remove (Picked unit) from cooldown_Group
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in cooldown_Group) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
              • -------- Add back armor, magic resist --------
 
Status
Not open for further replies.
Top