How to map mutliple keys to a button in Half Life 2/Team Fortress 2

half-life-2team-fortress-2

I'm sick of trying to get my rocket jumps accurate enough to actually jump places, that I'm left trying to jump instead of killing the enemy.

This would be helpful in Half Life 2 too. As they have the same engine, doing something in one should be the same in the other, right?

How can I bind a series of keys to a single button?

Best Answer

You need an alias. Create a file called autoexec.cfg in your Steam\steamapps\YOUR_ALIAS_HERE\team fortress 2\tf\cfg and add the following:

//Rocket Jump
alias +rocketjump "+jump;+duck;wait;+attack"
alias -rocketjump "-jump;-attack;wait;wait;wait;-duck"
bind mouse2 "+rocketjump"

Change mouse2 to your desired key. You can do so much with scripting, this is just one example. Check out the TF2 Wiki for more.