I am trying to make different types of rounds that can go into the same magazine. For example 5.56 ball, 5.56 tracer and 5.56 ap. I want to be able to mix them inside a magazine, such as 1 tracer, 5 ball, 5 ap, 5 ball, 5 ap, 1 tracer. I cannot do this with something like an array because it would just go: 2 tracer, 10 ball, 10 ap right? I could use BPs but would that be very cost ineffective?
Use a common base class for the ammo that can mix, set the magazine variable array type to the common class and then you can insert any ammo that inherits from that class.
Alternatively you could make an array of type actor and filter incoming objects via the actor tag or via in interface.
If you don’t need a physical representation of the bullets in the magazine then you could just have an array of structs which holds the current ammo mix info. Then you could retrieve the needed ammo via an object pooler upon firing.
My inventory subsystem distinguishes what its picked up, used, in bag etc. Keeps track of it and talks with player inventory component. So basically with that you can define different ammo types to same weapon type and it will just keep track of those in magazine.
If you want them ordered in a magazine that is a different question and I think arrays is the answer like 3dRaven said.
My weapon system only talks with inventory subsystem and asks couple of things like.