;;; BC 2.3.2 - January 2012
;;; RECRUITMENT EVENTS
;;; RAIDER'S LOOT
;;; EXTRA SIEGE COSTS
;;; AI CASH SCRIPT
;;; GARRISONS
;;; THE MONGOL INVASIONS
;;; THE CRUSADES
;;; AI FACTION STACKS
;;; CALL OF THE HORDE
;;; CALL OF THE CRUSADE
;;; CAPTURE MESSAGES
;;; MAMLUKS RISING
;;; OSMANI RISING

script
restrict_strat_radar false

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;RECRUITMENT EVENTS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;FIRST TURN CHECK - THIS IS USED AS A SWITCH FOR THE AI RECRUITMENT SYSTEM
monitor_event FactionTurnStart FactionType byzantium 
	add_events
		event	counter	first_turn
		date	0 0
	end_add_events
terminate_monitor
end_monitor

;ERE
monitor_event FactionTurnStart FactionType byzantium 
	and not I_LocalFaction byzantium
	add_events
		event	counter	ai_is_ere
		date	0 0
	end_add_events
	console_command add_money byzantium, 35000
terminate_monitor
end_monitor

;Turks
monitor_event FactionTurnStart FactionType turks 
	and not I_LocalFaction turks
	add_events
		event	counter	ai_is_turk
		date	0 0
	end_add_events
	console_command add_money turks, 45000
terminate_monitor
end_monitor

;KOJ
monitor_event FactionTurnStart FactionType france
	and not I_LocalFaction france
	add_events
		event	counter	ai_is_koj
		date	0 0
	end_add_events
	console_command add_money france, 37000
terminate_monitor
end_monitor

;Ayyubids
monitor_event FactionTurnStart FactionType egypt 
	and not I_LocalFaction egypt
	add_events
		event	counter	ai_is_ayyubid
		date	0 0
	end_add_events
	console_command add_money egypt, 40000
terminate_monitor
end_monitor

;Armenia
monitor_event FactionTurnStart FactionType poland
	and not I_LocalFaction poland
	add_events
		event	counter	ai_is_armenia
		date	0 0
	end_add_events
	console_command add_money poland, 37000
terminate_monitor
end_monitor

;Georgia
monitor_event FactionTurnStart FactionType england
	and not I_LocalFaction england
	add_events
		event	counter	ai_is_georgia
		date	0 0
	end_add_events
	console_command add_money england, 36000
terminate_monitor
end_monitor

;Makuria
monitor_event FactionTurnStart FactionType scotland
	and not I_LocalFaction scotland
	add_events
		event	counter	ai_is_makuria
		date	0 0
	end_add_events
	console_command add_money scotland, 38000
terminate_monitor
end_monitor

;Kypchack
monitor_event FactionTurnStart FactionType portugal
	and not I_LocalFaction portugal
	add_events
		event	counter	ai_is_kyp
		date	0 0
	end_add_events
	console_command add_money portugal, 41000
terminate_monitor
end_monitor

;Abbasid
monitor_event FactionTurnStart FactionType moors
	and not I_LocalFaction moors
	add_events
		event	counter	ai_is_abbasid
		date	0 0
	end_add_events
	console_command add_money moors, 38000
terminate_monitor
end_monitor

;Oman
monitor_event FactionTurnStart FactionType denmark 
	and not I_LocalFaction denmark
	add_events
		event	counter	ai_is_oman
		date	0 0
	end_add_events
	console_command add_money denmark, 33000
terminate_monitor
end_monitor

;Seljuks
monitor_event FactionTurnStart FactionType russia
	and not I_LocalFaction russia
	add_events
		event	counter	ai_is_seljuk
		date	0 0
	end_add_events
	console_command add_money russia, 35000
terminate_monitor
end_monitor

;Kwarzem
monitor_event FactionTurnStart FactionType spain
	and not I_LocalFaction spain
	add_events
		event	counter	ai_is_kwarz
		date	0 0
	end_add_events
	console_command add_money spain, 45000
terminate_monitor
end_monitor
	
;Ghorid
monitor_event FactionTurnStart FactionType milan 
	and not I_LocalFaction milan
	add_events
		event	counter	ai_is_ghorid
		date	0 0
	end_add_events
	console_command add_money milan, 35000
terminate_monitor
end_monitor

;Ghazni
monitor_event FactionTurnStart FactionType venice 
	and not I_LocalFaction venice
	add_events
		event	counter	ai_is_ghazni
		date	0 0
	end_add_events
	console_command add_money venice, 35000
terminate_monitor
end_monitor

;Chauhan
monitor_event FactionTurnStart FactionType aztecs
	and not I_LocalFaction aztecs
	add_events
		event	counter	ai_is_chauhan
		date	0 0
	end_add_events
	console_command add_money aztecs, 38000
terminate_monitor
end_monitor

;Sindh 
monitor_event FactionTurnStart FactionType hungary
	and not I_LocalFaction hungary
	add_events
		event	counter	ai_is_sindh
		date	0 0
	end_add_events
	console_command add_money hungary, 37000
terminate_monitor
end_monitor

;Rajput
monitor_event FactionTurnStart FactionType sicily
	and not I_LocalFaction sicily
	add_events
		event	counter	ai_is_rajput
		date	0 0
	end_add_events
	console_command add_money sicily, 38000
terminate_monitor
end_monitor

;Mongols
monitor_event FactionTurnStart FactionType mongols
	and not I_LocalFaction mongols
	add_events
		event	counter	ai_is_mongol
		date	0 0
	end_add_events
terminate_monitor
end_monitor

;ERE
monitor_event FactionTurnStart FactionType byzantium 
	and I_LocalFaction byzantium
	add_events
		event	counter player_is_ere
		date	0 0
	end_add_events
terminate_monitor
end_monitor

;Turks
monitor_event FactionTurnStart FactionType turks 
	and I_LocalFaction turks
	add_events
		event	counter player_is_turk
		date	0 0
	end_add_events
terminate_monitor
end_monitor

;KOJ
monitor_event FactionTurnStart FactionType france
	and I_LocalFaction france
	add_events
		event	counter player_is_koj
		date	0 0
	end_add_events
terminate_monitor
end_monitor

;Ayyubids
monitor_event FactionTurnStart FactionType egypt 
	and I_LocalFaction egypt
	add_events
		event	counter player_is_ayyubid
		date	0 0
	end_add_events
terminate_monitor
end_monitor

;Armenia
monitor_event FactionTurnStart FactionType poland
	and I_LocalFaction poland
	add_events
		event	counter player_is_armenia
		date	0 0
	end_add_events
terminate_monitor
end_monitor

;Georgia
monitor_event FactionTurnStart FactionType england
	and I_LocalFaction england
	add_events
		event	counter player_is_georgia
		date	0 0
	end_add_events
terminate_monitor
end_monitor

;Makuria
monitor_event FactionTurnStart FactionType scotland
	and I_LocalFaction scotland
	add_events
		event	counter player_is_makuria
		date	0 0
	end_add_events
terminate_monitor
end_monitor

;Kypchack
monitor_event FactionTurnStart FactionType portugal
	and I_LocalFaction portugal
	add_events
		event	counter player_is_kyp
		date	0 0
	end_add_events
terminate_monitor
end_monitor

;Abbasid
monitor_event FactionTurnStart FactionType moors
	and I_LocalFaction moors
	add_events
		event	counter player_is_abbasid
		date	0 0
	end_add_events
terminate_monitor
end_monitor

;Oman
monitor_event FactionTurnStart FactionType denmark 
	and I_LocalFaction denmark
	add_events
		event	counter player_is_oman
		date	0 0
	end_add_events
terminate_monitor
end_monitor

;Seljuks
monitor_event FactionTurnStart FactionType russia
	and I_LocalFaction russia
	add_events
		event	counter player_is_seljuk
		date	0 0
	end_add_events
terminate_monitor
end_monitor

;Kwarzem
monitor_event FactionTurnStart FactionType spain
	and I_LocalFaction spain
	add_events
		event	counter player_is_kwarz
		date	0 0
	end_add_events
terminate_monitor
end_monitor

;Ghorid
monitor_event FactionTurnStart FactionType milan 
	and I_LocalFaction milan
	add_events
		event	counter player_is_ghorid
		date	0 0
	end_add_events
terminate_monitor
end_monitor

;Ghazni
monitor_event FactionTurnStart FactionType venice 
	and I_LocalFaction venice
	add_events
		event	counter player_is_ghazni
		date	0 0
	end_add_events
terminate_monitor
end_monitor

;Chauhan
monitor_event FactionTurnStart FactionType aztecs
	and I_LocalFaction aztecs
	add_events
		event	counter player_is_chauhan
		date	0 0
	end_add_events
terminate_monitor
end_monitor

;Sindh 
monitor_event FactionTurnStart FactionType hungary
	and I_LocalFaction hungary
	add_events
		event	counter player_is_sindh
		date	0 0
	end_add_events
terminate_monitor
end_monitor

;Rajput
monitor_event FactionTurnStart FactionType sicily
	and I_LocalFaction sicily
	add_events
		event	counter player_is_rajput
		date	0 0
	end_add_events
terminate_monitor
end_monitor

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;RAIDER'S LOOT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;CASH FOR RAIDING AN ENEMY PROVINCE

monitor_event GeneralDevastatesTile FactionType turks
	if I_LocalFaction turks
		console_command add_money turks, 500
	end_if
	if not I_LocalFaction turks
		console_command add_money turks, 1500
	end_if
end_monitor

monitor_event GeneralDevastatesTile FactionType byzantium
	if I_LocalFaction byzantium
		console_command add_money byzantium, 500
	end_if
	if not I_LocalFaction byzantium
		console_command add_money byzantium, 1500
	end_if
end_monitor

monitor_event GeneralDevastatesTile FactionType poland
	if I_LocalFaction poland
		console_command add_money poland, 500
	end_if
	if not I_LocalFaction poland
		console_command add_money poland, 1500
	end_if
end_monitor

monitor_event GeneralDevastatesTile FactionType england
	if I_LocalFaction england
		console_command add_money england, 500
	end_if
	if not I_LocalFaction england
		console_command add_money england, 1500
	end_if
end_monitor

monitor_event GeneralDevastatesTile FactionType france
	if I_LocalFaction france
		console_command add_money france, 500
	end_if
	if not I_LocalFaction france
		console_command add_money france, 1500
	end_if
end_monitor

monitor_event GeneralDevastatesTile FactionType moors
	if I_LocalFaction moors
		console_command add_money moors, 500
	end_if
	if not I_LocalFaction moors
		console_command add_money moors, 1500
	end_if
end_monitor

monitor_event GeneralDevastatesTile FactionType denmark
	if I_LocalFaction denmark
		console_command add_money denmark, 500
	end_if
	if not I_LocalFaction denmark
		console_command add_money denmark, 1500
	end_if
end_monitor

monitor_event GeneralDevastatesTile FactionType russia
	if I_LocalFaction russia
		console_command add_money russia, 500
	end_if
	if not I_LocalFaction russia
		console_command add_money russia, 1500
	end_if
end_monitor

monitor_event GeneralDevastatesTile FactionType milan
	if I_LocalFaction milan
		console_command add_money milan, 500
	end_if
	if not I_LocalFaction milan
		console_command add_money milan, 1500
	end_if
end_monitor

monitor_event GeneralDevastatesTile FactionType sicily
	if I_LocalFaction sicily
		console_command add_money sicily, 500
	end_if
	if not I_LocalFaction sicily
		console_command add_money sicily, 1500
	end_if
end_monitor

monitor_event GeneralDevastatesTile FactionType venice
	if I_LocalFaction venice
		console_command add_money venice, 500
	end_if
	if not I_LocalFaction venice
		console_command add_money venice, 1500
	end_if
end_monitor

monitor_event GeneralDevastatesTile FactionType portugal
	if I_LocalFaction portugal
		console_command add_money portugal, 500
	end_if
	if not I_LocalFaction portugal
		console_command add_money portugal, 1500
	end_if
end_monitor

monitor_event GeneralDevastatesTile FactionType egypt
	if I_LocalFaction egypt
		console_command add_money egypt, 500
	end_if
	if not I_LocalFaction egypt
		console_command add_money egypt, 1500
	end_if
end_monitor

monitor_event GeneralDevastatesTile FactionType spain
	if I_LocalFaction spain
		console_command add_money spain, 500
	end_if
	if not I_LocalFaction spain
		console_command add_money spain, 1500
	end_if
end_monitor

monitor_event GeneralDevastatesTile FactionType scotland
	if I_LocalFaction scotland
		console_command add_money scotland, 500
	end_if
	if not I_LocalFaction scotland
		console_command add_money scotland, 1500
	end_if
end_monitor

monitor_event GeneralDevastatesTile FactionType hungary
	if I_LocalFaction hungary
		console_command add_money hungary, 500
	end_if
	if not I_LocalFaction hungary
		console_command add_money hungary, 1500
	end_if
end_monitor

monitor_event GeneralDevastatesTile FactionType aztecs
	if I_LocalFaction aztecs
		console_command add_money aztecs, 500
	end_if
	if not I_LocalFaction aztecs
		console_command add_money aztecs, 1500
	end_if
end_monitor

monitor_event GeneralDevastatesTile FactionType mongols
		console_command add_money mongols, 7500
end_monitor

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EXTRA SIEGE COSTS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;Added multi-level penalty
;;;;WHEN YOU GOT MORE THAN 5 SETTLEMENTS
monitor_event CharacterTurnEnd FactionType byzantium 
	and CharacterIsLocal
	and IsBesieging
		if I_NumberOfSettlements byzantium < 5
			console_command add_money byzantium, -250
		end_if
		if I_NumberOfSettlements byzantium > 5
		and I_NumberOfSettlements byzantium <= 10
			console_command add_money byzantium, -500  
		end_if
		if I_NumberOfSettlements byzantium > 10
			console_command add_money byzantium, -750
		end_if
end_monitor

monitor_event CharacterTurnEnd FactionType turks 
	and CharacterIsLocal
	and IsBesieging
		if I_NumberOfSettlements turks < 5
			console_command add_money turks, -250
		end_if
		if I_NumberOfSettlements turks > 5
		and I_NumberOfSettlements turks <= 10
			console_command add_money turks, -500
		end_if
		if I_NumberOfSettlements turks > 10
			console_command add_money turks, -750
		end_if
end_monitor

monitor_event CharacterTurnEnd FactionType poland 
	and CharacterIsLocal
	and IsBesieging
		if I_NumberOfSettlements poland < 5
			console_command add_money poland, -250
		end_if
		if I_NumberOfSettlements poland > 5
		and I_NumberOfSettlements poland <= 10
			console_command add_money poland, -500
		end_if
		if I_NumberOfSettlements poland > 10
			console_command add_money poland, -750
		end_if
end_monitor

monitor_event CharacterTurnEnd FactionType egypt
	and CharacterIsLocal
	and IsBesieging
		if I_NumberOfSettlements egypt < 5
			console_command add_money egypt, -250
		end_if
		if I_NumberOfSettlements egypt > 5
		and I_NumberOfSettlements egypt <= 10
			console_command add_money egypt, -500
		end_if
		if I_NumberOfSettlements egypt > 10
			console_command add_money egypt, -750
		end_if
end_monitor

monitor_event CharacterTurnEnd FactionType france 
	and CharacterIsLocal
	and IsBesieging
		if I_NumberOfSettlements france < 5
			console_command add_money france, -250
		end_if
		if I_NumberOfSettlements france > 5
		and I_NumberOfSettlements france <= 10
			console_command add_money france, -500
		end_if
		if I_NumberOfSettlements france > 10
			console_command add_money france, -750
		end_if
end_monitor

monitor_event CharacterTurnEnd FactionType moors 
	and CharacterIsLocal
	and IsBesieging
		if I_NumberOfSettlements moors < 5
			console_command add_money moors, -250
		end_if
		if I_NumberOfSettlements moors > 5
		and I_NumberOfSettlements moors <= 10
			console_command add_money moors, -500
		end_if
		if I_NumberOfSettlements moors > 10
			console_command add_money moors, -750
		end_if
end_monitor

monitor_event CharacterTurnEnd FactionType england 
	and CharacterIsLocal
	and IsBesieging
		if I_NumberOfSettlements england < 5
			console_command add_money england, -250
		end_if
		if I_NumberOfSettlements england > 5
		and I_NumberOfSettlements england <= 10
			console_command add_money england, -500
		end_if
		if I_NumberOfSettlements england > 10
			console_command add_money england, -750
		end_if
end_monitor

monitor_event CharacterTurnEnd FactionType russia
	and CharacterIsLocal
	and IsBesieging
		if I_NumberOfSettlements russia < 5
			console_command add_money russia, -250
		end_if
		if I_NumberOfSettlements russia > 5
		and I_NumberOfSettlements russia <= 10
			console_command add_money russia, -500
		end_if
		if I_NumberOfSettlements russia > 10
			console_command add_money russia, -750
		end_if
end_monitor

monitor_event CharacterTurnEnd FactionType scotland 
	and CharacterIsLocal
	and IsBesieging
		if I_NumberOfSettlements scotland < 5
			console_command add_money scotland, -250
		end_if
		if I_NumberOfSettlements scotland > 5
		and I_NumberOfSettlements scotland <= 10
			console_command add_money scotland, -500
		end_if
		if I_NumberOfSettlements scotland > 10
			console_command add_money scotland, -750
		end_if
end_monitor

monitor_event CharacterTurnEnd FactionType denmark 
	and CharacterIsLocal
	and IsBesieging
		if I_NumberOfSettlements denmark < 5
			console_command add_money denmark, -250
		end_if
		if I_NumberOfSettlements denmark > 5
		and I_NumberOfSettlements denmark <= 10
			console_command add_money denmark, -500
		end_if
		if I_NumberOfSettlements denmark > 10
			console_command add_money denmark, -750
		end_if
end_monitor

monitor_event CharacterTurnEnd FactionType hungary
	and CharacterIsLocal
	and IsBesieging
		if I_NumberOfSettlements hungary < 5
			console_command add_money hungary, -250
		end_if
		if I_NumberOfSettlements hungary > 5
		and I_NumberOfSettlements hungary <= 10
			console_command add_money hungary, -500
		end_if
		if I_NumberOfSettlements hungary > 10
			console_command add_money hungary, -750
		end_if
end_monitor

monitor_event CharacterTurnEnd FactionType spain 
	and CharacterIsLocal
	and IsBesieging
		if I_NumberOfSettlements spain < 5
			console_command add_money spain, -250
		end_if
		if I_NumberOfSettlements spain > 5
		and I_NumberOfSettlements spain <= 10
			console_command add_money spain, -500
		end_if
		if I_NumberOfSettlements spain > 10
			console_command add_money spain, -750
		end_if
end_monitor

monitor_event CharacterTurnEnd FactionType portugal
	and CharacterIsLocal
	and IsBesieging
		if I_NumberOfSettlements portugal < 5
			console_command add_money portugal, -250
		end_if
		if I_NumberOfSettlements portugal > 5
		and I_NumberOfSettlements portugal <= 10
			console_command add_money portugal, -500
		end_if
		if I_NumberOfSettlements portugal > 10
			console_command add_money portugal, -750
		end_if
end_monitor

monitor_event CharacterTurnEnd FactionType milan 
	and CharacterIsLocal
	and IsBesieging
		if I_NumberOfSettlements milan < 5
			console_command add_money milan, -250
		end_if
		if I_NumberOfSettlements milan > 5
		and I_NumberOfSettlements milan <= 10
			console_command add_money milan, -500
		end_if
		if I_NumberOfSettlements milan > 10
			console_command add_money milan, -750
		end_if
end_monitor

monitor_event CharacterTurnEnd FactionType venice 
	and CharacterIsLocal
	and IsBesieging
		if I_NumberOfSettlements venice < 5
			console_command add_money venice, -250
		end_if
		if I_NumberOfSettlements venice > 5
		and I_NumberOfSettlements venice <= 10
			console_command add_money venice, -500
		end_if
		if I_NumberOfSettlements venice > 10
			console_command add_money venice, -750
		end_if
end_monitor

monitor_event CharacterTurnEnd FactionType sicily 
	and CharacterIsLocal
	and IsBesieging
		if I_NumberOfSettlements sicily < 5
			console_command add_money sicily, -250
		end_if
		if I_NumberOfSettlements sicily > 5
		and I_NumberOfSettlements sicily <= 10
			console_command add_money sicily, -500
		end_if
		if I_NumberOfSettlements sicily > 10
			console_command add_money sicily, -750
		end_if
end_monitor


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GARRISONS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; DAMASCUS
declare_counter DimashkBesieged
set_counter DimashkBesieged 0

monitor_event CharacterTurnStart FactionType slave

	if I_CharacterTypeNearTile egypt named_character, 1 108, 115
	and not I_CharacterTypeNearTile france named_character, 1 108, 115
		
		set_counter DimashkBesieged 1
		terminate_monitor
	end_if
	
	if I_CharacterTypeNearTile france named_character, 1 108, 115
	and not I_CharacterTypeNearTile egypt named_character, 1 108, 115
	
		set_counter DimashkBesieged 2
		terminate_monitor
	end_if
	
	if I_CharacterTypeNearTile egypt named_character, 1 108, 115
	and I_CharacterTypeNearTile france named_character, 1 108, 115
	
		set_counter DimashkBesieged 3
		terminate_monitor
	end_if
