How to add reload functionality to weapon

Hi All! Im having a little issue with my weapon class. So far ive got a parent class that handles all the firing and shooting functionality for all weapons. I can create child blueprint classes based on this parent class and then modify requirements for each weapon such as weapon mesh, the damage, the sounds etc etc. I now want to implement an ammo function into the base weapon class but i have no idea how i should go about doing it. Ive got the decrement ammo function working and thats called whenever the player shoots the weapon. Im just confused as to how id go about doing the reload and when id call it.

Ive attached a screenshot of my BaseWeapon blueprint in this message as well as the decrement ammo function…

Any ideas or help would be appreciated. Thanks guys! :smiley:

Are you stuck on linking the input and calling your function?

If so, then you should get reference to your weapon to your character (or controller) and call your function:

136312-2017-05-01_19-17-37.png

Oh no! i know how to call the function. Im stuck on writing the function itself.

Ah) It’s such a relief, that you know the basics) Ok. I recommend you to split your ammo to magazine and total. Then you press R, add both amount, subtract magazine capacity and you will get remain ammo and full magazine) While you shoot decrease only your magazine and check its emptiness.

Okay ive got this so far…

and im able to get to zero and hit reload making the current ammo go back to its full amount… in my case 30.

But im not sure how to reduce the total ammo (the max ammo the gun can hold eg if i had 30/90… how to reduce to 90 to 60 after a reload)

If you want to loose shots from the mag do not add mag and remain ammo. Do you need help with code? I’m not sure you make the clear picture in your mind.

Yes i do need some help please

Im having a problem with my Weapon, im using a M4A1 and everything works reload, animation and the delay on it but i can fire while reloading can you help me out. If you notice after fire its running a check to so if im reloading or Sprinting, the sprinting works but the reloading does not. Ive tried everything all variables and nothing seems to be working any suggestions?