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

Scripted effect

potential_lifestyle_friend_saving_effect

potential_lifestyle_friend_saving_effect = { FOCUS = … SCOPE_NAME = … }

game/common/scripted_effects/00_lifestyle_focus_effects.txt, line 29 (189 lines). Parameters: $FOCUS$, $SCOPE_NAME$.

potential_lifestyle_friend_saving_effect is a scripted effect in Crusader Kings III, written at line 29 of its file. A call passes 2 parameters: FOCUS and SCOPE_NAME. The game's script calls it in 7 places, among them A Bloom In The Wilderness (event intrigue_temptation.3010), A Demonstration of Leadership (event martial_authority_special.3000) and A Little Experimentation (event intrigue_temptation.3110). Patch 1.20.1.2, from game/common/scripted_effects/00_lifestyle_focus_effects.txt.

The comment above it in the file

Needs FOCUS and SCOPE_NAME

What it does

Every line of it is script with no tooltip text: the script is below.

The script as written (120 lines of game script)
potential_lifestyle_friend_saving_effect = {
	hidden_effect = {
		save_temporary_scope_as = friend_checker
		save_temporary_scope_value_as = {
			name = friend_saving_focus
			value = flag:$FOCUS$
		}

		#PLAYERS
		if = {
			limit = { is_ai = no }

			#Add major characters to list
			get_characters_of_major_interest_effect = { LISTNAME = lifestyle_friend_list }

			#Step 1: Add characters of minor interest
			if = {
				limit = {
					any_in_list = {
						list = lifestyle_friend_list
						potential_lifestyle_friend_availability_trigger = { CHARACTER = scope:friend_checker FOCUS = $FOCUS$ }
						count = 0
					}
				}
			
				
				get_characters_of_minor_interest_effect = { LISTNAME = lifestyle_friend_list }
			}

			#Step 2: Randomize if we now have someone suitable
			if = {
				limit = {
					any_in_list = {
						list = lifestyle_friend_list
						potential_lifestyle_friend_availability_trigger = { CHARACTER = scope:friend_checker FOCUS = $FOCUS$ }
					}
				}
				#Randomize!
				random_in_list = {
					list = lifestyle_friend_list
					limit = { potential_lifestyle_friend_availability_trigger = { CHARACTER = scope:friend_checker FOCUS = $FOCUS$ } }
					weight = {
						base = 1
						modifier = {
							add = $FOCUS$_friend_points
						}
						modifier = {
							has_relation_potential_friend = scope:friend_checker
							add = 10
						}
						opinion_modifier = {
							opinion_target = scope:friend_checker
							multiplier = 0.2
						}
					}
					if = {
						limit = { is_ruler = yes }
						set_focus = $FOCUS$
					}
					save_scope_as = $SCOPE_NAME$
				}
			}
			#Step 3: Ok, there still was none. Try to force someone to switch focus
			else = {
				random_in_list = {
					list = lifestyle_friend_list
					limit = {
						is_ruler = yes
						opinion = {
							target = scope:friend_checker
							value >= 0
						}
						this != root
						trigger_if = {
							limit = {
								scope:friend_saving_focus = flag:diplomacy_foreign_affairs_focus
								scope:friend_saving_focus = flag:diplomacy_majesty_focus
								scope:friend_saving_focus = flag:diplomacy_family_focus
							}
							diplomacy >= decent_skill_rating
						}
						trigger_else_if = {
							limit = {
								scope:friend_saving_focus = flag:martial_strategy_focus
								scope:friend_saving_focus = flag:martial_authority_focus
							}
							martial >= decent_skill_rating
						}
						trigger_else_if = {
							limit = {
								scope:friend_saving_focus = flag:martial_chivalry_focus
							}
							prowess >= decent_skill_rating
						}
						trigger_else_if = {
							limit = {
								scope:friend_saving_focus = flag:stewardship_wealth_focus
								scope:friend_saving_focus = flag:stewardship_domain_focus
								scope:friend_saving_focus = flag:stewardship_duty_focus
							}
							stewardship >= decent_skill_rating
						}
						trigger_else_if = {
							limit = {
								scope:friend_saving_focus = flag:intrigue_skulduggery_focus
								scope:friend_saving_focus = flag:intrigue_temptation_focus
								scope:friend_saving_focus = flag:intrigue_intimidation_focus
							}
							intrigue >= decent_skill_rating
						}
						trigger_else_if = {
							limit = {
								scope:friend_saving_focus = flag:learning_medicine_focus
								scope:friend_saving_focus = flag:learning_scholarship_focus
								scope:friend_saving_focus = flag:learning_theology_focus
							}
							learning >= decent_skill_rating
						}
						# making the default behavior explicit if no other trigger_(else_)ifs are valid
						trigger_else = {

As written in game/common/scripted_effects/00_lifestyle_focus_effects.txt.

The first 120 of its 189 lines; the rest is in game/common/scripted_effects/00_lifestyle_focus_effects.txt from line 29.

Where it is used

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

Events (7)

1 more

Source: game/common/scripted_effects/00_lifestyle_focus_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?