I'm trying to figure out if a unit is able to shoot at air or if it does not. For this reason I tried to read the units' onlyTargets-category "notair" to do that.
So I hoped the boolean value would be different for example for the armanni and for the armflak.
Below is the code I use:
Code: Select all
local udef = UnitDefs[Spring.GetUnitDefID(unitID)]
local targetCat = udef.weapons[1].onlyTargets;
local tcat = "true"
if ( targetCat["notair"] == false ) then
tcat = "false"
end
Spring.Echo( udef.humanName .. " NotAir: " .. tcat )
Could anyone tell me plz what I am doing wrong? Many thanks in advance...