Solved Strange stuff with TuSKe Gui?

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

    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.

Aidanete

Active Member
Apr 11, 2017
139
10
0
code_language.skript:
on break:
    event-block is chest:
        player is holding a blaze rod named "<gold>Randomize Chest":
            cancel event
            set {randomizechest::%event-block%} to true
on rightclick on chest:
    {randomizechest::%event-block%} is true:
        set {randomizechest::%event-block%} to false
        set {_position} to 0
        loop 27 times:
            wait 1 ticks
            open virtual chest inventory with size 3 named "Loot Chest" to the player
            set {_itsl} to random integer between 1 and 10
            if {_itsl} is 1:
                set {_item} to wooden sword
            if {_itsl} is 2:
                set {_item} to leather chestplate
            if {_itsl} is bigger than 2:
                if {_itsl} is smaller than 11:
                    set {_item} to air
            format gui slot {_position} of player with {_item} to close
            add 1 to {_position}

Here is my code /\ - At the start it won't work, but this is supposed to create a random loot table chest, so each time you find a chest you will find this items. I found a bug that when I open the chest, all items that appears, dissappears after a few milliseconds and I don't want that.

Also I don't know how to make those items pickup-able.

Help!

Here a video of what happens:
 
  • loop 27 times:
  • wait 1 ticks
  • open virtual chest inventory with size 3 named "Loot Chest" to the player
There's your problem. Each time it loops, it opens a new virtual chest. Putting the chest effect before the loop should fix this.
code_language.skript:
open virtual chest inventory with size 3 named "Loot Chest" to the player
loop 27 times:
    wait 1 tick
    # code
 
Oh my, sorry, me idiot. Thank you a lot! :emoji_grinning:

Anyway, you know a way to make items pickup-able?
 
Oh my, sorry, me idiot. Thank you a lot! :emoji_grinning:

Anyway, you know a way to make items pickup-able?
Huh. So Tuske's GUIs don't let you pick up items...?
Well, I've personally never used Tuske in my life, therefore when I want to make GUI's I use Skript's built-in slot feature (that is if you're using the latest bensku fork).

So to create a GUI you could do something like
code_language.skript:
open chest with 5 rows named "name" to player
set slot 36 of player's current inventory to oak planks named "tuna" with lore "yo"
And if you wanted to make the items unpickable, you'd cancel the inventory click event
code_language.skript:
on inventory click:
    name of event-inventory is "the name you gave your gui"
    cancel event
 
Status
Not open for further replies.