move around

Hi
I have follow a guid from TornadoTwins and I cant get my “worm” to re spawn when it fall out of the platform.
my script is (i guess its wrong whiv false and true beacuse thay dont change collors

var speed = 3.0;
var rotateSpeed = 3.0;
var bullitPrefab:Transform;
private var dead = false;

function OnControllerColliderHit(hit : ControllerColliderHit)
{
if(hit.gameObject.tag == “fallout”)
{
dead = true;
//substract life here
}
}
function Update ()
{
var controller : CharacterController = GetComponent(CharacterController);
transform.Rotate(0, Input.GetAxis (“Horizontal”) * rotateSpeed, 0);

var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = speed * Input.GetAxis (“Vertical”);

controller.SimpleMove(forward * curSpeed);

if(Input.GetButtonDown(“Jump”))
{
var bullit = Instantiate(bullitPrefab,GameObject.Find(“spawnpoint”).transform.position,Quaternion.identity);
bullit.rigidbody.AddForce(transform.forward * 2000);
}

}

function LateUpdate()
{
if (dead)
{
transform.position = Vector3(0,4,0)
gameObject.Find(“Main Camera”).transform.position = Vector3(0,4,-10)
dead = false;
}
}

@script RequireComponent(CharacterController)

and my error code is

Assets/movearond.js(36,36): UCE0001: ‘;’ expected. Insert a semicolon at the end.


please help me (im on the 12 part of the guid http://www.youtube.com/watch?v=zsY86MdO_ZE)

/// Txzzo

The error message tells you exactly what the problem is, and exactly where it is. It even tells you how to fix it :slight_smile:

As Jesse say, it is fairly obvious.

oo I dident see that ty :smile:

but now its give me a error from my health bar..

my script is


var health1 : Texture2D; //one live left
var health2 : Texture2D; //two live left
var health3 : Texture2D; //full health

static var LIVES = 3;

function Update () {
}
switch(LIVES)
{
case 3;
guiTexture.texture = health3;
break;

case 2;
guiTexture.texture = health2;
break;

case 1;
guiTexture.texture = health1;
break;

case 0;
//gameover script here
break;

}

}


and my error is


Assets/livecontroll.js(11,7): BCE0044: expecting :, found ‘;’.

and my second error is


Assets/livecontroll.js(15,1): BCE0044: expecting EOF, found ‘case’.

well what i see I dont see that it tell me what wrong now…

ty for the help

//txzzo

You put ; instead of :

switch (variable)
{
	case 0:
		print("case 0");
		break;
	case 1:
		print("case 1");
		break;
	default:
		print ("any case");
		break;

}

where are im gonna to replace it?

case are always followed by :

ooo
ty :smile:
now my move around script have mess up…
well I send back later if I need help

//txzzo

hi again

I have problem whiv my script again
its my move around script.
its look like this.


var speed = 3.0;
var rotateSpeed = 3.0;
var bullitPrefab:Transform;
private var dead = false;

function OnControllerColliderHit(hit : ControllerColliderHit) //onTriggerEnter | collider
{
if(hit.gameObject.tag == “fallout”)
{
dead = true;
//substract life here
healtcontroll.LIVES -= 1;
}
}
function Update ()
{
var controller : CharacterController = GetComponent(CharacterController);
transform.Rotate(0, Input.GetAxis (“Horizontal”) * rotateSpeed, 0);

var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = speed * Input.GetAxis (“Vertical”);

controller.SimpleMove(forward * curSpeed);

if(Input.GetButtonDown(“Jump”))
{
var bullit = Instantiate(bullitPrefab,GameObject.Find(“spawnpoint”).transform.position,Quaternion.identity);
bullit.rigidbody.AddForce(transform.forward * 2000);
}
}

function LateUpdate()
{
if (dead)
{
transform.position = Vector3(0,4,0);
gameObject.Find(“Main Camera”).transform.position = Vector3(0,4,-10);
dead = false;
}
}

@script RequireComponent(CharacterController)


I have remove the script from my work so I get no error but its is there… :frowning:
look my error imige…

//txzzo

353753--12311--$cant_add_script_124.png

Your script is full of errors.
You have it pasted twice in here also.
Look at the console window and debug your script.

its onli say that I have one error and that is Assets/livecontroll.js(30,1): BCE0044: expecting EOF, found ‘}’.

The only error I get is :

What is it ? Did you spell it correctly ?

I gonna look again I wrote back in 10 min

yeah I did spell it wrong.
But it still say that it is a error but not on my movearound script its say that it is on my lifecontroll script.
but when I try to add the movearound script to my worm it say that I need to fix all bugg first.

What are the errors ? And the current script ?

lifecontroll != healtcontroll

I did delete my helth controller beasuse it made me mad :evil: so now i have the error

Assets/movearond.js(12,1): BCE0005: Unknown identifier: ‘HealtControll’.

the error is on my move around script

I think you should have a little reading.

http://unity3d.com/support/documentation/ScriptReference/index.Member_Variables_26_Global_Variables.html

yes, you have a reference in your move around script that points to the healthcontroll script ( not the lifecontroll which you had )
all you had to do is change the name of your lifecontroll to healthcontroll

ooo… well how am I thinking!