Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Death · Sep 23, 2011 at 12:17 AM · spawn

Spawning Zombies Different Rounds

Ok so i wanna make a zombie game kinda of like in CoD black ops. So i want the zombies to spawn in only the room the player is in. So say in room 1 and the other doors are closed right, so the zombies only spawn in that room. Once you open a door zombies can spawn from the room as well. And for each round the numbers increase like round 1 there are only 10 zombies round 2 20 zombies and in round 3 is 30. So for each round multiply by 10. So i need help with that please. Dont say go to the forums or telling me to put down a script. If you would like to help more your name will be in the credits.

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 Chris D · Sep 23, 2011 at 12:21 AM 0
Share
  • to trolling.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by roamcel · Sep 23, 2011 at 04:57 AM

Not quite clear what you're asking. But if you need an outline, here it is:

 - create an enemy spawn script with a public parameter 'round' and a private parameter 'zombiesperround'
  - attach the enemy spawn script to an empty gameobject in your zone
  - create an empty gameobject (call it zonespawn) and place it in your zone.
  - attach a zone wide trigger or another proper trigger (like 'dooropen') to zonespawn.
  - attach the enemy spawn script to zonespawn
  - use OnTriggerEnter in zonespawn to call your enemy spawn script.

Voila.

Comment
Add comment · 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
0

Answer by wienerdog · May 05, 2013 at 11:17 PM

I times zombies per round * round so part of code not completely working spawns 55 zombies for some reason. var zombiePrefab : GameObject; var zombieSpawned : int; var player : GameObject; var spawn : boolean; var minWait : int; var maxWait : int; var waitTime : int; var zombiesperround : int = 3; var round : int = 1; var roundclock : GUIText;

 function Start () 
 {
     minWait = 60;
     maxWait = 120;
     waitTime = Random.Range(minWait, maxWait);
     spawn = true;
 }
 
 function Update () 
 {
 roundclock.text = ""+round;
 zombiesperround = zombiesperround * round;
     if(spawn)
     {
         Spawn();
     }
 }
 function Spawn ()
 {
 if (zombiesperround > 0)
     {
         yield WaitForSeconds(1);
         Instantiate(zombiePrefab, transform.position, transform.rotation);
         zombieSpawned +=1;
         zombiesperround --;
         waitspawn();
     }
 else
     {
     if (zombieSpawned == 0)
         {
             round ++;
             spawn = false;
             SetSpawn();
         }
     }
 }
 function SetSpawn ()
 {
     yield WaitForSeconds(waitTime);
     spawn = true;
 }
 function NewWaitTime()
 {
 waitTime = Random.Range(minWait, maxWait);
 }
 function waitspawn()
 {
     yield WaitForSeconds(1);
     spawn = true;
 }
Comment
Add comment · 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

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

6 People are following this question.

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

Related Questions

How do I spawn a random prefab? 1 Answer

Script needs fixing ?! 1 Answer

Why not can't spawn the object? 1 Answer

Slender pages collection does not activate gameobject I want 0 Answers

How to instantiate object infront of player? 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