• 🏆 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] Auto-casting (toggleable) an ability with no cast animation

Level 4
Joined
Apr 3, 2012
Messages
31
I'm attempting to create an autocast ability with a cooldown, that applies a buff to the next attack. To this end, I'm using Damage Engine to detect an attack with the buff, and remove the buff and apply bonus damage (this part works fine). For the base ability I'm using Frenzy, as Frenzy is a toggleable (autocast on/off) self-buff. Now, while it works with some fiddling (for some reason, Frenzy doesn't autocast even when enabled? but I solved it with some triggering), casting Frenzy causes the hero to play their Spell animation, which is undesirable, as it basically skips like 2 seconds and feels very clunky.

I thought about using Berserk instead, as Berserk is an ability which doesn't require an animation, however Berserk cannot be toggled to autocast. Orb effects (Searing Arrows etc.) might work, but don't go on cooldown if the unit is on Hold Position.

Basically, is there a way to create a toggleable autocast ability which doesn't cause an animation to trigger? I'm thinking something along the lines of checking if the ability is on cooldown (with a timer?) and on autocast when the unit attacks, and if it isn't, initiating the cooldown through triggers, and spawning a dummy to cast a buff on the unit. That would still play the animation if the spell is cast manually though, and also seems very convoluted.

Alternatively, I might just give up on the toggleable autocast, and just base it on Berserk, which works flawlessly except the no autocast-thing.
 
Last edited:
Level 20
Joined
Aug 29, 2012
Messages
829
Does your unit use other abilities? Otherwise you can set both these values to 0 in the unit editor

1682960222282.png


It should ensure your spells are launched pretty much instantly once you hit the button
 
Level 4
Joined
Apr 3, 2012
Messages
31
Does your unit use other abilities? Otherwise you can set both these values to 0 in the unit editor

View attachment 432715

It should ensure your spells are launched pretty much instantly once you hit the button
Unfortunately it does yes. Backswing is not a problem, but cast point does make using the other skills look and feel a bit wack.

FWIW it does work pretty well for the autocast ability though.
 
Level 20
Joined
Feb 27, 2019
Messages
592
Have you tried changing the Art - Animation Names of the ability Frenzy to something else, like stand or attack?
 
Level 4
Joined
Apr 3, 2012
Messages
31
Have you tried changing the Art - Animation Names of the ability Frenzy to something else, like stand or attack?
Intriguingly, this does seem to somewhat work, even though frenzy doesn't inherently use any animation names (default spell). Unfortunately, it still resets the swing timer, so unless you have a ton of attack speed, the unit will stand around for a bit before making the attack. Moreover, the model I use doesn't have any animations faster than a second, so that's a showstopper as well. Good thought though.
 
Level 4
Joined
Apr 3, 2012
Messages
31
It's definitely doable although I can't think of a perfect solution right now.

What version of Warcraft 3 are you using?
1.35.0.20093

I did find a solution though! Instead of making the attacking unit itself cast frenzy, I create a dummy unit, give it a bloodlust ability with the same buff, and then subtract mana and start the ability cooldown. Then I use an array timer to time, when the ability is next up (I don't think there is a condition that checks whether an ability is off cooldown? If there is, let me know). Unfortunately, the manual cast retains its animation, but I can live with that.

Here's the trigger; feel free to critique it. Doesn't have to be MUI, just MPI.

Detect if autocast is on
  • Events
    • Unit - A unit Is issued an order with no target
  • Conditions
    • Or - Any (Conditions) are true
      • Conditions
        • (Issued order) Equal to (Order(frenzyon))
        • (Issued order) Equal to (Order(frenzyoff))
      • (Level of Mutilating Strike for (Ordered unit)) Greater than 0
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Issued order) Equal to (Order(frenzyon))
      • Then - Actions
        • Set VariableSet MutilatingStrike[(Player number of (Owner of (Ordered unit)))] = True
      • Else - Actions
        • Set VariableSet MutilatingStrike[(Player number of (Owner of (Ordered unit)))] = False
