Play specific unit attack animation

Solu9

You can change this now in User CP.
Reaction score
216
For a spell I need the unit to use a specific attack animation.
The unit has 3.
attack - 1
attack - 2
attack - 3

I want attack - 2.
Trigger:
  • Animation - Play Temp_Unit's attack - 2 animation


This doesn't work.
If I use attack it does, but plays a random attack animation.

How do I differ between animations with the same prefix?
 

vypur85

Hibernate
Reaction score
803
The 'Animation - Play unit animation' is kinda buggy most of the time.

Try this:
Code:
Set Unit = Whatever unit...
Custom script:   call SetUnitAnimationByIndex ( udg_Unit , 1 )

Change the '1' to whatever value and test until you get your desired animation. Then use the same code to play the animation when the spell is casted.
 

Solu9

You can change this now in User CP.
Reaction score
216
Fantastic!

It's a shame the animation number is kinda random but the custom script indeed does the trick.
Thanks :)
 

Accname

2D-Graphics enthusiast
Reaction score
1,463
The animation number is not random at all. It plays the animations in the same order as they are defined in the model-file.
 

Solu9

You can change this now in User CP.
Reaction score
216
The animation number is not random at all. It plays the animations in the same order as they are defined in the model-file.


Really?
I take you don't mean the sequence they show inside the editor because that's not correct.
 

Accname

2D-Graphics enthusiast
Reaction score
1,463
Nope. The editor sorts them by the animation names. The animation index, as used by that jass function, is the exact index in the files animation list.
Or so I was told by forum members who know more about this stuff. I never checked that information.
 

Solu9

You can change this now in User CP.
Reaction score
216
Nope. The editor sorts them by the animation names. The animation index, as used by that jass function, is the exact index in the files animation list.
Or so I was told by forum members who know more about this stuff. I never checked that information.


And is there a way to show this index?
 

DrEvil

FCRI Associate!
Reaction score
111
Trigger:
  • Animation - Play Unit's attack - 2 animation

translates to
Code:
call SetUnitAnimation( null, "attack - 2" )
which only plays the attack animation (it just plays "attack", the " - 2" is forgotten)
as accname and vyper said, you have to play it by index to get specific animations.

if you view the unit in the main editor screen, and press the left and right arrows on the mini object viewer, you can manually count the index for each animation. (Stand is normally the first, so that would be 1, if "attack" is next, 2, "attack - 2" 3, e.t.c)

EDIT: *points*
 

Solu9

You can change this now in User CP.
Reaction score
216
Open the model file with a model editor. Obviously.


Obviously.
Did that already. Still not correct. I had to use number 12, but in the model editor it shows as 2.
I have added and deleted animations from this model though. Obviously.
If it was obvious I obviously wouldn't have asked.
Obviously.
 

Solu9

You can change this now in User CP.
Reaction score
216
Trigger:
  • Animation - Play Unit's attack - 2 animation

translates to
Code:
call SetUnitAnimation( null, "attack - 2" )
which only plays the attack animation (it just plays "attack", the " - 2" is forgotten)
as accname and vyper said, you have to play it by index to get specific animations.

if you view the unit in the main editor screen, and press the left and right arrows on the mini object viewer, you can manually count the index for each animation. (Stand is normally the first, so that would be 1, if "attack" is next, 2, "attack - 2" 3, e.t.c)


As just stated. The animations "number" in the editor viewer does not represent the correct number in the index.

Edit:
Anyway. The problem is solved.
 

Accname

2D-Graphics enthusiast
Reaction score
1,463
Well, then that information seems to be incorrect.
As I said, I have been informed by other members that this is the case; I never checked that information, never opened even a single model file from wc3.
But it got to follow some convention. Have you tried it with different model-editors? Maybe some of them sort the animations by other aspects. Maybe try to open a model-file with a standard text-editor. Depending on the format this should be possible.
 

DrEvil

FCRI Associate!
Reaction score
111
I just tried it with a seige tank, the right animation played...
Is it a custom model?

Maybe try to open a model-file with a standard text-editor.
... o_O

EDIT: Ok... I lied.. I changed it to another animation index. And well. It didn't work. How about we just blame blizzard for being noobs?
 

Solu9

You can change this now in User CP.
Reaction score
216
I just tried it with a seige tank, the right animation played...
Is it a custom model?


Again as already stated. I have added and deleted animations, so that might be the reason why the numbers are messed up.
Oh yeah and the model is a custom model which might screw it up even more. Although I would have thought even a custom model would have the correct index to begin with.
So my best guess is still that it's because of the adding and deleting.
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
Magos sorts animations, geosets, etc. differently than the way they are defined (in the case of animations, it sorts it alphabetically). If you use something like MDLVis, it'll show the order of the sequences properly and you can just count which index the particular animation is (starting from 0).

