修正:修订间差异

本页面所适用的版本可能已经过时,最后更新于2.7
(merge from offical wiki)
 
(RemixMe移动页面Modifiers修正
(没有差异)

2019年2月28日 (四) 18:56的版本


Modifiers are bonus or penalties, referenced by a variable, localized and attached to characters, province, religion or opinion depending on the type.

Modifiers are everywhere and can be attached in multiple ways: traits, technology, events, culture, triggers, ...

All values of modifiers are double, but depending on how they are used in formulas, they can either be:

  • Flat (additive): 1 means +1
  • Percentage (multiplicative): 1 means +100% (i.e. x 2), 0.1 means +10% (i.e. x 1.1), etc.

List of modifiers

Modifiers can only be used in the correct scope. When using modifier in wrong scope, it will display as NONE in tooltip and/or will do absolutely nothing (though some modifier displayed as NONE may actually apply its effect):

  • [1]Character: Character modifiers are attached to characters and modify their personal or state abilities, their behavior (for the AI characters), or the opinion a group of people have of that character. They are primarily used in events via command add_character_modifier, combat tactics (for commanders), ambitions & focuses, artifacts, bloodlines, and religion character_modifier.
  • Traits: Traits modifiers are used inside traits. All character modifiers work in traits, but not vice-versa.
  • [2]Province: Province modifiers are attached to provinces and impact the actions of characters while they are in that province. They are added in events via add_province_modifier command, or via disease.
  • Councillor: Councillor jobs modifiers give bonus to a province where the job is being performed by the councillor.
  • Technology: Technology modifiers give bonus to a provinces which have attained that technological level. Anything that works as a province modifier will work as a tech modifier, though not vice-versa.
  • [3]Holding: Holding modifiers are attached to individual holdings in a province with the add_holding_modifier command. In pre-2.4 patches, this kind of modifier was only attached via vanilla code.
  • [4]Building: Building modifiers only affect the holding they're built in. For family palace buildings, any character modifier can also be used, and will apply to its owner. Some modifiers can only work in family palaces.
  • Laws: Laws modifiers apply to the primary title having such laws active.

Notes:

  • <holding_type> can be city, castle or temple
  • <unit> can be pikemen, light_cavalry, knights, heavy_infantry, archers or light_infantry. Entries from /common/special_troops are also valid: horse_archers, war_elephants, camel_cavalry.
  • <tech_type> can be economy, culture or military
  • ✓ means the modifier is known to work in that scope (used in vanilla or tested)
  • X means the modifier is known not to work in that scope
Character attribute modifiers Description Type Character[1] Traits Province[2] Councillor Technology Holding[3] Building[4] Laws
diplomacy Diplomacy skill of a character Flat X
diplomacy_penalty Modifies diplomacy skill of character. Total bonus cannot exceed 0. Flat X
stewardship Stewardship skill of a character Flat X
stewardship_penalty Modifies stewardship skill of character. Total bonus cannot exceed 0. Flat X
martial Martial skill of a character Flat X
martial_penalty Modifies martial skill of character. Total bonus cannot exceed 0. Flat X
intrigue Intrigue skill of a character Flat X
intrigue_penalty Modifies intrigue skill of character. Total bonus cannot exceed 0. Flat X
learning Learning skill of a character Flat X
learning_penalty Modifies learning skill of character. Total bonus cannot exceed 0. Flat X
fertility Fertility of a character. Percent X
fertility_penalty Modifies fertility of character. Total bonus cannot exceed 0. Percent X
health Health of a character Flat X
health_penalty Modifies health of character. Total bonus cannot exceed 0. Flat X
combat_rating Duel skill of a character Flat X
threat_decay_speed threat decay percentage per month Percent
Realm modifiers Description Type Character[1] Traits Province[2] Councillor Technology Holding[3] Building[4] Laws
demesne_size Maximum demesne size Flat X
vassal_limit Vassal limit Flat X X X X
global_revolt_risk Revolt risk in a ruler's realm (whole provinces, not only demesne) Percent X
local_revolt_risk Revolt risk in a in a province Percent X X X
disease_defence Chance of a province to gain a disease Percent X
culture_flex Tolerance to other cultures Percent
religion_flex Tolerance to other religions Percent
short_reign_length Short reign penalty in years Flat
moved_capital_months_mult Modifies the delay for how often one can change capital, if their government allows for more frequent switching than once per lifetime. Scripted on capital buildings.
Intrigue modifiers Description Type Character[1] Traits Province[2] Councillor Technology Holding[3] Building[4] Laws
assassinate_chance_modifier Chances to assassinate characters in a province Percent
arrest_chance_modifier Percent
plot_power_modifier Plot power for character's plots Percent X
murder_plot_power_modifier Defaults to 1, and is multiplied with a character's plot power when it comes to murder plots. Percent [✓] X [✓] [✓]
defensive_plot_power_modifier Percent [✓] X [✓] [✓]
plot_discovery_chance Chances to uncover plots in a province Percent X
Wealth, prestige, and piety Description Type Character[1] Traits Province[2] Councillor Technology Holding[3] Building[4] Laws
tax_income Taxes from holding in demesne Flat
global_tax_modifier Tax gained from every province in a ruler's realm. If used as a trait, properly increases the overall desmesne income but is listed as 'Stewardship' bonus. Percent X
local_tax_modifier Tax gained from every holding in a province Percent
<holding_type>_tax_modifier Tax gained from castles/cities/temples in demesne Percent X
<holding_type>_vassal_tax_modifier Tax gained from vassals of the government type that normally corresponds to that holding Percent
nomad_tax_modifier
monthly_character_prestige Prestige of a character earned each month Flat
liege_prestige Gives prestige to building owner and his/her liege X X
add_prestige_modifier Modifier of character prestige gain Percent X X
monthly_character_piety Piety of a character earned each month Flat
liege_piety Gives piety to building owner and his/her liege X X
add_piety_modifier Modifier of character piety gain Percent X X
monthly_character_wealth Wealth of a character earned each month Flat
AI behavior modifiers Description Type Character[1] Traits Province[2] Councillor Technology Holding[3] Building[4] Laws
ai_rationality Influences the way the AI makes choices, such as whether the AI will compare its own levy size with its enemy levy size if it wants to go to war. Flat X
ai_zeal Influences the way the AI deals with religious conflict, primarily whether the AI will join crusades and neighboring holy wars. Flat X
ai_greed Influences interactions concerning money, such as the effect of gifts on opinion as well as likelihood to ransom or start embargo wars. Flat X
ai_honor Influences the likelihood the AI will honor relationships and alliances, and the chance of attacking despite such relations. Also affects its likelihood of joining plots. Flat X
ai_ambition Influences the AI's desire for expansion, primarily affecting the likelihood of wanting to declare war. Flat X
AI construction modifiers Description Type Character[1] Traits Province[2] Councillor Technology Holding[3] Building[4] Laws
ai_feudal_modifier Influences the AI's building creation weight if the ai is feudal, or if tribal but strive to become feudal Flat
ai_republic_modifier Influences the AI's building creation weight if the ai is a republic, or if tribal but strive to become a republic Flat X X
Construction modifiers Description Type Character[1] Traits Province[2] Councillor Technology Holding[3] Building[4] Laws
build_cost_modifier Cost of constructing a building (demesne only) Flat
build_cost_castle_modifier Cost of constructing a castle building Flat
build_cost_city_modifier Cost of constructing a city building Flat
build_cost_temple_modifier Cost of constructing a temple building Flat [✓]
build_cost_tribal_modifier Cost of constructing a tribal building Flat
build_time_modifier Time to construct a building (demesne only) Flat
build_time_castle_modifier Time to construct a building in a castle Flat
build_time_city_modifier Time to construct a building in a city Flat
build_time_temple_modifier Time to construct a building in a temple Flat
build_time_tribal_modifier Time to construct a building in a tribe Flat
local_build_cost_modifier Cost of constructing a building in a province Percent X X[1]
local_build_cost_castle_modifier Cost of constructing a castle building in a province Percent X
local_build_cost_city_modifier Cost of constructing a city building in a province Percent X
local_build_cost_temple_modifier Cost of constructing a temple building in a province Percent [✓] [✓] [✓] [✓] [✓] X X
local_build_cost_tribal_modifier Cost of constructing a tribal building in a province Percent X
local_build_time_modifier Time to construct a building in a province Percent X X[2]
local_build_time_castle_modifier Time to construct a building in a castle Percent X
local_build_time_city_modifier Time to construct a building in a city Percent X
local_build_time_temple_modifier Time to construct a building in a temple Percent X
local_build_time_tribal_modifier Time to construct a building in a tribe Percent X
Opinion modifiers Description Type Character[1] Traits Province[2] Councillor Technology Holding[3] Building[4] Laws
ambition_opinion Changes the trait-holder's opinion of characters from which they want something (e.g., a county) Flat
vassal_opinion For traits, changes opinion of direct vassals and courtiers. For artifacts, changes opinion of vassals and below. Flat
sex_appeal_opinion Changes the opinion of adults interested in your gender. Also changes the opinion of homosexuals of the opposite gender, but only for traits, not for character modifiers or artifacts. Only active for adults below age 45 for women and 65 for men. Flat
same_opinion Changes a character's opinion with the same trait as you Flat
same_opinion_if_same_religion Changes a character's opinion with the same trait, if they have your religion Flat
opposite_opinion Changes a character's opinion with a trait defined in opposites = { } of you Flat
liege_opinion Changes your opinion of your liege OR changes your liege's opinion of you (depending on where it is used) Flat
general_opinion Changes all characters' opinion of you Flat
twin_opinion Changes your twin's opinion of you Flat
dynasty_opinion Changes all dynasty members' opinion of you Flat X
male_dynasty_opinion Changes all men in your dynasty's opinion of you Flat X X
female_dynasty_opinion Changes all women in your dynasty's opinion of you Flat X X
child_opinion Changes your children's opinion of you Flat X X
oldest_child_opinion Changes your oldest child's opinion of you Flat X
youngest_child_opinion Flat X
spouse_opinion Changes your spouses' opinion of you Flat X X
male_opinion Flat
female_opinion Flat
<religion>_opinion Changes the opinion of all characters of that religion toward the character. Custom religions can be added, but must be defined in 00_modifier_definitions.txt first. Flat X[3]
<religion_group>_opinion Changes the opinion of all characters of that religion group toward the character. Custom religions can be added, but must be defined in 00_modifier_definitions.txt first. Flat X ]]
same_religion_opinion Changes same religion members' opinion of you Flat
infidel_opinion Opinion of other religion groups Flat
<religion_group>_church_opinion Flat ?
church_opinion Changes the clergy's opinion of you Flat
temple_opinion Flat X
temple_all_opinion Flat X
town_opinion Flat
city_opinion Changes Burgher vassals' opinion of you Flat X X
castle_opinion Changes Feudal vassals' opinion of you. If used in a province modifier, only has an effect if it is your capital. Flat
feudal_opinion Opinion of direct feudal vassals Flat X X
tribal_opinion Opinion of tribal vassals (all tribals, including unreformed tribals) Flat
unreformed_tribal_opinion Flat
rel_head_opinion Opinion of character's religious head Flat X
free_invest_vassal_opinion Opinion of vassals with bishops Flat X
clan_sentiment [✓]
Warfare modifiers Description Type Character[1] Traits Province[2] Councillor Technology Holding[3] Building[4] Laws
levy_size Maximum levies. Does not influence fleet size. Percent X
<holding_type>_levy_size Maximum levies of a castle/city/temple Percent
global_levy_size Levy size modifier for characters Percent
levy_reinforce_rate Time for levies to regenerate Percent
army_reinforce_rate Time for commanded army, retinue, or horde to regenerate (i.e., if character leads centre flank) Percent
phase_<phase>_attack Increases or decreases the effectiveness of the specified phase, as the attacking army. e.g., phase_melee_attack. Phase: melee, skirmish, pursue Percent
phase_<phase>_defense Increases or decreases the effectiveness of the specified phase, as the defending army. Percent
<unit> Adds (or removes in case of a negative number) a specified number of the given unit to the holding's levy, indirectly also increasing the holding's garrison size by the same amount. Flat
<unit>_max_levy archers_max_levy, etc.
<unit>_min_levy archers_min_levy etc.
<unit>_offensive Percent
<unit>_defensive Percent
<unit>_morale Percent
<holding_type>_vassal_min_levy Minimum levy vassals have to provide to their liege. Not cumulative between laws (takes the lowest). Percent
<holding_type>_vassal_max_levy Maximum levy vassals have to provide to their liege. Not cumulative between laws (takes the highest). Percent
land_morale Morale of realm army Percent X
land_organisation Morale recovery rate Percent
regiment_reinforcement_speed
garrison_size Size of holding garrison Percent X X
global_garrison_size Garrison size modifier for characters Percent [✓]
garrison_growth Regeneration rate of holding garrison. Doesn't work in 2.2.1 will appear as NONE
fort_level Holding fort level Flat X X
global_defensive X
land
global_supply_limit Percent X
global_winter_supply Applicable on the capital.
supply_limit Amount of soldiers that can remain in a province until attrition occurs Percent X X
max_attrition Province maximum attrition Percent X
attrition Amount of attrition received by the troops being led. Not a command modifier Percent
days_of_supply Additional days troops can go without supplies before receiving attrition. Not a command modifier Flat
siege_defence Siege defence speed Percent
siege_speed Siege offence speed Percent
global_movement_speed Percent X
local_movement_speed Increases movement rate Percent
galleys_perc Number of galleys Percent X X
retinuesize Number of retinues Flat X[4]
retinuesize_perc Number of retinues Percent
retinue_maintenence_cost Applicable on characters, family palaces and the capital. The equivalent for tribal governments is horde_maintenence_cost. [✓] X [✓]
horde_maintenence_cost Applicable on characters, family palaces and the capital. [✓]
Technology modifiers Description Type Character[1] Traits Province[2] Councillor Technology Holding[3] Building[4] Laws
tech_growth_modifier Growth rate of all technology types. Percent X X X
commander_limit Increases the number of commanders a ruler can have. Scripted in buildings for capital settlements. Flat X
tech_growth_modifier_<tech_type> Growth rate of cultural/military/economy technology. Cumulative with tech_growth_modifier. Percent X X X
<tech_type>_techpoints Generation of technology points in province Percent X[5]
Trade modifiers Description Type Character[1] Traits Province[2] Councillor Technology Holding[3] Building[4] Laws
max_tradeposts Maximum number of trade posts Flat X X
tradevalue Trade zone value Flat
trade_route_wealth
trade_route_value
global_trade_route_wealth Applicable on the capital of holders of a trade post.
global_trade_route_value Applicable on the capital of holders of a trade post.
global_tradevalue Applicable on the capital of holders of a trade post.
global_tradevalue_mult Applicable on the capital of holders of a trade post.
multiplicative_trade_post_income_modifier Increases trade post income by the specified percent (1.0 = +100% = double income). Percent
Population modifiers Description Type Character[1] Traits Province[2] Councillor Technology Holding[3] Building[4] Laws
population_growth
manpower_growth [✓] X
max_population_mult Percent [✓]
max_manpower_mult [✓]
max_population Flat [✓]

