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.

Supply drop help

Discussion in 'Skript' started by Kasper Renhorn Berg, Feb 10, 2018.

Thread Status:
Not open for further replies.
  1. Kasper Renhorn Berg

    Kasper Renhorn Berg New Member

    Joined:
    Feb 10, 2018
    Messages:
    8
    Likes Received:
    0
    Ive been trying to make a kind of special supply drop skript for my server, but i just cant get it to work.

    I want blocks to fall from the sky and when they hit the ground they should turn into chests with items inside, so this is as far ive got: https://pastebin.com/0yWpVGFZ
     
  2. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    176
    Medals:
    you need to explain what doesn’t work at first glance it doesn’t look like you ever spawn a falling block you just set the locations
     
  3. Kasper Renhorn Berg

    Kasper Renhorn Berg New Member

    Joined:
    Feb 10, 2018
    Messages:
    8
    Likes Received:
    0
    sorry, the problem is that i tried to spawn gravel, it worked but then i have no idea how to change the block once it hits the ground.

    So, i set locations, but i need help with how i should spawn a falling block at the locations but then after that how to replace the block to a chest with items from {item-list::*} once it hits the ground
     
  4. Erry215

    Erry215 New Member

    Joined:
    Feb 8, 2017
    Messages:
    5
    Likes Received:
    0
    You can do:
    Code (Skript):
    1. function fallingChest(location: location, items: items, falltype: itemtype = beacon):
    2.   spawn "falling %{_falltype}%" parsed as an entity type at {_location}
    3.   set {_block} to last spawned entity
    4.   {_block}.setDropItem(false);
    5.   while {_block}.isOnGround() is false:
    6.     wait 1 tick
    7.   {_block}.remove();
    8.   set block at location of {_block} to chest
    9.   wait 1 tick
    10.   set inventory of block at location of {_block} to {item-list::*}
    11.  
     
    #4 Erry215, Feb 10, 2018
    Last edited: Feb 10, 2018
  5. Kasper Renhorn Berg

    Kasper Renhorn Berg New Member

    Joined:
    Feb 10, 2018
    Messages:
    8
    Likes Received:
    0
    Thank you, I do tho get 2 errors
    Error 1:
    "Can't understand this condition/effect: {_block}.setDropItem(false);"

    Error 2:
    "Can't compare '{_block}.isOnGround() with a boolean', line 31: while {_block}.isOnGround() is false:"

    How do i fix these?
     
  6. Uzumaki

    Uzumaki Well-Known Member

    Joined:
    Feb 20, 2017
    Messages:
    310
    Likes Received:
    10
    i think you need skript-mirror.
     
  7. Kasper Renhorn Berg

    Kasper Renhorn Berg New Member

    Joined:
    Feb 10, 2018
    Messages:
    8
    Likes Received:
    0
    Skript mirror is already installed.
     
  8. Erry215

    Erry215 New Member

    Joined:
    Feb 8, 2017
    Messages:
    5
    Likes Received:
    0
    Check your server log, maybe skript-mirror gives you an error on loading and you don't see it

    EDIT: I found an error on my previous code and I edited it. But that error isn't related with your ones
     
    #8 Erry215, Feb 10, 2018
    Last edited: Feb 10, 2018
  9. Kasper Renhorn Berg

    Kasper Renhorn Berg New Member

    Joined:
    Feb 10, 2018
    Messages:
    8
    Likes Received:
    0
    yep, that was it.

    how do i fix this?
    https://pastebin.com/ezqhGW8n
     
  10. ChisleLP

    ChisleLP Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    789
    Likes Received:
    60
    i have it already in my skyblock skript that i public here.

    so the code its:

    Code (Skript):
    1. function fallingchest(p: player, i: text):
    2.         set {_x} to random number between -10000 and 10000
    3.         set {_z} to random number between -10000 and 10000
    4.         set {_loc} to location at ({_x} parsed as number), 250, ({_z} parsed as number)-1 in world "world"
    5.         set block at {_loc} to chest
    6.         set {_true} to true
    7.         while {_true}:
    8.             set block at {_loc} to air
    9.             subtract 1 from y-coord of {_loc}
    10.             set block at {_loc} to chest
    11.             set {_loc1} to {_loc}
    12.             subtract 1 from y-coord of {_loc1}
    13.             if block at {_loc1} is not air:
    14.                 delete {_true}
    15.             wait a ticks
    16.         set {_I::*} to {_i} split at " "
    17.         loop {_i::*}:
    18.             if "%loop-value%" contains "of":
    19.                 set {_a::*} to loop-value split at "_"
    20.                 set {_i} to {_a::3} parsed as item
    21.                 set {_a} to {_a::1} parsed as number
    22.                 add {_a} of {_i} to block at {_loc}
    23.             else:
    24.                 set {_i} to loop-value parsed as item
    25.                 add {_i} to block at {_loc}
    26.  
    So, i edit a bit for you.
    and now you have doing create commands like
    Code (Skript):
    1. command /spawn:
    2.     trigger:
    3.         fallingchest("10_of_Stone 3_of_Diamond_Sword")
    fallingchest(player, "<block> <block> ..."
    1. if you want more than one piece of block than use
    2. fallingchest( "<number>_of_<block> <number>_of_>block>"
    3. if only one item, than use
    4. fallingchest("<block> <block>"
     
    • Like Like x 1
Thread Status:
Not open for further replies.

Share This Page

Loading...