KnightHawk75
Posts: 1450
Joined: 11/15/2018 Status: offline
|
As always thanks for the update, some nice QOL additions. 1 question though relating to [Lua] "UpdateUnit", been wanting that for ages, are there any associated doc updates for it or should I just assume the newly added mode keywords are "remove_magazine" and "add_magazine", and params magid or magazineid, etc? Edit: Never mind answered my own questions, it's as suspected above with the later being "magid". Still should make into docs though. For those wanting a simple example of how to use the addition.
local u = SE_GetUnit({guid='4FH7PU-0HM89QT2P5KHS'}); -- SingleUnitAirfield starts with one mag already.
u = ScenEdit_UpdateUnit({guid=u.guid, mode="add_magazine", dbid=1185}); --"standard 'Munitions' mag
print(u.magazines); --should see two
if #u.magazines == 2 then
print("Munitions 1185 added.");
local magguid = u.magazines[2].mag_guid --just for this example this will suffice.
if magguid ~=nil then
u = ScenEdit_UpdateUnit({guid=u.guid, mode="remove_magazine", magid=magguid});
if #u.magazines == 1 then
print("Munitions 1185 removed.");
end
else print("mag_guid could not be obtained. removal failed.");
end
else print("mag failed to be added.");
end
print(u.magazines);
< Message edited by KnightHawk75 -- 4/29/2021 12:07:57 PM >
|