Upvote Upvoted 0 Downvote Downvoted
Viewmodel Script for a specific case
posted in Customization
1
#1
0 Frags +

Hey guys,

So I've been using the following binds to switch between my 3 weapons.

bind "mouse5" "slot1; slot2"
bind "mouse4" "slot1; slot3"

But lately, I've started to look for a way to turn my primary viewmodels off and leave the secondary and melee ones on.

The problem beeing that the script that everybody uses can't aplly to the switching system that I use without messing it all up. In the following script which I"m refering to, the VM hides when the keen bound to a certain slot is pressed; but in my case, the same key (mouse4 or Mouse5) is used for different weapons depending on how many times y press it.

The script :
alias "weaponone" "slot1;r_drawviewmodel 0"
alias "weapontwo" "slot2;r_drawviewmodel 0"
alias "weaponthree" "slot3;r_drawviewmodel 1"

bind 1 weaponone
bind 2 weapontwo
bind 3 weaponthree

So I've been searching around for a way to do this for my kind of configuration but I haven't really found anything useful.
Any help appreciated, ty .

Talik

PS: Also, I'm using transparent vm, I guess I could specify it too even if I don t think this as any impact.

Hey guys,

So I've been using the following binds to switch between my 3 weapons.

bind "mouse5" "slot1; slot2"
bind "mouse4" "slot1; slot3"

But lately, I've started to look for a way to turn my primary viewmodels off and leave the secondary and melee ones on.

The problem beeing that the script that everybody uses can't aplly to the switching system that I use without messing it all up. In the following script which I"m refering to, the VM hides when the keen bound to a certain slot is pressed; but in my case, the same key (mouse4 or Mouse5) is used for different weapons depending on how many times y press it.

The script :
alias "weaponone" "slot1;r_drawviewmodel 0"
alias "weapontwo" "slot2;r_drawviewmodel 0"
alias "weaponthree" "slot3;r_drawviewmodel 1"

bind 1 weaponone
bind 2 weapontwo
bind 3 weaponthree

So I've been searching around for a way to do this for my kind of configuration but I haven't really found anything useful.
Any help appreciated, ty .

Talik

PS: Also, I'm using transparent vm, I guess I could specify it too even if I don t think this as any impact.
2
#2
-1 Frags +
Chronic_bind "mouse5" "slot1; slot2"
bind "mouse4" "slot1; slot3"

this is odd? is this really working out well for you?
also, how exactly does that work? does pressing M4 equip you with slot3, if slot1 was already equipped, and vice versa?

this does not work exactly the same, i think:

alias wep1 "slot1;r_drawviewmodel 0;bind mouse4 wep3;bind mouse5 wep2
alias wep2 "slot2;r_drawviewmodel 0;bind mouse4 wep3;bind mouse5 wep1
alias wep3 "slot3;r_drawviewmodel 1;bind mouse4 wep1;bind mouse5 wep2

bind 1 wep1
bind 2 wep2
bind 3 wep3

bind mouse5 wep2
bind mouse4 wep3

edit:
when you equip slot1, M4 and M5 become slot3 and slot2,
when you equip slot2, M4 becomes slot3 and M5 becomes slot1,
when you equip slot3, M4 becomes slot1 and M5 becomes slot2.

[quote=Chronic_]bind "mouse5" "slot1; slot2"
bind "mouse4" "slot1; slot3"[/quote]

this is odd? is this really working out well for you?
also, how exactly does that work? does pressing M4 equip you with slot3, if slot1 was already equipped, and vice versa?

this does not work exactly the same, i think:
[code]alias wep1 "slot1;r_drawviewmodel 0;bind mouse4 wep3;bind mouse5 wep2
alias wep2 "slot2;r_drawviewmodel 0;bind mouse4 wep3;bind mouse5 wep1
alias wep3 "slot3;r_drawviewmodel 1;bind mouse4 wep1;bind mouse5 wep2

bind 1 wep1
bind 2 wep2
bind 3 wep3

bind mouse5 wep2
bind mouse4 wep3[/code]

edit:
when you equip slot1, M4 and M5 become slot3 and slot2,
when you equip slot2, M4 becomes slot3 and M5 becomes slot1,
when you equip slot3, M4 becomes slot1 and M5 becomes slot2.
3
#3
1 Frags +

Hmm , so the way my thing works is :

If Mouse5 is pressed and the weapon showing isn't slot1, it switches to slot1. If I repress it, it switches to slot2; if y press it a third time it comes back to primary ect ect.

Same with mouse4 for the melee.

Not sure of what the script you have does, and how this would work with my binds.

EDIT: After testing your script, I concluded that it doesn t work with my config :/

Hmm , so the way my thing works is :

If Mouse5 is pressed and the weapon showing isn't slot1, it switches to slot1. If I repress it, it switches to slot2; if y press it a third time it comes back to primary ect ect.

Same with mouse4 for the melee.

Not sure of what the script you have does, and how this would work with my binds.

EDIT: After testing your script, I concluded that it doesn t work with my config :/
4
#4
-2 Frags +

it's a replacement for yours, not an extension.
just backup your own script some place and replace it with the one above to try it out, it should work

it's a replacement for yours, not an extension.
just backup your own script some place and replace it with the one above to try it out, it should work
5
#5
2 Frags +

Eh, might be a long shot but have you tried this:

bind "mouse5" "wep1; wep2"
bind "mouse4" "wep2; wep3"

alias "wep1" "slot1; r_drawviewmodel 0;
alias "wep2" "slot2; r_drawviewmodel 1"
alias "wep3" "slot3; r_drawviewmodel 1"
Eh, might be a long shot but have you tried this:

[code]
bind "mouse5" "wep1; wep2"
bind "mouse4" "wep2; wep3"

alias "wep1" "slot1; r_drawviewmodel 0;
alias "wep2" "slot2; r_drawviewmodel 1"
alias "wep3" "slot3; r_drawviewmodel 1"
[/code]
6
#6
2 Frags +

oh ok I'll be giving it a shot later; also what s the "wep1" at the end for ?

Ty :)

oh ok I'll be giving it a shot later; also what s the "wep1" at the end for ?

Ty :)
7
#7
0 Frags +

@sentinel Yeah, I had the same idea and wrote a similar script to yours, we'll also give it a shot later ; thks.

@sentinel Yeah, I had the same idea and wrote a similar script to yours, we'll also give it a shot later ; thks.
8
#8
0 Frags +

woops, i took it as a class config. wep1 can be removed.

with sentinel's script i think M5 will always turn on viewmodels, and M4 will always turn it off, even though the weapon switching might work(?)

woops, i took it as a class config. wep1 can be removed.

with sentinel's script i think M5 will always turn on viewmodels, and M4 will always turn it off, even though the weapon switching might work(?)
9
#9
0 Frags +

I use something similar. Not sure if it's exactly what you're looking for.

alias quickswitch1 "slot2;slot1;r_drawviewmodel 0;viewmodel_fov 0"
alias quickswitch2 "slot2;slot3;toggle r_drawviewmodel 1 0;toggle viewmodel_fov 90 0"
bind shift quickswitch1
bind e quickswitch2

Primary and secondary viewmodels are hidden. Hope it helps.

EDIT:

r_drawviewmodel 0
alias quickswitch1 "slot1;slot2;r_drawviewmodel 1;bind mouse5 quickswitch1.1;bind mouse4 quickswitch2"
alias quickswitch1.1 "slot1;slot2;r_drawviewmodel 0;bind mouse5 quickswitch1;"
alias quickswitch2 "slot1;slot3;r_drawviewmodel 1;bind mouse4 quickswitch2.2;bind mouse5 quickswitch1"
alias quickswitch2.2 "slot1;slot3;r_drawviewmodel 0;bind mouse4 quickswitch2"
bind mouse5 quickswitch1
bind mouse4 quickswitch2

Awfully complicated because of the way your setup is slightly different. There might be a cleaner way but that was what I came up with. Cheers.

I use something similar. Not sure if it's exactly what you're looking for.

alias quickswitch1 "slot2;slot1;r_drawviewmodel 0;viewmodel_fov 0"
alias quickswitch2 "slot2;slot3;toggle r_drawviewmodel 1 0;toggle viewmodel_fov 90 0"
bind shift quickswitch1
bind e quickswitch2

Primary and secondary viewmodels are hidden. Hope it helps.

EDIT:

r_drawviewmodel 0
alias quickswitch1 "slot1;slot2;r_drawviewmodel 1;bind mouse5 quickswitch1.1;bind mouse4 quickswitch2"
alias quickswitch1.1 "slot1;slot2;r_drawviewmodel 0;bind mouse5 quickswitch1;"
alias quickswitch2 "slot1;slot3;r_drawviewmodel 1;bind mouse4 quickswitch2.2;bind mouse5 quickswitch1"
alias quickswitch2.2 "slot1;slot3;r_drawviewmodel 0;bind mouse4 quickswitch2"
bind mouse5 quickswitch1
bind mouse4 quickswitch2

Awfully complicated because of the way your setup is slightly different. There might be a cleaner way but that was what I came up with. Cheers.
10
#10
0 Frags +

