Jump to content
Spyler.X

continuous game and doubt of performance.

Recommended Posts

Hi

I'm starting to work on a game, and I was wondering if there is a simple way to keep the player's inventory, to always have that information in our game.

I see two ways of doing it but I do not know which works best.


One is to generate an inventory for each one, and when the player disconnects, the inventory is saved until it is reconnected, obviously this is giving me problems because it involves a lot of complicated logic for me. But it is a way to eliminate the player from the game without losing inventory.

The other way I can think is to keep players disconnected in a room, it's easier, but I'm not sure if it would affect performance.

I also thought that maybe eliminating the player does not eliminate their inventory, but I've had problems with that in the past, so I'm not sure it's the best option.

Share this post


Link to post
Share on other sites

The easiest way I can imagine doing this would be when a player triggers the action via dying, disconnecting, saving or etc.

Create a man npc and attach it to label "player save". Then run a script that saves the inventory using an array and giving it to a new npc and giving it the same name as player.

Once a player joins the game make the trigger search for each entity within the label "player save". If the string names match for both the npc and the player give NPC items to player and delete NPC.

Share this post


Link to post
Share on other sites

Here ya go my dude.

If you have questions, let me know.

Entity Label.png

NPC Template.png

Spawn Point.png

Trigger Zone Save.png

Edit: "Set Counter" is a Local Variable I added to the script.

Edit 1: Set for "Spawn Point 1"    ->  REPEAT TIMES GET LENGTH Array GET LABELS Game Logic #4: Player Save Label

Edited by Igor Quintero
  • Thanks 1

Share this post


Link to post
Share on other sites

Thank you very much @Igor Quintero,  I'm going to put on that, I can make my system follow that path, but I think I'll start again to not complicatexD

Share this post


Link to post
Share on other sites

Just remember though, as of this moment all multiplayer games that you load and save will store player information and items into a temp save file. Which means you technically don't need this code since it already includes an "save and auto load" for all characters (UNLESS you start a new session of the game, which also makes the previous code obsolete)
 

  • Thanks 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×