This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

Seabass121

Member
  • Content count

    31
  • Joined

  • Last visited

  • Days Won

    2

Seabass121 last won the day on May 31

Seabass121 had the most liked content!

Community Reputation

6 Neutral

About Seabass121

  • Rank
    Member
  • Birthday

Profile Information

  • Gender
    Male
  • Location:
    USA
  • Interests
    American Football, Game Development, Guitar.

Recent Profile Visitors

370 profile views
  1. Yea, mozzie was just a little taller.
  2. Igor looks like Mozzie from white collar.
  3. Thanks!
  4. Sorry, I was at school. I can test it out now. Ok, it did not work. Still the same thing has happened. And I am getting a null reference. But everything is assigned. I think instead of this, I will use floats as like a % chance for spawning a different type. Thanks for your help though.
  5. This will also fix the issue where the enemies spawn infinatly when the round starts?
  6. So use random.range(0,2) ?
  7. Hello... I need help. So I am trying to make a cod zombies type game, not as good though... but whatever. I have two zombie types, Normal and Crawler. I am using enums for this. What I am trying to do is spawn either a Normal, or a Crawler zombie (the enum). And if I can improve my code, tell me, I need to learn. So hopefully you can help me. Here is my zombie ai script: using System.Collections; using System.Collections.Generic; using UnityEngine.AI; using UnityEngine; public enum ZombieType { Normal, Crawler }; public class ZombieAI : MonoBehaviour { public ZombieType typeOfZombie; public float moveSpeed; public bool isCrawler; private Transform target; private NavMeshAgent nav; private Animator anim; private CapsuleCollider capcol; void Start() { target = GameObject.FindGameObjectWithTag("Player").transform; nav = GetComponent<NavMeshAgent>(); anim = GetComponent<Animator>(); capcol = GetComponent<CapsuleCollider>(); if (typeOfZombie == ZombieType.Normal) moveSpeed = 0.5f + Random.Range(0f, 3f); if (typeOfZombie == ZombieType.Crawler) moveSpeed = .25f + Random.Range(0f, .5f); } void Update() { nav.SetDestination(target.position); if(typeOfZombie == ZombieType.Normal) { NormalZombieType(); } if (typeOfZombie == ZombieType.Crawler) { CrawlerZombieType(); } } void NormalZombieType() { isCrawler = false; capcol.direction = 1; capcol.center = new Vector3(0, 1, 0); anim.SetFloat("speed", Mathf.Abs(nav.velocity.x) + Mathf.Abs(nav.velocity.z)); } void CrawlerZombieType() { isCrawler = true; capcol.direction = 2; capcol.height = 2.5f; capcol.center = new Vector3(0, 0.5f, 0); anim.SetBool("isCrawler", isCrawler); } } Here is my GameManager or spawner script : using System.Collections; using System.Collections.Generic; using UnityEngine; public class GameManager : MonoBehaviour { public Transform[] spawnPoints; public GameObject enemy; public float spawnTimer; [Header("Round Configuration")] public int round; public int enemiesInCurrentRound; public static int enemiesLeftInRound; public int enemiesSpawned; public float roundTimer = 10; private ZombieAI ai; void FixedUpdate() { if (enemiesSpawned < enemiesInCurrentRound && roundTimer == 0) { if (spawnTimer > 2) { SpawnAI(); spawnTimer = 0; } else { spawnTimer += Time.deltaTime; } } else if (enemiesLeftInRound == 0) { StartNextRound(); } if (roundTimer > 0) { roundTimer -= Time.deltaTime; } else { roundTimer = 0; } } void SpawnAI() { Vector3 randomSpawnPoint = spawnPoints[Random.Range(0, spawnPoints.Length)].position; Instantiate(enemy, randomSpawnPoint, Quaternion.identity); ai.typeOfZombie = (ZombieType)Random.Range(0, 1); //When I do this, the zombies are just normal, and spawn infinatly, but when I don't have this, it spawns 1 zombie every 2 seconds. enemiesSpawned++; } void StartNextRound() { round++; enemiesInCurrentRound = enemiesLeftInRound = round * 5; enemiesSpawned = 0; roundTimer = 10f; } }
  8. I plan on adding more to this, that is why I put a separate function for this. This is just a test anyway. Thanks. Beginner question, how would it be different if I put this in just the update?
  9. Fixed! I put the variable in the wrong place. LOL.
  10. Ok, so here is my script now, using System.Collections; using System.Collections.Generic; using UnityEngine; public class Spawner : MonoBehaviour { public Transform spawnPoint; public GameObject[] objectToSpawn; float chance = Random.Range(0.0f, 1.0f); void Update() { SpawnObject(); } void SpawnObject() { if (Input.GetMouseButtonDown(0)) { if(chance >= 0.95f) // Legendary { Instantiate(objectToSpawn[4], spawnPoint.position, spawnPoint.rotation); } if (chance >= 0.8f && chance < 0.95f) // Very Rare { Instantiate(objectToSpawn[3], spawnPoint.position, spawnPoint.rotation); } if (chance >= 0.65f && chance < 0.8f) // Rare { Instantiate(objectToSpawn[2], spawnPoint.position, spawnPoint.rotation); } if (chance >= 0.5f && chance < 0.65f) // Uncommon { Instantiate(objectToSpawn[1], spawnPoint.position, spawnPoint.rotation); } if (chance > 0.1f && chance < 0.5f) // Common { Instantiate(objectToSpawn[0], spawnPoint.position, spawnPoint.rotation); } } } } Every Time I launch, It gives the random value, then when I click, it only gives me that chance throughout the entire thing until I launch again.
  11. Thanks so much gecko. I plan on using the au fps kit to attempt to make a borderlands style game, but obviously not as complex.
  12. I need help with a borderlands type loot system. I have made 5 cubes, and named them common, uncommon, rare, very rare, and legendary. I put the objects in to an array. I want common to be the most common chance of getting, and legendary to be the rarest. How would I go about doing that? I'm new to programming, so don't make fun of me if it is easy. Here is what I have so far: using System.Collections; using System.Collections.Generic; using UnityEngine; public class Spawner : MonoBehaviour { public Transform spawnPoint; public GameObject[] objectToSpawn; void Update() { SpawnObject(); } void SpawnObject() { if (Input.GetMouseButtonDown(0)) { Instantiate(objectToSpawn[Random.Range(0, objectToSpawn.Length)], spawnPoint.position, spawnPoint.rotation); } } } If you could help, that would be great.
  13. Some people really need to learn how to google. http://alexstv.com/index.php/posts/unity-voxel-block-tutorial
  14. Figured it out. I forgot to put the ai controller script. LOL
  15. Still no luck. I have been able to kill it, I can't figure out why it can't move. I may have skipped over some of your steps.