[Spoilers(?)] Changing music to only play during a set event?

Discuss problems related to FTL here. If you are having a problem or experiencing a bug PLEASE READ THE "MUST READ" POST.
Glowbomb12
Posts: 6
Joined: Thu Oct 11, 2018 1:25 am

[Spoilers(?)] Changing music to only play during a set event?

Postby Glowbomb12 » Thu Oct 11, 2018 1:39 am

Hello, I am completely new to this forum, and wanted to ask if there was a way where I can have the Federation bonus music play when I'm in the Last Stand sector, but then change to the Last Stand music only when I'm fighting the flagship. I've gotten as far as slipping in the audio into where it needs to be and I've set the game to be able to play it, but I noticed that the game would just cycle between the 2 tracks with what I currently have. Unless I can just set Federation as "explore" and Last Stand as "battle", I cant think of any other way that I can get my idea to work.

Thank you in advance.
User avatar
mr_easy_money
Posts: 589
Joined: Fri May 29, 2015 9:05 pm
Location: A galaxy far, far away

Re: [Spoilers(?)] Changing music to only play during a set event?

Postby mr_easy_money » Thu Oct 11, 2018 5:05 am

Let me preface this by saying this topic would be more suited to the Mod Development subforum.
Glowbomb12 wrote:Hello, I am completely new to this forum
Hello!
Glowbomb12 wrote:wanted to ask if there was a way where I can have the Federation bonus music play when I'm in the Last Stand sector, but then change to the Last Stand music only when I'm fighting the flagship.
I don't think it would be possible to set it only during the flagship fight, but it is possible to make it play separate tracks in combat and explore.
Glowbomb12 wrote:I've gotten as far as slipping in the audio into where it needs to be and I've set the game to be able to play it, but I noticed that the game would just cycle between the 2 tracks with what I currently have.
okay, so it sounds like
1) you created a new <track> in sounds.xml and added that track to the final sector in sector_data.xml. as you said that will add a new song to play after the current song ends.
2) which means you know how to make a mod...? otherwise how would you have added a new track...?
Glowbomb12 wrote:Unless I can just set Federation as "explore" and Last Stand as "battle", I cant think of any other way that I can get my idea to work.
Yeah instead you should do that, which as I said is close to what you want but not quite. Last Stand song will play in all sector 8 battles, but it's pretty close. But it's also important to note that when you start a battle the song will play from wherever you left off in the explore song, since the regular tracks are designed to fade into each other to make it natural.

Anyways, it sounds like you already know where the music should go and how to create a <track> in sounds.xml, so basically you just change the <explore> of the "laststand" <track> to whatever the Federation (Bonus) track's file name is, and then add a <combat> tag below it with the name of the Last Stand track (bp_MUS_LastStand.ogg). You shouldn't need to edit sector_data.xml.

(Vanilla sounds.xml for reference)

Code: Select all

<music>
   ...
   <track>
      <name>laststand</name>
      <explore>bp_MUS_LastStand.ogg</explore>
   </track>
   ...
</music>
if you only play vanilla without other sound mods, you can just add the entire <music> tag (like you probably did to add the separate track) and change the <track> with <name> laststand:

Code: Select all

<!-- this is sounds.xml.append -->
<music>
   ...
   <track>
      <name>laststand</name>
      <explore>{put the file name of the bonus track here, including extension}</explore>
      <combat>bp_MUS_LastStand.ogg</combat>
   </track>
   ...
</music>
That should work.

But like I said if you play with multiple sound mods, this is a better approach:

(Note that as of FTL 1.6.1+, music in audio/ must be in .ogg format)
The below is functionally equivalent to rewriting all of vanilla's <music> and making edits to change the laststand <track>. However, the special tags here will not break mods that add/modify <music> in any way, except for changes to the laststand <track>. I've explained what each command does in comments.

Code: Select all

<mod:findLike type="music"><!-- find the <music> tag -->
   <!-- find the <track> with <name>laststand</name> -->
   <mod:findWithChildLike type="track" child-type="name"><mod:selector>laststand</mod:selector>
      <!-- set the explore track to be the Federation bonus song, the combat track to be the Last Stand song -->
      <mod-overwrite:explore>{put the name of the bonus track here}</mod-overwrite:explore>
      <mod-append:combat>bp_MUS_LastStand.ogg</mod-append:combat>
   </mod:findWithChildLike>
</mod:findLike>
Glowbomb12
Posts: 6
Joined: Thu Oct 11, 2018 1:25 am

Re: [Spoilers(?)] Changing music to only play during a set event?

Postby Glowbomb12 » Thu Oct 11, 2018 11:04 pm

mr_easy_money wrote:Let me preface this by saying this topic would be more suited to the Mod Development subforum.
Glowbomb12 wrote:Hello, I am completely new to this forum
Hello!
Glowbomb12 wrote:wanted to ask if there was a way where I can have the Federation bonus music play when I'm in the Last Stand sector, but then change to the Last Stand music only when I'm fighting the flagship.
I don't think it would be possible to set it only during the flagship fight, but it is possible to make it play separate tracks in combat and explore.
Glowbomb12 wrote:I've gotten as far as slipping in the audio into where it needs to be and I've set the game to be able to play it, but I noticed that the game would just cycle between the 2 tracks with what I currently have.
okay, so it sounds like
1) you created a new <track> in sounds.xml and added that track to the final sector in sector_data.xml. as you said that will add a new song to play after the current song ends.
2) which means you know how to make a mod...? otherwise how would you have added a new track...?
Glowbomb12 wrote:Unless I can just set Federation as "explore" and Last Stand as "battle", I cant think of any other way that I can get my idea to work.
Yeah instead you should do that, which as I said is close to what you want but not quite. Last Stand song will play in all sector 8 battles, but it's pretty close. But it's also important to note that when you start a battle the song will play from wherever you left off in the explore song, since the regular tracks are designed to fade into each other to make it natural.

Anyways, it sounds like you already know where the music should go and how to create a <track> in sounds.xml, so basically you just change the <explore> of the "laststand" <track> to whatever the Federation (Bonus) track's file name is, and then add a <combat> tag below it with the name of the Last Stand track (bp_MUS_LastStand.ogg). You shouldn't need to edit sector_data.xml.

(Vanilla sounds.xml for reference)

Code: Select all

<music>
   ...
   <track>
      <name>laststand</name>
      <explore>bp_MUS_LastStand.ogg</explore>
   </track>
   ...
</music>
if you only play vanilla without other sound mods, you can just add the entire <music> tag (like you probably did to add the separate track) and change the <track> with <name> laststand:

Code: Select all

<!-- this is sounds.xml.append -->
<music>
   ...
   <track>
      <name>laststand</name>
      <explore>{put the file name of the bonus track here, including extension}</explore>
      <combat>bp_MUS_LastStand.ogg</combat>
   </track>
   ...
</music>
That should work.

But like I said if you play with multiple sound mods, this is a better approach:

(Note that as of FTL 1.6.1+, music in audio/ must be in .ogg format)
The below is functionally equivalent to rewriting all of vanilla's <music> and making edits to change the laststand <track>. However, the special tags here will not break mods that add/modify <music> in any way, except for changes to the laststand <track>. I've explained what each command does in comments.

Code: Select all

<mod:findLike type="music"><!-- find the <music> tag -->
   <!-- find the <track> with <name>laststand</name> -->
   <mod:findWithChildLike type="track" child-type="name"><mod:selector>laststand</mod:selector>
      <!-- set the explore track to be the Federation bonus song, the combat track to be the Last Stand song -->
      <mod-overwrite:explore>{put the name of the bonus track here}</mod-overwrite:explore>
      <mod-append:combat>bp_MUS_LastStand.ogg</mod-append:combat>
   </mod:findWithChildLike>
</mod:findLike>


Thank you for the help, I figured that I had posted in the wrong place, but at least I know now.
I did what you mentioned about putting Federation as explore and Last Stand as combat, but the additions you made seemed to me like a better way for me to go.

Also, I don't really know how to mod, as this simply was my first try extracting and modifying the files directly, but I again thank you.
User avatar
mr_easy_money
Posts: 589
Joined: Fri May 29, 2015 9:05 pm
Location: A galaxy far, far away

Re: [Spoilers(?)] Changing music to only play during a set event?

Postby mr_easy_money » Fri Oct 12, 2018 2:06 am

Glowbomb12 wrote:Also, I don't really know how to mod, as this simply was my first try extracting and modifying the files directly, but I again thank you.

well I'm not sure what you mean by "extracting and modifying the files directly". if you're not making a mod file and patching it with slipstream mod manager then my mod-compatible "additions" will not work.
Glowbomb12
Posts: 6
Joined: Thu Oct 11, 2018 1:25 am

Re: [Spoilers(?)] Changing music to only play during a set event?

Postby Glowbomb12 » Fri Oct 12, 2018 11:14 pm

mr_easy_money wrote:
Glowbomb12 wrote:Also, I don't really know how to mod, as this simply was my first try extracting and modifying the files directly, but I again thank you.

well I'm not sure what you mean by "extracting and modifying the files directly". if you're not making a mod file and patching it with slipstream mod manager then my mod-compatible "additions" will not work.


