Picking Peaches With Python in Animal Crossing New Horizons
Tom Nook will hate you because of this one weird trick!
Harvesting fruit is a great way to make some quick money in Animal Crossing New Horizons. Just visit another island, fill your pockets with fruit that is non-native to your island, and plant as many trees as possible when you get back home. Once you grow enough trees to form an orchard, you can easily make half a million bells or more every three days.
However, picking hundreds of trees can get pretty boring and you might find yourself thinking “there’s gotta be a better way…” Well I’m here to tell you, there is, with ACNH Automator!
ACNH Automator utilizes the joycontrol library to automate repetitive tasks in Animal Crossing New Horizons. Joycontrol (created by mart1nro) is a python based toolset that emulates a Nintendo Switch controller over Bluetooth, so once you’ve followed the instructions to get it installed and running on a Linux OS, you can start raking in the bells!
As of now, ACNH Automator has one available automation task called “pick_trees” which allows you to automatically pick fruit from trees and sell the fruit at Nook’s Cranny. I hope to design more features in the future to help with things like repetitive crafting tasks.
Before running ACNH Automator, you will need to input some information about your tree grid and where Nook’s Cranny is located in your town. In a future release this information will be entered into a command line prompt when running joycontrol, but for the current release you must edit the run_controller_cli.py file.
On line 63 of run_controller_cli.py you will find tree_pick_data being defined as an instance of the TreePickLogic class. It is populated with sample data that you will have to change. There are also secondary defaults that are defined, which can be updated as necessary. I’ve included a full explanation of each value you will have change in the Readme, but I’ve also included some reference images to clarify how the grid system is set up.
ACNH Automator v1.0 assumes that your trees are spaced exactly one grid space apart from each other in the x and y direction. Options for updating this will be available in a future release. Grid space is measured in [x,y] and assumes that [0,0] is the space directly to the left of the top-left tree. The nook_grid value should be exactly 2 spaces below Nook’s Cranny to avoid running into the building by accident.
- You MUST make sure that your inventory selector (the hand icon when you’re in your inventory) is located on the first inventory space, or the selling process will not work properly.
- I also recommend clearing out your inventory of anything you don’t want to accidentally sell until you are very comfortable with this toolset.
- It’s important to have Nook’s Cranny located as close as possible to your tree grid in order to make traveling to sell your fruit easier.
- I recommend separating your tree grid from the rest of the town to avoid the possibility of villagers getting in your way, I solved this by building on a cliff that is inaccessible to villagers.
- Try to only have one space available on either side of your tree grid, this will help your character “get back on track” if the automation goes awry.
Once you’ve entered your town’s data into run_controller_cli.py you can navigate your character to grid space [0,0] and move on to the next step.
Emulating the controller and running “pick_trees”
ACNH Automator relies on joycontrol to run, so you’ll need to first navigate to the Change Grip/Order menu on your Nintendo Switch, run joycontrol to begin emulating a controller, and then navigate back to Animal Crossing before running the pick_trees command.
To start this process, cd into the main joycontrol directory and run the following command:
sudo python3 run_controller_cli.py PRO_CONTROLLER
Once joycontrol is up and running and your character is at [0,0] facing the first tree, you can simply run the following command:
Based on the information you entered about your town, your character will:
- Navigate through the grid, harvesting fruit from each tree in the x direction until it reaches the last tree in the row.
- Travel down two spaces in the y direction to proceed to the next row, and change direction accordingly.
- Stop picking trees when a threshold is met for the amount of fruit that can be safely stored in your inventory.
- Travel to Nook’s Cranny to sell all of the fruit, and travel back to the next tree that needs to be picked.
- Repeat this process until all fruit is harvested and sold.
Here is an example of what this process looks like in action:
This project has been a lot of fun to work on, and I’ve refactored the code several times over the last couple months as I’ve learned more about software development while attending the Flatiron School. I can’t wait to come up with more features for the next version, and will be creating a future post detailing the process of writing and testing the code.
Thanks for reading and don’t spend all those bells in one place!