EasyEB Posted November 22, 2020 Posted November 22, 2020 Anyone ever made a successful script that returns if a plane has any built in cannon ammo left? I can’t for the life of me figure out how to do it using getAmmo
HC_Official Posted November 22, 2020 Posted November 22, 2020 it is PITA .......... diff aircraft have different bullets, so handling them all will take a lot of work No more pre-orders Click here for tutorials for using Virpil Hardware and Software Click here for Virpil Flight equipment dimensions and pictures. .
funkyfranky Posted November 22, 2020 Posted November 22, 2020 local flight=FLIGHTGROUP:New("Group Name") local nshells=flight:GetAmmoTot().Guns Requires MOOSE develop branch version. A warrior's mission is to foster the success of others. i9-12900K | RTX 4090 | 128 GB Ram 3200 MHz DDR-4 | Quest 3 RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss
toutenglisse Posted February 7, 2021 Posted February 7, 2021 In case you're still in need for, or for anyone else who needs to know, I just got usage of getammo function. Here a function I made to see how it returns values (but in purpose of checking WM's ammo). Gun ammo is the first [1] value returned, but when depleted the first entry is replaced by ammo that was in second entry. If you want to keep track of gun ammo only you could check if WeapTable[1]["desc"]["displayName"] is still equal to "M61_20_HE sans traceurs" (in my F18 exemple and in french), if not then gun ammo is zero. I put 10 entries to eventually cover varied ammo on high hardpoint count aircraft. missionCommands.addCommand('Check my ammo', nil, MA_Dec2Weapons) function MA_Dec2Weapons() local Wingman = Unit.getByName('Blue F18c 1-1') --my aircraft unitName local WeapTable = Unit.getAmmo(Wingman) if WeapTable[1] and WeapTable[1]["count"] and WeapTable[1]["desc"]["displayName"] then trigger.action.outText('You have : ' .. WeapTable[1]["count"] .. ' ' .. WeapTable[1]["desc"]["displayName"] .. '.', 10) end if WeapTable[2] and WeapTable[2]["count"] and WeapTable[2]["desc"]["displayName"] then trigger.action.outText('' .. WeapTable[2]["count"] .. ' ' .. WeapTable[2]["desc"]["displayName"] .. '.', 10) end if WeapTable[3] and WeapTable[3]["count"] and WeapTable[3]["desc"]["displayName"] then trigger.action.outText('' .. WeapTable[3]["count"] .. ' ' .. WeapTable[3]["desc"]["displayName"] .. '.', 10) end if WeapTable[4] and WeapTable[4]["count"] and WeapTable[4]["desc"]["displayName"] then trigger.action.outText('' .. WeapTable[4]["count"] .. ' ' .. WeapTable[4]["desc"]["displayName"] .. '.', 10) end if WeapTable[5] and WeapTable[5]["count"] and WeapTable[5]["desc"]["displayName"] then trigger.action.outText('' .. WeapTable[5]["count"] .. ' ' .. WeapTable[5]["desc"]["displayName"] .. '.', 10) end if WeapTable[6] and WeapTable[6]["count"] and WeapTable[6]["desc"]["displayName"] then trigger.action.outText('' .. WeapTable[6]["count"] .. ' ' .. WeapTable[6]["desc"]["displayName"] .. '.', 10) end if WeapTable[7] and WeapTable[7]["count"] and WeapTable[7]["desc"]["displayName"] then trigger.action.outText('' .. WeapTable[7]["count"] .. ' ' .. WeapTable[7]["desc"]["displayName"] .. '.', 10) end if WeapTable[8] and WeapTable[8]["count"] and WeapTable[8]["desc"]["displayName"] then trigger.action.outText('' .. WeapTable[8]["count"] .. ' ' .. WeapTable[8]["desc"]["displayName"] .. '.', 10) end if WeapTable[9] and WeapTable[9]["count"] and WeapTable[9]["desc"]["displayName"] then trigger.action.outText('' .. WeapTable[9]["count"] .. ' ' .. WeapTable[9]["desc"]["displayName"] .. '.', 10) end if WeapTable[10] and WeapTable[10]["count"] and WeapTable[10]["desc"]["displayName"] then trigger.action.outText('' .. WeapTable[10]["count"] .. ' ' .. WeapTable[10]["desc"]["displayName"] .. '.', 10) end end
Recommended Posts