I have this problem with my script for an AI
BCE0044: expecting EOF, found ‘<’.
this is my script:
function findPlayer(){
var hit : RaycastHit;
var distanceToPlayer : float;
directionToTarget = theTarget.transform.position - transform.position;
directionToPlayer = thePlayer.transform.position - transform.position;
distanceToPlayer = Vector3.Distance(transform.position, thePlayer.transform.position);
var targetAngle = Vector3.Angle(directionToTarget, transform.forward); //for vision
var playerAngle = Vector3.Angle(directionToPlayer, transform.forward);
Debug.Log(playerAngle);
Debug.Log(distanceToPlayer);
if(Mathf.Abs(targetAngle) < visionAngle distanceToPlayer < visionRange){
Physics.Linecast(transform.position, thePlayer.transform.position, hit);
//Debug.Log(hit.collider.name);
if(hit.collider.name == thePlayer.collider.name){
canSeePlayer = true;
theTarget = thePlayer;
}else{
canSeePlayer = false;
}
}else{
canSeePlayer = false;
}
if(distanceToPlayer < hearRadius){
canHearPlayer = true;
theTarget = thePlayer;
}else{
canHearPlayer = false;
}
if(canSeePlayer == false canHearPlayer == false){ //This has to ultimately be the final else
canSeePlayer = false;
canHearPlayer = false;
FindNextWaypoint();
}
}
dunno where the error is, I just went in and cleaned the code up a bit. Also, could you use code tags surrounded by brakets not pre tags… 
var visionAngle=0.3; // 1 is directly in front 0 is to the side -1 is directly behind
var visionRange = 30.0;
var hearRadius = 10.0;
var thePlayer : Transform;
function findPlayer(){
var hit : RaycastHit;
var distanceToPlayer = Vector3.Distance(transform.position, thePlayer.transform.position);
var forward = transform.TransformDirection(Vector3.forward);
var toPlayer = thePlayer.transform.position - transform.position;
canSeePlayer = false;
if (Vector3.Dot(forward,toPlayer) > visionAngle distanceToPlayer < visionRange){
if(Physics.Linecast(transform.position, thePlayer.transform.position, hit)){
if(hit.collider.name == thePlayer.collider.name){
canSeePlayer = true;
theTarget = thePlayer;
}
}
}
canHearPlayer = false;
if(distanceToPlayer < hearRadius){
canHearPlayer = true;
theTarget = thePlayer;
}
if(!canSeePlayer !canHearPlayer){ //This has to ultimately be the final else
FindNextWaypoint();
}
}
thanks, but “we” have a problem, when I put this script in the place of the other, I have the problem:
AISeePlayer.js(28,17): BCE0005: Unknown identifier: ‘FindNextWaypoint’.
That error means that you have no function called FindNextWaypoint. Neither your code nor BigMisterB’s code (which is the same) defines FindNextWaypoint, so if it was working before you copied his code in, you must have accidentally deleted it.
Correct, and in testing, I commented that line out. Your question did not pertain to creating all the functions you would need to make it run. 
function FindNextWaypoint(){
//add code to find your next waypoint... you do have waypoints, right?
}
I knew I posted this code someplace else…
http://forum.unity3d.com/threads/76325-Basic-AI-finite-state-machine-where-to-put-decision-logic
OK, using the script I posted a link to above would give you a general AI. Waypoints are an extension of that AI. Wandering would only be used used when it can’t see a waypoint to follow. Then you have to define what the waypoint is, what path it belongs to, and if that path is looping, pingpong or one way.
There are honestly thousands of ways you can accomplish all of this. So instead of giving you the code I use, I will let you do some searchs in the forums just search for “Waypoints” every page is good. Read and research. When you are ready start a program. It doesnt have to be the one I posted. Start one fresh. You will have to ask, What is a way point? How are they in relation to each other? How am I going to implement them into my game? Who follows what path?
Again, thousands of ways to do the same thing. So giving you code is not going to help you along.
thanks, you help too much [smiley][/smiley]