end_monitor

monitor_event SettlementTurnStart SettlementName Damascus
	and I_SettlementUnderSiege Damascus
	and GarrisonToPopulationRatio < 0.10
	and not SettlementIsLocal
	
	if I_SettlementOwner Damascus = slave
	and I_CompareCounter DimashkBesieged == 1
		
	end_if
	
	if I_SettlementOwner Damascus = slave
	and I_CompareCounter DimashkBesieged == 2
		create_unit Damascus, ayyubid ajnad macemen, num 1, exp 3, arm 0, wep 0
		create_unit Damascus, ayyubid ajnad spearmen, num 2, exp 3, arm 0, wep 0
	end_if
	
	if I_SettlementOwner Damascus = slave
	and I_CompareCounter DimashkBesieged == 3
		create_unit Damascus, ayyubid askari axemen, num 1, exp 5, arm 0, wep 0
		create_unit Damascus, ayyubid ajnad spearmen, num 2, exp 3, arm 0, wep 0
	end_if
	
	if I_SettlementOwner Damascus = egypt
		create_unit Damascus, ayyubid tawashi infantry, num 1, exp 4, arm 0, wep 0
		create_unit Damascus, ayyubid askari infantry, num 1, exp 4, arm 0, wep 0
		create_unit Damascus, ayyubid qara archer, num 1, exp 3, arm 0, wep 0
		create_unit Damascus, ayyubid ajnad macemen, num 1, exp 0, arm 0, wep 0
		create_unit Damascus, ayyubid ajnad spearmen, num 1, exp 0, arm 0, wep 0
		add_money egypt 3000
	end_if
end_monitor

;;;; AKABAT AYLA
declare_counter AkabatBesieged
set_counter AkabatBesieged 0

monitor_event SettlementTurnStart SettlementName Aqaba
	and not SettlementIsLocal
	and I_SettlementUnderSiege Aqaba
	and I_SettlementOwner Aqaba = egypt
	and not I_SettlementOwner Gaza = egypt
	and not I_SettlementOwner Kerak = egypt
	and GarrisonToPopulationRatio < 0.10
		create_unit Aqaba, ayyubid tawashi infantry, num 1, exp 6, arm 0, wep 0
		create_unit Aqaba, ayyubid askari infantry, num 1, exp 6, arm 0, wep 0
		create_unit Aqaba, ayyubid askari axemen, num 1, exp 6, arm 0, wep 0
		create_unit Aqaba, ayyubid ajnad spearmen, num 2, exp 3, arm 0, wep 0
		create_unit Aqaba, ayyubid qara archer, num 2, exp 3, arm 0, wep 0
		add_money egypt 3000
end_monitor

;;;; QAHIRA
monitor_event SettlementTurnStart SettlementName Qahira
and I_SettlementUnderSiege Qahira
and GarrisonToPopulationRatio < 0.15
and not SettlementIsLocal
	if I_SettlementOwner Qahira = egypt
		create_unit Qahira, ayyubid tawashi infantry, num 1, exp 7, arm 0, wep 0
		create_unit Qahira, ayyubid askari infantry, num 1, exp 7, arm 0, wep 0
		create_unit Qahira, ayyubid qara archer, num 2, exp 5, arm 0, wep 0
		create_unit Qahira, ayyubid ajnad spearmen, num 2, exp 3, arm 0, wep 0
		add_money egypt 3000
	end_if
end_monitor

;;;; BILBEIS
monitor_event SettlementTurnStart SettlementName Bilbeis
and I_SettlementUnderSiege Bilbeis
and GarrisonToPopulationRatio < 0.10
and not SettlementIsLocal
	if I_SettlementOwner Bilbeis = egypt
		create_unit Bilbeis, ayyubid tawashi infantry, num 1, exp 6, arm 0, wep 0
		create_unit Bilbeis, ayyubid askari axemen, num 1, exp 6, arm 0, wep 0
		create_unit Bilbeis, ayyubid qara archer, num 1, exp 4, arm 0, wep 0
		create_unit Bilbeis, ayyubid ajnad spearmen, num 1, exp 3, arm 0, wep 0
		add_money egypt 2000
		terminate_monitor
	end_if
end_monitor

;;;; SIS
monitor_event SettlementTurnStart SettlementName Sis
and I_SettlementUnderSiege Sis
and GarrisonToPopulationRatio < 0.10
and not SettlementIsLocal
	if I_SettlementOwner Sis = poland
		create_unit Sis, armenian dismounted nakharar, num 2, exp 7, arm 0, wep 0
		create_unit Sis, armenian heavy infantry, num 2, exp 5, arm 0, wep 0
		create_unit Sis, armenian medium spearmen, num 2, exp 4, arm 0, wep 0
		add_money poland 2000
	end_if
end_monitor

;;;; TARSUS
monitor_event SettlementTurnStart SettlementName Tarsus
and I_SettlementUnderSiege Tarsus
and GarrisonToPopulationRatio < 0.10
and not SettlementIsLocal
	if I_SettlementOwner Tarsus = poland
		create_unit Tarsus, armenian dismounted nakharar, num 1, exp 7, arm 0, wep 0
		create_unit Tarsus, armenian dismounted javcav, num 1, exp 6, arm 0, wep 0
		create_unit Tarsus, armenian medium spearmen, num 2, exp 4, arm 0, wep 0
		add_money poland 2000
		terminate_monitor
	end_if
end_monitor

;;;; TBILISI
monitor_event SettlementTurnStart SettlementName Tbilisi
and I_SettlementUnderSiege Tbilisi
and GarrisonToPopulationRatio < 0.15
and not SettlementIsLocal
	if I_SettlementOwner Tbilisi = england
		create_unit Tbilisi, georgian dismounted heavy lancers, num 1, exp 7, arm 0, wep 0
		create_unit Tbilisi, georgian medium swordsmen, num 1, exp 6, arm 0, wep 0
		create_unit Tbilisi, georgian dismounted heavy horse archers, num 2, exp 6, arm 0, wep 0
		create_unit Tbilisi, georgian heavy spearmen, num 2, exp 5 arm 0, wep 0
		add_money england 3000
	end_if
end_monitor

;;;; TELAVI
monitor_event SettlementTurnStart SettlementName Telavi
and I_SettlementUnderSiege Telavi
and GarrisonToPopulationRatio < 0.10
and not SettlementIsLocal
	if I_SettlementOwner Telavi = england
		create_unit Telavi, georgian medium swordsmen, num 1, exp 6, arm 0, wep 0
		create_unit Telavi, georgian heavy archer, num 1, exp 5, arm 0, wep 0
		create_unit Telavi, georgian medium spearmen, num 2, exp 5, arm 0, wep 0
		add_money england 2000
		terminate_monitor
	end_if
end_monitor

;;;; KUTAISI
monitor_event SettlementTurnStart SettlementName Kutaisi
and I_SettlementUnderSiege Kutaisi
and GarrisonToPopulationRatio < 0.10
and not SettlementIsLocal
	if I_SettlementOwner Kutaisi = england
		create_unit Kutaisi, georgian mandaturi, num 1, exp 6, arm 0, wep 0
		create_unit Kutaisi, georgian heavy archer, num 1, exp 5, arm 0, wep 0
		create_unit Kutaisi, georgian medium spearmen, num 2, exp 5, arm 0, wep 0
		add_money england 2000
		terminate_monitor
	end_if
end_monitor

;;;; SARKEL
monitor_event SettlementTurnStart SettlementName Sarkel
and I_SettlementUnderSiege Sarkel
and GarrisonToPopulationRatio < 0.15
and not SettlementIsLocal
	if I_SettlementOwner Sarkel = portugal
		create_unit Sarkel, kypchak heavy bowman, num 1, exp 9, arm 0, wep 0
		create_unit Sarkel, kypchak medium bowman, num 2, exp 6, arm 0, wep 0
		create_unit Sarkel, kypchak slavs swordsmen, num 2, exp 5, arm 0, wep 0
		add_money portugal 2000
	end_if
end_monitor

;;;; Azaq
monitor_event SettlementTurnStart SettlementName Azaq
and I_SettlementUnderSiege Azaq
and GarrisonToPopulationRatio < 0.15
and not SettlementIsLocal
	if I_SettlementOwner Azaq = portugal
		create_unit Azaq, kypchak heavy bowman, num 1, exp 9, arm 0, wep 0
		create_unit Azaq, kypchak medium bowman, num 2, exp 6, arm 0, wep 0
		create_unit Azaq, kypchak slavs swordsmen, num 2, exp 5, arm 0, wep 0
		add_money portugal 2000
		terminate_monitor
	end_if
end_monitor

;;;; KONYA
monitor_event SettlementTurnStart SettlementName Konya
and I_SettlementUnderSiege Konya
and GarrisonToPopulationRatio < 0.15
and not SettlementIsLocal
	if I_SettlementOwner Konya = turks
		create_unit Konya, ghulams heavy, num 1, exp 6, arm 0, wep 0
		create_unit Konya, ghulam medium ha, num 2, exp 6, arm 0, wep 0
		create_unit Konya, aux arab relig inf, num 2, exp 4, arm 0, wep 0
		add_money turks 3000
	end_if
end_monitor

;;;; KAYSERI
monitor_event SettlementTurnStart SettlementName Kayseri
and I_SettlementUnderSiege Kayseri
and GarrisonToPopulationRatio < 0.15
and not SettlementIsLocal
	if I_SettlementOwner Kayseri = turks
		create_unit Kayseri, ghulam medium ha, num 1, exp 6, arm 0, wep 0
		create_unit Kayseri, aux arab relig inf, num 1, exp 4, arm 0, wep 0
		create_unit Kayseri, levy an spearmen, num 2, exp 3, arm 0, wep 0
		add_money turks 2000
		terminate_monitor
	end_if
end_monitor

;;;; SIVAS
monitor_event SettlementTurnStart SettlementName Sivas
and I_SettlementUnderSiege Sivas
and GarrisonToPopulationRatio < 0.15
and not SettlementIsLocal
	if I_SettlementOwner Sivas = turks
		create_unit Sivas, aux arab relig inf, num 1, exp 4, arm 0, wep 0
		create_unit Sivas, levy an spearmen, num 2, exp 3, arm 0, wep 0
		add_money turks 1000
		terminate_monitor
	end_if
end_monitor

;;; ANKARA
monitor_event SettlementTurnStart SettlementName Ankara
and I_SettlementUnderSiege Ankara
and GarrisonToPopulationRatio < 0.15
and not SettlementIsLocal
	if I_SettlementOwner Ankara = turks
		create_unit Ankara, ghulams heavy, num 1, exp 6, arm 0, wep 0
		create_unit Ankara, ghulam medium ha, num 1, exp 6, arm 0, wep 0
		create_unit Ankara, levy an spearmen, num 2, exp 3, arm 0, wep 0
		add_money turks 1500
		terminate_monitor
	end_if
end_monitor

;;;; JERUSALEM
monitor_event SettlementTurnStart SettlementName Jerusalem
	and not SettlementIsLocal
	and I_SettlementUnderSiege Jerusalem
	and GarrisonToPopulationRatio < 0.10
	
	if I_SettlementOwner Jerusalem = france
		create_unit Jerusalem, koj knights jerusalem, num 1, exp 6, arm 0, wep 0
		create_unit Jerusalem, koj knights templar, num 1, exp 6, arm 0, wep 0
		create_unit Jerusalem, koj knights hospitaller, num 1, exp 6, arm 0, wep 0
		create_unit Jerusalem, koj knights dismounted jerusalem, num 1, exp 6, arm 0, wep 0
		create_unit Jerusalem, koj knights dismounted templar, num 1, exp 6, arm 0, wep 0
		create_unit Jerusalem, koj knights dismounted hospitaler, num 1, exp 6, arm 0, wep 0
		add_money france 3000
	end_if
	
	if I_SettlementOwner Jerusalem = egypt
		create_unit Jerusalem, ayyubid tawashi infantry, num 1, exp 6, arm 0, wep 0
		create_unit Jerusalem, ayyubid askari infantry, num 1, exp 6, arm 0, wep 0
		create_unit Jerusalem, ayyubid qara archer, num 1, exp 5, arm 0, wep 0
		create_unit Jerusalem, ayyubid ajnad macemen, num 1, exp 4, arm 0, wep 0
		create_unit Jerusalem, ayyubid ajnad spearmen, num 1, exp 4, arm 0, wep 0
		add_money egypt 3000
		terminate_monitor
	end_if
end_monitor

;;;GAZA
monitor_event SettlementTurnStart SettlementName Gaza
	and not SettlementIsLocal
	and I_SettlementUnderSiege Gaza
	and GarrisonToPopulationRatio < 0.10
	and I_SettlementOwner Gaza = france
		create_unit Gaza, koj knights templar, num 1, exp 7, arm 0, wep 0
		create_unit Gaza, koj armoured sergeants spearmen, num 5, exp 4, arm 0, wep 0
		create_unit Gaza, koj sergeant men at arms, num 2, exp 5, arm 0, wep 0
		add_money france 1500
		terminate_monitor
end_monitor

;;;; KERAK
monitor_event SettlementTurnStart SettlementName Kerak
and I_SettlementUnderSiege Kerak
and I_LocalFaction egypt
and GarrisonToPopulationRatio < 0.15
and not SettlementIsLocal
	if I_SettlementOwner Kerak = france
		create_unit Kerak, koj knights dismounted templar, num 2, exp 6, arm 0, wep 0
		add_money france 1000
		terminate_monitor
	end_if
end_monitor

;;;; ACRE
monitor_event SettlementTurnStart SettlementName Acre
and I_SettlementUnderSiege Acre
and GarrisonToPopulationRatio < 0.15
and not SettlementIsLocal
	if I_SettlementOwner Acre = france
		create_unit Acre, koj armoured sergeants spearmen, num 2, exp 5, arm 0, wep 0
		create_unit Acre, koj sergeant crossbowmen, num 2, exp 4, arm 0, wep 0
		add_money france 1500
		terminate_monitor
	end_if
end_monitor

;;;; TARTUS
monitor_event SettlementTurnStart SettlementName Tartus
and I_SettlementUnderSiege Tartus
and GarrisonToPopulationRatio < 0.15
and not SettlementIsLocal
	if I_SettlementOwner Tartus = france
		create_unit Tartus, koj knights dismounted hospitaler, num 2, exp 6, arm 0, wep 0
		add_money france 1500
		terminate_monitor
	end_if
end_monitor

;;;; ANTIOCH
monitor_event SettlementTurnStart SettlementName Antioch
and I_SettlementUnderSiege Antioch
and GarrisonToPopulationRatio < 0.15
and not SettlementIsLocal
	if I_SettlementOwner Antioch = france
		create_unit Antioch, koj armoured sergeants crossbowmen, num 3, exp 5, arm 0, wep 0
		add_money france 1500
		terminate_monitor
	end_if
end_monitor

;;;CONSTANTINOPLE
monitor_event SettlementTurnStart SettlementName Constantinople
and I_SettlementUnderSiege Constantinople
and GarrisonToPopulationRatio < 0.10
and not SettlementIsLocal
	if I_SettlementOwner Constantinople = byzantium
		create_unit Constantinople, ere elite varangian axemen, num 1, exp 6, arm 0, wep 0
		create_unit Constantinople, ere elite spearmen, num 2, exp 6, arm 0, wep 0
		create_unit Constantinople, ere heavy swordsmen, num 2, exp 4, arm 0, wep 0
	end_if
end_monitor

;;;NICAEA
monitor_event SettlementTurnStart SettlementName Nicaea
and I_SettlementUnderSiege Nicaea
and GarrisonToPopulationRatio < 0.10
and not SettlementIsLocal
	if I_SettlementOwner Nicaea = byzantium
		create_unit Nicaea, ere elite spearmen, num 2, exp 7, arm 0, wep 0
		create_unit Nicaea, ere heavy swordsmen, num 2, exp 5, arm 0, wep 0
		add_money byzantium 1500
		terminate_monitor
	end_if
end_monitor

;;;; BAGHDAD
monitor_event SettlementTurnStart SettlementName Baghdad
and I_SettlementUnderSiege Baghdad
and GarrisonToPopulationRatio < 0.10
and not SettlementIsLocal
	if I_SettlementOwner Baghdad = moors
		create_unit Baghdad, abbasid dismounted caliphs guard, num 1, exp 7, arm 0, wep 0
		create_unit Baghdad, abbasid abna infantry, num 1, exp 6, arm 0, wep 0
		create_unit Baghdad, abbasid abna spearmen, num 1, exp 6, arm 0, wep 0
		create_unit Baghdad, abbasid faris archer, num 2, exp 5, arm 0, wep 0
		add_money moors 3000
	end_if
end_monitor

;;;; SAMARRA
monitor_event SettlementTurnStart SettlementName Samarra
and I_SettlementUnderSiege Samarra
and GarrisonToPopulationRatio < 0.10
and not SettlementIsLocal
	if I_SettlementOwner Samarra = moors
		create_unit Samarra, abbasid dismounted caliphs guard, num 1, exp 7, arm 0, wep 0
		create_unit Samarra, abbasid tribal warrior, num 1, exp 5, arm 0, wep 0
		create_unit Samarra, abbasid faris archer, num 1, exp 6, arm 0, wep 0
		create_unit Samarra, abbasid faris axemen, num 1, exp 6, arm 0, wep 0
		add_money moors 3000
		terminate_monitor
	end_if
end_monitor

;;;; BASRA
monitor_event SettlementTurnStart SettlementName Basra
and I_SettlementUnderSiege Basra
and GarrisonToPopulationRatio < 0.10
and not SettlementIsLocal
	if I_SettlementOwner Basra = moors
		create_unit Basra, abbasid dismounted caliphs guard, num 1, exp 7, arm 0, wep 0
		create_unit Basra, abbasid tribal warrior, num 1, exp 5, arm 0, wep 0
		create_unit Basra, abbasid faris axemen, num 1, exp 6, arm 0, wep 0
		add_money moors 2000
		terminate_monitor
	end_if
end_monitor

;;;; HAMADAN
monitor_event SettlementTurnStart SettlementName Hamadan
and I_SettlementUnderSiege Hamadan
and GarrisonToPopulationRatio < 0.15
and not SettlementIsLocal
	if I_SettlementOwner Hamadan = russia
		create_unit Hamadan, ghulams elite, num 1, exp 7, arm 0, wep 0
		create_unit Hamadan, ghulams elite ha, num 1, exp 7, arm 0, wep 0
		create_unit Hamadan, turkoman heavy bowman, num 2, exp 6, arm 0, wep 0
		add_money russia 2000
	end_if
end_monitor

;;;; QAZVIN
monitor_event SettlementTurnStart SettlementName Qazvin
and I_SettlementUnderSiege Qazvin
and GarrisonToPopulationRatio < 0.10
and not SettlementIsLocal
	if I_SettlementOwner Qazvin = russia
		create_unit Qazvin, azer swordsmen, num 1, exp 6, arm 0, wep 0
		create_unit Qazvin, azer spearmen, num 1, exp 6, arm 0, wep 0
		create_unit Qazvin, turkoman heavy bowman, num 2, exp 6, arm 0, wep 0
		add_money russia 1500
		terminate_monitor
	end_if
end_monitor

;;;; RAYY
monitor_event SettlementTurnStart SettlementName Rayy
and I_SettlementUnderSiege Rayy
and GarrisonToPopulationRatio < 0.10
and not SettlementIsLocal
	if I_SettlementOwner Rayy = russia
		create_unit Rayy, turkoman heavy macemen, num 1, exp 6, arm 0, wep 0
		create_unit Rayy, turkoman medium swordsmen, num 1, exp 6, arm 0, wep 0
		create_unit Rayy, turkoman heavy bowman, num 2, exp 6, arm 0, wep 0
		add_money russia 1000
		terminate_monitor
	end_if
end_monitor

;;;; ARDABIL
monitor_event SettlementTurnStart SettlementName Ardabil
and I_SettlementUnderSiege Ardabil
and GarrisonToPopulationRatio < 0.10
and not SettlementIsLocal
	if I_SettlementOwner Ardabil = russia
		create_unit Ardabil, turkoman heavy bowman, num 1, exp 5, arm 0, wep 0
		create_unit Ardabil, azer spearmen, num 1, exp 5, arm 0, wep 0
		create_unit Ardabil, turkoman medium bowman, num 1, exp 4, arm 0, wep 0
		add_money russia 1000
		terminate_monitor
	end_if
end_monitor

;;;; NIZWA
monitor_event SettlementTurnStart SettlementName Nizwa
and I_SettlementUnderSiege Nizwa
and GarrisonToPopulationRatio < 0.15
and not SettlementIsLocal
	if I_SettlementOwner Nizwa = denmark
		create_unit Nizwa, oman heavy swordsmen, num 1, exp 7, arm 0, wep 0
		create_unit Nizwa, oman medium spearmen, num 1, exp 7, arm 0, wep 0
		create_unit Nizwa, oman medium swordsmen, num 1, exp 6, arm 0, wep 0
		create_unit Nizwa, oman medium archers, num 2, exp 6, arm 0, wep 0
		add_money denmark 2000
	end_if
end_monitor

;;;; SUHAR
monitor_event SettlementTurnStart SettlementName Suhar
and I_SettlementUnderSiege Suhar
and GarrisonToPopulationRatio < 0.10
and not SettlementIsLocal
	if I_SettlementOwner Suhar = denmark
		create_unit Suhar, oman medium swordsmen, num 1, exp 6, arm 0, wep 0
		create_unit Suhar, oman medium archers, num 1, exp 6, arm 0, wep 0
		create_unit Suhar, oman light archers, num 1, exp 4, arm 0, wep 0
		create_unit Suhar, oman swordsmen, num 1, exp 4, arm 0, wep 0
		add_money denmark 1000
	end_if
end_monitor

;;;; URGENCH
monitor_event SettlementTurnStart SettlementName Urgench
and I_SettlementUnderSiege Urgench
and GarrisonToPopulationRatio < 0.15
and not SettlementIsLocal
	if I_SettlementOwner Urgench = spain
		create_unit Urgench, daylami assault, num 1, exp 7, arm 0, wep 0
		create_unit Urgench, daylami heavy, num 2, exp 7, arm 0, wep 0
		create_unit Urgench, persian archer, num 2, exp 5, arm 0, wep 0
		create_unit Urgench, persian spearmen, num 2, exp 5, arm 0, wep 0
		add_money spain 3000
	end_if
end_monitor

;;;; KHIVA
monitor_event SettlementTurnStart SettlementName Khiva
and I_SettlementUnderSiege Khiva
and GarrisonToPopulationRatio < 0.10
and not SettlementIsLocal
	if I_SettlementOwner Khiva = spain
		create_unit Khiva, daylami heavy, num 1, exp 7, arm 0, wep 0
		create_unit Khiva, persian archer, num 1, exp 5, arm 0, wep 0
		create_unit Khiva, persian spearmen, num 2, exp 5, arm 0, wep 0
		add_money spain 1500
		terminate_monitor
	end_if
end_monitor

;;;; MERV
monitor_event SettlementTurnStart SettlementName Merv
and I_SettlementUnderSiege Merv
and GarrisonToPopulationRatio < 0.10
and not SettlementIsLocal
	if I_SettlementOwner Merv = spain
		create_unit Merv, daylami assault, num 1, exp 7, arm 0, wep 0
		create_unit Merv, daylami heavy, num 1, exp 7, arm 0, wep 0
		create_unit Merv, persian archer, num 1, exp 5, arm 0, wep 0
		create_unit Merv, persian spearmen, num 1, exp 5, arm 0, wep 0
		add_money spain 1500
	end_if
end_monitor

;;;; FIRUZKUH
monitor_event SettlementTurnStart SettlementName Ghor
and I_SettlementUnderSiege Ghor
and GarrisonToPopulationRatio < 0.15
and not SettlementIsLocal
	if I_SettlementOwner Ghor = milan
		create_unit Ghor, ghulam jihad dismounted, num 1, exp 7, arm 0, wep 0
		create_unit Ghor, ghazi heavy, num 1, exp 7, arm 0, wep 0
		create_unit Ghor, ghazi medium, num 1, exp 7, arm 0, wep 0
		create_unit Ghor, turkoman eastern medium bowman, num 2, exp 6, arm 0, wep 0
		add_money milan 3000
	end_if
end_monitor

;;;; KABUL
monitor_event SettlementTurnStart SettlementName Kabul
and I_SettlementUnderSiege Kabul
and GarrisonToPopulationRatio < 0.10
and not SettlementIsLocal
	if I_SettlementOwner Kabul = milan
		create_unit Kabul, ghazi heavy, num 1, exp 6, arm 0, wep 0
		create_unit Kabul, ghazi medium, num 1, exp 6, arm 0, wep 0
		create_unit Kabul, turkoman eastern medium bowman, num 2, exp 5, arm 0, wep 0
		add_money milan 2000
		terminate_monitor
	end_if
end_monitor

;;;; KANDAHAR
monitor_event SettlementTurnStart SettlementName Kandahar
and I_SettlementUnderSiege Kandahar
and GarrisonToPopulationRatio < 0.10
and not SettlementIsLocal
	if I_SettlementOwner Kandahar = milan
		create_unit Kandahar, ghazi medium, num 1, exp 6, arm 0, wep 0
		create_unit Kandahar, levy af noble javelinman, num 1, exp 6, arm 0, wep 0
		create_unit Kandahar, turkoman eastern medium bowman, num 2, exp 5, arm 0, wep 0
		add_money milan 1000
		terminate_monitor
	end_if
end_monitor

;;;; LAHORE
monitor_event SettlementTurnStart SettlementName Lahore
and I_SettlementUnderSiege Lahore
and GarrisonToPopulationRatio < 0.15
and not SettlementIsLocal
	if I_SettlementOwner Lahore = venice
		create_unit Lahore, ghulam heavy archer, num 2, exp 6, arm 0, wep 0
		create_unit Lahore, ghazni archers, num 2, exp 6, arm 0, wep 0
		create_unit Lahore, ghazni spearmen, num 2, exp 6, arm 0, wep 0
		add_money venice 3000
	end_if
end_monitor

;;;; MULTAN
monitor_event SettlementTurnStart SettlementName Multan
and I_SettlementUnderSiege Multan
and GarrisonToPopulationRatio < 0.10
and not SettlementIsLocal
	if I_SettlementOwner Multan = venice
		create_unit Multan, ghulam heavy archer, num 2, exp 6, arm 0, wep 0
		create_unit Multan, ghazni archers, num 2, exp 6, arm 0, wep 0
		create_unit Multan, ghulam spearmen, num 2, exp 6, arm 0, wep 0
		add_money venice 3000
		terminate_monitor
	end_if
end_monitor

;;;; DELHI
monitor_event SettlementTurnStart SettlementName Delhi
and I_SettlementUnderSiege Delhi
and GarrisonToPopulationRatio < 0.15
and not SettlementIsLocal
	if I_SettlementOwner Delhi = aztecs
		create_unit Delhi, rajput elite swordsmen, num 1, exp 7, arm 0, wep 0
		create_unit Delhi, rajput medium axemen, num 1, exp 6, arm 0, wep 0
		create_unit Delhi, rajput medium spearmen, num 2, exp 6, arm 0, wep 0
		add_money aztecs 3000
	end_if
end_monitor

;;;; AJMER
monitor_event SettlementTurnStart SettlementName Ajmer
and I_SettlementUnderSiege Ajmer
and GarrisonToPopulationRatio < 0.10
and not SettlementIsLocal
	if I_SettlementOwner Ajmer = aztecs
		create_unit Ajmer, rajput elite swordsmen, num 1, exp 7, arm 0, wep 0
		create_unit Ajmer, rajput medium spearmen, num 1, exp 6, arm 0, wep 0
		create_unit Ajmer, levy in archers, num 2, exp 6, arm 0, wep 0
		add_money aztecs 1500
		terminate_monitor
	end_if
end_monitor

;;;; DHAR
monitor_event SettlementTurnStart SettlementName Dhar
and I_SettlementUnderSiege Dhar
and GarrisonToPopulationRatio < 0.15
and not SettlementIsLocal
	if I_SettlementOwner Dhar = sicily
		create_unit Dhar, param champ hwy inf, num 1, exp 7, arm 0, wep 0
		create_unit Dhar, param spearmen, num 2, exp 6, arm 0, wep 0
		create_unit Dhar, param scale archers, num 2, exp 6, arm 0, wep 0
		add_money sicily 3000
	end_if
end_monitor

;;;; ANHILVARA
monitor_event SettlementTurnStart SettlementName Anhilvara
and I_SettlementUnderSiege Anhilvara
and GarrisonToPopulationRatio < 0.10
and not SettlementIsLocal
	if I_SettlementOwner Anhilvara = sicily
		create_unit Anhilvara, param champ hwy inf, num 1, exp 7, arm 0, wep 0
		create_unit Anhilvara, param spearmen, num 1, exp 6, arm 0, wep 0
		create_unit Anhilvara, param scale archers, num 1, exp 6, arm 0, wep 0
		add_money sicily 2000
		terminate_monitor
	end_if
end_monitor

;;;; THATTA
monitor_event SettlementTurnStart SettlementName Thatta
and I_SettlementUnderSiege Thatta
and GarrisonToPopulationRatio < 0.15
and not SettlementIsLocal
	if I_SettlementOwner Thatta = hungary
		create_unit Thatta, rajput dismounted noble swordsmen, num 1, exp 7, arm 0, wep 0
		create_unit Thatta, sindh javelin infantry, num 2, exp 7, arm 0, wep 0
		create_unit Thatta, rajput noble archer, num 2, exp 7, arm 0, wep 0
		add_money hungary 3000
	end_if
end_monitor

;;;; MANSURA
monitor_event SettlementTurnStart SettlementName Mansura
and I_SettlementUnderSiege Mansura
and GarrisonToPopulationRatio < 0.10
and not SettlementIsLocal
	if I_SettlementOwner Mansura = hungary
		create_unit Mansura, rajput dismounted noble swordsmen, num 1, exp 7, arm 0, wep 0
		create_unit Mansura, sindh light maceman, num 2, exp 6, arm 0, wep 0
		create_unit Mansura, sindh light spearman, num 1, exp 7, arm 0, wep 0
		add_money hungary 2000
		terminate_monitor
	end_if
end_monitor

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AI CASH SCRIPT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart FactionType aztecs
		and I_TurnNumber > 99
		and not I_LocalFaction aztecs
		
		if I_NumberOfSettlements aztecs >= 20
		and I_NumberOfSettlements aztecs < 25
			console_command add_money aztecs, -5000
		end_if

		if I_NumberOfSettlements aztecs >= 25
		and I_NumberOfSettlements aztecs < 30
			console_command add_money aztecs, -7500
		end_if

		if I_NumberOfSettlements aztecs >= 30
		and I_NumberOfSettlements aztecs < 35
			console_command add_money aztecs, -10000
		end_if

		if I_NumberOfSettlements aztecs >= 35
			console_command add_money aztecs, -12500
		end_if
	end_monitor
	
	monitor_event FactionTurnStart FactionType byzantium
		and I_TurnNumber > 99
		and not I_LocalFaction byzantium
		
		if I_NumberOfSettlements byzantium >= 20
		and I_NumberOfSettlements byzantium < 25
			console_command add_money byzantium, -5000
		end_if

		if I_NumberOfSettlements byzantium >= 25
		and I_NumberOfSettlements byzantium < 30
			console_command add_money byzantium, -7500
		end_if

		if I_NumberOfSettlements byzantium >= 30
		and I_NumberOfSettlements byzantium < 35
			console_command add_money byzantium, -10000
		end_if

		if I_NumberOfSettlements byzantium >= 35
			console_command add_money byzantium, -12500
		end_if
	end_monitor
	
	monitor_event FactionTurnStart FactionType denmark
		and I_TurnNumber > 99
		and not I_LocalFaction denmark
		
		if I_NumberOfSettlements denmark >= 20
		and I_NumberOfSettlements denmark < 25
			console_command add_money denmark, -5000
		end_if

		if I_NumberOfSettlements denmark >= 25
		and I_NumberOfSettlements denmark < 30
			console_command add_money denmark, -7500
		end_if

		if I_NumberOfSettlements denmark >= 30
		and I_NumberOfSettlements denmark < 35
			console_command add_money denmark, -10000
		end_if

		if I_NumberOfSettlements denmark >= 35
			console_command add_money denmark, -12500
		end_if
	end_monitor
	
	monitor_event FactionTurnStart FactionType egypt
		and I_TurnNumber > 99
		and not I_LocalFaction egypt
		
		if I_NumberOfSettlements egypt >= 20
		and I_NumberOfSettlements egypt < 25
			console_command add_money egypt, -5000
		end_if

		if I_NumberOfSettlements egypt >= 25
		and I_NumberOfSettlements egypt < 30
			console_command add_money egypt, -7500
		end_if

		if I_NumberOfSettlements egypt >= 30
		and I_NumberOfSettlements egypt < 35
			console_command add_money egypt, -10000
		end_if

		if I_NumberOfSettlements egypt >= 35
			console_command add_money egypt, -12500
		end_if
	end_monitor
	
	monitor_event FactionTurnStart FactionType england
		and I_TurnNumber > 99
		and not I_LocalFaction england
		
		if I_NumberOfSettlements england >= 20
		and I_NumberOfSettlements england < 25
			console_command add_money england, -5000
		end_if

		if I_NumberOfSettlements england >= 25
		and I_NumberOfSettlements england < 30
			console_command add_money england, -7500
		end_if

		if I_NumberOfSettlements england >= 30
		and I_NumberOfSettlements england < 35
			console_command add_money england, -10000
		end_if

		if I_NumberOfSettlements england >= 35
			console_command add_money england, -12500
		end_if
	end_monitor
	
	monitor_event FactionTurnStart FactionType france
		and I_TurnNumber > 99
		and not I_LocalFaction france
		
		if I_NumberOfSettlements france >= 20
		and I_NumberOfSettlements france < 25
			console_command add_money france, -5000
		end_if

		if I_NumberOfSettlements france >= 25
		and I_NumberOfSettlements france < 30
			console_command add_money france, -7500
		end_if

		if I_NumberOfSettlements france >= 30
		and I_NumberOfSettlements france < 35
			console_command add_money france, -10000
		end_if

		if I_NumberOfSettlements france >= 35
			console_command add_money france, -12500
		end_if
	end_monitor
	
	monitor_event FactionTurnStart FactionType hungary
		and I_TurnNumber > 99
		and not I_LocalFaction hungary
		
		if I_NumberOfSettlements hungary >= 20
		and I_NumberOfSettlements hungary < 25
			console_command add_money hungary, -5000
		end_if

		if I_NumberOfSettlements hungary >= 25
		and I_NumberOfSettlements hungary < 30
			console_command add_money hungary, -7500
		end_if

		if I_NumberOfSettlements hungary >= 30
		and I_NumberOfSettlements hungary < 35
			console_command add_money hungary, -10000
		end_if

		if I_NumberOfSettlements hungary >= 35
			console_command add_money hungary, -12500
		end_if
	end_monitor
	
	monitor_event FactionTurnStart FactionType milan
		and I_TurnNumber > 99
		and not I_LocalFaction milan
		
		if I_NumberOfSettlements milan >= 20
		and I_NumberOfSettlements milan < 25
			console_command add_money milan, -5000
		end_if

		if I_NumberOfSettlements milan >= 25
		and I_NumberOfSettlements milan < 30
			console_command add_money milan, -7500
		end_if

		if I_NumberOfSettlements milan >= 30
		and I_NumberOfSettlements milan < 35
			console_command add_money milan, -10000
		end_if

		if I_NumberOfSettlements milan >= 35
			console_command add_money milan, -12500
		end_if
	end_monitor
	
	monitor_event FactionTurnStart FactionType moors
		and I_TurnNumber > 99
		and not I_LocalFaction moors
		
		if I_NumberOfSettlements moors >= 20
		and I_NumberOfSettlements moors < 25
			console_command add_money moors, -5000
		end_if

		if I_NumberOfSettlements moors >= 25
		and I_NumberOfSettlements moors < 30
			console_command add_money moors, -7500
		end_if

		if I_NumberOfSettlements moors >= 30
		and I_NumberOfSettlements moors < 35
			console_command add_money moors, -10000
		end_if

		if I_NumberOfSettlements moors >= 35
			console_command add_money moors, -12500
		end_if
	end_monitor
	
	monitor_event FactionTurnStart FactionType poland
		and I_TurnNumber > 99
		and not I_LocalFaction poland
		
		if I_NumberOfSettlements poland >= 20
		and I_NumberOfSettlements poland < 25
			console_command add_money poland, -5000
		end_if

		if I_NumberOfSettlements poland >= 25
		and I_NumberOfSettlements poland < 30
			console_command add_money poland, -7500
		end_if

		if I_NumberOfSettlements poland >= 30
		and I_NumberOfSettlements poland < 35
			console_command add_money poland, -10000
		end_if

		if I_NumberOfSettlements poland >= 35
			console_command add_money poland, -12500
		end_if
	end_monitor
	
	monitor_event FactionTurnStart FactionType portugal
		and I_TurnNumber > 99
		and not I_LocalFaction portugal
		
		if I_NumberOfSettlements portugal >= 20
		and I_NumberOfSettlements portugal < 25
			console_command add_money portugal, -5000
		end_if

		if I_NumberOfSettlements portugal >= 25
		and I_NumberOfSettlements portugal < 30
			console_command add_money portugal, -7500
		end_if

		if I_NumberOfSettlements portugal >= 30
		and I_NumberOfSettlements portugal < 35
			console_command add_money portugal, -10000
		end_if

		if I_NumberOfSettlements portugal >= 35
			console_command add_money portugal, -12500
		end_if
	end_monitor
	
	monitor_event FactionTurnStart FactionType russia
		and I_TurnNumber > 99
		and not I_LocalFaction russia
		
		if I_NumberOfSettlements russia >= 20
		and I_NumberOfSettlements russia < 25
			console_command add_money russia, -5000
		end_if

		if I_NumberOfSettlements russia >= 25
		and I_NumberOfSettlements russia < 30
			console_command add_money russia, -7500
		end_if

		if I_NumberOfSettlements russia >= 30
		and I_NumberOfSettlements russia < 35
			console_command add_money russia, -10000
		end_if

		if I_NumberOfSettlements russia >= 35
			console_command add_money russia, -12500
		end_if
	end_monitor
	
	monitor_event FactionTurnStart FactionType scotland
		and I_TurnNumber > 99
		and not I_LocalFaction scotland
		
		if I_NumberOfSettlements scotland >= 20
		and I_NumberOfSettlements scotland < 25
			console_command add_money scotland, -5000
		end_if

		if I_NumberOfSettlements scotland >= 25
		and I_NumberOfSettlements scotland < 30
			console_command add_money scotland, -7500
		end_if

		if I_NumberOfSettlements scotland >= 30
		and I_NumberOfSettlements scotland < 35
			console_command add_money scotland, -10000
		end_if

		if I_NumberOfSettlements scotland >= 35
			console_command add_money scotland, -12500
		end_if
	end_monitor
	
	monitor_event FactionTurnStart FactionType sicily
		and I_TurnNumber > 99
		and not I_LocalFaction sicily
		
		if I_NumberOfSettlements sicily >= 20
		and I_NumberOfSettlements sicily < 25
			console_command add_money sicily, -5000
		end_if

		if I_NumberOfSettlements sicily >= 25
		and I_NumberOfSettlements sicily < 30
			console_command add_money sicily, -7500
		end_if

		if I_NumberOfSettlements sicily >= 30
		and I_NumberOfSettlements sicily < 35
			console_command add_money sicily, -10000
		end_if

		if I_NumberOfSettlements sicily >= 35
			console_command add_money sicily, -12500
		end_if
	end_monitor
	
	monitor_event FactionTurnStart FactionType spain
		and I_TurnNumber > 99
		and not I_LocalFaction spain
		
		if I_NumberOfSettlements spain >= 20
		and I_NumberOfSettlements spain < 25
			console_command add_money spain, -5000
		end_if

		if I_NumberOfSettlements spain >= 25
		and I_NumberOfSettlements spain < 30
			console_command add_money spain, -7500
		end_if

		if I_NumberOfSettlements spain >= 30
		and I_NumberOfSettlements spain < 35
			console_command add_money spain, -10000
		end_if

		if I_NumberOfSettlements spain >= 35
			console_command add_money spain, -12500
		end_if
	end_monitor
	
	monitor_event FactionTurnStart FactionType turks
		and I_TurnNumber > 99
		and not I_LocalFaction turks
		
		if I_NumberOfSettlements turks >= 20
		and I_NumberOfSettlements turks < 25
			console_command add_money turks, -5000
		end_if

		if I_NumberOfSettlements turks >= 25
		and I_NumberOfSettlements turks < 30
			console_command add_money turks, -7500
		end_if

		if I_NumberOfSettlements turks >= 30
		and I_NumberOfSettlements turks < 35
			console_command add_money turks, -10000
		end_if

		if I_NumberOfSettlements turks >= 35
			console_command add_money turks, -12500
		end_if
	end_monitor
	
	monitor_event FactionTurnStart FactionType venice
		and I_TurnNumber > 99
		and not I_LocalFaction venice
		
		if I_NumberOfSettlements venice >= 20
		and I_NumberOfSettlements venice < 25
			console_command add_money venice, -5000
		end_if

		if I_NumberOfSettlements venice >= 25
		and I_NumberOfSettlements venice < 30
			console_command add_money venice, -7500
		end_if

		if I_NumberOfSettlements venice >= 30
		and I_NumberOfSettlements venice < 35
			console_command add_money venice, -10000
		end_if

		if I_NumberOfSettlements venice >= 35
			console_command add_money venice, -12500
		end_if
	end_monitor




