outlawled

Mag Repack

208 posts in this topic

Update - 31 August 2015 - Version 3.1.3 Released

Hey, this is my magazine repacking mod. It lets you consolidate your non-full magazines so that you don't just walk around with a bunch of almost-empty magazines all the time like an idiot.

Description:

- Allows the player to repack the ammo in his magazines.
- Default keybinding to open the Mag Repack dialog is "Ctrl+R", this can be customized via the options menu in the Mag Repack dialog.
- Pressing "Alt+Shift+Ctrl+Backspace" will reset the keybinding to the default setting (in case the player forgets what he changed his keybinding to).
- The player may choose a magazine from a list of all of his magazines to be the "Source" magazine and then he may choose a magazine from a list of all of his magazines of the same ammo type as the Source magazine to be the "Target" magazine (or vice versa). As soon as the Source and Target are both defined, bullets from the Source magazine will automatically start repacking into the Target magazine.

Notes:

- The addon version requires CBA.
- This is my first time creating any kind of UI, and I haven't tested it out on a screen that isn't 1920x1080, so if your monitor has a different resolution, you should let me know how it looks...
- The mod lets you repack bullets from different kinds of magazines as long as the two magazines you're repacking use the same ammo. Unfortunately, there are some problems with the actual classnames of the different ammo types.
- For example:

- The '30Rnd_65x39_caseless_mag' and '30Rnd_65x39_caseless_mag_Tracer' both use 'B_65x39_Caseless' rounds (meaning you can repack between tracer and non tracer magazines).
- The '150Rnd_762x51_Box' and '150Rnd_762x51_Box_Tracer' both use 'B_762x51_Tracer_Green' rounds.
- And the '20Rnd_762x51_Mag' uses 'B_762x51_Ball' rounds (meaning you can't repack from either of the 7.62mm box magazines into the 20Rnd 7.62mm magazine).

- I may release an update soon that will make the mod ignore the tracer part of tracer rounds so that you can repack any ammo type with its tracer counterpart. Or maybe BIS will fix the classnames, I dunno.

Future Plans (should I ever return to ArmA modding):

- Custom sounds
- Custom animations
- The option to keep empty magazines instead of automatically discarding them when you fire the last bullet. (Right now, I'm not sure this is possible. I created a script that would let you keep your empty magazines, but when you have a magazine with 0 bullets in your inventory, any scripting commands related to magazines don't work properly.)
- Ammo boxes (like the ammo crates currently in the game but filled with bullets instead of magazines) which can be carried in a backpack or deployed on the ground.
- The ability to repack from magazines in nearby players' inventories (with their permission).

Changelog:


- 3.1.3
- Signed the addon version PBO with new outlw.bikey file (make sure to delete old outlw.bikey files if you still have them).
 

- 3.1.2 (thanks to GiPPO) - Fixed: GUI bugs caused by the latest ArmA 3 update. - Fixed: Not all belt magazines were recognized as belt magazines (anything with 100 or more bullets will count as a belt now). - Fixed: Tracer ammo and non-tracer ammo were able to be mixed together.   - 3.1.1 - Fixed: RPT error. - 3.1.0 - Fixed: Error dialogs popping up about the scrollbars. - Removed: Mag Repack logo from the bottom left of the main dialog. - Overhauled keybinding system. It now allows just one key and any combination of Shift, Ctrl, and Alt modifiers. For example: "Ctrl+R", "Alt+J", "Shift+Ctrl+N", "Shift+Alt+Ctrl+Space", etc. - Redesigned Keybinding dialog based on the new keybinding system. - Magazine type (i.e. whether the magazine is a belt magazine or a regular magazine) is determined by the magazine's "nameSound" config entry instead of just being based on the magazine's capacity. - Rewrote 40mm grenade conversion system so it no longer uses a predefined list. - 3.0.2 - Fixed: Updated UI classnames to be unique so as to avoid possible conflicts. - Fixed: An issue with the keybinding not being recognized if another key wasn't pressed between keybinding presses. - Changed "MagRepack_config.cpp" file extension to ".hpp". - 3.0.1 - New: Pressing the keybinding while the dialog is open will now close the dialog. - Back-end optimizations. - Adjusted size of the Mag Repack logo to be slightly smaller. - Fixed: Now uses the keyName command to get the Strings associated with each keyboard key instead of having them hardcoded like an idiot. - New: Can now change the bullet and belt repack times via outlw_MR_bulletTime and outlw_MR_beltTime variables (script version). - All default repack times slightly increased. - Fixed: Changed script version init file name to "MagRepack_init_sv.sqf" to avoid conflict when user has the addon version installed while playing on a server running the script version. - 3.0.0 - Removed: Everything. - New: Added a GUI. - New: Players may now repack bullets from different types of magazines as long as both magazines use the same ammo. - New: Players may now convert 1rnd 40mm magazines into 3rnd 40mm magazines and vice versa. - New: Players may now change their keybinding. - New: Optional debug info. - Fixed: Added animations for prone, launchers, and no weapon. - 2.1.4 - Reverted back to 2.1.2. - 2.1.3 - Fixed: Now uses CBA's Extended Pre-Init EventHandlers instead of the Post-Init ones which were broken with the ArmA 3 Beta update. - 2.1.2 - Fixed: Uses "hintSilent" instead of "hint" for most cases. - Fixed: The sorting function is now a proper function available in the player's function library. - 2.1.1 - Fixed: Now works with latest ArmA 3 Alpha Development Build - 2.1 - Fixed: Changed a global variable to be less likely to cause mod incompatibility. - 2.0 - New: Animation changed to 'Gear' animation. - New: Magazine types are now repacked one by one. - New: How long it takes to repack each magazine type depends on how many bullets of that magazine type need to be repacked. - New: A magazine type can be skipped by pressing the 'Space' key. - New: Repack can be exited by moving (if player is inside a vehicle, getting out will exit, pressing movement keys will do nothing). - Fixed: Player can no longer repack magazines while in the driver, gunner, or commander seat of a vehicle. - New: Informational hint after repacking now displays each individual magazine ammo count from before and after the repack. E.G. [15,16,12,5,3] >> [20,20,11] - New: While repacking, a hint displays which magazine type is being repacked and the current ammo counts of each individual magazine of the current magazine type. - Fixed: Vaulting and reloading are now disabled during repack. - 1.3 - Initial release.



Download (includes addon and script versions):

 

- Version 3.1.3 - 31/08/15

- Version 3.1.2 - 07/08/15
- Version 3.1.1 - 05/12/14
- Version 3.1.0 - 05/02/14
- Version 3.0.2 - 08/10/13
- Version 3.0.1 - 04/10/13
- Version 3.0.0 - 14/09/13
- Version 2.1.3 - 22/06/13
- Version 2.1.2 - 15/06/13
- Version 2.1.1 - 05/04/13
- Version 2.1 - 04/04/13
- Version 2 - 04/04/13
- Version 1.3 - 22/03/13

Images:

kG3BjmFs.jpgZbHQlSYs.jpgLU6W0MNs.jpg2jbwxzTs.jpgtdlHs6Is.jpgfXQvJOrs.jpgNjmGgnhs.jpg

Video:

Edited by outlawled

Share this post


Link to post
Share on other sites

Very nice little addon. Can you either make it an option, or make another version where it's a menu choice instead of a key stroke?

Share this post


Link to post
Share on other sites
Very nice little addon. Can you either make it an option, or make another version where it's a menu choice instead of a key stroke?

If we're going to be perfectly honest, I'm not entirely sure what you mean. Can you elaborate a bit?

Share this post


Link to post
Share on other sites

Nice one, but features like these should exist in core from BIS sadly.

How does arma handles alot of mods btw?

Share this post


Link to post
Share on other sites

Great idea! However, I think the process should take a lot longer. It takes away a part of the charm that you have to manage your half empty mags, so it should not be magically fixed in 5 secs. If it would take maybe 20 sec, the player would make sure he's in a safe position before doing this. However, then you need to be able to break out the animation, and abort the repack.

Share this post


Link to post
Share on other sites
Great idea! However, I think the process should take a lot longer. It takes away a part of the charm that you have to manage your half empty mags, so it should not be magically fixed in 5 secs. If it would take maybe 20 sec, the player would make sure he's in a safe position before doing this. However, then you need to be able to break out the animation, and abort the repack.
It would also be a nice touch being able to do the repack while in a vehicle as passenger...

Yay!

Share this post


Link to post
Share on other sites
Great idea! However, I think the process should take a lot longer. It takes away a part of the charm that you have to manage your half empty mags, so it should not be magically fixed in 5 secs. If it would take maybe 20 sec, the player would make sure he's in a safe position before doing this. However, then you need to be able to break out the animation, and abort the repack.

So I tried responding to this a minute ago, but my post didn't show up...so if it pops up in a second and I double post, I'm sorry.

Um. Last night I finished working on an update that does pretty much everything you just said...haha. We're on the same page for sure.

The new update makes it so the player repacks each magazine type one by one. It tells you which type of magazine you are currently repacking and gives you the option to either skip to the next magazine by pressing 'Space' or exit the repack altogether by pressing any of the movement keys (D, A, W, S).

How long it takes to repack each magazine type is dependent on how many bullets you are repacking for that magazine type. So it won't take long to repack two half-empty 20rnd mags, but it will take quite a while to repack five half-empty 200rnd box cases.

It would also be a nice touch being able to do the repack while in a vehicle as passenger...

That is a really good suggestion. I hadn't even thought about vehicles at all. Have you tried repacking your magazines in a vehicle and it didn't work? I'll have to look into this...

'S gonna delay the new update a bit, though. 8(

EDIT: Hey, so I just checked it out, and you can repack your magazines while in a vehicle, but you can also do it while you're the driver or gunner which is not good. So...I'm gonna make it so you can only repack if you're a passenger and if you get out of the vehicle mid-repack, you stop repacking.

Thank you for drawing my attention to this.

Edited by Outlawled

Share this post


Link to post
Share on other sites
but it will take quite a while to repack five half-empty 200rnd box cases.

The "repacking" of two belts together is relative fast. Dont forget that you have to unclip two bullet and use this free parts to clip them togeher. The longest part is the repacking in the box bot that is even faster as a 30 rounds mag (open magazine) but please dont forget to remove a bullet for each new mag.

can you make a buddy belting for the MG? i mean cip a new mag together with the loaded one? Ill love this to keep the supressive fire online

but dont forget that you need a bigger amount of bullets left on the belt:-)

