• 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.

I would like to start modding Paradox games if only I knew how!

  • True

    Votes: 1.716 70,6%
  • False

    Votes: 82 3,4%
  • I've already started modding!

    Votes: 632 26,0%

  • Total voters
    2.430

cKnoor

Live Content Producer
Paradox Staff
15 Badges
Jan 19, 2016
182
2.020
  • Lead and Gold
  • Magicka
  • Warlock 2: The Exiled
  • The Showdown Effect
  • Warlock: Master of the Arcane
  • Cities: Skylines
  • Pillars of Eternity
  • Cities: Skylines - After Dark
  • Stellaris Sign-up
  • Cities: Skylines - Green Cities
  • Shadowrun Returns
  • Shadowrun: Dragonfall
  • Prison Architect
  • Age of Wonders: Planetfall Sign Up
  • Shadowrun: Hong Kong
If you would please answer the above poll we would be eternally grateful for your input!

Hello,

So you want to learn how to mod CK2?

Well you might be in the right place, in this guide we’re going to, step by step, go through how you add an option to an in-game event. It is probably one of the more basic things you can do with modding and this should be considered a primer to see if you want to mod more things in your game.

This guide will not go over more advanced topics, but for those interested in moving forward with their modding feel free to look over the resource available to you in the user modification forum (https://forum.paradoxplaza.com/forum/index.php?forums/crusader-kings-ii-user-modifications.682/) or the CK2 Wiki (http://www.ckiiwiki.com/Modding). We assume that you are using Windows throughout this guide, but only a few things should change for macOS or Linux.

What we want to do is change this (Image of Comet Event) to something more. We’ll do this by finding the event itself among the game files and then edit it. Let’s get started:

1) Create Your Mod

We’re going to start by creating a new mod that you can turn on/off in the launcher. A mod simply consists of a text file containing some basic information about the mod (like the name) and a folder full of content files. You can download the template mod at the end of this post.

Now, go to your “My Documents” directory and go into the folder “Paradox Interactive” and then “Crusader Kings II”. You might need to make a “mod” folder here if you don’t already have one and then you can unzip the template mod above into this directory. At the end of the process, you should have the following;

A file called: “My Documents/Paradox Interactive/Crusader Kings II/mod/getting_started.mod”

A folder called: “My Documents/Paradox Interactive/Crusader Kings II/mod/getting_started/”

2) Find your Mod in the Launcher

You have now created a very basic mod! It doesn’t do anything yet, but if you fire up the Crusader Kings 2 launcher, you should be able to click on the “Mod” tab and see “My Awesome Comet Event” in the list of mods. You can turn it on/off with the check box.

3) Find your install directory

First, a quick primer on how mods work: Whenever CK2 tries to load a file, it will always load it from a loaded mod first (if it can) before loading the file that comes bundled with the game. This means that you can copy any file from the game into your mod, change it - and you can easily change how the game looks / works or plays.

So, in order to copy a file from the game into our mod so that we can change it - we need to find the game files. The easiest way to do this is to open Steam, find CK2 in your games library, right click on the name and select properties in the menu. Choose the local files tab and then press browse local files.

1.jpg


4) Copy health_event.txt into your mod

We want to modify the “health_event.txt” file, which contains information about a whole bunch of events in the game - including the Comet Sighted event. While you can just edit the files directly in the game folder, this is generally a bad idea, because it will get reverted whenever you click “Verify Files” in Steam or update the game and you will lose your precious mod files.

So, for this step, you should copy the file from this folder:

“Crusader Kings II/events/health_events.txt”

To the same folder in your mod:

“My Documents/Paradox Interactive/Crusader Kings II/mod/getting_started/events/health_events.txt”

You can copy nearly any file from the base game into your mod folder and edit it to change how the game works! An awful lot of Crusader Kings II is just made up from text files - from buildings to character names and you can edit it all.

5) Open health_event.txt

Now you need to open the file that you just copied. Make sure you open the file in your mod directory and not in the game directory. We suggest using Notepad++, which is a great free text editor for Windows.

6) Locate the Comet Sighted event

If you look through the health_event.txt file you will see there are a whole bunch of events that can happen based around character’s health - from contracting leprosy to becoming a lunatic. If you search the text file for “6203” you should find the following character event...

2.jpg


This text describes the “Comet Sighted” event. It looks fairly complicated, but it can be broken down into 3 parts. The top part (id, desc, picture, border) describes how the event should look for the player. The middle part describes when the event should happen - so it only happens to player characters and only when your character is over 16 years old for instance. The triggers can get quite complicated, but we don’t need to worry about that now. The last part is a list of “options” which represent the buttons the user can click on.

7) Create a New Event Option

Copy the seven lines of text that makes up the “option” portion of the event text and paste it again below, make sure to include all the brackets. Your event should now look something like this…

Code:
    mean_time_to_happen = {

        months = 120

    }


    option = {

        name = EVTOPTA6203

        add_character_modifier = {

            name = holy_comet

            duration = -1

        }

    }


    option = {

        name = EVTOPTA6203

        add_character_modifier = {

            name = holy_comet

            duration = -1

        }

    }

8) Customize your New Event Option

We’re not going to do anything with the actual mechanics behind the event, so we’re leaving the “character modifier” part alone. We will just change the name of the option, so that we change the text that will be displayed on the second button. So for now just change the name from EVTOPTA6203 to ThisIsANewAddition.

Your file should now look like this - don’t forget to save it!

3.jpg


9) Open the Localization File

As our games support multiple languages, we cannot simply put the text that you want to appear on the button straight in the event file. Instead, we give each event a unique name and then have another text file which tells us which text to show for a button with that name depending on the user’s language.

If you downloaded the “getting_started” mod above, we have already created an empty localization file for you to put your new text in. For this step, just open the file “My Documents/Paradox Interactive/Crusader Kings II/mod/getting_started/localisation/getting_started.csv”.

10) Add Your Event Text

We’re only going to add text for English at the moment, but if you also happen to speak French, German or Spanish - feel free to add your own text there too.

Add the following text to the file:
ThisIsANewAddition;This does not seem that bad!;;;;;;;;;;;;;x

4.jpg


Psst. If you open this in a spreadsheet program you’ll probably get a nicer text display, but this is a quick and dirty mod, so we’re keeping it simple.

11) Save getting_started.csv

12) Open CK2 and wait for the Comet event to trigger.

This could take a long time however, so you could also be lazy and open up the dev console. To do this press the ‘§’ key on Swedish keyboards, or the button to the left of the 1 on most other keyboards. Then type…

event 6203

Now you can enjoy your handiwork!

.
Final-popup.jpg


13) Bonus step - Upload your mod to Steam!

Now you’ve made your awesome event mod, you might want to upload it to Steam to share with your friends. Uploading your mod to Steam simply requires launching the game and clicking a few buttons…

  1. On the title screen of the game, click ‘Content’.

  2. Now click on the ‘MOD’ tab.

  3. Next to your mod, you should be able to click on a button named ‘Manage’.

  4. Enter a description for your mod in the text box.

  5. Click ‘Publish’!

What Next?

If you’ve enjoyed modifying the comet sighted event throughout this guide then you’ve just scratched the surface of what you can accomplish. There are a lot of guides on the internet about modding Paradox games, and here are just some of the places where you might want to get started.

If you’re eager to take event modding to the next step, check out this event modding guide:

http://www.ckiiwiki.com/Event_modding

The CK2 Wiki has a whole section on modding in fact...

http://www.ckiiwiki.com/Modding

The forums are also a great place to get help if you run into problems, so feel free to check out the modding community on the Paradox Plaza forums.

https://forum.paradoxplaza.com/forum/index.php?forums/crusader-kings-ii-user-modifications.682/
 

Attachments

  • template_mod_v1.zip
    75,2 KB · Views: 1.193
Last edited:
  • 5Like
Reactions:
Great idea, an official modding tutorial will surely help new modders.

I just noticed that when you are showing code, it is already color coded. And while you suggest NP++, you might possibly also want to suggest the custom CK2 language to make it look like in your pictures.
The latest version is found here I think:
http://forum.paradoxplaza.com/forum...d-auto-completion.745679/page-4#post-20829444
(Unless something official is coming of course :p)
 
  • 1Like
Reactions:
Wouldn't this be more appropriate in the modding section @cKnoor ?
 
Wouldn't this be more appropriate in the modding section @cKnoor ?
The mod forum is for those that have already decided to make their first mod, this guide is for those that don't know how easy it is to mod.
 
  • 1Like
Reactions:
The mod forum is for those that have already decided to make their first mod, this guide is for those that don't know how easy it is to mod.
Fair enough!

