Solved AutoReplant

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

Nextopi

Member
May 1, 2018
21
0
1
33
Category:

Game Mechanics ?

Suggested name: AutoReplant

What I want:
I saw a script that does this but is not complete

I want the player to be able to automatically replant any kind of farmland (fully grown, wheat, carrots...) if the player has the necesary seeds available and it's using any kind of hoe after left clicking (hitting) the farmland (the hoe needs to get damaged normally )


Ideas for commands:

(not really necessary) Player is able to disable this ability

Ideas for permissions:

permission to be able to use the command
permission to be able to replant automatically
permission to be able to replant without seeds

When I'd like it by:

No hurry
 
I Think I can write this, I will start testing it and see if it works, and let you know :emoji_slight_smile:
[doublepost=1525313005,1525311603][/doublepost]Okay I have it started and figured out, was a lot easier to do then I thought.
I have carrots and potatoes done so far, just have to do the rest of the plants.

Just want to confirm that you want it done the way im doing it
If player has a HOE
when the break a crop, and they have the appropriate seed/item on them, it will auto plant the item as well as deal damage to the tool itself?
 
Thank you for helping writing this script!

The damage to the tool is vanilla behavior, the damage it should receive like if you are using an axe to cut a tree.
 
for some reason when i break a crop with a hoe, its not dealing damage, so i had to add it in
[doublepost=1525313745,1525313424][/doublepost]I realized the hoe's dont take damage when breaking any block....
odd, but thats ok, I wrote it in

I think i am done, would you like me to copy/paste the code here, or post the file here?
 
I think hoes only take damage when you create farmlands
and that was really fast o.o, you can post it, copy the code, send it... Thanks a lot! I wanna see the code and learn abit from it
 
Just to double check, there is only 4 types of crops right? Im not missing one? Wheat, beets, carrots, potatoes?
[doublepost=1525314346,1525314255][/doublepost]oh, also make sure to click best answer, just to mark this as solved :emoji_slight_smile:
 

Attachments

  • farmlander.sk
    1.3 KB · Views: 1,564
OH POO.... shows how often I farm, okay well Melons and pumpkins you wouldn't need to replant
Okay so the only 3 that would actually need to be replanted are SugarCane, NetherWart and CocoaBeans

Let me know if you would like me to add all 3, or just 1 or 2.... up to you
 
No thats ok I think I can figure the rest, I think... like adding permissions should be as easy as adding few conditions more right?
 
yeah thats totally easy
for fun, im going to write the rest of the 3 crops, and then send it you to, whether you use it or not, its up to you :emoji_wink:
 
  • Like
Reactions: Nextopi
Should I wait for it? so mark as best answer? or if I mark the thread as solved it will close it ?
 
You could mark it now, when you mark it with best answer, or solved, it does not close the thread

Here is the other version, I added in nether wart, sugar cane, and cocoa beans (the latter 2 were a bit trickier to do)
I also threw a permission node into the top, change it however you would like to

If you need any more assistance I am more than glad to help
 

Attachments

  • farmlander.sk
    2.3 KB · Views: 841
  • Like
Reactions: Herosteve198G
Is there a way to make this work ? so some players can plant without seeds ?

code_language.skript:
variables:
    {_seeds} = 1
on block break:
    if player has permission "farmer.noseed":
        set {_seeds} to 0
    if player has permission "farmer.seeds":
        if player's tool is a hoe:
            if event-block is carrot_plant:
                if player has {_seeds} of carrot:
                    if the data value of the event-block is 7:
                        remove {_seeds} carrot from inventory of player
                        set {_block} to event-block
                        set data value of {_block} to 1
                        wait 10 ticks
                        set event-block to {_block}
                        damage player's tool by 1
 
yeah... I still have the original Skript I made for you... want me to re-write it in like that?
I can do it perm based like that
[doublepost=1525568637,1525568506][/doublepost]I just have to run out for a bit, BUT i will work on it tonight and have it back to you ASAP
 
Not a total re-write but I have to go thru each plant and just add new permission.... not a lot of trouble, I dont mind!
[doublepost=1525572891,1525572573][/doublepost]Okay so I fixed it all up for ya.
Permissions:
farmlander.seeds.required - Requires seeds to auto replant
farmlander.seeds.notrequired - Does not require seeds to auto plant

If a player has neither of these nodes, then nothing will happen at all
 

Attachments

  • farmlander.sk
    4.1 KB · Views: 807
thanks, i had to make some changes for example
the 3rd condition couldnt be

code_language.skript:
if player has 1 of cocoa beans:

because then, it would require to have atleast 1 seed to replant the first time, but everything else was good thanks alot :emoji_slight_smile:
 
thanks, i had to make some changes for example
the 3rd condition couldnt be

code_language.skript:
if player has 1 of cocoa beans:

because then, it would require to have atleast 1 seed to replant the first time, but everything else was good thanks alot :emoji_slight_smile:
OH DUH, haha oops.

Awesome, Im glad it worked out for ya :emoji_slight_smile: