How to create multiple AI movements and have the AI lock onto a position

I am creating a game that requires an enemy to move along a horizontal path until the main character enters the enemies’ field of view. When this happens the enemy will lock onto the main characters position ( only once, enemy does not follow character ) and fallow a path to the position specified. After the enemy is done with this movement, it should reverse and return to the original horizontal movement.