Animation Blueprint - how to randomly play anim?

I’ve an couple of Attack animations and I don’t know which is the best way to randomly play them when character is attacking. I can’t find any random node in Animation Blueprint. Anyone can point me out?

The functionality here would be really simple - when character is in some state he will start attacking and just picking attacks.

Use switch on int and input random int

can’t do that in animation blueprint.

1 Like

Just get a random int in your character blueprint, save that into a variable there, then in AnimBP’s EventGraph use something like “Get Player Character”, cast to your character BP, get the variable and set another int variable in your AnimBP to hold that random int value, and depending on it play one or another animation.

1 Like

You can call Anim Blueprint from other Blueprint using Get Anim Instance ;]

Make a structure with all of your animations, make a variable in your player blueprint of that structure, get that variable and break it, connect each of your pins (your montages) to a select utility, get a random integer from range that is the same as your number of pins, and feed that select node to your play montage, wala!

I know this is a really old post and I posted this in a different feed but I figured I’d share what i found worked for since I stumbled across this thread looking for answers. I created a bunch of animation Montages based on Death animations (6 total). 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.

Alternatively you can create an animation Montage and after setting that up you can call on it with a button input.

1 Like