Hard Light Productions Forums

Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: StargateSpankyHam on March 11, 2010, 11:07:57 am

Title: Second Reticule?
Post by: StargateSpankyHam on March 11, 2010, 11:07:57 am
The last time I installed the SCP mod, I had a secondary reticule behind my primary one, useful for seeing where the nose of the ship was pointed when flying from the chase view. However, after a system crash and a reinstall of everything, that second reticule is now gone. I seem to be unable to locate the option to reactivate it.

Does someone know how to do this?
Title: Re: Second Reticule?
Post by: m!m on March 11, 2010, 11:26:21 am
It was most likely the Velocity Indicator (http://www.hard-light.net/wiki/index.php/Script_-_Velocity_Indicator (http://www.hard-light.net/wiki/index.php/Script_-_Velocity_Indicator)).
Follow the instructions on the page and you'll have it back :)

The new Version of Blue Planet has it in also i think...
Title: Re: Second Reticule?
Post by: The E on March 11, 2010, 01:16:37 pm
Yes, it does, as part of the optional glide package.
Title: Re: Second Reticule?
Post by: Nuke on March 11, 2010, 01:46:45 pm
i saw that show up somewhere, i think while testing my particle build. is this thing in the media vps?

also i hope it doesnt clash with other scripts, hope it makes good use of local variables and sufficiently complexly named globals  (such as putting a mod prefix in front of them bp_ or nuke_ for example).

my usual practice is to declare global in an init function and set them to nil in an uninit function, then dont put globals anywhere else. if your script uses bitmaps, be sure to free them in the uninit function.
Title: Re: Second Reticule?
Post by: StargateSpankyHam on March 12, 2010, 04:48:13 pm
Whoa...lots of code... :nervous:

Also, there were no instructions on the page. I have no clue how to go about doing this, as I have no experience whatsoever with scripting.

Anybody have step-by-step instructions?
Title: Re: Second Reticule?
Post by: The E on March 12, 2010, 04:57:05 pm
Just copy this text:
Code: [Select]
#Conditional Hooks

$Application: FS2_Open
$State: GS_STATE_GAME_PLAY
$On Frame:

[

drawvelret = function(x, y)
   gr.drawGradientLine(x+10,y+10,x+2,y+2)
   gr.drawGradientLine(x-10,y+10,x-5,y+2)
   gr.drawGradientLine(x+10,y-10,x+2,y-2)
   gr.drawGradientLine(x-10,y-10,x-2,y-2)
end

-- get mission time
if missiontime == nil then
   missiontime = mn.getMissionTime()
   oldmissiontime = missiontime
end

-- if the time is valid
if missiontime ~= nil then
   -- if we are actually doing something
   missiontime = mn.getMissionTime()

   -- only continue if the time actually progresses
   if oldmissiontime ~= missiontime then
      plr = hv.Player

      -- only continue if we can get valid player handle
      if plr:isValid() then
         local velocity = plr.Physics.Velocity
         local vlenght = velocity:getMagnitude()

         -- if we actually some velocity...
         local vvector = plr.Position + (velocity/(vlenght/2000))
         if vlenght > 5 then
            local x
            local y
            x, y = vvector:getScreenCoords()

            -- ok... so now we have the projected velocity vector
            -- if it actually is on screen then draw it
            if x ~= false then
               gr.setColor(100,100,255,160)
               drawvelret(x, y)
            end
         end
      end
   end

   -- make sure oldmissiontime is incremented
   oldmissiontime = missiontime
end

]

#End
into an empty text document. Save it as "velindc-sct.tbm" (The file extension needs to be .tbm, not .txt or whatever). Put that file into mediavps\data\tables. The velocity indicator will now be loaded together with the mediavps.
Title: Re: Second Reticule?
Post by: StargateSpankyHam on March 12, 2010, 08:39:29 pm
Nice! It works great!

Just out of curiosity, not to be picky or anything...but it is sort of difficult to see. Is there a way to make it a bit larger and more visible?

I tried the following change:

from:
gr.setColor(100,100,255,160)
to:
gr.setColor(255,255,255,255)

It didn't actually change the color of the reticule.
Title: Re: Second Reticule?
Post by: Nuke on March 13, 2010, 12:05:24 am
Whoa...lots of code... :nervous:

you should see some of the monsters im working on, my ui just broke 1000 lines today
Title: Re: Second Reticule?
Post by: Mav on March 13, 2010, 09:58:51 pm
I'd assume that for making it larger you'd have to change the numbers in this part:

Code: [Select]
drawvelret = function(x, y)
   gr.drawGradientLine(x+10,y+10,x+2,y+2)
   gr.drawGradientLine(x-10,y+10,x-5,y+2)
   gr.drawGradientLine(x+10,y-10,x+2,y-2)
   gr.drawGradientLine(x-10,y-10,x-2,y-2)
end
Title: Re: Second Reticule?
Post by: Nuke on March 15, 2010, 12:48:07 am
you could also use a bitmap. ive been steering away from procedural hud elements involving large numbers of primitives, and instead try to use models and images.
Title: Re: Second Reticule?
Post by: PL_Harpoon on March 17, 2010, 06:20:03 pm
Oh, I didn't know that things like this exists.

Gotta use it in my mod :)
Thanks gus :)