Team Fortress 2

Team Fortress 2

600 ratings
How to Optimize your Team Fortress 2
By Archmage MC
A few scripts to help optimize the performance of TF2 using .cfg files. (AKA script files that VALVe says are ok to use.)
   
Award
Favorite
Favorited
Unfavorite
Introduction
This is a guide on how to optimize TF2 performance with scripts, as well as having a few other scripts that most professional TF2 players use.

Now all CFG/scripts are optional, but they do help give a more optimal TF2 experience.
Network Optimization Script and How To
1. Go into your C:\Program Files\Steam\Steamapps\Common]Team Fortress 2\tf\custom\My Custom Stuff\cfg folder (Or create all missing folders)

2. Make a new text file named Autoexec

3. Change the file extension to .cfg
-See Question 3 if you need to enable viewing of known file extensions.

4. Open the file using Notepad or other text editors.
-See Question 4 if your computer doesn't know what to use in order to open the .cfg you just made.

5. Add these lines to the .cfg file.

cl_updaterate 100 cl_cmdrate 100 rate 60000 cl_interp_ratio -1 cl_interp .015 cl_smooth 0 cl_smoothtime 0

6. Save

7. Restart TF2 if it was already open.

8. Enjoy having optimized network settings

What this does is optimize how your computer talks to the TF2 servers. This makes hits register better and hits made against you be more accurite, or it helps solve those "I was shot behind a wall" moment. It doesn't remove them, but makes them less likely.
Automatic Jump Crouch Script
This is optional, but makes you more difficult to hit when jumping, especially by snipers.

1. Go into your C:\Program Files\Steam\Steamapps\Common]Team Fortress 2\tf\custom\My Custom Stuff\cfg folder (Or create all missing folders)

2. Make new text files named Demoman, Engineer, Heavyweapons, Medic, Pyro, Scout, Sniper, Soldier, Spy and Default

3. Change the extension to all of these files to .cfg

4. Place this line in each class cfg (the Demoman,Engineer, Heavyweapons, Medic, Pyro, Scout, Sniper, Soldier, Spy files you just made.)

exec Default

5. Add these lines to the Default.cfg

alias "+jumpehs" "+jump; +duck" alias "-jumpehs" "-duck; -jump" bind "space" "+jumpehs"

5b Alternately you can add the above script into each class .cfg separately.

6. Save each one you complete.

7. Restart TF2

8. Now whenever you jump, you also crouch. Pushing space twice will make you crouch twice in the air, causing your hitbox to become very distorted and making you harder to hit/track.
Block Pinion and Malicous Servers Script
1. Go into your C:\Program Files\Steam\Steamapps\Common]Team Fortress 2\tf\custom\My Custom Stuff\cfg folder (Or create all missing folders)

2. Create a text file named Protect

3. Change the extension to .cfg

4. Open the file and add these lines to it.
*Not made by me.

//------------------------------------------------ // TF2 Anti-Virus by Casual v1.0 //------------------------------------------------ // Protection against server_can_execute bypass // Make your cfg/config.cfg read-only for extra protection cl_allowupload 1 alias cl_allowupload "echo Blocked cl_allowupload!" alias clear "echo Blocked clear!" alias unbindall "echo Blocked unbindall!" // Adblock for motd, extra protection: // > Create an empty file in your tf directory named textwindow_temp.html and make it read-only (this prevents the motd from being saved & loaded) // > Add '127.0.0.1 motd.pinion.gg' to your hosts file. This prevents a well known motd advertising network to load cl_disablehtmlmotd 1 alias closed_htmlpage "echo Blocked pinion!" // Gets rid of servers playing annoying sound files //alias play "echo Blocked play!" //alias sndplaydelay "echo Blocked sndplaydelay!" //alias playgamesound "echo Blocked playgamesound!" //alias soundfade "echo Blocked soundfade!" // Servers don't need this alias cl_spec_mode alias rpt_connect alias r_screenoverlay

*Note: the // excludes a line from being read as a script by the game. Remove // if you want to enable that line, but its not recommended. For example, if you enable the Alias play, Alias sndplaydelay, alias playgamesound, and alias soundfade lines, game music will be turned off.

*Note: If you make your config.cfg Read Only, you will be unable to save new keybinds, options set in the option menu, completed tutorials, and the like.

5. Save

6. Add this line to Autoexec.cfg, it doesn't matter where as long as its on its own line.

exec Protect

7. Save

8. Restart TF2

9. Enjoy Pinion not being as big of an annoyance, as well as being protected from a lot of malicious server commands.

I did not make the above script, however I am unaware of the name of the original author. If someone knows, please post it in the comments.
Class Scripts Introduction
Scripts in this section are Optional, but may help you be better at doing things with a class at the cost of something else. Each script will say what it does and what it might stop you from doing.

Note: This Section might say things in the script such as <Your Default Sensitivy Here> (Don't include the < or > when placing the number here). This is asking for the mouse sensitivy option you have in your options > mouse tab in TF2.

Note: This section might say things like <your Field of View here> (Don't include the < or > when placing the number here). This is asking for your field of view in your Options > Multiplayer > Advanced(button) and your Options > Video > Advanced(button) in TF2. The guide will specify which location to search for these options. If you want the 'optimal' settings or the settings most pro players use...

The Options > Video > Advanced(button) FoV is set to 90 or max
The Options > Muliplayer > Advanced(button) Field of View is set to 75 or max.


This section is for scripts for various classes. To place these scripts, you must place them in the correct class .cfg file, creating them if they don't exist. These files would be...

demoman.cfg = Demoman
engineer.cfg = Engineer
Heavyweapons.cfg = Heavy
Medic.cfg = Medic
Pyro.cfg = Pyro
Scout.cfg = Scout
Soldier.cfg = Soldier
Sniper.cfg = Sniper
Spy.cfg = Spy

Note: If a script rebinds a key that is used by all classes, such as Attack1, you will need to set a script in the default.cfg file that you created earlier in this guide, or rebind the key correclty in all other class .cfgs, otherwise it'll stay what that script bound it to.

Here is a quick 'rebind all to default' script you can place in the default.cfg. Place this at the top of the default.cfg script if you have something else posted in there.

If you have changed your keybinds to something else other than the listed keys in this script, change those keys in this script as well, otherwise they will be set to what this script says everytime you switch classes.

developer 1 echo "default settings loaded" developer 0 bind "0" "slot10" bind "1" "slot1" bind "2" "slot2" bind "3" "slot3" bind "4" "slot4" bind "5" "slot5" bind "q" "lastinv" bind "mouse1" "+attack" bind "mouse2" "+attack2" bind "mouse3" "+attack3" bind "a" "+moveleft" bind "d" "+moveright" bind "s" "+back" bind "w" "+forward" bind "SPACE" "+jump" bind "ctrl" "+duck" bind "v" "+voicerecord" bind "y" "say" bind "u" "say_team" bind "z" "voice_menu_1" bind "x" "voice_menu_2" bind "c" "voice_menu_3" bind "e" "voicemenu 0 0" bind "'" "+moveup" bind "/" "+movedown" bind "," "changeclass" bind "." "changeteam" bind "m" "open_charinfo_direct" bind "n" "open_charinfo_backpack" bind "l" "dropitem" bind "g" "taunt" bind "h" "+use_action_slot_item" bind "i" "showmapinfo" bind "f" "inspect" bind "r" "+reload" bind "t" "impulse 201" bind "tab" "+showscores" bind "f5" "screenshot" bind "f6" "save_replay" bind "f12" "replay_togglereplaytips" bind "`" "toggleconsole" bind "f3" "askconnect_accept" bind "j" "cl_trigger_first_notification" bind "k" "cl_decline_first_notification" bind "pgup" "+lookup" bind "pgdn" "+lookdown" unbind shift unbind alt
Scout Scripts
------------------------------------------------------------------------------------------------------

Scout

Automatic Winger Swap Script [/b]
Made by QuantumPoole

Note: Before you make this script, create two .cfg files named whatever you want. For this example we will call them Jump and Normal. This will let you swap this script on and off at the push of a button, and this can be used for any class script that you desire, as long as the button you use to activate the script for the first time isn't being used by said script. If you have multiple scripts for differnt playstyles, IE demoknight, you can use this method to cycle through them as long as you set them up correctly.

Alternativally, you can bind this script to a different button thats not jump and use that to activate the script.

What this Does

This script auto swaps to your Winger when you jump, and swaps back to whatever weapon you were usng when the jump button is released.

Drawbacks

With this script active, you can't fire your weapon for .63 seconds after you've jumped due to weapon swapping.

The Script

To be placed in Jump.cfg

alias "+wing" "slot2; +jump; +duck" alias "-wing" "-duck; -jump; lastinv" bind "space" "+wing" bind "shift" "exec normal"

To be placed in Normal.cfg

bind "space" "+jump" bind "shift" "exec jump"

If you are using the automatic Crouch Jump Script from above, you can place that in Normal.cfg along with bind "shift" "exec jump" instead of rebinding space to jump with bind "space" "+jump".

Place this in Scout.cfg at the bottom

bind "shift" "exec normal"


To activate this script if you use the method above, you push shift to swap to the auto winger script. Do note that if Scout.cfg gets executed again, you will have to push shift again to swap to the winger script. This happens when swapping classes or sometimes when you respawn.


Alternate method

Place this in Scout.cfg if the above is too complex. Do note to use this script you will have to jump using shift or whatever button you want to bind this to.

alias "+wing" "slot2; +jump; +duck" alias "-wing" "-duck; -jump; lastinv" bind "kp_5" "+wing"

================================================================

To be continued....
Soldier Scripts
Soldier

Coming Soon...
Pyro Scripts
Pyro

Coming Soon...
Demoman Scripts
Demoman

Demoknight Turn While Charging script. Booties not needed.
Made by Kered13

If you do not want to use a program to emulate a joystick to make this script work, skip this section and use the script in the next section. This script allows far greater turning control however.

This script requires Vjoy, a virtual Joystick, or a real joystick. Using Vjoy is allowed by VALVe and VAC as it is only emulating hardware and isn't modifying the games .exe files or editing the game's memory like Cheat Engine. Basically if VALVe bans you for using this script, they'd also ban you for using a normal controller.


Why this script needs a joystick
When a demoknight charges, they can slightly turn with their direction keys or by looking with the mouse, but there is a huge resistance in the way. This is not true for controllers however, and control sticks allow for free movement due to affecting a variable called Yaw. Yaw is what a controller uses to turn your character, unlike Mouse Aim which doens't use Yaw but something else. Demoknights while charging do not have that 'resistance' that you feel when mouse turning as their special coding doesn't account for the Yaw setting, thus demoknights can turn as much as they want when they use a controller.

Vjoy emulates a control stick and allows keypresses to simulate a Yaw command, thus allowing you to turn without the need of booties or anything.


What this script does

This Script allows you to turn as a Demoknight as if you were using a controller. Wearing booties has no effect on how tight you can turn.


What this script takes away

Unless you use a button to turn the script on and off (See Scout Winger Jump Script), you will turn when holding down Right Mouse and pushing A or D. In order to prevent this, Make 2 new .cfgs with different names and do what was done in the Scout Auto Winger script, changing the name of the stuff that is going to be executed with the exec command with the names of the new .cfgs you made.

Also you must close Vjoy by right clicking its icon in the lower right hand corner icon tray if you want to play any other games and not have that character turn when pushing A andor D.


Setting up Vjoy

(If steps 3 and 4 don't work for you for some reason, skip to step 5. Just note that Vjoy may not work.)

1. Download Vjoy here
http://headsoft.com.au/index.php?category=vjoy&page=home
(Scroll to the bottom of the page for the download links.)

2. Install Vjoy

3. Open Vjoy as Administrator (Right Click and select "Open as Administrator")

4. Click Yes

5. Make sure the box in the upper right hand corner named "Auto Center" is checked.

6. Make sure Vjoy is enabled.

7.Run VJoy. Map Buttons 1-4 to some keys, as well as Up, Left, and Slider+. Do this for both VJoy controllers, and make sure they are both enabled. (Screenshot)

8.Run Big Picture. Go to Settings > Controller, it should say "Controller Detected: VJoy Virtual Joystick" (if not, then Big Picture is reading the wrong controller). Click "Edit Controls". Map the first four buttons to buttons 1-4 in VJoy. Then scroll down to Left Stick X and Left Stick Y, map these to Left and Up. Finally, map Right Stick X to Slider+. Save this configuration (if you don't see a save button, press Esc) https://googledrive.com/host/0B8Uc-QugjMg2eTZyWng5TWREeWM/Big%20picture%20controller%202.jpg - Screenshot

9. Save the configuration to a file.

Success! You must run Vjoy everytime you want to use this script. You do not have to set it up in Big Picture though.


If Vjoy used to work for you and no longer does for some reason, do this.
On Windows 7 go to Start > Run (or use Windows + R), type "joy.cpl", and hit enter. In the dialog that opens, click "Advanced", then under "Preferred device" choose "VJoy Virtual Joystick".


the Script
// Charge script alias setstrafe "joystick 0" alias setturn "joystick 1" joystick 0 // Gamepad off by default. alias +charge "+attack2; setturn" alias -charge "-attack2; setstrafe" alias +m2 "+charge; spec_prev" alias -m2 "-charge" bind mouse2 +m2 joy_yawsensitivity -1.5 // Turn sensitivity // Gamepad configuration, copied from 360controller.cfg joy_name "VJoy controller" joy_advanced 1 joy_advaxisx 3 joy_advaxisy 1 joy_advaxisz 0 joy_advaxisr 2 joy_advaxisu 4 joy_advaxisv 0 joy_forwardsensitivity -1 joy_sidesensitivity 1 joy_pitchsensitivity 1.0 joy_lowend 0.65 joy_lowmap 0.15 joy_accelscale 2.0 joy_accelmax 0 joy_response_move 0 joy_response_look 1 joyadvancedupdate +jlook

Change the number in joy_yawsensitivity to change how tight or loose you turn.

=======================================================================

Alternate Demoknight Turn While Charging Script. No booties needed.

Unlike the script above, this script uses evreything in TF2, however its not very relaible and has the same things taken away that the above script takes away, although you can disable the script with a button built into the script. It is also not as reliable, but does work. Use this script if the above script just doesn't work for you. Your turning speed will be the same and can't be changed unlike the above script.


What this script does

This Script allows you to turn as a Demoknight. Wearing booties makes no difference in turn speed.


What this script takes away

After you activate the script with alt, when holding down Right Click and pushing A or D, you will turn left or right. If you disable the script with alt while holding Right Click, you will always turn left or right when pushing A or D until you re-enable the script.

The Script

alias +charge "+attack2; bind a +left; bind d +right; -moveleft; -moveright" alias -charge "-attack2; bind a +moveleft; bind d +moveright; -left; -right" alias chargetoggle "usecharge" alias usecharge "bind mouse2 +charge; alias chargetoggle useattack" alias useattack "bind mouse2 +attack2; alias chargetoggle usecharge" bind "alt" "chargetoggle"


If using the Double Script File method.

Other cfg script
unbind alt bind "mouse2" "+attack2" bind "a" "+moveleft" bind "d" "+moveright" -left -right


Add this to your Default.cfg or every classes' .cfg

unbind alt

This script makes it so that you have to enable/disable the script with alt. When you push A or D and hold Right click, you turn slowy in that direction. Alt Enables and Disables the script. DO NOT DISABLE THE SCRIPT WHILE HOLDING RIGHT CLICK, or you will need to re-enable it and right click to make it go back to making A and D strafe.
Heavy Scripts
Heavy

Coming Soon...
Engineer Scripts
Engineer

Coming Soon...
Medic Scripts
Medic

Coming Soon...
Sniper Scripts
Sniper

Coming Soon...
Spy Scripts
Spy

Ambassidor Zoom Script

-What it does.
This script allows you to 'zoom in' your Ambassidor by changing your FoV setting to the lowest it can go on keypress and reducing your sensetivity so you can have a more precise aim, and restoring them to your default settings when the key is released.

-Misc info
Default key is Shift, but this can be changed by changing the key you want it to use.
Can also be used while sniping to help you have a more accurate shot, but will take quite a bit of getting used to. If you want to use it for sniping, add it to your sniper.cfg as well.

-Script
alias +zoom "fov_desired 75; viewmodel_fov 54; viewmodel_fov_demo 54; sensitivity 0.5" alias -zoom "fov_desired <Your Field of View here (Video>Advanced)>; Viewmodel_fov <Your Field of View here (Multiplayer>Advanced)>; viewmodel_fov_demo <Your Filed of View here (Multiplayer>Advanced)>; sensitivity <Your Current Sensitivity Here (Mouse)>" bind shift +zoom

=======================================================================

To be continued...
ADVANCED Network Optimization Tweaks
DNS Editing

Set your DNS to 8.8.8.8 with a secondary DNS of 8.8.4.4 (Google DNS). Your ISP sets a default DNS which is theirs which is often EXTREMELY slow in comparison. Look up a guide on how to set up your DNS on your router, as it differs from router to router.

Registry Edits

Now, before I state these tweaks, DO NOT DO THEM IF YOUR NOT COMFORTABLE MAKING EDITS TO THE WINDOWS REGISTRY Any wrong edit to the Windows Registry could cause massive issues with computer stability. I take no responsability for inproper Registry Edits.

Disable Nagles Algorithm

This is the biggest edit that will, on average, reduce your ping by at least a small bit, but it can be as much as cutting it in half. What this change does is tell your computer to send a packet when it gets one, instead of waiting for a bundle of packets and sending them all at once.

The Registry keys are located in...
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{NIC-id}

Where NIC-id is your Network Card. To tell which one it is, there will be many entries when clicking on the folder. If multiple folders have many entries (And trust me, there will be a decent sized list), just put these in both of them.

Each key is a DWORD. If they aren't listed, right click and create a new DWORD. Make sure this new key is named the key listed below. Then right click and modify the key using Hex value and putting in the number below.

TcpAckFrequency 1

TCPNoDelay 1

TcpDelAckTicks 0

---------------------------------------------------------------------------------------------------------------------

FAQ
Q1. What do all of these scripts do?

A1. The first script optimizes the TF2 network settings. This means that you will be able to hit people more reliably, be hit a bit less often since you update your position better, and everyone will be a little smoother in movemeny.
-The Second Script helps you Duckjump, a technique used by high level competitive players to make them harder to hit and track. The downside is that its more difficult to do jumping Rocket/sticky jumps as you always crouch when you jump.
-The Third Script blocks a lot of commands that Pinion and malicious servers use to annoy you or break your game.
-Class Scripts help automate what you want to do. For some classes this is preferred over doing it yourself, but for other classes it is detrimental. What each class script does and if its good or bad for your game will be listed under the script.


Q2. Wont I get banned for using scripts?

A2. No. These are commands that Valve allows you to use. You will only be banned for using external programs on VAC secured games. (IE, Cheat Engine)


Q3. How do I enable viewing Known File Extensions?

A3. Go into your Control Panel > Folder Options > View. Scroll down the list that is given until you see a checkbox that says "Hide Known File Extensions". Uncheck this. Hit Apply and Ok and now you should see the file extensions of all known file types.

*Note: Do NOT change a file extension unless specified in this guide, otherwise the file may not work correctly. Windows will tell you this when you attempt to do so.


Q4. How do I open a .cfg file in a Text editor? My Computer says it doesn't know what to open that file with.

A4. Click the bubble that says "I'll choose what program to open this file with." Once there, click the down arrow to show a bunch of programs. Click on the program that says "Notepad". Click ok. Now you should have the .cfg opened up in Notepad.


Q5. Where does my Hosts file go to block pinion?

A5. The hosts file goes in C:\Windows\System32\Drivers\etc. You can't edit that file directly, but must copy it to your desktop or documents, edit it there, then replace the hosts file in that system32 location.


Q6. Where do I navigate to on a MAC to create .cfg files?

A6. ~/Library/Application Support/Steam/SteamApps/common/Team Fortress 2/tf/cfg
~/Library/Application Support/Steam/SteamApps/common/Team Fortress 2/tf/custom/configs/cfg

Either one, making the paths if not avalable, but the second one will have more cfg success.


Q7: My Program Files folder doesn't have a Steam folder, what do I do?

A7: Don't panic, this probably means you have a 64 bit operating system. This means that your Steam Folder is installed in your Program Files(x86) folder instead.


Q8: My CFG files don't work, whats wrong?

A8: After the Steampipe update, TF2 usually will associate custom files in the location I game (tf/custom/mycustomstuff) However sometimes it might read files like it did prior to the Steampipe update for some odd reason, mostly config and resource files. To fix this, place your .cfg files in your steam/steamapps/common/Team Fortress 2/tf/cfg folder. If the scripts still don't work, leave a comment explaining what you did and I'll try to troubleshoot it.


Q9: After using your scripts, some servers say that I have "ping masking" enabled and they kick me from them when I join.

A9: If this is a server you used to frequent or want to frequent, place // in front of the autoexec lines cl_updaterate 100 and cl_cmdrate 100, or change them to values of 66.


Q10: When running your Spy script, my viewmodel is disabled all the time, even when I uninstall it. Also some keys carry over to the other classes.

A10: Enable Console, go into console, and type dr_viewmodel 1 to reenable viewmodels.

For the second half of this question, thats because you didn't rebind those keys that the spy script changed in your other class .cfgs. The only one this should affect is the shift button, but it might affect other buttons as well. If your having problems with this, bind the key thats giving you problems to the correct action in the other class .CFG files. Go to http://wiki.teamfortress.com/wiki/List_of_default_keys for a list of default keys.
Exodus
Please place any comments/Suggestons/Questions in the comments and I'll answer them when I can. If you want to suggest a class script, make sure it does not use the WAIT command.
168 Comments
euψychius May 23, 2021 @ 5:04am 
im bad at creating alias stuff, but i think this one is interesting
deflector for engi

unbind mouse2

alias +deflector "slot2; +attack2"
alias -deflector "-attack2; lastinv"


kinda shame to see this guide last updated in year 18 btw
Белочерный Sep 23, 2018 @ 3:54am 
Hm, with this internet config I have 90+ ping and low lags with ping. One question: HOW TO WORK THIS CMDRATE AND UPDATERATE WITH 100. HOW, REALY
cushiontwin Aug 10, 2018 @ 1:50pm 
difference*
cushiontwin Aug 10, 2018 @ 1:50pm 
Is there a differnce? I want to combine them both.

Aar's Network Script:
cl_drawhud 0
cl_interp 0.0325
cl_interp_ratio 1
rate 97000
cl_updaterate 66
cl_cmdrate 66

Your Netwrok Script:
cl_updaterate 100
cl_cmdrate 100
rate 60000
cl_interp_ratio -1
cl_interp .015
cl_smooth 0
cl_smoothtime 0
synaptics May 5, 2018 @ 12:48pm 
If you need to do this properly I recommend this
https://github.com/mastercoms/mastercomfig/blob/release/docs/README.md
Asuka 「THE DINGLE」 Soryu May 5, 2018 @ 12:33pm 
I tried the network optimization and it hasn't done anything, both on the main menu and in game the values were still at default
kozz Nov 2, 2017 @ 2:35pm 
I put the commands in, THEN changed it to a cfg file (it was a txt before). Is that okay?
L-BOLT Mar 21, 2017 @ 8:22am 
...Thanks...I'll be working this out for a while...
Aith Oct 13, 2015 @ 1:02am 
HALP, I PRESSED A BUTTON AND NOW I'M PERMENTANTLY ZOOMED IN AND MY SENSITIVITY GOES TO ZERO EVERYTIME

HALP!
novasunshine Sep 17, 2015 @ 1:43am 
Quick question, for the class .cfg(s) do they have to be capitalized and not capitalized when you say so?