Solved Add random items to chest

  • 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.

MeHow

Active Member
Feb 6, 2017
140
13
18
22
Lithuania
code_language.skript:
                loop all blocks in radius 200 of {sw.arena.%{arena.%loop-player%}%.center}:
                    If loop-block is chest:
                        clear loop-block's inventory
                        wait a second
                        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::*}
                        loop (random integer between 1 and 30) times:
                            set {_chestitem} to random item from {chestitems::*}
                            add {_chestitem} to loop-block

How to fix this thing?What do I need to do that this code will work?
Thx for reply
 
  • Like
Reactions: Ilas
code_language.skript:
                loop all blocks in radius 200 of {sw.arena.%{arena.%loop-player%}%.center}:
                    If loop-block is chest:
                        clear loop-block's inventory
                        wait a second
                        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::*}
                        loop (random integer between 1 and 30) times:
                            set {_chestitem} to random item from {chestitems::*}
                            add {_chestitem} to loop-block

How to fix this thing?What do I need to do that this code will work?
Thx for reply
Any actual in game errors? This should work, possibly try some debugging with the variables. Specifically this one:
code_language.skript:
{sw.arena.%{arena.%loop-player%}%.center}
 
I have problem with variables::*
Try this, and go from that. This code provided should work 100%
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-value
Please reply if there is any problems.
 
Status
Not open for further replies.