Paste #38310: Edit of P#38309 Random Chest

Date: 2016/12/14 10:24:03 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


######################################################################
#Random Chest Instructions: Simply insert this script into your      #
#scripts folder. Once inserted, you can easily copy and paste, then  #
#edit the appropriate sections.                                      #
#The areas you need to edit are noted below.                         #
#To Make a new chest: Copy everything below "on player right clicks  #
#chest:" and paste it before the last "- queue clear".               #
#To add items, simply add extra "- inventory add" commands or you can#
#also add cash using the "money" command. You can add as many to     #
#each                                                                #
#If statement as you'd like.                                         #
#To change the chance of each item just change the number ranges to  #
#reflect your percentages.                                           #
#Be sure to give your new chests unique flags!!!                     #
######################################################################
randomchest:
  type: world
  events:
    on player right clicks chest:
    - if <context.location.simple> == -2560,61,-2932,world && <player.has_flag[testchest].not> {
      - define contents <util.random.int[1].to[100]>
      - wait .1s
      }
    - if <def[contents]> < 10 {
      - inventory add d:<player.open_inventory> && <player.has_flag[testchest].not> o:i@386
      - flag player testchest
      - queue clear
      }
    - if <def[contents]> >= 10 && <def[contents]> && <player.has_flag[testchest].not> < 20 {
      - inventory add d:<player.open_inventory> o:i@sand[quantity=32]
      - flag player testchest
      - queue clear
      }
    - if <def[contents]> >= 20 && <def[contents]> && <player.has_flag[testchest].not> < 30 {
      - inventory add d:<player.open_inventory> o:i@gold_ingot[quantity=32]
      - flag player testchest
      - queue clear
      }
    - if <def[contents]> >= 30 && <def[contents]> && <player.has_flag[testchest].not> < 40 {
      - inventory add d:<player.open_inventory> o:i@iron_ingot[quantity=32]
      - flag player testchest
      - queue clear
      }
    - if <def[contents]> >= 40 && <def[contents]> && <player.has_flag[testchest].not> < 50 {
      - inventory add d:<player.open_inventory> o:i@stick[quantity=32]
      - flag player testchest
      - queue clear
      }
    - if <def[contents]> >= 50 && <def[contents]> < 60 && <player.has_flag[testchest].not> {
      - inventory add d:<player.open_inventory> o:i@redstone[quantity=32]
      - flag player testchest
      - queue clear
      }
    - if <def[contents]> >= 60 && <def[contents]> < 70 && <player.has_flag[testchest].not> {
      - inventory add d:<player.open_inventory> o:i@stone[quantity=32]
      - flag player testchest
      - queue clear
      }
    - if <def[contents]> >= 70 && <def[contents]> < 80 && <player.has_flag[testchest].not> {
      - inventory add d:<player.open_inventory> o:i@diamond[quantity=32]
      - flag player testchest
      - queue clear
      }
    - if <def[contents]> >= 80 && <def[contents]> < 90 && <player.has_flag[testchest].not> {
      - inventory add d:<player.open_inventory> o:i@dirt[quantity=32]
      - flag player testchest
      - queue clear
      }
    - if <def[contents]> >= 90 && <def[contents]> < 101 && <player.has_flag[testchest].not> {
      - inventory add d:<player.open_inventory> o:i@planks[quantity=32]
      - flag player testchest
      - queue clear
      }
    - queue clear