How to spawn a list of sounds on specific locations locations within a radius

Hello there!

I have 3 sounds that I want one of them to be randomly chosen to spawn in one of the 4 xyz locations I’ve chosen once every 5 seconds.

Can anyone help?

Thanks a lot, can you further help with random spawning in blueprints? Because sometimes I want to spawn objects instead. I did it like a while ago using arrays it’s been a very long time, I almost forgot everything about Blueprints

Thanks again!

Of course.
Spawn sound are done with spwan sound at location or play sound at location. Objects can be spawned with SpawnActor (you need set which class need to be spawned)

Random Locatiom can be done in several ways, here is two proof of concept:

  1. Make an FVector Array, add some locations. Before spawn create a random integer between 0 - (Array length - 1) and get that location from vector array.
  2. You can get a random vector based on player location. Get Actor Location, break them to xyz floats and get random float between (x - 1000) (x + 1000), (y - 1000) (y + 1000) and so on with z if needed. From the result make a Vector which will be your random location somewhere near on your character or camera whatever :slight_smile:

Last one will generate basically a random location in distance 1000 (+/-) based on your player position :slight_smile:

Ps. Random float are done with RandRange node :slight_smile:

Hey there!

Sound Cue editor has built in RANDOM Selector!
Open Sound Cue editor, on right you see random node, just add before output and connect as many soundwave you need.
After this you have only one job, play Sound Cue at your chosen location and sound will be randomly selected each time you play sound cue :wink: