Enemy AI differently

I have a question, I recently started programming in unity but three months and I do not know how to make “Enemy AI” I saw something in fps, but the tutorial was a bit different as I thought. So I want to ask if someone makes a script that does that for me to go after the enemy and I will shoot the dice.

give it a google!

this is what i came up with…
http://www.google.ca/search?q=unity+ai&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official

I’m using the same scripts in this tutorial for waypoints and enemy ai, but they won’t attach to any object. I’m following the tutorial (Unity 3d AI Tutorial 2 - OneWaypoint system), and it makes sense but it won’t do what its supposed to.
Waypoints:
var waypoint : Transform;
var speed : float = 20;

function Update () {
var target : Vector3 = waypoint.position;
var moveDirection : Vector3 = target - transform.position;

var velocity = rigidbody.velocity;

if(moveDirection.magnitude <1){
velocity = Vector3.zero;
}
else{
velocity = Vector3.forward * speed;
}

}

Enemy AI:
var waypoint : Transform[ ];
var speed : float = 20;
private var currentWaypoint : int;
var loop : boolean = true;

var player : Transform;

function Awake(){
waypoint[0] = transform;
}

function Update () {
if(currentWaypoint < waypoint.length){
var target : Vector3 = waypoint[currentWaypoint].position;
var moveDirection : Vector3 = target - transform.position;
var distFromPlayer : Vector3 = player.position - transform.position;

var velocity = rigidbody.velocity;
if(moveDirection.magnitude < 3){
currentWaypoint++;
}
else if(distFromPlayer. magnitude < 20){
velocity = Vector3.zero;
target = player.position;
velocity = (player.position - transform.position).normalized * speed;
if((player.position - waypoint[currentWaypoint].position).magnitude > 21){
target = waypoint[currentWaypoint].position;
velocity = moveDirection.normalized * speed;
}
}
else{
velocity = moveDirection.normalized * speed;
}
}
else{
if(loop){
currentWaypoint=0;
}
else{
velocity = Vector3.zero;
}
}

rigidbody.velocity = velocity;
transform.LookAt(target);

}

I have 3 problems in code.

nothing ?

My Guess is that there should be comments for the lines:
Waypoints: , EnemyAI:
It doesn’t mean anything pro-grammatically so it’s probably a comment.
//Waypoints:
//EnemyAI:

It is 2 scripts in one:
Waypoints.js
and
Enemy AI.js
Cut them.