Team Fortress 2

Team Fortress 2

52 ratings
CFG files and how to edit them
By Das Psycho
What is a CFG and how to create/edit one. BASICS
   
Award
Favorite
Favorited
Unfavorite
What
TF2 is a game that can be eddited to fit the players gamestyle, such moddification is done through the use of a notepad (or other similar tool) to edit commands which will be executed in-game.

This is an ongoing guide but feel free to suggest in comments what should be added.

I will not cover all useful or interesting things to add, mainly how to add.

**Tip, you can also generate and customize in a website to then have everything custom made for you.
https://cfg.tf/
Alternatively you can use https://comfig.app/ to create/modify your config, but it uses a different filetype and layout.

Strongly suggest you use cfg.tf or comfig.app to create them for you as the website is very user friendly. (Im not affiliated with them). This guide is just to help you understand the basics and to help modifying them.
Where
This is located in steam-directory>steamapps>common>teamfortress2>tf>cfg
It should look something like this below.


Go into the cfg folder and you should see some files already there but you will need to add more.

*edit.

As noted in the comments below by a very rude person. It is possible to locate the .cfg files in the custom folder. Yet, im unsure as to why someone wouldnt put a .cfg file in a CFG folder idk..
What to add
This is what mine currently looks like

I changed the view so you can see all the files here.

You will need to copy the config_default file and rename it to the names listed below EXACTLY as it is spelled

autoexec
demoman
engineer
heavyweapons
medic
pyro
scout
sniper
soldier
spy

The reason why you copy and re-name is to keep the .cfg extension as the file type.

Then delete everything inside the files and replace it with your binds like mine below.
You can keep them in there and just modify what you want to change.

This is where you keep files that will affect the quality of the game such as detail resolution and ping limits.

**Be sure to keep the commands consistent for each class.
For example, if you have the below command (key F) in ONLY the medic class and key F is not listed in heavy cfg. When playing as heavy the F key will also be used for slot 1.
bind F "slot1"

TF2 pulls all binds and all keys from all cfg files. So if F is only assigned in one class file and not assigned anything in the other files, it will be pulling it in all cases. That is why it is best to create 1 class CFG first as a template, assign all your preferred keys, then save and copy for the other classes. Revising the binds as needed. For example, I have MOUSE5 in the medic script say in team chat that i have uber ready. If i did not define MOUSE5 in any other class cfg, then while playing pyro, if i pressed MOUSE5 it was still say in team chat that i had uber. So always assign keys.

A way to bypass that would be to have the below command in my pyro class. That way pressing MOUSE5 would not say in team chat that I had uber.
unbind MOUSE5


Useful stuff to add
Listed here are Optional but useful or helpful or maybe even just fun things.

Useful stuff
The main thing to know is use other sources for more information or guidance. I made this for people who may need some help but not to explain everything. Also know that when you see '//' the two / means for the game to ignore whatever is on that line. so you can put a title such as

//--------useful stuff-------
bind __ "____;_____"
bind __ "____;_____"
bind __ "____;_____"

and it will ignore the first line, also

bind g "slot1"
//bind p "slot1"

the game will ignore the second and make only g go to slot 1

Whenever you see a 0 it means disable and 1 means enable. Below is my bind for the medic where mouse wheel up will go to my primary weapon, has a weapon viewmodel of 60, and a field of view of 90 and will hide my weapon model. With mouse wheel down it will take me to my melee, viewmodel of 65, fov of 90, and have the melee weapon show,. This is how to hide or show weapons of any class of any slot. The command for this is r_drawviewmodel

bind "MWHEELUP" "slot1;viewmodel_fov 60;r_drawviewmodel 0;fov_desired 90"
bind "MWHEELDOWN" "slot3;viewmodel_fov 65;r_drawviewmodel 1;fov_desired 90"
bind "f" "slot2;viewmodel_fov 60;r_drawviewmodel 0;fov_desired 90"

The null movement script is helpful and you can google what it does. It should be used in all the class scripts.

//Null movement script
bind w +mfwd
bind s +mback
bind a +mleft
bind d +mright

alias +mfwd "-back;+forward;alias checkfwd +forward"
alias +mback "-forward;+back;alias checkback +back"
alias +mleft "-moveright;+moveleft;alias checkleft +moveleft"
alias +mright "-moveleft;+moveright;alias checkright +moveright"
alias -mfwd "-forward;checkback;alias checkfwd none"
alias -mback "-back;checkfwd;alias checkback none"
alias -mleft "-moveleft;checkright;alias checkleft none"
alias -mright "-moveright;checkleft;alias checkright none"
alias checkfwd none
alias checkback none
alias checkleft none
alias checkright none
alias none ""

For engi, there is a thing called "autobuild" and guess what, it autobuilds for you
//autobuilds
//sentry
bind "q" "destroy 2 0; build 2 0"
//dispenser
bind "e" "destroy 0 0; build 0 0"
In this instance, it will destroy any existing sentry and build a new one, and same with dispenser, useful with minisentries. You may seperate into different keys to build or destroy.

This is a tricky one and one that you should be careful using, (use at own risk) (you may need to reset your cfgs if done incorrectly. This will hide the pyros flame particles, airblast effect, and viewmodel. (ONLY FOR PYRO) (you can change the bolded items)

//nofire
bind MWHEELUP "slot1;viewmodel_fov -1;r_drawviewmodel 1"
bind f "slot2;viewmodel_fov 60;r_drawviewmodel 0"
bind MWHEELDOWN "slot3;viewmodel_fov 60"


This next one is odd, it makes you jump and crouch at the same time (do not use with soldier or demo, it messes up your jumps)
//crouch jump
alias +crouchjump "+jump; +duck"
alias -crouchjump "-duck; -jump"
bind "SPACE" "+crouchjump"

Fun stuff
You can also edit what happens in the chat.

You can bind a key to say something in chat and also say something ingame.
bind "x" "say Thank You!;voicemenu 0 1"

Randomvoice allows you to press a button and you are able to mask ubercharge (stop medic from calling "i am fully charged" or just to shout a random command. Search the tf2 wiki for info on what the voicemenu is and what the values represent.
(ONLY CHANGE THE VALUES After the VOICEMENT command)
//randomvoice
alias "randomvoice""random1"
alias "random1""voicemenu 0 1;alias randomvoice random2"
alias "random2""voicemenu 1 1;alias randomvoice random3"
alias "random3""voicemenu 1 2;alias randomvoice random4"
alias "random4""voicemenu 2 1;alias randomvoice random5"
alias "random5""voicemenu 0 4;alias randomvoice random6"
alias "random6""voicemenu 0 7;alias randomvoice random7"
alias "random7""voicemenu 2 7;alias randomvoice random8"
alias "random8""voicemenu 2 3;alias randomvoice random9"
alias "random9""voicemenu 2 6;alias randomvoice random10"
alias "random10""voicemenu 0 5;alias randomvoice random11"
alias "random11""voicemenu 0 2;alias randomvoice random12"
alias "random12""voicemenu 1 0;alias randomvoice random1"
bind "MOUSE4" "randomvoice"

here is my dump of everything in my autoexec file, feel free to copy whatever you want, ask what they mean also

this WILL affect your gameplay, dont just copy and paste, see what you want to add, and see how i organized it

bind / "screenshot"
bind \ "screenshot"
//below for tr_walkway
sv_allow_point_servercommand always

// ----------------------------------------------------------------------------
// Added 0001

r_drawtracers_firstperson 0
tracer_extra 0
r_fastzrejectdisp 1
cl_detailfade 800
//possibly keepable
ai_expression_frametime 0.022
ai_expression_optimization 1
r_drawopaquestaticpropslast 1
cl_disablehtmlmotd 0
cl_ejectbrass 0
mat_clipz 1
cl_forcepreload 1
cl_disablehtmlmotd 1
fps_max 125

// ----------------------------------------------------------------------------
// General

sv_pure 1
mat_queue_mode -1
hud_saytext_time 2
hud_combattext_batching 1
hud_combattext_batching_window 2
r_maxdlights 12
cl_phys_timescale 0.8
mat_phong 1
mat_specular 1
mat_bumpmap 1
r_waterforceexpensive 0
r_waterforcereflectentities 0
r_shadowrendertotexture 0

// ----------------------------------------------------------------------------
//fromChris's config

cl_showhelp 0
cl_showpluginmessages 0
con_enable 1
fog_enable 0
fog_override 1

// Good connection <80ping
cl_cmdrate 66
cl_interp 0
cl_interp_ratio 1
cl_lagcompensation 1
cl_pred_optimize 2
cl_smooth 0
cl_smoothtime 0.01
cl_updaterate 66
rate 60000

// Bad connection >80ping
//cl_cmdrate 40
//cl_interp 0
//cl_interp_ratio 2
//cl_lagcompensation 1
//cl_pred_optimize 2
//cl_smooth 0
//cl_smoothtime 0.01
//cl_updaterate 40
//rate 35000

//may remove
cl_jiggle_bone_framerate_cutoff 70
cl_show_splashes 0
func_break_max_pieces 0
props_break_max_pieces 0
r_3dsky 0
r_waterdrawreflection 0

// ----------------------------------------------------------------------------
// Facial features

// Disable facial features
//r_eyes 0
//r_flex 0
//r_lod 2
//r_rootlod 2
//r_teeth 0

// Enable facial features -- uncomment this section if you want these settings
r_eyes 1
r_flex 1
r_lod 1 // Needs to be set to 1, otherwise they will still be disabled.
r_rootlod 1
r_teeth 1

// ----------------------------------------------------------------------------
// Ragdolls
// You will have reduced performance on deaths which produce ragdolls.

// Disable ragdolls
cl_ragdoll_fade_time 0
cl_ragdoll_forcefade 1
cl_ragdoll_physics_enable 0
g_ragdoll_fadespeed 0
g_ragdoll_lvfadespeed 0
ragdoll_sleepaftertime 0

// Enable ragdolls -- uncomment this section if you want these settings
//cl_ragdoll_fade_time 15
//cl_ragdoll_forcefade 0
//cl_ragdoll_physics_enable 1
//g_ragdoll_fadespeed 600
//g_ragdoll_lvfadespeed 100
//ragdoll_sleepaftertime "5.0f"

// ----------------------------------------------------------------------------
// Gibs
// ----------------------------------------------------------------------------
// You will have reduced performance on deaths which produce gibs.
// ----------------------------------------------------------------------------

// Disable gibs
cl_phys_props_enable 0
cl_phys_props_max 0
props_break_max_pieces 0
r_propsmaxdist 1
violence_agibs 0
violence_hgibs 0

// Enable gibs -- uncomment this section if you want these settings
//cl_phys_props_enable 1
//cl_phys_props_max 128
//props_break_max_pieces -1
//r_propsmaxdist 1000
//violence_agibs 1
//violence_hgibs 1
Issues and Fixes
A common issue is when commands are transfered from one class cfg to another. Look at the example below.

Pyro Cfg

bind "MWHEELUP" "slot1;viewmodel_fov 60;r_drawviewmodel 0;fov_desired 90"
bind "MWHEELDOWN" "slot3;viewmodel_fov 65;r_drawviewmodel 1;fov_desired 90"
bind "f" "slot2;viewmodel_fov 60;r_drawviewmodel 0;fov_desired 90"

Demoman Cfg

bind "MWHEELUP" "slot1"
bind "MWHEELDOWN" "slot3"
bind "f" "slot2"


In the example above, the demoman cfg ASSUMES that it has the same properties as the pyro regarding the viewmodel and fov settings. To fix this all you need to do is assign settings to every class and every slot.

here would be the fixed demoman slot settings.

Demoman Cfg - Fixed -

bind "MWHEELUP" "slot1;viewmodel_fov 70;r_drawviewmodel 1;fov_desired 90"
bind "MWHEELDOWN" "slot3;viewmodel_fov 70;r_drawviewmodel 1;fov_desired 90"
bind "f" "slot2;viewmodel_fov 70;r_drawviewmodel 1;fov_desired 90"
Conclusion
Feel free to comment what i missed, should add, or got wrong (if anything).
I hope this helps.

Also, should anything go wrong or you get stuck and it wont use a more recent file of your cfg. You will need to manually reset steams cloud storage of the files. (They save a copy of your files and you need to edit it). Ill explain further if anyone is confused. (I AM NOT RESPONSIBLE FOR LOST DATA OR FILES, ALWAYS BACKUP YOUR FILES)

If you need to use the steps below, please be sure to backup all your files and if need be ask here.

The steps are found in this thread here (eddited for tf2)

they are

Steam Cloud is preventing me from changing/resetting my config files.
Follow these instructions to reset the configuration for a specific game

1. Go to library
2. Disable Steam Cloud
3. Navigate to “Steam\SteamApps\<username>\teamfortress2\tf\ and delete the cfg folder
4. Launch the game, allow it to write a new config file, then exit the game
5. Enable Steam Cloud
6. Launch the game and test the issue.
7. Close the game and add the new cfg files (either the ones you saved beforehand)

I am glad to help anyone with issues, but also check the scriptstation sub-reddit of tf2. Very helpful people and tips.
64 Comments
Das Psycho  [author] 22 Sep, 2023 @ 8:37pm 
Ahh that would do it. Well, glad to see it's all good now
PotatoRP3 22 Sep, 2023 @ 5:41pm 
I kinda reset everything and added some cfg files I was missing. The four key was bound to "exit" instead of "tele_exit" or whatever.
Das Psycho  [author] 22 Sep, 2023 @ 5:21pm 
glad to hear, what fixed it?
PotatoRP3 22 Sep, 2023 @ 4:50pm 
I did get it fixed, ty for responding though!
Das Psycho  [author] 19 Sep, 2023 @ 3:06am 
Are you running any other mods or scripts? You may need to start from a fresh cfg file, I have never heard of the destroy/build keybinding crashing a game. Can you paste exactly what the keybindings you used are?
PotatoRP3 18 Sep, 2023 @ 9:58pm 
I realize it's my fault for messing around and finding out, but I've messed up a bit with my files trying to do this and now when hitting the 1-2-3 keys they do nothing and the 4 key crashes my game. I was trying to do destroy and built keybinds for engie and clearly it did not work out. Where might I find help for this?
Das Psycho  [author] 19 Jul, 2022 @ 10:30am 
This comment is awaiting analysis by our automated content check system. It will be temporarily hidden until we verify that it does not contain harmful content (e.g. links to websites that attempt to steal information).
Yellow Fellow 19 Jul, 2022 @ 6:16am 
helped alot, thanks!
Ramen 15 Jun, 2022 @ 11:25am 
Got it
Das Psycho  [author] 15 Jun, 2022 @ 11:21am 
Not sure, add me on discord and send a screeshot of what you see das psycho#8313