;;; KYPCHAKS

	monitor_event FactionTurnStart FactionType portugal
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money portugal, 10000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money portugal, 6000
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money portugal, 4000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money portugal, 2000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType portugal
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 2500
		
			if I_TurnNumber < 60
				console_command add_money portugal, 2500
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money portugal, 1500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money portugal, 1000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money portugal, 1000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType portugal
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money portugal, 5000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money portugal, 3500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money portugal, 2500
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money portugal, 1000
			end_if
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
        and FactionType portugal
		and SettlementType city
		and SettlementBuildingExists = wooden_pallisade
	console_command add_money portugal, 150
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
        and FactionType portugal
		and SettlementType city
		and SettlementBuildingExists = wooden_wall
	console_command add_money portugal, 300
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
        and FactionType portugal
		and SettlementType city
		and SettlementBuildingExists = stone_wall
	console_command add_money portugal, 450
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType portugal
		and SettlementType city
		and SettlementBuildingExists = large_stone_wall
	console_command add_money portugal, 600
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType portugal
		and SettlementType city
		and SettlementBuildingExists = huge_stone_wall
	console_command add_money portugal, 750
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType portugal
		and SettlementType castle
		and SettlementBuildingExists = motte_and_bailey
	console_command add_money portugal, 150
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType portugal
		and SettlementType castle
		and SettlementBuildingExists = wooden_castle
	console_command add_money portugal, 300
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType portugal
		and SettlementType castle
		and SettlementBuildingExists = castle
	console_command add_money portugal, 450
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType portugal
		and SettlementType castle
		and SettlementBuildingExists = fortress
	console_command add_money portugal, 600
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType portugal
		and SettlementType castle
		and SettlementBuildingExists = citadel
	console_command add_money portugal, 750
	end_monitor

;;; GHORID SULTANATE

		monitor_event FactionTurnStart FactionType milan
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money milan, 10000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money milan, 6000
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money milan, 4000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money milan, 2000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType milan
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 2500
		
			if I_TurnNumber < 60
				console_command add_money milan, 2500
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money milan, 1500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money milan, 1000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money milan, 1000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType milan
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money milan, 5000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money milan, 3500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money milan, 2500
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money milan, 1000
			end_if
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType milan
		and SettlementType city
		and SettlementBuildingExists = wooden_pallisade
	console_command add_money milan, 300
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType milan
		and SettlementType city
		and SettlementBuildingExists = wooden_wall
	console_command add_money milan, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType milan
		and SettlementType city
		and SettlementBuildingExists = stone_wall
	console_command add_money milan, 650
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType milan
		and SettlementType city
		and SettlementBuildingExists = large_stone_wall
	console_command add_money milan, 750
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType milan
		and SettlementType city
		and SettlementBuildingExists = huge_stone_wall
	console_command add_money milan, 800
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType milan
		and SettlementType castle
		and SettlementBuildingExists = motte_and_bailey
	console_command add_money milan, 300
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType milan
		and SettlementType castle
		and SettlementBuildingExists = wooden_castle
	console_command add_money milan, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType milan
		and SettlementType castle
		and SettlementBuildingExists = castle
	console_command add_money milan, 650
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType milan
		and SettlementType castle
		and SettlementBuildingExists = fortress
	console_command add_money milan, 750
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType milan
		and SettlementType castle
		and SettlementBuildingExists = citadel
	console_command add_money milan, 800
	end_monitor

;;; ABBASID CALIPHATE

		monitor_event FactionTurnStart FactionType moors
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money moors, 10000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money moors, 6000
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money moors, 4000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money moors, 2000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType moors
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 2500
		
			if I_TurnNumber < 60
				console_command add_money moors, 2500
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money moors, 1500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money moors, 1000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money moors, 1000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType moors
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money moors, 5000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money moors, 3500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money moors, 2500
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money moors, 1000
			end_if
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType moors
		and SettlementType city
		and SettlementBuildingExists = wooden_pallisade
	console_command add_money moors, 150
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType moors
		and SettlementType city
		and SettlementBuildingExists = wooden_wall
	console_command add_money moors, 300
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType moors
		and SettlementType city
		and SettlementBuildingExists = stone_wall
	console_command add_money moors, 450
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType moors
		and SettlementType city
		and SettlementBuildingExists = large_stone_wall
	console_command add_money moors, 600
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType moors
		and SettlementType city
		and SettlementBuildingExists = huge_stone_wall
	console_command add_money moors, 750
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType moors
		and SettlementType castle
		and SettlementBuildingExists = motte_and_bailey
	console_command add_money moors, 150
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType moors
		and SettlementType castle
		and SettlementBuildingExists = wooden_castle
	console_command add_money moors, 300
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType moors
		and SettlementType castle
		and SettlementBuildingExists = castle
	console_command add_money moors, 450
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType moors
		and SettlementType castle
		and SettlementBuildingExists = fortress
	console_command add_money moors, 600
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType moors
		and SettlementType castle
		and SettlementBuildingExists = citadel
	console_command add_money moors, 750
	end_monitor

;;; TURKISH SULTANATE

		monitor_event FactionTurnStart FactionType turks
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money turks, 10000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money turks, 6000
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money turks, 4000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money turks, 2000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType turks
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 2500
		
			if I_TurnNumber < 60
				console_command add_money turks, 2500
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money turks, 1500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money turks, 1000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money turks, 1000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType turks
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money turks, 5000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money turks, 3500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money turks, 2500
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money turks, 1000
			end_if
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType turks
		and SettlementType city
		and SettlementBuildingExists = wooden_pallisade
	console_command add_money turks, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType turks
		and SettlementType city
		and SettlementBuildingExists = wooden_wall
	console_command add_money turks, 550
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType turks
		and SettlementType city
		and SettlementBuildingExists = stone_wall
	console_command add_money turks, 600
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType turks
		and SettlementType city
		and SettlementBuildingExists = large_stone_wall
	console_command add_money turks, 650
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType turks
		and SettlementType city
		and SettlementBuildingExists = huge_stone_wall
	console_command add_money turks, 700
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType turks
		and SettlementType castle
		and SettlementBuildingExists = motte_and_bailey
	console_command add_money turks, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType turks
		and SettlementType castle
		and SettlementBuildingExists = wooden_castle
	console_command add_money turks, 550
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType turks
		and SettlementType castle
		and SettlementBuildingExists = castle
	console_command add_money turks, 600
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType turks
		and SettlementType castle
		and SettlementBuildingExists = fortress
	console_command add_money turks, 650
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType turks
		and SettlementType castle
		and SettlementBuildingExists = citadel
	console_command add_money turks, 700
	end_monitor

;;; ROMAN EMPIRE

	monitor_event FactionTurnStart FactionType byzantium
		and not FactionIsLocal
		
			if I_TurnNumber <= 90
				console_command add_money byzantium, -3500
			end_if
			
			if I_TurnNumber > 90
				
				if I_NumberOfSettlements byzantium >= 20
					console_command add_money byzantium, -5000
				end_if
				
				if I_NumberOfSettlements byzantium >= 25
					console_command add_money byzantium, -7500
				end_if
				
				if I_NumberOfSettlements byzantium >= 30
					console_command add_money byzantium, -10000
				end_if
				
				if I_NumberOfSettlements byzantium >= 35
					console_command add_money byzantium, -12500
				end_if
				
				if I_NumberOfSettlements byzantium >= 35
					console_command add_money byzantium, -15000
				end_if
				
			end_if
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType byzantium
		and SettlementType city
		and SettlementBuildingExists = wooden_pallisade
	console_command add_money byzantium, 50
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType byzantium
		and SettlementType city
		and SettlementBuildingExists = wooden_wall
	console_command add_money byzantium, 100
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType byzantium
		and SettlementType city
		and SettlementBuildingExists = stone_wall
	console_command add_money byzantium, 150
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType byzantium
		and SettlementType city
		and SettlementBuildingExists = large_stone_wall
	console_command add_money byzantium, 200
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType byzantium
		and SettlementType city
		and SettlementBuildingExists = huge_stone_wall
	console_command add_money byzantium, 250
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType byzantium
		and SettlementType castle
		and SettlementBuildingExists = motte_and_bailey
	console_command add_money byzantium, 50
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType byzantium
		and SettlementType castle
		and SettlementBuildingExists = wooden_castle
	console_command add_money byzantium, 100
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType byzantium
		and SettlementType castle
		and SettlementBuildingExists = castle
	console_command add_money byzantium, 150
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType byzantium
		and SettlementType castle
		and SettlementBuildingExists = fortress
	console_command add_money byzantium, 200
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
        and FactionType byzantium
		and SettlementType castle
		and SettlementBuildingExists = citadel
			console_command add_money byzantium, 250
	end_monitor

;;; KINGDOM OF ARMENIA

		monitor_event FactionTurnStart FactionType poland
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money poland, 10000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money poland, 6000
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money poland, 4000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money poland, 2000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType poland
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 2500
		
			if I_TurnNumber < 60
				console_command add_money poland, 2500
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money poland, 1500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money poland, 1000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money poland, 1000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType poland
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money poland, 5000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money poland, 3500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money poland, 2500
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money poland, 1000
			end_if
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType poland
		and SettlementType city
		and SettlementBuildingExists = wooden_pallisade
	console_command add_money poland, 250
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType poland
		and SettlementType city
		and SettlementBuildingExists = wooden_wall
	console_command add_money poland, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType poland
		and SettlementType city
		and SettlementBuildingExists = stone_wall
	console_command add_money poland, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType poland
		and SettlementType city
		and SettlementBuildingExists = large_stone_wall
	console_command add_money poland, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType poland
		and SettlementType city
		and SettlementBuildingExists = huge_stone_wall
	console_command add_money poland, 750
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType poland
		and SettlementType castle
		and SettlementBuildingExists = motte_and_bailey
	console_command add_money poland, 250
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType poland
		and SettlementType castle
		and SettlementBuildingExists = wooden_castle
	console_command add_money poland, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType poland
		and SettlementType castle
		and SettlementBuildingExists = castle
	console_command add_money poland, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType poland
		and SettlementType castle
		and SettlementBuildingExists = fortress
	console_command add_money poland, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType poland
		and SettlementType castle
		and SettlementBuildingExists = citadel
	console_command add_money poland, 750
	end_monitor

;;; SULTANATE OF GHAZNI

		monitor_event FactionTurnStart FactionType venice
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money venice, 10000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money venice, 6000
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money venice, 4000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money venice, 2000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType venice
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 2500
		
			if I_TurnNumber < 60
				console_command add_money venice, 2500
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money venice, 1500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money venice, 1000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money venice, 1000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType venice
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money venice, 5000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money venice, 3500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money venice, 2500
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money venice, 1000
			end_if
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType venice
		and SettlementType city
		and SettlementBuildingExists = wooden_pallisade
	console_command add_money venice, 250
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType venice
		and SettlementType city
		and SettlementBuildingExists = wooden_wall
	console_command add_money venice, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType venice
		and SettlementType city
		and SettlementBuildingExists = stone_wall
	console_command add_money venice, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType venice
		and SettlementType city
		and SettlementBuildingExists = large_stone_wall
	console_command add_money venice, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType venice
		and SettlementType city
		and SettlementBuildingExists = huge_stone_wall
	console_command add_money venice, 750
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType venice
		and SettlementType castle
		and SettlementBuildingExists = motte_and_bailey
	console_command add_money venice, 250
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType venice
		and SettlementType castle
		and SettlementBuildingExists = wooden_castle
	console_command add_money venice, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType venice
		and SettlementType castle
		and SettlementBuildingExists = castle
	console_command add_money venice, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType venice
		and SettlementType castle
		and SettlementBuildingExists = fortress
	console_command add_money venice, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType venice
		and SettlementType castle
		and SettlementBuildingExists = citadel
	console_command add_money venice, 750
	end_monitor

;;; AYYUBID SULTANATE

		monitor_event FactionTurnStart FactionType egypt
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money egypt, 10000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money egypt, 6000
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money egypt, 4000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money egypt, 2000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType egypt
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 2500
		
			if I_TurnNumber < 60
				console_command add_money egypt, 2500
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money egypt, 1500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money egypt, 1000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money egypt, 1000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType egypt
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money egypt, 5000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money egypt, 3500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money egypt, 2500
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money egypt, 1000
			end_if
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType egypt
		and SettlementType city
		and SettlementBuildingExists = wooden_pallisade
	console_command add_money egypt, 200
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType egypt
		and SettlementType city
		and SettlementBuildingExists = wooden_wall
	console_command add_money egypt, 400
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType egypt
		and SettlementType city
		and SettlementBuildingExists = stone_wall
	console_command add_money egypt, 600
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType egypt
		and SettlementType city
		and SettlementBuildingExists = large_stone_wall
	console_command add_money egypt, 800
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType egypt
		and SettlementType city
		and SettlementBuildingExists = huge_stone_wall
	console_command add_money egypt, 1000
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType egypt
		and SettlementType castle
		and SettlementBuildingExists = motte_and_bailey
	console_command add_money egypt, 200
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType egypt
		and SettlementType castle
		and SettlementBuildingExists = wooden_castle
	console_command add_money egypt, 400
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType egypt
		and SettlementType castle
		and SettlementBuildingExists = castle
	console_command add_money egypt, 600
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType egypt
		and SettlementType castle
		and SettlementBuildingExists = fortress
	console_command add_money egypt, 800
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType egypt
		and SettlementType castle
		and SettlementBuildingExists = citadel
	console_command add_money egypt, 1000
	end_monitor

;;; KINGDOM OF JERUSALEM

		monitor_event FactionTurnStart FactionType france
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money france, 10000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money france, 6000
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money france, 4000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money france, 2000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType france
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 2500
		
			if I_TurnNumber < 60
				console_command add_money france, 2500
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money france, 1500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money france, 1000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money france, 1000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType france
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money france, 5000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money france, 3500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money france, 2500
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money france, 1000
			end_if
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType france
		and SettlementType city
		and SettlementBuildingExists = wooden_pallisade
	console_command add_money france, 150
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType france
		and SettlementType city
		and SettlementBuildingExists = wooden_wall
	console_command add_money france, 300
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType france
		and SettlementType city
		and SettlementBuildingExists = stone_wall
	console_command add_money france, 450
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType france
		and SettlementType city
		and SettlementBuildingExists = large_stone_wall
	console_command add_money france, 600
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType france
		and SettlementType city
		and SettlementBuildingExists = huge_stone_wall
	console_command add_money france, 750
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType france
		and SettlementType castle
		and SettlementBuildingExists = motte_and_bailey
	console_command add_money france, 150
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType france
		and SettlementType castle
		and SettlementBuildingExists = wooden_castle
	console_command add_money france, 300
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType france
		and SettlementType castle
		and SettlementBuildingExists = castle
	console_command add_money france, 450
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType france
		and SettlementType castle
		and SettlementBuildingExists = fortress
	console_command add_money france, 600
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType france
		and SettlementType castle
		and SettlementBuildingExists = citadel
	console_command add_money france, 750
	end_monitor

;;; GREAT SELJUKS

		monitor_event FactionTurnStart FactionType russia
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money russia, 10000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money russia, 6000
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money russia, 4000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money russia, 2000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType russia
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 2500
		
			if I_TurnNumber < 60
				console_command add_money russia, 2500
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money russia, 1500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money russia, 1000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money russia, 1000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType russia
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money russia, 5000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money russia, 3500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money russia, 2500
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money russia, 1000
			end_if
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType russia
		and SettlementType city
		and SettlementBuildingExists = wooden_pallisade
	console_command add_money russia, 250
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType russia
		and SettlementType city
		and SettlementBuildingExists = wooden_wall
	console_command add_money russia, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType russia
		and SettlementType city
		and SettlementBuildingExists = stone_wall
	console_command add_money russia, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType russia
		and SettlementType city
		and SettlementBuildingExists = large_stone_wall
	console_command add_money russia, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType russia
		and SettlementType city
		and SettlementBuildingExists = huge_stone_wall
	console_command add_money russia, 750
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType russia
		and SettlementType castle
		and SettlementBuildingExists = motte_and_bailey
	console_command add_money russia, 250
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType russia
		and SettlementType castle
		and SettlementBuildingExists = wooden_castle
	console_command add_money russia, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType russia
		and SettlementType castle
		and SettlementBuildingExists = castle
	console_command add_money russia, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType russia
		and SettlementType castle
		and SettlementBuildingExists = fortress
	console_command add_money russia, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType russia
		and SettlementType castle
		and SettlementBuildingExists = citadel
	console_command add_money russia, 750
	end_monitor

;;; KINGDOM OF GEORGIA

		monitor_event FactionTurnStart FactionType england
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money england, 10000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money england, 6000
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money england, 4000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money england, 2000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType england
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 2500
		
			if I_TurnNumber < 60
				console_command add_money england, 2500
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money england, 1500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money england, 1000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money england, 1000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType england
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money england, 5000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money england, 3500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money england, 2500
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money england, 1000
			end_if
	end_monitor
	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType england
		and SettlementType city
		and SettlementBuildingExists = wooden_pallisade
	console_command add_money england, 300
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType england
		and SettlementType city
		and SettlementBuildingExists = wooden_wall
	console_command add_money england, 400
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType england
		and SettlementType city
		and SettlementBuildingExists = stone_wall
	console_command add_money england, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType england
		and SettlementType city
		and SettlementBuildingExists = large_stone_wall
	console_command add_money england, 600
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType england
		and SettlementType city
		and SettlementBuildingExists = huge_stone_wall
	console_command add_money england, 700
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType england
		and SettlementType castle
		and SettlementBuildingExists = motte_and_bailey
	console_command add_money england, 300
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType england
		and SettlementType castle
		and SettlementBuildingExists = wooden_castle
	console_command add_money england, 400
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType england
		and SettlementType castle
		and SettlementBuildingExists = castle
	console_command add_money england, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType england
		and SettlementType castle
		and SettlementBuildingExists = fortress
	console_command add_money england, 600
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType england
		and SettlementType castle
		and SettlementBuildingExists = citadel
	console_command add_money england, 700
	end_monitor

;;; SOLANKI RAJPUTS

		monitor_event FactionTurnStart FactionType sicily
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money sicily, 10000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money sicily, 6000
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money sicily, 4000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money sicily, 2000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType sicily
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 2500
		
			if I_TurnNumber < 60
				console_command add_money sicily, 2500
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money sicily, 1500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money sicily, 1000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money sicily, 1000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType sicily
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money sicily, 5000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money sicily, 3500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money sicily, 2500
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money sicily, 1000
			end_if
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType sicily
		and SettlementType city
		and SettlementBuildingExists = wooden_pallisade
	console_command add_money sicily, 250
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType sicily
		and SettlementType city
		and SettlementBuildingExists = wooden_wall
	console_command add_money sicily, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType sicily
		and SettlementType city
		and SettlementBuildingExists = stone_wall
	console_command add_money sicily, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType sicily
		and SettlementType city
		and SettlementBuildingExists = large_stone_wall
	console_command add_money sicily, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType sicily
		and SettlementType city
		and SettlementBuildingExists = huge_stone_wall
	console_command add_money sicily, 750
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType sicily
		and SettlementType castle
		and SettlementBuildingExists = motte_and_bailey
	console_command add_money sicily, 250
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType sicily
		and SettlementType castle
		and SettlementBuildingExists = wooden_castle
	console_command add_money sicily, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType sicily
		and SettlementType castle
		and SettlementBuildingExists = castle
	console_command add_money sicily, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType sicily
		and SettlementType castle
		and SettlementBuildingExists = fortress
	console_command add_money sicily, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType sicily
		and SettlementType castle
		and SettlementBuildingExists = citadel
	console_command add_money sicily, 750
	end_monitor
	
	;;; CHAUHAN RAJPUTS

		monitor_event FactionTurnStart FactionType aztecs
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money aztecs, 10000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money aztecs, 6000
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money aztecs, 4000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money aztecs, 2000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType aztecs
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 2500
		
			if I_TurnNumber < 60
				console_command add_money aztecs, 2500
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money aztecs, 1500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money aztecs, 1000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money aztecs, 1000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType aztecs
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money aztecs, 5000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money aztecs, 3500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money aztecs, 2500
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money aztecs, 1000
			end_if
	end_monitor
	
	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType aztecs
		and SettlementType city
		and SettlementBuildingExists = wooden_pallisade
	console_command add_money aztecs, 200
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType aztecs
		and SettlementType city
		and SettlementBuildingExists = wooden_wall
	console_command add_money aztecs, 400
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType aztecs
		and SettlementType city
		and SettlementBuildingExists = stone_wall
	console_command add_money aztecs, 600
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType aztecs
		and SettlementType city
		and SettlementBuildingExists = large_stone_wall
	console_command add_money aztecs, 600
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType aztecs
		and SettlementType city
		and SettlementBuildingExists = huge_stone_wall
	console_command add_money aztecs, 600
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType aztecs
		and SettlementType castle
		and SettlementBuildingExists = motte_and_bailey
	console_command add_money aztecs, 200
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType aztecs
		and SettlementType castle
		and SettlementBuildingExists = wooden_castle
	console_command add_money aztecs, 400
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType aztecs
		and SettlementType castle
		and SettlementBuildingExists = castle
	console_command add_money aztecs, 600
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType aztecs
		and SettlementType castle
		and SettlementBuildingExists = fortress
	console_command add_money aztecs, 600
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType aztecs
		and SettlementType castle
		and SettlementBuildingExists = citadel
	console_command add_money aztecs, 600
	end_monitor
	
	;;; MALIKATE OF SINDH

		monitor_event FactionTurnStart FactionType hungary
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money hungary, 10000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money hungary, 6000
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money hungary, 4000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money hungary, 2000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType hungary
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 2500
		
			if I_TurnNumber < 60
				console_command add_money hungary, 2500
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money hungary, 1500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money hungary, 1000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money hungary, 1000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType hungary
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money hungary, 5000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money hungary, 3500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money hungary, 2500
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money hungary, 1000
			end_if
	end_monitor
	
	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType hungary
		and SettlementType city
		and SettlementBuildingExists = wooden_pallisade
	console_command add_money hungary, 200
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType hungary
		and SettlementType city
		and SettlementBuildingExists = wooden_wall
	console_command add_money hungary, 300
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType hungary
		and SettlementType city
		and SettlementBuildingExists = stone_wall
	console_command add_money hungary, 400
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType hungary
		and SettlementType city
		and SettlementBuildingExists = large_stone_wall
	console_command add_money hungary, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType hungary
		and SettlementType city
		and SettlementBuildingExists = huge_stone_wall
	console_command add_money hungary, 600
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType hungary
		and SettlementType castle
		and SettlementBuildingExists = motte_and_bailey
	console_command add_money hungary, 200
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType hungary
		and SettlementType castle
		and SettlementBuildingExists = wooden_castle
	console_command add_money hungary, 300
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType hungary
		and SettlementType castle
		and SettlementBuildingExists = castle
	console_command add_money hungary, 400
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType hungary
		and SettlementType castle
		and SettlementBuildingExists = fortress
	console_command add_money hungary, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType hungary
		and SettlementType castle
		and SettlementBuildingExists = citadel
	console_command add_money hungary, 600
	end_monitor

;;; KINGDOM OF MAKURIA

		monitor_event FactionTurnStart FactionType scotland
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money scotland, 10000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money scotland, 6000
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money scotland, 4000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money scotland, 2000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType scotland
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 2500
		
			if I_TurnNumber < 60
				console_command add_money scotland, 2500
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money scotland, 1500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money scotland, 1000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money scotland, 1000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType scotland
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money scotland, 5000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money scotland, 3500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money scotland, 2500
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money scotland, 1000
			end_if
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType scotland
		and SettlementType city
		and SettlementBuildingExists = wooden_pallisade
	console_command add_money scotland, 200
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType scotland
		and SettlementType city
		and SettlementBuildingExists = wooden_wall
	console_command add_money scotland, 300
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType scotland
		and SettlementType city
		and SettlementBuildingExists = stone_wall
	console_command add_money scotland, 400
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType scotland
		and SettlementType city
		and SettlementBuildingExists = large_stone_wall
	console_command add_money scotland, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType scotland
		and SettlementType city
		and SettlementBuildingExists = huge_stone_wall
	console_command add_money scotland, 600
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType scotland
		and SettlementType castle
		and SettlementBuildingExists = motte_and_bailey
	console_command add_money scotland, 200
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType scotland
		and SettlementType castle
		and SettlementBuildingExists = wooden_castle
	console_command add_money scotland, 300
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType scotland
		and SettlementType castle
		and SettlementBuildingExists = castle
	console_command add_money scotland, 400
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType scotland
		and SettlementType castle
		and SettlementBuildingExists = fortress
	console_command add_money scotland, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType scotland
		and SettlementType castle
		and SettlementBuildingExists = citadel
	console_command add_money scotland, 600
	end_monitor

;;; IMAMAT OF OMAN

		monitor_event FactionTurnStart FactionType denmark
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money denmark, 10000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money denmark, 6000
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money denmark, 4000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money denmark, 2000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType denmark
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 2500
		
			if I_TurnNumber < 60
				console_command add_money denmark, 2500
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money denmark, 1500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money denmark, 1000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money denmark, 1000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType denmark
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money denmark, 5000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money denmark, 3500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money denmark, 2500
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money denmark, 1000
			end_if
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
        and FactionType denmark
		and SettlementType city
		and SettlementBuildingExists = wooden_pallisade
	console_command add_money denmark, 250
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
        and FactionType denmark
		and SettlementType city
		and SettlementBuildingExists = wooden_wall
	console_command add_money denmark, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
        and FactionType denmark
		and SettlementType city
		and SettlementBuildingExists = stone_wall
	console_command add_money denmark, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType denmark
		and SettlementType city
		and SettlementBuildingExists = large_stone_wall
	console_command add_money denmark, 750
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType denmark
		and SettlementType city
		and SettlementBuildingExists = huge_stone_wall
	console_command add_money denmark, 750
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType denmark
		and SettlementType castle
		and SettlementBuildingExists = motte_and_bailey
	console_command add_money denmark, 250
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType denmark
		and SettlementType castle
		and SettlementBuildingExists = wooden_castle
	console_command add_money denmark, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType denmark
		and SettlementType castle
		and SettlementBuildingExists = castle
	console_command add_money denmark, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType denmark
		and SettlementType castle
		and SettlementBuildingExists = fortress
	console_command add_money denmark, 750
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType denmark
		and SettlementType castle
		and SettlementBuildingExists = citadel
	console_command add_money denmark, 750
	end_monitor

;;; KHWAREZM SHAH

		monitor_event FactionTurnStart FactionType spain
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money spain, 10000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money spain, 6000
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money spain, 4000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money spain, 2000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType spain
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 2500
		
			if I_TurnNumber < 60
				console_command add_money spain, 2500
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money spain, 1500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money spain, 1000
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money spain, 1000
			end_if
	end_monitor
	
	monitor_event FactionTurnEnd FactionType spain
		and not FactionIsLocal
		and not FactionScoreRank military <= 3
		and Treasury < 0
		
			if I_TurnNumber < 60
				console_command add_money spain, 5000
			end_if
			
			if I_TurnNumber >= 90
			and I_TurnNumber < 120
				console_command add_money spain, 3500
			end_if
			
			if I_TurnNumber >= 120
			and I_TurnNumber < 150
				console_command add_money spain, 2500
			end_if
			
			if I_TurnNumber >= 150
				console_command add_money spain, 1000
			end_if
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType spain
		and SettlementType city
		and SettlementBuildingExists = wooden_pallisade
	console_command add_money spain, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType spain
		and SettlementType city
		and SettlementBuildingExists = wooden_wall
	console_command add_money spain, 600
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType spain
		and SettlementType city
		and SettlementBuildingExists = stone_wall
	console_command add_money spain, 700
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType spain
		and SettlementType city
		and SettlementBuildingExists = large_stone_wall
	console_command add_money spain, 700
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType spain
		and SettlementType city
		and SettlementBuildingExists = huge_stone_wall
	console_command add_money spain, 700
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType spain
		and SettlementType castle
		and SettlementBuildingExists = motte_and_bailey
	console_command add_money spain, 500
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType spain
		and SettlementType castle
		and SettlementBuildingExists = wooden_castle
	console_command add_money spain, 600
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType spain
		and SettlementType castle
		and SettlementBuildingExists = castle
	console_command add_money spain, 700
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType spain
		and SettlementType castle
		and SettlementBuildingExists = fortress
	console_command add_money spain, 700
	end_monitor

	monitor_event SettlementTurnStart not FactionIsLocal
                and FactionType spain
		and SettlementType castle
		and SettlementBuildingExists = citadel
	console_command add_money spain, 700
	end_monitor

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;THE MONGOL INVASIONS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


declare_counter mongol_invaded1
set_counter mongol_invaded1 0

monitor_event EventCounter EventCounterType mongol_em
	and EventCounter > 0
	add_events
		event	counter mongol_invasion
		date	1 2
	end_add_events

end_monitor

monitor_event EventCounter EventCounterType mongol_invasion
	and EventCounter > 0

	add_events
		event	emergent_faction	mongols
		date	0
		region 	Samarqand_Region
		movie	event/mongols_invade.bik
	end_add_events

	if I_EventCounter mongol_invaded1 == 0
		spawn_army 
			faction mongols
			character	Genghis Khan, named character, age 30, x 278, y 267, family	;command 8, dread 9, loyalty 7, piety 1
			traits EasternWarlord 3 , GoodCommander 5 , Bloodthirsty 2 , BattleDread 4 , StrategyDread 2 , PublicFaith 1 , Loyal 2 , ContentGeneral 3	;command 8, dread 9, loyalty 7, piety 1
			unit		Khan's Guard			exp 9 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers		exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers		exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers		exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Dismaunted Guards	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Dismaunted Guards	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Dismaunted Guards	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		bc catapult				exp 3 armour 0 weapon_lvl 0
			unit		bc catapult				exp 3 armour 0 weapon_lvl 0
		end
		spawn_army 
			faction mongols
			character	Chagatai, named character, age 30, x 279, y 267, family	;command 8, dread 9, loyalty 7, piety 1
			traits EasternWarlord 2 , GoodCommander 3 , Bloodthirsty 1 , BattleDread 2 , StrategyDread 1 , PublicFaith 1 , Loyal 2 , ContentGeneral 3	;command 8, dread 9, loyalty 7, piety 1
			unit		Mongol Bodyguard		exp 9 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers		exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers		exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers		exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers		exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Dismaunted Guards	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Dismaunted Guards	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Dismaunted Guards	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		bc catapult				exp 3 armour 0 weapon_lvl 0
			unit		bc catapult				exp 3 armour 0 weapon_lvl 0
		end
		spawn_army 
			faction mongols
			character	Jebe, named character, age 30, x 280, y 267, family	;command 8, dread 9, loyalty 7, piety 1
			traits EasternWarlord 2 , GoodCommander 2 , Bloodthirsty 2 , BattleDread 2 , PublicFaith 1 , Loyal 2 , ContentGeneral 3	;command 8, dread 9, loyalty 7, piety 1
			unit		Mongol Bodyguard		exp 6 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Dismaunted Guards	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Dismaunted Guards	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		bc catapult				exp 3 armour 0 weapon_lvl 0
			unit		bc catapult				exp 3 armour 0 weapon_lvl 0
		end
		spawn_army 
			faction mongols
			character	Jochi, named character, age 30, x 281, y 267, family	;command 8, dread 9, loyalty 7, piety 1
			traits EasternWarlord 1 , GoodCommander 2 , Bloodthirsty 2 , BattleDread 2 , PublicFaith 1 , Loyal 2 , ContentGeneral 3	;command 8, dread 9, loyalty 7, piety 1
			unit		Mongol Bodyguard		exp 6 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Dismaunted Guards	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Dismaunted Guards	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
		end
		spawn_army 
			faction mongols
			character	Subutai, named character, age 30, x 278, y 266, family	;command 8, dread 9, loyalty 7, piety 1
			traits EasternWarlord 3 , GoodCommander 2 , Bloodthirsty 2 , BattleDread 4 , PublicFaith 1 , Loyal 2 , ContentGeneral 3	;command 8, dread 9, loyalty 7, piety 1
			unit		Mongol Bodyguard		exp 6 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Dismaunted Guards	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Dismaunted Guards	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
		end
		spawn_army 
			faction mongols
			character	Ogodei, named character, age 30, x 279, y 266, family	;command 8, dread 9, loyalty 7, piety 1
			traits EasternWarlord 1 , GoodCommander 2 , Bloodthirsty 2 , BattleDread 2 , PublicFaith 1 , Loyal 2 , ContentGeneral 3	;command 8, dread 9, loyalty 7, piety 1
			unit		Mongol Bodyguard		exp 6 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Dismaunted Guards	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Dismaunted Guards	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
		end
		spawn_army 
			faction mongols
			character	Tolui, named character, age 30, x 280, y 266, family	;command 8, dread 9, loyalty 7, piety 1
			traits EasternWarlord 1 , GoodCommander 2 , Bloodthirsty 2 , BattleDread 2 , PublicFaith 1 , Loyal 2 , ContentGeneral 3	;command 8, dread 9, loyalty 7, piety 1
			unit		Mongol Bodyguard		exp 6 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Dismaunted Guards	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Dismaunted Guards	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
		end
		spawn_army 
			faction mongols
			character	Kublai, named character, age 20, x 281, y 264, family	;command 8, dread 9, loyalty 7, piety 1
			traits EasternWarlord 2 , GoodCommander 2 , Bloodthirsty 2 , BattleDread 2 , PublicFaith 1 , Loyal 2 , ContentGeneral 3	;command 8, dread 9, loyalty 7, piety 1
			unit		Mongol Bodyguard		exp 6 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
		end
		spawn_army 
			faction mongols
			character	Guyuk, named character, age 30, x 281, y 263, family	;command 8, dread 9, loyalty 7, piety 1
			traits EasternWarlord 2 , GoodCommander 2 , Bloodthirsty 2 , BattleDread 2 , PublicFaith 1 , Loyal 2 , ContentGeneral 3	;command 8, dread 9, loyalty 7, piety 1
			unit		Mongol Bodyguard		exp 6 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Dismaunted Guards	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Dismaunted Guards	exp 3 armour 0 weapon_lvl 0
		end

		spawn_army 
			faction mongols
			character	Jebuk, named character, age 30, x 282, y 263, family	;command 8, dread 9, loyalty 7, piety 1
			traits EasternWarlord 1 , GoodCommander 2 , Bloodthirsty 2 , BattleDread 2 , PublicFaith 1 , Loyal 2 , ContentGeneral 3	;command 8, dread 9, loyalty 7, piety 1
			unit		Mongol Bodyguard		exp 6 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
		end

		spawn_army 
			faction mongols
			character	Kubeke, named character, age 30, x 280, y 263, family	;command 8, dread 9, loyalty 7, piety 1
			traits EasternWarlord 1 , GoodCommander 2 , Bloodthirsty 2 , BattleDread 2 , PublicFaith 1 , Loyal 2 , ContentGeneral 3	;command 8, dread 9, loyalty 7, piety 1
			unit		Mongol Bodyguard		exp 6 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
		end

		set_counter mongol_invaded1 1
	end_if
terminate_monitor
end_monitor

;;;;;;;;;;;;;;MONGOL REINFORCEMENTS;;;;;;;;;;;;;;;;;;;;

monitor_event FactionTurnStart FactionType mongols
	and I_SettlementOwner Samarqand = mongols
		spawn_army 
			faction mongols
			character	Bavdai, named character, age 25, x 280, y 263, family	;command 8, dread 9, loyalty 7, piety 1
			traits EasternWarlord 1 , GoodCommander 2 , Bloodthirsty 2 , BattleDread 2 , PublicFaith 1 , Loyal 2 , ContentGeneral 3	;command 8, dread 9, loyalty 7, piety 1
			unit		Mongol Bodyguard		exp 6 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Dismaunted Guards	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Dismaunted Guards	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Dismaunted Guards	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Dismaunted Guards	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
		end

terminate_monitor
end_monitor

monitor_event FactionTurnStart FactionType mongols
	and I_SettlementOwner Bukhara = mongols
		spawn_army 
			faction mongols
			character	Abayan, named character, age 25, x 281, y 263, family	;command 8, dread 9, loyalty 7, piety 1
			traits EasternWarlord 1 , GoodCommander 2 , Bloodthirsty 2 , BattleDread 2 , PublicFaith 1 , Loyal 2 , ContentGeneral 3	;command 8, dread 9, loyalty 7, piety 1
			unit		Mongol Bodyguard		exp 6 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
		end

terminate_monitor
end_monitor


monitor_event FactionTurnStart FactionType mongols
	and I_SettlementOwner Balkh = mongols
		spawn_army 
			faction mongols
			character	Gendai, named character, age 25, x 282, y 263, family	;command 8, dread 9, loyalty 7, piety 1
			traits EasternWarlord 1 , GoodCommander 2 , Bloodthirsty 2 , BattleDread 2 , PublicFaith 1 , Loyal 2 , ContentGeneral 3	;command 8, dread 9, loyalty 7, piety 1
			unit		Mongol Bodyguard		exp 6 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
		end

terminate_monitor
end_monitor

monitor_event FactionTurnStart FactionType mongols
	and I_SettlementOwner Urgench = mongols
		spawn_army 
			faction mongols
			character	Khushan, named character, age 25, x 281, y 264, family	;command 8, dread 9, loyalty 7, piety 1
			traits EasternWarlord 1 , GoodCommander 2 , Bloodthirsty 2 , BattleDread 2 , PublicFaith 1 , Loyal 2 , ContentGeneral 3	;command 8, dread 9, loyalty 7, piety 1
			unit		Mongol Bodyguard		exp 6 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
		end

terminate_monitor
end_monitor

monitor_event FactionTurnStart FactionType mongols
	and I_SettlementOwner Merv = mongols
		spawn_army 
			faction mongols
			character	Kuo_Kan, named character, age 25, x 280, y 266, family	;command 8, dread 9, loyalty 7, piety 1
			traits EasternWarlord 1 , GoodCommander 2 , Bloodthirsty 2 , BattleDread 2 , PublicFaith 1 , Loyal 2 , ContentGeneral 3	;command 8, dread 9, loyalty 7, piety 1
			unit		Mongol Bodyguard		exp 6 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
		end

terminate_monitor
end_monitor

monitor_event FactionTurnStart FactionType mongols
	and I_SettlementOwner Khiva = mongols
		spawn_army 
			faction mongols
			character	Mongatai, named character, age 25, x 279, y 266, family	;command 8, dread 9, loyalty 7, piety 1
			traits EasternWarlord 1 , GoodCommander 2 , Bloodthirsty 2 , BattleDread 2 , PublicFaith 1 , Loyal 2 , ContentGeneral 3	;command 8, dread 9, loyalty 7, piety 1
			unit		Mongol Bodyguard		exp 6 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
		end

terminate_monitor
end_monitor

monitor_event FactionTurnStart FactionType mongols
	and I_SettlementOwner Nishapur = mongols
		spawn_army 
			faction mongols
			character	Aboke, named character, age 25, x 279, y 262, family	;command 8, dread 9, loyalty 7, piety 1
			traits EasternWarlord 1 , GoodCommander 2 , Bloodthirsty 2 , BattleDread 2 , PublicFaith 1 , Loyal 2 , ContentGeneral 3	;command 8, dread 9, loyalty 7, piety 1
			unit		Mongol Bodyguard		exp 6 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
		end

		spawn_army 
			faction mongols
			character	Orjibal, named character, age 25, x 279, y 263, family	;command 8, dread 9, loyalty 7, piety 1
			traits EasternWarlord 1 , GoodCommander 2 , Bloodthirsty 2 , BattleDread 2 , PublicFaith 1 , Loyal 2 , ContentGeneral 3	;command 8, dread 9, loyalty 7, piety 1
			unit		Mongol Bodyguard		exp 6 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
		end

		spawn_army 
			faction mongols
			character	Toqoqan, named character, age 25, x 279, y 261, family	;command 8, dread 9, loyalty 7, piety 1
			traits EasternWarlord 1 , GoodCommander 2 , Bloodthirsty 2 , BattleDread 2 , PublicFaith 1 , Loyal 2 , ContentGeneral 3	;command 8, dread 9, loyalty 7, piety 1
			unit		Mongol Bodyguard		exp 6 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
		end

		spawn_army 
			faction mongols
			character	Yesuk, named character, age 25, x 279, y 260, family	;command 8, dread 9, loyalty 7, piety 1
			traits EasternWarlord 1 , GoodCommander 2 , Bloodthirsty 2 , BattleDread 2 , PublicFaith 1 , Loyal 2 , ContentGeneral 3	;command 8, dread 9, loyalty 7, piety 1
			unit		Mongol Bodyguard		exp 6 armour 0 weapon_lvl 0
			unit		Mongol Heavy Cavalry			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Comon Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Horse Archers			exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Hwy Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
			unit		Mongol Inf Archer	exp 3 armour 0 weapon_lvl 0
		end

terminate_monitor
end_monitor


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;THE CRUSADES;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

declare_counter crusade_jerusalem
set_counter crusade_jerusalem 0

declare_counter crusade_jaffa
set_counter crusade_jaffa 0

declare_counter crusade_acre
set_counter crusade_acre 0

declare_counter crusade_start
set_counter crusade_start 0

declare_counter barbarossa
set_counter barbarossa 0

declare_counter barbarossa_arrived
set_counter barbarossa_arrived 0

declare_counter richard
set_counter richard 0

declare_counter richard_arrived
set_counter richard_arrived 0

declare_counter leopold
set_counter leopold 0

declare_counter leopold_arrived
set_counter leopold_arrived 0

declare_counter frederick
set_counter frederick 0

declare_counter frederick_arrived
set_counter frederick_arrived 0

declare_counter louis
set_counter louis 0

declare_counter louis_arrived
set_counter louis_arrived 0


;;; JERUSALEM STATUS
monitor_event GeneralCaptureSettlement SettlementName Jerusalem
	and FactionReligion islam
	and not I_LocalFaction france

	if I_CompareCounter crusade_jerusalem == 0
		add_events
		    event historic crusade_jerusalem
		    date	0 1
		end_add_events
	end_if

	set_counter crusade_jerusalem 1
	set_counter crusade_start 1
end_monitor

;; JAFFA STATUS
monitor_event GeneralCaptureSettlement SettlementName Jaffa
	and FactionReligion islam
	and not I_LocalFaction france

	set_counter crusade_jaffa 1
	set_counter crusade_start 1
end_monitor

;; ACRE STATUS
monitor_event GeneralCaptureSettlement SettlementName Acre
	and FactionReligion islam
	and not I_LocalFaction france

	set_counter crusade_acre 1
	set_counter crusade_start 1
end_monitor

;; KOJ HAS JERUSALEM
monitor_event FactionTurnStart FactionType france
	and I_SettlementOwner Jerusalem = france

	if I_CompareCounter crusade_jerusalem == 1
		set_counter crusade_jerusalem 0
	end_if
end_monitor


;; BARBAROSSA'S CRUSADE

;; CRUSADE LAUNCHED
monitor_conditions I_TurnNumber > 0
	and I_TurnNumber < 32
	and I_CompareCounter crusade_start == 1
	and I_CompareCounter barbarossa == 0

		add_events
			event historic crusade_launched_barbarossa
			date 1
		end_add_events

	set_counter barbarossa 1
end_monitor

;; CRUSADE ARRIVED
monitor_event EventCounter EventCounterType crusade_launched_barbarossa
	and EventCounter > 0
		add_events
			event historic crusade_arrives_barbarossa
        		date	1 2
		end_add_events
end_monitor

;; SPAWN CRUSADE ARMY
monitor_event EventCounter EventCounterType crusade_arrives_barbarossa
	and EventCounter > 0

	if I_CompareCounter barbarossa_arrived == 0

	;; spawn army in anatolia
		spawn_army
			faction france
			character	Frederick Barbarossa, named character, age 30, x 10, y 127, family
			traits GoodCommander 3 , PublicFaith 1 , Loyal 4
			unit		Barbarossa		exp 9 armour 0 weapon_lvl 0
			unit		koj knights secular				exp 3 armour 0 weapon_lvl 0
			unit		koj knights secular				exp 3 armour 0 weapon_lvl 0
			unit		koj knights surcoat				exp 3 armour 0 weapon_lvl 0
			unit		koj knights surcoat				exp 3 armour 0 weapon_lvl 0
			unit		koj sergeant crossbowmen				exp 1 armour 0 weapon_lvl 0
			unit		koj sergeant crossbowmen				exp 1 armour 0 weapon_lvl 0
			unit		koj sergeant crossbowmen				exp 1 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 1 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 1 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 1 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 1 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 1 armour 0 weapon_lvl 0
			unit		koj armoured men at arms				exp 1 armour 0 weapon_lvl 0
			unit		koj armoured men at arms				exp 1 armour 0 weapon_lvl 0
			unit		koj armoured men at arms				exp 1 armour 0 weapon_lvl 0
			unit		bc catapult				exp 3 armour 0 weapon_lvl 0
			unit		bc catapult				exp 3 armour 0 weapon_lvl 0
			unit		bc trebuchet				exp 3 armour 0 weapon_lvl 0
			unit		bc trebuchet				exp 3 armour 0 weapon_lvl 0
		end

		spawn_army
			faction france
			character	Frederick of Swabia, named character, age 30, x 18, y 128, family
			traits GoodCommander 3 , PublicFaith 1 , Loyal 4
			unit		Frederick		exp 6 armour 0 weapon_lvl 0
			unit		koj knights secular				exp 3 armour 0 weapon_lvl 0
			unit		koj knights secular				exp 3 armour 0 weapon_lvl 0
			unit		koj armoured men at arms				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured men at arms				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured men at arms				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants crossbowmen				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants crossbowmen				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 0 armour 0 weapon_lvl 0
			unit		koj sergeant voulgiers				exp 0 armour 0 weapon_lvl 0
			unit		koj sergeant voulgiers				exp 0 armour 0 weapon_lvl 0
			unit		bc catapult				exp 3 armour 0 weapon_lvl 0
			unit		bc catapult				exp 3 armour 0 weapon_lvl 0
			unit		bc catapult				exp 3 armour 0 weapon_lvl 0
		end

	end_if

		console_command add_money france, 10000

set_counter barbarossa_arrived 1
end_monitor

;; RICHARD'S CRUSADE

;; CRUSADE LAUNCHED
monitor_conditions I_TurnNumber > 32
	and I_TurnNumber < 72
	and I_CompareCounter crusade_start == 1
	and I_CompareCounter richard == 0

		add_events
			event historic crusade_launched_richard
			date 2
		end_add_events

	set_counter richard 1
end_monitor

;; CRUSADE ARRIVED
monitor_event EventCounter EventCounterType crusade_launched_richard
	and EventCounter > 0
		add_events
			event historic crusade_arrives_richard
        		date	1 4
		end_add_events
end_monitor

;; SPAWN ARMY
monitor_event EventCounter EventCounterType crusade_arrives_richard
	and EventCounter > 0

	if I_CompareCounter richard_arrived == 0

	;; spawn at acre
		spawn_army
			faction france
			character	Richard, named character, age 30, x 94, y 113, family
			traits GoodCommander 3 , PublicFaith 1 , Loyal 4
			unit		Richard		exp 9 armour 0 weapon_lvl 0
			unit		aux knights cav					exp 9 armour 0 weapon_lvl 0
			unit		aux knights cav					exp 6 armour 0 weapon_lvl 0
			unit		koj knights secular				exp 3 armour 0 weapon_lvl 0
			unit		koj knights secular				exp 3 armour 0 weapon_lvl 0
			unit		aux christ religion inf				exp 0 armour 0 weapon_lvl 0
			unit		aux christ religion inf 			exp 0 armour 0 weapon_lvl 0
			unit		koj knights dismounted surcoat				exp 4 armour 0 weapon_lvl 0
			unit		koj knights dismounted secular				exp 4 armour 0 weapon_lvl 0
			unit		koj knights dismounted secular				exp 4 armour 0 weapon_lvl 0
			unit		koj armoured sergeants crossbowmen				exp 3 armour 0 weapon_lvl 0
			unit		koj armoured sergeants crossbowmen				exp 3 armour 0 weapon_lvl 0
			unit		turkopole archer				exp 2 armour 0 weapon_lvl 0
			unit		turkopole archer				exp 2 armour 0 weapon_lvl 0
			unit		koj armoured men at arms				exp 5 armour 0 weapon_lvl 0
			unit		koj armoured men at arms				exp 5 armour 0 weapon_lvl 0
			unit		bc catapult				exp 3 armour 0 weapon_lvl 0
			unit		bc catapult				exp 3 armour 0 weapon_lvl 0
			unit		bc trebuchet				exp 3 armour 0 weapon_lvl 0
			unit		bc trebuchet				exp 3 armour 0 weapon_lvl 0
		end

	end_if

		console_command add_money france, 10000

set_counter richard_arrived 1
end_monitor

;; LEOPOLD'S CRUSADE

;; CRUSADE LAUNCHED
monitor_conditions I_TurnNumber > 72
	and I_TurnNumber < 112
	and I_CompareCounter crusade_jerusalem == 1
	and I_CompareCounter leopold == 0

		add_events
			event historic crusade_launched_leopold
			date 1
		end_add_events

	set_counter leopold 1
end_monitor

;; CRUSADE ARRIVED
monitor_event EventCounter EventCounterType crusade_launched_leopold
	and EventCounter > 0
		add_events
			event historic crusade_arrives_leopold
        		date	1 4
		end_add_events
end_monitor

;; SPAWN CRUSADE ARMY
monitor_event EventCounter EventCounterType crusade_arrives_leopold
	and EventCounter > 0

	if I_CompareCounter leopold_arrived == 0

	;; spawn at tyre
		spawn_army
			faction france
			character	Leopold of Germany, named character, age 30, x 94, y 116, family
			traits GoodCommander 3 , PublicFaith 1 , Loyal 4
			unit		leopold				exp 9 armour 0 weapon_lvl 0
			unit		koj knights secular				exp 0 armour 0 weapon_lvl 0
			unit		koj knights secular				exp 0 armour 0 weapon_lvl 0
			unit		koj knights secular				exp 0 armour 0 weapon_lvl 0
			unit		koj knights surcoat				exp 0 armour 0 weapon_lvl 0
			unit		koj knights surcoat				exp 0 armour 0 weapon_lvl 0
			unit		koj knights dismounted templar				exp 0 armour 0 weapon_lvl 0
			unit		koj knights dismounted templar				exp 0 armour 0 weapon_lvl 0
			unit		koj knights dismounted secular				exp 0 armour 0 weapon_lvl 0
			unit		koj knights dismounted secular				exp 0 armour 0 weapon_lvl 0
			unit		koj sergeant crossbowmen				exp 0 armour 0 weapon_lvl 0
			unit		koj sergeant crossbowmen				exp 0 armour 0 weapon_lvl 0
			unit		koj sergeant crossbowmen				exp 0 armour 0 weapon_lvl 0
			unit		koj sergeant crossbowmen				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 0 armour 0 weapon_lvl 0
			unit		bc catapult				exp 3 armour 0 weapon_lvl 0
			unit		bc trebuchet				exp 3 armour 0 weapon_lvl 0
		end

	end_if

		console_command add_money france, 10000

set_counter leopold_arrived 1
end_monitor

;; FREDERICK'S CRUSADE

;; CRUSADE LAUNCHED
monitor_conditions I_TurnNumber > 112
	and I_TurnNumber < 142
	and I_CompareCounter frederick == 0
	and I_CompareCounter crusade_jerusalem == 1

		add_events
			event historic crusade_launched_frederick
			date 1
		end_add_events

	set_counter frederick 1
end_monitor

;; CRUSADE ARRIVED
monitor_event EventCounter EventCounterType crusade_launched_frederick
	and EventCounter > 0
		add_events
			event historic crusade_arrives_frederick
        		date	1 4
		end_add_events
end_monitor

;; SPAWN CRUSADE ARMY
monitor_event EventCounter EventCounterType crusade_arrives_frederick
	and EventCounter > 0

	if I_CompareCounter frederick_arrived == 0

	;; spawn at tripoli
		spawn_army
			faction france
			character	Frederick, named character, age 30, x 93, y 126, family
			traits GoodCommander 3 , PublicFaith 1 , Loyal 4
			unit		leopold				exp 9 armour 0 weapon_lvl 0
			unit		koj knights secular				exp 0 armour 0 weapon_lvl 0
			unit		koj knights secular				exp 0 armour 0 weapon_lvl 0
			unit		koj knights dismounted templar				exp 0 armour 0 weapon_lvl 0
			unit		koj knights dismounted templar				exp 0 armour 0 weapon_lvl 0
			unit		koj knights dismounted secular				exp 0 armour 0 weapon_lvl 0
			unit		koj knights dismounted secular				exp 0 armour 0 weapon_lvl 0
			unit		koj sergeant crossbowmen				exp 0 armour 0 weapon_lvl 0
			unit		koj sergeant crossbowmen				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 0 armour 0 weapon_lvl 0
			unit		koj sergeant men at arms				exp 0 armour 0 weapon_lvl 0
			unit		koj sergeant men at arms				exp 0 armour 0 weapon_lvl 0
			unit		koj sergeant voulgiers				exp 0 armour 0 weapon_lvl 0
			unit		koj sergeant voulgiers				exp 0 armour 0 weapon_lvl 0
			unit		bc catapult				exp 3 armour 0 weapon_lvl 0
			unit		bc catapult				exp 3 armour 0 weapon_lvl 0
			unit		bc catapult				exp 3 armour 0 weapon_lvl 0
		end

	end_if

		console_command add_money france, 10000

set_counter frederick_arrived 1
end_monitor



;; LOUIS' CRUSADE

;; CRUSADE LAUNCHED
monitor_conditions I_TurnNumber > 142
	and I_TurnNumber < 192
	and I_CompareCounter louis == 0
	and I_CompareCounter crusade_jerusalem == 1

		add_events
			event historic crusade_launched_louis
			date 1
		end_add_events

	set_counter louis 1
end_monitor

;; CRUSADE ARRIVED
monitor_event EventCounter EventCounterType crusade_launched_louis
	and EventCounter > 0
		add_events
			event historic crusade_arrives_louis
        		date	1 4
		end_add_events
end_monitor

;; SPAWN CRUSADE ARMY
monitor_event EventCounter EventCounterType crusade_arrives_louis
	and EventCounter > 0

	if I_CompareCounter louis_arrived == 0

	;; spawn at tripoli
		spawn_army
			faction france
			character	Louis of France, named character, age 30, x 77, y 85, family
			traits GoodCommander 3 , PublicFaith 1 , Loyal 4
			unit		leopold				exp 9 armour 0 weapon_lvl 0
			unit		koj knights surcoat				exp 0 armour 0 weapon_lvl 0
			unit		koj knights surcoat				exp 0 armour 0 weapon_lvl 0
			unit		koj knights surcoat				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants crossbowmen				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants crossbowmen				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants crossbowmen				exp 0 armour 0 weapon_lvl 0
			unit		koj sergeant men at arms				exp 0 armour 0 weapon_lvl 0
			unit		koj sergeant men at arms				exp 0 armour 0 weapon_lvl 0
			unit		koj sergeant men at arms				exp 0 armour 0 weapon_lvl 0
			unit		koj sergeant men at arms				exp 0 armour 0 weapon_lvl 0
			unit		koj sergeant voulgiers				exp 0 armour 0 weapon_lvl 0
			unit		koj sergeant voulgiers				exp 0 armour 0 weapon_lvl 0
			unit		koj sergeant voulgiers				exp 0 armour 0 weapon_lvl 0
			unit		koj sergeant voulgiers				exp 0 armour 0 weapon_lvl 0
			unit		aux christ religion inf				exp 0 armour 0 weapon_lvl 0
			unit		aux christ religion inf				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 0 armour 0 weapon_lvl 0
		end
	end_if

		console_command add_money france, 10000

set_counter louis_arrived 1
end_monitor


;;;;;;;;;;;;;;;;;;;;;;;; THE FOURTH CRUSADE
;;;;;;;;;;;;;;;;;;;;;;;; Script uses armies coded in descr_strat under "4th crusade on vacation in Tibet"

declare_counter siegeConstantinople
set_counter siegeConstantinople 0

monitor_event EventCounter EventCounterType fourth_crusade_2
	and EventCounter > 0
	and not I_SettlementOwner Constantinople = slave
	
	add_events
		event	historic	fourth_crusade_3
		date	0 1
		movie	event/Latin_march.bik
	end_add_events
	terminate_monitor
end_monitor

monitor_event EventCounter EventCounterType fourth_crusade_3
	and EventCounter > 0
	and not I_SettlementOwner Constantinople = slave
	
	if I_CharacterExists Doge
		reposition_character Doge, 20, 143
	end_if
	
	if I_CharacterExists ItalianGuy
		reposition_character ItalianGuy, 20, 142
	end_if
	
	set_counter siegeConstantinople 1
	terminate_monitor
end_monitor

monitor_event FactionTurnStart FactionType slave
	and I_CompareCounter siegeConstantinople == 1
	and not I_SettlementOwner Constantinople = slave
	
	if I_CharacterExists Doge
		siege_settlement Doge, Constantinople, maintain
	end_if
	
	if I_CharacterExists ItalianGuy
		siege_settlement ItalianGuy, Constantinople, maintain
	end_if
end_monitor

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AI FACTION STACKS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;ERE
monitor_event FactionTurnStart FactionType byzantium
	and not I_LocalFaction byzantium
	
	spawn_army
		faction byzantium
		character	Armatos, named character, age 30, x 51, y 123, family
		traits GoodCommander 1, Loyal 2, Brave 1
		unit		bodyguard ere				exp 3 armour 0 weapon_lvl 0
	end
	
terminate_monitor
end_monitor

monitor_event PreFactionTurnStart FactionType byzantium
	and I_LocalFaction turks
	
	spawn_army
		faction byzantium
		character	Basil, named character, age 30, x 27, y 128, family
		traits GoodCommander 4, Loyal 2, LoyaltyStarter 1 
		unit		bodyguard ere				exp 3 armour 0 weapon_lvl 0
		unit		ere kataphractoi				exp 2 armour 0 weapon_lvl 0
		unit		ere medium lancer				exp 1 armour 0 weapon_lvl 0
		unit		ere medium swordsmen				exp 1 armour 0 weapon_lvl 0
		unit		ere medium swordsmen				exp 1 armour 0 weapon_lvl 0
		unit		ere medium spearmen				exp 0 armour 0 weapon_lvl 0
		unit		ere medium spearmen				exp 0 armour 0 weapon_lvl 0
		unit		ere pikemen				exp 0 armour 0 weapon_lvl 0
		unit		ere pikemen				exp 0 armour 0 weapon_lvl 0
		unit		ere medium spearmen				exp 1 armour 0 weapon_lvl 0
		unit		ere medium spearmen				exp 1 armour 0 weapon_lvl 0
		unit		ere jav				exp 0 armour 0 weapon_lvl 0
		unit		ere jav				exp 0 armour 0 weapon_lvl 0
		unit		ere archer				exp 0 armour 0 weapon_lvl 0
		unit		ere archer				exp 0 armour 0 weapon_lvl 0
		unit		ere archer				exp 0 armour 0 weapon_lvl 0
		unit		ere archer				exp 0 armour 0 weapon_lvl 0
	end

	spawn_army
		faction byzantium
		character	Dragos, named character, age 30, x 29, y 128, family
		traits GoodCommander 2, Loyal 2, LoyaltyStarter 1 
		unit		bodyguard ere				exp 3 armour 0 weapon_lvl 0
		unit		ere kataphractoi				exp 2 armour 0 weapon_lvl 0
		unit		ere medium lancer				exp 1 armour 0 weapon_lvl 0
		unit		ere medium swordsmen				exp 1 armour 0 weapon_lvl 0
		unit		ere medium swordsmen				exp 1 armour 0 weapon_lvl 0
		unit		ere medium spearmen				exp 0 armour 0 weapon_lvl 0
		unit		ere medium spearmen				exp 0 armour 0 weapon_lvl 0
		unit		ere light spearmen				exp 0 armour 0 weapon_lvl 0
		unit		ere light spearmen				exp 0 armour 0 weapon_lvl 0
		unit		ere light spearmen				exp 0 armour 0 weapon_lvl 0
		unit		ere light spearmen				exp 0 armour 0 weapon_lvl 0
		unit		ere jav				exp 0 armour 0 weapon_lvl 0
		unit		ere jav				exp 0 armour 0 weapon_lvl 0
		unit		ere archer				exp 0 armour 0 weapon_lvl 0
		unit		ere archer				exp 0 armour 0 weapon_lvl 0
	end
	
	console_command add_money byzantium 20000

terminate_monitor
end_monitor

;Turks
monitor_event PreFactionTurnStart FactionType turks
	and not I_LocalFaction turks
	
	spawn_army
		faction turks
		character	Murad, named character, age 30, x 53, y 138, family
		traits GoodCommander 4, Loyal 2, LoyaltyStarter 1 
		unit		bodyguard turks				exp 3 armour 0 weapon_lvl 0
		unit		ghulams elite				exp 3 armour 0 weapon_lvl 0
		unit		ghulam medium cavalry				exp 3 armour 0 weapon_lvl 0
		unit		ghulam medium cavalry				exp 3 armour 0 weapon_lvl 0
		unit		ghulam medium ha				exp 3 armour 0 weapon_lvl 0
		unit		ghulam medium ha				exp 3 armour 0 weapon_lvl 0
		unit		turks ghazis				exp 2 armour 0 weapon_lvl 0
		unit		turks ghazis				exp 2 armour 0 weapon_lvl 0
		unit		turks ghazis				exp 2 armour 0 weapon_lvl 0
		unit		turks ghazis				exp 2 armour 0 weapon_lvl 0
		unit		turkoman medium archer cavalry regular bow				exp 3 armour 0 weapon_lvl 0
		unit		turkoman medium archer cavalry regular bow				exp 3 armour 0 weapon_lvl 0
		unit		turkoman light archer cavalry regular bow				exp 2 armour 0 weapon_lvl 0
		unit		turkoman light archer cavalry regular bow				exp 2 armour 0 weapon_lvl 0
	end
	
	console_command add_money turks, 5000
	
terminate_monitor
end_monitor

monitor_event PreFactionTurnStart FactionType turks
	and I_LocalFaction byzantium

	spawn_army
		faction turks
		character	Gunduz, named character, age 30, x 52, y 138, family
		traits GoodCommander 4, Loyal 2, LoyaltyStarter 1 
		unit		bodyguard turks				exp 3 armour 0 weapon_lvl 0
		unit		ghulams elite				exp 3 armour 0 weapon_lvl 0
		unit		ghulam medium cavalry				exp 3 armour 0 weapon_lvl 0
		unit		ghulam medium cavalry				exp 3 armour 0 weapon_lvl 0
		unit		ghulam medium ha				exp 3 armour 0 weapon_lvl 0
		unit		aor anatolian axmen				exp 2 armour 0 weapon_lvl 0
		unit		aor anatolian axmen				exp 2 armour 0 weapon_lvl 0
		unit		aor anatolian axmen				exp 2 armour 0 weapon_lvl 0
		unit		turks ghazis				exp 2 armour 0 weapon_lvl 0
		unit		turks ghazis				exp 2 armour 0 weapon_lvl 0
		unit		turkoman medium archer cavalry regular bow				exp 3 armour 0 weapon_lvl 0
		unit		turkoman medium archer cavalry regular bow				exp 3 armour 0 weapon_lvl 0
		unit		turkoman light archer cavalry regular bow				exp 2 armour 0 weapon_lvl 0
		unit		turkoman light archer cavalry regular bow				exp 2 armour 0 weapon_lvl 0
	end
	
	console_command add_money turks, 5000
	
terminate_monitor
end_monitor

;KOJ
monitor_event PreFactionTurnStart FactionType france
	and I_LocalFaction egypt
	
	spawn_army
		faction france
		character	Jobert de Beaufort, named character, age 30, x 94, y 106, family
		traits GoodCommander 3, Loyal 1, LoyaltyStarter 1, Intelligent 2, ReligionStarter 1, BattleChivalry 1
			unit		bodyguard jerusalem				exp 3 armour 0 weapon_lvl 0
			unit		aux knights cav				exp 3 armour 0 weapon_lvl 0
			unit		aux knights cav				exp 3 armour 0 weapon_lvl 0
			unit		koj armoured sergeants crossbowmen				exp 3 armour 0 weapon_lvl 0
			unit		koj armoured sergeants crossbowmen				exp 3 armour 0 weapon_lvl 0
			unit		koj sergeant men at arms				exp 0 armour 3 weapon_lvl 0
			unit		koj sergeant men at arms				exp 0 armour 3 weapon_lvl 0
			unit		aux christ religion inf				exp 0 armour 0 weapon_lvl 0
			unit		aux christ religion inf				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 0 armour 0 weapon_lvl 0
	end
	
	console_command add_money france, 8000
	
terminate_monitor
end_monitor

monitor_event PreFactionTurnStart FactionType france
	and I_LocalFaction moors
	
	spawn_army
		faction france
		character	Jobert de Beaufort, named character, age 30, x 94, y 106, family
		traits GoodCommander 3, Loyal 1, LoyaltyStarter 1, Intelligent 2, ReligionStarter 1, BattleChivalry 1
			unit		bodyguard jerusalem				exp 3 armour 0 weapon_lvl 0
			unit		aux knights cav				exp 3 armour 0 weapon_lvl 0
			unit		aux knights cav				exp 3 armour 0 weapon_lvl 0
			unit		koj armoured sergeants crossbowmen				exp 3 armour 0 weapon_lvl 0
			unit		koj armoured sergeants crossbowmen				exp 3 armour 0 weapon_lvl 0
			unit		koj sergeant men at arms				exp 0 armour 3 weapon_lvl 0
			unit		koj sergeant men at arms				exp 0 armour 3 weapon_lvl 0
			unit		aux christ religion inf				exp 0 armour 0 weapon_lvl 0
			unit		aux christ religion inf				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 0 armour 0 weapon_lvl 0
			unit		koj armoured sergeants spearmen				exp 0 armour 0 weapon_lvl 0
	end
	
	console_command add_money france, 8000
	
terminate_monitor
end_monitor

;Ayyubids
monitor_event PreFactionTurnStart FactionType egypt
	and not I_LocalFaction egypt
	
	spawn_army
		faction egypt
		character	Fahim, named character, age 30, x 112, y 115, family
		traits GoodCommander 3 , Loyal 3, LoyaltyStarter 1 
		unit		bodyguard ayyubids				exp 6 armour 0 weapon_lvl 0
		unit		ayyubid askari cavalry				exp 5 armour 0 weapon_lvl 0
		unit		ayyubid qara cavalry archer				exp 4 armour 0 weapon_lvl 0
		unit		ayyubid askari axemen				exp 4 armour 0 weapon_lvl 0
		unit		ayyubid askari infantry				exp 4 armour 0 weapon_lvl 0
		unit		aux arab archer				exp 3 armour 0 weapon_lvl 0
		unit		aux arab archer				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid ajnad macemen				exp 2 armour 0 weapon_lvl 0
		unit		ayyubid ajnad macemen				exp 2 armour 0 weapon_lvl 0
		unit		ayyubid ajnad spearmen				exp 2 armour 0 weapon_lvl 0
		unit		ayyubid ajnad spearmen				exp 2 armour 0 weapon_lvl 0
		unit		ayyubid ajnad spearmen				exp 2 armour 0 weapon_lvl 0
		unit		bc trebuchet				exp 3 armour 0 weapon_lvl 0
		unit		bc trebuchet				exp 3 armour 0 weapon_lvl 0
	end
	
	console_command add_money egypt, 8000
	
terminate_monitor
end_monitor

;Armenia
monitor_event PreFactionTurnStart FactionType poland
	and not I_LocalFaction poland
	
	spawn_army
		faction poland
		character	Kachig, named character, age 27, x 85, y 148
		traits GoodCommander 2 , Loyal 3, LoyaltyStarter 1 
		unit		bodyguard armenia				exp 6 armour 0 weapon_lvl 0
		unit		armenian nakharar				exp 5 armour 0 weapon_lvl 0
		unit		armenian nakharar				exp 5 armour 0 weapon_lvl 0
		unit		armenian javcav				exp 4 armour 0 weapon_lvl 0
		unit		armenian javcav				exp 4 armour 0 weapon_lvl 0
		unit		armenian medium horsearchers				exp 4 armour 0 weapon_lvl 0
		unit		armenian medium horsearchers				exp 4 armour 0 weapon_lvl 0
		unit		armenian medium spearmen				exp 4 armour 0 weapon_lvl 0
		unit		armenian heavy infantry				exp 4 armour 0 weapon_lvl 0
		unit		armenian medium archers				exp 3 armour 0 weapon_lvl 0
		unit		armenian medium javinfantry				exp 3 armour 0 weapon_lvl 0
		unit		armenian light spearmen				exp 3 armour 0 weapon_lvl 0
		unit		armenian light axemen				exp 2 armour 0 weapon_lvl 0
		unit		armenian light archers				exp 2 armour 0 weapon_lvl 0
	end
	
	console_command add_money poland, 8000
	
terminate_monitor
end_monitor

;Georgia
monitor_event PreFactionTurnStart FactionType england
	and not I_LocalFaction england
	
terminate_monitor
end_monitor

;Makuria
monitor_event PreFactionTurnStart FactionType scotland
	and not I_LocalFaction scotland
	
	spawn_army
		faction scotland
		character	Egnathius, named character, age 25, x 85, y 9, family
		traits GoodCommander 3 , Loyal 2, LoyaltyStarter 1
		unit		bodyguard makuria				exp 5 armour 0 weapon_lvl 0
		unit		makuria light cavalry				exp 3 armour 0 weapon_lvl 0
		unit		makuria light cavalry				exp 3 armour 0 weapon_lvl 0
		unit		makuria light cavalry				exp 3 armour 0 weapon_lvl 0
		unit		makuria light cavalry				exp 3 armour 0 weapon_lvl 0
		unit		makuria light spearmen				exp 2 armour 0 weapon_lvl 0
		unit		makuria light spearmen				exp 2 armour 0 weapon_lvl 0
		unit		makuria light spearmen				exp 2 armour 0 weapon_lvl 0
		unit		makuria light spearmen				exp 2 armour 0 weapon_lvl 0
		unit		makuria levy longbowmen				exp 1 armour 0 weapon_lvl 0
		unit		makuria levy longbowmen				exp 1 armour 0 weapon_lvl 0
	end
	
	console_command add_money scotland, 8000
	
terminate_monitor
end_monitor

;Kypchack
monitor_event PreFactionTurnStart FactionType portugal
	and not I_LocalFaction portugal
	
	spawn_army
			faction portugal
			character	Alkaevli, named character, age 30, x 102, y 237, family
			traits GoodCommander 4, Intelligent 2, ReligionStarter 1, BattleChivalry 3, StrategyChivalry 3, Loyal 3
			unit		bodyguard kypchaks				exp 6 armour 0 weapon_lvl 0
			unit		kypchak medium lancers				exp 2 armour 0 weapon_lvl 0
			unit		kypchak medium lancers				exp 2 armour 0 weapon_lvl 0
			unit		kypchak slavs cavalry				exp 1 armour 0 weapon_lvl 0
			unit		kypchak slavs cavalry				exp 1 armour 0 weapon_lvl 0
			unit		kypchak slavs spearmen				exp 0 armour 0 weapon_lvl 0
			unit		kypchak slavs spearmen				exp 0 armour 0 weapon_lvl 0
			unit		kypchak slavs spearmen				exp 0 armour 0 weapon_lvl 0
			unit		kypchak slavs spearmen				exp 0 armour 0 weapon_lvl 0
			unit		turkoman northern light horse archer				exp 0 armour 0 weapon_lvl 0
			unit		turkoman northern light horse archer				exp 0 armour 0 weapon_lvl 0
			unit		turkoman northern light horse archer				exp 0 armour 0 weapon_lvl 0
			unit		turkoman northern light horse archer				exp 0 armour 0 weapon_lvl 0
		end

		spawn_army
			faction portugal
			character	Argu, named character, age 30, x 95, y 249, family
			traits GoodCommander 4, Intelligent 2, ReligionStarter 1, BattleChivalry 3, StrategyChivalry 3, Loyal 3
			unit		bodyguard kypchaks				exp 6 armour 0 weapon_lvl 0
			unit		kypchak medium lancers				exp 2 armour 0 weapon_lvl 0
			unit		kypchak medium lancers				exp 2 armour 0 weapon_lvl 0
			unit		kypchak slavs cavalry				exp 1 armour 0 weapon_lvl 0
			unit		kypchak slavs cavalry				exp 1 armour 0 weapon_lvl 0
			unit		kypchak slavs spearmen				exp 0 armour 0 weapon_lvl 0
			unit		kypchak slavs spearmen				exp 0 armour 0 weapon_lvl 0
			unit		kypchak slavs spearmen				exp 0 armour 0 weapon_lvl 0
			unit		kypchak slavs spearmen				exp 0 armour 0 weapon_lvl 0
			unit		turkoman northern light horse archer				exp 0 armour 0 weapon_lvl 0
			unit		turkoman northern light horse archer				exp 0 armour 0 weapon_lvl 0
			unit		turkoman northern light horse archer				exp 0 armour 0 weapon_lvl 0
			unit		turkoman northern light horse archer				exp 0 armour 0 weapon_lvl 0
		end
	
	console_command add_money portugal, 12000
	
terminate_monitor
end_monitor

;Abbasid
monitor_event PreFactionTurnStart FactionType moors
	and not I_LocalFaction moors
	
terminate_monitor
end_monitor

;Oman
monitor_event PreFactionTurnStart FactionType denmark
	and not I_LocalFaction denmark
	
	spawn_army
			faction denmark
			character	Fawzan, named character, age 27, x 287, y 123
			traits LoyaltyStarter 1, GoodCommander 4, ReligionStarter 1, BattleChivalry 3, Loyal 3
			unit		bodyguard oman				exp 6 armour 0 weapon_lvl 0
			unit		oman medium lancers				exp 5 armour 0 weapon_lvl 0
			unit		oman javcav				exp 4 armour 0 weapon_lvl 0
			unit		oman light lancers				exp 4 armour 0 weapon_lvl 0
			unit		oman medium archers				exp 3 armour 0 weapon_lvl 0
			unit		oman light archers				exp 3 armour 0 weapon_lvl 0
			unit		oman dismounted javcav				exp 4 armour 0 weapon_lvl 0
			unit		oman heavy swordsmen				exp 4 armour 0 weapon_lvl 0
			unit		oman medium spearmen				exp 4 armour 0 weapon_lvl 0
			unit		oman light spearmen				exp 3 armour 0 weapon_lvl 0
	end
	
	console_command add_money denmark, 7000
	
terminate_monitor
end_monitor

;Seljuks
monitor_event PreFactionTurnStart FactionType russia
	and not I_LocalFaction russia
	
	spawn_army
			faction russia
			character	Toghtekin, named character, age 27, x 193, y 173
			traits LoyaltyStarter 1, GoodCommander 2, ReligionStarter 1, BattleChivalry 1, Loyal 3
			unit		bodyguard seljuks				exp 6 armour 0 weapon_lvl 0
			unit		ghulams elite				exp 5 armour 0 weapon_lvl 0
			unit		ghulams elite ha				exp 5 armour 0 weapon_lvl 0
			unit		aor iraq nobles				exp 4 armour 0 weapon_lvl 0
			unit		aux arab swordsmen				exp 4 armour 0 weapon_lvl 0
			unit		aux arab swordsmen				exp 4 armour 0 weapon_lvl 0
			unit		turkoman heavy bowman				exp 4 armour 0 weapon_lvl 0
			unit		turkoman medium bowman				exp 4 armour 0 weapon_lvl 0
			unit		turkoman light bowman				exp 4 armour 0 weapon_lvl 0
			unit		turkoman heavy macemen				exp 4 armour 0 weapon_lvl 0
			unit		turkoman medium swordsmen				exp 3 armour 0 weapon_lvl 0
			unit		turkoman medium swordsmen				exp 3 armour 0 weapon_lvl 0
	end
	
	console_command add_money russia, 12000
	
terminate_monitor
end_monitor

;Kwarzem
monitor_event PreFactionTurnStart FactionType spain
	and not I_LocalFaction spain
	
	spawn_army
			faction spain
			character	Gharajeh, named character, age 23, x 242, y 249
			traits LoyaltyStarter 1, GoodCommander 2, ReligionStarter 1, BattleChivalry 1, Loyal 3
			unit		bodyguard khwarezm				exp 6 armour 0 weapon_lvl 0
			unit		khwarezm fullcat lancer				exp 5 armour 0 weapon_lvl 0
			unit		khwarezm heavy cavalry				exp 5 armour 0 weapon_lvl 0
			unit		persian lancers				exp 4 armour 0 weapon_lvl 0
			unit		turkoman eastern light horse archer				exp 4 armour 0 weapon_lvl 0
			unit		persian spearmen				exp 4 armour 0 weapon_lvl 0
			unit		persian spearmen				exp 4 armour 0 weapon_lvl 0
			unit		persian swordsmen				exp 4 armour 0 weapon_lvl 0
			unit		persian swordsmen				exp 4 armour 0 weapon_lvl 0
			unit		persian archer				exp 4 armour 0 weapon_lvl 0
			unit		persian archer				exp 3 armour 0 weapon_lvl 0
	end
	
	console_command add_money spain, 15000
	
terminate_monitor
end_monitor

;Ghorid
monitor_event PreFactionTurnStart FactionType milan
	and not I_LocalFaction milan
	and I_SettlementOwner Lahore = milan
	
terminate_monitor
end_monitor

;Ghazni
monitor_event PreFactionTurnStart FactionType venice
	and not I_LocalFaction venice
	
terminate_monitor
end_monitor

;Chauhan
monitor_event PreFactionTurnStart FactionType aztecs
	and not I_LocalFaction aztecs
	
terminate_monitor
end_monitor

;Sindh 
monitor_event PreFactionTurnStart FactionType hungary
	and not I_LocalFaction hungary
	
	spawn_army
		faction hungary
		character	Khaira, named character, age 25, x 356, y 165, family
		traits GoodCommander 4, Loyal 4, ReligionStarter 1
		unit		bodyguard sindh				exp 3 armour 0 weapon_lvl 0
		unit		sindh medium cavalry				exp 2 armour 0 weapon_lvl 0
		unit		sindh medium cavalry				exp 2 armour 0 weapon_lvl 0
		unit		sindh light spearman				exp 0 armour 0 weapon_lvl 0
		unit		sindh light spearman				exp 0 armour 0 weapon_lvl 0
		unit		punjab sindh spearmen				exp 0 armour 0 weapon_lvl 0
		unit		punjab sindh spearmen				exp 0 armour 0 weapon_lvl 0
		unit		punjab javelinmen				exp 0 armour 0 weapon_lvl 0
		unit		punjab javelinmen				exp 0 armour 0 weapon_lvl 0
	end
	
	console_command add_money hungary, 5000
	
terminate_monitor
end_monitor

;Rajput
monitor_event PreFactionTurnStart FactionType sicily
	and not I_LocalFaction sicily
	
terminate_monitor
end_monitor

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CALL OF THE HORDE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

monitor_conditions I_TurnNumber > 0
	and I_SettlementOwner Aqmesqit = portugal
	and I_SettlementOwner Belgorod = portugal
	and I_SettlementOwner Caffa = portugal
	and I_SettlementOwner Kiev = portugal
	and I_SettlementOwner Kursk = portugal
	and I_SettlementOwner Ryazan = portugal
	and I_SettlementOwner Samandar = portugal
	and I_SettlementOwner Saqsin = portugal

	add_events
		event	historic kypchak_horde
		date	1
	end_add_events

;;Sarkel
	spawn_army
		faction portugal
		character	Bartan, named character, age 30, x 80, y 227, family
		traits GoodCommander 3 , Loyal 3
		unit		bodyguard kypchaks				exp 4 armour 0 weapon_lvl 0
		unit		kypchak elite lancers				exp 3 armour 0 weapon_lvl 0
		unit		kypchak elite lancers				exp 3 armour 0 weapon_lvl 0
		unit		kypchak elite lancers				exp 3 armour 0 weapon_lvl 0
		unit		kypchak medium horse archer				exp 0 armour 0 weapon_lvl 0
		unit		kypchak medium horse archer				exp 0 armour 0 weapon_lvl 0
		unit		kypchak medium horse archer				exp 0 armour 0 weapon_lvl 0
		unit		kypchak medium horse archer				exp 0 armour 0 weapon_lvl 0
		unit		turkoman northern light horse archer				exp 0 armour 0 weapon_lvl 0
		unit		turkoman northern light horse archer				exp 0 armour 0 weapon_lvl 0
		unit		turkoman northern light horse archer				exp 0 armour 0 weapon_lvl 0
		unit		turkoman northern light horse archer				exp 0 armour 0 weapon_lvl 0
		unit		kypchak heavy bowman				exp 3 armour 0 weapon_lvl 0
		unit		kypchak heavy bowman				exp 3 armour 0 weapon_lvl 0
		unit		kypchak heavy bowman				exp 3 armour 0 weapon_lvl 0
		unit		kypchak slavs swordsmen				exp 4 armour 0 weapon_lvl 0
		unit		kypchak slavs swordsmen				exp 4 armour 0 weapon_lvl 0
		unit		kypchak slavs swordsmen				exp 4 armour 0 weapon_lvl 0
		unit		kypchak slavs swordsmen				exp 4 armour 0 weapon_lvl 0
	end
	spawn_army
		faction portugal
		character	Kaizuk, named character, age 30, x 91, y 230, family
		traits GoodCommander 3 , Loyal 3
		unit		bodyguard kypchaks				exp 4 armour 0 weapon_lvl 0
		unit		bodyguard kypchaks				exp 4 armour 0 weapon_lvl 0
		unit		kypchak elite lancers				exp 3 armour 0 weapon_lvl 0
		unit		kypchak elite lancers				exp 3 armour 0 weapon_lvl 0
		unit		kypchak elite lancers				exp 3 armour 0 weapon_lvl 0
		unit		kypchak medium horse archer				exp 0 armour 0 weapon_lvl 0
		unit		kypchak medium horse archer				exp 0 armour 0 weapon_lvl 0
		unit		kypchak medium horse archer				exp 0 armour 0 weapon_lvl 0
		unit		kypchak medium horse archer				exp 0 armour 0 weapon_lvl 0
		unit		turkoman northern light horse archer				exp 0 armour 0 weapon_lvl 0
		unit		turkoman northern light horse archer				exp 0 armour 0 weapon_lvl 0
		unit		turkoman northern light horse archer				exp 0 armour 0 weapon_lvl 0
		unit		turkoman northern light horse archer				exp 0 armour 0 weapon_lvl 0
		unit		kypchak heavy bowman				exp 3 armour 0 weapon_lvl 0
		unit		kypchak heavy bowman				exp 3 armour 0 weapon_lvl 0
		unit		kypchak heavy bowman				exp 3 armour 0 weapon_lvl 0
		unit		kypchak slavs swordsmen				exp 4 armour 0 weapon_lvl 0
		unit		kypchak slavs swordsmen				exp 4 armour 0 weapon_lvl 0
		unit		kypchak slavs swordsmen				exp 4 armour 0 weapon_lvl 0
		unit		kypchak slavs swordsmen				exp 4 armour 0 weapon_lvl 0
	end

		console_command add_money portugal, 10000
terminate_monitor
end_monitor


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CALL OF THE CRUSADE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

declare_counter call_of_the_crusade
set_counter call_of_the_crusade 0


;; TEST IF EGYPT IS STRONG
declare_counter egypt_is_strong
set_counter egypt_is_strong 0

