Group of AI shotgunners, only 1 fires projectiles?

Hello all! So, my shotgun enemy is acting all sorts of weird…basically what is happening I place 4 into a map, and then they see the player and move in to attack. However only the first AI who is in range first will start firing the actual projectiles, the other 3 AI will play the fire animation but their projectiles will spawn on the muzzle of whichever one started firing first. I am not sure at all why this is happening, here is a GIF of the issue in action.

GIF:

From what I understand I think they might not be instanced correctly but I am not sure of how to do that. Any help or advice would be wonderful, thank you all so much in advance!

Blueprint Script:

Looking at your blueprint:

  1. You use GetAllActorsOfClass but use Get for only one AI
  2. This one AI is used to spawn the projectiles
  3. There is a timer which is looping a function which starts a timer(!?) which is then connected to nothing
  4. You do this in every AI character so maybe every character uses a Get 0 from the AI array and uses the same location
  5. There are disconnected nodes

Try to Cast to the Character after OnPawnSensing, Stop the movement and then Spawn the Projectiles. No GetAllActors. Define it for one. Test it.

1 Like

Ended up just giving them a sphere collision for now and using that relative location, works just fine now but I’ll have to come up with a better solution in the future. I think recreating the enemy with the shotgun already in their hands instead of using a BP would work fine, this is a retro fps after all :stuck_out_tongue: thanks for your help, sorry it took me so long to mark your answer :slight_smile:

1 Like