Team Fortress 2

Team Fortress 2

31 ratings
MvM Scripts
By adri
Make your MvM experience better.
   
Award
Favorite
Favorited
Unfavorite
Changelog
October 2022:
- Vaccinator 123: now 100% consistent.
- Fast Destroy&Build: new alternative solution.
- Fast Revive: added a few lines to increase consistency.
- New Script: Phlog Taunt Cancel.
- New Script: Sticky reload+.

March 2022:
- Destroy + Build: change the "exit" alias to "t_exit" to avoid any problem.

December 2020:
- added a memory for togglers such that you can switch classes without having to hit the toggler again.
- added 'warnings for perfectionists' section.
Introduction: Must know
How to read the scripts:
  • Some lines are too long for steam to display it in one line, if a line starts with a blank or a '↪' then it is the continuity of the previous line, making them 1 code line.

  • You already have experience with TF2 scripting.

Misconceptions:
  • '+myattack' and 'myattack' are 2 different commands. Nothing in common.

  • These are class specific scripts, to be added in the class config files desired (ex: tf/cfg/soldier.cfg).

  • TF2 scripting.
Setting Up your config
> You must rebind by yourself any key susceptible of not working for other classes.
  • Simple but unoptimized solution:
    exec user/binds.cfg // or wherever your binds are
    in the first line of every class config files. You already have experience with scripting, depending on how you manage your cfg files (which I hope you do), you'll have to adapt.

  • Optimized solution:
    Create a file where you put only the binds overridden by class configs, it will only rebind the keys needed and not everything, which could save from a big freeze for some computers with low standards.:
    exec user/binds_reset.cfg
> Adjusting 'wait x': it's unlikely that you want to change this (unless bad internet stability or bad CPU), a good PC will countdown the wait x FASTER than a bad computer. You can lower it to spam even faster, but it might become inconsistent. It is currently adjusted for good CPUs. If you do have a mediocre PC, test them offline and not playing: the fastest way the delay will be counted down is when the PC has nothing else to calculate, so no robots. Lower the numbers until its good enough.

> Memory for togglers: If you record a lot of demos (to fix a visual bug), or frequently have freezes, your class cfg files will be re-executed automatically. Causing any toggler to come back to its default state set in the script, for example:
alias beggarsSpamToggler beggarsSpamOn
will set the toggler to On, it's not even a problem if you didn't even pressed the toggler, but in case of having pressed it once to activate the script: you will have to press the key twice to deactivate the toggler.

Solution : If you want to fix this that can become annoying with time, the solution is to put every aliases in a common file and exec this file at the launch of the game, like:
exec user/aliases_classes.cfg
Such that only the binds are left in the class config files, the state of the togglers will not be reset anymore, it will also be faster to load the files when you switch classes (in case of a bad computer this can be interesting).

Keep the file organised as all your 9 classes' aliases will be centralised here.

Details
  • Most MvM scripts here are using the 'wait' command, be careful to not permanently freeze your game with the spam scripts in a community server not enabling the command (most are fine).

  • The echo command does not work the same in a server as in the launch of the game (for me), quotations marks act weirdly. I use ';' to end an echo. Spaces split the echo command into different echos for TF2, sometimes making the order of the words completely messed up (in my case). This is why I am using underscores instead of spaces for in game echos.

  • The alias in charge of the memory of the toggler is not declared as its own dedicated code line, because it would nullify its own purpose if it was declared in the class cfg file.
    Therefore this line...
    alias beggarsSpamState
    ... is not with the scripts shared here. The alias will not be declared if the script is not toggled at least once, and will displayed a 'unknown command: beggarsSpamState' in console every time you pick the class having the toggler. So I added this line in my aliases_classes.cfg file to counter this message.
