Hello! My problem that I am having is that when I reload my shotgun, a remington shotgun, it reloads all the bullets at the same time and does not reload the bullet 1 at a time. It plays the animation once and I want it to play the animation for each bullet that it reloads. How do I fix it? I tried a couple of things, like looping the animation for the amount of bullets that it needs to reload, but it did not work as intended. Here is the blueprint:
When you are adding ammo to your weapon, I am not seeing where you are adding bullets one by one directly. Instead, would you mind going over your math and process in the nodes in the screenshots?
For example, why you are adding your current ammo to the entirety of your reserve instead of adding one by one using a loop with a break that ends the look once the ammo is full, playing the animation each time?
Sorry for the late reply. I will explain my blueprint piece by piece.
In this part of the blueprint its gonna check if the amount of bullets that you have in the gun is the max that it can hold; if the amount is the max it won’t reload. Then it passes to a branch that checks if the current gun has 0 ammo in it; it plays an animation if it has 0 in it and plays a different animation if it has 1 or more. It plays the weapon reload event and the animation.
If it is true, it plays an animation that spawns a shotgun shell in the hands and when it finishes the animation it despawns it. This animation has a pump animation.
If it is false, it plays an animation spawns a shotgun shell in the hands and when it finishes the animation it despawns it. This animation does not have a pump animation.
In the first step it will check if you have enough bullets in your reserve to be able to reload; as long as you have 1 bullet you will be able to reload. If you do have enough bullets it will check, just in case, if your clip is full. If its not full it will set the isreloading variable to true(I use it to limit other animations while you reload). The anim montage does nothing, I left it there for something I have in mind for the future. After the anim theres a branch that checks if you have more than 0 bullets to be able to reload. NeededAmmo keeps track of how much ammo you are missing from the clip of the weapon; if you have a 6 bullet clip and your gun has 4 bullets in that clip, it will set the needed ammo to 2. If the reserve that you have is less or equal to the neededammo it will just add that reserve to the clip and make the reserve 0; If you have 2 bullets in your reserve and the neededammo is 4, you cant just reload 4 bullets if you only have 2, so this just sums the ammo with the currentammo that you have in your clip. If the reserve is more than the neededammo it will just substract the neededammo from the reserve and then set the clip size back to full.
I tried to just make a simplified reload first, then when I tried to edit it into a full shotgun reload blueprint I ran into problems. I made the reload to reload the entire mag and not one by one, as a form of punishment for the player for reloading in front of an enemy. I tried just repeating the animation based on the needed ammo but it did not work, and I could not understand why. So, I went here to see if someone can shine some light to my slow brain.
I hope I was able to explain everything and answer your questions. I am a pretty bad at explaining things, so very sorry. If you need more information or I did not answer one of your questions correctly, please tell me! Thank you for your time and patience.
In your reloading montage add a notify at the point in the anim in which the shell has been added. We’ll use that “Event” to Update your Ammo Pool and Mag in the weapon.
e.g. Max Mag Size = 5, Magazine 0 (empty)
After we decrement pool and increment mag we check if the mag is topped off.
If not we call Reload action again.
This is the simplest approach. You can add a bool (bIsReloading) to help prevent spamming as well. Set it to true after the montage starts. Set it to False after Incrementing mag. Modify the functions Branch to check for it.
Glad it worked. Take note though. This is only the base logic. You’ll need to expand on it to fully implement a tight production ready reload process.