monitor_event FactionTurnStart FactionType egypt
	and I_SettlementOwner Qahira = egypt
	and I_SettlementOwner Damascus = egypt
	and I_SettlementOwner Hama = egypt
	and I_SettlementOwner Damyut = egypt
	and I_SettlementOwner Homs = egypt
	and I_SettlementOwner Baalbek = egypt
	and I_SettlementOwner Gaza = egypt

		set_counter egypt_is_strong 1
end_monitor

monitor_event FactionTurnStart FactionType egypt
	and not I_SettlementOwner Damascus = egypt
		set_counter egypt_is_strong 0
end_monitor

monitor_event FactionTurnStart FactionType egypt
	and not I_SettlementOwner Qahira = egypt
		set_counter egypt_is_strong 0
end_monitor


;; CALL CRUSADE
monitor_event SettlementTurnStart SettlementName Jerusalem
	and SettlementBuildingExists = crusade_city
	and I_LocalFaction france

	if RandomPercent <= 5
		set_counter call_of_the_crusade 1
	end_if

	if I_NumberOfSettlements france <= 4
		set_counter call_of_the_crusade 1
	end_if

	if I_CompareCounter egypt_is_strong = 1
		set_counter call_of_the_crusade 1
	end_if

	if I_SettlementOwner Jerusalem = egypt
		set_counter call_of_the_crusade 1
	end_if

	if I_SettlementOwner Antioch = egypt
		set_counter call_of_the_crusade 1
	end_if

	if I_SettlementOwner Acre = egypt
		set_counter call_of_the_crusade 1
	end_if

	if I_SettlementOwner Jaffa = egypt
		set_counter call_of_the_crusade 1
	end_if

terminate_monitor
end_monitor

monitor_event SettlementTurnStart SettlementName Acre
	and SettlementBuildingExists = crusade_castle
	and I_LocalFaction france

	if RandomPercent <= 5
		set_counter call_of_the_crusade 1
	end_if

	if I_NumberOfSettlements france <= 4
		set_counter call_of_the_crusade 1
	end_if

	if I_CompareCounter egypt_is_strong = 1
		set_counter call_of_the_crusade 1
	end_if

	if I_SettlementOwner Jerusalem = egypt
		set_counter call_of_the_crusade 1
	end_if

	if I_SettlementOwner Antioch = egypt
		set_counter call_of_the_crusade 1
	end_if

	if I_SettlementOwner Acre = egypt
		set_counter call_of_the_crusade 1
	end_if

	if I_SettlementOwner Jaffa = egypt
		set_counter call_of_the_crusade 1
	end_if

terminate_monitor
end_monitor

monitor_event SettlementTurnStart SettlementName Antioch
	and SettlementBuildingExists = crusade_city
	and I_LocalFaction france

	if RandomPercent <= 5
		set_counter call_of_the_crusade 1
	end_if

	if I_NumberOfSettlements france <= 4
		set_counter call_of_the_crusade 1
	end_if

	if I_CompareCounter egypt_is_strong = 1
		set_counter call_of_the_crusade 1
	end_if

	if I_SettlementOwner Jerusalem = egypt
		set_counter call_of_the_crusade 1
	end_if

	if I_SettlementOwner Antioch = egypt
		set_counter call_of_the_crusade 1
	end_if

	if I_SettlementOwner Acre = egypt
		set_counter call_of_the_crusade 1
	end_if

	if I_SettlementOwner Jaffa = egypt
		set_counter call_of_the_crusade 1
	end_if

terminate_monitor
end_monitor

monitor_event SettlementTurnStart SettlementName Jaffa
	and SettlementBuildingExists = crusade_city
	and I_LocalFaction france

	if RandomPercent <= 5
		set_counter call_of_the_crusade 1
	end_if

	if I_NumberOfSettlements france <= 4
		set_counter call_of_the_crusade 1
	end_if

	if I_CompareCounter egypt_is_strong = 1
		set_counter call_of_the_crusade 1
	end_if

	if I_SettlementOwner Jerusalem = egypt
		set_counter call_of_the_crusade 1
	end_if

	if I_SettlementOwner Antioch = egypt
		set_counter call_of_the_crusade 1
	end_if

	if I_SettlementOwner Acre = egypt
		set_counter call_of_the_crusade 1
	end_if

	if I_SettlementOwner Jaffa = egypt
		set_counter call_of_the_crusade 1
	end_if

terminate_monitor
end_monitor


;; CALL OF THE CRUSADE 1st PERIOD
monitor_conditions I_TurnNumber > 0
	and I_TurnNumber < 32
	and I_LocalFaction france
	and I_CompareCounter call_of_the_crusade == 1

		add_events
			event historic crusade_launched_barbarossa
			date 1
		end_add_events

	set_counter call_of_the_crusade 0
terminate_monitor
end_monitor

;; CALL OF THE CRUSADE 2nd PERIOD
monitor_conditions I_TurnNumber > 32
	and I_TurnNumber < 72
	and I_LocalFaction france
	and I_CompareCounter call_of_the_crusade == 1

		add_events
			event historic crusade_launched_richard
			date 1
		end_add_events

	set_counter call_of_the_crusade 0
terminate_monitor
end_monitor

;; CALL OF THE CRUSADE 3rd PERIOD
monitor_conditions I_TurnNumber > 72
	and I_TurnNumber < 112
	and I_LocalFaction france
	and I_CompareCounter call_of_the_crusade == 1

		add_events
			event historic crusade_launched_leopold
			date 1
		end_add_events

	set_counter call_of_the_crusade 0
terminate_monitor
end_monitor

;; CALL OF THE CRUSADE 4th PERIOD
monitor_conditions I_TurnNumber > 112
	and I_TurnNumber < 142
	and I_LocalFaction france
	and I_CompareCounter call_of_the_crusade == 1

		add_events
			event historic crusade_launched_frederick
			date 1
		end_add_events

	set_counter call_of_the_crusade 0
terminate_monitor
end_monitor

;; CALL OF THE CRUSADE 5th PERIOD
monitor_conditions I_TurnNumber > 142
	and I_TurnNumber < 192
	and I_LocalFaction france
	and I_CompareCounter call_of_the_crusade == 1

		add_events
			event historic crusade_launched_louis
			date 1
		end_add_events

	set_counter call_of_the_crusade 0
terminate_monitor
end_monitor


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAPTURE MESSAGES;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; CONSTANTINOPLE
monitor_event GeneralCaptureSettlement SettlementName Constantinople
	and FactionReligion islam
		add_events
		    event historic fateh_constantinople
		    date	0 0
		    movie	event/turks-const.bik
		end_add_events
terminate_monitor
end_monitor

monitor_event GeneralCaptureSettlement SettlementName Constantinople
	and FactionType france
		add_events
		    event historic latin_constantinople
		    date	0 0
		    movie	Latin_burn.bik
		end_add_events
terminate_monitor
end_monitor

;; JERUSALEM
monitor_event GeneralCaptureSettlement SettlementName Jerusalem
	and FactionType Egypt
		add_events
		    event historic jerusalem_captured
		    date	0 0
		    movie	event/Jerusalem.bik
		end_add_events
terminate_monitor
end_monitor

;; DELHI
monitor_event GeneralCaptureSettlement SettlementName Delhi
	and FactionType milan
		add_events
		    event historic muslim_delhi
		    date	0 0
		    movie	event/Delhi.bik
		end_add_events
terminate_monitor
end_monitor

monitor_event GeneralCaptureSettlement SettlementName Delhi
	and FactionType venice
		add_events
		    event historic muslim_delhi
		    date	0 0
		end_add_events
terminate_monitor
end_monitor

;; BADGHDAD
monitor_event GeneralCaptureSettlement SettlementName Baghdad
	and FactionType russia
		add_events
		    event historic muslim_baghdad
		    date	0 0
		    movie	event/baghdad.bik
		end_add_events
terminate_monitor
end_monitor

monitor_event GeneralCaptureSettlement SettlementName Baghdad
	and FactionType mongols
		add_events
		    event historic mongol_baghdad
		    date	0 0
		end_add_events
terminate_monitor
end_monitor


;; QAHIRA
monitor_event GeneralCaptureSettlement SettlementName Qahira
	and FactionType france
		add_events
		    event historic latin_qahira
		    date	0 0
		    movie	event/Cairo.bik
		end_add_events
terminate_monitor
end_monitor

;; MECCA
monitor_event GeneralCaptureSettlement SettlementName Mecca
	and FactionType france
		add_events
		    event historic latin_mecca
		    date	0 0
		    movie	event/mecca.bik
		end_add_events
terminate_monitor
end_monitor


;; GHAZNI
monitor_event GeneralCaptureSettlement SettlementName Ghazni
	and FactionType Venice
		add_events
		    event historic Ghazni_Ghazni
		    date	0 0
		    movie	event/Ghazni_recaptured.bik
		end_add_events
terminate_monitor
end_monitor

;; GHOR
monitor_event GeneralCaptureSettlement SettlementName Ghor
	and FactionType Spain
		add_events
		    event historic Khw_Firuzkuh
		    date	0 0
		    movie	event/khware.bik
		end_add_events
terminate_monitor
end_monitor


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAMLUK RISING;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

monitor_conditions I_TurnNumber > 152
	and not I_LocalFaction egypt

		add_events
		    event historic mamluk_rising
		    date	0 0
		end_add_events

	spawn_army
		faction egypt
		character	Baybars, named character, age 30, x 81, y 65, family
		traits GoodCommander 4 , Loyal 4 , BattleDread 3 , StrategyDread 2 
		unit		ayyubid mamluk cavalry				exp 9 armour 0 weapon_lvl 0
		unit		ayyubid mamluk cavalry				exp 9 armour 0 weapon_lvl 0
		unit		ayyubid mamluk cavalry				exp 9 armour 0 weapon_lvl 0
		unit		ayyubid mamluk cavalry				exp 9 armour 0 weapon_lvl 0
		unit		ayyubid tawashi cavalry				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid tawashi cavalry				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid mamluk cavalry archer				exp 4 armour 0 weapon_lvl 0
		unit		ayyubid mamluk cavalry archer				exp 4 armour 0 weapon_lvl 0
		unit		ayyubid mamluk cavalry archer				exp 4 armour 0 weapon_lvl 0
		unit		ayyubid mamluk cavalry archer				exp 4 armour 0 weapon_lvl 0
		unit		ayyubid qara cavalry archer				exp 4 armour 0 weapon_lvl 0
		unit		ayyubid qara cavalry archer				exp 4 armour 0 weapon_lvl 0
		unit		ayyubid mamluk axemen				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid mamluk axemen				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid mamluk axemen				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid mamluk axemen				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid mamluk archer				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid mamluk archer				exp 3 armour 0 weapon_lvl 0
		unit		bc catapult				exp 3 armour 0 weapon_lvl 0
		unit		bc catapult				exp 3 armour 0 weapon_lvl 0
	end

	spawn_army
		faction egypt
		character	Qutuz, named character, age 30, x 82, y 65, family
		traits GoodCommander 4 , Loyal 4 , BattleDread 3 , StrategyDread 2  
		unit		ayyubid mamluk cavalry				exp 9 armour 0 weapon_lvl 0
		unit		ayyubid mamluk cavalry				exp 9 armour 0 weapon_lvl 0
		unit		ayyubid mamluk cavalry				exp 9 armour 0 weapon_lvl 0
		unit		ayyubid mamluk cavalry				exp 9 armour 0 weapon_lvl 0
		unit		ayyubid tawashi cavalry				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid tawashi cavalry				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid mamluk cavalry archer				exp 4 armour 0 weapon_lvl 0
		unit		ayyubid mamluk cavalry archer				exp 4 armour 0 weapon_lvl 0
		unit		ayyubid mamluk cavalry archer				exp 4 armour 0 weapon_lvl 0
		unit		ayyubid mamluk cavalry archer				exp 4 armour 0 weapon_lvl 0
		unit		ayyubid qara cavalry archer				exp 4 armour 0 weapon_lvl 0
		unit		ayyubid qara cavalry archer				exp 4 armour 0 weapon_lvl 0
		unit		ayyubid mamluk axemen				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid mamluk axemen				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid mamluk axemen				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid mamluk axemen				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid mamluk archer				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid mamluk archer				exp 3 armour 0 weapon_lvl 0
		unit		bc catapult				exp 3 armour 0 weapon_lvl 0
		unit		bc catapult				exp 3 armour 0 weapon_lvl 0
	end

	spawn_army
		faction egypt
		character	Turanshah, named character, age 30, x 83, y 65, family
		traits GoodCommander 4 , Loyal 4 , BattleDread 3 , StrategyDread 2  
		unit		ayyubid mamluk cavalry				exp 9 armour 0 weapon_lvl 0
		unit		ayyubid mamluk cavalry				exp 9 armour 0 weapon_lvl 0
		unit		ayyubid mamluk cavalry				exp 9 armour 0 weapon_lvl 0
		unit		ayyubid mamluk cavalry				exp 9 armour 0 weapon_lvl 0
		unit		ayyubid tawashi cavalry				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid tawashi cavalry				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid tawashi cavalry				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid tawashi cavalry				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid mamluk cavalry archer				exp 4 armour 0 weapon_lvl 0
		unit		ayyubid mamluk cavalry archer				exp 4 armour 0 weapon_lvl 0
		unit		ayyubid mamluk cavalry archer				exp 4 armour 0 weapon_lvl 0
		unit		ayyubid mamluk cavalry archer				exp 4 armour 0 weapon_lvl 0
		unit		ayyubid mamluk axemen				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid mamluk axemen				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid mamluk axemen				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid mamluk axemen				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid mamluk archer				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid mamluk archer				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid mamluk archer				exp 3 armour 0 weapon_lvl 0
		unit		ayyubid mamluk archer				exp 3 armour 0 weapon_lvl 0
	end

terminate_monitor
end_monitor

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OSMANI RISING;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

monitor_conditions I_TurnNumber > 232
	and not I_LocalFaction turks

		add_events
		    event historic osmani_rising
		    date	0 0
		end_add_events

	spawn_army
		faction turks
		character	Osman, named character, age 22, x 75, y 150, family
		traits GoodCommander 4 , Loyal 4 , BattleChivalry 3 , StrategyChivalry 2 
		unit		bodyguard turks				exp 9 armour 0 weapon_lvl 0
		unit		turks sipahi lancers				exp 7 armour 0 weapon_lvl 0
		unit		turks sipahi lancers				exp 7 armour 0 weapon_lvl 0
		unit		turks timariot lancers				exp 7 armour 0 weapon_lvl 0
		unit		turks timariot lancers				exp 7 armour 0 weapon_lvl 0
		unit		turks timariot axemen				exp 6 armour 0 weapon_lvl 0
		unit		turks timariot axemen				exp 6 armour 0 weapon_lvl 0
		unit		turks timariot axemen				exp 6 armour 0 weapon_lvl 0
		unit		turks ghazis				exp 9 armour 0 weapon_lvl 0
		unit		turks ghazis				exp 9 armour 0 weapon_lvl 0
		unit		turks ghazis				exp 9 armour 0 weapon_lvl 0
		unit		turks ghazis				exp 9 armour 0 weapon_lvl 0
		unit		turks janissary infantry				exp 9 armour 0 weapon_lvl 0
		unit		turks janissary infantry				exp 9 armour 0 weapon_lvl 0
		unit		turks janissary infantry				exp 9 armour 0 weapon_lvl 0
		unit		turks janissary archers				exp 9 armour 0 weapon_lvl 0
		unit		turks janissary archers				exp 9 armour 0 weapon_lvl 0
		unit		turks janissary archers				exp 9 armour 0 weapon_lvl 0
		unit		bc catapult				exp 3 armour 0 weapon_lvl 0
		unit		bc catapult				exp 3 armour 0 weapon_lvl 0
	end

	spawn_army
		faction turks
		character	Dundar, named character, age 42, x 73, y 150, family
		traits GoodCommander 4 , Loyal 4 , BattleChivalry 3 , StrategyChivalry 2 
		unit		bodyguard turks				exp 9 armour 0 weapon_lvl 0
		unit		turks sipahi lancers				exp 7 armour 0 weapon_lvl 0
		unit		turks sipahi lancers				exp 7 armour 0 weapon_lvl 0
		unit		turks sipahi horse archers				exp 7 armour 0 weapon_lvl 0
		unit		turks sipahi horse archers				exp 7 armour 0 weapon_lvl 0
		unit		turks timariot lancers				exp 7 armour 0 weapon_lvl 0
		unit		turks timariot lancers				exp 7 armour 0 weapon_lvl 0
		unit		turks timariot axemen				exp 6 armour 0 weapon_lvl 0
		unit		turks timariot axemen				exp 6 armour 0 weapon_lvl 0
		unit		turks sipahi infantry				exp 7 armour 0 weapon_lvl 0
		unit		turks sipahi infantry				exp 7 armour 0 weapon_lvl 0
		unit		turks sipahi infantry				exp 7 armour 0 weapon_lvl 0
		unit		turks janissary infantry				exp 9 armour 0 weapon_lvl 0
		unit		turks janissary infantry				exp 9 armour 0 weapon_lvl 0
		unit		turks janissary infantry				exp 9 armour 0 weapon_lvl 0
		unit		turks janissary archers				exp 9 armour 0 weapon_lvl 0
		unit		turks janissary archers				exp 9 armour 0 weapon_lvl 0
		unit		turks janissary archers				exp 9 armour 0 weapon_lvl 0
		unit		bc catapult				exp 3 armour 0 weapon_lvl 0
		unit		bc catapult				exp 3 armour 0 weapon_lvl 0
	end

	spawn_army
		faction turks
		character	Orhan, named character, age 32, x 72, y 150, family
		traits GoodCommander 4 , Loyal 4 , BattleChivalry 3 , StrategyChivalry 2 
		unit		bodyguard turks				exp 9 armour 0 weapon_lvl 0
		unit		turks sipahi lancers				exp 7 armour 0 weapon_lvl 0
		unit		turks sipahi lancers				exp 7 armour 0 weapon_lvl 0
		unit		turks sipahi horse archers				exp 7 armour 0 weapon_lvl 0
		unit		turks sipahi horse archers				exp 7 armour 0 weapon_lvl 0
		unit		turks timariot axemen				exp 6 armour 0 weapon_lvl 0
		unit		turks timariot axemen				exp 6 armour 0 weapon_lvl 0
		unit		turks sipahi infantry				exp 7 armour 0 weapon_lvl 0
		unit		turks sipahi infantry				exp 7 armour 0 weapon_lvl 0
		unit		turks sipahi infantry				exp 7 armour 0 weapon_lvl 0
		unit		turks ghazis				exp 9 armour 0 weapon_lvl 0
		unit		turks ghazis				exp 9 armour 0 weapon_lvl 0
		unit		turks janissary infantry				exp 9 armour 0 weapon_lvl 0
		unit		turks janissary infantry				exp 9 armour 0 weapon_lvl 0
		unit		turks janissary infantry				exp 9 armour 0 weapon_lvl 0
		unit		turks janissary infantry				exp 9 armour 0 weapon_lvl 0
		unit		turks janissary archers				exp 9 armour 0 weapon_lvl 0
		unit		turks janissary archers				exp 9 armour 0 weapon_lvl 0
		unit		turks janissary archers				exp 9 armour 0 weapon_lvl 0
		unit		turks janissary archers				exp 9 armour 0 weapon_lvl 0
	end

terminate_monitor
end_monitor

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SALADIN ATTACKS DAMASCUS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

declare_counter SaladinDamascus1
set_counter SaladinDamascus1 0

monitor_event PreFactionTurnStart FactionType egypt
	and I_IsFactionAIControlled egypt
	
	generate_random_counter SaladinDamascus2 0 4
	terminate_monitor
end_monitor

monitor_event CharacterTurnStart FactionType egypt
	and I_IsFactionAIControlled egypt

	if I_EventCounter SaladinDamascus2 > 0
		create_unit Saladin1, ayyubid tawashi cavalry, num 2, exp 6, arm 0, wep 0
		create_unit Saladin1, ayyubid askari axemen, num 1, exp 5, arm 0, wep 0
		create_unit Saladin1, ayyubid tawashi infantry, num 1, exp 5, arm 0, wep 0
		create_unit Saladin1, ayyubid askari infantry, num 1, exp 4, arm 0, wep 0
		create_unit Saladin1, ayyubid qara archer, num 2, exp 4, arm 0, wep 0
		create_unit Saladin1, ayyubid ajnad macemen, num 2, exp 3, arm 0, wep 0
		create_unit Saladin1, ayyubid ajnad spearmen, num 2, exp 3, arm 0, wep 0
		reposition_character Saladin1, 110, 114
		set_counter SaladinDamascus1 1
		terminate_monitor
	end_if
end_monitor

monitor_event CharacterTurnEnd FactionType egypt
	and I_IsFactionAIControlled egypt
	and I_EventCounter SaladinDamascus2 > 0
	and I_CharacterTypeNearTile egypt named_character, 0 110, 114
	
		siege_settlement Saladin1, Damascus, maintain
	terminate_monitor
end_monitor

monitor_event CharacterTurnStart FactionType egypt
	and IsBesieging
	and I_IsFactionAIControlled egypt
	and I_EventCounter SaladinDamascus2 > 0

	if I_CharacterExists Saladin1
		siege_settlement Saladin1, Damascus, attack
	end_if
	terminate_monitor
end_monitor


wait_monitors

end_script