Crusader Kings III

Crusader Kings III

Dwarves Rising
oNeCoLdKiLLeR  [developer] 27 Mar, 2022 @ 3:03pm
Altering This Mod or Creating Your Own
If you like this mod but wish to add something of your own to it or wish to take away a feature I have added then please read on.

I am going to go through some of the things I did in order to make this mod possible. It is not really that complicated once you look at it more and more.

The first thing I needed to do was create a decision. This decision would allow you, the player, to change every single character who shares your culture to be changed into a dwarf. It also would give those characters the stubborn and herculean traits because I thought it was fitting.

Below I am going to show you the code I used to do this:

dwarf_culture_decisions = {

picture = "gfx/interface/illustrations/decisions/dwarves_rising.dds"

major = yes

desc = "dwarf_culture_decisions_desc"
selection_tooltip = "dwarf_culture_decisions_tooltip"

is_shown = { is_ai = no }

cooldown = { months = 6 }

effect = {

every_living_character = {
limit = {
culture = root.culture
}
add_to_list = character_to_alter
}
every_in_list = {
list = character_to_alter
add_trait = dwarf
add_trait = stubborn
add_trait = physique_good_3
}
}
ai_potential = {
always = no
}

ai_will_do = {
base = 0
}
}


If you don't know anything about coding don't worry I didn't either and must admit I only know a fraction of a fraction of what is possible through coding.

Lets walk through it though.

First to create a decision you must first create a folder called common. Then within that folder create another folder called decisions. Then within that folder create a text document called whatever you decide to name your decision. I named mine dwarf_culture_decision.

Next you will open up the text file you just made. And then you will add the name of your decision. Again if you look at my code above you will see I named it dwarf_culture_decision. After you name your decision you will add a space and then an = sign followed by another space and then the { key. (This tells the game that everything after the { key is what happens when the decision is run. At the end of all of your coding you must have the } key. This tells the game that this is the end of whatever it is you are trying to do. It is very important not to miss these keys or your code will not work.)

After you enter the { key you can then hit enter and go to the next line of code.

NOTE: When creating folders or names of decisions, etc. always use lower case and always use the _ (underscore) in between each word. If you do not do this your code will not work.

Picture :

If you look at my code above you will notice it says picture and then the location of the picture. You can use whatever picture you like whether its a picture the game already provides or a custom picture you want to use. You may use a custom picture as I have but you must make sure it is the correct format. It must be .dds file. I use GIMP, which is free, to change my files from .jpg to .dds. All you have to do is download or create an image you want to use and then right click on it and then choose open with GIMP. Once in GIMP you can then click on File and then click on Export As. You will see a pop up where you must enter .dds at the end of your pictures name and then click Export. Another pop up will give you a few options to tweak. I typically don't change anything here I just click on the Export button and then you will have the correctly formatted picture for use in game. Again if you look at my code above you will see the folders you must create in order for your custom image to be able to be used. First you create a folder called gfx then within that folder you create another one called interface then within that folder create another one called illustrations then within that one create another one called decisions then within that folder you want to place your custom picture. In game you will now see your image that you created used in the decision box.

Also try to make sure your image dimensions are no greater than 1200 x 500 and no smaller that 1000 x 450. If you can't find an image to use or create within those limits try altering the dimensions within GIMP or Paint if you can. If you do not do this results may vary as to how the image will be displayed in game.

Now you may hit the enter key again to go to a new line of code.

Major or Minor Decisions :

Here you can determine where the decision will show. If you use major = yes here you will see the decision show up on the upper part of your decision pop up. If you type nothing here the game will automatically by default place your decision on the lower portion of the decision pop up.

If you decided to make the decision major you may hit the enter key to start a new line of code now. If not then continue to the next part of the tutorial.

Descriptions :

These next two lines of code will add a description that will show in your words what your decision will do.

Lets take a look at my code

desc = "dwarf_culture_decisions_desc"
selection_tooltip = "dwarf_culture_decisions_tooltip"

The first line is written as "desc = "dwarf_culture_decisions_desc". The first part states what the description of your decision is. The part in quotation marks states what text document the game can find your description in.

The second line is written as "selection_tooltip = "dwarf_culture_decisions_tooltip". The first part states what the description would be if you just hovered you mouse over the decision in game. They are called tooltips. The part in quotation marks states where the game can find your toottip description.

Creating the Description Itself :

For this next section you should minimize your decision text document and do the following:

For your descriptions to appear in game you must first create another folder called localization. Next within the localization folder you want to create a text document. The first line of code you want to type if you are creating your mod in English is:

l_english:

If you do not type l_english: on the first line of this text document the game will not know what language you are using and will not add a description in game. The l stands for language and then _ (underscore) whichever language you wish to make your description in and then after you enter the language you wish to use you have to add a : (colon).

After you enter l_english: you may hit the enter key to go to a new line of code.

Below is the code I used on this mod:

dwarf_culture_decisions:0 "Dwarves Rising"
dwarf_culture_decisions_desc:0 "Converts All Characters That Possess The Same
Culture As Their Ruler Into Dwarves"
dwarf_culture_decisions_tooltip:0 "Activate Dwarves Rising"
dwarf_culture_decisions_confirm:0 "Dwarves Rise!!!"


First take notice of the naming of the descriptions. Notice how they all match the name of the decision text document I called "dwarf_culture_decisions" Make sure to match the name of the description with the name of the decision. I am not 100% sure what the 0 does after the colon in this code but I just add it because its how the games decisions files are written.

The first line which reads "dwarf_culture_decisions:0 "Dwarves Rising" will tell the game what the decision will show once you open up your Decison pop up while in game.

The second line which reads "dwarf_culture_decisions_desc:0 "Converts All Characters That Possess The Culture As Their Ruler Into Dwarves" is the actual description you will see if you click on the Dwarves Rising decision.

The third line which reads "dwarf_culture_decisions_tooltip:0 "Activate Dwarves Rising" will show when you hover your mouse over the Dwarves Rising button.

The fourth line which reads "dwarf_culture_decisions_confirm:0 "Dwarves Rise!!!" is a button on the decision pop up that confirms you wish to run the decision.

Once you are done with writing the code for your mod or altering the code I wrote then you must save the text document. For this text document you must click file then save as then type "dwarf_culture_decisions_l_english.yml" or whatever name you decide for your description file as long as you include the l_english.yml part. The game uses .yml files for localization files which are basically description files. Before you click save you also must go to where it says encoding next to the save button and go to the UTF-8 with BOM selection. I am not sure exactly why you need to do this but the game requires it so go ahead a do it. Then you can click save. Now your decision in game will have the descriptions you entered.

Go back to the decision text document you minimized earlier and hit the enter key to go to the next line of code.

Who sees the Decision :


This next line of code is written as "is_shown = { is_ai = no }". This is telling the game that the AI will not be able to see this decision and therefore will not ever be able to activate it. If you wanted the AI to be able to activate the decision you would type "is_shown = { is_ruler = yes }". This would tell the game that you want any character that is a ruler to be able to run your decision. There are many other ways you can make a decision appear to a character for instance you can make decisions appear only to characters that have the lunatic trait or that have the title of emperor or its equivalent. I'm not gonna go into that here. I wanna keep it simple and get you acquainted with creating your own decisions first.

You may now click the enter key to go to the next line of code.

Waiting Period :

This next line of code reads "cooldown = { months = 6 } This tells the game that every 6 months this decision will become available to run again. You can type whatever you want here. You can type "cooldown = { years = 10 } or cooldown = { days = 10 }" and you will tell the game that the decision can be run every 10 years or 10 days depending on which one you type in. Alternatively you can not add a cooldown at all. This will tell the game that the decision can be run whenever you decide to run it. There will be no limit set on how many times the decision is activated.

You may now click the enter key to go to the next line of code.

What the Decision will do :

The next line of code reads "effects = {" This is the meat of your decision. This is what the game will use to determine what the decision actually does in game.

You may now click the enter key to go to the next line of code.

I'm going to post the next lines of code as a whole and then break them down for you:

effect = {

every_living_character = {
limit = {
culture = root.culture
}
add_to_list = character_to_alter
}
every_in_list = {
list = character_to_alter
add_trait = dwarf
add_trait = stubborn
add_trait = physique_good_3
}
}

This section of code has the beginning and end of the effect of the decision in game. We already started by entering in "effect = {" Now we can look at the next part.

This next part starting with "every_living_character" tells the game that every living character in the game is about to have something done to it. In this case we are going to create a list.

The next line is "limit = { culture = root.culture }" This tells the game to look up every single living character with the same culture as the character you are playing. That is what the root.culture part means.

The next line is "add_to_list = character_to_alter" This line tells the game to take the results of every living character that shares the culture of the player and adds them to a list you can call whatever you like. I called it "character_to_alter".

The next line of code is actually just the } key which then ends the every_living_character code.

The next line of code is going to tell the game what to do with the list it just created. First is "every_in_list = {" Then the next line is the list you just created "list = character_to_alter"

Then the next few lines are changes you wish to make to the characters on the list you created. You may enter anything you like here. I wanted to created dwarves with a few traits I think dwarves have so I wrote "add_trait = dwarf
add_trait = stubborn
add_trait = physique_good_3"

This will give every character in the list we created the dwarf, stubborn and herculean traits.

The next few lines just closes out the effects. Remember to always do this. For every { key there must be a } key. This is how the game knows the beginning and end of what you are trying to do.

Can AI use the Decision :

The next section of code reaffirms that the AI will not be able to run this decision.

ai_potential = {
always = no
}

ai_will_do = {
base = 0
}

But if you did want the AI to be able to run this decision you would enter yes for the ai_potential part and for the ai_will_do part where it says base is basically a percentage that the AI will actually run the decision and how important it is for them to run it. So if you put 100 there instead of 0 the AI will run the decision as soon as possible as you just made it of the upmost important to run it. If you put 20 in there than you just made it essentially random if the AI will ever run the decision. Play around with it if you like but at least you have an idea of what it actually does now.

The last line of code you will enter ends the enter decision with a } key.

You may now save the text document. Before you save the document you must go to the encoding drop down and select UTF-8 with BOM then you can save the text document.

Creating and Using the Mod :


So now you should have 3 folders

1. common folder which will have your decision text document inside
2. gfx folder which will have an interface folder inside. And inside the interface folder you will have an illustrations folder. And inside the illustrations folder you will have a decisions folder. And inside the decisions folder you will have the image you want to display for your decision.
3. localization folder which will have your l_english text document inside.

With these 3 folders and the text documents and picture you have a completed decision mod.

If you wish to test your mod or upload it so others can enjoy it you can load up Crusader Kings III then look to the left and you will see a few options to click on. You want to click on the All installed mods selection. Once on that screen look to your upper right and you will see Upload Mod. Click on it. Here it will ask you to select a mod to upload or create a mod. Click on create a mod. Here it will ask you for the name of your mod, then the version of your mod, then it will have a directory box where you want to enter in the name of your mod again. Then below that will be a section called tags. Select the tags that are relevant to your mod and then click on create mod. This will create a folder inside the mod folder that will have the name of your mod. It will also have .mod file with the name of your mod. If you open up your the file with the name of your mod you will see a .mod file with the name descriptor. This is where you want to add the 3 folders you created earlier. Once you have done this your mod is ready to be played and uploaded to paradox or steam. You want to add the mod to a playlist and then make sure when you load your game its with the correct playlist that has your mod loaded to it.

That is it. Enjoy. I hope you learned something. And please do not hesitate to point out anything I missed or flat out have wrong. That is how we get better folks. Thanks
Last edited by oNeCoLdKiLLeR; 27 Mar, 2022 @ 3:12pm