• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

What do I need to do to make this code work?

Status
Not open for further replies.
Level 3
Joined
Jul 18, 2008
Messages
42
Custom script: call SetUnitByAnimationIndex(udg_Hero,animation2)



I'm trying to make it do an animation, but the editor keeps disabling the trigger :(. What do I have to fill in???
 
Level 3
Joined
Jul 18, 2008
Messages
42
OKay coolty I tried what you said and the script looks like this


Custom script: call SetUnitByAnimationIndex(udg_Naruto,morph alternate)


But this time it said "expected a function name" and turned the trigger off.

Naruto = unit variable for triggering unit

morph alternate = animation name. So whats wrong?
 
Level 8
Joined
Aug 4, 2006
Messages
357
It's supposed to be Custom script: call SetUnitAnimationByIndex(udg_Hero,animation2) and make sure animation2 is an integer.

Edit: if you want to set animation by the animation name, do something like Custom script: call SetUnitAnimation(udg_Hero, "attack")
 
Level 3
Joined
Jul 18, 2008
Messages
42
It's supposed to be Custom script: call SetUnitAnimationByIndex(udg_Hero,animation2) and make sure animation2 is an integer.

Edit: if you want to set animation by the animation name, do something like Custom script: call SetUnitAnimation(udg_Hero, "attack")



So do I just copy that exactly in the custom script or does it need variables or anything?
 
Level 8
Joined
Aug 4, 2006
Messages
357
call SetUnitAnimationByIndex(udg_Hero, 2)

Just copy/paste that into a custom script. That will play "Hero"'s second animation. If that's not the animation you want, try changing the number to 0,1,3,4,etc. until you find the animation you want.... Personally, I prefer setting the animation by name since I know exactly what animation it will play. To set it by name, copy/paste:

call SetUnitAnimation(udg_Hero, "attack")

and replace "attack" with whatever animation you want to play, whether it's "stand", "spell", or whatever.
 
Level 3
Joined
Jul 18, 2008
Messages
42
with that first script it said "compile error" "expected a name" ????


this is what I put for the script
Custom script: call SetUnitAnimationByIndex(udg_Hero, 2)
 
Status
Not open for further replies.
Top