• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

detect unit has finished animation?

Status
Not open for further replies.

Chaosy

Tutorial Reviewer
Level 41
Joined
Jun 9, 2011
Messages
13,239
There is no good way to do this as far as I know.

You can manually check how long the animation lasts in the model preview window and then just wait that long with the code. However all units do obviously not have attack animations that last for exactly the same time so in some maps it wont work.

If you decide to wait for one second it will more or less suit most animaions because they are between 0.8 and 1.5 seconds most of the time.
 
Level 23
Joined
Feb 6, 2014
Messages
2,466
I'll assume you want to deal damage after the animation, then in that case you could use:
  • Events
  • Unit - Unit Finishes Casting An Ability
with the Channel Ability with a Follow Through Time.
The Follow Through Time will dictate how long the unit will play the animation before the effects start, so go trial and error until you find the appropriate Follow Through Time that matches the animation.

Note: It may not match every unit type's attack animation.
 
Level 10
Joined
Jun 17, 2014
Messages
236
There is no good way to do this as far as I know.

You can manually check how long the animation lasts in the model preview window and then just wait that long with the code. However all units do obviously not have attack animations that last for exactly the same time so in some maps it wont work.

If you decide to wait for one second it will more or less suit most animaions because they are between 0.8 and 1.5 seconds most of the time.

