• 🏆 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!

How to make a unit use one animation

Status
Not open for further replies.
Level 4
Joined
Dec 29, 2009
Messages
69
Hey Trigger thank you for the offer, I'll pm him now, is there no way to do it via triggers or unit editor though? :(
 
Level 7
Joined
Jul 18, 2009
Messages
272
Just make a trigger:

Event: Unit enters playable map area
Condition: Unit type of triggering unit = your unit
Action: Disable attack animations 1 + 2 for triggering unit

I don't see a problem there.
 
Level 4
Joined
Dec 29, 2009
Messages
69
@Just_Spectating: i can't find this alternate animations field in the object editor, what editor version are you using?
 
Level 4
Joined
Dec 29, 2009
Messages
69
@Armenian Beagle: How do you copy the animations one by one? when i import the model the texture, model and animations kinda come in one package xD
 
Level 4
Joined
Dec 29, 2009
Messages
69
meOme: I got it now, thank you so much :p, seems a lot easier than i thought it would be :D
 
Level 4
Joined
Dec 29, 2009
Messages
69
meOme i just made the trigger but for some reason it's not removing or adding the animation tags to the unit. The animation i want is called Attack. I want to remove Attack One Alternate and Attack Two Alternate. So i've put add animation tag Attack and remove animation tag for the other 2 but it's still not working, is there some sort of animation ID i have to enter?
 
Level 13
Joined
Jun 22, 2004
Messages
783
well, if you're making a trigger where you want the unit to play an animation, just do what i said above.

if you're trying to make a unit that will only use one animation whenever it attacks, sorry cant help. :(

That last thing ain't too hard, here is a small example, perhaps not the most efficient of code, but hench it should work

  • Attack Animation Blademaster
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Blademaster
    • Actions
      • Set attackingUnit = (Attacking unit)
      • Custom script: call SetUnitAnimationByIndex (udg_attackingUnit, 2)
      • Animation - Queue attackingUnit's stand animation
The event enables the trigger when a unit is attacked (there is no real function for "if a unit is attacking") so were basically doing it the other way around.

because you only want a specific type of unit(s) to do this, you narrow the enablement down with a conditional statement, in this case "Unit - Type Comparison", we use the attacking unit, cause we don't want to know whom the attacked unit is, but the attacker; in this case the Blademaster unit type.

Next up the actions, first of all I saved the attacking unit, in a unit variable (this allows easier acces in your custom script next up).
Following up, we make A script call "SetUnitAnimationByIndex", between the () we first fill in the first parameter which is the unit we are refering to, so in this case attackingUnit, cause of the global scope the variable has, we have to put udg_ in front of it.
We close that with a ","to then fill out the next parameter, this is the Index number of the units animation (in this case2)
Note: you can find animation index numbers easily with wc3viewer.

Conclusively we Que the stand animation, so the unit doesn't freeze after it has attacked.

And there you have it, hope this helps you out ;)
 
Status
Not open for further replies.
Top