Creating AI Enemies that Follow and then Shoot

Hello,

I’m looking for a tutorial on how to create an enemy that follows the player and then starts shooting at the player when it gets within a certain distance. I have found tutorials on one or the other but can’t seem to find anything that gives me what I need. If anyone has any suggestions or can point me in the right direction I would be most grateful.

Thanks,

hm… but why don’t you combine them? If I were you, I would first make AI to chase a player. I would assume you make it using behav. trees. Then, I would find an example how to see if a player is within the range. If within - then shoot (span projectile that will fly towards the player). Then you can get move advanced, and see if there is any obstacle between AI and the player before shooting. And then find a way how to avoid such obstacles.

You can post here any questions for each step.

Thanks for your message. I’m fairly new to Unreal so I just don’t know a lot of the scripting options. I know in my head how I would create it logically, I just don’t know how to put it into blueprints. I’ve made it so that it comes after the player (who is stationary) and runs all the way up to him but I’m just not sure how to add the shooting once the enemy is within a certain radius of the player. I haven’t used behavior trees - one, because I don’t fully understand how they work, and two, because I thought this enemy was a bit basic for a behavior tree.

This is what I have so far: