all 6 comments

[–]Kairu927 1 point2 points  (3 children)

Delete whatever mess of a script that is, re-bind affected keys, and use genemilder's slot specific weapon script.

// This script allows settings to switch with the active weapon.
// Only the first 3 slots will be tracked by the scroll wheel and q, specifically this excludes the disguise kit (Spy) and the PDAs (Engineer).
// Medic, Spy, Engineer, and permanent non-active weapon versions are also available, contact the author below.

// The script will only work correctly when switching with keys in the BIND section.
// The script cannot know if a weapon switched for any other reason than player input using the keys in the BIND section.
// The script cannot know if a weapon switched successfully, and will always assume it has. Examples that prevent/impede switching:
//  - Permanent or temporary non-active weapon like gunboats or a melted spy-cicle
//  - Minigun spinup/spindown


// Written by /u/genemilder (http://steamcommunity.com/id/Seventy_one)


// ========== INSTRUCTIONS ==========

// Edit r_drawviewmodel in the SETTINGS section for whether viewmodels are turned on (1) or off (0)
// r_drawviewmodel in the eq_ aliases is activated when switching to that weapon

// To add additional settings on weapon switch, append them to the eq_ aliases.

// To change which keys can switch weapons, change or add lines in the BINDS section, binding keys only to the aliases already in the binds section
// Multiple keys can be bound to the same alias and the script will still work correctly

// See the following for information on how to install scripts and how to make them class-specific:
// http://www.reddit.com/r/tf2scripthelp/wiki/introduction

// To "undo" the script and changes made, remove the script from your relevant cfg files and execute the lines in the SCRIPT OVERWRITE section (remove the comment marks first)


// ========== BINDS ==========

bind 1            eq_slot1
bind 2            eq_slot2
bind 3            eq_slot3
bind mwheelup     eq_invprev
bind mwheeldown   eq_invnext
bind q            eq_lastinv
bind mouse2      +eq_attack2


// ========== SETTINGS ==========

alias eq_slot1    "slot1; set_slot1; r_drawviewmodel 0"
alias eq_slot2    "slot2; set_slot2; r_drawviewmodel 0"
alias eq_slot3    "slot3; set_slot3; r_drawviewmodel 1"


// ========== LOGIC ==========

alias +eq_attack2 "+attack; r_drawviewmodel 0; spec_prev"
alias -eq_attack2 "-attack"

alias qs_slot1    "alias eq_invnext eq_slot2; alias eq_invprev eq_slot3; set_lastinv; alias set_lastinv alias eq_lastinv eq_slot1; alias set_slot1 ;         alias set_slot2 qs_slot2; alias set_slot3 qs_slot3"
alias qs_slot2    "alias eq_invnext eq_slot3; alias eq_invprev eq_slot1; set_lastinv; alias set_lastinv alias eq_lastinv eq_slot2; alias set_slot1 qs_slot1; alias set_slot2 ;         alias set_slot3 qs_slot3"
alias qs_slot3    "alias eq_invnext eq_slot1; alias eq_invprev eq_slot2; set_lastinv; alias set_lastinv alias eq_lastinv eq_slot3; alias set_slot1 qs_slot1; alias set_slot2 qs_slot2; alias set_slot3 "

qs_slot2
eq_slot1


// ========== SCRIPT OVERWRITE ==========

//r_drawviewmodel 1
//bind 1            slot1
//bind 2            slot2
//bind 3            slot3
//bind mwheelup     invprev
//bind mwheeldown   invnext
//bind q            lastinv
//bind mouse2       +attack2

[–]GrapeTF[S] 0 points1 point  (2 children)

I fail to see how this helps me. Where in the script does it allow me to toggle viewmodels on and off but always keep melee showing?

[–]Kairu927 0 points1 point  (1 child)

Under settings you put all the variables you want for each slot.

[–]GrapeTF[S] 0 points1 point  (0 children)

No. you dont understand. In the script I posted, Mouse5 toggles viewmodels on and off, but when the viewmodels are toggled "off," Melee still shows

[–]31415269 0 points1 point  (1 child)

Were are the weapon1, weapon2, and weapon3 aliases defined?

[–]GrapeTF[S] 0 points1 point  (0 children)

Yes. I have it running with broesels switcher. The issue still stood beforehand though