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

[General] Instance Appropriate Music

Status
Not open for further replies.
Level 2
Joined
Jan 8, 2014
Messages
10
I am making an RTS map, and I want the game to play music appropriate music for the scenario. For example, during peacetime, there is more relaxed and peaceful music, while if the player is under attack, the music switches to a list of themes that are more intense and fast-paced.

I've tried a couple of ways to get this to work without any success, so I would appreciate any help.

Also, how much music should I put into the game if I want it to be played on multiplayer? The themes I have are around 1-4 minutes long.
 
Level 2
Joined
Jan 8, 2014
Messages
10
Basically there would be a list of songs the game would rotate between for the player, and then if any of the units of that player were attacked the normal music cycle would be turned off, and a battle music list would begin to play. If, for an extended period of time, no units were attacked, the battle music would end and return to the normal music. There really only is two instances for the music, battle, and peacetime, nothing else.

However, I was not able to figure out how to create lists of music, how to make the battle music turn off after a period of no combat, or if it was even that effective of an idea compared to solutions others have used/could come up with.

I also thought of making the music region based, since the homebases for several of the factions are fixed, but again that wouldn't work because many if not most conflicts would likely take place outside of the main bases.
 
Level 2
Joined
Jan 8, 2014
Messages
10
I was able to figure out how to make a music list of sorts (You just make a trigger play a bunch of themes, and then at the end loop). However, I still have the dilemma of not being able to find a way to make the music list change to battle music when the player is under attack.

First of all, is there a way to play music specifically for a player? If not, then i think I need to scrap this feature.

If so, I was thinking that a music track of peaceful music play by default, but then whenever a unit is attacked for Player X, a random battle theme play for Player X. This theme would play until 10 seconds of no combat passed for the player.

Anybody know how to trigger this?
 
Level 25
Joined
May 11, 2007
Messages
4,650
Have an event so that when an unit is attacked, an integer is increased if it's below an integer called BATTLE_MUSIC_TIME.

  • Events: An unit is attacked
  • Conditions:
  • Actions:
  • if (timer_time < MUSIC_BATTLE_TIME)
  • Set timer_time = timer_time + 1;
  • trigger enable trigger MUSIC_BATTLE_TIMER;
  • if (MUSIC_BATTLE_IS_PLAYING != true)
  • play battleMusic;
  • Set MUSIC_BATTLE_IS_PLAYING = true;
  • else
  • do nothing or paint a bunny pink;
trigger two, MUSIC_BATTLE_TIMER
  • Events: Time - Every 1 second
  • Conditions:
  • Actions:
  • Set timer_time = timer_time - 1;
  • if (timer_time <= 0)
  • stop playing battleMusic
  • set MUI_BATTLE_IS_PLAYING = false;
There you go, now you just need to squeeze it into two triggers :)
And do some minor edits if you want it for multiple people..
 
Status
Not open for further replies.
Top