
# Called once per empty holding in qualifying realm provinces of a nomad
# that's about to settle (only provinces actually part of the nomad's
# demesne and non-nomadic subrealm qualify).
emf_nomad_settlement_spawn_unit_effect = {
	ROOT = {
		spawn_unit = {
			province = event_target:emf_new_capital
			owner = ROOT
			troops = {
				light_cavalry = { 60 60 }
				horse_archers = { 30 30 }
			}
			attrition = 1
			cannot_inherit = yes
			earmark = settled_nomads
			merge = yes
		}
	}
}

# Called by antinomad from a province_event where ROOT, obviously,
# is the province in which we've just built a new temple.
emf_nomad_antinomad_temple_effect = {
	random_province_holding = {
		limit = { holding_type = temple }
		if = {
			limit = { is_capital = yes }
			revoke_capital_holding = yes
		}
		ROOT = {
			owner = {
				create_random_priest = {
					random_traits = yes
					dynasty = none
					female = no
					religion = PREV # Province
					culture = PREV # Province
				}
				new_character = {
					if = {
						limit = { religion_group = indian_group }
						add_trait = brahmin
						character_event = { id = RoI.30121 }
					}
					grant_title_no_opinion = PREVPREVPREV # Holding
					primary_title = { add_law = succ_open_elective }
					set_defacto_liege = PREV # Nomad
				}
			}
		}
		refill_holding_levy = yes
	}
}

# Called by antinomad from a province_event where ROOT, obviously,
# is the province in which we've just built a new tribal settlement.
emf_nomad_antinomad_tribal_effect = {
	random_province_holding = {
		limit = { holding_type = tribal }
		if = {
			limit = { is_capital = yes }
			revoke_capital_holding = yes
		}
		ROOT = {
			owner = {
				create_character = {
					random_traits = yes
					dynasty = random
					female = no
					religion = PREV # Province
					culture = PREV # Province
				}
				new_character = {
					if = {
						limit = { religion_group = indian_group }
						add_trait = kshatriya
						character_event = { id = RoI.30121 }
					}
					grant_title_no_opinion = PREVPREVPREV # Holding
					primary_title = { add_law = succ_gavelkind }
					set_defacto_liege = PREV # Nomad
				}
			}
		}
		refill_holding_levy = yes
	}
}
