How to turn off the original music?

Place to get help with not working mods / modding interface.
Artanis_Mattias
Manual Inserter
Manual Inserter
Posts: 4
Joined: Tue Nov 20, 2018 3:30 am
Contact:

How to turn off the original music?

Post by Artanis_Mattias »

Good afternoon, I'm new here.
I must warn you right away, I do not know English very well, I am from Russia, and I am only learning it.
I made a couple of music mods, but my friends wanted something to turn off the original songs.
You do not know how this can be done?

Code: Select all

data:extend(
{
{
    type = "ambient-sound",
    name = "1",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/02_Blood_Dragon_Theme.ogg"
    }
  },   
  {
	type = "ambient-sound",
    name = "29",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft_II_Legacy_of_the_Void.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "30",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/Warhammer_40000_Dawn_of_War_II.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "31",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/SC1_Terran1.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "32",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/SC1_Terran2.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "33",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/SC1_Terran3.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "34",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/SC1_Terran4.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "35",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/TerranSC2-01.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "36",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/TerranSC2-02.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "37",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/TerranSC2-03.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "38",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/TerranSC2-04.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "39",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/TerranSC2-05.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "40",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/ZSwarm_Music_Terran7_Action.ogg"
    }
  },
 }
)
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: How to turn off the original music?

Post by darkfrei »

Not tested, but it must be like that:

Code: Select all

for i, sound in pairs (data.raw["ambient-sound"]) do
  if sound.track_type and sound.track_type == "main-track" then
   data.raw["ambient-sound"][i] = nil
  end
end
Just add it before adding your music.

(Updated)
Last edited by darkfrei on Tue Nov 20, 2018 8:07 pm, edited 1 time in total.
Artanis_Mattias
Manual Inserter
Manual Inserter
Posts: 4
Joined: Tue Nov 20, 2018 3:30 am
Contact:

Re: How to turn off the original music?

Post by Artanis_Mattias »

Thanks for the answer!
I did everything right? If yes, then, unfortunately, it did not work.

Code: Select all

for i, sound in pairs (data.raw["ambient-sound"]) do
  if sound.track_type and sound.track_type == "main-track" then
   sound = nil
  end
end
data:extend(
{
{
    type = "ambient-sound",
    name = "1",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/02_Blood_Dragon_Theme.ogg"
    }
  },   
  {
	type = "ambient-sound",
    name = "29",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft_II_Legacy_of_the_Void.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "30",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/Warhammer_40000_Dawn_of_War_II.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "31",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/SC1_Terran1.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "32",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/SC1_Terran2.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "33",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/SC1_Terran3.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "34",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/SC1_Terran4.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "35",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/TerranSC2-01.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "36",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/TerranSC2-02.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "37",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/TerranSC2-03.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "38",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/TerranSC2-04.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "39",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/TerranSC2-05.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "40",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/ZSwarm_Music_Terran7_Action.ogg"
    }
  },
 }
)
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3717
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: How to turn off the original music?

Post by DaveMcW »

Code: Select all

for key,_ in pairs (data.raw["ambient-sound"]) do
  data.raw["ambient-sound"][key] = nil
end
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: How to turn off the original music?

Post by darkfrei »

Artanis_Mattias wrote: Tue Nov 20, 2018 4:01 pm Thanks for the answer!
I did everything right? If yes, then, unfortunately, it did not work.
Yes, it was my bug, it must be deleted with the key, see above.
Artanis_Mattias
Manual Inserter
Manual Inserter
Posts: 4
Joined: Tue Nov 20, 2018 3:30 am
Contact:

Re: How to turn off the original music?

Post by Artanis_Mattias »

Unfortunately, all the music from the game is gone. Including added music added by this mod.

Code: Select all

for key,_ in pairs (data.raw["ambient-sound"]) do
  data.raw["ambient-sound"][key] = nil
end
data:extend(
{
{
    type = "ambient-sound",
    name = "1",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/02_Blood_Dragon_Theme.ogg"
    }
  },   
  {
	type = "ambient-sound",
    name = "29",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft_II_Legacy_of_the_Void.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "30",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/Warhammer_40000_Dawn_of_War_II.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "31",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/SC1_Terran1.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "32",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/SC1_Terran2.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "33",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/SC1_Terran3.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "34",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/SC1_Terran4.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "35",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/TerranSC2-01.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "36",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/TerranSC2-02.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "37",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/TerranSC2-03.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "38",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/TerranSC2-04.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "39",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/TerranSC2-05.ogg"
    }
  },
  {
	type = "ambient-sound",
    name = "40",
    track_type = "main-track",
    sound =
    {
      filename = "__CustomMusicfromMattiasPart1__/music/StarCraft/ZSwarm_Music_Terran7_Action.ogg"
    }
  },
 }
)
Post Reply

Return to “Modding help”