Alright i have two different weapons at the moment, a single shot, and a triple shot. Now i have the 3-way shot set as a power-up. So if i get to the power-up, i got to shoot 3 bullets at once, over just one. That part works, but I want it so that after i get the power-up, it will automatically make it so i can switch from single shot to triple shot at the push of a button (1 and 2). Here is how i thought about doing it, but it doesn't seem to work.
function Update () {
if(Input.GetKeyDown("1")) {
var weapon = 1;
}
if (weapon == 1 ) {
if(Input.GetButtonDown("Fire1"))
{
The actual code is quite a bit longer so i only grabbed the parts that pretain to it. Also, the if (weapon == 1) part IS in the update function. Now the actual problem with this script is that when i press 1, it seems it does nothing, but if i repeatedly press 1 and fire at the same time, i will randomly shoot 3 amidst lots of single shots. So more or less i want it so it is a toggle. I want it so when weapon is set to 1 it will stay 1 till i click something different.
Lastly, after the checking what weapon is part i have it making the bullets, adding force, and adding random rotation to make them spread. I also have taken a look at the FPS tutorial but it makes no sense to me how they did it.