Upvote Upvoted 0 Downvote Downvoted
cl_crosshair_file for specific weapon switching
posted in Customization
1
#1
0 Frags +

Hi,
I installed a set of custom crosshairs from cfg.tf last night but found that I was unsatisfied with the green dot there that I used for sniper and wish to switch back to Valve's default crosshair5 for sniper rifles only. I've set up the following script in my sniper.cfg

alias "weaponone" "slot1; cl_crosshair_file crosshair5; cl_crosshair_scale 25.65"
alias "weapontwo" "slot2; exec defaultcrosshair.cfg; cl_crosshair_scale 32"
alias "weaponthree" "slot3; exec defaultcrosshair.cfg; cl_crosshair_scale 32"

bind 1 weaponone
bind 2 weapontwo
bind 3 weaponthree
bind q lastinv 

With defaultcrosshair.cfg reading

cl_crosshair_file ""

But have found that while switching to my rifle gets the correct valve green dot, switching to my secondary or melee doesn't switch to the default crosshair, meaning that the custom crosshairs from cfg.tf don't get enabled as the game sticks with valve crosshair5. Would anyone know what I'm doing wrong? I've tried having defaultcrosshair.cfg read

cl_crosshair_file

and tried both versions with a new, blank line, but neither work.
Thank you

Hi,
I installed a set of custom crosshairs from cfg.tf last night but found that I was unsatisfied with the green dot there that I used for sniper and wish to switch back to Valve's default crosshair5 for sniper rifles only. I've set up the following script in my sniper.cfg

[code]
alias "weaponone" "slot1; cl_crosshair_file crosshair5; cl_crosshair_scale 25.65"
alias "weapontwo" "slot2; exec defaultcrosshair.cfg; cl_crosshair_scale 32"
alias "weaponthree" "slot3; exec defaultcrosshair.cfg; cl_crosshair_scale 32"

bind 1 weaponone
bind 2 weapontwo
bind 3 weaponthree
bind q lastinv [/code]

With defaultcrosshair.cfg reading
[code]cl_crosshair_file ""[/code]

But have found that while switching to my rifle gets the correct valve green dot, switching to my secondary or melee doesn't switch to the default crosshair, meaning that the custom crosshairs from cfg.tf don't get enabled as the game sticks with valve crosshair5. Would anyone know what I'm doing wrong? I've tried having defaultcrosshair.cfg read
[code]cl_crosshair_file[/code]
and tried both versions with a new, blank line, but neither work.
Thank you
2
#2
2 Frags +

You can't use custom crosshairs in pure servers unless they're located in materials/vgui/replay/thumbnails (textures in here are ignored by pure for some reason), and even then, unfortunately, you can't switch between them with cl_crosshair_file when sv_pure is on.

Best bet for custom weapon specific crosshairs is to use the crosshair "file" line in the weapon scripts (scripts/tf_weapon_whatever.txt|ctx), https://cfg.tf/tools/crosshairs/ is a tool that can do it for you if you don't feel like doing it manually.

edit: didn't read the part where you said you already used the cfg.tf thing, in that case you can open the weapon scripts for the weapons you want valve's dot crosshair on (in a text editor) and change the "file" line in the crosshair section to read:

"file"		"vgui/crosshairs/crosshair5"
You can't use custom crosshairs in pure servers unless they're located in materials/vgui/replay/thumbnails (textures in here are ignored by pure for some reason), and even then, unfortunately, you can't switch between them with cl_crosshair_file when sv_pure is on.

Best bet for custom weapon specific crosshairs is to use the crosshair "file" line in the weapon scripts (scripts/tf_weapon_whatever.txt|ctx), https://cfg.tf/tools/crosshairs/ is a tool that can do it for you if you don't feel like doing it manually.

edit: didn't read the part where you said you already used the cfg.tf thing, in that case you can open the weapon scripts for the weapons you want valve's dot crosshair on (in a text editor) and change the "file" line in the crosshair section to read:
[code]"file" "vgui/crosshairs/crosshair5"[/code]
3
#3
0 Frags +

