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

Scripted effect

had_sex_with_effect

had_sex_with_effect = { CHARACTER = … PREGNANCY_CHANCE = … }

game/common/scripted_effects/00_romance_effects.txt, line 361 (385 lines). Parameters: $CHARACTER$, $PREGNANCY_CHANCE$.

had_sex_with_effect is a scripted effect in Crusader Kings III, written at line 361 of its file. A call passes 2 parameters: CHARACTER and PREGNANCY_CHANCE. The game's script calls it in 124 places, among them apa_exchanging_race_commentary (activity pulse), … …: Grappling with Lust (event ep2_tournament_events.2005) and ... From My Friends (event imperial_examination.4030). Its body carries 3 texts of the game's own for the player. Patch 1.20.1.2, from game/common/scripted_effects/00_romance_effects.txt.

What it does

  • If

    • One of these

      • scope:had_sex_root_character: Is a child
      • or

        scope:had_sex_with_effect_partner: Is a child

    Then

    • error_log = Trying to run had_sex_with_effect but one or more partners is a child
  • If

    a check the game hides

    Then

    • If

      • scope:had_sex_root_character:

      Then

      • scope:had_sex_with_effect_partner › scope:had_sex_root_character:
        • error_log = had_sex_with_effect.log.root_cheated_inappropriately
    • If

      • scope:had_sex_with_effect_partner:

      Then

      • scope:had_sex_root_character › scope:had_sex_with_effect_partner:
        • error_log = had_sex_with_effect.log.target_cheated_inappropriately
  • clear_saved_scope = ignore_cheating_error_check
  • If

    a check the game hides

    Then

    • You lay with …

    Else if

    • root = scope:had_sex_with_effect_partner

    Then

    • Lays with …

    Otherwise

    • … lays with …
  • If

    a check the game hides

    Then

    • create_character_memory = { … }
  • If

    a check the game hides

    Then

    • $CHARACTER$ = { … }
    • If

      a check the game hides

      Then

      • Stress and fulfillment impact: by trait: Lustful -15, Rakish -15
  • If

    Then

    • scope:had_sex_root_character: Violet Poet experience changes
  • If

    Then

    • scope:had_sex_with_effect_partner: Violet Poet experience changes
  • fp2_had_friend_with_benefits = yes
  • ce3_papal_bull_check_effect = yes

• 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)
had_sex_with_effect = {
	save_scope_as = had_sex_root_character
	$CHARACTER$ = { save_scope_as = had_sex_with_effect_partner }

	# Error logging
	## Children should never run this effect.
	if = {
		limit = {
			OR = {
				scope:had_sex_root_character = { is_adult = no }
				scope:had_sex_with_effect_partner = { is_adult = no }
			}
		}
		error_log = "Trying to run had_sex_with_effect but one or more partners is a child"
	}
	## Did you forget to run the check for whether adultery was valid?
	if = {
		limit = {
			# Rarely, we may also want to block this check (e.g., seduction schemes or monogamous threesomes).
			NOT = { exists = scope:ignore_cheating_error_check }
		}
		# Check whether the root char is cheating.
		if = {
			limit = {
				scope:had_sex_root_character = {
					NOR = {
						is_consort_of = scope:had_sex_with_effect_partner
						has_relation_lover = scope:had_sex_with_effect_partner
					}
					might_cheat_on_every_partner_trigger = no
				}
			}
			# The weird structure here is so that we can use prev scope in loc to grab both chars.
			scope:had_sex_with_effect_partner = {
				scope:had_sex_root_character = { error_log = had_sex_with_effect.log.root_cheated_inappropriately }
			}
		}
		# Check whether their partner is cheating.
		## Though this does lead to potential duplication in the error log, where you'll get an entry for X cheating with Y _and_ for Y cheating with X, it is necessary: it's perfectly possible for one char to be cheating but the other not.
		if = {
			limit = {
				scope:had_sex_with_effect_partner = {
					NOR = {
						is_consort_of = scope:had_sex_root_character
						has_relation_lover = scope:had_sex_root_character
					}
					might_cheat_on_every_partner_trigger = no
				}
			}
			# The weird structure here is so that we can use prev scope in loc to grab both chars.
			scope:had_sex_root_character = {
				scope:had_sex_with_effect_partner = { error_log = had_sex_with_effect.log.target_cheated_inappropriately }
			}
		}
	}
	### Plus, remove the blocking scope we might have.
	clear_saved_scope = ignore_cheating_error_check

	if = {
		limit = { this = root }
		custom_tooltip = had_sex_with_effect.first_person.tt
	}
	else_if = {
		limit = { root = scope:had_sex_with_effect_partner }
		custom_tooltip = had_sex_with_effect.other_person.tt
	}
	else = {
		custom_tooltip = had_sex_with_effect.third_person.tt
	}

	if = {
		limit = {
			NOT = { exists = scope:no_sex_memory }
		}
		create_character_memory = {
			type = had_sex
			participants = {
				sex_partner = scope:had_sex_with_effect_partner
			}
		}
	}

	#Stress
	if = {
		limit = { # For use with events that add/remove more stress than these values, to avoid ugly tooltips
			NOT = {
				has_character_flag = no_sex_stress_loss
			}
		}
		$CHARACTER$ = {
			if = {
				limit = { this = root }
				stress_and_fulfillment_impact = {
					lustful = minor_stress_impact_loss
					rakish = minor_stress_impact_loss
				}
			}
			else = {
				hidden_effect = {
					stress_and_fulfillment_impact = {
						lustful = minor_stress_impact_loss
						rakish = minor_stress_impact_loss
					}
				}
			}
		}
		if = {
			limit = { this = root }
			stress_and_fulfillment_impact = {
				lustful = minor_stress_impact_loss
				rakish = minor_stress_impact_loss
			}
		}
		else = {
			hidden_effect = {
				stress_and_fulfillment_impact = {
					lustful = minor_stress_impact_loss
					rakish = minor_stress_impact_loss
				}
			}

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

The first 120 of its 385 lines; the rest is in game/common/scripted_effects/00_romance_effects.txt from line 361.

Where it is used

Every place in common/, events/ and history/ that calls had_sex_with_effect — the first 120 of 124.

Activity pulse actions (1)

  • apa_exchanging_race_commentary

Events (114)

108 more

Scripted effects inside an event file (4)

  • coronation_events_6030_choose_courtesan_effect
  • tour_grounds_1004_shag_effect
  • tour_grounds_events_6000_sex_effect
  • witch_3017_soulmate_sex_effect

Scripted effects (1)

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