I am new to scripting at unity and am trying to make an fps game. I downloaded some weapon things from dastardly bannana even though i had some scripts i needed gun models. Their weapons are all good except the grenade. I wanted the grenade to bounce and explode on a timer, not on collision, so i am re-scripting it(in java script). http://www.dastardlybanana.com/FPSConstructorWeapons.htm I think i almost got it except i keep getting this error:
Assets/my grenade.js(8,18): BCE0044 expecting (, found 'Update'.
Here is my script so far:
var ExplodeTime : float;
var Explosion : Transform; private var Thrown : boolean = false; var speed : int = 25;
function Start() { function Update() { if(Input.GetButtonDown("Fire1")) { gameObject.velocity = transform.TransformDirection( Vector3( 0, 0, speed) ); Physics.IgnoreCollision( gameObject.collider, transform.root.collider ); Thrown = true; } else { return; } if(Thrown = true) { yield WaitForSeconds (ExplodeTime); if(Time.time > ExplodeTime) { Instantiate(Explosion, transform.position, transform.rotation); Destroy(gameObject); } }
}
}
Please help me fix this or give me a new script. THANKYOU``