1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Crate Inventory / GUI Issues

Discussion in 'Skript' started by Nightmarinya, May 20, 2019.

Thread Status:
Not open for further replies.
  1. Nightmarinya

    Nightmarinya Member

    Joined:
    Oct 2, 2018
    Messages:
    31
    Likes Received:
    4
    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. Unless opening the event-inventory to player remembers the items in said inventory in which case it won't be an issue.
     
  2. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    107
    Medals:
    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).
    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
     
  3. Nightmarinya

    Nightmarinya Member

    Joined:
    Oct 2, 2018
    Messages:
    31
    Likes Received:
    4
    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.

    [​IMG]

    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:
     
    #23 Nightmarinya, May 25, 2019
    Last edited: May 25, 2019
  4. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    107
    Medals:
    I think you forgot to wait a tick after the event + condition
     
  5. Nightmarinya

    Nightmarinya Member

    Joined:
    Oct 2, 2018
    Messages:
    31
    Likes Received:
    4
    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
    --- Double Post Merged, May 25, 2019, Original Post Date: May 25, 2019 ---
    Hi there, almost got a test version of it working to see if it works but I ran into this issue:

    [​IMG]

    Code (Skript):
    1.  
    2. on inventory click:
    3.     name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
    4.         cancel the event
    5.         clicked slot is 12, 13, 14, 21, 22, 23, 30, 31 or 32:
    6.             loop 50 times:
    7.                 set {slot.%clicked-slot%.%player%} to clicked slot
    8.                 add 0.05 to {rolltime.%clicked-slot%.%player%}
    9.                 wait "{rolltime.%clicked-slot%.%player%} seconds" parsed as timespan
    10.                 name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
    11.                     play sound "block.note_block.guitar" with volume 100 and pitch 2 at player for player
    12.                     play sound "block.dispenser.dispense" with volume 100 and pitch 1 at player for player
    13.                     chance of 50%:
    14.                         set slot {slot.%clicked-slot%.%player%} to 32 diamond block
    15.                         stop
    16.                     chance of 100%:
    17.                         set slot {slot.%clicked-slot%.%player%} to 2 beacon
    18.                         stop
    19.  
    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~
    --- Double Post Merged, May 25, 2019 ---
    Also another issue, no errors but the rolling doesn't seem to work for some reason

    Full Code For Click Event:
    Code (Skript):
    1.  
    2. on inventory click:
    3.    name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
    4.        cancel the event
    5.        clicked slot is 12, 13, 14, 21, 22, 23, 30, 31 or 32:
    6.            set {slot::%player%::%event-slot%} to clicked slot
    7.            loop 50 times:
    8.                add 0.05 to {rolltime::%player%::%event-slot%}
    9.                wait "{rolltime::%player%::%event-slot%} seconds" parsed as timespan
    10.                name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
    11.                    play sound "block.note_block.guitar" with volume 100 and pitch 2 at player for player
    12.                    play sound "block.dispenser.dispense" with volume 100 and pitch 1 at player for player
    13.                    chance of 50%:
    14.                        set {slot::%player%::%event-slot%} to 32 diamond block
    15.                        stop
    16.                    chance of 100%:
    17.                        set {slot::%player%::%event-slot%} to 2 beacon
    18.                        stop
    19.  
    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
     
    #25 Nightmarinya, May 25, 2019
    Last edited: May 25, 2019
    • Like Like x 1
  6. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    107
    Medals:
    It's probably because you're setting the variable itself, not the actual slot of the player.
     
  7. Nightmarinya

    Nightmarinya Member

    Joined:
    Oct 2, 2018
    Messages:
    31
    Likes Received:
    4
    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.
     
  8. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    107
    Medals:
    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
     
  9. Nightmarinya

    Nightmarinya Member

    Joined:
    Oct 2, 2018
    Messages:
    31
    Likes Received:
    4
    I assume you would have meant all nine slots in my case, assuming you knew what it looked like prior? xd

    [​IMG]

    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 (Skript):
    1.  
    2. on inventory click:
    3.     name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
    4.         cancel the event
    5.         clicked slot is 12, 13, 14, 21, 22, 23, 30, 31 or 32:
    6.             set {slot::%player%::%event-slot%} to clicked slot
    7.             loop 50 times:
    8.                 set {rolltime::%player%::%event-slot%} to 0
    9.                 add 0.05 to {rolltime::%player%::%event-slot%}
    10.                 wait "%{rolltime::%player%::%event-slot%}% seconds" parsed as timespan
    11.                 name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
    12.                     play sound "block.note_block.guitar" with volume 100 and pitch 2 at player for player
    13.                     play sound "block.dispenser.dispense" with volume 100 and pitch 1 at player for player
    14.                     chance of 50%:
    15.                         set slot {slot::%player%::%event-slot%} of player's current inventory to 32 diamond block
    16.                         stop
    17.                     chance of 100%:
    18.                         set slot {slot::%player%::%event-slot%} of player's current inventory to 2 beacon
    19.                         stop
    20.  
    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?
     
  10. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    107
    Medals:
    Exactly, there is no need for the stop
     
  11. Nightmarinya

    Nightmarinya Member

    Joined:
    Oct 2, 2018
    Messages:
    31
    Likes Received:
    4
    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 (Skript):
    1.  
    2. chance of 100%:
    3.     set slot {slot::%player%::%event-slot%} of player's current inventory to 2 beacon
    4. chance of 50%:
    5.     set slot {slot::%player%::%event-slot%} of player's current inventory to 32 diamond block
    6.  
     
    #31 Nightmarinya, May 25, 2019
    Last edited: May 25, 2019
  12. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    107
    Medals:
    Use an `else`
     
  13. Nightmarinya

    Nightmarinya Member

    Joined:
    Oct 2, 2018
    Messages:
    31
    Likes Received:
    4
    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 (Skript):
    1.  
    2. on right click with ender chest:
    3.     name of player's tool is "&4&l-=+> &c&k::&7 Irothai Caverns Lootbox &c&k::&4&l <+=-":
    4.         if player can hold 768 command block:
    5.             open chest with 6 rows named "&lIROTHAI CAVERNS LOOTBOX" to player
    6.             wait 1 tick
    7.             name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
    8.                 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
    9.                 play sound "block.ender_chest.open" with volume 100 and pitch 0.75 at player for player
    10.                 play sound "entity.firework_rocket.launch" with volume 100 and pitch 1 at player for player
    11.                 play sound "entity.player.levelup" with volume 100 and pitch 1 at player for player
    12.                 loop integers between 0 and menu size of player's current inventory - 1:
    13.                     set slot loop-number of player's current inventory to black stained glass pane named " "
    14.                 loop integers between 12 and 15 - 1:
    15.                     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!"
    16.                 loop integers between 21 and 24 - 1:
    17.                     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!"
    18.                 loop integers between 30 and 33 - 1:
    19.                     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!"
    20.                 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!"
    21.             stop
    22.         else:
    23.             play sound "entity.villager.no" with volume 100 and pitch 1 at player for player
    24.             send "&4&l(!) &4You do not have enough room in your"
    25.             send "&4inventory to open this crate!"
    26.             send "&e&l(!) &eRequired Space:&7 12 slots or more"
    27.            
    28. on inventory click:
    29.     name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
    30.         cancel the event
    31.         clicked slot is 12, 13, 14, 21, 22, 23, 30, 31 or 32:
    32.             set {slot::%player%::%event-slot%} to clicked slot
    33.             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!":
    34.                 delete {rolltime::%player%::%event-slot%}
    35.                 loop 50 times:
    36.                     if {rolltime::%player%::%event-slot%} is not set:
    37.                         set {rolltime::%player%::%event-slot%} to 0
    38.                     add 0.005 to {rolltime::%player%::%event-slot%}
    39.                     wait "%{rolltime::%player%::%event-slot%}% seconds" parsed as timespan
    40.                     name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
    41.                         play sound "block.dispenser.dispense" with volume 100 and pitch 1 at player for player
    42.                         chance of 100%:
    43.                             set slot {slot::%player%::%event-slot%} of player's current inventory to 64 experience bottle named "&7x256 Bottles of Enchanting" with lore "&f* NORMAL *"
    44.                         chance of 40%:
    45.                             set slot {slot::%player%::%event-slot%} of player's current inventory to 2 golden apple named "&7x64 Golden Apples" with lore "&f* NORMAL *"
    46.                         chance of 25%:
    47.                             set slot {slot::%player%::%event-slot%} of player's current inventory to 32 diamond block named "&7x32 Diamond Blocks" with lore "&f* NORMAL *"
    48.                         chance of 20.50%:
    49.                             set slot {slot::%player%::%event-slot%} of player's current inventory to 2 beacon named "&7x2 Beacons" with lore "&f* NORMAL *"
    50.                         chance of 13.50%:
    51.                             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 *"
    52.                         chance of 10%:
    53.                             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 *"
    54.                         chance of 7.65%:
    55.                             set slot {slot::%player%::%event-slot%} of player's current inventory to 3 book named "&5x3 Random Custom Enchants" with lore "&5* EPIC *"
    56.                         chance of 5.50%:
    57.                             set slot {slot::%player%::%event-slot%} of player's current inventory to shulker box named "&5x1 Shulker Box" with lore "&5* EPIC *"
    58.                         chance of 4.75%:
    59.                             set slot {slot::%player%::%event-slot%} of player's current inventory to enchanted book named "&5x1 Mending Enchanted Book" with lore "&5* EPIC *"
    60.                         chance of 4.50%:
    61.                             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 *"
    62.                         chance of 3.5%:
    63.                             set slot {slot::%player%::%event-slot%} of player's current inventory to 5 book named "&ex5 Random Custom Enchants" with lore "&6* Legendary *"
    64.                         chance of 3.5%:
    65.                             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 *"
    66.                         chance of 2.5%:
    67.                             set slot {slot::%player%::%event-slot%} of player's current inventory to elytra named "&ex1 Elytra" with lore "&6* Legendary *"
    68.                         chance of 2.5%:
    69.                             set slot {slot::%player%::%event-slot%} of player's current inventory to dragon egg named "&ex1 Dragon Egg" with lore "&6* Legendary *"
    70.                         chance of 2.25%:
    71.                             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 *"
    72.                         chance of 2%:
    73.                             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 *"
    74.                 set {reward::%player%::%event-slot%} to {slot::%player%::%event-slot%}
    75.                 loop all items in player's current inventory:
    76.                     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!":
    77.                         name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
    78.                             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!"
    79.                             stop            
    80.         clicked slot is 49:
    81.             name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
    82.                 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!":
    83.                     play sound "entity.bat.takeoff" with volume 100 and pitch 0.75 at player for player
    84.                     chance of 2.5%:
    85.                         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 *"
    86.                         stop
    87.                     chance of 2.5%:
    88.                         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 *"
    89.                         stop
    90.                     chance of 5%:
    91.                         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 *"
    92.                         stop
    93.                     chance of 5%:
    94.                         set slot 49 of player's current inventory to book named "&cx1 Random Divine Custom Enchant" with lore "&4* Divine *"
    95.                         stop
    96.                     chance of 5.5%:
    97.                         set slot 49 of player's current inventory to armor stand named "&cx1 Irothian Knight Figurine" with lore "&4* Divine *"
    98.                         stop
    99.                     chance of 7.5%:
    100.                         set slot 49 of player's current inventory to 2 totem of undying named "&cx2 Totems of Undying" with lore "&4* Divine *"
    101.                         stop
    102.                     chance of 50%:
    103.                         set slot 49 of player's current inventory to experience bottle named "&ex1 Experience Booster &7(4 Hours)" with lore "&6* Legendary *"
    104.                         stop
    105.                     chance of 50.25%:
    106.                         set slot 49 of player's current inventory to 3 chest named "&ex3 Random Loot Crates &7(Tier 2 - 4)" with lore "&6* Legendary *"
    107.                         stop
    108.                     chance of 50.5%:
    109.                         set slot 49 of player's current inventory to dragon egg named "&ex1 Dragon Egg" with lore "&6* Legendary *"
    110.                         stop
    111.                     chance of 50.5%:
    112.                         set slot 49 of player's current inventory to elytra named "&ex1 Elytra" with lore "&6* Legendary *"
    113.                         stop
    114.                     chance of 60%:
    115.                         set slot 49 of player's current inventory to paper named "&ex1 Command Access" with lore "&7/sethome, /home" and "&6* Legendary *"
    116.                         stop
    117.                     chance of 100%:
    118.                         set slot 49 of player's current inventory to 5 book named "&ex5 Random Custom Enchants" with lore "&6* Legendary *"
    119.                         stop
    120.            
    121. on inventory close:
    122.     name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
    123.         loop all items in player's current inventory:
    124.             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!":
    125.                 wait 1 tick
    126.                 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
    127.                 stop
    128.             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!":
    129.                 wait 1 tick
    130.                 open event-inventory to player
    131.                 stop
    132.             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!":
    133.                 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!":
    134.                     wait 1 tick
    135.                     open event-inventory to player
    136.                     stop
    137.             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!":
    138.                 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!":
    139.                     give {reward::%player%::12} to player
    140.                     give {reward::%player%::13} to player
    141.                     give {reward::%player%::14} to player
    142.                     give {reward::%player%::21} to player
    143.                     give {reward::%player%::22} to player
    144.                     give {reward::%player%::23} to player
    145.                     give {reward::%player%::30} to player
    146.                     give {reward::%player%::31} to player
    147.                     give {reward::%player%::32} to player
    148.                     give {reward::%player%::49} to player
    149.                     stop
    150.  
    And here is my issues:
    Firstly, this piece of code doesn't work properly.
    Code (Skript):
    1.  
    2.                 set {reward::%player%::%event-slot%} to {slot::%player%::%event-slot%}
    3.                 loop all items in player's current inventory:
    4.                     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!":
    5.                         name of player's current inventory is "&lIROTHAI CAVERNS LOOTBOX":
    6.                             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!"
    7.                             stop
    8.  
    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 (Skript):
    1.  
    2. 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!":
    3.                 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!":
    4.                     give {reward::%player%::12} to player
    5.                     give {reward::%player%::13} to player
    6.                     give {reward::%player%::14} to player
    7.                     give {reward::%player%::21} to player
    8.                     give {reward::%player%::22} to player
    9.                     give {reward::%player%::23} to player
    10.                     give {reward::%player%::30} to player
    11.                     give {reward::%player%::31} to player
    12.                     give {reward::%player%::32} to player
    13.                     give {reward::%player%::49} to player
    14.                     stop
    15.  
    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:
     
    #33 Nightmarinya, May 25, 2019
    Last edited: May 26, 2019
  14. Jeroeno_Boy

    Jeroeno_Boy Active Member

    Joined:
    Jun 2, 2017
    Messages:
    61
    Likes Received:
    2
    code is short
     
  15. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    107
    Medals:
    Thanks for your contribution to this thread!
     
  16. Jeroeno_Boy

    Jeroeno_Boy Active Member

    Joined:
    Jun 2, 2017
    Messages:
    61
    Likes Received:
    2
  17. AsuDev

    VIP

    Joined:
    Jan 27, 2017
    Messages:
    243
    Likes Received:
    21
    I don't mind at all. Just add me on discord and we can talk about it.
     
  18. Nightmarinya

    Nightmarinya Member

    Joined:
    Oct 2, 2018
    Messages:
    31
    Likes Received:
    4
    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.


    Also awesome! I'll send you an invite to the server :emoji_slight_smile: Thanks for your help in advance!
     
  19. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    107
    Medals:
    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)
     
  20. Nightmarinya

    Nightmarinya Member

    Joined:
    Oct 2, 2018
    Messages:
    31
    Likes Received:
    4

    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.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...