GUI inventory manage

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

ahmed

Member
Nov 11, 2021
2
0
1
23
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
 
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:
command /ú:
    trigger:
        player is {SHK}
        open virtual chest inventory with size 1 named "Death Pocket" to player
        set {_slot} to 0
        loop 9 times:
            set slot {_slot} of player's current inventory to {SHKI::%{_slot}%}
            add 1 to {_slot}

on inventory close:
    if name of player's current inventory is "Death Pocket":
        set {_slot} to 0
        loop 9 times:
            set {SHKI::%{_slot}%} to slot {_slot} of player's current inventory
            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.
 
Status
Not open for further replies.