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
1
Question by hugemaggot · Dec 04, 2010 at 06:08 PM · enemy

how to kill an enemy

when i shoot my enemy i want it to dissapear. ive already tried using the characterdamage script which the fps tutorial says to use but it dosent work, so can anyone tell me if there's any other way of doing this?

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by oliver-jones · Dec 04, 2010 at 06:35 PM

Well this depends on a lot of factors in your game. Such as what are you using to kill the enemy? If you are using a gun, then you need to send negative hitpoints from you gun, to your enemy. And in your enemy you want something like this:

if (hitpoints <= 0){
Destroy(gameObject);
}

The FPS destroy emeny should work, but you havnt given me a lot of info to work from. Its your gun that sends the enemy negative hitpoints.

Comment
Add comment · Show 5 · 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 hugemaggot · Dec 05, 2010 at 02:17 PM 0
Share

how do i change the amount hitpoints my gun will take off my enemy?

avatar image oliver-jones · Dec 05, 2010 at 03:31 PM 0
Share

Well, like I said, I cannot really help you unless you post your scripts that you are using.

avatar image hugemaggot · Dec 06, 2010 at 09:33 PM 0
Share

the only script im using is the character damage script which is:

var hitPoints = 100.0; var deadReplacement : Transform; var dieSound : AudioClip;

function ApplyDamage (damage : float) { // We already have less than 0 hitpoints, maybe we got killed already? if (hitPoints <= 0){ Destroy(gameObject); } hitPoints -= damage; if (hitPoints <= 0.0) { Detonate(); } }

function Detonate () { // Destroy ourselves Destroy(gameObject);

 // Play a dying audio clip
 if (dieSound)
     AudioSource.PlayClipAtPoint(dieSound, transform.position);

 // Replace ourselves with the dead body
 if (
avatar image insanamon · Jul 09, 2011 at 04:17 AM 0
Share

what about your gun's scripts???

avatar image Dreamblur · Jul 09, 2011 at 04:45 AM 0
Share

@insanamon Please don't necropost an abandoned question asking for clarification about the original question. Common sense should dictate that it was abandoned for a reason.

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

2 People are following this question.

avatar image avatar image

Related Questions

Trap Door Question 1 Answer

Damaging enemies... 1 Answer

Enemy Health Help 1 Answer

How to make enemy tp to you after 45 sec.? 1 Answer

Destroying Enemy Help 5 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