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!

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

Custom crate templates (Creating crate designs for free)

Discussion in 'Snippets' started by LimeGlass, Feb 19, 2017.

  1. LimeGlass

    VIP Supporter ++ Regular Diner Addon Developer

    Joined:
    Jan 24, 2017
    Messages:
    623
    Likes Received:
    439
    Medals:
    Custom crate templates by LimeGlass

    Basically I will be creating your crate ideas in any way you wish. All you have todo is explain how the crate rotates or moves with a picture or explaination.

    Why am I doing this? Doesn't it seem like alot of work? Won't people request alot?
    Yes and I don't mind. If I can help anyone in anyway for simply sharing my love for GUI's that's all fine with me.

    Here are some crates you can use on the fly right now if you don't want to wait for me to respond :emoji_grinning:

    (The spaces used to be tabs, SkUnity just converts them)
    All Crates need SkQuery and Skellett or just Skript dev-35+

    Class CSGO style:
    [​IMG]
    Code (Skript):
    1. options:
    2.     #This is the name of the crate
    3.     name: "&6Crates System"
    4. on rightclick on jukebox:
    5.     cancel event
    6.     open chest with 3 rows named {@name} to player
    7.     #Add your items below
    8.     #If you want to adjust the percent of an item. Add more of the other items.
    9.    #So if you want to make beacons rare. Add every item except beacon again. This raises the chance to get a different item than beacon.
    10.     add stone, diamond, diamond sword, gold block, redstone, redstone block, beacon, name tag, emerald and gravel to {_roll::*}
    11.     add dirt named "&6DIRT" to {_roll::*}
    12.     #Speed option safety net, so running 0 ticks doesn't crash your server.
    13.     #This is basically how fast the rolling starts (Should be higher than 0)
    14.     set {_speedFinal} to 2
    15.     #Selector settings (Where the selectors should be)
    16.     set {_Selector1} to 4
    17.     set {_Selector2} to 22
    18.     #Main code below. This random integer is the time length of the crate opening, which is random.
    19.     loop (random integer between 21 and 50) times:
    20.         #If they close their inventory stop the system
    21.         if inventory name of player's current inventory is not {@name}:
    22.             stop
    23.         #The {_sel} tells the script how many item slots there are, in order to save them.
    24.         set {_sel} to 21
    25.         loop {_sel} times:
    26.             #This is the data saving for the scroll effect
    27.             set {_sel2} to {_sel} - 1
    28.             set {_item::%{_sel}%} to {_item::%{_sel2}%}
    29.             subtract 1 from {_sel}
    30.         #Grab a new item from the options
    31.         set {_item::1} to a random element out of {_roll::*}
    32.         #This below just updates the GUI
    33.         loop integers between 0 and inventory size of player's current inventory - 1:
    34.             if loop-number-2 is {_Selector1} or {_Selector2}:
    35.                 set slot loop-number-2 of player's current inventory to shiny light green stained glass pane named " "
    36.             else:
    37.                 set slot loop-number-2 of player's current inventory to black stained glass pane named " "
    38.             loop 9 times:
    39.                 set slot 8 + loop-number-3 of player's current inventory to {_item::%loop-number-3%}
    40.         #This below is just sound. It plays it for the player.
    41.         add 1 to {_sound}
    42.         if {_sound} > 3:
    43.             set {_sound} to 1
    44.         if {_sound} = 1:
    45.             play BLOCK_NOTE_PLING for player with volume 1 and pitch 4
    46.         else if {_sound} = 2:
    47.             play BLOCK_NOTE_PLING for player with volume 1 and pitch 3
    48.         else if {_sound} = 3:
    49.             play BLOCK_NOTE_PLING for player with volume 1 and pitch 1
    50.         add 1 to {_speed}
    51.         #This below causes the crate to slow down when it gets closer to the end of the animation. The greater the {_speed} test, the longer the tick delay will be.
    52.         #Meaning it will slow down more of the speed every X number of updates.
    53.         if {_speed} is 5:
    54.             set {_speed} to 0
    55.             add 1 to {_speedFinal}
    56.         loop {_speedFinal} times:
    57.             wait a tick
    58.     #This is where you can give players or test for which item has won and give stuff based on that item.
    59.     set {_wonItem} to slot 13 of player's current inventory
    60.     message "You won %{_wonItem}%"
    61.     give player {_wonItem}
    62. #This is just a system so that they can't steal any of the items
    63. on inventory click:
    64.     if inventory name of player's current inventory is {@name}:
    65.         cancel event
    Hypixel soul crate
    [​IMG]
    [​IMG]
    Code (Skript):
    1. options:
    2.     #This is the name of the crate
    3.     name: "&6Crates System"
    4. on rightclick on gold block:
    5.     player is not sneaking
    6.     cancel event
    7.     open chest with 5 rows named {@name} to player
    8.     #Add your items below
    9.     #If you want to adjust the percent of an item. Add more of the other items.
    10.     #So if you want to make beacons rare. Add every item except beacon again. This raises the chance to get a different item than beacon.
    11.     add stone, diamond, diamond sword, gold block, redstone, redstone block, beacon, name tag, emerald and gravel to {_roll::*}
    12.     add dirt named "&6DIRT" to {_roll::*}
    13.     #Speed option safety net, so running 0 ticks doesn't crash your server.
    14.     #This is basically how fast the rolling starts (Should be higher than 0)
    15.     set {_speedFinal} to 2
    16.     #Selector settings (Where the selectors should be)
    17.     set {_Selector1} to 21
    18.     set {_Selector2} to 23
    19.     #Main code below. This random integer is the time length of the crate opening, which is random.
    20.     loop (random integer between 10 and 40) times:
    21.         #If they close their inventory stop the system
    22.         if inventory name of player's current inventory is not {@name}:
    23.             stop
    24.         #The {_sel} tells the script how many item slots there are, in order to save them.
    25.         set {_sel} to 5
    26.         loop {_sel} times:
    27.             #This is the data saving for the scroll effect
    28.             set {_sel2} to {_sel} - 1
    29.             set {_item::%{_sel}%} to {_item::%{_sel2}%}
    30.             subtract 1 from {_sel}
    31.         #Grab a new item from the options
    32.         set {_item::1} to a random element out of {_roll::*}
    33.         #This below just updates the GUI
    34.         loop integers between 0 and inventory size of player's current inventory - 1:
    35.             if loop-number-2 is {_Selector1} or {_Selector2}:
    36.                 set slot loop-number-2 of player's current inventory to shiny light green stained glass pane named " "
    37.             else:
    38.                 set slot loop-number-2 of player's current inventory to black stained glass pane named " "
    39.             loop 5 times:
    40.                 set slot -5 + (9 * loop-number-3) of player's current inventory to {_item::%loop-number-3%}
    41.         #This below is just sound. It plays it for the player.
    42.         add 1 to {_sound}
    43.         if {_sound} > 3:
    44.             set {_sound} to 1
    45.         if {_sound} = 1:
    46.             play BLOCK_NOTE_PLING for player with volume 1 and pitch 4
    47.         else if {_sound} = 2:
    48.             play BLOCK_NOTE_PLING for player with volume 1 and pitch 3
    49.         else if {_sound} = 3:
    50.             play BLOCK_NOTE_PLING for player with volume 1 and pitch 1
    51.         add 1 to {_speed}
    52.         #This below causes the crate to slow down when it gets closer to the end of the animation. The greater the {_speed} test, the longer the tick delay will be.
    53.         #Meaning it will slow down more of the speed every X number of updates.
    54.         if {_speed} is 5:
    55.             set {_speed} to 0
    56.             add 1 to {_speedFinal}
    57.         loop {_speedFinal} times:
    58.             wait a tick
    59.     #This is where you can give players or test for which item has won and give stuff based on that item.
    60.     set {_wonItem} to slot 22 of player's current inventory
    61.     message "You won %{_wonItem}%"
    62.     give player {_wonItem}
    63. #This is just a system so that they can't steal any of the items
    64. on inventory click:
    65.     if inventory name of player's current inventory is {@name}:
    66.         cancel event
    Lightning bolt crate
    [​IMG]
    Code (Skript):
    1. options:
    2.     #This is the name of the crate
    3.     name: "&6Crates System"
    4. on rightclick on diamond block:
    5.     player is not sneaking
    6.     cancel event
    7.     open chest with 5 rows named {@name} to player
    8.     #Add your items below
    9.     #If you want to adjust the percent of an item. Add more of the other items.
    10.     #So if you want to make beacons rare. Add every item except beacon again. This raises the chance to get a different item than beacon.
    11.     add stone, diamond, diamond sword, gold block, redstone, redstone block, beacon, name tag, emerald and gravel to {_roll::*}
    12.     add dirt named "&6DIRT" to {_roll::*}
    13.     #Speed option safety net, so running 0 ticks doesn't crash your server.
    14.     #This is basically how fast the rolling starts (Should be higher than 0)
    15.     set {_speedFinal} to 2
    16.     #Selector settings (Where the selectors should be)
    17.     set {_Selector1} to 13
    18.     set {_Selector2} to 31
    19.     set {_Selector3} to 21
    20.     set {_Selector4} to 23
    21.     #Main code below. This random integer is the time length of the crate opening, which is random.
    22.     loop (random integer between 20 and 50) times:
    23.         #If they close their inventory stop the system
    24.         if inventory name of player's current inventory is not {@name}:
    25.             stop
    26.         #The {_sel} tells the script how many item slots there are, in order to save them.
    27.         set {_sel} to 7
    28.         loop {_sel} times:
    29.             #This is the data saving for the scroll effect
    30.             set {_sel2} to {_sel} - 1
    31.             set {_item::%{_sel}%} to {_item::%{_sel2}%}
    32.             subtract 1 from {_sel}
    33.         #Grab a new item from the options
    34.         set {_item::1} to a random element out of {_roll::*}
    35.         #This below just updates the GUI
    36.         loop integers between 0 and inventory size of player's current inventory - 1:
    37.             if loop-number-2 is {_Selector1}, {_Selector2}, {_Selector3} or {_Selector4}:
    38.                 set slot loop-number-2 of player's current inventory to shiny light green stained glass pane named " "
    39.             else:
    40.                 set slot loop-number-2 of player's current inventory to white stained glass pane named " "
    41.             loop 9 times:
    42.                 if loop-number-3 = 1:
    43.                     set slot 7 of player's current inventory to {_item::%loop-number-3%}
    44.                 else if loop-number-3 = 2:
    45.                     set slot 15 of player's current inventory to {_item::%loop-number-3%}
    46.                 else if loop-number-3 = 3:
    47.                     set slot 14 of player's current inventory to {_item::%loop-number-3%}
    48.                 else if loop-number-3 = 4:
    49.                     set slot 22 of player's current inventory to {_item::%loop-number-3%}
    50.                 else if loop-number-3 = 5:
    51.                     set slot 30 of player's current inventory to {_item::%loop-number-3%}
    52.                 else if loop-number-3 = 6:
    53.                     set slot 29 of player's current inventory to {_item::%loop-number-3%}
    54.                 else if loop-number-3 = 7:
    55.                     set slot 37 of player's current inventory to {_item::%loop-number-3%}
    56.         #This below is just sound. It plays it for the player.
    57.         add 1 to {_sound}
    58.         if {_sound} > 3:
    59.             set {_sound} to 1
    60.         if {_sound} = 1:
    61.             play BLOCK_NOTE_PLING for player with volume 1 and pitch 4
    62.         else if {_sound} = 2:
    63.             play BLOCK_NOTE_PLING for player with volume 1 and pitch 3
    64.         else if {_sound} = 3:
    65.             play BLOCK_NOTE_PLING for player with volume 1 and pitch 1
    66.         add 1 to {_speed}
    67.         #This below causes the crate to slow down when it gets closer to the end of the animation. The greater the {_speed} test, the longer the tick delay will be.
    68.         #Meaning it will slow down more of the speed every X number of updates.
    69.         if {_speed} is 6:
    70.             set {_speed} to 0
    71.             add 1 to {_speedFinal}
    72.         loop {_speedFinal} times:
    73.             wait a tick
    74.     #This is where you can give players or test for which item has won and give stuff based on that item.
    75.     set {_wonItem} to slot 22 of player's current inventory
    76.     message "You won %{_wonItem}%"
    77.     give player {_wonItem}
    78. #This is just a system so that they can't steal any of the items
    79. on inventory click:
    80.     if inventory name of player's current inventory is {@name}:
    81.         cancel event
     
    #1 LimeGlass, Feb 19, 2017
    Last edited: Mar 27, 2018
  2. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Hey LimeGlass, Maybe you could try making a Casino type crate if possible?

    It would be pretty awesome if they have to get the full row in order to collect the item.

    Thanks :emoji_slight_smile:
     
    Dylan The Beast likes this.
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    So like a slot machine?

    Sorta like this?
     
    mel_instagibson likes this.
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    I found an example but with redstone, if its possible to convert it to a gui?

     
    Dylan The Beast likes this.
  5. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    ^ Private messaged this request
     
    #5 ShaneBee, Mar 16, 2017
    Last edited by a moderator: Mar 27, 2018
  6. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    How about a mystery box skript?
     
  7. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    So exactly like Hypixle? It's not a GUI template so idk if I will make it in this thread.
     
    #7 ShaneBee, Mar 16, 2017
    Last edited by a moderator: Jun 7, 2017
  8. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    I would assume so. :emoji_astonished:
     
  9. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Yes :emoji_grinning:
     
  10. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Hello, can you add roullete type like this? I think it looks pretty cool.
    [​IMG]
     
  11. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    https://gfycat.com/FreshDistantEider

    Code (Skript):
    1. function startThisShit(p: player):
    2.   loop 12, 14, 30, 32, 13, 21, 23 and 31:
    3.     set slot loop-value of {_p}'s current inventory to (check [loop-value is 13, 21, 23 or 31] ? light green glass : black glass)
    4.   loop 100 times:
    5.     loop 3, 4, 5, 15, 24, 33, 41, 40, 39, 29, 20 and 11:
    6.       set slot loop-value-2 of {_p}'s current inventory to a random element out of {slotitems::*}
    7.     set slot 22 of {_p}'s current inventory to glowing slot 4 of {_p}'s current inventory
    8.     wait 1 tick
    9.  
    10. command /test:
    11.   trigger:
    12.     open chest with 5 rows named "Spinner Thing" to player
    13.     loop numbers between 0 and (5*9)-1:
    14.       set slot loop-value of player's current inventory to (check [loop-value is 12, 13, 14, 21, 22, 23, 30, 31 or 32] ? green glass : black glass)
    15.  
    16. on inventory click:
    17.   if name of player's current inventory is "Spinner Thing":
    18.     cancel the event
    19.     if clicked slot is 12, 13, 14, 21, 22, 23, 30, 31 or 32:
    20.       if clicked item is green glass:
    21.         startThisShit(player)
    22.       else if clicked slot is 22:
    23.         give item amount of clicked item of type of clicked item to player
    24.         close player's inventory
     
    #11 ShaneBee, Jun 7, 2017
    Last edited by a moderator: Jun 7, 2017
  12. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Nice!

    @MachisCZ If you would like me to make this still, please respond but Pika made a really good template above for you.

    Also what's the invSize(player's current inventory) can you provide that so this works. Also Skellett has an expression to grab the inventory size and amount of rows.
     
    #12 ShaneBee, Jun 7, 2017
    Last edited by a moderator: Mar 18, 2018
  13. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Huh, I thought I removed that before uploading. I edited it out now. You're right, it just gets the amount of rows and returns the numbers from 0 to (amount of slots - 1).
     
  14. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Pikachu's code not working for me: Error. I had no errors when reloading .sk file.
    @LimeGlass can you do it by yourself? Thank you.
     
  15. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    @Pikachu @MachisCZ The error above happened because
    Code (Skript):
    1.  set slot 22 of {_p}'s current inventory to glowing slot 4 of {_p}'s current inventory
    slot 4 of {_p}'s current inventory returned null. Pika clearly tested on a server that you're not using. If you're using 1.8 it returns null I think. If you use 1.9+ it returns as air rather than null. I will fix this error from being in the console but it won't work even if I fix it. It's an issue in the script btw.
     
  16. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    I am on 1.11 and using syntaxes from templates from this forum with no problems.
     
  17. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Nah, the issue is probably that he didn't put any items in the {slotitems::*} variable which resulted in the NPE because if he had the slot wouldn't be null since the code only runs after filling all the slots. @MachisCZ you have to put the items you want to have in the gui in the {slotitems::*} list
     
  18. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    I have some (6) items in {slotitems::*} but still getting same error in console :/
    Skript: 2.2 dev-25 Bensku
    Error : https://hastebin.com/kifipuqese.vbs
    Code (Skript):
    1. command /machistest:
    2.     permission: machis.test
    3.     trigger:
    4.         add apple to {slotitems::*}
    5.         add stick to {slotitems::*}
    6.         add diamond to {slotitems::*}
    7.         add gold to {slotitems::*}
    8.         add emerald to {slotitems::*}
    9.         add coal to {slotitems::*}
    10.         broadcast "%{slotitems::*}%"
    11.        
    12.  
    13. function startThisShit(p: player):
    14.   loop 12, 14, 30, 32, 13, 21, 23 and 31:
    15.     set slot loop-value of {_p}'s current inventory to (check [loop-value is 13, 21, 23 or 31] ? light green glass : black glass)
    16.   loop 100 times:
    17.     loop 3, 4, 5, 15, 24, 33, 41, 40, 39, 29, 20 and 11:
    18.       set slot loop-value-2 of {_p}'s current inventory to a random element out of {slotitems::*}
    19.     set slot 22 of {_p}'s current inventory to glowing slot 4 of {_p}'s current inventory
    20.     wait 1 tick
    21.  
    22. command /test:
    23.   trigger:
    24.     open chest with 5 rows named "Spinner Thing" to player
    25.     loop numbers between 0 and (5*9)-1:
    26.       set slot loop-value of player's current inventory to (check [loop-value is 12, 13, 14, 21, 22, 23, 30, 31 or 32] ? green glass : black glass)
    27.  
    28. on inventory click:
    29.   if name of player's current inventory is "Spinner Thing":
    30.     cancel the event
    31.     if clicked slot is 12, 13, 14, 21, 22, 23, 30, 31 or 32:
    32.       if clicked item is green glass:
    33.         startThisShit(player)
    34.       else if clicked slot is 22:
    35.         give item amount of clicked item of type of clicked item to player
    36.         close player's inventory
     
  19. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    You can either check if the slot is set before that line or try removing the word glowing
     
  20. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Hey, are you still making theese type of crate templates?
     

Share This Page

Loading...