Having a sound effect play at random

How would I go about achieving the effect of having an audio sound effect playing at random moments?

For example, a grandfather clock chiming at the hour or minute, or having a phone start to ring, etc. Would I set it up as a “timer” blueprint or can I do it in another way?

A grandfather clock chiming on the hour isn’t really random. :stuck_out_tongue:

You could do:

Begin play → delay (random 5-10s (or however long)) → play sound (select random sound) → back to delay node in a loop.

Maybe add a check in to see if you still want the continue the loop or if you want to block random sounds for the moment and skip the play sound node.

I would suggest using a Timer.

How to use it in BluePrint is quite well documented over at the docs


In the function / event that you set up just select one of your sounds at random (maybe add all of your sounds to an array, get a random int between 0 and ArrayOfSounds → getLastIndex → Get from ArrayOfSounds) and that’s about it :wink: