|
Okay, so I am relativity new to scripting in Unity3d but not new to the program its self. I have a shoot script that I am having some difficulties with. If you apply the script to the first person controller (along with another script I will include), everything works as it is supposed to. Except for the fact that you can't reload until you run out of ammo(this includes that you can't reload when you have ammo left). When you run out of ammo you can reload just fine, even when you have ammo left. Once you run out of ammo the first time, you get a label that says "RELOAD". This label won't go away at all, not even once you have reloaded("r"). I found that those two things were a problem, and I have worked to my best efforts to try and figure them out. Some help would be greatly appreciated. If something didn't make sense, please tell me and I will try to explain it more clearly. Thanks! Scripts: Firearm: PlayerHealth(Make sure the script is called this): var fireRate : float = 0.3; private var nextFire : float = 2.0; var Ammo : int = 30; var gunfire : AudioClip; var reload : AudioClip; var empty : boolean = false; var Projectile : Transform;
(comments are locked)
|
|
empty, once set to true, is never set back to false on reload. Right so how do I make it set back to false once I reload?
Feb 23 '12 at 03:08 AM
Major
add empty = false; in Reload function.
Feb 23 '12 at 03:18 AM
Berenger
Okay I will thanks!
Feb 23 '12 at 03:52 AM
Major
I got an error. I put empty=false; at the end of the function that was in the brakets, is there another spot that i'm supposed to put it?
Feb 24 '12 at 04:43 AM
Major
I edited your script. The edit on this website takes a few hours for some reasons, you should see it tomorrow.
Feb 24 '12 at 05:06 AM
Berenger
(comments are locked)
|