MvM Script: Beggar's Bazooka spam
alias +beggarsSpam "alias beggarsSpamEnd beggarsSpamStart;beggarsSpamEnd" alias -beggarsSpam "alias beggarsSpamEnd" alias beggarsSpamStart "slot1;+attack;wait 3;-attack;wait 3;beggarsSpamEnd" alias beggarsSpamToggler beggarsSpamOn alias beggarsSpamOn "bind MOUSE3 +beggarsSpam;echo Beggars_Mode_on...; ↪ alias beggarsSpamState beggarsSpamOn;alias beggarsSpamToggler beggarsSpamOff" alias beggarsSpamOff "bind MOUSE3 +attack3;echo Beggars_Mode_off...; ↪ alias beggarsSpamState;alias beggarsSpamToggler beggarsSpamOn" bind F9 beggarsSpamToggler;beggarsSpamState
First 3 lines set the spam command, then I am using a toggle that I bind to F9.
MvM Script: Sticky spam
alias +stickySpam "alias stickySpamEnd stickySpamStart;stickySpamEnd" alias -stickySpam "alias stickySpamEnd" alias stickySpamStart "slot2;+attack;wait 8;-attack;wait 8;stickySpamEnd" alias stickySpamToggler stickySpamOn alias stickySpamOn "bind MOUSE3 +stickySpam;echo Maxstickies_Mode_on...; ↪ alias stickySpamState stickySpamOn;alias stickySpamToggler stickySpamOff" alias stickySpamOff "bind MOUSE3 +attack3;echo Maxstickies_Mode_off...; ↪ alias stickySpamState;alias stickySpamToggler stickySpamOn" bind F9 stickySpamToggler;stickySpamState
First 3 lines set the spam command, then I am using a toggle that I bind to F9.
MvM Script: Sticky reload+
alias +reloadWhileM2 "+attack2;+reload" alias -reloadWhileM2 "-attack2;-reload" bind MOUSE2 +reloadWhileM2

Not much but since Valve has never fixed this, here is a solution.

Explanation: fire a sticky, hold MOUSE2 before the firing animation ends, you won't be reloading, but with this: you can start reloading while holding MOUSE2 even though the firing animation is still going.
MvM Script: Phlog Taunt Cancel
alias +tauntSpam "alias tauntSpamEnd tauntSpamStart;tauntSpamEnd" alias -tauntSpam "alias tauntSpamEnd" alias tauntSpamStart "slot1;+taunt;wait 3;tauntSpamEnd" bind MOUSE4 +tauntSpam
bind MOUSE2 +attack2

Just hold MOUSE2 you dummy dumb.
MvM Script: Fast Destroy&Build
alias sentry "destroy 2;build 2" alias dispenser "destroy 0;build 0" alias t_entrance "destroy 1;build 1" alias t_exit "destroy 3;build 3" bind 6 sentry bind 7 dispenser bind 8 t_entrance bind 9 t_exit

I personally stopped using this and went for this solution instead:

alias buildMenu "use tf_weapon_pda_engineer_build" alias destroyMenu "use tf_weapon_pda_engineer_destroy" bind MWHEELUP buildMenu bind MWHEELDOWN destroyMenu

I made the switch because 6 7 8 and 9 are too far away, and I don't have room for 4 binds within my reach area, it's therefore annoying. I lowered the number to 2 binds and this is as fast as the previous one if not faster after getting used to it.
MvM Script: Fast revives
alias +fastRevive "alias fastReviveEnd fastReviveStart;fastReviveEnd" alias -fastRevive "alias fastReviveEnd" alias fastReviveStart "wait 6;+attack;wait 6;-attack;wait 6;fastReviveEnd" alias +pushToFastRevive "bind MOUSE1 +fastRevive;+duck" alias -pushToFastRevive "bind MOUSE1 +attack;-fastRevive;-duck" alias pushToFastReviveToggler pushToFastReviveOn alias pushToFastReviveOn "bind CTRL +pushToFastRevive;echo Fast_revive_Mode_on...; ↪ alias pushToFastReviveState pushToFastReviveOn; ↪ alias pushToFastReviveToggler pushToFastReviveOff" alias pushToFastReviveOff "bind CTRL +duck;echo Fast_revive_Mode_off...; ↪ alias pushToFastReviveState; ↪ alias pushToFastReviveToggler pushToFastReviveOn" bind F9 pushTofastReviveToggler;pushToFastReviveState
First 3 lines set the command, then I'm using a push to activate, itself toggled by F9.

The script is weird. Sometimes it is actually insane how fast you can revive people, and others it's not reviving them at all. This can be avoided by increasing the time between the attacks.

The explanation for why this is inconsistent is not known.

But there is a way of making it more consistent:

alias fastReviveStart1 "wait 6;+attack;wait 6;-attack;wait 6;fastReviveEnd" alias fastReviveStart2 "wait 9;+attack;wait 9;-attack;wait 9;fastReviveEnd" alias fastReviveStart fast1ReviveStart alias +pushToChangeRate "alias fastReviveStart fastReviveStart2" alias -pushToChangeRate "alias fastReviveStart fastReviveStart1" bind MOUSE5 +pushToChangeRate

It basically allows you to have a slower fast revive on demand. Simply hold MOUSE5 and it will slow down just enough to make it viable. It this is still too inconsistent for you, mind increasing the wait delays.
MvM Script: Vaccinator Wheel Switch
alias doubleReload "+reload;wait 6;-reload;wait 6;+reload;wait 6;-reload" alias vaccWheelToggler vaccWheelOn alias vaccWheelOn "bind MWHEELDOWN +reload;bind MWHEELUP doubleReload; ↪ echo Vacc_Wheel_on...; alias vaccWheelToggler vaccWheelOff; ↪ alias vaccWheelState vaccWheelOn alias vaccWheelOff "bind MWHEELDOWN invnext;bind MWHEELUP invprev; ↪ echo Vacc_Wheel_off...; alias vaccWheelToggler vaccWheelOn; ↪ alias vaccWheelState" bind F10 vaccWheelToggler;vaccWheelState
First line speaks for itself, then I'm using a toggler.
MvM Script: Vaccinator 1 2 3 Switch
alias simpleReload "+reload;wait 10;-reload" alias doubleReload "+reload;wait 10;-reload;wait 10;+reload;wait 10;-reload" alias bullToBlst "preventDesync;unbindMwheel;slot2;simpleReload;wait 20;rebindMwheel;blst" alias blstToFire "preventDesync;unbindMwheel;slot2;simpleReload;wait 20;rebindMwheel;fire" alias fireToBull "preventDesync;unbindMwheel;slot2;simpleReload;wait 20;rebindMwheel;bull" alias bullToFire "preventDesync;unbindMwheel;slot2;doubleReload;wait 40;rebindMwheel;fire" alias blstToBull "preventDesync;unbindMwheel;slot2;doubleReload;wait 40;rebindMwheel;bull" alias fireToBlst "preventDesync;unbindMwheel;slot2;doubleReload;wait 40;rebindMwheel;blst" alias waitBullToBlst "preventDesync;unbindMwheel;slot2;wait 300;simpleReload;wait 20;rebindMwheel;blst" alias waitBlstToFire "preventDesync;unbindMwheel;slot2;wait 300;simpleReload;wait 20;rebindMwheel;fire" alias waitFireToBull "preventDesync;unbindMwheel;slot2;wait 300;simpleReload;wait 20;rebindMwheel;bull" alias waitBullToFire "preventDesync;unbindMwheel;slot2;wait 300;doubleReload;wait 40;rebindMwheel;fire" alias waitBlstToBull "preventDesync;unbindMwheel;slot2;wait 300;doubleReload;wait 40;rebindMwheel;bull" alias waitFireToBlst "preventDesync;unbindMwheel;slot2;wait 300;doubleReload;wait 40;rebindMwheel;blst" alias wheelToBull "preventDesync;unbindMwheel;slot2;wait 300;rebindMwheel;bull" alias wheelToBlst "preventDesync;unbindMwheel;slot2;wait 300;rebindMwheel;blst" alias wheelToFire "preventDesync;unbindMwheel;slot2;wait 300;rebindMwheel;fire" alias changeFrom alias bull "alias toBull slot2;alias toBlst bullToBlst;alias toFire bullToFire;alias changeFrom fromBull" alias blst "alias toBlst slot2;alias toFire blstToFire;alias toBull blstToBull;alias changeFrom fromBlst" alias fire "alias toFire slot2;alias toBull fireToBull;alias toBlst fireToBlst;alias changeFrom fromFire" alias fromBull "alias toBull wheelToBull;alias toBlst waitBullToBlst;alias toFire waitBullToFire;alias changeFrom fromBull" alias fromBlst "alias toBlst wheelToBlst;alias toFire waitBlstToFire;alias toBull waitBlstToBull;alias changeFrom fromBlst" alias fromFire "alias toFire wheelToFire;alias toBull waitFireToBull;alias toBlst waitFireToBlst;alias changeFrom fromFire" alias mWheelUpAlias "slot1;changeFrom;alias changeFrom" alias mWheelDownAlias "slot3;changeFrom;alias changeFrom" alias unbindMwheel "unbind MWHEELUP; unbind MWHEELDOWN" alias rebindMwheel "bind MWHEELUP mWheelUpAlias; bind MWHEELDOWN mWheelDownAlias" alias preventDesync "alias toBull; alias toBlst; alias toFire" alias vacc123Toggler vacc123On alias vacc123State alias vacc123On "vaccWheelOff;slot2;bull;bind 1 toBull;bind 2 toBlst;bind 3 toFire;bind MOUSE4 fromBull;bind MWHEELUP mWheelUpAlias;bind MWHEELDOWN mWheelDownAlias;bind SHIFT +shiftMenuVacc123;echo Vacc_123_on...;alias vacc123State vacc123On;alias vacc123Toggler vacc123Off" alias vacc123Off "bind 1 slot1;bind 2 slot2;bind 3 slot3;bind MWHEELUP slot4;unbind MOUSE4;bind MWHEELDOWN slot5;echo Vacc_123_off...;alias vacc123State;alias vacc123Toggler vacc123On" bind F11 vacc123Toggler;vacc123State

