unity 3rd person orb's AI

Hello :)

So Im using the orb’s out of the unity 3rd person tut and they work grate just like the original but
what I want is for instead of them zooming straight to the player and start attacking I want them to wonder around and then once in a radius of the player then start to attack and if u stray too far away they stop following I have had a look at some scripts on here but Im not sure how you would attach or make it work with what I already have can anyone help?

Do somethink like this, using the Vector3.Distance() function.

var MyPlayer : Transform //attach the transform of your player
var disToAtack : Integer //how much near to atack

if (Vector3.Distance(MyPlayer.position, transform.position)<disToAtack){

    //Atack

}else{

    //Walking around

}

how can i get it to work?