1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT??:

    You can always check our our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Chest refill

Discussion in 'Skript' started by Maezukie, Aug 21, 2018.

Thread Status:
Not open for further replies.
  1. Maezukie

    Maezukie Member

    Joined:
    May 21, 2018
    Messages:
    15
    Likes Received:
    0
    the error I'm getting is
    Code (Skript):
    1. command /chest:
    2.     permission: chest.sk
    3.     trigger:
    4.         loop {chestloc::*}:
    5.             if loop-value is a chest:
    6.                 clear loop-value's inventory
    7.                 set {_item} to a random number between 3 and 6
    8.                 loop {_item} times:
    9.                     set {_randomitem} to random element out of {random.item.list::*}
    10.                     add {_randomitem} to the block at loop-value's inventory #<--- The error line
    11.         broadcast "&aChests Refilled! &fNext refill, 5 minutes"
     
  2. T

    TPGamesNL Well-Known Member

    Joined:
    Jan 20, 2018
    Messages:
    1,234
    Likes Received:
    71
    Medals:
    Try removing the "block at" part since loop-value is already a block.
     
  3. Maezukie

    Maezukie Member

    Joined:
    May 21, 2018
    Messages:
    15
    Likes Received:
    0
    Nope same error
     
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,007
    Likes Received:
    138
    try "clear inventory of loop-value"
     
  5. Maezukie

    Maezukie Member

    Joined:
    May 21, 2018
    Messages:
    15
    Likes Received:
    0
    that's not the problem
     
  6. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,007
    Likes Received:
    138
    "There's no loop that matches 'loop-value's inventory' (chest.sk, line 51: add {_randomitem} to the block at loop-value's inventory')"
    try add {_randomitem} to inventory of block at loop-value
     
  7. Maezukie

    Maezukie Member

    Joined:
    May 21, 2018
    Messages:
    15
    Likes Received:
    0
     
  8. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,007
    Likes Received:
    138
    loop-value-1
     
  9. Maezukie

    Maezukie Member

    Joined:
    May 21, 2018
    Messages:
    15
    Likes Received:
    0
    no errors but the chests dont refill
    --- Double Post Merged, Aug 22, 2018, Original Post Date: Aug 22, 2018 ---
    Heres the full code
    Code (Skript):
    1. on load:
    2.     delete {random.item.list::*}
    3.     add 2 diamond to {random.item.list::*}
    4.     add 2 iron ingot to {random.item.list::*}
    5.     add 2 leather to {random.item.list::*}
    6.     add 2 tnt to {random.item.list::*}
    7.     add 1 flint and steel to {random.item.list::*}
    8.     add 1 golden apple to {random.item.list::*}
    9.     add 4 cooked beef to {random.item.list::*}
    10.     add 32 stone to {random.item.list::*}
    11.     add 32 cobble stone to {random.item.list::*}
    12.     add 4 cooked porkchop to {random.item.list::*}
    13.     add 32 wooden plank to {random.item.list::*}
    14.     add 2 apple to {random.item.list::*}
    15.     add 1 stone sword to {random.item.list::*}
    16.     add 1 stone pickaxe to {random.item.list::*}
    17.     add 1 stone axe to {random.item.list::*}
    18.     add 1 leather leggings to {random.item.list::*}
    19.     add 1 leather boots to {random.item.list::*}
    20.     add 1 leather chestplate to {random.item.list::*}
    21.     add 1 leather helmet to {random.item.list::*}
    22.     add 4 snowball to {random.item.list::*}
    23.     add 4 arrow to {random.item.list::*}
    24.     add 1 bow to {random.item.list::*}
    25.     add 1 iron sword to {random.item.list::*}
    26.     add 1 iron pickaxe to {random.item.list::*}
    27.     add 1 iron axe to {random.item.list::*}
    28.     add 1 iron leggings to {random.item.list::*}
    29.     add 1 iron boots to {random.item.list::*}
    30.     add 1 iron chestplate to {random.item.list::*}
    31.     add 1 iron helmet to {random.item.list::*}
    32.     add 1 diamond sword to {random.item.list::*}
    33.     add 1 diamond pickaxe to {random.item.list::*}
    34.     add 1 diamond axe to {random.item.list::*}
    35.     add 1 diamond boots to {random.item.list::*}
    36.     add 1 diamond leggings to {random.item.list::*}
    37.     add 1 diamond helmet to {random.item.list::*}
    38.     add 1 diamond chestplate to {random.item.list::*}
    39.     wait 1 tick
    40.     execute console command "/chest"
    41.  
    42. command /chest:
    43.     permission: chest.sk
    44.     trigger:
    45.         loop {chestloc::*}:
    46.             if loop-value is a chest:
    47.                 clear loop-value's inventory
    48.                 set {_item} to a random number between 3 and 6
    49.                 loop {_item} times:
    50.                     set {_randomitem} to random element out of {random.item.list::*}
    51.                     add {_randomitem} to inventory of block at loop-value-1
    52.         broadcast "&aChests Refilled! &fNext refill, 5 minutes"
    53.  
    54. command /setloc:
    55.     permission: Setchest.loc
    56.     trigger:
    57.         if target block is a chest:
    58.             add target block's location to {chestloc::*}
    59.             send "&aChest location added!"
    60.         else:
    61.             send "&cNot a chest"
    62.  
    63. every 5 minutes:
    64.     execute console command "/chest"
     
  10. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,007
    Likes Received:
    138
    okay, so:
    add target block's location to {chestloc::*}
    You are adding a location the variable

    then:
    loop {chestloc::*}:
    if loop-value is a chest:

    you are checking if the loop value is a chest? But the loop value is a location
     
  11. Maezukie

    Maezukie Member

    Joined:
    May 21, 2018
    Messages:
    15
    Likes Received:
    0
    oh, how would I fix this
     
  12. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,007
    Likes Received:
    138
    Code (Skript):
    1. if target block is a chest:
    2.             add target block's location to {chestloc::*}
    when setting the variable, you already have it check for the chest....

    so in this one... remove the condition checking the chest
    Code (Skript):
    1.  loop {chestloc::*}:
    2.             if loop-value is a chest:
    3.                 clear loop-value's inventory
     
Thread Status:
Not open for further replies.
Loading...