Custom modifiers

Custom modifiers can be defined in common/modifier_definitions.

Flag Value Description Code
show_as_percent bool Show it as a percentage boost, rather than a regular number. Automatically multiplies it by 100 for display as well show_as_percent = yes
is_good bool Show positive numbers in green is_good = yes
is_monthly bool Add a "(monthly)" to the display is_monthly = no
is_hidden bool Don't show it at all is_hidden = no
max_decimals int How many numbers after the decimal point to show max_decimals = 2
show_value bool Whether to show its value at all. Setting to "no" can be useful for showing a modifier unlocks some sort of feature. Note it will only show up when the modifier is not equal to zero show_value = no

They are based on an hardcoded convention on their name, similarly to the sympathy_<religion> modifier, which works for any custom religion, not only vanilla religions.

They are restricted to the following entities:

  • Special units:
    • <special_unit>: defines the modifier providing the troop itself. E.G., "horse_archers". It's what you'd use in the building giving the special unit.
    • <special_unit>_offensive: Defines the unit's offensive modifier. E.G., horse_archers_offensive
    • <special_unit>_defensive: Defines the unit's defensive modifier
    • <special_unit>_morale: Defines the unit's morale modifier
  • Cultures:
    • <culture>_opinion: Gives opinion bonus with specified culture, E.G., norse_opinion
    • <culture_group>_opinion: Gives opinion bonus with specified group, E.G., north_germanic_opinion
  • Religions:
    • <religion>_opinion: Gives opinion bonus with specified religion, E.G., catholic_opinion
    • <religion_group>_opinion: Gives opinion bonus with specified group, E.G., muslim_opinion
  • Traits:
    • <trait>_opinion: Gives opinion bonus with persons who have specified trait, E.G., genius_opinion
    • opinion_of_<trait>: Makes the character like characters who have the specified trait, E.G., opinion_of_lustful
  • Offmap currency: The name of this token is defined in the offmap itself. Gives monthly offmap currency

If not matching any convention, custom modifiers with show_value = no can still be used to display a localized text in the tooltip of an element that accepts a modifier ( bloodlines, traits, ...). This allows to describe features that are managed externally via scripting (events, ...).

Custom modifiers are localized via the following keys:

  • <modifier>: the description of the modifier
  • <modifier>_EXPLANATION: shows an explanation in places that sum up different modifiers (opinion breakdowns, ...)

Static modifiers

Static modifiers are global modifiers (character, province, or unit), and defined in /common/static_modifiers.txt

Some of these modifiers are referenced from the code.

Culture modifiers

Culture modifiers can be used to differentiate between different cultures.

Vanilla CK2 uses a single modifier, default_culture_modifier, which does nothing and appears to simply be a placeholder. Modders can use these culture modifiers to, for example, enhance a specific culture's heavy infantry statistics, reduce or increase specific troop type numbers per holding, increase tax income, or any number of other effects.

For example, the following is a culture modifier used in the Elder Scrolls Modification to differentiate unit statistics of the Nibenean from other cultures in the modification.

 nibenean_culture_modifier = {
 	pikemen_offensive = 0.1
 	pikemen_defensive = 0.1
 	light_cavalry_offensive = 0.25
 	light_cavalry_defensive = 0.25
 	knights_offensive = 0.15
 	knights_defensive = 0.15
 	heavy_infantry_offensive = -0.2
 	heavy_infantry_defensive = -0.2
 	light_infantry_offensive = -0.2
 	light_infantry_defensive = -0.2
 	archers_offensive = -0.1
 	archers_defensive = -0.1
 	
 	land_organisation = 0.1
 }


Event modifiers

Event modifiers are either:

  • character modifiers
  • province modifiers
  • holding modifiers (since patch 2.4)

They are stored under common/event_modifiers/ and grouped and referenced by a name.

In addition to their modifier properties, they also have:

  • an optional is_visible condition block, to decides if the viewer can see this trait on holder (default is yes). ROOT is the viewer, FROM is the holder.
  • the optional major = yes property
  • a mandatory icon, see vanilla icons below:


List of vanilla icons (positive index / negative index):

  • Martial: Martial positive modifier.png 1 / 19
  • Learning: Learning positive modifier.png 2 / 20
  • Diplomacy: Diplomacy positive modifier.png 3 / 21
  • Stewardship: Stewardship positive modifier.png 4 / 22
  • Intrigue: Intrigue positive modifier.png 5 / 23
  • Money: Money positive modifier.png 6 / 24
  • Prestige: Prestige positive modifier.png 7 / 25
  • Piety: Piety positive modifier.png 8 / 26
  • Titles: Titles positive modifier.png 9 / 27
  • Council: Council positive modifier.png 10 / 28
  • Laws: Laws positive modifier.png 11 / 29
  • Technology: Technology positive modifier.png 12 / 30
  • Military: Military positive modifier.png 13 / 31
  • Plots: Plots positive modifier.png 14 / 32
  • Messages: Messages positive modifier.png 15 / 33
  • Diplomatic actions: Diplomatic actions positive modifier.png 16 / 34
  • Church: Church positive modifier.png 17 / 35
  • Characters: Characters positive modifier.png 18 / 36
  • Prison: Prison positive modifier.png 37 / 38
  • Love: Love positive modifier.png 39 / 40
  • Death: Death positive modifier.png 41 / 42
  • Indian religion: Indian religion positive modifier.png 43 / 44
  • Dog: Dog positive modifier.png 45 / 65
  • Cat: Cat positive modifier.png 46 / 66
  • Owl: Owl positive modifier.png 47 / 67
  • Pagan religion: Pagan religion positive modifier.png 48 / 49
  • Staff of Asclepius: Staff of Asclepius positive modifier.png 50 / 51
  • Mystic: Mystic positive modifier.png 52 / 53
  • Bonesaw: Bonesaw positive modifier.png 54 / 55
  • Horseshoe: Horseshoe positive modifier.png 56 / 57
  • Parrot: Parrot positive modifier.png 58 / 68
  • Ham: Ham positive modifier.png 59 / 60
  • Anchor: Anchor positive modifier.png 61 / 62
  • Jewish religion: Jewish religion positive modifier.png 63 / 64
  • Bed: Bed positive modifier.png 69 / 70
  • Wolf: Wolf positive modifier.png 71 / 72
  • Raven: Raven positive modifier.png 73 / 74
  • Demon horns: Demon horns positive modifier.png 75 / 76
  • Trident: Trident positive modifier.png 77 / 78
  • Stars: Stars positive modifier.png 79 / 80
  • Eye: Eye positive modifier.png 81 / 82
  • Test/tubes: Test tubes positive modifier.png 83 / 84
  • Science flask: Science flask positive modifier.png 85 / 86
  • Flower: Flower positive modifier.png 87 / 88
  • Rats: Rats positive modifier.png 89 / 90
  • Otter: Otter positive modifier.png 91 / 92
  • Hedgehog: Hedgehog positive modifier.png 93 / 94

