I DID IT!!!!!!!!!!!!!!!!!!!!!!!!!!
If programming has taught me anything, it’s that I am an utter moron! I had a feeling the fix was going to be something stupid, because that’s how it always is. I’ll have some sort of impossible bug or issue, spend days if not weeks trying to figure it out and approaching it from the most complicated angles, only to discover in the end that the answer was stupidly simple the entire time.
So let me explain what happened here:
The way I have my save/load system set up is within the level blueprint itself and each time the player gets to the checkpoint, it takes the variables such as health/inventory/ammo etc. at that time and stores it. If you die and reload, then as soon as the map is loaded in, it checks for all those stored values and applies them to the player again.
So when it didn’t work in the shipping build, it was really confusing the hell out of me! Why was this working only in the development build?
I spent so long researching it online and spent days and days trying to implement the fixes that I found, but to no avail. I even looked for solutions while at work (when no one was looking) and printed out pages of forum posts with potential fixes to bring home. Nothing worked.
I was actually making more of a mess of things trying to apply the solutions from other people’s issues. It wasn’t until I got so frustrated that I just went through my own code again and tried to narrow it down myself.
I did checks and saw that the map that the player was on was getting saved. I then did checks and saw that the health was getting saved. So logically, it had to be something with the inventory code and not the save/load system itself, since it was saving and loading those other variables fine.
It wasn’t until by chance that I took notice of one little node that said “INVENTORY”. The reason this stuck out, was because it should have said “SAVED INVENTORY”.
What the code is essentially doing here is searching through the player’s inventory, checking if there is anything in it, and then adding it to the current player’s inventory. Except when I saw that, it dawned on me that the “INVENTORY” node was just the base default inventory, and NOT THE FUCKING INVENTORY WITH THE SAVED ITEMS!!!
I extended the correct node, connected it, compiled and like magic, it worked! So this entire time, after weeks of stress and anguish and wondering if I was going to have to rebuild the whole damn system, it all came down to this one.silly.little.oversight.
I can’t even blame the engine at all because it was doing exactly what I was telling it to do! It was loading everything from an empty inventory; which is nothing! And when I told it told load from the inventory with items; it loaded the items. Go figure! XD The reason it still worked in the development build is because I think, it was either pulling the variables from memory or somewhere else that isn’t included after the game is compiled. I’m not entirely sure, but I don’t even care now. I’m just glad it works.
I am elated and exhausted. It’s finally solved. I’ll let you guys know how the testing goes. π












Comments are closed.