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!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Tree Feller Skript!

Discussion in 'Requests' started by BrownMee, Sep 17, 2018.

  1. BrownMee

    BrownMee Active Member

    Apr 16, 2018
    Likes Received:
    Category: Fun

    Suggested name: TreeFeller

    What I want:
    When you break a logs from the tree. All logs fall at once like this plugin https://www.spigotmc.org/resources/tree-feller-async.20385/

    Ideas for commands:

    Ideas for permissions:

    When I'd like it by: A reasonable time

    #1 BrownMee, Sep 17, 2018
    Last edited: Sep 18, 2018
  2. Best Answer:
    Post #4 by ShaneBee, Sep 18, 2018
  3. BrettPlayMC


    Jan 26, 2017
    Likes Received:
    Please use the request format.
  4. BrownMee

    BrownMee Active Member

    Apr 16, 2018
    Likes Received:
  5. ShaneBee

    Supporter + Addon Developer

    Sep 7, 2017
    Likes Received:
    Heres a basic version of one I have.
    The version I use is a bit different (uses gravity rather than just breaking the blocks like that GIF)

    Code (Skript):
    1. function chain(b: block, n: number, p: player):
    2.     wait 1 tick
    3.     if {_n} is less than 50:
    4.         add 1 to {_n}
    5.         loop blocks in radius 3 around {_b}:
    6.             if loop-block is any log block:
    7.                 if block below loop-block is air or any leaves or any log:
    8.                     set block below loop-block to air
    9.                     chain(loop-block,{_n}, {_p})
    10.                     break loop-block naturally
    11.                     play sound "BLOCK_WOOD_BREAK" with volume 1 at location of loop-block for all players
    12.                     wait 10 tick
    14. on break:
    15.     if gamemode of player is survival:
    16.         if event-block is any log block:
    17.             set {_tree} to false
    18.             loop blocks above event-block:
    19.                 if loop-block is any leaves:
    20.                     set {_tree} to true
    21.             if {_tree} is true:
    22.                 chain(event-block, 0, player)
  6. Darkry

    Darkry Member

    Jun 6, 2019
    Likes Received:
    Hi, I'd like to post an "upgraded" version of this script.
    I know this is an old post, but Google still offers this as a search result, so lemme explain:
    - this code is great as a base template, but has many issues
    - it can easily break whole houses if you have the tree accidentaly touching it (house is within a 3 block radius, which can happen)
    - I found the checks pretty much not very reliable and inefficient
    - I added condition checks that should prevent breaking huge parts of houses (I tested it and it only had issues with jungle trees right next to the house which will not even grow like that in normal game, I had to use WE)
    I know I am looping "blocks above" 2 times, but it was necesarry for the code to not have issues with acacia trees :emoji_grinning:

    So here's my "upgrade" on the latest version of Skript up to this date for those who are still curious:
    (note- I'm using some addons but none should interfere in this code, so it should be vanilla)
    Code (Text):
    1. function chain(b: block, n: integer):
    2.     wait 1 tick
    3.     if {_n} is less than 50:
    4.         add 1 to {_n}
    5.         loop blocks in radius 3 around {_b}:
    6.             if loop-block is any log:
    7.                 loop blocks above loop-block:
    8.                     loop-block-2 is air:
    9.                         block above loop-block-2 is air
    10.                         exit 1 loop
    11.                     exit 1 loop
    12.                 loop blocks above loop-block:
    13.                     loop-block-2 is any leaves
    14.                     chain(loop-block-1, {_n})
    15.                     break loop-block-1
    16.                     wait 10 tick
    18. on break:
    19.     player's gamemode is survival
    20.     if event-block is any log:
    21.         loop blocks above event-block:
    22.             set {_l} to 0
    23.             if loop-block is any leaves:
    24.                 loop all blocks in radius 2 of loop-block:
    25.                     loop-block-2 is any leaves
    26.                     add 1 to {_l}
    27.                 {_l} > 7
    28.                 set {_tree} to true
    29.         if {_tree} is true:
    30.             chain(event-block, 0)

    Hope this will come in handy to people in 2023+ :emoji_slight_smile:

Share This Page