namespace = DRAGONKIN

########################JOINING############################

#Back up event for showing interest
character_event = {
	id = DRAGONKIN.000
	hide_window = yes

	is_triggered_only = yes

	trigger = {
		is_in_society = no
		interested_in_society = dragonkin_society
	}

	immediate = {
		character_event = { id = DRAGONKIN.001 days = 90 random = 640 }
	}
}

character_event = {
	id = DRAGONKIN.001
	hide_window = yes

	is_triggered_only = yes

	trigger = {
		is_in_society = no
		interested_in_society = dragonkin_society
	}

	immediate = {
		if = {
			# if not allowed into the society, call the event again later
			limit =
			{
				OR = {
					is_adult = no
					NOT = { intrigue = 10 }
					prisoner = yes
				}
			}
			# if induced into society as a kid then stat pool towards eligibility
			if = {
				limit = {
					is_adult = yes
					has_character_flag = dragonkin_society_inducted_into_society
					NOT = { intrigue = 10 }
				}
				random_list = {
					100 = {
						trigger = {
							diplomacy = 4
						}
						character_event = { id = DRAGONKIN.700 }
					}
					100 = {
						trigger = {
							martial = 4
						}
						character_event = { id = DRAGONKIN.710 }
					}
					100 = {
						trigger = {
							stewardship = 4
						}
						character_event = { id = DRAGONKIN.720 }
					}
					100 = {
						trigger = {
							learning = 4
						}
						character_event = { id = DRAGONKIN.730 }
					}
					100 = {
						trigger = {
							trait = kind
						}
						character_event = { id = DRAGONKIN.750 }
					}
					100 = {
						trigger = {
							trait = wroth
						}
						character_event = { id = DRAGONKIN.760 }
					}
					100 = {
						trigger = {
							trait = content
						}
						character_event = { id = DRAGONKIN.770 }
					}
					100 = {
						trigger = {
							trait = honest
						}
						character_event = { id = DRAGONKIN.780 }
					}
					100 = {
						trigger = {
							trait = trusting
						}
						character_event = { id = DRAGONKIN.790 }
					}
					1 = {
						character_event = { id = DRAGONKIN.740 }
					}
				}
			}
			repeat_event = { id = DRAGONKIN.001 days = 90 random = 180 }
			break = yes
		}
		random_society_member = {
			limit = {
				society_member_of = dragonkin_society
				is_society_grandmaster = no
			}
			character_event = { id = DRAGONKIN.101 }
		}
	}
}

# Fired from on_character_leave_society (meant to clear any society related flags and effects)
character_event = {
    id = DRAGONKIN.002
    is_triggered_only = yes
    hide_window = yes
    
    immediate = {
		clr_character_flag = dragonkin_society_inducted_into_society
		clr_character_flag = dragonkin_society_decipher_secrets_deceit
		clr_character_flag = dragonkin_society_decipher_secrets_potion
		clr_character_flag = dragonkin_society_decipher_secrets_tryhard
		clr_character_flag = dragonkin_society_decipher_secrets_bully
		clr_character_flag = dragonkin_society_decipher_secrets_distraction
		clr_character_flag = becoming_dragon
		clr_character_flag = choosing_warrior_training
		clr_character_flag = gaining_dragonheart
		clr_character_flag = burning_dragon_incense
		remove_character_modifier = induct_into_society_cooldown_timer
		remove_character_modifier = resist_evil_decision_cooldown_timer
		remove_character_modifier = artefact_hunt_decision_cooldown_timer
		remove_character_modifier = avoid_disease_cooldown_timer
    }
}

#From on_character_ask_to_join_society
character_event = {
    id = DRAGONKIN.100
	hide_window = yes
    is_triggered_only = yes
    trigger = {
    	FROM = { leader = { society_member_of = dragonkin_society } }
    }
    immediate = {
    	FROM = { leader = { character_event = { id = DRAGONKIN.101 } } } #target is the leader of the society
    }
}

#Ping event
character_event = {
    id = DRAGONKIN.101
	hide_window = yes
    is_triggered_only = yes
    immediate = {
    	FROM = { letter_event = { id = DRAGONKIN.102 } } #send event back 
    }
}

#Welcome letter
letter_event = {
    id = DRAGONKIN.102
    desc = EVTDESC_DRAGONKIN_102
    border = GFX_event_letter_frame_intrigue
	
    is_triggered_only = yes

    option = { #join the society
        name = EVTOPTA_DRAGONKIN_102
		join_society = dragonkin_society
		clr_character_flag = dragonkin_society_inducted_into_society # no longer needed once in
		if = {
			limit = { ai = yes }
			clr_character_flag = society_join_block
		}
    }
    option = { #don't
        name = EVTOPTB_DRAGONKIN_102
		set_interested_society = none
		ai_chance = { factor = 0 }
    }
}

########################AI JOIN AND AI RANK UP###########################

character_event = { #force the AI to join a society
	id = DRAGONKIN.110
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		if = {
			limit = { #if he's already a member, will force a rank up 25% of the time
				ai = yes
				prisoner = no
				NOT = { trait = incapable }
				society_member_of = dragonkin_society
				society_rank <= 3
				society_can_rank_up = yes
			}
			random_list = {
				75 = {}
				25 = {
					society_rank_up = 1					
				}
			}
		}
		any_courtier = {  #if you want courtier in the society enable this part
			limit = {
				ai = yes
				prisoner = no
				NOT = { trait = incapable }
				is_adult = yes
				is_in_society = no
				controls_religion = no
				block_general_event_trigger = no
			}
			character_event = { id = DRAGONKIN.111 }
		}
		if = { #force the joining event on AI
			limit = {
				ai = yes
				prisoner = no
				NOT = { trait = incapable }
				is_adult = yes
				is_in_society = no
				controls_religion = no
				block_general_event_trigger = no
			}
			character_event = { id = DRAGONKIN.111 }
		}
	}
}

character_event = { #AI join event
	id = DRAGONKIN.111
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		random_list = {
			90 = { # do nothing
			}
			10 = { # try to join a society 10% of the time
				trigger = { #meet the requirement
					can_join_society = dragonkin_society
				}
				modifier = {
					factor = 12
					culture = dragon_culture
				}
				modifier = { #things that will make that 10% of the time bigger, can be anything 
					factor = 2
					prestige = 200
				}
				join_society = dragonkin_society #join the society
				if = { # Make grandmaster if there is none
					limit = {
						NOT = {
							society = {
								any_society_member = {
									is_society_grandmaster = yes
								}
							}
						}
					}
					set_society_grandmaster = yes
				}
			}
		}
	}
}

#################################MISSIONS######################################

#Mission tombola, this is where an hidden event choose a quest. I have made only one quest, do look for other mission tombola in the vanilla files for more example.
character_event = {
    id = DRAGONKIN.120
    hide_window = yes

    is_triggered_only = yes
    
	is_in_society = yes

	trigger = {
		society_member_of = dragonkin_society
		has_any_quest = no #cannot have more than 1 shown
		NOT = { has_character_modifier = quest_cooldown_timer } #to avoid spam and delay it for people who refused a quest.
		NOT = { is_inaccessible_trigger = yes }
		prisoner = no
		society = { #look if there is a close member to give you the quest
			any_society_member = {
				NOT = { character = ROOT }
				prisoner = no
				is_within_diplo_range = ROOT
				opinion = { who = ROOT value = 0 }
			}
		}
	}

    immediate = {
    	#Picks out mission giver
    	random_list = {
    		20 = { #International society member
    			society = {
    				random_society_member = {
    					limit = { 	
							NOT = { character = ROOT }
							prisoner = no
    						is_within_diplo_range = ROOT
							opinion = { who = ROOT value = 0 }
    					}
    					save_event_target_as = quest_collaborator
    				}
    			}
    		}
    		40 = { #Realm society member is there is any
    			trigger = {
    				society = {
    					any_society_member = {
    						NOT = { character = ROOT }
    						prisoner = no
    						is_within_diplo_range = ROOT
							opinion = { who = ROOT value = 0 }
							same_realm = ROOT
    					}
    				}
    			}
    			society = {
    				random_society_member = {
    					limit = { 	
    						NOT = { character = ROOT }
    						prisoner = no
    						is_within_diplo_range = ROOT
							opinion = { who = ROOT value = 0 }
							same_realm = ROOT
    					}
    					save_event_target_as = quest_collaborator
    				}
    			}
    		}
    	}

    	#Randomizes mission
    	random_list = {
			1 = { # true form
				trigger = {
					society_rank >= 3
					NOT = { has_character_flag = becoming_dragon }
					NOT = { culture = dragon_culture }
				}
				event_target:quest_collaborator = {
					character_event = { id = DRAGONKIN.170 }
				}
			}
			5 = { # resist evil, rare unless necessary
				modifier = {
					factor = 0
					society_rank >= 3
					NOT = { has_character_flag = becoming_dragon }
					NOT = { culture = dragon_culture }
				}
				modifier = {
					factor = 20
					OR = {
						trait = craven
						trait = paranoid
						trait = possessed
						trait = lunatic
						trait = cannibal
						trait = depressed
						trait = stressed
					}
				}
				event_target:quest_collaborator = {
					character_event = { id = DRAGONKIN.140 }
				}
			}
			150 = { # amass wealth
				trigger = {
					is_playable = yes
					OR = {
						is_patrician = yes
						is_landed = yes
					}
					NOT = {
						wealth = 200
					}
				}
				modifier = {
					factor = 0
					society_rank >= 3
					NOT = { has_character_flag = becoming_dragon }
					NOT = { culture = dragon_culture }
				}
				event_target:quest_collaborator = {
					character_event = { id = DRAGONKIN.150 }
				}
			}
			100 = { # lose weak focus
				trigger = {
					has_dlc = "Way of Life"
					OR = {
						is_patrician = yes
						is_landed = yes
					}
					NOR = {
						has_focus = focus_intrigue
						has_focus = focus_scholarship
					}
				}
				modifier = {
					factor = 0
					society_rank >= 3
					NOT = { has_character_flag = becoming_dragon }
					NOT = { culture = dragon_culture }
				}
				event_target:quest_collaborator = {
					character_event = { id = DRAGONKIN.160 }
				}
			}
			100 = { # induct child
				trigger = {
					NOT = { has_character_modifier = induct_into_society_cooldown_timer }
					any_close_relative = {
	        			is_grandchild_of = PREV
	        			is_in_society = no
	        			is_alive = yes
	        			age = 6
					    prisoner = no
	        			NOT = { has_character_flag = dragonkin_society_inducted_into_society }
	        		}
				}
				modifier = {
					factor = 0
					society_rank >= 3
					NOT = { has_character_flag = becoming_dragon }
					NOT = { culture = dragon_culture }
				}
				event_target:quest_collaborator = {
					character_event = { id = DRAGONKIN.130 }
				}
			}
			50 = { # decipher secrets
				modifier = {
					factor = 0
					society_rank >= 3
					NOT = { has_character_flag = becoming_dragon }
					NOT = { culture = dragon_culture }
				}
				event_target:quest_collaborator = {
					character_event = { id = DRAGONKIN.200 }
				}
			}
			100 = { #AI 
				trigger = {
					ai = yes
				}
				modifier = {
					factor = 0
					society_rank >= 3
					NOT = { has_character_flag = becoming_dragon }
					NOT = { culture = dragon_culture }
				}
			}
    	}
    }
}

character_event = {
    id = DRAGONKIN.130
    hide_window = yes #instant event, no need to show it
    is_triggered_only = yes
    immediate = { FROM = { society_quest_event = { id = DRAGONKIN.131 days = 7 random = 7 } } }
}

society_quest_event = {
    id = DRAGONKIN.131
    desc = EVTDESC_DRAGONKIN_131

    is_triggered_only = yes
   
    option = { 
		name = ACCEPT
		set_quest = quest_dragonkin_society_induct_child
	}

	option = {
		name = DECLINE
		custom_tooltip = { text = decline_quest_tooltip }

		add_character_modifier = { #will delay the next quest for a while
			name = quest_cooldown_timer
			hidden = yes
			days = 1000
		}

		ai_chance = { factor = 0 }
	}
}

#send to grandmaster for Ping
character_event = {
	id = DRAGONKIN.132
	is_triggered_only = yes
	hide_window = yes

	immediate = {
		random_society_member = {
			limit = {
				same_society_as = ROOT
				is_society_grandmaster = yes
			}
			character_event = {
				id = DRAGONKIN.133
			}
		}
	}
}

#Ping
character_event = {
	id = DRAGONKIN.133
	is_triggered_only = yes
	hide_window = yes

	immediate = {
		FROM = {
			letter_event = {
				id = DRAGONKIN.134
			}
		}
	}
}

letter_event = {
	id = DRAGONKIN.134
	desc = EVTDESC_DRAGONKIN_134
	border = GFX_event_letter_frame_intrigue

	is_triggered_only = yes

	option = {
		name = EVTOPTA_DRAGONKIN_134
		
		clr_quest = quest_dragonkin_society_induct_child
		sound_effect = time_forward
		add_society_currency_minor_effect = yes
	}
}

#This is the quest_collaborator receiving the mission and giving it back to you.
character_event = {
    id = DRAGONKIN.140
    hide_window = yes #instant event, no need to show it
    is_triggered_only = yes
    immediate = { FROM = { society_quest_event = { id = DRAGONKIN.141 days = 7 random = 7 } } }
}

#This event is set as a society_quest_event, not character_event. This is the accept or refuse the quest event, the next parts of the quest use the regular character_event.
society_quest_event = {
    id = DRAGONKIN.141
    desc = EVTDESC_DRAGONKIN_141

    is_triggered_only = yes
   
    option = {
		name = ACCEPT

		hidden_tooltip = {
			if = {
				limit = { has_character_modifier = resist_evil_decision_cooldown_timer }
				remove_character_modifier = resist_evil_decision_cooldown_timer
			}
		}
		
		set_quest = quest_dragonkin_society_resist_evil
	}

	option = {
		name = DECLINE
		custom_tooltip = { text = decline_quest_tooltip }

		add_character_modifier = { #will delay the next quest for a while
			name = quest_cooldown_timer
			hidden = yes
			days = 1000
		}

		ai_chance = { factor = 0 }
	}
}

#send to grandmaster for Ping
character_event = {
	id = DRAGONKIN.142
	is_triggered_only = yes
	hide_window = yes

	immediate = {
		random_society_member = {
			limit = {
				same_society_as = ROOT
				is_society_grandmaster = yes
			}
			character_event = {
				id = DRAGONKIN.143
			}
		}
	}
}

#Ping
character_event = {
	id = DRAGONKIN.143
	is_triggered_only = yes
	hide_window = yes

	immediate = {
		FROM = {
			letter_event = {
				id = DRAGONKIN.144
			}
		}
	}
}

letter_event = {
	id = DRAGONKIN.144
	desc = EVTDESC_DRAGONKIN_144
	border = GFX_event_letter_frame_intrigue

	is_triggered_only = yes

	option = {
		name = EVTOPTA_DRAGONKIN_144
		
		clr_quest = quest_dragonkin_society_resist_evil
		sound_effect = time_forward
		add_society_currency_minor_effect = yes
	}
}

#MISSION: Amass Wealth
#This is the quest_collaborator receiving the mission and giving it back to you.
character_event = {
    id = DRAGONKIN.150
    hide_window = yes #instant event, no need to show it
    is_triggered_only = yes
    immediate = { FROM = { society_quest_event = { id = DRAGONKIN.151 days = 7 random = 7 } } }
}

#This event is set as a society_quest_event, not character_event. This is the accept or refuse the quest event, the next parts of the quest use the regular character_event.
society_quest_event = {
    id = DRAGONKIN.151
    desc = EVTDESC_DRAGONKIN_151

    is_triggered_only = yes
   
    option = { 
		name = ACCEPT
		set_quest = quest_dragonkin_society_amass_wealth
	}

	option = {
		name = DECLINE
		custom_tooltip = { text = decline_quest_tooltip }

		add_character_modifier = { #will delay the next quest for a while
			name = quest_cooldown_timer
			hidden = yes
			days = 1000
		}

		ai_chance = { factor = 0 }
	}
}

character_event = {
    id = DRAGONKIN.152
    desc = EVTDESC_DRAGONKIN_152
    picture = GFX_evt_castle_garden
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes

    option = { #Quest will success
        name = EVTOPTA_DRAGONKIN_152
		
		if = { 
			limit = { NOT = { trait = charitable } }
			if = {
				limit = { trait = greedy }
				change_stewardship = 1
			}
			if = {
				limit = { NOT = { trait = greedy } }
				add_trait = greedy
			}
		}
		if = {
			limit = { trait = charitable } 
			remove_trait = charitable
		}
		
		clr_quest = quest_dragonkin_society_amass_wealth
		sound_effect = time_forward
		add_society_currency_minor_effect = yes
    }
}

#MISSION: Intrigue focus
#This is the quest_collaborator receiving the mission and giving it back to you.
character_event = {
    id = DRAGONKIN.160
    hide_window = yes #instant event, no need to show it
    is_triggered_only = yes
    immediate = { FROM = { society_quest_event = { id = DRAGONKIN.161 days = 7 random = 7 } } }
}

society_quest_event = {
	id = DRAGONKIN.161
	desc = EVTDESC_DRAGONKIN_161
	picture = GFX_evt_secluded_in_prayer
	border = GFX_event_letter_frame_religion

	is_triggered_only = yes

	trigger = {
		NOR = {
			has_focus = focus_intrigue
			has_any_quest = yes
		}
	}

	option = {
		name = ACCEPT
		set_quest = quest_dragonkin_society_intrigue_focus
	}

	option = {
		name = DECLINE
		custom_tooltip = { text = decline_quest_tooltip }

		add_character_modifier = {
			name = quest_cooldown_timer
			hidden = yes
			days = 1000
		}

		ai_chance = { factor = 0 }
	}
}

#send to grandmaster for Ping
character_event = {
	id = DRAGONKIN.162
	is_triggered_only = yes
	hide_window = yes

	immediate = {
		random_society_member = {
			limit = {
				same_society_as = ROOT
				is_society_grandmaster = yes
			}
			character_event = {
				id = DRAGONKIN.163
			}
		}
	}
}

#Ping
character_event = {
	id = DRAGONKIN.163
	is_triggered_only = yes
	hide_window = yes

	immediate = {
		FROM = {
			letter_event = {
				id = DRAGONKIN.164
			}
		}
	}
}

letter_event = {
	id = DRAGONKIN.164
	desc = EVTDESC_DRAGONKIN_164
	border = GFX_event_letter_frame_intrigue

	is_triggered_only = yes

	option = {
		name = EVTOPTA_DRAGONKIN_164
		
		clr_quest = quest_dragonkin_society_intrigue_focus
		sound_effect = time_forward
		add_society_currency_minor_effect = yes
	}
}

#MISSION: Embrace True Form
#This is the quest_collaborator receiving the mission and giving it back to you.
character_event = {
    id = DRAGONKIN.170
    hide_window = yes #instant event, no need to show it
    is_triggered_only = yes
    immediate = { FROM = { society_quest_event = { id = DRAGONKIN.171 days = 7 random = 7 } } }
}

#This event is set as a society_quest_event, not character_event. This is the accept or refuse the quest event, the next parts of the quest use the regular character_event.
society_quest_event = {
    id = DRAGONKIN.171
    desc = EVTDESC_DRAGONKIN_171

    is_triggered_only = yes
   
    option = { 
		name = ACCEPT
		set_quest = quest_dragonkin_society_become_dragon
	}

	option = {
		name = DECLINE
		custom_tooltip = { text = decline_quest_tooltip }

		add_character_modifier = { #will delay the next quest for a while
			name = quest_cooldown_timer
			hidden = yes
			days = 1000
		}

		ai_chance = { factor = 0 }
	}
}

#MISSION: Decipher Secrets
#This is the quest_collaborator receiving the mission and giving it back to you.
character_event = {
    id = DRAGONKIN.200
    hide_window = yes #instant event, no need to show it
    is_triggered_only = yes
    immediate = { FROM = { society_quest_event = { id = DRAGONKIN.201 days = 7 random = 7 } } }
}

society_quest_event = {
    id = DRAGONKIN.201
    desc = EVTDESC_DRAGONKIN_201

    is_triggered_only = yes
   
    option = { 
		name = ACCEPT
		set_quest = quest_dragonkin_society_decipher_secrets
		hidden_tooltip = {
			set_variable = { which = dragonkin_decipher_secrets_points value = 0 }
			character_event = { id = DRAGONKIN.202 days = 40 random = 30 } 
		}
	}

	option = {
		name = DECLINE
		custom_tooltip = { text = decline_quest_tooltip }

		add_character_modifier = { #will delay the next quest for a while
			name = quest_cooldown_timer
			hidden = yes
			days = 1000
		}

		ai_chance = { factor = 0 }
	}
}

