Enemy AI help

i need help i need to make a enemy AI to follow the enemy,teleport every so often,cant go through walls im new to scripting but i dont know alot of stuff so if anyone can help me that would be great here is the script i use thanks :smile:DDDDDDDDD

#pragma strict

var target : Transform; //the enemy’s target
var moveSpeed = 3; //move speed
var rotationSpeed = 3; //speed of turning

var myTransform : Transform; //current transform data of this enemy

function Awake()
{
myTransform = transform; //cache transform data for easy access/preformance
}

function Start()
{
target = GameObject.FindWithTag(“Player”).transform; //target the player

}

function Update () {
//rotate to look at the player
myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);

//move towards the player
myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;

}

Well, I have followed tutorial on Enemy AI script, it’s C#, but I can get it to you! If you want script, here! http://dl.dropbox.com/u/92094772/EnemyAI.cs

It should work completely! But make sure you create a new tag for your enemy as “Enemy”, and create a tag for player named, “Player”! Hope this helps you! NOTE: Unity will throw you a error until you add the enemy’s target! :smile:

And also make sure if you use the script to name it EnemyAI!