• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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 64
Joined
Aug 10, 2018
Messages
6,583
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