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

animations depending on item class

Status
Not open for further replies.
Level 5
Joined
Apr 11, 2011
Messages
107
is there a way to check if the unit has an item class in ANY slot (without having to check each slot individually)? heres what im using. are there any major errors with this?

  • bow
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Attacking unit) Equal to Player_Unit
      • (Item-class of (Item carried by (Attacking unit) in slot 1)) Equal to Powerup
    • Actions
      • Animation - Play (Attacking unit)'s attack lumber animation
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
No, but I guess you have 6 triggers of this type, one for each slot.

You can use a

For each integer A from 1 to 6 do:
If (Item-Class of (Item Carrier by (Attacking Unit) in slot (Integer A)) Equal to PowerUp
Then blah blah...
 
Level 9
Joined
Apr 23, 2011
Messages
460
It depends on how many of these you have, If you have say 5+ of these you would need to look for more optimum methods of checking and creating an animation. But if you only have a few of these, you can nest them inside of if's like this.

  • Test
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Attacking unit) Equal to Player_Unit
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-class of (Item carried by (Attacking Unit) in slot (Integer A)) Equal to Powerup
            • Then - Actions
              • Animation - Play (Last created unit)'s attack lumber animation
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item-class of (Item carried by (Attacking Unit) in slot (Integer A)) Equal to OtherItem
                • Then - Actions
                  • Animation - Play (Last created unit)'s other animation
                • Else - Actions
 
Last edited:
Level 5
Joined
Apr 11, 2011
Messages
107
maker, would it remove the animation tag if the were to lose the item? i dont want the unit shooting a bow when it has no bow equipt. as i dont want it 2 handed swinging with a dagger and mace.
 
Status
Not open for further replies.
Top