Crate Inventory / GUI Issues

  • 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.
What do you meaning with `roll`?


You can try to re-open the menu on inventory close (do wait a tick). You can re-open it with `open event-inventory to player`

Sorry, should have been more specific, by "roll" I mean like this:
(Check gyazo link for gif of what I mean)

{Original Post}
[doublepost=1558704182,1558695905][/doublepost]https://gyazo.com/9245d8f25f11a7b85e0b04cb42eb8811

Here, I linked a gif of something similar to what I'm trying to achieve ^^
The flickering when opening the crate is me trying to close out of the inventory but it not letting me,
one of the things I need help figuring out. And the rolling of the items, another thing I need help figuring out.
As you can see it also remembers what the items in the inventory of the crate was even when I closed out of it and it reopened itself.

I couldn't find a perfect example of what I'm trying to create that is professionally done like the one in the gif is, but it's very similar to what I'm going for.

It changes (rolls) through the items possible to get and lands on the one you will receive.
Also I'll try that thank you, only issue I can see it causing though is it needs to be able to reopen it with the same items whilst it's rolling / changing items. Unless opening the event-inventory to player remembers the items in said inventory in which case it won't be an issue.
 
Sorry, should have been more specific, by "roll" I mean like this:
(Check gyazo link for gif of what I mean)



It changes (rolls) through the items possible to get and lands on the one you will receive.
Also I'll try that thank you, only issue I can see it causing though is it needs to be able to reopen it with the same items whilst it's rolling / changing items.
For the rolling, you could do something like loop 100 times, set the middle slot to a random item and then wait a tick (or more).
Also I'll try that thank you, only issue I can see it causing though is it needs to be able to reopen it with the same items whilst it's rolling / changing items.
It will open with the same items, and if you do something like I said above, you can just check if the current inventory is the right one. If it's not, don't set the slot, but do wait a tick. That way it will wait until the inventory is open again. You should also add a check to see if the player is still online in the loop
 
Kind of an unrelated topic, but this happened just now lol
Not sure why. It just happened after I tried reloading the skript after putting the "open event-inventory to player" event.

1a41ec4619da7b2e1c9dbb0037443d14.png

Also I'm not super experienced with skript so I don't exactly know everything you said but I'll try a couple of things and try what you suggested and get back to you if I have any issues, I know I've said this like 100 times already but, again, thank you for your help c:
 
Last edited:
Kind of an unrelated topic, but this happened just now lol
Not sure why. It just happened after I tried reloading the skript after putting the "open event-inventory to player" event.

1a41ec4619da7b2e1c9dbb0037443d14.png

Also I'm not super experienced with skript so I don't exactly know everything you said but I'll try a couple of things and try what you suggested and get back to you if I have any issues, I know I've said this like 100 times already but, again, thank you for you help c:
I think you forgot to wait a tick after the event + condition
 
I think you forgot to wait a tick after the event + condition

Yeah you're right just checked and I did, what a thing to happen though xD Lagged my computer for like a good minute until it finally shut down.
Also having that "open event-inventory to player" event actually does save all of the information of what items where in the inventory before closing it so that's great :emoji_slight_smile: that makes my life a lot easier, not having to write a whole thing for that and all ^^

Anyways I'll let you know if I figure out a way to make what you sent me work with the project or not, or if I have any further issues
[doublepost=1558779267,1558778410][/doublepost]Hi there, almost got a test version of it working to see if it works but I ran into this issue:

6417394037efc8fe501f4ed87e96e69e.png

code_language.skript:
on inventory click:
    name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
        cancel the event
        clicked slot is 12, 13, 14, 21, 22, 23, 30, 31 or 32:
            loop 50 times:
                set {slot.%clicked-slot%.%player%} to clicked slot
                add 0.05 to {rolltime.%clicked-slot%.%player%}
                wait "{rolltime.%clicked-slot%.%player%} seconds" parsed as timespan
                name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
                    play sound "block.note_block.guitar" with volume 100 and pitch 2 at player for player
                    play sound "block.dispenser.dispense" with volume 100 and pitch 1 at player for player
                    chance of 50%:
                        set slot {slot.%clicked-slot%.%player%} to 32 diamond block
                        stop
                    chance of 100%:
                        set slot {slot.%clicked-slot%.%player%} to 2 beacon
                        stop

Is there a way to use something that can determine "clicked slot" like "clicked-slot" would have if it were a thing?
Basically I'm trying to use "%clicked-slot%" as a way to make sure it doesn't interfere with a player rolling multiple items at
once.

EDIT: Got some help on the discord server, clicked-slot should be event-slot instead~
[doublepost=1558783830][/doublepost]Also another issue, no errors but the rolling doesn't seem to work for some reason

Full Code For Click Event:
code_language.skript:
on inventory click:
   name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
       cancel the event
       clicked slot is 12, 13, 14, 21, 22, 23, 30, 31 or 32:
           set {slot::%player%::%event-slot%} to clicked slot
           loop 50 times:
               add 0.05 to {rolltime::%player%::%event-slot%}
               wait "{rolltime::%player%::%event-slot%} seconds" parsed as timespan
               name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
                   play sound "block.note_block.guitar" with volume 100 and pitch 2 at player for player
                   play sound "block.dispenser.dispense" with volume 100 and pitch 1 at player for player
                   chance of 50%:
                       set {slot::%player%::%event-slot%} to 32 diamond block
                       stop
                   chance of 100%:
                       set {slot::%player%::%event-slot%} to 2 beacon
                       stop

Didn't get an answer on the discord, help anyone? :C

EDIT: Help from TPGamesNL on discord, thank you! :emoji_slight_smile:

TPGamesNL Today at 7:54 AM


the problem is wait "{rolltime::%player%::%event-slot%} seconds" parsed as timespan: the variable in the string needs %%. also, you shouldn't add a stop

I feel like such an idiot for not noticing haha.
But unfortunately another issue arises :C
now it makes the sounds and stuff but doesn't actually roll anything, no errors
 
Last edited:
  • Like
Reactions: TPGamesNL
Yeah you're right just checked and I did, what a thing to happen though xD Lagged my computer for like a good minute until it finally shut down.
Also having that "open event-inventory to player" event actually does save all of the information of what items where in the inventory before closing it so that's great :emoji_slight_smile: that makes my life a lot easier, not having to write a whole thing for that and all ^^

Anyways I'll let you know if I figure out a way to make what you sent me work with the project or not, or if I have any further issues
[doublepost=1558779267,1558778410][/doublepost]Hi there, almost got a test version of it working to see if it works but I ran into this issue:

6417394037efc8fe501f4ed87e96e69e.png

code_language.skript:
on inventory click:
    name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
        cancel the event
        clicked slot is 12, 13, 14, 21, 22, 23, 30, 31 or 32:
            loop 50 times:
                set {slot.%clicked-slot%.%player%} to clicked slot
                add 0.05 to {rolltime.%clicked-slot%.%player%}
                wait "{rolltime.%clicked-slot%.%player%} seconds" parsed as timespan
                name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
                    play sound "block.note_block.guitar" with volume 100 and pitch 2 at player for player
                    play sound "block.dispenser.dispense" with volume 100 and pitch 1 at player for player
                    chance of 50%:
                        set slot {slot.%clicked-slot%.%player%} to 32 diamond block
                        stop
                    chance of 100%:
                        set slot {slot.%clicked-slot%.%player%} to 2 beacon
                        stop

Is there a way to use something that can determine "clicked slot" like "clicked-slot" would have if it were a thing?
Basically I'm trying to use "%clicked-slot%" as a way to make sure it doesn't interfere with a player rolling multiple items at
once.

EDIT: Got some help on the discord server, clicked-slot should be event-slot instead~
[doublepost=1558783830][/doublepost]Also another issue, no errors but the rolling doesn't seem to work for some reason

Full Code For Click Event:
code_language.skript:
on inventory click:
   name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
       cancel the event
       clicked slot is 12, 13, 14, 21, 22, 23, 30, 31 or 32:
           set {slot::%player%::%event-slot%} to clicked slot
           loop 50 times:
               add 0.05 to {rolltime::%player%::%event-slot%}
               wait "{rolltime::%player%::%event-slot%} seconds" parsed as timespan
               name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
                   play sound "block.note_block.guitar" with volume 100 and pitch 2 at player for player
                   play sound "block.dispenser.dispense" with volume 100 and pitch 1 at player for player
                   chance of 50%:
                       set {slot::%player%::%event-slot%} to 32 diamond block
                       stop
                   chance of 100%:
                       set {slot::%player%::%event-slot%} to 2 beacon
                       stop

