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
broadcast "Chest spawned at %{location.%{_random}%.chestspawn}%"
on rightclick:
if clicked block is ender chest
loop integers between 1 and 5
clicked block's location is {location.%loop-number%.chestspawn}
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 only the spawned in enderchests to be affected by the script so I tried using a loop integers but I get errors that I don't know how to fix them:
Code:
[20:37:08 ERROR]: [Skript] Can't compare 'if clicked block' with an item type (Zeta.sk, line 19: if clicked block is ender chest')
[20:37:08 ERROR]: [Skript] Can't understand this condition/effect: loop integers between 1 and 5 (Zeta.sk, line 20: loop integers between 1 and 5')
[20:37:08 ERROR]: [Skript] There's no loop that matches 'loop-number' (Zeta.sk, line 21: clicked block's location is {location.%loop-number%.chestspawn}')
maybe someone can help me indent it and place the right tabs because I'm so lost and don't know what to do.
kind regards
hasanas
[doublepost=1486928701,1486928449][/doublepost]I basically want a script that allows me to set 5 spawns for chests that spawn in regularily, that give out rewards, I just don't know how to make it so ONLY the SPAWNED chests give out rewards, I think my current solution is pretty good but I don't know how or why it still gives me errors, if someone could help me indent it a bit or maybe correct some errors, it'd be great!