Hey folks, long time not read.
I'm working on a "carrier simulation script" which basically simulates a not-physically (in virtual terms) Aircraft carrier. Mission makers can call AI-controlled Air squadrons from this carrier. I have several conditions i check for the squadron to return to carrier (out of fuel, out of ammo, dammaged).
The problem comes up with the ammo tracking. As missionmakers should be able to alter the payload to theyr needs, each plane could carry any sort of weapon. Beside th onboard machine gun, almost everything else is possible (rockets, FFAR, GBU, Maverick and whatever is around in addons).
What i need is a way to track the remaining payload without the machine gun.
Practically speaking:
I have a A10 (as example) and in the script i remove all magazines. I add the Bomblauncher as weapon and it's respective magazines also. As the machine gun is empty, a simple
someammo will return false as soon all bombs are dropped.
So far so good. Thats basically what i want.
The problems comes up when i load a magazine for the machine gun into the A10. Now a check with
someammo will return true even if all bombs are dropped and only MG has ammo.
I tried the commands
primaryWeapon and
secondaryWeapon to get a way to sort the weapons and maybe on this way find a solution, but these commands always return empty strings only.
So what i need is a way to determine if a plane/chopper which has a MG and other weapons is out of ammo for the "other weapons".
As i want to keep the script as open as possible for addons, a predefinition of all MG classes seems not the best way to me, except i'll find no other way around.
Help really appreciated.
Myke out