Didn't get an answer on the discord, help anyone? :C

EDIT: Help from TPGamesNL on discord, thank you! :emoji_slight_smile:

TPGamesNL Today at 7:54 AM


the problem is wait "{rolltime::%player%::%event-slot%} seconds" parsed as timespan: the variable in the string needs %%. also, you shouldn't add a stop

I feel like such an idiot for not noticing haha.
But unfortunately another issue arises :C
now it makes the sounds and stuff but doesn't actually roll anything, no errors
It's probably because you're setting the variable itself, not the actual slot of the player.
 
Hmm what do you mean exactly and how could I fix that?
I just had "set {slot::%player%::%event-slot%} to clicked slot" written the way it was cause I wanted to have it be able to differentiate if the player was rolling multiple items at once, would there be a better way of doing this that would fix the issue?

Apologies if I don't completely understand what you're trying to tell me by the way ^^
You might need to be a little more specific with me, or "dumb it down" per se since I'm not very knowledgeable on everything skript related.
 
Well currently, your code sets the slot variable to an item, but you never told Skript to do anything with that variable. You will need to set the middle slot to that variable as well
 
I assume you would have meant all nine slots in my case, assuming you knew what it looked like prior? xd

e84ab6b39f839aa5c785753eb1a1367a.png

Also wow I'm a dummy, I just realized what you meant, originally the plan was to have "set {slot::%player%::%event-slot%} to 32 diamond block" set the slot event-slot to 32 diamond blocks as for example: "set slot 0 of player's current inventory to 32 diamond block" would.
I also just realized that I completely forgot to put "of player's inventory" after "{slot::%player%::%event-slot%}" anyway.

Here's the new stuff:
code_language.skript:
on inventory click:
    name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
        cancel the event
        clicked slot is 12, 13, 14, 21, 22, 23, 30, 31 or 32:
            set {slot::%player%::%event-slot%} to clicked slot
            loop 50 times:
                set {rolltime::%player%::%event-slot%} to 0
                add 0.05 to {rolltime::%player%::%event-slot%}
                wait "%{rolltime::%player%::%event-slot%}% seconds" parsed as timespan
                name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
                    play sound "block.note_block.guitar" with volume 100 and pitch 2 at player for player
                    play sound "block.dispenser.dispense" with volume 100 and pitch 1 at player for player
                    chance of 50%:
                        set slot {slot::%player%::%event-slot%} of player's current inventory to 32 diamond block
                        stop
                    chance of 100%:
                        set slot {slot::%player%::%event-slot%} of player's current inventory to 2 beacon
                        stop

Buuuut one other thing, it wouldn't be an Ashfell problem if an issue didn't come after another.
It sets the slot of with the item but doesn't loop, I'm assuming that's because "stop" is preventing it from doing so?
 
well the reason I put the stop is because if I didn't it would then have a 100% chance of changing it back to 2 beacons instead of the diamond blocks, even if that 50% chance was successfully chosen. Perhaps I could fix this by reversing it so it's this instead?
code_language.skript:
chance of 100%:
    set slot {slot::%player%::%event-slot%} of player's current inventory to 2 beacon
chance of 50%:
    set slot {slot::%player%::%event-slot%} of player's current inventory to 32 diamond block
 
Last edited:
well the reason I put the stop is because if I didn't it would then have a 100% chance of changing it back to 2 beacons instead of the diamond blocks, even if that 50% chance was successfully chosen. Perhaps I could fix this by reversing it so it's this instead?
code_language.skript:
chance of 100%:
        set slot {slot::%player%::%event-slot%} of player's current inventory to 2 beacon
chance of 50%:
        set slot {slot::%player%::%event-slot%} of player's current inventory to 32 diamond block
Use an `else`
 
Update: So I'm basically done with this project, I just have 2 issues left that need to be resolved and it's finished!
Here is the full, entire code:

code_language.skript:
on right click with ender chest:
    name of player's tool is "&4&l-=+> &c&k::&7 Irothai Caverns Lootbox &c&k::&4&l <+=-":
        if player can hold 768 command block:
            open chest with 6 rows named "&lIROTHAI CAVERNS LOOTBOX" to player
            wait 1 tick
            name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
                remove 1 ender chest named "&4&l-=+> &c&k::&7 Irothai Caverns Lootbox &c&k::&4&l <+=-" with lore "&7A mysterious box found in the depths of", "&7the Irothai Caverns, there may be more", "&7down there, but this is the first of it's", "&7kind to see the light of day...", "&k", "&f&lNORMAL REWARDS:", "&7 - x32 Diamond Blocks", "&7 - x256 Bottles of Enchanting", "&7 - x2 Beacons", "&7 - x1 Irothian Pickaxe", "&7 - x64 Golden Apples", "&k", "&5&lEPIC REWARDS:", "&7 - &5x1 Reward Loot Crate &7(Tier 1 - 3)", "&7 - &5x2 Enchanted Golden Apples", "&7 - &5x1 Shulker Box", "&7 - &5x1 Mending Enchanted Book", "&7 - &5x3 Random Custom Enchants", "&k", "&6&lLEGENDARY REWARDS:", "&7 - &ex3 Random Loot Crates &7(Tier 2 - 4)", "&7 - &ex1 Experience Booster &7(4 Hours)", "&7 - &ex1 Command Access: &7/sethome, /home", "&7 - &ex5 Random Custom Enchants", "&7 - &ex1 Dragon Egg", "&7 - &ex1 Elytra", "&k", "&4&lDIVINE REWARDS:", "&7 - &cx1 &k::&7&l Irothian Knight VKit Access &c&k::", "&7 - &cx1 &k::&7&l Irothai Caverns Key &c&k::", "&7 - &cx1 Potion of Unlimited Buffs &7(3 Uses)", "&7 - &cx2 Totems of Undying", "&7 - &cx1 Random Divine Custom Enchant" and "&7 - &cx1 Admin Item" from player's inventory
                play sound "block.ender_chest.open" with volume 100 and pitch 0.75 at player for player
                play sound "entity.firework_rocket.launch" with volume 100 and pitch 1 at player for player
                play sound "entity.player.levelup" with volume 100 and pitch 1 at player for player
                loop integers between 0 and menu size of player's current inventory - 1:
                    set slot loop-number of player's current inventory to black stained glass pane named " "
                loop integers between 12 and 15 - 1:
                    set slot loop-number of player's current inventory to ender chest named "&6&l???" with lore "&7Click to redeem a random item" and "&7from the Irothai Caverns&7 Lootbox!"
                loop integers between 21 and 24 - 1:
                    set slot loop-number of player's current inventory to ender chest named "&6&l???" with lore "&7Click to redeem a random item" and "&7from the Irothai Caverns&7 Lootbox!"
                loop integers between 30 and 33 - 1:
                    set slot loop-number of player's current inventory to ender chest named "&6&l???" with lore "&7Click to redeem a random item" and "&7from the Irothai Caverns&7 Lootbox!"
                set slot 49 of player's current inventory to red stained glass pane named "&4&lDIVINE REWARD" with lore "&7Click to receive a guaranteed", "&6&lLEGENDARY&7 tier reward or higher!", "&k" and "&6Legendary&e and &4Divine&e reward", "&echances are increased!", "&k", "&4You must open your main rewards before" and "&4you can open your &nDIVINE&4 reward!"
            stop
        else:
            play sound "entity.villager.no" with volume 100 and pitch 1 at player for player
            send "&4&l(!) &4You do not have enough room in your"
            send "&4inventory to open this crate!"
            send "&e&l(!) &eRequired Space:&7 12 slots or more"
            
