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

Solved Placing a chest with specified items in it

Discussion in 'Skript' started by RetroGamerSP, Jul 12, 2017.

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

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    it now semi works but due to the fact that im using a 1 time use item to summon the chest it doesnt go away when empty
     
  2. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    This should work if it doesnt work is cause the item set is not working correctly
    Code (Skript):
    1.  
    2. function chestSummon(player: player):
    3.     #here you get a random block
    4.     set {_block} to random element out of the blocks in radius 10 around {_player}
    5.     broadcast "%{_block}%"
    6.     set block at {_block} to chest
    7.     #Here is where you add the items this is just an example
    8.     add 1 diamond sword to block at {_block}'s inventory
    9.     #Here is where you check if the chest has items
    10.     while block at {_block} is a chest:
    11.         if items in {_block}'s inventory isn't set:
    12.             set block at {_block} to air
    13.         wait 1 tick
    14.  
    15. on rightclick:
    16.     chestSummon(player)
    17.  
     
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    231
    could you also add a loop so if the chosen block is not air it will attempt to choose a different block?
    --- Double Post Merged, Jul 12, 2017, Original Post Date: Jul 12, 2017 ---
     
Thread Status:
Not open for further replies.

Share This Page

Loading...