Soundscript can't be packed into map correctly

Fiend558

L1: Registered
Nov 23, 2021
8
0
Hey, I have a map where I need this soundscript to work, which it normally does, when I put it in the folder with my map, but for some reason, it ceases functioning when packed into the bsp itself. Does anyone know how I could fix this?
 

Attachments

  • koth_fiendish_level_sounds.txt
    121 bytes · Views: 61

Fiend558

L1: Registered
Nov 23, 2021
8
0
Have you tried caching the soundfile by putting an unused ambient_generic somewhere in the map? This helped on one of my maps where I had a similar issue.
Sorry, but I'm sorta new to hammer and I don't really understand what you mean by caching the soundfile.
 

worMatty

Repacking Evangelist
aa
Jul 22, 2014
1,258
999
Have you tried caching the soundfile by putting an unused ambient_generic somewhere in the map? This helped on one of my maps where I had a similar issue.
This is not necessary. Sound files inside a soundscript are all already cached.

OP, you may have packed the sound file into an incorrect directory inside the BSP. How are you packing it? And does the soundscript filename match the map's filename exactly, excluding the _level_sounds suffix?
 

Fiend558

L1: Registered
Nov 23, 2021
8
0
This is not necessary. Sound files inside a soundscript are all already cached.

OP, you may have packed the sound file into an incorrect directory inside the BSP. How are you packing it? And does the soundscript filename match the map's filename exactly, excluding the _level_sounds suffix?
Firstly, I'm just using pakrat and manually using that to pack the soundscript into the bsp, and secondly, the soundscript is named koth_fiendish_level_sounds and the map is called koth_fiendish.
 
Last edited:

Cyberen

L3: Member
Mar 30, 2021
143
30
This is a good question, I just added mine with CompilePal, but I can't seem to pack cubemaps in with it.
 

worMatty

Repacking Evangelist
aa
Jul 22, 2014
1,258
999
If the file is still present in your maps folder in addition to being packed into the map, you should still be hearing the sounds. I suppose it's possible that you have packed the file correctly, and TF2 is using that instead of the unpacked file, but something is preventing the sounds from emitting. I would reload TF2, enable developer 1 in the console, then load the map and check the console for errors.

If you want you can upload a copy of your packed map here and I will test it.

I advise against using Pakrat to pack custom files. It has a bug which does something to the map which renders it unable to be packed again. For single files I suggest VIDE, or using BSPZIP via the command line, but CompilePalX's auto packer will detect and pack most assets without problems.
 
Last edited:

Fiend558

L1: Registered
Nov 23, 2021
8
0
If the file is still present in your maps folder in addition to being packed into the map, you should still be hearing the sounds. I suppose it's possible that you have packed the file correctly, and TF2 is using that instead of the unpacked file, but something is preventing the sounds from emitting. I would reload TF2, enable developer 1 in the console, then load the map and check the console for errors.

If you want you can upload a copy of your packed map here and I will test it.

I advise against using Pakrat to pack custom files. It has a bug which does something to the map which renders it unable to be packed again. For single files I suggest VIDEom, or using BSPZIP via the command line, but CompilePalX's auto packer will detect and pack most assets without problems.
Here's the map.
How exactly do you use compilepal to pack stuff? I imagine I'd have to manually add the soundscript
 

Attachments

  • koth_fiendish.bsp
    5.3 MB · Views: 53

worMatty

Repacking Evangelist
aa
Jul 22, 2014
1,258
999
How exactly do you use compilepal to pack stuff?
CPX is a batch compile tool that makes it easy to compile one or more maps. It has a set of presets you can choose between, and it lets you add arguments for each compile 'step' from a list, with descriptions for each one.

One of its major selling points is that because it's a separate app to Hammer, it doesn't freeze up Hammer while it compiles so you're free to keep working on your map in the meantime. But another major selling point is its auto packer app.

Like Pakrat and VIDE, it scans your map to see which assets it should pack, but it identifies many, many more assets. It's clever enough to detect any custom script files you have with the same name as the map (e.g. soundscape and sound script files) and pack them in for you. So your soundscript file koth_fiendish_level_sounds.txt would be identified by CPX and packed for you. No need to do it manually. It's a one-stop map compiling and preparation tool.

I had a look at the contents of your map's pak file lump, using GCFScape. You have VMTs and VTFs in materials/ and lots of .mp3 files in sounds/ but nothing else. No script files, no cubemaps.

I did notice your map is repacked, though, which is good. I presume you understand what I'm talking about.