on inventory click:
    name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
        cancel the event
        clicked slot is 12, 13, 14, 21, 22, 23, 30, 31 or 32:
            set {slot::%player%::%event-slot%} to clicked slot
            if slot {slot::%player%::%event-slot%} of player's current inventory is ender chest named "&6&l???" with lore "&7Click to redeem a random item" and "&7from the Irothai Caverns&7 Lootbox!":
                delete {rolltime::%player%::%event-slot%}
                loop 50 times:
                    if {rolltime::%player%::%event-slot%} is not set:
                        set {rolltime::%player%::%event-slot%} to 0
                    add 0.005 to {rolltime::%player%::%event-slot%}
                    wait "%{rolltime::%player%::%event-slot%}% seconds" parsed as timespan
                    name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
                        play sound "block.dispenser.dispense" with volume 100 and pitch 1 at player for player
                        chance of 100%:
                            set slot {slot::%player%::%event-slot%} of player's current inventory to 64 experience bottle named "&7x256 Bottles of Enchanting" with lore "&f* NORMAL *"
                        chance of 40%:
                            set slot {slot::%player%::%event-slot%} of player's current inventory to 2 golden apple named "&7x64 Golden Apples" with lore "&f* NORMAL *"
                        chance of 25%:
                            set slot {slot::%player%::%event-slot%} of player's current inventory to 32 diamond block named "&7x32 Diamond Blocks" with lore "&f* NORMAL *"
                        chance of 20.50%:
                            set slot {slot::%player%::%event-slot%} of player's current inventory to 2 beacon named "&7x2 Beacons" with lore "&f* NORMAL *"
                        chance of 13.50%:
                            set slot {slot::%player%::%event-slot%} of player's current inventory to diamond pickaxe of efficiency 6, unbreaking 10 and fortune 4 named "&7x1 Irothian Pickaxe" with lore "&f* NORMAL *"
                        chance of 10%:
                            set slot {slot::%player%::%event-slot%} of player's current inventory to 2 enchanted golden apple named "&5x2 Enchanted Golden Apples" with lore "&5* EPIC *"
                        chance of 7.65%:
                            set slot {slot::%player%::%event-slot%} of player's current inventory to 3 book named "&5x3 Random Custom Enchants" with lore "&5* EPIC *"
                        chance of 5.50%:
                            set slot {slot::%player%::%event-slot%} of player's current inventory to shulker box named "&5x1 Shulker Box" with lore "&5* EPIC *"
                        chance of 4.75%:
                            set slot {slot::%player%::%event-slot%} of player's current inventory to enchanted book named "&5x1 Mending Enchanted Book" with lore "&5* EPIC *"
                        chance of 4.50%:
                            set slot {slot::%player%::%event-slot%} of player's current inventory to 3 chest named "&5x3 Random Loot Crates &7(Tier 1 - 3)" with lore "&5* EPIC *"
                        chance of 3.5%:
                            set slot {slot::%player%::%event-slot%} of player's current inventory to 5 book named "&ex5 Random Custom Enchants" with lore "&6* Legendary *"
                        chance of 3.5%:
                            set slot {slot::%player%::%event-slot%} of player's current inventory to paper named "&ex1 Command Access" with lore "&7/sethome, /home" and "&6* Legendary *"
                        chance of 2.5%:
                            set slot {slot::%player%::%event-slot%} of player's current inventory to elytra named "&ex1 Elytra" with lore "&6* Legendary *"
                        chance of 2.5%:
                            set slot {slot::%player%::%event-slot%} of player's current inventory to dragon egg named "&ex1 Dragon Egg" with lore "&6* Legendary *"
                        chance of 2.25%:
                            set slot {slot::%player%::%event-slot%} of player's current inventory to 3 chest named "&ex3 Random Loot Crates &7(Tier 2 - 4)" with lore "&6* Legendary *"
                        chance of 2%:
                            set slot {slot::%player%::%event-slot%} of player's current inventory to experience bottle named "&ex1 Experience Booster &7(4 Hours)" with lore "&6* Legendary *"
                set {reward::%player%::%event-slot%} to {slot::%player%::%event-slot%}
                loop all items in player's current inventory:
                    slot 32, 31, 30, 23, 22, 21, 14, 13 and 12 of player's current inventory is not ender chest named "&6&l???" with lore "&7Click to redeem a random item" and "&7from the Irothai Caverns&7 Lootbox!":
                        name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
                            set slot 49 of player's current inventory to glowing chorus flower named "&4&lDIVINE REWARD" with lore "&7Click to receive a guaranteed", "&6&lLEGENDARY&7 tier reward or higher!", "&k" and "&6Legendary&e and &4Divine&e reward", "&echances are increased!"
                            stop            
        clicked slot is 49:
            name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
                slot 49 of player's current inventory is glowing chorus flower named "&4&lDIVINE REWARD" with lore "&7Click to receive a guaranteed", "&6&lLEGENDARY&7 tier reward or higher!", "&k" and "&6Legendary&e and &4Divine&e reward", "&echances are increased!":
                    play sound "entity.bat.takeoff" with volume 100 and pitch 0.75 at player for player
                    chance of 2.5%:
                        set slot 49 of player's current inventory to glowing blaze powder named "&cx1 &k::&7&l Irothian Knight VKit Access &c&k::" with lore "&4* Divine *"
                        stop
                    chance of 2.5%:
                        set slot 49 of player's current inventory to glowing tripwire hook named "&cx1 &k::&7&l Irothai Caverns Key &c&k::" with lore "&4* Divine *"
                        stop
                    chance of 5%:
                        set slot 49 of player's current inventory to glowing water bottle named "&cx1 Potion of Unlimited Buffs &7(3 Uses)" with lore "&4* Divine *"
                        stop
                    chance of 5%:
                        set slot 49 of player's current inventory to book named "&cx1 Random Divine Custom Enchant" with lore "&4* Divine *"
                        stop
                    chance of 5.5%:
                        set slot 49 of player's current inventory to armor stand named "&cx1 Irothian Knight Figurine" with lore "&4* Divine *"
                        stop
                    chance of 7.5%:
                        set slot 49 of player's current inventory to 2 totem of undying named "&cx2 Totems of Undying" with lore "&4* Divine *"
                        stop
                    chance of 50%:
                        set slot 49 of player's current inventory to experience bottle named "&ex1 Experience Booster &7(4 Hours)" with lore "&6* Legendary *"
                        stop
                    chance of 50.25%:
                        set slot 49 of player's current inventory to 3 chest named "&ex3 Random Loot Crates &7(Tier 2 - 4)" with lore "&6* Legendary *"
                        stop
                    chance of 50.5%:
                        set slot 49 of player's current inventory to dragon egg named "&ex1 Dragon Egg" with lore "&6* Legendary *"
                        stop
                    chance of 50.5%:
                        set slot 49 of player's current inventory to elytra named "&ex1 Elytra" with lore "&6* Legendary *"
                        stop
                    chance of 60%:
                        set slot 49 of player's current inventory to paper named "&ex1 Command Access" with lore "&7/sethome, /home" and "&6* Legendary *"
                        stop
                    chance of 100%:
                        set slot 49 of player's current inventory to 5 book named "&ex5 Random Custom Enchants" with lore "&6* Legendary *"
                        stop
            
