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.

Aeleas

Member
  • Content count

    118
  • Joined

  • Last visited

Community Reputation

3 Neutral

About Aeleas

  • Rank
    Member

Profile Information

  • Gender
    Male
  • Location:
    this world

Recent Profile Visitors

676 profile views
  1. Number of enemies inside every wave ?

    I tried to use enemyCount if (currentWave.enemyCount == 0) { currentWave.enemyCount = 5; print ("new wave"); } But it doesn't work. Later I figure out. To refull enemyCount I have to use "enemiesRemainingToSpawn" (I wasted my day on this spawn script) the script you sent it was great. you did well . Just if I could modify it and make it run. I done from this headache. But I couldn't, this new script I got it from the video I sent it to you which is after I got your script not before. Now I deleted this script from my project and post yours and still get these warnings messages on Wave and EnemySpawnMode !! Now my problem with number of different enemy on the wave. If i have 7 enemies on my array, How to make only first three only appears on first wave ? public GameObject[] enemy; // 7 enemies. public Transform[] spawnPoints; void Update() { foreach (GameObject enem in enemy) { Instantiate(enem, spawnPoints[spawnPointIndex].position, spawnPoints[spawnPointIndex].rotation); } } If nothing work, I have to use "Dog plan ". I don't know if i could make it works or not but i have to try.
  2. Number of enemies inside every wave ?

    Thank you for the script. I have something easier but still I need to add some public Wave[] waves; public GameObject enemy; // Wave currentWave; int currentWaveNumber; int enemiesRemainingToSpawn; int enemiesRemainingAlive; float nextSpawnTime; public Transform[] spawnPoints; void Start() { NextWave(); } void Update() { if (enemiesRemainingToSpawn > 0 && Time.time > nextSpawnTime) { enemiesRemainingToSpawn--; nextSpawnTime = Time.time + currentWave.timeBetweenSpawns; int spawnPointIndex = Random.Range(0, spawnPoints.Length); Instantiate(enemy, spawnPoints[spawnPointIndex].position, spawnPoints[spawnPointIndex].rotation); } print(" wave nuumber : " + currentWaveNumber + " enemy remining to respawn : " + enemiesRemainingToSpawn + " enemt remining a live : " + enemiesRemainingAlive); } // end update void NextWave() { currentWaveNumber++; print("Wave: " + currentWaveNumber); if (currentWaveNumber - 1 < waves.Length) { currentWave = waves[currentWaveNumber - 1]; enemiesRemainingToSpawn = currentWave.enemyCount; enemiesRemainingAlive = enemiesRemainingToSpawn; } } [System.Serializable] public class Wave { public int enemyCount; public float timeBetweenSpawns; } How to reply the same wave two or three times ? How to make a wave have more kind of enemies with the same function ? If i could got this......
  3. Number of enemies inside every wave ?

    What i need is "create a wave, wait a while - then create another one" Evey wave start with time, and had different kind of enemy.
  4. I want to make number of enemy waves and every wave has number of enemies. I couldn't do that because my script only spawn enemy on different spots. public Transform[] spawnPoints; public GameObject enemy_Lv1,enemy_Lv2,enemy_Lv3; // enemy level, weak to strong. public bool wavebutton = false; public float GameTime, seconds, minutes, hours; void Start() { InvokeRepeating("Spawn", 0.0f, 3.0f); enemy_Lv1 = Instantiate(Resources.Load("enemy/Enemy Idle (1)")) as GameObject; enemy_Lv2 = Instantiate(Resources.Load("enemy/Enemy Idle (2)")) as GameObject; enemy_Lv3 = Instantiate(Resources.Load("enemy/Enemy Idle (3)")) as GameObject; } void Spawn() { int spawnPointIndex = Random.Range(0, spawnPoints.Length); Instantiate(enemy_Lv1, spawnPoints[spawnPointIndex].position, spawnPoints[spawnPointIndex].rotation); } void Update() { if (wavebutton) { hours = (int)(GameTime / 3600.0f); minutes = (int)(GameTime / 60f); seconds = (int)(GameTime % 60f); print(hours.ToString("00") + ":" + minutes.ToString("00") + ":" + seconds.ToString("00")); GameTime += Time.deltaTime; } if (seconds == 5) { // start wave 1 // number of enemy lv1 = 10 ---> enemy lv2 = 5 ---> enemy lv3 = 3 } if (seconds == 20) { // start wave 2 // number of enemy lv1 = 15 ---> enemy lv2 = 8 ---> enemy lv3 = 5 } } I don't know if it's the right way to do this or not. Please, help me with this.
  5. Thank you Ocular.
  6. Thank you for you respond. Second point solved. first point still need to rechecked. Because I didn't test yet. you mean something like this: public Transform target; privte GameObject[] targets; // Update is called once per frame void Update () { targets = GameObject.FindGameObjectsWithTag("Enemy"); target = targets[15].transform; }
  7. Hi. I'm working on Tower Defense game. My character follow my mouse click on the map scene and if there are any enemies near him he aims directly at him. I copy most of the script from YT tutorial and I adjust it. I need help with two things here: 1/ line 6. target here is one enemy. What if I have more than 3 enemies ? How to make target is any object with "enemy" tag ? 2/ line 86. If my character selected target. I need to search for child object inside this target call "dead_point" ? Script file
  8. MadFPS Kit

    Coooool. I will wait for it.
  9. MadFPS Kit

    Great work. I really hope you will add a feature for these soldiers where they can point or aim at player not matter where he is "under or above a truck". this will be really amazing. Thank you so much for this kit.
  10. IK armies aiming far from target ?

    You right. I'm think to make my animation and not using mixamo. It will take time but maybe will solve this stupid problem. Thank you so much for what you did for me.
  11. IK armies aiming far from target ?

    What you said is correct. Now i can adjust the rotation of character. But still, if character moved behind target or far from it, I need again to fix the rotation manually !! Here is my script, private Animator mAnimator; private bool run_ = false; private bool walk_ = false; private bool aim_ = false; public Transform target; public bool activeIK = false; public float a,s,d,f,g; Vector3 targetPosition; Vector3 dampVelocity; public Vector3 offset_target; public Transform bSpine; public float dx,dy,dz; // Use this for initialization void Start () { mAnimator = GetComponent<Animator>(); } void Update () { offset_target = new Vector3(target.transform.position.x,target.transform.position.y,target.transform.position.z); bSpine = mAnimator.GetBoneTransform(HumanBodyBones.Spine); bSpine.LookAt(target.position); dis = Vector3.Distance(transform.position,target.transform.position); disy = transform.position.y - target.transform.position.y; disx = transform.position.x - target.transform.position.x; mAnimator.SetBool("run",run_); mAnimator.SetBool("walk",walk_); mAnimator.SetBool("aim",aim_); } void OnAnimatorIK(){ if (activeIK == false) { mAnimator.SetLookAtWeight (a, s, d, f, g); } else { targetPosition = Vector3.SmoothDamp(targetPosition, target.position, ref dampVelocity, 0.2f); mAnimator.SetLookAtPosition (target.position - new Vector3 (dx,dy,dz)); // mAnimator.SetLookAtPosition (target.position - (Vector3.up * dz)); mAnimator.SetLookAtWeight (a, s , d, f, g); } } } what else you advice me to do ? tell me.
  12. IK armies aiming far from target ?

    Yes, my problem is with the spine not the head. I used the spine but i didn't notes anything so I tried with the head. I really hope to find a way to fix this. I did what you said but i get error on last part. I recode my script private Animator mAnimator; private bool run_ = false; private bool walk_ = false; private bool aim_ = false; public Transform target; public bool activeIK = false; public float a,s,d,f,g; Vector3 targetPosition; Vector3 dampVelocity; public Vector3 offset_target; public Transform bSpine; // Use this for initialization void Start () { mAnimator = GetComponent<Animator>(); } void Update () { offset_target = new Vector3(target.transform.position.x,target.transform.position.y,target.transform.position.z); bSpine = mAnimator.GetBoneTransform(HumanBodyBones.Spine); bSpine.LookAt(target.position); dis = Vector3.Distance(transform.position,target.transform.position); disy = transform.position.y - target.transform.position.y; disx = transform.position.x - target.transform.position.x; mAnimator.SetBool("run",run_); mAnimator.SetBool("walk",walk_); mAnimator.SetBool("aim",aim_); } void OnAnimatorIK(){ if (activeIK == false) { mAnimator.SetLookAtWeight (a, s, d, f, g); } else { targetPosition = Vector3.SmoothDamp(targetPosition, target.position, ref dampVelocity, 0.2f); mAnimator.SetLookAtPosition (target.position - (Vector3.up * offset_target)); // error _._ Operator '*' cannot be applied to operands of type 'UnityEngine.Vector3' and 'UnityEngine.Vector3' mAnimator.SetLookAtWeight (a, s , d, f, g); } } I get error "Operator '*' cannot be applied to operands of type 'UnityEngine.Vector3' and 'UnityEngine.Vector3'". Also, Why i don't use spine bone on OnAnimatorIK function ?
  13. IK armies aiming far from target ?

    oh god no don't say that. I get me character from mixamo and didn't find anyone have this issue with unity3d !! could you please look at my file, maybe you will find something ? Yes, it's possible but will take long time from me, especially with other characters. I don't want to stop again my new project because this. Here is my avatar bones. do you see anything wrong ? I tried to do what you said but nothing happen. here is my script. public Vector3 offset_target; private Animator mAnimator; public Transform target; public Transform mhead; // Use this for initialization void Start () { mAnimator = GetComponent<Animator>(); } void Update () { offset_target = new Vector3(target.transform.position.x,target.transform.position.y,target.transform.position.z); mhead = mAnimator.GetBoneTransform(HumanBodyBones.Head); mhead.LookAt(target.position + offset_target); } void OnAnimatorIK() { if (activeIK == false) { mAnimator.SetLookAtWeight (0, 0, 0, 0, 0); } else { targetPosition = Vector3.SmoothDamp(targetPosition, target.position, ref dampVelocity, 0.2f); mAnimator.SetLookAtPosition (target.position); mAnimator.SetLookAtWeight (1, 1 , 1, 1, 1); } } could you look at the file and check whether is something wrong with bones ?
  14. IK armies aiming far from target ?

    I really need to fix this. I tried so much things but nothing could fix it. My project is RTS style game. Where player or enemy auto aiming at target. I have problem with IK that can't aiming correctly at target. The head is look at target without any problem, but the chest and armies pointing away from target !!? Here is my script, it looks long but it really simple one private Animator mAnimator; private bool run_ = false; private bool walk_ = false; private bool aim_ = false; public Transform target; public bool activeIK = false; public float a,s,d,f,g; Vector3 targetPosition; Vector3 dampVelocity; public clickme _click; // agent script public clickme _move; // agent script public float disx, disy; // Use this for initialization void Start () { mAnimator = GetComponent<Animator>(); } // Update is called once per frame void Update () { disy = transform.position.y - target.transform.position.y; disx = transform.position.x - target.transform.position.x; if (disx <2 && disx>-2 && disy<2 && disy>-7 && run_ == false && walk_ == false ) { activeIK = true; aim_ = true; } else { activeIK = false; aim_ = false; } if (_move.actives == false) { walk_ = false; run_ = false; } else { if (_click.mark >= 5) { run_ = true; } if (_click.mark <= 5) { walk_ = true; } } if (activeIK == false) { a = a - Time.deltaTime * 2; if (a <=0) { a = 0; } } else { a = a + Time.deltaTime * 2; if (a >=1) { a = 1; } } s = a; d = a; f = a; g = a; mAnimator.SetBool("run",run_); mAnimator.SetBool("walk",walk_); mAnimator.SetBool("aim",aim_); } void OnAnimatorIK(){ if (activeIK == false) { mAnimator.SetLookAtWeight (a, s, d, f, g); } else { targetPosition = Vector3.SmoothDamp(targetPosition, target.position, ref dampVelocity, 0.2f); mAnimator.SetLookAtPosition (target.position); mAnimator.SetLookAtWeight (a, s , d, f, g); } } Here is scene file 26mb https://www.sendspace.com/file/glmidi Could anyone here tell me why armies not pointing at target ? It's from the script or bones ?
  15. Positive and negative value ?

    Thank you so much guys for what you did for me. I don't know why it did work before !! the script is simple. public Transform target; public bool pass = false; public float check_distance; // Update is called once per frame void Update () { check_distance = transform.position.y - target.transform.position.y; if (check_distance <=0) { pass = true; } else { pass = false; } Debug.Log(check_distance); } I think there was a bug with the agent object !! Now i can continue my project. Thank you guys.
×