[BETA] Radar and Sonar for Aircraft & Boats


#1

This mod is in an early beta. It has not been tested on a larger scale, nor do I have the time or contacts to do so myself, so I’m releasing this early version for you guys to test. Feedback is very welcome!

What it is:
A somewhat simplified RADAR & SONAR system for airplanes and boats.

How it looks:
Example 1 (RADAR, first person)
Example 2 (SONAR, third person)

Download & Installation:

  • Download here. (v0.1)
  • Extract the InoTechRadar folder into your server’s resources folder. It should look something like this: [1], [2]
  • Add “InoTechRadar” to your citmp-server.yml file. It should look something like this.
  • Start your server, and you should be good to go!

Requirements & Dependencies:

  • None!

Features:

  • Tracks other player-controlled aircraft and boats.
  • Toggleable interface display, which is maximized while in first person. (See example screenshot #1)
  • Different vehicles have different radar ranges and refresh rates. (Military vehicles are generally equipped with much stronger radar, for instance). 2D range checks are used for simplicity’s sake.
  • Configurable LoS checks allows for using terrain or buildings to occlude yourself, effectively allowing you to “fly under the radar”.
  • Radar targets will be displayed with their callsign, distance, altitude, and velocity. (See example screenshot #1).
  • Sonar targets are only displayed as a dot (See example screenshot #2).
  • Radar cannot see targets that are submerged, and Sonar can only see other boats and subs.
  • A notification appears when you enter a radar capable vehicle.
  • Size of the radar scales automatically with your resolution.

Known issues:

  • The check for whether something is submerged or not returns questionable values at times, which may lead to aircraft radar incorrectly detecting submarines underwater.
  • Does not track NPC vehicles. This is a FiveM limitation as the functions to get all vehicles in an area are not implemented AFAIK. There may be workarounds but I haven’t looked into it too much at this point.
  • “This vehicle has radar/sonar capabilities” popup doesn’t properly update the hotkeys if the default hotkey for “Character Wheel” has been changed. This will be fixed in v0.2. (Thanks @Havoc!)

Other notes:

  • A lot of people are likely going to point out discrepancies about these systems compared to their real life counterpart. Many of the decisions made in the design of these systems were made with the gameplay and performance aspects as prio #1. Radar ranges and refresh rates in particular fall into this category.

  • Something I reckon a lot of people will miss is the classic “radar sweep” animation. However, for a smooth sweep animation, I would have to redraw the radar at least some 30+ times per second, which would significantly impact performance. I won’t rule it out for the future, but I’ve decided to take the safe route performance wise for now.

  • Currently, local tests show the radar performing very well, with a total processing time of ~2ms per radar update (which is normally done at most a few times per second).

  • I have a long list of things I’d like to implement in the future. I’ve left my own personal todo at the top of the .lua file which you can look at if you’re interested. It’s not in a very readable format, though, as it was only meant for my own consumption.

  • The default hotkey is the “character wheel” button, which is ALT or down on D-pad by default.

  • Not all airplanes or boats are equipped with radar or sonar! The only vehicles equipped with either of these systems are the ones which can reasonably be assumed should have them. Usually this is determined by whether they have a radar display on their dashboard or an externally visible radar. For a full list of radar/sonar enabled vehicles, see the _radarEnabledVehicles list in the .lua file.

  • Both the InoTechRadar_Client.lua and html/radarScript.js files have some options you as the server owner may configure if you so please. Do not change anything underneath the “CONFIG END” lines.

  • Most of the code isn’t commented. If you’re wondering how I did X, feel free to ask.

  • You can also hit me up on FiveM’s Discord (just ping @ino)

What I want from YOU:

  • Any errors or bugs you may encounter! Please include log files if you run into an error.
  • Feedback on the general usability of the radar/sonar systems. Does it feel easy to use? Intuitive? Do the colors work for you?
  • If you really want to, have a look at the top of the .lua file and leave a comment on what out of my todo list you think is worth prioritising.
  • Anything not on the to-do list which you believe should be added.
  • Most importantly, have fun!

#2

thx for your script is nice :wink:
sorry for my english im french x)


#3

Good job, Nice Script!!! #Caribou


#4

A Monster :sunglasses: good job :smiley:


#5

That looks sweet, especially the aircraft one.


#6

can you make an another script where players can use the helicopter spotlight to track players?


#7

@roboticgamer Isn’t there a script for that already? I could’ve sworn I’ve seen that on some servers.


#8

nah I checked and theres no script for that also I press ALT but is it suppose to do something nothing is happening?


#9

@roboticgamer I might have a look at a spotlight script at some point then. You want something like point your camera at someone while in a heli, and it tracks them forever kinda?

If your vehicle is radar capable, there should be a popup above your minimap telling you to press ALT. If you’ve rebound your “Character Select Wheel” button it might be a different button for you though, even if the text still says ALT.


#10

Yeah well am pointing at stuff but nothing is happening is there a different button to press to track people?


#11

You should change that to dispay ~INPUT_CHARACTER_WHEEL~ instead. It’ll automatically show the bound key.

https://wiki.fivem.net/wiki/Controls


#12

@robotic I did try that, actually. The result, no matter which input I chose, was always displayed as b_xxxx, like so: http://i.imgur.com/JjBCLHv.png (I put in two different inputs for testing, each became b_xx)


#13

That’s strange. It works for me

Code
SetTextComponentFormat("STRING")
AddTextComponentString("Pls press ~INPUT_CHARACTER_WHEEL~")
DisplayHelpTextFromStringLabel(0, 0, 0, -1)

#14

@Havoc Hmm, okay, that’s odd. It works with your type of notification (top left of screen). I was using an above-radar notification. I guess hotkeys weren’t meant to go there.

I’ll have this added to the next release. Thank you! :slight_smile:


#15

This radar/sonar script looks great, thanks!

Since you mention it, a spotlight script would also be amazing. It gets mentioned in these forums quite a bit. Your idea of mouse pointing to find a target could be good, as long as you could manage it while flying, but even a button to target spotlight on the closest vehicle would be nice.

I was tinkering with a simple version but didn’t quite get it to work. I found a short thread discussing this in the coding section of gtaforums. There is reference to an existing spotlight mod, made in C# I believe, which has source you can look at.


#17

am sorry but am still confused how to track people am pressing buttons but nothing working or when am pressing ALT its does automatically?


#18

@loque Yeah I might look into that. Closest vehicle would be the easiest for sure. I can’t imagine it would be difficult overall but I’m not sure I’ll have the time to create it anytime soon.

@Genox That’d be pretty cool, but would have to be a completely separate mod. Like above, I might be able to make something like that in the future, but won’t have time for it right now.

@roboticgamer are you able to open the radar at all? It should look like one of the screenshots. If the vehicle can use radar, it should be tracking nearby vehicles automatically. No manual tracking required.


#19

@ino yeah am able to open the radar but if you say it tracks vehicles automatically then its not working for me because when I press ALT nothing else happens after that.


#20

@roboticgamer Is anyone else nearby in an airplane? It doesn’t show cars/pedestrians, only other aircraft and boats. (It also only tracks players)


#21

ohh am so dumb I thought it would track players in cars to… so this is only tracks planes and boats?