[CLOSED] Farming Simulator

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

I was boring. so i joined the "Party". :emoji_grinning:

You can increase the Radius while you leveling it, when your don't have this tool. you will not harvest it. so like in Farming simulator. You need one Things for Wheat... One other Things for.. .example potato... so you can set here easy up. Just Change the Name or somethings. and check it. if you're holding nothing. will he nothing harvesting... :emoji_wink: (Sorry my bad English today maybe)

code_language.skript:
on vehicle enter:
    wait 1 tick
    "%entity%" is "boat"
    while player is riding:
        wait 5 ticks

        if block at player's vehicle is farmland:
            set {_block} to block in horizontal direction of player's vehicle from player
            {_block} is not farmland
            {_block} is not water
            block above {_block} is air
            make player execute "/up"
        if name of player's tool contains "Harvester":
            set {_N::*} to name of player's tool split at "Level "
            replace every "]" with "" in {_N::2}
            set {_r} to {_N::2} parsed as number #RADIUS
        else:
            send action bar from "&a&lRemain for Harvester you need some tool." to player
        broadcast "Level: %{_r}% - So its mean too Radius." #!DEBUGS
        if {_r} is set:
            loop blocks in radius {_r} around block above block at player:
                y-coord of loop-block is y-coord of block above block at player
                loop-block is not air
                set {_block} to loop-block
                if name of player's tool contains "Harvester":
                    set {_amount} to random number between 1 and 3
                    if "%{_block}%" contains "wheat":
                        data value of {_block} is 7
                        set data value of block at {_block} to 0
                        drop {_amount} of wheat at block at {_block}
                        add 1 to {_EXP}

                    else if "%{_block}%" contains "carrot":
                        data value of {_block} is 7
                        set data value of block at {_block} to 0
                        drop {_amount} of carrots at block at {_block}
                        add 1 to {_EXP}
                else:
                    send action bar from "&c&lWrong Tool!" to player
            if {_EXP} is set:
                set {_N::*} to name of player's tool split at "Level "
                replace every "]" with "" in {_N::2}
                set {_r} to {_N::2} parsed as number
                if {_r} is more than or equal to 10:
                    set name of player's tool to "%{_N::1}%Level MAX]"
                    set lore of player's tool to "%{_L::1}% MAX/MAX"
                else:
                    set {_L::*} to uncolored lore of player's tool split at " "
                    set {_A::*} to {_L::2} split at "/"
                    set {_A::1} to {_A::1} parsed as number
                    add {_EXP} to {_A::1}
                    set {_A::2} to {_A::2} parsed as number
                    if {_A::1} is more than or equal to {_A::2}:
                        broadcast "LEVEL UP!"
                        subtract {_A::2} from {_A::1}
                        set {_A::2} to {_A::2}*3
                        add 1 to {_r}
                        set name of player's tool to "%{_N::1}%Level %{_R}%]"
                    set lore of player's tool to "%{_L::1}% %{_A::1}%/%{_A::2}%"
            delete {_r}
            delete {_EXP}
            
            
command /test:
    trigger:
        loop blocks in radius 2 around block above block at player:
            y-coord of loop-block is y-coord of block above block at player
            loop-block is not air
            set {_block} to loop-block
            broadcast "%{_block}%"
            
command /stick:
    trigger:
        give player stick named "Harvester [Level 1]" with lore "EXP: 0/100"

command /up:
    executable by: players
    trigger:
        player is riding
        "%player's vehicle%" is "boat"
        block at player's vehicle is farmland
        set {_boat} to player's vehicle
        make player dismount any vehicle
        teleport {_boat} to location of player
        push {_boat} forwards at speed 0.5
        push {_boat} upwards at speed 0.5
        wait 2 ticks
        make player ride {_boat}

on click with stick:
    send "%target block%"
 
Welcome to the "Party" :emoji_grinning: I can definitely use your suggestion! Maybe we can sell some keys and have an "upgrade" command to make your key better, like higher radius, more crops, faster speed, replant or no replant. Stuff like that :emoji_grinning:
[doublepost=1490734506,1490119868][/doublepost]I added some functions to clean up

Full source on https://github.com/GeekWithAChick/FarmingSim

code_language.skript:
on vehicle enter:

    wait 1 tick
    "%entity%" is "boat"

    while player is riding:
        wait 5 ticks # Do not delete this line

        enableAutomaticStepUpFor(player)

        name of player's tool contains "Harvester"
        set {_r} to "%getRadiusFromToolOf(player)%" parsed as number

        {_r} is more than 0
        loop blocks in radius {_r} around block above block at player:

            y-coord of loop-block is y-coord of block above block at player # loop in a circle not sphere
            loop-block is not air

            set {_block} to loop-block
            set {_amount} to random number between 1 and 3

            if "%{_block}%" contains "wheat":
                data value of {_block} is 7
                set data value of block at {_block} to 0
                drop {_amount} of wheat at block at {_block}
                addExperienceToToolOf(player, 1)

            else if "%{_block}%" contains "carrot":
                data value of {_block} is 7
                set data value of block at {_block} to 0
                drop {_amount} of carrots at block at {_block}
                addExperienceToToolOf(player, 1)