I didn't use slipstream for this, but just used an (un)packer program and added the code in like that, but I got resource.dat and data.dat by packing the same thing into those two. I presume ill have to find where the unmodified versions are and replace them? (This is without your method, as I realized I don't use many music mods).
User avatar
mr_easy_money
Posts: 589
Joined: Fri May 29, 2015 9:05 pm
Location: A galaxy far, far away

Re: [Spoilers(?)] Changing music to only play during a set event?

Postby mr_easy_money » Sat Oct 13, 2018 2:35 am

Glowbomb12 wrote:just used an (un)packer program and added the code in like that, but I got resource.dat and data.dat by packing the same thing into those two. I presume ill have to find where the unmodified versions are and replace them?

ah I see. yeah modding approach is probably better in the long run, but this is okay. well actually if you have data.dat then you don't need to unpack and repack -- you can edit it directly as it is text. just make sure to create backups of whichever files you change, otherwise you'll have to reinstall (which actually is no big deal). finding the unmodified versions should be easy... wouldn't you have had to find them to unpack? well possibly not I suppose. they'd be wherever FTL is installed.

but then if you have data.dat and resource.dat that means you're on FTL 1.5.13, which isn't the latest version of FTL (current is 1.6.8). that's why I was confused when you said "modifying directly", because the new ftl.dat file is uneditable and Slipstream is the only thing I know of that can repack it, which requires mods to make changes.
Glowbomb12
Posts: 6
Joined: Thu Oct 11, 2018 1:25 am

Re: [Spoilers(?)] Changing music to only play during a set event?

Postby Glowbomb12 » Sat Oct 13, 2018 9:53 am

mr_easy_money wrote:
Glowbomb12 wrote:just used an (un)packer program and added the code in like that, but I got resource.dat and data.dat by packing the same thing into those two. I presume ill have to find where the unmodified versions are and replace them?

ah I see. yeah modding approach is probably better in the long run, but this is okay. well actually if you have data.dat then you don't need to unpack and repack -- you can edit it directly as it is text. just make sure to create backups of whichever files you change, otherwise you'll have to reinstall (which actually is no big deal). finding the unmodified versions should be easy... wouldn't you have had to find them to unpack? well possibly not I suppose. they'd be wherever FTL is installed.

but then if you have data.dat and resource.dat that means you're on FTL 1.5.13, which isn't the latest version of FTL (current is 1.6.8). that's why I was confused when you said "modifying directly", because the new ftl.dat file is uneditable and Slipstream is the only thing I know of that can repack it, which requires mods to make changes.


Oh, that would make more sense then.

The only issue im having is how do I put the modded data.dat and resource.dat back? ive looked at the readme file and the actual page of FTL UnPacker 1.0.1, but im still clueless as to where specifically do I put them in? Because after I changed what I wanted, I packed all the folders (In one group) I got from ftl.dat twice, once doing into data.dat, and the second time into resource.dat.
This is where im stuck, because I know im doing something wrong, but I don't know where in the ftl root folder they go, nor anything else past that.

Any way I could fix this? Because all the guides ive seen and read basically leave there and expect for me to know how to finish that part.
User avatar
mr_easy_money
Posts: 589
Joined: Fri May 29, 2015 9:05 pm
Location: A galaxy far, far away

Re: [Spoilers(?)] Changing music to only play during a set event?

Postby mr_easy_money » Sat Oct 13, 2018 12:44 pm

Glowbomb12 wrote:The only issue im having is how do I put the modded data.dat and resource.dat back? ive looked at the readme file and the actual page of FTL UnPacker 1.0.1, but im still clueless as to where specifically do I put them in? Because after I changed what I wanted, I packed all the folders (In one group) I got from ftl.dat twice, once doing into data.dat, and the second time into resource.dat.
This is where im stuck, because I know im doing something wrong, but I don't know where in the ftl root folder they go, nor anything else past that.

Any way I could fix this? Because all the guides ive seen and read basically leave there and expect for me to know how to finish that part.

um... so this is what I meant.

let's start from the beginning. FTL used to have its game files as data.dat and resource.dat. FTL UnPacker supports that previous format. However, when 1.6.1 released, it not only merged the data.dat and resource.dat into one file, but the format of the file also changed. Hence why it's uneditable by text editor and the only repacker is Slipstream.

so when you say you unpacked ftl.dat and repacked it into data.dat and resource.dat, there's nothing to be done, nowhere to put them. you've unpacked the current format and got yourself 2 files that are no longer recognized by the game.
~~~
so then I guess you should just get slipstream and make this into a mod. creating a mod is really not that bad, and the current version of slipstream can do some basic setup via "New Mod...". tell it to create 'audio' and 'data' folders.

