Im trying to make an inventory system for my Battle Royale gamemode for carrying stuff such as helmets, armors, bandages, weapons and attachments but I have no idea where to start. Any tips?
To be honest you can’t really come here and ask for tips when you aren’t exactly sure where to start. It’s easy to do, but easier to do wrong.
Never trust the client, nor let the client tell you what the server has. Do proper checks to make sure things are logical - such as a user being near an item to pick it up, or if you have inventory space make sure they can’t pick up any more items.
If you’re working with a database, store every item as a row. If you do quantity, have a quantity column to cut down on the amount of rows you’ll have. Try to keep queries to a minimum, and make sure you sanitize any input the user gives.
I suppose I should have asked this first, but what is your experience with SQL, or networking?
I have no experience whatsoever with SQL but I know how to do the networking. Also storing data using SQL wont be required as its for battle royale and once the round ends it will clear the data so I wont need any safer long term way of saving it for when players crash and leave and such.
I might check how pointshop is made and use that info to make it.
(And if im too handicapped to even get that working i suppose i can buy one from scriptfodder :P)
Per round then you just need to properly network when things are “stored” in the inventory. You can do this using a table stored on the player entity, such as ply.royaleInventory.
Then you could store it a multitude of ways from there, such as using the entity name as the key, and then have values such as quantity, durability, etc. in the table there.