Autocast
  • Events
    • Unit - A unit Is attacked
  • Conditions
    • (Level of Mutilating Strike for (Attacking unit)) Greater than 0
    • (MutilatingStrike[(Player number of (Owner of (Attacking unit)))] Equal to True
    • (Remaining time for MutilatingTimer[(Player number of (Owner of (Attacking unit)))] Equal to 0.00
    • (Mana of (Attacking unit) Greater than or equal to (25.00 + ((Real((Level of Mutilating Strike for (Attacking unit)))) x 5.00))
  • Actions
    • Set Variable TempPoint = (Position of Attacking unit)
    • Unit - Create 1 Dummy for (Owner of Attacking unit) at TempPoint facing Default building facing degrees
    • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
    • Unit - Add Mutilating Strike (Dummy) to (Last created unit)
    • Unit - Order (Last created unit) to Orc Shaman - Bloodlust Attacking Unit
    • Unit - For Unit Attacking unit, start cooldown of ability Mutilating Strike " over "14.00 seconds.
    • Unit - Set mana of (Attacking unit) to ((Mana of (Attacking unit)) - (25.00 + ((real((Level of Mutilating Strike for (Attacking unit)))) x 5.00)))
    • Animation - Play (Attacking unit)'s attack slam animation
    • Countdown Timer - Start MutilatingTimer[(Player number of (Owner of (Attacking unit))] as a One-shot timer that will expire in 14.00 seconds
    • Custom script: call RemoveLocation(udg_TempPoint)
Manual cast
  • Events
    • Unit . A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Mutilating Strike
  • Actions
    • Countdown Timer - Start MutilatingTimer[(Player number of (Owner of (Attacking unit))] as a One-shot timer that will expire in 14.00 seconds
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,555
There is a Real condition that gets you the current cooldown of an ability. If it's <= 0.00 then you know the ability is ready.

It looks good, although I would personally use more variables in the Autocast trigger to avoid any potential issues. Here's how it looks with some improvements:
  • Events
    • Unit - A unit Is attacked
  • Conditions
    • (Level of Mutilating Strike for (Attacking unit)) Greater than 0
    • (MutilatingStrike[(Player number of (Owner of (Attacking unit)))] Equal to True
    • (Ability Cooldown Remaining of (Attacking unit) for ability Mutilating Strike..) Less than or equal to 0.00
    • (Mana of (Attacking unit) Greater than or equal to (25.00 + ((Real((Level of Mutilating Strike for (Attacking unit)))) x 5.00))
  • Actions
    • Set Variable MStrike_Caster = (Attacking unit)
    • Set Variable TempPoint = (Position of MStrike_Caster)
    • Unit - Create 1 Dummy for (Owner of MStrike_Caster) at TempPoint facing Default building facing degrees
    • Custom script: call RemoveLocation(udg_TempPoint)
    • Set Variable MStrike_Dummy = (Last created unit)
    • Unit - Add a 0.10 second Generic expiration timer to MStrike_Dummy
    • Unit - Add Mutilating Strike (Dummy) to MStrike_Dummy
    • Unit - Order MStrike_Dummy to Orc Shaman - Bloodlust MStrike_Caster
    • Unit - For Unit MStrike_Caster, start cooldown of ability Mutilating Strike " over "14.00 seconds.
    • Unit - Set mana of MStrike_Caster to (MStrike_Caster) - (25.00 + ((real((Level of Mutilating Strike for MStrike_Caster)) x 5.00)))
    • Animation - Play MStrike_Caster's attack slam animation
If the Dummy is setup properly then you shouldn't need to keep it alive for more than a frame.
 
Last edited:
Level 4
Joined
Apr 3, 2012
Messages
31
There is a Real condition that gets you the current cooldown of an ability. If it's <= 0.00 then you know the ability is ready.

It looks good, although I would personally use more variables in the Autocast trigger to avoid any potential issues. Here's how it looks with some improvements:

If the Dummy is setup properly then you shouldn't need to keep it alive for more than a frame.

Great, thanks a lot :)
 
Top