Mini-mod tutorial

From Valve Developer Community
Revision as of 19:24, 5 August 2008 by TheRatcheteer (talk | contribs) (First off: a space is important here)
Jump to: navigation, search

Half-Life 2 Making your own Mini-mod

Ok so you don't know C++ and have no idea what a cpp file is, but that doesn't limit you to the normal HL2 style game play on your custom single player map.

This tutorial is going to teach you how to make a CFG file and how to execute it from inside your map.

First thing to think about is that you are only limited by commands you can type in the console. With that said there are a lot of little things you can do to make your map different from others.

For example, you can change the distance the gravity gun can pull from, the speed it throws objects, you can change the max ammo a weapon can carry, you could activate colliding ragdolls, or even the damage a weapon deals. Anything you can set in the console. So start looking through those commands.

First off

Open notepad.

Now for anything you want to happen for your map, type as you would in the console. In my case the first two lines read:

sv_cheats 1

bind "tab" "incrementvar host_timescale 0.25 1 0.75; incrementvar mat_yuv 0 1 1"

That's the command to bind that action to the 'tab' key. It will act like bullet time and switch on/off. Try not to bind anything that is already used like 'e' or 'z.' That would be a silly thing to do.

To string commands together use the ; character.

If there is any thing else particular to your map that you want to add do that too. Mine looks like this:

sv_cheats 1

bind "tab" "incrementvar host_timescale 0.25 1 0.75; incrementvar mat_yuv 0 1 1"

cl_ragdoll_collide 1

sk_max_ar2_altfire 10

When you go to save, make sure you have "all files" selected in the 'save as type' drop down, and save it as X.cfg (where X is the name you want it to be) in the following directory:

\steam\SteamApps\[user name]\half-life 2\hl2\cfg

Create a map

Add a logic_auto into your map. (I like to keep it next to the player start to keep track of things.) Now add a point_clientcommand next to that, and name it "console."

Then in the outputs for your logic_auto fill it out like this:

Output: OnMapSpawn

Target entites named: console

Via this input: Command

With a parameter override of: exec YOURCFGNAME

What this does is once your map loads the logic_auto tells the point_clientcommand to load the cfg file you chose, essentially typing in all the console commands you entered into that file.

That's it.. all your changes should be loaded for your player. For added professionalism you could add some game_text entities with little messages like "'tab' bullet time on/off" So your player knows about the new button changes.


All you have to do is make sure you add the cfg file to your map folder containing your bsp files and stuff. And make sure you give instructions on moving it to the cfg folder.


Because the bind command is actually binding commands to a key, even without the cfg file in your HL2 directory those commands will be kept.

Make a new cfg file called uninstallyourmapname.cfg And make sure all the key you binded are removed i.e:

bind "tab" ""

That will remove that binding in my example. Distribute this file with you map, and write instructions on performing the uninstall.


The downside is, your commands will stay loaded even when the player stops playing your map and plays another one like an official HL2 maps. Or even quits HL2 (so use the uninstall method to clean things up. And thirdly im only learning all this and there are some bugs to iron out but you guys can work around 'em. And if any one knows a way to slow the audio down with console commands, I’d love to make that bullet time effect cooler, so let me know.


Alternatively, you could just create a point_clientcommand entity. Then in the outputs for an object, you could fill it out:

Via this input: Command

With a parameter override of: ENTERCOMMANDHERE

Difference: You don't have to create a .cfg file, you would only have to create one output for every command (you can still string commands together with ;).