﻿### Royal Favor
@xp_gain = 4
@xp_loss = -0.8

### Realm Ethos
@ruler = 30
@heir = 10
@councillor = 15
@pvassal = 0
@nruler = -30
@nheir = -10
@ncouncillor = -15
@npvassal = -15

on_game_start_after_lobby = { 
	on_actions = {
		gpt_expansion_traits_start
	 	gpt_royal_favor_start
	}
}

quarterly_playable_pulse = {
	on_actions = {
		gpt_royal_favor_check
    }
	on_actions = {
		delay = { days = 1 }
		gpt_court_skill_check
    }
	on_actions = {
		delay = { days = 2 }
		gpt_army_xp_check
    }
	on_actions = {
		delay = { days = 3 }
	 	gpt_realm_ethos_check
    }
	on_actions = {
		delay = { days = 4 }
	 	gpt_power_struggle_check
    }
	on_actions = {
		delay = { days = 5 }
	 	gpt_entourage_circle_check
    }
}

yearly_playable_pulse = {
	on_actions = {
		gpt_remove_check
		gpt_remove_check_2
    	gpt_royal_favor_dynasty
		gpt_royal_favor_nobility
		gpt_royal_favor_merchants
		gpt_royal_favor_knights
		gpt_royal_favor_clergy
		gpt_royal_favor_peasants
		gpt_royal_favor_outlaws
    }
}

on_stress_level_1 = {
	on_actions = {
		gpt_senility_stress_1
	}
}
on_stress_level_2 = {
	on_actions = {
		gpt_senility_stress_2
	}
}
on_stress_level_3 = {
	on_actions = {
		gpt_senility_stress_3
	}
}
gpt_senility_stress_1 = {
	trigger = {
		is_ai = no
		NOT = { has_character_flag = gpt_stress_1_flag }
	}
	effect = {
		add_character_flag = gpt_stress_1_flag
	}
}
gpt_senility_stress_2 = {
	trigger = {
		is_ai = no
		NOT = { has_character_flag = gpt_stress_2_flag }
	}
	effect = {
		add_character_flag = gpt_stress_2_flag
	}
}
gpt_senility_stress_3 = {
	trigger = {
		is_ai = no
		NOT = { has_character_flag = gpt_stress_3_flag }
	}
	effect = {
		add_character_flag = gpt_stress_3_flag
	}
}

gpt_expansion_traits_start = {
	trigger = {
		NOT = { has_game_rule = GPT_rfavor_disabled }
	}
	effect = {
		every_ruler = {
			if = {
				limit = {
					is_landless_adventurer = no
					is_ai = no
				}
				add_trait = gpt_social_strata
				add_trait = gpt_court_skill
			 	add_trait = gpt_army_xp
				add_trait = gpt_realm_ethos
				add_trait = gpt_power_struggle
				add_trait = gpt_entourage_circle
				add_character_flag = {
					flag = gpt_rfavor_player_start
					years = 2
				}
			}
		}
	}
}

