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.

GUI inventory manage

Discussion in 'Skript' started by ahmed, Nov 16, 2021.

  1. ahmed

    ahmed Member

    Joined:
    Nov 11, 2021
    Messages:
    2
    Likes Received:
    0
    Hey So i wanted to make an inventory manage commands so it open a Gui and the Guy Just like put his sword in slot 3 and when he die the sword came in slot 3 and never come at 1
     
  2. Allan Noyd

    Allan Noyd Member

    Joined:
    Apr 29, 2021
    Messages:
    33
    Likes Received:
    0
    At first, I would start with something like this. It's a snippet of code for my off brand origins mod, specifically the Shulk. What it does is it opens an inventory for the player to put items in, like post-mortem chest/ keep inventory.
    Code (Text):
    1. command /ú:
    2.     trigger:
    3.         player is {SHK}
    4.         open virtual chest inventory with size 1 named "Death Pocket" to player
    5.         set {_slot} to 0
    6.         loop 9 times:
    7.             set slot {_slot} of player's current inventory to {SHKI::%{_slot}%}
    8.             add 1 to {_slot}
    9.  
    10. on inventory close:
    11.     if name of player's current inventory is "Death Pocket":
    12.         set {_slot} to 0
    13.         loop 9 times:
    14.             set {SHKI::%{_slot}%} to slot {_slot} of player's current inventory
    15.             add 1 to {_slot}
    You can leave out the "player is {SHK}" part tho, that is to validate if player is the shulk in the first place- something you don't worry about since I recon you want the thing for everyone.
    Next you'll probably want to somehow link the "on pick up:" event to this GUI for it to filter the items into specific slots, but I would lie to you if I said that I can help you with that. You could try comparing picked up items with every slot of GUI until you find a match and putting it into the coresponding slot number.
    Hope I helped with something at least.
     

Share This Page

Loading...