decisions = {

	abdicate_throne = {
		from_potential = {
			ai = no
			is_ruler = yes
		}
        potential = { 
			# Flags that will not allow the abdicate button to display and prevents spamming of the button between 2 characters in the realm
			NOT = { 
				has_character_flag = wants_to_abdicate 
				has_character_flag = has_abdicated_throne 
				}
			# condition's for the heir (must not have abdicated a throne before) if condition's are not met button will not display (might want to remove the is_adult condition)
			current_heir = {
			dynasty = ROOT
			NOT = { has_character_flag = has_abdicated_throne }
			}

			# No gavelkind succession
			OR = {
				AND = {
					primary_title = { tier = KING }
					NOT = {
						any_demesne_title = {
							kingdom = { has_law = succ_gavelkind }
						}
					}
				}
				AND = {
					primary_title = { tier = EMPEROR }
					NOT = {
						any_demesne_title = {
							empire = { has_law = succ_gavelkind }
						}
					}
				}
				AND = {
					NOT = { primary_title = { higher_tier_than = DUKE } }
					NOT = {
						primary_title = {
							has_law = succ_gavelkind
						}
					}
				}
			}
			
        } 		
		allow = {
			war = no
		}
		effect = {
			add_trait = content
			set_character_flag = wants_to_abdicate
			current_heir = {
				character_event = { id = ABDICATE.001 days = 3 random = 3 tooltip = "abd_ask" }
			}
		}
		ai_will_do = {
			factor = 0 # Prevent AI from doing (can cause major crashes)
		}		
	}
}