(Help) Per player virtual chests without addons

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

ililedie

New Member
Feb 19, 2021
7
0
1
I am trying to create a virtual chest system. The idea is that users can open at least 3 containers using /container 1, 2, 3, and that the stored items do not disappear on restart. Yes, it is a kind of virtual chests. I would like you to give me an example code, (preferably without addons) it will serve me in the future, I am using Skript 2.5.3 on a minecraft 1.16.4 server, it works fine. (Note: to the first answer to this post I will give a code that I made)
 
if you want i can send how to make one using tuske so you will get the idea and then you could make it without addons
 
Code:
command /container <integer>:
    trigger:
        if arg-1 < 2:
            open virtual chest inventory with size 6 named "Container %arg-1%" to player
            set {_slot} to 0
            loop 54 times:
                set slot {_slot} of player's current inventory to {slot.%arg-1%.%{_slot%}.%player%} 
                add 1 to {_slot}
            
            
on inventory close:
    if event-inventory's display name contains "container 1":
        set {_slot} to 0
        loop 54 times:
            set {slot.1.%{_slot}%.%player%} to slot {_slot} of event-inventory
            add 1 to {_slot}

on inventory close:
    if event-inventory's display name contains "container 2":
        set {_slot} to 0
        loop 54 times:
            set {slot.2.%{_slot}%.%player%} to slot {_slot} of event-inventory
            add 1 to {_slot}
 
It works fine, if I had done it on my own it would have taken at least a week. What if I wanted to lock an item, to serve as a button that changes from container to the next? how would i do?
Also, how do I remove the content of the variable?
 
Last edited:
Status
Not open for further replies.