Coat of arms modding

From Imperator Wiki
Jump to navigation Jump to search


Flag scripting is located in game/common/coat_of_arms/coat_of_arms with different files for prescripted flags, random flags and templates for random flags.

Flag files are located in game/gfx/coat_of_arms with different folders for patterns, colored emblems and textured emblems.


Existing Countries[edit]

All existing countries have their flag defined in common/coat_of_arms/coat_of_arms/00_pre_scripted_countries.txt.

For example:

ETR = {
	pattern = "pattern_solid.tga"
	color1 = "etruscan_blue"
	color2 = "bone_white"

	colored_emblem = {
		texture = ""
		color1 = "bone_white"

The possible elements are:

Key Description Example Notes
pattern The pattern used, refers to a file in game/gfx/coat_of_arms/pattern pattern = "pattern_solid.tga" Is not required, will be solid red if not specified. More info below.
color1 The color used for the red in the pattern file color1 = "bone_white" This color is required, since it also colors the folds on the flag.

Default is hot pink

color2 The color used for the yellow in the pattern file color2 = "pitch_black" This color is required, since it also colors the armor on the units ingame.

Default is lime green

color3 The color used for the white in the pattern file color3 = "ck2_yellow" This color is not required and is only used on patterns which have three colors. Has no other impact.
colored emblem This is used to specify a colored emblem to be placed on the flag
colored_emblem = {
    texture = ""
    color1 = "bone_white"
This part is not required and multiple can be used. More details below.
textured emblem This is used to specify a textured emblem to be placed on the flag
textured_emblem = {
    texture = ""
This part is not required. More details below.


A pattern must be specified if not using a textured emblem that is full size (256x256).

  • color1 indicates the color of the red fields
  • color2 indicates the color of the yellow fields
  • color3 indicated the color of the white fields

For example the rebel flag:

REB = {
	pattern = "pattern_diagonal_split_01.tga"
	color1 = "phrygia_red"
	color2 = "pitch_black"

Colored Emblems[edit]

Color emblems are an optional part of which multiple can be used. They can have the following subelements.

Key Description Example Notes
texture The emblem used, refers to a file in game/gfx/coat_of_arms/colored_emblems texture="" Required
color1 The color used for the pink in the emblem file color1 = "bone_white" This is required, otherwise hot pink is used.
color2 The color used for the yellow in the yellow file color2 = "pitch_black" Required if the emblem has a yellow color. If not specified lime green is used
mask Effect is unknown mask = { 1 2 3 } Used in tags like MAP, but effect is unknown

An instance field can be used to adjust other elements of the emblem. Multiple of these can be used within the colored_emblem area. This is not required. Example:

BYZ = {
	pattern = "pattern_solid.tga"
	color1= "roman_red"
	color2= "ck2_yellow"
	colored_emblem = {
		texture = ""
		color1 = "ck2_yellow"
		instance = { position = { 0.3 0.3 } scale = { -0.35  0.35 } }
		instance = { position = { 0.7 0.3 } scale = {  0.35  0.35 } }
		instance = { position = { 0.3 0.7 } scale = { -0.35 -0.35 } }
		instance = { position = { 0.7 0.7 } scale = {  0.35 -0.35 } }
Key Description Example Notes
position Indicates the position of this instance. position = { x y } Values are from 0 to 1
scale Indicates the scale used for this instance. scale = { x y } Values are from 0 to 255, with 1 being normal size

Negative values mirror the emblem around its own centrepoint

rotation Rotation rotates the emblem around the centrepoint of the whole flag rotation = 90
depth Unknown depth=0.010000 Is used in tags like MAP, but effect is unknown

This can not be used to vary colors

Textured Emblems[edit]

Textured emblems are the recommended way of making your own flag as it is by far the easiest way.

Textured emblems can have any size, but 256x256 is recommended.


BAR = {
	pattern = "pattern_solid.tga"
	color1 = "ck2_black"
	color2 = "phrygia_red"

	textured_emblem = {
		texture = ""

The textured emblem is overlaid on the whole image.


Colors can be defined in three ways

  • using a named color color1 = pitch_black
  • using an rgb value color1 = rgb { 255 255 255}
  • using an hsv value color1 = hsv { 1.0 1.0 1.0}

Named colors can be found in /common/named_colors/default_colors.txt A new one can be made by adding another file in this folder with entries like so:

colors = {
    custom_color = hsv { 0 0 0.12 }
    custom_color = rgb{ 128 128 128 }

The entries are made in either hsv or rgb format.

Making a new pattern or emblem[edit]


All patterns consist of 256x256 images with a maximum of three colors. Formats confirmed to work so far are png, dds and tga.

  • red (rgb 255 0 0) used for color1
  • yellow (rgb 255 255 0) used for color2
  • white (rgb 255 255 255) used for color3

The blocks don't have to be connected and can have any shape.

Colored Emblems[edit]

Colored emblems consist of 256x256 or 512x512 images (mostly). Other sizes also exist but these are recommened. Formats confirmed to work so far are: png, dds and tga.

The colors below are the main colors used in making emblems.

  • pink(rgb 255 0 128) used for color1
  • light yellow (rgb 255 255 128) used for color2
  • blue (rgb 0 0 255) which denotes the amount of black

The blue channel (for color 1 and 2) is a special one. It can be set to 0 to make it completely black, or to 255 to make it completely white. If using just the blue channel (with red and green set to 0) will vary the color between white (255 255 255) and black (0 0 0).

This effectively denotes how much black and white you can to mix in: 0-128 for black, and 128-255 for black. This way you can make any color fade into black or white without needing the color2.

Fades are made by lowering the green channel. So an rgb value of (255 128 128) will be a mix of color1 and color2 in equal proportions.

The alpha value denotes transparency. A value of 255 is non-transparent and a value of 0 will show just the background.

Documentation EffectsTriggersModifiersScopesVariablesData TypesLocalisationCustomizable localization
Scripting AIBuildingsCasus belliCharacterCharacter InteractionsCombat TacticsCountriesCultureDecisionsDefinesEconomic PoliciesEventsEthnicitiesGovernmentGovernor PoliciesIdeasModifiersMilitary TraditionsOfficesOn ActionsPartiesPricesPopsProvince setupReligionScript ValuesScript ModifiersSubject TypesTechnologyTrade goodsTraitsUnits
Map MapTerrainMap locators
Graphics 3D ModelsInterfaceCoat of armsGraphical AssetsFontsParticlesShadersUnit models
Audio MusicSound
Other Console commandsChecksumMod structureTroubleshooting