enemy AI script

I need an example of an enemy AI scipt, i can make a turret thanks to Tornado Twins and i assume i just put a transform position on it after the look at script to get it to follow but how would i do a senser for if my player is in the radius of like 40 then trigger it examples?

If I understand your question right, then you might be able to use this:

    var distance;
    var target : Transform;    
    var lookAtDistance = 15.0;
    var attackRange = 10.0;
    var moveSpeed = 5.0;
    var damping = 6.0;
    private var isItAttacking = false;

    function Update () 
    {
    distance = Vector3.Distance(target.position, transform.position);

    if(distance < lookAtDistance)
    {
    isItAttacking = false;
    renderer.material.color = Color.yellow;
    lookAt ();
    }   
    if(distance > lookAtDistance)
    {
    renderer.material.color = Color.green; 
    }
    if(distance < attackRange)
    {
    attack ();
    }
    if(isItAttacking)
    {
    renderer.material.color = Color.red;
    }
}

function lookAt ()
{
var rotation = Quaternion.LookRotation(target.position - transform.position);
transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * damping);
}

function attack ()
{
    isItAttacking = true;
    renderer.material.color = Color.red;

    transform.Translate(Vector3.forward * moveSpeed *Time.deltaTime);
}

When you come close this "AI" it will look at you. If you get even closer it will follow you around until you run away from it. Just drag the target you want the AI to follow inside the slot in the Inspector named "target".

Be aware that this is only a simple AI, you might need to change things inside the script or compine what TornadoTwins has thought you in order for this to suite your needs.

Hope this has helped you.

use a sphere collider and check the isTrigger option. then make the collider as wide as you need it for your radius. then use the onTriggerEnter, onTriggerStay, and onTriggerExit for your on/off or whatever you need. http://unity3d.com/support/documentation/ScriptReference/Collider.html

:-)

what is the a.i. script for the game “mummy maze”?

It says
unspected token ! what should i do !