Hi all,
So, I added the following lines to my code:
if (isDead() == true) {
//if enemy is dead stop firing
DetachFromControllerPendingDestroy();
GetCapsuleComponent()->SetCollisionEnabled(ECollisionEnabled::NoCollision);
}
Yes, I realise the “==true” is not needed, but, I add it for clarity - it just helps when reading through code, especially at a later date. But anyway the code is still allowing for the enemy to fire whilst lying on the floor into the wild blue yonder(ie the direction at which the gun is pointing after falling over). I have made some minor changes to the code to allow the fire button to be able to be held down to fire a burst of x amount of rounds quickly, then force a reload for x amount of time. This also overrides the wait time in the behaviour tree, so would this be the culprit in the continual firing? Or should the “DetachFromControllerPendingDestroy()” stop this action from ocurring?
All help is greatly appreciated.