OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: LVSOCOM on 21 Apr 2009, 22:35:38

Title: Want to Add Ammo to Current Magazine NOT Add New Magazines
Post by: LVSOCOM on 21 Apr 2009, 22:35:38
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.
Title: Re: Want to Add Ammo to Current Magazine NOT Add New Magazines
Post by: Worldeater 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.
Title: Re: Want to Add Ammo to Current Magazine NOT Add New Magazines
Post by: bedges 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.
Title: Re: Want to Add Ammo to Current Magazine NOT Add New Magazines
Post by: LVSOCOM 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
Title: Re: Want to Add Ammo to Current Magazine NOT Add New Magazines
Post by: Spooner on 23 Apr 2009, 14:01:19
Yes, you can affect vehicles like that, but not soldiers.