Freezers (how to store the contents of a chest and restore it)

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Lummox

Member
Jan 29, 2017
28
0
1
42
I'm trying to create a script to make chests "freezers".

I used this code so that when you opening a chest called "freezer", it will automatically be filled with blocks of ice in certain slots.

code_language.skript:
options:
   congelador: chest named "Congelador"

on right click:
    if target block is a {@congelador}:
        cancel event
        open chest with 5 rows named "<grey>-- <aqua>Congelador <grey>--" to player #--- Abre un cofre de una fila ---#
        loop integers between 0 to 44:
            if loop-number is 9:
                format slot 9 of player with ice_block named "<orange>//<orange>&m-------<grey>[ <aqua>&lHielo <grey>]<orange>&m-------<orange>\\" to be unstealable
            if loop-number is 17:
                format slot 17 of player with ice_block named "<orange>//<orange>&m-------<grey>[ <aqua>&lHielo <grey>]<orange>&m-------<orange>\\" to be unstealable
            if loop-number is 18:
                format slot 18 of player with ice_block named "<orange>//<orange>&m-------<grey>[ <aqua>&lHielo <grey>]<orange>&m-------<orange>\\" to be unstealable
            else if loop-number is 20:
                format slot 20 of player with ice_block named "<orange>//<orange>&m-------<grey>[ <aqua>&lHielo <grey>]<orange>&m-------<orange>\\" to be unstealable
            else if loop-number is 24:
                format slot 24 of player with ice_block named "<orange>//<orange>&m-------<grey>[ <aqua>&lHielo <grey>]<orange>&m-------<orange>\\" to be unstealable
            else if loop-number is 26:
                format slot 26 of player with ice_block named "<orange>//<orange>&m-------<grey>[ <aqua>&lHielo <grey>]<orange>&m-------<orange>\\" to be unstealable
            else if loop-number is 27:
                format slot 27 of player with ice_block named "<orange>//<orange>&m-------<grey>[ <aqua>&lHielo <grey>]<orange>&m-------<orange>\\" to be unstealable
            else if loop-number is 28:
                format slot 28 of player with ice_block named "<orange>//<orange>&m-------<grey>[ <aqua>&lHielo <grey>]<orange>&m-------<orange>\\" to be unstealable
            else if loop-number is 29:
                format slot 29 of player with ice_block named "<orange>//<orange>&m-------<grey>[ <aqua>&lHielo <grey>]<orange>&m-------<orange>\\" to be unstealable
            else if loop-number is 30:
                format slot 30 of player with ice_block named "<orange>//<orange>&m-------<grey>[ <aqua>&lHielo <grey>]<orange>&m-------<orange>\\" to be unstealable
            else if loop-number is 31:
                format slot 31 of player with ice_block named "<orange>//<orange>&m-------<grey>[ <aqua>&lHielo <grey>]<orange>&m-------<orange>\\" to be unstealable
            else if loop-number is 32:
                format slot 32 of player with ice_block named "<orange>//<orange>&m-------<grey>[ <aqua>&lHielo <grey>]<orange>&m-------<orange>\\" to be unstealable
            else if loop-number is 33:
                format slot 33 of player with ice_block named "<orange>//<orange>&m-------<grey>[ <aqua>&lHielo <grey>]<orange>&m-------<orange>\\" to be unstealable
            else if loop-number is 34:
                format slot 34 of player with ice_block named "<orange>//<orange>&m-------<grey>[ <aqua>&lHielo <grey>]<orange>&m-------<orange>\\" to be unstealable
            else if loop-number is 35:
                format slot 35 of player with ice_block named "<orange>//<orange>&m-------<grey>[ <aqua>&lHielo <grey>]<orange>&m-------<orange>\\" to be unstealable
            else if loop-number is 36:
                format slot 36 of player with ice_block named "<orange>//<orange>&m-------<grey>[ <aqua>&lHielo <grey>]<orange>&m-------<orange>\\" to be unstealable
            else if loop-number is 37:
                format slot 37 of player with ice_block named "<orange>//<orange>&m-------<grey>[ <aqua>&lHielo <grey>]<orange>&m-------<orange>\\" to be unstealable
            else if loop-number is 38:
                format slot 38 of player with ice_block named "<orange>//<orange>&m-------<grey>[ <aqua>&lHielo <grey>]<orange>&m-------<orange>\\" to be unstealable
            else if loop-number is 39:
                format slot 39 of player with ice_block named "<orange>//<orange>&m-------<grey>[ <aqua>&lHielo <grey>]<orange>&m-------<orange>\\" to be unstealable
            else if loop-number is 40:
                format slot 40 of player with ice_block named "<orange>//<orange>&m-------<grey>[ <aqua>&lHielo <grey>]<orange>&m-------<orange>\\" to be unstealable
            else if loop-number is 41:
                format slot 41 of player with ice_block named "<orange>//<orange>&m-------<grey>[ <aqua>&lHielo <grey>]<orange>&m-------<orange>\\" to be unstealable
            else if loop-number is 42:
                format slot 42 of player with ice_block named "<orange>//<orange>&m-------<grey>[ <aqua>&lHielo <grey>]<orange>&m-------<orange>\\" to be unstealable
            else if loop-number is 43:
                format slot 43 of player with ice_block named "<orange>//<orange>&m-------<grey>[ <aqua>&lHielo <grey>]<orange>&m-------<orange>\\" to be unstealable
            else if loop-number is 44:
                format slot 44 of player with ice_block named "<orange>//<orange>&m-------<grey>[ <aqua>&lHielo <grey>]<orange>&m-------<orange>\\" to be unstealable

This part works fine, when I right click it opens the inventory with blocks of ice, and the rest of slots are empty. My problem is that I do not know how to do so that when you place objects inside the chest (inside the empty slots), they stay there once you close the chest.

As it is now, I put objects inside the chest (in empty slots), I close it ... and when I open it, they have disappeared, only see the ice blocks.

To say that blocks of ice always have to appear in the same slots and should not be able to move.

How can I do to create a list with the objects that have been put into the chest (must save the custom name the item and its lore) and restore it when the chest is opened again ?.

There will be many freezers, so you have to save the list for the specific freezer (maybe by consulting coordinates), how would you do it ?.
 
Status
Not open for further replies.