Skip to content

Instantly share code, notes, and snippets.

@illixion
Last active March 21, 2025 11:26
Show Gist options
  • Save illixion/b9b09f0c79afaba4e194e7ab7916cbd0 to your computer and use it in GitHub Desktop.
Save illixion/b9b09f0c79afaba4e194e7ab7916cbd0 to your computer and use it in GitHub Desktop.
Team Fortress 2 weapon cycling bind with viewmodel_fov adjustment
// Commands here will run before every class config
viewmodel_fov 75
// Movement with null cancel
bind w +mf
bind d +mr
bind a +ml
bind s +mb
// Reset keys to default weapon slot behavior without changing viewmodel_fov
bind "1" "slot1" // Primary weapon
bind "2" "slot2" // Secondary weapon
bind "3" "slot3" // Melee weapon
// Reset mouse wheel behavior
bind "MWHEELUP" "invprev" // Scroll up to switch to slot 1
bind "MWHEELDOWN" "invnext" // Scroll down to switch to slot 2
bind "MOUSE3" "+attack3"
// Bind for cycling between slot 1 and 2 with Left Shift
alias "cycle_slots" "slot1_toggle"
alias "slot1_toggle" "slot1; alias cycle_slots slot2_toggle"
alias "slot2_toggle" "slot2; alias cycle_slots slot1_toggle"
bind "SHIFT" "cycle_slots" // Left shift to cycle between slot 1 and 2
// Viewmodel FOV toggle
bind "MOUSE5" "incrementvar viewmodel_fov 0.1 75 74.9"
// Bind MOUSE4 to disguise as last used spy disguise
bind "MOUSE4" "lastdisguise"
// Pyro config with hold-to-cycle between slots
// Weapon slots with viewmodel FOV control
alias "slot1c" "slot1; viewmodel_fov 0.1; alias next_slot slot2c"
alias "slot2c" "slot2; viewmodel_fov 75; alias next_slot slot1c"
alias "slot3c" "slot3; viewmodel_fov 75"
// Initialize cycle state
alias "next_slot" "slot2c"
// Hold-to-cycle system (requires server to allow wait)
alias "+hold_cycle" "alias _cycle_active cycle_loop; cycle_loop"
alias "-hold_cycle" "alias _cycle_active"
alias "cycle_loop" "next_slot; wait 120; _cycle_active"
alias "cycle_continue" "cycle_loop"
// Key binds
bind "MWHEELUP" "slot1c; alias next_slot slot2c"
bind "MWHEELDOWN" "slot2c; alias next_slot slot1c"
bind "MOUSE3" "slot3c"
bind "SHIFT" "+hold_cycle" // Hold to cycle
bind "MOUSE4" "next_slot" // Single cycle
// Viewmodel FOV toggle
bind "MOUSE5" "incrementvar viewmodel_fov 0.1 75 74.9"
// Number keys with state tracking
bind "1" "slot1c; alias next_slot slot2c"
bind "2" "slot2c; alias next_slot slot1c"
bind "3" "slot3c"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment