盾徽修改

本页面适用于最新的版本(2.0)。


Coats of arms, or flags, are images used to visually identify a country. A country can either be given a unique pre-scripted flag, or have one automatically generated by the game (following pre-defined patterns).

Location

Flag scripting (for both pre-scripted flags and autogeneration patterns) is located in game/common/coat_of_arms/coat_of_arms. By default, they are organized into different files for prescripted flags and templates for randomly generated flags.

The images for the actual emblems and patterns used in flags are located in game/gfx/coat_of_arms with different folders for patterns, colored emblems and textured emblems.

Template types

Pre-scripted flags

In vanilla, all pre-scripted flags are 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 = "ce_chimera.dds"
		color1 = "bone_white"
	}
}

Every pre-scripted flag must have a name/key. If a flag's key matches that of a tag, then it will be automatically be used as that country's flag (in this example, ETR is the tag for 伊特鲁里亚的国旗 伊特鲁里亚, so this flag will be used for Etruria), but this is not necessary. In addition, a pre-scripted flag can always be assigned to any country in script by using the change_country_flag = KEY command in country scope (regardless of whether or not it was or is currently also assigned to a particular tag). Note that this can be done completely separately from changing a country's tag and (map) colour.

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 = "ce_chimera.dds"
    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 = "te_skull_goat.dds"
}
This part is not required. More details below.

Randomly generated flags

Randomly generated flags are used for all countries that do not have a pre-scripted flag. This includes most countries at start, as well as all those dynamically generated over the course of the game (unless they are assigned a pre-scripted flag through script). Templates for randomly generated flags are wrapped in a template = {} block and have the same structure as the definitions for pre-scripted flags, except that fields can be given a (separately defined) list of values instead of a single value - the game will randomly choose an element in the list (subject to weights and conditions) when generating a flag using the template. For example:

template = {
	flag_type_checkers_canton_01 = {
		pattern = "pattern_canton_01.tga"
		color1 = list "triggered_colors_list1"
		color2 = list "triggered_colors_list3"
		color3 = list "triggered_colors_list2"
		
		
		#checkers
		colored_emblem = {
			mask  = { 2 }
			texture = list "checkers"
			color1 = list "triggered_colors_list3"
			color2 = list "triggered_colors_list2"
			instance = { rotation = 180  }
		}
	}
}

Lists are defined in common\coat_of_arms\template_lists, and must be in a block corresponding to its type (coat_of_arms_template_lists, colored_emblem_texture_lists, color_lists, or pattern_texture_lists). Each value in a list is associated with a weight (which determines how likely it is to appear) and can also have a special selection trigger that places a condition on when that value is allowed to be chosen. For example:

	borders = {
		2 = "ce_border_simple_01.tga"
		4 = "ce_border_simple_02.tga"		# 4 times more likely to appear than the one in the line below
		1 = "ce_border_checker_01.tga"
		1 = "ce_border_rug_01.tga"
		1 = "ce_border_stars_01.dds"
		1 = "ce_border_triangles_01.dds"
		1 = "ce_border_triangles_02.dds"
		1 = "ce_border_zigzag_01.dds"
		1 = "ce_border_zigzag_02.dds"
		
		special_selection = {
			trigger = {
				country_culture_group = "hellenic"	# These will only be chosen for countries in the Hellenistic culture group
			}
			4 = "ce_border_meander_01.tga"
			4 = "ce_border_meander_02.tga"
			4 = "ce_border_meander_03.tga"
		}
		special_selection = {
			trigger = {
				primary_culture = "hebrew"	# This will only be chosen for countries with Hebrew primary culture
			}
			4 = "ce_border_leaves_01.dds"
		}
	}

When randomly generating a flag for starting countries, the flag will be generated based on a fixed seed so that it will always have the same flag, even across different starts or setups as long as nothing changes about which patterns and values it is eligible for. This gives the illusion of all starting countries having a pre-scripted flag, even though this is (typically) not the case.

Note that when randomly generating flags, the game does not check to see if there already exists a flag with the same set of values (and therefore an identical flag) - for instance, see 维涅提亚的国旗 维涅提亚 and 帕提亚的国旗 帕提亚 in vanilla. This can be mitigated by increasing the number of possible choices in each list.

Template elements

Patterns

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

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="ce_gryphon_01.dds" 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 Applies the flag pattern as a opacity mask on the emblem, with each number corresponding to a colour in the pattern. mask = { 1 } By default, the mask is { 1 2 3 }, which has no effect. Removing 1 from the array will make red areas in the pattern transparent, 2 will make yellow areas transparent, 3 will make white areas transparent.

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 = "ce_writing_greek_beta.dds"
		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

A textured emblem simply places an image as-is on the flag. If not using a pre-existing design, 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.

Example:

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

	textured_emblem = {
		texture = "te_skull_goat.dds"
	}
}

The textured emblem is overlaid on the whole image.

Colors

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 the /common/named_colors/ folder. 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. Note that all values in HSV colours are out of 1, while all values in RGB colours are out of 255.

Colours defined here can also be assigned to directly to countries in script to change their colour on the map (using the change_country_color = COLOUR command)

Making a new pattern or emblem

Patterns

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

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.

Converting flag emblems into images

The following instruction guide, specific to GIMP, details how to make flags from the game into images.

  • Obtain a detailed log for how a specific tag's emblem looks in game by using the coat_of_arms <TAG> console command
  • This information will be saved in the game log, found at PATH\Paradox Interactive\Imperator\logs
  • Open the texture file for the coloured emblem of interest (pink and yellow images)
  • Decompose into RGBA (or RGB if no alpha) layers, Colors -> Components -> Decompose...
  • Switch image back to RGB mode, Image -> Mode -> RGB
  • For red layer, fill completely with colour 1
  • For green layer (if not completely filled or same colour as red layer):
    • Duplicate
    • On original layer, Ctrl+A -> Ctrl+C (Copy whole layer)
    • On duplicate layer:
      • fill completely with colour 2
      • right click -> Add Layer Mask (or shift+left click layer)
      • Make sure layer mask is selected (border is on left thumbnail)
      • Ctrl+V -> Right click pasted layer -> Anchor Layer
      • Right click layer -> Apply Layer Mask
      • Delete/hide original layer
  • For blue layer (if not completely grey):
    • Duplicate twice
    • On duplicate layer #1:
      • Colours -> Curves -> set to (0, 0) to (127/128, 255)
      • Colours -> Linear Invert
      • Ctrl+A (Copy whole layer)
    • On a new black layer (this will generate "blue #1"):
      • right click -> Add Layer Mask
      • Ctrl+V -> Right click pasted layer -> Anchor Layer
      • Right click layer -> Apply Layer Mask
      • Delete/hide duplicate layer
    • On duplicate layer #2:
      • Colours -> Curves -> set to (127/128, 0) to (224, 255)
      • Ctrl+A (Copy whole layer)
    • On a new white layer (this will generate "blue #2"):
      • right click -> Add Layer Mask
      • Ctrl+V -> Right click pasted layer -> Anchor Layer
      • Right click layer -> Apply Layer Mask
      • Delete/hide duplicate layer
  • Arrange blue #1 > blue #2 > green > red layers
    • Merge them
  • Copy Alpha Layer
  • On merged blue/green/red layers:
    • right click -> Add Layer Mask
    • Ctrl+V -> Right click pasted layer -> Anchor Layer
    • Right click layer -> Apply Layer Mask