Storable Inventory

  • 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!

code_language.skript:
command /vault:
    trigger:
        create a gui with virtual chest with size 6 named "Vault":
            run when close:
                set {list.variable::*} to all items of gui-inventory
        open last created gui to player
        set {_x} to 0
        loop {list.variable::*}:
            set slot {_x} of player's current inventory to loop-value
            add 1 to {_x}

If you are going for something like playervaults or such, use this syntax with Tuske
 
code_language.skript:
command /vault:
    trigger:
        create a gui with virtual chest with size 6 named "Vault":
            run when close:
                set {list.variable::*} to all items of gui-inventory
        open last created gui to player
        set {_x} to 0
        loop {list.variable::*}:
            set slot {_x} of player's current inventory to loop-value
            add 1 to {_x}

If you are going for something like playervaults or such, use this syntax with Tuske
It doesn't work it says "create a gui with virtual chest with size 6 named "" is not a boolean (yes/no) (vault.sk, line 16: create a gui with virtual chest with size 6 named "":') 'last created gui' is not an entity type (vault.sk, line 19: open last created gui to player')"
 
code_language.skript:
#the code to open the chest
open chest with 6 row named "virtual chest" to player
{chest.%player%::0} is set:
    loop {chest.%player%::*}:
        set slot "%loop-index%" parsed as integer of current inventory of player to loop-value

#the code to save the chest
on inventory close:
    inventory name of current inventory of player is "virtual chest"
    set {_counter} to 0
    loop 54 times:
        set {chest.%player%::%{_counter}%} to slot {_counter} of player's current inventory
        add 1 to {_counter}

If I remember correctly, you need SkQuery for inventory names and to open chests. Skellett has an option too, I think.
 
code_language.skript:
#the code to open the chest
open chest with 6 row named "virtual chest" to player
{chest.%player%::0} is set:
    loop {chest.%player%::*}:
        set slot "%loop-index%" parsed as integer of current inventory of player to loop-value

#the code to save the chest
on inventory close:
    inventory name of current inventory of player is "virtual chest"
    set {_counter} to 0
    loop 54 times:
        set {chest.%player%::%{_counter}%} to slot {_counter} of current inventory of player
        add 1 to {_counter}

If I remember correctly, you need SkQuery for inventory names and to open chests. Skellett has an option too, I think.
It cant understand event loop {chest.%player%::*}:
 
He means to put the part of the code he gave under vault command or something.
I did

command /stanvault <player>:
permission: vault.create
description: opens a standard vault
trigger:
open chest with 6 row named "virtual chest" to player
{chest.%player%::0} is set:
loop {chest.%player%::*}:
set slot "%loop-index%" parsed as integer of current inventory of player to loop-value

#the code to save the chest
on inventory close:
inventory name of current inventory of player is "virtual chest"
set {_counter} to 0
loop 54 times:
set {chest.%player%::%{_counter}%} to slot {_counter} of player's current inventory
add 1 to {_counter}
 
How would I create a Storable Inventory so I can store and remove items like a echest?
Sorry for late response but here is a code that replaces Essentials echest

code_language.skript:
command /echest:
    trigger:
        create a gui with virtual chest with size 4 named "Echest":
            run when close:
                delete {echest::%player's uuid%::*}
                set {echest::%player's uuid%::*} to all items of gui-inventory
        open last created gui to player
        set {_x} to 0
        loop {echest::%player's uuid%::*}:
            set slot {_x} of player's current inventory to loop-value
            add 1 to {_x}
 
I did

command /stanvault <player>:
permission: vault.create
description: opens a standard vault
trigger:
open chest with 6 row named "virtual chest" to player
{chest.%player%::0} is set:
loop {chest.%player%::*}:
set slot "%loop-index%" parsed as integer of current inventory of player to loop-value

#the code to save the chest
on inventory close:
inventory name of current inventory of player is "virtual chest"
set {_counter} to 0
loop 54 times:
set {chest.%player%::%{_counter}%} to slot {_counter} of player's current inventory
add 1 to {_counter}
Use the code format so I can see tabulations and stuff, please. Also, post the exact error it gives you on reload.