Or you can open the .mdl file in notepad and count it. Here is a sample:
Code:
Sequences 17 {
        Anim "Stand" {
                Interval { 3333, 6000 },
                MinimumExtent { -85.5541, -85.1761, -0.735934 },
                MaximumExtent { 83.1785, 74.1028, 209.012 },
                BoundsRadius 137.455,
        }
        Anim "Stand - 2" {
                Interval { 6667, 10000 },
                MinimumExtent { -85.5577, -85.1907, -0.736055 },
                MaximumExtent { 83.1785, 74.1128, 209.012 },
                BoundsRadius 137.48,
        }
        Anim "Walk" {
                Interval { 13667, 15667 },
                MoveSpeed 200,
                MinimumExtent { -138.788, -48.8426, -1.26554 },
                MaximumExtent { 89.8302, 113.422, 210.922 },
                BoundsRadius 165.949,
        }
        Anim "Stand Ready" {
                Interval { 16667, 18667 },
                MinimumExtent { -82.4281, -86.6628, -0.76509 },
                MaximumExtent { 71.7419, 130.536, 209.012 },
                BoundsRadius 154.89,
        }
        Anim "Attack - 1" {
                Interval { 20000, 21000 },
                NonLooping,
                MinimumExtent { -152.138, -100.333, -7.18807 },
                MaximumExtent { 233.286, 130.536, 209.012 },
                BoundsRadius 214.324,
        }
        Anim "Death" {
                Interval { 23200, 25533 },
                NonLooping,
                MinimumExtent { -304.427, -168.207, -16.8208 },
                MaximumExtent { 102.035, 130.536, 209.012 },
                BoundsRadius 252.853,
        }
        Anim "Spell" {
                Interval { 26533, 27700 },
                NonLooping,
                MinimumExtent { -139.589, -82.4189, -3.83338 },
                MaximumExtent { 169.714, 74.455, 209.958 },
                BoundsRadius 188.489,
        }
        Anim "Walk Gold" {
                Interval { 28667, 29667 },
                MoveSpeed 200,
                MinimumExtent { -261.506, -92.2042, -38.2161 },
                MaximumExtent { 22.908, 113.609, 108.192 },
                BoundsRadius 172.889,
        }
        Anim "Stand Gold" {
                Interval { 30000, 32667 },
                MinimumExtent { -146.659, -93.1261, -80.3994 },
                MaximumExtent { 114.435, 63.8673, 92.2605 },
                BoundsRadius 162.667,
        }
        Anim "Stand Gold - 2" {
                Interval { 33333, 36667 },
                MinimumExtent { -146.659, -93.1261, -80.4255 },
                MaximumExtent { 114.435, 63.8673, 92.2604 },
                BoundsRadius 162.671,
        }
        Anim "Attack Gold" {
                Interval { 40733, 41733 },
                NonLooping,
                MinimumExtent { -176.809, -82.4581, -75.264 },
                MaximumExtent { 175.16, 135.003, 127.975 },
                BoundsRadius 186.277,
        }
        Anim "Stand Ready Gold" {
                Interval { 42400, 46400 },
                MinimumExtent { -146.659, -82.4581, -80.5297 },
                MaximumExtent { 141.41, 54.396, 92.2604 },
                BoundsRadius 165.266,
        }
        Anim "Death Gold" {
                Interval { 48767, 50200 },
                NonLooping,
                MinimumExtent { -146.659, -82.4581, -147.86 },
                MaximumExtent { 141.41, 124.346, 111.415 },
                BoundsRadius 162.775,
        }
        Anim "Spell Gold" {
                Interval { 54733, 55900 },
                NonLooping,
                MinimumExtent { -202.141, -82.4581, -97.4892 },
                MaximumExtent { 141.41, 155.386, 114.138 },
                BoundsRadius 205.516,
        }
        Anim "Decay Gold" {
                Interval { 57067, 117067 },
                NonLooping,
                MinimumExtent { 3.40282e+038, 3.40282e+038, 3.40282e+038 },
                MaximumExtent { -3.40282e+038, -3.40282e+038, -3.40282e+038 },
        }
        Anim "Decay Flesh" {
                Interval { 173267, 233267 },
                NonLooping,
                MinimumExtent { -295.367, -172.12, -138.53 },
                MaximumExtent { 48.0356, 44.8795, 36.6764 },
                BoundsRadius 213.262,
        }
        Anim "Decay Bone" {
                Interval { 239933, 299933 },
                NonLooping,
                MinimumExtent { -106.698, -103.051, 2.00656 },
                MaximumExtent { 46.6459, 34.7261, 19.1762 },
                BoundsRadius 89.9866,
        }
}

"Sequences" is followed by a number displaying the animation count (in this case, 17). The way the animations are ordered defines its animation index. Thus, "stand" is 0, "stand - 2" is 1, "walk" is 2, etc. This is a bit tedious though. Perhaps it would be neat to add a plug-in in JNGP to get the animation indexes of a model. :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top