So I'm attempting to create a reloading mechanic that will automatically reload one bullet at a time, like a shotgun, that can't exceed it's max of four rounds, and draws from an ammo reserve. So basically, a single-round loading weapon that uses reserve ammo. When I try to get it to reload, it usually gives the player like 48 bullets or something like that. If I can get it to reload without going overdrive like that, I'd also like to know how to program a reserve ammo function so the player doesn't have infinite ammo.
Here's any code I have related to reloading:
Ammo Instance variable is set to 4 normally.
Mouse: Left Button is down
Soldier: Ammo > 0
(Subevent)System: Every 0.8 seconds (reload delay)
System: Create Object Rocket
Soldier: Subtract 1 from Ammo.
Text2(HUD Ammo count) Set text to Soldier.Ammo
System: Soldier.Ammo < 4
System: Wait 0.8 Seconds (Time between reloading each shot)
Add 1 to Ammo
The code above is where the issue seems to happen. It'll run a reload, and the ammo count will go to 48. I'd love to be able to set a limit, as well as getting to reload one at a time.