Download

Ammo Reload Help.

I have an ammo and shooting system that i just finished. Everything works fine but there is some type of bug i cannot figure out for my reload system. The default ammo you have is 180 30 loaded and 150 not loaded. Once i try to reload it does not take the ammo away from the unloaded ammo. So it starts 30/150 i shoot 30 and then reload and it goes back to 30/150. But then if i reload again its goes to 30/120. So it only drops the ammo pull by 30 every other time i reload Does anyone know why it does this. Here is my blueprint and a video.

2e803ce2472bf748bfd438b696a28e7bd3ecfe00.png

Hello,
On your first branch “player ammo” has to be > 0. When it is = 0 nothing is done ? Maybe your trouble.

“Ammo” is the current player ammunition?

What is the initial value of “Needed Ammo”?
After the first branch on the “Set Needed Ammo” node you probably intended to do “30 - Ammo”. This is probably the issue.

On the second branch (True path) you want to set the ammo to (Ammo + PlayerAmmo). But that is a different issue.

Sorry i should of said what all the vars were.

Needed Ammo: How much ammo is needed to be called when reloaded (30)

Player Ammo: How much ammo the play has not loaded into the gun (150)

Ammo: Ammo that is loaded into the gun (30)

Edit: I fixed it by doing the what you said it also fixed a issue i didnt even see until after i did the first method Thanks! I seem to mix up these variables alot.

Then changing the “30 - Needed Ammo” to “30 - Ammo” should fix it.

Here a variant without branches. It is untested but should work. (Current Ammo is Ammo, Backback Ammo is Player Ammo, and Available Ammo is a new variable, Needed Ammo is not needed anymore)

Oh ok, i thought player ammo was the loaded value…

I’m not sure if you saw my edit in my last post but what you told me to do fixed it. But thanks this is alot prettier to look at then my current setup.

But now i have a issue that i’m not quite sure what to do to fix. I found out while i was testing after the fix. When i’m shooting i can reload at the same time do you know how i would fix that. Would i need to use a gate somewhere or is there another way.?

You can add a variable “IsReloading” and then gate on it when shooting. But it would be best to open a different thread for new issues :slight_smile:

Ok, Thanks!

You’re a life saver :slight_smile: