Ship with embarked aircraft

All discussions & material related to Command's Lua interface

Moderators: angster, RoryAndersonCDT, michaelm75au, MOD_Command

Post Reply
LorenAgus
Posts: 12
Joined: Wed Nov 24, 2021 3:00 pm

Ship with embarked aircraft

Post by LorenAgus »

Hi, when I create a naval unit with ScenEdit_AddUnit I can't make it appear with embarked aircraft. I have tried the following:

ScenEdit_AddUnit ({type = 'Ship', name = 'BARCO', dbid = 2222, side = "SPAIN", embarkedUnits = {type = 'Aircraft', name = 'COBRA', dbid = 836}, Lat = "44.75" , Lon = "- 12.75"})

2222 = Spanish LHD
836 = AV8 Harrier

LUA does not return any error, the boat appears, but without the AV8.

What am I doing wrong?
Sorry if I ask stupid questions, I'm starting with this and going little by little.
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: Ship with embarked aircraft

Post by KnightHawk75 »

Not a dumb question.
https://www.matrixgames.com/forums/tm.asp?m=4819096 post #3

In sort the order is
1. First create the host unit.
2. Then created the units you want to insert into the host, either inserting them during creation or doing it later via HostUnitToParent().
local h,u;
h = ScenEdit_AddUnit ({type = 'Ship', name = 'BARCO', dbid = 2222, side = "SPAIN", Lat = "44.75" , Lon = "- 12.75"})
u = ScenEdit_AddUnit ({type = 'Aircraft', name = 'COBRA #1', dbid = 836,side="SPAIN",loadoutid=3,lat=1,lon=1,base=h.name})
u = ScenEdit_AddUnit ({type = 'Aircraft', name = 'COBRA #2', dbid = 836,side="SPAIN",loadoutid=3,lat=1,lon=1,base=h.name})
-- hostunittoparent example
u = ScenEdit_AddUnit ({type = 'Aircraft', name = 'COBRA #3', dbid = 836,side="SPAIN",loadoutid=3,lat=1,lon=1});
ScenEdit_HostUnitToParent({HostedUnitNameOrID=u.guid,SelectedHostNameOrID=h.guid})
LorenAgus
Posts: 12
Joined: Wed Nov 24, 2021 3:00 pm

RE: Ship with embarked aircraft

Post by LorenAgus »

Ok, thank you, I will try.
Post Reply

Return to “Lua Legion”