Help with UnitDefs Weapons
Posted: 22 Oct 2007, 16:03
Hi all,
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:
The problem is that in both cases (armanni and armfalk) the value is true and I expected them to be different since the flak shoots at air while the anni does not.
Could anyone tell me plz what I am doing wrong? Many thanks in advance...
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...