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

Unit animation depending on random integer

Status
Not open for further replies.
Level 19
Joined
Apr 21, 2013
Messages
1,194
Okay i'm using villager255 in my game because it has lots of animations that i can use so the problem is this.

  • Sword
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Simple Adventurer
      • (Item-type of (Item carried by (Attacking unit) of type Sword)) Equal to Sword
    • Actions
      • Set animAttack = (Random integer number between 0 and 2)
      • If (animAttack Equal to 1) then do (Custom script: call SetUnitAnimationByIndex(GetAttacker(), 57)) else do (Do nothing)
shouldn't the unit attack only with one animation when attacking?

it uses different animations instead of chosen animation tho :S
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
Okay i'm using villager255 in my game because it has lots of animations that i can use so the problem is this.

  • Sword
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Simple Adventurer
      • (Item-type of (Item carried by (Attacking unit) of type Sword)) Equal to Sword
    • Actions
      • Set animAttack = (Random integer number between 0 and 2)
      • If (animAttack Equal to 1) then do (Custom script: call SetUnitAnimationByIndex(GetAttacker(), 57)) else do (Do nothing)
shouldn't the unit attack only with one animation when attacking?

it uses different animations instead of chosen animation tho :S
I'm not sure I understand your problem. What do you mean by this:
shouldn't the unit attack only with one animation when attacking?

Also, it does not have to use only the 'chosen' animation, atm I don't see you displaying anywhere what number is saved in animAttack and since it can save any of the 3 numbers (0, 1 and 2), there is basically a 33% chances for the unit to use the 57th animation as you want.
 
Status
Not open for further replies.
Top