• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Help for random sounds played when using spells.

Status
Not open for further replies.

jayjayduque

J

jayjayduque

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.
 
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.
 
Tnx mate. very much. I can finally make random events. tnx to you.
 
Status
Not open for further replies.
Back
Top