#Tombola & outcome evaluator for decipher secrets
character_event = {
	id = DRAGONKIN.202
	hide_window = yes

	is_triggered_only = yes

	#trigger = {
	#	society_member_of = dragonkin_society
	#	has_quest = quest_dragonkin_society_decipher_secrets
	#}

	immediate = {
		if = {
			limit = {
				OR = {
					NOT = { society_member_of = dragonkin_society }
					NOT = { has_quest = quest_dragonkin_society_decipher_secrets }
				}
			}
			character_event = { id = DRAGONKIN.211 }
			break = yes
		}
		if = {
			limit = { 
				has_quest = quest_dragonkin_society_decipher_secrets
			}
			if = {
				limit = { 
					NOR = {
						check_variable = { which = dragonkin_decipher_secrets_points value = 4 } 
						NOT = { check_variable = { which = dragonkin_decipher_secrets_points value = -2 } }
					}
				}
				random_list = { #Next mission
					25 = { #potion
						modifier = {
							factor = 0
							has_character_flag = dragonkin_society_decipher_secrets_potion
						}
						set_character_flag = dragonkin_society_decipher_secrets_potion
						character_event = { id = DRAGONKIN.203 }
					}
					25 = { #tryhard
						modifier = {
							factor = 0
							has_character_flag = dragonkin_society_decipher_secrets_tryhard
						}
						set_character_flag = dragonkin_society_decipher_secrets_tryhard
						character_event = { id = DRAGONKIN.204 }
					}
					25 = { #bully
						modifier = {
							factor = 0
							has_character_flag = dragonkin_society_decipher_secrets_bully
						}
						set_character_flag = dragonkin_society_decipher_secrets_bully
						character_event = { id = DRAGONKIN.205 }
					}
					25 = { #distraction
						modifier = {
							factor = 0
							has_character_flag = dragonkin_society_decipher_secrets_distraction
						}
						set_character_flag = dragonkin_society_decipher_secrets_distraction
						character_event = { id = DRAGONKIN.206 }
					}
					25 = { #deceit
						modifier = {
							factor = 0
							has_character_flag = dragonkin_society_decipher_secrets_deceit
						}
						set_character_flag = dragonkin_society_decipher_secrets_deceit
						character_event = { id = DRAGONKIN.212 }
					}
					10 = { #General success
						modifier = {
							is_virtous = yes
							factor = 1.5
						}
						modifier = {
							is_wicked = yes
							factor = 0.7
						}
						modifier = {
							is_learned_trigger = yes
							factor = 1.5
						}
						character_event = { id = DRAGONKIN.207 }
					}
					20 = { #If all missions have been done already....
						modifier = {
							factor = 0
							NAND = {
								has_character_flag = dragonkin_society_decipher_secrets_deceit
								has_character_flag = dragonkin_society_decipher_secrets_potion
								has_character_flag = dragonkin_society_decipher_secrets_tryhard
								has_character_flag = dragonkin_society_decipher_secrets_bully
								has_character_flag = dragonkin_society_decipher_secrets_distraction
							}
						}
						clr_character_flag = dragonkin_society_decipher_secrets_deceit
						clr_character_flag = dragonkin_society_decipher_secrets_potion
						clr_character_flag = dragonkin_society_decipher_secrets_tryhard
						clr_character_flag = dragonkin_society_decipher_secrets_bully
						clr_character_flag = dragonkin_society_decipher_secrets_distraction
					}
				}
				character_event = { id = DRAGONKIN.202 days = 40 random = 30 } #Sends the tombola again
			}
			if = {
				limit = { 
					OR = {
						check_variable = { which = dragonkin_decipher_secrets_points value = 4 } 
						NOT = { check_variable = { which = dragonkin_decipher_secrets_points value = -2 } }
					}
				} 

				random_society_member = {
					limit = {
						is_society_grandmaster = yes
						same_society_as = ROOT
					}
					character_event = { id = DRAGONKIN.208 } #Mission success/fail
				}
			}
		}
	}
}

character_event = {
    id = DRAGONKIN.203
    desc = EVTDESC_DRAGONKIN_203
    picture = GFX_evt_scientist
    border = GFX_event_normal_frame_religion
	hide_from = yes

    is_triggered_only = yes

    option = {
        name = EVTOPTA_DRAGONKIN_203
		
		add_trait = vomiting
		set_character_flag = disease_not_serious
		hidden_effect = { character_event = { id = HFP.14005 days = 10 random = 30 } } #remove vomiting
		
		custom_tooltip = {
			text = dragonkin_decipher_success_tooltip
			change_variable = { which = dragonkin_decipher_secrets_points value = 1 }
		}
    }
    option = {
        name = EVTOPTB_DRAGONKIN_203
		
		custom_tooltip = {
			text = dragonkin_decipher_setback_tooltip
			change_variable = { which = dragonkin_decipher_secrets_points value = -1 }
		}
    }
}

character_event = {
    id = DRAGONKIN.204
    desc = EVTDESC_DRAGONKIN_204
    picture = GFX_evt_ritual_scroll
    border = GFX_event_normal_frame_religion
	hide_from = yes

    is_triggered_only = yes

    option = {
        name = EVTOPTA_DRAGONKIN_204
		
		random_list = {
			50 = {
				modifier = {
					is_smart_trigger = yes
					factor = 1.4
				}
				modifier = {
					learning = 14
					factor = 1.4
				}
				modifier = {
					learning = 16
					factor = 1.4
				}
				modifier = {
					is_learned_trigger = yes
					factor = 2
				}
				custom_tooltip = {
					text = dragonkin_decipher_success_tooltip
					change_variable = { which = dragonkin_decipher_secrets_points value = 1 }
				}
			}
			50 = {
				modifier = {
					is_dumb_trigger = yes
					factor = 1.5
				}
				modifier = {
					NOT = { learning = 8 }
					factor = 1.5
				}
				custom_tooltip = {
					text = dragonkin_decipher_setback_tooltip
					change_variable = { which = dragonkin_decipher_secrets_points value = -1 }
				}
			}
		}
    }
    option = {
        name = EVTOPTB_DRAGONKIN_204
		trigger = {
			trait = stressed
		}
		tooltip_info = stressed
		random = {
			chance = 70
			remove_trait = stressed
		}
		
		custom_tooltip = {
			text = dragonkin_decipher_setback_tooltip
			change_variable = { which = dragonkin_decipher_secrets_points value = -1 }
		}
    }
}

character_event = {
    id = DRAGONKIN.205
    desc = EVTDESC_DRAGONKIN_205
    picture = GFX_evt_child_bully
    border = GFX_event_normal_frame_diplomacy
	hide_from = yes

    is_triggered_only = yes

    option = {
        name = EVTOPTA_DRAGONKIN_205
		
		if = {
			limit = { trait = kind }
			if = {
				limit = { diplomacy = 13 }
				random = {
					chance = 30
					change_diplomacy = 1
				}
			}
			if = {
				limit = { NOT = { diplomacy = 13 } }
				change_diplomacy = 1
			}
		}
		if = {
			limit = { NOT = { trait = kind } }
			add_trait = kind
			hidden_tooltip = {
				remove_trait = wroth
			}
		}
		
		custom_tooltip = {
			text = dragonkin_decipher_failure_tooltip
			change_variable = { which = dragonkin_decipher_secrets_points value = -3 }
		}
    }
    option = {
        name = EVTOPTB_DRAGONKIN_205
		custom_tooltip = {
			text = dragonkin_decipher_success_tooltip
			change_variable = { which = dragonkin_decipher_secrets_points value = 1 }
		}
    }
}

character_event = {
    id = DRAGONKIN.206
    desc = EVTDESC_DRAGONKIN_206
    picture = GFX_evt_book_carolingian_script
    border = GFX_event_normal_frame_religion
	hide_from = yes

    is_triggered_only = yes

    option = {
        name = EVTOPTA_DRAGONKIN_206
		
		if = {
			limit = { trait = erudite }
			if = {
				limit = { learning = 13 }
				random = {
					chance = 30
					change_learning = 1
				}
			}
			if = {
				limit = { NOT = { learning = 13 } }
				change_learning = 1
			}
		}
		if = {
			limit = { NOT = { trait = erudite } }
			add_trait = erudite
		}
		
		custom_tooltip = {
			text = dragonkin_decipher_failure_tooltip
			change_variable = { which = dragonkin_decipher_secrets_points value = -3 }
		}
    }
    option = {
        name = EVTOPTB_DRAGONKIN_206
		custom_tooltip = {
			text = dragonkin_decipher_success_tooltip
			change_variable = { which = dragonkin_decipher_secrets_points value = 1 }
		}
    }
}

character_event = {
    id = DRAGONKIN.207
    desc = EVTDESC_DRAGONKIN_207
    picture = GFX_evt_ritual_scroll
    border = GFX_event_normal_frame_religion
	hide_from = yes

    is_triggered_only = yes

    option = {
        name = EVTOPTA_DRAGONKIN_207
		custom_tooltip = {
			text = dragonkin_decipher_success_tooltip
			change_variable = { which = dragonkin_decipher_secrets_points value = 1 }
		}
    }
}

character_event = {
	id = DRAGONKIN.208
	hide_window = yes

	is_triggered_only = yes

	immediate = {
		if = {
			limit = { FROM = { check_variable = { which = dragonkin_decipher_secrets_points value = 4 } } }
			FROM = { letter_event = { id = DRAGONKIN.209 } }
		}
		if = {
			limit = { FROM = { NOT = { check_variable = { which = dragonkin_decipher_secrets_points value = -2 } } } }
			FROM = { letter_event = { id = DRAGONKIN.210 } }
		}
	}
}

letter_event = {
	id = DRAGONKIN.209
	desc = EVTDESC_DRAGONKIN_209
	border = GFX_event_letter_frame_religion

	is_triggered_only = yes

	option = {
		name = EVTOPTA_DRAGONKIN_209
		
		clr_quest = quest_dragonkin_society_decipher_secrets
		sound_effect = time_forward
		add_society_currency_medium_effect = yes
		
		hidden_tooltip = {
			clr_character_flag = dragonkin_society_decipher_secrets_deceit
			clr_character_flag = dragonkin_society_decipher_secrets_potion
			clr_character_flag = dragonkin_society_decipher_secrets_tryhard
			clr_character_flag = dragonkin_society_decipher_secrets_bully
			clr_character_flag = dragonkin_society_decipher_secrets_distraction
		}
	}
}

letter_event = {
	id = DRAGONKIN.210
	desc = EVTDESC_DRAGONKIN_210
	border = GFX_event_letter_frame_religion

	is_triggered_only = yes

	option = {
		name = EVTOPTA_DRAGONKIN_210
		
		clr_quest = { id = quest_dragonkin_society_decipher_secrets failure = yes }
		
		hidden_tooltip = {
			clr_character_flag = dragonkin_society_decipher_secrets_deceit
			clr_character_flag = dragonkin_society_decipher_secrets_potion
			clr_character_flag = dragonkin_society_decipher_secrets_tryhard
			clr_character_flag = dragonkin_society_decipher_secrets_bully
			clr_character_flag = dragonkin_society_decipher_secrets_distraction
		}
	}
}

character_event = {
    id = DRAGONKIN.211
    picture = GFX_evt_ritual_scroll
    border = GFX_event_normal_frame_learning

    is_triggered_only = yes
    
    desc = EVTDESC_DRAGONKIN_211

    option = {
        name = EVTOPTA_DRAGONKIN_211
    }
}

character_event = {
    id = DRAGONKIN.212
    desc = EVTDESC_DRAGONKIN_212
    picture = GFX_evt_book_shadowy_cabal
    border = GFX_event_normal_frame_intrigue
	hide_from = yes

    is_triggered_only = yes

    option = {
        name = EVTOPTA_DRAGONKIN_212
		
		if = {
			limit = { trait = deceitful }
			if = {
				limit = { intrigue = 16 }
				random = {
					chance = 30
					change_intrigue = 1
				}
			}
			if = {
				limit = { NOT = { intrigue = 16 } }
				change_intrigue = 1
			}
		}
		if = {
			limit = { NOT = { trait = deceitful } }
			add_trait = deceitful
		}
		
		custom_tooltip = {
			text = dragonkin_decipher_failure_tooltip
			change_variable = { which = dragonkin_decipher_secrets_points value = -3 }
		}
    }
    option = {
        name = EVTOPTB_DRAGONKIN_212
		custom_tooltip = {
			text = dragonkin_decipher_success_tooltip
			change_variable = { which = dragonkin_decipher_secrets_points value = 1 }
		}
    }
}

#################################POWERS######################################
 
# Way of the Dragon
character_event = {
    id = DRAGONKIN.221
    picture = GFX_evt_ritual_scroll
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    
    desc = EVTDESC_DRAGONKIN_221

    option = { #Finally!
        name = EVTOPTA_DRAGONKIN_221
        add_trait = master_of_flame
        clr_character_flag = choosing_warrior_training
    }
}

# Dragonheart
character_event = {
    id = DRAGONKIN.222
    picture = GFX_evt_ritual_scroll
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    
    desc = EVTDESC_DRAGONKIN_222

    option = { #Finally!
        name = EVTOPTA_DRAGONKIN_222
        add_character_modifier = 
		{
			name = dragonkin_dragonheart
			duration = -1
		}
        clr_character_flag = gaining_dragonheart
    }
}

# Become Dragon
character_event = {
	id = DRAGONKIN.220
	hide_window = yes

	is_triggered_only = yes

	immediate = {
		if = {
			limit = {
				any_demesne_province = { NOT = { culture = dragon_culture } }
			}
			character_event = { id = DRAGONKIN.223 }
		}
		if = {
			limit = {
				NOT = { any_demesne_province = { NOT = { culture = dragon_culture } } }
			}
			character_event = { id = DRAGONKIN.224 }
		}
	}
}

character_event = {
    id = DRAGONKIN.223
    picture = GFX_evt_scandal
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    
    desc = EVTDESC_DRAGONKIN_223

    option = { # convince everyone
        name = EVTOPTA_DRAGONKIN_223
		tooltip_info = diplomacy
		trigger = {
			diplomacy = 20
		}
		character_event = { id = DRAGONKIN.224 days = 7 random = 7 }
		ai_chance = {
			factor = 100
		}
    }
    option = { # hire more guards to keep the peace
        name = EVTOPTB_DRAGONKIN_223
		scaled_wealth = { value = -2 min = 200 }
		character_event = { id = DRAGONKIN.224 days = 7 random = 7 }
    }
    option = { # all non-dragon demesne counties get penalty
        name = EVTOPTC_DRAGONKIN_223
		any_demesne_province = {
			limit = {
				NOT = { culture = dragon_culture }
			}
			add_province_modifier = {
				name = peasant_unrest
				years = 10
			}
		}
		character_event = { id = DRAGONKIN.224 days = 7 random = 7 }
    }
    option = { # chicken out
        name = EVTOPTD_DRAGONKIN_223
		ai_chance = {
			factor = 0
		}
		if = {
			limit = { has_quest = quest_dragonkin_society_become_dragon }
			clr_quest = { id = quest_dragonkin_society_become_dragon failure = yes }
		}
        clr_character_flag = becoming_dragon
		detract_society_currency_medium_effect = yes
    }
}

character_event = {
    id = DRAGONKIN.224
    picture = GFX_evt_scandal
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    
    desc = EVTDESC_DRAGONKIN_224

    option = { #Finally!
        name = EVTOPTA_DRAGONKIN_224
		culture = dragon_culture
		if = {
			limit = { has_quest = quest_dragonkin_society_become_dragon }
			clr_quest = quest_dragonkin_society_become_dragon
			sound_effect = time_forward
			add_society_currency_minor_effect = yes
		}
		hidden_tooltip = {
			set_graphical_culture = dragon_culture
		}
        clr_character_flag = becoming_dragon
    }
}

#POWER: Culture Convert County
#Notification for ruler who performs the power
character_event = {
    id = DRAGONKIN.230
	picture = GFX_evt_burning_castle_hf
	desc = EVTDESC_DRAGONKIN230
	border = GFX_event_normal_frame_intrigue
	
	is_triggered_only = yes
	
	notification = yes
	
	option = {
		name = EXCELLENT
	}
}

#Notification event for county owner if different from user
character_event = {
    id = DRAGONKIN.231
	picture = GFX_evt_burning_castle_hf
	desc = EVTDESC_DRAGONKIN231
	border = GFX_event_normal_frame_intrigue
	
	is_triggered_only = yes
	
	option = {
		name = INTERESTING
	}
}

# POWER: Hidden Vault
character_event = {
    id = DRAGONKIN.240
    picture = GFX_evt_treasure_chamber
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    
    desc = EVTDESC_DRAGONKIN_240

    option = {
        name = EXCELLENT
    }
}

# POWER: Resist Evil
character_event = {
    id = DRAGONKIN.250
    picture = GFX_evt_secluded_in_prayer
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    
    desc = EVTDESC_DRAGONKIN_250

    option = {
        name = EVTOPTA_DRAGONKIN_250
		piety = 20
		add_character_modifier = {
			name = in_meditation
			duration = -1
		}
		character_event = { id = DRAGONKIN.251 days = 14 random = 30 }
    }
}

character_event = { # logic event for the resist
    id = DRAGONKIN.251
    hide_window = yes
    is_triggered_only = yes
	
	immediate = {
		if = {
			limit = { has_character_modifier = in_meditation }
			character_event = { id = DRAGONKIN.252 }
		}
		if = {
			limit = {
				NOT = { has_character_modifier = in_meditation }
				has_quest = quest_dragonkin_society_resist_evil
			}
			character_event = { id = DRAGONKIN.253 }
		}
	}
}

character_event = { # choose something to purge
    id = DRAGONKIN.252
    picture = GFX_evt_secluded_in_prayer
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    
    desc = EVTDESC_DRAGONKIN_252

    option = {
        name = EVTOPTA_DRAGONKIN_252
		trigger = {
			OR = {
				trait = craven
				trait = paranoid
			}
		}
		if = {
			limit = { NOT = { trait = paranoid } }
			remove_trait = craven
		}
		if = {
			limit = { trait = paranoid }
			remove_trait = paranoid
		}
		remove_character_modifier = in_meditation
		if = {
			limit = {
				has_quest = quest_dragonkin_society_resist_evil
			}
			character_event = { id = DRAGONKIN.142 days = 20 }
		}
    }

    option = {
        name = EVTOPTC_DRAGONKIN_252
		trigger = {
			OR = {
				trait = possessed
				trait = lunatic
			}
		}
		if = {
			limit = { NOT = { trait = possessed } }
			remove_trait = lunatic
		}
		if = {
			limit = { trait = possessed }
			remove_trait = possessed
		}
		remove_character_modifier = in_meditation
		if = {
			limit = {
				has_quest = quest_dragonkin_society_resist_evil
			}
			character_event = { id = DRAGONKIN.142 days = 20 }
		}
    }

    option = {
        name = EVTOPTB_DRAGONKIN_252
		trigger = {
			trait = cannibal
		}
		remove_trait = cannibal
		remove_character_modifier = in_meditation
		if = {
			limit = {
				has_quest = quest_dragonkin_society_resist_evil
			}
			character_event = { id = DRAGONKIN.142 days = 20 }
		}
    }

    option = {
        name = EVTOPTD_DRAGONKIN_252
		trigger = {
			NOR = {
				trait = craven
				trait = paranoid
				trait = possessed
				trait = lunatic
				trait = cannibal
			}
			OR = {
				trait = stressed
				trait = depressed
			}
		}
		if = {
			limit = { NOT = { trait = stressed } }
			remove_trait = depressed
		}
		if = {
			limit = { trait = stressed }
			remove_trait = stressed
		}
		remove_character_modifier = in_meditation
		if = {
			limit = {
				has_quest = quest_dragonkin_society_resist_evil
			}
			character_event = { id = DRAGONKIN.142 days = 20 }
		}
    }

    option = {
        name = EVTOPTE_DRAGONKIN_252
		trigger = {
			NOR = {
				trait = craven
				trait = paranoid
				trait = possessed
				trait = lunatic
				trait = cannibal
				trait = depressed
				trait = stressed
			}
		}
		piety = 30
		remove_character_modifier = in_meditation
		if = {
			limit = {
				has_quest = quest_dragonkin_society_resist_evil
			}
			character_event = { id = DRAGONKIN.142 days = 20 }
		}
    }
}

character_event = { # failed mission
    id = DRAGONKIN.253
    picture = GFX_evt_lunatic
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    
    desc = EVTDESC_DRAGONKIN_253

    option = {
        name = EVTOPTA_DRAGONKIN_253
		clr_quest = { id = quest_dragonkin_society_resist_evil failure = yes }
    }
}

# POWER: Artefact Hunt
character_event = {
    id = DRAGONKIN.260
    picture = GFX_evt_ritual_scroll
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    
    desc = EVTDESC_DRAGONKIN_260

    option = {
        name = EVTOPTA_DRAGONKIN_260
		detract_society_currency_minor_effect = yes
		custom_tooltip = {
			text = dragonkin_artefact_tier_1_tt
		}
		increase_visibility_minor_effect = yes
		character_event = { id = DRAGONKIN.261 days = 90 random = 60 }
    }
    option = {
        name = EVTOPTB_DRAGONKIN_260
		trigger = {
			has_society_currency_medium_trigger = yes
		}
		detract_society_currency_medium_effect = yes
		custom_tooltip = {
			text = dragonkin_artefact_tier_2_tt
		}
		increase_visibility_effect = yes
		character_event = { id = DRAGONKIN.262 days = 90 random = 60 }
    }
    option = {
        name = EVTOPTC_DRAGONKIN_260
		tooltip_info = learning
		trigger = {
			has_society_currency_major_trigger = yes
			learning = 13
		}
		detract_society_currency_major_effect = yes
		custom_tooltip = {
			text = dragonkin_artefact_tier_3_tt
		}
		increase_visibility_effect = yes
		character_event = { id = DRAGONKIN.263 days = 90 random = 60 }
    }
}

character_event = { # tier 1 roll
    id = DRAGONKIN.261
    hide_window = yes
    is_triggered_only = yes
	
	trigger = { society_member_of = dragonkin_society }
	
	immediate = {
		random_list = {
			100 = { # dragon sculpture
				modifier = {
					factor = 0
					has_artifact = chinese_sculpture
				}
				character_event = { id = DRAGONKIN.267 }
			}
			100 = { # gold bracelets
				modifier = {
					factor = 0
					has_artifact = golden_bracelets
				}
				character_event = { id = DRAGONKIN.268 }
			}
			100 = { # dragon language vol 2
				modifier = {
					factor = 0
					has_artifact = learning_languages_2
				}
				modifier = {
					factor = 0
					NOT = { culture = dragon_culture }
				}
				character_event = { id = DRAGONKIN.272 }
			}
			100 = { # dragon language vol 1
				modifier = {
					factor = 0
					has_artifact = learning_languages_1
				}
				modifier = {
					factor = 0
					NOT = { culture = dragon_culture }
				}
				character_event = { id = DRAGONKIN.271 }
			}
			100 = { # strange chest
				if = {
					limit = { has_artifact = strange_chest }
					character_event = { id = DRAGONKIN.265 } # find key
				}
				if = {
					limit = { NOT = { has_artifact = strange_chest } }
					character_event = { id = DRAGONKIN.266 } # find chest
				}
			}
			100 = { # fail
				character_event = { id = DRAGONKIN.264 }
			}
		}
	}
}

character_event = { # tier 2 roll
    id = DRAGONKIN.262
    hide_window = yes
    is_triggered_only = yes
	
	trigger = { society_member_of = dragonkin_society }
	
	immediate = {
		random_list = {
			100 = { # ruby bracelets
				modifier = {
					factor = 0
					has_artifact = ruby_bracelets
				}
				character_event = { id = DRAGONKIN.269 }
			}
			100 = { # dragon sculpture
				modifier = {
					factor = 0
					has_artifact = chinese_sculpture
				}
				character_event = { id = DRAGONKIN.267 }
			}
			100 = { # gold bracelets
				modifier = {
					factor = 0
					has_artifact = golden_bracelets
				}
				character_event = { id = DRAGONKIN.268 }
			}
			100 = { # dragon language vol 3
				modifier = {
					factor = 0
					has_artifact = learning_languages_3
				}
				modifier = {
					factor = 0
					NOT = { culture = dragon_culture }
				}
				character_event = { id = DRAGONKIN.273 }
			}
			100 = { # dragon language vol 2
				modifier = {
					factor = 0
					has_artifact = learning_languages_2
				}
				modifier = {
					factor = 0
					NOT = { culture = dragon_culture }
				}
				character_event = { id = DRAGONKIN.272 }
			}
			100 = { # dragon language vol 1
				modifier = {
					factor = 0
					has_artifact = learning_languages_1
				}
				modifier = {
					factor = 0
					NOT = { culture = dragon_culture }
				}
				character_event = { id = DRAGONKIN.271 }
			}
			100 = { # strange chest
				if = {
					limit = { has_artifact = strange_chest }
					character_event = { id = DRAGONKIN.265 } # find key
				}
				if = {
					limit = { NOT = { has_artifact = strange_chest } }
					character_event = { id = DRAGONKIN.266 } # find chest
				}
			}
			50 = { # fail
				character_event = { id = DRAGONKIN.264 }
			}
		}
	}
}

character_event = { # tier 3 roll
    id = DRAGONKIN.263
    hide_window = yes
    is_triggered_only = yes
	
	trigger = { society_member_of = dragonkin_society }
	
	immediate = {
		random_list = {
			100 = { # dragon amulet
				modifier = {
					factor = 0
					has_artifact = chinese_dragon_amulet
				}
				character_event = { id = DRAGONKIN.270 }
			}
			100 = { # ruby bracelets
				modifier = {
					factor = 0
					has_artifact = ruby_bracelets
				}
				character_event = { id = DRAGONKIN.269 }
			}
			100 = { # dragon sculpture
				modifier = {
					factor = 0
					has_artifact = chinese_sculpture
				}
				character_event = { id = DRAGONKIN.267 }
			}
			100 = { # gold bracelets
				modifier = {
					factor = 0
					has_artifact = golden_bracelets
				}
				character_event = { id = DRAGONKIN.268 }
			}
			100 = { # dragon language vol 4
				modifier = {
					factor = 0
					has_artifact = learning_languages_4
				}
				modifier = {
					factor = 0
					NOT = { culture = dragon_culture }
				}
				character_event = { id = DRAGONKIN.274 }
			}
			100 = { # dragon language vol 3
				modifier = {
					factor = 0
					has_artifact = learning_languages_3
				}
				modifier = {
					factor = 0
					NOT = { culture = dragon_culture }
				}
				character_event = { id = DRAGONKIN.273 }
			}
			100 = { # dragon language vol 2
				modifier = {
					factor = 0
					has_artifact = learning_languages_2
				}
				modifier = {
					factor = 0
					NOT = { culture = dragon_culture }
				}
				character_event = { id = DRAGONKIN.272 }
			}
			100 = { # dragon language vol 1
				modifier = {
					factor = 0
					has_artifact = learning_languages_1
				}
				modifier = {
					factor = 0
					NOT = { culture = dragon_culture }
				}
				character_event = { id = DRAGONKIN.271 }
			}
			100 = { # strange chest
				if = {
					limit = { has_artifact = strange_chest }
					character_event = { id = DRAGONKIN.265 } # find key
				}
				if = {
					limit = { NOT = { has_artifact = strange_chest } }
					character_event = { id = DRAGONKIN.266 } # find chest
				}
			}
		}
	}
}

# Failed
character_event = {
    id = DRAGONKIN.264
    picture = GFX_evt_performing_experiments
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    
    desc = EVTDESC_DRAGONKIN_264

    option = {
        name = EVTOPTA_DRAGONKIN_264
		prestige = -5
    }
}

# Find key
character_event = {
    id = DRAGONKIN.265
    picture = GFX_evt_relic_box
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    
    desc = EVTDESC_DRAGONKIN_265

    option = {
        name = EVTOPTA_TOG_3302
		custom_tooltip = {
			text = opens_chest
			hidden_tooltip = {
				random_list = {
					40 = { character_event = { id = TOG.3306 } }
					40 = { character_event = { id = TOG.3307 } }
					40 = { character_event = { id = TOG.3308 } }
					5 = { character_event = { id = TOG.3309 } }
				}
			}
		}
    }
}

# Find strange chest
character_event = {
    id = DRAGONKIN.266
    picture = GFX_evt_relic_box
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    
    desc = EVTDESC_DRAGONKIN_266

    option = {
        name = EVTOPTA_TOG_3301
		add_artifact = strange_chest
		new_artifact = {
			set_creation_date = 1.1.1
			set_original_owner = none
		}
    }
}

# Find sculpture
character_event = {
    id = DRAGONKIN.267
    picture = GFX_evt_relic_box
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    
    desc = EVTDESC_DRAGONKIN_267

    option = {
        name = EVTOPTA_DRAGONKIN_267
		add_artifact = chinese_sculpture
		new_artifact = {
			set_name = chinese_sculpture_name
			set_creation_date = 1.1.1
			set_original_owner = none
		}
    }
}

# Find gold bracelets
character_event = {
    id = DRAGONKIN.268
    picture = GFX_evt_relic_box
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    
    desc = EVTDESC_DRAGONKIN_268

    option = {
        name = EVTOPTA_DRAGONKIN_268
		add_artifact = golden_bracelets
        new_artifact = {
			set_creation_date = 1.1.1
			set_original_owner = none
		}
    }
}

# Find ruby bracelets
character_event = {
    id = DRAGONKIN.269
    picture = GFX_evt_relic_box
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    
    desc = EVTDESC_DRAGONKIN_269

    option = {
        name = EVTOPTA_DRAGONKIN_269
		add_artifact = ruby_bracelets
        new_artifact = {
			set_creation_date = 1.1.1
			set_original_owner = none
		}
    }
}

# Find dragon amulet
character_event = {
    id = DRAGONKIN.270
    picture = GFX_evt_relic_box
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    
    desc = EVTDESC_DRAGONKIN_270

    option = {
        name = EVTOPTA_DRAGONKIN_270
		add_artifact = chinese_dragon_amulet
        new_artifact = {
			set_creation_date = 1.1.1
			set_original_owner = none
		}
    }
}

# Find dragon language vol 1
character_event = {
    id = DRAGONKIN.271
    picture = GFX_evt_relic_box
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    
    desc = EVTDESC_DRAGONKIN_271

    option = {
        name = EVTOPTA_DRAGONKIN_271
		add_artifact = learning_languages_1
        new_artifact = {
			set_creation_date = 1.1.1
			set_original_owner = none
		}
    }
}

# Find dragon language vol 2
character_event = {
    id = DRAGONKIN.272
    picture = GFX_evt_relic_box
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    
    desc = EVTDESC_DRAGONKIN_272

    option = {
        name = EVTOPTA_DRAGONKIN_272
		add_artifact = learning_languages_2
        new_artifact = {
			set_creation_date = 1.1.1
			set_original_owner = none
		}
    }
}

# Find dragon language vol 3
character_event = {
    id = DRAGONKIN.273
    picture = GFX_evt_relic_box
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    
    desc = EVTDESC_DRAGONKIN_273

    option = {
        name = EVTOPTA_DRAGONKIN_273
		add_artifact = learning_languages_3
        new_artifact = {
			set_creation_date = 1.1.1
			set_original_owner = none
		}
    }
}

# Find dragon language vol 4
character_event = {
    id = DRAGONKIN.274
    picture = GFX_evt_relic_box
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    
    desc = EVTDESC_DRAGONKIN_274

    option = {
        name = EVTOPTA_DRAGONKIN_274
		add_artifact = learning_languages_4
        new_artifact = {
			set_creation_date = 1.1.1
			set_original_owner = none
		}
    }
}

#POWER: Remove Lawless Presence
character_event = {
    id = DRAGONKIN.280
	picture = GFX_evt_end_of_days
	desc = EVTDESC_DRAGONKIN280
	border = GFX_event_normal_frame_intrigue
	
	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
		
		FROM = {
			location = {
				add_province_modifier = {
					name = peasants_protected
					years = 2
				}
			}
		}
	}
}

#POWER: Burn Dragon Incense
character_event = {
    id = DRAGONKIN.290
	picture = GFX_evt_ritual_scroll
	desc = EVTDESC_DRAGONKIN_290
	border = GFX_event_normal_frame_intrigue
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_DRAGONKIN_290
		character_event = { id = DRAGONKIN.291 }
		custom_tooltip = {
			text = dragonkin_incense_martial_tooltip
		}

		ai_chance = {
            factor = 10
			modifier = {
				factor = 2
				NOT = { martial = 8 }
			}
            modifier = {
                factor = 0.5
                martial = 13
            }
		}
	}
	option = {
		name = EVTOPTB_DRAGONKIN_290
		character_event = { id = DRAGONKIN.292 }
		custom_tooltip = {
			text = dragonkin_incense_intrigue_tooltip
		}

		ai_chance = {
            factor = 10
            modifier = {
                factor = 0.5
                intrigue = 16
            }
		}
	}
	option = {
		name = EVTOPTC_DRAGONKIN_290
		character_event = { id = DRAGONKIN.293 }
		custom_tooltip = {
			text = dragonkin_incense_learning_tooltip
		}

		ai_chance = {
            factor = 10
			modifier = {
				factor = 2
				NOT = { learning = 8 }
			}
            modifier = {
                factor = 0.5
                learning = 13
            }
		}
	}
	option = {
		name = EVTOPTD_DRAGONKIN_290
		character_event = { id = DRAGONKIN.294 }
		custom_tooltip = {
			text = dragonkin_incense_fertility_tooltip
		}

		ai_chance = {
            factor = 10
			modifier = {
				factor = 2
				NOT = { has_character_modifier = dragonkin_incense_fertility }
			}
            modifier = {
                factor = 0.5
                trait = lustful
            }
		}
	}
}

character_event = {
    id = DRAGONKIN.291
	picture = GFX_evt_secluded_in_prayer
	desc = EVTDESC_DRAGONKIN_291
	border = GFX_event_normal_frame_intrigue
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_DRAGONKIN_291
		
		add_character_modifier = {
			name = dragonkin_incense_martial
			years = 2
			stacking = yes
		}
		
		random = {
			chance = 25
			if = {
				limit = { NOT = { trait = dwarf } }
				add_trait = giant
			}
			if = {
				limit = { trait = dwarf }
				remove_trait = dwarf
			}
		}
		
		hidden_tooltip = {
			clr_character_flag = burning_dragon_incense
			random = {
				chance = 60
				character_event = { id = DRAGONKIN.295 days = 7 }
				modifier = {
					factor = 0.5
					intrigue = 13
				}
				modifier = {
					factor = 0.5
					intrigue = 15
				}
				modifier = {
					factor = 0.5
					intrigue = 18
				}
				modifier = {
					factor = 0
					intrigue = 20
				}
			}
		}
	}
}

character_event = {
    id = DRAGONKIN.292
	picture = GFX_evt_secluded_in_prayer
	desc = EVTDESC_DRAGONKIN_292
	border = GFX_event_normal_frame_intrigue
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_DRAGONKIN_291
		
		add_character_modifier = {
			name = dragonkin_incense_intrigue
			years = 2
			stacking = yes
		}
		
		random = {
			chance = 25
			if = {
				limit = { NOT = { trait = trusting } }
				add_trait = paranoid
			}
			if = {
				limit = { trait = trusting }
				remove_trait = trusting
			}
		}
		
		hidden_tooltip = {
			clr_character_flag = burning_dragon_incense
			random = {
				chance = 60
				character_event = { id = DRAGONKIN.295 days = 7 }
				modifier = {
					factor = 0.5
					intrigue = 13
				}
				modifier = {
					factor = 0.5
					intrigue = 15
				}
				modifier = {
					factor = 0.5
					intrigue = 18
				}
				modifier = {
					factor = 0
					intrigue = 20
				}
			}
		}
	}
}

character_event = {
    id = DRAGONKIN.293
	picture = GFX_evt_secluded_in_prayer
	desc = EVTDESC_DRAGONKIN_293
	border = GFX_event_normal_frame_intrigue
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_DRAGONKIN_291
		
		add_character_modifier = {
			name = dragonkin_incense_learning
			years = 2
			stacking = yes
		}
		
		hidden_tooltip = {
			clr_character_flag = burning_dragon_incense
			random = {
				chance = 60
				character_event = { id = DRAGONKIN.295 days = 7 }
				modifier = {
					factor = 0.5
					intrigue = 13
				}
				modifier = {
					factor = 0.5
					intrigue = 15
				}
				modifier = {
					factor = 0.5
					intrigue = 18
				}
				modifier = {
					factor = 0
					intrigue = 20
				}
			}
		}
	}
}

character_event = {
    id = DRAGONKIN.294
	picture = GFX_evt_secluded_in_prayer
	desc = EVTDESC_DRAGONKIN_294
	border = GFX_event_normal_frame_intrigue
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_DRAGONKIN_291
		
		add_character_modifier = {
			name = dragonkin_incense_fertility
			years = 2
			stacking = yes
		}
		
		random = {
			chance = 25
			if = {
				limit = { NOT = { trait = chaste } }
				add_trait = lustful
			}
			if = {
				limit = { trait = chaste }
				remove_trait = chaste
			}
		}
		
		hidden_tooltip = {
			clr_character_flag = burning_dragon_incense
			random = {
				chance = 60
				character_event = { id = DRAGONKIN.295 days = 7 }
				modifier = {
					factor = 0.5
					intrigue = 13
				}
				modifier = {
					factor = 0.5
					intrigue = 15
				}
				modifier = {
					factor = 0.5
					intrigue = 18
				}
				modifier = {
					factor = 0
					intrigue = 20
				}
			}
		}
	}
}

# incense goes wrong!
character_event = {
    id = DRAGONKIN.295
    picture = GFX_evt_performing_experiments
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    
    desc = EVTDESC_DRAGONKIN_295

    option = {
        name = EVTOPTA_DRAGONKIN_295
		
		add_character_modifier = {
			name = dragonkin_incense_fail
			years = 2
			stacking = yes
		}
    }
}

#################################EVENTS######################################

# thief steals money
character_event = {
    id = DRAGONKIN.500
    desc = EVTDESC_DRAGONKIN_500
    picture = GFX_evt_treasure_chamber
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes

	trigger = {
		society_member_of = dragonkin_society
		wealth = 50
		NOT = { has_character_modifier = dragonkin_traps }
	}
	
    option = {
        name = EVTOPTA_DRAGONKIN_500
		scaled_wealth = -0.2
    }
}

# thief caught
character_event = {
    id = DRAGONKIN.510
    desc = EVTDESC_DRAGONKIN_510
    picture = GFX_evt_treasure_chamber
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes

	trigger = {
		society_member_of = dragonkin_society
	}
	
    option = {
        name = EVTOPTA_DRAGONKIN_510
		trigger = {
			NOT = {
				has_artifact = rival_skull
			}
		}
		add_artifact = rival_skull
        new_artifact = {
			set_creation_date = 1.1.1
			set_original_owner = none
		}
		increase_visibility_minor_effect = yes
    }
	
    option = {
        name = EVTOPTB_DRAGONKIN_510
		prestige = 25
    }
}

# go deeper?
character_event = {
    id = DRAGONKIN.520
    desc = EVTDESC_DRAGONKIN_520
    picture = GFX_evt_ritual_scroll
    border = GFX_event_normal_frame_religion

    is_triggered_only = yes

	trigger = {
		society_member_of = dragonkin_society
	}
	
    option = {
        name = EVTOPTA_DRAGONKIN_520
		random = {
		  chance = 45
		  add_trait = possessed
		}
		change_learning = 1
		increase_visibility_minor_effect = yes
    }
	
    option = {
        name = EVTOPTB_DRAGONKIN_520
		piety = 25
    }
}

# get paranoid
character_event = {
    id = DRAGONKIN.530
    desc = EVTDESC_DRAGONKIN_530
    picture = GFX_evt_suspicious_noble
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes

	trigger = {
		society_member_of = dragonkin_society
		OR = {
			NOT = { trait = lunatic }
			NOT = { trait = paranoid }
		}
	}
	
    option = {
        name = EVTOPTA_DRAGONKIN_530
		if = {
			limit = { trait = paranoid }
			add_trait = lunatic
		}
		if = {
			limit = { NOT = { trait = paranoid } }
			add_trait = paranoid
		}
    }
}

# repair traps?
character_event = {
    id = DRAGONKIN.540
    desc = EVTDESC_DRAGONKIN_540
    picture = GFX_evt_treasure_chamber
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes

	trigger = {
		society_member_of = dragonkin_society
		NOT = { has_character_modifier = dragonkin_traps }
	}
	
    option = {
        name = EVTOPTA_DRAGONKIN_540
		scaled_wealth = -0.1
		add_character_modifier = {
			name = dragonkin_traps
			years = 5
		}
		increase_visibility_minor_effect = yes
    }
	
    option = {
        name = EVTOPTB_DRAGONKIN_540
    }
}

# force AI to convert culture
character_event = {
    id = DRAGONKIN.550
    picture = GFX_evt_burning_castle_hf
	only_playable = yes

    is_triggered_only = yes

	trigger = {
		society_member_of = dragonkin_society
		ai = yes
		society_rank = 4
		culture = dragon_culture
		society_currency >= 1000
		any_demesne_province = { NOT = { culture = dragon_culture } }
	}
	
    option = {
		change_society_currency = -1000
		increase_visibility_effect = yes
		random_demesne_province = {
			limit = {
				NOT = { culture = dragon_culture }
			}
			culture = dragon_culture
			add_province_modifier = {
				name = peasant_unrest
				years = 10
			}
		}
    }
}

