# Farmer

{% 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 %}

## ![](/files/QbKIvfGxGaQpYQNpkQmg) 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="/files/yG0ZlDkqF84s0TYj36vf" alt="" class="gitbook-drawing">

## Parameters

| Options                          | Details                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ![](/files/y2hZBzqyKd7q9yqwKiUs) | <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> |
| ![](/files/J93KuxHtac9RhNqbOzgP) | <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>                                                                                                                                                                                                                                           |
| ![](/files/Wkz6EIlSRTMIbQZbKPD7) | <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="/files/9r1klje7KtQEtYjVfydZ" alt="" data-size="line"> to remove default or other unwanted tags.</p>                                                                                                                                                                                                       |
| ![](/files/INRwJzjSWe12Ju85OVSf) | **Gathering Speed** (slider) - determine the maximum amount of objects that can be gathered per second within the defined space.                                                                                                                                                                                                                                                                                                                     |
| ![](/files/5RckSwzJsevkxDL8402g) | <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>                                                                                                                                        |
| ![](/files/bdqMr0Z6Ms3sb6lwY4Mn) | **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.                                                                                                                                                                                                                                                                                 |
| ![](/files/Fchch11O5U5mn8SKW1Cd) | <p><strong>Tags to Flee</strong> - Determines which tags the Object detects as an enemy and will flee from.<br><br>Press <img src="/files/9r1klje7KtQEtYjVfydZ" alt="" data-size="line"> to remove default or other unwanted tags.</p>                                                                                                                                                                                                               |
| ![](/files/g0zjN9gchC1CilML8mC0) | <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: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

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

The question should be specific, self-contained, and written in natural language.
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.
