# Melee Enemy

{% 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-MOysCPJoQe0JbvXjJMh%2F-MOysemH_mptSuqDWB4p%2FFighter.gif?alt=media&#x26;token=97ec5a8a-261f-4ec6-9dac-22b51e093524" alt=""><figcaption></figcaption></figure>

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

## ![](/files/yq0nlx5wpPuQvl8d8rQV) Melee Enemy

* Walk within a defined zone - Attacks Avatar within his range - Once attacked by something, it counter attacks immediately

## Common Uses

* Enemy NPCs, or non-player characters, that will attack players, Citizens, Soldiers, etc.
* Creating factions of fighters with specific targets using Tags
* Creating anything that will use Attack animations and destroy other Objects (even non-living things - apply a Health Component and hide the health bar)

## 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 specified Tags (default Tag is Avatar)</p></td><td><p><strong>Outputs:</strong></p><p>If any of its Tags to Attack are detected, moves toward and attacks the Avatar or Objects with its target Tags</p></td></tr></tbody></table>

<img src="/files/w6avp1UbR1AC0MpEKsqw" alt="" class="gitbook-drawing">

## Parameters

| Options                          | Details                                                                                                                                                                                                                                                                                                                               |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ![](/files/4yv42lfJ1YXqkJYietYi) | Parameters with a ![](/files/17pDzIRAXKFYmEf7qxGq) symbol are currently locked and cannot be interacted with.                                                                                                                                                                                                                         |
| ![](/files/AptTCwO5hA2oidptIP9W) | **Tags to Attack** - Add or remove tags that you want the Object to attack upon detection.                                                                                                                                                                                                                                            |
| ![](/files/qEjKK4XtnQpvR735ZiRP) | **Motion Speed** - Defines the amount of blocks traveled by the Object while chasing a target.                                                                                                                                                                                                                                        |
| ![](/files/aW04DColo6EZ9pK1oGgw) | **(Locked)**                                                                                                                                                                                                                                                                                                                          |
| ![](/files/mZvT14nnsd9H2QzRmI3a) | <p><strong>Chasing Zone</strong> (slider) - defines the area in which your Object can chase a target.<br><br>This parameter is visualised with a <mark style="color:green;"><strong>green</strong></mark> circle Gizmo that adjusts as you move the slider or change the value.</p>                                                   |
| ![](/files/SwDWvB2YnpjmTPOfsCej) | **(Locked)**                                                                                                                                                                                                                                                                                                                          |
| ![](/files/49nSRyE8CoitdmjPZjHF) | *<mark style="color:green;">**Can Block Attacks**</mark>* - Toggle this option on or off to define whether your Object is able to block attacks.                                                                                                                                                                                      |
| ![](/files/mqKbYRnb2NdcQ44lPwe6) | <p><em><mark style="color:green;"><strong>Attack Damage</strong></mark></em> (slider) - Defines how many points of damage your Object will deal with a single hit.<br><br><em><mark style="color:green;"><strong>Attack Rate</strong></mark></em> (slider) - Defines the time in seconds between each attack the Object performs.</p> |
| ![](/files/O9g1m2xkyqVzfWoLCOxq) | <p><strong>Detection Range</strong> (slider) - defines the area in which your Object will detect <mark style="color:red;">tags to attack</mark>.<br><br>This parameter is visualised with a <mark style="color:yellow;"><strong>yellow</strong></mark> 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/melee-enemy.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.