Share this post


Link to post
Share on other sites
The "repacking" of two belts together is relative fast. Dont forget that you have to unclip two bullet and use this free parts to clip them togeher. The longest part is the repacking in the box bot that is even faster as a 30 rounds mag (open magazine) but please dont forget to remove a bullet for each new mag.

can you make a buddy belting for the MG? i mean cip a new mag together with the loaded one? Ill love this to keep the supressive fire online

but dont forget that you need a bigger amount of bullets left on the belt:-)

I really like that buddy belting idea. I could maybe make it a scroll-wheel action... Hm. I'll look into it. Thanks for the suggestion!

Edited by Outlawled

Share this post


Link to post
Share on other sites

I don't know what the issue is, but right now if I have 11 full magazines and do a repack, I get only two magazines with 30 rounds each (and total bullett count on the popup is 33); if I repack again, I get only one magazine with 6 bullets inside...

Yay!

Share this post


Link to post
Share on other sites

Hm. It shouldn't let you repack your magazines if all your magazines are full...I'm not sure what would be causing that problem.

I did just release version 2.0 of the mod, though, so maybe that will have been fixed. I tested repacking 11 full magazines and had no problems, so...I dunno. Let me know if you encounter this or any other problems again.

Version 2.0 Released

Changelog:

- Version 2:
- New: Animation changed to 'Gear' animation.
- New: Magazine types are now repacked one by one.
- New: How long it takes to repack each magazine type depends on how many bullets of that magazine type need to be repacked.
- New: A magazine type can be skipped by pressing the 'Space' key.
- New: Repack can be exited by moving (if player is inside a vehicle, getting out will exit, pressing movement keys will do nothing).
- Fixed: Player can no longer repack magazines while in the driver, gunner, or commander seat of a vehicle.
- New: Informational hint after repacking now displays each individual magazine ammo count from before and after the repack. E.G. [15,16,12,5,3] >> [20,20,11]
- New: While repacking, a hint displays which magazine type is being repacked and the current ammo counts of each individual magazine of the current magazine type.
- Fixed: Vaulting and reloading are now disabled during repack.

Share this post


Link to post
Share on other sites
Hm. It shouldn't let you repack your magazines if all your magazines are full...I'm not sure what would be causing that problem.

I did just release version 2.0 of the mod, though, so maybe that will have been fixed. I tested repacking 11 full magazines and had no problems, so...I dunno. Let me know if you encounter this or any other problems again.

Version 2.0 Released

Changelog:

- Version 2:
   - New: Animation changed to 'Gear' animation.
   - New: Magazine types are now repacked one by one.
   - New: How long it takes to repack each magazine type depends on how many bullets of that magazine type need to be repacked.
   - New: A magazine type can be skipped by pressing the 'Space' key.
   - New: Repack can be exited by moving (if player is inside a vehicle, getting out will exit, pressing movement keys will do nothing).
   - Fixed: Player can no longer repack magazines while in the driver, gunner, or commander seat of a vehicle.
   - New: Informational hint after repacking now displays each individual magazine ammo count from before and after the repack. E.G. [15,16,12,5,3] >> [20,20,11]
   - New: While repacking, a hint displays which magazine type is being repacked and the current ammo counts of each individual magazine of the current magazine type.
   - Fixed: Vaulting and reloading are now disabled during repack.

Great, will try this releas as soon as I can!

Yay!

Share this post


Link to post
Share on other sites

New version frontpaged on the Armaholic homepage.

PS: if you do not mind any feedback from me.

Mission makers (and others as well) may not be happy if you change the pbo name with each update. It is not adviced to do that (missions made with the older version will have to be reworked for example).

So, maybe leave the versioning out of the pbo name?

