• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Solved] SetUnitAnimationByIndex quirk

Status
Not open for further replies.
Level 5
Joined
Dec 1, 2008
Messages
120
So I picked up this old thing again https://www.hiveworkshop.com/threads/could-something-like-useful.267922/post-2710168, and realized I never fixed this quite bothersome bug.

So the problem here is:
JASS:
library a initializer Init
    
    private function Init takes nothing returns nothing
        local unit a = CreateUnit(Player(0), 'n000', -16.0, .0, 270.0)
        local unit b = CreateUnit(Player(0), 'n000', -16.0, -32.0, 270.0)
        local unit c = CreateUnit(Player(0), 'n000', -16.0, -64.0, 270.0)
        
        call SetUnitAnimationByIndex(a, 0)
        call SetUnitAnimationByIndex(b, 1)
        call SetUnitAnimationByIndex(c, 2)
    endfunction
    
endlibrary
Units a and b will change their animations to 2 too. The units are using a custom model I made.

Not sure if this is the right place to post. Guess it's more of a model problem, as this doesn't happen if I change the unitId to 'hpea' for example.
 

Attachments

I think I made a mistake in the first post? Now the units seem to be using the first animation I set (0). I'm sure it was the the other way around before...

I have other test in the map that uses timers, which works correctly:
JASS:
library b initializer Init
    
    globals
        private integer i = 0
        private real y = .0
    endglobals
    
    private function Create takes nothing returns nothing
        call SetUnitAnimationByIndex(CreateUnit(Player(0), 'n000', 16.0, y, 270.0), i)
        set i = i + 1
        set y = y - 32.0
    endfunction
    
    private function Init takes nothing returns nothing
        call TimerStart(CreateTimer(), .0, false, function Create)
        call TimerStart(CreateTimer(), .1, false, function Create)
        call TimerStart(CreateTimer(), .2, false, function Create)
    endfunction
    
endlibrary
 
Status
Not open for further replies.
Back
Top