Help with giving explosed blocks to players inv

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

HKG

New Member
Feb 3, 2019
7
0
0
22
I'm trying to make so exploded blocks go back to the players inventory but isn't working (its being dropped on ground), here's my code:


on block break:
chance of 100%:
if player's tool is a pickaxe:
loop blocks from the block 1 in front of the player to the block 20 in front of the player:
create explosion of force 2 at loop-block
give loop-block to player
set loop-block to air
wait 1 tick
 
Okay what happens is that wenn the loop-block gets looped you do a explosion effect this explosion destroys the block so wenn it wants to give the loop-block the loop-block is already air
 
Still not working: https://gyazo.com/cfb711cf8ba5e60e0d28c8ab923ad69c

Code:
on block break:
 chance of 100%:
  if player's tool is a pickaxe:
   loop blocks from the block 1 in front of the player to the block 20 in front of the player:
    create explosion of force 2 at loop-block
    give loop-block to player
    wait 1 tick


You do not understand what i am saying. The explosion will cause the blocks to break so the block will be air if the block is already air you will be giving air to the player not the block.

Code:
on block break:
 chance of 100%:
  if player's tool is a pickaxe:
   loop blocks from the block 1 in front of the player to the block 20 in front of the player:
    give loop-block to player
    create explosion of force 2 at loop-block
    wait 1 tick
 
It's still not working, same as Before.
[doublepost=1549282463,1549279990][/doublepost]when I have the explosion, it doesnt work, without the explosion it works. anyone hel pplease?
 
set a local variable to the block and give that to the player BEFORE you let it explode
 
Code:
on block break:
 chance of 100%:
  if player's tool is a pickaxe:
   loop blocks from the block 1 in front of the player to the block 20 in front of the player:
    add loop-block to {_list::*}
   loop blocks from the block 1 in front of the player to the block 20 in front of the player:
    create explosion of force 2 at loop-block
    wait 1 tick
   loop {_list::*}:
    give loop-value to player
 
code_language.skript:
on block break:
    chance of 100%:
        if player's tool is a pickaxe:
            loop blocks from the block 1 in front of the player to the block 20 in front of the player:
                broadcast "%loop-block%"
                set {_i} to loop-block
                give {_i} to player
                create explosion of force 2 at loop-block
                wait 1 tick
sure lemme spoonfeed ya
 
code_language.skript:
on block break:
    chance of 100%:
        if player's tool is a pickaxe:
            loop blocks from the block 1 in front of the player to the block 20 in front of the player:
                broadcast "%loop-block%"
                set {_i} to loop-block
                give {_i} to player
                create explosion of force 2 at loop-block
                wait 1 tick
sure lemme spoonfeed ya

That still won't work because the explosion will break the blocks next to it to. wich are blocks that still need to be looped
 
I get this error: https://gyazo.com/eb7cf6cc22ef1b4e28b41bc006280eb9

When I use this code: https://gyazo.com/f8d7f0bcb6b633ddcb2c02e286e25021
[doublepost=1549283716,1549283638][/doublepost]
code_language.skript:
on block break:
    chance of 100%:
        if player's tool is a pickaxe:
            loop blocks from the block 1 in front of the player to the block 20 in front of the player:
                broadcast "%loop-block%"
                set {_i} to loop-block
                give {_i} to player
                create explosion of force 2 at loop-block
                wait 1 tick
sure lemme spoonfeed ya

Did not work
 
@HKG
code_language.skript:
block break:
    chance of 100%:
        tool is a pickaxe
        loop blocks from the block 1 in front of the player to the block 20 in front of the player:
            give loop-block to player
            create explosion of force 2 at loop-block
            wait 1 tick
The code above works, but you're probably using different code. If you have 2 loops like
code_language.skript:
loop {_a::*}:
    broadcast "%loop-value%" # This can be used here
    loop {_b::*}:
        broadcast "%loop-value-1%" # loop value from the parent loop (loop {_a::*})
        broadcast "%loop-value-2%" # current loop (loop {_b::*})
You've got to number it, so skript knows which value you're looking for

Hope this helps you understand it a bit better
 
Okay I see now, I used the code above but still the blocks are not getting into inventory. Have you tried this to confirm it actually works?
 
If you have TuSke, you can basically
code_language.skript:
give drops of loop-block using tool to player
 
If you have TuSke, you can basically
code_language.skript:
give drops of loop-block using tool to player

Code:
on block break:
 chance of 100%:
  if player's tool is a pickaxe:
   loop blocks from the block 1 in front of the player to the block 20 in front of the player:
    set {_i} to loop-block
    give {_i} to player
    create explosion of force 2 at loop-block
    give drops of loop-block using tool to player
    wait 1 tick

I'm using this, but still not working.
 
Status
Not open for further replies.