#saving inventory

1 messages · Page 1 of 1 (latest)

cold portal
#

how to save inventory cordinates and maybe tags.

open sparrow
cold portal
#

player cordinates

#

and player tags

simple snow
#

where do you want to save these values?

cold portal
#

uhh idk in some dynamicproperty i just need like 2 functions
save and load

open sparrow
#
player.setDynamicProperty("propertyName", JSON.stringify(object)) // Save
let data = JSON.parse(player.getDynamicProperty("propertyName")) // Load
cold portal
#

but i do i put items in the inventory(with properties)

open sparrow
#

what items? You first say that you need to save the inventory location, then you need the player location and then some items

cold portal
#

the whole invitenory with items

open sparrow
#

do you need to save inventory to dynamic properties?

tribal comet
#

If you want to actually save the items with their data and properties (shulker boxes, books, etc) then you need to copy or move them from the player's inventory into a block with an inventory and then save that as a structure and remove it from the world. You can store the structure IDs in a dynamic property.

honest epoch
#

If I use getItem() won’t it lose their data?

open sparrow
open sparrow
honest epoch
#

Ty

honest epoch
tribal comet