Solved I want to make a GUI Store

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

Danic

Member
Jul 23, 2020
42
0
6
Korea
www.youtube.com
I would like to build a store system utilizing the script's GUI functionality and Entity functionality.
I had a high degree of maturity for my first project. but I found one problem, which is difficult to find and solve it with my lack of skill.
Below are construction of my project.
To explain in detail, what I want to build, when I right-click on an entity, a GUI is created and I want to create a store where I can buy and sell things using the GUI. Lines 6 to 12 are created to randomly set the GUI name displayed at the top of the GUI when right-clicking the entity, and Line 13 to Line 20 can be sold to players in the store. This is the phrase to pay the emerald corresponding to the block sold using the phrase [excute op command "/give %player% minecraft:blockID count"].

Skript Version : Skript 2.5 alpha6
Skript Author : Danic
Minecraft Version : 1.16.1
Addons using (including versions): : SkQuery 4.1.2, SkRayFall 1.9.21, skUtilities 0.9.2
I did my best to solve this problem, but I can't.
I hope someone can help me. This is part of an ambitious project :emoji_slight_smile:

* If you need more to solve this problem, I will be happy to show them. (Ex : plugins or server driver and etc...)

Code:
on rightclick on entity:
    trigger:
        if entity's name is "npc name":
            set {npc's say} to random integer between 1 and 3
            if {npc's say} is 1:
            open chest with 5 rows named "say 1" to player
            if {npc's say} is 2:
                open chest with 5 rows named "say 2" to player
            if {npc's say} is 3:
                open chest with 5 rows named "say 3" to player
            format slot 10 of player with coal named "coal 1" with lore "price : 1" to close then run [execute op command "/give %player% minecraft:emerald 1" and "/clear %player% minecraft:coal 1"]
            format slot 12 of player with charcoal named "charcoal 5" with lore "price : 1" to close then run [execute op command "/give %player% minecraft:emerald 1" and "/clear %player% minecraft:charcoal 5"]
            format slot 14 of player with iron_ingot named "iron 1" with lore "price : 5" to close then run [execute op command "/give %player% minecraft:emerald 5" and "/clear %player% minecraft:iron_ingot 1"]
            format slot 16 of player with redstone_dust named "redstone 10" with lore "price : 10" to close then run [execute op command "/give %player% minecraft:emerald 10" and "/clear %player% minecraft:redstone_dust 10"]
            format slot 28 of player with lapis_lazuli named "lapis 10" with lore "price : 10" to close then run [execute op command "/give %player% minecraft:emerald 10" and "/clear %player% minecraft:lapis_lazuli 10"]
            format slot 30 of player with gold_ingot named "gold 1" with lore "price : 20" to close then run [execute op command "/give %player% minecraft:emerald 20" and "/clear %player% minecraft:gold_ingot 1"]
            format slot 32 of player with diamond named "diamond 1" with lore "price : 64" to close then run [execute op command "/give %player% minecraft:emerald 64" and "/clear %player% minecraft:diamond 1"]
            format slot 34 of player with netheright_ingot named "netheright 1" with lore "price : 100" to close then run [execute op command "/give %player% minecraft:emerald 100" and "/clear %player% minecraft:netheright_ingot 1"]
        else:
            stop

I am getting this error when reloading the code.

Code:
Empty configuration section! You might want to indent one or more of the subsequent lines to make them belong to this section or remove the colon at the end of the line if you don't want this line to start a section. [File name.sk, line 7: if {npc's say} is 1:]
can't understand this condition: 'trigger' <File name.sk, line 4: trigger:')
[Skript] Encountered 1 error while reloading File name.sk!
 
Last edited:
Thank you very much!
I was just laughing at wasting days.
Sincere thanks to you!
Tell me a lot in the future, Genius Killerz1243!
[doublepost=1595501948,1595501607][/doublepost]If it's okay, I'll ask one more.
I want to write an if statement so that the player can only take the emerald when they have the corresponding item. Are there any syntax to execute "/give %player% item count" only when the player has item count >= price?
 
Status
Not open for further replies.