Chest Refill bug

  • 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
Hello guys! I found a bug I think, because this thing worked now it don't
Code:
code_language.skript:
command /chestreset [<text>]:
    trigger:
        if player is op:
            if arg-1 is set:
                delete {listofspawnpoint.%arg-1%::*}
                add {skyw.cagespawn1.%arg-1%} to {listofspawnpoint.%arg-1%::*}
                add {skyw.cagespawn2.%arg-1%} to {listofspawnpoint.%arg-1%::*}
                add {skyw.cagespawn3.%arg-1%} to {listofspawnpoint.%arg-1%::*}
                add {skyw.cagespawn4.%arg-1%} to {listofspawnpoint.%arg-1%::*}
                add {skyw.cagespawn5.%arg-1%} to {listofspawnpoint.%arg-1%::*}
                add {skyw.cagespawn6.%arg-1%} to {listofspawnpoint.%arg-1%::*}
                add {skyw.cagespawn7.%arg-1%} to {listofspawnpoint.%arg-1%::*}
                add {skyw.cagespawn8.%arg-1%} to {listofspawnpoint.%arg-1%::*}
                add {skyw.cagespawn9.%arg-1%} to {listofspawnpoint.%arg-1%::*}
                add {skyw.cagespawn10.%arg-1%} to {listofspawnpoint.%arg-1%::*}
                add {skyw.cagespawn11.%arg-1%} to {listofspawnpoint.%arg-1%::*}
                add {skyw.cagespawn12.%arg-1%} to {listofspawnpoint.%arg-1%::*}      
                loop {listofspawnpoint.%arg-1%::*}:
                    loop all blocks in radius 10 of loop-value:              
                        set {_chestpatern.mid} to a random integer between 1 and 1
                        if loop-block is a chest:
                            if {_chestpatern.mid} is 1:              
                                clear loop-block's inventory                  
                                clear {list.p1::*}
                                loop {chestitems.p1.::*}:
                                    add loop-value-2 to {list.p1::*}
                                wait 5 ticks
                                loop {list.p1::*}:
                                    set {_slot} to a random number between 1 and 27
                                    set slot {_slot} of loop-block to loop-value-2      
                                    remove loop-value-2 from {list.p1::*}  
                                                                       
                            if {_chestpatern.mid} is 2:          
                                clear loop-block's inventory
                                clear {list.p2::*}
                                loop {chestitems.p2.::*}:
                                    add loop-value-2 to {list.p2::*}
                                wait 5 ticks
                                loop {list.p2::*}:
                                    set {_slot} to a random number between 1 and 27
                                    set slot {_slot} of loop-block to loop-value-2      
                                    remove loop-value-2 from {list.p2::*}  
                                                                                   
                            if {_chestpatern.mid} is 3:              
                                clear loop-block's inventory                  
                                clear {list.p3::*}
                                loop {chestitems.p3.::*}:
                                    add loop-value-2 to {list.p3::*}                              
                                wait 5 ticks
                                loop {list.p3::*}:
                                    set {_slot} to a random number between 1 and 27
                                    set slot {_slot} of loop-block to loop-value-2      
                                    remove loop-value-2 from {list.p3::*}      
                                                                               
                            if {_chestpatern.mid} is 4:      
                                clear loop-block's inventory
                                clear {list.p4::*}
                                loop {chestitems.p4.::*}:
                                    add loop-value-2 to {list.p4::*}
                                wait 5 ticks
                                loop {list.p4::*}:
                                    set {_slot} to a random number between 1 and 27
                                    set slot {_slot} of loop-block to loop-value-2      
                                    remove loop-value-2 from {list.p4::*}
Result in screenshot

Items:

