Modding General

**Mods** are changes or additions to Hegemony III created by its players. To install a mod, you'll need to move the mod's folder (it should contain a Resources/ folder and possibly a cover.str and/or a guicover.dds file) into My Documents/Longbow Digital Arts/Hegemony III/Mods. If that folder does not exist, create it. It should appear in the "Mods" menu if it is successfully installed. Successful installation of a mod automatically activates it; if you would like to deactivate a mod, either uninstall it by deleting its folder in the My Documents/Longbow Digital Arts/Hegemony III/Mods/ folder or click on it in the Mods menu.

Creating a mod is similar. You'll need to create a folder in My Documents/Longbow Digital Arts/Hegemony III/Mods/. In that folder, you can create a Resources folder for the game to draw from (if you do not, your mod will not do anything), a cover.str StringWrangler file to define the name and description of your mod as it shows up in the mods menu (if you do not, your folder name will be used as your mod name), and a guicover.dds file to show as your mod's button (if you do not, a default texture will be used).

You can refer to this Steam Guide for an introduction to Modding Hegemony 3.

## Workshop Integration

You can upload mods to the Steam Workshop. To upload a mod, press `F2` and enter the `workshopupload()` script command. This command has four parameters: the name of the folder in My Documents/Longbow Digital Arts/Hegemony III/Mods you want to upload, the title of your mod, the description of your mod, and optionally, an image's filename to be used as your mod's icon on the Steam Workshop. It is recommended to only use `workshopupload("ModFolder")`, everything else can be completed in Steam. When updating your mod use the same command `workshopupload("ModFolder")` and your mod will be updated in the workshop. If you'd rather create a complete new version of your mod (e.g. because you want the older version to be still available for compatibility reasons), then you can remove the steamID.txt in your mod folder and upload using the aforementioned command. This will remove the connnection to the existing version of your mod and create a new mod entry in Steam.

## Modding Tutorial

These are the chapters of Longbow's Modding Tutorial as featured at the Steam Workshop Discussion page.

1. Basics and the Blue Histri
2. Stances
3. New Factions in a New Sandbox
4. Upgrades
5. Skills and Skill Trees
6. Brigades
7. A First Look At Events
8. Quests (continues from Events)

## Main Modding Objects

### globals.xnt

Various miscellaneous game variables (not all of which do anything) are found in Resources/Data/globals.xnt. If any mod has a Data/globals.xnt, the game will use any values defined in it instead of the default ones. Values can be missing from the mod's globals.xnt, in which case the game will use the default value.

* AI Modding

### String Modding

Most mods will need a large amount of strings for a variety of subjects such as the names and descriptions of factions, cities, scenarios or objectives. See String Modding for more information. This is the easiest way to modify the game experience.

* String Modding

For a guide how to create your own localization / translation of the game, see here.

### Entity Modding

Most game objects like units and factions are defined as XML text files called entities. See Entity Modding for more information. This covers the structure that all entity types share; for how to edit specific entity types, see the correct page:

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

The .xnt files relevant for the entities can be found in Longbow's Google Drive

### Music Modding

Unlike other games, there is no fixed musical composition in this game, but rather bits and pieces of music are dynamically combined depending on game situation. Still, some modding is possible.

* Music Modding

### Scenario Modding

A scenario file determines the starting conditions of a game including the map, factions and play boundaries. See Scenario Modding for more information. A Scenario Mod may involve complex file interactions and scripting.

* Scenario Modding

## Map Editing

Using the Map Editor you can create new historical or fantasy worlds to campaign on.

## Scripting

### LUA Scripting

LUA is a scripting language used in Modding Hegemony III (i.e. the \*.lua files). More detail and references can be found in the dedicated article on LUA Scripting.

### Debug Mode

The game has its own debug mode wherein you can quickly see the cursor map position and entity tags and other things that are really useful when modding. Also it allows the game to run in the background, which helps when testing so you don't have to stay in the game all the time. If you want to use the debug mode, you have to call the console command `debugmode(true)` after you start the game. To disable again type `debugmode(false)`.

The mod "Always-On Debug Mode" by jorellaf, which you can get in the Steam workshop, runs a script at load which sets debugmode(true). The mod simply makes it easy for you to have access to the debug mode without actually making your own mod and cover.str, or having to call the debugmode(true) command every session.

*Hint*: if you want to show the return of certain console commands (i.e. output them to the console) then you can use `print()` for strings or `pprint()` for other function returns.

### Script Function List

Please refer to the dedicated page Script Function List for a list of commands used in modding Hegemony. You can also always search in the console using command("@@@") toghther with a search-string.

### Tips & Tricks

On the page Modding Tips & Tricks you'll find a compilation of useful tips that might help to achieve your modding objective.

## Modding Tools

There is a number of Modding Tools that either make a modder's life easier or are just a requirement for modding.

## Other References

* Longbow's step-by-step Modding Tutorial on Steam