| 05-15-2008, 04:51 AM | #1 |
I tried using this to play a unit's walk animation and it doesn't work however other animations like death, attack and stand, work. Using SetUnitAnimationByIndex can solve this but I would need to find out which index is the walk animation, so it would be a pain in the ass. I was using this to play a unit's animation since I'm trying to use keyboard directional buttons to make a unit move, so I can't use SetUnitAnimationByIndex since each model has a different index for it's walk animation. So my question is, How can I play a unit's walk animation using SetUnitAnimation? |
| 05-15-2008, 12:20 PM | #2 |
your prolly interupting your units animation through SetUnitPosition, or a PauseUnit try SetUnitX/Y if not already doing so otherwise, being as I think those are the only two ways to play animations, your going to have to get every units walk id it cant be that hard, how many units could your map possibly have that are controlled by the player using arrow keys? |
| 05-15-2008, 04:27 PM | #3 |
Make an array/for loop that checks the unit type and returns the animation index. |
| 05-15-2008, 06:21 PM | #4 |
@emjlr3: I'm using SetUnitX and SetUnitY, sorry for not mentioning that detail, and thanks for the info. Also I only intend to use a single unit per player, what I meant is if I decided to use different models then I would need to keep track of every walk animation index, that would make the code lengthy. I also searched through some threads and they are having the same problem I have. In conclusion, SetUnitAnimation DOES NOT play unit animations with substring "walk". Thanks again emjlr3! @rulerofiron99: This is what I have been doing and I hated the idea of using arrays to store walk animation index per model/unit type because If I used 30 unittypes then I would have to identify and store each units walk animation index. Unluckily, there is no other way I know of so I'd stick to this. Anyways, thanks man! Should I blame blizzard for this bug? lol, Thanks again guys. |
| 05-15-2008, 08:03 PM | #5 | |
Quote:
|
| 05-15-2008, 08:18 PM | #6 | |
Quote:
|
| 05-15-2008, 08:41 PM | #7 |
as i have tested you can't play animation using SetUnitAnimation with "movespeed" param. the name of animation makes no differense. after i removed movespeed from walk animation it could be played via SetUnitAnimation. well it was long ago so i am not 100% sure. |
| 05-16-2008, 04:18 AM | #8 |
@Toadcop: What's a movespeed param Tc? Is it the one within the model itself, or the one in the object editor? @Rising_Dusk: It's just my conclusion considering I've tried searching threads and found no direct answers to the question; also could you give me a map where it can be achieved and please include what changes you made in the map to make it work. Thanks Rising_Dusk. And thanks for correcting my invalid conclusion. Oh Dusk could you post the code you used to play them please :) Also I forgot to mention that any other animation works only animations with "walk" on it doesn't seem to work, tried it on two different newly created maps but still does not work so please help me guys, Thanks again. Edit: Toadcop's suggestion worked, after setting the unit's movespeed to 0, I was able to make the unit play it's walk animation, now my new probem is how the hell to make a unit rotate, since the movespeed is 0, it does not rotate lol. Thanks for the help guys. |
