Jump to content

How to add customized sensors for your mod


uboats

Recommended Posts

I saw many aircraft/vehicles/ships in customized mods use default sensors listed in db_sensor.lua. Although they may find a sensor with similar performance, it may not accurately reveal the combat characteristics of the customized unit.

 

Here, I'm going to show you how to add customized sensors in your mod

 

you can put down below code in AIRCRAFTNAME.lua of your mod, or make a dedicated sensor.lua. There is no sequence requirement for the execution of the lua files. So you can dofile your AIRCRAFT.lua before the SENSOR.lua

 

 

example:

 

--SENSOR TYPE
local SENSOR_OPTICAL = 0
local SENSOR_RADAR = 1
local SENSOR_IRST = 2
local SENSOR_RWR = 3
--RADAR
local RADAR_AS = 0
local RADAR_SS = 1
local RADAR_MULTIROLE = 2
--
local ASPECT_HEAD_ON = 0
local ASPECT_TAIL_ON = 1
--
local HEMISPHERE_UPPER = 0
local HEMISPHERE_LOWER = 1
--IRST
local ENGINE_MODE_FORSAGE = 0
local ENGINE_MODE_MAXIMAL = 1
local ENGINE_MODE_MINIMAL = 2
--OPTIC
local OPTIC_SENSOR_TV = 0
local OPTIC_SENSOR_LLTV = 1
local OPTIC_SENSOR_IR = 2

DIY_RADAR = {
   Name = "DIY Radar",
   category = SENSOR_RADAR ,
   type = RADAR_MULTIROLE,
   scan_volume =
   {
       azimuth = {-60.0, 60.0},
       elevation = {-30.0, 10.0}
   },
   max_measuring_distance = 265000.0,
   scan_period = 5.0,
   air_search = {          
       centered_scan_volume =
       {
           azimuth_sector = 30.0,
           elevation_sector = 30.0
       },          
       detection_distance =
       {
           [HEMISPHERE_UPPER] =
           {
               [ASPECT_HEAD_ON] = 76000.0,
               [ASPECT_TAIL_ON] = 46000.0
           },
           [HEMISPHERE_LOWER] =
           {
               [ASPECT_HEAD_ON] = 76000.0,
               [ASPECT_TAIL_ON] = 35000.0
           }
       },
       lock_on_distance_coeff = 0.85,
       velocity_limits =
       {
           radial_velocity_min = 100.0 / 3.6,
           relative_radial_velocity_min = 100.0 / 3.6,
       },
   },
   surface_search = {
       vehicles_detection = true,
       RCS = 100,
       RBM_detection_distance = 180000.0,
       GMTI_detection_distance = 220000.0,
       HRM_detection_distance = 20000.0
   }
},

DIY_RWR_A =
{
   Name = "DIY RWR A",
   category = SENSOR_RWR ,
   detection_dist_to_radar_detection_dist_max_ratio = 0.80,
   lock_on_detection = true
},

declare_sensor(DIY_RADAR)
declare_sensor(DIY_RWR_A)

[sIGPIC][/sIGPIC]

My DCS Mods, Skins, Utilities and Scripts

 

| Windows 10 | i7-4790K | GTX 980Ti Hybrid | 32GB RAM | 3TB SSD |

| TM Warthog Stick | CH Pro Throttle + Pro Pedal | TIR5 Pro | TM MFD Cougar | Gun Camera: PrtScn |

Link to comment
Share on other sites

  • 8 months later...

I have tried to copy that all in my main aircraft file and then it won't load the aircraft I previously had working. If I put a dofile(current_mod_path.."/Sensors/Sensors.lua")

Then make a Sensors.lua file in that path it will load the aircraft but it will say it cannot find the data for the sensor i picked. I am a little green on this stuff is there any tutorials or info that can further me along? I am using notepad++ also and have done successful edits before like adding missiles to aircraft, etc.

Link to comment
Share on other sites

  • 3 years later...
On 1/9/2019 at 12:54 AM, rolemodel said:

I have tried to copy that all in my main aircraft file and then it won't load the aircraft I previously had working. If I put a dofile(current_mod_path.."/Sensors/Sensors.lua")

Then make a Sensors.lua file in that path it will load the aircraft but it will say it cannot find the data for the sensor i picked. I am a little green on this stuff is there any tutorials or info that can further me along? I am using notepad++ also and have done successful edits before like adding missiles to aircraft, etc.

Hi Rolemodel, and also hello to Uboat:

I have tried to do the above as suggested by Uboat by means of pasting the entirety of code inside the aircraft's LUA, which resulted in as Rolemodel experienced of a no-show of modded aircraft.  If I create a file with the code and named it Sensor.LUA (or as Sensors.LUA), it resulted in as if the game does not recognize there is a radar in the jet.  It only launches IR guided weapons as a result.

To Rolemodel and Uboat, and everyone who have a bit experience with modding, I opted to enter the "AN/APG-63" as sensor of choice within the aircraft's LUA.  Doing so does resulted in DCS recognizing what I ask of it to do.  Once I enter the above code per Uboat, the AI behaved as if it has no radar whatsoever.

Did I enter the code wrongly? Syntax error perhaps?  Or DCS 2.7 has changed in such a way that no longer permit using Saved Game folder level modding?

I am attempting to increase the radar range of a user made mod, the JAS-39 Gripen.  It is a nice mod.  It would be nice to have the Meteor launch at much longer distance.

Before DCS 2.7, I was able to mod the DB_Sensors.LUA for my own preference for curiosity and creativity sake only.

It would be great to do so in DCS 2.7 again.

Thank you for helping if possible.  Thanks! 🙂


Edited by Pally
Saying thanks, and provided clarity to my question.
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...