# How to randomly play an animation in a state

**URL:** <https://forums.unrealengine.com/t/how-to-randomly-play-an-animation-in-a-state/344419>\
**Category:** Character & Animation\
**Tags:** select, unreal-engine, state-machines, question\
**Created:** [January 18, 2016, 3:25am UTC](https://forums.unrealengine.com/t/how-to-randomly-play-an-animation-in-a-state/344419 "2016-01-18T03:25:29Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ViceVersa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ViceVersa](https://forums.unrealengine.com/u/ViceVersa)\
**Post date:** [January 18, 2016, 3:25am UTC](https://forums.unrealengine.com/t/how-to-randomly-play-an-animation-in-a-state/344419/1 "2016-01-18T03:25:29Z")

</div>

I downloaded the Zombie pose pack and i want to set it up so that when the zombie is killed, it will randomly choose between the two death animations. I feel like what im trying to do should be really simple but i cant quite figure it out. Heres a picture of what im trying

 ![74863-animstate.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/c/b/fcbafb06efa40622b4c7ea9875963ef948b9bda0.png)

for some reason he just goes right to the T pose. but if i plug one directly in, it works

 ![74864-animstate2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/1/2/4124f2fcca8de0f9a5fdba6c078c2fc3410bdca3.png)

im guessing that Select node is not what im looking for. Does anybody know how to do this/is this even possible?

---

<div class="post-metadata">

**Author:** ![Darvos](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Darvos](https://forums.unrealengine.com/u/Darvos)\
**Post date:** [January 18, 2016, 7:28am UTC](https://forums.unrealengine.com/t/how-to-randomly-play-an-animation-in-a-state/344419/2 "2016-01-18T07:28:58Z")

</div>

I have only done this with flipbooks(2d) but maybe you can try a “switch on int” with the random integer range. Maybe someone else might have a better idea, but this is what I have done in the past.

---

<div class="post-metadata">

**Author:** ![ViceVersa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ViceVersa](https://forums.unrealengine.com/u/ViceVersa)\
**Post date:** [January 25, 2016, 1:48am UTC](https://forums.unrealengine.com/t/how-to-randomly-play-an-animation-in-a-state/344419/3 "2016-01-25T01:48:34Z")

</div>

i tried this, the problem is the output needs to be a type animnode (the kind in the shape of the littler person). most of the functions dont output that type so i cant really figure out how to use any of them

---

<div class="post-metadata">

**Author:** ![Mr.uno](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mr.uno](https://forums.unrealengine.com/u/Mr.uno)\
**Post date:** [March 14, 2017, 1:24am UTC](https://forums.unrealengine.com/t/how-to-randomly-play-an-animation-in-a-state/344419/4 "2017-03-14T01:24:43Z")

</div>

![129938-animation_random2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/f/8/cf87b58ad870e1caeea26d29c643d680257814e9.png)

---

<div class="post-metadata">

**Author:** ![Neil\_London](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/neil_london/32/1104110_2.png) [@Neil\_London](https://forums.unrealengine.com/u/Neil_London)\
**Post date:** [September 5, 2017, 2:13pm UTC](https://forums.unrealengine.com/t/how-to-randomly-play-an-animation-in-a-state/344419/5 "2017-09-05T14:13:15Z")

</div>

I know this is an old post but I did this and it worked for me. Not sure if this is fully answering the question BUT, I created a bunch of animation Montages based on Death animations. I wanted each death to be unique so I made a variable made it an array and called it Death Montage and set it to Anim Montage. I then added all the death anim montages into the array. I then told it to Get the array and grab a random integer and pumped the get into the Play Anim Montage. Now when I kill a bad guy they die 1 of 6 ways.  
I hope this help anyone having trouble with this.

 ![212347-capture-2017-09-05-07-04-20-366.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/d/3/9d3e34555e507c87a5c105e499a3459d9a96ef2d.png)

---

<div class="post-metadata">

**Author:** ![Mr.uno](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mr.uno](https://forums.unrealengine.com/u/Mr.uno)\
**Post date:** [September 6, 2017, 7:01am UTC](https://forums.unrealengine.com/t/how-to-randomly-play-an-animation-in-a-state/344419/6 "2017-09-06T07:01:59Z")

</div>

Even if an old question but still need help with it. Im about to try your idea.

---

<div class="post-metadata">

**Author:** ![ShadowOf047](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ShadowOf047](https://forums.unrealengine.com/u/ShadowOf047)\
**Post date:** [September 10, 2017, 3:00pm UTC](https://forums.unrealengine.com/t/how-to-randomly-play-an-animation-in-a-state/344419/7 "2017-09-10T15:00:00Z")

</div>

If you are in state mahcine you can use "Blend poses by int " node, and you can add more entery pin if you want more than 2 .

---

<div class="post-metadata">

**Author:** ![KazemAkhgary](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KazemAkhgary](https://forums.unrealengine.com/u/KazemAkhgary)\
**Post date:** [July 13, 2019, 10:50am UTC](https://forums.unrealengine.com/t/how-to-randomly-play-an-animation-in-a-state/344419/8 "2019-07-13T10:50:41Z")

</div>

There is a “Random Sequence Player” node that you can use inside a state. in the details panel you can pick animations that you want to play.
