> For the complete documentation index, see [llms.txt](https://docs.sandbox.game/en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sandbox.game/en/creator/game-maker/docs/behaviours/npc-ai-pawns/farmer.md).

# Farmer

Harvesting Behaviour that appears to collect plants.

{% hint style="success" %}
**COPY/PASTE PARAMETERS**

New in GM 0.11! Right click on a behaviour or component to copy. Then open an object, add the same behaviour or component, and right click it to paste identical parameter settings.
{% endhint %}

<figure><img src="https://4251931498-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MO_j99BJEXK4zHqxgqS%2F-MOyp0ykQO6grKWUl4u-%2F-MOys6iIvvXikEsek3Cg%2FFarmer.gif?alt=media&#x26;token=287e3bcd-12b1-4ab7-ac20-c90a90356cf5" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
This behaviour has not yet been migrated for use in multiplayer Experiences.
{% endhint %}

## ![](https://331512196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F83PS3g9zpWmq73xzlwFn%2Fuploads%2FY5E6Rlh0SdUtTkXGTUV4%2Fimage.png?alt=media\&token=67d8d147-1586-4ae9-b347-906897432b0d) Farmer

* Walk and gather specific assets within a defined zone - Its “gathering rate” can be changed within its parameters - Can flee once it detects an enemy nearby - Peaceful NPC that doesn’t attack any targets

## Common Uses

* "Harvesting" or "collecting" any Object using Gathering Tags (vegetables on a farm, groceries in a store, scrap metal in a wasteland, trash to recycle, etc.)
* Use cases where Objects need to be randomly removed without a destroy animation

{% hint style="warning" %}
**KNOWN ISSUE**\
Farmer behaviour only detects and removes objects placed in a location with an even y axis coordinate (vertical). \
**Workaround:** Adjust the position in the [**Properties Panel**](/en/creator/game-maker/docs/build-menus/properties-panel.md#transform) or with the [**Move tool**](/en/creator/game-maker/docs/build-menus/side-bar.md#move).
{% endhint %}

## Communications

<table data-header-hidden><thead><tr><th width="278"></th><th></th></tr></thead><tbody><tr><td><p><strong>Inputs:</strong></p><p>Detects Hostiles or other Tags</p></td><td><p><strong>Outputs:</strong></p><p>Moves away</p></td></tr><tr><td>Detects Plants or other Tags</td><td>Randomly moves toward and removes objects with its target Tags</td></tr></tbody></table>

<img src="https://content.gitbook.com/content/83PS3g9zpWmq73xzlwFn/blobs/Uvk5IYcPb2GosDDJqQuS/file.excalidraw.svg" alt="" class="gitbook-drawing">

## Parameters

| Options                                                                                            | Details                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| -------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ![](https://content.gitbook.com/content/83PS3g9zpWmq73xzlwFn/blobs/KSbY9aoAFvTczQSAnLUO/image.png) | <p><strong>Gathering area</strong> - defines the space where the Object will walk around and gather objects with a specified tag. It may step up or down one block at a time.<br><br>This parameter is visualised with a blue cube Gizmo that adjusts as you enter new <mark style="color:red;"><strong>X</strong></mark>, <mark style="color:green;"><strong>Y</strong></mark>, and <mark style="color:blue;"><strong>Z</strong></mark> values.</p> |
| ![](https://content.gitbook.com/content/83PS3g9zpWmq73xzlwFn/blobs/hRObirYyzQsVcstRRQD1/image.png) | <p><strong>Walk Speed</strong> (slider) - set the walking speed of the Object using a slider or by entering a value.<br><br>The value defines the amount of blocks travelled per second by the Object.</p>                                                                                                                                                                                                                                           |
| ![](https://content.gitbook.com/content/83PS3g9zpWmq73xzlwFn/blobs/KBsj1WEdfQQJfiy5VIhR/image.png) | <p><strong>Tags</strong> - Determines which tags the Object will look for to gather. You may add more than one tag.<br><br>Press <img src="https://content.gitbook.com/content/83PS3g9zpWmq73xzlwFn/blobs/gpWj5yH1ilotn8VBOPWh/image.png" alt="" data-size="line"> to remove default or other unwanted tags.</p>                                                                                                                                     |
| ![](https://content.gitbook.com/content/83PS3g9zpWmq73xzlwFn/blobs/StxuT4INDzjjbZxM33Qt/image.png) | **Gathering Speed** (slider) - determine the maximum amount of objects that can be gathered per second within the defined space.                                                                                                                                                                                                                                                                                                                     |
| ![](https://content.gitbook.com/content/83PS3g9zpWmq73xzlwFn/blobs/X1jgGhlsNLhoC2S5t669/image.png) | <p><strong>Can Flee</strong> - if set to <strong>true</strong>, the Object can flee from enemy tags if it is attacked or if it detects an enemy within its enemy detection range.<br></p><p><strong>Flee when Attacked</strong> - if set to <strong>true</strong> the Object will flee if it is attacked.</p>                                                                                                                                        |
| ![](https://content.gitbook.com/content/83PS3g9zpWmq73xzlwFn/blobs/nEtHGhWaHyj64NTieXgr/image.png) | **Flee Speed** (slider) - Determines the speed at which the Object will flee. The value defines the amount of blocks the Object will travel per second when fleeing.                                                                                                                                                                                                                                                                                 |
| ![](https://content.gitbook.com/content/83PS3g9zpWmq73xzlwFn/blobs/Up2nrsYb0Q3GpicLnSxx/image.png) | <p><strong>Tags to Flee</strong> - Determines which tags the Object detects as an enemy and will flee from.<br><br>Press <img src="https://content.gitbook.com/content/83PS3g9zpWmq73xzlwFn/blobs/gpWj5yH1ilotn8VBOPWh/image.png" alt="" data-size="line"> to remove default or other unwanted tags.</p>                                                                                                                                             |
| ![](https://content.gitbook.com/content/83PS3g9zpWmq73xzlwFn/blobs/G86cv7XuAPhrl4bMD6vQ/image.png) | <p><strong>Enemy Detection</strong> (slider) - defines the range within which the Object will detect "tags to flee".<br><br>This parameter is visualised with a red circle Gizmo that adjusts as you move the slider or change the value.</p>                                                                                                                                                                                                        |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sandbox.game/en/creator/game-maker/docs/behaviours/npc-ai-pawns/farmer.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
