Patch 2.7 mod compatibility guide

本页面讲述的内容长期有效


This guide describes the steps to make a mod compatible with patch 2.7.X from patch 2.6.3.

Note that this does not replace the usual step of merging files, in case the mod modifies some vanilla files.

In case of issues, run the latest version of The Validator, and try activating debug launch options, which will now report failed asserts in log files.

Folders and files

  • \common\custom_localisation\ is moved to \localisation\customizable_localisation, so that custom localization commands don't impact the checksum.
  • \interface\portrait_properties.txt is now folderized into \interface\portrait_properties\
  • Duplicated portrait.gfx files at the root of \interface, are now only in \interface\portraits

Scripting

主条目:Scripting

New operators ==, >, >=, <, and <= have been introduced:

AND = {
  society_rank > 1
  ROOT = { society_rank == 1 }
}

However as of patch 2.7 they only work for new triggers (ex: society_rank) and the old triggers don't support this new syntax.[1]

Secret religions

主条目:Society modding
  • A new secret trait should be created for each religion:
secretly_catholic = {
	opposites = {
		#Other religions
	}

	is_visible = {
		OR = {
			character = FROM
			society_member_of = secret_religious_society_catholic
			AND = {
				is_close_relative = FROM
				trait = secretly_catholic
			}
		}
	}

	same_opinion = 15
	
	random = no
	customizer = no
	ai_zeal = -50
}
  • Some triggers that exclude some religions may also need to be adapted to the new secret religion traits:

NOT = { religion_group = jewish_group } NOT = { trait = secretly_jewish }

Artifacts

主条目:Artifact modding

Items previously managed as character modifiers, dynasty flags or traits should be migrated to artifacts.

For instance:

add_character_modifier = {
	name = the_necronomicon
	duration = -1
}

has_character_modifier = the_necronomicon

may become:

add_artifact = necronomicon
new_artifact = {
	set_creation_date = 1.1.1
}

has_artifact = necronomicon

destroy_artifact = necronomicon

Targeted decisions

  • ai_target_filter is now mandatory for targeted decisions (ai_target_filter = self for decisions taken on the character itself).
  • Some normal decisions have been converted to targeted decisions with filters:
filter = self
ai_target_filter = self

Misc

  • Missing age variations of portraits (male1, male2, ...) will no longer default. Make sure you have portraitTypes with male, male1, male2, female, female1 and female2 for all your custom ethnicities.
  • Game rules can be associated to one or multiple groups via group = "TEXT_KEY_FOR_GROUP"
  • In minor titles:
OR = {
	primary_title = { temporary = no }
	NOT = {
		primary_title = {
			always = yes
		}
	}
}

is replaced by: NOT = { primary_title = { temporary = yes } }

  • Religion and religion group opinion modifiers are now dynamic and may be defined in common\modifier_definitions\:
<religion_group>_opinion = {
	show_as_percent = no
	is_good = yes
	is_monthly = no
	is_hidden = no
	max_decimals = 0
}

They also need to be localized.

OR = {
	trait = monk
	trait = nun
}

is replaced by: is_ascetic_trigger = yes

  • Some obedience / non_interference checks are added in some events:
ROOT = {
	NOR = {
		obedient = PREV
		non_interference = PREV
	}
}
  • Region definitions included in map/geographical_region.txt are now interpreted differently. Duchy references now equate to their de jure countries at the start_date defined in common/defines.txt, not their de jure counties in common/landed_titles before history is executed. This change has no effect if no counties change de_jure_liege before the start_date.
  • Define NDefines.NGraphics.NUMBER_OF_PROPERTIES is now determined automatically from portrait_properties file, and can be removed.

Outstanding bugs

  • In character history, dynasty=0 is ignored for lowborns, and they get assigned a random dynasty[2]. Workaround is to reset the dynasty to none via effect:
1000.1.1 = { 
  birth = yes 
  effect = { dynasty = none } 
}

References