gpt_royal_favor_start = {
	trigger = {
		NOT = { has_game_rule = GPT_rfavor_disabled }
	 #	OR = {
	 #		has_game_rule = GPT_rfavor_player
	 #		has_game_rule = GPT_rfavor_count
	 #		has_game_rule = GPT_rfavor_duke
	 #		has_game_rule = GPT_rfavor_king
	 #	}
	}
	effect = {
		every_ruler = {
			if = {
				limit = {
					is_landless_adventurer = no
				 #	is_landed = yes
					NOT = { has_game_rule = GPT_rfavor_disabled }
					OR = {
						AND = {
							NOT = { has_game_rule = GPT_rfavor_player }
							highest_held_title_tier >= gpt_rfavor_tier
						}
						is_ai = no
					}
				}
				if = { limit = { NOT = { has_trait = gpt_social_strata } } add_trait = gpt_social_strata }
				add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = 45 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = 45 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = 45 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = 45 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = 45 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = 45 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = 45 }
			 #	if = {
			 #		limit = {
			 #			is_ai = no
			 #		}
			 #		trigger_event = {
			 #			id = bestow_favor_events.9999
			 #		}
			 #	}
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					government_has_flag = government_is_landless_adventurer
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = 20 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = -20 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					OR = {
						government_has_flag = government_is_administrative
						government_has_flag = government_has_treasury
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = 10 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = 10 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = -10 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = -10 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					government_has_flag = government_is_feudal
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = 20 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = -20 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					government_has_flag = government_is_clan
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = 20 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = -20 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					OR = { government_has_flag = government_is_tribal government_has_flag = government_is_nomadic }
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = 20 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = -20 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					OR = {
						culture = { has_cultural_tradition = tradition_horse_lords }
						culture = { has_cultural_tradition = tradition_devoted_horsemanship }
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = 20 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = -20 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					faith = { has_doctrine_parameter = unreformed }
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = 20 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = -20 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					culture = { has_cultural_pillar = ethos_bellicose }
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = 20 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = -20 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					culture = { has_cultural_pillar = ethos_bureaucratic }
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = 20 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = -20 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					culture = { has_cultural_pillar = ethos_communal }
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = 20 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = -20 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					culture = { has_cultural_pillar = ethos_spiritual }
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = 20 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = -20 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					culture = { has_cultural_pillar = ethos_egalitarian }
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = 20 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = -20 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					culture = { has_cultural_pillar = ethos_stoic }
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = 20 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = -20 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					Or = {
						has_trait = brave
						has_trait = ambitious
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = 15 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					Or = {
						has_trait = greedy
						has_trait = just
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = 15 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					Or = {
						has_trait = arrogant
						has_trait = diligent
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = 15 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					Or = {
						has_trait = zealous
						has_trait = trusting
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = 15 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					Or = {
						has_trait = deceitful
						has_trait = arbitrary
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = 15 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					Or = {
						has_trait = compassionate
						has_trait = humble
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = 15 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					Or = {
						has_trait = craven
						has_trait = content
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = -15 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					Or = {
						has_trait = generous
						has_trait = arbitrary
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = -15 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					Or = {
						has_trait = humble
						has_trait = lazy
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = -15 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					Or = {
						has_trait = cynical
						has_trait = paranoid
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = -15 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					Or = {
						has_trait = honest
						has_trait = just
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = -15 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					Or = {
						has_trait = sadistic
						has_trait = arrogant
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = -15 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = 5 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = 5 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = 5 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = 5 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = 5 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = 5 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = 5 }
			}
		}
	}	
}

gpt_royal_favor_check = {
	trigger = {
		is_landless_adventurer = no
	 #	is_landed = yes
	 	NOT = { has_game_rule = GPT_rfavor_disabled }
		OR = {
			is_ai = no
			has_game_rule = GPT_rfavor_count
			has_game_rule = GPT_rfavor_duke
			has_game_rule = GPT_rfavor_king
		}
	}
	effect = {
		if = {
			limit = {
				is_ai = yes
				OR = {
					has_game_rule = GPT_rfavor_disabled
					highest_held_title_tier < gpt_rfavor_tier
				}
				has_trait = gpt_social_strata
			}
			remove_trait = gpt_social_strata
		}
		if = {
			limit = {
			 #	is_landed = yes
				NOT = { has_game_rule = GPT_rfavor_disabled }
				OR = {
					highest_held_title_tier >= gpt_rfavor_tier
					is_ai = no
				}
				NOT = { has_trait = gpt_social_strata }
			}

			add_trait = gpt_social_strata

			add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = -100 }
			add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = -100 }
			add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = -100 }
			add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = -100 }
			add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = -100 }
			add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = -100 }
			add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = -100 }

			add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = 45 }
			add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = 45 }
			add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = 45 }
			add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = 45 }
			add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = 45 }
			add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = 45 }
			add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = 45 }

			if = {
				limit = {
					has_trait = gpt_social_strata
					government_has_flag = government_is_landless_adventurer
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = 20 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = -20 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					OR = {
						government_has_flag = government_is_administrative
						government_has_flag = government_has_treasury
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = 10 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = 10 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = -10 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = -10 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					government_has_flag = government_is_feudal
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = 20 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = -20 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					government_has_flag = government_is_clan
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = 20 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = -20 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					OR = { government_has_flag = government_is_tribal government_has_flag = government_is_nomadic }
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = 20 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = -20 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					OR = {
						culture = { has_cultural_tradition = tradition_horse_lords }
						culture = { has_cultural_tradition = tradition_devoted_horsemanship }
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = 20 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = -20 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					faith = { has_doctrine_parameter = unreformed }
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = 20 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = -20 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					culture = { has_cultural_pillar = ethos_bellicose }
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = 20 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = -20 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					culture = { has_cultural_pillar = ethos_bureaucratic }
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = 20 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = -20 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					culture = { has_cultural_pillar = ethos_communal }
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = 20 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = -20 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					culture = { has_cultural_pillar = ethos_spiritual }
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = 20 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = -20 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					culture = { has_cultural_pillar = ethos_egalitarian }
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = 20 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = -20 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					culture = { has_cultural_pillar = ethos_stoic }
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = 20 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = -20 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					Or = {
						has_trait = brave
						has_trait = ambitious
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = 15 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					Or = {
						has_trait = greedy
						has_trait = just
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = 15 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					Or = {
						has_trait = arrogant
						has_trait = diligent
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = 15 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					Or = {
						has_trait = zealous
						has_trait = trusting
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = 15 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					Or = {
						has_trait = deceitful
						has_trait = arbitrary
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = 15 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					Or = {
						has_trait = compassionate
						has_trait = humble
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = 15 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					Or = {
						has_trait = craven
						has_trait = content
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = -15 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					Or = {
						has_trait = generous
						has_trait = arbitrary
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = -15 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					Or = {
						has_trait = humble
						has_trait = lazy
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = -15 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					Or = {
						has_trait = cynical
						has_trait = paranoid
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = -15 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					Or = {
						has_trait = honest
						has_trait = just
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = -15 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
					Or = {
						has_trait = sadistic
						has_trait = arrogant
					}
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = -15 }
			}
			if = {
				limit = {
					has_trait = gpt_social_strata
				}
				add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = 5 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = 5 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = 5 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = 5 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = 5 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = 5 }
				add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = 5 }
			}
		}
	}	
}

gpt_court_skill_check = {
	trigger = {
		is_landless_adventurer = no
		NOT = { has_game_rule = GPT_rfavor_disabled }
		OR = {
			is_ai = no
			has_game_rule = GPT_rfavor_count
			has_game_rule = GPT_rfavor_duke
			has_game_rule = GPT_rfavor_king
		}
	}
	effect = {
		if = {
			limit = {
				is_ai = yes
				OR = {
					has_game_rule = GPT_rfavor_disabled
					highest_held_title_tier < gpt_rfavor_tier
				}
			}
			if = { limit = { has_trait = gpt_court_skill } remove_trait = gpt_court_skill }
		}

		if = {
			limit = {
			 #	is_adult = yes
			 	NOT = { has_game_rule = GPT_rfavor_disabled }
				OR = {
					highest_held_title_tier >= gpt_rfavor_tier
					is_ai = no
				}
			}
			if = { limit = { NOT = { has_trait = gpt_court_skill } } add_trait = gpt_court_skill }
			add_trait_xp = { trait = gpt_court_skill track = gpt_diplomacy_track value = -100 }
			add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = -100 }
			add_trait_xp = { trait = gpt_court_skill track = gpt_martial_track value = -100 }
			add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = -100 }
			add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = -100 }
			add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = 100 }
			add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = 100 }



			if = {
				limit = {
					has_trait = gpt_court_skill
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_diplomacy_track value = root.diplomacy }
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = root.stewardship }
				add_trait_xp = { trait = gpt_court_skill track = gpt_martial_track value = root.martial }
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = root.intrigue }
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = root.learning }
			}



			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.10
						num_virtuous_traits >= 1
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_diplomacy_track value = 20 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.20
						num_virtuous_traits >= 1
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_diplomacy_track value = 20 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.30
						num_virtuous_traits >= 1
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_diplomacy_track value = 20 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.40
						num_virtuous_traits >= 1
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_diplomacy_track value = 20 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.50
						num_virtuous_traits >= 1
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_diplomacy_track value = 20 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.10
						num_sinful_traits >= 1
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_diplomacy_track value = -10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.20
						num_sinful_traits >= 1
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_diplomacy_track value = -10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.30
						num_sinful_traits >= 1
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_diplomacy_track value = -10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.40
						num_sinful_traits >= 1
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_diplomacy_track value = -10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.50
						num_sinful_traits >= 1
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_diplomacy_track value = -10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.10
						OR = {
							has_trait = gregarious
							has_trait = calm
							has_trait = forgiving
							has_trait = generous
							has_trait = compassionate
							has_trait = patient
							has_trait = trusting
							has_trait = gluttonous
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_diplomacy_track value = 20 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.20
						OR = {
							has_trait = gregarious
							has_trait = calm
							has_trait = forgiving
							has_trait = generous
							has_trait = compassionate
							has_trait = patient
							has_trait = trusting
							has_trait = gluttonous
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_diplomacy_track value = 20 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.30
						OR = {
							has_trait = gregarious
							has_trait = calm
							has_trait = forgiving
							has_trait = generous
							has_trait = compassionate
							has_trait = patient
							has_trait = trusting
							has_trait = gluttonous
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_diplomacy_track value = 20 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.40
						OR = {
							has_trait = gregarious
							has_trait = calm
							has_trait = forgiving
							has_trait = generous
							has_trait = compassionate
							has_trait = patient
							has_trait = trusting
							has_trait = gluttonous
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_diplomacy_track value = 20 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.50
						OR = {
							has_trait = gregarious
							has_trait = calm
							has_trait = forgiving
							has_trait = generous
							has_trait = compassionate
							has_trait = patient
							has_trait = trusting
							has_trait = gluttonous
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_diplomacy_track value = 20 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.10
						OR = {
							has_trait = shy
							has_trait = wrathful
							has_trait = vengeful
							has_trait = greedy
							has_trait = sadistic
							has_trait = impatient
							has_trait = paranoid
							has_trait = lustful
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_diplomacy_track value = -10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.20
						OR = {
							has_trait = shy
							has_trait = wrathful
							has_trait = vengeful
							has_trait = greedy
							has_trait = sadistic
							has_trait = impatient
							has_trait = paranoid
							has_trait = lustful
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_diplomacy_track value = -10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.30
						OR = {
							has_trait = shy
							has_trait = wrathful
							has_trait = vengeful
							has_trait = greedy
							has_trait = sadistic
							has_trait = impatient
							has_trait = paranoid
							has_trait = lustful
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_diplomacy_track value = -10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.40
						OR = {
							has_trait = shy
							has_trait = wrathful
							has_trait = vengeful
							has_trait = greedy
							has_trait = sadistic
							has_trait = impatient
							has_trait = paranoid
							has_trait = lustful
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_diplomacy_track value = -10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.50
						OR = {
							has_trait = shy
							has_trait = wrathful
							has_trait = vengeful
							has_trait = greedy
							has_trait = sadistic
							has_trait = impatient
							has_trait = paranoid
							has_trait = lustful
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_diplomacy_track value = -10 }
			}















			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_chancellor
					cp:councillor_chancellor  = {
						diplomacy >= 8
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 4 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_chancellor
					cp:councillor_chancellor  = {
						diplomacy >= 12
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 6 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_chancellor
					cp:councillor_chancellor  = {
						diplomacy >= 16
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_chancellor
					cp:councillor_chancellor  = {
						diplomacy >= 20
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_chancellor
					cp:councillor_chancellor  = {
						diplomacy >= 24
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 12 }
			}

			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_steward
					cp:councillor_steward  = {
						stewardship >= 8
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 2 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_steward
					cp:councillor_steward  = {
						stewardship >= 12
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 4 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_steward
					cp:councillor_steward  = {
						stewardship >= 16
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 6 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_steward
					cp:councillor_steward  = {
						stewardship >= 20
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 7 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_steward
					cp:councillor_steward  = {
						stewardship >= 24
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 8 }
			}

			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_marshal
					cp:councillor_marshal  = {
						martial >= 8
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 2 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_marshal
					cp:councillor_marshal  = {
						martial >= 12
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 4 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_marshal
					cp:councillor_marshal  = {
						martial >= 16
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 6 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_marshal
					cp:councillor_marshal  = {
						martial >= 20
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 7 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_marshal
					cp:councillor_marshal  = {
						martial >= 24
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 8 }
			}

			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_spymaster
					cp:councillor_spymaster  = {
						intrigue >= 8
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 2 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_spymaster
					cp:councillor_spymaster  = {
						intrigue >= 12
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 4 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_spymaster
					cp:councillor_spymaster  = {
						intrigue >= 16
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 6 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_spymaster
					cp:councillor_spymaster  = {
						intrigue >= 20
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 7 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_spymaster
					cp:councillor_spymaster  = {
						intrigue >= 24
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 8 }
			}

			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain  = {
						learning >= 8
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 2 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain  = {
						learning >= 12
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 4 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain  = {
						learning >= 16
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 6 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain  = {
						learning >= 20
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 7 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain  = {
						learning >= 24
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 8 }
			}


			








			if = {
				limit = {
					has_trait = gpt_court_skill
					any_knight = {
						count = 1
						martial >= 12
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_martial_track value = 8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_knight = {
							count = 2
							martial >= 12
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_martial_track value = 8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_knight = {
							count = 3
							martial >= 12
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_martial_track value = 8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_knight = {
							count = 4
							martial >= 12
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_martial_track value = 8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_knight = {
							count = 5
							martial >= 12
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_martial_track value = 8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_knight = {
							martial >= 16
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_martial_track value = 8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_knight = {
							martial >= 20
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_martial_track value = 8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_knight = {
							martial >= 24
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_martial_track value = 8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_knight = {
							martial >= 28
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_martial_track value = 8 }
			}

			if = {
				limit = {
					has_trait = gpt_court_skill
					any_knight = {
						count = 1
						prowess >= 12
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_martial_track value = 8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_knight = {
							count = 2
							prowess >= 12
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_martial_track value = 8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_knight = {
							count = 3
							prowess >= 12
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_martial_track value = 8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_knight = {
							count = 4
							prowess >= 12
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_martial_track value = 8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_knight = {
							count = 5
							prowess >= 12
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_martial_track value = 8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_knight = {
							prowess >= 16
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_martial_track value = 8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_knight = {
							prowess >= 20
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_martial_track value = 8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_knight = {
							prowess >= 24
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_martial_track value = 8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_knight = {
							prowess >= 28
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_martial_track value = 8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_knight = {
						percent >= 0.20
						OR = {
							has_trait = logistician
							has_trait = military_engineer
							has_trait = aggressive_attacker
							has_trait = unyielding_defender
							has_trait = flexible_leader
							has_trait = desert_warrior
							has_trait = jungle_stalker
							has_trait = reaver
							has_trait = reckless
							has_trait = holy_warrior
							has_trait = open_terrain_expert
							has_trait = rough_terrain_expert
							has_trait = forest_fighter
							has_trait = cautious_leader
							has_trait = organizer
							has_trait = winter_soldier
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_martial_track value = 8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_knight = {
						percent >= 0.35
						OR = {
							has_trait = logistician
							has_trait = military_engineer
							has_trait = aggressive_attacker
							has_trait = unyielding_defender
							has_trait = flexible_leader
							has_trait = desert_warrior
							has_trait = jungle_stalker
							has_trait = reaver
							has_trait = reckless
							has_trait = holy_warrior
							has_trait = open_terrain_expert
							has_trait = rough_terrain_expert
							has_trait = forest_fighter
							has_trait = cautious_leader
							has_trait = organizer
							has_trait = winter_soldier
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_martial_track value = 8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_knight = {
						percent >= 0.50
						OR = {
							has_trait = logistician
							has_trait = military_engineer
							has_trait = aggressive_attacker
							has_trait = unyielding_defender
							has_trait = flexible_leader
							has_trait = desert_warrior
							has_trait = jungle_stalker
							has_trait = reaver
							has_trait = reckless
							has_trait = holy_warrior
							has_trait = open_terrain_expert
							has_trait = rough_terrain_expert
							has_trait = forest_fighter
							has_trait = cautious_leader
							has_trait = organizer
							has_trait = winter_soldier
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_martial_track value = 8 }
			}













			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest  = {
						percent >= 0.10
						OR = {
							has_trait = brave
							has_trait = shrewd
							dread >= 40
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest  = {
						percent >= 0.20
						OR = {
							has_trait = brave
							has_trait = shrewd
							dread >= 40
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest  = {
						percent >= 0.30
						OR = {
							has_trait = brave
							has_trait = shrewd
							dread >= 40
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest  = {
						percent >= 0.40
						OR = {
							has_trait = brave
							has_trait = shrewd
							dread >= 40
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest  = {
						percent >= 0.50
						OR = {
							has_trait = brave
							has_trait = shrewd
							dread >= 40
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest  = {
						count = 1
						diplomacy >= 10
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_courtier_or_guest  = {
							count = 2
							diplomacy >= 10
						}
						any_courtier_or_guest  = {
							count = 1
							diplomacy >= 12
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_courtier_or_guest  = {
							count = 3
							diplomacy >= 10
						}
						any_courtier_or_guest  = {
							count = 1
							diplomacy >= 14
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_courtier_or_guest  = {
							count = 4
							diplomacy >= 10
						}
						any_courtier_or_guest  = {
							count = 1
							diplomacy >= 16
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_courtier_or_guest  = {
							count = 5
							diplomacy >= 10
						}
						any_courtier_or_guest  = {
							count = 1
							diplomacy >= 18
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 5 }
			}

			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest  = {
						count = 1
						stewardship >= 10
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_courtier_or_guest  = {
							count = 2
							stewardship >= 10
						}
						any_courtier_or_guest  = {
							count = 1
							stewardship >= 12
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_courtier_or_guest  = {
							count = 3
							stewardship >= 10
						}
						any_courtier_or_guest  = {
							count = 1
							stewardship >= 14
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_courtier_or_guest  = {
							count = 4
							stewardship >= 10
						}
						any_courtier_or_guest  = {
							count = 1
							stewardship >= 16
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_courtier_or_guest  = {
							count = 5
							stewardship >= 10
						}
						any_courtier_or_guest  = {
							count = 1
							stewardship >= 18
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 5 }
			}

			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest  = {
						count = 1
						martial >= 10
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_courtier_or_guest  = {
							count = 2
							martial >= 10
						}
						any_courtier_or_guest  = {
							count = 1
							martial >= 12
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_courtier_or_guest  = {
							count = 3
							martial >= 10
						}
						any_courtier_or_guest  = {
							count = 1
							martial >= 14
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_courtier_or_guest  = {
							count = 4
							martial >= 10
						}
						any_courtier_or_guest  = {
							count = 1
							martial >= 16
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_courtier_or_guest  = {
							count = 5
							martial >= 10
						}
						any_courtier_or_guest  = {
							count = 1
							martial >= 18
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 5 }
			}

			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest  = {
						count = 1
						intrigue >= 10
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_courtier_or_guest  = {
							count = 2
							intrigue >= 10
						}
						any_courtier_or_guest  = {
							count = 1
							intrigue >= 12
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_courtier_or_guest  = {
							count = 3
							intrigue >= 10
						}
						any_courtier_or_guest  = {
							count = 1
							intrigue >= 14
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_courtier_or_guest  = {
							count = 4
							intrigue >= 10
						}
						any_courtier_or_guest  = {
							count = 1
							intrigue >= 16
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_courtier_or_guest  = {
							count = 5
							intrigue >= 10
						}
						any_courtier_or_guest  = {
							count = 1
							intrigue >= 18
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 5 }
			}

			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest  = {
						count = 1
						learning >= 10
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_courtier_or_guest  = {
							count = 2
							learning >= 10
						}
						any_courtier_or_guest  = {
							count = 1
							learning >= 12
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_courtier_or_guest  = {
							count = 3
							learning >= 10
						}
						any_courtier_or_guest  = {
							count = 1
							learning >= 14
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_courtier_or_guest  = {
							count = 4
							learning >= 10
						}
						any_courtier_or_guest  = {
							count = 1
							learning >= 16
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					OR = {
						any_courtier_or_guest  = {
							count = 5
							learning >= 10
						}
						any_courtier_or_guest  = {
							count = 1
							learning >= 18
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 5 }
			}






			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.1
						is_councillor = no
						OR = {
							has_trait = education_diplomacy_3
							has_trait = education_stewardship_3
							has_trait = education_intrigue_3
							has_trait = education_martial_3
							has_trait = education_learning_3
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.2
						is_councillor = no
						OR = {
							has_trait = education_diplomacy_3
							has_trait = education_stewardship_3
							has_trait = education_intrigue_3
							has_trait = education_martial_3
							has_trait = education_learning_3
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.3
						is_councillor = no
						OR = {
							has_trait = education_diplomacy_3
							has_trait = education_stewardship_3
							has_trait = education_intrigue_3
							has_trait = education_martial_3
							has_trait = education_learning_3
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.1
						is_councillor = no
						OR = {
							has_trait = education_diplomacy_4
							has_trait = education_stewardship_4
							has_trait = education_intrigue_4
							has_trait = education_martial_4
							has_trait = education_learning_4
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 15 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.2
						is_councillor = no
						OR = {
							has_trait = education_diplomacy_4
							has_trait = education_stewardship_4
							has_trait = education_intrigue_4
							has_trait = education_martial_4
							has_trait = education_learning_4
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 15 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.3
						is_councillor = no
						OR = {
							has_trait = education_diplomacy_4
							has_trait = education_stewardship_4
							has_trait = education_intrigue_4
							has_trait = education_martial_4
							has_trait = education_learning_4
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 15 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						is_councillor = no
						OR = {
							has_trait = education_diplomacy_5
							has_trait = education_stewardship_5
							has_trait = education_intrigue_5
							has_trait = education_martial_5
							has_trait = education_learning_5
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 20 }
			}
			


			if = {
				limit = {
					has_trait = gpt_court_skill
					any_knight = {
						percent >= 0.15
						is_councillor = no
						OR = {
							has_trait = education_diplomacy_3
							has_trait = education_stewardship_3
							has_trait = education_intrigue_3
							has_trait = education_martial_3
							has_trait = education_learning_3
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_knight = {
						percent >= 0.3
						is_councillor = no
						OR = {
							has_trait = education_diplomacy_3
							has_trait = education_stewardship_3
							has_trait = education_intrigue_3
							has_trait = education_martial_3
							has_trait = education_learning_3
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_knight = {
						percent >= 0.45
						is_councillor = no
						OR = {
							has_trait = education_diplomacy_3
							has_trait = education_stewardship_3
							has_trait = education_intrigue_3
							has_trait = education_martial_3
							has_trait = education_learning_3
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_knight = {
						percent >= 0.15
						is_councillor = no
						OR = {
							has_trait = education_diplomacy_4
							has_trait = education_stewardship_4
							has_trait = education_intrigue_4
							has_trait = education_martial_4
							has_trait = education_learning_4
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 15 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_knight = {
						percent >= 0.3
						is_councillor = no
						OR = {
							has_trait = education_diplomacy_4
							has_trait = education_stewardship_4
							has_trait = education_intrigue_4
							has_trait = education_martial_4
							has_trait = education_learning_4
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 15 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_knight = {
						percent >= 0.45
						is_councillor = no
						OR = {
							has_trait = education_diplomacy_4
							has_trait = education_stewardship_4
							has_trait = education_intrigue_4
							has_trait = education_martial_4
							has_trait = education_learning_4
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 15 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_knight = {
						is_councillor = no
						OR = {
							has_trait = education_diplomacy_5
							has_trait = education_stewardship_5
							has_trait = education_intrigue_5
							has_trait = education_martial_5
							has_trait = education_learning_5
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 20 }
			}


			if = {
				limit = {
					has_trait = gpt_court_skill
					any_councillor = {
						percent >= 0.2
						OR = {
							has_trait = education_diplomacy_3
							has_trait = education_stewardship_3
							has_trait = education_intrigue_3
							has_trait = education_martial_3
							has_trait = education_learning_3
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_councillor = {
						percent >= 0.4
						OR = {
							has_trait = education_diplomacy_3
							has_trait = education_stewardship_3
							has_trait = education_intrigue_3
							has_trait = education_martial_3
							has_trait = education_learning_3
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_councillor = {
						percent >= 0.6
						OR = {
							has_trait = education_diplomacy_3
							has_trait = education_stewardship_3
							has_trait = education_intrigue_3
							has_trait = education_martial_3
							has_trait = education_learning_3
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_councillor = {
						percent >= 0.2
						OR = {
							has_trait = education_diplomacy_4
							has_trait = education_stewardship_4
							has_trait = education_intrigue_4
							has_trait = education_martial_4
							has_trait = education_learning_4
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 15 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_councillor = {
						percent >= 0.4
						OR = {
							has_trait = education_diplomacy_4
							has_trait = education_stewardship_4
							has_trait = education_intrigue_4
							has_trait = education_martial_4
							has_trait = education_learning_4
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 15 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_councillor = {
						percent >= 0.6
						OR = {
							has_trait = education_diplomacy_4
							has_trait = education_stewardship_4
							has_trait = education_intrigue_4
							has_trait = education_martial_4
							has_trait = education_learning_4
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 15 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_councillor = {
						OR = {
							has_trait = education_diplomacy_5
							has_trait = education_stewardship_5
							has_trait = education_intrigue_5
							has_trait = education_martial_5
							has_trait = education_learning_5
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 20 }
			}

			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.1
						is_councillor = no
						num_of_known_languages >= 3
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_knight = {
						percent >= 0.15
						is_councillor = no
						num_of_known_languages >= 3
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_councillor = {
						percent >= 0.2
						num_of_known_languages >= 3
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.2
						is_councillor = no
						num_of_known_languages >= 3
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_knight = {
						percent >= 0.30
						is_councillor = no
						num_of_known_languages >= 3
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_councillor = {
						percent >= 0.4
						num_of_known_languages >= 3
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 10 }
			}







			



			if = {
				limit = {
					has_trait = gpt_court_skill
					any_knight = {
						percent >= 0.4
						opinion = {
							target = root
							value <= 0
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = -8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_knight = {
						percent >= 0.25
						opinion = {
							target = root
							value <= -50
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = -8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_knight = {
						percent >= 0.1
						is_powerful_vassal = no
						opinion = {
							target = root
							value <= -100
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = -8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_councillor = {
						is_powerful_vassal = no
						opinion = {
							target = root
							value <= 0
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = -12 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_councillor = {
						percent >= 0.5
						opinion = {
							target = root
							value <= 0
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = -12 }
			}

			if = {
				limit = {
					has_trait = gpt_court_skill
					any_councillor = {
						is_powerful_vassal = no
						opinion = {
							target = root
							value <= -50
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = -12 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_councillor = {
						percent >= 0.5
						opinion = {
							target = root
							value <= -50
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = -12 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_councillor = {
						is_powerful_vassal = no
						opinion = {
							target = root
							value <= -100
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = -12 }
			}

		 #	if = {
		 #		limit = {
		 #			has_trait = gpt_court_skill
		 #			any_councillor = {
		 #				percent >= 0.5
		 #				is_powerful_vassal = yes
		 #			}
		 #		}
		 #		add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = -12 }
		 #	}
		 #	if = {
		 #		limit = {
		 #			has_trait = gpt_court_skill
		 #			any_councillor = {
		 #				percent >= 1
		 #				is_powerful_vassal = yes
		 #			}
		 #		}
		 #		add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = -12 }
		 #	}

			if = {
				limit = {
					has_trait = gpt_court_skill
					any_councillor = {
						percent >= 0.5
						OR = {
							has_trait = disloyal
							has_trait = arrogant
							has_trait = ambitious
							has_trait = arbitrary
							has_trait = paranoid
							has_trait = greedy
							has_trait = deceitful
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = -12 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_councillor = {
						percent >= 0.5
						OR = {
							has_trait = loyal
							has_trait = humble
							has_trait = content
							has_trait = just
							has_trait = trusting
							has_trait = honest
							has_trait = generous
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = 12 }
			}

			if = {
				limit = {
					has_trait = gpt_court_skill
					any_powerful_vassal = {
						percent >= 0.5
						opinion = {
							target = root
							value <= 0
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = -12 }
			}

			if = {
				limit = {
					has_trait = gpt_court_skill
					any_vassal = {
						percent >= 0.40
						is_powerful_vassal = no
						opinion = {
							target = root
							value <= 0
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = -8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_vassal = {
						percent >= 0.25
						is_powerful_vassal = no
						opinion = {
							target = root
							value <= -50
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = -8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.40
						is_powerful_vassal = no
						opinion = {
							target = root
							value <= 0
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = -8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.25
						opinion = {
							target = root
							value <= -50
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = -8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent = 0.10
						opinion = {
							target = root
							value <= -100
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = -8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.40
						OR = {
							has_trait = disloyal
							has_trait = arrogant
							has_trait = ambitious
							has_trait = arbitrary
							has_trait = paranoid
							has_trait = greedy
							has_trait = deceitful
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = -8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_courtier_or_guest = {
						percent >= 0.40
						OR = {
							has_trait = loyal
							has_trait = humble
							has_trait = content
							has_trait = just
							has_trait = trusting
							has_trait = honest
							has_trait = generous
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = 8 }
			}

			if = {
				limit = {
					has_trait = gpt_court_skill
					any_powerful_vassal = {
						opinion = {
							target = root
							value <= 0
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = -12 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_powerful_vassal = {
						opinion = {
							target = root
							value <= -50
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = -12 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_powerful_vassal = {
						percent >= 0.5
						opinion = {
							target = root
							value <= -50
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = -12 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_powerful_vassal = {
						opinion = {
							target = root
							value <= -100
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = -12 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_vassal = {
						percent = 0.10
						is_powerful_vassal = no
						opinion = {
							target = root
							value <= -100
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = -8 }
			}		
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_vassal = {
						percent >= 0.30
						is_powerful_vassal = no
						OR = {
							has_trait = disloyal
							has_trait = arrogant
							has_trait = ambitious
							has_trait = arbitrary
							has_trait = paranoid
							has_trait = greedy
							has_trait = deceitful
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = -8 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_vassal = {
						percent >= 0.30
						is_powerful_vassal = no
						OR = {
							has_trait = loyal
							has_trait = humble
							has_trait = content
							has_trait = just
							has_trait = trusting
							has_trait = honest
							has_trait = generous
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = 8 }
			}

			if = {
				limit = {
					has_trait = gpt_court_skill
					any_powerful_vassal = {
						percent >= 0.5
						OR = {
							has_trait = disloyal
							has_trait = arrogant
							has_trait = ambitious
							has_trait = arbitrary
							has_trait = paranoid
							has_trait = greedy
							has_trait = deceitful
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = -12 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_powerful_vassal = {
						percent >= 0.5
						OR = {
							has_trait = loyal
							has_trait = humble
							has_trait = content
							has_trait = just
							has_trait = trusting
							has_trait = honest
							has_trait = generous
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = 12 }
			}







			if = {
				limit = {
					has_trait = gpt_court_skill
					any_knight = {
						count >= 2
						is_lowborn = yes
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -3 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_knight = {
						count >= 4
						is_lowborn = yes
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -3 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_knight = {
						count >= 6
						is_lowborn = yes
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -3 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_knight = {
						count >= 8
						is_lowborn = yes
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -3 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_knight = {
						count >= 10
						is_lowborn = yes
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -3 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_councillor = {
						count >= 1
						is_lowborn = yes
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_councillor = {
						count >= 2
						is_lowborn = yes
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_councillor = {
						count >= 3
						is_lowborn = yes
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -10 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_councillor = {
						count >= 4
						is_lowborn = yes
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_consort = {
						count >= 2
						is_lowborn = yes
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -4 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_consort = {
						count >= 3
						is_lowborn = yes
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -4 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_consort = {
						count >= 4
						is_lowborn = yes
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -4 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_court_position_holder = {
						count >= 1
						is_lowborn = yes
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -2 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_court_position_holder = {
						count >= 2
						is_lowborn = yes
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -2 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_court_position_holder = {
						count >= 3
						is_lowborn = yes
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -2 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_court_position_holder = {
						count >= 4
						is_lowborn = yes
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -2 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_court_position_holder = {
						count >= 5
						is_lowborn = yes
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -2 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_court_position_holder = {
						count >= 1
						is_lowborn = yes
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -2 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = primary_spouse
					primary_spouse = {
						is_lowborn = yes
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -12 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = primary_spouse
					primary_spouse = {
						num_sinful_traits >= 1
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -3 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = primary_spouse
					primary_spouse = {
						num_sinful_traits >= 2
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -3 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = primary_spouse
					primary_spouse = {
						num_sinful_traits >= 3
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -3 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = primary_spouse
					primary_spouse = {
						piety_level = 0
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -2 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = faith.religious_head
					faith.religious_head = {
						opinion = {
							target = root
							value <= 50
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -2 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = faith.religious_head
					faith.religious_head = {
						opinion = {
							target = root
							value <= 0
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -2 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = faith.religious_head
					faith.religious_head = {
						opinion = {
							target = root
							value <= -50
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -2 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = faith.religious_head
					faith.religious_head = {
						opinion = {
							target = root
							value <= -100
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -2 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						opinion = {
							target = root
							value <= 50
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -3 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						opinion = {
							target = root
							value <= 0
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -3 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						opinion = {
							target = root
							value <= -50
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -3 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						opinion = {
							target = root
							value <= -100
						}
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -3 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_vassal = {
						percent >= 0.1
						num_sinful_traits >= 1
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -2 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_vassal = {
						percent >= 0.2
						num_sinful_traits >= 1
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -2 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_vassal = {
						percent >= 0.3
						num_sinful_traits >= 1
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -2 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_councillor = {
						count >= 1
						num_sinful_traits >= 1
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -2 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_councillor = {
						count >= 2
						num_sinful_traits >= 1
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -2 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					any_councillor = {
						count >= 3
						num_sinful_traits >= 1
					}
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -2 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					num_sinful_traits >= 1
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					num_sinful_traits >= 2
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					num_sinful_traits >= 3
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -5 }
			}
			if = {
				limit = {
					has_trait = gpt_court_skill
					piety_level = 0
				}
				add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = -5 }
			}


			add_trait_xp = { trait = gpt_court_skill track = gpt_legitimacy_track value = 0.1 }
			add_trait_xp = { trait = gpt_court_skill track = gpt_loyalty_track value = 0.1 }
			add_trait_xp = { trait = gpt_court_skill track = gpt_diplomacy_track value = 0.1 }
			add_trait_xp = { trait = gpt_court_skill track = gpt_stewardship_track value = 0.1 }
			add_trait_xp = { trait = gpt_court_skill track = gpt_martial_track value = 0.1 }
			add_trait_xp = { trait = gpt_court_skill track = gpt_intrigue_track value = 0.1 }
			add_trait_xp = { trait = gpt_court_skill track = gpt_learning_track value = 0.1 }
		}
	}	
}

gpt_army_xp_check = {
	trigger = {
		is_landless_adventurer = no
		NOT = { has_game_rule = GPT_rfavor_disabled }
		OR = {
			is_ai = no
			has_game_rule = GPT_rfavor_count
			has_game_rule = GPT_rfavor_duke
			has_game_rule = GPT_rfavor_king
		}
	}
	effect = {
		if = {
			limit = {
				is_ai = yes
				OR = {
					has_game_rule = GPT_rfavor_disabled
					highest_held_title_tier < gpt_rfavor_tier
				}
			}
			if = { limit = { has_trait = gpt_army_xp } remove_trait = gpt_army_xp }
		}
		if = {
			limit = {
				has_trait = gpt_army_xp
				is_at_war = yes
			}
			add_trait_xp = { trait = gpt_army_xp track = gpt_army_dip value = gpt_quarterly_xp_dip }
			add_trait_xp = { trait = gpt_army_xp track = gpt_army_stw value = gpt_quarterly_xp_stw }
			add_trait_xp = { trait = gpt_army_xp track = gpt_army_mar value = gpt_quarterly_xp_mar }
			add_trait_xp = { trait = gpt_army_xp track = gpt_army_int value = gpt_quarterly_xp_int }
			add_trait_xp = { trait = gpt_army_xp track = gpt_army_ler value = gpt_quarterly_xp_ler }
			add_trait_xp = { trait = gpt_army_xp track = gpt_army_dread value = gpt_quarterly_xp_dread }
		}
		if = {
			limit = {
				is_adult = yes
				NOT = { has_game_rule = GPT_rfavor_disabled }
				OR = {
					highest_held_title_tier >= gpt_rfavor_tier
					is_ai = no
				}
				OR = {
					NOT = { has_trait = gpt_army_xp }
					has_character_flag = gpt_rfavor_player_start
				}
			}

			add_trait = gpt_army_xp

			add_trait_xp = { trait = gpt_army_xp track = gpt_army_dip value = -100 }
			add_trait_xp = { trait = gpt_army_xp track = gpt_army_stw value = -100 }
			add_trait_xp = { trait = gpt_army_xp track = gpt_army_mar value = -100 }
			add_trait_xp = { trait = gpt_army_xp track = gpt_army_int value = -100 }
			add_trait_xp = { trait = gpt_army_xp track = gpt_army_ler value = -100 }
			add_trait_xp = { trait = gpt_army_xp track = gpt_army_dread value = -100 }

			if = {
				limit = {
					has_trait = gpt_army_xp
				}
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_dip value = gpt_initial_xp_dip }
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_stw value = gpt_initial_xp_stw }
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_mar value = gpt_initial_xp_mar }
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_int value = gpt_initial_xp_int }
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_ler value = gpt_initial_xp_ler }
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_dread value = gpt_initial_xp_dread }
			}

			if = {
				limit = {
					has_trait = gpt_army_xp
					OR = { government_has_flag = government_is_tribal government_has_flag = government_is_nomadic }
				}
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_dip value = 15 }
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_mar value = 15 }
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_dread value = 20 }
			}

			if = {
				limit = {
					has_trait = gpt_army_xp
					government_has_flag = government_is_clan
				}
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_stw value = 20 }
			 	add_trait_xp = { trait = gpt_army_xp track = gpt_army_int value = 15 }
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_dread value = 15 }
			}

			if = {
				limit = {
					has_trait = gpt_army_xp
					NOR = {
						government_has_flag = government_is_clan
						OR = { government_has_flag = government_is_tribal government_has_flag = government_is_nomadic }
					}
				}
			 	add_trait_xp = { trait = gpt_army_xp track = gpt_army_dip value = 10 }
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_stw value = 10 }
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_mar value = 10 }
			 	add_trait_xp = { trait = gpt_army_xp track = gpt_army_int value = 10 }
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_ler value = 10 }
			}

			if = {
				limit = {
					has_trait = gpt_army_xp
					culture = { has_cultural_pillar = ethos_bellicose }
				}
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_mar value = 10 }
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_dread value = 10 }
			}
			if = {
				limit = {
					has_trait = gpt_army_xp
					culture = { has_cultural_pillar = ethos_bureaucratic }
				}
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_stw value = 10 }
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_ler value = 10 }
			}
			if = {
				limit = {
					has_trait = gpt_army_xp
					culture = { has_cultural_pillar = ethos_communal }
				}
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_mar value = 10 }
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_stw value = 10 }
			}
			if = {
				limit = {
					has_trait = gpt_army_xp
					culture = { has_cultural_pillar = ethos_egalitarian }
				}
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_int value = 10 }
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_ler value = 10 }
			}
			if = {
				limit = {
					has_trait = gpt_army_xp
					culture = { has_cultural_pillar = ethos_courtly }
				}
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_dip value = 10 }
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_int value = 10 }
			}
			if = {
				limit = {
					has_trait = gpt_army_xp
					culture = { has_cultural_pillar = ethos_stoic }
				}
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_dread value = 10 }
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_dip value = 10 }
			}

			if = {
				limit = {
					has_trait = gpt_army_xp
				}
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_dip value = 0.1 }
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_stw value = 0.1 }
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_mar value = 0.1 }
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_int value = 0.1 }
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_ler value = 0.1 }
				add_trait_xp = { trait = gpt_army_xp track = gpt_army_dread value = 0.1 }
			}
		}
	}	
}

gpt_realm_ethos_check = {
	trigger = {
		is_landless_adventurer = no
		NOT = { has_game_rule = GPT_rfavor_disabled }
		OR = {
			is_ai = no
			has_game_rule = GPT_rfavor_count
			has_game_rule = GPT_rfavor_duke
			has_game_rule = GPT_rfavor_king
		}
	}
	effect = {
		
		if = {
			limit = {
				is_ai = yes
				OR = {
					has_game_rule = GPT_rfavor_disabled
					highest_held_title_tier < gpt_rfavor_tier
				}
			}
			if = { limit = { has_trait = gpt_realm_ethos } remove_trait = gpt_realm_ethos }
		}

		if = {
			limit = {
			 #	is_landed = yes
				NOT = { has_game_rule = GPT_rfavor_disabled }
				OR = {
					highest_held_title_tier >= gpt_rfavor_tier
					is_ai = no
				}
			}
			if = { limit = { NOT = { has_trait = gpt_realm_ethos } } add_trait = gpt_realm_ethos }
			add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = -100 }
			add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = -100 }
			add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = -100 }
			add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = -100 }
			add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = -100 }
			add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = -100 }
			add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = -100 }
			add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = -100 }
			add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = -100 }
			
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					OR = {
						has_trait = greedy
						has_trait = ambitious
						has_trait = arbitrary
						has_trait = impatient
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = @ruler }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					exists = primary_heir
					primary_heir = {
						is_adult = yes
						OR = {
							has_trait = greedy
							has_trait = ambitious
							has_trait = arbitrary
							has_trait = impatient
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = @heir }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 1
						OR = {
							has_trait = greedy
							has_trait = ambitious
							has_trait = arbitrary
							has_trait = impatient
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 2
						OR = {
							has_trait = greedy
							has_trait = ambitious
							has_trait = arbitrary
							has_trait = impatient
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 3
						OR = {
							has_trait = greedy
							has_trait = ambitious
							has_trait = arbitrary
							has_trait = impatient
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 4
						OR = {
							has_trait = greedy
							has_trait = ambitious
							has_trait = arbitrary
							has_trait = impatient
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 5
						OR = {
							has_trait = greedy
							has_trait = ambitious
							has_trait = arbitrary
							has_trait = impatient
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 1
						is_councillor = yes
						OR = {
							has_trait = greedy
							has_trait = ambitious
							has_trait = arbitrary
							has_trait = impatient
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 2
						is_councillor = yes
						OR = {
							has_trait = greedy
							has_trait = ambitious
							has_trait = arbitrary
							has_trait = impatient
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 3
						is_councillor = yes
						OR = {
							has_trait = greedy
							has_trait = ambitious
							has_trait = arbitrary
							has_trait = impatient
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 4
						is_councillor = yes
						OR = {
							has_trait = greedy
							has_trait = ambitious
							has_trait = arbitrary
							has_trait = impatient
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 5
						is_councillor = yes
						OR = {
							has_trait = greedy
							has_trait = ambitious
							has_trait = arbitrary
							has_trait = impatient
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = @pvassal }
			}

			if = {
				limit = {
					has_trait = gpt_realm_ethos
					OR = {
						has_trait = generous
						has_trait = content
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = @nruler }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					exists = primary_heir
					primary_heir = {
						is_adult = yes
						OR = {
							has_trait = generous
							has_trait = content
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = @nheir }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 1
						OR = {
							has_trait = generous
							has_trait = content
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 2
						OR = {
							has_trait = generous
							has_trait = content
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 3
						OR = {
							has_trait = generous
							has_trait = content
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 4
						OR = {
							has_trait = generous
							has_trait = content
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 5
						OR = {
							has_trait = generous
							has_trait = content
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 1
						is_councillor = yes
						OR = {
							has_trait = generous
							has_trait = content
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 2
						is_councillor = yes
						OR = {
							has_trait = generous
							has_trait = content
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 3
						is_councillor = yes
						OR = {
							has_trait = generous
							has_trait = content
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 4
						is_councillor = yes
						OR = {
							has_trait = generous
							has_trait = content
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 5
						is_councillor = yes
						OR = {
							has_trait = generous
							has_trait = content
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = @npvassal }
			}












			if = {
				limit = {
					has_trait = gpt_realm_ethos
					OR = {
						has_trait = compassionate
						has_trait = forgiving
						has_trait = humble
						has_trait = generous
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = @ruler }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					exists = primary_heir
					primary_heir = {
						is_adult = yes
						OR = {
							has_trait = compassionate
							has_trait = forgiving
							has_trait = humble
							has_trait = generous
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = @heir }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 1
						OR = {
							has_trait = compassionate
							has_trait = forgiving
							has_trait = humble
							has_trait = generous
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 2
						OR = {
							has_trait = compassionate
							has_trait = forgiving
							has_trait = humble
							has_trait = generous
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 3
						OR = {
							has_trait = compassionate
							has_trait = forgiving
							has_trait = humble
							has_trait = generous
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 4
						OR = {
							has_trait = compassionate
							has_trait = forgiving
							has_trait = humble
							has_trait = generous
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 5
						OR = {
							has_trait = compassionate
							has_trait = forgiving
							has_trait = humble
							has_trait = generous
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 1
						is_councillor = yes
						OR = {
							has_trait = compassionate
							has_trait = forgiving
							has_trait = humble
							has_trait = generous
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 2
						is_councillor = yes
						OR = {
							has_trait = compassionate
							has_trait = forgiving
							has_trait = humble
							has_trait = generous
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 3
						is_councillor = yes
						OR = {
							has_trait = compassionate
							has_trait = forgiving
							has_trait = humble
							has_trait = generous
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 4
						is_councillor = yes
						OR = {
							has_trait = compassionate
							has_trait = forgiving
							has_trait = humble
							has_trait = generous
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 5
						is_councillor = yes
						OR = {
							has_trait = compassionate
							has_trait = forgiving
							has_trait = humble
							has_trait = generous
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = @pvassal }
			}

			if = {
				limit = {
					has_trait = gpt_realm_ethos
						OR = {
							has_trait = callous
							has_trait = cynical
						}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = @nruler }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					exists = primary_heir
					primary_heir = {
						is_adult = yes
						OR = {
							has_trait = callous
							has_trait = cynical
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = @nheir }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 1
						OR = {
							has_trait = callous
							has_trait = cynical
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 2
						OR = {
							has_trait = callous
							has_trait = cynical
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 3
						OR = {
							has_trait = callous
							has_trait = cynical
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 4
						OR = {
							has_trait = callous
							has_trait = cynical
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 5
						OR = {
							has_trait = callous
							has_trait = cynical
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 1
						is_councillor = yes
						OR = {
							has_trait = callous
							has_trait = cynical
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 2
						is_councillor = yes
						OR = {
							has_trait = callous
							has_trait = cynical
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 3
						is_councillor = yes
						OR = {
							has_trait = callous
							has_trait = cynical
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 4
						is_councillor = yes
						OR = {
							has_trait = callous
							has_trait = cynical
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 5
						is_councillor = yes
						OR = {
							has_trait = callous
							has_trait = cynical
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = @npvassal }
			}



















			if = {
				limit = {
					has_trait = gpt_realm_ethos
						OR = {
							has_trait = gluttonous
							has_trait = lustful
							has_trait = arrogant
							has_trait = gregarious
						}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = @ruler }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					exists = primary_heir
					primary_heir = {
						is_adult = yes
						OR = {
							has_trait = gluttonous
							has_trait = lustful
							has_trait = arrogant
							has_trait = gregarious
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = @heir }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 1
						OR = {
							has_trait = gluttonous
							has_trait = lustful
							has_trait = arrogant
							has_trait = gregarious
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 2
						OR = {
							has_trait = gluttonous
							has_trait = lustful
							has_trait = arrogant
							has_trait = gregarious
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 3
						OR = {
							has_trait = gluttonous
							has_trait = lustful
							has_trait = arrogant
							has_trait = gregarious
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 4
						OR = {
							has_trait = gluttonous
							has_trait = lustful
							has_trait = arrogant
							has_trait = gregarious
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 5
						OR = {
							has_trait = gluttonous
							has_trait = lustful
							has_trait = arrogant
							has_trait = gregarious
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 1
						is_councillor = yes
						OR = {
							has_trait = gluttonous
							has_trait = lustful
							has_trait = arrogant
							has_trait = gregarious
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 2
						is_councillor = yes
						OR = {
							has_trait = gluttonous
							has_trait = lustful
							has_trait = arrogant
							has_trait = gregarious
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 3
						is_councillor = yes
						OR = {
							has_trait = gluttonous
							has_trait = lustful
							has_trait = arrogant
							has_trait = gregarious
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 4
						is_councillor = yes
						OR = {
							has_trait = gluttonous
							has_trait = lustful
							has_trait = arrogant
							has_trait = gregarious
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 5
						is_councillor = yes
						OR = {
							has_trait = gluttonous
							has_trait = lustful
							has_trait = arrogant
							has_trait = gregarious
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = @pvassal }
			}

			if = {
				limit = {
					has_trait = gpt_realm_ethos
						OR = {
							has_trait = temperate
							has_trait = chaste
						}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = @nruler }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					exists = primary_heir
					primary_heir = {
						is_adult = yes
						OR = {
							has_trait = temperate
							has_trait = chaste
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = @nheir }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 1
						OR = {
							has_trait = temperate
							has_trait = chaste
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 2
						OR = {
							has_trait = temperate
							has_trait = chaste
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 3
						OR = {
							has_trait = temperate
							has_trait = chaste
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 4
						OR = {
							has_trait = temperate
							has_trait = chaste
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 5
						OR = {
							has_trait = temperate
							has_trait = chaste
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 1
						is_councillor = yes
						OR = {
							has_trait = temperate
							has_trait = chaste
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 2
						is_councillor = yes
						OR = {
							has_trait = temperate
							has_trait = chaste
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 3
						is_councillor = yes
						OR = {
							has_trait = temperate
							has_trait = chaste
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 4
						is_councillor = yes
						OR = {
							has_trait = temperate
							has_trait = chaste
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 5
						is_councillor = yes
						OR = {
							has_trait = temperate
							has_trait = chaste
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = @npvassal }
			}














			if = {
				limit = {
					has_trait = gpt_realm_ethos
						OR = {
							has_trait = brave
							has_trait = zealous
							has_trait = stubborn
							has_trait = wrathful
						}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = @ruler }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					exists = primary_heir
					primary_heir = {
						is_adult = yes
						OR = {
							has_trait = brave
							has_trait = zealous
							has_trait = stubborn
							has_trait = wrathful
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = @heir }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 1
						OR = {
							has_trait = brave
							has_trait = zealous
							has_trait = stubborn
							has_trait = wrathful
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 2
						OR = {
							has_trait = brave
							has_trait = zealous
							has_trait = stubborn
							has_trait = wrathful
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 3
						OR = {
							has_trait = brave
							has_trait = zealous
							has_trait = stubborn
							has_trait = wrathful
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 4
						OR = {
							has_trait = brave
							has_trait = zealous
							has_trait = stubborn
							has_trait = wrathful
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 5
						OR = {
							has_trait = brave
							has_trait = zealous
							has_trait = stubborn
							has_trait = wrathful
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 1
						is_councillor = yes
						OR = {
							has_trait = brave
							has_trait = zealous
							has_trait = stubborn
							has_trait = wrathful
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 2
						is_councillor = yes
						OR = {
							has_trait = brave
							has_trait = zealous
							has_trait = stubborn
							has_trait = wrathful
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 3
						is_councillor = yes
						OR = {
							has_trait = brave
							has_trait = zealous
							has_trait = stubborn
							has_trait = wrathful
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 4
						is_councillor = yes
						OR = {
							has_trait = brave
							has_trait = zealous
							has_trait = stubborn
							has_trait = wrathful
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 5
						is_councillor = yes
						OR = {
							has_trait = brave
							has_trait = zealous
							has_trait = stubborn
							has_trait = wrathful
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = @pvassal }
			}

			if = {
				limit = {
					has_trait = gpt_realm_ethos
						OR = {
							has_trait = craven
							has_trait = humble
						}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = @nruler }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					exists = primary_heir
					primary_heir = {
						is_adult = yes
						OR = {
							has_trait = craven
							has_trait = humble
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = @nheir }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 1
						OR = {
							has_trait = craven
							has_trait = humble
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 2
						OR = {
							has_trait = craven
							has_trait = humble
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 3
						OR = {
							has_trait = craven
							has_trait = humble
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 4
						OR = {
							has_trait = craven
							has_trait = humble
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 5
						OR = {
							has_trait = craven
							has_trait = humble
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 1
						is_councillor = yes
						OR = {
							has_trait = craven
							has_trait = humble
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 2
						is_councillor = yes
						OR = {
							has_trait = craven
							has_trait = humble
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 3
						is_councillor = yes
						OR = {
							has_trait = craven
							has_trait = humble
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 4
						is_councillor = yes
						OR = {
							has_trait = craven
							has_trait = humble
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 5
						is_councillor = yes
						OR = {
							has_trait = craven
							has_trait = humble
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = @npvassal }
			}













			if = {
				limit = {
					has_trait = gpt_realm_ethos
						OR = {
							has_trait = vengeful
							has_trait = sadistic
							has_trait = chaste
							has_trait = craven
						}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = @ruler }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					exists = primary_heir
					primary_heir = {
						is_adult = yes
						OR = {
							has_trait = vengeful
							has_trait = sadistic
							has_trait = chaste
							has_trait = craven
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = @heir }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 1
						OR = {
							has_trait = vengeful
							has_trait = sadistic
							has_trait = chaste
							has_trait = craven
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 2
						OR = {
							has_trait = vengeful
							has_trait = sadistic
							has_trait = chaste
							has_trait = craven
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 3
						OR = {
							has_trait = vengeful
							has_trait = sadistic
							has_trait = chaste
							has_trait = craven
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 4
						OR = {
							has_trait = vengeful
							has_trait = sadistic
							has_trait = chaste
							has_trait = craven
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 5
						OR = {
							has_trait = vengeful
							has_trait = sadistic
							has_trait = chaste
							has_trait = craven
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 1
						is_councillor = yes
						OR = {
							has_trait = vengeful
							has_trait = sadistic
							has_trait = chaste
							has_trait = craven
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 2
						is_councillor = yes
						OR = {
							has_trait = vengeful
							has_trait = sadistic
							has_trait = chaste
							has_trait = craven
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 3
						is_councillor = yes
						OR = {
							has_trait = vengeful
							has_trait = sadistic
							has_trait = chaste
							has_trait = craven
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 4
						is_councillor = yes
						OR = {
							has_trait = vengeful
							has_trait = sadistic
							has_trait = chaste
							has_trait = craven
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 5
						is_councillor = yes
						OR = {
							has_trait = vengeful
							has_trait = sadistic
							has_trait = chaste
							has_trait = craven
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = @pvassal }
			}

			if = {
				limit = {
					has_trait = gpt_realm_ethos
						OR = {
							has_trait = shy
							has_trait = trusting
						}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = @nruler }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					exists = primary_heir
					primary_heir = {
						is_adult = yes
						OR = {
							has_trait = shy
							has_trait = trusting
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = @nheir }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 1
						OR = {
							has_trait = shy
							has_trait = trusting
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 2
						OR = {
							has_trait = shy
							has_trait = trusting
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 3
						OR = {
							has_trait = shy
							has_trait = trusting
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 4
						OR = {
							has_trait = shy
							has_trait = trusting
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 5
						OR = {
							has_trait = shy
							has_trait = trusting
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 1
						is_councillor = yes
						OR = {
							has_trait = shy
							has_trait = trusting
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 2
						is_councillor = yes
						OR = {
							has_trait = shy
							has_trait = trusting
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 3
						is_councillor = yes
						OR = {
							has_trait = shy
							has_trait = trusting
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 4
						is_councillor = yes
						OR = {
							has_trait = shy
							has_trait = trusting
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 5
						is_councillor = yes
						OR = {
							has_trait = shy
							has_trait = trusting
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = @npvassal }
			}










			if = {
				limit = {
					has_trait = gpt_realm_ethos
						OR = {
							has_trait = diligent
							has_trait = calm
							has_trait = temperate
							has_trait = callous
						}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = @ruler }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					exists = primary_heir
					primary_heir = {
						is_adult = yes
						OR = {
							has_trait = diligent
							has_trait = calm
							has_trait = temperate
							has_trait = callous
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = @heir }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 1
						OR = {
							has_trait = diligent
							has_trait = calm
							has_trait = temperate
							has_trait = callous
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 2
						OR = {
							has_trait = diligent
							has_trait = calm
							has_trait = temperate
							has_trait = callous
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 3
						OR = {
							has_trait = diligent
							has_trait = calm
							has_trait = temperate
							has_trait = callous
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 4
						OR = {
							has_trait = diligent
							has_trait = calm
							has_trait = temperate
							has_trait = callous
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 5
						OR = {
							has_trait = diligent
							has_trait = calm
							has_trait = temperate
							has_trait = callous
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 1
						is_councillor = yes
						OR = {
							has_trait = diligent
							has_trait = calm
							has_trait = temperate
							has_trait = callous
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 2
						is_councillor = yes
						OR = {
							has_trait = diligent
							has_trait = calm
							has_trait = temperate
							has_trait = callous
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 3
						is_councillor = yes
						OR = {
							has_trait = diligent
							has_trait = calm
							has_trait = temperate
							has_trait = callous
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 4
						is_councillor = yes
						OR = {
							has_trait = diligent
							has_trait = calm
							has_trait = temperate
							has_trait = callous
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 5
						is_councillor = yes
						OR = {
							has_trait = diligent
							has_trait = calm
							has_trait = temperate
							has_trait = callous
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = @pvassal }
			}

			if = {
				limit = {
					has_trait = gpt_realm_ethos
						OR = {
							has_trait = lazy
							has_trait = arrogant
						}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = @nruler }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					exists = primary_heir
					primary_heir = {
						is_adult = yes
						OR = {
							has_trait = lazy
							has_trait = arrogant
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = @nheir }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 1
						OR = {
							has_trait = lazy
							has_trait = arrogant
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 2
						OR = {
							has_trait = lazy
							has_trait = arrogant
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 3
						OR = {
							has_trait = lazy
							has_trait = arrogant
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 4
						OR = {
							has_trait = lazy
							has_trait = arrogant
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 5
						OR = {
							has_trait = lazy
							has_trait = arrogant
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 1
						is_councillor = yes
						OR = {
							has_trait = lazy
							has_trait = arrogant
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 2
						is_councillor = yes
						OR = {
							has_trait = lazy
							has_trait = arrogant
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 3
						is_councillor = yes
						OR = {
							has_trait = lazy
							has_trait = arrogant
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 4
						is_councillor = yes
						OR = {
							has_trait = lazy
							has_trait = arrogant
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 5
						is_councillor = yes
						OR = {
							has_trait = lazy
							has_trait = arrogant
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = @npvassal }
			}













			if = {
				limit = {
					has_trait = gpt_realm_ethos
						OR = {
							has_trait = just
							has_trait = patient
							has_trait = honest
							has_trait = trusting
						}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = @ruler }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					exists = primary_heir
					primary_heir = {
						is_adult = yes
						OR = {
							has_trait = just
							has_trait = patient
							has_trait = honest
							has_trait = trusting
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = @heir }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 1
						OR = {
							has_trait = just
							has_trait = patient
							has_trait = honest
							has_trait = trusting
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 2
						OR = {
							has_trait = just
							has_trait = patient
							has_trait = honest
							has_trait = trusting
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 3
						OR = {
							has_trait = just
							has_trait = patient
							has_trait = honest
							has_trait = trusting
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 4
						OR = {
							has_trait = just
							has_trait = patient
							has_trait = honest
							has_trait = trusting
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 5
						OR = {
							has_trait = just
							has_trait = patient
							has_trait = honest
							has_trait = trusting
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 1
						is_councillor = yes
						OR = {
							has_trait = just
							has_trait = patient
							has_trait = honest
							has_trait = trusting
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 2
						is_councillor = yes
						OR = {
							has_trait = just
							has_trait = patient
							has_trait = honest
							has_trait = trusting
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 3
						is_councillor = yes
						OR = {
							has_trait = just
							has_trait = patient
							has_trait = honest
							has_trait = trusting
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 4
						is_councillor = yes
						OR = {
							has_trait = just
							has_trait = patient
							has_trait = honest
							has_trait = trusting
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 5
						is_councillor = yes
						OR = {
							has_trait = just
							has_trait = patient
							has_trait = honest
							has_trait = trusting
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = @pvassal }
			}

			if = {
				limit = {
					has_trait = gpt_realm_ethos
						OR = {
							has_trait = arbitrary
							has_trait = impatient
						}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = @nruler }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					exists = primary_heir
					primary_heir = {
						is_adult = yes
						OR = {
							has_trait = arbitrary
							has_trait = impatient
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = @nheir }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 1
						OR = {
							has_trait = arbitrary
							has_trait = impatient
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 2
						OR = {
							has_trait = arbitrary
							has_trait = impatient
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 3
						OR = {
							has_trait = arbitrary
							has_trait = impatient
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 4
						OR = {
							has_trait = arbitrary
							has_trait = impatient
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 5
						OR = {
							has_trait = arbitrary
							has_trait = impatient
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 1
						is_councillor = yes
						OR = {
							has_trait = arbitrary
							has_trait = impatient
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 2
						is_councillor = yes
						OR = {
							has_trait = arbitrary
							has_trait = impatient
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 3
						is_councillor = yes
						OR = {
							has_trait = arbitrary
							has_trait = impatient
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 4
						is_councillor = yes
						OR = {
							has_trait = arbitrary
							has_trait = impatient
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 5
						is_councillor = yes
						OR = {
							has_trait = arbitrary
							has_trait = impatient
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = @npvassal }
			}













			if = {
				limit = {
					has_trait = gpt_realm_ethos
						OR = {
							has_trait = deceitful
							has_trait = paranoid
							has_trait = cynical
							has_trait = shy
						}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = @ruler }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					exists = primary_heir
					primary_heir = {
						is_adult = yes
						OR = {
							has_trait = deceitful
							has_trait = paranoid
							has_trait = cynical
							has_trait = shy
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = @heir }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 1
						OR = {
							has_trait = deceitful
							has_trait = paranoid
							has_trait = cynical
							has_trait = shy
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 2
						OR = {
							has_trait = deceitful
							has_trait = paranoid
							has_trait = cynical
							has_trait = shy
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 3
						OR = {
							has_trait = deceitful
							has_trait = paranoid
							has_trait = cynical
							has_trait = shy
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 4
						OR = {
							has_trait = deceitful
							has_trait = paranoid
							has_trait = cynical
							has_trait = shy
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 5
						OR = {
							has_trait = deceitful
							has_trait = paranoid
							has_trait = cynical
							has_trait = shy
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 1
						is_councillor = yes
						OR = {
							has_trait = deceitful
							has_trait = paranoid
							has_trait = cynical
							has_trait = shy
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 2
						is_councillor = yes
						OR = {
							has_trait = deceitful
							has_trait = paranoid
							has_trait = cynical
							has_trait = shy
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 3
						is_councillor = yes
						OR = {
							has_trait = deceitful
							has_trait = paranoid
							has_trait = cynical
							has_trait = shy
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 4
						is_councillor = yes
						OR = {
							has_trait = deceitful
							has_trait = paranoid
							has_trait = cynical
							has_trait = shy
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 5
						is_councillor = yes
						OR = {
							has_trait = deceitful
							has_trait = paranoid
							has_trait = cynical
							has_trait = shy
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = @pvassal }
			}

			if = {
				limit = {
					has_trait = gpt_realm_ethos
						OR = {
							has_trait = honest
							has_trait = wrathful
						}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = @nruler }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					exists = primary_heir
					primary_heir = {
						is_adult = yes
						OR = {
							has_trait = honest
							has_trait = wrathful
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = @nheir }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 1
						OR = {
							has_trait = honest
							has_trait = wrathful
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 2
						OR = {
							has_trait = honest
							has_trait = wrathful
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 3
						OR = {
							has_trait = honest
							has_trait = wrathful
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 4
						OR = {
							has_trait = honest
							has_trait = wrathful
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 5
						OR = {
							has_trait = honest
							has_trait = wrathful
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 1
						is_councillor = yes
						OR = {
							has_trait = honest
							has_trait = wrathful
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 2
						is_councillor = yes
						OR = {
							has_trait = honest
							has_trait = wrathful
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 3
						is_councillor = yes
						OR = {
							has_trait = honest
							has_trait = wrathful
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 4
						is_councillor = yes
						OR = {
							has_trait = honest
							has_trait = wrathful
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 5
						is_councillor = yes
						OR = {
							has_trait = honest
							has_trait = wrathful
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = @npvassal }
			}















			if = {
				limit = {
					has_trait = gpt_realm_ethos
						OR = {
							has_trait = eccentric
							has_trait = fickle
							has_trait = lazy
							has_trait = content
						}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = @ruler }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					exists = primary_heir
					primary_heir = {
						is_adult = yes
						OR = {
							has_trait = eccentric
							has_trait = fickle
							has_trait = lazy
							has_trait = content
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = @heir }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 1
						OR = {
							has_trait = eccentric
							has_trait = fickle
							has_trait = lazy
							has_trait = content
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 2
						OR = {
							has_trait = eccentric
							has_trait = fickle
							has_trait = lazy
							has_trait = content
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 3
						OR = {
							has_trait = eccentric
							has_trait = fickle
							has_trait = lazy
							has_trait = content
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 4
						OR = {
							has_trait = eccentric
							has_trait = fickle
							has_trait = lazy
							has_trait = content
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 5
						OR = {
							has_trait = eccentric
							has_trait = fickle
							has_trait = lazy
							has_trait = content
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = @councillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 1
						is_councillor = yes
						OR = {
							has_trait = eccentric
							has_trait = fickle
							has_trait = lazy
							has_trait = content
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 2
						is_councillor = yes
						OR = {
							has_trait = eccentric
							has_trait = fickle
							has_trait = lazy
							has_trait = content
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 3
						is_councillor = yes
						OR = {
							has_trait = eccentric
							has_trait = fickle
							has_trait = lazy
							has_trait = content
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 4
						is_councillor = yes
						OR = {
							has_trait = eccentric
							has_trait = fickle
							has_trait = lazy
							has_trait = content
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = @pvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 5
						is_councillor = yes
						OR = {
							has_trait = eccentric
							has_trait = fickle
							has_trait = lazy
							has_trait = content
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = @pvassal }
			}

			if = {
				limit = {
					has_trait = gpt_realm_ethos
						OR = {
							has_trait = stubborn
							has_trait = gregarious
						}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = @nruler }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					exists = primary_heir
					primary_heir = {
						is_adult = yes
						OR = {
							has_trait = stubborn
							has_trait = gregarious
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = @nheir }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 1
						OR = {
							has_trait = stubborn
							has_trait = gregarious
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 2
						OR = {
							has_trait = stubborn
							has_trait = gregarious
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 3
						OR = {
							has_trait = stubborn
							has_trait = gregarious
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 4
						OR = {
							has_trait = stubborn
							has_trait = gregarious
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_councillor = {
						count >= 5
						OR = {
							has_trait = stubborn
							has_trait = gregarious
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = @ncouncillor }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 1
						is_councillor = yes
						OR = {
							has_trait = stubborn
							has_trait = gregarious
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 2
						is_councillor = yes
						OR = {
							has_trait = stubborn
							has_trait = gregarious
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 3
						is_councillor = yes
						OR = {
							has_trait = stubborn
							has_trait = gregarious
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 4
						is_councillor = yes
						OR = {
							has_trait = stubborn
							has_trait = gregarious
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = @npvassal }
			}
			if = {
				limit = {
					has_trait = gpt_realm_ethos
					any_powerful_vassal = {
						count >= 5
						is_councillor = yes
						OR = {
							has_trait = stubborn
							has_trait = gregarious
						}
					}
				}
				add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = @npvassal }
			}


			add_trait_xp = { trait = gpt_realm_ethos track = gpt_taxation value = 0.1 }
			add_trait_xp = { trait = gpt_realm_ethos track = gpt_charity value = 0.1 }
			add_trait_xp = { trait = gpt_realm_ethos track = gpt_revelry value = 0.1 }
			add_trait_xp = { trait = gpt_realm_ethos track = gpt_warfare value = 0.1 }
			add_trait_xp = { trait = gpt_realm_ethos track = gpt_authority value = 0.1 }
			add_trait_xp = { trait = gpt_realm_ethos track = gpt_production value = 0.1 }
			add_trait_xp = { trait = gpt_realm_ethos track = gpt_statecraft value = 0.1 }
			add_trait_xp = { trait = gpt_realm_ethos track = gpt_espionage value = 0.1 }
			add_trait_xp = { trait = gpt_realm_ethos track = gpt_scholarship value = 0.1 }
		}
	}	
}

@pstraitp = 15
@pstraitn = -10
@pstraitpr = 5
@pstraitnr = -5
@psage = 10
@psrank1 = 10
@psrank2 = 20
@psskill = 10
@psdread = 10
@pscrauth0 = 20
@pscrauth1 = 10
@pscrauth2 = 0
@pscrauth3 = -10
@pslegitp = 5
@psspecialp = 10
@psspecialn = -10
@pslowb = -10
@psperceivp = 10
@psperceivn = -10
@pssentraitp = 10
@pssentraitn = -10
@pssenagep = 10
@pssenagen = -10
@pssenslv1 = 10
@pssenslv2 = 15
@pssenslv3 = 20
@psfemale = 10

gpt_power_struggle_check = {
	trigger = {
		is_landless_adventurer = no
		NOT = { has_game_rule = GPT_rfavor_disabled }
		OR = {
			is_ai = no
			has_game_rule = GPT_rfavor_count
			has_game_rule = GPT_rfavor_duke
			has_game_rule = GPT_rfavor_king
		}
	}
	effect = {
		
		if = {
			limit = {
				is_ai = yes
				OR = {
					has_game_rule = GPT_rfavor_disabled
					highest_held_title_tier < gpt_rfavor_tier
				}
			}
			if = { limit = { has_trait = gpt_power_struggle } remove_trait = gpt_power_struggle }
		}

		if = {
			limit = {
			 #	is_landed = yes
				NOT = { has_game_rule = GPT_rfavor_disabled }
				OR = {
					highest_held_title_tier >= gpt_rfavor_tier
					is_ai = no
				}
			}
			if = { limit = { NOT = { has_trait = gpt_power_struggle } } add_trait = gpt_power_struggle }
			add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = -100 }
			add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = -100 }
			add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = -100 }
			add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = -100 }
			add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = -100 }
			add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = -100 }
			add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = -100 }
			add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = -100 }

			if = {
				limit = {
					is_female = yes
					faith = { has_doctrine = doctrine_gender_male_dominated }
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psfemale }
			}

			if = {
				limit = {
					ai_boldness <= -20
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_boldness <= -40
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_boldness <= -60
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_boldness <= -80
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_boldness <= -100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}

			if = {
				limit = {
					ai_compassion <= -20
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_compassion <= -40
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_compassion <= -60
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_compassion <= -80
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_compassion <= -100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}

			if = {
				limit = {
					ai_sociability <= -20
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_sociability <= -40
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_sociability <= -60
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_sociability <= -80
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_sociability <= -100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}

			if = {
				limit = {
					ai_greed <= -20
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_greed <= -40
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_greed <= -60
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_greed <= -80
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_greed <= -100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}

			if = {
				limit = {
					ai_energy <= -20
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_energy <= -40
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_energy <= -60
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_energy <= -80
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_energy <= -100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}

			if = {
				limit = {
					ai_honor <= -20
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_honor <= -40
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_honor <= -60
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_honor <= -80
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_honor <= -100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}

			if = {
				limit = {
					ai_rationality <= -20
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_rationality <= -40
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_rationality <= -60
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_rationality <= -80
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_rationality <= -100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}

			if = {
				limit = {
					ai_vengefulness >= 20
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_vengefulness >= 40
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_vengefulness >= 60
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_vengefulness >= 80
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_vengefulness >= 100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			
			if = {
				limit = {
					ai_zeal <= -20
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_zeal <= -40
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_zeal <= -60
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_zeal <= -80
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					ai_zeal <= -100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}


			if = {
				limit = {
					ai_compassion >= 20
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_compassion >= 40
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_compassion >= 60
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_compassion >= 80
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_compassion >= 100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			
			if = {
				limit = {
					ai_sociability >= 20
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_sociability >= 40
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_sociability >= 60
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_sociability >= 80
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_sociability >= 100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}

			if = {
				limit = {
					ai_greed >= 20
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_greed >= 40
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_greed >= 60
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_greed >= 80
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_greed >= 100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}

			if = {
				limit = {
					ai_energy >= 20
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_energy >= 40
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_energy >= 60
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_energy >= 80
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_energy >= 100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}

			if = {
				limit = {
					ai_honor >= 20
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_honor >= 40
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_honor >= 60
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_honor >= 80
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_honor >= 100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}

			if = {
				limit = {
					ai_boldness >= 20
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_boldness >= 40
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_boldness >= 60
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_boldness >= 80
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_boldness >= 100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}

			if = {
				limit = {
					ai_vengefulness <= -20
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_vengefulness <= -40
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_vengefulness <= -60
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_vengefulness <= -80
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_vengefulness <= -100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}

			if = {
				limit = {
					ai_zeal >= 20
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_zeal >= 40
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_zeal >= 60
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_zeal >= 80
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_zeal >= 100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}

			if = {
				limit = {
					ai_rationality >= 20
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_rationality >= 40
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_rationality >= 60
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_rationality >= 80
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}
			if = {
				limit = {
					ai_rationality >= 100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivn }
			}



			if = {
				limit = {
					OR = {
						has_trait = drunkard
						has_trait = flagellant
						has_trait = comfort_eater
						has_trait = contrite
						has_trait = improvident
						has_trait = inappetetic
						has_trait = reclusive
						has_trait = irritable
						has_trait = rakish
						has_trait = hashishiyah
						has_trait = profligate
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = 10 }
			}
			if = {
				limit = {
					NOR = {
						has_trait = drunkard
						has_trait = flagellant
						has_trait = comfort_eater
						has_trait = contrite
						has_trait = improvident
						has_trait = inappetetic
						has_trait = reclusive
						has_trait = irritable
						has_trait = rakish
						has_trait = hashishiyah
						has_trait = profligate
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = -10 }
			}

			if = {
				limit = {
					age > 60
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = -10 }
			}
			if = {
				limit = {
					age > 50
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = -10 }
			}
			if = {
				limit = {
					age > 40
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = -10 }
			}
			if = {
				limit = {
					age < 36
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = 10}
			}
			if = {
				limit = {
					age < 30
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = 10}
			}
			if = {
				limit = {
					age < 24
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = 10 }
			}
			if = {
				limit = {
					age < 18
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = 10 }
			}
			if = {
				limit = {
					age < 12
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = 10 }
			}
			
			if = {
				limit = {
					average_of_all_skills < 14
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					average_of_all_skills < 12
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					average_of_all_skills < 10
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					average_of_all_skills < 8
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}
			if = {
				limit = {
					average_of_all_skills < 6
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = @psperceivp }
			}










			if = {
				limit = {
					age < 10
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssenagen }
			}
			if = {
				limit = {
					age < 20
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssenagen }
			}
			if = {
				limit = {
					age < 30
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssenagen }
			}
			if = {
				limit = {
					age < 40
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssenagen }
			}
			if = {
				limit = {
					age >= 40
					age < 100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssenagep }
			}
			if = {
				limit = {
					age >= 45
					age < 100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssenagep }
			}
			if = {
				limit = {
					age >= 50
					age < 100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssenagep }
			}
			if = {
				limit = {
					age > 55
					age < 100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssenagep }
			}
			if = {
				limit = {
					age >= 60
					age < 100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssenagep }
			}
			if = {
				limit = {
					age >= 65
					age < 100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssenagep }
			}
			if = {
				limit = {
					age >= 70
					age < 100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssenagep }
			}
			if = {
				limit = {
					age >= 75
					age < 100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssenagep }
			}
			if = {
				limit = {
					age >= 80
					age < 100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssenagep }
			}
			if = {
				limit = {
					age >= 85
					age < 100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssenagep }
			}
			if = {
				limit = {
					age >= 90
					age < 100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssenagep }
			}
			if = {
				limit = {
					age >= 95
					age < 100
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssenagep }
			}
		 #	if = {
		 #		limit = {
		 #			age >= 100
		 #		}
		 #		add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssenagep }
		 #	}
			if = {
				limit = {
					has_trait = drunkard
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssentraitp }
			}
			if = {
				limit = {
					has_trait = flagellant
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssentraitp }
			}
			if = {
				limit = {
					has_trait = comfort_eater
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssentraitp }
			}
			if = {
				limit = {
					has_trait = contrite
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssentraitp }
			}
			if = {
				limit = {
					has_trait = improvident
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssentraitp }
			}
			if = {
				limit = {
					has_trait = inappetetic
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssentraitp }
			}
			if = {
				limit = {
					has_trait = reclusive
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssentraitp }
			}
			if = {
				limit = {
					has_trait = irritable
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssentraitp }
			}
			if = {
				limit = {
					has_trait = rakish
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssentraitp }
			}
			if = {
				limit = {
					has_trait = hashishiyah
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssentraitp }
			}
			if = {
				limit = {
					has_trait = profligate
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssentraitp }
			}
			if = {
				limit = {
					has_trait = confider
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssentraitn }
			}
			if = {
				limit = {
					has_trait = journaller
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssentraitn }
			}
			if = {
				limit = {
					has_trait = athletic
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssentraitn }
			}

			if = {
				limit = {
					has_character_flag = gpt_stress_1_flag
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssenslv1 }
			}
			if = {
				limit = {
					has_character_flag = gpt_stress_2_flag
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssenslv2 }
			}
			if = {
				limit = {
					has_character_flag = gpt_stress_3_flag
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = @pssenslv3 }
			}

			if = {
				limit = {
					has_active_diarchy = yes
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = -50 }
			}









			if = {
				limit = {
					exists = primary_spouse
					primary_spouse = {
						is_lowborn = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @pslowb }
			}

			if = {
				limit = {
					exists = primary_spouse
					primary_spouse = {
						is_lowborn = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @pslowb }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						is_lowborn = yes
					}
				}
			 #	add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pslowb }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					cp:councillor_chancellor = {
						is_lowborn = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pslowb }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					cp:councillor_steward = {
						is_lowborn = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pslowb }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					cp:councillor_marshal = {
						is_lowborn = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pslowb }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					cp:councillor_spymaster = {
						is_lowborn = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pslowb }
			}

			if = {
				limit = {
					highest_held_title_tier = 2
					has_legitimacy = yes
					legitimacy_level <= 0
				}
				if = {
					limit = {
						exists = cp:councillor_court_chaplain
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_chancellor
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_steward
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_marshal
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_spymaster
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pslegitp }
				}
			}
			if = {
				limit = {
					highest_held_title_tier = 3
					has_legitimacy = yes
					legitimacy_level <= 1
				}
				if = {
					limit = {
						exists = cp:councillor_court_chaplain
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_chancellor
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_steward
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_marshal
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_spymaster
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pslegitp }
				}
			}
			if = {
				limit = {
					highest_held_title_tier = 3
					has_legitimacy = yes
					legitimacy_level <= 0
				}
				if = {
					limit = {
						exists = cp:councillor_court_chaplain
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_chancellor
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_steward
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_marshal
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_spymaster
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pslegitp }
				}
			}
			if = {
				limit = {
					highest_held_title_tier = 4
					has_legitimacy = yes
					legitimacy_level <= 2
				}
				if = {
					limit = {
						exists = cp:councillor_court_chaplain
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_chancellor
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_steward
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_marshal
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_spymaster
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pslegitp }
				}
			}
			if = {
				limit = {
					highest_held_title_tier = 4
					has_legitimacy = yes
					legitimacy_level <= 1
				}
				if = {
					limit = {
						exists = cp:councillor_court_chaplain
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_chancellor
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_steward
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_marshal
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_spymaster
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pslegitp }
				}
			}
			if = {
				limit = {
					highest_held_title_tier = 4
					has_legitimacy = yes
					legitimacy_level <= 0
				}
				if = {
					limit = {
						exists = cp:councillor_court_chaplain
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_chancellor
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_steward
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_marshal
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_spymaster
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pslegitp }
				}
			}
			if = {
				limit = {
					highest_held_title_tier = 5
					has_legitimacy = yes
					legitimacy_level <= 3
				}
				if = {
					limit = {
						exists = cp:councillor_court_chaplain
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_chancellor
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_steward
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_marshal
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_spymaster
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pslegitp }
				}
			}
			if = {
				limit = {
					highest_held_title_tier = 5
					has_legitimacy = yes
					legitimacy_level <= 2
				}
				if = {
					limit = {
						exists = cp:councillor_court_chaplain
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_chancellor
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_steward
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_marshal
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_spymaster
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pslegitp }
				}
			}
			if = {
				limit = {
					highest_held_title_tier = 5
					has_legitimacy = yes
					legitimacy_level <= 1
				}
				if = {
					limit = {
						exists = cp:councillor_court_chaplain
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_chancellor
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_steward
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_marshal
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_spymaster
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pslegitp }
				}
			}
			if = {
				limit = {
					highest_held_title_tier = 5
					has_legitimacy = yes
					legitimacy_level <= 0
				}
				if = {
					limit = {
						exists = cp:councillor_court_chaplain
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_chancellor
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_steward
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_marshal
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pslegitp }
				}
				if = {
					limit = {
						exists = cp:councillor_spymaster
					}
					add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pslegitp }
				}
			}

			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						has_any_court_position = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					cp:councillor_chancellor = {
						has_any_court_position = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					cp:councillor_steward = {
						has_any_court_position = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					cp:councillor_marshal = {
						has_any_court_position = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					cp:councillor_spymaster = {
						has_any_court_position = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psspecialp }
			}

			if = {
				limit = {
					exists = primary_spouse
					primary_spouse = {
						is_imprisoned = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = -200 }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						is_imprisoned = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = -200 }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					cp:councillor_chancellor = {
						is_imprisoned = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = -200 }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					cp:councillor_steward = {
						is_imprisoned = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = -200 }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					cp:councillor_marshal = {
						is_imprisoned = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = -200 }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					cp:councillor_spymaster = {
						is_imprisoned = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = -200 }
			}

			if = {
				limit = {
					exists = primary_spouse
					primary_spouse = {
						opinion = {
							target = root
							value < 0
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						opinion = {
							target = root
							value < 0
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					cp:councillor_chancellor = {
						opinion = {
							target = root
							value < 0
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					cp:councillor_steward = {
						opinion = {
							target = root
							value < 0
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					cp:councillor_marshal = {
						opinion = {
							target = root
							value < 0
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					cp:councillor_spymaster = {
						opinion = {
							target = root
							value < 0
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psspecialp }
			}
			if = {
				limit = {
					exists = primary_spouse
					primary_spouse = {
						opinion = {
							target = root
							value < -40
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						opinion = {
							target = root
							value < -40
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					cp:councillor_chancellor = {
						opinion = {
							target = root
							value < -40
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					cp:councillor_steward = {
						opinion = {
							target = root
							value < -40
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					cp:councillor_marshal = {
						opinion = {
							target = root
							value < -40
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					cp:councillor_spymaster = {
						opinion = {
							target = root
							value < -40
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psspecialp }
			}
			if = {
				limit = {
					exists = primary_spouse
					primary_spouse = {
						opinion = {
							target = root
							value < -80
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						opinion = {
							target = root
							value < -80
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					cp:councillor_chancellor = {
						opinion = {
							target = root
							value < -80
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					cp:councillor_steward = {
						opinion = {
							target = root
							value < -80
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					cp:councillor_marshal = {
						opinion = {
							target = root
							value < -80
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					cp:councillor_spymaster = {
						opinion = {
							target = root
							value < -80
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psspecialp }
			}
			if = {
				limit = {
					exists = primary_spouse
					primary_spouse = {
						opinion = {
							target = root
							value > 50
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psspecialn }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						opinion = {
							target = root
							value > 50
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psspecialn }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					cp:councillor_chancellor = {
						opinion = {
							target = root
							value > 50
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psspecialn }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					cp:councillor_steward = {
						opinion = {
							target = root
							value > 50
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psspecialn }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					cp:councillor_marshal = {
						opinion = {
							target = root
							value > 50
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psspecialn }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					cp:councillor_spymaster = {
						opinion = {
							target = root
							value > 50
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psspecialn }
			}



			
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					is_adult = no
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psage }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					age < 20
					cp:councillor_court_chaplain = {
						age >= 30
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psage }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					age < 30
					cp:councillor_court_chaplain = {
						age >= 40
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psage }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					age < 40
					cp:councillor_court_chaplain = {
						age >= 50
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psage }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					age < 50
					cp:councillor_court_chaplain = {
						age >= 60
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psage }
			}

			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						is_landed = yes
						is_powerful_vassal = no
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psrank1 }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						is_landed = yes
						is_powerful_vassal = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psrank2 }
			}

			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					learning < 10
					cp:councillor_court_chaplain = {
						learning >= 20
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					learning < 12
					cp:councillor_court_chaplain = {
						learning >= 25
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					learning < 14
					cp:councillor_court_chaplain = {
						learning >= 30
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						learning >= 35
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psskill }
			}

			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					average_of_all_skills_and_prowess < 8
					cp:councillor_court_chaplain = {
						average_of_all_skills_and_prowess >= 10
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					average_of_all_skills_and_prowess < 10
					cp:councillor_court_chaplain = {
						average_of_all_skills_and_prowess >= 12
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					average_of_all_skills_and_prowess < 12
					cp:councillor_court_chaplain = {
						average_of_all_skills_and_prowess >= 14
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					average_of_all_skills_and_prowess < 14
					cp:councillor_court_chaplain = {
						average_of_all_skills_and_prowess >= 16
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psskill }
			}

			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					dread < 20
					cp:councillor_court_chaplain = {
						dread >= 40
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psdread }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					dread < 40
					cp:councillor_court_chaplain = {
						dread >= 60
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psdread }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					dread < 60
					cp:councillor_court_chaplain = {
						dread >= 80
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psdread }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					dread < 80
					cp:councillor_court_chaplain = {
						dread >= 100
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psdread }
			}

			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					has_trait = content
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pstraitpr }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					has_trait = lazy
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pstraitpr }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					has_trait = humble
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pstraitpr }
			}

			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						has_trait = ambitious
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pstraitp }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						has_trait = diligent
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pstraitp }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						has_trait = arrogant
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pstraitp }
			}

			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						has_trait = content
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pstraitn }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						has_trait = lazy
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pstraitn }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						has_trait = humble
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pstraitn }
			}
			
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					has_trait = ambitious
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pstraitnr }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					has_trait = diligent
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pstraitnr }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					has_trait = arrogant
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pstraitnr }
			}

			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					OR = {
						has_realm_law = crown_authority_0
						has_realm_law = realm_administration_law_0
						has_realm_law = tribal_authority_0
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pscrauth0 }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					OR = {
						has_realm_law = crown_authority_1
						has_realm_law = realm_administration_law_1
						has_realm_law = tribal_authority_1
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pscrauth1 }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					OR = {
						has_realm_law = crown_authority_2
						has_realm_law = realm_administration_law_2
						has_realm_law = tribal_authority_2
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pscrauth2 }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					OR = {
						has_realm_law = crown_authority_3
						has_realm_law = realm_administration_law_3
						has_realm_law = tribal_authority_3
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @pscrauth3 }
			}

			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						num_virtuous_traits >= 1
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						num_virtuous_traits >= 2
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						num_virtuous_traits >= 3
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						has_trait = zealous
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psspecialp }
			}

			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						num_sinful_traits >= 1
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psspecialn }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						num_sinful_traits >= 2
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psspecialn }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						num_sinful_traits >= 3
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psspecialn }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						has_trait = cynical
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psspecialn }
			}

			












			if = {
				limit = {
					exists = cp:councillor_chancellor
					is_adult = no
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psage }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					age < 20
					cp:councillor_chancellor = {
						age >= 30
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psage }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					age < 30
					cp:councillor_chancellor = {
						age >= 40
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psage }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					age < 40
					cp:councillor_chancellor = {
						age >= 50
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psage }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					age < 50
					cp:councillor_chancellor = {
						age >= 60
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psage }
			}

			if = {
				limit = {
					exists = cp:councillor_chancellor
					cp:councillor_chancellor = {
						is_landed = yes
						is_powerful_vassal = no
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psrank1 }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					cp:councillor_chancellor = {
						is_landed = yes
						is_powerful_vassal = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psrank2 }
			}

			if = {
				limit = {
					exists = cp:councillor_chancellor
					diplomacy < 10
					cp:councillor_chancellor = {
						diplomacy >= 20
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					diplomacy < 12
					cp:councillor_chancellor = {
						diplomacy >= 25
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					diplomacy < 14
					cp:councillor_chancellor = {
						diplomacy >= 30
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					cp:councillor_chancellor = {
						diplomacy >= 35
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psskill }
			}

			if = {
				limit = {
					exists = cp:councillor_chancellor
					average_of_all_skills_and_prowess < 8
					cp:councillor_chancellor = {
						average_of_all_skills_and_prowess >= 10
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					average_of_all_skills_and_prowess < 10
					cp:councillor_chancellor = {
						average_of_all_skills_and_prowess >= 12
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					average_of_all_skills_and_prowess < 12
					cp:councillor_chancellor = {
						average_of_all_skills_and_prowess >= 14
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					average_of_all_skills_and_prowess < 14
					cp:councillor_chancellor = {
						average_of_all_skills_and_prowess >= 16
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psskill }
			}

			if = {
				limit = {
					exists = cp:councillor_chancellor
					dread < 20
					cp:councillor_chancellor = {
						dread >= 40
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psdread }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					dread < 40
					cp:councillor_chancellor = {
						dread >= 60
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psdread }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					dread < 60
					cp:councillor_chancellor = {
						dread >= 80
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psdread }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					dread < 80
					cp:councillor_chancellor = {
						dread >= 100
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psdread }
			}

			if = {
				limit = {
					exists = cp:councillor_chancellor
					has_trait = content
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pstraitpr }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					has_trait = lazy
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pstraitpr }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					has_trait = humble
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pstraitpr }
			}

			if = {
				limit = {
					exists = cp:councillor_chancellor
					cp:councillor_chancellor = {
						has_trait = ambitious
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pstraitp }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					cp:councillor_chancellor = {
						has_trait = diligent
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pstraitp }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					cp:councillor_chancellor = {
						has_trait = arrogant
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pstraitp }
			}

			if = {
				limit = {
					exists = cp:councillor_chancellor
					cp:councillor_chancellor = {
						has_trait = content
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pstraitn }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					cp:councillor_chancellor = {
						has_trait = lazy
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pstraitn }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					cp:councillor_chancellor = {
						has_trait = humble
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pstraitn }
			}
			
			if = {
				limit = {
					exists = cp:councillor_chancellor
					has_trait = ambitious
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pstraitnr }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					has_trait = diligent
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pstraitnr }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					has_trait = arrogant
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pstraitnr }
			}

			if = {
				limit = {
					exists = cp:councillor_chancellor
					OR = {
						has_realm_law = crown_authority_0
						has_realm_law = realm_administration_law_0
						has_realm_law = tribal_authority_0
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pscrauth0 }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					OR = {
						has_realm_law = crown_authority_1
						has_realm_law = realm_administration_law_1
						has_realm_law = tribal_authority_1
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pscrauth1 }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					OR = {
						has_realm_law = crown_authority_2
						has_realm_law = realm_administration_law_2
						has_realm_law = tribal_authority_2
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pscrauth2 }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					OR = {
						has_realm_law = crown_authority_3
						has_realm_law = realm_administration_law_3
						has_realm_law = tribal_authority_3
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @pscrauth3 }
			}

			if = {
				limit = {
					exists = cp:councillor_chancellor
					cp:councillor_chancellor = {
						has_trait = gregarious
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					cp:councillor_chancellor = {
						has_trait = callous
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					cp:councillor_chancellor = {
						has_trait = shy
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psspecialn }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					cp:councillor_chancellor = {
						has_trait = compassionate
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psspecialn }
			}













			if = {
				limit = {
					exists = cp:councillor_steward
					is_adult = no
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psage }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					age < 20
					cp:councillor_steward = {
						age >= 30
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psage }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					age < 30
					cp:councillor_steward = {
						age >= 40
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psage }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					age < 40
					cp:councillor_steward = {
						age >= 50
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psage }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					age < 50
					cp:councillor_steward = {
						age >= 60
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psage }
			}

			if = {
				limit = {
					exists = cp:councillor_steward
					cp:councillor_steward = {
						is_landed = yes
						is_powerful_vassal = no
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psrank1 }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					cp:councillor_steward = {
						is_landed = yes
						is_powerful_vassal = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psrank2 }
			}

			if = {
				limit = {
					exists = cp:councillor_steward
					stewardship < 10
					cp:councillor_steward = {
						stewardship >= 20
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					stewardship < 12
					cp:councillor_steward = {
						stewardship >= 25
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					stewardship < 14
					cp:councillor_steward = {
						stewardship >= 30
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					cp:councillor_steward = {
						stewardship >= 35
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psskill }
			}

			if = {
				limit = {
					exists = cp:councillor_steward
					average_of_all_skills_and_prowess < 8
					cp:councillor_steward = {
						average_of_all_skills_and_prowess >= 10
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					average_of_all_skills_and_prowess < 10
					cp:councillor_steward = {
						average_of_all_skills_and_prowess >= 12
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					average_of_all_skills_and_prowess < 12
					cp:councillor_steward = {
						average_of_all_skills_and_prowess >= 14
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					average_of_all_skills_and_prowess < 14
					cp:councillor_steward = {
						average_of_all_skills_and_prowess >= 16
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psskill }
			}

			if = {
				limit = {
					exists = cp:councillor_steward
					dread < 20
					cp:councillor_steward = {
						dread >= 40
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psdread }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					dread < 40
					cp:councillor_steward = {
						dread >= 60
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psdread }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					dread < 60
					cp:councillor_steward = {
						dread >= 80
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psdread }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					dread < 80
					cp:councillor_steward = {
						dread >= 100
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psdread }
			}

			if = {
				limit = {
					exists = cp:councillor_steward
					has_trait = content
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pstraitpr }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					has_trait = lazy
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pstraitpr }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					has_trait = humble
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pstraitpr }
			}

			if = {
				limit = {
					exists = cp:councillor_steward
					cp:councillor_steward = {
						has_trait = ambitious
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pstraitp }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					cp:councillor_steward = {
						has_trait = diligent
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pstraitp }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					cp:councillor_steward = {
						has_trait = arrogant
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pstraitp }
			}

			if = {
				limit = {
					exists = cp:councillor_steward
					cp:councillor_steward = {
						has_trait = content
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pstraitn }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					cp:councillor_steward = {
						has_trait = lazy
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pstraitn }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					cp:councillor_steward = {
						has_trait = humble
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pstraitn }
			}
			
			if = {
				limit = {
					exists = cp:councillor_steward
					has_trait = ambitious
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pstraitnr }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					has_trait = diligent
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pstraitnr }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					has_trait = arrogant
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pstraitnr }
			}

			if = {
				limit = {
					exists = cp:councillor_steward
					OR = {
						has_realm_law = crown_authority_0
						has_realm_law = realm_administration_law_0
						has_realm_law = tribal_authority_0
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pscrauth0 }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					OR = {
						has_realm_law = crown_authority_1
						has_realm_law = realm_administration_law_1
						has_realm_law = tribal_authority_1
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pscrauth1 }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					OR = {
						has_realm_law = crown_authority_2
						has_realm_law = realm_administration_law_2
						has_realm_law = tribal_authority_2
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pscrauth2 }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					OR = {
						has_realm_law = crown_authority_3
						has_realm_law = realm_administration_law_3
						has_realm_law = tribal_authority_3
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @pscrauth3 }
			}

			if = {
				limit = {
					exists = cp:councillor_steward
					cp:councillor_steward = {
						has_trait = greedy
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					cp:councillor_steward = {
						has_trait = arbitrary
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					cp:councillor_steward = {
						has_trait = generous
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psspecialn }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					cp:councillor_steward = {
						has_trait = just
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psspecialn }
			}















			if = {
				limit = {
					exists = cp:councillor_marshal
					is_adult = no
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psage }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					age < 20
					cp:councillor_marshal = {
						age >= 30
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psage }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					age < 30
					cp:councillor_marshal = {
						age >= 40
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psage }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					age < 40
					cp:councillor_marshal = {
						age >= 50
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psage }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					age < 50
					cp:councillor_marshal = {
						age >= 60
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psage }
			}

			if = {
				limit = {
					exists = cp:councillor_marshal
					cp:councillor_marshal = {
						is_landed = yes
						is_powerful_vassal = no
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psrank1 }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					cp:councillor_marshal = {
						is_landed = yes
						is_powerful_vassal = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psrank2 }
			}

			if = {
				limit = {
					exists = cp:councillor_marshal
					martial < 10
					cp:councillor_marshal = {
						martial >= 20
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					martial < 12
					cp:councillor_marshal = {
						martial >= 25
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					martial < 14
					cp:councillor_marshal = {
						martial >= 30
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					cp:councillor_marshal = {
						martial >= 35
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psskill }
			}

			if = {
				limit = {
					exists = cp:councillor_marshal
					average_of_all_skills_and_prowess < 8
					cp:councillor_marshal = {
						average_of_all_skills_and_prowess >= 10
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					average_of_all_skills_and_prowess < 10
					cp:councillor_marshal = {
						average_of_all_skills_and_prowess >= 12
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					average_of_all_skills_and_prowess < 12
					cp:councillor_marshal = {
						average_of_all_skills_and_prowess >= 14
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					average_of_all_skills_and_prowess < 14
					cp:councillor_marshal = {
						average_of_all_skills_and_prowess >= 16
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psskill }
			}

			if = {
				limit = {
					exists = cp:councillor_marshal
					dread < 20
					cp:councillor_marshal = {
						dread >= 40
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psdread }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					dread < 40
					cp:councillor_marshal = {
						dread >= 60
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psdread }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					dread < 60
					cp:councillor_marshal = {
						dread >= 80
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psdread }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					dread < 80
					cp:councillor_marshal = {
						dread >= 100
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psdread }
			}

			if = {
				limit = {
					exists = cp:councillor_marshal
					has_trait = content
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pstraitpr }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					has_trait = lazy
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pstraitpr }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					has_trait = humble
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pstraitpr }
			}

			if = {
				limit = {
					exists = cp:councillor_marshal
					cp:councillor_marshal = {
						has_trait = ambitious
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pstraitp }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					cp:councillor_marshal = {
						has_trait = diligent
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pstraitp }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					cp:councillor_marshal = {
						has_trait = arrogant
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pstraitp }
			}

			if = {
				limit = {
					exists = cp:councillor_marshal
					cp:councillor_marshal = {
						has_trait = content
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pstraitn }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					cp:councillor_marshal = {
						has_trait = lazy
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pstraitn }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					cp:councillor_marshal = {
						has_trait = humble
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pstraitn }
			}
			
			if = {
				limit = {
					exists = cp:councillor_marshal
					has_trait = ambitious
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pstraitnr }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					has_trait = diligent
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pstraitnr }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					has_trait = arrogant
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pstraitnr }
			}

			if = {
				limit = {
					exists = cp:councillor_marshal
					OR = {
						has_realm_law = crown_authority_0
						has_realm_law = realm_administration_law_0
						has_realm_law = tribal_authority_0
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pscrauth0 }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					OR = {
						has_realm_law = crown_authority_1
						has_realm_law = realm_administration_law_1
						has_realm_law = tribal_authority_1
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pscrauth1 }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					OR = {
						has_realm_law = crown_authority_2
						has_realm_law = realm_administration_law_2
						has_realm_law = tribal_authority_2
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pscrauth2 }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					OR = {
						has_realm_law = crown_authority_3
						has_realm_law = realm_administration_law_3
						has_realm_law = tribal_authority_3
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @pscrauth3 }
			}

			if = {
				limit = {
					exists = cp:councillor_marshal
					cp:councillor_marshal = {
						has_trait = brave
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					cp:councillor_marshal = {
						has_trait = wrathful
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					cp:councillor_marshal = {
						has_trait = craven
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psspecialn }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					cp:councillor_marshal = {
						has_trait = calm
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psspecialn }
			}
















			if = {
				limit = {
					exists = cp:councillor_spymaster
					is_adult = no
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psage }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					age < 20
					cp:councillor_spymaster = {
						age >= 30
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psage }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					age < 30
					cp:councillor_spymaster = {
						age >= 40
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psage }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					age < 40
					cp:councillor_spymaster = {
						age >= 50
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psage }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					age < 50
					cp:councillor_spymaster = {
						age >= 60
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psage }
			}

			if = {
				limit = {
					exists = cp:councillor_spymaster
					cp:councillor_spymaster = {
						is_landed = yes
						is_powerful_vassal = no
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psrank1 }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					cp:councillor_spymaster = {
						is_landed = yes
						is_powerful_vassal = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psrank2 }
			}

			if = {
				limit = {
					exists = cp:councillor_spymaster
					intrigue < 10
					cp:councillor_spymaster = {
						intrigue >= 20
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					intrigue < 12
					cp:councillor_spymaster = {
						intrigue >= 25
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					intrigue < 14
					cp:councillor_spymaster = {
						intrigue >= 30
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					cp:councillor_spymaster = {
						intrigue >= 35
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psskill }
			}

			if = {
				limit = {
					exists = cp:councillor_spymaster
					average_of_all_skills_and_prowess < 8
					cp:councillor_spymaster = {
						average_of_all_skills_and_prowess >= 10
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					average_of_all_skills_and_prowess < 10
					cp:councillor_spymaster = {
						average_of_all_skills_and_prowess >= 12
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					average_of_all_skills_and_prowess < 12
					cp:councillor_spymaster = {
						average_of_all_skills_and_prowess >= 14
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psskill }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					average_of_all_skills_and_prowess < 14
					cp:councillor_spymaster = {
						average_of_all_skills_and_prowess >= 16
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psskill }
			}

			if = {
				limit = {
					exists = cp:councillor_spymaster
					dread < 20
					cp:councillor_spymaster = {
						dread >= 40
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psdread }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					dread < 40
					cp:councillor_spymaster = {
						dread >= 60
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psdread }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					dread < 60
					cp:councillor_spymaster = {
						dread >= 80
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psdread }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					dread < 80
					cp:councillor_spymaster = {
						dread >= 100
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psdread }
			}

			if = {
				limit = {
					exists = cp:councillor_spymaster
					has_trait = content
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pstraitpr }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					has_trait = lazy
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pstraitpr }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					has_trait = humble
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pstraitpr }
			}

			if = {
				limit = {
					exists = cp:councillor_spymaster
					cp:councillor_spymaster = {
						has_trait = ambitious
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pstraitp }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					cp:councillor_spymaster = {
						has_trait = diligent
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pstraitp }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					cp:councillor_spymaster = {
						has_trait = arrogant
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pstraitp }
			}

			if = {
				limit = {
					exists = cp:councillor_spymaster
					cp:councillor_spymaster = {
						has_trait = content
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pstraitn }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					cp:councillor_spymaster = {
						has_trait = lazy
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pstraitn }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					cp:councillor_spymaster = {
						has_trait = humble
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pstraitn }
			}
			
			if = {
				limit = {
					exists = cp:councillor_spymaster
					has_trait = ambitious
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pstraitnr }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					has_trait = diligent
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pstraitnr }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					has_trait = arrogant
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pstraitnr }
			}

			if = {
				limit = {
					exists = cp:councillor_spymaster
					OR = {
						has_realm_law = crown_authority_0
						has_realm_law = realm_administration_law_0
						has_realm_law = tribal_authority_0
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pscrauth0 }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					OR = {
						has_realm_law = crown_authority_1
						has_realm_law = realm_administration_law_1
						has_realm_law = tribal_authority_1
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pscrauth1 }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					OR = {
						has_realm_law = crown_authority_2
						has_realm_law = realm_administration_law_2
						has_realm_law = tribal_authority_2
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pscrauth2 }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					OR = {
						has_realm_law = crown_authority_3
						has_realm_law = realm_administration_law_3
						has_realm_law = tribal_authority_3
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @pscrauth3 }
			}

			if = {
				limit = {
					exists = cp:councillor_spymaster
					cp:councillor_spymaster = {
						has_trait = paranoid
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					cp:councillor_spymaster = {
						has_trait = deceitful
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psspecialp }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					cp:councillor_spymaster = {
						has_trait = trusting
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psspecialn }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					cp:councillor_spymaster = {
						has_trait = honest
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psspecialn }
			}




















			if = {
				limit = {
					exists = primary_spouse
					is_adult = no
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @psage }
			}
			if = {
				limit = {
					exists = primary_spouse
					age < 20
					primary_spouse = {
						age >= 30
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @psage }
			}
			if = {
				limit = {
					exists = primary_spouse
					age < 30
					primary_spouse = {
						age >= 40
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @psage }
			}
			if = {
				limit = {
					exists = primary_spouse
					age < 40
					primary_spouse = {
						age >= 50
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @psage }
			}
			if = {
				limit = {
					exists = primary_spouse
					age < 50
					primary_spouse = {
						age >= 60
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @psage }
			}

			if = {
				limit = {
					exists = primary_spouse
					primary_spouse = {
						OR = {
							highest_held_title_tier >= 2
							any_parent = {
								highest_held_title_tier >= 2
							}
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @psrank1 }
			}
			if = {
				limit = {
					exists = primary_spouse
					primary_spouse = {
						OR = {
							highest_held_title_tier >= 3
							any_parent = {
								highest_held_title_tier >= 3
							}
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @psrank1 }
			}
			if = {
				limit = {
					exists = primary_spouse
					primary_spouse = {
						OR = {
							highest_held_title_tier >= 4
							any_parent = {
								highest_held_title_tier >= 4
							}
						}
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @psrank1 }
			}

			if = {
				limit = {
					exists = primary_spouse
					average_of_all_skills_and_prowess < 8
					primary_spouse = {
						average_of_all_skills_and_prowess >= 10
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @psskill }
			}
			if = {
				limit = {
					exists = primary_spouse
					average_of_all_skills_and_prowess < 10
					primary_spouse = {
						average_of_all_skills_and_prowess >= 12
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @psskill }
			}
			if = {
				limit = {
					exists = primary_spouse
					average_of_all_skills_and_prowess < 12
					primary_spouse = {
						average_of_all_skills_and_prowess >= 14
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @psskill }
			}
			if = {
				limit = {
					exists = primary_spouse
					average_of_all_skills_and_prowess < 14
					primary_spouse = {
						average_of_all_skills_and_prowess >= 16
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @psskill }
			}

			if = {
				limit = {
					exists = primary_spouse
					dread < 20
					primary_spouse = {
						dread >= 40
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @psdread }
			}
			if = {
				limit = {
					exists = primary_spouse
					dread < 40
					primary_spouse = {
						dread >= 60
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @psdread }
			}
			if = {
				limit = {
					exists = primary_spouse
					dread < 60
					primary_spouse = {
						dread >= 80
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @psdread }
			}
			if = {
				limit = {
					exists = primary_spouse
					dread < 80
					primary_spouse = {
						dread >= 100
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @psdread }
			}

			if = {
				limit = {
					exists = primary_spouse
					has_trait = content
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @pstraitpr }
			}
			if = {
				limit = {
					exists = primary_spouse
					has_trait = lazy
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @pstraitpr }
			}
			if = {
				limit = {
					exists = primary_spouse
					has_trait = humble
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @pstraitpr }
			}

			if = {
				limit = {
					exists = primary_spouse
					primary_spouse = {
						has_trait = ambitious
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @pstraitp }
			}
			if = {
				limit = {
					exists = primary_spouse
					primary_spouse = {
						has_trait = diligent
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @pstraitp }
			}
			if = {
				limit = {
					exists = primary_spouse
					primary_spouse = {
						has_trait = arrogant
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @pstraitp }
			}

			if = {
				limit = {
					exists = primary_spouse
					primary_spouse = {
						has_trait = content
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @pstraitn }
			}
			if = {
				limit = {
					exists = primary_spouse
					primary_spouse = {
						has_trait = lazy
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @pstraitn }
			}
			if = {
				limit = {
					exists = primary_spouse
					primary_spouse = {
						has_trait = humble
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @pstraitn }
			}
			
			if = {
				limit = {
					exists = primary_spouse
					has_trait = ambitious
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @pstraitnr }
			}
			if = {
				limit = {
					exists = primary_spouse
					has_trait = diligent
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @pstraitnr }
			}
			if = {
				limit = {
					exists = primary_spouse
					has_trait = arrogant
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @pstraitnr }
			}

			if = {
				limit = {
					exists = primary_spouse
					OR = {
						has_realm_law = crown_authority_0
						has_realm_law = realm_administration_law_0
						has_realm_law = tribal_authority_0
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @pscrauth0 }
			}
			if = {
				limit = {
					exists = primary_spouse
					OR = {
						has_realm_law = crown_authority_1
						has_realm_law = realm_administration_law_1
						has_realm_law = tribal_authority_1
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @pscrauth1 }
			}
			if = {
				limit = {
					exists = primary_spouse
					OR = {
						has_realm_law = crown_authority_2
						has_realm_law = realm_administration_law_2
						has_realm_law = tribal_authority_2
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @pscrauth2 }
			}
			if = {
				limit = {
					exists = primary_spouse
					OR = {
						has_realm_law = crown_authority_3
						has_realm_law = realm_administration_law_3
						has_realm_law = tribal_authority_3
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @pscrauth3 }
			}

			if = {
				limit = {
					exists = primary_spouse
					primary_spouse = {
						has_trait = vengeful
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @psspecialp }
			}
			if = {
				limit = {
					exists = primary_spouse
					primary_spouse = {
						has_trait = lustful
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @psspecialp }
			}
			if = {
				limit = {
					exists = primary_spouse
					primary_spouse = {
						has_trait = forgiving
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @psspecialn }
			}
			if = {
				limit = {
					exists = primary_spouse
					primary_spouse = {
						has_trait = chaste
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @psspecialn }
			}






			if = {
				limit = {
					exists = primary_spouse
					primary_spouse = {
						has_character_flag = gpt_sucessful_confrontation
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = -50 }
			}
			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						has_character_flag = gpt_sucessful_confrontation
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = -50 }
			}
			if = {
				limit = {
					exists = cp:councillor_chancellor
					cp:councillor_chancellor = {
						has_character_flag = gpt_sucessful_confrontation
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = -50 }
			}
			if = {
				limit = {
					exists = cp:councillor_steward
					cp:councillor_steward = {
						has_character_flag = gpt_sucessful_confrontation
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = -50 }
			}
			if = {
				limit = {
					exists = cp:councillor_marshal
					cp:councillor_marshal = {
						has_character_flag = gpt_sucessful_confrontation
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = -50 }
			}
			if = {
				limit = {
					exists = cp:councillor_spymaster
					cp:councillor_spymaster = {
						has_character_flag = gpt_sucessful_confrontation
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = -50 }
			}

			if = {
				limit = {
					is_female = yes
					faith = { has_doctrine = doctrine_gender_male_dominated }
					exists = primary_spouse
					primary_spouse = {
						is_male = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = @psfemale }
			}
			if = {
				limit = {
					is_female = yes
					faith = { has_doctrine = doctrine_gender_male_dominated }
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = {
						is_male = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = @psfemale }
			}
			if = {
				limit = {
					is_female = yes
					faith = { has_doctrine = doctrine_gender_male_dominated }
					exists = cp:councillor_chancellor
					cp:councillor_chancellor = {
						is_male = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = @psfemale }
			}
			if = {
				limit = {
					is_female = yes
					faith = { has_doctrine = doctrine_gender_male_dominated }
					exists = cp:councillor_steward
					cp:councillor_steward = {
						is_male = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = @psfemale }
			}
			if = {
				limit = {
					is_female = yes
					faith = { has_doctrine = doctrine_gender_male_dominated }
					exists = cp:councillor_marshal
					cp:councillor_marshal = {
						is_male = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = @psfemale }
			}
			if = {
				limit = {
					is_female = yes
					faith = { has_doctrine = doctrine_gender_male_dominated }
					exists = cp:councillor_spymaster
					cp:councillor_spymaster = {
						is_male = yes
					}
				}
				add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = @psfemale }
			}


			add_trait_xp = { trait = gpt_power_struggle track = gpt_immaturity value = 0.1 }
			add_trait_xp = { trait = gpt_power_struggle track = gpt_senility value = 0.1 }
			add_trait_xp = { trait = gpt_power_struggle track = gpt_spouse value = 0.1 }
			add_trait_xp = { trait = gpt_power_struggle track = gpt_chaplain value = 0.1 }
			add_trait_xp = { trait = gpt_power_struggle track = gpt_chancellor value = 0.1 }
			add_trait_xp = { trait = gpt_power_struggle track = gpt_steward value = 0.1 }
			add_trait_xp = { trait = gpt_power_struggle track = gpt_marshal value = 0.1 }
			add_trait_xp = { trait = gpt_power_struggle track = gpt_spymaster value = 0.1 }
		}
	}	
}

gpt_entourage_circle_check = {
	trigger = {
		is_landless_adventurer = no
		NOT = { has_game_rule = GPT_rfavor_disabled }
		OR = {
			is_ai = no
			has_game_rule = GPT_rfavor_count
			has_game_rule = GPT_rfavor_duke
			has_game_rule = GPT_rfavor_king
		}
	}
	effect = {
		
		if = {
			limit = {
				is_ai = yes
				OR = {
					has_game_rule = GPT_rfavor_disabled
					highest_held_title_tier < gpt_rfavor_tier
				}
			}
			if = { limit = { has_trait = gpt_entourage_circle } remove_trait = gpt_entourage_circle }
		}

		if = {
			limit = {
			 #	is_landed = yes
				age >= 14
				NOT = { has_game_rule = GPT_rfavor_disabled }
				OR = {
					highest_held_title_tier >= gpt_rfavor_tier
					is_ai = no
				}
			}
			if = { limit = { NOT = { has_trait = gpt_entourage_circle } } add_trait = gpt_entourage_circle }
			add_trait_xp = { trait = gpt_entourage_circle track = gpt_coterie value = -100 }
			add_trait_xp = { trait = gpt_entourage_circle track = gpt_retainers value = -100 }
			add_trait_xp = { trait = gpt_entourage_circle track = gpt_advisors value = -100 }
			add_trait_xp = { trait = gpt_entourage_circle track = gpt_family value = -100 }
			add_trait_xp = { trait = gpt_entourage_circle track = gpt_devouts value = -100 }
			add_trait_xp = { trait = gpt_entourage_circle track = gpt_foragers value = -100 }
			add_trait_xp = { trait = gpt_entourage_circle track = gpt_sycophants value = -100 }
			add_trait_xp = { trait = gpt_entourage_circle track = gpt_artisans value = -100 }
			add_trait_xp = { trait = gpt_entourage_circle track = gpt_commoners value = -100 }
			
			if = {
				limit = {
					has_trait = gpt_entourage_circle 
				}
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_coterie value = { value = 0 add = ai_sociability } }
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_coterie value = { value = 0 add = ai_zeal multiply = -1 } }

				add_trait_xp = { trait = gpt_entourage_circle track = gpt_retainers value = { value = 0 add = ai_honor } }
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_retainers value = { value = 0 add = ai_compassion multiply = -1 } }
				
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_advisors value = { value = 0 add = ai_energy } }

				add_trait_xp = { trait = gpt_entourage_circle track = gpt_family value = { value = 0 add = ai_vengefulness } }
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_family value = { value = 0 add = ai_boldness multiply = -1 } }

				add_trait_xp = { trait = gpt_entourage_circle track = gpt_devouts value = { value = 0 add = ai_zeal } }
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_devouts value = { value = 0 add = ai_sociability multiply = -1 } }

				add_trait_xp = { trait = gpt_entourage_circle track = gpt_foragers value = { value = 0 add = ai_boldness } }
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_foragers value = { value = 0 add = ai_rationality multiply = -1 } }

				add_trait_xp = { trait = gpt_entourage_circle track = gpt_sycophants value = { value = 0 add = ai_greed } }
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_sycophants value = { value = 0 add = ai_honor multiply = -1 } }

				add_trait_xp = { trait = gpt_entourage_circle track = gpt_artisans value = { value = 0 add = ai_vengefulness multiply = -1 } }
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_artisans value = { value = 0 add = ai_rationality } }

				add_trait_xp = { trait = gpt_entourage_circle track = gpt_commoners value = { value = 0 add = ai_compassion } }
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_commoners value = { value = 0 add = ai_greed multiply = -1 } }


				add_trait_xp = { trait = gpt_entourage_circle track = gpt_coterie value = { value = 0 add = diplomacy multiply = 2 } }
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_coterie value = { value = 0 add = learning multiply = -2 } }

				add_trait_xp = { trait = gpt_entourage_circle track = gpt_retainers value = { value = 0 add = martial multiply = 2 } }
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_retainers value = { value = 0 add = intrigue multiply = -2 } }

				add_trait_xp = { trait = gpt_entourage_circle track = gpt_family value = { value = 0 add = intrigue multiply = 2 } }
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_family value = { value = 0 add = dread multiply = -1 } }

				add_trait_xp = { trait = gpt_entourage_circle track = gpt_devouts value = { value = 0 add = learning multiply = 2 } }
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_devouts value = { value = 0 add = stewardship multiply = -2 } }

				add_trait_xp = { trait = gpt_entourage_circle track = gpt_foragers value = { value = 0 add = prowess multiply = 1.5 } }
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_foragers value = { value = 0 add = diplomacy multiply = -2 } }

				add_trait_xp = { trait = gpt_entourage_circle track = gpt_sycophants value = { value = 0 add = dread multiply = 1 } }
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_sycophants value = { value = 0 add = learning multiply = -2 } }

				add_trait_xp = { trait = gpt_entourage_circle track = gpt_artisans value = { value = 0 add = stewardship multiply = 2 } }
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_artisans value = { value = 0 add = prowess multiply = -1.5 } }

				add_trait_xp = { trait = gpt_entourage_circle track = gpt_commoners value = { value = 0 add = legitimacy_level multiply = 3.5 } }
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_commoners value = { value = 0 add = martial multiply = -2 } }
			}

			if = {
				limit = {
					has_trait = gpt_entourage_circle 
					OR = {
						has_trait = ambitious
						has_trait = diligent
					}
				}
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_advisors value = 25 }
			}
			if = {
				limit = {
					has_trait = gpt_entourage_circle 
					OR = {
						has_trait = content
						has_trait = lazy
					}
				}
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_advisors value = -25 }
			}

			if = {
		 		limit = {
		 			has_trait = gpt_entourage_circle
					OR = {
						AND = {
							has_trait = gregarious
		 					has_trait = zealous
						}
						AND = {
							has_trait = shy
		 					has_trait = cynical
						}
					}
		 		}
		 		add_trait_xp = { trait = gpt_entourage_circle track = gpt_coterie value = -100 }
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_coterie value = 50 }
		 	}
			if = {
		 		limit = {
		 			has_trait = gpt_entourage_circle
					OR = {
						AND = {
							has_trait = just
		 					has_trait = compassionate
						}
						AND = {
							has_trait = arbitrary
		 					has_trait = sadistic
						}
					}
		 		}
		 		add_trait_xp = { trait = gpt_entourage_circle track = gpt_retainers value = -100 }
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_retainers value = 50 }
		 	}
			if = {
		 		limit = {
		 			has_trait = gpt_entourage_circle
					OR = {
						AND = {
							has_trait = vengeful
		 					has_trait = brave
						}
						AND = {
							has_trait = forgiving
		 					has_trait = craven
						}
					}
		 		}
		 		add_trait_xp = { trait = gpt_entourage_circle track = gpt_family value = -100 }
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_family value = 50 }
		 	}
			if = {
		 		limit = {
		 			has_trait = gpt_entourage_circle
					OR = {
						AND = {
							has_trait = zealous
		 					has_trait = gregarious
						}
						AND = {
							has_trait = shy
		 					has_trait = cynical
						}
					}
		 		}
		 		add_trait_xp = { trait = gpt_entourage_circle track = gpt_devouts value = -100 }
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_devouts value = 50 }
		 	}
			if = {
		 		limit = {
		 			has_trait = gpt_entourage_circle
					OR = {
						AND = {
							has_trait = greedy
		 					has_trait = just
						}
						AND = {
							has_trait = arbitrary
		 					has_trait = generous
						}
					}
		 		}
		 		add_trait_xp = { trait = gpt_entourage_circle track = gpt_sycophants value = -100 }
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_sycophants value = 50 }
		 	}
			if = {
		 		limit = {
		 			has_trait = gpt_entourage_circle
					OR = {
						AND = {
							has_trait = compassionate
		 					has_trait = greedy
						}
						AND = {
							has_trait = sadistic
		 					has_trait = generous
						}
					}
		 		}
		 		add_trait_xp = { trait = gpt_entourage_circle track = gpt_commoners value = -100 }
				add_trait_xp = { trait = gpt_entourage_circle track = gpt_commoners value = 50 }
		 	}

			add_trait_xp = { trait = gpt_entourage_circle track = gpt_coterie value = 0.1 }
			add_trait_xp = { trait = gpt_entourage_circle track = gpt_retainers value = 0.1 }
			add_trait_xp = { trait = gpt_entourage_circle track = gpt_advisors value = 0.1 }
			add_trait_xp = { trait = gpt_entourage_circle track = gpt_family value = 0.1 }
			add_trait_xp = { trait = gpt_entourage_circle track = gpt_devouts value = 0.1 }
			add_trait_xp = { trait = gpt_entourage_circle track = gpt_foragers value = 0.1 }
			add_trait_xp = { trait = gpt_entourage_circle track = gpt_sycophants value = 0.1 }
			add_trait_xp = { trait = gpt_entourage_circle track = gpt_artisans value = 0.1 }
			add_trait_xp = { trait = gpt_entourage_circle track = gpt_commoners value = 0.1 }
		}
	}	
}





gpt_royal_favor_dynasty = {
	trigger = {
		is_landless_adventurer = no
		NOT = { has_game_rule = GPT_rfavor_disabled }
		OR = {
			is_ai = no
			has_game_rule = GPT_rfavor_count
			has_game_rule = GPT_rfavor_duke
			has_game_rule = GPT_rfavor_king
		}
	}
	effect = {

		if = {
			limit = {
				has_trait = gpt_social_strata
				NOT = { has_character_flag = gpt_favoring_dynasty }
				has_character_flag = gpt_favoring_dynasty_timeout
				is_adult = yes
				is_ruler = yes
				highest_held_title_tier >= 2 is_imprisoned = no ### is_landed = yes
			}
			random = {
				chance = 100
				random_list = {
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = gpt_favoring_dynasty_end_t
							desc = gpt_favoring_dynasty_end_d
							left_icon = root
						 #	show_as_tooltip = { custom_tooltip = { text = favor_stop_xp_tip } }
						}
						remove_character_flag = gpt_favoring_dynasty_timeout
					}
				}
			}
		}

		if = {
			limit = {
				has_trait = gpt_social_strata
				has_character_flag = gpt_favoring_dynasty
				has_character_flag = gpt_favoring_dynasty_timeout
				is_adult = yes
				is_ruler = yes
				highest_held_title_tier >= 2 is_imprisoned = no ### is_landed = yes
			}
			random = {
				chance = 100
				random_list = {
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_dynasty_event_01_t
							desc = bestow_favor_dynasty_event_01_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_dynasty_event_02_t
							desc = bestow_favor_dynasty_event_02_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_dynasty_event_03_t
							desc = bestow_favor_dynasty_event_03_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_dynasty_event_04_t
							desc = bestow_favor_dynasty_event_04_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_dynasty_event_05_t
							desc = bestow_favor_dynasty_event_05_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_dynasty_event_06_t
							desc = bestow_favor_dynasty_event_06_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_dynasty_event_07_t
							desc = bestow_favor_dynasty_event_07_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_dynasty_event_08_t
							desc = bestow_favor_dynasty_event_08_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_dynasty_event_09_t
							desc = bestow_favor_dynasty_event_09_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_dynasty_event_10_t
							desc = bestow_favor_dynasty_event_10_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_dynasty_event_11_t
							desc = bestow_favor_dynasty_event_11_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_dynasty_event_12_t
							desc = bestow_favor_dynasty_event_12_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_dynasty_event_13_t
							desc = bestow_favor_dynasty_event_13_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_dynasty_event_14_t
							desc = bestow_favor_dynasty_event_14_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_dynasty_event_15_t
							desc = bestow_favor_dynasty_event_15_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_dynasty_event_16_t
							desc = bestow_favor_dynasty_event_16_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_dynasty_event_17_t
							desc = bestow_favor_dynasty_event_17_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_dynasty_event_18_t
							desc = bestow_favor_dynasty_event_18_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_dynasty_event_19_t
							desc = bestow_favor_dynasty_event_19_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_dynasty_event_20_t
							desc = bestow_favor_dynasty_event_20_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
				}
			}
		}
	}
}

gpt_royal_favor_nobility = {
	trigger = {
		is_landless_adventurer = no
		NOT = { has_game_rule = GPT_rfavor_disabled }
		OR = {
			is_ai = no
			has_game_rule = GPT_rfavor_count
			has_game_rule = GPT_rfavor_duke
			has_game_rule = GPT_rfavor_king
		}
	}
	effect = {

		if = {
			limit = {
				has_trait = gpt_social_strata
				NOT = { has_character_flag = gpt_favoring_nobility }
				has_character_flag = gpt_favoring_nobility_timeout
				is_adult = yes
				is_ruler = yes
				highest_held_title_tier >= 2 is_imprisoned = no ### is_landed = yes
			}
			random = {
				chance = 100
				random_list = {
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = gpt_favoring_nobility_end_t
							desc = gpt_favoring_nobility_end_d
							left_icon = root
						 #	show_as_tooltip = { custom_tooltip = { text = favor_stop_xp_tip } }
						}
						remove_character_flag = gpt_favoring_nobility_timeout
					}
				}
			}
		}

		if = {
			limit = {
				has_trait = gpt_social_strata
				has_character_flag = gpt_favoring_nobility
				has_character_flag = gpt_favoring_nobility_timeout
				is_adult = yes
				is_ruler = yes
				highest_held_title_tier >= 2 is_imprisoned = no ### is_landed = yes
			}
			random = {
				chance = 100
				random_list = {
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_nobility_event_01_t
							desc = bestow_favor_nobility_event_01_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_nobility_event_02_t
							desc = bestow_favor_nobility_event_02_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_nobility_event_03_t
							desc = bestow_favor_nobility_event_03_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_nobility_event_04_t
							desc = bestow_favor_nobility_event_04_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_nobility_event_05_t
							desc = bestow_favor_nobility_event_05_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_nobility_event_06_t
							desc = bestow_favor_nobility_event_06_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_nobility_event_07_t
							desc = bestow_favor_nobility_event_07_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_nobility_event_08_t
							desc = bestow_favor_nobility_event_08_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_nobility_event_09_t
							desc = bestow_favor_nobility_event_09_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_nobility_event_10_t
							desc = bestow_favor_nobility_event_10_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_nobility_event_11_t
							desc = bestow_favor_nobility_event_11_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_nobility_event_12_t
							desc = bestow_favor_nobility_event_12_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_nobility_event_13_t
							desc = bestow_favor_nobility_event_13_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_nobility_event_14_t
							desc = bestow_favor_nobility_event_14_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_nobility_event_15_t
							desc = bestow_favor_nobility_event_15_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_nobility_event_16_t
							desc = bestow_favor_nobility_event_16_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_nobility_event_17_t
							desc = bestow_favor_nobility_event_17_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_nobility_event_18_t
							desc = bestow_favor_nobility_event_18_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_nobility_event_19_t
							desc = bestow_favor_nobility_event_19_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_nobility_event_20_t
							desc = bestow_favor_nobility_event_20_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
				}
			}
		}
	}
}

gpt_royal_favor_merchants = {
	trigger = {
		is_landless_adventurer = no
		NOT = { has_game_rule = GPT_rfavor_disabled }
		OR = {
			is_ai = no
			has_game_rule = GPT_rfavor_count
			has_game_rule = GPT_rfavor_duke
			has_game_rule = GPT_rfavor_king
		}
	}
	effect = {

		if = {
			limit = {
				has_trait = gpt_social_strata
				NOT = { has_character_flag = gpt_favoring_merchants }
				has_character_flag = gpt_favoring_merchants_timeout
				is_adult = yes
				is_ruler = yes
				highest_held_title_tier >= 2 is_imprisoned = no ### is_landed = yes
			}
			random = {
				chance = 100
				random_list = {
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = gpt_favoring_merchants_end_t
							desc = gpt_favoring_merchants_end_d
							left_icon = root
						 #	show_as_tooltip = { custom_tooltip = { text = favor_stop_xp_tip } }
						}
						remove_character_flag = gpt_favoring_merchants_timeout
					}
				}
			}
		}

		if = {
			limit = {
				has_trait = gpt_social_strata
				has_character_flag = gpt_favoring_merchants
				has_character_flag = gpt_favoring_merchants_timeout
				is_adult = yes
				is_ruler = yes
				highest_held_title_tier >= 2 is_imprisoned = no ### is_landed = yes
			}
			random = {
				chance = 100
				random_list = {
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_merchants_event_01_t
							desc = bestow_favor_merchants_event_01_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_merchants_event_02_t
							desc = bestow_favor_merchants_event_02_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_merchants_event_03_t
							desc = bestow_favor_merchants_event_03_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_merchants_event_04_t
							desc = bestow_favor_merchants_event_04_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_merchants_event_05_t
							desc = bestow_favor_merchants_event_05_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_merchants_event_06_t
							desc = bestow_favor_merchants_event_06_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_merchants_event_07_t
							desc = bestow_favor_merchants_event_07_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_merchants_event_08_t
							desc = bestow_favor_merchants_event_08_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_merchants_event_09_t
							desc = bestow_favor_merchants_event_09_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_merchants_event_10_t
							desc = bestow_favor_merchants_event_10_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_merchants_event_11_t
							desc = bestow_favor_merchants_event_11_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_merchants_event_12_t
							desc = bestow_favor_merchants_event_12_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_merchants_event_13_t
							desc = bestow_favor_merchants_event_13_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_merchants_event_14_t
							desc = bestow_favor_merchants_event_14_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_merchants_event_15_t
							desc = bestow_favor_merchants_event_15_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_merchants_event_16_t
							desc = bestow_favor_merchants_event_16_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_merchants_event_17_t
							desc = bestow_favor_merchants_event_17_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_merchants_event_18_t
							desc = bestow_favor_merchants_event_18_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_merchants_event_19_t
							desc = bestow_favor_merchants_event_19_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_merchants_event_20_t
							desc = bestow_favor_merchants_event_20_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
				}
			}
		}
	}
}

gpt_royal_favor_knights = {
	trigger = {
		is_landless_adventurer = no
		NOT = { has_game_rule = GPT_rfavor_disabled }
		OR = {
			is_ai = no
			has_game_rule = GPT_rfavor_count
			has_game_rule = GPT_rfavor_duke
			has_game_rule = GPT_rfavor_king
		}
	}
	effect = {

		if = {
			limit = {
				has_trait = gpt_social_strata
				NOT = { has_character_flag = gpt_favoring_knights }
				has_character_flag = gpt_favoring_knights_timeout
				is_adult = yes
				is_ruler = yes
				highest_held_title_tier >= 2 is_imprisoned = no ### is_landed = yes
			}
			random = {
				chance = 100
				random_list = {
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = gpt_favoring_knights_end_t
							desc = gpt_favoring_knights_end_d
							left_icon = root
						 #	show_as_tooltip = { custom_tooltip = { text = favor_stop_xp_tip } }
						}
						remove_character_flag = gpt_favoring_knights_timeout
					}
				}
			}
		}

		if = {
			limit = {
				has_trait = gpt_social_strata
				has_character_flag = gpt_favoring_knights
				has_character_flag = gpt_favoring_knights_timeout
				is_adult = yes
				is_ruler = yes
				highest_held_title_tier >= 2 is_imprisoned = no ### is_landed = yes
			}
			random = {
				chance = 100
				random_list = {
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_knights_event_01_t
							desc = bestow_favor_knights_event_01_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_knights_event_02_t
							desc = bestow_favor_knights_event_02_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_knights_event_03_t
							desc = bestow_favor_knights_event_03_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_knights_event_04_t
							desc = bestow_favor_knights_event_04_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_knights_event_05_t
							desc = bestow_favor_knights_event_05_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_knights_event_06_t
							desc = bestow_favor_knights_event_06_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_knights_event_07_t
							desc = bestow_favor_knights_event_07_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_knights_event_08_t
							desc = bestow_favor_knights_event_08_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_knights_event_09_t
							desc = bestow_favor_knights_event_09_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_knights_event_10_t
							desc = bestow_favor_knights_event_10_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_knights_event_11_t
							desc = bestow_favor_knights_event_11_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_knights_event_12_t
							desc = bestow_favor_knights_event_12_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_knights_event_13_t
							desc = bestow_favor_knights_event_13_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_knights_event_14_t
							desc = bestow_favor_knights_event_14_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_knights_event_15_t
							desc = bestow_favor_knights_event_15_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_knights_event_16_t
							desc = bestow_favor_knights_event_16_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_knights_event_17_t
							desc = bestow_favor_knights_event_17_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_knights_event_18_t
							desc = bestow_favor_knights_event_18_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_knights_event_19_t
							desc = bestow_favor_knights_event_19_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_knights_event_20_t
							desc = bestow_favor_knights_event_20_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
				}
			}
		}
	}
}

gpt_royal_favor_clergy = {
	trigger = {
		is_landless_adventurer = no
		NOT = { has_game_rule = GPT_rfavor_disabled }
		OR = {
			is_ai = no
			has_game_rule = GPT_rfavor_count
			has_game_rule = GPT_rfavor_duke
			has_game_rule = GPT_rfavor_king
		}
	}
	effect = {

		if = {
			limit = {
				has_trait = gpt_social_strata
				NOT = { has_character_flag = gpt_favoring_clergy }
				has_character_flag = gpt_favoring_clergy_timeout
				is_adult = yes
				is_ruler = yes
				highest_held_title_tier >= 2 is_imprisoned = no ### is_landed = yes
			}
			random = {
				chance = 100
				random_list = {
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = gpt_favoring_clergy_end_t
							desc = gpt_favoring_clergy_end_d
							left_icon = root
						 #	show_as_tooltip = { custom_tooltip = { text = favor_stop_xp_tip } }
						}
						remove_character_flag = gpt_favoring_clergy_timeout
					}
				}
			}
		}

		if = {
			limit = {
				has_trait = gpt_social_strata
				has_character_flag = gpt_favoring_clergy
				has_character_flag = gpt_favoring_clergy_timeout
				is_adult = yes
				is_ruler = yes
				highest_held_title_tier >= 2 is_imprisoned = no ### is_landed = yes
			}
			random = {
				chance = 100
				random_list = {
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_clergy_event_01_t
							desc = bestow_favor_clergy_event_01_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_clergy_event_02_t
							desc = bestow_favor_clergy_event_02_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_clergy_event_03_t
							desc = bestow_favor_clergy_event_03_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_clergy_event_04_t
							desc = bestow_favor_clergy_event_04_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_clergy_event_05_t
							desc = bestow_favor_clergy_event_05_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_clergy_event_06_t
							desc = bestow_favor_clergy_event_06_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_clergy_event_07_t
							desc = bestow_favor_clergy_event_07_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_clergy_event_08_t
							desc = bestow_favor_clergy_event_08_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_clergy_event_09_t
							desc = bestow_favor_clergy_event_09_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_clergy_event_10_t
							desc = bestow_favor_clergy_event_10_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_clergy_event_11_t
							desc = bestow_favor_clergy_event_11_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_clergy_event_12_t
							desc = bestow_favor_clergy_event_12_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_clergy_event_13_t
							desc = bestow_favor_clergy_event_13_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_clergy_event_14_t
							desc = bestow_favor_clergy_event_14_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_clergy_event_15_t
							desc = bestow_favor_clergy_event_15_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_clergy_event_16_t
							desc = bestow_favor_clergy_event_16_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_clergy_event_17_t
							desc = bestow_favor_clergy_event_17_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_clergy_event_18_t
							desc = bestow_favor_clergy_event_18_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_clergy_event_19_t
							desc = bestow_favor_clergy_event_19_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_clergy_event_20_t
							desc = bestow_favor_clergy_event_20_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
				}
			}
		}
	}
}

gpt_royal_favor_peasants = {
	trigger = {
		is_landless_adventurer = no
		NOT = { has_game_rule = GPT_rfavor_disabled }
		OR = {
			is_ai = no
			has_game_rule = GPT_rfavor_count
			has_game_rule = GPT_rfavor_duke
			has_game_rule = GPT_rfavor_king
		}
	}
	effect = {

		if = {
			limit = {
				has_trait = gpt_social_strata
				NOT = { has_character_flag = gpt_favoring_peasants }
				has_character_flag = gpt_favoring_peasants_timeout
				is_adult = yes
				is_ruler = yes
				highest_held_title_tier >= 2 is_imprisoned = no ### is_landed = yes
			}
			random = {
				chance = 100
				random_list = {
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = gpt_favoring_peasants_end_t
							desc = gpt_favoring_peasants_end_d
							left_icon = root
						 #	show_as_tooltip = { custom_tooltip = { text = favor_stop_xp_tip } }
						}
						remove_character_flag = gpt_favoring_peasants_timeout
					}
				}
			}
		}

		if = {
			limit = {
				has_trait = gpt_social_strata
				has_character_flag = gpt_favoring_peasants
				has_character_flag = gpt_favoring_peasants_timeout
				is_adult = yes
				is_ruler = yes
				highest_held_title_tier >= 2 is_imprisoned = no ### is_landed = yes
			}
			random = {
				chance = 100
				random_list = {
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_peasants_event_01_t
							desc = bestow_favor_peasants_event_01_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_peasants_event_02_t
							desc = bestow_favor_peasants_event_02_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_peasants_event_03_t
							desc = bestow_favor_peasants_event_03_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_peasants_event_04_t
							desc = bestow_favor_peasants_event_04_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_peasants_event_05_t
							desc = bestow_favor_peasants_event_05_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_peasants_event_06_t
							desc = bestow_favor_peasants_event_06_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_peasants_event_07_t
							desc = bestow_favor_peasants_event_07_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_peasants_event_08_t
							desc = bestow_favor_peasants_event_08_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_peasants_event_09_t
							desc = bestow_favor_peasants_event_09_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_peasants_event_10_t
							desc = bestow_favor_peasants_event_10_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_peasants_event_11_t
							desc = bestow_favor_peasants_event_11_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_peasants_event_12_t
							desc = bestow_favor_peasants_event_12_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_peasants_event_13_t
							desc = bestow_favor_peasants_event_13_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_peasants_event_14_t
							desc = bestow_favor_peasants_event_14_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_peasants_event_15_t
							desc = bestow_favor_peasants_event_15_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_peasants_event_16_t
							desc = bestow_favor_peasants_event_16_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_peasants_event_17_t
							desc = bestow_favor_peasants_event_17_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_peasants_event_18_t
							desc = bestow_favor_peasants_event_18_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_peasants_event_19_t
							desc = bestow_favor_peasants_event_19_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_peasants_event_20_t
							desc = bestow_favor_peasants_event_20_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_gain }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_loss }
					}
				}
			}
		}
	}
}

gpt_royal_favor_outlaws = {
	trigger = {
		is_landless_adventurer = no
		NOT = { has_game_rule = GPT_rfavor_disabled }
		OR = {
			is_ai = no
			has_game_rule = GPT_rfavor_count
			has_game_rule = GPT_rfavor_duke
			has_game_rule = GPT_rfavor_king
		}
	}
	effect = {

		if = {
			limit = {
				has_trait = gpt_social_strata
				NOT = { has_character_flag = gpt_favoring_criminals }
				has_character_flag = gpt_favoring_criminals_timeout
				is_adult = yes
				is_ruler = yes
				highest_held_title_tier >= 2 is_imprisoned = no ### is_landed = yes
			}
			random = {
				chance = 100
				random_list = {
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = gpt_favoring_criminals_end_t
							desc = gpt_favoring_criminals_end_d
							left_icon = root
						 #	show_as_tooltip = { custom_tooltip = { text = favor_stop_xp_tip } }
						}
						remove_character_flag = gpt_favoring_criminals_timeout
					}
				}
			}
		}

		if = {
			limit = {
				has_trait = gpt_social_strata
				has_character_flag = gpt_favoring_criminals
				has_character_flag = gpt_favoring_criminals_timeout
				is_adult = yes
				is_ruler = yes
				highest_held_title_tier >= 2 is_imprisoned = no ### is_landed = yes
			}
			random = {
				chance = 100
				random_list = {
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_outlaws_event_01_t
							desc = bestow_favor_outlaws_event_01_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_outlaws_event_02_t
							desc = bestow_favor_outlaws_event_02_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_outlaws_event_03_t
							desc = bestow_favor_outlaws_event_03_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_outlaws_event_04_t
							desc = bestow_favor_outlaws_event_04_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_outlaws_event_05_t
							desc = bestow_favor_outlaws_event_05_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_outlaws_event_06_t
							desc = bestow_favor_outlaws_event_06_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_outlaws_event_07_t
							desc = bestow_favor_outlaws_event_07_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_outlaws_event_08_t
							desc = bestow_favor_outlaws_event_08_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_outlaws_event_09_t
							desc = bestow_favor_outlaws_event_09_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_outlaws_event_10_t
							desc = bestow_favor_outlaws_event_10_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_outlaws_event_11_t
							desc = bestow_favor_outlaws_event_11_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_outlaws_event_12_t
							desc = bestow_favor_outlaws_event_12_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_outlaws_event_13_t
							desc = bestow_favor_outlaws_event_13_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_outlaws_event_14_t
							desc = bestow_favor_outlaws_event_14_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_outlaws_event_15_t
							desc = bestow_favor_outlaws_event_15_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_outlaws_event_16_t
							desc = bestow_favor_outlaws_event_16_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_outlaws_event_17_t
							desc = bestow_favor_outlaws_event_17_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_outlaws_event_18_t
							desc = bestow_favor_outlaws_event_18_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_outlaws_event_19_t
							desc = bestow_favor_outlaws_event_19_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain }
					}
					1 = {
						send_interface_message = {
							type = event_rfavor_neutral_with_text
							title = bestow_favor_outlaws_event_20_t
							desc = bestow_favor_outlaws_event_20_d
							show_as_tooltip = { add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain } custom_tooltip = { text = gpt_loss_favor_xp } }
						}
						add_trait_xp = { trait = gpt_social_strata track = gpt_dynasty value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_nobility value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_merchants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_knights value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_clergy value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_peasants value = @xp_loss }
						add_trait_xp = { trait = gpt_social_strata track = gpt_criminals value = @xp_gain }
					}
				}
			}
		}
	}
}




gpt_remove_check = {
	trigger = {
		OR = {
			has_game_rule = GPT_rfavor_player
			has_game_rule = GPT_rfavor_disabled
		}
	}
	effect = {
		if = {
			limit = {
				is_ai = yes
				has_trait = gpt_social_strata
			}
			remove_trait = gpt_social_strata
		}
		if = {
			limit = {
				is_ai = yes
				has_trait = gpt_realm_ethos
			}
			remove_trait = gpt_realm_ethos
		}
		if = {
			limit = {
				is_ai = yes
				has_trait = gpt_power_struggle
			}
			remove_trait = gpt_power_struggle
		}
		if = {
			limit = {
				is_ai = yes
				has_trait = gpt_court_skill
			}
			remove_trait = gpt_court_skill
		}
		if = {
			limit = {
				is_ai = yes
				has_trait = gpt_army_xp
			}
			remove_trait = gpt_army_xp
		}
		if = {
			limit = {
				is_ai = yes
				has_trait = gpt_entourage_circle
			}
			remove_trait = gpt_entourage_circle
		}
		if = {
			limit = {
				is_ai = no
				has_game_rule = GPT_rfavor_disabled
				OR = {
					has_trait = gpt_social_strata
					has_trait = gpt_realm_ethos
					has_trait = gpt_power_struggle
					has_trait = gpt_army_xp
					has_trait = gpt_court_skill
					has_trait = gpt_entourage_circle
				}
			}
			remove_trait = gpt_social_strata
			remove_trait = gpt_realm_ethos
			remove_trait = gpt_power_struggle
			remove_trait = gpt_army_xp
			remove_trait = gpt_court_skill
			remove_trait = gpt_entourage_circle
		}
	}	
}

gpt_remove_check_2 = {
	trigger = {
		OR = {
		 #	is_landed = no
			is_landless_adventurer = yes
		}
	}
	effect = {
		if = {
			limit = {
				OR = {
				 #	is_landed = no
					is_landless_adventurer = yes
				}
				has_trait = gpt_social_strata
			}
			remove_trait = gpt_social_strata
		}
		if = {
			limit = {
				is_landless_adventurer = yes
				has_trait = gpt_realm_ethos
			}
			remove_trait = gpt_realm_ethos
		}
		if = {
			limit = {
				is_landless_adventurer = yes
				has_trait = gpt_power_struggle
			}
			remove_trait = gpt_power_struggle
		}
		if = {
			limit = {
				is_landless_adventurer = yes
				has_trait = gpt_court_skill
			}
			remove_trait = gpt_court_skill
		}
		if = {
			limit = {
				is_landless_adventurer = yes
				has_trait = gpt_army_xp
			}
			remove_trait = gpt_army_xp
		}
		if = {
			limit = {
				is_landless_adventurer = yes
				has_trait = gpt_entourage_circle
			}
			remove_trait = gpt_entourage_circle
		}
	}	
}
