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 copperdoggames · Jan 20, 2014 at 11:13 PM · errorzombieround

Zombie Round Script Help

I have a small problem with my zombie round script I've been tweaking. I've fixed 5 errors I've gotten with the script but I can't figure out what is causing an "expecting ), found :". But I've changed it to what it says but it errors again. If seeing the full script would help, let me know, I'll post it up. The error is at "maxlivezombies:int"

 void Update()
 {
      while(GameObject.FindGameObjectsWithTag("zombie").length < maxLiveZombies:int || zombiesThisRound > maxZombies;
      {
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 Lockstep · Jan 21, 2014 at 12:29 AM 0
Share

"expecting ), found :" obviously means that you forgot to close a parenthesis.

1 Reply

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

Answer by jolo309 · Jan 21, 2014 at 01:00 AM

 void Update()
 {
      while(GameObject.FindGameObjectsWithTag("zombie").length < maxLiveZombies:int || zombiesThisRound > maxZombies);
      {

would do it. You forgot a ) at the end of maxZombies, that should do it

Comment
Add comment · Show 9 · 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 copperdoggames · Jan 21, 2014 at 02:47 AM 0
Share

Wait, Now I'm getting another error including the last error. It says the ) is an unexpected token.

avatar image jolo309 · Jan 21, 2014 at 02:26 PM 0
Share

What line and what script is that line, is it the same? Because if it is i can't really seem to find any other errors EDIT: Oh yeah try

 void Update()
 {
      while(GameObject.FindGameObjectsWithTag("zombie").length < maxLiveZombies:int || zombiesThisRound > maxZombies)
      {

ins$$anonymous$$d :D I wonder why i didn't see that before but you had a ; at the end

avatar image copperdoggames · Jan 21, 2014 at 10:39 PM 0
Share

You fixed the error, (Thank You!) but now I'm getting an different error at (7, 9) and (12, 9) saying that void is not a macro. Here is the complete script:

 var zombie:GameObject; //Set the zombie model in the inspector
 var maxZombies:int; //set max zombies in this round
 var maxLiveZombies:int; //set max zombies alive at once
 private var zombiesThisRound:int = 0; //this is the number of zombies that have spawned this round, alive or dead
 private var previousSpawnPoint:GameObject; //this is where the last zombie spawned
  
     void Start()
 {
      previousSpawnPoint = GameObject.FindGameObjectsWithTag("spawnpoints")[0]; //this will break if you have no spawnpoints tagged "spawnpoints".
 }
  
     void Update()
 {
      while(GameObject.FindGameObjectsWithTag("zombie").length < maxLiveZombies)int || zombiesThisRound > maxZombies;
      {
           var spawnPoints = GameObject.FindGameObjectsWithTag("spawnpoints"); //get a list of all spawn points
           var spawnPoint = previousSpawnPoint; //choose a default spawn point
           while(spawnPoint == previousSpawnPoint && spawnPoints.length > 1) //keep choosing a random spawn point until you choose one you haven't choosen yet
           {
                var spawnPoint = spawnPoints[$$anonymous$$ath.floor($$anonymous$$ath.random() * spawnPoints.length)];
           }
           previousSpawnPoint = spawnPoint; //store where the zombie spawn last
           var newZombie = Instantiate(zombie, spawnPoint.transform.position, spawnPoint.transform.rotation); //create the new zombie
           newZombie.tag = "zombie"; //tag it as a zombie
           zombiesThisRound++; //increase the number of spawned zombies.
      }
  
 }
avatar image jolo309 · Jan 21, 2014 at 11:35 PM 0
Share

Hmm, seems you use Javascript(UnityScript)

so ins$$anonymous$$d of void use

function

void is used for C#

 var zombie:GameObject; //Set the zombie model in the inspector
 var maxZombies:int; //set max zombies in this round
 var maxLiveZombies:int; //set max zombies alive at once
 private var zombiesThisRound:int = 0; //this is the number of zombies that have spawned this round, alive or dead
 private var previousSpawnPoint:GameObject; //this is where the last zombie spawned
  
     function Start()
 {
      previousSpawnPoint = GameObject.FindGameObjectsWithTag("spawnpoints")[0]; //this will break if you have no spawnpoints tagged "spawnpoints".
 }
  
     function Update()
 {
      while(GameObject.FindGameObjectsWithTag("zombie").length < maxLiveZombies)int || zombiesThisRound > maxZombies;
      {
           var spawnPoints = GameObject.FindGameObjectsWithTag("spawnpoints"); //get a list of all spawn points
           var spawnPoint = previousSpawnPoint; //choose a default spawn point
           while(spawnPoint == previousSpawnPoint && spawnPoints.length > 1) //keep choosing a random spawn point until you choose one you haven't choosen yet
           {
                var spawnPoint = spawnPoints[$$anonymous$$ath.floor($$anonymous$$ath.random() * spawnPoints.length)];
           }
           previousSpawnPoint = spawnPoint; //store where the zombie spawn last
           var newZombie = Instantiate(zombie, spawnPoint.transform.position, spawnPoint.transform.rotation); //create the new zombie
           newZombie.tag = "zombie"; //tag it as a zombie
           zombiesThisRound++; //increase the number of spawned zombies.
      }
  
 }
avatar image copperdoggames · Jan 22, 2014 at 02:02 AM 0
Share

Didn't even notice that! thank you!

Show more comments

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

21 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

ArgumentOutOfRangeException: Argument is out of range. Parameter name: index System. 0 Answers

Error in script 1 Answer

Error in script 1 Answer

Access components in ALL children 1 Answer

UCE0001: ';' expected. Insert a semicolon at the end 1 Answer


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