infantry drop
Posted: Tue Jun 09, 2020 12:32 pm
I'm trying to drop an infantry unit (from edit cargo). The manual process works, where I add a infantry section, select unload cargo and the unit appears.
If I script it, I get an Object reference not set to an instance of an object error.
local u = SE_GetUnit({name='Cub4', guid='RHR5WE-0HM0B0J6KFMOU'})
print(u.cargo[1].cargo)
for k,v in pairs (u.cargo[1].cargo) do
print(v.dbid)
ScenEdit_UnloadCargo(u.guid, { {v.quantity,v.dbid}})
end
{ [1] = { mass = 0, status = 'Operational', name = 'Spetsnaz Saboteur', area = 0, dbid = 880, crew = 1, quantity = 10, guid = 'RHR5WE-0HM0CJQSARNTP' } }
880
ERROR: Object reference not set to an instance of an object.
I'm using arrays, since I'll have several planes in the section, but even if I'm explicit in my reference parameters, meaning, CUB1, it still returns an error?
This is definitely a bug.. needs fixing. Because it works manually.
I've tried everything and there doesn't seem to be a way to unload cargo from a aircraft. You can certainly do it manually, but the ID field doesn't seem to conform to the dbid field in the database. Anyway, any help here would be greatly appreciated. Also, adding cargo to a guid doesn't seem to work, and not sure why?
am I missing something
If I script it, I get an Object reference not set to an instance of an object error.
local u = SE_GetUnit({name='Cub4', guid='RHR5WE-0HM0B0J6KFMOU'})
print(u.cargo[1].cargo)
for k,v in pairs (u.cargo[1].cargo) do
print(v.dbid)
ScenEdit_UnloadCargo(u.guid, { {v.quantity,v.dbid}})
end
{ [1] = { mass = 0, status = 'Operational', name = 'Spetsnaz Saboteur', area = 0, dbid = 880, crew = 1, quantity = 10, guid = 'RHR5WE-0HM0CJQSARNTP' } }
880
ERROR: Object reference not set to an instance of an object.
I'm using arrays, since I'll have several planes in the section, but even if I'm explicit in my reference parameters, meaning, CUB1, it still returns an error?
This is definitely a bug.. needs fixing. Because it works manually.
I've tried everything and there doesn't seem to be a way to unload cargo from a aircraft. You can certainly do it manually, but the ID field doesn't seem to conform to the dbid field in the database. Anyway, any help here would be greatly appreciated. Also, adding cargo to a guid doesn't seem to work, and not sure why?
am I missing something


