Team Fortress Classic | Configs | Organization

Team Fortress Classic Configs: Organization

Before we dive into organization, it is important to understand the hierichy of config files.

The Various Config Files

autoexec.cfg

This is executed once, when TFC first starts up. It's a good place to configure settings, such as +mlook for mouse look, but it's not a good idea to put binds or aliases in here. Any settings or binds done in here could potentially be over written by the next thing to run (config.cfg).

A couple of good settings to put in autoexec are the following, which control when the other config files run:

setinfo "ec" "1" //exec {classname}.cfg automatically when loading a class
setinfo "em" "1" //execs {mapname}.cfg automatically when joining or switching maps.
Setting any of these to "0" disables it.

config.cfg

This is the one that causes all the pain! All the current settings and bindings, including any changes you've made using TFCs configuration menu, will be saved in here automatically when the game quits. The problem is that config.cfg runs three separate times as TFC starts, after most of the other configs, sometimes overwriting settings that you may have put into other files. As an example, if you currently have key x bound to "discard", and then you add "bind x +detdispenser" to autoexec.cfg, when you load up TFC you'll find that x still does a discard. This is because config.cfg, which contains the settings from the last game, ran AFTER autoexec, and rebound x back to discard. A quick & dirty way to fix this is to pull down the console after joining the game and manually "exec autoexec.cfg". X will now be bound to +detdispenser, and when you quit the game, config.cfg will be updated. Subsequent games should then work OK. There are much better ways to do it than this though, see later. Another point to note is that by default, config.cfg contains no settings and a complete key binding list, but no aliases at all. More on this later too.

mapdefault.cfg

This doesn't exist by default, but if you create it it'll run when you first join a game and also whenever the map switches - regardless of which map it switches to. This can be useful, since neither config.cfg or autoexec.cfg run when the map switches. If you want to put things back to default settings after running special configuration for a particular map, this is a good place to do it.

{mapname}.cfg (e.g. well.cfg, 2fort.cfg, totalwar.cfg)

This loads just after the map called {mapname} loads, either when joining a map or when the map changes from one to another. These config files useful for setting up configurations which are specific to a particular map, such as communication sets for Hunted, or even a different brightness level for a particular map. Remember though that if you change anything unusual, such as brightness, you're going to have to reset it somewhere when the next map loads. Know what the next map to load will be? No chance - so to avoid having to have a {mapname}.cfg for EVERY possible map, and reset the brightness in ALL if then - just do it in mapdefault.cfg.

{classname}.cfg (e.g. medic.cfg, soldier.cfg)

One of these files loads whenever you become a particular class - i.e. when joining a game, after the map changes, or when you switch classes or teams in the middle of a map. The best thing about the classname.cfg is that it's the very last config file to run in all these cases. You can be sure that anything set up in here won't be overwritten bythe damned config.cfg running again. Because of this, many people edit add a line to every {classname}.cfg which calls out and exec's another config file - let's call it classdefault.cfg - in which you can set up all sorts of things which will now apply to all classes.

So Exactly What Order Do the Config Files Run In?

When joining a game:

(TFC loads)
autoexec.cfg
config.cfg
config.cfg again
("Player has joined the game" appears)
mapdefault.cfg
{mapname}.cfg (if "em" has previously been set to 1)
config.cfg
(The map intro text appears, and you click to continue)
(You select your team)
(You select your class)
{classname}.cfg (if "ec" has previously been set to 1)
(You enter the game)

When the map changes:

mapdefault.cfg
{mapname}.cfg
(You select your team & class)
{classname}.cfg

When switching classes or teams:

{classname.cfg}

Config Organization

With config files, there are any number of ways to organize them depending on any number of factors. The following method is the simplest, and most effecient that I know of. I also know of other people that have each alais is its own config file - that is executed on command. If you are just starting out, go with the system we suggest here - then grow from there. To get a visual of what is being described here, download Warthog's Config.

An effective config system is using autoexec.cfg as your main config where all general purpose binds and aliases are placed. With a couple additional commands placed here as well, Class configs will be loaded automatically when you switch classes. This offeres a simple and powerful method to organizing your configs. Let's roll.

Make sure this command line is your autoexec.cfg
setinfo ec "1"
This command automatically executes the [classname].cfg when you switch classes. So effectively, you can have the same key proform different functions for each class - and all you had to do was switch to the other class.

Here's how the setup above actually works. I'll just set up one or two things to show how it fits together, a real example would be much bigger...

I join a game and autoexec.cfg runs. Along with basic movement binds, it contains:

setinfo ec "1" // exec [classname].cfg automatically when loading a class
bind mouse3 "quickweapon" // for quickweapon alias as defined in each class.cfg
Next, config.cfg runs. Twice. It puts my settings and binds to the way they were when I last quit the game - note that depending what map & class I was playing, that might not be what I want now. If I happened to have changed some of the information in autoexec.cfg - I'll have to pull down the console and type "exec autoexec.cfg" (without quotes) to get them to operate (just the way things work.. Don't shoot the messenger).

Now let's say I start to play as a medic. Medic.cfg will run next.

// Quick Weapon
alias quick1 "tf_weapon_supershotgun;wait;alias quickweapon quick2"
alias quick2 "tf_weapon_superng;wait;alias quickweapon quick1"
alias quickweapon quick1

// Weapon
bind MOUSE2 +attack2 // this automatically pulls out the medkit to infect/heal
bind c "say_team If you're infected; stand still and call for a medic." bind g "say_team Your welcome. Don't forget to call me in the morning now."
I have removed comm information from this simple diagram for ease and also because Voice Comm allows for far superior team coordination. Thats it - as a medic with a set tailored to the class. If you switch classes - no problem. All the settings will take care of themselves.




IGN.com | GameSpy | Comrade | Arena | FilePlanet | GameSpy Technology
TeamXbox | Planets | Vaults | VE3D | CheatsCodesGuides | GameStats | GamerMetrics
AskMen.com | Rotten Tomatoes | Direct2Drive | Green Pixels
By continuing past this page, and by your continued use of this site, you agree to be bound by and abide by the User Agreement.
Copyright 1996-2009, IGN Entertainment, Inc.   About Us | Support | Advertise | Privacy Policy | User Agreement Subscribe to RSS Feeds RSS Feeds
IGN's enterprise databases running Oracle, SQL and MySQL are professionally monitored and managed by Pythian Remote DBA.