Announcement

Collapse
No announcement yet.

Zoom Crosshair Problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Zoom Crosshair Problem

    Strange crosshair problem, if the player dies with zoom enabled the crosshair is hidden until the player picks up the weapon again!

    code:
    -----------------------------------------------------------------------------------
    simulated event RenderOverlays( Canvas Canvas )
    {
    local PlayerController P;
    local float Scale;

    P = PlayerController(Instigator.Controller);
    LastFOV = PlayerController(Instigator.Controller).DesiredFOV ;

    if ( LastFOV > P.DesiredFOV )
    {
    PlaySound(Sound'WeaponSounds.LightningGun.Lightnin gZoomIn', SLOT_Misc,,,,,false);
    }

    else if ( LastFOV < P.DesiredFOV )
    {
    PlaySound(Sound'WeaponSounds.LightningGun.Lightnin gZoomOut', SLOT_Misc,,,,,false);
    }

    if ( P.DesiredFOV == P.DefaultFOV)
    {
    P.MyHud.bCrosshairShow = True;
    Super.RenderOverlays(Canvas);
    zoomed = false;
    }

    else
    {
    P.MyHud.bCrosshairShow = False;
    SetZoomBlendColor(Canvas);
    scale = Canvas.ClipX/640 * 1.1;
    Canvas.SetPos(0.5 * Canvas.ClipX - 128 * Scale, 0.5 * Canvas.ClipY - 128 * Scale );
    Canvas.Style = ERenderStyle.STY_Translucent;
    Canvas.DrawIcon(Texture'CrapTex.Tex.CrapScope', Scale);
    Canvas.SetPos(0.5 * Canvas.ClipX + 64 * Scale, 0.5 * Canvas.ClipY + 96 * Scale);
    Canvas.DrawColor.R = 0;
    Canvas.DrawColor.G = 155;
    Canvas.DrawColor.B = 255;
    scale = P.DefaultFOV/P.DesiredFOV;
    Canvas.DrawText("X"$int(Scale)$"."$int(10 * scale - 10 * int(Scale)));
    zoomed = true;
    }
    }
    -----------------------------------------------------------------------------

    #2
    I was only doing this yesterday At first I did it exactly the same as you did, however it doesnt take into account wether the player had crosshairs hidden by default and means that the non-zoomed view will put the crosshair back up wether the player wants it or not

    Create a variable in your fire class that stores the state of the crosshair default for player and restore to that rather than a direct true or false at bringup, putdown and in event of playerdeath.

    Comment


      #3
      :up: THX

      Added the following to PutDown and ClientWeaponThrown in my WeaponClass.

      Works perfect!
      code:
      ==============================================

      simulated function ClientWeaponThrown()
      {
      if( Instigator != none && Instigator.Controller.IsA( 'PlayerController' ) )
      PlayerController(Instigator.Controller).EndZoom();
      PlayerController(Instigator.Controller).MyHud.bCro sshairShow = True;
      Super.ClientWeaponThrown();
      }
      simulated function bool PutDown()
      {
      if( Instigator.Controller.IsA( 'PlayerController' ) )
      PlayerController(Instigator.Controller).EndZoom();
      PlayerController(Instigator.Controller).MyHud.bCro sshairShow = True;
      if ( Super.PutDown() )
      {
      GotoState('');
      return true;
      }
      return false;
      }
      ==============================================

      Comment


        #4
        what happens if they die while zoomed

        i had this problem and thought i fixed it but it doesnt seem to work online O_o

        Comment


          #5
          Tested it online and it works.

          Comment

          Working...
          X