Upvote Upvoted 1 Downvote Downvoted
Viewmodel Variability Script
posted in Q/A Help
1
#1
0 Frags +

Is there a way to show the viewmodel for, say, the original and the shotgun, but not the cow mangler?

Please and thank you.

Is there a way to show the viewmodel for, say, the original and the shotgun, but not the cow mangler?

Please and thank you.
2
#2
3 Frags +

As far as I know, you cannot change whether you can see viewmodels based on different weapons. However, you can use a viewmodel toggle.

Something along the lines of
bind "[key]" "incrementvar r_drawviewmodel 0 1 1"
in your config.

As far as I know, you cannot change whether you can see viewmodels based on different weapons. However, you can use a viewmodel toggle.

Something along the lines of
bind "[key]" "incrementvar r_drawviewmodel 0 1 1"
in your config.
3
#3
0 Frags +

https://code.google.com/p/broesels-crosshair-switcher/

Sets different crosshairs, colours, viewmodel on/off and indiviual weapons' fov

Edit: Note that this script only sets 1/2/3 with primary/secondary/melee and doesn't not have the ability set crosshair and other settings to weapons, so what Snowy wants for individual weapons does not exist (as far as I know).

https://code.google.com/p/broesels-crosshair-switcher/

Sets different crosshairs, colours, viewmodel on/off and indiviual weapons' fov

Edit: Note that this script only sets 1/2/3 with primary/secondary/melee and doesn't not have the ability set crosshair and other settings to weapons, so what Snowy wants for individual weapons does not exist (as far as I know).
4
#4
-14 Frags +
ffaAs far as I know, you cannot change whether you can see viewmodels based on different weapons.

You poor fuck.

[quote=ffa]As far as I know, you cannot change whether you can see viewmodels based on different weapons.[/quote]
You poor fuck.
5
#5
1 Frags +

It is very possible. If you simply search "weapon specific viewmodel script for tf2" on google you will find many different ways to do this.

It is very possible. If you simply search "weapon specific viewmodel script for tf2" on google you will find many different ways to do this.
6
#6
2 Frags +

This comes close to what you want. What this does is let you hit any key (the code here uses t) to toggle whether or not you want the slot to be visible.

bind 1 "slot1; primary; alias currenttog primarytog" 
bind 2 "slot2; secondary; alias currenttog secondarytog"
bind 3 "slot3; melee; alias currenttog meleetog"
bind t currenttog
alias currenttog primarytog
alias primary primaryvis
alias primaryvis "r_drawviewmodel 1"
alias primaryhid "r_drawviewmodel 0"
alias primarytog primarytogvis
alias primarytogvis "primaryvis; alias primary primaryvis; alias primarytog primarytoghid"
alias primarytoghid "primaryhid; alias primary primaryhid; alias primarytog primarytogvis"
alias secondary secondaryvis
alias secondaryvis "r_drawviewmodel 1"
alias secondaryhid "r_drawviewmodel 0"
alias secondarytog secondarytogvis
alias secondarytogvis "secondaryvis; alias secondary secondaryvis; alias secondarytog secondarytoghid"
alias secondarytoghid "secondaryhid; alias secondary secondaryhid; alias secondarytog secondarytogvis"
alias melee meleevis
alias meleevis "r_drawviewmodel 1"
alias meleehid "r_drawviewmodel 0"
alias meleetog meleetogvis
alias meleetogvis "meleevis; alias melee meleevis; alias meleetog meleetoghid"
alias meleetoghid "meleehid; alias melee meleehid; alias meleetog meleetogvis"
This comes close to what you want. What this does is let you hit any key (the code here uses t) to toggle whether or not you want the slot to be visible.
[code]bind 1 "slot1; primary; alias currenttog primarytog"
bind 2 "slot2; secondary; alias currenttog secondarytog"
bind 3 "slot3; melee; alias currenttog meleetog"
bind t currenttog
alias currenttog primarytog
alias primary primaryvis
alias primaryvis "r_drawviewmodel 1"
alias primaryhid "r_drawviewmodel 0"
alias primarytog primarytogvis
alias primarytogvis "primaryvis; alias primary primaryvis; alias primarytog primarytoghid"
alias primarytoghid "primaryhid; alias primary primaryhid; alias primarytog primarytogvis"
alias secondary secondaryvis
alias secondaryvis "r_drawviewmodel 1"
alias secondaryhid "r_drawviewmodel 0"
alias secondarytog secondarytogvis
alias secondarytogvis "secondaryvis; alias secondary secondaryvis; alias secondarytog secondarytoghid"
alias secondarytoghid "secondaryhid; alias secondary secondaryhid; alias secondarytog secondarytogvis"
alias melee meleevis
alias meleevis "r_drawviewmodel 1"
alias meleehid "r_drawviewmodel 0"
alias meleetog meleetogvis
alias meleetogvis "meleevis; alias melee meleevis; alias meleetog meleetoghid"
alias meleetoghid "meleehid; alias melee meleehid; alias meleetog meleetogvis"[/code]
7
#7
-4 Frags +

Part of my Soldier config:

bind "MWHEELUP" "slot1;r_drawviewmodel 0"
bind "MWHEELDOWN" "slot2;r_drawviewmodel 0"
bind q "slot3;r_drawviewmodel 1""

Something you could do is save different Soldier configs, and have binds to exec whichever corresponds to your primary weapon, since you mentioned Original vs Cowmangler.

Part of my Soldier config:

bind "MWHEELUP" "slot1;r_drawviewmodel 0"
bind "MWHEELDOWN" "slot2;r_drawviewmodel 0"
bind q "slot3;r_drawviewmodel 1""

Something you could do is save different Soldier configs, and have binds to exec whichever corresponds to your primary weapon, since you mentioned Original vs Cowmangler.
8
#8
1 Frags +

I know you can set viewmodels on/off for slots but not based on weapon. (i.e models on for original but not on the cowmangler).
Unless you have a different cfg.

I know you can set viewmodels on/off for slots but not based on weapon. (i.e models on for original but not on the cowmangler).
Unless you have a different cfg.
9
#9
1 Frags +

Oh, Mage's looks better.

Oh, Mage's looks better.
10
#10
-1 Frags +
RenhetPart of my Soldier config:

bind "MWHEELUP" "slot1;r_drawviewmodel 0"
bind "MWHEELDOWN" "slot2;r_drawviewmodel 0"
bind q "slot3;r_drawviewmodel 1""

Something you could do is save different Soldier configs, and have binds to exec whichever corresponds to your primary weapon, since you mentioned Original vs Cowmangler.

this or bindtoggle key "r_drawviewmodel" with this you can manualy change viewmodel with a press of a button

[quote=Renhet]Part of my Soldier config:

bind "MWHEELUP" "slot1;r_drawviewmodel 0"
bind "MWHEELDOWN" "slot2;r_drawviewmodel 0"
bind q "slot3;r_drawviewmodel 1""

Something you could do is save different Soldier configs, and have binds to exec whichever corresponds to your primary weapon, since you mentioned Original vs Cowmangler.[/quote]

this or bindtoggle key "r_drawviewmodel" with this you can manualy change viewmodel with a press of a button
11
#11
0 Frags +

Make different loadouts with the weapons you want to use and then make binds that change your loadout as well as change your viewmodel cvar values.

alias loadout1 "defaultrl;load_itempreset 0"
alias loadout2 "cowmangler;load_itempreset 1"
alias loadout3 ""
alias loadout4 ""
bind f1 loadout1
bind f2 loadout2
bind f3 loadout3
bind f4 loadout4
bind 1 key1
bind 2 key2
bind 3 key3
alias defaultrl "alias key1 "slot1;viewmodel_fov 0;r_drawviewmodel 0";alias key2 "slot2;viewmodel_fov 0;r_drawviewmodel 0";alias key3 "slot3;viewmodel_fov 90;r_drawviewmodel 1""
alias cowmangler "alias key1 "slot1;viewmodel_fov 90;r_drawviewmodel 1";alias key2 "slot2;viewmodel_fov 0;r_drawviewmodel 0";alias key3 "slot3;viewmodel_fov 90;r_drawviewmodel 1""

Make different loadouts with the weapons you want to use and then make binds that change your loadout as well as change your viewmodel cvar values.

alias loadout1 "defaultrl;load_itempreset 0"
alias loadout2 "cowmangler;load_itempreset 1"
alias loadout3 ""
alias loadout4 ""
bind f1 loadout1
bind f2 loadout2
bind f3 loadout3
bind f4 loadout4
bind 1 key1
bind 2 key2
bind 3 key3
alias defaultrl "alias key1 "slot1;viewmodel_fov 0;r_drawviewmodel 0";alias key2 "slot2;viewmodel_fov 0;r_drawviewmodel 0";alias key3 "slot3;viewmodel_fov 90;r_drawviewmodel 1""
alias cowmangler "alias key1 "slot1;viewmodel_fov 90;r_drawviewmodel 1";alias key2 "slot2;viewmodel_fov 0;r_drawviewmodel 0";alias key3 "slot3;viewmodel_fov 90;r_drawviewmodel 1""
12
#12
0 Frags +

Okay so I tried the toggle and put that in my reset file

//defaults for how hiding weapons is done
alias show_weapon "viewmodel_fov 70; r_drawviewmodel 1"
alias hide_weapon "viewmodel_fov 0" //0.0001 is causing some graphical glitches, keeping it at 0 for now
//undo class specific stuff
//binds
bind 1 weapon1
bind 2 weapon2
bind 3 weapon3
bind q primsecswap
bind MOUSE1 "+attack; current_vis_shootswitch"
bind MOUSE2 "+attack2; current_vis_shootswitch"
bind MOUSE3 "+attack3; current_vis_shootswitch"

bind 1 "slot1; primary; alias currenttog primarytog"
bind 2 "slot2; secondary; alias currenttog secondarytog"
bind 3 "slot3; melee; alias currenttog meleetog"
bind p currenttog
alias currenttog primarytog
alias primary primaryvis
alias primaryvis "r_drawviewmodel 1"
alias primaryhid "r_drawviewmodel 0"
alias primarytog primarytogvis
alias primarytogvis "primaryvis; alias primary primaryvis; alias primarytog primarytoghid"
alias primarytoghid "primaryhid; alias primary primaryhid; alias primarytog primarytogvis"
alias secondary secondaryvis
alias secondaryvis "r_drawviewmodel 1"
alias secondaryhid "r_drawviewmodel 0"
alias secondarytog secondarytogvis
alias secondarytogvis "secondaryvis; alias secondary secondaryvis; alias secondarytog secondarytoghid"
alias secondarytoghid "secondaryhid; alias secondary secondaryhid; alias secondarytog secondarytogvis"
alias melee meleevis
alias meleevis "r_drawviewmodel 1"
alias meleehid "r_drawviewmodel 0"
alias meleetog meleetogvis
alias meleetogvis "meleevis; alias melee meleevis; alias meleetog meleetoghid"
alias meleetoghid "meleehid; alias melee meleehid; alias meleetog meleetogvis"

and everytime I switch weapons it just goes back to showing the weapon. Here's my soldier cfg:

exec reset
alias start_spawn_switch "alias finish_spawn_switch "join_class soldier"; join_class random"
unbind mouse2
unbind 1
unbind 2
unbind 3
unbind q
bind 1 weapon1
bind 2 weapon2
bind 3 weapon3
bind q primsecswap
bind mouse2 primsecswap
bind SPACE +crouchJump

What's interfering? What do I need to fix?

Edit: hooli I just saw your message trying that now

Okay so I tried the toggle and put that in my reset file

[quote]
//defaults for how hiding weapons is done
alias show_weapon "viewmodel_fov 70; r_drawviewmodel 1"
alias hide_weapon "viewmodel_fov 0" //0.0001 is causing some graphical glitches, keeping it at 0 for now
//undo class specific stuff
//binds
bind 1 weapon1
bind 2 weapon2
bind 3 weapon3
bind q primsecswap
bind MOUSE1 "+attack; current_vis_shootswitch"
bind MOUSE2 "+attack2; current_vis_shootswitch"
bind MOUSE3 "+attack3; current_vis_shootswitch"

bind 1 "slot1; primary; alias currenttog primarytog"
bind 2 "slot2; secondary; alias currenttog secondarytog"
bind 3 "slot3; melee; alias currenttog meleetog"
bind p currenttog
alias currenttog primarytog
alias primary primaryvis
alias primaryvis "r_drawviewmodel 1"
alias primaryhid "r_drawviewmodel 0"
alias primarytog primarytogvis
alias primarytogvis "primaryvis; alias primary primaryvis; alias primarytog primarytoghid"
alias primarytoghid "primaryhid; alias primary primaryhid; alias primarytog primarytogvis"
alias secondary secondaryvis
alias secondaryvis "r_drawviewmodel 1"
alias secondaryhid "r_drawviewmodel 0"
alias secondarytog secondarytogvis
alias secondarytogvis "secondaryvis; alias secondary secondaryvis; alias secondarytog secondarytoghid"
alias secondarytoghid "secondaryhid; alias secondary secondaryhid; alias secondarytog secondarytogvis"
alias melee meleevis
alias meleevis "r_drawviewmodel 1"
alias meleehid "r_drawviewmodel 0"
alias meleetog meleetogvis
alias meleetogvis "meleevis; alias melee meleevis; alias meleetog meleetoghid"
alias meleetoghid "meleehid; alias melee meleehid; alias meleetog meleetogvis"[/quote]

and everytime I switch weapons it just goes back to showing the weapon. Here's my soldier cfg:

[quote]exec reset
alias start_spawn_switch "alias finish_spawn_switch "join_class soldier"; join_class random"
unbind mouse2
unbind 1
unbind 2
unbind 3
unbind q
bind 1 weapon1
bind 2 weapon2
bind 3 weapon3
bind q primsecswap
bind mouse2 primsecswap
bind SPACE +crouchJump
[/quote]

What's interfering? What do I need to fix?

Edit: hooli I just saw your message trying that now
13
#13
0 Frags +

nvm I can't read :(

nvm I can't read :(
14
#14
0 Frags +

The config worked for me. You might have to press the button an extra time the first time, but it seems to be fine.

The config worked for me. You might have to press the button an extra time the first time, but it seems to be fine.
15
#15
0 Frags +

Mage everytime I press 1, 2, 3 or q the viewmodel switches back on. That's why I pasted my configs to see if you could figure out what part of my scripts are interfering with yours.

Hooli your script changes the loadouts for me, but the viewmodels stay intact. What should I fix? here's what I've done to it so far:

bind 1 weapon1; key1
bind 2 weapon2; key2
bind 3 weapon3; key3

alias loadout1 "defaultrl;load_itempreset 0"
alias loadout2 "load_itempreset 1"
alias loadout3 "cowmangler;load_itempreset 2"
alias loadout4 "load_itempreset 3"
bind f1 loadout1
bind f2 loadout2
bind f3 loadout3
bind f4 loadout4
alias defaultrl "alias key1 "slot1;viewmodel_fov 0;r_drawviewmodel 0";alias key2 "slot2;viewmodel_fov 0;r_drawviewmodel 0";alias key3 "slot3;viewmodel_fov 90;r_drawviewmodel 1""
alias cowmangler "alias key1 "slot1;viewmodel_fov 90;r_drawviewmodel 1";alias key2 "slot2;viewmodel_fov 0;r_drawviewmodel 0";alias key3 "slot3;viewmodel_fov 90;r_drawviewmodel 1""

The "bind 1 weapon 1" part because otherwise it wouldn't do anything.

