OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: CharlieReddog on 25 Jan 2009, 12:58:52

Title: Return number of bombs remaining on an aircraft?
Post by: CharlieReddog on 25 Jan 2009, 12:58:52
I'm trying to determine how many bombs an aircraft has left so that it's not left loitering in CAS mode if it's empty. The aircraft is an ACE Harrier, but it uses 6rnd_GBU12_AV8B magazines if that's any use.

If I try pln ammo "6rnd_GBU12_AV8B" it returns 0.

Any ideas?
Title: Re: Return number of bombs remaining on an aircraft?
Post by: Mandoble on 25 Jan 2009, 13:59:18
well, ammo command should work: unit ammo "weaponclassname", is "6rnd_GBU12_AV8B" the correct weapon class name? If not sure, type hint format["%1", weapons this] in the init line of one of these harriers.
Title: Re: Return number of bombs remaining on an aircraft?
Post by: Ext3rmin4tor on 25 Jan 2009, 14:26:52
Try using the Ammo classname instead of the Magazine Classname
Title: Re: Return number of bombs remaining on an aircraft?
Post by: Planck on 25 Jan 2009, 14:47:22
Should be unit ammo "magazineName"

At least according to the comref anyway.  :P


Planck
Title: Re: Return number of bombs remaining on an aircraft?
Post by: Ext3rmin4tor on 25 Jan 2009, 15:00:06
EDIT: I've got it working!

1) If you place a playable harrier on the map you must use (vehicle player) to access the vehicle weapon array because for some reason the name is attached to the unit commander (i.e. the pilot in this case) and not to the vehicle

2) For vehicles you must use the Weapon classname and not the Magazine classname for ammo command

So let's say you named your harrier "plane", then this line returns the ammount of GBU left

Code: [Select]
_bombs = (vehicle plane) ammo "BombLauncher"
Title: Re: Return number of bombs remaining on an aircraft?
Post by: Planck on 25 Jan 2009, 15:14:06
Strangely I changed the biki a couple of days ago.

Have to check, maybe the muzzlename doesn't apply to vehicle weapons.

EDIT:  Mandoble was right it is the weaponName:

_bigBangs = _myPlane ammo "BombLauncher"

Muzzle names would only be relevant for weapons with added grenade launchers methinks.

All comrefs edited to suit.


Planck
Title: Re: Return number of bombs remaining on an aircraft?
Post by: CharlieReddog on 25 Jan 2009, 16:02:15
Many thanks, that's working perfectly now. :clap: Just need to debug the rest of the CAS routine now :(