i want to make it MUI, here is my whole trigger

  • CP
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Colt Phyton
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Colt_IndexSize Equal to 0
        • Then - Actions
          • Trigger - Turn on CP Loop <gen>
        • Else - Actions
      • Set Colt_IndexSize = (Colt_IndexSize + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Colt_IndexSize Greater than Colt_MaxIndex
        • Then - Actions
          • Set Colt_Index[Colt_IndexSize] = Colt_IndexSize
          • Set Colt_MaxIndex = Colt_IndexSize
        • Else - Actions
      • Set Colt_TempInt = Colt_Index[Colt_IndexSize]
      • Set Colt_Caster[Colt_TempInt] = (Triggering unit)
      • Set Colt_Target[Colt_TempInt] = (Target unit of ability being cast)
      • Set Colt_Level[Colt_TempInt] = (Level of Colt Phyton for Colt_Caster[Colt_TempInt])
      • Set Colt_Damage_Base[1] = 250.00
      • Set Colt_Damage_Base[2] = 375.00
      • Set Colt_Damage_Base[3] = 500.00
      • Set Colt_Damage_Base[4] = 350.00
      • Set Colt_Damage_Base[5] = 550.00
      • Set Colt_Damage_Base[6] = 750.00
      • Set Colt_DamageN[Colt_TempInt] = (UnitAttack[UDex] + Colt_Damage_Base[Colt_Level[Colt_TempInt]])
      • Set Colt_DamageG[Colt_TempInt] = (UnitAttack[UDex] + Colt_Damage_Base[(3 + Colt_Level[Colt_TempInt])])
      • Set Colt_Loc1[Colt_TempInt] = (Position of Colt_Caster[Colt_TempInt])
      • Set Colt_Loc2[Colt_TempInt] = (Position of Colt_Target[Colt_TempInt])
      • Set Colt_Dis[Colt_TempInt] = (Distance between Colt_Loc1[Colt_TempInt] and Colt_Loc2[Colt_TempInt])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Colt_Dis[Colt_TempInt] Less than or equal to 800.00
        • Then - Actions
          • Set Colt_RealDamage[Colt_TempInt] = Colt_DamageN[Colt_TempInt]
          • Unit - Pause Colt_Caster[Colt_TempInt]
          • Animation - Play Colt_Caster[Colt_TempInt]'s Spell Chain animation
          • Unit - Unpause Colt_Caster[Colt_TempInt]
          • Unit - Create 1 Shade EFX for (Owner of Colt_Caster[Colt_TempInt]) at Colt_Loc1[Colt_TempInt] facing Default building facing degrees
          • Set Colt_Dumu[Colt_TempInt] = (Last created unit)
          • Set Colt_Loc3[Colt_TempInt] = (Position of Colt_Dumu[Colt_TempInt])
          • Custom script: call RemoveLocation (udg_Colt_Loc1[udg_Colt_TempInt])
          • Custom script: call RemoveLocation (udg_Colt_Loc2[udg_Colt_TempInt])
        • Else - Actions
          • Set Colt_RealDamage[Colt_TempInt] = Colt_DamageG[Colt_TempInt]
          • Unit - Pause Colt_Caster[Colt_TempInt]
          • Animation - Play Colt_Caster[Colt_TempInt]'s Spell Channel animation
          • Unit - Unpause Colt_Caster[Colt_TempInt]
          • Unit - Pause Colt_Caster[Colt_TempInt]
          • Animation - Play Colt_Caster[Colt_TempInt]'s Spell Chain animation
          • Unit - Unpause Colt_Caster[Colt_TempInt]
          • Unit - Create 1 Shade EFX for (Owner of Colt_Caster[Colt_TempInt]) at Colt_Loc1[Colt_TempInt] facing Default building facing degrees
          • Set Colt_Dumu[Colt_TempInt] = (Last created unit)
          • Set Colt_Loc3[Colt_TempInt] = (Position of Colt_Dumu[Colt_TempInt])
          • Custom script: call RemoveLocation (udg_Colt_Loc1[udg_Colt_TempInt])
          • Custom script: call RemoveLocation (udg_Colt_Loc2[udg_Colt_TempInt])
  • CP Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Colt_Looper) from 1 to Colt_IndexSize, do (Actions)
        • Loop - Actions
          • Set Colt_TempInt = Colt_Index[Colt_Looper]
          • Set Colt_Loc3[Colt_TempInt] = (Position of Colt_Dumu[Colt_TempInt])
          • Set Colt_Loc2[Colt_TempInt] = (Position of Colt_Target[Colt_TempInt])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Colt_Target[Colt_TempInt] is alive) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between Colt_Loc3[Colt_TempInt] and Colt_Loc3[Colt_TempInt]) Greater than 20.00
                • Then - Actions
                  • Set Colt_Angle[Colt_TempInt] = (Angle from Colt_Loc2[Colt_TempInt] to Colt_Loc3[Colt_TempInt])
                  • Set Colt_Loc4[Colt_TempInt] = (Colt_Loc3[Colt_TempInt] offset by (1200.00 x 0.03) towards Colt_Angle[Colt_TempInt] degrees)
                  • Unit - Move Colt_Dumu[Colt_TempInt] instantly to Colt_Loc4[Colt_TempInt]
                  • Custom script: call RemoveLocation (udg_Colt_Loc4[udg_Colt_TempInt])
                  • Custom script: call RemoveLocation (udg_Colt_Loc2[udg_Colt_TempInt])
                • Else - Actions
                  • Unit - Cause Colt_Caster[Colt_TempInt] to damage Colt_Target[Colt_TempInt], dealing Colt_RealDamage[Colt_TempInt] damage of attack type Hero and damage type Normal
                  • Unit - Kill Colt_Dumu[Colt_TempInt]
                  • Set Colt_Index[Colt_Looper] = Colt_Index[Colt_IndexSize]
                  • Set Colt_Index[Colt_IndexSize] = Colt_TempInt
                  • Set Colt_IndexSize = (Colt_IndexSize - 1)
                  • Set Colt_Looper = (Colt_Looper - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Colt_IndexSize Equal to 0
                    • Then - Actions
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
            • Else - Actions
              • Set Colt_Index[Colt_Looper] = Colt_Index[Colt_IndexSize]
              • Set Colt_Index[Colt_IndexSize] = Colt_TempInt
              • Set Colt_IndexSize = (Colt_IndexSize - 1)
              • Set Colt_Looper = (Colt_Looper - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Colt_IndexSize Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
here is my spell description : Barbossa's favorite gun. he use it to shot his enemy arm mainly to disable their attacks. enemies arm that got shotted from this gun receive damage and get their attacks disabled for 2 Second if the target range is less than 800 range. but if the enemy range is far more greater than 800 range, Barbossa will use his scope to get the better view of his target, and after few seconds, he will shot the enemies vital spots. deals greater damage and instant kill if the enemy hp is below 15%. max 1500 range.

if distance between target and caster is > 800, caster will shot target (Spell Chain) else caster will play scope animation (Spell Channel) after animation end, caster will shot target (Spell Chain)

sadly caster does'nt do anything.
and if i use wait, the spell not MUI anymore

I'll assume you want to deal damage after the animation, then in that case you could use:
  • Events
  • Unit - Unit Finishes Casting An Ability
with the Channel Ability with a Follow Through Time.
The Follow Through Time will dictate how long the unit will play the animation before the effects start, so go trial and error until you find the appropriate Follow Through Time that matches the animation.

Note: It may not match every unit type's attack animation.

and this does'nt work ;-;
 
Level 14
Joined
Oct 18, 2013
Messages
724
As other have said, you can find the duration of a specific animation. All you should need to do is just play that animation and start a timer for the duration of the animation. Hook the spell onto a trigger that runs when that timer ends.
 
Level 14
Joined
Oct 18, 2013
Messages
724
You might have to use an integer or real if you want it to be MUI, and make a timer using them. If the animation is 0.66s long, you would pry want the periodic trigger run every 0.03s, and set the integer for that instance at 22.

Every time it runs, it checks to see if the integer is at 0, and if it is then run the spell or whatever. The integer variable would have to be an array, of course, but this could definitely be MUI.
 

Chaosy

Tutorial Reviewer
Level 41
Joined
Jun 9, 2011
Messages
13,239
After reading the description, I'm pretty sure my suggestiion would work. But meh, too lazy to create a test map.

It would not.

The animation duration is (likely) not the same of all units. Thus the animation is not necessarily finished when the spell goes on cooldown. Do not confuse animation with cast time.
Would be kinda funny if stormbolt had a 1 second cast time (due the animation being 1 second long) while it has a 2 second casttime for a paladin (just an example).
 
Level 23
Joined
Feb 6, 2014
Messages
2,466
It would not.

The animation duration is (likely) not the same of all units. Thus the animation is not necessarily finished when the spell goes on cooldown. Do not confuse animation with cast time.
Would be kinda funny if stormbolt had a 1 second cast time (due the animation being 1 second long) while it has a 2 second casttime for a paladin (just an example).

That's why I said do a trial and error until the follow through time matches the animation duration. He's using it for a single unit (Barbossa)

And it's channeling time not casting time, they're different.
 
Level 10
Joined
Jun 17, 2014
Messages
236
You might have to use an integer or real if you want it to be MUI, and make a timer using them. If the animation is 0.66s long, you would pry want the periodic trigger run every 0.03s, and set the integer for that instance at 22.

Every time it runs, it checks to see if the integer is at 0, and if it is then run the spell or whatever. The integer variable would have to be an array, of course, but this could definitely be MUI.

what would the array refer to? the TempInt?

A common misconception

yeah, i know we can use Magtheridon96 Mui Triggres with Waits tutorial, but my trigger has Loop, how can i do that?

I should use Kakerate suggestion first
 
Level 10
Joined
Jun 17, 2014
Messages
236
You might have to use an integer or real if you want it to be MUI, and make a timer using them. If the animation is 0.66s long, you would pry want the periodic trigger run every 0.03s, and set the integer for that instance at 22.

Every time it runs, it checks to see if the integer is at 0, and if it is then run the spell or whatever. The integer variable would have to be an array, of course, but this could definitely be MUI.

Thankyou its work!

+REP who try to help me
 
Status
Not open for further replies.
Top