# Creating an Enemy

<figure><img src="/files/254wZ9pzBBtXVGfW2slm" alt=""><figcaption></figcaption></figure>

### Creating the Character & Setting up the Components

1. Create a new blueprint derived from **Soulslike Enemy (B\_Soulslike\_Enemy).**

<figure><img src="/files/1pv24kBzIlJtfyP14Dwm" alt=""><figcaption></figcaption></figure>

2. Assign your character mesh & the relevant Animation Blueprint you'd like to use:

{% hint style="info" %}
If your character is Epic skeleton compatible, you can use the Animation Blueprint & the Animation Blendspace provided by Soulslike Framework.
{% endhint %}

<figure><img src="/files/5529guT3gaMw45LMOtlG" alt=""><figcaption></figcaption></figure>

3. **(Optional)** If your character will be using weapon(s), add a **Child Actor Component** to your Mesh. Select the world actor **(derived from B\_Item\_Weapon\_AI)** for the weapon you'd like your enemy to use:

{% hint style="success" %}
For more information about creating **AI Weapons**, check out our guide on [Creating & Editing Weapons for AI](/workflow/creating-and-editing-items/creating-and-editing-weapons.md#creating-editing-weapons-for-ai).
{% endhint %}

<figure><img src="/files/51f0LrhBWTn7rwzX9GAg" alt=""><figcaption></figcaption></figure>

4. **(Optional)** Setup your loot table for the enemy under the **AC\_LootDropManager** component. For more information, [read about the Loot Drop Manager component here](/components-managers/shared-components/loot-drop-manager.md).

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

5. Setup movement speed & stats/attributes for your enemy under the **AC\_StatManager** component. Additionally, you can override any stat/attribute you want and adjust their values from this component. For more information, [read about the Stat Manager component here](/components-managers/shared-components/stat-attribute-manager.md).

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

6. Setup AI behavior for your enemy under the **AC\_AI\_BehaviorManager** component. For more information, [read about the AI Behavior Manager component here](/components-managers/ai-only-components/ai-behavior-manager.md).

<figure><img src="/files/6kzajZq7wh99YPuG6PQO" alt=""><figcaption></figcaption></figure>

7. Finally, setup combat related data for your enemy under the **AC\_AI\_CombatManager** component. For more information, [read about the AI Combat Manager component here](/components-managers/ai-only-components/ai-combat-manager.md).

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

{% hint style="warning" %}
If your Enemy character will not be using a weapon, ensure that you fill in the **Unarmed** category correctly under **AC\_AI\_CombatManager.**
{% endhint %}

### Creating AI Abilities

Soulslike Framework uses a data-asset based, scored ability system for every enemy's abilities. To create new abilities, click on the Soulslike Framework dropdown and select the **AI Ability Creator**:

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

For each ability, you can define the corresponding **montage**, its **score** (weight based), its **cooldown** and custom **rules**. For more information on creating montages & utilizing notifies, [check out our Setup Custom Montages](/getting-started/quickstart/setup-custom-montages.md) page.

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

After creating the ability, do not forget to assign it to your enemy's **AC\_AI\_CombatManager!**

### Advanced: New/Custom Ability Rules

The framework provides two rules - **Distance (FAiRuleDistance) & Stat (FAiRuleStat)**. These rules are structures that contain relevant data. They are located in **/SoulslikeFramework/Structures/AI/Rules.**

With the use of **Instanced Structures,** you can create your own rules by creating a new structure with the relevant data and adjusting the **EvaluateAbilityRule()** function inside **AC\_AI\_CombatManager.**

#### Example #1 - Target (player) Stat Rule

For this example, we'll create a rule which is **capable of checking any Stat of the player**. Start by duplicating the **FAiRuleStat** rule and rename it appropriately (or just create a new struct):

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

Next, adjust the EvaluateAbilityRule() function to take into consideration this new rule we created:

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

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

Finally, utilize the rule in any AI Ability you have:

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

<figure><img src="/files/3RpccK3ZoX8ulzNMfhgd" alt=""><figcaption><p>After the player's health drops below 95%, enemy can no longer execute the ability - thus strafing randomly.</p></figcaption></figure>

#### Example #2 - Input Reading Rule

For this example, we'll create a rule that is **capable of reading player input**. Start by creating a new structure and name it appropriately - lets say **FAiRulePlayerInput**:

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

For this rule, we want to keep track of the actions the player is executing. We can retrieve this from the [AC\_InputBuffer ](/components-managers/player-specific-components/input-buffer.md)component of the player. We will bind to the **OnInputBufferConsumed** delegate in the Input Buffer Component to detect when an action has been performed. You can do this anywhere you like, but for this example, we'll do it inside [AC\_AI\_BehaviorManager](/components-managers/ai-only-components/ai-behavior-manager.md)'s **SetTarget()** method:

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

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

Now that we're keeping track of the recently triggered actions of the player, we can utilize this new property we created (**MostRecentPlayerActionInput**) on the [AC\_AI\_CombatManager](/components-managers/ai-only-components/ai-combat-manager.md)'s **EvaluateAbilityRule()** method:

<figure><img src="/files/5H0LKeqEQKo3AeFJLt9r" alt=""><figcaption></figcaption></figure>

Add the new rule to the AI ability you want to use:

<figure><img src="/files/1dLnNlgQokM8cJXh4cZS" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/3xdNRJtr4eqOsqrhy2iX" alt=""><figcaption><p>Enemy will now dodge when player attacks!</p></figcaption></figure>


---

# 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://soulslike-framework.isik.vip/workflow/creating-an-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.
