1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

(Help) Per player virtual chests without addons

Discussion in 'Skript' started by Edisson De la Cruz, Feb 19, 2021.

Thread Status:
Not open for further replies.
  1. Edisson De la Cruz

    Joined:
    Feb 19, 2021
    Messages:
    3
    Likes Received:
    0
    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)
     
  2. Time4Games

    Time4Games Active Member

    Joined:
    Jul 25, 2020
    Messages:
    196
    Likes Received:
    4
    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
     
  3. Edisson De la Cruz

    Joined:
    Feb 19, 2021
    Messages:
    3
    Likes Received:
    0
    Yes, it could also be useful, can you give me an example?
     
  4. Time4Games

    Time4Games Active Member

    Joined:
    Jul 25, 2020
    Messages:
    196
    Likes Received:
    4
    Code (Text):
    1. command /container <integer>:
    2.     trigger:
    3.         if arg-1 < 2:
    4.             open virtual chest inventory with size 6 named "Container %arg-1%" to player
    5.             set {_slot} to 0
    6.             loop 54 times:
    7.                 set slot {_slot} of player's current inventory to {slot.%arg-1%.%{_slot%}.%player%}
    8.                 add 1 to {_slot}
    9.            
    10.            
    11. on inventory close:
    12.     if event-inventory's display name contains "container 1":
    13.         set {_slot} to 0
    14.         loop 54 times:
    15.             set {slot.1.%{_slot}%.%player%} to slot {_slot} of event-inventory
    16.             add 1 to {_slot}
    17.  
    18. on inventory close:
    19.     if event-inventory's display name contains "container 2":
    20.         set {_slot} to 0
    21.         loop 54 times:
    22.             set {slot.2.%{_slot}%.%player%} to slot {_slot} of event-inventory
    23.             add 1 to {_slot}
     
  5. Edisson De la Cruz

    Joined:
    Feb 19, 2021
    Messages:
    3
    Likes Received:
    0
    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?
     
    #5 Edisson De la Cruz, Feb 19, 2021
    Last edited: Feb 19, 2021
Thread Status:
Not open for further replies.

Share This Page

Loading...