Play Random Montages While Avoiding Duplicates

I’m using the random integer node to play 16 sword montages every time the same button is pressed. However, I don’t want the same animation to play twice.

I’ve already spent 10+ hours browsing the internet and the Unreal forums about this, tried everything people suggested, but I couldn’t get it to work. I learned recently about the “Random integer From Stream” node which apparently can accomplish this, but I don’t know how this would be setup with montages. This is what I have so far to get the random months to play. How can I play random montages while avoiding the same montage from playing twice?

You can simply remove the selected element from the array :blush:

And to avoid the same animation playing consecutively instead of removing it forever, you can store the selected element inside a variable and add it back to the array after the next animation is selected.

Hope this helps! :innocent:

Thanks so much for the reply! What would this look like in blueprints or how would I make the connections? How do I know which animation will be the selected element (the duplicate) if they play randomly everytime? I’m still a beginner and not as familiar with arrays as I’d like to be. I’ll try it out

Here you go :innocent:

This works! When I first set this up, it took me a while to fully understand what is happening here lol Now that I understand I made some detailed notes about it in my code. Thanks again!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.