One important thing to note is that you should not put anything inside the root asset dirs like materials/ and sound/. You should always put them in sub-dirs like materials/mapname/ so they don't get overridden by assets downloaded by the client to their computer, or other maps with assets with the same filepaths packed into them. Some tools also have a bad time with assets in root dirs. This information is not related to your sound script problem but it's important.

So yes, you'll need to prepare another copy of your map for me to test, which includes the sound script file.
 

Fiend558

L1: Registered
Nov 23, 2021
8
0
CPX is a batch compile tool that makes it easy to compile one or more maps. It has a set of presets you can choose between, and it lets you add arguments for each compile 'step' from a list, with descriptions for each one.

One of its major selling points is that because it's a separate app to Hammer, it doesn't freeze up Hammer while it compiles so you're free to keep working on your map in the meantime. But another major selling point is its auto packer app.

Like Pakrat and VIDE, it scans your map to see which assets it should pack, but it identifies many, many more assets. It's clever enough to detect any custom script files you have with the same name as the map (e.g. soundscape and sound script files) and pack them in for you. So your soundscript file koth_fiendish_level_sounds.txt would be identified by CPX and packed for you. No need to do it manually. It's a one-stop map compiling and preparation tool.

I had a look at the contents of your map's pak file lump, using GCFScape. You have VMTs and VTFs in materials/ and lots of .mp3 files in sounds/ but nothing else. No script files, no cubemaps.

I did notice your map is repacked, though, which is good. I presume you understand what I'm talking about.

One important thing to note is that you should not put anything inside the root asset dirs like materials/ and sound/. You should always put them in sub-dirs like materials/mapname/ so they don't get overridden by assets downloaded by the client to their computer, or other maps with assets with the same filepaths packed into them. Some tools also have a bad time with assets in root dirs. This information is not related to your sound script problem but it's important.

So yes, you'll need to prepare another copy of your map for me to test, which includes the sound script file.
Sorry, I guess I must've removed the soundscript for the final version because it didn't work anyways.
Also, I'm not really sure what repacking means unfortunately.
For some reason, opening my map's bsp with pakrat now makes this appear instead of what I normally see, which means I can't actually use it. Not sure what to do about this.
upload_2021-12-28_19-50-55.png
 

worMatty

Repacking Evangelist
aa
Jul 22, 2014
1,258
999
I can't really test it without the sound script.

Repacking is a form of map compression. It's normally done manually using the TF2 console or Valve's BSPZIP app, but CompilePalX has it as an optional step, and all maps submitted to the TF2 Workshop are repacked automatically. I am not sure how you managed to repack your map without realising, unless Pakrat has just tricked GCFScape into thinking it's compressed.

You can't pack anything into a repacked map. You have to decompress it first. That probably explains why you are seeing different text in Pakrat's console than usual. See this thread for info on how to decompress a map, or use a clean copy instead. Remember what I said earlier about Pakrat having a bug preventing you from packing anything into the map again. It would be better for you if you just stopped using Pakrat and switched to CompilePalX and VIDE.
 

Fiend558

L1: Registered
Nov 23, 2021
8
0
I can't really test it without the sound script.

Repacking is a form of map compression. It's normally done manually using the TF2 console or Valve's BSPZIP app, but CompilePalX has it as an optional step, and all maps submitted to the TF2 Workshop are repacked automatically. I am not sure how you managed to repack your map without realising, unless Pakrat has just tricked GCFScape into thinking it's compressed.

You can't pack anything into a repacked map. You have to decompress it first. That probably explains why you are seeing different text in Pakrat's console than usual. See this thread for info on how to decompress a map, or use a clean copy instead. Remember what I said earlier about Pakrat having a bug preventing you from packing anything into the map again. It would be better for you if you just stopped using Pakrat and switched to CompilePalX and VIDE.
I'm really sorry about this. I had sent the workshop version of my map because of other issues. Here's an uncompressed version with the soundscript.
 

Attachments

  • koth_fiendish.bsp
    7.5 MB · Views: 67

worMatty

Repacking Evangelist
aa
Jul 22, 2014
1,258
999
The sound script is not packed into the right directory within the map. It should be packed in maps, but instead it's packed in C:/Users/Anakin/Desktop/koth_fiendish. TF2 won't load it unless it's in the right place.

GCFScape_2021-12-31_15-41-25.png


I copied your soundscript into my maps dir and ran the map and can confirm the two muted sound names did not play, which is your intended result. You can use the console command playgamesound to conveniently play any cached game sound. This proves your soundscript works, so your problem seems to be related to packing. CompilePalX would have put the file in the right place for you.