Just a thing I noticed :o

Edited by Foxhound
updated to latest version!

Share this post


Link to post
Share on other sites

Version 2.1 Released

Changelog:

- Version 2.1:
- Fixed: Changed global variable to be less likely to cause mod incompatibility.

- Version 2:
- New: Animation changed to 'Gear' animation.
- New: Magazine types are now repacked one by one.
- New: How long it takes to repack each magazine type depends on how many bullets of that magazine type need to be repacked.
- New: A magazine type can be skipped by pressing the 'Space' key.
- New: Repack can be exited by moving (if player is inside a vehicle, getting out will exit, pressing movement keys will do nothing).
- Fixed: Player can no longer repack magazines while in the driver, gunner, or commander seat of a vehicle.
- New: Informational hint after repacking now displays each individual magazine ammo count from before and after the repack. E.G. [15,16,12,5,3] >> [20,20,11]
- New: While repacking, a hint displays which magazine type is being repacked and the current ammo counts of each individual magazine of the current magazine type.
- Fixed: Vaulting and reloading are now disabled during repack.

Edited by Outlawled

Share this post


Link to post
Share on other sites

The update is great, this is the best magazine repacking I've ever seen for a game. However, would it be possible to make it more obvious which magazine is the "current" magazine in the list, for instance by surrounding its number in the hint list with some symbol? i.e. [15, 16, >12<, 5, 3]; It would make it more precise to skip magazines.

Share this post


Link to post
Share on other sites
Hm. It shouldn't let you repack your magazines if all your magazines are full...I'm not sure what would be causing that problem.
I have the same issue with 2.1 version: only Mods active are yours and CBA...

With the new UI I think it's quite clear what is happening: the actual N bullets in magazines are for some reason counted as N/10 (where / is integer division)... This means that if I have 10 magazines with 30 rounds each, the mod counts them as 10 magazines with 30/10 = 3 rounds each, and obviously (and correctly) repacks them in one 30 round magazine and one 3 round magazine: if I run the repack again, the Mod will once again count a magazine with 30/10 = 3 rounds and, fore some odd reason, won't do this division with the 3 rounds magazine (since it should be 3/10 = 0)...

So i looks like the division is made only if the number of rounds in a magazine is more than 10: if I shoot enough rounds to make the number drop in the twenties, the repack will count 2 (24/10 = 2 for example); same thing with the tens (16/10 = 1 for example)...

It's nearly as if this sort of code was implemented for the magazine count function (I'm just writing this to make myslef as clear as possible, I have no idea how the code actually looks like):

int countBullets (Magazine ToRepackMag)
 {
 if (ToRepackMag.bulletsInMag >= 10)
   return ToRepackMag.bulletsInMag / 10;

 else if (ToRepackMag.bulletsInMag < 10)
   return ToRepackMag.bulletsInMag;
 };

Or another possibility could as well be:

int countBullets (Magazine ToRepackMag)
 {
 int numOfBullets = ToRepackMag.bulletsInMag / 10;        //if bullets < 10 then numOfBullets = 0

 if (numOfBullets != 0)
   return numOfBullets;

 else
   return ToRepackMag.bulletsInMag:
 };

I would be glad to make a video if I wasn't clear enough...

Yay!

Edited by Gliptal

Share this post


Link to post
Share on other sites

Could you make a quick video demonstrating your problem, Gliptal? I'm having trouble reproducing your error.

This means that if I have 10 magazines with 30 rounds each, the mod counts them as 10 magazines with 30/10 = 3 rounds each, and obviously (and correctly) repacks them in one 30 round magazine and one 3 round magazine

I'm so confused as to what is causing this problem for you two. Haha.

Thanks for bringing it to my attention, though. And lemme know when that video is up.

EDIT: So I determined where the error would likely be and started trying to fix it even though it wasn't broken for me...and ended up breaking it for me. So I was able to reproduce your error after changing the code. And now I fixed it again, but...if the way it was before didn't work for you and it did for me...I dunno why this would work for you. I need to understand why it wasn't working for you...

Which version of ArmA 3 are you running?

Also edit:

The update is great, this is the best magazine repacking I've ever seen for a game. However, would it be possible to make it more obvious which magazine is the "current" magazine in the list, for instance by surrounding its number in the hint list with some symbol? i.e. [15, 16, >12<, 5, 3]; It would make it more precise to skip magazines.

For the "current" magazine thing, the mod sorts the magazine array descendingly, so that particular mag array would be [16,15,12,5,3], the right-most magazine is always the one that is having bullets taken out of it and the left-most, non-full magazine is the one having the bullets placed in.

I will take a look at making it more obvious, though.

Edited by Outlawled

Share this post


Link to post
Share on other sites

Just to know, what was the error?

I'll make the video ASAP by the way!

Yay!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now