Setting Up Hammer for a Custom Mod

- By Raeven0
This tutorial was submited on Feb 26, 2006.

It's entirely possible to make maps for custom mods by copying and pasting the BSP into the mod's maps directory. But wouldn't it be nicer if Hammer could do all of the work for a custom mod automatically, as it does for official mods?

Well, Hammer's options allow for easy configuration of a custom mod. If you set up Hammer to use a custom mod, it will then recognize that mod's entities, use that mod's textures and other resources, copy the map into the mod's maps folder, and even run the mod for you.

To write a new mod configuration, you need only know the mod directory and have an FGD for the mod. Most custom mods have their mod directory in ./Steam/SteamApps/SourceMods/; just find the folder therein that matches your mod. Dystopia's mod directory is ./Steam/SteamApps/SourceMods/dystopia/.

An FGD is a text file with the extension .fgd (e.g., hl2-rae108.fgd). Frequently, mods include their own FGDs within the mod directory. However, it may be necessary to download an FGD from the mod's Web site, or EditLife may have an FGD for the mod.

Knowing the mod directory and having an FGD, open Hammer and pull up the Options.



Start in the Game Configurations tab. First, click the Edit button in the upper-right; from there, you can Add a new game. Having added it (and clicked Close), select it from the Configuration drop-down menu.



In the Game Data files section, click Add and add the FGD that you were supposed to have.

Leave Texture Format at Materials and Map Type as Half-Life 2.

For the Default Point-Entity class, you choose the point-entity that Hammer will default to when the mod configuration is loaded. A relatively common one is good, like info_player_start or light. Likewise for the Default SolidEntity class: try a common brush like func_brush or trigger_multiple.

Default texture scale, Default lightmap scale, and Cordon texture can be left alone unless you have a special need--e.g., your mod rescales maps from how they appear in Hammer, making the default scales bad.

For Game Executable Directory, you'll write the location of the main game executable. Since all mods are technically mods of HL2, as opposed to CS:S or DOD:S, you should write $SteamUserDir\half-life 2\hl2 (note the backslashes). Hammer will automatically parse $SteamUserDir as your Steam user directory--./Steam/SteamApps/[account]/.

For the Game Directory, you want to write the mod directory. Remember that this is something like ./Steam/SteamApps/SourceMods/SomeMod; for Hammer, this can be safely written as $SteamDir\SteamApps\SourceMods\SomeMod (note the backslashes again). $SteamDir represents the root Steam folder, where steam.exe is located.

For the Hammer VMF Directory, you can write whatever you want. This is the default save directory for your maps; really, you're allowed to save maps wherever you like.



To make sure Hammer understands, click OK and reload the options. Open the Build Programs tab and find your mod in the drop-down list--we're now going to allow your mod's maps to be compiled.



The most popular Game Executable is $SteamUserDir\half-life 2\hl2.exe (backslashes again). From hl2.exe, it's possible to load all custom mods. Another possible game executable is $SteamDir\steam.exe--from steam.exe it is possible to load any mod, though support for that tends to be superfluous.

For the BSP, VIS, and RAD executables, the defaults are usually okay:
$SteamUserDir\sourcesdk\bin\vbsp.exe
$SteamUserDir\sourcesdk\bin\vvis.exe
$SteamUserDir\sourcesdk\bin\vrad.exe
You may have downloaded custom compilation tools; if you have, they need to be declared here instead of the V tools.

"Place compiled maps in this directory before running the game" is pretty self-explanatory: choose the maps directory for your mod. This is always just the folder named maps located in the aforementioned mod directory.



Click OK and you're almost done.

In most cases, Hammer now needs a bit more help to run the mod after map compilation.

Begin to compile a map, but don't click Go! in the compilation dialogue box. (Reach this box by clicking File, then Run Map. If a button labeled Expert appears in the lower left corner of the dialogue box, click that. Do not click the button if it reads Normal.)

