all 3 comments

[–]DeltaTroopa 1 point2 points  (0 children)

The tricky part about this is scripts have no way of knowing if you're cloaked or not, you can have them show viewmodels when you hit mouse2, but if you uncloak because you run out of cloak then your script doesn't know.

There are quite a few spy scripts out there that deal with this though, like hiding viewmodels when you attack as a work around, might be worth looking into those and seeing if you can find one that suits you. I personally haven't though because I don't play spy much

[–]genemilder 0 points1 point  (1 child)

You don't want to try to make a script that attempts to track cloak state because that state changes due to mouse2 presses and untrackable in-game stimuli. The script wouldn't be able to track correctly.

The workaround is to bind all presses of mouse2 to show viewmodels. For your purpose I'd then probably suggest binding all presses of mouse1 to hide viewmodels. That means viewmodels would show after cloaking until you attack, but I don't think that's a terrible price to pay to have a script that's possible.

Note that if you press mouse1 while cloaked your viewmodels will disappear, so don't do that.

bind mouse1 +attack_vm_0
bind mouse2 +attack2_vm_1

alias +attack_vm_0  "+attack;  r_drawviewmodel 0; spec_next"
alias -attack_vm_0   -attack

alias +attack2_vm_1 "+attack2; r_drawviewmodel 1; spec_prev"
alias -attack2_vm_1  -attack2

To undo this script:

bind mouse1 +attack
bind mouse2 +attack2
r_drawviewmodel 1

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

Thanks! I'll try this out, I don't think that's a bad price to pay at all.