I do know how to basically do this. I’m guessing I need some kind of Exec timer that is set to 0.1 seconds and then every 0.1 seconds it will shoot but how do I do this? And what Exec node would I use?
I’m also guessing I need some kind of variable to help perform this.
Anyone know?
Thanks!
make a custom event called FireBullet that is called by a timer. the timer can be set when the player presses a button, and it can be cleared when the player releases the button, in an event called StopFiring. the delay on the timer should be set by a float called FireRate, and the timer handle should be stored in a variable called FireTimer.
then make a boolean called IsAutomatic, and after each shot, you can branch on IsAutomatic, and if its false, you can call StopFiring.
before you fire each bullet, you should check if your Ammo is greater than 0, and after you fire each bullet, subtract 1 from ammo to set the new ammo amount. if you try to fire a bullet, and Ammo is not greater than 0, StopFiring.
you should also make an enum that holds the weapons state, for things like dropping, jamming, overheating, switching, equipping, reloading, shooting, and Idle. then whenever you want to shoot a bullet, you check if its in the idle state, and if so, you switch WeaponState to shooting, and do the rest of the shooting code, subtracting ammo, tracing, spawning projectile, playing animations, etc…