Ammo pickups body_entered signal not working




im not sure why the body_entered signal isnt working, ive changed the collision layer, deleted and added the player group but nothing is working.

Your first two errors look like broken references (incorrect nodepaths maybe?), and the third one suggests a type mismatch.

I can’t be certain this will help as I haven’t reached this part of the course yet, but when I did something similar in some extensions I made to Barbarian Blaster, I found that body (in your example) was referring to the CollisionShape itself instead of the actual parent. That, however, was area-to-area collision, not area-to-body.

You could try body.get_parent() and see if that works - no guarantee that it will, as my case was different, and it would be a good idea to use some print() statements to see exactly what’s being retrieved.

You can also try temporarily removing the strong typing from the function definition body: CharacterBody3D, as that will probably give you a more descriptive error when it fails. Hopefully one of those things will be helpful.

2 Likes

thanks but none of that worked, I might just give my character a bunch of ammo :skull:

As @BH67 has suggested the first two errors relate to the nodepaths not being correct as its looking for the AnimationPlayer inside the fps_pistol for the dual_pistols but the screenshot shots it being under the pistol not dual pistols.
I assume the same issue is going to be true for the second error.

The third without seeing the signal call it looks like again BH67 is correct in that you are using a collisionshape which is using the wrong signal type.

The help we can provide is a little limited as it detracts from the course content with the errors all relating to the dual pistols but i would be looking at where you are getting the references in relation to where they actually are/what you actually are getting.

Hope this helps

2 Likes

thankfully the first two errors don’t affect the game at all since i disabled the ability to switch weapons, ill try change the collision shape, thanks

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms