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
0
Question by oooooooooott · Apr 25, 2013 at 11:07 PM · javascripterror messagenoobhealth

Health Script Help...?

Hi, major noob, just wondering why I am getting an error message for LINE 18, when I don't HAVE a line 18... Any Help? Here's the code ATM... Not 100% working, but the rest is solvable.

 static var Blood : float = 2000;
 public var infected : boolean = false;
 var dead : boolean = false;
 var brokenlimb : boolean = false;
 private var bleedout : float = 2.0;
 private var isbleeding : boolean = false;
 
 function Update () {
 if (Blood>0) dead && true;
 if (brokenlimb && true) {
     maxforwardspeed.float = 3;
 }
 if (isbleeding && true) Bleed ();
 }
 
 function Bleed () {
 while ((isbleeding && true) && (Blood>0)) {
 Blood -= bleedout*Time.deltaTime;
 }

Note: The exact error message is: "(Assets/Insomniac Studios/Name Censored for Copyright Reasons/Ditto/Health.js(20,1): BCE0044: expecting }, found ".

Comment
Add comment · Show 10
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 oooooooooott · Apr 25, 2013 at 11:51 PM 0
Share

Bump. Bump.

avatar image oooooooooott · Apr 26, 2013 at 12:07 AM 0
Share

Does ANYBODY know how to solve this?!?!?!?!?!!?

avatar image AlucardJay · Apr 26, 2013 at 12:08 AM 0
Share
  • 1 : Don't bump after 1 hour, that's not cool. Your question is still visible.

  • 2 : You havn't even posted the error message.

avatar image AlucardJay · Apr 26, 2013 at 12:10 AM 0
Share

Ok, you get downvoted for bumping twice in 1 hour. Even as I'm writing the above comment, you bumped again.

avatar image oooooooooott · Apr 26, 2013 at 12:14 AM 0
Share

Lol... I didn't see that comment at all, and I bumped and error messaged at the same time. XD

Show more comments

1 Reply

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

Answer by AlucardJay · Apr 26, 2013 at 12:09 AM

Line 9 makes no sense at all :

 if (Blood) = 0 dead && true;

what is this supposed to be doing ?!

Edit : The problem is you don't have a closing curly brace for function Bleed()

And still, what is this line supposed to be doing :

  if (Blood>0) dead && true;


One-line conditionals is not optimization. Format your code better, then you'll be able to actually read it :

 if (brokenlimb && true) maxforwardspeed.float = 3;

not good

 if (brokenlimb && true) 
     maxforwardspeed.float = 3;

better

 if (brokenlimb && true) {
     maxforwardspeed.float = 3;
 }

very nice looking formatting.

Comment
Add comment · Show 5 · 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 oooooooooott · Apr 26, 2013 at 12:15 AM 0
Share

Well, thanks for the formatting tip, I'm really new to coding. But... I posted the error message, and that format adjustment didn't solve my problem/the reason I posted this...

avatar image AlucardJay · Apr 26, 2013 at 12:31 AM 0
Share

Line 9 makes no sense at all :

 if (Blood) = 0 dead && true;

I cannot even guess what you are trying to do there.

I have updated the answer. The problem is you don't have a closing curly brace for function Bleed

avatar image oooooooooott · Apr 26, 2013 at 12:37 AM 0
Share

Lol... THAN$$anonymous$$ YOU! I was such a noob there. XD Several hours of messing with it before posting this on unity answers, to get into a nerdfight with some random guy just to find out it was that $$anonymous$$OTHER*** CURLY BRACE! Anyways, thanks for the help. XP

avatar image oooooooooott · Apr 26, 2013 at 12:39 AM 0
Share

Lol.. and just saying, line 9 is supposed to be the starter for the death script. There will be lots of ways to die, so I will just make it change a variable. I guess I should change it so it calls a function... :P

avatar image AlucardJay · Apr 26, 2013 at 12:44 AM 0
Share

So you probably mean

 if ( Blood <= 0 ) 
 {
     dead = true;
 }

Look into conditional statements and operators.

Conditional statements are things like if else statements, for loops, etc.

Operators are the signs used in conditional statements.

Basic Operators :

     ==      is equal to
     !=      is not equal to
     >       is greater than
     <       is less than
     >=      is greater than or equal to
     <=      is less than or equal to
     &&      if one condition is true AND another is also true
     ||      if one condition is true OR another is also true

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

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Help a beginner with a small doubt ? 2 Answers

How to make a simple ladder? 3 Answers

Health script and damage script dont work. 2 Answers

How can I change this script to use GUITexture instead of GUI number, for health display? 1 Answer

Help with OnCollision 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