Ammo Magazine System / Array Useage Help please!

I have an advanced ammo system that I’ve been working on that accounts for actual magazines which are put into an array of magazines. This system works great. Say you have 3 mags (12 rounds each), you fire 5 out of MAG0, reload, fire 12 out of MAG1, reload, fire 12 out of MAG3, reload, it cycles back to MAG0 with 6 rounds left over from before.

I’m working on a magazine repacking system with “Ammo Boxes” but I’ve hit a snag and maybe I’m missing something… I’ll post what I have so far.

Here’s the set up of the Mag system on start, works great.

Here’s the set up of the ammo repacking item when you click on it to use it, I’ve annotated a few points:

Basically what I’m wanting in the end is for when the player uses the ammo box, it repacks, each mag in the Array from Mag0 to however many are left until the ammo box runs out of bullets or all the mags are full. I’m storing the completely empty mags in a different variable for now and will deal with that later (I’ll end up adding them back to the array and adding delicious bullets into them if there’s remaining ammo in the box after repacking current mags)

There’s a step I’m missing and I’ll post specifically where

How do I tell it that for each loop, it should grab the proper index and add ammo to that proper magazine?
Am I even doing this correctly or is there a better mathy way than going “full yet? nope, add one. full yet? nope, add one. etc etc etc” Because right now it basically just checks if the mag is full yet, if the ammo box is empty, adds one bullet, subtracts one bullet from the box count and loops until there’s a stop. I feel like there’s a better way of running through an array and doing the same action, I just can’t quite figure it out or maybe there’s a better node I haven’t heard of that can do some math on the whole array at once to any of the mags that are less than full?

Any help on this would be GREATLY appreciated. I’m a bit new with blueprints but really starting to dig my teeth into it and I’d love to learn something from this if anyone has some better nodes or ways of accomplishing this! Thanks!!

i know this post is a couple years old, but did you ever figure this system out? If so would you be willing to share your work? I’m designing a game that uses a magazine system like you have and just can’t figure it out.

Make a new post and label it with “blueprint scripting”, i’ll help you with that :wink:

Thanks, i posted it. The title is “Help with blueprint for ammo into magazines”. Any help is greatly appreciated.

Hi, did you ever complete this?