Death Item Drop Bug

OK so testing my game saving system after a few fixes, and I discover a new bug. If my player dies, drops his stuff, leaves the game scene and returns later to collect his stuff off the ground (which he dropped before his death), the stuff that is on the ground is twice the amount that he originally dropped before saving and quitting the game.

This is very similar to a bug that we fixed about 6 months ago, when I was still learning the course, and back then it turned out that “onDie.Invoke()” was called twice, resulting in an infinite loot bug back then. This time, it’s not the case.

The first time I leave my stuff, quit and return, I get twice the stuff on the ground, and everytime I load my game back up it’s just THAT twice the stuff that was initially loaded by the return to my current game save, and that’s it

Where can I start debugging this from?

Is there any chance you have two RandomDroppers on your player?

I do have a “Random Dropper.cs” script on my player, and in health.cs, there is a call for our “DropIDroppableItems()” function (which is in “Random Dropper.cs”) we created when we were making an equipment drop function, also on my player

Yes, but neither of thse should be causing item duplication.
If you’re getting doubled the things that you saved in the first place, then my first thought would be that there were TWO RandomDroppers (or another subclass of ItemDropper) somewhere on your player.

Are the duplicate items in the exact same location as the originals?

Yup, I had a second RandomDropper.cs Script hidden on my player… Apologies for the mistake :sweat_smile: (for now I’ll open a question for 2h, dual hand weapons and shields. I tried Thomas’ solution and I hate to say this, but it didn’t work for me. If not tonight, then we can give it a go whenever you’re free :laughing:)

Privacy & Terms