on inventory close:
    name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
        loop all items in player's current inventory:
            slot 32, 31, 30, 23, 22, 21, 14, 13 and 12 of player's current inventory is ender chest named "&6&l???" with lore "&7Click to redeem a random item" and "&7from the Irothai Caverns&7 Lootbox!":
                wait 1 tick
                give 1 ender chest named "&4&l-=+> &c&k::&7 Irothai Caverns Lootbox &c&k::&4&l <+=-" with lore "&7A mysterious box found in the depths of", "&7the Irothai Caverns, there may be more", "&7down there, but this is the first of it's", "&7kind to see the light of day...", "&k", "&f&lNORMAL REWARDS:", "&7 - x32 Diamond Blocks", "&7 - x256 Bottles of Enchanting", "&7 - x2 Beacons", "&7 - x1 Irothian Pickaxe", "&7 - x64 Golden Apples", "&k", "&5&lEPIC REWARDS:", "&7 - &5x1 Reward Loot Crate &7(Tier 1 - 3)", "&7 - &5x2 Enchanted Golden Apples", "&7 - &5x1 Shulker Box", "&7 - &5x1 Mending Enchanted Book", "&7 - &5x3 Random Custom Enchants", "&k", "&6&lLEGENDARY REWARDS:", "&7 - &ex3 Random Loot Crates &7(Tier 2 - 4)", "&7 - &ex1 Experience Booster &7(4 Hours)", "&7 - &ex1 Command Access: &7/sethome, /home", "&7 - &ex5 Random Custom Enchants", "&7 - &ex1 Dragon Egg", "&7 - &ex1 Elytra", "&k", "&4&lDIVINE REWARDS:", "&7 - &cx1 &k::&7&l Irothian Knight VKit Access &c&k::", "&7 - &cx1 &k::&7&l Irothai Caverns Key &c&k::", "&7 - &cx1 Potion of Unlimited Buffs &7(3 Uses)", "&7 - &cx2 Totems of Undying", "&7 - &cx1 Random Divine Custom Enchant" and "&7 - &cx1 Admin Item" to player
                stop
            slot 49 of player's current inventory is red stained glass pane named "&4&lDIVINE REWARD" with lore "&7Click to receive a guaranteed", "&6&lLEGENDARY&7 tier reward or higher!", "&k" and "&6Legendary&e and &4Divine&e reward", "&echances are increased!", "&k", "&4You must open your main rewards before" and "&4you can open your &nDIVINE&4 reward!":
                wait 1 tick
                open event-inventory to player
                stop
            slot 49 of player's current inventory is not red stained glass pane named "&4&lDIVINE REWARD" with lore "&7Click to receive a guaranteed", "&6&lLEGENDARY&7 tier reward or higher!", "&k" and "&6Legendary&e and &4Divine&e reward", "&echances are increased!", "&k", "&4You must open your main rewards before" and "&4you can open your &nDIVINE&4 reward!":
                slot 49 of player's current inventory is glowing chorus flower named "&4&lDIVINE REWARD" with lore "&7Click to receive a guaranteed", "&6&lLEGENDARY&7 tier reward or higher!", "&k" and "&6Legendary&e and &4Divine&e reward", "&echances are increased!":
                    wait 1 tick
                    open event-inventory to player
                    stop
            slot 49 of player's current inventory is not red stained glass pane named "&4&lDIVINE REWARD" with lore "&7Click to receive a guaranteed", "&6&lLEGENDARY&7 tier reward or higher!", "&k" and "&6Legendary&e and &4Divine&e reward", "&echances are increased!", "&k", "&4You must open your main rewards before" and "&4you can open your &nDIVINE&4 reward!":
                slot 49 of player's current inventory is not glowing chorus flower named "&4&lDIVINE REWARD" with lore "&7Click to receive a guaranteed", "&6&lLEGENDARY&7 tier reward or higher!", "&k" and "&6Legendary&e and &4Divine&e reward", "&echances are increased!":
                    give {reward::%player%::12} to player
                    give {reward::%player%::13} to player
                    give {reward::%player%::14} to player
                    give {reward::%player%::21} to player
                    give {reward::%player%::22} to player
                    give {reward::%player%::23} to player
                    give {reward::%player%::30} to player
                    give {reward::%player%::31} to player
                    give {reward::%player%::32} to player
                    give {reward::%player%::49} to player
                    stop

