Script - Escort Reticle

From FreeSpace Wiki
Revision as of 08:40, 25 January 2010 by Zacam (talk | contribs)
Jump to: navigation, search

Function

Creates an additional reticle around all ships in the escort list. This script needs a nightly build revision 5834 or later to work.

Table Entry

#Conditional Hooks

$Application: FS2_Open

$On Game Init:
[
drawReticle = function(ship)
	if     ship.Team.Name == "Hostile"  then gr.setColor(255,50,50,255)
	elseif ship.Team.Name == "Friendly" then gr.setColor(0,255,0,255)
	elseif ship.Team.Name == "Unknown"  then gr.setColor(255,255,0,255)
	end
	local x 
	local y
	local x1
	local y1 
	x,y,x1,y1 = gr.drawTargetingBrackets(ship, true)
	if x ~= nil and y1 ~= nil then gr.drawString(ship.Name, x, y1 + 4) end
end
]

$On HUD Draw:
[

if missiontime == nil then
   missiontime = mn.getMissionTime()
   oldmissiontime = missiontime
end

if missiontime ~= nil then
	if hu.HUDDrawn then
	missiontime = mn.getMissionTime()
		if oldmissiontime ~= missiontime then
        		if mn.EscortShips ~= nil then
	        		NumberEscorted = #mn.EscortShips
		        	for i= 1,NumberEscorted do
	        			escortedship = mn.EscortShips[i]
        				if escortedship.Position:getScreenCoords() ~= false then
		        			drawReticle(escortedship)
			        	end
         			end
	        	end
		end
	end
	oldmissiontime = missiontime
end

]

#End