Add Mod Content to Hammer: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(3 intermediate revisions by 3 users not shown)
Line 9: Line 9:
</pre>
</pre>


When you start hammer, it loads the content from the mod described in Portal 2/bin/GameConfig.txt
When you start [[Valve_Hammer_Editor|hammer]], it loads the content from the mod described in Portal 2/bin/GameConfig.txt
Portal 2's GameConfig.txt
Portal 2's GameConfig.txt
<pre>
<pre>
Line 74: Line 74:
SearchPaths
SearchPaths
{
{
                         // When the mod mod_test is mounted, all other portal 2 game content is loaded aswell.
                         // When the mod mod_test is mounted, all other portal 2 game content is loaded as well.
Game "C:\Program Files (x86)\Steam\steamapps\sourcemods\Portal Mod Test" // <== The location of the mod
Game "C:\Program Files (x86)\Steam\steamapps\sourcemods\Portal Mod Test" // <== The location of the mod
Game portal2_dlc2
Game portal2_dlc2
Line 86: Line 86:
</pre>
</pre>
What this does, is that first Portal 2's content gets loaded, and then our mod's.
What this does, is that first Portal 2's content gets loaded, and then our mod's.
Now, we need to tell hammer to load our mod mod_test instead of portal2.  
Now, we need to tell hammer to load our mod mod_test instead of portal2.


GameConfig.txt in ....Portal 2/bin/GameConfig.txt
GameConfig.txt in ....Portal 2/bin/GameConfig.txt

Latest revision as of 15:57, 5 January 2025

For this example, a mod called "Portal Mod Test" (Game name: "mod_test") will be used. This works on all engines.

Portal 2 has the following mods included:

portal2
portal2_dlc1
portal2_dlc2
update

When you start hammer, it loads the content from the mod described in Portal 2/bin/GameConfig.txt Portal 2's GameConfig.txt

"Configs" {
	"Games" {
		"Portal 2" {
			"GameDir"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\portal2"
			"Hammer" {
				"GameData0"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\portal2.fgd"
				"TextureFormat"		"5"
				"MapFormat"		"4"
				"DefaultTextureScale"		"0.250000"
				"DefaultLightmapScale"		"16"
				"GameExe"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\portal2.exe"
				"DefaultSolidEntity"		"func_detail"
				"DefaultPointEntity"		"prop_static"
				"BSP"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\vbsp.exe"
				"Vis"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\vvis.exe"
				"Light"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\vrad.exe"
				"GameExeDir"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2"
				"MapDir"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\sdk_content\maps"
				"BSPDir"		"C:\Program Files (x86)\Steam\steamapps\sourcemods\Portal Mod Test\maps"
				"PrefabDir"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\Prefabs"
				"CordonTexture"		"tools\toolsskybox"
				"MaterialExcludeCount"		"0"
			}
		}
	}
	"SDKVersion"		"4"
}

We only care about the "GameDir". As you can see, the mod portal2 get specified. If you now just copy the line and replace one of them with your mod's location, it will work, but you will always get an error message when you start hammer! This is how I got around this:

First, we need to add a new mod to Portal 2. Portal 2 will now have these mods:

mod_test
portal2
portal2_dlc1
portal2_dlc2
update

To create the mod, just create a new folder ....Portal 2/mod_test and create a new gameinfo.txt Content of our gameinfo.txt: (Copy pasted from Portal 2)

"GameInfo"
{
	game 		"PORTAL 2"
	title 		"PORTAL 2"
	GameData	"portal2.fgd"
	gamelogo 	1

	SupportsDX8     0
	SupportsXbox360 1

	FileSystem
	{
		SteamAppId				620
		ToolsAppId				211
		
		SearchPaths
		{
                        // When the mod mod_test is mounted, all other portal 2 game content is loaded as well.
			Game				"C:\Program Files (x86)\Steam\steamapps\sourcemods\Portal Mod Test" // <== The location of the mod
			Game				portal2_dlc2
			Game				portal2_dlc1
			Game				portal2
			Game				update
			platform			platform
		}
	}
}

What this does, is that first Portal 2's content gets loaded, and then our mod's. Now, we need to tell hammer to load our mod mod_test instead of portal2.

GameConfig.txt in ....Portal 2/bin/GameConfig.txt

"Configs"
{
	"Games"
	{
		"Portal 2"
		{       // The GameDir is the content hammer will load.
			"GameDir"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\mod_test"
			"Hammer"
			{
				"GameData0"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\portal2.fgd"
				"TextureFormat"		"5"
				"MapFormat"		"4"
				"DefaultTextureScale"		"0.250000"
				"DefaultLightmapScale"		"16"
				"GameExe"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\portal2.exe"
				"DefaultSolidEntity"		"func_detail"
				"DefaultPointEntity"		"prop_static"
				"BSP"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\vbsp.exe"
				"Vis"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\vvis.exe"
				"Light"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\vrad.exe"
				"GameExeDir"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2"
				"MapDir"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\sdk_content\maps"
				"BSPDir"		"C:\Program Files (x86)\Steam\steamapps\sourcemods\Portal Mod Test\maps"
				"PrefabDir"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\Prefabs"
				"CordonTexture"		"tools\toolsskybox"
				"MaterialExcludeCount"		"0"
			}
		}
	}
	"SDKVersion"		"4"
}

We're done! We should now be able to open hammer and see all of our custom content. In case you override any assets, like textures or models, you will also see those instead of Portal 2's.

Troubleshooting In case that your GameConfig.txt gets resetted, just make it read-only.