Zoom Function Issues
by Chris "C2" Byars · in Torque Game Engine · 03/11/2006 (4:35 pm) · 0 replies
In expansion of my Zoom Resource, I was working on getting the scopes to be toggling, so the user does not have to hold the zoom button down the entire time the scope is active in order to use it.
Currently I was able to get it to work; however, there is one minor issue I'd like to get sorted out, and my knowledge on toggling as such is limited. Hitting the zoom key once both activates and deactivates the scopes perfectly, but if you hold down the zoom key when you hit it to deactivate, (!$ZoomOn), the FOV will remain at the scope's FOV as long as you hold the button down.
Edit: SOLVED
Currently I was able to get it to work; however, there is one minor issue I'd like to get sorted out, and my knowledge on toggling as such is limited. Hitting the zoom key once both activates and deactivates the scopes perfectly, but if you hold down the zoom key when you hit it to deactivate, (!$ZoomOn), the FOV will remain at the scope's FOV as long as you hold the button down.
Edit: SOLVED
function clientCmdZoomInDaBiatch( %val, %curWeapon )
{
if ( %val && %curWeapon $= "XM8" )
{
$ZoomOn = !$ZoomOn;
if ($ZoomOn)
setFov(15);
else
setFov($Pref::player::DefaultFov);
ScopeGuiGroup.setVisible($ZoomOn); // show crosshair for zoom
Crosshair.setVisible(!$ZoomOn); // hide crosshair
}
else if ( %val && %curWeapon $= "sniperRifle" )
{
$ZoomOn = !$ZoomOn;
if ($ZoomOn)
setFov(11.25);
else
setFov($Pref::player::DefaultFov);
SniperGuiGroup.setVisible($ZoomOn); // show GUI for zoom
Crosshair.setVisible(!$ZoomOn); // hide crosshair
}
else
{
if ( !$ZoomOn )
{
setFov( $Pref::player::DefaultFov );
}
else
{
}
}
}