Difference between revisions of "Script - Escort Reticle"

From FreeSpace Wiki
Jump to: navigation, search
(new page)
 
(Updated the script for compatibility)
Line 1: Line 1:
 
==Function==
 
==Function==
Creates an additional reticle around all ships in the escort list and also displayes ships name below the reticle
+
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==
 
==Table Entry==
<pre>#Global Hooks
+
<pre>#Conditional Hooks
 
 
$GameInit:
 
 
 
[
 
 
 
escortReticle = function(x1, y1, name)
 
  gr.drawGradientLine(x1, y1+36, x1+8, y1+24)
 
  gr.drawGradientLine(x1, y1+36, x1-8, y1+24)
 
  gr.drawGradientLine(x1+24, y1, x1+16, y1+12)
 
  gr.drawGradientLine(x1-24, y1, x1-16, y1+12)
 
  gr.drawGradientLine(x1, y1-36, x1+8, y1-24)
 
  gr.drawGradientLine(x1, y1-36, x1-8, y1-24)
 
  gr.drawGradientLine(x1+24, y1, x1+16, y1-12)
 
  gr.drawGradientLine(x1-24, y1, x1-16, y1-12)
 
  gr.drawString(name,x1-36,y1+48)
 
end
 
 
 
]
 
  
$HUD:
+
$Application: FS2_Open
  
 +
$On HUD Draw:
 
[
 
[
  
for i=1, mn.getNumEscortShips() do
+
missiontime = mn.getMissionTime()
  escortedship = mn.getEscortShipByIndex(i)
+
if missiontime > 0.5 then
  X, Y = escortedship.Position:getScreenCoords()
+
  if mn.EscortShips ~= nil then
  if escortedship.Position:getScreenCoords() ~= false and escortedship.Team.Name == "Hostile" then
+
      NumberEscorted = #mn.EscortShips
      gr.setColor(255,50,50,255)
+
      for i= 1,NumberEscorted do
      escortReticle(X, Y, escortedship.Name)
+
        escortedship = mn.EscortShips[i]
  end
+
        if escortedship.Position:getScreenCoords() ~= false then
  if escortedship.Position:getScreenCoords() ~= false and escortedship.Team.Name == "Friendly" then
+
            x1, y1 = escortedship.Position:getScreenCoords()
      gr.setColor(0,255,0,255)
+
            if escortedship.Team.Name == "Hostile" then
      escortReticle(X, Y, escortedship.Name)
+
              gr.setColor(255,50,50,255)
  end
+
              gr.drawTargetingBrackets(escortedship, true)
  if escortedship.Position:getScreenCoords() ~= false and escortedship.Team.Name == "Unknown" then
+
            elseif escortedship.Team.Name == "Friendly" then
      gr.setColor(255,255,0,255)
+
              gr.setColor(0,255,0,255)
      escortReticle(X, Y, escortedship.Name)
+
              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
 
end

Revision as of 12:02, 23 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 HUD Draw:
[

missiontime = mn.getMissionTime()
if missiontime > 0.5 then
   if mn.EscortShips ~= nil then
      NumberEscorted = #mn.EscortShips
      for i= 1,NumberEscorted do
         escortedship = mn.EscortShips[i]
         if escortedship.Position:getScreenCoords() ~= false then
            x1, y1 = escortedship.Position:getScreenCoords()
            if escortedship.Team.Name == "Hostile" then
               gr.setColor(255,50,50,255)
               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