Extracting and Modifying Military Base Groups in Game via Lua Scripting

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
hanzawa1991
Posts: 74
Joined: Tue Apr 05, 2022 9:05 am

Extracting and Modifying Military Base Groups in Game via Lua Scripting

Post by hanzawa1991 »

I am interested in extracting the game's built-in military base groups, which are imported in some manner, into Lua script statements. This would allow me to modify details like latitude and longitude, on-site facilities, etc., so that the base groups can be redeployed elsewhere or have their runway models changed. How can I achieve this? Also, how can I find out the existing Lua code for the base groups? I'm not sure if I've explained this clearly enough. I'm guessing the code might look something like this? local redUnits = ScenEdit_GetUnits({side='Red'})
if redUnits then
for _, unit in ipairs(redUnits) do
-- Retrieve details for each unit
local unitDetails = ScenEdit_GetUnit({guid=unit.guid})
if unitDetails then
print("Unit Name: " .. unitDetails.name)
print("Unit Type: " .. unitDetails.type)
print("Unit Subtype: " .. unitDetails.subtype)
print("Unit GUID: " .. unitDetails.guid)
print("Latitude: " .. unitDetails.latitude)
print("Longitude: " .. unitDetails.longitude)
print("Speed: " .. unitDetails.speed .. " knots")
print("Heading: " .. unitDetails.heading .. " degrees")
print("-------------------------------")
end
end
else
print("No units found for Red side.")
end
Post Reply

Return to “Lua Legion”