• 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!

How to have custom music replace the background one?

Status
Not open for further replies.
I want to replace the human background music for my campaign, I got 3 tracks, but I'm not sure how.

I'm not sure how to exactly have a trigger to randomly play one of the three tracks and then to repeat itself. I tried making my own, but it didnt really work. It's also a bit of a problem since the music would have to repeat itself after every cinematic. I was also wondering if it's possible to just replace the music path, like you can do for unit sounds.

Thanks in advance :)
 
this is an example of how to make it play your own imported music of a random option. im assuming you know how to import your music in this example so if you dont know how let me know.

  • music
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Temp_Integer = (Random integer number between 1 and 3)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Temp_Integer Equal to 1
        • Then - Actions
          • Sound - Play Music
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Temp_Integer Equal to 2
            • Then - Actions
              • Sound - Play Music 2
            • Else - Actions
              • Sound - Play Music 3
 
The above trigger is used if you have 3 different songs. It will play a random song of the 3 you have. The triggers (correct me if im wrong) does not cycle through these 3 songs though. You need to tell us exactly what you want your music system to do.
 
I belive something like this would work
  • Untitled Trigger 001
    • Events
      • Time - music expires
    • Conditions
    • Actions
      • Custom script: local integer i = GetRandomInt(1, 3)
      • Custom script: if i == 1 then
      • Sound - Play Music
      • Countdown Timer - Start music as a One-shot timer that will expire in (Length of Music) seconds
      • Custom script: elseif i == 2 then
      • Sound - Play Music
      • Countdown Timer - Start music as a One-shot timer that will expire in (Length of Music) seconds
      • Custom script: elseif i == 3 then
      • Sound - Play Music
      • Countdown Timer - Start music as a One-shot timer that will expire in (Length of Music) seconds
      • Custom script: endif
 
I belive something like this would work
  • Untitled Trigger 001
    • Events
      • Time - music expires
    • Conditions
    • Actions
      • Custom script: local integer i = GetRandomInt(1, 3)
      • Custom script: if i == 1 then
      • Sound - Play Music
      • Countdown Timer - Start music as a One-shot timer that will expire in (Length of Music) seconds
      • Custom script: elseif i == 2 then
      • Sound - Play Music
      • Countdown Timer - Start music as a One-shot timer that will expire in (Length of Music) seconds
      • Custom script: elseif i == 3 then
      • Sound - Play Music
      • Countdown Timer - Start music as a One-shot timer that will expire in (Length of Music) seconds
      • Custom script: endif

I combined yours and Bond009's system along with some triggers I added and it worked perfectly. Thank you, +rep to both of you :)
 
I belive something like this would work
  • Untitled Trigger 001
    • Events
      • Time - music expires
    • Conditions
    • Actions
      • Custom script: local integer i = GetRandomInt(1, 3)
      • Custom script: if i == 1 then
      • Sound - Play Music
      • Countdown Timer - Start music as a One-shot timer that will expire in (Length of Music) seconds
      • Custom script: elseif i == 2 then
      • Sound - Play Music
      • Countdown Timer - Start music as a One-shot timer that will expire in (Length of Music) seconds
      • Custom script: elseif i == 3 then
      • Sound - Play Music
      • Countdown Timer - Start music as a One-shot timer that will expire in (Length of Music) seconds
      • Custom script: endif

Just curious. Why do you play the music locally with custom script? Are you trying to play it for a specific player or something?
 
he did it so you don't have to create a global variable for this system to work. Also more officiant.

A local variable is a variable that can only be played inside the function it is played. In this GUI case this local variable only plays inside this trigger.

This has nothing to do with the condition 'GetLocalPlayer()' in jass.
 
Status
Not open for further replies.
Back
Top