How to add Hero Units in Your MOD


Mar 10, 2012
This tutorial explains how to add Heroes to your MOD by extending the Civlization Allstars MOD. And you can create bridge MOD to add Heroes to other people's MOD too.

This tutorial assume you have basic knowledge of modding, can use Modbuddy, create XML files, and create iconatlas. I'll use this Civ Scotland mod to explain how to create an allstars bridge mod, to add heroes to the Scotland Civilization.

Before you start
you can try create a game with both mod enabled. Since there are no Heroes defined for Scotland, you can see the allstars mod assign some random Heroes to Scotland.
Spoiler :

This feature allow you to play a hero game with custom civilization MOD. But that's good enough, if you want to add custom heroes for Scotland, follow these steps to create a bridge mod.

Create the MOD
Create an empty MOD in Modbuddy, and add dependencies to both Allstars and Scotland MOD:
Spoiler :

The mod ID and name can be found at the head of modinfo file in the root of these mod's dir.

Add your first Hero
Now let's add William Wallace through XML file. Create a new XML file and add an "OnModActivated" -> "UpdateDatabase" entry in the "Actions" tab of mod properties page. Then enter the following codes in the XML file:
Spoiler :

Let's take a deeper look at the context of this file.

The <Type> tag is used as a string key to index the table. For easier display, this key must be the same as <Description>. Here we enter TXT_KEY_HERO_SCOTLAND_WALLACE. And add this english language string at end of file.

The <Description>, <Civilopedia> and <Help> as you may expect, are the text keys for your Hero. <Description> is the name key, <Civilopedia> is the history info of this Hero, you need to provide these text keys. <Help> is the help info, your can provide your own, or use the default ones for each Hero Class. Here we add an <Civilopedia> string from wikipedia, and use the default help key, in this case, TXT_KEY_HERO_AGILITY_HELP for agility hero.

The <PortraitIndex> and <IconAtlas> are the portrait picture for the Heroes, provide your altas in the following sizes:
256, 128, 80, 64, 45, 32
We create the SCOT_HERO_ATLAS atlas, add the arts and atlas files.

The <Civilization> defines the owner of this Hero, enter CIVILIZATION_SCOT for the Scotland Civilization.

The <TalentClass> define the start talent pillar of the Hero, the Hero's Class can be also infered from the start pillar. Hero we define Wallace as a Ranger and give him the start talent of TALENTCLASS_AGILITY. the 7 talent cass and corresponding hero class are:
Spoiler :

Add 2 more Heroes
Let's repeat to add 2 more heroes : Robert the Bruce and Princess Isabelle. For balance reason, each Civ should start with 3 heroes and they are Martialist, Ranger and Magician. Since Isabelle is a female hero, you need to add a <Female>true</Female> tag for her, so she can use female only spell.
Don't forget to add "UpdateDatabase" actions for these files.

Test in game
Test this bridge mod by enable all 3 mods together:
Spoiler :

you should be able to setup a game with Scotland heroes now:
Spoiler :

Customize your Hero
Every hero will start with default unit type, and receive a random hero trait at a different game. But you can customize these by modifing the xml file, now let's make Wallace a Highlander(UU of Scotland) and give him a trait of Flying General, which increase skill damage and grant him extra moves and promotions. You can do this by add the following two line in green:
Spoiler :
<?xml version="1.0" encoding="utf-8"?>
[COLOR="Green"]			<UnitType>UNIT_HIGHLANDER</UnitType>
[/COLOR]		</Row>
			<Text>William Wallace</Text>

Now rebuild your mod and check in game for the changes:
Spoiler :

The full list of Hero Traits can be found at this file in Civilization Allstars MOD:

You can download this example mod here:
View attachment Example - Allstars Bridge for Civ Scotland MOD (v 1).civ5mod

And feel free to ask any questions.


Mar 10, 2012
Advanced features
You can also customize abilities, artifacts, hero traits and many other features of this mod by XML. And if you want to add custom effect through LUA, there are special GameEvents and LuaEvents defined, you can add LUA callback functions to these events. I'll write in more detail later.

Stephan Reiken

Sep 29, 2013
From a third party, worked for me. I just wanted to add my own heroes with their own art and descriptions. You can see the result in the last screenshot on my mod's steam page here.


Mar 10, 2012
you can add a hero for world wonder, replace the <Civilization>...</Civilization> tag with a wonder tag like this:
the content is the wonder class of your custom wonder.

But you can not add hero for tech, since a wonder only have 1 global instance, but tech is for all players and may create duplicate hero
Top Bottom