Objective modding

From Crusader Kings II Wiki
Jump to: navigation, search
Objectives are goals a character can select.

There are four categories of objectives, which are determined by their prefix:

  • Ambitions (obj_ prefix)
  • Factions (faction_ prefix)
  • Plots. (plot_ prefix)
  • Foci (focus_ prefix)

Configuration[edit]

Name Type Description Example
type string Each objective has a target. The type defines the initial pool of targets for the target. This pool can be narrowed down further in the allow section. The types for ambitions and plots are:
  • character (the plotter)
  • spouse (the plotter's spouse)
  • rivals (the plotter's rivals)
  • friends (the plotter's friends)
  • liege_titles (the plotter's liege's titles)
  • liege_titles_w_claimant (the plotter's liege's titles for a claimant)
  • vassal_titles (the plotter's vassals' titles)
  • realm_titles (titles in the plotter's realm)
  • realm_characters (characters in the plotter's realm)
  • realm_characters_plus (characters in the plotter's realm, plus rivals and relatives of the plotter, parents, children and spouse)
  • independent_rulers
  • rep_trade_posts

Some of these types target characters, others target titles. All ambitions in vanilla use the character scope but it is possible to have ambitions targeting other characters.

type = character
intrigue_plot

military_plot
vassal_rank_plot
vassal_intrigue_plot
murder_plot

bool Each plot must specify who is eligible to join the plot as fellow plotters. Each pool of potential plotters is enabled by setting it with "yes". More than one pool can be enabled. For example, if you have the line "murder_plot = yes" then the courtiers in the same court as the target will be able to join the plot.

These pools are defined by relationships to the target of the plot. If the relationship and the target type of the plot do not match there will not be any plotters in that pool. For example if you have a plot that targets a realm_character the vassal_rank_plot pool will not contain any plotters. This is because the vassal_rank_pool makes plotters eligible based on their relationship to a target title, not to a target character.

intrigue_plot = yes
is_job_ambition bool The objective is about a councillor job. Helps the AI to prioritize. is_job_ambition = yes
potential conditions Only used for plots. It checks the plotter scope, where conditions can be set to let certain characters to use a specific plot.
potential = {
	independent = no
}
target_potential conditions Conditions on the target of a plot.
target_potential = {
	NOT = { any_spouse = { character = FROM } }
}
allow conditions
  • For plots, allow checks the target scope. Conditions in this section will determine which characters are valid targets for the plot. The FROM scope in this context can be used to check the plotter scope.
  • For ambitions, allow checks the plotter scope, just as potential does for plots.
player_allow conditions If false, shows the faction entry for players, but disabled. For plots and factions
allow_join conditions Restricts whether characters can join factions. Faction member scope (ROOT = joiner, FROM = target).
chance AI characters pick ambitions and plots based on the chance value. The greater the chance value, the greater the odds that the AI will pick that particular ambition. Just like ai_chance for event options, modifiers can be used to alter a particular character's chance of picking the objective. Base chance is set by adding "factor = x" in the chance section, where x is the base weight.

AI characters will also not pick objectives below a certain factor at all. This value can be changed in defines.lua, by changing the "OBJECTIVE_DISCARD_WEIGHT_THRESHOLD" variable.

chance = {
	factor = 100
	modifier = {
		factor = 1.25
		trait = patient
	}
}
creation_effect commands
  • For plots, commands occur when the plot is activated.
  • For ambitions, the commands are fired upon ambition selection.
success conditions The success section is used to set conditions to determine if the character has completed the objective. When all conditions are true in this section, the objective is considered completed.
success = {
	has_job_title = job_chancellor
}
abort conditions When all conditions in the abort section are true, the character is forced to abort the current objective.
abort = {
	OR = {
		trait = charitable
		trait = incapable
	}
}
abort_effect commands When an objective is aborted, either by choice or by forced abort, all of the commands in the abort_effect section are fired.
effect commands When an objective is successfully completed, all of the commands in the effect section are fired.
effect = {
	change_intrigue = 1
}
exclusive bool Can only lead or be in one faction of this type exclusive = yes
expectation_of_liege bool expectation_of_liege = yes
rel_head_loyalist bool Members consider the "real" pope to be the rightful religious head
cancel_on_leader_death bool The faction will not automatically continue under a new leader cancel_on_leader_death = yes
warning_level double At this level of faction power we give player an alert. Set to 0 for no alerts. warning_level = 0.7
ai_capital_kingdom_focus bool AI characters with this ambition will actually focus on taking the kingdom ai_capital_kingdom_focus = yes
membership clause AI membership weight: ROOT is the prospective member. FROM is the faction leader. FROMFROM is the target title or character.
can_cancel bool Ambition cannot be cancelled. can_cancel = no
<modifier_name> modifiers Modifiers while the objective is active.
potential_traits List<traits> Traits that can be gained via this focus
potential_traits = {
	haughty
	brooding
}
Modding
History
Scripting
Common
DefinesGame rulesReligionCultureTraitsTechnologyLawsBuildingsCasus BelliObjectivesGovernmentsDiseaseDeathMinor titles
Gfx/Sfx/localisation