Entity Modding

**Entity modding** is the addition of new or modification of existing entity types. An "entity" can be a brigade, building, faction, upgrade, stance, skill tree, skill, faction group, or anything else defined by a .XNT file. .XNT files are .XML files. In order to manipulate them, you'll need a plain text editor (like Notepad or Notepad++, but NOT Microsoft Word or other formatted text editors).

## Common XNT Structure

Every XNT file expects to be contained within a single xml block, and each entity expects to have an entire xml block to itself opening and closing with the "entity" tag. This is what an xml block defining an entity looks like.

```
<entity>
	(your data here)
</entity>

```

If you want to have multiple entities defined, you need to contain them all within one block marked "entitygroup", like so.

```
<entitygroup>
	<entity>
		(your data here)
	</entity>
	<entity>
		(your data here)
	</entity>
	<entity>
		(your data here)
	</entity>
</entitygroup>

```

In addition, every entity looks for its **class** and **type**. The **class** is what tells the game whether it's trying to make a unit, building, faction, or so on. The **type** is the unique name of the entity being defined here. For example, Greek Hoplites have the following header:

```
<entity>
	<type>greekHoplite</type>
	<class>brigade</class>
(...)
</entity>

```

Where "brigade" is specifying that it's a unit and "greekHoplite" is saying what type of unit it is. An entity's class and type can also be declared as xml attributes, which would look like this.

```
<entity class="brigade" type="greekHoplite">
(...)
</entity>

```

## Mod Technique

All editable entity types look for an attribute called "modtechnique". Add a modtechnique attribute when you're editing an existing entity. There are three valid declarations of modtechnique.

```
<entity modtechnique="merge" class="brigade" type="greekHoplite">

```

* Adds the contents of the entity block to the Greek Hoplite brigade.

```
<entity modtechnique="replace" class="brigade" type="greekHoplite">

```

* Replaces the Greek Hoplite with the contents of the entity block. Be sure to declare everything an entity of the given class needs!

```
<entity modtechnique="delete" class="brigade" type="greekHoplite">

```

* Deletes the Greek Hoplite.

## Entity Refs

These are references to another entity. A tag with an entity ref has a "class" and "type" attribute pointing to the entity referenced; usually, this tag will have nothing else in it and will be immediately closed with a slash. For example,

```
<defaultstance class="brigadestance" type="skirmish"/>

```

Is an entity ref pointing to the skirmish brigadestance.

## Atlas Refs

These are references to an image. Most atlas refs in the default game point to part of an "atlas", or image compiled out of multiple ones. For example,

```
<buildbutton atlas="buttons" sprite="buildetruscanaxemen"/>

```

points to the buildetruscanaxemen part of the buttons atlas, which is a large image containing every button in the default game stored together for optimization purposes. However, you can also point to a single image in an atlas ref. You do this by putting "FILE:" in the atlas attribute and path to the image in the sprite attribute. For example,

```
<generalportrait atlas="FILE:" sprite="Resources/Images/NewPortraits/etruscanarcher.png"/>

```

Is an atlas ref pointing to the custom image in a mod's resources/images/newportraits folder.

## See Also

This covers the structure that all entity types share: for how to edit specific entity types, see the correct page at:

* Brigade Modding
* Building Modding
* Faction Modding
* Skill Modding
* Stance Modding
* Upgrade Modding