this is the zoom state from sniperrifle that is called when the user presses altfire...
Code:
state Zooming
{
simulated function Tick(float DeltaTime)
{
if ( Pawn(Owner).bAltFire == 0 )
{
if ( (PlayerPawn(Owner) != None) && PlayerPawn(Owner).Player.IsA('ViewPort') )
PlayerPawn(Owner).StopZoom();
SetTimer(0.0,False);
GoToState('Idle');
}
}
simulated function BeginState()
{
if ( Owner.IsA('PlayerPawn') )
{
if ( PlayerPawn(Owner).Player.IsA('ViewPort') )
PlayerPawn(Owner).ToggleZoom();
SetTimer(0.2,True);
}
else
{
Pawn(Owner).bFire = 1;
Pawn(Owner).bAltFire = 0;
Global.Fire(0);
}
}
}
As you can see, it uses the function togglezoom that can be found in the pawn class...
That function checks wheter the fov is the default value or not and if it's not it ends the zoom, else it zooms...
The endzoom and startzoom and stopzoom sets the bZooming value to true or false which makes the UpdateEyeHeight function alter the zoom.
If you check the end of UpdateEyeHeight you'll find the piece that takes care of the zooming effect.
In EndZoom you'll also find a resetter that resets the DesiredFOV(the one when zoomed in) to the DefaultFOV (the one you've set as default)
Hope this helps...