And here is my issues:
Firstly, this piece of code doesn't work properly.
code_language.skript:
                set {reward::%player%::%event-slot%} to {slot::%player%::%event-slot%}
                loop all items in player's current inventory:
                    slot 32, 31, 30, 23, 22, 21, 14, 13 and 12 of player's current inventory is not ender chest named "&6&l???" with lore "&7Click to redeem a random item" and "&7from the Irothai Caverns&7 Lootbox!":
                        name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
                            set slot 49 of player's current inventory to glowing chorus flower named "&4&lDIVINE REWARD" with lore "&7Click to receive a guaranteed", "&6&lLEGENDARY&7 tier reward or higher!", "&k" and "&6Legendary&e and &4Divine&e reward", "&echances are increased!"
                            stop
What it's supposed to do is set the red stained glass pane at the bottom of the GUI to a glowing chorus flower block item after all nine of the "???" items have been rolled. But it does it after only one has been rolled.

-----------

Second, I'm having troubles figuring out a way to put the items successfully rolled into an integer to give to the player afterwards.
code_language.skript:
slot 49 of player's current inventory is not red stained glass pane named "&4&lDIVINE REWARD" with lore "&7Click to receive a guaranteed", "&6&lLEGENDARY&7 tier reward or higher!", "&k" and "&6Legendary&e and &4Divine&e reward", "&echances are increased!", "&k", "&4You must open your main rewards before" and "&4you can open your &nDIVINE&4 reward!":
                slot 49 of player's current inventory is not glowing chorus flower named "&4&lDIVINE REWARD" with lore "&7Click to receive a guaranteed", "&6&lLEGENDARY&7 tier reward or higher!", "&k" and "&6Legendary&e and &4Divine&e reward", "&echances are increased!":
                    give {reward::%player%::12} to player
                    give {reward::%player%::13} to player
                    give {reward::%player%::14} to player
                    give {reward::%player%::21} to player
                    give {reward::%player%::22} to player
                    give {reward::%player%::23} to player
                    give {reward::%player%::30} to player
                    give {reward::%player%::31} to player
                    give {reward::%player%::32} to player
                    give {reward::%player%::49} to player
                    stop
