# 6. Custom Assets

# Custom AI

Information about how to create and manage custom AI variants.

# Helpful Tips in Organizing Custom Assets



# 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>

# Creating Custom AI - entities

<p class="callout info">See [Creating Custom AI - decls](https://wiki.eternalmods.com/books/advanced-guide-custom-assets/page/creating-custom-ai-decls) before proceeding</p>

### idAI2 - [Reference](https://wiki.eternalmods.com/books/entities-custom-encounters/page/idai2)

Reference the original **idAI2** file for the vanilla AI and copy it into a separate text file. Like the the **entitydef** decl file, this links all the decls together in a usable format. You will need to copy all of the decl references in this entity, just like for the **entitydef** file.

<p class="callout warning">Make sure to inherit from the added **entitydef** decl.</p>

**materialRemap** is used to apply the custom textures to the new demon. Under **renderModelInfo**, a **materialRemap** parameter can be added (if it does not already exist). The following is an example.

```
renderModelInfo = {
	model = "md6def/characters/monsters/gargoyle/base/gargoyle.md6"; // base gargoyle model to use
	materialRemap = {
		num = 2;
		item[0] = {
			from = "models/monsters/gargoyle/gargoyle"; // replace existing texture
			to = "models/customization/monsters/mancubus/set12/mancubus_guns_set12"; // to this
		}
		item[1] = {
			from = "models/monsters/gargoyle/gargoyle_body";
			to = "models/customization/monsters/mancubus/set12/mancubus_body_set12";
		}
	}
}
```

<p class="callout info">**materialRemaps** should also be done in the entityDef decl.</p>

Notice that the **set12** skin for the the Mancubus is used. See [Creating Custom AI - textures](https://wiki.eternalmods.com/books/6-custom-assets/page/creating-custom-ai-textures) for more information.

### idTarget\_Spawn - [Reference](https://wiki.eternalmods.com/link/64#bkmrk-eternal)

The **idTarget\_Spawn** entity is used to spawn the custom AI. You will need more per custom AI that you want to spawn. Make sure to change the spawn positions for each. Always reference the idAI2 entity when spawning the custom AI, so you would not accidentally spawn the vanilla AI.

#### Troubleshooting

The process of getting custom AI working is a rather challenging task. You are bound to encounter some issues. Double check all of your **modified** decls and reference them with their **vanilla** counterparts. Same applies to **entities**. Ask yourself the following:

- Are you spawning your AI correctly?

If not, check the **idAI2** and **idTarget\_Spawn** for typos. The [encounter manager](https://wiki.eternalmods.com/books/5-level-modding/page/idencountermanager) can also have syntax errors.

- Are the textures loading consistently?

If not, check the **materialRemaps** or **TGA** files for typos. Also, check if the textures are added correctly in the assetsinfo JSON file.

- Does your AI function as intended?

If not, check the **decls** for typos or mislinks. The **entitydef** file might be the root of your problems if there is a mislink.

<p class="callout info">Double check BOTH assetsinfo JSON files for typos. Most crashes occur from syntax errors.</p>

### See Also

- ##### [Entities](https://wiki.eternalmods.com/books/entities-custom-encounters/chapter/entities)

# Creating Custom AI - textures

<p class="callout info">See [Creating Custom AI - decls](https://wiki.eternalmods.com/books/advanced-guide-custom-assets/page/creating-custom-ai-decls) before proceeding</p>

### Creating Custom Textures

While adding custom textures into the game is possible, it is not the optimal choice. Even if the added textures are in a relatively high patch directory, there is the chance that some of them will not load properly, especially if there are a lot of added assets in the mod(s).

Instead, it is recommended to replace the textures of an existing playable demon skin. Since injecting gameplay-altering mods disable Battlemode entirely, there is little concern for distorting playable demon skins. You will want to edit the regular demon skin like normal and replace its name with the cosmetic skin that you want to replace. Make sure to include the ENTIRE file extension ( ex: **mancubus\_body\_set12.tga$streamed$mtlkind=albedo** )

Also, be sure to replace ONLY the matching **$streamed$** TGA extension. In the case of Gargoyles, replace any **.tga$streamed$mtlkind=albedo** file with that of the same extension for a **set12** mancubus skin, for example. Most cosmetic skins are located in **warehouse\\models\\customization\\monsters**

If your extracted textures do not have the **$streamed$** TGA extension, then reference here - [Resource Data](https://docs.google.com/spreadsheets/d/1uKJjAptblGkqiFUbH8ksGoRjXAstTrpXgh3Ja5W-W1c)

Then, you need to modify the **material2** decls for demon skin in **warehouse**. They will be used to remap the textures on the custom AI. For the Stone Gargoyle, copy all the regular Gargoyle material2 decl parameters into the demon skin material2 decl equivalent that you set.

For example, the following would be copied over:  
**models/monsters/gargoyle/gargoyle\_body**  
to  
**models/customization/monsters/mancubus/set12/mancubus\_body\_set12**

<p class="callout info">It is best practice to replace a demon skin material2 decl with a similar name to the custom AI material2 decl.</p>

In the copied **gargoyle\_body** decl, which is now named **mancubus\_body\_set12**, replace the RenderLayers with your modified demon skin textures. The following is an example:

```
RenderLayers = {
	item[0] = {
		parms = {
			bloommaskmap = {
				filePath = "models/monsters/gargoyle/gargoyle_body_e.tga";
			}
			sssmask = {
				filePath = "models/customization/monsters/mancubus/set11/mancubus_body_set11_sss.tga";
				options = {
					format = "FMT_BC3";
				}
			}
			smoothness = {
				filePath = "models/monsters/gargoyle/gargoyle_body_g.tga";
			}
			normal = {
				filePath = "models/monsters/gargoyle/gargoyle_body_n.tga";
			}
			specular = {
				filePath = "models/monsters/gargoyle/gargoyle_body_s.tga";
			}
			albedo = {
				filePath = "models/customization/monsters/mancubus/set12/mancubus_body_set12.tga";
			}
		}
	}
}
```

Once each material2 decl is modified, you will need to use a **materialRemap** in the **renderModelInfo** of BOTH the **entityDef** decl and **idAI2** entity. The following is an example:

```
renderModelInfo = {
	model = "md6def/characters/monsters/gargoyle/base/gargoyle.md6";
	materialRemap = {
		num = 8;
		item[0] = {
			from = "models/monsters/gargoyle/gargoyle";
			to = "models/customization/monsters/mancubus/set12/mancubus_guns_set12_hq";
		}
		item[1] = {
			from = "models/monsters/gargoyle/gargoyle_body";
			to = "models/customization/monsters/mancubus/set12/mancubus_body_set12";
		}
		item[2] = {
			from = "models/monsters/gargoyle/gargoyle_cs";
			to = "models/customization/monsters/mancubus/set12/mancubus_body_set12_hq";
		}
		item[3] = {
			from = "models/monsters/gargoyle/gargoyle_eyes";
			to = "models/customization/monsters/mancubus/set12/mancubus_eyes_set12";
		}
		item[4] = {
			from = "models/monsters/gargoyle/gargoyle_fbg";
			to = "models/customization/monsters/mancubus/set12/mancubus_legs_set12_hq";
		}
		item[5] = {
			from = "models/monsters/gargoyle/gargoyle_gore";
			to = "models/customization/monsters/mancubus/set12/mancubus_head_set12_hq";
		}
		item[6] = {
			from = "models/monsters/gargoyle/gargoyle_head";
			to = "models/customization/monsters/mancubus/set12/mancubus_head_set12";
		}
		item[7] = {
			from = "models/monsters/gargoyle/gargoyle_wings";
			to = "models/customization/monsters/mancubus/set12/mancubus_legs_set12";
		}
	}
	lightRigDecl = "gargoyle/gargoyle_default";
}
```

If you want to go far enough to apply the textures to sync kills (glory kills, chainsaw kills, crucible kills, berserk kills), the apply the same **materialRemap** to added **entitydef\\characters\\monsters** decls and reference them in the added **entitydef\\syncmelee** decls.

### See Also

- [Eternal Texture Mods: Beginner's Guide](https://wiki.eternalmods.com/books/eternal-texture-mods-a-comprehensive-guide/page/beginners-guide)

# Moving Assets

Information about moving assets from and to other patches.

# Assets Info Redirect Links

### assetsinfo JSON

##### [Format Overview](https://wiki.eternalmods.com/books/modinjector-json-guide/page/format-overview)

##### [Reference: "resources" Array](https://wiki.eternalmods.com/books/modinjector-json-guide/page/reference-resources-array)