Page 1 of 1

Ship with embarked aircraft

Posted: Mon Nov 29, 2021 5:09 pm
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.

RE: Ship with embarked aircraft

Posted: Tue Nov 30, 2021 3:19 am
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})

RE: Ship with embarked aircraft

Posted: Tue Nov 30, 2021 12:42 pm
by LorenAgus
Ok, thank you, I will try.