Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Make sure to the following below.
- #
- # Go to, Skript > config.sk > enable effective commands > Go in game > /sk reload config > Type in chat, "!set {CrateLoc} to location of player" above the crate block, make sure it is centered!.
- #
- options:
- name: "&8Crate"
- function Crate(p: player):
- open chest with 3 rows named {@name} to {_p}
- set {Crate} to true
- add dirt named "&7&oThe dirt block.." to {_roll::*}
- set {_speedFinal} to 2
- set {_Selector1} to 4
- set {_Selector2} to 22
- loop (random integer between 21 and 50) times:
- if {Crate} isn't set:
- stop
- set {_sel} to 21
- loop {_sel} times:
- set {_sel2} to {_sel} - 1
- set {_item::%{_sel}%} to {_item::%{_sel2}%}
- subtract 1 from {_sel}
- #Grab a new item from the options
- set {_item::1} to a random element out of {_roll::*}
- loop integers between 0 and inventory size of {_p}'s current inventory - 1:
- set {_loop} to loop-number-2
- if {_loop} is {_Selector1} or {_Selector2}:
- set slot loop-number-2 of {_p}'s current inventory to orange stained glass pane named " "
- else:
- set slot loop-number-2 of {_p}'s current inventory to black stained glass pane named " "
- loop 9 times:
- set slot 8 + loop-number-3 of {_p}'s current inventory to {_item::%loop-number-3%}
- add 1 to {_sound}
- if {_sound} > 3:
- set {_sound} to 1
- if {_sound} = 1:
- play sound "ui.button.click" with volume 1 and pitch 4 at {_p}
- else if {_sound} = 2:
- play sound "ui.button.click" with volume 1 and pitch 4 at {_p}
- else if {_sound} = 3:
- play sound "ui.button.click" with volume 1 and pitch 2 at {_p}
- add 1 to {_speed}
- if {_speed} is 5:
- set {_speed} to 0
- add 1 to {_speedFinal}
- loop {_speedFinal} times:
- wait a tick
- set {_wonItem} to slot 13 of {_p}'s current inventory
- delete {Crate}
- close inventory of {_p}
- # adding if {_wonItem} is dirt would detect the won item and display your custom needs.
- if {_wonItem} is dirt:
- message "&aYou won the darn freaking &c&lOG &adirt block!!" to {_p}
- create holo object "&6&lCRATE NAME;;ItemStack:Dirt;" with id "Prize" at location of {CrateLoc}
- give {_p} {_wonItem}
- wait 3 seconds
- delete holo object "Prize"
- on inventory click:
- if inventory name of player's current inventory is {@name}:
- cancel event
- on inventory close:
- if {Crate} is true:
- delete {Crate}
- wait 3 ticks
- Crate(player)
- on rightclick on end portal frame:
- if player is holding a prismarine shard named "Crate Key":
- if {Crate} isn't true:
- Crate(player)
- remove 1 prismarine shard named "Crate Key" from player
- else:
- send "&cThis crate is currently being used."
- else:
- send "&cYou do not have the correct crate key for this!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement