Page 1 of 1

How do u put music in a map?

Posted: Sat Oct 16, 2021 7:24 pm
by Kennedy
Hi, i really forget alot of stuff of modding maps & creatings stuff here xd..

so what name do u put on a music so the map can hear it while u play.

Re: How do u put music in a map?

Posted: Sun Oct 17, 2021 12:21 am
by TommyCD1
The simplest way is to add a replacement for the music_common_list.cfg file within your map folder. It looks like this:

Code: Select all

///////////////////////////////////////////////////////////////////////////////
//
// Pandemic Studios
//
// Game Music
//

Cmd("sound.player.addtrack '1_Strings.mp3'");
Cmd("sound.player.addtrack '2_Polka.mp3'");
Cmd("sound.player.addtrack '3_Mystery.mp3'");
Cmd("sound.player.addtrack '4_Zwaga.mp3'");
Cmd("sound.player.addtrack '5_Drums.mp3'");
Cmd("sound.player.addtrack '6_Tubes.mp3'");
Cmd("sound.player.addtrack '7_Chimes.mp3'");
Cmd("sound.player.addtrack '8_Horns.mp3'");
You can see it adds the MP3 files by name. You can change these to whatever files you want, you can even add 9+ tracks if you wish. Keep in mind that the MP3 files you are adding must then also be added to the map's folder, which can severly bloat the filesize if you add too many.

You can find the music_common_list.cfg file within the base.x archive, or directly from this post if you are not sure how to extract it yourself.

The way the game queues and then plays music is handled through objective actions. Normally, this is handled automatically for you through the ruleset, whether that's Protect HQ or King of the Hill. However, if you are using a custom ruleset, you'll need to make sure that this happens. You can do this by assigning an objective to client teams, and then making sure that objective contains the following action:
(code borrowed from protect.x)

Code: Select all

StartActionAvailable()
{
  CreateVarFloat("@.timeleft", 180);
  NewObjective("protecthq.check");
  NewObjective("common.killallenemy");
  NewObjective("common.aivictory");
  NewObjective("common.eliminate");
}

Code: Select all

CreateObjectType("protecthq.check", "Objective")
{
  // Do I NOT have a fully-constructed HQ?
  Condition("HaveType")
  {
    Type("army.building.hq1")
    {
      Operator("==");
      Amount(0);
    }
  }
  Action()
  {
    Cmd("sound.player.clear");
    Cmd("exec music_common_list.cfg");
    Cmd("sound.player.play");

Re: How do u put music in a map?

Posted: Sun Oct 17, 2021 7:16 pm
by Kennedy
Thanks tom