Example:

sweet_temptation = {
  fertility = 0.2
  church_opinion = -20
  icon = 26
}

Event modifiers are attached by event to a character/province via add_character_modifier/add_province_modifier effects:

add_character_modifier = {
  modifier = sweet_temptation
  duration = -1
}

Triggered modifiers

Triggered modifiers are similar to character event modifiers, except that they do not need to be attached or detached by script: depending on conditions they will automatically be applied or removed.

For performance reasons, they only apply to playable characters (counts or above). As they are evaluated everyday for every landed character in existence, these are very resource intensive.

They are stored in /common/triggered_modifiers/00_triggered_modifiers.txt

Structure:

triggered_modifier_name = {
  potential = {
    #Conditions on characters to check
  }
  trigger = {
    #Conditions for modifier to activate
  }
  icon = 24 #Same icons as event modifier icons
  active = no #Completely de-activates the modifier

  # Character modifiers go here
  land_morale = -0.25
}

Religion modifiers

Religion modifiers impact the moral authority of a religion. They are stored under common/religion_modifiers/.

Flag Value Description Code
authority int Percentage of religion moral authority. authority = -10
years int Duration of the modifier in years. years = 20

Example:

won_holy_war = {
  authority = 3
  years = 20
}

Religion modifiers can be attached via event with the religion_authority command:

religion_authority = {
  modifier = ruler_bowed_to_pope
  years = 10
}

Society modifiers

The equivalent of religious moral authority for societies is influence.

They are stored under common/event_modifiers/.

Flag Value Description Code
society_influence int Percentage of society influence. society_influence = 1

They can also be capped via static modifier's static_modifier_cap = 10.

Society modifiers are attached via event with add_society_modifier command.

add_society_modifier = 	{
  modifier = successful_mission
  years = 10
}

Opinion modifiers

Opinion modifiers modify the relations between two characters. They are somehow similar to the opinion_xxx character modifiers, but apply to a single character, rather than a group of character (clergy, mayors, ...). In addition they can contain extra information, such as cause for imprisonment. They are stored under common/opinion_modifiers/.

In patch 2.1.5 some hardcoded opinion modifiers for relatives have been added for brother, half-brother, sister, half-sister, grandfather, grandmother, grandchild, uncle, aunt, nephew and niece.

Flag Value Description Code
opinion double opinion = -30
days int Duration in days days = 120
months int Duration in months months = 120
years int Duration in years years = 3
inherit bool Heirs inherit this opinion
opinion_supported_cardinal = {
  opinion = 15
  months = 1000
  inherit = yes
}
decay bool Linear decay over time
common_interests_opinion = {
  opinion = 20
  decay = yes
}
revoke_reason bool Gives righteous cause to revoke one title
declared_war = {
  opinion = -25
  months = 160
  revoke_reason = yes
}
prison_reason bool Gives righteous cause to imprison a character
opinion_dishonorable = {
  opinion = -10
  months = 60
  prison_reason = yes
}
execute_reason bool Gives righteous cause to execute a character
opinion_rebel_traitor = {
  opinion = -100
  months = 1200
  prison_reason = yes
  revoke_reason = yes
  execute_reason = yes
  inherit = yes
}
banish_reason bool Gives righteous cause to banish a character
attempted_murder_of_spouse = {
  opinion = -70
  crime = yes

  prison_reason = yes
  banish_reason = yes
  execute_reason = yes
}
preparing_adventure_against_me bool preparing_adventure_against_me = yes
preparing_to_invade_me bool Used by Prepared Invasion mechanic preparing_to_invade_me = yes
preparing_invasion bool Used by Prepared Invasion mechanic
preparing_to_invade = {
  opinion = -10
  months = 24
  preparing_invasion = yes
}
enemy bool Makes the characters enemies of each other (effectively at war)
opinion_looted = {
  opinion = -40
  months = 6
  enemy = yes
}
crime bool Character counts as a rival for the is_foe condition (committed a criminal act against me)
grievously_offended = {
  opinion = -30
  months = 60
  crime = yes
  disable_non_aggression_pacts = yes
}
disable_non_aggression_pacts bool Temporarily disables all non-aggression pacts between the two characters
broken_non_aggression_pact = {
  opinion = -10
  years = 3
  disable_non_aggression_pacts = yes
}
non_aggression_pact bool Gives a temporary non-aggression pact between the two characters
in_non_aggression_pact = {
  opinion = 10
  years = 3
  non_aggression_pact = yes
}
obedient bool The AI will accept all diplomatic interactions from the other character. Also makes the trigger obedient return true.
opinion_loyal_servant = {
  opinion = 50
  months = 1200	# For life
  obedient = yes
}
non_interference bool The AI will accept all diplomatic interactions from the other character. Non-interference is considered a subset of obedient, so any obedient character is automatically non-interfering as well. Also makes the trigger non_interference return true.

Example:

declared_war = {
  opinion = -25
  months = 160
  revoke_reason = yes
}

Opinion modifiers can be attached via event, via the opinion effect:

opinion = {
  modifier = opinion_shocked
  who = ROOT
  years = 2
}

Command modifiers

These modifiers apply only to the command_modifier clause of traits. They are multiplied by the number of martial points times COMMAND_MODIFIER_MARTIAL_MULTIPLIER = 0.05

Modifier Description Type
morale_offence Percentage
morale_defence Percentage
defence Percentage
speed Army movement speed Percentage
retreat Percentage
damage Percentage
siege Reduces siege time Percentage
random Percentage
flank Active when character leads a flank Percentage
center Active when character leads centre Percentage
cavalry Both knights and light_cavalry unit types. Percentage
religious_enemy Percentage
%phase% Percentage
%unit_type% light_infantry, heavy_infantry, etc. Percentage
terrain Gives TERRAIN_SPEC_BONUS = 0.2 bonus when fighting in that terrain. Percentage
narrow_flank Percentage
winter_supply
winter_combat Percentage

For instance:

command_modifier = {
	morale_defence = 0.1
	center = 0.1
}

References