Home   Help Search Login Register  

Author Topic: Want to Add Ammo to Current Magazine NOT Add New Magazines  (Read 1740 times)

0 Members and 1 Guest are viewing this topic.

Offline LVSOCOM

  • Members
  • *
Hi, I'm having some trouble finding a command in the comref that will help me add ammo to the magazine currently loaded, instead of just adding magazines to the vehicle.

What I'm trying to do is create a DSHKM that does not reload, it can fire constantly without running out of ammo without having to park an ammo truck next to it.   :laugh: Using addmagazines (I think is the command) it will add a new belt/magazine but there doesn't appear to be a limit to how many belts/magazines it can hold. So instead of maxing it out on magazines then replacing the one that is loaded every time a new one is added, it just adds another magazine and the DSHKM still has to reload.

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Want to Add Ammo to Current Magazine NOT Add New Magazines
« Reply #1 on: 22 Apr 2009, 05:44:16 »
Well, there is no command to do this. The cleanest solution to avoid reloading is probably to create a custom magazine that holds a million rounds.
try { return true; } finally { return false; }

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Want to Add Ammo to Current Magazine NOT Add New Magazines
« Reply #2 on: 22 Apr 2009, 10:03:41 »
Alternatively, add a 'fired' event handler to the unit which calls a script. The script checks the ammo in the current weapon, and if it's 1 or less removes the weapon, adds another magazine, adds the weapon back (which will be loaded), and selects the weapon.

Tested and works in OFP. The only issue is selecting the correct muzzle.

EDIT - should probably read the question properly before responding huh  :-[ Tested with an M2 machine gun and works just the same. I expect all vehicle-based weapons would also work with the above technique.
« Last Edit: 22 Apr 2009, 10:27:03 by bedges »

Offline LVSOCOM

  • Members
  • *
Re: Want to Add Ammo to Current Magazine NOT Add New Magazines
« Reply #3 on: 22 Apr 2009, 15:26:40 »
I did some testing and found that SetVehicleAmmo effects the currently loaded magazine in a DSHKM/M2 tripod. It does not add more magazines, but setting it to 1 maxes out the current magazine. Made a simple loop with an if to count the ammo left and setvehicle ammo if its the dshkm is near empty and the tripod never stops firing.  :cool2:

Ty for the responces  :D

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Want to Add Ammo to Current Magazine NOT Add New Magazines
« Reply #4 on: 23 Apr 2009, 14:01:19 »
Yes, you can affect vehicles like that, but not soldiers.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)