Patch 2.6 mod compatibility guide

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


This guide describes the steps to make a mod compatible with patch 2.6.X from patch 2.5.2.

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.

Localisation

  • The load order of csv files has been reverted to pre-2.5 order. Typically "zz_" prefix needs to be transformed to "00_" prefix.
  • Bookmarks hardcoded localization convention _ERA and _ERA_INFO are now explicitly referenced in name/desc

Traits

  • Some negative modifiers are changed from diplomacy = -1 to diplomacy_penalty = -1. This applies to diplomacy_penalty, stewardship_penalty, martial_penalty, intrigue_penalty, learning_penalty, health_penalty and fertility_penalty.
  • vice = yes is added to sinful traits.
  • hidden = yes is added for traits that should remain hidden. A variant is to use same_trait_visibility = yes for traits that should be hidden except for players with the same trait.
  • New maimed traits need to be handled in custom nicknames.

Portraits

  • Two new properties were added: p12 (mask) and p13 (eyepatch). The following lines should be added to any custom portraitType derived from vanilla, in order to support them:
(...)
(p10 - blinded)
"GFX_character_eyepatch:p13:y:o32x63"
(p1 - hair)
"GFX_character_mask:p12:y:o40x45"
(p3 - clothes_infront)
(...)
  • A new define NDefines.NGraphics.NUMBER_OF_PROPERTIES = 14 may allow a custom number of properties, see Portrait_modding#Properties.
  • NDefines.NCharacter.LATE_PORTRAIT_AND_UNIT_AFTER_YEAR define was reduced from 1250 to 1200.

Modifiers

  • major = yes is added to some event modifiers (e.g. prosperity)
  • stacking = no can be added to opinion modifiers that should not stack

Scripting

Some new scripted triggers:

  • trait = in_hiding is replaced by is_inaccessible_trigger = yes
  • trait = maimed is replaced by is_maimed_trigger = yes
  • NOT = { trait = maimed } is replaced by can_be_maimed_trigger = yes
  • death_reason = death_execution is replaced by death_execution_trigger = yes
  • death_reason = death_murder is replaced by death_murder_known_trigger = yes
  • death_reason = death_sacrificed is replaced by death_sacrificed_trigger = yes

Some new scripted effects:

  • remove_trait = in_hiding is replaced by end_inaccessibility_effect = yes
  • add_trait = maimed is replaced by add_maimed_trait_effect = yes

Seclusion must be handled similar to hiding:

  • Faction creation ai chances:
modifier = {
	factor = 0
	FROM = {
		has_character_modifier = in_seclusion
	}
}
  • Disabled councillor actions:
FROM = {
	job_chancellor = {
		NOT = {
			has_character_modifier = in_seclusion
		}
	}
}
  • Disabled decisions that involve bringing in new courtiers:
allow = {
	NOT = {
		has_character_modifier = in_seclusion
	}
}

Misc:

  • NOT = { trait = craven } is replaced by NOR = { trait = craven trait = berserker } before adding Craven.png trait.

Optimizations

  • on_focus_pulse on_action is re-enabled and can be used instead of MTTH events.
  • Some new on_action can be used to reduce MTTH events: on_holding_building_start, on_province_major_modifier, on_outbreak
  • NDefines.NDisease.CROWDED_THRESHOLD_MODIFIER has been changed from 75 to 25
  • Unlanded characters that are important to mods need to be flagged {{sup|?}} to avoid being culled. In particular defaults are:
    • NDefines.NEngine.COURT_PRUNE_SIZE = 10
    • NDefines.NEngine.PRUNE_MINIMAL_AGE = 40
    • NDefines.NEngine.HEALTH_IMMUNITY_TO_PRUNING = 40
  • any_playable_ruler = { limit = { ai = no} } should be replaced by any_player
  • New event pre-triggers can be used:
    • Trigger NOT = { has_dlc = "Zeus" } should be replaced by pre-trigger lacks_dlc = "Conclave"
    • Trigger is_married = no can be moved to its equivalent pre-trigger
  • Decisions now support pre-trigger too:
    • Most decisions linked to realm should have only_playable = yes to exclude courtiers and barons. Note that is_playable = yes is kept in potential of vanilla scripts, in addition to the pre-trigger.
    • only_independent = yes can be used for top liege decisions

Game rules

主条目:Game rules modding

Check if some custom events/decisions would match a vanilla game rule.

Most impacting are:

  • gender (events, minor titles, laws, ...)

Depending on location:

  • Potential:
has_game_rule = {
	name = regencies
	value = off
}
  • AI:
modifier = {
	factor = 0
	has_game_rule = {
		name = ai_seduction
		value = off
	}
}

Map

  • A new de_jure title k_sapmi is added.
  • Some fictional baronies are added to some provinces, for prosperity mechanic.
  • Adapt new NDefines.NFrontend.MAX_ZOOM_LEVEL = 2500 to custom maps

Diseases

主条目:Disease modding
  • There are two sets of diseases using rip = yes or rip = no to switch between mechanics.
  • Diseases now have colors for the new mapmode.
  • add_trait = ill needs to be replaced by:
if = {
	limit = {
		NOT = {
			has_dlc = "Reapers"
		}
	}
	add_trait = ill
}
if = {
	limit = {
		has_dlc = "Reapers"
	}
	add_symptom_effect = yes
}
  • trait = ill needs to be replaced by is_ill = yes

Deaths

主条目:Death modding
  • Deaths are now more precise (e.g. death_accident may become death_murder_unknown_fall)
  • Custom deaths can now be modded in, and workarounds with fake health traits can be removed.
  • Scripted trigger may need to be modified to add new death reasons (e.g. death_execution_trigger, ...)
  • death_text and heir_text are used to customize the flavor text displayed on succession screen. Entries need to be added to handle custom traits, custom deaths, etc.

Misc

  • Monthly prestige of councillor titles is greatly increased (e.g. 0.015 to 0.75)
  • Religious titles have revoke_allowed = no added.
  • primary_title = { holy_order = no } is added to factions potential block
  • NOT = { trait = incapable } is added to many minor titles allowed_to_hold blocks
  • holder_scope = { NOT = { has_character_flag = liege_forced_succ_law } } is added to suiccession laws allow blocks
  • HOSPITAL must be added to governments allowed_holdings list, and can_build_hospitals = no when applicable.
  • africangfx ethnicity now has a portrait pack (East African), so can be used as a fallback to custom cultures, if applicable.
  • In bookmark select era screen, selectable_character whose religion require a DLC to be playable can be highlighted (e.g. dlc = "The Sword of Islam").
  • is_mercenary = yes needs to be added to decisions that allow to raise event troops, for the A.I. to consider them before hiring mercenaries.

References