#Avoid Dragon Disease
#This event is set as a society_quest_event, not character_event. This is the accept or refuse the quest event, the next parts of the quest use the regular character_event.
narrative_event = {
    id = DRAGONKIN.181
	title = EVTTITLE_DRAGONKIN_181
    desc = EVTDESC_DRAGONKIN_181
    picture = GFX_evt_depopulated_town
    border = GFX_event_narrative_frame_intrigue
	only_playable = yes

    is_triggered_only = yes
	
	trigger = {
		society_member_of = dragonkin_society
		OR = {
			society_rank >= 2
			culture = dragon_culture
		}
		has_dlc = "Reapers"
		prisoner = no
		NOT = { has_character_flag = do_not_disturb }
		NOT = { has_character_modifier = out_traveling }
		NOT = { has_character_modifier = recently_opened_gates }
		NOT = { has_character_modifier = avoid_disease_cooldown_timer }
		is_ill = no
		is_tribal = no
		is_nomadic = no
	}
   
    option = { 
		name = EVTOPTA_DRAGONKIN_181

		add_character_modifier = {
			name = avoid_disease_cooldown_timer
			hidden = yes
			years = 20
		}
		
		set_character_flag = do_not_disturb
		hidden_tooltip = {
			character_event = { id = RIP.12000 }
			add_character_modifier = {
				name = in_seclusion
				duration = -1
			}
			if = {
				limit = {
					has_minor_title = title_commander
				}
				remove_title = title_commander
			}
			if = { # If you are a councillor, stop working and return home
				limit = {
					host = { NOT = { character = ROOT } }
					OR = {
						is_councillor = yes
						has_minor_title = title_councilmember_king
						has_minor_title = title_councilmember_emperor
					}
				}
				force_host = ROOT
			}
			any_courtier = { # Unlanded councillors stop working in order to go into seclusion with their liege
				limit = {
					prisoner = no
					is_councillor = yes
					is_landed = no
					liege = { character = ROOT }
					NOT = { character = ROOT }
				}
				add_character_modifier = {
					name = in_seclusion
					duration = -1
				}
			}
			any_courtier = { # Unlanded non-councillors join their liege in seclusion
				limit = {
					prisoner = no
					is_councillor = no
					is_landed = no
					liege = { character = ROOT }
					NOT = { character = ROOT }
				}
				add_character_modifier = {
					name = in_seclusion
					duration = -1
				}
			}
			any_courtier = { # Landed councillors return home while you, their liege, is in seclusion
				limit = {
					prisoner = no
					OR = {
						is_councillor = yes
						has_minor_title = title_councilmember_king
						has_minor_title = title_councilmember_emperor
					}
					is_landed = yes
					liege = { character = ROOT }
					NOT = { character = ROOT }
				}
				force_host = THIS
			}
			any_courtier = { # Landed children being educated in your court are sent home, with the guardianship ending
				limit = {
					prisoner = no
					is_landed = yes
					is_adult = no
					has_guardian = yes
				}
				remove_guardian = yes
			}
			if = { #If you are getting educated elsewhere, then go home to be secluded
				limit = {
					NOT = { age = 16 }
					is_abroad = yes
				}
				remove_guardian = yes
				force_host = ROOT
			}
			any_vassal = {
				character_event = { id = RIP.12001 days = 7 random = 7 }
			}
			if = { #Notify employer that councillor is going into seclusion
				limit = { 
					is_councillor = yes 
					liege = { ai = no }
				}
				liege = { letter_event = { id = RIP.12101 days = 1 } }
			}
		}
		
		hidden_tooltip = {
			character_event = { id = DRAGONKIN.182 days = 30 random = 30 }
		}
	}

	option = {
		name = EVTOPTB_DRAGONKIN_181

		add_character_modifier = {
			name = avoid_disease_cooldown_timer
			hidden = yes
			years = 20
		}
		
		hidden_tooltip = {
			character_event = { id = DRAGONKIN.182 days = 30 random = 30 }
		}

		ai_chance = { factor = 0 }
	}
}

# if gates shut, start the food event chain, if gates open, get infected
character_event = {
    id = DRAGONKIN.182
    hide_window = yes
    is_triggered_only = yes
	
	immediate = {
		if = {
			limit = { has_character_modifier = in_seclusion }
			character_event = { id = RIP.11550 } # life in seclusion isn't so bad...
			character_event = { id = DRAGONKIN.183 days = 180 random = 90 }
		}
		if = {
			limit = { NOT = { has_character_modifier = in_seclusion } }
			character_event = { id = DRAGONKIN.190 } # infection!
		}
	}
}

#25%
character_event = {
    id = DRAGONKIN.183
    hide_window = yes
    is_triggered_only = yes
	
	immediate = {
		if = {
			limit = { has_character_modifier = in_seclusion }
			character_event = { id = DRAGONKIN.184 days = 180 random = 90 }
			
			# courtier generated so they'll always be someone who can steal food
			create_character = {
				employer = ROOT
				random_traits = yes
				dynasty = none
				religion = ROOT
				culture = ROOT
				female = 40
				age = 30
				attributes = {
					martial = 6
					diplomacy = 8
					stewardship = 9
					intrigue = 12
					learning = 12
				}
				trait = gluttonous
			}
			new_character = {
				add_character_modifier = {
					name = in_seclusion
					duration = -1
				}
			}
			character_event = { id = RIP.11554 days = 10 random = 50 }
		}
		if = {
			limit = { NOT = { has_character_modifier = in_seclusion } }
			character_event = { id = DRAGONKIN.190 } # infection!
		}
	}
}

#50%
character_event = {
    id = DRAGONKIN.184
    hide_window = yes
    is_triggered_only = yes
	
	immediate = {
		if = {
			limit = { has_character_modifier = in_seclusion }
			character_event = { id = DRAGONKIN.185 days = 180 random = 90 }
			
			clr_character_flag = seclusion_rats_eaten
			character_event = { id = RIP.11553 days = 10 random = 50 }
		}
		if = {
			limit = { NOT = { has_character_modifier = in_seclusion } }
			character_event = { id = DRAGONKIN.190 } # infection!
		}
	}
}

#75%
character_event = {
    id = DRAGONKIN.185
    hide_window = yes
    is_triggered_only = yes
	
	immediate = {
		if = {
			limit = { has_character_modifier = in_seclusion }
			character_event = { id = DRAGONKIN.186 days = 180 random = 90 }
		}
		if = {
			limit = { NOT = { has_character_modifier = in_seclusion } }
			character_event = { id = DRAGONKIN.190 } # infection!
		}
	}
}

#final check
character_event = {
    id = DRAGONKIN.186
    hide_window = yes
    is_triggered_only = yes
	
	immediate = {
		if = {
			limit = { has_character_modifier = in_seclusion }
			character_event = { id = DRAGONKIN.187 } # all clear
		}
		if = {
			limit = { NOT = { has_character_modifier = in_seclusion } }
			character_event = { id = DRAGONKIN.190 } # infection!
		}
	}
}

#send to grandmaster for Ping
character_event = {
	id = DRAGONKIN.187
	is_triggered_only = yes
	hide_window = yes

	immediate = {
		random_society_member = {
			limit = {
				same_society_as = ROOT
				is_society_grandmaster = yes
			}
			character_event = {
				id = DRAGONKIN.188
			}
		}
	}
}

#Ping
character_event = {
	id = DRAGONKIN.188
	is_triggered_only = yes
	hide_window = yes

	immediate = {
		FROM = {
			letter_event = {
				id = DRAGONKIN.189
			}
		}
	}
}

letter_event = {
	id = DRAGONKIN.189
	desc = EVTDESC_DRAGONKIN_189
	border = GFX_event_letter_frame_intrigue

	is_triggered_only = yes

	option = {
		name = EVTOPTA_DRAGONKIN_189
		sound_effect = time_forward
		add_society_currency_major_effect = yes
	}
}

# infection!
character_event = {
    id = DRAGONKIN.190
    picture = GFX_evt_bloody_knife_hf
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    
    desc = EVTDESC_DRAGONKIN_190

    option = {
        name = EVTOPTA_DRAGONKIN_190
		if = {
			limit = { culture = dragon_culture }
			add_trait = dragonkin_infection
			hidden_tooltip = {
				character_event = { id = DRAGONKIN.191 days = 365 random = 1095 }
			}
		}
		if = {
			limit = { NOT = { culture = dragon_culture } }
			add_trait = infection
			hidden_tooltip = {
				character_event = { id = RIP.11001 days = 365 random = 1095 }
			}
		}
    }
}

# Removing dragon infection
character_event = {
	id = DRAGONKIN.191
	picture = GFX_evt_recovery
	desc = EVTDESC_RIP_11001
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes

	option = {
		name = EVTOPTA_RIP_11001
		remove_trait = dragonkin_infection
		hidden_tooltip = {
			if = {
				limit = { trait = wounded }
				character_event = { id = 6081 days = 14 random = 30 } # wound should heal soon after
			}
		}
	}
}

# stat pooling
character_event = {
    id = DRAGONKIN.700
    desc = EVTDESC_DRAGONKIN_700
    picture = GFX_evt_woman_at_window_hf
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
	
    option = {
        name = EVTOPTA_DRAGONKIN_700
		change_diplomacy = -1
		change_intrigue = 1
    }
    option = {
        name = EVTOPTB_DRAGONKIN_700
		set_interested_society = none
		clr_character_flag = dragonkin_society_inducted_into_society
		if = {
			limit = { ai = yes }
			clr_character_flag = society_join_block
		}
		ai_chance = { factor = 0 }
    }
}

character_event = {
    id = DRAGONKIN.710
    desc = EVTDESC_DRAGONKIN_700
    picture = GFX_evt_woman_at_window_hf
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
	
    option = {
        name = EVTOPTA_DRAGONKIN_700
		change_martial = -1
		change_intrigue = 1
    }
    option = {
        name = EVTOPTB_DRAGONKIN_700
		set_interested_society = none
		clr_character_flag = dragonkin_society_inducted_into_society
		if = {
			limit = { ai = yes }
			clr_character_flag = society_join_block
		}
		ai_chance = { factor = 0 }
    }
}

character_event = {
    id = DRAGONKIN.720
    desc = EVTDESC_DRAGONKIN_700
    picture = GFX_evt_woman_at_window_hf
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
	
    option = {
        name = EVTOPTA_DRAGONKIN_700
		change_stewardship = -1
		change_intrigue = 1
    }
    option = {
        name = EVTOPTB_DRAGONKIN_700
		set_interested_society = none
		clr_character_flag = dragonkin_society_inducted_into_society
		if = {
			limit = { ai = yes }
			clr_character_flag = society_join_block
		}
		ai_chance = { factor = 0 }
    }
}

character_event = {
    id = DRAGONKIN.730
    desc = EVTDESC_DRAGONKIN_700
    picture = GFX_evt_woman_at_window_hf
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
	
    option = {
        name = EVTOPTA_DRAGONKIN_700
		change_intrigue = 1
		change_learning = -1
    }
    option = {
        name = EVTOPTB_DRAGONKIN_700
		set_interested_society = none
		clr_character_flag = dragonkin_society_inducted_into_society
		if = {
			limit = { ai = yes }
			clr_character_flag = society_join_block
		}
		ai_chance = { factor = 0 }
    }
}

character_event = {
    id = DRAGONKIN.740
    desc = EVTDESC_DRAGONKIN_700
    picture = GFX_evt_woman_at_window_hf
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
	
    option = {
        name = EVTOPTA_DRAGONKIN_700
		change_intrigue = 1
    }
}

character_event = {
    id = DRAGONKIN.750
    desc = EVTDESC_DRAGONKIN_700
    picture = GFX_evt_woman_at_window_hf
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
	
    option = {
        name = EVTOPTA_DRAGONKIN_700
		remove_trait = kind
    }
    option = {
        name = EVTOPTB_DRAGONKIN_700
		set_interested_society = none
		clr_character_flag = dragonkin_society_inducted_into_society
		if = {
			limit = { ai = yes }
			clr_character_flag = society_join_block
		}
		ai_chance = { factor = 0 }
    }
}

character_event = {
    id = DRAGONKIN.760
    desc = EVTDESC_DRAGONKIN_700
    picture = GFX_evt_woman_at_window_hf
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
	
    option = {
        name = EVTOPTA_DRAGONKIN_700
		remove_trait = wroth
    }
    option = {
        name = EVTOPTB_DRAGONKIN_700
		set_interested_society = none
		clr_character_flag = dragonkin_society_inducted_into_society
		if = {
			limit = { ai = yes }
			clr_character_flag = society_join_block
		}
		ai_chance = { factor = 0 }
    }
}

character_event = {
    id = DRAGONKIN.770
    desc = EVTDESC_DRAGONKIN_700
    picture = GFX_evt_woman_at_window_hf
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
	
    option = {
        name = EVTOPTA_DRAGONKIN_700
		remove_trait = content
    }
    option = {
        name = EVTOPTB_DRAGONKIN_700
		set_interested_society = none
		clr_character_flag = dragonkin_society_inducted_into_society
		if = {
			limit = { ai = yes }
			clr_character_flag = society_join_block
		}
		ai_chance = { factor = 0 }
    }
}

character_event = {
    id = DRAGONKIN.780
    desc = EVTDESC_DRAGONKIN_700
    picture = GFX_evt_woman_at_window_hf
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
	
    option = {
        name = EVTOPTA_DRAGONKIN_700
		remove_trait = honest
    }
    option = {
        name = EVTOPTB_DRAGONKIN_700
		set_interested_society = none
		clr_character_flag = dragonkin_society_inducted_into_society
		if = {
			limit = { ai = yes }
			clr_character_flag = society_join_block
		}
		ai_chance = { factor = 0 }
    }
}

character_event = {
    id = DRAGONKIN.790
    desc = EVTDESC_DRAGONKIN_700
    picture = GFX_evt_woman_at_window_hf
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
	
    option = {
        name = EVTOPTA_DRAGONKIN_700
		remove_trait = trusting
    }
    option = {
        name = EVTOPTB_DRAGONKIN_700
		set_interested_society = none
		clr_character_flag = dragonkin_society_inducted_into_society
		if = {
			limit = { ai = yes }
			clr_character_flag = society_join_block
		}
		ai_chance = { factor = 0 }
    }
}

#induct into society
# society member sends letter to target
character_event = {
    id = DRAGONKIN.800
    desc = EVTDESC_DRAGONKIN_800
    picture = GFX_evt_princess_byzantine
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
	
    option = {
        name = EVTOPTA_DRAGONKIN_800
		event_target:new_recruit = { character_event = { id = DRAGONKIN.801 days = 7 } }
    }
}

#target receives letter
character_event = {
    id = DRAGONKIN.801
    desc = EVTDESC_DRAGONKIN_801
    picture = GFX_evt_recieve_letter
    border = GFX_event_normal_frame_intrigue
	hide_from = yes

    is_triggered_only = yes
	
    option = {
        name = EVTOPTA_DRAGONKIN_801
		FROM = { character_event = { id = DRAGONKIN.802 days = 7 } }
		set_character_flag = dragonkin_society_inducted_into_society
		set_interested_society = dragonkin_society
		character_event = { id = DRAGONKIN.001 days = 90 }
		clear_event_target = new_recruit
		if = {
			limit = { ai = no }
			clr_character_flag = society_join_block
		}
		ai_chance = {
			factor = 1
		}
    }
    option = {
        name = EVTOPTB_DRAGONKIN_801
		FROM = { character_event = { id = DRAGONKIN.803 days = 7 } }
		clear_event_target = new_recruit
		clr_character_flag = society_join_block
		ai_chance = {
			factor = 5
			modifier = {
				factor = 10
				NOT = { opinion = { who = FROM value = -25 } }
			}
			modifier = {
				factor = 2
				trait = zealous
			}
			modifier = {
				factor = 0.5
				trait = trusting
			}
			modifier = {
				factor = 0.125
				opinion = { who = FROM value = 50 }
			}
			modifier = {
				factor = 0
				opinion = { who = FROM value = 75 }
			}
		}
    }
}

# target agrees to join
character_event = {
    id = DRAGONKIN.802
    desc = EVTDESC_DRAGONKIN_802
    picture = GFX_evt_pleasing_letter
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
	
    option = {
        name = EVTOPTA_DRAGONKIN_802
		if = {
			limit = {
				has_quest = quest_dragonkin_society_induct_child
			}
			character_event = { id = DRAGONKIN.132 days = 20 }
		}
    }
}

# target refuses
character_event = {
    id = DRAGONKIN.803
    desc = EVTDESC_DRAGONKIN_803
    picture = GFX_evt_upsetting_letter
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
	
    option = {
        name = EVTOPTA_DRAGONKIN_803
		if = {
			limit = {
				has_quest = quest_dragonkin_society_induct_child
			}
			clr_quest = { id = quest_dragonkin_society_induct_child failure = yes }
		}
    }
}

# society member influences the egg to join dragon kin
character_event = {
    id = DRAGONKIN.804
    desc = EVTDESC_DRAGONKIN_804
    picture = GFX_evt_book_carolingian_script
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
	
    option = {
        name = EVTOPTA_DRAGONKIN_804
		event_target:new_recruit = { character_event = { id = DRAGONKIN.805 days = 7 } }
    }
}

# egg "reacts"
character_event = {
    id = DRAGONKIN.805
    desc = EVTDESC_DRAGONKIN_805
    picture = GFX_evt_book_carolingian_script
    border = GFX_event_normal_frame_intrigue
	hide_from = yes

    is_triggered_only = yes
	
    option = {
        name = EVTOPTA_DRAGONKIN_805
		FROM = { character_event = { id = DRAGONKIN.806 days = 7 } }
		set_character_flag = dragonkin_society_inducted_into_society
		set_interested_society = dragonkin_society
		character_event = { id = DRAGONKIN.001 days = 90 }
		clear_event_target = new_recruit
		if = {
			limit = { ai = no }
			clr_character_flag = society_join_block
		}
		ai_chance = {
			factor = 1
		}
    }
    option = {
        name = EVTOPTB_DRAGONKIN_805
		FROM = { character_event = { id = DRAGONKIN.807 days = 7 } }
		clear_event_target = new_recruit
		clr_character_flag = society_join_block
		ai_chance = {
			factor = 5
			modifier = {
				factor = 10
				NOT = { opinion = { who = FROM value = -25 } }
			}
			modifier = {
				factor = 2
				trait = timid
			}
			modifier = {
				factor = 0.5
				trait = curious
			}
			modifier = {
				factor = 0.125
				opinion = { who = FROM value = 10 }
			}
			modifier = {
				factor = 0
				opinion = { who = FROM value = 35 }
			}
		}
    }
}

# egg "accepts"
character_event = {
    id = DRAGONKIN.806
    desc = EVTDESC_DRAGONKIN_806
    picture = GFX_evt_book_carolingian_script
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
	
    option = {
        name = EVTOPTA_DRAGONKIN_806
		if = {
			limit = {
				has_quest = quest_dragonkin_society_induct_child
			}
			character_event = { id = DRAGONKIN.132 days = 20 }
		}
    }
}

# egg "refuses"
character_event = {
    id = DRAGONKIN.807
    desc = EVTDESC_DRAGONKIN_807
    picture = GFX_evt_bad_news
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
	
    option = {
        name = EVTOPTA_DRAGONKIN_807
		if = {
			limit = {
				has_quest = quest_dragonkin_society_induct_child
			}
			clr_quest = { id = quest_dragonkin_society_induct_child failure = yes }
		}
    }
}

# society member opens up a story book with the kid
character_event = {
    id = DRAGONKIN.808
    desc = EVTDESC_DRAGONKIN_808
    picture = GFX_evt_open_book_hf
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
	
    option = {
        name = EVTOPTA_DRAGONKIN_808
		event_target:new_recruit = { character_event = { id = DRAGONKIN.809 days = 7 } }
    }
}

# hey kid it's story time!
character_event = {
    id = DRAGONKIN.809
    desc = EVTDESC_DRAGONKIN_809
    picture = GFX_evt_open_book_hf
    border = GFX_event_normal_frame_intrigue
	hide_from = yes

    is_triggered_only = yes
	
    option = {
        name = EVTOPTA_DRAGONKIN_809
		FROM = { character_event = { id = DRAGONKIN.810 days = 7 } }
		set_character_flag = dragonkin_society_inducted_into_society
		set_interested_society = dragonkin_society
		character_event = { id = DRAGONKIN.001 days = 90 }
		clear_event_target = new_recruit
		if = {
			limit = { ai = no }
			clr_character_flag = society_join_block
		}
		ai_chance = {
			factor = 1
		}
    }
    option = {
        name = EVTOPTB_DRAGONKIN_809
		FROM = { character_event = { id = DRAGONKIN.811 days = 7 } }
		clear_event_target = new_recruit
		clr_character_flag = society_join_block
		ai_chance = {
			factor = 5
			modifier = {
				factor = 10
				NOT = { opinion = { who = FROM value = -25 } }
			}
			modifier = {
				factor = 2
				trait = timid
			}
			modifier = {
				factor = 0.5
				trait = curious
			}
			modifier = {
				factor = 0.125
				opinion = { who = FROM value = 10 }
			}
			modifier = {
				factor = 0
				opinion = { who = FROM value = 35 }
			}
		}
    }
}

# kid agrees to join
character_event = {
    id = DRAGONKIN.810
    desc = EVTDESC_DRAGONKIN_810
    picture = GFX_evt_child_reading_arabic
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
	
    option = {
        name = EVTOPTA_DRAGONKIN_810
		if = {
			limit = {
				has_quest = quest_dragonkin_society_induct_child
			}
			character_event = { id = DRAGONKIN.132 days = 20 }
		}
    }
}

# kid freaks out
character_event = {
    id = DRAGONKIN.811
    desc = EVTDESC_DRAGONKIN_811
    picture = GFX_evt_bad_news
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
	
    option = {
        name = EVTOPTA_DRAGONKIN_811
		if = {
			limit = {
				has_quest = quest_dragonkin_society_induct_child
			}
			clr_quest = { id = quest_dragonkin_society_induct_child failure = yes }
		}
    }
}