Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by otepralloma5 · Aug 31, 2013 at 07:45 AM · hudhphealth

How do you create a Deus Ex Health System?

How do you create a health system like the one in Deus Ex? Except with more body parts. Here's the total:

Upper Head(Cranium); Lower Head(Jaw); Spinal Cord; Neck; Chest; Stomach; Upper Back; Lower Back; Shoulder; Arm; Elbow; Forearm; Wrist; Hand; Groin; Thigh; Knee; Leg; Ankle; Foot

Anyway, if anyone decides to help, thanks in advance.

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image getyour411 · Aug 31, 2013 at 09:01 AM 0
Share

Not familiar with it - would you need to real-time check for collisions against each body part with a weapon or just select a target region and then apply damage?

avatar image otepralloma5 · Aug 31, 2013 at 12:38 PM 0
Share

I don't know. That's why I'm asking. I actually don't have Unity yet, because I don't have a comp and the Internet Cafes here are too slow, but I'm trying to learn. But since I don't have Unity, I can't learn from experience, so this is the next best thing besides tutorials.

avatar image donnysobonny · Aug 31, 2013 at 12:53 PM 0
Share

Not trying to put a downer on your intentions, however with your current level of experience, something to this sort of complexity might be slightly to advanced.

What you're looking to is entirely possibly within Unity, using the suggestion made by getyour411. However I would personally recommend that when you do manage to get a copy of Unity, that you work your way through the countless number of tutorials out there, offering examples of how to make a simple game from scratch.

After a few tutorials you will probably be able to answer this simple question yourself. ;-)

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by save · Aug 31, 2013 at 01:48 PM

One way to do it is to create a Body- and a BodyPart class. The Body class holds information about each body part where you would assign each element to its corresponding part.

To give you an idea of the concept, the class would look something like this:

 class Body {
     var health : float = 100;
     var minHealth : float = 0;
     var maxHealth : float = 100;
 
     var head : BodyPart;
     var chest : BodyPart;
     var armLeft : BodyPart;
     var armRight : BodyPart;
     var legLeft : BodyPart;
     var legRight : BodyPart;
     // etc...
 }
 
 class BodyPart {
     var collider : Collider;
     var health : float = 100;
 }

Changing the main health of a body object would look something like this:

 function AlterHealth (healthChange : float, body : Body) {
     // Additively alter the health of passed body
     body.health = Mathf.Clamp(body.health+healthChange, body.minHealth, body.maxHealth);
 }

Creating a body object with these abilities would look like this: var body : Body = new Body();

Each part of the body would have a collider which you assign to the body object. You would want to catch collisions with a body part collider, preferably with a script which sends information to the main body script. Something like this:

 var thisBody : BodyScript; // The main Body Script of this object
 
 function OnCollisionEnter (collision : Collision) {
     if (collision.collider.CompareTag("Collidable Object")) {
         BodyScript.AlterBodyPartHealth(thisBody.body, collider, collision.relativeVelocity.magnitude);
     }
 }

Where the BodyScript would have a function, AlterBodyPartHealth, which receives the part and handles it correspondingly to the body object.

 static function AlterBodyPartHealth (body : Body, col : Collider, healthChange : float) {
     
     // Main health change for non-vital limbs
     var mainHealthChange : float = healthChange*.25;
     
     // Additively alter the health of passed body's body part and change the mainHealthChange for vital body parts
     switch (col) {
         case body.head.collider: body.head.health -= healthChange; mainHealthChange*=4; break;
         case body.chest.collider: body.chest.health -= healthChange; mainHealthChange*=2; break;
         case body.armLeft.collider: body.armLeft.health -= healthChange; break;
         case body.armRight.collider: body.armRight.health -= healthChange; break;
         case body.legLeft.collider: body.legLeft.health -= healthChange; break;
         case body.legRight.collider: body.legRight.health -= healthChange; break;
     }
     
     // Alter the main health as well
     AlterHealth(mainHealthChange, body);
     body.health = Mathf.Clamp(body.health+healthChange, body.minHealth, body.maxHealth);
 }


I strongly suggest to start with something easier and work your way through understanding of the built-in classes and their correlation before you tackle something like this. There's a lot around this as well, handling collisions the correct way is just one tricky part to become friends with at first - as well as creating the skinned mesh avatar.

For more information about how you solve the GUI to this, please see the GUI Scripting Guide and ask another question if you have trouble when you're there and we'll help you through it.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image otepralloma5 · Aug 31, 2013 at 01:54 PM 0
Share

Thank you.

avatar image
0

Answer by fherbst · Aug 31, 2013 at 01:00 PM

Basic concept: Each body part has its own health and collision detection. Additionally, there is some general handler to manage them(resetting, healing etc.). Collision might mean bullets, swords, or just clicking. But you have to think about getyour411's comment, that's not a matter of implementation but of game design (how does the principle work, independent of Unity).

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

21 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Adding fall damage with the default FPSWalker 1 Answer

Making an HUD 3 Answers

C# issue, health, and destroying affect other objects. 3 Answers

Health Bar Division like in MOBA 1 Answer

Player Health Goes Down Too Fast/Too Much 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges