Download

UE4 Ammo System

Hi. I’m having a problem and I can’t figure out how to solve it. I’ve created a modulated system for my weapons and it’s all working perfect. I can fire and reload just fine, but I don’t know how to show the ammo count and ammo max for each weapon inside a widget. The other problem is that each time I change the weapon, the ammo count and ammo max is resetting getting the child values for each weapon. I’ve created an enum called WeaponsStructure, and inside I’ve created variable called ItemStructure (Another enum with weapon values)


After that I’ve created a blueprint, BP_WeaponsParent and from that I’ve created childs for each weapon.


Here I want to show the ammo count and ammo max for each weapon.

This is the Fire Function and it’s working great for each child, but as I said, after I change the weapon, the ammo is resetting.

So, is there a way to get the updated values for each child without creating separate variables for each weapon? Thank you!