Convert airfields and ports multi-unit to singe-unit(saving loadout and missions))

All discussions & material related to Command's Lua interface

Moderators: angster, RoryAndersonCDT, michaelm75au, MOD_Command

Post Reply
DmitriyBlade
Posts: 98
Joined: Mon Dec 20, 2021 3:22 pm
Location: Russia

Convert airfields and ports multi-unit to singe-unit(saving loadout and missions))

Post by DmitriyBlade »

Nothing found on google

Anyone have LUA script
which converts
each airbase and port facility to single unit?
(saving units and their missions accordingly)
LettuceTurnipTheBeet
Posts: 10
Joined: Sat Dec 18, 2021 12:09 pm

RE: Convert airfields and ports multi-unit to singe-unit(saving loadout and missions))

Post by LettuceTurnipTheBeet »

Here is a somewhat naive script that kinda does what you asked for. However, a multi-component airfield AFAIK may have any number of runways and other elements which can not always be accurately represented by the selection of single-unit variants in the DB. Therefore, this script simply adds a generic 2600m airstrip anywhere. If you want more accurate representations you can write some extra code that extracts the length of a given runway to select a comparable single-unit equivalent from the DB instead. The script also doesn't take into account any aircraft that might be flying during conversion, but I think in most cases the game will take care of that and select a suitable new base for them.
Attachments
convert_single_unit.zip
(1.19 KiB) Downloaded 10 times
LettuceTurnipTheBeet
Posts: 10
Joined: Sat Dec 18, 2021 12:09 pm

RE: Convert airfields and ports multi-unit to singe-unit(saving loadout and missions))

Post by LettuceTurnipTheBeet »

[UPDATE] Fixed an issue where it couldn't handle missing loadouts.
Attachments
convert_single_unit.zip
(1.15 KiB) Downloaded 21 times
Post Reply

Return to “Lua Legion”