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.

Search the Community

Showing results for tags 'enemy'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


    • Introduce yourself
    • Discussions
    • Showcase
    • Need help?
    • Seeking team members?
    • Offtopic
    • Example Projects
    • Scripts
    • Shaders
    • Unity Tutorials
    • FPS Kit Tutorials
    • 3D models
    • Animated 3D Models
    • Graphic design
    • Textures
    • Sounds
    • Other
    • Sell
    • Request
  • Mars' Modular Multiplayer Photon FPS Kit's Topics
  • Mars' Modular Multiplayer Photon FPS Kit's Reviews
  • Mars' Modular Multiplayer Photon FPS Kit's Updates
  • Mars' Modular Multiplayer Photon FPS Kit's Tutorials
  • Busy People's Introductions
  • Photon's Tutorials
  • Photon's Photon General
  • Photon's Showcase


  • Free Projects
  • Free Assets
  • Game Demos
  • Photon's Files

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL





YouTube URL

Facebook URL

Twitter URL

IndieGoGo URL

Kickstarter URL


GreenLight URL



Found 7 results

  1. Hello! This is my first post ever! I just wanted to share a simple gun script that uses C#. Probably the best script for beginners! There are two scripts, one for the gun, and one for the enemies to shoot at! Hope u like it! 1st script: using UnityEngine; public class Gun : MonoBehaviour { public float damage = 25f; public float range = 100f; public Camera fpsCam; public ParticleSystem muzzleFlash; // Update is called once per frame void Update () { if (Input.GetButtonDown("Fire1")) { Shoot(); } } void Shoot () { muzzleFlash.Play(); RaycastHit hit; if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range)) { Debug.Log(hit.transform.name); Target target = hit.transform.GetComponent<Target>(); if (target != null) { target.TakeDamage(damage); } } } } 2nd Script (Target Script) using UnityEngine; public class Target : MonoBehaviour { public float health = 50f; //what makes the damage work public void TakeDamage (float amount) { health -= amount; if (health <= 0f) { Die(); } } void Die () { Destroy(gameObject); } } There u go! those are all of the scripts! (Credit to brackeys for them.)
  2. Hi I'm trying to make enemy character who is in idle animation and when i shoot him, his body will be replace with ragdoll. Im using AU fps kit by the way. Can anyone help me please?
  3. I want to use the tactical shooter against my Player(FPSController), I had setup the scene with player and AI but it`s only shooting on me and can`t moving around so that whenever I go it follow me. I wanna make that when I shoot AI then it will take damage and when it shoot me it then I will take damage. My gun script and health script is taken from OneManArmy3d`s Au fps kit v1.5. If you want this package ask me I `ll give u. Please help me!
  4. Hello people. This is a Simple enemy Ai using Navmesh for navigation. I have written in the script, what the the different things do, so its easy enough to find out what the AI does. The only thing you need to do is to place the script on your AI. Add the (Nav Mesh Agent) component to your AI, and set the (Nav Mesh Agents) stopping distance to 2, and you are done. ////////////////////////////////////////////////////////////////////////////////////// /// /// /// /// /// AI Script Written by mikkel1265 /// /// /// /// /// ////////////////////////////////////////////////////////////////////////////////////// var Distance; var Target : Transform; var lookAtDistance = 25.0; //when the AI starts to look at the player var chaseRange = 10.0; //when the AI starts to chase the player var attackRange = 2; // when the AI stars to attack the player var moveSpeed = 4.0; var Damping = 6.0; var attackRepeatTime = 3; var TheDamage = 20; // how much damage the AI gives private var attackTime : float; var gravity : float = 20.0; function Awake() { Target = GameObject.FindWithTag("Player").transform; } function Start () { attackTime = Time.time; } function Update () { Distance = Vector3.Distance(Target.position, transform.position); if (Distance < lookAtDistance) { lookAt(); } if (Distance > lookAtDistance) { //renderer.material.color = Color.green; // if you want the AI to be green when it not can see you. } if (Distance < attackRange) { attack(); }else{ } if (Distance < chaseRange) { chase (); } } function lookAt () { //renderer.material.color = Color.yellow; //if you want the AI to be yellow when it have spottet you. var rotation = Quaternion.LookRotation(Target.position - transform.position); transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * Damping); } function chase () { this.GetComponent(NavMeshAgent).destination = gameObject.Find("Player").transform.position; //renderer.material.color = Color.red; //if you want the Ai to be red when it are chasing you. } function attack () { if (Time.time > attackTime) { Target.SendMessage("ApplyDamage", TheDamage); Debug.Log("The Enemy Has Attacked"); attackTime = Time.time + attackRepeatTime; } } function ApplyDammage () // To give a effect thet the AI have been hurt, so it lose movespeed, but it are angry at you so it want to catch you. { chaseRange += 5; moveSpeed -= 1; lookAtDistance += 5; } The AI helath/damage is in another script and thats just a simple if (health <= 0) Destroy (gameObject); script, but if in some way you want it just pm me. Its my first script i post here, so i hope you like it.
  5. This is a script I found on the Unity3D forums, slightly modified by me to work for my stuff, I did NOT create these but I thought some others might need this so, here you go. ~Have a great day Money.js EnemyHealth.js
  6. someone will have a script for the enemy patrol and if you see me (player) attack me and been trying to make one but nothing gives me many errors and I searched the net but have had no luck. support for the enemy ai I've been learning some java script, leave my script for you to see and if they find several erroes please let me know my script: # pragma strict var targetCollider: GameObject; var targetBoolean: boolean = false; var enemy: GameObject; var Attack: AnimationClip; // Deve equal the name of the animation var Idle: AnimationClip; // Idle animation var Run: AnimationClip; // animation run var speed: float = 5f; var wp1: GameObject; var wp2: GameObject; var wp3: GameObject; var WP4: GameObject; function Start () { } Update function () { if (targetBoolean == true) { Debug.log ("I see"); animation.Play ("Attack"); // remember the name of the animation as animation clip arrives } else { Debug.log ("pa where you left"); animation.Play ("Idle"); // idle animation } if (targetBoolean == false) { Enemigo.transform.position = Vector3.Lerp (Enemigo.transform.position, wp1.transform.position, Time.deltaTime * speed); } } OnTriggerEnter function (targetCollider: Collider) { targetBoolean = true; } OnTriggerExit function (targetCollider: Collider) { targetBoolean = false; }
  7. Hallo guys i am totaly new to javascript and C# but i tried making somefhing fast just to see what i have learned And so i think i should share it with you guys Player Script: static var MyHealth = 100; var MyDamage = 50; function Update () { if(MyHealth == 0) Die(); } function Die () { Destroy(this.gameObject); } function OnGUI () { GUILayout.Label("Health: " + MyHealth); } function OnTriggerEnter () { Debug.Log("KILLED ENEMY !!"); Enemy.EnemyHealth -= MyDamage; Enemy Script: #pragma strict static var EnemyHealth = 100; var EnemyDamage = 50; function Start () { } function Update () { if(EnemyHealth == 0) Destroy(this.gameObject); } function OnTriggerEnter() { damage.MyHealth -= EnemyDamage; } I know this is not the best but i tried :/
  • Create New...