Mage everytime I press 1, 2, 3 or q the viewmodel switches back on. That's why I pasted my configs to see if you could figure out what part of my scripts are interfering with yours.

Hooli your script changes the loadouts for me, but the viewmodels stay intact. What should I fix? here's what I've done to it so far:

[quote]bind 1 weapon1; key1
bind 2 weapon2; key2
bind 3 weapon3; key3

alias loadout1 "defaultrl;load_itempreset 0"
alias loadout2 "load_itempreset 1"
alias loadout3 "cowmangler;load_itempreset 2"
alias loadout4 "load_itempreset 3"
bind f1 loadout1
bind f2 loadout2
bind f3 loadout3
bind f4 loadout4
alias defaultrl "alias key1 "slot1;viewmodel_fov 0;r_drawviewmodel 0";alias key2 "slot2;viewmodel_fov 0;r_drawviewmodel 0";alias key3 "slot3;viewmodel_fov 90;r_drawviewmodel 1""
alias cowmangler "alias key1 "slot1;viewmodel_fov 90;r_drawviewmodel 1";alias key2 "slot2;viewmodel_fov 0;r_drawviewmodel 0";alias key3 "slot3;viewmodel_fov 90;r_drawviewmodel 1""[/quote]

The "bind 1 weapon 1" part because otherwise it wouldn't do anything.
16
#16
0 Frags +
SnowyMage everytime I press 1, 2, 3 or q the viewmodel switches back on. That's why I pasted my configs to see if you could figure out what part of my scripts are interfering with yours.

Don't use q. I didn't code that bit in.
I literally just wrote that on the fly.
The issue is that you're unbinding the commands that I set when you join as soldier and then rebinding them to other things. Don't rebind 1, 2, and 3, and it'll work.

[quote=Snowy]Mage everytime I press 1, 2, 3 or q the viewmodel switches back on. That's why I pasted my configs to see if you could figure out what part of my scripts are interfering with yours.[/quote]
Don't use q. I didn't code that bit in.
I literally just wrote that on the fly.
The issue is that you're unbinding the commands that I set when you join as soldier and then rebinding them to other things. Don't rebind 1, 2, and 3, and it'll work.
17
#17
0 Frags +

Oh okay I changed my 1, 2, 3 to yours and it's working.

But I can't live without my primsecswap. Could you help me figure in that part as well? And thanks for the help!

Oh okay I changed my 1, 2, 3 to yours and it's working.

But I can't live without my primsecswap. Could you help me figure in that part as well? And thanks for the help!
18
#18
0 Frags +

Adding in the last weapon key would literally double the number of states, and said states would be more complex.
It's definitely possible, but it's a lot of work.
I might be missing an easier way.

Adding in the last weapon key would literally double the number of states, and said states would be more complex.
It's definitely possible, but it's a lot of work.
I might be missing an easier way.
19
#19
0 Frags +

It's not the last weapon key, even if you were holding out the melee if you press q twice it would go to your primary then your secondary.

Primsecswap; it's amazing.

Actually I'll try out that first thing posted in the thread, maybe that'll help.

Edit: nope

Edit2: great, now my primsecswap is broken.

It's not the last weapon key, even if you were holding out the melee if you press q twice it would go to your primary then your secondary.

Primsecswap; it's amazing.

Actually I'll try out that first thing posted in the thread, maybe that'll help.

Edit: nope

Edit2: great, now my primsecswap is broken.
20
#20
1 Frags +

Just use Broesel's switcher. No point in wasting time trying to make your own script that'll more than likely break.

Just use Broesel's switcher. No point in wasting time trying to make your own script that'll more than likely break.
21
#21
0 Frags +

No, I like my scripts. All I need to do is get all this working with primsecswap (or a different script that works the same way, perhaps? I've been looking through your Broesel's switcher and it has this "switch_between_slot1_and_slot2" which sounds promising.)

Just curious, how are you guys capable of just writing scripts on the spot? Is there like a guide that lists all the different elements of the code, like a dictionary of scripting language)

No, I like my scripts. All I need to do is get all this working with primsecswap (or a different script that works the same way, perhaps? I've been looking through your Broesel's switcher and it has this "switch_between_slot1_and_slot2" which sounds promising.)

Just curious, how are you guys capable of just writing scripts on the spot? Is there like a guide that lists all the different elements of the code, like a dictionary of scripting language)
22
#22
0 Frags +
SnowyJust curious, how are you guys capable of just writing scripts on the spot? Is there like a guide that lists all the different elements of the code, like a dictionary of scripting language)

There isn't much to the scripting 'language', once you're comfortable with aliasing there isn't much you can't do.

[quote=Snowy]Just curious, how are you guys capable of just writing scripts on the spot? Is there like a guide that lists all the different elements of the code, like a dictionary of scripting language)[/quote]

There isn't much to the scripting 'language', once you're comfortable with aliasing there isn't much you can't do.
23
#23
0 Frags +

I mean, someone somewhere had to have said "drawviewmodel" will do this-

What are all the other key words? I mean if hooli didn't show me I never would've guessed that load_itempreset is the command that switches loadouts.

I mean, someone somewhere had to have said "drawviewmodel" will do this-

What are all the other key words? I mean if hooli didn't show me I never would've guessed that load_itempreset is the command that switches loadouts.
24
#24
0 Frags +

Is it possible to have it swap hud crosshairs?

Is it possible to have it swap hud crosshairs?
25
#25
0 Frags +

Your hud would have to reload every time you switch weapons, so you'd freeze if you were constantly switching hud crosshairs.

I just use two dif small configs on pyro. One On for flaregun and one Off for shotgun. Bind them to two exec on dif button presses and press said button once when you switch loadouts.

Your hud would have to reload every time you switch weapons, so you'd freeze if you were constantly switching hud crosshairs.

I just use two dif small configs on pyro. One On for flaregun and one Off for shotgun. Bind them to two exec on dif button presses and press said button once when you switch loadouts.
26
#26
0 Frags +
SnowyI mean, someone somewhere had to have said "drawviewmodel" will do this-

What are all the other key words? I mean if hooli didn't show me I never would've guessed that load_itempreset is the command that switches loadouts.

http://wiki.teamfortress.com/wiki/List_of_useful_console_commands

[quote=Snowy]I mean, someone somewhere had to have said "drawviewmodel" will do this-

What are all the other key words? I mean if hooli didn't show me I never would've guessed that load_itempreset is the command that switches loadouts.[/quote]

http://wiki.teamfortress.com/wiki/List_of_useful_console_commands
27
#27
0 Frags +
BenroadsIs it possible to have it swap hud crosshairs?

Yes. You put one crosshair in your achievment overlay, then toggle that on and off depending on your weapon. You can also put one in net_graph, but that means you'll either have the graph popping up all the time or you'll have to completely disable it.

[quote=Benroads]Is it possible to have it swap hud crosshairs?[/quote]
Yes. You put one crosshair in your achievment overlay, then toggle that on and off depending on your weapon. You can also put one in net_graph, but that means you'll either have the graph popping up all the time or you'll have to completely disable it.
28
#28
0 Frags +
trogBenroadsIs it possible to have it swap hud crosshairs?Yes. You put one crosshair in your achievment overlay, then toggle that on and off depending on your weapon. You can also put one in net_graph, but that means you'll either have the graph popping up all the time or you'll have to completely disable it.

I have one crosshair I really like but I wanted to put konrwings on scout, how would I do this achievement stuff and how would I remove the other crosshair?

[quote=trog][quote=Benroads]Is it possible to have it swap hud crosshairs?[/quote]
Yes. You put one crosshair in your achievment overlay, then toggle that on and off depending on your weapon. You can also put one in net_graph, but that means you'll either have the graph popping up all the time or you'll have to completely disable it.[/quote]

I have one crosshair I really like but I wanted to put konrwings on scout, how would I do this achievement stuff and how would I remove the other crosshair?
Please sign in through STEAM to post a comment.