Event trigger.png We are conducting a survey to learn how we can improve the Paradox Wikis experience for our users. Please take the time to fill the Survey Event trigger.png

Great work modding

From Crusader Kings II Wiki
Revision as of 21:58, 20 April 2019 by Keizer Harm (talk | contribs) (Created great work modding page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Great works, often called wonders in the script, are defined in the files in the /common/wonders/ folder. The features, also called wonder upgrades, are defined in files in /common/wonder_upgrades/. There are many associated locations for images, 3D models, and gfx keys, which will be covered in their respective sections.

Great works

This is a general template for a great work definition. The variables are explained in more detail below.

wonder_example_name = {
	picture = GFX_something
	model = GFX_something
	default_picture_stage = 3
	allow_construction = yes
	is_in_water = no
	allow_coastal = no
	show_model = yes
	background_overrides = {
		jungle = fields
		forest = jungle
	potential = {
	active = {
	available_upgrades = {
	flags = {
	stage = {
		allow = {
			#triggers (eg. wealth)
		build_time = 600
		restore_time = 90
		loot_time = 10
		gold_cost_flat = 1000
		gold_cost_ticking = 2
		restore_cost_flat = 427
		restore_cost_ticking = 3
		upgrade_slots = {

		local_modifier = {
			#Province modifiers of this stage in itself, such as "local_tax_modifier = 0.25".
		owner_modifier = {
			# Character effects of this stage in itself, such as "monthly_character_prestige = 0.25"

Note that in the wonder definition the scope ROOT is the character, FROMFROM the wonder and FROMFROMFROM the province.


Name Value type Description Example
<name of wonder> string/clause wonder_cathedral_01 = { ...
picture gfx The files have a _size postfix but that should be excluded here as the code adds the postfix conditionally depending on where the image is shown. wonder_image = GFX_wonder_strip_temple
model model name Name of the model to use when displaying the wonder on the map. The name is defined in wonder_mesh.gfx model = big_wonder_thing
default_picture_stage boolean Decides which frame of the wonder image strip frames should be displayed for GUI places where there doesn't already exist a wonder (such as the construction and construction confirmation views) Can be set to 0 to get the damaged state.

Defaults to 3.

default_picture_stage = 1
allow_construction boolean Indicates if new construction of new instances of this wonder type should be allowed. Defaults to yes. allow_construction = no
is_in_water boolean Indicates if the wonder is placed in water. This us used to decide if it should have the sea background isntead of province terrain.

Defaults to no.

is_in_water = yes
allow_coastal boolean Indicates if the wonder should be allowed to be placed on the coast. If set to true, the sea background will be used for wonders placed in coastal provinces

Defaults to no.

allow_coastal = yes
show_model boolean Indicates if the wonder 3D map model should be shown or not. Defaults to yes. show_model = yes
background_overrides clause Defines what terrain should be used if the province terrain type matches the left hand argument. Left hand argument can be set to ""All"" to force the background to be set to the right hand argument.

If left hand argument is ""All"", the right hand argument needs to be a GFX entry on the format ""GFX_wonder_background_<name>"" (note that the size has been omitted as it is deduced in code)

background_overrides = {
         desert = jungle
         snow = fields
potential conditions When it can be built. potential = { religion = catholic }
available_upgrades clause A list of upgrades that are unlocked when this stage is finishes. Choose upgrades from the common/wonder_upgrades folder. available_upgrades = { upgrade_stained_glass_window upgrade_church_bells }
active conditions Conditions that determine whether the wonder's effects will apply at all.
flags clause Used for categorizing wonders. Similar to bloodlines and artifacts. flags = { religious_building }


A great work can have as many stages as you would like, though amounts below four and above fifteen cause visual glitches in the roman numerals in the wonder interface.

Name Type Description Example
allow conditions allow = { religion = catholic }
build_time int Defines how long the base build time is in months. build_time = 12
loot_time int Defines how many months it takes to loot the stage. loot_time = 6
restore_time int Defines how many months it takes to restore a wonder that is damaged at this stage. restore_time = 9
gold_cost_flat fixedpoint Defines how much gold will be deducted when the stage construction is initiated. gold_cost_flat = 500
gold_cost_ticking fixedpoint Defines how much gold will be deducted at the end of each month durign construction. gold_cost_ticking = 10
restore_cost_flat fixedpoint Defines how much gold will be deducted when restoration is started. restore_cost_flat = 298
restore_cost_ticking fixedpoint Defines how much gold will be deducted at the end of each month durign restoration. restore_cost_ticking = 3
upgrade_slots int Defines how many new upgrade slots the stage makes available. upgrade_slots = 2
local_modifier clause
local_modifier = {
    local_tax_modifier = 0.25
owner_modifier clause
owner_modifier = {
    monthly_character_prestige = 0.01


Features, also called wonder upgrades, are defined thusly:

	picture = GFX_upgrade_icon_crates
	show_in_history = yes
	allow = { }
	potential = { }
	active = { }
	flags = { }
	build_time = 20
	gold_cost_flat = 450
	gold_cost_ticking = 1
	local_modifier = { }
	owner_modifier = { }

In the feature definition, ROOT is the character, FROM is the upgrade, FROMFROM the wonder, and FROMFROMFROM the province.


Name Type Description Example
<name of upgrade> string/clause wonder_cathedral_01 = { ...
picture gfx picture = GFX_wonder_cathedral_bells
show_in_history boolean Decides if the wonder upgrade should be visible in wonder history Defaults to yes show_in_history = no
potential conditions potential = { religion = catholic }
custom_modifier_text A string which appears in the GUI, listed as an effect from the upgrade (at the bottom of the list), but written by hand by script, not generated from code. For things which are not clear cut modifiers, but rather affecting outcomes of events or other happenings. custom_modifier_text = bells_upgrade_tt
flags clause Used for categorizing upgrades, but also in combination with custom_modifier_text. Similar to bloodlines and artifacts. flags = { special_effect_bells metal_upgrade }
active clause For triggers
active = {
       religion = catholic
allow conditions
build_time int Defines how long the base build time is in days. build_time = 365
gold_cost_flat fixedpoint Defines how much gold will be deducted when the upgrade construction is initiated. gold_cost_flat = 500
gold_cost_ticking fixedpoint Defines how much gold will be deducted at the end of each month gold_cost_ticking = 10
local_modifier clause Modifiers that the upgrade contribute with to the wonder when fully built. This part will be applied to the local province.
local_modifier = {
     revolt_risk = -0.02
owner_modifier clause Modifiers that the upgrade contribute with to the wonder when fully built. This part will be applied to the top liege character.


If you want to give your great work a custom sprite, you will, just as with trait icons, have to create the image several times, in multiple different sizes. Small versions are 92 by 96 pixels, medium are 132 by 132 pixels, and large versions are 150 by 150 pixels. Each image file is really a strip of images: one for each stage, with the first one reserved for the damaged/looted stage. Therefore, vanilla strips are 460 pixels wide in small, 660 in medium and 750 pixels wide in the large version. All of them are located in the folder /gfx/interface/wonder_interface/wonder_strips/. All images are in the dds format. For consistency with vanilla, name them according to the pattern: wonder_stages_<wonder name>_<size>.dds.

All images are defined (given gfx keys) in /interface/wonder.gfx. Once you have added your custom image at all required sizes, add your own entry to a (new) gfx file in the same folder, using this template:

spriteType = {
	name = "GFX_wonder_strip_<wonder name>_large"
	texturefile = "gfx\\interface\\wonder_interface\\wonder_strips\\wonder_stages_<wonder name>_large.dds"
	noOfFrames = 5

Obviously alter the noOfFrames variable if you have additional or fewer stages in your strip. You will have to create three of these entries, for small, medium and large. Also, do not worry that your

After that, you can refer to your image using the simple GFX_wonder_strip_<wonder_name> key. Do not attach the size suffix: the game will do that automatically whenever it is needed.


Features are more easily given custom images, as the picture only needs to be made in a single size (50 by 50 pixels), in the folder /gfx/interface/wonder_interface/wonder_upgrades/. They are typically named wonder_upgrade_<upgrade name>.dds.

After creating your image, add an entry in a file in the /interface/ folder (where the strips are also located), following this simple template:

spriteType = {
	name = "GFX_upgrade_icon_<upgrade name>"
	texturefile = "gfx\\interface\\wonder_interface\\wonder_upgrades\\wonder_upgrade_<upgrade name>.dds"

Background images

You can add your own images to be used as a background for your wonder. If you want the adamant tower of Barad-dûr to come with the fiery, volcanic terrain that such a terrible construction would indubitably introduce to its surroundings, you should define a new background image. This must too be done in three sizes (92 by 96, 132 by 132 and 150 by 150 pixels for small, medium and large, respectively), in the /gfx/interface/wonder_interface/wonder_backgrounds/ folder. Also, supply it with three gfx entries, one for each size, in the familiar /interface/ folder, following the familiar template:

spriteType = {
	name = "GFX_wonder_background_<my background>_<size>"
	texturefile = "gfx\\interface\\wonder_interface\\wonder_backgrounds\\wonder_background_<my background>_<size>.dds"
	noOfFrames = 1

One particular thing about this is that these pictures can sometimes be in strip form and sometimes in plain form. If you want multiple possible volcanic wastelands, put your desired number of variations behind each other in the image file, and increase the noOfFrames variable accordingly. The game will select one at random for your wonder, based on the province ID (meaning a great work in London will always have the same background, even over different campaigns).

Then, you can make your wonder always select this background image using the following syntax in the wonder definition:

background_overrides = {
         All = GFX_wonder_background_<my background>

Again, the size suffix is by the game, so no need to add that.

The vanilla background images are selected automatically, based on the terrain type. This code only takes into account the vanilla terrain types. If you added your own terrain types, they will not be linked automatically to the corresponding background images. Therefore, you would have to refer to it in the background overrides, in each and every wonder definition, to ensure any wonder placed on your new terrain would have the correct background:

background_overrides = {
         <my terrain type> = GFX_wonder_background_<my background>

3D models

The 3D models for each wonder are defined in /interface/wonder_mesh.gfx, and the mesh files themselves located in (one of the subfolders of) /gfx/models/Mapitems/great_works/. A tutorial on how to create the meshes themselves is out of the scope for this page, but the Clausewitz Maya Exporter tool is a good place to get started.


Historical or pre-existing great works can be added in province history files. You first add a date key (e.g. 867.1.1 = {), which opens a clause where you can put any command you like. The following history commands are available:

Command Value type Description
build_wonder wonder_type Starts building the first stage of a wonder.
destroy_wonder boolean
build_wonder_upgrade upgrade type Starts construction of a wonder upgrade of a specific type
destroy_wonder_upgrade upgrade type
set_wonder_stage number Force a wonders stage to be set to <number>
set_wonder_name localization key string Sets the key used for localizing the name of a wonder
set_wonder_description localization key string Sets the key used for localizing the descrption of a wonder
set_wonder_damaged boolean Sets the damage state of a wonder
add_custom_history localization key string Adds an entry to the history view containing the text specified by the loc key

See also