Game Development Community

Zooming Questions

by Stephen · in Torque Game Engine · 10/02/2005 (1:11 pm) · 2 replies

Hello, I have been playing around with zooming in my game and I have a few question about it. Here's the scripts that I have got for the zooming. Zoom Functions

The zoom works great but I have ran into a few problems. The first one is how can set it where you can not zoom in if you are in third person. The next one is I have a reload function for the rifle and how can I set it where (if zoomed in) when you are reloading it gets out of zoom for reloading. The last one, is when you die while zoomed in, it stays zoomed it. How can I set it where when you die and zoomed in, it unzooms.

Thanks,
Stephen

#1
10/02/2005 (1:58 pm)
I belive you took your zoom code from the zoom resource at the bottom of the resource I posted something that should help but I'll reiderate.

function serverCmdweaponzoomout(%client){
$ZoomOn = false;
setFov( $Pref::player::DefaultFov );
ScopeGuiGroup1.Visible = 0; // Make XM8 Scope HUD Invisible
ScopeGuiGroup2.Visible = 0; //Make Sniper Rifle Scope HUD Invisible
Crosshair.Visible = 1; // Show crosshair
}

everytime you want to zoom out you say

commandToServer('weaponzoomout');

so now find
function reloadBullets(%image, %obj) {

// The ammo inventory state has changed, we need to update any
// mounted images using this ammo to reflect the new state.
for (%i = 0; %i < 8; %i++) {
if (%image == %obj.getMountedImage(%i))
%obj.setImageAmmo(%i,true);
}

%obj.decInventory(%image.clip,1);
%obj.setInventory(%image.ammo,%image.ammo.maxInventory);
commandToServer('weaponzoomout');

}
and add the command to server like I just did
#2
10/02/2005 (2:32 pm)
Cool thanks, but now how can I set it up where you can't zoom in the thirdperson.

Thanks