Persistant weapon ammo?

I currently have 2 weapons- Primary/Secondary. When the player starts, he spawns with a primary, and when he switches weapons, it destroys the primary actor, and spawns the secondary in it’s place. The problem here is that the weapon blueprints that are being spawned set the current ammo and ammo pool of the player- so every time the player swaps weapons, his ammo is reset. How could I make it so that after switching, the weapon “remembers” how much ammo it had- even after being destroyed? The only way I can see it working right now is if I make all of the weapons’ clip size/ammo pool/loaded ammo variables in the character, and have the weapon blueprint only containing the shooting logic. Ideally, I’d like to have all of that information in the weapon blueprint, as it would clean up my character blueprint quite a bit. Thanks!

It’s better to put changing variables like total remaining ammo and ammo left in the current clip in the player controller or the character. The weapon blueprint can have non changing variables like the total ammo in a new clip, max ammo count etc.

I currently have- loadedammo, ammopool and clipsize in the player character and for each weapon blueprint I have the same variables which are specific to the weapon. However, when the weapon is swapped, it resets these values to the values of the current gun. I’m not sure how I can make the player “recall” the amount of ammo that was in the clip the last time it was used. The only way I see this working is if I have separate variables “primaryloadedammo, primaryammopool, primaryclipsize, secondaryloadedammo, etc.” Then the player would be limited to 2 weapons at any time which is fine, but it would still be messy for replacing weapons and switching the UI to show primary/secondary. I feel the best option would be a generic “loadedammo” etc. that just changes depending on what weapon you are using- not sure how to do that without the values constantly resetting.

Clipsize would be better off in the weapon blueprint. As for loaded ammo and total ammo left, you can have two arrays (each having size = total number of weapons) in the controller or character that can take a weapon index (0,1,2 based on number of weapons) and store in the arrays using this index. You can do this everytime you switch your weapon. Everytime you take a new weapon, you access the data from these arrays and show the HUD/do calculations.

Even if you create custom loaded ammo, you would need to store all these values for different weapons. So I dont think it would make much difference.

Awesome, thanks for the help!

I have the same problem, but i have only one PickUp weapon and this is one PickUp i’m posted on my map. Now whe i taked gun of firs PickUp and shot some amount ammo and before this take gun of second PickUp i have amount bullets of first PickUp. How to fix? P.S Sorry for my bad English. I hope that you have understood everything.