It has shoot every 0.2 seconds, however player can spam fire by fast single clicking that is faster than 0.2 seconds. So my question is how can i maintain the full auto ability and also prevent player from single firing faster than 0.2 seconds between shoots.
This is the setup for the Fire Input Action i have, Pressed and Released in Triggers
Hey @V3lir You can make a small update to your bp and it should address your issues. You can track “is pressed” as you are but don’t invalidate your timer on release. When timer is active and valid, you don’t create a new timer and when you let go of the button, let the timer clear and invalidate itself. This way mashing button won’t fire the event again. Example attached. Feel free to ask more questions.
It works nice @zer0chi , however i see two issues, first shoot is always delayed by the Set Timer’s node time so in case my first shot is delayed by the 0.2 seconds. Second issue is when stopped holding the key on the timer being active the next shoot will shoot, in other words when i stop automatic fire it will shoot one more time even after i released the key already. Setting the time for 0.5 or more will show the issues clearly
First one you can resolve by calling the event right after you set timer by event. For the second one, you kill the timer when you feel like its appropriate. You can add cooldown after shot is fired and before next shot can happen. So even if someone taps it, there is retroactive cooldown. In your case, on release you can destroy the timer if you want to do so.
Your suggestion works, however It looks like i need to tick check for timer when still holding key, because without checking it there is a issue where i did:
Click(for one shot) > Release( for duration less than the cooldown) > Click and hold. And with that combo shooting will not start at all.
And the IA_Shoot having Pressed and Released triggers.
And now shooting is perfect working without any of the issues above. One downside is that first and second Branch is ticking for checking the bool and if the timer is still active or not, which maybe is not best solution, however it does not look like a big impact of performance so I think i can stick with it.