View Model - TF2 Config Script

This script that automates viewmodels off and on while switching between weapons based on predefined settings. This means that viewmodels will be switched off or on, depending on your settings, when changing weapon between primary, secondary and melee. "View Models" are the gun and hand(s) you see of your character on your screen.

This script works with Q and is completely customisable with individual class settings.


What View Models are

View Models
The models of your own arms and weapons that you can see in first person.

Download

If you don't know what to do, follow this guide on Setting up TF2 Configuration Files before you continue.

Packed script: viewmodel.rar - 3.09KB


The Script for Manual Install

  1. Open your TF2 Configuration Folder. Should be something like:
        C:\Program Files (x86)\Steam\steamapps\common\team fortress 2\tf\custom\myconfigs\cfg
  2. Open autoexec.cfg in a Text Editor (Notepad on Windows)
  3. Copy this code into autoexec.cfg, then save and close.
    // Aliases - setting up the script
    alias vm1 "r_drawviewmodel 1" // Default Primary Viewmodels 
    alias vm2 "r_drawviewmodel 1" // Default Secondary Viewmodels 
    alias vm3 "r_drawviewmodel 1" // Default Melee Viewmodels 
    alias eq_1 "eq_1f3"
    alias eq_2 "eq_2f1"
    alias eq_3 "eq_3f1"
    alias sw ""
    alias eq_1f2 "slot1;vm1;alias sw eq_2f1;alias eq_2 eq_2f1;alias eq_3 eq_3f1"
    alias eq_1f3 "slot1;vm1;alias sw eq_3f1;alias eq_2 eq_2f1;alias eq_3 eq_3f1"
    alias eq_2f1 "slot2;vm2;alias sw eq_1f2;alias eq_1 eq_1f2;alias eq_3 eq_3f2"
    alias eq_2f3 "slot2;vm2;alias sw eq_3f2;alias eq_1 eq_1f2;alias eq_3 eq_3f2"
    alias eq_3f1 "slot3;vm3;alias sw eq_1f3;alias eq_1 eq_1f3;alias eq_2 eq_2f3"
    alias eq_3f2 "slot3;vm3;alias sw eq_2f3;alias eq_1 eq_1f3;alias eq_2 eq_2f3"
    
    // Binds - binds the commands to keys
    bind "1" "eq_1"
    bind "2" "eq_2"
    bind "3" "eq_3"
    bind "q" "sw"
  4. Open scout.cfg, soldier.cfg, spy.cfg, pyro.cfg, demoman.cfg, heavyweapons.cfg, engineer.cfg, medic.cfg and sniper.cfg
  5. Copy this code into all of them, then save and close.
    alias vm1 "r_drawviewmodel 1" // View Models: Primary 
    alias vm2 "r_drawviewmodel 1" // View Models: Secondary
    alias vm3 "r_drawviewmodel 1" // View Models: Melee
    
    eq_1f3 // Initialise

Editing Settings

Once you have added the script to the configuration files, you must decide which weapons for which classes you want to have no viewmodels for.

To turn view models off for soldier primary (for example), open up the soldier.cfg configuration file and change the primary line from:

alias vm1 "r_drawviewmodel 1" // View Models: Primary 

to

alias vm1 "r_drawviewmodel 0" // View Models: Primary 

All you have to do is change the 1 to a 0 to turn view models off, and put the zero back to 1 to turn them on.


Notes

There are a many viewmodel scripts like this, but when I first used one I couldn't find one that worked with Q (lastinv). So I wrote this one.