Thank you for the quick reply. I've tried doing what you said, editing tf_weapon_sniperrifle.txt, tf_weapon_sniperrifle_classic.txt, and tf_weapon_sniperrifle_decap.txt, to have

		"crosshair"
		{
				"file"		"vgui/crosshairs/crosshair5"
				"x"		"0"
				"y"		"0"
				"width"		"64"
				"height"	"64"

But am still getting the crosshair from cfg.tf. The .txt files I'm editing are all in \Team Fortress 2\tf\custom\crosshairs\scripts
If it's being difficult I guess I can just get used to a new crosshair. Sorry for the trouble

Thank you for the quick reply. I've tried doing what you said, editing tf_weapon_sniperrifle.txt, tf_weapon_sniperrifle_classic.txt, and tf_weapon_sniperrifle_decap.txt, to have

[code] "crosshair"
{
"file" "vgui/crosshairs/crosshair5"
"x" "0"
"y" "0"
"width" "64"
"height" "64"
[/code]

But am still getting the crosshair from cfg.tf. The .txt files I'm editing are all in \Team Fortress 2\tf\custom\crosshairs\scripts
If it's being difficult I guess I can just get used to a new crosshair. Sorry for the trouble
4
#4
1 Frags +

Using a script for this is less than ideal tho. Just open up the game's textures vpk file (should be something like tf_textures_dir.vpk) with gfscape/crowbar, extract the crosshair you want (should be in materials/vgui/crosshairs), put it the replay folder of the crosshair mod, copy an existing vmt file, rename and edit it to point to the file you just copied and edit the weapon scripts to use it.

Using a script for this is less than ideal tho. Just open up the game's textures vpk file (should be something like tf_textures_dir.vpk) with gfscape/crowbar, extract the crosshair you want (should be in materials/vgui/crosshairs), put it the replay folder of the crosshair mod, copy an existing vmt file, rename and edit it to point to the file you just copied and edit the weapon scripts to use it.
5
#5
0 Frags +

Thanks horse, I gave that a go as well but it doesn't seem to have worked either. I used crowbar to extract the crosshairs folder from tf2_textures_dir.vpk, then renamed crosshair5.vtf to crosshair5_valve.vtf, then copied it to Team Fortress 2\tf\custom\crosshairs\materials\vgui\replay\thumbnails. From there I copied a .vmt and changed it to read

"UnlitGeneric"
{
	"$translucent"	1
	"$basetexture" "vgui\replay\thumbnails\crosshair5_valve"
	"$vertexcolor" 1
	"$no_fullbright" 1
	"$ignorez" 1
}

and saved it as crosshair5_valve.vmt, then adjusted relevant rifle script files to read

"crosshair"
		{
				"file"		"vgui/replay/thumbnails/crosshair5_valve"
				"x"		"0"
				"y"		"0"
				"width"		"64"
				"height"	"64"
}

I've checked these to see if they're set to read only or weren't saving properly and they don't seem to be having any issues of that sort. The only crosshair related line in my sniper.cfg is now cl_crosshair_scale 25.650000
https://files.catbox.moe/aj45dp.png
This is a screenshot showing ingame the difference between the two, 300% zoomed in Photoshop - left is crosshair5 from Leth's Crosshair pack on cfg.tfg; right is Valve's crosshair5 set ingame using the options menu.

Again, it's not a big deal, although I am interested now to know why it keeps reverting back to the cfg.tf one. Thank you again

Thanks horse, I gave that a go as well but it doesn't seem to have worked either. I used crowbar to extract the crosshairs folder from tf2_textures_dir.vpk, then renamed crosshair5.vtf to crosshair5_valve.vtf, then copied it to Team Fortress 2\tf\custom\crosshairs\materials\vgui\replay\thumbnails. From there I copied a .vmt and changed it to read
[code]"UnlitGeneric"
{
"$translucent" 1
"$basetexture" "vgui\replay\thumbnails\crosshair5_valve"
"$vertexcolor" 1
"$no_fullbright" 1
"$ignorez" 1
}
[/code]
and saved it as crosshair5_valve.vmt, then adjusted relevant rifle script files to read
[code]"crosshair"
{
"file" "vgui/replay/thumbnails/crosshair5_valve"
"x" "0"
"y" "0"
"width" "64"
"height" "64"
}
[/code]
I've checked these to see if they're set to read only or weren't saving properly and they don't seem to be having any issues of that sort. The only crosshair related line in my sniper.cfg is now cl_crosshair_scale 25.650000
https://files.catbox.moe/aj45dp.png
This is a screenshot showing ingame the difference between the two, 300% zoomed in Photoshop - left is crosshair5 from Leth's Crosshair pack on cfg.tfg; right is Valve's crosshair5 set ingame using the options menu.

Again, it's not a big deal, although I am interested now to know why it keeps reverting back to the cfg.tf one. Thank you again
6
#6
0 Frags +
Scarth

Weird, makes no sense really. If you zip and upload the whole crosshair mod I can try to adjust it myself and see if it works.

[quote=Scarth][/quote]
Weird, makes no sense really. If you zip and upload the whole crosshair mod I can try to adjust it myself and see if it works.
7
#7
0 Frags +

Here you go: https://files.catbox.moe/mu1i6l.zip
If you need my sniper .cfg it's just

sensitivity 1.12
cl_interp 0.033

cl_crosshair_scale 25.650000
Here you go: https://files.catbox.moe/mu1i6l.zip
If you need my sniper .cfg it's just
[code]sensitivity 1.12
cl_interp 0.033

cl_crosshair_scale 25.650000
[/code]
8
#8
0 Frags +

It works perfectly fine for me. I can switch between the crosshairs, including crosshair5_valve, just fine. Only thing I can think of is that you maybe got another folder/vpk in your custom folder that also changes weapon scripts.

It works perfectly fine for me. I can switch between the crosshairs, including crosshair5_valve, just fine. Only thing I can think of is that you maybe got another folder/vpk in your custom folder that also changes weapon scripts.
9
#9
0 Frags +

Alright, thank you anyway. At least this means that I followed your instructions correctly, I'll have a play around and see if I can find out what is causing it.

Alright, thank you anyway. At least this means that I followed your instructions correctly, I'll have a play around and see if I can find out what is causing it.
10
#10
0 Frags +

Small update: I tried extracting the Valve crosshairs again using gfscape and overwriting crosshair5_valve.vtf, this didn't work.

I then tried changing the rifle's script file to read

		"crosshair"
		{
				"file"		"vgui/replay/thumbnails/quarteredcircle"
				"x"		"0"
				"y"		"0"
				"width"		"64"
				"height"	"64"
		}

This did successfully change it to the quartered circle that came from cfg.tf.

I also tried removing my custom hud (m0rehud) and a couple of .vpk's I wasn't really using and found that it didn't make a difference. I'm using mastercomfig low + customizations so I tried adding the transparent viewmodels addon and that hasn't made a difference either. Very bizarre but I'm not sure what else to do so I'll just use my sniper script to set crosshair 5 ingame for that class only. Thanks again for the help

Small update: I tried extracting the Valve crosshairs again using gfscape and overwriting crosshair5_valve.vtf, this didn't work.

I then tried changing the rifle's script file to read
[code] "crosshair"
{
"file" "vgui/replay/thumbnails/quarteredcircle"
"x" "0"
"y" "0"
"width" "64"
"height" "64"
}
[/code]
This did successfully change it to the quartered circle that came from cfg.tf.

I also tried removing my custom hud (m0rehud) and a couple of .vpk's I wasn't really using and found that it didn't make a difference. I'm using mastercomfig low + customizations so I tried adding the transparent viewmodels addon and that hasn't made a difference either. Very bizarre but I'm not sure what else to do so I'll just use my sniper script to set crosshair 5 ingame for that class only. Thanks again for the help
Please sign in through STEAM to post a comment.