Make an enemy move upon characters interaction with an object/box

Hey guys I am trying to get my character to trigger an enemy to move across the screen when my character steps on a box
At the moment what I have is checking that my character has hit the object with Debug.Log but after that I have no idea what to do. I am trying to keep this in one script(I know I can call a function from another script but just don’t know how to do it)
box trigger script:

var speed : float=5.0;
function OnTriggerEnter(other : Collider)
{

  • if(gameObject.Find(“zombie_hires”))*
  • Debug.Log(“ouch”);*
  • {*
  • gameObject.Find(“swat”):*

_ transform.Translate(Vector3(0,0,speed)*Time.deltaTime);_

  • animation.Play(“soldier_run”);*
  • }*
    }

enemy script(currently disabled):
var speed : float=5.0;
var lifeTime = 3.0;
function Awake () //unity predifined function
{
Destroy (gameObject, lifeTime);//delete fireballs in “lifetime”/time set can also be changed from unity
}
function Update () {
transform.Translate(Vector3(0,0,speed)*Time.deltaTime);
animation.Play(“soldier_run”);
}

can someone help me get this to work please:) (In my box collider script everything under debug.log only gives me errors) and for specification, my character is called “zombie_hires” and my enemy is called “swat” and my box is called “warning box”
many thanks in advance

bump? anyone know a possible solution:( its driving me crazy:(

well, first you need to have a script detecting collision, not enter, there’s a script reference for that. unless you can enter the box, then leave it as trigger enter. Then on trigger enter gameObject.find("swat).sendmessage(“move”).

in the enemy script have a
function move () {
transform.translate(Vector3(0,0,speed)*Time.deltaTime);
}
the errors are from your first script

make it this, the whole script:

function OnTriggerStay(other : Collider)
{
gameObject.find("swat").sendMessage("move")
}

in the enemy script delete the lifetime, function awake script, and replace update with move

and make your enemy script this:

var speed : float=5.0;

function move () {

transform.Translate(Vector3(0,0,speed)*Time.deltaT ime);
animation.Play("soldier_run");

}

for some weird reason I am getting an error on “gameObject.find(“swat”).sendMessage(“move”);“MissingMethodException: Method not found: ‘UnityEngine.GameObject.find’.”
is this not javascript:p?