• 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.
Hello, and welcome to another development diary about Crusader Kings II.

This time there are two subjects I want to talk in detail about, both related to something popular in this community, ie usermodding.

New file-system for Mods.

We have implemented a system in the game, where there is no need for a mod-dir system, and where the game files are loaded in the same way as any applied user-modification.

The game will allow enable/disable of any mod and/or dlc you have in your folders when you start the game.

Advantages of new system.
  • transparent for us when developing so there should be much less problems in the future when someone forgets to add mod support to some files
  • can load several mods at once
  • supports archives


example file structure
Code:
mods/my_cool_mod.mod
mods/my_cool_mod.7z

New file format
Code:
name = "My Cool Mod"
archive = "mods/my_cool_mod.7z"
dependencies = "some_other_cool_mod"
override =" flags"

- Name is just a name given to the mod for display purposes.
- Archive specifies a zip file that contains the files for the mods.
you also have the option of using "path" instead of archive with a normal directory, but we recommend using the zip archive for released mods because its less clutter on the player's computer.
- dependencies is a list of mod names. This means that you can set up a dependency chain and support having multiple mods loaded even if they might affect the same files. You can also depend on official DLC here. If dependencies are missing the mod wont be loaded.
- override specifies directories that will not be extended like normal, if you use this any previous loaded mods containing a directory in that list will not have that part loaded.

Event Scripting

We have also severly enhanced the scripting capabilities for CK2.

First of all we have added lots of triggers and effects to the language, which give you some rather powerful capabilities. While the game only have province and character events as entry points, an effect or trigger can switch scope to titles, wars & combats as well.

We have also made a system that random events can be run from what we call "pulses", so that you get one event each "time-period", so that when we add events, it will give more variety without the spam.


Another cool option is the "hidden_tooltip" effect, which allows the event-writer to have some hidden effects.
Code:
	hidden_tooltip = { prestige = 100 }

You can now also make event-chains that lasts over time much easier than before, with the new concept of "spawn event in the future at days x-y from now".
Code:
	character_event = { id = hedgeknight.1  days = 2 random = 5 tooltip = "They will get this in 2 to 7 days" }

It is also possible to have some options in an event only be available when certain conditions are true.
Code:
	option = {
		trigger = { trait = cruel }
		name = "I can only do this if cruel"
		prestige = 10
	}

Also, an option can have multiple effects, effects that depend on whatever conditions are true.
Code:
	option = {
		name = "Effect depends on stuff"
		if = {
			limit = {
				trait = cruel
			}
			piety = 10		#we become more pious if we are cruel.
		}
		if = {
			limit = { liege = { opinion = { who = root value = 25 } }
			scaled_wealth = 0.05	#get 5% more money if our liege has at least 25 relation with us
		}
		prestige = 10		#always get 10 prestige
	}

There is new terminology for scope-switching, and you can nest as many scope-switches as you'd like.
  • prev = previous scope.
  • from = who sent this event to us.
  • root = who got the event.

Events that target a character can use targeting mechanisms like from, prev, root, and also stuff like liege, prevprev, fromfrom and prevprevprev!



We mentioned earlier that you do not have to find unique id's for your event series and can instead just use a descriptive tag as base for your event series.
Code:
namespace = hedgeknight
character_event = {
	id = hedgeknight.0
	desc = "hedgeknight.0.desc"

	...
	option = {
		name = "hedgeknight.0.a" #Refuse them Access
		random_courtier = {
			character_event = { id = hedgeknight.1  days = 2 random = 5 }
		}
	}
 
This is incredibly amazing. I particularly love the "if" clause

It doesn't really do anything that couldn't be done before, it just makes it easier to type/read.

Code:
if = {
	limit = { wealth = 10 NOT = { wealth = 15 } }
	effect...
}

Instead of:

Code:
any_owned_province = {
	limit = { owner = { wealth = 10 NOT = { wealth = 15 } } }
	owner = { effect... }
}

And

Code:
hidden_tooltip = {
	prestige = 100
}

instead of:

Code:
set_country_flag = hidden_tooltip
any_owned_province = {
	limit = { owner = { has_country_flag = hidden_tooltip } }
	owner = { prestige = 100 }
}
clr_country_flag = hidden_tooltip
 
It doesn't really do anything that couldn't be done before, it just makes it easier to type/read.

Code:
if = {
	limit = { wealth = 10 NOT = { wealth = 15 } }
	effect...
}

Instead of:

Code:
any_owned_province = {
	limit = { owner = { wealth = 10 NOT = { wealth = 15 } } }
	owner = { effect... }
}

And

Code:
hidden_tooltip = {
	prestige = 100
}

instead of:

Code:
set_country_flag = hidden_tooltip
any_owned_province = {
	limit = { owner = { has_country_flag = hidden_tooltip } }
	owner = { prestige = 100 }
}
clr_country_flag = hidden_tooltip
Readability is important. I remember making a huge event chain in EU3 using these workarounds and ending with a headache. Debugging it was quite a pain, too, and I remember there still were things that you couldn't fully do without crap like hidden events (I might be wrong, though; it's been a few years). An 'If' clause is much simpler, and it probably even helps a bit with performance, since it doesn't have to do that double scope change anymore (owner->province->owner) or any other workaround you had to do to replicate such a thing.

Oh, and the improved, nesting scope switches are awesome too. In previous games, when event chains were supposed to apply to more than one or two kingdoms my brain would tie into a knot finding ways to apply the correct effects and events to the right target :D Now things should be quite better.

EDIT: BTW, thank you very much for answering, Johan. That's great, and should make things much easier for us.
 
Last edited:
Hey Johan and the rest of the Paradox team,
Thanks for this dev diary and the modding improvements you plan on adding. This certainly sounds great, and it should make my life a little bit easier. I still find your syntax for "greater than," "less than," etc confusing though :). innovative_narrowminded >= 2 is so much clearer than innovative_narrowminded = 2.

Could we please, please, please have sample province and character files? I'd like to start some preliminary modding work ;).
 
Could we please, please, please have sample province and character files? I'd like to start some preliminary modding work ;).

This!

Also.. are there any changes to the way the map functions? Since I plan on porting the Vinland Mod to CK2 (as a more natural habitat for it), so obviously I'd be pushing the map westward. I hope it won't have problems doing so?
 
Also.. are there any changes to the way the map functions? Since I plan on porting the Vinland Mod to CK2 (as a more natural habitat for it), so obviously I'd be pushing the map westward. I hope it won't have problems doing so?
I'd be very interested on this, too. Will it be very diferent from Sengoku? I'd like to know whether I can keep improving my map using that engine or if I would just be wasting my time.
 
This is just great! :)

As one might have suspected from the dev diary about the map, I do hope that a map mod can also be made (my main concern is province borders) though.
 
Last edited:
This!

Also.. are there any changes to the way the map functions? Since I plan on porting the Vinland Mod to CK2 (as a more natural habitat for it), so obviously I'd be pushing the map westward. I hope it won't have problems doing so?
:O Vinland in CK2?! Do want :D
 
these all look great improvements. maybe. confusing improvements anyway but im sure great ones.
Treating Mods as DLC in regards to modular compatibility or whatever you call it is brilliant.

As to asking about what things might be possible to mod.
Will it be possible to create an event that adds a defined character? one with a certain name, culture, stats etc or half defined character, of a certain culture but random everything else?

Why would there be any question of expanding the map? does sengoku not let you? as EU3 and Rome and V2 and all the others let whole new maps be made for them, and rome as the flat map instead of global one so if it can be expanded past its borders then its probably safe to assume CK2s could be expanded or replaced with bigger ones easily enough.

What about arrange marriages via event?

like you have an event chain where a dragon terrorizes a village, placing looted modifier on it or something, then the provinces around it. then if you can send out word for help and promise rewards, and then a couple events later an unknown hero kills the dragon and you get three options, to reneg on the promise and lost alot of prestige and upset your vassals, give him lots of gold [only if you have lots of gold and i mean lots] or give him half your kingdom and your daughters hand [of if you dont have a daughter just half your kingdom].
And if you do the last one, then a new courtier is created wih a high military stat, married to your daughter and then released as a count with half the counties you directly hold or half the duke-and-below titles you currently have?

Or for a better example, an event where your romantic traited daughter elopes to a peasent behind your back, where a new courtier is created and married to your daughter.
But the dragon example also lets us ask about titles being divided out in events, or if events can cause succession to happen outside of someone dying [as maybe it would work that a gravelkind succession would be trigged with your only you and the dragonslayer as applicable heirs.] which could also be used for events about palace coups and the like.

Just thinking if the effects are there, anything could be possible.
 
Last edited:
I can confirm it is very fun using if = { limit = { } }, hidden_tooltip = { } and be able to trigger different event options depending on different things (traits, treasury, relations and so on...) :)

I have already tried them in my Genpei Mod for Sengoku, and these effects work well.
 
This is just great! :)

As one might have suspected from the dev diary about the map, I do hope that a map mod can also be made (my main concern is province borders) though.
I sure hope so, otherwise my planned mod will be a total non-starter.
 
Picking up an old thread I know, but it seemed appropriate to ask a question I just thought of in here.

In the current engine, at least as of Sengoku, you can have multiple extra files for all sorts of things, but some - and I'm specifically thinking of "event_modifiers.txt" - either have to use the original file, or a new one *of the same name* in the /mod/mod_name/common folder.

In the new system, is it possible to truly extend by having another file full of modifiers, presumably with the "namespace" id to add them to the root "event_modifiers" file?

If not, I forsee trouble with the modular loading, so I'm sure it's taken care of somehow...
 
I think that we'll support .zip, .7z and plain old directory in the end.
Why no *.rar? I thought your games where rar-sism free ? xD

I kind of like the point that you don't need event-ids anymore, it was hell
of typing event 9999999 and stuff just to not get in conflict with existing ones,
especially if you want to combine two mods ^^
 
This kind of reminds me of Fallout 3's dependencies (Mod D requires Mod C and Mod A to operate.)