I’ve been looking around the code for the FPS example that you can download from the marketplace, and I understand the weapon code for the most part, but I can’t find a way to make a weapon semi-automatic, or even burst, instead of full-automatic. Would it have something to do with the BurstCounter variable?
Just add after the Input/Keypress DOONCE and then reset on release. You could also use DoN for having it activate N number of times.
If you add a property to the weapon config that specifies the number of rounds per burst, and you add a counter variable in the weapon class then you could have the counter initially set to 0, increment it each time you fire, and call the stop firing function when the counter reaches the burst size. If you want to keep the ability to have automatic weapons then you’d want to add a isAutomatic property to ignore these changes. This is how I implemented it in my project.
Where exactly would I put this? I tried putting it at the end of the code below, but it couldn’t compile.
InputComponent->BindAction(“Fire”, IE_Pressed, this, &AShooterCharacter::OnStartFire);