CK3 DatabaseCrusader Kings III · 1.20.1.2 “Crozier” · unofficial
Silk & Silverout Tue, Nov 17What's free, what needs the DLC, price →

Scripted effect · Roads to Power files

ep3_adventurer_ai_contract_find_next_employer_effect

ep3_adventurer_ai_contract_find_next_employer_effect = yes

game/common/scripted_effects/07_dlc_ep3_story_cycle_adventurer_ai_scripted_effects.txt, line 5 (168 lines). No parameters.

ep3_adventurer_ai_contract_find_next_employer_effect is a scripted effect in Crusader Kings III, in the Roads to Power files, written at line 5 of its file. It takes no parameters: ep3_adventurer_ai_contract_find_next_employer_effect = yes. The game's script calls it in 1 place, among them story_adventurer_ai (story cycle). Patch 1.20.1.2, from game/common/scripted_effects/07_dlc_ep3_story_cycle_adventurer_ai_scripted_effects.txt.

What it does

  • If a check the game hides passes: the same again (1 line)
    • story_owner = { … }
  • story_owner = { … }

• the game's own tooltip text · ◦ our reading of the script line · code the script where neither exists

“They” is whatever it runs on (the scope it is called in). The scripted triggers and effects it calls link to their own pages; $PARAMETERS$ stay as written: each call fills them in.

The script as written (120 lines of game script)
ep3_adventurer_ai_contract_find_next_employer_effect = {
	save_scope_as = story
	# Save previous employer for easy reference
	var:previous_employer ?= { save_scope_as = previous_employer }
	# Save current employer for easy reference
	var:active_employer ?= { save_scope_as = current_employer }
	# Find next employer in active de jure kingdom
	var:active_kingdom = {
		random_de_jure_county_holder = {
			limit = {
				save_temporary_scope_as = new_employer_temp
				NOR = {
					scope:story = {
						is_target_in_variable_list = {
							name = recent_employers
							target = scope:new_employer_temp
						}
					}
					is_at_war_with = scope:story.story_owner
					has_imprisonment_reason = scope:story.story_owner
					has_execute_reason = scope:story.story_owner
					has_banish_reason = scope:story.story_owner
					any_liege_or_above = {
						OR = {
							has_imprisonment_reason = scope:story.story_owner
							has_execute_reason = scope:story.story_owner
							has_banish_reason = scope:story.story_owner
							is_at_war_with = scope:story.story_owner
						}
					}
				}
			}
			weight = {
				base = 1
				# Prefer higher ranked employers
				modifier = { add = highest_held_title_tier }
				# Prefer same culture employers
				modifier = {
					culture = { has_same_culture_heritage = scope:story.story_owner.culture }
					factor = 1.5
				}
				# Prefer same faith employers
				modifier = {
					faith = scope:story.story_owner.faith
					factor = 1.5
				}
				# Prefer same faith employers
				modifier = {
					religion = scope:story.story_owner.religion
					factor = 1.5
				}
				# Prefer new employers
				modifier = {
					scope:previous_employer ?= scope:new_employer_temp
					factor = 0.25
				}
				modifier = {
					scope:current_employer ?= scope:new_employer_temp
					factor = 0.25
				}
				# Mercenary
				modifier = {
					scope:story.story_owner = {
						has_realm_law = camp_purpose_mercenaries
						NOR = {
							has_relation_rival = scope:new_employer_temp
							scope:new_employer_temp = {
								any_war_enemy = {
									OR = {
										is_consort_of = scope:story.story_owner
										is_close_family_of = scope:story.story_owner
										is_allied_to = scope:story.story_owner
										has_relation_friend = scope:story.story_owner
									}
								}
							}
						}
						can_create_task_contract = {
							type_name = laamp_join_war_contract
							employer = scope:new_employer_temp
						}
					}
					factor = 2
				}
			}
			# Save new employer
			save_scope_as = new_employer
		}
	}
	if = {
		limit = { exists = scope:new_employer }
		if = { # Save previous employer for checks and debugging
			limit = { exists = scope:current_employer }
			set_variable = {
				name = previous_employer
				value = scope:current_employer
			}
			add_to_variable_list = {
				name = recent_employers
				target = scope:current_employer
				years = 2
			}
		}
		set_variable = { # Save active employer
			name = active_employer
			value = scope:new_employer
		}
		set_variable = { # Reset remaining contracts counter
			name = remaining_contract_counter
			value = {
				integer_range = {
					min = ep3_adventurer_ai_contracts_per_employer_min_value
					max = ep3_adventurer_ai_contracts_per_employer_max_value
				}
			}
		}
		change_variable = { # Change remaining employer counter
			name = remaining_employer_counter
			add = -1
		}

As written in game/common/scripted_effects/07_dlc_ep3_story_cycle_adventurer_ai_scripted_effects.txt.

The first 120 of its 168 lines; the rest is in game/common/scripted_effects/07_dlc_ep3_story_cycle_adventurer_ai_scripted_effects.txt from line 5.

Where it is used

Every place in common/, events/ and history/ that calls ep3_adventurer_ai_contract_find_next_employer_effect.

Story cycles (1)

  • story_adventurer_ai

Source: game/common/scripted_effects/07_dlc_ep3_story_cycle_adventurer_ai_scripted_effects.txt and every file of common/, events/ and history/ that calls it, Crusader Kings III 1.20.1.2.

Spotted a mistake on this page?