then when that's done, create a folder called 'music' inside of 'audio' and place the Federation Bonus track there, making sure it is in .ogg format (.wav would be too big). then inside the 'data' folder make a text file called sounds.xml.append (making sure that the file type is now .append) and add the simple version or my fancy version of the code (making sure to specify the proper file). after that select the 3 main folders: audio, data, mod-appendix (this is just for mod description in slipstream, no effect on game) and zip them up into a .zip file. rename the .zip extension to .ftl or go to the preferences of slipstream and allow_zip. add the new .zip/.ftl file to the mods folder of slipstream, patch the mod and voila!
~~~
though I do have to ask... how did you accomplish this?
Glowbomb12 wrote:I've gotten as far as slipping in the audio into where it needs to be and I've set the game to be able to play it, but I noticed that the game would just cycle between the 2 tracks with what I currently have.
Glowbomb12
Posts: 6
Joined: Thu Oct 11, 2018 1:25 am

Re: [Spoilers(?)] Changing music to only play during a set event?

Postby Glowbomb12 » Sun Oct 14, 2018 12:54 am

mr_easy_money wrote:
Glowbomb12 wrote:The only issue im having is how do I put the modded data.dat and resource.dat back? ive looked at the readme file and the actual page of FTL UnPacker 1.0.1, but im still clueless as to where specifically do I put them in? Because after I changed what I wanted, I packed all the folders (In one group) I got from ftl.dat twice, once doing into data.dat, and the second time into resource.dat.
This is where im stuck, because I know im doing something wrong, but I don't know where in the ftl root folder they go, nor anything else past that.

Any way I could fix this? Because all the guides ive seen and read basically leave there and expect for me to know how to finish that part.

um... so this is what I meant.

let's start from the beginning. FTL used to have its game files as data.dat and resource.dat. FTL UnPacker supports that previous format. However, when 1.6.1 released, it not only merged the data.dat and resource.dat into one file, but the format of the file also changed. Hence why it's uneditable by text editor and the only repacker is Slipstream.

so when you say you unpacked ftl.dat and repacked it into data.dat and resource.dat, there's nothing to be done, nowhere to put them. you've unpacked the current format and got yourself 2 files that are no longer recognized by the game.
~~~
so then I guess you should just get slipstream and make this into a mod. creating a mod is really not that bad, and the current version of slipstream can do some basic setup via "New Mod...". tell it to create 'audio' and 'data' folders.

then when that's done, create a folder called 'music' inside of 'audio' and place the Federation Bonus track there, making sure it is in .ogg format (.wav would be too big). then inside the 'data' folder make a text file called sounds.xml.append (making sure that the file type is now .append) and add the simple version or my fancy version of the code (making sure to specify the proper file). after that select the 3 main folders: audio, data, mod-appendix (this is just for mod description in slipstream, no effect on game) and zip them up into a .zip file. rename the .zip extension to .ftl or go to the preferences of slipstream and allow_zip. add the new .zip/.ftl file to the mods folder of slipstream, patch the mod and voila!
~~~
though I do have to ask... how did you accomplish this?
Glowbomb12 wrote:I've gotten as far as slipping in the audio into where it needs to be and I've set the game to be able to play it, but I noticed that the game would just cycle between the 2 tracks with what I currently have.


I did that by unpacking and going into both sounds.xml and sector.xml, changed em to txt and then added the code for the track (following a guide on Imgur), then I changed the extensions back and packed em.

But I see what you mean now. Ill attempt to do that way then.
Glowbomb12
Posts: 6
Joined: Thu Oct 11, 2018 1:25 am

Re: [Spoilers(?)] Changing music to only play during a set event?

Postby Glowbomb12 » Sun Oct 14, 2018 1:33 am

I now says that "It doesn't append. It clobbers" when I try validating the mods.

Heres the entire text it outputs:

@ Music Additons.ftl:
-------------------

~ This mod doesn't append. It clobbers.


FTL itself can tolerate lots of XML typos and still run. But malformed XML may break tools that do proper parsing, and it hinders the development of new tools.

Slipstream will try to parse XML while patching: first strictly, then failing over to a sloppy parser. The sloppy parser will tolerate similar errors, at the risk of unforseen behavior, so satisfying the strict parser is advised.

-------------------

This happened both when I used a backup of the game's sounds.xml with my additions to it, and when I just made the same name for a text file, then stuck my code in alone before changing the file name and such.

Who is online

Users browsing this forum: No registered users and 4 guests