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 /
  • Help Room /
avatar image
0
Question by Leanosh10 · Oct 19, 2016 at 02:10 PM · spawnzombiewaves

Zombie Wave Spawning?

Currently attempting to make zombies spawn in waves. I am using script found at http://wiki.unity3d.com/index.php?title=Enemy_Spawner I understand how the spawning of a wave works however when implemented to multiple spawn locations the script becomes useless because the zombies will keep spawning at the same location because it only applies to a single spawner and not the entire game.

Is there a way to reference each spawner and make zombies spawn at those locations? Also, is there a way to implement a wave counting system, one which can track all zombies killed rather than those relating to that specific spawner?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Oliver-Bogdan · Oct 19, 2016 at 03:17 PM

You can use only one instance of the spawner and create a list of spawning position that are stored in an array (or a List)

You can modify spawnEnemy method so that it uses a random spawn position.

 private void spawnEnemy()
 {
     GameObject Enemy = (GameObject)Instantiate(Enemies[enemyLevel], GetRandomSpawnPoint(), Quaternion.identity);
     Enemy.SendMessage("setName", SpawnID);
     // Increase the total number of enemies spawned and the number of spawned enemies
         numEnemy++;
         spawnedEnemy++;
 }

 private Vector3 GetRandomSpawnPoint(){
  // here you would choose a position of a random (or not) Spawn Point and return it;
 //select a random SpawnPoint from a list and return it's position
 //you can fiddle with this so that maybe you could sequentially traverse all spawn points rather than choosing a random one each time.
 }



For tracking all the zombies that were killed I suggest you let this video inspire you.

https://unity3d.com/learn/tutorials/topics/scripting/events-creating-simple-messaging-system

Comment
Add comment · Show 1 · 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 Leanosh10 · Oct 19, 2016 at 11:49 PM 0
Share

Can you please elaborate on the GetRandomSpawnPoint() function. I am relatively new to C# and I can't find a definite way to create the appropriate list. I also can't load the recommended tutorial due to network blocking.

How would I set the list up? and return a random value for that list

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Enemy Spawner Crash 1 Answer

[SOLVED]Multiple enemies Wave Spawner 1 Answer

How to make an array that stores x, y and z co-ordinates? 1 Answer

Spawning Bug. 1 Answer

NetworkServer.SpawnWithClientAuthority not working? 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