Page 1 of 1

How do I make an ability use a specific attack animation?

Posted: Fri Apr 02, 2010 12:50 pm
by Flak Maniak
So I'm making an ability for a hero with, for all intents and purposes, the Demon Hunter model file. (It's that unarmed hero model from the Hive Workshop.) For one of his triggered abilities, I have it give him an ability based on Channel and make him cast it. This is so he can't do anything else during the ability. I want it to make him play his second attack animation while he's channeling this. I can't make him play an animation with triggers while he's channeling for some reason. So I set the spell's animation to every variant of attack 2 I can think of, and none of them stop him from sometimes doing his attack 1 animation. So what's the correct syntax for specifying attack 2? Is there one?

A moment ago, I tried having it pause him instead of making him channel something, and make him play an animation, but I run into the same problem.

Re: How do I make an ability use a specific attack animation?

Posted: Fri Apr 02, 2010 6:28 pm
by vesuvan
I don't know of any method of directly referencing the first or second attack animation.

If you have a program capable of editing MDL files, you could simply copy the animation and rename it so that it is no longer an "attack."

This tool may be useful to you: http://www.hiveworkshop.com/forums/tool ... tor-62876/

Re: How do I make an ability use a specific attack animation?

Posted: Sat Apr 03, 2010 7:11 pm
by Flak Maniak
If there's a way to use Magos to do that, I haven't found it. But I'll keep trying. It's disappointing that you can't stipulate specific attack animations with spells or triggers.

Re: How do I make an ability use a specific attack animation?

Posted: Sat Apr 03, 2010 7:32 pm
by 2-P
You can play specific animations with:

Code: Select all

SetUnitAnimationByIndex(unit, integer)
You can play the different animations by changing the integer. To check which integer plays which animation you can use WC3Viewer for example, it shows all the animations in the right order (starting from 0).

Not sure about your custom model, but to play the attack 2 animation of the original demon hunter it would be 6.

Re: How do I make an ability use a specific attack animation?

Posted: Sun Apr 04, 2010 2:25 pm
by Flak Maniak
So can I just slot that code into a run custom script action? (I'm a wussy GUI user.)

Edit: So I just tried it. I naively presumed I could just put in the name of a unit variable, and the editor barfed and disabled it when I tried to save. So, how do I put a unit variable in there?

Re: How do I make an ability use a specific attack animation?

Posted: Sun Apr 04, 2010 6:22 pm
by 2-P
Yeah, custom script is fine. You have to put "udg_" in front of the variable. Let's say the variable is called Demon, then you'd have

Code: Select all

call SetUnitAnimationByIndex(udg_Demon, 6)

Re: How do I make an ability use a specific attack animation?

Posted: Mon Apr 05, 2010 3:41 pm
by Flak Maniak
Thanks. It works!