Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Unity user · Jan 16, 2011 at 01:41 AM · syntax-errorbce0044

Problems with my grenade PLEASE HELP!

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``

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Unity user · Jan 16, 2011 at 01:48 AM 0
Share

when i do this it gives me a lot more errors

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Nynex71 · Jan 16, 2011 at 01:44 AM

the function start () { is missing an end bracket, since you not doing anything with it you dont need it so your script should look like this

var ExplodeTime : float;

var Explosion : Transform;

 private var Thrown : boolean = false; 

 var speed : int = 25;



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); } 





 }

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Nynex71 · Jan 16, 2011 at 01:44 AM 0
Share

commonly missed error good luck with your game

avatar image Nynex71 · Jan 16, 2011 at 02:18 AM 0
Share

i might have messed up with to many { and } if so im sure you can fix im just tired

avatar image Unity user · Jan 22, 2011 at 09:09 PM 0
Share

Thank you!!!!!!!!!!!!!!!!!!!!!

avatar image Nynex71 · Feb 21, 2011 at 04:22 PM 0
Share

its no problem...

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

ShopScript.Js(49,17): BCE0044 expecting :, found GUI. 1 Answer

EOF error message 2 Answers

could someone tell me whats wrong with this script? 2 Answers

HELP!! expecting :, found ';' problem 2 Answers

Assets/Shoot.js(7,90): BCE0044: expecting :, found ';'. whats wrong? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges