Hi!!
I’m trying to make a simple Fps, so I made this script ( I don’t know how to post this very well):
And I don’t know how to do so that when there are no clips remaining It doesn’t reload( It is the last thing in the script)
Can you help me???
Hi!!
I’m trying to make a simple Fps, so I made this script ( I don’t know how to post this very well):
And I don’t know how to do so that when there are no clips remaining It doesn’t reload( It is the last thing in the script)
Can you help me???
if(Clip <= 0)
{
AmmoInClip = 30;
}
}
You didn’t got the question!!
I have no ammo so I can’t Reload
Then don’t run and gun…shoot wisely.
Up the amount of clips.
Realy -,-
Rather than using clips remaining, you should have bullets remaining (unless you want to discard half full clips)
anyway…
function Reload()
{
if(Clip > 0)
{
AmmoInClip = MaxClipSize;
Debug.Log("Reload");
Clip -= 1;
}
}
Very Tankful for your help!!
Incidentally, something like this should be the code you use to control it via bullets rather than clips.
var bulletsRemaining = 30;
var MaxClipSize = 30;
var AmmoInClip = 30;
function Reload()
{
if(bulletsRemaining > 0)
{
if(AmmoInClip < maxClipSize)
{
var adding = Mathf.Clamp(maxClipSize - AmmoInClip,0, bulletsRemaining );
bulletsRemaining -= adding;
AmmoInClip += adding;
}
}
}