code_language.skript:
on load:
    clear {chestitems.p1::*}
    clear {chestitems.p2.::*}
    clear {chestitems.p3.::*}
    clear {chestitems.p4.::*}
    clear {chestitems.p5.::*}
    clear {chestitems.p6.::*}
    
    add 2 golden apple to {chestitems.p5.::*}
    add 1 golden apple to {chestitems.p5.::*}
    add 4 golden apple to {chestitems.p5.::*}
    add 1 diamond chestplate of protection 3 to {chestitems.p5.::*}
    add 1 diamond leggings of protection 2 to {chestitems.p5.::*}
    add 1 diamond sword of sharpness 3 to {chestitems.p5.::*}
    add 64 snowball to {chestitems.p5.::*}
    add 64 egg to {chestitems.p5.::*}
    add 64 egg to {chestitems.p5.::*}
    add 10 tnt to {chestitems.p5.::*}
    add 23 tnt to {chestitems.p5.::*}
    add 1 flint and steel to {chestitems.p5.::*}
    add 1 fishing rod of knockback 3 to {chestitems.p5.::*}
    add 64 stone to {chestitems.p5.::*}
    add 43 stone to {chestitems.p5.::*}
    add 32 planks to {chestitems.p5.::*}
                
    add 3 golden apple to {chestitems.p6.::*}
    add 1 fishing rod of knockback 2 to {chestitems.p6.::*}
    add 1 diamond sword to {chestitems.p6.::*}
    add 1 flint and steel to {chestitems.p6.::*}
    add 1 diamond leggings of protection 1 to {chestitems.p6.::*}
    add 1 diamond helmet of protection 2 to {chestitems.p6.::*}
    add 64 stone to {chestitems.p6.::*}
    add 2 golden apple to {chestitems.p6.::*}
    add 3 golden apple to {chestitems.p6.::*}
    add 20 tnt to {chestitems.p6.::*}
    add 10 tnt to {chestitems.p6.::*}
    add 1 water_bottle:16393 to {chestitems.p6.::*}
    add 1 water_bottle:16388 to {chestitems.p6.::*}

    add 10 arrows to {chestitems.p1.::*}
    add 1 diamond sword of sharpness 1 to {chestitems.p1::*}
    add 1 bow of power 3 to {chestitems.p1::*}
    add 1 bow of power 3 to {chestitems.p1::*}
    add 1 diamond helmet to {chestitems.p1::*}
    add 1 diamond boots to {chestitems.p1::*}
    add 1 iron chestplate to {chestitems.p1::*}
    add 1 iron leggings to {chestitems.p1::*}
    add 16 egg to {chestitems.p1.::*}
    add 1 fishing rod of knockback 1 to {chestitems.p1::*}
    add 1 lava bucket to {chestitems.p1::*}
    add 1 water_bottle:16386 to {chestitems.p1::*}
    add 24 planks to {chestitems.p1::*}
    add 1 diamond axe to {chestitems.p1.::*}
    add 12 stone to {chestitems.p1::*}
    add 1 diamond pickaxe to {chestitems.p1.::*}       

    add 1 iron sword of sharpness 3 to {chestitems.p2.::*}
    add 1 fishing rod to {chestitems.p2.::*}
    add 35 planks to {chestitems.p2.::*}
    add 20 stone to {chestitems.p2.::*}
    add 16 snowball to {chestitems.p2.::*}
    add 35 stone to {chestitems.p2.::*}
    add 1 iron helmet to {chestitems.p2::*}
    add 1 water_bottle:16388 to {chestitems.p2.::*}
    add 1 iron boots to {chestitems.p2::*}
    add 1 iron axe to {chestitems.p2.::*}
    add 1 iron chestplate to {chestitems.p2::*}
    add 1 iron leggings to {chestitems.p2::*}
    add 13 steak to {chestitems.p2::*}
    add 1 water bucket to {chestitems.p2::*}
    add 1 diamond pickaxe to {chestitems.p2.::*}   

    add 1 stone sword of sharpness 3 to {chestitems.p3.::*}
    add 16 egg to {chestitems.p3.::*}
    add 46 stone to {chestitems.p3.::*}
    add 32 planks to {chestitems.p3.::*}
    add 1 iron helmet to {chestitems.p3.::*}
    add 1 iron leggings to {chestitems.p3.::*}
    add 1 diamond boots to {chestitems.p3.::*}
    add 1 water bucket to {chestitems.p3.::*}
    add 1 lava bucket to {chestitems.p3.::*}
    add 16 snowball to {chestitems.p3.::*}
    add 1 diamond pickaxe to {chestitems.p3.::*}
    add 1 iron axe to {chestitems.p3.::*}               

    add 1 diamond sword to {chestitems.p4.::*}
    add 1 fishing rod to {chestitems.p4.::*}
    add 32 stone to {chestitems.p4.::*}
    add 10 stone to {chestitems.p4.::*}
    add 16 egg to {chestitems.p4.::*}
    add 1 water_bottle:16388 to {chestitems.p4.::*}
    add 16 snowball to {chestitems.p4.::*}
    add 16 steak to {chestitems.p4.::*}
    add 1 water_bottle:16385 to {chestitems.p4.::*}
    add 1 diamond chestplate to {chestitems.p4.::*}
    add 1 diamond leggings to {chestitems.p4.::*}
    add 1 iron boots to {chestitems.p4.::*}
    add 1 iron helmet to {chestitems.p4.::*}
    add 1 golden apple to {chestitems.p4.::*}
Sk Version: 2.2
Mc: 1.8

Help me!
Thanks <3
 

Attachments

  • 2017-06-03_17.09.49.png
    2017-06-03_17.09.49.png
    232.6 KB · Views: 121
"loop-value-2" needs to be "loop-value-3" in these lines:
code_language.skript:
set slot {_slot} of loop-block to loop-value-2
 
If "{list.p1::*}" is supposed to be a list of the items then the "loop-value-2" in line 26 also needs to be "loop-value-3"
 
Is it only 3 items every time? Since you're setting the slot to a random slot, it's possible that it chose the same one of those 3 slots each loop iteration, therefore just replacing the item that was previously in that slot and resulting in only 3 items at the end.
 
I'm not quite sure what the problem is then. Try broadcasting "{chestitems.p1.::*}" and "{list.p1::*}" and see if they're what you expect them to be.

They way you're doing this right now should be filling the chest with all of the items in your list (expect if a slot is chosen twice)... is that what you want? If you want it to fill it with a random amount of items then do something more like this:
code_language.skript:
loop random amount of times: 
    set {var} to random element of {item_list} 
    set {slot} to random integer between 1 and 27
    set slot {slot} of loop-block to {var}
Obviously that's just a rough outline
 
I want to fill chest with 1 chest pattern
[doublepost=1496590442,1496590077][/doublepost]And chest wouldnt be with same items
[doublepost=1496604640][/doublepost]I tried your skript, don't work for use
 
Status
Not open for further replies.