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

How to have custom music replace the background one?

Status
Not open for further replies.
Level 27
Joined
Nov 5, 2010
Messages
1,404
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 :)
 
Level 13
Joined
Mar 24, 2010
Messages
950
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
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
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.
 
Level 27
Joined
Nov 5, 2010
Messages
1,404
I want that the three 3 songs play randomly after each other, just like the real background music. I think that the system Bond009 posted would work well, but I'd just need to add a trigger to repeat itself after the song ends.
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,219
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
 
Level 27
Joined
Nov 5, 2010
Messages
1,404
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 :)
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
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.
Top