Difference between revisions of "Script - Escort Reticle"

From FreeSpace Wiki
Jump to: navigation, search
(Updated the script for compatibility)
(Now replaces the old script fully)
Line 5: Line 5:
  
 
$Application: FS2_Open
 
$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)
 +
gr.drawString(ship.Name, x, y1 + 4)
 +
end
 +
]
  
 
$On HUD Draw:
 
$On HUD Draw:
 
[
 
[
  
missiontime = mn.getMissionTime()
+
if hu.HUDDrawn then
if missiontime > 0.5 then
+
if mn.EscortShips ~= nil then
  if mn.EscortShips ~= nil then
+
NumberEscorted = #mn.EscortShips
      NumberEscorted = #mn.EscortShips
+
for i= 1,NumberEscorted do
      for i= 1,NumberEscorted do
+
escortedship = mn.EscortShips[i]
        escortedship = mn.EscortShips[i]
+
if escortedship.Position:getScreenCoords() ~= false then
        if escortedship.Position:getScreenCoords() ~= false then
+
drawReticle(escortedship)
            x1, y1 = escortedship.Position:getScreenCoords()
+
end
            if escortedship.Team.Name == "Hostile" then
+
end
              gr.setColor(255,50,50,255)
+
end
              gr.drawTargetingBrackets(escortedship, true)
 
            elseif escortedship.Team.Name == "Friendly" then
 
              gr.setColor(0,255,0,255)
 
              gr.drawTargetingBrackets(escortedship, true)
 
            elseif escortedship.Team.Name == "Unknown" then
 
              gr.setColor(255,255,0,255)
 
              gr.drawTargetingBrackets(escortedship, true)
 
            end
 
        end
 
      end
 
  end
 
 
end
 
end
  

Revision as of 07:04, 25 January 2010

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)
	gr.drawString(ship.Name, x, y1 + 4)
end
]

$On HUD Draw:
[

if hu.HUDDrawn 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