[SOLVED] Adding miscellaneous custom content to .bsp

Marios

L1: Registered
May 15, 2017
6
1
I've been trying to add a file into a map that is not a navigation mesh or material/model needed for the map using bspzip. Specifically, it's a text file that states the upgrades the upgrade station sells in MvM. It goes in scripts/items.

To see if the method to make the game to use a custom upgrades file works, before attempting that, I put the upgrades file in a "custom" folder. The upgrades are indeed replaced properly. Now, when using anything I could to insert the upgrades file into scripts/items inside the map (a utility to embed files in bsps or directly by command line), it couldn't be loaded no matter what.

Googling and searching around only yielded results or tools about repacking your maps with bspzip to compress their size. But my map is a matter of kilobytes (below 1 MB) so I sure had no use for that.

Does anyone have any clues regarding this?

EDIT: The solution to this problem, for anyone else who has it, is directly below.
 
Last edited:

fubarFX

The "raw" in "nodraw"
aa
Jun 1, 2009
1,720
1,978
if you're trying to use bspzip, the command you want to write would look something like this
bspzip -addfile "C:\program files(x82)\steam\steamapps\team fortress 2\tf\maps\mvm_name.bsp" "scripts/items/popfilename.pop" "C:\program files(x82)\steam\steamapps\team fortress 2\tf\scripts\items\popfilename.pop" "C:\program files(x82)\steam\steamapps\team fortress 2\tf\maps\mvm_name.bsp"

btw, can someone give me the quick rundown on how pop files work, I'll implement pop file detection in compilepal.
 

Marios

L1: Registered
May 15, 2017
6
1
if you're trying to use bspzip, the command you want to write would look something like this
[...]
btw, can someone give me the quick rundown on how pop files work, I'll implement pop file detection in compilepal.

Well, my subject was not a pop file, but either way you showed me how that tool whose only clear function is compressing works. I'll try that tomorrow and see if it works.

Also, since you asked nicely, pop files are text files that define a mission and its robots (hence "population"). It is named the map's name, and a suffix when there's more than one mission in the map.

For example, here are Decoy's population files:

mvm_decoy
mvm_decoy_intermediate
mvm_decoy_intermediate2
mvm_decoy_advanced
mvm_decoy_advanced2
mvm_decoy_advanced3
mvm_decoy_expert

You can probably guess which mission is which. Note the first one doesn't have a suffix: That is the mission that gets loaded by default when you load the map.

Somewhere internally (I think) the missions have names far more interesting than the population file names, such as "Doe's Drill" or "Mann-euvers". Custom missions don't and cannot get the same treatment, so they are instead referred to by their population file name, such as "MVM DECOY SURVIVALOBJLESS"

In the end, all you have to do to make population files work their magic, besides writing them, is to place them in your scripts/population folder. If you don't have it, just make it. And it can be embedded in a map the same way.
 

Marios

L1: Registered
May 15, 2017
6
1
Oh right, upgrade files are a different thing. Guess I'll have to figure those out too.

That just replaces MvM upgrades. It's a simplier deal. Also a .txt file, that goes in scripts/items. Usually called "mvm_upgrades.txt" to directly overwrite the default upgrades, but a custom upgrades file can be referred to in the map for loading.
 

Hydrogen

MvM Maniac
Apr 5, 2017
84
181
@fubarFX Pop files go into /script/population.

@Jill recommended to me that when packing pop files (which you only do at the final release, not during testing) to omit the map name. e.g. mvm_mapname_advanced.pop becomes just advanced.pop, and normal mode is just normal.pop (as part of their goal to make all files independent of the map name). Moreover, bot templates usually don't start with the map name (e.g. mvm_isolation has robots_isolation.pop), so all this together you can't reliably use the map name as a check for which pop files to add.

MvM upgrade files go into scripts/items folder. Usually they are named "mvm_upgrades.txt" but it can be any other file (the mapper needs to specify this in SetCustomUpgradesFile in gamerules however).

Somewhere internally (I think) the missions have names far more interesting than the population file names, such as "Doe's Drill" or "Mann-euvers". Custom missions don't and cannot get the same treatment, so they are instead referred to by their population file name, such as "MVM DECOY SURVIVALOBJLESS"

This is defined in tf_english.txt and is referenced in items_game.txt, so it is off limits to the mission maker. See the spoiler for an example snippet.

Code:
// From items_game.txt
        "mvm_decoy"
        {
            "display_name"    "#TF_MVM_Map_Decoy"

            "missions"
            {
                "mvm_decoy"
                {
                    "display_name"    "#TF_MVM_Challenge_Decoy1"   // translation string
                    "mode"            "#TF_MVM_Challenge_Invasion"
                    "difficulty"    "normal"
                }

// From tf_english.txt
"TF_MVM_Challenge_Decoy1"        "Doe's Drill"
 

Marios

L1: Registered
May 15, 2017
6
1
As it turns out, the file got inserted in the bsp juuuust nice. Thank you very much, fubarFX!
 
Last edited: