• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

iron0037

37th Great-Grandson of Charlemagne
75 Badges
May 15, 2009
2.264
1.107
  • Crusader Kings II
  • Europa Universalis III Complete
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Rome Gold
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Steel Division: Normand 44 Sign-up
  • Europa Universalis IV: Mandate of Heaven
  • Cities: Skylines - Mass Transit
  • Stellaris - Path to Destruction bundle
  • Crusader Kings II: Monks and Mystics
  • Cities: Skylines - Natural Disasters
  • 500k Club
  • Cities: Skylines
  • Crusader Kings II: Holy Knight (pre-order)
  • Europa Universalis IV: El Dorado
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Cities: Skylines - Snowfall
  • Stellaris
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Dharma
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome
  • Imperator: Rome Sign Up
  • Cities: Skylines - Campus
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Imperator: Rome - Magna Graecia
  • Crusader Kings II: Holy Fury
  • Europa Universalis IV: Rule Britannia
  • Stellaris: Distant Stars
  • Victoria 2
  • Europa Universalis IV
  • Europa Universalis IV: Cradle of Civilization
  • Cities: Skylines Industries
  • Stellaris: Megacorp
  • Stellaris: Humanoids Species Pack
  • Cities: Skylines - Green Cities
  • Crusader Kings III: Royal Edition
  • Europa Universalis III Complete
  • Stellaris: Apocalypse
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:
  1. 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.
  2. This thread does not discuss how to leverage emblems and patterns to create of custom coat of arms.
  3. These instructions rely on posts from Arko, enderbr, and others. Many thanks for your contributions.
Step 1: Get Organized
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
This is where you'll put all the files you assemble for your customization. At the top of the /mod folder, create a new text file with the extension .mod, i.e. custom_coas.mod. Write the following two lines in it:
Code:
name = "<my mod's name>"
path = "mod/<my mod's dir>"
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:
7651531.jpg

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
	}
}
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:
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
		}
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:
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
		}
	}
}
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:
Code:
	templates = { 
		"coa_plain:1"
		"coa_party_per_fess:2"
		"coa_party_per_pale:2"
		"coa_party_per_cross:4"
		"coa_party_triangle:3"
	}
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.
 
