- Home /
Semicolon? WHAT? HELP ME!
ok, so my script for making my turret only look/ shoot at me when im in the trigger goes like this
var LookAtTarget:Transform; var damp = 6.0; var bullitPrefab:Transform; var savedTime=100000;
function OnTriggerStay(hit : Collider) { if(LookAtTarget); { var rotate = Quaternion.LookRotation(LookAtTarget.position - transform.position);
transform.rotation = Quaternion.Slerp(transform.rotation, rotate, Time.deltaTime * damp);
var seconds : int = Time.time;
var oddeven = (seconds % 2);
if(oddeven)
{
Shoot(seconds);
}
}
function Shoot(seconds) { if(seconds!=savedTime) { var bullit = Instantiate(bullitPrefab ,transform.Find("Spawnpoint").transform.position , Quaternion.identity);
bullit.rigidbody.AddForce(transform.forward * 3000);
savedTime=seconds;
}
} }
but it says that i need to insert a semicolon at var LookAtTarget:Transform; var damp = 6.0; var bullitPrefab:Transform; var savedTime=100000; and i have one... any suggestions?
Answer by denewbie · Nov 24, 2010 at 11:56 PM
var LookAtTarget:Transform; var damp = 6.0; var bullitPrefab:Transform; var savedTime=100000;
function OnTriggerStay(hit : Collider) { if(LookAtTarget); // REMOVE THIS SEMI COLON !!!!!!!!!!!!!!!!!!!!!!!!! { var rotate = Quaternion.LookRotation(LookAtTarget.position - transform.position); transform.rotation = Quaternion.Slerp(transform.rotation, rotate, Time.deltaTime * damp);
var seconds : int = Time.time;
var oddeven = (seconds % 2);
if(oddeven)
{
Shoot(seconds);
}
}
} // ADD ONE MORE BRACKET !!!!!!!!!!!!!!!!!!!!!!!
By the way, the error could also be because the semi-colon is missing from the line BEFORE then one they complained about so please check that too.
Your answer
Follow this Question
Related Questions
Collision Detector script 1 Answer
Desintergrate Enemies on Dying 4 Answers
script help 2 Answers
whats wrong wrong with my script 4 Answers
at booster to an object 0 Answers