Page 1 of 3

Zoom script for .12b

Posted: Mon Feb 02, 2015 8:14 pm
by Chameleon
I don't have much time, so here's something from tpsd:

EDIT: This script changes your Field Of View SMOOTHLY when aiming or sprinting. Must be applied to each weapon's script individually in order to take effect for those weapons. Compatible with 99.99% of mods. Look below in comments for two more tutorials.
here's a script of FOV - smoothed out! (there might be some little bug when reloading, but it is hard to notice):
File: View.as, Place: in void AddToScene() {
Code: Select all
float zoom = AimDownSightStateSmooth * (cg_zoomFov.IntValue - fov);  //difference in fov (degrees). below zero when aiming
float run = SprintState * (cg_runFov.IntValue - fov); //above zero when sprinting
cg_fov.IntValue = fov + zoom + run;
if (AimDownSightState == 0 && SprintState == 0)
{
	cg_fov.IntValue = fov;
}
Same file, place: class ViewSMGSkin { (don't do CTRL+F, not accurate)
Code: Select all
		ConfigItem cg_fov("cg_fov");
		private ConfigItem cg_fov2("cg_fov2");
		private int fov = cg_fov2.IntValue;
		private ConfigItem cg_zoomFov("cg_zoomFov");
		private ConfigItem cg_runFov("cg_runFov");
File: Scripts/Gui/Preferences.as Place: about line 660, together with other options
Code: Select all
			layouter.AddSliderField(_Tr("Preferences", "FOV"), "cg_fov", 60, 110, 5,
				ConfigNumberFormatter(1, " deg"));
			layouter.AddSliderField(_Tr("Preferences", "FOV2 - keep same as FOV"), "cg_fov2", 60, 110, 5,
				ConfigNumberFormatter(1, " deg"));
			layouter.AddSliderField(_Tr("Preferences", "ZoomFOV"), "cg_zoomFov", 20, 90, 5,
				ConfigNumberFormatter(1, " deg"));
			layouter.AddSliderField(_Tr("Preferences", "SprintFOV"), "cg_runFov", 60, 110, 5,
				ConfigNumberFormatter(1, " deg"));
This can be applied to each weapon individually.
Credit is a must.

Re: Zoom script for .12b

Posted: Mon Feb 02, 2015 8:38 pm
by Omicronkill
You, sir, deserve a cookie.

Srsly, that's truely awesome! Can I include it with my AWP?

Re: Zoom script for .12b

Posted: Mon Feb 02, 2015 8:46 pm
by bloodfox
YUS! Except, I don't give a f*ck about OS modding... But, iceball modding on the other hand...

Re: Zoom script for .12b

Posted: Mon Feb 02, 2015 9:01 pm
by Omicronkill
bloodfox wrote:
YUS! Except, I don't give a f*ck about OS modding... But, iceball modding on the other hand...
Yes, we know that you love Iceball x)

This answer was my first totally inutile post here, applause! Maybe I must gtb now...

Re: Zoom script for .12b

Posted: Mon Feb 02, 2015 10:50 pm
by bloodfox
Omicronkill wrote:
bloodfox wrote:
YUS! Except, I don't give a f*ck about OS modding... But, iceball modding on the other hand...
Yes, we know that you love Iceball x)

This answer was my first totally inutile post here, applause! Maybe I must gtb now...
Here, have a trophy.

Re: Zoom script for .12b

Posted: Tue Feb 03, 2015 1:12 pm
by Chameleon
Yes you can! OK, let me change this: anyone can use it, but credit is a must.

Re: Zoom script for .12b

Posted: Tue Feb 03, 2015 8:17 pm
by Omicronkill
The script works like a charm, but there is a bug the first time you play with it. You can't see anything w/o sprinting/aiming, you actually have to modify the fov options to your liking and to rejoin a server before being able to play with it.

Anyway, nice work as always!

Re: Zoom script for .12b

Posted: Thu Feb 05, 2015 2:56 am
by Hot Dog
I've got a couple questions. Mind you, these are coming from a layman.
Not sure how hard this would be, but (1) can you make it so each weapon has a different fov?
And (2) can you make it so fov is adjusted via the scroll wheel?
The second one comes off as difficult to me.

Re: Zoom script for .12b

Posted: Thu Feb 05, 2015 9:48 am
by Chameleon
1st one: Yes you can (if you know a little bit of scripting, you should do it easily)
2nd one: I have to look at the code (.as files, not source) to see if it's possible. I've always wanted to bind a key to medkit

Re: Zoom script for .12b

Posted: Sat Feb 07, 2015 2:31 pm
by BlueKorean
Uhh, I don't know how to use those C++ codes or any coding, but I want my rifle to zoom in when ads. So, can you put a file of view.as or anything else that are needed to make this work? I have no idea how this works. O.O but, I can see that this is amazing work :D

Re: Zoom script for .12b

Posted: Sat Feb 07, 2015 4:00 pm
by Chameleon
I'll make a tutorial for this matter... View.as files can differ a lot sometimes, so the View.as I'll give you might not work with some mods.
Start modding tutorial.doc - Dropbox
FOV script tutorial.doc - Dropbox

I provided some images and wasted 2 hours on this.

Re: Zoom script for .12b

Posted: Sun Feb 08, 2015 7:14 pm
by BlueKorean
Thx A LOT. You man, deserves more than a cookie. A jar full of cookies!

Re: Zoom script for .12b

Posted: Mon Feb 09, 2015 1:34 pm
by Rainbow_Rambo
Chameleon wrote:
here's a script of FOV - smoothed out!
Could you explain this in some other words?
I cant understand what this effect is. Thank you)

Re: Zoom script for .12b

Posted: Mon Feb 09, 2015 4:23 pm
by Omicronkill
What Chameleon means here is that when you are aiming or sprinting, the FOV changes smoothly.

Re: Zoom script for .12b

Posted: Sat Feb 14, 2015 12:12 pm
by Someone64
Is it possible to make it so that I can have preferences per each weapon so for example, my shotgun doesn't zoom in as closely as a sniper rifle while when the rifle is selected it does?