Hey there! I've been making a script but I've run into a problem, here is the code:
I need it so only the spawned ender chests give loot and not placed ones, as you see I tried making it a NAMED ender chest but that doesn't work either since it gives me this error:
Kind regards
hasanas
Code:
variables:
{rewards::1} = stick
{rewards::2} = diamond
{rewards::3} = apple
command /chestspawn <integer>:
usage: /chestspawn <1-5>
trigger:
arg-1 is between 1 and 5:
set {location.%arg-1%.chestspawn} to player's location
send "Chestspawn %arg-1% created."
every 1 minute:
set {_random} to a random integer between 1 and 5
set block at {location.%{_random}%.chestspawn} to ender chest named "&cLootCrate"
broadcast "Chest spawned at %{location.%{_random}%.chestspawn}%"
on rightclick:
if clicked block is ender chest named "&cLootCrate"
cancel event
if {LootCrate.open} is true:
message "&cSomeone else opened this crate already" to player
stop
else:
set {LootCrate.open} to true
wait 0.5 seconds
give player a random item out of {rewards::*}
launch burst firework colored blue at clicked block timed 0.1
wait 0.5 seconds
set {LootCrate.open} to false
I need it so only the spawned ender chests give loot and not placed ones, as you see I tried making it a NAMED ender chest but that doesn't work either since it gives me this error:
Code:
Can't compare 'if clicked block' with an item type (Zeta.sk, line 19: if clicked block is ender chest named "&cLootCrate"')
Kind regards
hasanas