Glitch

Ive stumbled upon a weird glitch where when I shoot with gun a the ammo of gun b is taken up as well as the ammo of gun a. the thing is, gun a stops shooting when its out of ammo.

Unfortunately due to the resolution of the video i am unable to read the code to see where the issue might be.
If you could post the code as a screenshot that would be helpful so we can take a closer look.
I wonder as you have diversed from the course it looks like you are using dual wield guns and so the issue is coming from there.



here are the screen shots of the ammo handler, weapon handler, and hitscan weapon scripts

Hi,

I’ve had a look and i cant really see what would be causing the issue, Its as if its confused about what ammo to use and also there seems to be a delay in the label updating as well after using the dual pistols.

If you can go to your project folder and make the entire project a zip file then upload it and let me know here when its done i can open the project at my end and see if i can figure out what is going on.
Link to upload to
Project Upload Site

Thanks in advance

ok, I filled out the form, I think you should be able to access it

the file is for windows by the way

Hi Owais,

just looked at the folder you uploaded for Marc to see if i can help.

May I ask was that exported from within the Godot editor itself?
just wondering as it appears to have the .remap filename endings that i unfortunately cannot open.

would you be able to zip up the project folder via the operating system please and re-upload as this will allow me us to open it directly in the editor.

Cheers,
Darren
( Assistant )

I’m not quite sure how to do that as its my first time trying. could you tell me how?

no worries, what you can do is go to the folder where you saved the project in.

from there you can left click to select the project folder.
then right click the folder and complress to zip file.

that should then create a zip file in the same folder, and if you could, this is the one to upload when using the form for sending the project over.

hope thats ok.

Darren

I had to alter the steps a little bit as I’m on Mac but I think everything should work, thanks

1 Like

unfortunately, that file that was uploaded was empty.

i thought it was windows sorry, but on a Mac you should be able to highlight the folder that your whole project is saved in and right click, or cmd click and compress as far as i mind

I’ve resent the whole thing but this time. I just compressed the robo rampage folder. hopefully it works this time

hi
I’ve just left the project untouched for a few days and new issues are appearing but I don’t know why, all I did was the exporting and the screenshots. I can’t even run the game anymore

I’ve almost managed to reput together a project as it was missing the project file.

If I can figure out what’s going on tonight I’ll upload the project so you can use it.

Fingers crossed

Thank you so much! Hopefully you can figure what this mystery bug is :sob:

its the secondary dual wield as Marc thought.
It looks like due to it being pasted in as a child it also has its own script.

So when switching weapons, it sets the main weapon to not fire (not sure why the child’s process isn’t inheriting, it is inheriting its visibility tho) but not its secondary child.
That’s where the main confusion lies.

So the child weapon is still firing and using up ammo no matter what weapon is selected.

I’m going to test when equipping, I wonder if we can just equip 2 of them rather than having a parent child going on as that gives an extra hassle of figuring out how to get the muzzle particles firing on a child.

1 Like

Ive managed to get it working to an extent. so heres what i ended up doing.

in the below image, heres the scene tree layout, what i did was copy one of the other weapons as per course.
instead of having two guns in the main scene, in the dual weapons ive got one of the model sets, as a child of the other…
that way, we only have to assign one model in the inspector and all the recol movements cover the parent, and therefore the child.

the other thing that was bothering me was the muzzle flash, so ive duplicated a second in the scene and placed it where it needs to be on other gun barrel position.

in the dual pistol scene, or just by editing the hitscan weapon script, ive added a muzzle flash 2 export variable.
then in the dual weapons scene, you can drag and drop or assign in the second muzzle slot in the inspector.

and then in the shoot() function we restart the muzzle flash we have already, but additionally shown here in line 41 and 42, if the second muzzle flash is not null then restart it as well. gets around having one or two of them

image

ive also changed a few of the transforms, just to tidy the raycasting up a little as it was off centre. but should be ok from what i can see.

ive uploaded the project folder to my google drive to share, so you can hopefully grab it from there.

https://drive.google.com/drive/folders/1QFUWsL-4eoffJ422QMDXu43j9G16SYP6?usp=sharing

hope that allows you to carry on with the course.

Darren

Really sorry to bother you AGAIN but whenever I try to import the zip file, I keep getting an error message saying: “sandbox.tscn can’t be found. it might’ve been deleted or moved”

many thanks
dean

Sorry, clean forgot it’s downloaded as a zip.

That has the entire project. No need to import into godot.

In windows , if you just unzip to a new folder, then you can run the project in it

THANK YOU SO MUCH I was gonna restart the whole course! Everything is working perfectly now! Took a month to fix but we got there in the end :skull:

1 Like

Privacy & Terms