Potions with inventory slots

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

lateeagle

Active Member
Jan 29, 2025
77
8
8
25
How can I add potions to inventory slots:

Slot 20 and 22

function pregameShop(p: player):
set metadata tag "pregameShopGUI" of {_p} to chest inventory with 3 rows named "&8Vote for a map!"
set slot 0 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 1 of metadata tag "pregameShopGUI" of {_p} to golden sword named "King's Sword" with sharpness 5 and unbreaking 3
set slot 2 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 3 of metadata tag "pregameShopGUI" of {_p} to diamond sword named "Diamond Sword" with sharpness 2 and unbreaking 3
set slot 4 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 5 of metadata tag "pregameShopGUI" of {_p} to iron sword named "Iron Sword" with sharpness 2 and unbreaking 3
set slot 6 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 7 of metadata tag "pregameShopGUI" of {_p} to crossbow named "Crossbow" with quick charge 3 and unbreaking 3
set slot 8 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 9 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 10 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 11 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 12 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 13 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 14 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 15 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 16 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 17 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 18 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 19 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 20 of metadata tag "pregameShopGUI" of {_p} to potion named "Potion of Swiftness"
set slot 21 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 22 of metadata tag "pregameShopGUI" of {_p} to potion named "Potion of Healing"
set slot 23 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 20 of metadata tag "pregameShopGUI" of {_p} to cooked beef named "Steak"
set slot 25 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 26 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 27 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
open (metadata tag "pregameShopGUI" of {_p}) to {_p}
 
Set it as a variable.


like:
set {swiftnesspotion} to held item of player

This is a temporary solution. You can find a better one.
 
How can I add potions to inventory slots:

Slot 20 and 22

function pregameShop(p: player):
set metadata tag "pregameShopGUI" of {_p} to chest inventory with 3 rows named "&8Vote for a map!"
set slot 0 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 1 of metadata tag "pregameShopGUI" of {_p} to golden sword named "King's Sword" with sharpness 5 and unbreaking 3
set slot 2 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 3 of metadata tag "pregameShopGUI" of {_p} to diamond sword named "Diamond Sword" with sharpness 2 and unbreaking 3
set slot 4 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 5 of metadata tag "pregameShopGUI" of {_p} to iron sword named "Iron Sword" with sharpness 2 and unbreaking 3
set slot 6 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 7 of metadata tag "pregameShopGUI" of {_p} to crossbow named "Crossbow" with quick charge 3 and unbreaking 3
set slot 8 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 9 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 10 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 11 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 12 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 13 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 14 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 15 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 16 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 17 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 18 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 19 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 20 of metadata tag "pregameShopGUI" of {_p} to potion named "Potion of Swiftness"
set slot 21 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 22 of metadata tag "pregameShopGUI" of {_p} to potion named "Potion of Healing"
set slot 23 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 20 of metadata tag "pregameShopGUI" of {_p} to cooked beef named "Steak"
set slot 25 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 26 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
set slot 27 of metadata tag "pregameShopGUI" of {_p} to black stained glass pane named " "
open (metadata tag "pregameShopGUI" of {_p}) to {_p}
Skript does not refer to potions as a derivative of the minecraft:potion item like Minecraft does. It has special aliases that you can use for each potion. If you want to see all of Skript's aliases, you can check them out here.

So all you really have to do is this:
code_language.skript:
function pre_game_shop(p: player):
    set metadata tag "pre_game_shop_gui" of {_p} to chest inventory with 3 rows named "&8Vote for a map!"
    set {_g} to metadata tag "pre_game_shop_gui" of {_p}

    # set placeholder items
    set slot (0, 2, 4, 6, (integers from 8 to 19), 21, 23, 25, 26, and 27) of {_g} to black stained glass pane named " "
  
    set slot 1 of {_g} to golden sword of sharpness 5 and unbreaking 3 named "King's Sword"
    set slot 3 of {_g} to diamond sword of sharpness 2 and unbreaking 3 named "Diamond Sword"
    set slot 5 of {_g} to iron sword of sharpness 2 and unbreaking 3 named "Iron Sword"
    set slot 7 of {_g} to crossbow of quick charge 3 and unbreaking 3 named "Crossbow"
    set slot 20 of {_g} to potion of swiftness named "Potion of Swiftness"
    set slot 22 of {_g} to potion of healing named "Potion of Healing"
    set slot 24 of {_g} to cooked beef named "Steak"

    open {_g} to {_p}

And, as you can see in the code, the syntax for adding enchantments to an item is:

Code:
# <item type> of <enchantments...>
set {example item} to dirt block of sharpness 5, efficiency 10, and quick charge 8