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.

Broken Blocks no Velocity + stacking

Discussion in 'Skript' started by DJ411, Apr 15, 2018.

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

    DJ411 Member

    Joined:
    Mar 24, 2018
    Messages:
    2
    Likes Received:
    0
    I've been trying to work on a small task skript where when i mine a block instead of bouncing all over the place it would go to the player. Almost teleport to the player. Also with stacking. Like if there is already 1 block it would just be 2 almost like those mob stacking plugins but for an item.

    Just wondering if this is possible as i can't seem to get past the item teleportation correctly.
     
  2. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    You could do something simple like
    Code (Skript):
    1. On block break:
    2.     cancel event
    3.     set event-block to air
    4.     give player 1 of event-block
     
  3. DJ411

    DJ411 Member

    Joined:
    Mar 24, 2018
    Messages:
    2
    Likes Received:
    0
    Thanks for the reply. I had similar results but with worse code lol. But the same outcome is happening. Its giving free silk touch with out having it. But i also test this with a full inventory. I can't give them something when its full. Why i have the item drop at their location or a clear spot nearby.
    i guess it can't be done easily without checks and stuff.
     
  4. Pikachu

    Moderator Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    139
    Medals:
    what game version do you use?
     
  5. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    Oh right i forgot it'll just give them the ore block

    You could try something like this
    Code (Skript):
    1. on block break:
    2.     cancel event
    3.     set event-block to air
    4.     loop players inventory:
    5.         if loop-block is air:
    6.             if event-block is diamond ore:
    7.                 give player 1 of diamond
    8.                 stop
    9.         else:
    10.             send "Your inventory is too full" to player
    Its not the cleanest code, but it gives you an idea of how it could work
     
  6. Pikachu

    Moderator Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    139
    Medals:
    Code (Skript):
    1. on break:
    2.   wait 1 tick
    3.   event.isCancelled() is false
    4.   delete dropped items in radius 0.25 of event-block
    5.   give player (event-block.getDrops(((tool of player).getRandom()))
    something like this would do the job
     
  7. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    Well that looks much cleaner than mine... are you using Skript-Mirror for that?
     
  8. Pikachu

    Moderator Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    139
    Medals:
    yeah
     
  9. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    duly noted, i need to learn how to use that!
     
Thread Status:
Not open for further replies.

Share This Page

Loading...