Author Topic: Discussion: Zoom Sniper Scope  (Read 13391 times)

Offline Joker{eXtreme}

  • Rank: Private
  • *
  • Posts: 6108
    • http://www.mycallofduty.com
Discussion: Zoom Sniper Scope
« Reply #30 on: February 26, 2008, 08:40:51 pm »
Did you edit the weaponsfiles?

The ads fov of each rifle must be set to 0

Offline weestu

  • Rank: Private
  • *
  • Posts: 8
Discussion: Zoom Sniper Scope
« Reply #31 on: February 26, 2008, 08:58:24 pm »
Doh... fixed and working 100%

Many Thanks  :lol:

Offline Jeepy

  • Rank: Private
  • *
  • Posts: 88
Discussion: Zoom Sniper Scope
« Reply #32 on: February 28, 2008, 06:18:46 pm »
Love the incremental zoom and works great.

Is there a way to add these to work
                  case  "m21_acog_mp":
                        zoom  =  1;  
                        self  setclientDvar  ("cg_fovmin",  "60");         //15 for all
                        break;
 
                  case  "barrett_acog_mp":
                        zoom  =  1;  
                        self  setclientDvar  ("cg_fovmin",  "60");
                        break;
 
                  case  "dragunov_acog_mp":
                        zoom  =  1;  
                        self  setclientDvar  ("cg_fovmin",  "60");
                        break;
 
                  case  "m40a3_acog_mp":
                        zoom  =  1;  
                        self  setclientDvar  ("cg_fovmin",  "60");
                        break;
 
                  case  "remington700_acog_mp":
                        zoom  =  1;  
                        self  setclientDvar  ("cg_fovmin",  "60");
                        break;

I've tried but no luck so far, it will zoom at times but also melee at the same time  but it will easily zoom down with no problems.

Thanks
Jeepy

Offline Joker{eXtreme}

  • Rank: Private
  • *
  • Posts: 6108
    • http://www.mycallofduty.com
Discussion: Zoom Sniper Scope
« Reply #33 on: February 28, 2008, 06:57:22 pm »
Jeepy -- did you change the FOV in those weapons files?

Offline Jeepy

  • Rank: Private
  • *
  • Posts: 88
Discussion: Zoom Sniper Scope
« Reply #34 on: February 28, 2008, 08:33:26 pm »
Yes sir I did.


We have  5 weapons for snipin

m21
barret
dragunov
m40a3
remington700

and I have allowed the acog scope to be an attachment because of some requests

the zomm works up&down fine if you do not choose the scope
but if you do the down zoom works fine but the up zoom does not do right
it will work BUT when you up zoom it melee's also. I'll look around a bit more if if you can think of anything I'd apprieate it

Thannks
Jeepy



Edit: oPPs Hmmm thats 10 weapons that need the fov to be at 0 (Ya Think?)

Offline Joker{eXtreme}

  • Rank: Private
  • *
  • Posts: 6108
    • http://www.mycallofduty.com
Discussion: Zoom Sniper Scope
« Reply #35 on: February 28, 2008, 08:46:52 pm »
Wanna post or email over your zoom GSC ?

Offline Jeepy

  • Rank: Private
  • *
  • Posts: 88
Discussion: Zoom Sniper Scope
« Reply #36 on: February 28, 2008, 08:48:50 pm »
I got er.... Thanks so much!!!

I am going to try to add some sound effects to the zooming action and if successful then I'll post the whole working gsc file if it's ok with whoever owns credit for this great script.

Jeepy

Offline Joker{eXtreme}

  • Rank: Private
  • *
  • Posts: 6108
    • http://www.mycallofduty.com
Discussion: Zoom Sniper Scope
« Reply #37 on: February 28, 2008, 09:03:57 pm »
Oh sweet -- got it working?  Nice

Yea, post away

Offline Jeepy

  • Rank: Private
  • *
  • Posts: 88
Discussion: Zoom Sniper Scope
« Reply #38 on: February 28, 2008, 09:27:17 pm »
Here ya go Joker. This is what I have.

Here is my _ex_zoom.gsc file :

main()  
 
 {  
      self  endon("disconnect");  
      self  endon("death");  
      self  endon("joined_spectators");      
 
      switch(  self  getCurrentWeapon()  )
            {
                  case  "m21_mp":
                        zoom  =  1;  
                        self  setclientDvar  ("cg_fovmin",  "60");         //15 for all
                        break;
 
                  case  "barrett_mp":
                        zoom  =  1;  
                        self  setclientDvar  ("cg_fovmin",  "60");
                        break;
 
                  case  "dragunov_mp":
                        zoom  =  1;  
                        self  setclientDvar  ("cg_fovmin",  "60");
                        break;
 
                  case  "m40a3_mp":
                        zoom  =  1;  
                        self  setclientDvar  ("cg_fovmin",  "60");
                        break;
 
                  case  "remington700_mp":
                        zoom  =  1;  
                        self  setclientDvar  ("cg_fovmin",  "60");
                        break;
                  
                   case  "m21_acog_mp":
                        zoom  =  1;  
                        self  setclientDvar  ("cg_fovmin",  "60");         //15 for all
                        break;
 
                  case  "barrett_acog_mp":
                        zoom  =  1;  
                        self  setclientDvar  ("cg_fovmin",  "60");
                        break;
 
                  case  "dragunov_acog_mp":
                        zoom  =  1;  
                        self  setclientDvar  ("cg_fovmin",  "60");
                        break;
 
                  case  "m40a3_acog_mp":
                        zoom  =  1;  
                        self  setclientDvar  ("cg_fovmin",  "60");
                        break;
 
                  case  "remington700_acog_mp":
                        zoom  =  1;  
                        self  setclientDvar  ("cg_fovmin",  "60");
                        break;
 
                  default:
                        zoom  =  0;
                        break;
            }
 
      while(isAlive(  self  )  &&  zoom  !=  0)  
      {  
            wait  .05;                                   //.05
 
            if  (  self  playerADS()  ==  1)  
            {                                                      
                              if(!isdefined(self.hud_zoom))
                              {
                                                self.hud_zoom  =  newClientHudElem(self);
                                                self.hud_zoom.x  =  320;
                                                self.hud_zoom.y  =  450;
                                                self.hud_zoom.alignx  =  "center";
                                                self.hud_zoom.aligny  =  "middle";
                                                self.hud_zoom.horzAlign  =  "fullscreen";
                                                self.hud_zoom.vertAlign  =  "fullscreen";
                                                self.hud_zoom.alpha  =  .9;
                                                self.hud_zoom.fontScale  =  1.5;
                              }
                              self.hud_zoom.label  =  &"^7[^1FEAR^7] ^2Insta-Zoom ^5";  //comment  this  out  if  you  do  not  have  localized  strings  defined  here
                              self.hud_zoom  setvalue(zoom);  
                               
                              if  (  self  meleeButtonPressed())
                     
                        {  
                                                zoom++;  
                                                     
                                    if  (zoom  ==  7)  zoom  =  6;  
                                                                     
                                      if  (zoom  ==  1)  self  setclientDvar  ("cg_fovmin",  "60");  //40
                                      if  (zoom  ==  2)  self  setclientDvar  ("cg_fovmin",  "50");  //20  
                                      if  (zoom  ==  3)  self  setclientDvar  ("cg_fovmin",  "40");  //15
                                      if  (zoom  ==  4)  self  setclientDvar  ("cg_fovmin",  "30");  //10
                                      if  (zoom  ==  5)  self  setclientDvar  ("cg_fovmin",  "20");  //5
                                      if  (zoom  ==  6)  self  setclientDvar  ("cg_fovmin",  "10");  //3
                        }
                        //self playlocalsound("sndbag_snow02.wav");                                         //No worky yet Jeepy
                        
                        if ( self fragButtonPressed())
                        {
                                    zoom--;
                     
                           if (zoom == 0)   zoom =   1;
                     
                           if (zoom == 6) self setclientDvar ("cg_fovmin", "10");
                           if (zoom == 5) self setclientDvar ("cg_fovmin", "20");
                           if (zoom == 4) self setclientDvar ("cg_fovmin", "30");
                           if (zoom == 3) self setclientDvar ("cg_fovmin", "40");
                           if (zoom == 2) self setclientDvar ("cg_fovmin", "50");
                           if (zoom == 1) self setclientDvar ("cg_fovmin", "60");
                        }
                        //self playlocalsound("sndbag_snow01.wav");                                      //No worky either  Jeepy
            }  
             
            if(isDefined(self.hud_zoom)  &&  self  playerADS()  !=  1  )  self.hud_zoom  destroy();      
      }
 }




Now ya gotta remember like Joker and all say

Set  adsZoomFov to 0 (zero) in each weapons mp file you wish to ues
Also set meleedamage to 0 (zero)  That will get rid of the knifeing action

You'll find the weapons file in your extreme mods clientside.iwd\weapons\mp folder.


Hope this helps

PS ...
If I get the sound workin I'll post it as well or maybe someone else will add to this.

Jeepy

Offline Joker{eXtreme}

  • Rank: Private
  • *
  • Posts: 6108
    • http://www.mycallofduty.com
Discussion: Zoom Sniper Scope
« Reply #39 on: February 28, 2008, 09:45:32 pm »
Sound
Code: [Select]

if (zoom_mode == 0)
{
self setclientDvar ("cg_fovmin", "15");
self playlocalsound("mouse_click");
}
else
if (zoom_mode == 1)
{
self setclientDvar ("cg_fovmin", "7");
self playlocalsound("mouse_click");

Offline redrock

  • Rank: Private
  • *
  • Posts: 119
    • http://easclan.org
Discussion: Zoom Sniper Scope
« Reply #40 on: February 28, 2008, 11:53:13 pm »
in the above example where would you place that script joker thx

Offline Joker{eXtreme}

  • Rank: Private
  • *
  • Posts: 6108
    • http://www.mycallofduty.com
Discussion: Zoom Sniper Scope
« Reply #41 on: February 29, 2008, 01:09:56 am »
if (zoom == 1) self setclientDvar ("cg_fovmin", "60"); //40
if (zoom == 2) self setclientDvar ("cg_fovmin", "50"); //20
if (zoom == 3) self setclientDvar ("cg_fovmin", "40"); //15
if (zoom == 4) self setclientDvar ("cg_fovmin", "30"); //10
if (zoom == 5) self setclientDvar ("cg_fovmin", "20"); //5
if (zoom == 6) self setclientDvar ("cg_fovmin", "10"); //3

would looke like

if (zoom == 1)
{
     self setclientDvar ("cg_fovmin", "60");
     self playlocalsound ("mouse_click");
}

etc etc etc etc etc

Offline PatmanSan

  • Administrator
  • Rank: Private
  • *****
  • Posts: 2527
Discussion: Zoom Sniper Scope
« Reply #42 on: February 29, 2008, 03:04:35 am »
Quote from: "Jeepy"
//self playlocalsound("sndbag_snow02.wav"); //No worky yet Jeepy

//self playlocalsound("sndbag_snow01.wav"); //No worky either Jeepy


- You cannot feed a sound file into the playlocalsound procedure. You need to feed it a sound alias.
- Don't try to play the sound outside the meleeButtonPressed or fragButtonPressed blocks. If those calls would work (fixed aliases), they would also play if NOT pressing melee or frag, and the sounds would overlap too.

This is not the code from X4 1.1, but an optimized version of what you have now. Give it a try.

Code: [Select]
main()
{
self endon("disconnect");
self endon("death");
self endon("joined_spectators");

zoom = 0;

while( isAlive(self) )
{
wait .05;

if( isSniper(self getCurrentWeapon()) && self playerADS() )
{
if(!zoom)
{
zoom = 1;
setZoom(zoom);
}

if( !isdefined(self.hud_zoom) )
{
self.hud_zoom = newClientHudElem(self);
self.hud_zoom.x = 320;
self.hud_zoom.y = 450;
self.hud_zoom.alignx = "center";
self.hud_zoom.aligny = "middle";
self.hud_zoom.horzAlign = "fullscreen";
self.hud_zoom.vertAlign = "fullscreen";
self.hud_zoom.alpha = .9;
self.hud_zoom.fontScale = 1.5;
}

self.hud_zoom.label = &"ZOOM LEVEL ";
self.hud_zoom setvalue(zoom);

if( self meleeButtonPressed() && zoom < 6)
{
zoom++;
//self playlocalsound("put_valid_soundalias_here");
setZoom(zoom);
wait .2;
}

if( self fragButtonPressed() && zoom > 1)
{
zoom--;
//self playlocalsound("put_valid_soundalias_here");
setZoom(zoom);
wait .2;
}
}
else if( isDefined(self.hud_zoom) ) self.hud_zoom destroy();
}
}

setZoom(zoom)
{
self endon("disconnect");
self endon("death");

zoomvalue = 70 - (zoom * 10);
self setclientDvar("cg_fovmin", zoomvalue);
if(isDefined(self.hud_zoom)) self.hud_zoom setvalue(zoom);
}

isSniper(weapon)
{
switch(weapon)
{
case "m21_mp":
case "m21_acog_mp":
case "m40a3_mp":
case "m40a3_acog_mp":
case "barrett_mp":
case "barrett_acog_mp":
case "dragunov_mp":
case "dragunov_acog_mp":
case "remington700_mp":
case "remington700_acog_mp": return true;
default: return false;
}
}

Offline Jeepy

  • Rank: Private
  • *
  • Posts: 88
Discussion: Zoom Sniper Scope
« Reply #43 on: February 29, 2008, 02:20:20 pm »
Perfect





Thanks
Jeepy

Offline The_Aces

  • Rank: Private
  • *
  • Posts: 35
Discussion: Zoom Sniper Scope
« Reply #44 on: March 16, 2008, 09:17:54 pm »
hi just been going through this and cant seem to get it to work this is in my ex_zoom file
Code: [Select]
main()

{
self endon("disconnect");
self endon("death");
self endon("joined_spectators");

switch( self getCurrentWeapon() )
{
case "m21_mp":
zoom = 1;
self setclientDvar ("cg_fovmin", "40");
break;

case "barrett_mp":
zoom = 1;
self setclientDvar ("cg_fovmin", "40");
break;

case "dragunov_mp":
zoom = 1;
self setclientDvar ("cg_fovmin", "40");
break;

case "m40a3_mp":
zoom = 1;
self setclientDvar ("cg_fovmin", "40");
break;

case "remington700_mp":
zoom = 1;
self setclientDvar ("cg_fovmin", "40");
break;

case "m21_acog_mp":
zoom = 1;
self setclientDvar ("cg_fovmin", "40");
break;

case "barrett_acog_mp":
zoom = 1;
self setclientDvar ("cg_fovmin", "40");
break;

case "dragunov_acog_mp":
zoom = 1;
self setclientDvar ("cg_fovmin", "40");
break;

case "m40a3_acog_mp":
zoom = 1;
self setclientDvar ("cg_fovmin", "40");
break;

case "remington700_acog_mp":
zoom = 1;
self setclientDvar ("cg_fovmin", "40");
break;

default:
zoom = 0;
break;
}

while(isAlive( self ) && zoom != 0)
{
wait .05; //.05

if ( self playerADS() == 1)
{
if(!isdefined(self.hud_zoom))
{
self.hud_zoom = newClientHudElem(self);
self.hud_zoom.x = 320;
self.hud_zoom.y = 450;
self.hud_zoom.alignx = "center";
self.hud_zoom.aligny = "middle";
self.hud_zoom.horzAlign = "fullscreen";
self.hud_zoom.vertAlign = "fullscreen";
self.hud_zoom.alpha = .9;
self.hud_zoom.fontScale = 2;
}
self.hud_zoom.label = &"^3ZOOM ^1"; //comment this out if you do not have localized strings defined here
self.hud_zoom setvalue(zoom);

if ( self meleeButtonPressed())
{
zoom++;
//self playlocalsound("mouse_click");
            setZoom(zoom);
            wait .2;
}

if (zoom == 7) zoom = 6;
{
if (zoom == 1) self setclientDvar ("cg_fovmin", "40");
if (zoom == 2) self setclientDvar ("cg_fovmin", "20");
if (zoom == 3) self setclientDvar ("cg_fovmin", "15");
if (zoom == 4) self setclientDvar ("cg_fovmin", "10");
if (zoom == 5) self setclientDvar ("cg_fovmin", "5");
if (zoom == 6) self setclientDvar ("cg_fovmin", "3");
}

if ( self fragButtonPressed())
{
zoom--;
//self playlocalsound("mouse_click");
            setZoom(zoom);
            wait .2;
}

if (zoom == 0) zoom = 1;
{
if (zoom == 6) self setclientDvar ("cg_fovmin", "3");
if (zoom == 5) self setclientDvar ("cg_fovmin", "5");
if (zoom == 4) self setclientDvar ("cg_fovmin", "10");
if (zoom == 3) self setclientDvar ("cg_fovmin", "15");
if (zoom == 2) self setclientDvar ("cg_fovmin", "20");
if (zoom == 1) self setclientDvar ("cg_fovmin", "40");
}  

if(isDefined(self.hud_zoom) && self playerADS() != 1 ) self.hud_zoom destroy();
}
}


and i put it in the mod it just crashes the server can some body help me with this and thanx for any help i receive..............i think my woman powers are running out lol