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 doomprodigy · Dec 12, 2010 at 05:02 AM · errorfalsetruecs1525

True False What am I doing wrong.

I seem to be on a roll today with my questions. Alright so Im working on making it when the character is out of mags he can no longer shoot. I think I am just writing it funny or something small.

private bool outofmags = false;

This is in my void update V V V

if (VariableScript.pistolclip <= 0)
        {
            outofmags = true;
        }
        if (VariableScript.pistolclip >= 1)
        {
            outofmags = false;
        }

Later on ....

if ( Input.GetMouseButtonDown(0) )
            {
                if outofmags == false;
                {
                HandleBullets();
                }
                if outofmags == true;
                {
                    // ignore this here, Ill just make it play a sound or something instead of calling another function that doesn't shoot
                }
}

I get the error Assets/Scripts/AIscript.cs(129,44): error CS1525: Unexpected symbol outofmags', expecting('

I know it tells me what It is expecting I am just unsure on how to fix it.

Hopefully you get what I want it to do.

Im learning a lot from my questions cheers guys.

Comment
Add comment · Show 2
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 _Petroz · Dec 12, 2010 at 05:52 AM 0
Share

FYI: You should be using 'else' in s$$anonymous$$d of the second 'if' in both code fragments.

avatar image doomprodigy · Dec 13, 2010 at 05:45 AM 0
Share

$$anonymous$$ will do, Did you negative my question?, honestly don't know why or who is doing it to my questions. Im no coder, just learning

1 Reply

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

Answer by Justin Warner · Dec 12, 2010 at 05:45 AM

Your if statements is wrong in the second piece....

You have:

if ( Input.GetMouseButtonDown(0) )
            {
                if outofmags == false;
                {
                HandleBullets();
                }
                if outofmags == true;
                {
                    // ignore this here, Ill just make it play a sound or something instead of calling another function that doesn't shoot
                }
}

It SHOULD be:

if ( Input.GetMouseButtonDown(0) )
            {
                if (outofmags == false)
                {
                HandleBullets();
                }
                if (outofmags == true)
                {
                    // ignore this here, Ill just make it play a sound or something instead of calling another function that doesn't shoot
                }
}

Good to ask though, always ask, no matter how small the question is =).

Comment
Add comment · Show 2 · 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 doomprodigy · Dec 12, 2010 at 05:50 AM 1
Share

Cheers mate, worked like a charm.

avatar image Justin Warner · Dec 12, 2010 at 05:50 AM 0
Share

Aight, good to hear... Off for the night, haha, have a good night =).

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

A bunch of errors that I can't fix 1 Answer

How can I make 2 objects that are close to each other being treated as being in the same position? 1 Answer

error CS1525: Unexpected symbol `)' 1 Answer

yield waitforseconds false/true 2 Answers

How to do Multiple OnTriggerEnters 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