Using Line of Sight to allow the engine to know when your character should be shot at.
This video will walk you through the concept:
youtube.com/watch
You can also have more than one Line of Sight behavior on an enemy - a large one for vision to set aggro - then a smaller one for attack range.