Script - Zoom

From FreeSpace Wiki
Revision as of 15:10, 15 July 2010 by M!m (talk | contribs) (Created page with 'This script enables you to zoom your view so precise aiming is easier. == Table Entry == * To use create an file called '''zoom-sct.tbm''' in your date/tables directory and paste…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This script enables you to zoom your view so precise aiming is easier.

Table Entry

  • To use create an file called zoom-sct.tbm in your date/tables directory and paste the following code into it:
#Conditional Hooks

$Application: FS2_Open
$On Mission Start: 
[
runZoomScript = true
zoomValue = 0.1
normalFOV = 0.75
zooming = false
defaultZoomSet = false
]

$Application: FS2_Open
$On Mission End: 
[
runZoomScript = false
]

$KeyPress: d
$State: GS_STATE_GAME_PLAY
$On Key Pressed: 
[
if runZoomScript then 
	if not zooming then
		plr = hv.Player
		if plr:isValid() then
			if #gr.Cameras > 0 then
				cam = gr.Cameras[1]
				if cam:isValid() then
					zooming = true
					if not defaultZoomSet then
						normalFOV = cam.FOV
						defaultZoomSet = true
					end
					zoom = normalFOV * zoomValue
					cam:setFOV(zoom,2,1,0.5)
				end
			end
		end
	end
end
]

$KeyPress: d
$State: GS_STATE_GAME_PLAY
$On Key Released:
[
if runZoomScript then 
	if zooming then
		plr = hv.Player
		if plr:isValid() then
			if #gr.Cameras > 0 then
				cam = gr.Cameras[1]
				if cam:isValid() then
					zooming = false
					cam:setFOV(normalFOV,2,1,0.5)
				end
			end
		end
	end
end
]

#End