How to implement charge shots (e.g. Zenyatta's Alt Fire (OW) and Beggar's Bazooka (TF2)).

Greetings All,

As the title states, I’m trying to implement an attack that when the button is held down it will begin to charge/store X amount of ammo(projectiles) into the attack and upon release volleys the projectiles one after the other. Basically like Zenyatta’s alt fire, (while you hold RMB your ammo decrements up to -5 from ammo pool, upon release the number of shots you stored while holding RMB shoot out one at a time) or like that of Team Fortress 2’s Soldier weapon the Beggar’s Bazooka, (player holds down LMB and begins to load/store rocket ammo into their attack and on release the rockets fire one after the other).

See the attached image for reference to what I’ve been testing with. For quick testing purposes I’m not working with any ammo integers at the moment. As of right now the Primary Action Event is not important, the Secondary Action Event is the focus. While I hold down RMB I want it to charge/store up to a count of 5 potential projectiles to fire. So far all I can get is either an endless loop of projectiles firing or it only fires while I hold down RMB. This was just me trying to get something going but I’ve hit a wall and seeking assistance. I’ll answer what I can and I look forward to input. Thanks for the time. :slight_smile:

I’ve updated my code since yesterday and am closer to the mechanics I’m pursuing for. As of right now the charging portion is sort of working, while holding down RMB a Print String will inform me of the Current Ammo Amount decreasing and upon release shoots a certain amount of projectiles. For a moment it worked fine but for some reason it began doubling the last amount taken during each pass while RMB is held down. Sometimes a small amount of projectiles fire other times it’s like a fire hose that varies on when it will stop. I’ll keep making adjustments and hopefully get it right soon, but any help would be awesome. Updated code for reference attached.