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

[Solved] How to Make This Ability MUI?

Status
Not open for further replies.
Level 21
Joined
May 29, 2013
Messages
1,567
I'm trying to make a passive ability that increases the unit's attack rate by 75% and movement speed by 50% for 12 seconds whenever its hit points fall below 25% of its maximum HP. This effect can only occur once every 120 seconds.

I want the ability to have a visible cooldown, so I based it on Exhume Corpses, since it's the only passive ability (that is not attack-based) which can have a visible cooldown that can be triggered at any time.

The ability should NOT activate while it's on cooldown. The speed boost should NOT be dispellable and should NOT disappear if the unit is healed above 25% HP during its duration.

Most of the triggers below were copied from somewhere in an attempt to make this MUI, but they're presumably completely nonsensical since I don't really understand the logic behind it; I just know that it doesn't work properly.

P.S. I know I should probably use a damage detection system in the second trigger, but in this case the "A unit is attacked" event is good enough as a placeholder, until I decide which DDS to use.
  • AR Add Bonuses
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Adrenaline Rush (Exhume Corpses)
    • Actions
      • Unit - Add Attack Speed Bonus (Gloves of Haste) to (Casting unit)
      • Unit - Add Movement Speed Bonus (Tornado Slow Aura) to (Casting unit)
      • Set AR_Index = (AR_Index + 1)
      • Set AR_Caster[AR_Index] = (Triggering unit)
      • Set AR_Counter[AR_Index] = 0.00
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AR_Index Equal to 1
        • Then - Actions
          • Trigger - Turn on AR Loop <gen>
        • Else - Actions
  • AR Cast
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) belongs to an enemy of (Owner of (Attacked unit))) Equal to True
      • (Level of Adrenaline Rush (Exhume Corpses) for (Triggering unit)) Greater than 0
      • (Life of (Attacked unit)) Less than ((Max life of (Attacked unit)) / 4.00)
      • (Level of Movement Speed Bonus (Tornado Slow Aura) for (Triggering unit)) Equal to 0
      • (Ability Cooldown Remaining of (Triggering unit) for ability Adrenaline Rush (Exhume Corpses)) Equal to 0.00
    • Actions
      • Custom script: call IssueImmediateOrderById( GetTriggerUnit(), 852537)
      • -------- 852537 is the order ID of Exhume Corpses --------
  • AR Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer AR_Loop_Integer) from 1 to AR_Index, do (Actions)
        • Loop - Actions
          • Set AR_Counter[AR_Loop_Integer] = (AR_Counter[AR_Loop_Integer] + 1.00)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • AR_Counter[AR_Loop_Integer] Greater than or equal to 12.00
            • Then - Actions
              • Set AR_Caster[AR_Loop_Integer] = AR_Caster[AR_Index]
              • Set AR_Counter[AR_Loop_Integer] = AR_Counter[AR_Index]
              • Set AR_Index = (AR_Index - 1)
              • Set AR_Loop_Integer = (AR_Loop_Integer - 1)
              • Unit - Remove Movement Speed Bonus (Tornado Slow Aura) from AR_Caster[AR_Loop_Integer]
              • Unit - Remove Attack Speed Bonus (Gloves of Haste) from AR_Caster[AR_Loop_Integer]
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • AR_Index Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
Not sure which version you're using, but in the newer patches you can trigger the cooldown for Exhume Corpses like so:
  • Unit - For Unit (Triggering unit), start cooldown of ability Adrenaline Rush (Exhume Corpses) " over "120.00 seconds.
Then you can move the Actions from AR Add Bonuses to AR Cast (You could actually do this now and save yourself a trigger).

Also, in AR Loop, you want to Remove the speed abilities from AR_Caster BEFORE you change the rest of the variables. So move those 2 actions to the very top of your If Then Else.

With those changes it should work fine.

And this method is called dynamic indexing, there's a link to it in my signature. Here's a poor explanation:

Let's say 3 units are affected by Adrenaline Rush.
In this case AR_Index will be equal to 3 and AR_Loop will loop from 1 to 3 every 1.00 second.

When AR_Caster[1]'s duration has completed, AR_Caster[1] is set to AR_Caster[3], AR_Counter[1] is set to AR_Counter[3] and AR_Index/AR_Loop_Integer are reduced by 1.

As a result of this, AR_Index is now equal to 2 and AR_Loop will loop from 1 to 2.

Since AR_Loop_Integer is reduced by 1, the Loop will actually run through the same Index again. So it just finished looping through Index 1 of 3, and now it will loop through Index 1 of 2.

But this time it won't reference the original AR_Caster[1], it will instead reference AR_Caster[3], since we've set AR_Caster[1] to be equal to AR_Caster[3]. Same goes for AR_Counter.

Then once AR_Caster[3] (aka the new AR_Caster[1]) is completed, the process will repeat, but this time setting AR_Caster[1]/AR_Counter[1] to AR_Caster[2]/AR_Counter[2].

This process repeats on and on until the very last unit is removed from the Loop.

For the last unit, AR_Caster/AR_Counter [1] would be set to AR_Caster/AR_Counter [1], which obviously doesn't do anything. That's fine since AR_Index would be set to 0 and the trigger would be turned off.
 
Last edited:
Level 21
Joined
May 29, 2013
Messages
1,567
Not sure which version you're using, but in the newer patches you can trigger the cooldown for Exhume Corpses like so:
  • Unit - For Unit (Triggering unit), start cooldown of ability Adrenaline Rush (Exhume Corpses) " over "120.00 seconds.
I'm using patch 1.29.2; I can reset the ability cooldown and set it to a specific value, but it looks like I can't make the cooldown start on its own without using the ability.
Also, in AR Loop, you want to Remove the speed abilities from AR_Caster BEFORE you change the rest of the variables. So move those 2 actions to the very top of your If Then Else.

With those changes it should work fine.

And this method is called dynamic indexing, there's a link to it in my signature. Here's a poor explanation:
I've heard of dynamic indexing before, but it always seemed too complicated for me until now. Thank you so much for the detailed explanation!
 
Status
Not open for further replies.
Top