# Setting up a Player with Emerald AI

To get started, it is recommended that you use the included EmeraldGeneralTargetBridge script. This script can be attached to any GameObject, including players, which will then allow it to be properly detected and receive damage calls from AI.

<figure><img src="/files/uO1FOoiEYKp8FY0HqFEO" alt=""><figcaption></figcaption></figure>

Add the EmeraldGeneralTargetBridge component to your player. Upon doing so, it will add 2 additional components; a Faction Extension and a Target Position Modifier.

{% hint style="info" %}
**Note:** If you created a [custom player bridge script](https://black-horizon-studios.gitbook.io/emerald-ai-wiki/api/damaging-a-custom-character-controller), the Faction Extension and Target Position Modifier scripts will also be added. You will not need to have the EmeraldGeneralTargetBridge present if you are using a custom player bridge script.
{% endhint %}

<figure><img src="/files/yUvxIeVhlh1wgegUPgyD" alt=""><figcaption></figcaption></figure>

The Faction Extension allows you to specify the faction the player will belong to. For this guide, we will be using the Player faction.

<figure><img src="/files/0w74UfhnCaygCdQkdsE7" alt=""><figcaption></figcaption></figure>

The Target Position Modifier works exactly as it does with AI. You simply need to apply a transform source that will be used as the aim point for other targets. For a detailed guide on setting this up, see the [Target Position Modifier](/emerald-ai-wiki/emerald-components-optional/target-position-modifier-component/setting-up-the-tpm-component-on-a-player.md) section.

<figure><img src="/files/AJmkWLDvwo7MuWFMxIM7" alt=""><figcaption></figcaption></figure>

Ensure your tags and layers are set for your player. These are project dependent and depend on the character controller you are using. Make sure that these are added to your AI's Detection Layers and Player Tag within their [Detection Component](/emerald-ai-wiki/emerald-components-required/detection-component/setting-up-the-detection-layers-and-player-tag.md).

<figure><img src="/files/grOjrUpDv5TTqKAyABqx" alt=""><figcaption></figcaption></figure>

Your player object should now be able to be detected by other AI and receive damage through the EmeraldGeneralTargetBridge script. If you would like to have your custom player controller's health damaged directly, you will need to create a custom script. For a guide on this, see the [Damaging a Custom Character Controller](/emerald-ai-wiki/api/damaging-a-custom-character-controller.md) section.


---

# 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://black-horizon-studios.gitbook.io/emerald-ai-wiki/getting-started/setting-up-a-player-with-emerald-ai.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.
