Got that working and added some extra fields.
Now trying with the mounts and weapons and I read this form you people on other threads.
I'm getting the mounts and weapons on these mounts. Tried also to get the weapons that are in the loadout.
Managed to get the loadout name but when I tried to add text to it, it erros on the firt empty one. Probebly should use an extra loop of some sort? But cannot get it to work. Apologise if this are stupid questions, it all copy/paste & trial/errror here.Do not wanna waste peoples time.
What I have so far:
local WpnTypeTable={
[1001] = 'None',
[2001] = 'GuidedWeapon',
[2002] = 'Rocket',
[2003] = 'IronBomb',
[2004] = 'Gun',
[2005] = 'Decoy_Expendable',
[2006] = 'Decoy_Towed',
[2007] = 'Decoy_Vehicle',
[2008] = 'TrainingRound',
[2009] = 'Dispenser',
[2010] = 'ContactBomb_Suicide',
[2011] = 'ContactBomb_Sabotage',
[2012] = 'GuidedProjectile',
[3001] = 'SensorPod',
[3002] = 'DropTank',
[3003] = 'BuddyStore',
[3004] = 'FerryTank',
[4001] = 'Torpedo',
[4002] = 'DepthCharge',
[4003] = 'Sonobuoy',
[4004] = 'BottomMine',
[4005] = 'MooredMine',
[4006] = 'FloatingMine',
[4007] = 'MovingMine',
[4008] = 'RisingMine',
[4009] = 'DriftingMine',
[4011] = 'DummyMine',
[4101] = 'HeliTowedPackage',
[5001] = 'RV',
[6001] = 'Laser',
[8001] = 'HGV',
[9001] = 'Cargo',
[9002] = 'Troops',
[9003] = 'Paratroops',
}
local s = VP_GetSide({Side="Blue"})
local unitlist = s:unitsBy('Aircraft');
local function catNumToString(catTable, n)
n = tonumber(n);
if catTable[n] ~=nil then return catTable[n]; else return tostring(n); end
end
for _,v in ipairs(unitlist) do
local u = SE_GetUnit({guid=v.guid});
local lo = ScenEdit_GetLoadout({name=v.name}) -- deze added
if u ~=nil then
for k,v in pairs(u.mounts) do
print("Unit: " .. (u.name) .. " (" .. tostring(u.classname) .. ")");
print (lo.name) -- deze kan verder geen tekst hebben wnat loopt op nil dan vast. zonde .. loopt het door
print(" * Mount nr".. k .. ": mount name: " .. tostring(v.mount_name) .. " - mount guid: " .. tostring(v.mount_guid))
if v.mount_weapons ~=nil then
for i,j in ipairs(v.mount_weapons) do
print(" ~ Weapon nr" .. i .. ": weapon name: " .. j.wpn_name .. " - wpn_type: " .. catNumToString(WpnTypeTable,j.wpn_type) .. " - Current Nr: " .. j.wpn_current .. " - Weapon DBID: " .. j.wpn_dbid)
end
else
print(" No weapons on this mount.")
end
end
end
print ("")
end
Did not manage to put something in with weapons (or is it best to use Loadout?)
best regards GJ