# Creating Custom AI - decls

<p class="callout warning">This is an ADVANCED GUIDE. You are expected to have a decent understanding of decls, textures, and entities.</p>

#### See the Following Books Before Proceeding

- ##### [How to Create Mods](https://wiki.eternalmods.com/books/2-how-to-create-mods)
- ##### [Texture Modding](https://wiki.eternalmods.com/books/4-texture-modding)
- ##### [Level Modding](https://wiki.eternalmods.com/books/5-level-modding)

### Basics

For starters, do all of your editing on an existing AI, so you know what the results will look like before you spend a large sum of time managing an entirely new AI variant.

For your custom AI, you want to copy all the decl files that will be changed. The **entityDef** file is the most important and mandatory for almost all custom AI. Paste the vanilla decls into a [resource patch with a very high priority](https://docs.google.com/spreadsheets/d/10R5fWKGyqPuCPdueqKeCYycHETSHg0QeFOCbWIQZUCY). Patch priority changes between each update, so you will most likely need to change it after each update. As of Update 6.66 rev 1.1, it is recommended to use **e6m1\_cult\_horde\_patch1**, **e6m2\_earth\_horde\_patch1**, or **e6m3\_mcity\_horde\_patch1**.

<p class="callout warning">Be sure to rename the decls too, so they do not replace properties of the vanilla AI.</p>

After making changes to the decls, you will need to link them to the other modified decls if necessary. Make sure to do so for all of the modified decls. For example, to link the demon's FX, go to the entityDef file and change:  
**fxDecl = "character/gargoyle/gargoyle";**  
to  
**fxDecl = "character/stonegargoyle/stonegargoyle";**

<p class="callout info">The stonegargoyle FX decl is a modification to the vanilla gargoyle decl.</p>

For every added asset, you will need to add them to the **EternalMod\\assetsinfo** JSON file. This must be done in BOTH the directory that contains all the added decls AND the level patch that holds your entities file(s). Here is an example:

**e6m3\_mcity\_horde\_patch1\\EternalMod\\assetsinfo\\e6m3\_mcity\_horde.json**

```
{
    "assets":
    [
        {
            "name":"ai/fodder/stonegargoyle",
            "mapResourceType":"entitydef"
        },
        {
            "name":"character/stonegargoyle/stonegargoyle",
            "mapResourceType":"fx"
        },
        {
            "name":"samplePath",
            "mapResourceType":"sampleResource"
        }
    ]
}
```

**e5m2\_earth\_patch2\\EternalMod\\assetsinfo\\e5m2\_earth.json**

```
{
    "resources":
    [
        {
            "name":"e6m3_mcity_horde_patch1.resources"
        }
    ],
    "assets":
    [
        {
            "name":"ai/fodder/stonegargoyle",
            "mapResourceType":"entitydef"
        },
        {
            "name":"character/stonegargoyle/stonegargoyle",
            "mapResourceType":"fx"
        },
        {
            "name":"samplePath",
            "mapResourceType":"sampleResource"
        }
    ]
}
```

<p class="callout info">samplePath &amp; sampleResource are not actual assets.</p>

In this example, the added assets are in **e6m3\_mcity\_horde\_patch1** because that resource patch has a very high priority and a low resource amount. The Stone Gargoyle custom AI will be loaded into the highest Reclaimed Earth patch (**e5m2\_earth\_patch2**).

When you are adding a new decl that is a variation of an existing file, if possible, always make it inherit from the vanilla demon counter part. This is especially important for the **entityDef** and **md6def**. A lot of The Ancient Gods Part 2 and Spectre demons do this, so use them as reference.

<p class="callout warning">Some decls, such as FX, cannot be inherited.</p>