Since 1 2 and 3 are now for bullet, blast and fire resistance, I bind slot1 to MWHEELUP and slot3 to MWHEELDOWN.

This script remembers what type of resistance you had before switching weapons.

Problem with this script: there is no way to automatically reset the cursor to bullet if you die ; this is why I bind fromBull to MOUSE4 so that whenever I die, I press MOUSE4 and it resets.
MvM Script: Auto disguise
alias +ad +attack alias -ad "-attack;impulse 231" alias adToggler adOn alias adOn "bind MOUSE1 +ad;echo Auto-disguise_on...;alias adToggler adOff;alias adState adOn" alias adOff "bind MOUSE1 +attack;echo Auto-disguise_off...;alias adToggler adOn;alias adState" bind F9 adToggler;adState
impulse 231 to disguise as BLU Scout
impulse 238 to disguise as BLU Spy
Template: Push to Activate
What: Hold a certain key to unlock / override a bind momentarily.

Why: All your primary keys are already binded, and you don't want to use an annoying key. You want to hold a first key doing as usual + trigerring a new bind for a second key.
alias +pushToDoNewAction "bind key +keyNewAction; +defaultAction" alias -pushToDoNewAction "bind key +keyDefaultAction; -keyNewAction; -defaultAction" bind pushToActivateKey +pushToDoNewAction
I am adding the -keyNewAction to avoid problems. In fact, if you hold your pushTo key while releasing the rebinded key, you will continue to do +keyNewAction.

Example:
alias +pushToFastRevive "bind MOUSE1 +fastRevive;+duck" alias -pushToFastRevive "bind MOUSE1 +attack;-fastRevive;-duck" bind CTRL +pushToFastRevive
Here, I am binding the push to fastrevive to my default duck key. I personally want to fast revive only when I am crouching.
Template: Bind Toggler

What:
Hit a certain key to unlock an action triggered by another key. Press the same first key to go back to square one.

Why: Different configs adapted to different gamemodes.
alias actionToggler actionOn alias actionOn "bind key +action; alias actionState actionOn; alias actionToggler actionOff" alias actionOff "bind key +defaultAction; alias actionState; alias actionToggler actionOn" bind toggleKey actionToggler; actionState

Example :
alias pushToFastReviveToggler pushToFastReviveOn alias pushToFastReviveOn "bind CTRL +pushToFastRevive; alias pushToFastReviveToggler ↪ pushToFastReviveOff; alias pushToFastReviveState pushToFastReviveOn; ↪ echo Fast_revive_mode_on..." alias pushToFastReviveOff "bind CTRL +duck; alias pushToFastReviveToggler ↪ pushToFastReviveOn; alias pushToFastReviveState;echo Fast_revive_mode_off..." bind F9 pushToFastReviveToggle;pushToFastReviveState
To continue with the same example as before, I don't want to activate the fast revive unless I activated the mode. For that I am using a toggler that I bind to F9.

Once I hit F9, the +pushToFastRevive is available.

I am also displaying a message in the console without spaces: the order of the words in the console are oftenly messed up (for me) if they are splitted by spaces.

The command following the bind of the toggler to F9 is to avoid problems. If you switch classes, the toggler will not reset. Remove this to reset the toggler if you switch classes.
The End
Questions?
Improvements?

Share it here: ˅ Comments ˅
9 Comments
U think skillplay or cheating? 24 Dec, 2023 @ 11:15pm 
U have Scripts auto ready ?
Lavvie 3 Jul, 2023 @ 4:09pm 
is there a script to insta auto queue for the next unfinnished mission? would be in handy for 2c and steel trap tour grinding
adri  [author] 27 Dec, 2021 @ 7:23pm 
@Brokilon You send me pleased. Glad it helped ya.
Brokilon 27 Dec, 2021 @ 5:27pm 
Thanks you so much! I learned a lot and optimized my keys binds. I created the scripts i need and modify yours to my liking. You helped me a lot :cozybethesda:
adri  [author] 29 Dec, 2020 @ 8:39am 
@Tokisakeeeeee Yes. These are shortcuts I use myself and that I would recommend. It is useful to have them not only in MvM but in a general aspect of TF2, this is why I didn't implement them in this guide dedicated to MvM.

If you have mastercomfig installed, follow the documentation; otherwise autoexec.cfg will work just fine.
:3 *nuzzles your rocket* 28 Dec, 2020 @ 5:11pm 
I use a class switch bind. It's useful not only for MvM to get back to spawn instantly(unless you're engie, in which case you gotta stay there to keep the buildings unles you want to redeploy everything), but also outside of it too. I'm not entirely confident with this, but i think this goes in the autoexec cfg? Please tell me if I did anything wrong, the intent tis to replace the numpad keys with their respective classes.

bind kp_end "join_class scout"
bind kp_downarrow "join_class soldier"
bind kp_pgdn "join_class pyro"
bind kp_leftarrow "join_class demoman"
bind kp_5 "join_class heavyweapons"
bind kp_rightarrow "join_class engineer"
bind kp_home "join_class medic"
bind kp_uparrow "join_class sniper"
bind kp_pgup "join_class spy"
BezaoBuilder 21 May, 2020 @ 3:03am 
It was a joke, I have never seen someone in any guide explain where to put the config files in Linux.
adri  [author] 20 May, 2020 @ 3:31pm 
Thanks.

Also, what do you mean by "no one knows where to put the config files in Linux" ?
I feel like you're missing something here...
BezaoBuilder 20 May, 2020 @ 11:44am 
Very interesting guide, glad to see not all guides are bad. Scripting is an interesting part of Team Fortress 2.
And also, to this day, no one knows where to put the config files in Linux.