Last edited:
I took the liberty to create a 10x10 template file for COAs (based on an ARKO's file) :


and to make the game take account of the file, add this as iron0037 taught you :
make a .tga file out of it, add your customs COAs and add this at the end of coat_of_arms.txt
Code:
		texture = { 
			file = "gfx\\coats_of_arms\\template.tga"
			size = { x = 10 y = 10 }
			noOfFrames = 100
			color = 0
			random = no
		}
 
Sweet guide!

Can you make a similar one to creating CUSTOM flags, especially for Muslim factions?

I can't seem to make my flags work.

I reverse engineered a couple mods on how they deal with flags (A Game of Thrones and Elder Kings). They have some script that adds the following folders and files POST starting / after starting.

C:\Users\USER_NAME\Documents\Paradox Interactive\Crusader Kings II\ElderKings\gfx\flags

In this newly created folder by script I'm guessing, there are the three files that I tried to emulate but failed:

1. TEXT files: flagfiles.txt and flagfilescolor.txt
2. DDS files: flagfiles_0, flagfiles_1, flagfiles_2

Does the game itself do this or do the mod authors somehow guide the game to create these?
 
I reverse engineered a couple mods on how they deal with flags (A Game of Thrones and Elder Kings). They have some script that adds the following folders and files POST starting / after starting.

C:\Users\USER_NAME\Documents\Paradox Interactive\Crusader Kings II\ElderKings\gfx\flags

In this newly created folder by script I'm guessing, there are the three files that I tried to emulate but failed:

1. TEXT files: flagfiles.txt and flagfilescolor.txt
2. DDS files: flagfiles_0, flagfiles_1, flagfiles_2

Does the game itself do this or do the mod authors somehow guide the game to create these?

the game generates them once at first launch to start faster on future launches.
the user_dir command contained in the *.mod file defines if a separate user directory is created or not.
 
the game generates them once at first launch to start faster on future launches.
the user_dir command contained in the *.mod file defines if a separate user directory is created or not.

Thank you very much for responding Arko!

I'm trying your mod as well. Looks spectacular and definitely an improvement! Great job! Kudos!!!

Now, I'm still having an issue.

For my custom empire with custom kingdoms and duchies, NONE of my flags for them are appearing in game. Instead, I'm getting the random Muslim flags. Granted, my custom empire is a Muslim faction... but shouldn't have my flags OVERRIDE the default, randomly generated ones? Please help!

Another issue is that my custom COA for my dynasty ... well I can't seem to find the right TEXTURE for it. Again, it is a Muslim faction, so I added it right after the "pattern2_muslim.tga" in the coats_of_arms.txt in the interface folder. I THOUGHT the following, but it appears not to be correct:

# WHEN ADDING NEW, ALWAYS ADD AT THE END
textures = {
texture = {
file = "gfx\\coats_of_arms\\pattern_muslim.tga" <================== TEXTURE 0?
size = { x = 10 y = 4 }
noOfFrames = 35
color = 2
emblem = no
}
texture = {
file = "gfx\\coats_of_arms\\pattern2_muslim.tga" <================== TEXTURE 1?
size = { x = 10 y = 6 }
noOfFrames = 55
color = 3
emblem = no
}
texture = {
file = "gfx\\coats_of_arms\\pattern3_muslim.tga" <================== TEXTURE 2?
size = { x = 1 y = 1 }
noOfFrames = 1
color = 0
random = no # Do not use for random CoAs
}
}

This is how my corresponding dynasties.txt looks like below:
1029096 = {
name="Imanbai"
culture = turanian
coat_of_arms = {
template = 0 <================== to have plain background
layer = {
texture = 2 <================== This is where I specify the texture tga, right?
The tutorial was dealing with Christian factions, so 5 was chosen, but I counted 7 entries there. Perhaps an update?
texture_internal = 0 <================== according to tutorial, instructed to leave at 0
emblem = 0 <================== according to tutorial, instructed to leave at 0
color = 0 <================== according to tutorial, instructed to leave at 0
color = 0 <================== according to tutorial, instructed to leave at 0
color = 0 <================== according to tutorial, instructed to leave at 0
}
}
}

Please help!!! I'm at my wits end. Other than the flags and COAs, everything else works perfectly as I want it to. I'm soooo close to playing CK2, but I wouldn't start/invest the time, without fully completing my mod.

Basically, I modded in my own family into the game, tee hee, as a new culture, the Turanians with Khanates of Tatarstan (duchies of Kazan and Grey Horde), Kazakhstan (duchies of White and Blue Hordes), and Turkestan (duchies of Bukhara and Samarkand).

Naturally, I do believe I have correct flag name alignment with titles alignment: e_turan, k_tatarstan, k_kazakhstan, k_turkestan, d_kazan, d_grey_horde, d_white_horde, d_blue_horde, d_bukhara, d_samarkand.

I'll send this mod to my brothers, so they get to play as their respective selves for funsies.
 
muslim territorial flags issues. territorial flags are used for religions taht don't use random CoA, so, your flags might work if the titles are created by a non muslim.
problem is that the game uses random CoA for everyone in a religion or not. it can be changed in 00_religion.txt. there is no middle solution sadly.

TEXTURE are counted from 0 as you guessed. idem with texture internal. so your code might be ok.

don't mind uploading your files if still blocked^^
 
muslim territorial flags issues. territorial flags are used for religions taht don't use random CoA, so, your flags might work if the titles are created by a non muslim.
problem is that the game uses random CoA for everyone in a religion or not. it can be changed in 00_religion.txt. there is no middle solution sadly.

TEXTURE are counted from 0 as you guessed. idem with texture internal. so your code might be ok.

don't mind uploading your files if still blocked^^

SUCCESS!!! Well partially...

You were SPOT on with directing me to 00_religion.txt
ALL it took for my flags to show up in-game was switching the following line from "no" to "yes", mimicking the Christian factions, this way allowing for custom flags to register.
has_coa_on_barony_only = yes
So now, I understand... with the above set as "no" for Muslim factions... the Muslim COAs OVERRIDE all flags from baronies up through all ranks. I seriously don't understand why.

Interestingly, I found that my flag for Duchy of Samarkand was actually IN-GAME!!! as County of Samarkand. Granted, my flag.tga was of much higher quality and better looking, but that got me thinking. WHY on Earth does Paradox have ALL these gorgeous county, duchy, kingdom, and empire (above barony) flags and NOT use them?

It almost seems to me that in their haste to push out Sword of Islam DLC, they forgot to "unlock" the Muslim territorial flags from being turned off, the state they were in base CK2.

OR ... that's part of the gameplay, however borked that is... the only way to see ALL those spiffy flags is for a non-Muslim faction to reign... which is just pointless. Those flags were there even under Muslim rulers or not, didn't matter.



Now, to my dynasty COA, it still isn't working... I'm getting the texture number wrong, I'm sure.

I'll upload my Turan empire mod, if you want or if that'll help you figure out why I can't seem to pinpoint my dynasty COA texture pattern ID number. However, this is more of a personal mod, not historical or anything :p

PS: How do I upload files on here again? I'm relatively new to the site, even though I've owned Mount&Blade:Warband since 2009 or something.
 
Now you find by yourself how the system works ;) the benefit is to have different shield between christian and muslim with having to draw every individual twice for the +1000 titles. you can of course use "christian" coa for muslim too (as it was the case in CK1, same coa, different frame), a lot are not more christian than muslim^^

Does your character and dynsty appear correctly ingame ?
to upload files upload them to an external site like say filesmelt and provide the download link here or by PM.
 
What code should one use to set a custom dynastic CoA for Muslims in 00_dynasties.txt? However I try it, it either comes up with the CoA in a Christian shape, or has the correctly shape but uses a random Muslim CoA.
 
Wow, I never knew this thread got replies! I wrote that in February 2012 and apparently didn't get a response for over a year. I'm glad to see that Arko helped that person out, because I didn't even notice it. I've subscribed to this thread for the future, so I will detect any comments in the future. I'm glad you figured out your issue Quackberg.
 
Hello, Can you tell me why I can't see the first COA I have made in the game please? All the other ones have shown up though:
LhcyFoBl.png

This is my code for it:
Code:
texture = {            file = "gfx\\coats_of_arms\\TEST.tga"
            size = { x = 10 y = 10 }
            noOfFrames = 10
            emblem = no
            color = 2
        }
No matter what the number on the color is, the first coa just shows up as blank but I can change the color of the background though.
 
Hello, Can you tell me why I can't see the first COA I have made in the game please? All the other ones have shown up though:
No matter what the number on the color is, the first coa just shows up as blank but I can change the color of the background though.
Hey Supeerme. I have never attempted anything other that color=0. Did you try that first and verify that your coat shows up? What are you hoping to accomplish by setting it to a non-zero value? How exactly did you test this out? Did you assign the coat to a particular dynasty? If so, how are you changing the color...are you doing so in the game somehow, or do you mean you tried different values in the code and restarted the game?
 
By changing the color value you can use the colors (Green is the background red is the symbol and blue is the alt background) I been booting the game and I have the customizer so I can change the dynasty coa at will.
 
Big thanks to Arko and Turanian for the answer this one, even if it was a year ago, for saving my sanity. :).

In case anyone has a similar problem and are useing the search tool to find information on missing flags, mixed flags, or flag cache, here is the problem I had and what I did:

* I made custom flags for all my counties, duchies, kingdoms, etc. Except for a few that were uncreated titles and could be seen in the de jure setings, the flags did NOT show up in the game at all. So I assumed something was wrong in landed_titles.txt file.

* Every line of landed_titles.txt was hand-checked and in the Validator, no issues
* Every county, duchy, kingdom, and empire that needed a flag had a flag, no typos or missing flags
* The flags TGA file had every flag in the directory loaded into it, correctly, in the proper order according to landed_titles.txt
* The armies on the map WOULD wear the correct flags on their surcoats, so I KNEW the game was loading them OK
* I deleted the mod cache repeatedly
* I tried all TGA variations, no help
* I tried backing all the way back to one kingdom and 12 counties,

It turns out my religions.txt file had been changed to make everyone with the main religion ignore county and higher flags! The tiny few flags I could see had no holders, hence they were visible. So I changed the main religion to have this line:

has_coa_on_barony_only = yes

and all my nice custom flags returned!
:D
 
Last edited:
Hey, I tried coding my custom coa but it doesnt appear and it is a random coa for my dynasty, I dont know why.
Heres the code for the texture:
texture = {
file = "gfx\\coats_of_arms\\Tegeingl.tga"
size = { x = 1 y = 1 }
noOfFrames = 1
color = 0
random = no # Do not use for random CoAs
}

and the one for the dynasty:
390006 = {
name = "Tegeingl"
culture = "welsh"
religion = "catholic"
coat_of_arms = {
template = 0
layer = {
texture = 10
texture_internal = 0
emblem = 0
color = 0
color = 0
color = 0
}
}
}