Zoom script for .12b

Released modifications for the OpenSpades client.
Forum rules
Release, download, and praise or criticize completed modifications. For installation and creation help, please visit the OpenSpades general discussion forum.
31 posts Page 1 of 3 First unread post
Chameleon
Modder
Modder
Posts: 601
Joined: Thu Nov 22, 2012 6:41 pm


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.
Last edited by Chameleon on Thu Feb 12, 2015 7:28 am, edited 3 times in total.
Omicronkill
Deuced Up
Posts: 87
Joined: Sat Oct 26, 2013 4:45 pm


You, sir, deserve a cookie.

Srsly, that's truely awesome! Can I include it with my AWP?
bloodfox
Post Demon
Post Demon
Posts: 2206
Joined: Mon Oct 21, 2013 4:32 pm


YUS! Except, I don't give a f*ck about OS modding... But, iceball modding on the other hand...
Omicronkill
Deuced Up
Posts: 87
Joined: Sat Oct 26, 2013 4:45 pm


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...
bloodfox
Post Demon
Post Demon
Posts: 2206
Joined: Mon Oct 21, 2013 4:32 pm


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.
Chameleon
Modder
Modder
Posts: 601
Joined: Thu Nov 22, 2012 6:41 pm


Yes you can! OK, let me change this: anyone can use it, but credit is a must.
Omicronkill
Deuced Up
Posts: 87
Joined: Sat Oct 26, 2013 4:45 pm


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!
Hot Dog
Blue Master Race
Blue Master Race
Posts: 83
Joined: Sun Dec 22, 2013 2:36 am


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.
Chameleon
Modder
Modder
Posts: 601
Joined: Thu Nov 22, 2012 6:41 pm


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
BlueKorean
Deuce
Posts: 7
Joined: Thu May 22, 2014 1:18 pm


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
Chameleon
Modder
Modder
Posts: 601
Joined: Thu Nov 22, 2012 6:41 pm


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.
BlueKorean
Deuce
Posts: 7
Joined: Thu May 22, 2014 1:18 pm


Thx A LOT. You man, deserves more than a cookie. A jar full of cookies!
Rainbow_Rambo
Deuced Up
Posts: 25
Joined: Wed May 07, 2014 7:21 pm


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)
Omicronkill
Deuced Up
Posts: 87
Joined: Sat Oct 26, 2013 4:45 pm


What Chameleon means here is that when you are aiming or sprinting, the FOV changes smoothly.
Someone64
Deuce
Posts: 1
Joined: Sat Feb 14, 2015 12:10 pm


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?
31 posts Page 1 of 3 First unread post
Return to “OpenSpades MODs”

Who is online

Users browsing this forum: No registered users and 40 guests