r/tf2scripthelp • u/ElPequenoDuende • Apr 19 '20
Answered How do I toggle mouse2 for miniguns only?
So I found out I can toggle mouse2 in my heavy.cfg file so I don't have to keep pressed right click. This is the command:
bind MOUSE2 toggle
alias toggle "enable"
alias enable "alias toggle disable; +attack2"
alias disable "alias toggle enable; -attack2"The problem comes when I wanna throw a sandwich to a teammate, as I have to press right click to do it, so after throwing it, my minigun revs automatically. I want that toggle function to work only with heavy's slot 1 -aka miniguns-
I found a script that would fix that problem in gamebanana. The thing is: I know almost nothing about scripting so idk how to put my mouse2 toggle script in this one:
bind "1" "lslot1"
bind "2" "lslot2"
bind "3" "lslot3"
lslot1
alias lslot1 "slot1;bind mwheeldown lslot2; bind mwheelup lslot3; [cmd]"
alias lslot2 "slot2;bind mwheeldown lslot3; bind mwheelup lslot1; [cmd]"
alias lslot3 "slot3;bind mwheeldown lslot1; bind mwheelup lslot2; [cmd]"Any idea?
1
Upvotes
5
u/pdatumoj Apr 19 '20
Like many of the other questions here recently - this really relies on having a weapon switcher script as a basis for it. You need something that's aware (mostly) of what slot is in use - and given that scripts can't read game state, the only way to really do that is have the script manage the weapon switching themselves.
So, then the next question is - what's your desired weapon switching approach?
Would you like:
There are a lot of possibilities.
Anyway, once you figure out how you want your weapons to be managed, then you can tie the spinup toggle to the slot entry/exit code in the script ... and it's going to be simpler than the weapon switcher itself, at least.
BTW, would you be OK with me adding that as a feature to my script?
It seems like an interesting idea. I'm not sure I'd use it myself much, but it's a close relatively of the medigun toggle, conceptually, and therefore probably bears some experimentation. :)
2
u/KatenGaas Apr 19 '20 edited Jun 19 '20
autoexec:
heavyweapons.cfg:
reset.cfg:
I think this should do the trick. Basically, I've set up a weapon switcher script (one that you'll often see used for viewmodel purposes, read here if you want to learn more about that), and used that to change what mouse2 does depending on the weapon. I avoided putting any binds in files other than the autoexec to make it a bit easier to keep an overview of everything.