Are other PDX games just as easy to mod as ck2?
They are all different, but the base explained here is similar, so I would say it is equally easy. You can see the respective wikis for more details.
 
where is the documentation??? this is one event... where is the list of functions and everything you can do? this is a useless tutorial
For that you'll need to look into the resources I linked in the post. That would be way to involved for this type of beginner guide.
 
your sdk is shit

let us use a normal language like a c language or something... so much shit in this game is broken and needs to be fixed
Would you please kindly stop spamming your hate for this game everywhere? I am really trying to stay polite, but this is an official thread dedicated just to help new people, and you are trying to poison it for no apparent reason.
I would really wish you'd stop doing that in literally every thread.

The game's language is of course nowhere near as complete or powerful as say C++, but it is very easy to use and beginner-friendly. Which is a great thing, and which is why an official guide like this can show this to new people and possibly help them get into the fun of modding.
 
Say I wanted to make a mod that put Chalcedonian Christianity back into the game (like CK2+ has). How would I go about modding the religion files and icons to make things like:
A new color for the religion (preferably) Gold (metallic / bright [think Golden Horde color])
A new icon (something similar to the golden crucifix that Catholics get but featuring Orthodox elements as well)
Make the already Catholic Pope the head of the religion (without making a new Pope since he was Primus Inter Pares)
Convert that pope to Chalcedonian
Have the Pentarchy in place
Have Crusades
And last but not least among specific features: a way to mend the schism between Catholics and Orthodox making both heresies of True Chalcedonian Christianity
And have all of the other stuff like Excommunication
I've been trying to figure out how to make this but do not know half of what I would need to do. Any help is much appreciated!
 
Say I wanted to make a mod that put Chalcedonian Christianity back into the game (like CK2+ has). How would I go about modding the religion files and icons to make things like:
A new color for the religion (preferably) Gold (metallic / bright [think Golden Horde color])
A new icon (something similar to the golden crucifix that Catholics get but featuring Orthodox elements as well)
Make the already Catholic Pope the head of the religion (without making a new Pope since he was Primus Inter Pares)
Convert that pope to Chalcedonian
Have the Pentarchy in place
Have Crusades
And last but not least among specific features: a way to mend the schism between Catholics and Orthodox making both heresies of True Chalcedonian Christianity
And have all of the other stuff like Excommunication
I've been trying to figure out how to make this but do not know half of what I would need to do. Any help is much appreciated!
Everything is explained here: http://www.ckiiwiki.com/Religion_modding
 
Just wanted to say, whilst I clicked True in the above, the real reason I am unlikely to mod anytime in the near (or not so near) future is time.

And Paradox bears a great deal of responsibility for my lack of time. For starters they keep creating these games that I want to play. And others want to play - and write AARs about - and I want to read about.

So if I never mod it is Paradox's fault. :D
 
Just wanted to say, whilst I clicked True in the above, the real reason I am unlikely to mod anytime in the near (or not so near) future is time.

In a way I agree that modding is too time consuming, and I think that's the next big improvement to democratize it...
The documentation is already quite extensive on the wiki and there are various community tools that greatly help in specific areas (validator, map, 3D models, portraits, ...)

But compared to modern development environments for programming languages, it is still the stone age: documentation is not integrated, syntax validation is external (and slow), no refactoring capabilities, context-based auto-completion etc. Even after several years of modding, doing simple changes are still time consuming, because of undetected mistakes and slow troubleshooting (a feedback loop of 1-2 min is way too long).

Trying a few things (mainly with Xtext in Java with Eclipse), I was quickly blocked by the fact the grammar for CK2 scripts (and I think other Paradox games) is ambiguous and context dependent: you need the path of the parent folder to know what syntax to expect in the file, and doesn't work well with language grammar tools.

For instance instead of having common/religions/00_religion.txt with:
Code:
religion1 = {
}

it would be more tooling-friendly with simply:
Code:
religions = {
  religion1 = {
  }
}

Unless Paradox scripters have access to some secret magic tooling, I suppose they face the same issues as modders do, easily introducing bugs for simple changes, causing extra work for themselves and QA, so it would make sense to invest here early for future games.
 
I really want to make a Ancient Egyptian Mod.. But I am too afraid to get into modding and then mess something up and break the game :(

The Guide helps but i am still afraid of breaking something...