I would have corrected the mistake myself and tested it but VIDE will not open the map, which I presume is caused by the Pakrat bug.

Tips

To mute a sound you only need to provide a replacement sound file parameter in the soundscript; you don't need to specify anything else like pitch.
Code:
"Announcer.RoundEnds10seconds"
{
    "wave"             "common/null.wav"
}

Your sounds and materials are in the root asset dirs. It's always best to place custom assets in their own subdirectory. e.g. sound/mapname and materials/mapname. This greatly reduces the risk of conflicts and potential application problems, and aids organisation down the line.​
 

Fiend558

L1: Registered
Nov 23, 2021
8
0
The sound script is not packed into the right directory within the map. It should be packed in maps, but instead it's packed in C:/Users/Anakin/Desktop/koth_fiendish. TF2 won't load it unless it's in the right place.

GCFScape_2021-12-31_15-41-25.png


I copied your soundscript into my maps dir and ran the map and can confirm the two muted sound names did not play, which is your intended result. You can use the console command playgamesound to conveniently play any cached game sound. This proves your soundscript works, so your problem seems to be related to packing. CompilePalX would have put the file in the right place for you.

I would have corrected the mistake myself and tested it but VIDE will not open the map, which I presume is caused by the Pakrat bug.

Tips

To mute a sound you only need to provide a replacement sound file parameter in the soundscript; you don't need to specify anything else like pitch.
Code:
"Announcer.RoundEnds10seconds"
{
    "wave"             "common/null.wav"
}

Your sounds and materials are in the root asset dirs. It's always best to place custom assets in their own subdirectory. e.g. sound/mapname and materials/mapname. This greatly reduces the risk of conflicts and potential application problems, and aids organisation down the line.​
I'm not sure I understand what I do. I am aware that placing the file in the maps folder gets it to work, but is there no way to have it just be packed into the bsp itself? I was told that I could do that.
Also, I want to clarify that I'm genuinely sorry if my lack of understanding is a little frustrating at times, but I don't have much experience in mapping and am trying my best.
 

worMatty

Repacking Evangelist
aa
Jul 22, 2014
1,258
999
I'm not sure I understand what I do.
Pack the soundscript in the right directory within the map.

I am aware that placing the file in the maps folder gets it to work, but is there no way to have it just be packed into the bsp itself? I was told that I could do that.
Yes, that is what you have done, you have just put it in the wrong place, as I explained. If you insist on using Pakrat you must pay close attention to the directory structure you specify when manually adding a file. I'm not talking about the location of the file on your hard drive, I'm talking about the location of the file within the map itself. All content in a map is mounted to a root dir - the map - which mirrors the tf dir. e.g. /maps, /models, /materials etc. So when adding files, the destination directory should be relative to the map root, and not the absolute path on your hard drive. If Pakrat asks you where to save it within the map, specify maps. But as I have already said, if you use CompilePalX this will all be done automatically.

Also, I want to clarify that I'm genuinely sorry if my lack of understanding is a little frustrating at times, but I don't have much experience in mapping and am trying my best.
That's fine, but I've given you all the information you need, now you just need to digest it. I admit though that the internal file structure of the game and maps, the way content is mounted makes a lot of people stumble. Pakrat and VIDE expect the user to understand it.
 

Fiend558

L1: Registered
Nov 23, 2021
8
0
Pack the soundscript in the right directory within the map.


Yes, that is what you have done, you have just put it in the wrong place, as I explained. If you insist on using Pakrat you must pay close attention to the directory structure you specify when manually adding a file. I'm not talking about the location of the file on your hard drive, I'm talking about the location of the file within the map itself. All content in a map is mounted to a root dir - the map - which mirrors the tf dir. e.g. /maps, /models, /materials etc. So when adding files, the destination directory should be relative to the map root, and not the absolute path on your hard drive. If Pakrat asks you where to save it within the map, specify maps. But as I have already said, if you use CompilePalX this will all be done automatically.


That's fine, but I've given you all the information you need, now you just need to digest it. I admit though that the internal file structure of the game and maps, the way content is mounted makes a lot of people stumble. Pakrat and VIDE expect the user to understand it.
Thank you so much man. At one point I thought that i'd just have to give up but now it finally works.
 

worMatty

Repacking Evangelist
aa
Jul 22, 2014
1,258
999
My pleasure. Glad you got it to work. Hopefully this thread will help people who search for the same problem in future.