Jump to content
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

Everything posted by Seabass121

  1. Yea, mozzie was just a little taller.
  2. Igor looks like Mozzie from white collar.
  3. 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.
  4. This will also fix the issue where the enemies spawn infinatly when the round starts?
  5. So use random.range(0,2) ?
  6. Seabass121

    I need help pls

    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; } }
  7. 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?
  8. Fixed! I put the variable in the wrong place. LOL.
  9. 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.
  10. 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.
  11. 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.
  12. Some people really need to learn how to google. http://alexstv.com/index.php/posts/unity-voxel-block-tutorial
  13. Figured it out. I forgot to put the ai controller script. LOL
  14. 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.
  15. Does not work. I am using fps kit 1.5 c#. The agents won't move, I put the target script on my player. I baked the scene. Made sure the teams were different.
  16. Seabass121

    Tommy Gun

    Opps. Verts : 3, 219 Faces : 3, 104 Tris : 6, 455
  17. Seabass121

    Tommy Gun

    This is my second model. I think this is way better that the scar I made a few weeks ago. Here are some pictures: Is is made in blender. If there is anything I can add or fix, tell me. It can be used commercially, because it is my second model, but credit me. Download : https://mega.nz/#!bhMBWarS Key : !EDNOmAo8zfamkzm4_5xpece0wRmzYLOIKpuVRl0ZMLs Thanks. Verts : 3, 219 Faces : 3, 104 Tris : 6, 455
  18. You need winrar, the password to extract it is armedunity.
  19. I was gonna use for a boss battle, lol. Oh well. Just tuo spoky 4 u?
  20. I wan't to create something simple, yet amazing. I am a beginner programmer, so a lot is hard for me, and it is annoying. I don't want to copy many features from most games. I don't know. If you can come up with uniqueish ideas, please tell me, and I will add it. I was thinking about making a borderlands type game with this kit, but I know that that is way to complex for me. Thank you for the reply.
  21. Ok, I am making a game with the au fps kit. I made ai that can shoot, die, damage me, I can damage it, etc, a main menu, a decent test map, and a few guns, one that I made. I feel like I am trying to do everything at once, and I don't know what I should add. I am not trying to make the next cod, I don't know what I want to add is the problem. If you guys could help me, that would be great.
×
×
  • Create New...