How to refocus or retarget enemy with towers?

I am making a tower defense game and what I have so far is okay, but I am wondering how to get my towers to “keep up” with my enemy. I’ve adjusted the Interp Speed and they are still semi-focused. Any help on tightening up the targets would be greatly appreciated. Thanks…

You need to check if an enemy is in range. If it is, aim at the enemy. If not, increase rotation by +1 (for turning around). You get the idea. You can have 2 different states, one fighting state, one idle state.

Here is a new link to a video to show what I am talking about. The last link is bad apparently…

So as anyone can see, it starts just fine, but after they all are inside the collision, it stops shooting them. I am seeing on collision enter, but not while in collision. How do I update while / if they are inside the collision still?

Still looking for help on this. Just need to keep or figure out how to update current overlaping enemies as targets and follow them all the way and not partially.

Get overlapping actors, sort by health remaining, set the winner as the target for the turret. Fire at it for as long as it’s overlapping or update every frame if you want to switch to the weakest target available.

Thanks, I will give that a try.

I have an older experimental project somewhere with tower defense elements. Let me know if you’re having problems with this and I’ll try to dig it up and see if it makes sense in 4.19

If you know how to sort by remaining health or update every frame, it would save me some research time. And be appreciated… lol I am using 4.18 though.

Turrets have a collision sphere which checks for overlapping actors, puts their health into an array and fetches the one with the lowest value. The retrieved object is then set as target for the turret for as long as it’s alive, is in range or something with lower health comes along…

Apart from that there are some more elements when it comes to target selection. The project is attached if you want to take it apart, it’s just 3 blueprints, really. Some stuff in the construction scripts, some widgets and it all spawns in the level blueprint.

Link to the project (20MB): https://drive.google.com/open?id=1dmzXQAI3dQ9VSHsZp8J_il6Lx_d8YXPz

Vid: https://i.gyazo.com/beee742e871e5d4346310b688a22e54d.mp4

Hope it helps.

Thanks that helped a lot. Much appreciated.