This thread is intended on providing a concise, step-by-step procedure for assigning custom graphics as a dynasty's coat of arms. A couple of notes:
This may sound obvious, but make sure you have a plan in place before you start amending files. Think about the scope of the changes you want to make and begin to gather raw images you want to use to build your CoAs. Most importantly, create a new directory in your /mod folder. Within that directory, add the following subfolders:
Replace the text within the <> with the text you want displayed in the load screen and the directory you just created.
Step 2: Create Your tga File
You will need to create a tga-formatted image for your coat of arm(s). There are many fine graphics editors out there, and I don't want to go into the details of how to perform graphics work. Check the provinces tutorial if you want a bit more guidance here.
While you can create one tga file per coat, I recommend that you consolidate all the graphics into a single file. Lay them out in a grid that looks something like this:
Bear in mind that if you wish to expand this image in the future, adding rows is relatively easy, but adding columns creates coding complications that I will discuss later. Upon completion, save your tga file in your mod's gfx/coat_of_arms directory. Name it whatever you want.
How big should each CoA be?
The Dynasty DLC pack allots 128x128 pixels for each coat of arms. I've been using that in my mod, but I do not believe that this a requirement. You could potentially go bigger to give yourself additional resolution, but ultimately, your graphics are going to get shrunk into a space that's 80x84 pixels. You'll have no control over the resizing process if you let the game handle it, so things may look not to your liking. It gets even worse for the mini CoA icon in character lists and the like. I'm not exactly sure how many pixels big that thing is, but you'll probably want to consider your CoA's appearance in that tiny space.
If you look in the game's gfx\coat_of_arms folder, you'll see the files plain.tga and plain_muslim.tga. Open them up and you can see the shield overlay size and shape in the game. Your square CoA in your tga file will be placed underneath these shapes. So any work you do outside the center 80% of the grid will show up in the game.
Step 3: Add Your Graphics to the Game
Go to the game's interface folder and find coat_of_arms.txt. Copy this file to your mod's interface folder. When you load your mod, your custom coat_of_arms.txt file will be loaded instead of the game's default.
Open your mod's copy of the file up and look through it for a declaration called textures:
This code tells the game to load imagery from tga files. You will need to go to the textures section you're interested in (western or Muslim) and add a new texture declaration to the end. It will look something like this:
Change the file name to match the file name you chose. Amend x to equal the number of COLUMNS in your tga file (even columns that are blank). Amend y to equal the number of ROWS in your tga file (even those that are blank). Set noOfFrames to equal x times y. Why would you ever want it to be lower? Well, if there are blank squares in your tga file in the last row, you can prevent yourself from accidentally assigning a dynasty to that blank graphic by lowering noOfFrames. But, I don't think it's necessary.
As for color, emblem, and random, I'd recommend the values I define above. To my knowledge, color and emblem relate to random CoAs.
Take note of how many texture declarations there are in the textures entry you amended. If it's the Western group and you have the Dynasty CoA DLC, it will probably be the 6th entry.
What happens if I goof the values of x and y?
To my knowledge, defining the wrong values for x and y will cause your CoAs to be distorted. This is what happened to the DLC content following the 1.03b patch. There was a mismatch in the shape of the tga file and the shape defined in coat_of_arms.txt.
Step 4: Assign Coats to Dynasties
Go to your game's common folder and copy dynasties.txt to your mod's common folder. Open it up and you'll see a listing of all the game's named dynasties. Other dynasties might pop up like "de Alexandria" based on a province's name. But in order to leverage your CoAs, the dynasty will need to be in here. You are welcome to add your own dynasties into this file as well. Just make sure you use unique ID numbers for them.
A dynasty's entry with a custom CoA will look something like this:
Each dynasty has a unique number assigned to it. It will have a name field in quotes and a culture without quotes. Comments might be present on a line following a # symbol. Most entries in the unedited copy of dynasties.txt will only have these two fields defined. We're going to add a third: coat_of_arms.
First, set templates = 0. If you go back to your coat_of_arms.txt file, you'll see this text:
By setting templates to a value of 0, we are saying that we're going to use coa_plain as the "matting" of our coats. Basically, we're going to put it in that shield shape (or circle if it's a Muslim CoA).
Underneath layer are several entries. The first, texture, maps to the texture declaration we added in coat_of_arms.txt. Remember that I said to note which element of the textures listing we were, and that it was probably the 6th entry? Well, the number you enter here has to equal the entry number minus 1 (for zero-based indexing). So by setting my example texture to 5 and having defined what tga file maps to entry 5 in coat_of_arms.txt, we now know which tga file to pull from.
The texture_internal field tells the game which grid space within your tga file to grab for the specific CoA you want. Again, this is zero-based indexing. So if you want the first image in your tga, you need to say texture_internal = 0. From there, the counting goes left to right and top to bottom. texture_internal = 7 would correspond to the 8th column of the 1st row of an 8x8 tga file. texture_internal = 15 would correspond to the 8th column of the 2nd row of an 8x8 tga. Get it?
The other four fields are not pertinent to this exercise. They relate to the emblems and patterns I said I wouldn't be detailing in this tutorial. It may be possible to delete them without repercussions. I haven't tested.
So once you have one of these entries completed, it's now just a matter of updating every dynasty's entry to point to the right coat in your tga. It's a lot of copying and pasting from here. Have fun with that
.
What happens if I mess up an entry?
If for some reason you accidentally don't type the right value for texture or texture_internal, one of two things will happen. Either you will display the wrong custom CoA, or you will get a random one. Your game won't crash if you inadvertently had an entry in dynasties.txt that said texture_internal = 72 in my example. You will just be left scratching your head as to why it doesn't look correct in the game.
Step 5: Verification and Maintenance
If you've accomplished all that's described above, then you should be good to go! Run CK2 with your mod checked on the load screen. Verify that your coats are present. If not, review the instructions above and see if you made a mistake. If you're still having a problem, I recommend a very simple, single coat modification. Eliminate possible causes of your issue by going to the degenerate case. Don't build a 1000 element tga file without verifying that you've mastered an easy modification.
How will my mod function following a patch or with extra DLCs?
If a patch or DLC modifies coat_of_arms.txt or dynasties.txt, then your mod will not be fully compatible. They might add a new texture entry, which you won't have in your mod. They might add new dynasties that won't show up when you play your mod. So always check to see if the date stamp on those files in the core game have changed when you update. If they have, you will probably need to amend your files to account for this. For example, if the game adds a new texture entry, you'll need to add it to your coat_of_arms.txt file and update your dynasties.txt texture declarations to be one value higher. It's a pain...I know.
How will my mod function with other mods?
If you want to load 2+ mods together that modify coat_of_arms.txt and/or dynasties.txt, then to my knowledge,only one will get utilized. The safest thing to do is to merge changes from multiple mods into a new, uber-mod that includes all changes and avoids file clashes.
- There are many aspects of this process that I'm not fully versed in and would certainly appreciate input from others to refine the instructions.
- This thread does not discuss how to leverage emblems and patterns to create of custom coat of arms.
- These instructions rely on posts from Arko, enderbr, and others. Many thanks for your contributions.
This may sound obvious, but make sure you have a plan in place before you start amending files. Think about the scope of the changes you want to make and begin to gather raw images you want to use to build your CoAs. Most importantly, create a new directory in your /mod folder. Within that directory, add the following subfolders:
- common
- gfx/coat_of_arms
- interface
Code:
name = "<my mod's name>"
path = "mod/<my mod's dir>"
Step 2: Create Your tga File
You will need to create a tga-formatted image for your coat of arm(s). There are many fine graphics editors out there, and I don't want to go into the details of how to perform graphics work. Check the provinces tutorial if you want a bit more guidance here.
While you can create one tga file per coat, I recommend that you consolidate all the graphics into a single file. Lay them out in a grid that looks something like this:

Bear in mind that if you wish to expand this image in the future, adding rows is relatively easy, but adding columns creates coding complications that I will discuss later. Upon completion, save your tga file in your mod's gfx/coat_of_arms directory. Name it whatever you want.
How big should each CoA be?
The Dynasty DLC pack allots 128x128 pixels for each coat of arms. I've been using that in my mod, but I do not believe that this a requirement. You could potentially go bigger to give yourself additional resolution, but ultimately, your graphics are going to get shrunk into a space that's 80x84 pixels. You'll have no control over the resizing process if you let the game handle it, so things may look not to your liking. It gets even worse for the mini CoA icon in character lists and the like. I'm not exactly sure how many pixels big that thing is, but you'll probably want to consider your CoA's appearance in that tiny space.
If you look in the game's gfx\coat_of_arms folder, you'll see the files plain.tga and plain_muslim.tga. Open them up and you can see the shield overlay size and shape in the game. Your square CoA in your tga file will be placed underneath these shapes. So any work you do outside the center 80% of the grid will show up in the game.
Step 3: Add Your Graphics to the Game
Go to the game's interface folder and find coat_of_arms.txt. Copy this file to your mod's interface folder. When you load your mod, your custom coat_of_arms.txt file will be loaded instead of the game's default.
Open your mod's copy of the file up and look through it for a declaration called textures:
Code:
textures = {
texture = {
file = "gfx\\coats_of_arms\\pattern.tga"
size = { x = 10 y = 3 }
noOfFrames = 27
color = 2
}
<snip>
# WHEN ADDING NEW, ALWAYS ADD AT THE END !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11111
}
}
Code:
texture = {
file = "gfx\\coats_of_arms\\tartans.tga"
size = { x = 8 y = 8 }
noOfFrames = 64
color = 0
emblem = no
random = no # Do not use for random CoAs
}
As for color, emblem, and random, I'd recommend the values I define above. To my knowledge, color and emblem relate to random CoAs.
Take note of how many texture declarations there are in the textures entry you amended. If it's the Western group and you have the Dynasty CoA DLC, it will probably be the 6th entry.
What happens if I goof the values of x and y?
To my knowledge, defining the wrong values for x and y will cause your CoAs to be distorted. This is what happened to the DLC content following the 1.03b patch. There was a mismatch in the shape of the tga file and the shape defined in coat_of_arms.txt.
Step 4: Assign Coats to Dynasties
Go to your game's common folder and copy dynasties.txt to your mod's common folder. Open it up and you'll see a listing of all the game's named dynasties. Other dynasties might pop up like "de Alexandria" based on a province's name. But in order to leverage your CoAs, the dynasty will need to be in here. You are welcome to add your own dynasties into this file as well. Just make sure you use unique ID numbers for them.
A dynasty's entry with a custom CoA will look something like this:
Code:
123 = {
name="Menteith" # This is a comment
culture = scottish
coat_of_arms = {
template = 0
layer = {
texture = 5
texture_internal = 20
emblem = 0
color = 0
color = 0
color = 0
}
}
}
First, set templates = 0. If you go back to your coat_of_arms.txt file, you'll see this text:
Code:
templates = {
"coa_plain:1"
"coa_party_per_fess:2"
"coa_party_per_pale:2"
"coa_party_per_cross:4"
"coa_party_triangle:3"
}
Underneath layer are several entries. The first, texture, maps to the texture declaration we added in coat_of_arms.txt. Remember that I said to note which element of the textures listing we were, and that it was probably the 6th entry? Well, the number you enter here has to equal the entry number minus 1 (for zero-based indexing). So by setting my example texture to 5 and having defined what tga file maps to entry 5 in coat_of_arms.txt, we now know which tga file to pull from.
The texture_internal field tells the game which grid space within your tga file to grab for the specific CoA you want. Again, this is zero-based indexing. So if you want the first image in your tga, you need to say texture_internal = 0. From there, the counting goes left to right and top to bottom. texture_internal = 7 would correspond to the 8th column of the 1st row of an 8x8 tga file. texture_internal = 15 would correspond to the 8th column of the 2nd row of an 8x8 tga. Get it?
The other four fields are not pertinent to this exercise. They relate to the emblems and patterns I said I wouldn't be detailing in this tutorial. It may be possible to delete them without repercussions. I haven't tested.
So once you have one of these entries completed, it's now just a matter of updating every dynasty's entry to point to the right coat in your tga. It's a lot of copying and pasting from here. Have fun with that
What happens if I mess up an entry?
If for some reason you accidentally don't type the right value for texture or texture_internal, one of two things will happen. Either you will display the wrong custom CoA, or you will get a random one. Your game won't crash if you inadvertently had an entry in dynasties.txt that said texture_internal = 72 in my example. You will just be left scratching your head as to why it doesn't look correct in the game.
Step 5: Verification and Maintenance
If you've accomplished all that's described above, then you should be good to go! Run CK2 with your mod checked on the load screen. Verify that your coats are present. If not, review the instructions above and see if you made a mistake. If you're still having a problem, I recommend a very simple, single coat modification. Eliminate possible causes of your issue by going to the degenerate case. Don't build a 1000 element tga file without verifying that you've mastered an easy modification.
How will my mod function following a patch or with extra DLCs?
If a patch or DLC modifies coat_of_arms.txt or dynasties.txt, then your mod will not be fully compatible. They might add a new texture entry, which you won't have in your mod. They might add new dynasties that won't show up when you play your mod. So always check to see if the date stamp on those files in the core game have changed when you update. If they have, you will probably need to amend your files to account for this. For example, if the game adds a new texture entry, you'll need to add it to your coat_of_arms.txt file and update your dynasties.txt texture declarations to be one value higher. It's a pain...I know.
How will my mod function with other mods?
If you want to load 2+ mods together that modify coat_of_arms.txt and/or dynasties.txt, then to my knowledge,only one will get utilized. The safest thing to do is to merge changes from multiple mods into a new, uber-mod that includes all changes and avoids file clashes.
Last edited: