Hud Ammo Counter Multiple Guns?

Hey, so I have just set up my basic ammo counter for my game, it works for only the pistol but all of my weapons are child actor components that are attached to my player character model and all of their stats are stored within the player character blueprint (example of variables: pistol ammo current, pistol ammo min, pistol ammo max, shotgun ammo current, shotgun ammo min, shotgun ammo max). I am trying to figure out, since the ammo values are stored within the player character how can I (when I switch weapons, this works with my debug commands so its just a matter of getting it to show up correctly on screen), get the ammo counter to switch dynamically when I switch from pistol to shotgun?

Here is a screenshot of the blueprint script that shows up on the ammo counter, surprisingly this works in displaying only the pistols ammo.

Any help would be wonderful! Thank you all! :slight_smile:

EDIT:

Realized this might be some more useful information: I handle gun swapping with a GunInventoryArray which I pass through the parent gun so that it knows which gun is in the players hand.

Update: i am still struggling with this, i know i need to somehow pass my gun inventory array over to the hud but im not sure of how i can do that, i played with my Equip Gun function but that didnt seem to work.

Any suggestions would be much appreciated :slight_smile:

Okay so heres where I was able to get to, what I am thinking is I am grabbing the two Current Ammo values for the trench gun and pistol, feeding them into a print to text (so it shows in the lower right corner). Currently this only works for the pistol and I haven’t been able to get them to flip back and forth when swapping weapons. Any suggestions?

EDIT: Forgot to post the screenshot of the blueprint

EDIT 2:

I thought out this system a bit further and came up with a solution! Basically i remade the array (same index per weapon) with only the current ammo variables, so melee is at index 0 (no ammo so its set to 0), pistol at index 1 and shotgun at index 2. This seems to work just fine for now.

Does anyone know if there is a better way to do this for optimization?