- Home /
Invoke problem, can't manually reload
Hello, I'm making an FPS game, (right now just working on the player/gun, etc.) and I'm having a bit of a problem. I'm trying to make it so that the player can manually reload using the R key but only if the ammo is less than 7. I tried to do the following:
//This is in the Update Function:
if(Input.GetKeyDown(KeyCode.R && AmmoLeft < 7)) {
Invoke("ManualReload", 0.5);
}
//Then in the ManualReload function:
function ManualReload() {
//All of the reloading is here in the script
}
I'm not sure where I'm going wrong with this, can anyone help?
Thanks
Comment
Best Answer
Answer by GameVortex · Dec 13, 2013 at 08:24 AM
You have put your logic for AmmoLeft < 7 as a parameter for your GetKeyDown function. That will not compile.
Just move one of the ) at the end to right after KeyCode.R:
if(Input.GetKeyDown(KeyCode.R) && AmmoLeft < 7) {
Invoke("ManualReload", 0.5);
}
Your answer
Follow this Question
Related Questions
Gun reload not working? 1 Answer
Switch Weapon Script Not taking effect HELP!! 2 Answers
How do I make an object move? 3 Answers
Reload help 1 Answer