• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How to play multiple custom music?

Status
Not open for further replies.
Level 10
Joined
Jun 7, 2008
Messages
420
Hi, I need a way to play custom music, have 3 or 4 pieces.
Already managed to import the mp3 and play in game, however I need it to randomly select one of them at a time. And wait (silence) for a while before it selects a new one.

Also, how do I remove the vanilla music? Its really getting on my nerves. I like to have silence between my soundtracks.
 
Level 4
Joined
Jan 11, 2008
Messages
55
Hi, I need a way to play custom music, have 3 or 4 pieces.
Already managed to import the mp3 and play in game, however I need it to randomly select one of them at a time. And wait (silence) for a while before it selects a new one.

Also, how do I remove the vanilla music? Its really getting on my nerves. I like to have silence between my soundtracks.

for the silence, p[lay an empty wav file between songs.

Set each sound into an array, then choose a random integer, if random int = 1, play song 1, ect
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,456
Here's one way:

Create four triggers named Song0, Song1, Song2, Song3. One for each song. Create a "Trigger Variable Array" in the variable editor. In your Events - Map Initialization trigger, put this:
  • Set Trig[0] = Song0
  • Set Trig[1] = Song1
  • Set Trig[2] = Song2
  • Set Trig[3] = Song3
Now, each of the triggers will have a wait period of the length of the song (which you can look up in the sound editor) and then a wait period of silence. For example, each trigger should look something like this:

  • Actions
    • Sound - Play (Music)
    • Sound - Clear the music list
    • -------- The above "clear music list" is so that it doesn't play twice --------
    • -------- The below is just an estimated wait time until the song stops playing and with, I don't know, 15 seconds of silence --------
    • Wait 240.00 Seconds
    • Trigger - Run (Trig[(Random integer between 0 and 3)])
Your map initilization should also have that "run random trigger" action after you define the triggers, so that it initializes the cycle.
 
Status
Not open for further replies.
Top