I tried a few things but I can't get it to work, I basically just need the rewards / rolled items to be put into {reward::%player%::[slot number]}% for all 10 items.

Feel free to copy the code over to a script on your own server to test it out and see what issues I'm having and any replies letting me know how to potentially fix these issues or resolve them would be much appreciated! Thank you in advance~ :emoji_slight_smile:
 
Last edited:
Apologies for not responding to this thread for a while, I ended up going to sleep after my last post.



I do agree with TPGames, I've had lots of moments where I looked up how to do something, and got answered based off of the process of fixing the issue, and not the actual solution that the person who made the thread wanted.



I really do appreciate the offer Revelation and I can understand not wanting to deal with back and forths on forum pages.
But, since the post is already made and is here it might as well have the solutions be posted here.

I definitely don't mind talking to you at some point though if there are any more issues I come across, if you're still up for it.
What I could do in the future if you help me is just make a thread about the issue I was having and respond to myself with the solutions that we
went through to try and fix it, and then the solution that did fix it, kind of like a, "this was the issue, here's the solutions" kind of post, if that's allowed. I'm not sure if that kind of stuff is or isn't allowed, (posting and responding to myself about the solutions I mean) so if someone experienced with the forums community, probably someone like TPGames, could let me know that would be awesome, thank you~ :emoji_slight_smile:

Also one other thing I don't know if you're up for it but if we talked Revelation I'd likely add you to a public discord group I made for my friends and steam group members, it's still relatively small, but there is a Semi-Private channel we could discuss the coding and stuff in that only staff are allowed to see, and they won't likely bother us while we're talking unless they need to. Mainly just because I'm not a huge fan of talking to people I've just met in completely private areas (no offense I hope you understand what I mean though :c) but we could for sure talk in that semi-private channel I have in the server if you're interested ^^ Let me know if that's alright with you, maybe we could work together on some stuff at some point help each other out on scripts and stuff ^^ although I'm fairly certain that you know a lot more about skript than I do and most of the stuff I know you probably already know haha cx
I don't mind at all. Just add me on discord and we can talk about it.
 
code is short

Ok well it's long for me alright? xD
I'm sure you've coding a script wayyy longer than this but this is probably one of the biggest ongoing projects I have / have done.


I don't mind at all. Just add me on discord and we can talk about it.

Also awesome! I'll send you an invite to the server :emoji_slight_smile: Thanks for your help in advance!
 
What it's supposed to do is set the red stained glass pane at the bottom of the GUI to a glowing chorus flower block item after all nine of the "???" items have been rolled. But it does it after only one has been rolled.
Try to keep track of what iteration it is from the loop using local variables, and check if it's the 9th.
I tried a few things but I can't get it to work, I basically just need the rewards / rolled items to be put into {reward::%player%::[slot number]}% for all 10 items.
You can use the slot expression again, so `slot {slot::%player%::%event-slot%} of current inventory of player` (give that to the player)
 
Try to keep track of what iteration it is from the loop using local variables, and check if it's the 9th.

You can use the slot expression again, so `slot {slot::%player%::%event-slot%} of current inventory of player` (give that to the player)


Hey sorry for not responding for a while,
Could you possibly give a little example of what you mean by that? If not that's okay, I just figured I would ask
As I said in the past I'm not too familiar with the different types of variables and how they work, so you might need to be a little more erm... explanatory? With what you mean. I apologize for asking for all this help but it's super close to done and hopefully after it's finished I can take some of the knowledge I've gained from this thread and your help and maybe put it into some of any future project I do ^^

I feel bad though asking if you could show me an example of what you mean, I don't mean to sound like I want you to spoon feed me the code or anything :C I'm just better at learning by seeing, rather than explaining, if that makes sense.
 
Status
Not open for further replies.