boogabooga
Posts: 457
Joined: 7/18/2018 Status: offline
|
Yes, that's difficult because generally you need to know a unit's name or guid ahead of time in order to GetUnit. What I do, following others, is to create units directly in LUA and list them in a table as they are created in order to keep track of them. EX: quote:
function AddFingerFour(callsign,side,dbid,loadout,latitudeIn,longitudeIn,heading,altitude,proficiency,groupName) --local circle = World_GetCircleFromPoint({latitude=latitude,longitude=longitude,radius=0.5,numpoints = 72}) local addedAircraftTable = {} blah blah blah local unit = ScenEdit_AddUnit({type='Aircraft',side=side,dbid=dbid,name=callsign..' #'..i,loadoutid=loadout,latitude=position.latitude,longitude=position.longitude,heading=heading,altitude=altitude,proficiency=proficiency}); unit.group=groupName table.insert(addedAircraftTable,unit) return addedAircraftTable end Then the loop to access each unit: quote:
for key, value in pairs(addedAircraftTable) do blah blah blah
|