Get fuel range for a unit

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
gesch80550
Posts: 8
Joined: Wed Mar 06, 2024 1:20 pm

Get fuel range for a unit

Post 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 227 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
User avatar
blu3s
Posts: 1111
Joined: Fri Jul 08, 2022 9:45 am

Re: Get fuel range for a unit

Post 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
gesch80550
Posts: 8
Joined: Wed Mar 06, 2024 1:20 pm

Re: Get fuel range for a unit

Post 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....
Post Reply

Return to “Lua Legion”