• 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.
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
 
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
 
You can do:
code_language.skript:
function fallingChest(location: location, items: items, falltype: itemtype = beacon):
  spawn "falling %{_falltype}%" parsed as an entity type at {_location}
  set {_block} to last spawned entity
  {_block}.setDropItem(false);
  while {_block}.isOnGround() is false:
    wait 1 tick
  {_block}.remove();
  set block at location of {_block} to chest
  wait 1 tick
  set inventory of block at location of {_block} to {item-list::*}
 
Last edited:
You can do:
code_language.skript:
function fallingChest(location: location, items: items, falltype: itemtype = beacon):
  spawn "falling %{_falltype}%" parsed as an entity type at {_location}
  set {_block} to last spawned entity
  {_block}.setDropItem(false);
  while {_block}.isOnGround() is false:
    wait 1 tick
  {_block}.remove();
  set block at location of {_block} to chest
  wait 1 tick
  set inventory of block at location of {_block} to {item-list::*}
#This get's all the blocks around a player and then checks if one of them is a beacon
        loop blocks in radius 4 of player:
            if loop-block is beacon:
#And then it set's that loop-block beacon to a chest
                set loop-block to chest
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?
 
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
 
Last edited:
i have it already in my skyblock skript that i public here.

so the code its:

code_language.skript:
function fallingchest(p: player, i: text):
        set {_x} to random number between -10000 and 10000
        set {_z} to random number between -10000 and 10000
        set {_loc} to location at ({_x} parsed as number), 250, ({_z} parsed as number)-1 in world "world"
        set block at {_loc} to chest
        set {_true} to true
        while {_true}:
            set block at {_loc} to air
            subtract 1 from y-coord of {_loc}
            set block at {_loc} to chest
            set {_loc1} to {_loc}
            subtract 1 from y-coord of {_loc1}
            if block at {_loc1} is not air:
                delete {_true}
            wait a ticks
        set {_I::*} to {_i} split at " "
        loop {_i::*}:
            if "%loop-value%" contains "of":
                set {_a::*} to loop-value split at "_"
                set {_i} to {_a::3} parsed as item
                set {_a} to {_a::1} parsed as number
                add {_a} of {_i} to block at {_loc}
            else:
                set {_i} to loop-value parsed as item
                add {_i} to block at {_loc}

So, i edit a bit for you.
and now you have doing create commands like
code_language.skript:
command /spawn:
    trigger:
        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
Reactions: Uzumaki
Status
Not open for further replies.