Select the $game_exe command from the large box on the left. In the Parameters box on the right, several parameters are listed, such as +map $file. Try to find a parameter called -game [anything] in this box. If you find it, remove both -game and whatever was immediately after it.

Then go back to the beginning of the Parameters string--the far left of the Parameters box. Write -game $gamedir before whatever is present there (with a space immediately after $gamedir, obviously). This instructs Steam that $game_exe (which we defined as hl2.exe) should be run, and load the game in $gamedir (which we defined as our mod directory)--thus, the mod is loaded.

If the game executable had been defined as steam.exe instead, we would simply write -applaunch 220 -game $gamedir instead of just the -game $gamedir. This would specifically instruct Steam to load HL2 (its applaunch code is 220), then load the game in $gamedir.

My $game_exe parameters thus read like this:
-game $gamedir +map $file

This should be done likewise for the $bsp_exe, $vis_exe, and $light_exe lines. Ensure that they all have these parameters:
-game $gamedir $path\$file

This ensures that the compilation tools also read materials and such from the correct folder.

You may now load the SDK tools using your mod configuration. It will appear in the drop-down menu in the Source SDK dialogue box.



Important Note: If ever you use the Reset Game Configurations tool, to fix miscellaneous problems with Hammer, you will be required to recreate your mod configuration!



Still need help? Ask your questions in one of our HELP FORUMS
Post A Comment
Name:
Email: Links Not Allowed In Comments
Comment:
What is the capital of France? Need Help?
Comments
Jim the Hermit - Mar 22, 2009
Can anyone tell me how to fix "Could not load: gameui" error. For the love of God.
99headhunter99 - Aug 9, 2008
You lost me at:
Begin to compile a map, but don't click Go! in the compilation dialogue box. (Reach this box by clicking File, then Run Map. If a button labeled Expert appears in the lower left corner of the dialogue box, click that. Do not click the button if it reads Normal.) unless I start a new map it doesnt have file, run map. And once i hit run map it just opens up save as menu.
Robin Bowin - Oct 22, 2007
When I did a map to Zombie Master I didn't need to do anything but what is written in this tutorial and thats good thanks for this tutorial. :)
Raeven0 - Mar 24, 2006
Limpet's response is [url=http://www.editlife.net/forums/viewtopic.php?t=815]here[/url], uncorrupted by failed parsing. Note that the system not finding the specified file is almost always the result of the specified file not being created, due to error.
Limpet - Mar 24, 2006
Wow, that post just got killed. I'll make a post in General Editing section for you. Kinda sucks that backslashes and linebreaks get cutout.
Limpet - Mar 24, 2006
Each command requires different parameters, so before you try to run the map you must make the .bsp first. First add your $bsp_exe command and add -game $gamedir $path$file for it's parameters. What this does it starts your bsp compiler specified during configuration and passes it those parameters. The parameters really are just peices of a long string to make the file path which may end up being something like C:Program FilesValveSteamSteamApps<steamname>sourcesdk_contenthl2mapsrc estmap when everything is all peiced together. Watch the console next time your compile your map and you should see it when it says it's executing the bsp/vis/rad compiler. The same parameters should used for $vis_exe and $light_exe commands since you use the same file. When you use the $game_exe command you'll use different parameters to launch the game and have it load your map itself. As you've used before, you'll want to use -game $gamedir +map $file as the parameters. This loads the game and puts +map "mapname.bsp" in the command line. -dev -console -allowdebug can go before or behind -game $gamedir +map $file but not in the middle of it. There should be other examples of compiling configurations when you switch to expert mode.
polka - Mar 24, 2006
nice tut, but you loose me in the end, during expert compile setup i get "system cannot find specified file" i just pasted -game $gamedir +map $file into game.exe, bsp,vis, and light parameters + where does -dev -console -allowdebug go in the equation? thanks i´ve been looking for this tut.
All original content ©2006 EditLife.net. All Rights reserved. All files property of their rightful owners.
Get Firefox! Get Thunderbird! Get Notepad++!