LUA to change mk41 VLS loadout?

All discussions & material related to Command's Lua interface

Moderators: angster, RoryAndersonCDT, michaelm75au, MOD_Command

Post Reply
Craigkn
Posts: 200
Joined: Thu Jan 27, 2022 12:06 am
Location: Central Maryland

LUA to change mk41 VLS loadout?

Post by Craigkn »

I tried searching, but did not find the magic terms - I am spawning an Arleigh Burke via LUA, and I want to change the Mk41 loadouts to add more SAM and less TLAM. Looking at the CMO LUA functions, its not obvious how to do this, does this functionality exist?

My Plan B for this is a bit ugly - make another faction, hide the Burke's on the other side of the planet, then change sides / teleport to where i need them at the appropriate time. Ideally I want to handle this pragmatically.
User avatar
blu3s
Posts: 1121
Joined: Fri Jul 08, 2022 9:45 am

Re: LUA to change mk41 VLS loadout?

Post by blu3s »

Search in the Lua API, you'll find better responses

https://commandlua.github.io/assets/Fun ... oUnit.html

You need to iterate over the magazines of the Burke, then once you're on the VLS, you can iterate over the weapons and using weapon dbids, remove ones to add another ones.

Print is your friend to understand the tables on unit.mounts

Check also this one:

https://forums.matrixgames.com/viewtopi ... 9#p5124449
thewood1
Posts: 10132
Joined: Sun Nov 27, 2005 6:24 pm
Location: Boston

Re: LUA to change mk41 VLS loadout?

Post by thewood1 »

Couldn't you just build several Burke inst files with various VLS loadouts and then use importinst lua function. I haven't used lua to do this, but to help with scenario building, I do this manually. I have several Burke VLS loadouts saved for that very purpose.
Post Reply

Return to “Lua Legion”