Try:

alias qs_12 "slot1;slot2;tog_vm12; alias tog_vm12 incrementvar r_drawviewmodel 0 1 1; alias tog_vm13 r_drawviewmodel 1"
alias qs_13 "slot1;slot3;tog_vm13; alias tog_vm13 incrementvar r_drawviewmodel 0 1 1; alias tog_vm12 r_drawviewmodel 1"
bind mouse5 qs_12
bind mouse4 qs_13

In class/reset cfgs I recommend:

r_drawviewmodel 0 //Assuming slot1 is held after switching class.
alias tog_vm12 "incrementvar r_drawviewmodel 0 1 1"
alias tog_vm13 "incrementvar r_drawviewmodel 0 1 1"

The script will desync without tf_remember_activeweapon and other conditions, but hitting one bind or the other should resync it as it falls back to turning viewmodels on for slot2/3. As a reminder, scripts cannot tell if a slot lacks ammo or an available weapon.

Try:
[code]alias qs_12 "slot1;slot2;tog_vm12; alias tog_vm12 incrementvar r_drawviewmodel 0 1 1; alias tog_vm13 r_drawviewmodel 1"
alias qs_13 "slot1;slot3;tog_vm13; alias tog_vm13 incrementvar r_drawviewmodel 0 1 1; alias tog_vm12 r_drawviewmodel 1"
bind mouse5 qs_12
bind mouse4 qs_13[/code]

In class/reset cfgs I recommend:
[code]r_drawviewmodel 0 //Assuming slot1 is held after switching class.
alias tog_vm12 "incrementvar r_drawviewmodel 0 1 1"
alias tog_vm13 "incrementvar r_drawviewmodel 0 1 1"[/code]

The script will desync without tf_remember_activeweapon and other conditions, but hitting one bind or the other should resync it as it falls back to turning viewmodels on for slot2/3. As a reminder, scripts cannot tell if a slot lacks ammo or an available weapon.
11
#11
0 Frags +

So after having tested all that, if found that @AElai script was working wonders.

Although, I would like to know if it s possible for me to change the hidden viewmodel slot depending on the class I'm playing.

IE, for scout, I would turn off primary and leave secondary on, but for soldier, I would have slot1 and 3 on and slot 2 turned off.

Is it just a matter of changing the order of those values only ?

----
alias qs_12 "slot1;slot2;tog_vm12; alias tog_vm12 incrementvar r_drawviewmodel 0 1 1; alias tog_vm13 r_drawviewmodel 1"
alias qs_13 "slot1;slot3;tog_vm13; alias tog_vm13 incrementvar r_drawviewmodel 0 1 1; alias tog_vm12 r_drawviewmodel 1"
bind mouse5 qs_12
bind mouse4 qs_13
----

Thanks again to everyone who posted :)

So after having tested all that, if found that @AElai script was working wonders.

Although, I would like to know if it s possible for me to change the hidden viewmodel slot depending on the class I'm playing.

IE, for scout, I would turn off primary and leave secondary on, but for soldier, I would have slot1 and 3 on and slot 2 turned off.

Is it just a matter of changing the order of those values only ?


----
alias qs_12 "slot1;slot2;tog_vm12; alias tog_vm12 incrementvar [h][b]r_drawviewmodel 0 1 1[/b][/h]; alias tog_vm13 r_drawviewmodel 1"
alias qs_13 "slot1;slot3;tog_vm13; alias tog_vm13 incrementvar [h][b]r_drawviewmodel 0 1 1[/b][/h]; alias tog_vm12 r_drawviewmodel 1"
bind mouse5 qs_12
bind mouse4 qs_13
----


Thanks again to everyone who posted :)
12
#12
1 Frags +

IIRC if min > max for incrementvar, as 1 > 0, r_drawviewmodel will just stick to 1 instead of wrapping around. I don't think incrementvar or toggle would work for every case.

The following allows viewmodel customization and setting a "quickswitch" slot other than slot1, eg. slot2 for medigun or slot3 for wrench:

alias qs_ab "tog_b; alias tog_c tog_ac"
alias qs_ac "tog_c; alias tog_b tog_ab"
alias tog_ab "vm_b; alias tog_b tog_ba"
alias tog_ba "vm_a; alias tog_b tog_ab"
alias tog_ac "vm_c; alias tog_c tog_ca"
alias tog_ca "vm_a; alias tog_c tog_ac"
bind mouse5 qs_ab
bind mouse4 qs_ac

In class/reset cfg:

alias vm_a "slot1; r_drawviewmodel 0" //Slots and viewmodel setting.
alias vm_b "slot2; r_drawviewmodel 1" //
alias vm_c "slot3; r_drawviewmodel 1" //
alias tog_b "tog_ab"
alias tog_c "tog_ac"
vm_a

Example class customization:

alias vm_a "slot2; r_drawviewmodel 0" //Slots and viewmodel setting.
alias vm_b "slot1; r_drawviewmodel 1" //
vm_a                                  //Need to call vm_a again if changed.

The script is mostly the same, and uses letters to better distinguish from slot#s. It should still be easy to resync.

IIRC if min > max for incrementvar, as 1 > 0, r_drawviewmodel will just stick to 1 instead of wrapping around. I don't think incrementvar or toggle would work for every case.

The following allows viewmodel customization and setting a "quickswitch" slot other than slot1, eg. slot2 for medigun or slot3 for wrench:

[code]
alias qs_ab "tog_b; alias tog_c tog_ac"
alias qs_ac "tog_c; alias tog_b tog_ab"
alias tog_ab "vm_b; alias tog_b tog_ba"
alias tog_ba "vm_a; alias tog_b tog_ab"
alias tog_ac "vm_c; alias tog_c tog_ca"
alias tog_ca "vm_a; alias tog_c tog_ac"
bind mouse5 qs_ab
bind mouse4 qs_ac
[/code]

In class/reset cfg:
[code]
alias vm_a "slot1; r_drawviewmodel 0" //Slots and viewmodel setting.
alias vm_b "slot2; r_drawviewmodel 1" //
alias vm_c "slot3; r_drawviewmodel 1" //
alias tog_b "tog_ab"
alias tog_c "tog_ac"
vm_a
[/code]

Example class customization:
[code]
alias vm_a "slot2; r_drawviewmodel 0" //Slots and viewmodel setting.
alias vm_b "slot1; r_drawviewmodel 1" //
vm_a //Need to call vm_a again if changed.
[/code]

The script is mostly the same, and uses letters to better distinguish from slot#s. It should still be easy to resync.
13
#13
0 Frags +

So I can't change the values depending on the classes with the first script you posted ?

So I can't change the values depending on the classes with the first script you posted ?
14
#14
0 Frags +

No, the first script is simplified for slot1 one way, slot2/3 the other way - it is inflexible. Have any questions or issue with applying the second script?

No, the first script is simplified for slot1 one way, slot2/3 the other way - it is inflexible. Have any questions or issue with applying the second script?
15
#15
0 Frags +

Oh, nvrmd, I figured it out combining all of what u guys posted, it s all good now; thks all ! :)

Also, I'm having an minor issue where the screen becames darker when I switch to a slot where VM doesn't appear. This happens randomly and is sometimes gone after around 5 secs after having spawned.

EDIT: I happens during the time that your teammates are glowing and then it disapears.

Oh, nvrmd, I figured it out combining all of what u guys posted, it s all good now; thks all ! :)

Also, I'm having an minor issue where the screen becames darker when I switch to a slot where VM doesn't appear. This happens randomly and is sometimes gone after around 5 secs after having spawned.

EDIT: I happens during the time that your teammates are glowing and then it disapears.
16
#16
0 Frags +

That is a common issue with transparent viewmodels. IIRC you can fix it by disabling team xray/cart glow. You can also add the on/off cmds to vm_a/b/c if you want to toggle them.

That is a common issue with transparent viewmodels. IIRC you can fix it by disabling team xray/cart glow. You can also add the on/off cmds to vm_a/b/c if you want to toggle them.
17
#17
0 Frags +

What are those vm_ commands ?

What are those vm_ commands ?
18
#18
0 Frags +

vm_* are aliases, in the second block of my script. My script is customized for classes via redefining them in class cfgs, as in the example. You can add more commands as you like within the quotes, with semicolons (;) separating them.

I don't know the commands for xray and cart glow, but you can search online or use "find" in console, eg. find xray.

vm_* are aliases, in the second block of my script. My script is customized for classes via redefining them in class cfgs, as in the example. You can add more commands as you like within the quotes, with semicolons (;) separating them.

I don't know the commands for xray and cart glow, but you can search online or use "find" in console, eg. find xray.
19
#19
0 Frags +
AElai I don't know the commands for xray and cart glow, but you can search online or use "find" in console, eg. find xray.

Yeah I found them, it s working perfectly now, thks again ! :)

[quote=AElai] I don't know the commands for xray and cart glow, but you can search online or use "find" in console, eg. find xray.[/quote]

Yeah I found them, it s working perfectly now, thks again ! :)
Please sign in through STEAM to post a comment.