Team Fortress 2

Team Fortress 2

133 ratings
Create an autoexec and class specific scripts
By slinky
A how-to on creating an autoexec.cfg, as well as having scripts that only run on certain classes.

Also included is a guide to installing Chris' Config.
2
   
Award
Favorite
Favorited
Unfavorite
Introduction
Are you scratching your head wondering what a .cfg is? Here's the short answer: An autoexec.cfg is a configuration file where you can place scripts and commands that execute every time you start Team Fortress 2. Each class .cfg (sniper.cfg, spy.cfg, etc) is a configuration file for each class, that executes every time you switch to that class in-game. Simple enough?
autoexec.cfg
Most people don't have or don't use class specific configs, but everyone has an autoexec.cfg

To create one, make sure you've disabled "Hide extensions for known file types"



Then, navigate to
C:\Program Files (x86)\Steam\SteamApps\common\Team Fortress 2\tf\cfg

If you don't see an autoexec.cfg, create a new text document (autoexec.txt) and change the file extension to .cfg

Congrats! You've created your own autoexec file. Not very hard at all.
Class Configs


Now that you've created your autoexec, you might want a script to only activate for a certain class (Stabbystabby's config for example). You can create class configs through the same method as creating the autoexec.

However, switching classes again doesn't automatically undo your scripts. You need to create a reset.cfg. Use the same method as before and create a reset.cfg, along with a cfg for each class (Note: Heavy is referred to as heavyweapons)

scout.cfg
soldier.cfg
pyro.cfg
demoman.cfg
heavyweapons.cfg
engineer.cfg
medic.cfg
sniper.cfg
spy.cfg
reset.cfg


You should have all these files in your /cfg/ folder. In the reset.cfg you simply rebind everything you've changed in other class configs (If you rebind E in spy.cfg and J in medic.cfg, reset.cfg needs to rebind both E and J). In order for the reset.cfg to actually function, you need to open each class cfg in your text editor, and before any other script type:

exec reset

This will execute the reset.cfg when you select that class, then run any scripts below it.

You're done! That's all you need for class configs.



All we're doing is resetting the modified binds in your spy.cfg to the default binds. Hence, reset.cfg
FPS Config


A lot of people can't run TF2 at above 60 fps, even at "minimum" graphics settings. There are many hidden config options that can squeeze every last frame out, at the cost of visual quality. These can double or even triple your framerate.

The most user friendly config generator is http://clugu.com/tf2mate/
Follow this along and customize it to your liking.

Once you're done, unzip all the .cfg files to your /tf/cfg folder you found earlier.

The site also provides your launch options for you to easily copy and paste; right click Team Fortress 2 in your steam library, click properties, then click "Set Launch Options"


There! You're finished! Enjoy your drastically increased FPS.
112 Comments
dapper fella 20 Apr, 2024 @ 6:54am 
10 years later and this guide is still easy to understand and still holds up, would recommend
Bishporgieborgen 4 Sep, 2023 @ 3:33am 
I tried this and now the game crashes when I pick any class.
TNT! 9 Nov, 2021 @ 9:12am 
does this work on mac, because like my autoexec wont work on mac
Bun Shapiro 6 Sep, 2021 @ 11:27am 
Thannnnnkk yoooouuuu i needed the reset cfg and havent been able to use most cfgs for sooo long
IM COME YOU 26 Apr, 2021 @ 7:59pm 
instead of making a reset script, couldn't you execute autoexec again to cut out the middleman?
kirschwasser 24 Jun, 2020 @ 3:10pm 
@nomnoms
try making your notepad and then saving it under all files instead of text document
Sillius Soddus 24 Feb, 2020 @ 5:08pm 
i simply copy the "config.cfg" file and then edit it to what i want for my class. then i rename it to the class i want to to be the config for. i put it in tf / cfg folder. not sure why its not working for you.
Nomsie 13 Feb, 2020 @ 6:11am 
regarding the class config. I tried everything from renaming and inserting new configs for each class. All to no hope, I think the location of the classconfigs may be my issue since all class configs and reset.cfg are within the Team Fortreess 2 / tf / cfg folder. Others suggest to put the scripts in their autoexec which didnt work either. Am I wrong somewhere?
slinky 5 Jan, 2020 @ 2:28pm 
@P A N no, autoexec.cfg runs automatically when you launch the game. scout, soldier, etc. configs run automatically when you pick that class, no need to exec them somewhere else. "reset.cfg" is the one you need to exec ute at the start of your class configs
shrungle 18 Nov, 2019 @ 12:51pm 
Lemme see if i understand... So i put "engineer.cfg" in "autoexec.cfg", then create "engineer.cfg" and bind my stuff in it so the autoexec will run it when i switch to the class, and then reset will clear my custom binds for my other classes? Please explain.