Chest refill system

  • 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 community!

    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.

MeHow

Active Member
Feb 6, 2017
140
13
18
Lithuania
Hello guys I have problems with Chest refill system , I get no erros 1.8 version of minecraft and 2.2 skript.
code_language.skript:
                            set {_chestpatern} to a random integer between 1 and 4
                            if {_chestpatern} is 1:
                                loop all blocks in radius 20 of {sw.arena.%arg-2%.spawnpoint.11}:          
                                    if loop-block is a chest:  
                                        clear loop-block's inventory      
                                        loop (random integer between 3 and 10) times:
                                            set {_slot} to a random number between 1 and 27
                                            set {_item} to a random element of {chestitems.p1.::*}                                              
                                            add {_item} to block at loop-block  
                                            set slot {_slot} of loop-block to {_item}
                            if {_chestpatern} is 2:
                                loop all blocks in radius 20 of {sw.arena.%arg-2%.spawnpoint.11}:          
                                    if loop-block is a chest:  
                                        clear loop-block's inventory      
                                        loop (random integer between 3 and 10) times:
                                            set {_slot} to a random number between 1 and 27
                                            set {_item} to a random element of {chestitems.p2.::*}                                              
                                            add {_item} to block at loop-block  
                                            set slot {_slot} of loop-block to {_item}                      
                            if {_chestpatern} is 3:
                                loop all blocks in radius 20 of {sw.arena.%arg-2%.spawnpoint.11}:          
                                    if loop-block is a chest:  
                                        clear loop-block's inventory      
                                        loop (random integer between 3 and 10) times:
                                            set {_slot} to a random number between 1 and 27
                                            set {_item} to a random element of {chestitems.p3.::*}                                              
                                            add {_item} to block at loop-block  
                                            set slot {_slot} of loop-block to {_item}
                            if {_chestpatern} is 4:
                                loop all blocks in radius 20 of {sw.arena.%arg-2%.spawnpoint.11}:          
                                    if loop-block is a chest:  
                                        clear loop-block's inventory      
                                        loop (random integer between 3 and 10) times:
                                            set {_slot} to a random number between 1 and 27
                                            set {_item} to a random element of {chestitems.p4.::*}                                              
                                            add {_item} to block at loop-block  
                                            set slot {_slot} of loop-block to {_item}
and it's doesn't work, but if this work i got just 3*10 same items from the list

Thank you

BTW If you can, you can do another system, What i need to do random slots and add items from the random list
 
https://forums.skunity.com/threads/add-random-items-to-chest.2867/ try this
[doublepost=1493458210,1493458090][/doublepost]
  1. code_language.skript:
    on load:
        clear {chestitems::*}
        add 5 wood to {chestitems::*}
        add 1 diamond pickaxe to {chestitems::*}
        add wooden sword of sharpness 2 to {chestitems::*}
        add 1 diamond sword to {chestitems::*}
        add 1 diamond helmet of fire protection 1 to {chestitems::*}
        add 10 arrow to {chestitems::*}
        add 1 ender pearl to {chestitems::*}
        add 23 xp bottle to {chestitems::*}
        add 5 golden apple to {chestitems::*}                   
        add 1 iron sword to {chestitems::*}
        add 1 ender pearl to {chestitems::*}
        add 23 xp bottle to {chestitems::*}       
        add 1 golden apple to {chestitems::*}
        add 1 diamond pickaxe to {chestitems::*}
        add 1 iron axe to {chestitems::*}
        add 1 ender pearl to {chestitems::*}
        add 23 xp bottle to {chestitems::*}
        add 5 golden apple to {chestitems::*}
        add 1 wooden sword of sharpness 2 to {chestitems::*}
        add 1 diamond chestplate of fire protection 1 to {chestitems::*}
        add 12 arrow to {chestitems::*}
        add 1 slimeball of knockback 5 to {chestitems::*}
        add 1 ender pearl to {chestitems::*}
        add 23 xp bottle to {chestitems::*}
        add 5 golden apple to {chestitems::*}
        add 12 stained hardened clay to {chestitems::*}
        add 1 diamond sword to {chestitems::*}
        add diamond chestplate of fire protection 4 to {chestitems::*}
        add 1 bow of flame 1 to {chestitems::*}
        add 1 diamond sword to {chestitems::*}
        add 1 golden boots of fire protection 4 to {chestitems::*}
        add 5 golden apple to {chestitems::*}
        add 12 stained hardened clay to {chestitems::*}
        add 1 golden helmet of fire protection 4 to {chestitems::*}
        add 1 lava bucket to {chestitems::*}
        add 8 cooked beef to {chestitems::*}
        add 23 xp bottle to {chestitems::*}
        add 12 stained hardened clay to {chestitems::*}
        add 1 diamond helmet of fire protection to {chestitems::*}
        add 1 golden sword of fire aspect 1 to {chestitems::*}
        add 1 diamond leggings of fire protection 4 to {chestitems::*}
        add 5 golden apple to {chestitems::*}
        add 12 stained hardened clay to {chestitems::*}
        add 1 wooden sword of sharpness 2 to {chestitems::*}
        add 12 wood to {chestitems::*}
        add 10 arrow  to {chestitems::*}
        add 1 ender pearl to {chestitems::*}
        add 23 xp bottle to {chestitems::*}
        add 5 golden apple to {chestitems::*}
        add 12 stained hardened clay to {chestitems::*}
        add 1 diamond helmet of fire protection 1 to {chestitems::*}
        add 1 diamond pickaxe to {chestitems::*}
        add 1 iron axe to {chestitems::*}
        add 8 stone:1 to {chestitems::*}
        add 1 iron axe to {chestitems::*}
        add 1 ender pearl to {chestitems::*}
        add 23 xp bottle to {chestitems::*}
        add 5 golden apple to {chestitems::*}
        add 1 wooden sword of sharpness 2 to {chestitems::*}
        add 1 diamond sword to {chestitems::*}
        add 12 arrow to {chestitems::*}
        add 1 bow to {chestitems::*}
        add 1 wooden sword of sharpness 2 to {chestitems::*}
        add 1 diamond sword of fire aspect 1 to {chestitems::*}
        add 12 arrow to {chestitems::*}
        add 10 arrow to {chestitems::*}
        add 1 diamond boots of fire protection 4 to {chestitems::*}
        add 1 diamond helmet of fire protection 4 to {chestitems::*}
        add 1 stone sword of fire aspect 1 to {chestitems::*}
        add 1 bow of infinity to {chestitems::*}           
        add 1 golden boots of fire protection 4 to {chestitems::*}
        add 1 iron block to {chestitems::*}
        add 1 stick to {chestitems::*}
        add 1 bow of flame 1 to {chestitems::*}
        add 1 arrow to {chestitems::*}
        add 12 arrow to {chestitems::*}
        add 1 diamond sword to {chestitems::*}
        add 1 diamond sword of sharpness 1 to {chestitems::*}
        add 1 leather chestplate of fire protection 4 to {chestitems::*}
        add 8 stone:1 to {chestitems::*}
    command /items:
        trigger:
            loop all blocks in radius 200 of player:
                if loop-block is a chest:
                    loop (random integer between 1 and 30) times:
                        set {_item} to a random element of {chestitems::*}
                        add {_item} to block at loop-blocks
 
Status
Not open for further replies.