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

Attack animation problem

Status
Not open for further replies.
Level 5
Joined
Jan 23, 2014
Messages
152
Hi! I downloaded a custom model that has 2 attack animations, one is named just "attack" and the other is "attack 2". I have a spell where the unit plays it's 'attack' animation, so in the trigger i placed, Play unit's attack animation, although it does indeed do the attack animation, sometimes, it also plays the attack 2. How can I avoid that?
 
Level 8
Joined
Jul 8, 2013
Messages
249
Choosing a specific attack animation is somewhat trickier than one would think. There are several ways to do it though.

The first is using a model editor. Assuming you do not need or want attack 1 to be used for anything but casting spells by that unit, you could use a model editor to rename the unit's attack 1 animation to spell or something like that.

The second is by triggering the animation to be played. Several of the more obvious ways to do this will not actually work, however. I believe you may need to use a custom script instead of a normal GUI action.

Basically set up a trigger with the event A Unit Starts the Effect of an Ability

Conditions: ability being cast = whatever your ability is

Then action
  • Custom script: call SetUnitAnimationByIndex ( GetTriggerUnit() , 0 )
Replace that 0 with various other integers one by one until you find out which one is its desired attack animation.

Edit: I'm testing that on various abilities and units atm and finding it works on some but not others. Having fiddled around a bit, I actually got the best results by setting the unit's cast point to 0. Basically what happens is for a split second the unit will try to do its spell animation, THEN it will switch to the proper attack 2 animation. Setting the cast point to 0 for the unit eliminates that problem. However, it means the effect of the spell will begin before the unit finishes the new animation.
 
Status
Not open for further replies.
Top