Charge Shot / Quick Shot gun Charge Fire/Hold not working

So my goal is to make a pistol that has both a charge shot and quick shot. So if the player taps the input it shoots like a normal pistol would, but if they hold the input it will perform a charge shot for extra damage.

So I set the "Fire" type to "Charge and Fire" or "Charge and Hold" (I've tried both) and set the charge times. I set up the animations like the Bow from the demo.

The charge part works perfectly fine and functions as it should. The issue now is that the quick shot is not working. I have the UseSlot0 Ability stop type set to Button Up - this solved some issues for me and really is the part that made it work so far. I have the Animator Audio Substateindex set to 2 for the weapon properties script and then the charge substateindex sets it to 10. I have the use even and use complete events set to timers for full control of the timing. I've been trying to play around with the times to see if the use or use complete events set the substate to 2 in order for a normal quick shot fire but seem to have no success with that.

As always any help is appreciated and if I do have to code this on my own I would need some helpful advice on where to start. I'm thinking of starting a timer with the button down event and if the button is lifted before the min charge time then regular shot and if the button is held then charge shot. But it would be great to achieve this with the out of the box controller.

Thanks.
 
Last edited:
Have you tried using 2 different ShootableWeapon components on the same item? One for the quick-fire and one for the hold-fire?
 
Hi thanks for the suggestion but this did not work either. Although I did learn a lot about Action Id's and adding more actions to a weapon.

I use a second shootable weapon properties and a second Third person perspective properties for a second action id. I can't get the one quick charge to not instantly fire not matter what. So even if I just hold the input it will instantly fire a quick shot and then start the charge shot after. The input stop types are button up. I thought that would only shoot the weapon if the button was lifted, which would give perfect functionality to what I'm trying to achieve.

Is there a way to only have the Use ability shoot the weapon on button up?

I also wanted to know why there is not option for the amount of damage for a charge shot. I thought the "Charge Strength" value would be the damage the projectile does based on the amount of charge but it turns out its just the velocity. I actually had this working nicely just by putting the "Minimum Charge Time" to 0 so it would quick shot without charging. But then there was no way of changing how much damage it did based on the charge.
 
Hm yes I can see why that might not match exactly what you're going for. And I guess just using a single ShootableWeapon action with hold-to-fire doesn't quite do it either. In this case you may want to create a custom version of ShootableWeapon - it should be simple enough to check if the user has quickly pressed and released the input (e.g. released within 0.2 sec, roughly the average person's reaction speed).

The charge strength could easily enough be used to adjust the damage amount - you could modify the HitscanDamage method in your subclass to adjust damageAmount by some multiplier of strength.
 
Top