Count block type in an area

  • 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 our Wiki for downloads and any other information about Skript!

DarkestVoids

Member
May 28, 2019
3
1
3
19
Hi so I'm trying to count a certain block type within a specified area then set a variable to the amount of blocks for later use.

I've tried to find a method to do this myself but after an hour or so of trying with... lots of errors, I've been unable.

Code:
command /cheststuff:
   trigger:
      loop all blocks in radius 5 of player:
         set {_chestcount} to amount of minecraft:trapped_chest in loop blocks

I literally just need to get the number of trapped chests within the area and save it to the variable.
Any help would be greatly appreciated :emoji_slight_smile:
 
Hi so I'm trying to count a certain block type within a specified area then set a variable to the amount of blocks for later use.

I've tried to find a method to do this myself but after an hour or so of trying with... lots of errors, I've been unable.

Code:
command /cheststuff:
   trigger:
      loop all blocks in radius 5 of player:
         set {_chestcount} to amount of minecraft:trapped_chest in loop blocks

I literally just need to get the number of trapped chests within the area and save it to the variable.
Any help would be greatly appreciated :emoji_slight_smile:
Code:
command /cheststuff:
   trigger:
      clear {count}
      loop all blocks in radius 5 of player:
         if event-block is trapped chest:
            add 1 to {count}

command checkcoint:
   trigger:
      send "&6Chest Count: &c%{count}%" to player
This should probablyyyy work (By the way this wasn't tested so it may not work).
 
Ty for the reply and help,

I've tried it but I get an error for "if event-block is trapped chest:", Says "There's no block in a command event"