Jump to content

Any game deep divers who delve into the code and/or make mods, What files are the player's inventory kept? Non admin


Recommended Posts

That would be the inventory component.

  • In the files you can find it in scripts\components\inventory (To get the scripts folder, go to steamapps\common\Don't Starve Together\data\databundles and extract scripts.zip to somewhere you'll have easy access to it)
  • In-game, you can reference it in the console with ThePlayer.components.inventory. For example, c_announce(ThePlayer.components.inventory:GetDebugString()) will list the items in your inventory.

But what exactly are you trying to do here?
Depending on what it is you want, you might need to use a different component. For example, stacksize is handled by the stackable component and individual item stats are usually handled by their respective components (i.e. armor component handles dmg absorption, weapon component handles dmg).

1 hour ago, Arcwell said:

That would be the inventory component.

  • In the files you can find it in scripts\components\inventory (To get the scripts folder, go to steamapps\common\Don't Starve Together\data\databundles and extract scripts.zip to somewhere you'll have easy access to it)
  • In-game, you can reference it in the console with ThePlayer.components.inventory. For example, c_announce(ThePlayer.components.inventory:GetDebugString()) will list the items in your inventory.

But what exactly are you trying to do here?
Depending on what it is you want, you might need to use a different component. For example, stacksize is handled by the stackable component and individual item stats are usually handled by their respective components (i.e. armor component handles dmg absorption, weapon component handles dmg).

I think there should be a native way for "admins" or rather, the host to be able to access inventories of other players who have been missing for a long while. 

8 minutes ago, chirsg said:

I think there should be a native way for "admins" or rather, the host to be able to access inventories of other players who have been missing for a long while. 

Unsure if that can be done with commands, but there's a finnicky workaround you can do with game files I learned from this thread.

I would recommend backing up your save file before you try this.
Open your world folder by clicking the wrench to the right of it in world select, then navigate to \Master\save\session. From there, there should be a folder with a bunch of random letters and numbers, open that, then open the next random letter/number folder inside that. 
From there, you should have some files named things like "0000000003". These are the character saves. If you open that file in a text editor, you'll get a bunch of unreadable text, but also the character's inventory data, like so:
image.png.ee7fcb8f3e92c3190dfce2b5a2ded1af.png

Once you find the inventory of the player you'd like to edit, you can copy and paste everything from inside inventory={} to the same area in the file that has your player inventory. Be aware this will overwrite everything you currently have in your inventory including equipment, so remove it all beforehand if you try this. Alternatively, you can just make a note of the items the player has and spawn them in yourself.

1 hour ago, Arcwell said:

Unsure if that can be done with commands, but there's a finnicky workaround you can do with game files I learned from this thread.

I would recommend backing up your save file before you try this.
Open your world folder by clicking the wrench to the right of it in world select, then navigate to \Master\save\session. From there, there should be a folder with a bunch of random letters and numbers, open that, then open the next random letter/number folder inside that. 
From there, you should have some files named things like "0000000003". These are the character saves. If you open that file in a text editor, you'll get a bunch of unreadable text, but also the character's inventory data, like so:
image.png.ee7fcb8f3e92c3190dfce2b5a2ded1af.png

Once you find the inventory of the player you'd like to edit, you can copy and paste everything from inside inventory={} to the same area in the file that has your player inventory. Be aware this will overwrite everything you currently have in your inventory including equipment, so remove it all beforehand if you try this. Alternatively, you can just make a note of the items the player has and spawn them in yourself.

I'm trying to understand the nature of it all in order to make a suggestion, where if a given player is logged out for enough in game hours, their inventory is subject to be placed in a container for other players to freely access.

It would be hard for me to make the suggestion if it's something that wasn't mechanically possible, but from what I gather, if klei so chose, they would be mechanically able to introduce this in game, right?

21 minutes ago, chirsg said:

I'm trying to understand the nature of it all in order to make a suggestion, where if a given player is logged out for enough in game hours, their inventory is subject to be placed in a container for other players to freely access.

It would be hard for me to make the suggestion if it's something that wasn't mechanically possible, but from what I gather, if klei so chose, they would be mechanically able to introduce this in game, right?

Yes, they could add it if they so choose, although obviously they'd need to determine when and how the feature is used.
And a mod creator could probably make one if they jumped through all the necessary hoops.

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...