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

Attack Animations with Items

Status
Not open for further replies.
Level 7
Joined
Sep 8, 2011
Messages
208
Sorry to post another thread so quickly but I really need to know how to change a units attack animations when he has an item equipped. I am now using the Villager 255 animation model, when he doesn't have weapons he attacks using his fists (this is default and it is fine left like this) but when the player picks up a weapon I want him to use different animations he has for the item when he attacks.

Anyone know what to do here?
 
You should use SetUnitAnimationByIndex(GetAttackingUnit(),integer) with the event EVENT_PLAYER_UNIT_ATTACKED

In GUI it would be kinda like this:

  • TempTrigger
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) has an item of type Your Item) Equal to True
    • Actions
      • Set TempInteger = 0
      • -------- TempInteger is the index of the animation you wanna play --------
      • Custom script: call SetUnitAnimationByIndex(GetAttacker(),udg_TempInteger)
And if you wanna do it in more than a single item:

  • TempTrigger
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • ((Attacking unit) has an item of type Sword) Equal to True
          • ((Attacking unit) has an item of type Dagger) Equal to True
          • ((Attacking unit) has an item of type Bow) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Attacking unit) has an item of type Sword) Equal to True
        • Then - Actions
          • Set TempInteger = 1
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Attacking unit) has an item of type Dagger) Equal to True
            • Then - Actions
              • Set TempInteger = 2
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Attacking unit) has an item of type Bow) Equal to True
                • Then - Actions
                  • Set TempInteger = 3
                • Else - Actions
      • Custom script: call SetUnitAnimationByIndex(GetAttacker(),udg_TempInteger)
 
Last edited:
I have all the animations I want written down. I just want to know how to make the villager use specific animations when he picks up an item.

For example: There is a one handed sword in the game he can pick up, when he obtains it, it gives him the model I have added to the sword but he still punches and kicks rather that uses the animations I have set in the option in object editor Art - Animation Names.

I want to know how exactly do I change his animations for auto attacking with different items. :)
 
I am terrible at custom scripts... It keeps giving me an syntax error with the custom script even though I have modified it. I has set it as:

SetUnitAnimationByIndex(GetAttacker(),udg_Temp_Integer) because the variable I am using is Temp_Integer...

What am I doing wrong? (probably everything :P )

Edit: I wasn't adding in the call at the start...... I haven't done map editing in a long time lmao. Thanks to everyone that has helped me! :)
 
Last edited:
Status
Not open for further replies.
Back
Top