|
Hi! This is a followup to the last question. I have used all of the official tutorial resources and PDF document. But, I just cant get the robot to take any damage! It will first run in place the other way from me, then when I shoot it, it doesn't die! I've tried to add a box collider and numerous things, but it just doesn't do a darn thing! Thank you! Oh yeah, here's my script:
(comments are locked)
|
The question has been closed Jul 23 '11 at 07:42 PM by Jason B for the following reason:
Too subjective and argumentative
This looks like it would be the problem. You're checking to see if(hitPoints <= 0.0) in two different parts of the code. What I copy/pasted above is the first check. When this checks and finds that you have no health left, it will return from the function and never perform the second check. Detonate will never be called. The first if avoids the enemy to die again; if hitPoints>0 it's alive and can be hit. After receiving the damage, the second if checks if this damage killed the enemy.
Jul 23 '11 at 07:25 PM
aldonaletto
(comments are locked)
|
|
so, i need help, can you please post the whole code the way it is supposed to be?!?!?!?!?!? Please do not post comments or questions as answers. @Kith has provided what looks like the correct solution; take a second to try to parse the meaning out of his string of words. If you can't figure it out, consider trying a more basic programming tutorial.
Jul 22 '11 at 08:32 PM
Chris D
seriously, please! I just need the script. I am not a very good scripter!
Jul 22 '11 at 08:34 PM
goosoodude
...@Kith has literally listed the answer; just eliminate that code. I understand you're not the greatest scripter but you've gotta think about these things if you want to improve. Otherwise you're going to be here for every problem you have.
Jul 22 '11 at 08:49 PM
Chris D
I'm sorry to burst your bubble, but I know how to move, I know a lot of things about Unity3D. Oh yeah, that was not the answer! I deleted that part of the code and it said "All compiler errors have to be fixed to enter playmode!"
Jul 22 '11 at 09:20 PM
goosoodude
You're making it very difficult for us to help you. "All compiler errors have to be fixed to enter play mode". Yes, we know this. Can you tell us what your error is? Open up your console and see what it says. I'm sorry, but unless you're willing to pay me, I'm not going to write the script for you. If you're serious about learning how to program well, you're going to have to increase your problem-solving skills. I'll be happy to point you in the right direction, but this isn't a place for you to ask people to write your code for you. So, what is the error? Because I assure you, the problem you were having before was due to that if statement you deleted.
Jul 22 '11 at 09:43 PM
Kith
(comments are locked)
|

Everything should work properly right off the bat. Have you changed anything? Try re-downloading and opening the project.
so what i do is delete the first one? in the original script or the script in the other quesiton?