Add Mod Content to Hammer

From Valve Developer Community
Revision as of 08:55, 16 October 2018 by Tewan (talk | contribs) (How to add your mod's content to hammer editor without having to manually copy everything)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

For this example, I am using my mod (Portal: Revolution) on the Portal 2 engine, but this works on any engine

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 Revolution\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. My mod is called Portal: Revolution, so I will just add a mod called portal_revolution to Portal 2. Portal 2 will now have these mods:

portal_revolution
portal2
portal2_dlc1
portal2_dlc2
update

To create the mod, just create a new folder ....Portal 2/portal_revolution 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
		{
			Game				"C:\Program Files (x86)\Steam\steamapps\sourcemods\Portal Revolution" // <== The location of my 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 portal_revolution instead of portal2.

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

"Configs"
{
	"Games"
	{
		"Portal 2"
		{
			"GameDir"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\portal_revolution"
			"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 Revolution\maps"
				"PrefabDir"		"C:\Program Files (x86)\Steam\steamapps\common\Portal 2\bin\Prefabs"
				"CordonTexture"		"tools\toolsskybox"
				"MaterialExcludeCount"		"0"
			}
		}
	}
	"SDKVersion"		"4"
}

You are done! You should now be able to open hammer and see all of your 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.