Home   Help Search Login Register  

Author Topic: Return number of bombs remaining on an aircraft?  (Read 1330 times)

0 Members and 1 Guest are viewing this topic.

Offline CharlieReddog

  • Members
  • *
Return number of bombs remaining on an aircraft?
« 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?

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Return number of bombs remaining on an aircraft?
« Reply #1 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.

Offline Ext3rmin4tor

  • Members
  • *
Re: Return number of bombs remaining on an aircraft?
« Reply #2 on: 25 Jan 2009, 14:26:52 »
Try using the Ammo classname instead of the Magazine Classname
How can you shoot women and children?
Easy! Ya' just don't lead'em so much! Ain't war hell?!!

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: Return number of bombs remaining on an aircraft?
« Reply #3 on: 25 Jan 2009, 14:47:22 »
Should be unit ammo "magazineName"

At least according to the comref anyway.  :P


Planck
I know a little about a lot, and a lot about a little.

Offline Ext3rmin4tor

  • Members
  • *
Re: Return number of bombs remaining on an aircraft?
« Reply #4 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"
« Last Edit: 25 Jan 2009, 15:19:00 by Ext3rmin4tor »
How can you shoot women and children?
Easy! Ya' just don't lead'em so much! Ain't war hell?!!

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: Return number of bombs remaining on an aircraft?
« Reply #5 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
« Last Edit: 25 Jan 2009, 15:26:08 by Planck »
I know a little about a lot, and a lot about a little.

Offline CharlieReddog

  • Members
  • *
Re: Return number of bombs remaining on an aircraft?
« Reply #6 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 :(