Solved Refill chest issue

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Ariuw

Member
Sep 6, 2017
42
1
8
30
Hello there, I've been trying to refill chests between coordinates but I can't get it to work.. no errors are given tho. Here's the full code:

Code:
on load:
   delete {random2.item.list::*}
   add 1 diamond leggings to {random2.item.list::*}
   add 1 diamond helmet to {random2.item.list::*}
   add 1 diamond chestplate to {random2.item.list::*}
   wait 1 tick
   execute console command "/refill"

command /refill:
   permission: chest.sk
   trigger:
       set {_item} to a random number between 3 and 6
       loop all blocks between {_location-1} and {_location-2}:
           if loop-blocks is a chest:
               loop {_item} times:
                   wait 5 ticks
                   set {_randomitem} to random element out of {random2.item.list::*}
                   wait 4 ticks
                   add {_randomitem} to inventory of block at loop-value-1
               broadcast "&aChests Refilled! &fNext refill, 5 minutes"


command /loc2:
   permission: loc.1
   trigger:
       set {_location-1} to location of player
       broadcast {_location-1}
           
command /loc1:
   permission: loc.1
   trigger:
       set {_location-2} to location of player
       broadcast {_location-2}


every 5 minutes:
   execute console command "/refill"
 
Hello there, I've been trying to refill chests between coordinates but I can't get it to work.. no errors are given tho. Here's the full code:

Code:
on load:
   delete {random2.item.list::*}
   add 1 diamond leggings to {random2.item.list::*}
   add 1 diamond helmet to {random2.item.list::*}
   add 1 diamond chestplate to {random2.item.list::*}
   wait 1 tick
   execute console command "/refill"

command /refill:
   permission: chest.sk
   trigger:
       set {_item} to a random number between 3 and 6
       loop all blocks between {_location-1} and {_location-2}:
           if loop-blocks is a chest:
               loop {_item} times:
                   wait 5 ticks
                   set {_randomitem} to random element out of {random2.item.list::*}
                   wait 4 ticks
                   add {_randomitem} to inventory of block at loop-value-1
               broadcast "&aChests Refilled! &fNext refill, 5 minutes"


command /loc2:
   permission: loc.1
   trigger:
       set {_location-1} to location of player
       broadcast {_location-1}
          
command /loc1:
   permission: loc.1
   trigger:
       set {_location-2} to location of player
       broadcast {_location-2}


every 5 minutes:
   execute console command "/refill"
Does "&aChests Refilled! &fNext refill, 5 minutes" get broadcasted?
 
Status
Not open for further replies.