The Farmer Was Replaced

The Farmer Was Replaced

Often Mar 12, 2023 @ 9:49am
Skipping already tilled soil?
How do I make this thing plant in soil that is already tilled? When planting pumpkins if I grow a 2x2 patch and replant, it will only plant 1, the next time around it'll skip the patches that are already tilled. Or if one of them dies it'll skip that patch.

I tried to add a check to see if the ground type was tilled, but I don't think i can figure out the syntax for checking that because it doesn't ever seem to work, Any advice?

Thanks to the Dev and Rolar8 for pointing me in the correct direction. I had some stupid code elsewhere that was causing the issue!
Last edited by Often; Mar 12, 2023 @ 3:41pm
< >
Showing 1-11 of 11 comments
Timon  [developer] Mar 12, 2023 @ 10:20am 
you can check if the ground is tilled like this
if get_ground_type() == Grounds.Soil:
Last edited by Timon; Mar 12, 2023 @ 10:21am
Often Mar 12, 2023 @ 10:33am 
So I found that, and found the output from that function by using some basic print debugging.

But when I run it in my function, it doesn't seem to be working, just skips right over it.

It worked once, but then it does not.

My function for that is as follows;
(I have a 4x4 world, I know it's not the greatest, but I'm still getting stuff setup as I unlock things)

def plant_pumpkins(): if (get_pos_x() == 2 or get_pos_x() == 3) and get_pos_y() < 2: if get_ground_type() == Grounds.Soil: plant(Entities.Pumpkin) else: till() plant(Entities.Pumpkin)

It'll do it once if I clear the word (following the else block). I'm trying to get them to plant in the bottom right quadrant of the field. After that it just skips over the already tilled soil.

Edit: I have enough seeds.
Last edited by Often; Mar 12, 2023 @ 10:34am
Rolar8 Mar 12, 2023 @ 2:34pm 
if get_ground_type() == Grounds.Turf: till() while get_entity_type() !=Entities.Pumpkin: plant(Entities.Pumpkin)
pumpkins have a 20% chance of not growing. must wait:(
Often Mar 12, 2023 @ 3:12pm 
Originally posted by Rolar8:
if get_ground_type() == Grounds.Turf: till() while get_entity_type() !=Entities.Pumpkin: plant(Entities.Pumpkin)
pumpkins have a 20% chance of not growing. must wait:(

It's not that they're not growing, it's that it's not planting on Soil. The way I wrote my script is that it'll pass over stuff that's already Grounds.Soill.

I would expect:
if get_ground_type() == Grounds.Soil: plant(Entities.Pumpkin)

to work, but it doesn't even execute that block. That condition doesn't evaluate to True, despite it being True if I print get_ground_type()
Rolar8 Mar 12, 2023 @ 3:33pm 
Then so. What gives the execution of my piece of code.
A pumpkin must be planted and grown.
Last edited by Rolar8; Mar 12, 2023 @ 3:34pm
Often Mar 12, 2023 @ 3:40pm 
I figured it out, actually. It was a logic error with scoping in a previous function. I had my planting_pumpkins function happening under an if statement if can_harvest() was true.

Obviously can_harvest isn't true on a blank soil patch, so it was skipping my code. It was me creating spaghetti trying to have too many layers of abstraction. Thanks for your help, though, you pointed me in the right direction.
Rolar8 Mar 12, 2023 @ 3:53pm 
I suggest to try such a scheme of movement. Especially for pumpkins :)
def Move_P(): x= get_pos_x() y= get_pos_y() if x ==0 and y%2 ==0: move (North) elif y==0 and x%2 ==1: move(East) elif x==y: if x%2 ==1: move(South) else: move (West) elif x<y: if y%2== 0: move(West) else: move(East) elif y<x: if x%2==1: move(South) else: move(North)
Last edited by Rolar8; Mar 12, 2023 @ 3:53pm
Often Mar 12, 2023 @ 4:00pm 
I was thinking of doing something similar. Right now I'm still moving top to bottom, but I know it's not the most efficient as getting the 3x3 is a bit hard. i know there's a better way, and doing something like this will help me no matter the size. Right now I've got it all hard coded and I want to automate my movement coming up so that I can have pumpkin placement and tree placement alternating. Gotta get it all planned out in my brain, though.

Loving the game. Don't know what made the dev make it, but it's really fun!
Rolar8 Mar 12, 2023 @ 4:15pm 
Here the essence is that the route ends at the point 0,0. Which is just convenient.

And I just thought of this thing after the Trees. Almost a hint. +
Atroxide May 17, 2024 @ 9:29pm 
Originally posted by Often:
I was thinking of doing something similar. Right now I'm still moving top to bottom, but I know it's not the most efficient as getting the 3x3 is a bit hard. i know there's a better way, and doing something like this will help me no matter the size. Right now I've got it all hard coded and I want to automate my movement coming up so that I can have pumpkin placement and tree placement alternating. Gotta get it all planned out in my brain, though.

Loving the game. Don't know what made the dev make it, but it's really fun!

You really want even bigger than 3x3 for pumpkins. You want the max size of your plot. You want to be able to just grow a single pumpkin over the whole plot for maximum pumpkin. Down below is the strat I used

Loop over every square and till/plant. Add every square to a "not ready" list.
Loop through every square continuously on your "not ready" list and remove that square from list once it's harvestable. If it ain't harvestable then keep it on the list and replant if the entity doesn't exist.

Once your list is empty, you have a maximum size pumpkin and know it's completely filled in and can then harvest.
Ydyp May 18, 2024 @ 1:47am 
I see nowhere checking if you got enough pumpkin seeds, it cannot plant if you don't have seeds. Had this happen to me a few times in the past where I had my seed check and buying outside the cycle for my tilling/planting and running out of seeds midway.
< >
Showing 1-11 of 11 comments
Per page: 1530 50

Date Posted: Mar 12, 2023 @ 9:49am
Posts: 11