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

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 25
Joined
Sep 26, 2009
Messages
2,383
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