Add cargo container with items

All discussions & material related to Command's Lua interface

Moderators: angster, RoryAndersonCDT, michaelm75au, MOD_Command

Post Reply
patpatpowercat
Posts: 15
Joined: Tue Nov 19, 2019 11:51 am

Add cargo container with items

Post by patpatpowercat »

Is there a way to add a cargo container to a unit, but with items already inside of the container? I know you can use the ScenEdit_UpdateUnitCargo to add for example a 40ft ISO container, but is there a way to add a container that already has some ordinance inside of it?
BDukes
Posts: 2633
Joined: Wed Dec 27, 2017 12:59 pm

Re: Add cargo container with items

Post by BDukes »

local am= ScenEdit_GetUnit({guid='NLBN1G-0HNCMOSSC5K9S'})
--print(am.cargo)
--createUnitCargo(type #, ID) 4 type is container, 2 is 20ft Container
local loadcontainer = am : createUnitCargo(4,2)
loadcontainer :createContainerContentAmmunition(686,100)
Don't call it a comeback...
patpatpowercat
Posts: 15
Joined: Tue Nov 19, 2019 11:51 am

Re: Add cargo container with items

Post by patpatpowercat »

Awesome thank you!
Post Reply

Return to “Lua Legion”