How do u put music in a map?

Have modding questions or discovered something new? Post here.
Post Reply
User avatar
Kennedy
Loyal Member
Loyal Member
Posts: 621
Joined: Sun Dec 30, 2012 12:51 pm
Location: behind u.. now u see me?
Contact:
Mexico

How do u put music in a map?

Post 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.
Keep Calm... Im Here!
http://tru3---clan.webs.com/
User avatar
TommyCD1
Moderator
Moderator
Posts: 1144
Joined: Tue Jun 04, 2013 8:55 am
Location: East Coast
Contact:
United States of America

Re: How do u put music in a map?

Post 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");
Attachments
music_common_list.zip
(330 Bytes) Downloaded 239 times
music_common_list.zip
(330 Bytes) Downloaded 239 times
I may not make the best maps, or be the best player, but I put a lot of time, effort, and care into my stuff. That counts for something, right? No.
Image
"Can we order a pizza?"
GameRanger ID: 913974
User avatar
Kennedy
Loyal Member
Loyal Member
Posts: 621
Joined: Sun Dec 30, 2012 12:51 pm
Location: behind u.. now u see me?
Contact:
Mexico

Re: How do u put music in a map?

Post by Kennedy »

Thanks tom
Keep Calm... Im Here!
http://tru3---clan.webs.com/
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests