Hello, I have been working on a turret blueprint that attacks Ai Zombies that run past it. I have made it target the zombies via a operlap event however, when the first target is dead it ignores the AI already in the area and waits for a new zombie to enter. How would I go about having the turret attack anything already in the area?
I’m using Blueprint for this as I’m not a coder.
Ah thanks very much. The asset is currently set as character, using the ‘Character movement’ componenet, what would be the closet to this node in pawn?.
I was going to type it all out but it seemed like a lot of work. I am basically checking which one is closest and setting that distance. I am also checking to see if they have a tag of “Target”. Then I just added in some check variables, Target is the closest actor with the tag of “Target”. “Closest” is the distance to the “Target”. “Has Target” just makes sure that there is a target in range. My max range is 3500 and is set to tell the “Has Target” whether it is true or false depending on the closest target. Then I just do a “Is Valid” to make sure the target isn’t dead. The other “Get Distance To” is actually to keep the turret from targeting outside the range I want. Otherwise it would literally fire until the target was dead. I chose to use the distance instead of a collider but you could always use a collider. The two other scripts are special for my turret. I don’t have a skeleton on it and Rotate Turret just rotates the actor.