Page 1 of 1

Get fuel range for a unit

Posted: Wed Jun 12, 2024 1:26 am
by gesch80550
I would like to setup an event on detection of a unit to send an aircraft to investigate or engage that unit, but I need to make sure that the aircraft selected has the range to reach the target...but I have not found any way to get the range (combat radius) of a unit based on its load out. Effectively I am trying to get the range part of the Range & Profile column from the Aircraft Loadouts in the Database Viewer.
Aircraft_Loadout.png
Aircraft_Loadout.png (57.99 KiB) Viewed 232 times
I have not found any property of either Unit or Loadout that gives me that value. Does anyone know how to do this?
Or alternatively, if I can get the Performance data of the Engines, I might be able to back-calculate the range, but I can't find a way to get that value in Lua script either.

Thanks in advance

Re: Get fuel range for a unit

Posted: Wed Jun 12, 2024 6:53 am
by blu3s
I'm afraid that there's no way to do it currently via Lua.

If you don't have too many units, you can create a table with your aircraft and copy paste the data from the DB to the table

Re: Get fuel range for a unit

Posted: Thu Jun 13, 2024 1:22 am
by gesch80550
Thanks - I was afraid of that. I had thought about storing a table, but the scenario has a lot of aircraft...maybe I'll try storing it by dbid & loadout Id instead of aircraft and try a lookup that way.
Definitely need something..I was just testing the current logic and it is spinning up a pair of aircraft with a combat radius of 170nm to go after a target 430nm away - that is clearly not going to work :D .

Thanks for confirming....