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

This is where all discussion of WC3 mapmaking should be held. This forum exists particularly for mapmaking needs. If you have a question on how something works or have need for some code review, this is the place to put it.
Post Reply
Flak Maniak
Noobite Warrior
Posts: 16
Joined: Sun Feb 28, 2010 1:05 am

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

Post by Flak Maniak » Fri Apr 02, 2010 12:50 pm

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.

vesuvan
Revenent of the Replies
Posts: 337
Joined: Tue Jan 15, 2008 12:29 pm

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

Post by vesuvan » Fri Apr 02, 2010 6:28 pm

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/
͎̟͕͎̯̺͎̟͕͎̯̺ĩ̵̢͉̺̹͖͔̻̣̟̙ͦ̋̍ͤ̈́ͫ̓͐͐̅͊͒ͪͬͧͅn̢̮͈̪̤̳̏ͥ̐̍̌͊͜͟͠
̵̢͉̺̹͖͔̻̣̟̙ͦ̋̍ͤ̈́ͫ̓͐͐̅͊͒ͪͬͧͅn̢̮͈̪̤̳̏ͥ̐̍̌͊͜͟͠

Flak Maniak
Noobite Warrior
Posts: 16
Joined: Sun Feb 28, 2010 1:05 am

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

Post by Flak Maniak » Sat Apr 03, 2010 7:11 pm

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.

User avatar
2-P
Revenent of the Replies
Posts: 328
Joined: Wed Feb 13, 2008 11:18 am

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

Post by 2-P » Sat Apr 03, 2010 7:32 pm

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.
Humans don't have the patience to wait even ten minutes for something!

Flak Maniak
Noobite Warrior
Posts: 16
Joined: Sun Feb 28, 2010 1:05 am

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

Post by Flak Maniak » Sun Apr 04, 2010 2:25 pm

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?

User avatar
2-P
Revenent of the Replies
Posts: 328
Joined: Wed Feb 13, 2008 11:18 am

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

Post by 2-P » Sun Apr 04, 2010 6:22 pm

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)
Humans don't have the patience to wait even ten minutes for something!

Flak Maniak
Noobite Warrior
Posts: 16
Joined: Sun Feb 28, 2010 1:05 am

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

Post by Flak Maniak » Mon Apr 05, 2010 3:41 pm

Thanks. It works!

Post Reply

Return to “Custom Map Creation”