permission: op
trigger:
give player chest named "&6Loot Chest"
on place of chest:
if name of player's held item is "&6Loot Chest":
set {lootchest::%location of event-block%} to true
send actionbar "&aLoot chest placed and registered!" to player
on right click on chest:
set {_loc} to location of clicked block
if {lootchest::%{_loc}%} is set:
cancel event
if difference between now and {looted::%player's uuid%::%{_loc}%} < 60 seconds:
send actionbar "&cThis chest is recharging..." to player
stop
set {looted::%player's uuid%::%{_loc}%} to now
set {_common::*} to bread, stone sword, leather boots
set {_rare::*} to diamond, golden apple, bow
set {_legendary} to netherite sword named "&cGodblade"
set {_inv} to a new chest inventory with 3 rows named "&6Loot Chest"
loop 5 times:
set {_slot} to random integer between 0 and 26
set {_roll} to random number between 1 and 100
if {_roll} <= 60:
set slot {_slot} of {_inv} to random element of {_common::*}
else if {_roll} <= 90:
set slot {_slot} of {_inv} to random element of {_rare::*}
else:
set slot {_slot} of {_inv} to {_legendary}
open {_inv} to player
every 5 minutes:
loop {lootchest::*}:
set {_loc} to loop-value
if block at {_loc} is chest:
set {_inv} to inventory of block at {_loc}
clear {_inv}
set {_loot::*} to bread, iron sword, golden apple, emerald, bow
loop 5 times:
set slot random integer between 0 and 26 of {_inv} to random element of {_loot::*}
#chest loot tables
1 messages · Page 1 of 1 (latest)
cool
- you haven't said what isn't working, only showed the code. What part doesn't work? Any errors it gives you?
- In your
every 5 minutessection at the bottom, you set the{_loc}variable to theloop-value, but what you actually need isloop-index
i said this was solved