Load/Save Issue Created 7 years ago2016-05-19 15:02:28 UTC by Half-Rats Half-Rats

Created 7 years ago2016-05-19 15:02:28 UTC by Half-Rats Half-Rats

Posted 7 years ago2016-05-19 15:02:28 UTC Post #330160
Anyone have any background with code? We have a somewhat unique inventory system which allows for real-time use, as well as a money/shop system. Well, when you load a save, all of your inventory items disappear, as well as all your cash, AND one of the weapons' sounds stop working correctly, if at all.

What is this likely caused by?

I'm guessing you'd need to know more of the particulars of how our code works, but I've got my fingers crossed at the moment.
Posted 7 years ago2016-05-19 15:19:33 UTC Post #330161
Your programmer forgot to add the variables into the save table.

Assuming the player's cash is stored in a variable called "m_iCash" in the "CBasePlayer" class. Your programmer will need to add the following line in the "m_playerSaveData" TYPEDESCRIPTION array (in the beginning of "player.cpp") :

DEFINE_FIELD( CBasePlayer, m_iCash, FIELD_INTEGER ),

As for the items, I would recommend to use the "m_rgItems" variable in the "CBasePlayer" class, it's an "int" array. Ask your programmer to look for "ITEM_ANTIDOTE" as an example and make sure he don't forget to change if necessary the "MAX_ITEMS" constant (otherwise it will be infinite boose, drugs...). The "m_rgItems" is already saved so no need to add to the save table.
Posted 7 years ago2016-05-19 16:35:46 UTC Post #330162
Ahhh, alright. Thanks! I relayed the info. He's never done anything like this before.
Posted 7 years ago2016-05-20 03:33:23 UTC Post #330163
The issue has been resolved! Thank you for your help. Looks like we got a demo to release soon!
You must be logged in to post a response.