• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Help for random sounds played when using spells.

Status
Not open for further replies.
Level 2
Joined
Aug 20, 2011
Messages
8
Hello, I wanted to create a spell that makes random sound quotes when it's being cast, but I don't know how to setup the trigger or the variables. I know a little about building triggers but when it comes to the variables, I'm kind of a newb.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
This thread has some examples of what you'd want to do: random integer number (detecting that number)

In your case you want a Sound variable Array. At map initialization you can assign each Sound in this Array with a different sound, IE:
  • Set Variable RandomSound[1] = SomeSound
  • Set Variable RandomSound[2] = SomeSound
  • Set Variable RandomSound[3] = SomeSound
Then get your random number when it comes time to play one of these sounds:
  • Set Variable RandomNumber = (Random integer number between 1 and 3)
And finally use that random number to play a random sound:
  • Sound - Play RandomSound[RandomNumber]
You may want to look into 3D sounds as playing Sounds like this can have undesirable effects.
 
Status
Not open for further replies.
Top