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

Solved Farming skript

Discussion in 'Skript' started by kays, Feb 23, 2018.

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

    kays Member

    Joined:
    Jul 15, 2017
    Messages:
    8
    Likes Received:
    2
    Skript Version: Skript 2.2 dev33
    Skript Author: Bensku
    Minecraft Version: 1.12.2

    I'm trying to create a unique farming skript. Where plants growth by it self but I don't know how to make it so when player break that specific block the plant stop growing. I know my problem but I have no clue how to write it

    Here is my take and it works but when break the blocks still growth because of tick. :3 anyways I can stop it when a person break??
    Code (Skript):
    1. on rightclick on soil:
    2.     if name of tool of player is "&aCucumber Seed":
    3.         remove 1 of event-item from player
    4.         if block above is air:
    5.             wait 10 tick
    6.             set block above to crops
    7.             wait 20 tick
    8.             set block above to crops:1
    9.             wait 20 tick
    10.             set block above to crops:2
    11.             wait 20 tick
    12.             set block above to crops:3
    13.             wait 20 tick
    14.             set block above to crops:4
    15.             wait 20 tick
    16.             set block above to crops:5
    17.             wait 20 tick
    18.             set block above to crops:6
    19.             wait 20 tick
    20.             set block above to crops:7
    21.             wait 20 tick
    22.             set block above to fern
    23.  
    24. on break of crops:0-6:
    25.     if block below event-block is farmland:
    26.         cancel event
     
  2. Gladrian

    Gladrian Member

    Joined:
    Feb 20, 2017
    Messages:
    41
    Likes Received:
    3
    Here's something that should fix that and also make it more efficient. If you want to make it slower it wlll be a lot easier, and if the server restarts in the middle of growing it should pick up where it left off.

    Code (Skript):
    1. on rightclick on soil:
    2.     if name of player's tool is "&aCucumber Seed":
    3.         if block above clicked block is air:
    4.             remove 1 of player's tool from player
    5.             add location above clicked block to {cucumbers::*}
    6.             set block above clicked block to crops
    7.  
    8. every 20 ticks:
    9.     loop {cucumbers::*}:
    10.         if block at loop-value is crops:    # This checks to see if it has been harvested
    11.             if data value of block at loop-value is greater than 6:
    12.                 set block at loop-value to fern
    13.             else:
    14.                 add 1 to data value of block at loop-value    # The data value is the grow state in the case of crops
    15.         else:
    16.             remove loop-value from {cucumbers::*}
    17.             # Deletes the cucumber location variable if harvested or full grown
    18.  
    19. on break of crops:0-6:
    20.     if block below event-block is farmland:
    21.         cancel event
    22.        
     
  3. k

    kays Member

    Joined:
    Jul 15, 2017
    Messages:
    8
    Likes Received:
    2
    is there a way to add tags on the block fern so when I break the fern block with certain NBT tags it drop certains thing. :O I tried add nbt "{Tags:"Cucumber"}" to event-block but not working.
    --- Double Post Merged, Feb 25, 2018, Original Post Date: Feb 25, 2018 ---
    I figured it out ":emoji_grinning:
     
    • Like Like x 1
Thread Status:
Not open for further replies.
Loading...