> For the complete documentation index, see [llms.txt](https://black-horizon-studios.gitbook.io/emerald-ai-wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://black-horizon-studios.gitbook.io/emerald-ai-wiki/emerald-components-required/detection-component/faction-relations.md).

# Faction Relations

## Faction Relations

The Faction Settings allow you to control which Factions your AI sees as an Enemy, Ally, or Neutral, including the relations with the AI and the player. An AI will react, based on its Current Behavior Type (from the [Behavior Component](/emerald-ai-wiki/emerald-components-required/behaviors-component.md)), and its Relation Type of the detected target.

{% hint style="info" %}
**Coward Example:** If an AI has a Coward Behavior Type and they detect a target who they have an Enemy Relation Type of, the AI will flee from that target.&#x20;
{% endhint %}

{% hint style="info" %}
**Aggressive Example:** If an AI has a Aggressive Behavior Type and they detect a target who they have an Enemy Relation Type of, the AI will attack that target.
{% endhint %}

<figure><img src="https://content.gitbook.com/content/v03IiZPaMe8fX49a9MnO/blobs/nuYJgnXKCKsXRiaGl8Q4/FactionSettingsFoldout.png" alt=""><figcaption></figcaption></figure>

## Setting up an AI's Faction Relations

The first time you are setting up an AI's Factions, you will receive a warning message about an AI needing at least 1 faction to function properly. To fix this, you will need to set up an AI's factions, which is covered below. This is also useful if you want to change an AI's faction or its relation with other AI.

<figure><img src="https://content.gitbook.com/content/v03IiZPaMe8fX49a9MnO/blobs/yz3IWgeQNqqySVU7v0Vj/AIFactionWarning.png" alt=""><figcaption></figcaption></figure>

To setup an AI's Faction Relations, you will first need to assign the AI a Faction of its own. This can be any of the preexisting Faction Relations from the Faction Manager.

<figure><img src="https://content.gitbook.com/content/v03IiZPaMe8fX49a9MnO/blobs/sOuUWBcaTDVg6ZFmk6jp/AnAIsOwnFaction.png" alt=""><figcaption></figcaption></figure>

You will need at least 1 faction in order for an AI to function properly. You can do so by pressing the + button at the bottom of the AI Faction Relation List. Next, you can choose your Relation Type with that Faction. You can also remove factions by selecting the faction within the faction list, and pressing the - button.

{% hint style="warning" %}
**Important:** An AI cannot have its own faction set as Enemy or you will receive an error.
{% endhint %}

{% hint style="warning" %}
**Important:** In order for an AI to detect a player, the player will need to have its own faction. By default, this is Player. If you want an AI to attack the player faction, it will need to have a Relation Type of Enemy with the Player faction.
{% endhint %}

<figure><img src="https://content.gitbook.com/content/v03IiZPaMe8fX49a9MnO/blobs/yR9NCaMOH7BIQgPxC5bS/ApplyingFactionRelations.png" alt=""><figcaption></figcaption></figure>

At any time, if you need to add or modify the available factions, you can do so by pressing the Open Faction Manager button. This will allow you to edit and add new factions, which will become available within all Faction dropdowns. For more information on the Faction Manager, you can see the [Faction Manager](/emerald-ai-wiki/emerald-managers/faction-manager.md) section of the Wiki.

<figure><img src="https://content.gitbook.com/content/v03IiZPaMe8fX49a9MnO/blobs/Jpry6YHZ0fmWoCfBopqR/OpenFactionManager.png" alt=""><figcaption></figcaption></figure>


---

# 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://black-horizon-studios.gitbook.io/emerald-ai-wiki/emerald-components-required/detection-component/faction-relations.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.
