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 'damage'.

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 8 results

  1. hi,I wanted to know that how can I create an damage Indicator in Unity 3D ? I went very search, but I did not find anything! If the code is so much better.
  2. Here is the code of Health Script of my Player and the name of my player health script is HealthingScript my AU_FPS Kitv1.5 and another code is of my AI`s bullet script. I don`t know how to receive Damage from AI, Please help me I want to upload my #1 Fps update on Youtube. My player tag is "Player" function PlayerDamage (damage : int) { if (hitPoints < 0.0) return; hitPoints -= damage; aSource.PlayOneShot(painSound, 1.0); t = 2.0; if (hitPoints <= 0.0) Die(); } using UnityEngine; using System.Collections; /* * Moves an object until it hits a target, at which time it calls the Damage(float) method on all scripts on the hit object * Can also home in on targets and "detonate" when in close proximity. * */ namespace TacticalAI { public class BulletScript : MonoBehaviour { public string damageMethodName = "Damage"; public float speed = 1000; public LayerMask layerMask; public float maxLifeTime = 3; //Bullet Stuff public float damage = 16; //use for shotguns public float bulletForce = 100; //Hit Effects public GameObject hitEffect; public float hitEffectDestroyTime = 1; public string hitEffectTag = "HitBox"; public GameObject missEffect; public float missEffectDestroyTime = 1; public float timeToDestroyAfterHitting = 0.5f; private RaycastHit hit; private Transform myTransform; //Rotation private Quaternion targetRotation; private Transform target = null; public float homingTrackingSpeed = 3; public float minDistToDetonate = 0.5f; private float minDistToDetonateSqr; public string friendlyTag; void Awake() { myTransform = transform; Move(); StartCoroutine(SetTimeToDestroy()); } //Automatically destroy the bullet after a certain amount of time //Especially useful for missiles, which may end up flying endless circles around their target, //long after the appropriate sound effects have ended. IEnumerator SetTimeToDestroy() { yield return new WaitForSeconds(maxLifeTime); if (target) { Instantiate(hitEffect, myTransform.position, myTransform.rotation); } Destroy(gameObject); } IEnumerator ApplyDamage() { //Reduce the enemy's health //Does NOT travel up the heirarchy. if (hit.transform.tag != friendlyTag) { Uncomment for RFPS if (hit.collider.gameObject.GetComponent<FPSPlayer>()) { hit.collider.gameObject.GetComponent<FPSPlayer>().ApplyDamage(damage); } hit.collider.SendMessage(damageMethodName, damage, SendMessageOptions.DontRequireReceiver); } //Produce the appropriate special effect if (hit.transform.tag == hitEffectTag && hitEffect) { GameObject currentHitEffect = (GameObject)(Instantiate(hitEffect, hit.point, myTransform.rotation)); GameObject.Destroy(currentHitEffect, hitEffectDestroyTime); } else if (missEffect) { GameObject currentMissEffect = (GameObject)(Instantiate(missEffect, hit.point + hit.normal * 0.01f, Quaternion.LookRotation(hit.normal))); GameObject.Destroy(currentMissEffect, missEffectDestroyTime); } this.enabled = false; yield return null; //Wait a fram to apply forces as we need to make sure the thing is dead if (hit.rigidbody) hit.rigidbody.AddForceAtPosition(myTransform.forward * bulletForce, hit.point, ForceMode.Impulse); //Linger around for a while to let the trail renderer dissipate (if the bullet has one.) Destroy(gameObject, timeToDestroyAfterHitting); } // Update is called once per frame void Update() { Move(); } //Move is a seperate method as the bullet must move IMMEDIATELY. //If it does not, the shooter may literally outrun the bullet-momentarily. //If the shooter passes the bullet, the bullet will then start moving and hit the shooter in the back. //That would not be good. void Move() { //Check to see if we're going to hit anything. If so, move right to it and deal damage if (Physics.Raycast(myTransform.position, myTransform.forward, out hit, speed * Time.deltaTime, layerMask.value)) { myTransform.position = hit.point; StartCoroutine(ApplyDamage()); } else { //Move the bullet forwards transform.Translate(Vector3.forward * Time.deltaTime * speed); } //Home in on the target if (target != null) { //Firgure out the rotation required to move directly towards the target targetRotation = Quaternion.LookRotation(target.position - transform.position); //Smoothly rotate to face the target over several frames. The slower the rotation, the easier it is to dodg. transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, homingTrackingSpeed * Time.deltaTime); Debug.DrawRay(transform.position, (target.position - transform.position).normalized * minDistToDetonate,Color.red); //Projectile will "detonate" upon getting close enough to the target.. if (Vector3.SqrMagnitude(target.position - transform.position) < minDistToDetonateSqr) { //The hitEffect should be your explosion. Instantiate(hitEffect, myTransform.position, myTransform.rotation); GameObject.Destroy(gameObject); } } } //To avoid costly SqrRoot in Vector3.Distance public void SetDistToDetonate(float x) { minDistToDetonateSqr = x * x; } //Call this method upon instantating the bullet in order to make it home in on a target. public void SetAsHoming(Transform t) { target = t; SetDistToDetonate(minDistToDetonate); } } } in code there is word(FPSPlayer) i don`t what is that? How to give damage to player? Any help and answer is appreciated here. Thanks
  3. I need some help with player damage script. I use AU FPS kit and i would like to make so that zombie that i added does damage to player. Any ideas on how to do that?
  4. Hi guys! Surfing on the web I found this video about the fall damage. Video:
  5. 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 :/
  6. Im trying to use the progress bar script from unity3d third person shooter tutorial in the Oma Fps Kit 1.3.5 to replace the health text. I want the script to change the health bar when the "PlayerDamageNew" script takes damage instead of "HealthController". Thanks, Heres the Progress bar script: using UnityEngine; using System.Collections; public class ProgressBar : MonoBehaviour { public HealthController lthealthController; public Texture foregroundTexture; public Texture backgroundTexture; public Texture2D damageTexture; public bool rightSide = false; void OnGUI () { // Make rect 10 pixels from side edge and 6 pixels from top. Rect rect = new Rect(10, 6, Screen.width/2-10-40, backgroundTexture.height); // If this is a right side health bar, flip the rect. if (rightSide) { rect.x = Screen.width - rect.x; rect.width = -rect.width; } // Draw the background texture GUI.DrawTexture(rect, backgroundTexture); float health = healthController.normalizedHealth; // Multiply width with health before drawing the foreground texture rect.width *= health; // Get color from damage texture GUI.color = damageTexture.GetPixelBilinear(health, 0.5f); // Draw the foreground texture GUI.DrawTexture(rect, foregroundTexture); // Reset GUI color. GUI.color = Color.white; } }
  7. Before we get started here are a few things that you will need - A GameObject to receive damage (Soldier) [You can use the Bootcamp soldier] - A Ragdoll of said GameObject [There is a free Bootcamp soldier ragdoll on this site] If you have seen this script here http://armedunity.com/topic/5598-player-falls-and-turns-to-rag-doll-effect-js/?hl=ragdoll And are some form of a newbie and don't know how to input this into a damage script, I did it for you guys. It works perfectly, just fill in the appropriate slots in the inspector with what the script tells you, set up the max health and everything should work just fine for you. It also doubles as just a normal damage script if you don't own or know how to create a ragdoll. I am experimenting on using rigidbodies on the objects that will be destroyed as it looks better, so in the future the script may be changed to also set the ragdoll to a rigidbody to show force better. Of course half of the credit goes out to yellowflashxd for creating the actual ragdoll script. Also a thanks goes out to lego for helping with some bug fixing. It works best if there is a rigidbody on the ragdoll and a collider on the actual soldier player. Code: var MaxHealth : int = 100; var CurrentHealth : int; var MinHealth : int = 0; var currentSpeed : float; var lastPosition : Vector3 = Vector3.zero; var Soldier : GameObject; var Ragdoll : GameObject; //var Other : GameObject; function Start () { CurrentHealth = MaxHealth; } function Update () { if (CurrentHealth == 0) { currentSpeed = transform.position.y - lastPosition.y; lastPosition.y = transform.position.y; if(currentSpeed < -0.3) { var Ragdoll = Instantiate(Ragdoll, transform.position, transform.rotation); //Instantiate(Ragdoll,Ragdoll.transform.position,Soldier.transform.rotation); Destroy(Soldier); } } } function ApplyDamage (Damage : float) { if(CurrentHealth < 0) { CurrentHealth = MinHealth; //return; } CurrentHealth -= Damage; }
  8. I'm working with the fps kit v2...and I dont have any idea about how to do a damage user interface! Thing is, when an enemy shoots at me, I got damaged, but how can I show the damage direction? Any ideas?! there are many fps games that have that! Is that possible? Here is an image that I first found on google, to show you what i'm talking about: (I want to make that thing up there showing where does the damage come from) Thanks guys!
  • Create New...