How would i make followers?

I want my game to have party members but i need a properly organized system, they need to follow the player until they find an enemy and attack the enemy until it leaves the screen and then go back to following the player but i dont want them trying to go on top of the player nor do i want them trying to follow the player exactly, in combat one is supposed to go charging at the enemy while the other only moves slightly toward the enemy so that she can hit with her spells i have a general object so that the ai can follow and attack but i am not sure how to set this all up, currently due to my game being no where near complete providing a link wouldnt help. If you could help please provide a snippet or a link for it, thank you!