script

	restrict_strat_radar false
	
	;monitor_event FactionTurnStart FactionIsLocal
	;   console_command toggle_perfect_spy
	;end_monitor
	
	;console_command toggle_fow
	;console_command show_cursorstat
	
		declare_counter ui_showing
	monitor_event ShortcutTriggered ShortcutTriggered object_manager hide_gui
		wait 0.1
		if I_CompareCounter ui_showing = 0
			hide_ui
			disable_movie_view
			set_counter ui_showing 2
		end_if
		if I_CompareCounter ui_showing = 1
			show_ui
			set_counter ui_showing 0
		end_if
		if I_CompareCounter ui_showing = 2
			set_counter ui_showing 1
		end_if
	end_monitor

	monitor_event FactionTurnEnd FactionType slave
		hide_all_revealed_tiles
	end_monitor

	;#############################################################################################################################
	;##########################  Inhaltsverzeichnis ##############################################################################
	;#############################################################################################################################      

	;#### I.		Counter
	;#### II.		Vier Jahreszeiten
	;#### III. 		Willkommensevent
	;#### IV.		Papstmodell/Stratmodelle
	;#### V. 		Unterstützung für Computergegner
	;#### VI. 		Forderungen der Gläubiger
	;#### VII. 		Schwarze Bande
	;#### VIII. 		Unsterbliches Papsttum (gelöscht)
	;#### IX. 		Dürre auf Sizilien
	;#### X. 		Hexenjagd
	;#### XI. 		Inquisition in Neapel (gelöscht)
	;#### XII. 		Verrat von Novara
	;#### XIII. 		Schweizer Reformation
	;#### XIV. 		Johannes Calvin
	;#### XV.		Venedigs Flotte
	;#### XVI.		Eroberung Budas
	;#### XVII.		Sacco di Roma
	;#### XVIII.		Eroberung von Tunis
	;#### XIX.		Diverse Skripte Osmanen (gelöscht)
	;#### XX.		Doppelte Buchführung
	;#### XXI.		Feuer der Eitelkeiten
	;#### XXII.		Vater der Landsknechte (gelöscht, siehe  "Schweizerkrieg")
	;#### XXIII.		Casa Contratacion
	;#### XXIV.		Wächter des Papstes
	;#### XXV.		Die Fugger
	;#### XXVI.		Der Fürst
	;#### XXVII.		Armer Konrad
	;#### XXVIII.		Vorboten des Sturms (gelöscht)
	;#### XXIX.		Reinheitsgebot
	;#### XXX.		Martin Luther
	;#### XXXI.		Ritterkrieg
	;#### XXXII. 		Angriff der Osmanen
	;#### XXXIII.		Bauernkrieg (Siehe: Neue Scripte von Vlad)
	;#### XXXIV.		Belagerung Neapels (gelöscht)
	;#### XXXV.		Belagerung Wiens
	;#### XXXVI. 		Unterdrückung der Hugenotten
	;#### XXXVII. 		Jesuiten
	;#### XXXVIII.		Sublimus Dei
	;#### XXXIX.		Andreas Vesalius
	;#### XXXX.		Potosi (gelöscht)
	;#### XXXXI. 		Augsburger Religionsfrieden
	;#### XXXXII. 		Frieden von Cateau Cambresis
	;#### XXXXIII.		Rebellion in Afrika
	;#### XXXXIV. 		Seuchen
	;#### XXXXV.		Garnisionsskript (gelöscht)
	;------------------------------------------------------------------------------
	;---------------------- Weitere Scripte von Neadal ----------------------------
	;------------------------------------------------------------------------------
	;---------------------- Papst erwählen
	;---------------------- Unabhängigkeit Ragusa
	;---------------------- Unabhängigkeit Genua
	;---------------------- Unabhängigkeit Gaeta
	;---------------------- Unabhängigkeit Ancona
	;---------------------- Johanniter Unterstützung
	;---------------------- Abwesenheit des Sultans
	;---------------------- Verstärkung aus Spanien
	;---------------------- Herrschaften und Seerepubliken
	;---------------------- Übergabe von Noli
	;---------------------- Vasallenschaft von Neapel
	;---------------------- Piratenplage (verworfen)
	;---------------------- Akinjis (verworfen)
	;---------------------- Feldkosten
	;---------------------- Darlehen
	;---------------------- Söldnerunwesen
	;----------------------  + Existenz der Söldner prüfen
	;----------------------  + Söldnercharaktere prüfen
	;---------------------- Condotta-Script (not included)
	;----------------------  + Condotta-Events (not included)
	;----------------------  + Condotta-Action Tracking (not included)
	;---------------------- Rekrutierungsbeschränkung (nicht implementiert)
	;------------------------------------------------------------------------------
	;---------------------- Events Ragusa -----------------------------------------
	;------------------------------------------------------------------------------
	;------------------------------------------------------------------------------
	;---------------------- Events Ferrara ----------------------------------------
	;------------------------------------------------------------------------------
	;------------------------------------------------------------------------------
	;---------------------- Events Mantua -----------------------------------------
	;------------------------------------------------------------------------------
	;------------------------------------------------------------------------------
	;---------------------- Events Genua ------------------------------------------
	;------------------------------------------------------------------------------
	;------------------------------------------------------------------------------
	;---------------------- Events Hafsiden ---------------------------------------
	;------------------------------------------------------------------------------
	;------------------------------------------------------------------------------
	;---------------------- Events Savoyen ----------------------------------------
	;------------------------------------------------------------------------------
	;------------------------------------------------------------------------------
	;---------------------- Events Montferrat -------------------------------------
	;------------------------------------------------------------------------------
	;------------------------------------------------------------------------------
	;---------------------- Events Urbino -----------------------------------------
	;------------------------------------------------------------------------------
	;------------------------------------------------------------------------------
	;---------------------- Events Siena ------------------------------------------
	;------------------------------------------------------------------------------
	;---------------------- Bürgerkrieg (deaktiviert)
	;------------------------------------------------------------------------------
	;---------------------- Events Schwaben ---------------------------------------
	;------------------------------------------------------------------------------
	;---------------------- Schweizerkrieg
	;---------------------- Landshuter Erbfolgekrieg
	;---------------------- Raubritter
	;---------------------- Armer Konrad
	;---------------------- Ritterkrieg
	;---------------------- Bauernkrieg
	;---------------------- Reformation
	;---------------------- Unterstützung für Habsburg
	;---------------------- Türkenhilfe
	;------------------------------------------------------------------------------
	;---------------------- Events Florenz  ---------------------------------------
	;------------------------------------------------------------------------------
	;---------------------- Drohung des Papstes
	;---------------------- Hinrichtung Savonarola
	;---------------------- Wiedereinsetzung der Medici
	;---------------------- Aufstand gegen die Medici
	;---------------------- Machiavelli Miliz
	;---------------------- Der Krieg mit Pisa
	;---------------------- Eroberung der Toskana
	;------------------------------------------------------------------------------
	;---------------------- Events GHZ Toskana ------------------------------------
	;------------------------------------------------------------------------------
	;---------------------- Aufstand der Republikaner
	;---------------------- Strafgericht
	;---------------------- Unterstützung gegen Frankreich
	;------------------------------------------------------------------------------
	;---------------------- Events Osmanen ----------------------------------------
	;------------------------------------------------------------------------------
	;---------------------- Untergang des Mamelukenreichs 
	;---------------------- Eroberung Belgrads
	;---------------------- Seeschlacht von Preveza (nicht eingebaut)
	;---------------------- Ban von Bosnien
	;---------------------- Fall von Rhodos
	;---------------------- Nordafrika
	;---------------------- Expansionsscripte
	;---------------------- Respawn
	;------------------------------------------------------------------------------
	;---------------------- Events Ungarn -----------------------------------------
	;------------------------------------------------------------------------------
	;---------------------- Fall von Sinj
	;---------------------- Fall von Bihac
	;---------------------- Auflösung Serbiens
	;---------------------- Belagerung Kanizas
	;---------------------- Niedergang Ungarns (nicht eingebaut)
	;---------------------- Polnische Unterstützung (gelöscht)
	;------------------------------------------------------------------------------
	;---------------------- Neue Scripte von Iskar --------------------------------
	;------------------------------------------------------------------------------
	;---------------------- Trockendocks
	;---------------------- Radschloss
	;---------------------- Mimar Sinan
	;---------------------- Kopernikus
	;---------------------- Verstärkung für Grossmächte
	;------------------------------------------------------------------------------
	;---------------------- Neue Scripte von Vlad ---------------------------------
	;------------------------------------------------------------------------------
	;---------------------- Eroberung Neapels
	;---------------------- Taschenuhr
	;---------------------- Einfall Englands (Siehe Englands Kriegseintritt)
	;---------------------- Comuneros Aufstand
	;---------------------- Siebenbürgen in Gefahr
	;---------------------- Schweizerkrieg
	;---------------------- Waldseemüllers Weltkarte
	;---------------------- Rhinocerus
	;---------------------- Königswahl Gustav Wasas
	;---------------------- Englischer Schweiß
	;---------------------- Täuferreich von Münster
	;---------------------- Ankunft in Tanegashima
	;---------------------- Eroberung von Kasan
	;---------------------- Eroberung Mexikos
	;---------------------- Korsar des Königs
	;---------------------- Bauernkriege
	;---------------------- Ritter ohne Furcht und Tadel
	;---------------------- Kampf den Orsini
	;---------------------- Petersdom
	;------------------------------------------------------------------------------
	;---------------------- Früher Kampagnenverlauf
	;------------------------------------------------------------------------------
	;---------------------- Italienzug von Charles
	;---------------------- Liga von Venedig
	;---------------------- Allianz von Blois
	;---------------------- Liga von Cambrai
	;---------------------- Veneto-Päpstliche Allianz
	;---------------------- Heilige Liga
	;---------------------- Veneto-Französische Allianz
	;----------------------  + KI-Armee Spawn für Liga-Events
	;------------------------------------------------------------------------------
	;---------------------- Mittlerer Kampagnenverlauf
	;------------------------------------------------------------------------------
	;---------------------- Der Vertrag von Granada
	;---------------------- Der Kaiser ist tot..
	;---------------------- ...lang lebe der Kaiser!
	;---------------------- Krieg von 1521 - 1526
	;---------------------- + Auftakt
	;---------------------- + Englands Kriegseintritt
	;---------------------- + Der Fall Bourbon
	;---------------------- + Eine ungewöhnliche Allianz
	;---------------------- + Der Vertrag von Madrid
	;------------------------------------------------------------------------------
	;---------------------- Späterer Kampagnenverlauf
	;------------------------------------------------------------------------------
	;---------------------- Liga von Cognac
	;------------------------------------------------------------------------------
	;---------------------- KI-Expansion
	;---------------------- Zustätzliche Fraktionsanführertitel
	;---------------------- Erbentitel entfernen
	;---------------------- Bischofzähler
	;---------------------- Log-Hilfe
	;---------------------- Auto-Win Osmanen (gelöscht)
	;---------------------- Einzigartigkeit Montfort, Waldburg, La Giulia
	;---------------------- Testen Fraktion am Leben?
	;---------------------- Log-Hilfe
	;---------------------- BAD AI Germanicus


	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Counter
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


	declare_counter Spieler_ist_Venedig
	declare_counter Spieler_ist_Spanien
	declare_counter Spieler_ist_Frankreich
	declare_counter Spieler_ist_HRR
	declare_counter Spieler_ist_Mailand
	declare_counter Spieler_ist_Ungarn
	declare_counter Spieler_ist_Papststaaten
	declare_counter Spieler_ist_Schweiz
	declare_counter Spieler_ist_Florenz
	declare_counter Spieler_ist_Neapel
	declare_counter Spieler_ist_Turken
	declare_counter Spieler_ist_Schwaben
	declare_counter Spieler_ist_Genua
	declare_counter Spieler_ist_Mantua
	declare_counter Spieler_ist_Modena
	declare_counter Spieler_ist_Siena
	declare_counter Spieler_ist_Ragusa
	declare_counter Spieler_ist_Hafsid
	declare_counter Spieler_ist_Savoyen
	declare_counter Spieler_ist_Montferrat
	declare_counter Spieler_ist_Urbino
	declare_counter Spieler_ist_Lucca
	declare_counter Spieler_ist_Bologna

	declare_counter Innsbruck_belagert
	declare_counter Wien_belagert
	declare_counter Augsburg_belagert
	declare_counter Mulhouse_belagert
	declare_counter Dijon_belagert
	declare_counter Lyon_belagert
	declare_counter Marseille_belagert
	declare_counter Neapel_belagert
	declare_counter Palermo_belagert
	declare_counter Bari_belagert
	declare_counter Malta_belagert
	declare_counter Venezia_belagert
	declare_counter Verona_belagert
	declare_counter Ragusa_belagert
	declare_counter Rome_belagert
	declare_counter Bologna_belagert
	declare_counter Benevento_belagert
	declare_counter Avignon_belagert
	declare_counter Milano_belagert
	declare_counter Genua_belagert
	declare_counter Parma_belagert
	declare_counter Bastia_belagert
	declare_counter Buda_belagert
	declare_counter Zagreb_belagert
	declare_counter Pressburg_belagert
	declare_counter Zurich_belagert
	declare_counter Tunis_belagert
	declare_counter Bern_belagert
	declare_counter Qusantina_belagert
	declare_counter Florenz_belagert
	declare_counter Salzburg_belagert
	declare_counter Spoleto_belagert
	declare_counter Otranto_belagert
	declare_counter Bonifacio_belagert
	declare_counter Genf_belagert
	declare_counter Chur_belagert

	declare_counter Belagerung_Wien
	declare_counter Belagerung_Neapel
	declare_counter Belagerung_Mulhouse
	declare_counter Belagerung_Salzburg
	declare_counter Belagerung_Augsburg
	declare_counter Belagerung_Freiburg
	declare_counter Belagerung_Otranto
	declare_counter Belagerung_Tunis
	declare_counter Belagerung_Afrika
	declare_counter Belagerung_Jajce
	declare_counter Belagerung_Mailand

	declare_counter Zahlung_sehr_hoch
	declare_counter Zahlung_hoch
	declare_counter Zahlung_normal
	declare_counter Zahlung_gering
	declare_counter Zahlung_erlassen




	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Vier Jahreszeiten
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	declare_counter quarter
	set_counter quarter 1 ;set to January

	monitor_event PreFactionTurnStart FactionIsLocal ; set the season for each quarter
		if I_CompareCounter quarter == 1 ;Jan, Feb, March
			console_command season winter
		end_if

		if I_CompareCounter quarter == 2 ;April, May, June
			console_command season summer
		end_if

		if I_CompareCounter quarter == 3 ;July, Aug, Sept
			console_command season summer
		end_if

		if I_CompareCounter quarter == 4 ;Oct, Nov, Dec
			console_command season winter
		end_if

		inc_counter quarter 1 ;advance the quarter
		if I_CompareCounter quarter == 5 ;start a new year
			set_counter quarter 1
		end_if
	end_monitor

	monitor_event FactionTurnEnd FactionType slave
		and I_CompareCounter quarter > 1
		console_command season summer
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Willkommensevent
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart I_TurnNumber = 0			
		
		if I_LocalFaction normans                   ;Swabia
			historic_event welcome_normans
			set_counter Spieler_ist_Schwaben 1
		end_if

		if I_LocalFaction poland                   ;Florence
			historic_event welcome_florenz
			set_counter Spieler_ist_Florenz 1
		end_if

		if I_LocalFaction sicily                   ;Naples
			historic_event welcome_neapel
			set_counter Spieler_ist_Neapel 1
		end_if
		
		if I_LocalFaction venice                   ;Venice
			historic_event welcome_venice
			set_counter Spieler_ist_Venedig 1
		end_if

		if I_LocalFaction spain                   ;Spain
			historic_event welcome_spain
			set_counter Spieler_ist_Spanien 1
		end_if

		if I_LocalFaction france                   ;France
			historic_event welcome_france
			set_counter Spieler_ist_Frankreich 1
		end_if

		if I_LocalFaction hre                   ;HRE
			historic_event welcome_hre
			set_counter Spieler_ist_HRR 1
		end_if

		if I_LocalFaction milan                   ;Milan
			historic_event welcome_milan
			set_counter Spieler_ist_Mailand 1
		end_if

		if I_LocalFaction turks                   ;Ottomans
			historic_event welcome_turks
			set_counter Spieler_ist_Turken 1
		end_if

		if I_LocalFaction hungary                   ;Hungary
			historic_event welcome_hungary
			set_counter Spieler_ist_Ungarn 1
		end_if

		if I_LocalFaction papal_states                   ;Papal States
			historic_event welcome_papal_states
			set_counter Spieler_ist_Papststaaten 1
		end_if

		if I_LocalFaction saxons                   ;Swiss
			historic_event welcome_saxons
			set_counter Spieler_ist_Schweiz 1
		end_if

		if I_LocalFaction denmark                   ;Genoa
			historic_event welcome_genua
			set_counter Spieler_ist_Genua 1
		end_if

		if I_LocalFaction byzantium                   ;Mantua
			historic_event welcome_mantua
			set_counter Spieler_ist_Mantua 1
		end_if

		if I_LocalFaction england                   ;Ferrara
			historic_event welcome_modena
			set_counter Spieler_ist_Modena 1
		end_if

		if I_LocalFaction russia                   ;Siena
			historic_event welcome_siena
			set_counter Spieler_ist_Siena 1
		end_if

		if I_LocalFaction scotland                   ;Ragusa
			historic_event welcome_ragusa
			set_counter Spieler_ist_Ragusa 1
		end_if

		if I_LocalFaction egypt                   ;Hafsids
			historic_event welcome_hafsid
			set_counter Spieler_ist_Hafsid 1
		end_if

		if I_LocalFaction savoy                   ;Savoy
			historic_event welcome_savoy
			set_counter Spieler_ist_Savoyen 1
		end_if

		if I_LocalFaction montferrat                   ;Montferrat
			historic_event welcome_montferrat
			set_counter Spieler_ist_Montferrat 1
		end_if

		if I_LocalFaction timurids                   ;Bologna
			historic_event welcome_bologna
			set_counter Spieler_ist_Bologna 1
		end_if

		if I_LocalFaction urbino                   ;Urbino
			historic_event welcome_urbino
			set_counter Spieler_ist_Urbino 1
		end_if

		if I_LocalFaction lucca                   ;Lucca
			historic_event welcome_lucca
			set_counter Spieler_ist_Lucca 1
		end_if

		set_event_counter catholic 1                   ;Counter sets catholic temple building tree available for the current player        
													   ;Needed later to differ from Protestantism 
		terminate_monitor
	end_monitor	


	
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Unterstützung für Computergegner
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart FactionType france	;Frankreich
		and not I_LocalFaction france
		and Treasury < 12000
		and I_NumberOfSettlements france < 10
		if I_TurnNumber >= 0
			and I_TurnNumber <= 50
			console_command add_money france, 15000
		end_if
		if I_TurnNumber >= 51
			and I_TurnNumber <= 200
			console_command add_money france, 10000
		end_if
	end_monitor

	monitor_event FactionTurnStart FactionType hre		;HRR
		and not I_LocalFaction hre
		and Treasury < 5000
		and I_NumberOfSettlements hre < 10
		if I_TurnNumber >= 0
			and I_TurnNumber <= 50
			console_command add_money hre, 30000
		end_if
		if I_TurnNumber >= 51
			and I_TurnNumber <= 200
			console_command add_money hre, 10000
		end_if
	end_monitor

	monitor_event FactionTurnStart FactionType turks	;Türken
		and not I_LocalFaction turks
		and Treasury < 5000
		and I_NumberOfSettlements turks > 10

		console_command add_money turks, 15000
	end_monitor

	monitor_event FactionTurnStart FactionType slave		;Rebellen
		and Treasury < 12000
		and I_NumberOfSettlements slave < 10
		if I_TurnNumber >= 0
			and I_TurnNumber <= 50
			console_command add_money slave, 15000
		end_if
		if I_TurnNumber >= 51
			and I_TurnNumber <= 200
			console_command add_money slave, 10000
		end_if
	end_monitor
	
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;               Forderungen der Gläubiger
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	monitor_event FactionTurnStart FactionType sicily       ;Neapel
		and I_LocalFaction sicily   
		and Treasury > 35000
		and I_TurnNumber > 80

		generate_random_counter outcome 1 5

		if I_EventCounter outcome = 1
			console_command add_money sicily    , -50000
			historic_event payback_very_high
		end_if


		if I_EventCounter outcome = 2
			console_command add_money sicily    , -25000
			historic_event payback_high
		end_if

		if I_EventCounter outcome = 3
			console_command add_money sicily    , -15000
			historic_event payback_normal
		end_if

		if I_EventCounter outcome = 4
			console_command add_money sicily    , -7500
			historic_event payback_little
		end_if

		if I_EventCounter outcome = 5
			historic_event payback_not
		end_if

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType poland       ;Florenz
		and I_LocalFaction poland   
		and Treasury > 35000
		and I_TurnNumber > 80

		generate_random_counter outcome 1 5

		if I_EventCounter outcome = 1
			console_command add_money poland    , -50000
			historic_event payback_very_high
		end_if

		if I_EventCounter outcome = 2
			console_command add_money poland    , -25000
			historic_event payback_high
		end_if

		if I_EventCounter outcome = 3
			console_command add_money poland    , -15000
			historic_event payback_normal
		end_if

		if I_EventCounter outcome = 4
			console_command add_money poland    , -7500
			historic_event payback_little
		end_if

		if I_EventCounter outcome = 5
			historic_event payback_not
		end_if

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType france       ;Frankreich
		and I_LocalFaction france   
		and Treasury > 35000
		and I_TurnNumber > 80

		generate_random_counter outcome 1 5

		if I_EventCounter outcome = 1
			console_command add_money france    , -50000
			historic_event payback_very_high
		end_if

		if I_EventCounter outcome = 2
			console_command add_money france    , -25000
			historic_event payback_high
		end_if

		if I_EventCounter outcome = 3
			console_command add_money france    , -15000
			historic_event payback_normal
		end_if

		if I_EventCounter outcome = 4
			console_command add_money france    , -7500
			historic_event payback_little
		end_if

		if I_EventCounter outcome = 5
			historic_event payback_not
		end_if

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType hre      ;HRR
		and I_LocalFaction hre  
		and Treasury > 35000
		and I_TurnNumber > 80

		generate_random_counter outcome 1 5

		if I_EventCounter outcome = 1
			console_command add_money hre    , -50000
			historic_event payback_very_high
		end_if

		if I_EventCounter outcome = 2
			console_command add_money hre    , -25000
			historic_event payback_high
		end_if

		if I_EventCounter outcome = 3
			console_command add_money hre    , -15000
			historic_event payback_normal
		end_if

		if I_EventCounter outcome = 4
			console_command add_money hre    , -7500
			historic_event payback_little
		end_if

		if I_EventCounter outcome = 5
			historic_event payback_not
		end_if

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType spain        ;Spanien
		and I_LocalFaction spain    
		and Treasury > 35000
		and I_TurnNumber > 80

		generate_random_counter outcome 1 5

		if I_EventCounter outcome = 1
			console_command add_money spain    , -50000
			historic_event payback_very_high
		end_if

		if I_EventCounter outcome = 2
			console_command add_money spain    , -25000
			historic_event payback_high
		end_if

		if I_EventCounter outcome = 3
			console_command add_money spain    , -15000
			historic_event payback_normal
		end_if

		if I_EventCounter outcome = 4
			console_command add_money spain    , -7500
			historic_event payback_little
		end_if

		if I_EventCounter outcome = 5
			historic_event payback_not
		end_if

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType hungary      ;Ungarn
		and I_LocalFaction hungary  
		and Treasury > 35000
		and I_TurnNumber > 80

		generate_random_counter outcome 1 5

		if I_EventCounter outcome = 1
			console_command add_money hungary    , -50000
			historic_event payback_very_high
		end_if

		if I_EventCounter outcome = 2
			console_command add_money hungary    , -25000
			historic_event payback_high
		end_if

		if I_EventCounter outcome = 3
			console_command add_money hungary    , -15000
			historic_event payback_normal
		end_if

		if I_EventCounter outcome = 4
			console_command add_money hungary    , -7500
			historic_event payback_little
		end_if

		if I_EventCounter outcome = 5
			historic_event payback_not
		end_if

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType papal_states     ;Papststaaten
		and I_LocalFaction papal_states 
		and Treasury > 35000
		and I_TurnNumber > 80

		generate_random_counter outcome 1 5

		if I_EventCounter outcome = 1
			console_command add_money papal_states    , -50000
			historic_event payback_very_high
		end_if

		if I_EventCounter outcome = 2
			console_command add_money papal_states    , -25000
			historic_event payback_high
		end_if

		if I_EventCounter outcome = 3
			console_command add_money papal_states    , -15000
			historic_event payback_normal
		end_if

		if I_EventCounter outcome = 4
			console_command add_money papal_states    , -7500
			historic_event payback_little
		end_if

		if I_EventCounter outcome = 5
			historic_event payback_not
		end_if

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType venice       ;Venedig
		and I_LocalFaction venice   
		and Treasury > 35000
		and I_TurnNumber > 80

		generate_random_counter outcome 1 5

		if I_EventCounter outcome = 1
			console_command add_money venice    , -50000
			historic_event payback_very_high
		end_if

		if I_EventCounter outcome = 2
			console_command add_money venice    , -25000
			historic_event payback_high
		end_if

		if I_EventCounter outcome = 3
			console_command add_money venice    , -15000
			historic_event payback_normal
		end_if

		if I_EventCounter outcome = 4
			console_command add_money venice    , -7500
			historic_event payback_little
		end_if

		if I_EventCounter outcome = 5
			historic_event payback_not
		end_if

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType milan        ;Mailand
		and I_LocalFaction milan    
		and Treasury > 35000
		and I_TurnNumber > 80

		generate_random_counter outcome 1 5

		if I_EventCounter outcome = 1
			console_command add_money milan   , -50000
			historic_event payback_very_high
		end_if

		if I_EventCounter outcome = 2
			console_command add_money milan    , -25000
			historic_event payback_high
		end_if

		if I_EventCounter outcome = 3
			console_command add_money milan    , -15000
			historic_event payback_normal
		end_if

		if I_EventCounter outcome = 4
			console_command add_money milan    , -7500
			historic_event payback_little
		end_if

		if I_EventCounter outcome = 5
			historic_event payback_not
		end_if

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType saxons       ;Schweiz
		and I_LocalFaction saxons   
		and Treasury > 35000
		and I_TurnNumber > 80

		generate_random_counter outcome 1 5

		if I_EventCounter outcome = 1
			console_command add_money saxons    , -50000
			historic_event payback_very_high
		end_if

		if I_EventCounter outcome = 2
			console_command add_money saxons    , -25000
			historic_event payback_high
		end_if

		if I_EventCounter outcome = 3
			console_command add_money saxons    , -15000
			historic_event payback_normal
		end_if

		if I_EventCounter outcome = 4
			console_command add_money saxons    , -7500
			historic_event payback_little
		end_if

		if I_EventCounter outcome = 5
			historic_event payback_not
		end_if
		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType denmark      ;Genua
		and I_LocalFaction denmark  
		and Treasury > 35000
		and I_TurnNumber > 80

		generate_random_counter outcome 1 5

		if I_EventCounter outcome = 1
			console_command add_money denmark    , -50000
			historic_event payback_very_high
		end_if

		if I_EventCounter outcome = 2
			console_command add_money denmark    , -25000
			historic_event payback_high
		end_if

		if I_EventCounter outcome = 3
			console_command add_money denmark    , -15000
			historic_event payback_normal
		end_if

		if I_EventCounter outcome = 4
			console_command add_money denmark    , -7500
			historic_event payback_little
		end_if

		if I_EventCounter outcome = 5
			historic_event payback_not
		end_if

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType byzantium        ;Mantua
		and I_LocalFaction byzantium
		and Treasury > 35000
		and I_TurnNumber > 80

		generate_random_counter outcome 1 5

		if I_EventCounter outcome = 1
			console_command add_money byzantium    , -50000
			historic_event payback_very_high
		end_if

		if I_EventCounter outcome = 2
			console_command add_money byzantium    , -25000
			historic_event payback_high
		end_if

		if I_EventCounter outcome = 3
			console_command add_money byzantium    , -15000
			historic_event payback_normal
		end_if

		if I_EventCounter outcome = 4
			console_command add_money byzantium    , -7500
			historic_event payback_little
		end_if

		if I_EventCounter outcome = 5
			historic_event payback_not
		end_if

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType england      ;Modena
		and I_LocalFaction england
		and Treasury > 35000
		and I_TurnNumber > 80

		generate_random_counter outcome 1 5

		if I_EventCounter outcome = 1
			console_command add_money england    , -50000
			historic_event payback_very_high
		end_if

		if I_EventCounter outcome = 2
			console_command add_money england    , -25000
			historic_event payback_high
		end_if

		if I_EventCounter outcome = 3
			console_command add_money england    , -15000
			historic_event payback_normal
		end_if

		if I_EventCounter outcome = 4
			console_command add_money england    , -7500
			historic_event payback_little
		end_if

		if I_EventCounter outcome = 5
			historic_event payback_not
		end_if

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType russia       ;Siena
		and I_LocalFaction russia
		and Treasury > 35000
		and I_TurnNumber > 80

		generate_random_counter outcome 1 5

		if I_EventCounter outcome = 1
			console_command add_money russia    , -50000
			historic_event payback_very_high
		end_if

		if I_EventCounter outcome = 2
			console_command add_money russia    , -25000
			historic_event payback_high
		end_if

		if I_EventCounter outcome = 3
			console_command add_money russia    , -15000
			historic_event payback_normal
		end_if

		if I_EventCounter outcome = 4
			console_command add_money russia    , -7500
			historic_event payback_little
		end_if

		if I_EventCounter outcome = 5
			historic_event payback_not
		end_if

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType scotland     ;Ragusa
		and I_LocalFaction scotland
		and Treasury > 35000
		and I_TurnNumber > 80

		generate_random_counter outcome 1 5

		if I_EventCounter outcome = 1
			console_command add_money scotland    , -50000
			historic_event payback_very_high
		end_if

		if I_EventCounter outcome = 2
			console_command add_money scotland    , -25000
			historic_event payback_high
		end_if

		if I_EventCounter outcome = 3
			console_command add_money scotland    , -15000
			historic_event payback_normal
		end_if

		if I_EventCounter outcome = 4
			console_command add_money scotland    , -7500
			historic_event payback_little
		end_if

		if I_EventCounter outcome = 5
			historic_event payback_not
		end_if

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType egypt        ;Hafsiden
		and I_LocalFaction egypt
		and Treasury > 35000
		and I_TurnNumber > 80

		generate_random_counter outcome 1 5

		if I_EventCounter outcome = 1
			console_command add_money egypt    , -50000
			historic_event payback_very_high
		end_if

		if I_EventCounter outcome = 2
			console_command add_money egypt    , -25000
			historic_event payback_high
		end_if

		if I_EventCounter outcome = 3
			console_command add_money egypt    , -15000
			historic_event payback_normal
		end_if

		if I_EventCounter outcome = 4
			console_command add_money egypt    , -7500
			historic_event payback_little
		end_if

		if I_EventCounter outcome = 5
			historic_event payback_not
		end_if

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType timurids        ;Bologna
		and I_LocalFaction timurids
		and Treasury > 35000
		and I_TurnNumber > 80

		generate_random_counter outcome 1 5

		if I_EventCounter outcome = 1
			console_command add_money timurids    , -50000
			historic_event payback_very_high
		end_if

		if I_EventCounter outcome = 2
			console_command add_money timurids    , -25000
			historic_event payback_high
		end_if

		if I_EventCounter outcome = 3
			console_command add_money timurids    , -15000
			historic_event payback_normal
		end_if

		if I_EventCounter outcome = 4
			console_command add_money timurids    , -7500
			historic_event payback_little
		end_if

		if I_EventCounter outcome = 5
			historic_event payback_not
		end_if

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType savoy        ;Savoyen
		and I_LocalFaction savoy
		and Treasury > 35000
		and I_TurnNumber > 80

		generate_random_counter outcome 1 5

		if I_EventCounter outcome = 1
			console_command add_money savoy    , -50000
			historic_event payback_very_high
		end_if

		if I_EventCounter outcome = 2
			console_command add_money savoy    , -25000
			historic_event payback_high
		end_if

		if I_EventCounter outcome = 3
			console_command add_money savoy    , -15000
			historic_event payback_normal
		end_if

		if I_EventCounter outcome = 4
			console_command add_money savoy    , -7500
			historic_event payback_little
		end_if

		if I_EventCounter outcome = 5
			historic_event payback_not
		end_if

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType montferrat        ;Montferrat
		and I_LocalFaction montferrat
		and Treasury > 35000
		and I_TurnNumber > 80

		generate_random_counter outcome 1 5

		if I_EventCounter outcome = 1
			console_command add_money montferrat    , -50000
			historic_event payback_very_high
		end_if

		if I_EventCounter outcome = 2
			console_command add_money montferrat    , -25000
			historic_event payback_high
		end_if

		if I_EventCounter outcome = 3
			console_command add_money montferrat    , -15000
			historic_event payback_normal
		end_if

		if I_EventCounter outcome = 4
			console_command add_money montferrat    , -7500
			historic_event payback_little
		end_if

		if I_EventCounter outcome = 5
			historic_event payback_not
		end_if

		terminate_monitor
	end_monitor


	monitor_event FactionTurnStart FactionType lucca       ;Lucca
		and I_LocalFaction lucca
		and Treasury > 35000
		and I_TurnNumber > 80

		generate_random_counter outcome 1 5

		if I_EventCounter outcome = 1
			console_command add_money lucca    , -50000
			historic_event payback_very_high
		end_if

		if I_EventCounter outcome = 2
			console_command add_money lucca    , -25000
			historic_event payback_high
		end_if

		if I_EventCounter outcome = 3
			console_command add_money lucca    , -15000
			historic_event payback_normal
		end_if

		if I_EventCounter outcome = 4
			console_command add_money lucca    , -7500
			historic_event payback_little
		end_if

		if I_EventCounter outcome = 5
			historic_event payback_not
		end_if

		terminate_monitor
	end_monitor


	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;               Schwarze Bande
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart FactionType france
		and I_LocalFaction france   
		and I_TurnNumber = 67

		historic_event schwarze_bande true 

		terminate_monitor
	end_monitor

	monitor_event EventCounter EventCounterType schwarze_bande_accepted
		and I_EventCounter schwarze_bande_accepted > 0

		historic_event schwarze_bande_yes

		console_command add_money france, -10000

		spawn_army 
			faction france
			character Georg Langenmantel, named character, age 41, x 7, y 260, direction E
			traits GoodCommander 3 , NaturalMilitarySkill 1 , GoodAttacker 3
			unit		NE Late Bodyguard		exp 5 armour 0 weapon_lvl 0
			unit		Landschneckt Pikemen		exp 5 armour 0 weapon_lvl 0
			unit		Landschneckt Pikemen		exp 3 armour 0 weapon_lvl 0
			unit		Landschneckt Pikemen		exp 3 armour 0 weapon_lvl 0
			unit		Landschneckt Pikemen		exp 3 armour 0 weapon_lvl 0
			unit		Landschneckt Pikemen		exp 3 armour 0 weapon_lvl 0
			unit		Landschneckt Pikemen		exp 3 armour 0 weapon_lvl 0
			unit		Mercenary Arquebusiers		exp 3 armour 0 weapon_lvl 0
			unit		Mercenary Arquebusiers		exp 3 armour 0 weapon_lvl 0
		end

		terminate_monitor
	end_monitor

	monitor_event EventCounter EventCounterType schwarze_bande_declined
		and I_EventCounter schwarze_bande_declined > 0

		historic_event schwarze_bande_no

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType france
		and I_IsFactionAIControlled france	
		and I_TurnNumber = 67

		spawn_army 
			faction france
			character Georg Langenmantel, named character, age 41, x 7, y 260, direction E
			traits GoodCommander 3 , NaturalMilitarySkill 1 , GoodAttacker 3
			unit		NE Late Bodyguard			exp 5 armour 0 weapon_lvl 0
			unit		Landschneckt Pikemen			exp 5 armour 0 weapon_lvl 0
			unit		Landschneckt Pikemen			exp 3 armour 0 weapon_lvl 0
			unit		Landschneckt Pikemen			exp 3 armour 0 weapon_lvl 0
			unit		Landschneckt Pikemen			exp 3 armour 0 weapon_lvl 0
			unit		Landschneckt Pikemen			exp 3 armour 0 weapon_lvl 0
			unit		Landschneckt Pikemen			exp 3 armour 0 weapon_lvl 0
			unit		Mercenary Arquebusiers			exp 3 armour 0 weapon_lvl 0
			unit		Mercenary Arquebusiers			exp 3 armour 0 weapon_lvl 0
		end

		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Papstmodell/Stratmodelle
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event BecomesFactionLeader FactionType papal_states
		change_battle_model papal_states leader Pope
	end_monitor

	monitor_event BecomesFactionLeader FactionType spain
		change_battle_model spain leader northern_generic_king
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Dürre auf Sizilien
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart FactionType spain
		and I_LocalFaction spain
		and I_TurnNumber = 27

		console_command add_population Palermo, -750
		console_command add_population Messina, -500
		console_command add_population Syrakus, -750

		add_settlement_turmoil Palermo 5
		add_settlement_turmoil Messina 5
		add_settlement_turmoil Syrakus 5

		set_event_counter duerre_start 1

		historic_event duerre_start				;Start

		terminate_monitor
	end_monitor


	monitor_event FactionTurnStart FactionType spain
		and I_LocalFaction spain
		and I_TurnNumber = 31

		console_command add_population Palermo, -1500
		console_command add_population Messina, -1000
		console_command add_population Syrakus, -1500

		add_settlement_turmoil Palermo 10
		add_settlement_turmoil Messina 10
		add_settlement_turmoil Syrakus 10

		historic_event duerre_dauert				;Andauern

		terminate_monitor
	end_monitor


	monitor_event FactionTurnStart FactionType spain
		and I_LocalFaction spain
		and I_TurnNumber = 35

		set_event_counter duerre_start 0

		historic_event duerre_ende				;Ende

		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Hexenjagd
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart FactionIsLocal		
		and I_TurnNumber = 67

		if I_LocalFaction spain

		console_command add_population Palermo, -500
		console_command add_population Syrakus, -500
		console_command add_population Cagliari, -500
		console_command add_population Messina, -750

		add_settlement_turmoil Palermo 15
		add_settlement_turmoil Syrakus 15
		add_settlement_turmoil Cagliari 15
		add_settlement_turmoil Messina 15

		historic_event hexenjagd

		end_if 

		if I_LocalFaction hre

		console_command add_population Innsbruck, -500
		console_command add_population Munchen, -750
		console_command add_population Villach, -500
		console_command add_population Wien, -750
		console_command add_population Freiburg, -500
		console_command add_population Salzburg, -750

		add_settlement_turmoil Innsbruck 15
		add_settlement_turmoil Munchen 15
		add_settlement_turmoil Villach 15
		add_settlement_turmoil Wien 15
		add_settlement_turmoil Freiburg 15
		add_settlement_turmoil Salzburg 15

		historic_event hexenjagd

		end_if 

		if I_LocalFaction france
				
		console_command add_population Dijon, -500
		console_command add_population Grenoble, -750
		console_command add_population Marseille, -500
		console_command add_population Lyon, -750
		console_command add_population Chaumont, -500

		add_settlement_turmoil Dijon 15
		add_settlement_turmoil Grenoble 15
		add_settlement_turmoil Marseille 15
		add_settlement_turmoil Lyon 15
		add_settlement_turmoil Chaumont 15

		historic_event hexenjagd

		end_if


		if I_LocalFaction hungary

		console_command add_population Buda, -500
		console_command add_population Pressburg, -750
		console_command add_population Pecs, -500
		console_command add_population Gran, -500
		console_command add_population Veszprem, -750
		console_command add_population Zagreb, -750
		console_command add_population Nyitra, -500

		add_settlement_turmoil Buda 15
		add_settlement_turmoil Pressburg 15
		add_settlement_turmoil Pecs 15
		add_settlement_turmoil Gran 15
		add_settlement_turmoil Veszprem 15
		add_settlement_turmoil Zagreb 15
		add_settlement_turmoil Nyitra 15

		historic_event hexenjagd

		end_if

		if I_LocalFaction papal_states

		console_command add_population Rom, -500
		console_command add_population Camerino, -750
		console_command add_population Avignon, -500
		console_command add_population Perugia, -500
		console_command add_population Benevent, -750

		add_settlement_turmoil Rome 15
		add_settlement_turmoil Camerino 15
		add_settlement_turmoil Avignon 15
		add_settlement_turmoil Perugia 15
		add_settlement_turmoil Benevent 15

		historic_event hexenjagd

		end_if

		if I_LocalFaction saxons

		console_command add_population Zurich, -500
		console_command add_population Bern, -750
		console_command add_population Chur, -500
		console_command add_population Genf, -750

		add_settlement_turmoil Zurich 15
		add_settlement_turmoil Bern 15
		add_settlement_turmoil Chur 15
		add_settlement_turmoil Genf 15

		historic_event hexenjagd

		end_if

		if I_LocalFaction venice

		console_command add_population Venedig, -500
		console_command add_population Brescia, -750
		console_command add_population Verona, -500
		console_command add_population Udine, -500
		console_command add_population Spalato, -750

		add_settlement_turmoil Venedig 15
		add_settlement_turmoil Brescia 15
		add_settlement_turmoil Verona 15
		add_settlement_turmoil Udine 15
		add_settlement_turmoil Spalato 15

		historic_event hexenjagd

		end_if

		if I_LocalFaction milan 

		console_command add_population Mailand, -750
		console_command add_population Pavia, -500

		add_settlement_turmoil Mailand 15
		add_settlement_turmoil Pavia 15

		historic_event hexenjagd

		end_if

		if I_LocalFaction poland

		console_command add_population Florenz, -750

		add_settlement_turmoil Florenz 15

		historic_event hexenjagd

		end_if

		if I_LocalFaction sicily

		console_command add_population Neapel, -500
		console_command add_population Salerno, -500
		console_command add_population Capua, -500

		add_settlement_turmoil Neapel 15
		add_settlement_turmoil Salerno 15
		add_settlement_turmoil Capua 15

		historic_event hexenjagd

		end_if

		if I_LocalFaction normans

		console_command add_population Augsburg, -500
		console_command add_population Ulm, -750

		add_settlement_turmoil Augsburg 25
		add_settlement_turmoil Ulm 30

		historic_event hexenjagd

		end_if


		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Verrat von Novara
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart FactionType milan
		and I_LocalFaction milan	
		and I_TurnNumber = 19

		historic_event angebot_novara true 

		terminate_monitor
	end_monitor

	monitor_event EventCounter EventCounterType angebot_novara_accepted
		and I_EventCounter angebot_novara_accepted > 0

		historic_event angebot_novara_yes

		console_command add_money milan, -3500

		console_command add_money saxons, 3500

		set_faction_standing milan saxons 1.0
		set_faction_standing saxons milan 1.0

		set_faction_standing france saxons -1.0
		set_faction_standing saxons france -1.0

		console_command diplomatic_stance saxons france War
		console_command diplomatic_stance saxons milan Allied

		spawn_army 
			faction milan
			character Evio, general, age 30, x 57, y 223, direction S
			unit		Swiss Pikemen Mercs			exp 4 armour 0 weapon_lvl 0
			unit		Swiss Pikemen Mercs			exp 3 armour 0 weapon_lvl 0
			unit		Swiss Pikemen Mercs			exp 2 armour 0 weapon_lvl 0
			unit		Swiss Pikemen Mercs			exp 2 armour 0 weapon_lvl 0
			unit		Swiss Pikemen Mercs			exp 3 armour 0 weapon_lvl 0
			unit		Swiss Pikemen Mercs			exp 1 armour 0 weapon_lvl 0
		end

		terminate_monitor
	end_monitor

	monitor_event EventCounter EventCounterType angebot_novara_declined
		and I_EventCounter angebot_novara_declined > 0

		historic_event angebot_novara_no

		set_faction_standing milan saxons -0.3
		set_faction_standing saxons milan -0.3

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType milan
		and I_LocalFaction milan	
		and I_EventCounter angebot_novara_accepted = 1
		and I_TurnNumber = 27

		historic_event verrat_novara 

		set_faction_standing milan saxons -1.0
		set_faction_standing saxons milan -1.0

		set_faction_standing france saxons 1.0
		set_faction_standing saxons france 1.0

		console_command diplomatic_stance saxons france Allied
		console_command diplomatic_stance saxons milan War

		destroy_units milan Swiss Pikemen Mercs

		console_command add_money france, 2500
		console_command add_money saxons, 2500


		spawn_army 
			faction saxons
			character Hans Turmann, named character, age 47, x 67, y 214, label siege_milan, direction E
			traits GoodCommander 3 , BattleDread 2, ReligionStarter 1, LoyaltyStarter 1, GoodAttacker 1
			unit		Swiss Bodyguard					exp 3 armour 0 weapon_lvl 0
			unit		Swiss Pike					exp 4 armour 0 weapon_lvl 0
			unit		Swiss Pike					exp 3 armour 0 weapon_lvl 0
			unit		Swiss Pike					exp 2 armour 0 weapon_lvl 0
			unit		Swiss Pike					exp 2 armour 0 weapon_lvl 0
			unit		Swiss Pike					exp 5 armour 0 weapon_lvl 0
			unit		Swiss Guard Elite				exp 2 armour 0 weapon_lvl 0
			unit		Swiss Guard Elite				exp 3 armour 0 weapon_lvl 0
			unit		Swiss Guard Elite				exp 1 armour 0 weapon_lvl 0
			unit		Swiss Arquebusiers				exp 2 armour 0 weapon_lvl 0
			unit		Swiss Arquebusiers				exp 4 armour 0 weapon_lvl 0
			unit		Condottieri					exp 6 armour 0 weapon_lvl 0
			unit		Condottieri					exp 4 armour 0 weapon_lvl 0
			unit		NE Cannon					exp 3 armour 0 weapon_lvl 0
		end

		terminate_monitor
	end_monitor

	declare_counter milano_engage

	monitor_event FactionTurnStart FactionType saxons

		and I_CharacterExists siege_milan

		if I_SettlementOwner Mailand = saxons
			terminate_monitor
		end_if

		if I_SettlementUnderSiege Mailand
			and I_EventCounter milano_engage = 0
			terminate_monitor 
		end_if

		if I_EventCounter milano_engage = 1
			siege_settlement siege_milan, Mailand, attack
			terminate_monitor
		end_if

		if I_EventCounter milano_engage = 0
			siege_settlement siege_milan, Mailand, maintain
			set_event_counter milano_engage 1
		end_if
	end_monitor	


	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Schweizer Reformation
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart FactionType saxons
		and I_TurnNumber = 115
		and I_LocalFaction saxons

		historic_event saxons_conversion true factions { saxons, }

		terminate_monitor
	end_monitor

	monitor_event EventCounter EventCounterType saxons_conversion_accepted
		and I_EventCounter saxons_conversion_accepted > 0

		historic_event saxons_reform

		set_religion saxons orthodox

		change_population_religion saxons orthodox 60 catholic

		destroy_buildings saxons temple_catholic true

		set_event_counter protestant 1
		set_event_counter catholic 0

		retire_characters saxons priest

		set_faction_standing saxons papal_states -0.5
		set_faction_standing papal_states saxons -0.5

		spawn_character saxons, Ulrich Zwingli, priest, age 38, x 42, y 251
		console_command give_trait "Ulrich Zwingli" StrongFaith 4
		console_command give_trait "Ulrich Zwingli" PriestProtestant 1

		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Johannes Calvin
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart FactionType saxons
		and I_TurnNumber = 191
		and I_EventCounter protestant = 1
		and not I_CharacterExists Johannes Calvin

		spawn_character saxons, Johannes Calvin, priest, age 32, x 42, y 251
		console_command give_trait "Johannes Calvin" StrongFaith 4
		console_command give_trait "Johannes Calvin" OpenMinded 1
		console_command give_trait "Johannes Calvin" PriestProtestant 1

		historic_event johannes_calvin

		terminate_monitor
	end_monitor


	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Venedigs Flotte
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart FactionType venice
		and I_LocalFaction venice	
		and I_TurnNumber = 119

		historic_event flotte_venedig true 

		terminate_monitor
	end_monitor

	monitor_event EventCounter EventCounterType flotte_venedig_accepted
		and I_EventCounter flotte_venedig_accepted > 0

		historic_event flotte_venedig_yes

		console_command add_money venice, -7500

		spawn_army
			faction		venice
			character	Bartolomeo Gusti, admiral, age 38, x 124, y 206, direction SE
			unit		galleass				exp 5 armour 0 weapon_lvl 0
			unit		war galley				exp 3 armour 0 weapon_lvl 0
			unit		war galley				exp 3 armour 0 weapon_lvl 0
			unit		war galley				exp 3 armour 0 weapon_lvl 0
			unit		war galley				exp 3 armour 0 weapon_lvl 0
		end

		spawn_army
			faction		venice
			character	Cristiano, general, age 40, x 124, y 206 
			unit		Venetian Heavy Infantry			exp 2 armour 1 weapon_lvl 0
			unit		Venetian Heavy Infantry			exp 2 armour 1 weapon_lvl 0
			unit		Venetian Archers			exp 2 armour 0 weapon_lvl 0
			unit		Venetian Archers			exp 2 armour 0 weapon_lvl 0
		end

		spawn_army
			faction		turks
			character	Jalal Erim, admiral, age 51, x 176, y 154, direction NE
			unit		war galley				exp 0 armour 0 weapon_lvl 0
			unit		war galley				exp 0 armour 0 weapon_lvl 0
			unit		war galley				exp 0 armour 0 weapon_lvl 0
			unit		war galley				exp 0 armour 0 weapon_lvl 0
			unit		war galley				exp 0 armour 0 weapon_lvl 0
			unit		war galley				exp 0 armour 0 weapon_lvl 0
			unit		war galley				exp 0 armour 0 weapon_lvl 0
			unit		war galley				exp 0 armour 0 weapon_lvl 0
			unit		war galley				exp 0 armour 0 weapon_lvl 0
		end

		spawn_army
			faction		turks
			character	random_name, general, age 40, x 178, y 161, label siege_supetar 
			unit		Sipahis			exp 2 armour 0 weapon_lvl 0
			unit		Serdengecti			exp 0 armour 0 weapon_lvl 0
			unit		Serdengecti			exp 2 armour 0 weapon_lvl 0
			unit		Azab			exp 1 armour 0 weapon_lvl 0
			unit		Azab			exp 2 armour 0 weapon_lvl 0
		end

		terminate_monitor
	end_monitor

	monitor_event EventCounter EventCounterType flotte_venedig_declined
		and I_EventCounter flotte_venedig_declined > 0

		historic_event flotte_venedig_no

		spawn_army
			faction		turks
			character	Jalal Erim, admiral, age 51, x 176, y 154, direction NE
			unit		war galley				exp 0 armour 0 weapon_lvl 0
			unit		war galley				exp 0 armour 0 weapon_lvl 0
			unit		war galley				exp 0 armour 0 weapon_lvl 0
			unit		war galley				exp 0 armour 0 weapon_lvl 0
			unit		war galley				exp 0 armour 0 weapon_lvl 0
			unit		war galley				exp 0 armour 0 weapon_lvl 0
			unit		war galley				exp 0 armour 0 weapon_lvl 0
			unit		war galley				exp 0 armour 0 weapon_lvl 0
			unit		war galley				exp 0 armour 0 weapon_lvl 0
		end

		spawn_army
			faction		turks
			character	random_name, general, age 40, x 178, y 161 
			unit		Sipahis			exp 2 armour 0 weapon_lvl 0
			unit		Serdengecti			exp 0 armour 0 weapon_lvl 0
			unit		Serdengecti			exp 2 armour 0 weapon_lvl 0
			unit		Azab			exp 1 armour 0 weapon_lvl 0
			unit		Azab			exp 2 armour 0 weapon_lvl 0
		end

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType turks

		and I_CharacterExists siege_supetar

		if I_SettlementOwner Supetar = turks
			terminate_monitor
		end_if

		if I_SettlementUnderSiege Supetar
			and I_EventCounter supetar_engage = 0
			terminate_monitor 
		end_if

		if I_EventCounter supetar_engage = 1
			siege_settlement siege_supetar, Supetar, attack
			terminate_monitor
		end_if

		if I_EventCounter supetar_engage = 0
			siege_settlement siege_supetar, Supetar, maintain
			set_event_counter supetar_engage 1
		end_if
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;               Eroberung Budas
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event GeneralCaptureSettlement FactionType turks        ;Türken
		and SettlementName Buda
		and I_EventCounter eroberung_budas = 0

		historic_event eroberung_budas
		console_command add_money turks, 15000

		console_command add_population Buda, -3500

		set_event_counter eroberung_budas 1

		terminate_monitor
	end_monitor



	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;               Sacco di Roma
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event GeneralCaptureSettlement FactionIsLocal 
		and SettlementName Rom
		and I_EventCounter sacco_di_roma = 0

		historic_event sacco_di_roma

		if I_SettlementOwner Rom = hre
		and I_LocalFaction hre
			console_command add_money hre, 10000
		end_if

		if I_SettlementOwner Rom = france
		and I_LocalFaction france
			console_command add_money france, 10000
		end_if

		if I_SettlementOwner Rom = spain
		and I_LocalFaction spain
			console_command add_money spain, 10000
		end_if

		set_event_counter sacco_di_roma 1

		console_command add_population Rom, -4000

		add_settlement_turmoil Rom 25

		terminate_monitor
	end_monitor


	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;               Eroberung von Tunis
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event GeneralCaptureSettlement FactionIsLocal
		and SettlementName Tunis
		and I_EventCounter eroberung_tunis = 0

		historic_event eroberung_tunis

		if I_LocalFaction hre
		and I_SettlementOwner Tunis = hre
			console_command add_money hre, 5000
		end_if

		if I_LocalFaction spain
		and I_SettlementOwner Tunis = spain
			console_command add_money spain, 5000
		end_if

		if I_LocalFaction france
		and I_SettlementOwner Tunis = france
			console_command add_money france, 5000
		end_if

		if I_LocalFaction denmark
		and I_SettlementOwner Tunis = denmark
			console_command add_money denmark, 5000
		end_if

		if I_LocalFaction poland
		and I_SettlementOwner Tunis = poland
			console_command add_money poland, 5000
		end_if

		if I_LocalFaction sicily
		and I_SettlementOwner Tunis = sicily
			console_command add_money sicily, 5000
		end_if

		set_event_counter eroberung_tunis 1

		console_command add_population Tunis, -2500

		add_settlement_turmoil Tunis 15

		terminate_monitor
	end_monitor


	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;               Doppelte Buchführung
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart FactionIsLocal
		and I_TurnNumber = 4

		historic_event  doppelte_buchfuehrung

		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;               Das Feuer der Eitelkeiten
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnEnd FactionType slave
		and I_TurnNumber = 15
		and I_EventCounter florenz_tribut_angenommen = 1
		and not I_CharacterExists Girolamo Savonarola

		historic_event  freudenfeuer

		spawn_character slave, Girolamo Savonarola, heretic, age 45, x 95, y 178
		console_command give_trait "Girolamo Savonarola" StrongFaith 3
		console_command give_trait "Girolamo Savonarola" NaturalHereticSkill 3

		add_settlement_turmoil Florenz 25
		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;               Casa Contratacion
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnEnd FactionType slave
		and I_TurnNumber = 39

		historic_event  casa_contratacion

		set_event_counter cassa_contratacion 1

		terminate_monitor
	end_monitor


	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;               Wächter des Papstes
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnEnd FactionType slave
		and I_TurnNumber = 51

		historic_event  schweizergarde

		spawn_army 
			faction papal_states
			character Kaspar von Silenen, named character, age 20, x 122, y 131, direction W
			traits GoodCommander 3 , NaturalMilitarySkill 1, ReligionStarter 1, LoyaltyStarter 1, GoodAttacker 2
			unit 		SE Late Bodyguard 		exp 3 armour 0 weapon_lvl 0
			unit 		Swiss Guard 		exp 3 armour 0 weapon_lvl 0
			unit 		Swiss Guard 		exp 3 armour 0 weapon_lvl 0
			unit 		Swiss Guard 		exp 3 armour 0 weapon_lvl 0
		end

		set_event_counter schweizergarde 1

		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Die Fugger
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnEnd FactionType slave
		and I_TurnNumber = 67

		historic_event	jakob_fugger

		set_event_counter jakob_fugger 1

		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Der Fürst
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnEnd FactionType slave
		and I_TurnNumber = 79

		historic_event	il_principe

		terminate_monitor
	end_monitor


	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Armer Konrad
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart FactionType hre
		and I_TurnNumber = 85
		and not I_IsFactionAIControlled hre

		historic_event	armer_konrad factions { hre, }

		spawn_army 
			faction peasants
			character Peter Gais, named character, age 33, x 56, y 275, direction NE
			traits GoodCommander 1 , NaturalMilitarySkill 1, ReligionStarter 1, GoodAttacker 2
			unit		Peasants Bodyguard		exp 7 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 0 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 0 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 0 armour 0 weapon_lvl 0
			unit		Revolting Peasants				exp 0 armour 0 weapon_lvl 0
			unit		Revolting Peasants				exp 0 armour 0 weapon_lvl 0
			unit		Peasants Knights				exp 1 armour 0 weapon_lvl 0
			unit		Citizen Militia				exp 3 armour 0 weapon_lvl 0
			unit		Citizen Militia			exp 6 armour 0 weapon_lvl 0
			unit		Citizen Militia			exp 2 armour 0 weapon_lvl 0
			unit		Peasants Knights			exp 5 armour 0 weapon_lvl 0
			unit		Arrie Ban Archers			exp 1 armour 0 weapon_lvl 0
			unit		Peasant Artillery			exp 0 armour 0 weapon_lvl 0
			unit		Arrie Ban Archers			exp 2 armour 0 weapon_lvl 0
			unit		Arrie Ban Archers			exp 1 armour 0 weapon_lvl 0
			unit		Arrie Ban Archers			exp 1 armour 0 weapon_lvl 0
		end

		add_settlement_turmoil Augsburg 15

		add_settlement_turmoil Munchen 15

		console_command diplomatic_stance hre peasants War
		console_command diplomatic_stance normans peasants War

		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Reinheitsgebot
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnEnd FactionType slave
		and I_TurnNumber = 92

		historic_event	reinheitsgebot

		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Martin Luther
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart I_TurnNumber = 95

		historic_event	luther

		change_population_religion hre orthodox 35
		change_population_religion normans orthodox 35


		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Angriff der Osmanen
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnEnd FactionType turks		;Unterstützungstruppen Sarajevo
		and not I_IsFactionAIControlled turks
		and I_TurnNumber = 23

		historic_event	hilfe_a factions { turks, }

		spawn_army 
			faction turks
			character Bayezid, named character, age 51, x 209, y 180, direction W
			traits GoodCommander 1 , NaturalMilitarySkill 2, LoyaltyStarter 1, GoodDefender 2
			unit		ME Late Bodyguard		exp 3 armour 0 weapon_lvl 0
			unit		Sipahis				exp 1 armour 0 weapon_lvl 0
			unit		Sipahis				exp 2 armour 0 weapon_lvl 0
			unit		Janissary Heavy Inf 	exp 4 armour 0 weapon_lvl 0
			unit		Janissary Heavy Inf 	exp 3 armour 0 weapon_lvl 0
			unit		Janissary Archers		exp 2 armour 0 weapon_lvl 0
			unit		Janissary Archers		exp 0 armour 0 weapon_lvl 0
			unit		Janissary Archers		exp 3 armour 0 weapon_lvl 0
			unit		Azab			exp 2 armour 0 weapon_lvl 0

		end

		console_command add_money turks, 1000

		set_event_counter janissary 1

		terminate_monitor
	end_monitor



	monitor_event FactionTurnEnd FactionType turks		;Unterstützungstruppen Sinj
		and not I_IsFactionAIControlled turks
		and I_TurnNumber = 43

		historic_event	hilfe_b factions { turks, }

		spawn_army 
			faction turks
			character random_name, named character, age 44, x 194, y 173, direction W
			traits GoodCommander 2 , BattleDread 2, LoyaltyStarter 1, GoodAttacker 1
			unit		ME Late Bodyguard		exp 1 armour 0 weapon_lvl 0
			unit		Turkmen			exp 3 armour 0 weapon_lvl 0
			unit		Turkmen			exp 2 armour 0 weapon_lvl 0
			unit		Sipahis				exp 2 armour 0 weapon_lvl 0
			unit		Janissary Heavy Inf		exp 3 armour 0 weapon_lvl 0
			unit		Dismounted Sipahi Lancers	exp 4 armour 0 weapon_lvl 0
			unit		Dismounted Sipahi Lancers	exp 3 armour 0 weapon_lvl 0
			unit		Janissary Archers		exp 2 armour 0 weapon_lvl 0
			unit		ME Halberd Militia		exp 0 armour 0 weapon_lvl 0
			unit		ME Halberd Militia		exp 3 armour 0 weapon_lvl 0
			unit		Azab			exp 4 armour 0 weapon_lvl 0
			unit		Azab			exp 4 armour 0 weapon_lvl 0

		end

		console_command add_money turks, 1500

		terminate_monitor
	end_monitor



	monitor_event FactionTurnEnd FactionType turks		;Unterstützungstruppen Vranduk
		and not I_IsFactionAIControlled turks
		and I_TurnNumber = 63

		historic_event	hilfe_c factions { turks, }

		spawn_army 
			faction turks
			character random_name, named character, age 23, x 209, y 200, direction NE
			traits GoodCommander 3 , BattleDread 1, NaturalMilitarySkill 2, LoyaltyStarter 1, GoodAttacker 3
			unit		ME Late Bodyguard		exp 2 armour 0 weapon_lvl 0
			unit		Turkmen			exp 3 armour 0 weapon_lvl 0
			unit		Turkmen				exp 2 armour 0 weapon_lvl 0
			unit		Akinjis				exp 1 armour 0 weapon_lvl 0
			unit		Akinjis				exp 2 armour 0 weapon_lvl 0
			unit		Janissary Heavy Inf		exp 3 armour 0 weapon_lvl 0
			unit		Janissary Heavy Inf		exp 1 armour 0 weapon_lvl 0
			unit		Janissary Heavy Inf		exp 3 armour 0 weapon_lvl 0
			unit		Janissary Heavy Inf		exp 4 armour 0 weapon_lvl 0
			unit		Janissary Archers		exp 1 armour 0 weapon_lvl 0
			unit		Janissary Archers		exp 2 armour 0 weapon_lvl 0
			unit		Janissary Archers		exp 0 armour 0 weapon_lvl 0
			unit		ME Monster Bombard		exp 0 armour 0 weapon_lvl 0

		end

		spawn_army 
			faction turks
			character random_name, general, age 20, x 214, y 209, direction S
			unit		Akinjis				exp 1 armour 0 weapon_lvl 0
			unit		Akinjis				exp 1 armour 0 weapon_lvl 0
			unit		Akinjis				exp 3 armour 0 weapon_lvl 0
			unit		Akinjis				exp 1 armour 0 weapon_lvl 0
			unit		Akinjis				exp 3 armour 0 weapon_lvl 0

		end

		console_command add_money turks, 2000


		terminate_monitor
	end_monitor

	monitor_event FactionTurnEnd FactionType turks		;Unterstützungstruppen Fort Sarajevo
		and not I_IsFactionAIControlled turks
		and I_TurnNumber = 103


		historic_event	hilfe_e factions { turks, }

		spawn_army 
			faction turks
			character random_name, named character, age 39, x 202, y 191, direction W
			traits GoodCommander 1 , BattleDread 4, NaturalMilitarySkill 2, LoyaltyStarter 1
			unit		ME Late Bodyguard		exp 4 armour 0 weapon_lvl 0
			unit		Turkmen			exp 3 armour 0 weapon_lvl 0
			unit		Sipahis				exp 1 armour 0 weapon_lvl 0
			unit		Serdengecti			exp 2 armour 0 weapon_lvl 0
			unit		Janissary Heavy Inf		exp 3 armour 0 weapon_lvl 0
			unit		Janissary Heavy Inf		exp 1 armour 0 weapon_lvl 0
			unit		Janissary Heavy Inf		exp 2 armour 0 weapon_lvl 0
			unit		Dismounted Sipahi Lancers	exp 3 armour 0 weapon_lvl 0
			unit		Janissary Archers		exp 2 armour 0 weapon_lvl 0
			unit		Janissary Archers		exp 2 armour 0 weapon_lvl 0
			unit		ME Halberd Militia		exp 0 armour 0 weapon_lvl 0
			unit		ME Halberd Militia		exp 3 armour 0 weapon_lvl 0
			unit		ME Halberd Militia		exp 3 armour 0 weapon_lvl 0
			unit		Azab				exp 4 armour 0 weapon_lvl 0
			unit		ME Cannon			exp 0 armour 0 weapon_lvl 0
			unit		ME Cannon			exp 0 armour 0 weapon_lvl 0

		end


		console_command add_money turks, 3000

		terminate_monitor
	end_monitor



	;--- Osmanen AI
	monitor_event FactionTurnEnd FactionType turks		;Activate event counter janissary, if faction is AI controlled
		and I_IsFactionAIControlled turks
		and I_TurnNumber = 0


		set_event_counter janissary 1

		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Ritterkrieg
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnEnd FactionType slave
		and I_TurnNumber >= 119
		historic_event	ritteraufstand

		terminate_monitor
	end_monitor


	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Bauernkriege
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


	declare_counter Belagerung_Stuttgart
	declare_counter Belagerung_Freiburg
	declare_counter Belagerung_Salzburg

	;;;;;;;;;;;;;;;;;;;;;;;;;;;Elsaß 1493;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart I_TurnNumber = 2


			historic_event	bundschuh_schlettstadt factions { hre, normans, }

			spawn_army 
				faction peasants
				character Joss Fritz, named character, age 23, x 41, y 277
				traits GoodCommander 1 , NaturalMilitarySkill 1, ReligionStarter 1, GoodAttacker 1 , LoyaltyStarter 1 
				unit		Peasants Bodyguard			exp 3 armour 0 weapon_lvl 0
				unit		Revolting Peasants				exp 0 armour 0 weapon_lvl 0
				unit		Revolting Peasants				exp 0 armour 0 weapon_lvl 0
				unit		Revolting Peasants				exp 0 armour 0 weapon_lvl 0
				unit		Arrie Ban Archers				exp 0 armour 0 weapon_lvl 0
				unit		Citizen Militia		exp 1 armour 0 weapon_lvl 0
				unit		Citizen Militia		exp 1 armour 0 weapon_lvl 0
			end


			add_settlement_turmoil Mulhouse 25
			add_settlement_turmoil Strassburg 25

			if I_CompareCounter Spieler_ist_Schwaben = 1
				snap_strat_camera 41, 287
				zoom_strat_camera 0.1

				reveal_tile 41, 277
			end_if

			if I_CompareCounter Spieler_ist_HRR = 1
				snap_strat_camera 41, 287
				zoom_strat_camera 0.1

				reveal_tile 41, 277
			end_if

			console_command diplomatic_stance hre peasants War
			console_command diplomatic_stance normans peasants War

		terminate_monitor
	end_monitor
	;;;;;;;;;;;;;;;;;;;;;;;;;;;Friaul 1511;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart I_TurnNumber = 72

		
		historic_event	aufstand_friaul factions { venice, }

		spawn_army 
			faction slave, sub_faction venice
			character Antonia Savorgnan, named character, age 54, x 126, y 221
			traits GoodCommander 1 , NaturalMilitarySkill 1, ReligionStarter 1, GoodAttacker 1 , LoyaltyStarter 1 
			unit		SE Late Bodyguard			exp 3 armour 0 weapon_lvl 0
			unit		Pavise Crossbowmen				exp 2 armour 0 weapon_lvl 0
			unit		Pike Militia				exp 4 armour 0 weapon_lvl 0
			unit		Condottieri				exp 1 armour 0 weapon_lvl 0
			unit		Pike Militia				exp 1 armour 0 weapon_lvl 0
			unit		Pike Militia				exp 0 armour 0 weapon_lvl 0
			unit		Peasants Rebel			exp 3 armour 0 weapon_lvl 0
			unit		Peasants Rebel			exp 0 armour 0 weapon_lvl 0
			unit		Peasants Rebel			exp 2 armour 0 weapon_lvl 0
		end

		add_settlement_turmoil Udine 25

		if I_CompareCounter Spieler_ist_Venedig = 1

			snap_strat_camera 126, 231
			zoom_strat_camera 0.1

			reveal_tile 126, 221

		end_if

		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;Schweiz 1513;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart I_TurnNumber = 80

			historic_event	aufstand_schweiz factions { saxons, }

		spawn_army 
			faction slave, sub_faction saxons
			character Peter Wyss, named character, age 35, x 51, y 250
			traits GoodCommander 1 , NaturalMilitarySkill 1, ReligionStarter 1, GoodAttacker 1 , LoyaltyStarter 1 
			unit		Swiss Pike				exp 3 armour 0 weapon_lvl 0
			unit		Swiss Pike				exp 4 armour 0 weapon_lvl 0
			unit		Swiss Halbediers				exp 0 armour 0 weapon_lvl 0
			unit		Swiss Halbediers				exp 2 armour 0 weapon_lvl 0
			unit		Peasants Rebel			exp 1 armour 0 weapon_lvl 0
			unit		Peasants Rebel			exp 0 armour 0 weapon_lvl 0
			unit		Peasants Rebel			exp 0 armour 0 weapon_lvl 0
		end

		add_settlement_turmoil Bern 25
		add_settlement_turmoil Zurich 25

		if I_CompareCounter Spieler_ist_Schweiz = 1

			snap_strat_camera 51, 260
			zoom_strat_camera 0.1

			reveal_tile 51, 250

		end_if

		terminate_monitor
	end_monitor


	;;;;;;;;;;;;;;;;;;;;;;;;;;;Ungarn 1514;;;;;;;;;;;;;;;;;;;;;;;;;;;
	monitor_event FactionTurnStart I_TurnNumber = 84

			historic_event	aufstand_ungarn factions { hungary, }


		spawn_army 
			faction slave, sub_faction hungary
			character Gyorgy Dozsa, named character, age 44, x 193, y 231
			traits GoodCommander 1 , NaturalMilitarySkill 1, ReligionStarter 1, GoodAttacker 1 , LoyaltyStarter 1 
			unit		Hungarian Nobles				exp 1 armour 0 weapon_lvl 0
			unit		Hungarian Nobles				exp 2 armour 0 weapon_lvl 0
			unit		Halberd Militia_ug				exp 4 armour 0 weapon_lvl 0
			unit		Halberd Militia_ug				exp 0 armour 0 weapon_lvl 0
			unit		Halberd Militia_ug 			exp 0 armour 0 weapon_lvl 0
			unit		Pavise Crossbow Militia			exp 3 armour 0 weapon_lvl 0
			unit		Pavise Crossbow Militia			exp 0 armour 0 weapon_lvl 0
			unit		EE Spear Militia				exp 0 armour 0 weapon_lvl 0
			unit		EE Spear Militia				exp 0 armour 0 weapon_lvl 0
			unit		Peasants Rebel			exp 2 armour 0 weapon_lvl 0
			unit		Peasants Rebel			exp 1 armour 0 weapon_lvl 0
			unit		Peasants Rebel			exp 1 armour 0 weapon_lvl 0
			unit		Peasants Rebel			exp 0 armour 0 weapon_lvl 0
			unit		Peasants Rebel			exp 0 armour 0 weapon_lvl 0
			unit		Peasants Rebel			exp 2 armour 0 weapon_lvl 0
		end

		spawn_army 
			faction slave, sub_faction hungary
			character Gergely Dozsa, named character, age 39, x 190, y 239
			traits GoodCommander 1 , NaturalMilitarySkill 1, ReligionStarter 1, GoodAttacker 1 , LoyaltyStarter 1 
			unit		Hungarian Nobles				exp 4 armour 0 weapon_lvl 0
			unit		Hungarian Nobles				exp 1 armour 0 weapon_lvl 0
			unit		Hungarian Nobles				exp 2 armour 0 weapon_lvl 0
			unit		Pavise Crossbow Militia			exp 0 armour 0 weapon_lvl 0
			unit		EE Spear Militia				exp 2 armour 0 weapon_lvl 0
			unit		Halberd Militia_ug 				exp 0 armour 0 weapon_lvl 0
			unit		Halberd Militia_ug 				exp 1 armour 0 weapon_lvl 0
			unit		Peasants Rebel			exp 1 armour 0 weapon_lvl 0
			unit		Peasants Rebel			exp 1 armour 0 weapon_lvl 0
			unit		Peasants Rebel			exp 0 armour 0 weapon_lvl 0
		end

		add_settlement_turmoil Stuhlweisenberg 25
		add_settlement_turmoil Pecs 25
		add_settlement_turmoil Kanizsa 25
		add_settlement_turmoil Virovitica 25

		if I_CompareCounter Spieler_ist_Ungarn = 1

			snap_strat_camera 193, 241
			zoom_strat_camera 0.1

			reveal_tile 193, 231

			wait 4.0
			reveal_tile 190, 239
			move_strat_camera 190, 249

		end_if

		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;Württemberg 1514;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart I_TurnNumber = 85
		and I_IsFactionAIControlled hre

			historic_event	armer_konrad factions { normans, }

		spawn_army 
			faction peasants
			character Peter Gais, named character, age 33, x 56, y 275, direction NE
			traits GoodCommander 1 , NaturalMilitarySkill 1, ReligionStarter 1, GoodAttacker 2
			unit		Peasants Bodyguard		exp 7 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 0 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 0 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 0 armour 0 weapon_lvl 0
			unit		Revolting Peasants				exp 0 armour 0 weapon_lvl 0
			unit		Revolting Peasants				exp 0 armour 0 weapon_lvl 0
			unit		Peasants Knights				exp 1 armour 0 weapon_lvl 0
			unit		Citizen Militia				exp 3 armour 0 weapon_lvl 0
			unit		Citizen Militia			exp 6 armour 0 weapon_lvl 0
			unit		Citizen Militia			exp 2 armour 0 weapon_lvl 0
			unit		Peasants Knights			exp 5 armour 0 weapon_lvl 0
			unit		Arrie Ban Archers			exp 1 armour 0 weapon_lvl 0
			unit		Peasant Artillery			exp 0 armour 0 weapon_lvl 0
			unit		Arrie Ban Archers			exp 2 armour 0 weapon_lvl 0
			unit		Arrie Ban Archers			exp 1 armour 0 weapon_lvl 0
			unit		Arrie Ban Archers			exp 1 armour 0 weapon_lvl 0
		end

		add_settlement_turmoil Stuttgart 25

		if I_CompareCounter Spieler_ist_Schwaben = 1

			snap_strat_camera 56, 285
			zoom_strat_camera 0.1

			reveal_tile 56, 275

		end_if

		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;Slowenien 1515;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart I_TurnNumber = 88

			historic_event	windischer_bauernkrieg factions { hre, }

		spawn_army 
			faction peasants
			character Jobst Herden, named character, age 49, x 149, y 222, direction N
			traits GoodCommander 1 , NaturalMilitarySkill 1, ReligionStarter 1, GoodAttacker 1 , LoyaltyStarter 1 
			unit		Peasants Bodyguard			exp 3 armour 0 weapon_lvl 0
			unit		Citizen Militia				exp 0 armour 0 weapon_lvl 0
			unit		Citizen Militia				exp 1 armour 0 weapon_lvl 0
			unit		Citizen Militia				exp 2 armour 0 weapon_lvl 0
			unit		Peasants Knights				exp 1 armour 0 weapon_lvl 0
			unit		Peasants Knights				exp 0 armour 0 weapon_lvl 0
			unit		Arrie Ban Archers			exp 4 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 2 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 2 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 1 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 0 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 0 armour 0 weapon_lvl 0
		end

		spawn_army 
			faction peasants
			character Thorsten Windeck, named character, age 27, x 142, y 226, direction E
			traits GoodCommander 1 , NaturalMilitarySkill 1, ReligionStarter 1, GoodAttacker 1 , LoyaltyStarter 1 
			unit		Peasants Bodyguard			exp 3 armour 0 weapon_lvl 0
			unit		Citizen Militia				exp 3 armour 0 weapon_lvl 0
			unit		Peasants Knights				exp 1 armour 0 weapon_lvl 0
			unit		Arrie Ban Archers				exp 1 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 0 armour 0 weapon_lvl 0
			unit		Peasant Artillery			exp 0 armour 0 weapon_lvl 0
		end

		add_settlement_turmoil Laibach 25
		add_settlement_turmoil Marburg 25
		add_settlement_turmoil Adelsberg 25

		if I_CompareCounter Spieler_ist_HRR = 1

			snap_strat_camera 149, 232
			zoom_strat_camera 0.1

			reveal_tile 149, 222

			wait 4.0
			reveal_tile 142, 226
			move_strat_camera 142, 236

		end_if

		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;Deutscher Bauernkrieg;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnEnd FactionIsLocal
		and I_TurnNumber = 124

		historic_event	deutscher_bauernkrieg event/anfang_bauernkrieg.bik

		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;Thomas Müntzer;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnEnd FactionIsLocal
		and I_TurnNumber = 126

		historic_event	thomas_muentzer

		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;Allgäu und Oberschwaben 1525;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart I_TurnNumber = 128

			historic_event	aufstand_oberschwaben factions { normans, }


		spawn_army 
			faction peasants
			character Matthias Scherer, named character, age 37, x 75, y 269
			traits GoodCommander 1 , NaturalMilitarySkill 1, ReligionStarter 1, GoodAttacker 1 , LoyaltyStarter 1 
			unit		Peasants Bodyguard			exp 3 armour 0 weapon_lvl 0
			unit		Citizen Militia				exp 2 armour 0 weapon_lvl 0
			unit		Citizen Militia				exp 0 armour 0 weapon_lvl 0
			unit		Citizen Militia				exp 4 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 0 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 1 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 1 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 0 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 2 armour 0 weapon_lvl 0
		end

		spawn_army 
			faction peasants
			character Lothar Becker, named character, age 29, x 65, y 269
			traits GoodCommander 1 , NaturalMilitarySkill 1, ReligionStarter 1, GoodAttacker 1 , LoyaltyStarter 1 
			unit		Peasants Bodyguard			exp 1 armour 0 weapon_lvl 0
			unit		Peasants Knights			exp 0 armour 0 weapon_lvl 0
			unit		Arrie Ban Archers			exp 2 armour 0 weapon_lvl 0
			unit		Citizen Militia				exp 4 armour 0 weapon_lvl 0
			unit		Citizen Militia				exp 3 armour 0 weapon_lvl 0
			unit		Citizen Militia				exp 0 armour 0 weapon_lvl 0
			unit		Citizen Militia				exp 2 armour 0 weapon_lvl 0
			unit		Arrie Ban Archers			exp 0 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 1 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 4 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 3 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 0 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 0 armour 0 weapon_lvl 0
		end

		spawn_army 
			faction peasants
			character Wolfgang Roht, named character, age 29, x 80, y 261
			traits GoodCommander 1 , NaturalMilitarySkill 1, ReligionStarter 1, GoodAttacker 1 , LoyaltyStarter 1 
			unit		Peasants Bodyguard				exp 1 armour 0 weapon_lvl 0
			unit		Citizen Militia				exp 1 armour 0 weapon_lvl 0
			unit		Citizen Militia				exp 1 armour 0 weapon_lvl 0
			unit		Arrie Ban Archers			exp 0 armour 0 weapon_lvl 0
			unit		Peasants Knights			exp 2 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 3 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 0 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 1 armour 0 weapon_lvl 0
		end

		add_settlement_turmoil Ravensburg 50
		add_settlement_turmoil Bregens 50
		add_settlement_turmoil Augsburg 25
		add_settlement_turmoil Rottweil 25

		if I_CompareCounter Spieler_ist_Schwaben = 1

			snap_strat_camera 75, 279
			zoom_strat_camera 0.1

			reveal_tile 75, 269

			wait 4.0
			reveal_tile 65, 269
			move_strat_camera 65, 279

			wait 4.0
			reveal_tile 80, 261
			move_strat_camera 80, 271

		end_if

		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;Zwölf Artikel und Bauernjörg;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart I_TurnNumber = 129

			historic_event	zwoelf_artikel factions { normans, }

		spawn_army 
			faction normans
			character Georg von Waldburgc, named character, age 37, x 81, y 278
			traits GoodCommander 3 , NaturalMilitarySkill 2, ReligionStarter 1, Energetic 2 , LoyaltyStarter 1 , BattleDread 3
			unit		NE Late Bodyguard			exp 3 armour 0 weapon_lvl 0
			unit		wald_Imperial Knights			exp 3 armour 0 weapon_lvl 0
			unit		SW Landsknecht Pikeniere			exp 3 armour 0 weapon_lvl 0
			unit		SW Landsknecht Pikeniere			exp 3 armour 0 weapon_lvl 0
			unit		Landsknecht Halberd			exp 3 armour 0 weapon_lvl 0
			unit		Landsknecht Halberd			exp 3 armour 0 weapon_lvl 0
			unit		S Doppelsoldner		exp 3 armour 0 weapon_lvl 0
			unit		S Doppelsoldner		exp 3 armour 0 weapon_lvl 0
			unit		Arquebusiers			exp 3 armour 0 weapon_lvl 0
			unit		Arquebusiers			exp 3 armour 0 weapon_lvl 0
			unit		Arquebusiers			exp 3 armour 0 weapon_lvl 0
			unit		NE Serpentine				exp 3 armour 0 weapon_lvl 0
			unit		NE Serpentine				exp 3 armour 0 weapon_lvl 0
		end

		if I_CompareCounter Spieler_ist_Schwaben = 1

			snap_strat_camera 81, 288
			zoom_strat_camera 0.1

			reveal_tile 81, 278

		end_if

		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;Württemberg 1525;;;;;;;;;;;;;;;;;;;;;;;;;;;


	monitor_event FactionTurnStart I_TurnNumber = 130

			historic_event	aufstand_wuerttemberg factions { normans, }

		spawn_army 
			faction peasants
			character Thomas Maier, named character, age 29, x 63, y 285, label siege_stuttgart, direction E  
			traits GoodCommander 1 , NaturalMilitarySkill 1, ReligionStarter 1, GoodAttacker 1 , LoyaltyStarter 1 
			unit		Peasants Bodyguard			exp 2 armour 0 weapon_lvl 0
			unit		Peasants Knights			exp 1 armour 0 weapon_lvl 0
			unit		Citizen Militia				exp 0 armour 0 weapon_lvl 0
			unit		Citizen Militia				exp 2 armour 0 weapon_lvl 0
			unit		Citizen Militia				exp 0 armour 0 weapon_lvl 0
			unit		Arrie Ban Archers			exp 0 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 4 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 1 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 1 armour 0 weapon_lvl 0
		end

		add_settlement_turmoil Stuttgart 50

		if I_CompareCounter Spieler_ist_Schwaben = 1

			snap_strat_camera 63, 295
			zoom_strat_camera 0.1

			reveal_tile 63, 285

		end_if

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType peasants

		and I_CharacterExists siege_stuttgart

		if I_SettlementOwner Stuttgart = peasants
			terminate_monitor
		end_if

		if I_SettlementUnderSiege Stuttgart
			and I_EventCounter stuttgart_engage = 0
			terminate_monitor 
		end_if

		if I_EventCounter stuttgart_engage = 1
			siege_settlement siege_stuttgart, Stuttgart, attack
			terminate_monitor
		end_if

		if I_EventCounter stuttgart_engage = 0
			siege_settlement siege_stuttgart, Stuttgart, maintain
			set_event_counter stuttgart_engage 1
		end_if
	end_monitor


	;;;;;;;;;;;;;;;;;;;;;;;;;;;Weinsberg und Luther;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnEnd FactionType slave
		and I_TurnNumber = 130

		historic_event	weinsberg_luther

		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;Leipheim 1525;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart I_TurnNumber = 131

			historic_event	aufstand_leipheim factions { normans, }


		spawn_army
			faction peasants
			character Jakob Wehe, named character, age 46, x 88, y 282
			traits GoodCommander 1 , NaturalMilitarySkill 1, ReligionStarter 1, GoodAttacker 1 , LoyaltyStarter 1 
			unit		Peasants Bodyguard				exp 1 armour 0 weapon_lvl 0
			unit		Citizen Militia				exp 2 armour 0 weapon_lvl 0
			unit		Arrie Ban Archers			exp 0 armour 0 weapon_lvl 0
			unit		Peasants Knights			exp 3 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 0 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 2 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 0 armour 0 weapon_lvl 0
			unit		Peasant Artillery			exp 1 armour 0 weapon_lvl 0
		end

		add_settlement_turmoil Ulm 50

		if I_CompareCounter Spieler_ist_Schwaben = 1

			snap_strat_camera 88, 292
			zoom_strat_camera 0.1

			reveal_tile 88, 282

		end_if

		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;Breisgau 1525;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart I_TurnNumber = 131

			historic_event	aufstand_breisgau factions { hre, }


		spawn_army 
			faction peasants
			character Hans Müller, named character, age 35, x 46, y 270, label siege_freiburg, direction E  
			traits GoodCommander 1 , NaturalMilitarySkill 1, ReligionStarter 1, GoodAttacker 1 , LoyaltyStarter 1 
			unit		Peasants Bodyguard			exp 3 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 1 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 4 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 2 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 0 armour 0 weapon_lvl 0
			unit		Peasants Knights			exp 3 armour 0 weapon_lvl 0
			unit		Peasants Knights			exp 1 armour 0 weapon_lvl 0
			unit		Arrie Ban Archers			exp 1 armour 0 weapon_lvl 0
			unit		Arrie Ban Archers			exp 0 armour 0 weapon_lvl 0
			unit		Citizen Militia					exp 0 armour 0 weapon_lvl 0
			unit		Citizen Militia					exp 2 armour 0 weapon_lvl 0
			unit		Citizen Militia					exp 0 armour 0 weapon_lvl 0
			unit		Citizen Militia					exp 4 armour 0 weapon_lvl 0
		end

		spawn_army 
			faction peasants
			character Erasmus Gerber, named character, age 44, x 41, y 275, direction N
			traits GoodCommander 1 , NaturalMilitarySkill 1, ReligionStarter 1, GoodAttacker 1 , LoyaltyStarter 1 
			unit		Peasants Bodyguard			exp 1 armour 0 weapon_lvl 0
			unit		Citizen Militia					exp 0 armour 0 weapon_lvl 0
			unit		Citizen Militia					exp 0 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 2 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 2 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 4 armour 0 weapon_lvl 0
			unit		Peasants Knights			exp 0 armour 0 weapon_lvl 0
			unit		Peasants Knights			exp 3 armour 0 weapon_lvl 0
			unit		Peasant Artillery			exp 0 armour 0 weapon_lvl 0
		end

		add_settlement_turmoil Freiburg 50
		add_settlement_turmoil Strassburg 50
		add_settlement_turmoil Baden 25
		add_settlement_turmoil Mulhouse 25

		if I_CompareCounter Spieler_ist_HRR = 1

			snap_strat_camera 46, 280
			zoom_strat_camera 0.1

			reveal_tile 46, 270

			wait 4.0
			reveal_tile 41, 275
			move_strat_camera 41, 285

		end_if

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType peasants

		and I_CharacterExists siege_freiburg

		if I_SettlementOwner Freiburg = peasants
			terminate_monitor
		end_if

		if I_SettlementUnderSiege Freiburg
			and I_EventCounter freiburg_engage = 0
			terminate_monitor 
		end_if

		if I_EventCounter freiburg_engage = 1
			siege_settlement siege_freiburg, Freiburg, attack
			terminate_monitor
		end_if

		if I_EventCounter freiburg_engage = 0
			siege_settlement siege_freiburg, Freiburg, maintain
			set_event_counter freiburg_engage 1
		end_if
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;Salzburg 1525;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart I_TurnNumber = 132

			historic_event	aufstand_salzburg factions { hre, }


		spawn_army 
			faction peasants
			character Michael Gruber, named character, age 40, x 133, y 260, label siege_salzburg
			traits GoodCommander 1 , NaturalMilitarySkill 1, ReligionStarter 1, GoodAttacker 1 , LoyaltyStarter 1 
			unit		Peasants Bodyguard				exp 1 armour 0 weapon_lvl 0
			unit		Citizen Militia				exp 0 armour 0 weapon_lvl 0
			unit		Citizen Militia				exp 2 armour 0 weapon_lvl 0
			unit		Citizen Militia				exp 0 armour 0 weapon_lvl 0
			unit		Arrie Ban Archers			exp 0 armour 0 weapon_lvl 0
			unit		Arrie Ban Archers			exp 3 armour 0 weapon_lvl 0
			unit		Peasants Knights			exp 3 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 0 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 1 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 1 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 0 armour 0 weapon_lvl 0
			unit		Revolting Peasants			exp 1 armour 0 weapon_lvl 0
			unit		Arrie Ban Archers			exp 1 armour 0 weapon_lvl 0
			unit		Peasant Artillery			exp 0 armour 0 weapon_lvl 0
		end

		add_settlement_turmoil Salzburg 50

		if I_CompareCounter Spieler_ist_HRR = 1

			snap_strat_camera 133, 270
			zoom_strat_camera 0.1

			reveal_tile 133, 260

		end_if

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType peasants

		and I_CharacterExists siege_salzburg

		if I_SettlementOwner Salzburg = peasants
			terminate_monitor
		end_if

		if I_SettlementUnderSiege Salzburg
			and I_EventCounter salzburg_engage = 0
			terminate_monitor 
		end_if

		if I_EventCounter salzburg_engage = 1
			siege_settlement siege_salzburg, Salzburg, attack
			terminate_monitor
		end_if

		if I_EventCounter salzburg_engage = 0
			siege_settlement siege_salzburg, Salzburg, maintain
			set_event_counter salzburg_engage 1
		end_if
	end_monitor




	;------------------------------------------------------------------------------
	;---------------------- Reformation -------------------------------------------
	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart FactionType normans
		and not I_IsFactionAIControlled normans 
		and I_TurnNumber = 148

		historic_event bund_reformation true factions { normans, }

		terminate_monitor
	end_monitor

	monitor_event EventCounter EventCounterType bund_reformation_accepted

		historic_event bund_reformation_ja factions { normans, }

		set_event_counter protestant 1
		set_event_counter catholic 0

		set_religion normans orthodox


		change_population_religion normans orthodox 50 catholic

		destroy_buildings normans temple_catholic true

		retire_characters normans priest

		set_faction_standing normans papal_states -0.5
		set_faction_standing papal_states normans -0.5
		set_faction_standing hre normans -0.5
		set_faction_standing normans hre -0.5

		add_settlement_turmoil Stuttgart 15
		add_settlement_turmoil Ulm 15
		add_settlement_turmoil Ravensburg 15
		add_settlement_turmoil Rottweil 15

		terminate_monitor
	end_monitor

	monitor_event EventCounter EventCounterType bund_reformation_declined

		historic_event bund_reformation_nein factions { normans, }

		change_population_religion normans orthodox 50 catholic

		spawn_character slave, Michael, heretic, age 27, x 85, y 276
		console_command give_trait "Michael" StrongFaith 3

		spawn_character slave, Hans, heretic, age 45, x 82, y 263
		console_command give_trait "Hans" StrongFaith 3

		spawn_character slave, Joss, heretic, age 22, x 97, y 279
		console_command give_trait "Joss" StrongFaith 3

		spawn_character slave, Jobst, heretic, age 50, x 85, y 261
		console_command give_trait "Jobst" StrongFaith 3

		spawn_character slave, Peter, heretic, age 34, x 61, y 280
		console_command give_trait "Peter" StrongFaith 3

		set_faction_standing normans papal_states 0.5
		set_faction_standing papal_states normans 0.5
		set_faction_standing hre normans 0.5
		set_faction_standing normans hre 0.5

		add_settlement_turmoil Stuttgart 15
		add_settlement_turmoil Ulm 15
		add_settlement_turmoil Ravensburg 15
		add_settlement_turmoil Rottweil 15

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Unterstützung für Habsburg ----------------------------
	;------------------------------------------------------------------------------

	declare_counter krieg_hre_milan
	declare_counter krieg_hre_papal
	declare_counter krieg_hre_france 
	declare_counter krieg_hre_florence
	declare_counter krieg_hre_venice

	;------------------ Mailand
	monitor_event FactionWarDeclared FactionType milan
		and TargetFactionType Hre

		set_counter krieg_hre_milan 1

	end_monitor

	monitor_event FactionWarDeclared FactionType hre
		and TargetFactionType Milan

		set_counter krieg_hre_milan 1

	end_monitor

	;------------------ Papst
	monitor_event FactionWarDeclared FactionType papal_states
		and TargetFactionType Hre

		set_counter krieg_hre_papal 1

	end_monitor

	monitor_event FactionWarDeclared FactionType hre
		and TargetFactionType Papal_states

		set_counter krieg_hre_papal 1

	end_monitor

	;------------------ Frankreich
	monitor_event FactionWarDeclared FactionType france
		and TargetFactionType Hre

		set_counter krieg_hre_france 1

	end_monitor

	monitor_event FactionWarDeclared FactionType hre
		and TargetFactionType France

		set_counter krieg_hre_france 1

	end_monitor

	;------------------ Florenz
	monitor_event FactionWarDeclared FactionType poland
		and TargetFactionType Hre

		set_counter krieg_hre_florence 1

	end_monitor

	monitor_event FactionWarDeclared FactionType hre
		and TargetFactionType Poland

		set_counter krieg_hre_florence 1

	end_monitor

	;------------------ Venedig
	monitor_event FactionWarDeclared FactionType venice
		and TargetFactionType Hre

		set_counter krieg_hre_venice 1

	end_monitor

	monitor_event FactionWarDeclared FactionType hre
		and TargetFactionType Venice

		set_counter krieg_hre_venice 1

	end_monitor

	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart FactionType normans
		and not DiplomaticStanceFromFaction hre = AtWar

		if I_CompareCounter krieg_hre_milan = 1

			historic_event bund_habsburg_us true factions { normans, }

			set_counter krieg_hre_milan 2

		end_if

		if I_CompareCounter krieg_hre_papal = 1

			historic_event bund_habsburg_us true factions { normans, }

			set_counter krieg_hre_papal 2

		end_if

		if I_CompareCounter krieg_hre_france = 1

			historic_event bund_habsburg_us true factions { normans, }

			set_counter krieg_hre_france 2

		end_if

		if I_CompareCounter krieg_hre_florence = 1

			historic_event bund_habsburg_us true factions { normans, }

			set_counter krieg_hre_florence 2

		end_if

		if I_CompareCounter krieg_hre_venice = 1


			historic_event bund_habsburg_us true factions { normans, }

			set_counter krieg_hre_venice 2

		end_if

	end_monitor
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType bund_habsburg_us_accepted

		historic_event bund_habsburg_us_ja factions { normans, }

		if I_CompareCounter krieg_hre_milan = 2

			set_counter krieg_hre_milan 0

			spawn_army 
				faction normans
				character random_name, named character, age 34, x 76, y 246, direction S
				traits GoodCommander 3 , BattleDread 2, NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
				unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
				unit		SW Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
				unit		SW Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
				unit		Landsknecht Halberd				exp 1 armour 1 weapon_lvl 0
				unit		Landsknecht Halberd				exp 1 armour 1 weapon_lvl 0
				unit		S Crossbowmen				exp 1 armour 1 weapon_lvl 0
				unit		S Imperial Knights	exp 2 armour 0 weapon_lvl 0
				unit		S Imperial Knights	exp 2 armour 0 weapon_lvl 0
				unit		Arquebusiers			exp 1 armour 1 weapon_lvl 0
				unit		Arquebusiers			exp 1 armour 1 weapon_lvl 0
				unit		NE Serpentine			exp 1 armour 1 weapon_lvl 0
			end

			console_command diplomatic_stance normans milan War

		end_if

		if I_CompareCounter krieg_hre_papal = 2

			set_counter krieg_hre_papal 0

			spawn_army 
				faction normans
				character random_name, named character, age 44, x 100, y 218, direction S
				traits GoodCommander 3 , BattleDread 2, NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
				unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
				unit		SW Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
				unit		SW Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
				unit		Landsknecht Halberd				exp 1 armour 1 weapon_lvl 0
				unit		Landsknecht Halberd				exp 1 armour 1 weapon_lvl 0
				unit		S Crossbowmen				exp 1 armour 1 weapon_lvl 0
				unit		S Imperial Knights	exp 2 armour 0 weapon_lvl 0
				unit		S Imperial Knights	exp 2 armour 0 weapon_lvl 0
				unit		Arquebusiers			exp 1 armour 1 weapon_lvl 0
				unit		Arquebusiers			exp 1 armour 1 weapon_lvl 0
				unit		NE Serpentine			exp 1 armour 1 weapon_lvl 0
			end

			console_command diplomatic_stance normans papal_states War

		end_if

		if I_CompareCounter krieg_hre_florence = 2

			set_counter krieg_hre_florence 0

			spawn_army 
				faction normans
				character random_name, named character, age 27, x 100, y 218, direction S
				traits GoodCommander 3 , BattleDread 2, NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
				unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
				unit		SW Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
				unit		SW Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
				unit		Landsknecht Halberd				exp 1 armour 1 weapon_lvl 0
				unit		Landsknecht Halberd				exp 1 armour 1 weapon_lvl 0
				unit		S Crossbowmen				exp 1 armour 1 weapon_lvl 0
				unit		S Imperial Knights	exp 2 armour 0 weapon_lvl 0
				unit		S Imperial Knights	exp 2 armour 0 weapon_lvl 0
				unit		Arquebusiers			exp 1 armour 1 weapon_lvl 0
				unit		Arquebusiers			exp 1 armour 1 weapon_lvl 0
				unit		NE Serpentine			exp 1 armour 1 weapon_lvl 0
			end

			console_command diplomatic_stance normans poland War

		end_if

		if I_CompareCounter krieg_hre_france = 2

			set_counter krieg_hre_france 0

			spawn_army 
				faction normans
				character random_name, named character, age 50, x 24, y 264
				traits GoodCommander 3 , BattleDread 2, NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
				unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
				unit		SW Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
				unit		SW Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
				unit		Landsknecht Halberd				exp 1 armour 1 weapon_lvl 0
				unit		Landsknecht Halberd				exp 1 armour 1 weapon_lvl 0
				unit		S Crossbowmen				exp 1 armour 1 weapon_lvl 0
				unit		S Imperial Knights	exp 2 armour 0 weapon_lvl 0
				unit		S Imperial Knights	exp 2 armour 0 weapon_lvl 0
				unit		Arquebusiers			exp 1 armour 1 weapon_lvl 0
				unit		Arquebusiers			exp 1 armour 1 weapon_lvl 0
				unit		NE Serpentine			exp 1 armour 1 weapon_lvl 0
			end

			console_command diplomatic_stance normans france War

		end_if

		if I_CompareCounter krieg_hre_venice = 2

			set_counter krieg_hre_venice 0

			spawn_army 
				faction normans
				character random_name, named character, age 22, x 100, y 218, direction S
				traits GoodCommander 3 , BattleDread 2, NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
				unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
				unit		SW Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
				unit		SW Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
				unit		Landsknecht Halberd				exp 1 armour 1 weapon_lvl 0
				unit		Landsknecht Halberd				exp 1 armour 1 weapon_lvl 0
				unit		S Crossbowmen				exp 1 armour 1 weapon_lvl 0
				unit		S Imperial Knights	exp 2 armour 0 weapon_lvl 0
				unit		S Imperial Knights	exp 2 armour 0 weapon_lvl 0
				unit		Arquebusiers			exp 1 armour 1 weapon_lvl 0
				unit		Arquebusiers			exp 1 armour 1 weapon_lvl 0
				unit		NE Serpentine			exp 1 armour 1 weapon_lvl 0
			end

			console_command diplomatic_stance normans venice War

		end_if

		console_command add_money normans, -5000

		set_faction_standing hre normans 1.0
		set_faction_standing normans hre 1.0

	end_monitor
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType bund_habsburg_us_declined

		historic_event bund_habsburg_us_nein factions { normans, }

		set_faction_standing hre normans -0.5

	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Türkenhilfe -------------------------------------------
	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart FactionType normans
		and not DiplomaticStanceFromFaction hre = AtWar

		if I_EventCounter turken_besetzt > 1
			inc_event_counter turken_besetzt -1
		end_if

		if I_EventCounter turken_besetzt = 2
			set_event_counter turken_besetzt 0
		end_if

		if I_SettlementOwner Marburg = turks
			and I_EventCounter turken_besetzt < 1

			historic_event bund_turken true factions { normans, }

			set_event_counter turken_besetzt 1
		end_if

		if I_SettlementOwner Odenburg = turks
			and I_EventCounter turken_besetzt < 1

			historic_event bund_turken true factions { normans, }

			set_event_counter turken_besetzt 1
		end_if

		if I_SettlementOwner Pressburg = turks
			and I_EventCounter turken_besetzt < 1

			historic_event bund_turken true factions { normans, }

			set_event_counter turken_besetzt 1
		end_if

		if I_SettlementOwner Eisenburg = turks
			and I_EventCounter turken_besetzt < 1

			historic_event bund_turken true factions { normans, }

			set_event_counter turken_besetzt 1
		end_if

		if I_SettlementOwner Zagreb = turks
			and I_EventCounter turken_besetzt < 1

			historic_event bund_turken true factions { normans, }

			set_event_counter turken_besetzt 1
		end_if

		if I_SettlementOwner Fiume = turks
			and I_EventCounter turken_besetzt < 1

			historic_event bund_turken true factions { normans, }

			set_event_counter turken_besetzt 1
		end_if

	end_monitor

	monitor_event EventCounter EventCounterType bund_turken_accepted
		and I_EventCounter turken_besetzt = 1

		historic_event bund_turken_ja factions { normans, }

		set_event_counter turken_besetzt 15

		spawn_army 
			faction normans
			character random_name, named character, age 22, x 166, y 258
			traits GoodCommander 3 , BattleDread 2, NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
			unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
			unit		SW Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
			unit		SW Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
			unit		Landsknecht Halberd				exp 1 armour 1 weapon_lvl 0 
			unit		S Imperial Knights	exp 2 armour 0 weapon_lvl 0
			unit		S Imperial Knights	exp 2 armour 0 weapon_lvl 0
			unit		Arquebusiers			exp 1 armour 1 weapon_lvl 0
			unit		Arquebusiers			exp 1 armour 1 weapon_lvl 0
		end

		console_command add_money normans, -5000

		set_faction_standing hre normans 1.0
		set_faction_standing normans hre 1.0

		console_command diplomatic_stance normans turks War

	end_monitor


	monitor_event EventCounter EventCounterType bund_turken_declined
		and I_EventCounter turken_besetzt = 1

		historic_event bund_turken_nein factions { normans, }
		set_event_counter turken_besetzt 15

		set_faction_standing hre normans -0.5
		set_faction_standing normans hre -0.5

	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Drohung des Papstes -----------------------------------
	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart FactionType poland
		and I_TurnNumber = 6
		and I_EventCounter florenz_tribut_angenommen = 1

		historic_event drohung_papst

		set_event_counter drohung_papst 1

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Hinrichtung Savonarola --------------------------------
	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart FactionType poland
		and I_TurnNumber = 19
		and I_EventCounter drohung_papst = 1

		historic_event hinrichtung

		set_event_counter drohung_papst = 0

		kill_character Girolamo Savonarola

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Wiedereinsetzung der Medici ---------------------------
	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart FactionType poland
		and I_TurnNumber = 76
		and I_EventCounter medici_abwesend = 1

		historic_event wiedereinsetzung true

		terminate_monitor
	end_monitor

	monitor_event EventCounter EventCounterType wiedereinsetzung_accepted

		console_command diplomatic_stance poland spain Allied

		console_command add_money poland, -20000

		set_event_counter medici_abwesend 0
		set_event_counter medici_wiedereingesetzt 1

		kill_character Piero Capponi

		spawn_army 
			faction poland
			character Piero de Medici, named character, age 41, x 94, y 179  
			traits Factionleader 1 , LoyaltyStarter 1 , GoodCommander 1 , Energetic 1 , Intelligent 1 , ReligionStarter 1 , BoringSpeaker 6 
			unit		SE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
		end

		spawn_army 
			faction poland
			character Giovanni de Medici, named character, age 38, x 97, y 173  
			traits Factionheir 1 , GoodCommander 1 , PoliticsSkill 2 , Intelligent 2 , Austere 1 , ReligionStarter 1 , LoyaltyStarter 1 
			unit		SE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
		end

		terminate_monitor
	end_monitor

	monitor_event EventCounter EventCounterType wiedereinsetzung_declined

		console_command diplomatic_stance poland spain War

		spawn_army 
			faction slave, sub_faction spain
			character Piero de Medici, named character, age 41, x 100, y 176, label siege_medici01, direction W
			traits LoyaltyStarter 1 , GoodCommander 1 , Energetic 1 , Intelligent 1 , ReligionStarter 1 , BoringSpeaker 6 
			unit		SE Late Bodyguard					exp 3 armour 0 weapon_lvl 0
			unit		Tercio Pikemen					exp 4 armour 0 weapon_lvl 0
			unit		Tercio Pikemen					exp 3 armour 0 weapon_lvl 0
			unit		Tercio Pikemen					exp 2 armour 0 weapon_lvl 0
			unit		Sword and Buckler Men					exp 2 armour 0 weapon_lvl 0
			unit		Sword and Buckler Men					exp 5 armour 0 weapon_lvl 0
			unit		Sword and Buckler Men				exp 2 armour 0 weapon_lvl 0
			unit		Sp Musketeers				exp 3 armour 0 weapon_lvl 0
			unit		Sp Musketeers				exp 1 armour 0 weapon_lvl 0
			unit		Sp Musketeers				exp 2 armour 0 weapon_lvl 0
			unit		Gendarmes				exp 4 armour 0 weapon_lvl 0
			unit		Condottieri					exp 6 armour 0 weapon_lvl 0
			unit		NE Culverin					exp 4 armour 0 weapon_lvl 0
			unit		NE Culverin					exp 3 armour 0 weapon_lvl 0
		end

		spawn_army 
			faction slave, sub_faction spain
			character Giovanni de Medici, named character, age 38, x 89, y 175, label siege_medici02, direction W
			traits GoodCommander 1 , PoliticsSkill 2 , Intelligent 2 , Austere 1 , ReligionStarter 1 , LoyaltyStarter 1 
			unit		SE Late Bodyguard					exp 3 armour 0 weapon_lvl 0
			unit		Tercio Pikemen					exp 4 armour 0 weapon_lvl 0
			unit		Tercio Pikemen					exp 3 armour 0 weapon_lvl 0
			unit		Tercio Pikemen					exp 2 armour 0 weapon_lvl 0
			unit		Sword and Buckler Men					exp 2 armour 0 weapon_lvl 0
			unit		Sword and Buckler Men					exp 5 armour 0 weapon_lvl 0
			unit		Sword and Buckler Men				exp 2 armour 0 weapon_lvl 0
			unit		Sp Musketeers				exp 3 armour 0 weapon_lvl 0
			unit		Sp Musketeers				exp 1 armour 0 weapon_lvl 0
			unit		Sp Musketeers				exp 2 armour 0 weapon_lvl 0
			unit		Gendarmes				exp 4 armour 0 weapon_lvl 0
			unit		Condottieri					exp 6 armour 0 weapon_lvl 0
			unit		NE Culverin					exp 4 armour 0 weapon_lvl 0
			unit		NE Culverin					exp 3 armour 0 weapon_lvl 0
		end

		terminate_monitor
	end_monitor


	declare_counter florenz_medici_engage

	monitor_event FactionTurnStart FactionType poland

		and I_CharacterExists siege_medici01

		if not I_SettlementOwner Florenz = poland
			terminate_monitor
		end_if

		if I_SettlementUnderSiege Florenz
			and I_EventCounter florenz_medici_engage = 0
			terminate_monitor 
		end_if

		if I_EventCounter florenz_medici_engage = 1
			siege_settlement siege_medici01, Florenz, attack
			terminate_monitor
		end_if

		if I_EventCounter florenz_medici_engage = 0
			siege_settlement siege_medici01, Florenz, maintain
			set_event_counter florenz_medici_engage 1
		end_if
	end_monitor

	declare_counter florenz_medici_g_engage

	monitor_event FactionTurnStart FactionType poland

		and I_CharacterExists siege_medici02

		if not I_SettlementOwner Pisa = poland
			terminate_monitor
		end_if

		if I_SettlementUnderSiege Pisa
			and I_EventCounter florenz_medici_g_engage = 0
			terminate_monitor 
		end_if

		if I_EventCounter florenz_medici_engage = 1
			siege_settlement siege_medici02, Pisa, attack
			terminate_monitor
		end_if

		if I_EventCounter florenz_medici_g_engage = 0
			siege_settlement siege_medici02, Pisa, maintain
			set_event_counter florenz_medici_g_engage 1
		end_if
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Aufstand gegen die Medici -----------------------------
	;------------------------------------------------------------------------------
	monitor_event FactionTurnStart FactionType poland
		and I_TurnNumber = 136
		and I_EventCounter medici_wiedereingesetzt = 1

		historic_event aufstand_medici factions { poland, }

		add_settlement_turmoil Florenz 75

		spawn_army 
			faction slave, sub_faction poland
			character Filippo Strozzi, named character, age 38, x 100, y 176, label siege_strozzi
			traits GoodCommander 1 , PoliticsSkill 2 , Intelligent 2 , Austere 1 , ReligionStarter 1 , LoyaltyStarter 1 
			unit		SE Late Bodyguard					exp 3 armour 0 weapon_lvl 0
			unit		FL Landsknecht Pikeniere					exp 4 armour 0 weapon_lvl 0
			unit		FL Landsknecht Pikeniere					exp 3 armour 0 weapon_lvl 0
			unit		FL Landsknecht Pikeniere					exp 2 armour 0 weapon_lvl 0
			unit		Halberd Militia					exp 2 armour 0 weapon_lvl 0
			unit		Halberd Militia					exp 5 armour 0 weapon_lvl 0
			unit		Halberd Militia				exp 2 armour 0 weapon_lvl 0
			unit		Arquebusiers				exp 3 armour 0 weapon_lvl 0
			unit		Arquebusiers				exp 1 armour 0 weapon_lvl 0
			unit		Arquebusiers				exp 2 armour 0 weapon_lvl 0
			unit		Broken Lances				exp 4 armour 0 weapon_lvl 0
			unit		Broken Lances					exp 6 armour 0 weapon_lvl 0
			unit		NE Mortar					exp 4 armour 0 weapon_lvl 0
			unit		NE Mortar					exp 3 armour 0 weapon_lvl 0
		end

		terminate_monitor
	end_monitor


	monitor_event FactionTurnStart FactionType poland

		and I_CharacterExists siege_strozzi

		if not I_SettlementOwner Florenz = poland
			terminate_monitor
		end_if

		if I_SettlementUnderSiege Florenz
			and I_EventCounter florenz_strozzi_engage = 0
			terminate_monitor 
		end_if

		if I_EventCounter florenz_strozzi_engage = 1
			siege_settlement siege_strozzi, Florenz, attack
			terminate_monitor
		end_if

		if I_EventCounter florenz_strozzi_engage = 0
			siege_settlement siege_strozzi, Florenz, maintain
			set_event_counter florenz_strozzi_engage 1
		end_if
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Machiavelli Miliz -------------------------------------
	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart FactionType poland
		and I_TurnNumber = 40

		historic_event machiavelli_florence true factions { poland, }

		terminate_monitor
	end_monitor


	monitor_event EventCounter EventCounterType machiavelli_florence_accepted

		historic_event machiavelli_florence_ja factions { poland, }

		console_command add_money poland, -15000

		set_event_counter machiavelli_accepted 1

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType poland
		and I_TurnNumber = 44
		and I_EventCounter machiavelli_accepted = 1

		historic_event machiavelli_yes factions { poland, }

		set_event_counter miliz 1

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionIsLocal
		and I_TurnNumber = 44

		historic_event machiavelli_other factions { france, normans, hre, hungary, saxons, milan, venice, turks, papal_states, sicily, spain, denmark, byzantium, england, scotland, }
		terminate_monitor
	end_monitor





	;------------------------------------------------------------------------------
	;---------------------- Trockendocks ------------------------------------------
	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart I_TurnNumber = 16

		historic_event drydock factions { france, normans, hre, hungary, saxons, milan, venice, poland, papal_states, sicily, spain, denmark, byzantium, england, scotland, savoy, timurids, montferrat, urbino, lucca, }

		set_event_counter drydock 1

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Radschloss --------------------------------------------
	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart I_TurnNumber = 29

		historic_event wheel_lock factions { france, normans, hre, hungary, saxons, milan, venice, poland, papal_states, sicily, spain, denmark, byzantium, england, scotland, savoy, timurids, montferrat, urbino, lucca, }

		set_event_counter wheel_lock 1

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Mimar Sinan -------------------------------------------
	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart I_TurnNumber = 180

		historic_event sinan factions { turks, }

		set_event_counter mimar_sinan 1

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Kopernikus --------------------------------------------
	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart I_TurnNumber = 184

		historic_event kopernikus factions { france, normans, hre, hungary, saxons, milan, venice, poland, papal_states, sicily, spain, denmark, byzantium, england, scotland, savoy, timurids, montferrat, urbino, lucca, }

		set_event_counter kopernikus 1

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------ 
	;---------------------- Verstärkung für Grossmächte ---------------------------
	;------------------------------------------------------------------------------

	;-- Frankreich

	declare_counter france_help
	declare_counter france_counter

	monitor_event FactionTurnStart FactionType france


		if I_CompareCounter france_help = 0
			and I_NumberOfSettlements france < 3

			historic_event Frankreich_Help event/hilfe_aus_frankreich.bik factions { france, }

			spawn_army 
				faction france
				character random_name, named character, age 35, x 2, y 240
				traits GoodCommander 3 , BattleDread 2, NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
				unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
				unit		Lancers				exp 2 armour 0 weapon_lvl 0
				unit		Lancers				exp 2 armour 0 weapon_lvl 0
				unit		Aventurier			exp 1 armour 1 weapon_lvl 0
				unit		Aventurier			exp 2 armour 0 weapon_lvl 0
				unit		Pikemen				exp 2 armour 0 weapon_lvl 0
				unit		Pikemen				exp 1 armour 1 weapon_lvl 0
				unit		Pikemen				exp 1 armour 1 weapon_lvl 0
			end

			spawn_army 
				faction france
				character random_name, named character, age 28, x 2, y 236
				traits GoodCommander 3 , NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
				unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
				unit		Arquebusiers				exp 2 armour 0 weapon_lvl 0
				unit		Arquebusiers				exp 2 armour 0 weapon_lvl 0
				unit		Frz Gendarmes			exp 1 armour 1 weapon_lvl 0
				unit		Frz Gendarmes			exp 2 armour 0 weapon_lvl 0
				unit		Pikemen				exp 2 armour 0 weapon_lvl 0
				unit		Pikemen				exp 2 armour 0 weapon_lvl 0
				unit		Pikemen				exp 2 armour 0 weapon_lvl 0
				unit		NE Serpentine				exp 1 armour 1 weapon_lvl 0
				unit		NE Serpentine				exp 1 armour 1 weapon_lvl 0
			end

			set_counter france_help 1
		end_if

		if I_CompareCounter france_help = 1
			inc_counter france_counter 1
		end_if

		if I_CompareCounter france_counter = 10
			set_counter france_help 0
		end_if

	end_monitor

	declare_counter france_help_lyon
	declare_counter france_counter_lyon


	monitor_event FactionTurnStart FactionType france


		if I_CompareCounter france_help_lyon = 0
			and not I_SettlementOwner Lyon = france

			historic_event Frankreich_Help event/hilfe_aus_frankreich.bik factions { france, }

			spawn_army 
				faction france
				character random_name, named character, age 35, x 2, y 240
				traits GoodCommander 3 , BattleDread 2, NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
				unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
				unit		Lancers				exp 2 armour 0 weapon_lvl 0
				unit		Lancers				exp 2 armour 0 weapon_lvl 0
				unit		Aventurier			exp 1 armour 1 weapon_lvl 0
				unit		Aventurier			exp 2 armour 0 weapon_lvl 0
				unit		Pikemen				exp 2 armour 0 weapon_lvl 0
				unit		Pikemen				exp 1 armour 1 weapon_lvl 0
				unit		Pikemen				exp 1 armour 1 weapon_lvl 0
			end

			spawn_army 
				faction france
				character random_name, named character, age 28, x 2, y 236
				traits GoodCommander 3 , NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
				unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
				unit		Arquebusiers				exp 2 armour 0 weapon_lvl 0
				unit		Arquebusiers				exp 2 armour 0 weapon_lvl 0
				unit		Frz Gendarmes			exp 1 armour 1 weapon_lvl 0
				unit		Frz Gendarmes			exp 2 armour 0 weapon_lvl 0
				unit		Pikemen				exp 2 armour 0 weapon_lvl 0
				unit		Pikemen				exp 2 armour 0 weapon_lvl 0
				unit		Pikemen				exp 2 armour 0 weapon_lvl 0
				unit		NE Serpentine				exp 1 armour 1 weapon_lvl 0
				unit		NE Serpentine				exp 1 armour 1 weapon_lvl 0
			end

			set_counter france_help_lyon 1
		end_if

		if I_CompareCounter france_help_lyon = 1
			inc_counter france_counter_lyon 1
		end_if

		if I_CompareCounter france_counter_lyon = 10
			set_counter france_help_lyon 0
		end_if

	end_monitor

	;-- HRE

	declare_counter hre_help
	declare_counter hre_counter

	monitor_event FactionTurnStart FactionType hre


		if I_CompareCounter hre_help = 0
			and I_NumberOfSettlements hre < 3

			historic_event HRE_Help event/hilfe_aus_dem_reich.bik factions { hre, }

			spawn_army 
				faction hre
				character random_name, named character, age 35, x 178, y 286
				traits GoodCommander 3 , BattleDread 2, NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
				unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
				unit		Gothic Knights				exp 2 armour 0 weapon_lvl 0
				unit		Gothic Knights				exp 2 armour 0 weapon_lvl 0
				unit		Hre Pike Militia			exp 1 armour 1 weapon_lvl 0
				unit		Hre Pike Militia			exp 2 armour 0 weapon_lvl 0
				unit		Hre Pike Militia				exp 2 armour 0 weapon_lvl 0
				unit		Hre Pike Militia			exp 1 armour 1 weapon_lvl 0
				unit		Hre Arquebusiers				exp 1 armour 1 weapon_lvl 0
			end

			spawn_army 
				faction hre
				character random_name, named character, age 28, x 182, y 286
				traits GoodCommander 3 , NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
				unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
				unit		Hre Arquebusiers				exp 2 armour 0 weapon_lvl 0
				unit		Hre Arquebusiers				exp 2 armour 0 weapon_lvl 0
				unit		Landsknecht Pikeniere			exp 1 armour 1 weapon_lvl 0
				unit		Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
				unit		Landsknecht Pikeniere				exp 2 armour 0 weapon_lvl 0
				unit		Landsknecht Pikeniere				exp 2 armour 0 weapon_lvl 0
				unit		Forlorn Hope				exp 2 armour 0 weapon_lvl 0
				unit		NE Serpentine				exp 1 armour 1 weapon_lvl 0
				unit		NE Serpentine				exp 1 armour 1 weapon_lvl 0
			end

			set_counter hre_help 1
		end_if

		if I_CompareCounter hre_help = 1
			inc_counter hre_counter 1
		end_if

		if I_CompareCounter hre_counter = 10
			set_counter hre_help 0
		end_if

	end_monitor

	declare_counter hre_help_wien
	declare_counter hre_counter_wien

	monitor_event FactionTurnStart FactionType hre


		if I_CompareCounter hre_help_wien = 0
			and not I_SettlementOwner Wien = hre

			historic_event HRE_Help event/hilfe_aus_dem_reich.bik factions { hre, }

			spawn_army 
				faction hre
				character random_name, named character, age 35, x 178, y 286
				traits GoodCommander 3 , BattleDread 2, NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
				unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
				unit		Gothic Knights				exp 2 armour 0 weapon_lvl 0
				unit		Gothic Knights				exp 2 armour 0 weapon_lvl 0
				unit		Hre Pike Militia			exp 1 armour 1 weapon_lvl 0
				unit		Hre Pike Militia			exp 2 armour 0 weapon_lvl 0
				unit		Hre Pike Militia				exp 2 armour 0 weapon_lvl 0
				unit		Hre Pike Militia			exp 1 armour 1 weapon_lvl 0
				unit		Hre Arquebusiers				exp 1 armour 1 weapon_lvl 0
			end

			spawn_army 
				faction hre
				character random_name, named character, age 28, x 182, y 286
				traits GoodCommander 3 , NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
				unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
				unit		Hre Arquebusiers				exp 2 armour 0 weapon_lvl 0
				unit		Hre Arquebusiers				exp 2 armour 0 weapon_lvl 0
				unit		Landsknecht Pikeniere			exp 1 armour 1 weapon_lvl 0
				unit		Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
				unit		Landsknecht Pikeniere				exp 2 armour 0 weapon_lvl 0
				unit		Landsknecht Pikeniere				exp 2 armour 0 weapon_lvl 0
				unit		Forlorn Hope				exp 2 armour 0 weapon_lvl 0
				unit		NE Serpentine				exp 1 armour 1 weapon_lvl 0
				unit		NE Serpentine				exp 1 armour 1 weapon_lvl 0
			end

			set_counter hre_help_wien 1
		end_if

		if I_CompareCounter hre_help_wien = 1
			inc_counter hre_counter_wien 1
		end_if

		if I_CompareCounter hre_counter_wien = 10
			set_counter hre_help_wien 0
		end_if

	end_monitor

	;-- Osmanen

	declare_counter turks_help
	declare_counter turks_counter

	monitor_event FactionTurnStart FactionType turks


		if I_CompareCounter turks_help = 0
			and I_NumberOfSettlements turks < 3

			historic_event Turks_Help

			spawn_army 
				faction turks
				character random_name, named character, age 35, x 216, y 180
				traits GoodCommander 3 , BattleDread 2, NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
				unit		ME Late Bodyguard		exp 3 armour 0 weapon_lvl 0
				unit		Sipahis				exp 2 armour 0 weapon_lvl 0
				unit		Sipahis				exp 2 armour 0 weapon_lvl 0
				unit		Janissary Heavy Inf			exp 1 armour 1 weapon_lvl 0
				unit		Janissary Heavy Inf			exp 2 armour 0 weapon_lvl 0
				unit		Janissary Heavy Inf				exp 2 armour 0 weapon_lvl 0
				unit		Janissary Musketeers			exp 1 armour 1 weapon_lvl 0
				unit		Janissary Musketeers				exp 1 armour 1 weapon_lvl 0
			end

			spawn_army 
				faction turks
				character random_name, named character, age 28, x 217, y 178
				traits GoodCommander 3 , NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
				unit		ME Late Bodyguard		exp 3 armour 0 weapon_lvl 0
				unit		Cebeli				exp 2 armour 0 weapon_lvl 0
				unit		Serdengecti				exp 2 armour 0 weapon_lvl 0
				unit		Serdengecti			exp 1 armour 1 weapon_lvl 0
				unit		Dismounted Sipahi Lancers			exp 2 armour 0 weapon_lvl 0
				unit		Dismounted Sipahi Lancers				exp 2 armour 0 weapon_lvl 0
				unit		Dismounted Sipahi Lancers				exp 2 armour 0 weapon_lvl 0
				unit		Janissary Archers				exp 2 armour 0 weapon_lvl 0
				unit		Janissary Archers				exp 1 armour 1 weapon_lvl 0
				unit		ME Grand Bombard				exp 1 armour 1 weapon_lvl 0
			end

			set_counter turks_help 1
		end_if

		if I_CompareCounter turks_help = 1
			inc_counter turks_counter 1
		end_if

		if I_CompareCounter turks_counter = 10
			set_counter turks_help 0
		end_if

	end_monitor

	declare_counter turks_help_sara
	declare_counter turks_counter_sara

	monitor_event FactionTurnStart FactionType turks


		if I_CompareCounter turks_help_sara = 0
			and not I_SettlementOwner Sarajevo = turks

			historic_event Turks_Help

			spawn_army 
				faction turks
				character random_name, named character, age 35, x 216, y 180
				traits GoodCommander 3 , BattleDread 2, NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
				unit		ME Late Bodyguard		exp 3 armour 0 weapon_lvl 0
				unit		Sipahis				exp 2 armour 0 weapon_lvl 0
				unit		Sipahis				exp 2 armour 0 weapon_lvl 0
				unit		Janissary Heavy Inf			exp 1 armour 1 weapon_lvl 0
				unit		Janissary Heavy Inf			exp 2 armour 0 weapon_lvl 0
				unit		Janissary Heavy Inf				exp 2 armour 0 weapon_lvl 0
				unit		Janissary Musketeers			exp 1 armour 1 weapon_lvl 0
				unit		Janissary Musketeers				exp 1 armour 1 weapon_lvl 0
			end

			spawn_army 
				faction turks
				character random_name, named character, age 28, x 217, y 178
				traits GoodCommander 3 , NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
				unit		ME Late Bodyguard		exp 3 armour 0 weapon_lvl 0
				unit		Cebeli				exp 2 armour 0 weapon_lvl 0
				unit		Serdengecti				exp 2 armour 0 weapon_lvl 0
				unit		Serdengecti			exp 1 armour 1 weapon_lvl 0
				unit		Dismounted Sipahi Lancers			exp 2 armour 0 weapon_lvl 0
				unit		Dismounted Sipahi Lancers				exp 2 armour 0 weapon_lvl 0
				unit		Dismounted Sipahi Lancers				exp 2 armour 0 weapon_lvl 0
				unit		Janissary Archers				exp 2 armour 0 weapon_lvl 0
				unit		Janissary Archers				exp 1 armour 1 weapon_lvl 0
				unit		ME Grand Bombard				exp 1 armour 1 weapon_lvl 0
			end

			set_counter turks_help_sara 1
		end_if

		if I_CompareCounter turks_help_sara = 1
			inc_counter turks_counter_sara 1
		end_if

		if I_CompareCounter turks_counter_sara = 10
			set_counter turks_help_sara 0
		end_if

	end_monitor

	;-- Spanien

	declare_counter spain_help
	declare_counter spain_counter

	monitor_event FactionTurnStart FactionType spain


		if I_CompareCounter spain_help = 0
			and I_NumberOfSettlements spain < 3

			historic_event Spain_Help

			spawn_army 
				faction spain
				character random_name, named character, age 35, x 116, y 51
				traits GoodCommander 3 , BattleDread 2, NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
				unit		SE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
				unit		Gendarmes				exp 2 armour 0 weapon_lvl 0
				unit		Gendarmes				exp 2 armour 0 weapon_lvl 0
				unit		Tercio Pikemen			exp 1 armour 1 weapon_lvl 0
				unit		Tercio Pikemen			exp 2 armour 0 weapon_lvl 0
				unit		Tercio Pikemen				exp 2 armour 0 weapon_lvl 0
				unit		Sp Musketeers			exp 1 armour 1 weapon_lvl 0
				unit		Sp Musketeers				exp 1 armour 1 weapon_lvl 0
			end

			spawn_army 
				faction spain
				character random_name, named character, age 28, x 117, y 53
				traits GoodCommander 3 , NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
				unit		SE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
				unit		S Italian Cavalry Militia				exp 2 armour 0 weapon_lvl 0
				unit		S Italian Cavalry Militia				exp 2 armour 0 weapon_lvl 0
				unit		Conquistadores			exp 1 armour 1 weapon_lvl 0
				unit		Sword and Buckler Men			exp 2 armour 0 weapon_lvl 0
				unit		Sword and Buckler Men				exp 2 armour 0 weapon_lvl 0
				unit		Sp Pike Militia				exp 2 armour 0 weapon_lvl 0
				unit		Sp Pike Militia				exp 2 armour 0 weapon_lvl 0
				unit		Arquebusiers				exp 1 armour 1 weapon_lvl 0
				unit		Arquebusiers				exp 1 armour 1 weapon_lvl 0
			end

			set_counter spain_help 1
		end_if

		if I_CompareCounter spain_help = 1
			inc_counter spain_counter 1
		end_if

		if I_CompareCounter spain_counter = 10
			set_counter spain_help 0
		end_if

	end_monitor

	declare_counter spain_help_palermo
	declare_counter spain_counter_palermo

	monitor_event FactionTurnStart FactionType spain


		if I_CompareCounter spain_help_palermo = 0
			and not I_SettlementOwner Palermo = spain

			historic_event Spain_Help

			spawn_army 
				faction spain
				character random_name, named character, age 35, x 116, y 51
				traits GoodCommander 3 , BattleDread 2, NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
				unit		SE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
				unit		Gendarmes				exp 2 armour 0 weapon_lvl 0
				unit		Gendarmes				exp 2 armour 0 weapon_lvl 0
				unit		Tercio Pikemen			exp 1 armour 1 weapon_lvl 0
				unit		Tercio Pikemen			exp 2 armour 0 weapon_lvl 0
				unit		Tercio Pikemen				exp 2 armour 0 weapon_lvl 0
				unit		Sp Musketeers			exp 1 armour 1 weapon_lvl 0
				unit		Sp Musketeers				exp 1 armour 1 weapon_lvl 0
			end

			spawn_army 
				faction spain
				character random_name, named character, age 28, x 117, y 53
				traits GoodCommander 3 , NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
				unit		SE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
				unit		S Italian Cavalry Militia				exp 2 armour 0 weapon_lvl 0
				unit		S Italian Cavalry Militia				exp 2 armour 0 weapon_lvl 0
				unit		Conquistadores			exp 1 armour 1 weapon_lvl 0
				unit		Sword and Buckler Men			exp 2 armour 0 weapon_lvl 0
				unit		Sword and Buckler Men				exp 2 armour 0 weapon_lvl 0
				unit		Sp Pike Militia				exp 2 armour 0 weapon_lvl 0
				unit		Sp Pike Militia				exp 2 armour 0 weapon_lvl 0
				unit		Arquebusiers				exp 1 armour 1 weapon_lvl 0
				unit		Arquebusiers				exp 1 armour 1 weapon_lvl 0
			end

			set_counter spain_help_palermo 1
		end_if

		if I_CompareCounter spain_help_palermo = 1
			inc_counter spain_counter_palermo 1
		end_if

		if I_CompareCounter spain_counter_palermo = 10
			set_counter spain_help_palermo 0
		end_if

	end_monitor


	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Belagerung Wiens
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart I_TurnNumber = 143
		and I_IsFactionAIControlled turks


		historic_event	belagerung_wiens

		spawn_army 
			faction turks
			character Ibrahim Pascha, named character, age 40, x 117, y 178, label siege_wien
			traits GoodCommander 3 , BattleDread 2, NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
			unit		ME Late Bodyguard		exp 6 armour 0 weapon_lvl 0
			unit		Cebeli				exp 4 armour 0 weapon_lvl 0
			unit		Sipahis				exp 2 armour 0 weapon_lvl 0
			unit		Sipahis				exp 2 armour 0 weapon_lvl 0
			unit		Sipahis				exp 2 armour 0 weapon_lvl 0
			unit		Janissary Heavy Inf		exp 2 armour 1 weapon_lvl 0
			unit		Janissary Heavy Inf		exp 4 armour 1 weapon_lvl 0
			unit		Janissary Heavy Inf		exp 5 armour 0 weapon_lvl 0
			unit		Janissary Heavy Inf		exp 0 armour 0 weapon_lvl 0
			unit		Janissary Heavy Inf		exp 1 armour 0 weapon_lvl 0
			unit		Janissary Archers		exp 3 armour 0 weapon_lvl 0
			unit		Janissary Archers		exp 2 armour 0 weapon_lvl 0
			unit		Janissary Archers		exp 2 armour 0 weapon_lvl 0
			unit		ME Cannon			exp 3 armour 0 weapon_lvl 0
			unit		ME Cannon			exp 3 armour 0 weapon_lvl 0
			unit		Serdengecti				exp 5 armour 0 weapon_lvl 0
			unit		Serdengecti				exp 4 armour 0 weapon_lvl 0
			unit		Akinjis				exp 4 armour 0 weapon_lvl 0
			unit		Akinjis				exp 5 armour 0 weapon_lvl 0

		end

		set_faction_standing hre turks -1.0
		set_faction_standing turks hre -1.0

		terminate_monitor
	end_monitor


	monitor_event FactionTurnStart FactionType hre

		and I_CharacterExists siege_wien

		if I_SettlementOwner Wien = turks
			terminate_monitor
		end_if

		if I_SettlementUnderSiege Wien
			and I_EventCounter wien_engage = 0
			terminate_monitor 
		end_if

		if I_EventCounter wien_engage = 1
			siege_settlement siege_wien, Wien, attack
			terminate_monitor
		end_if

		if I_EventCounter wien_engage = 0
			siege_settlement siege_wien, Wien, maintain
			set_event_counter wien_engage 1
		end_if
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Unterdrückung der Hugenotten
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart FactionType france
		and I_LocalFaction france	
		and I_TurnNumber = 147

		historic_event	hugenotten factions { france, }

		spawn_character slave, Lanfrank_Alacoque, heretic, age 45, x 12, y 221
		console_command give_trait "Lanfrank_Alacoque" NaturalHereticSkill 1
		console_command give_trait "Lanfrank_Alacoque" StrongFaith 2

		spawn_character slave, Volo_Robert, heretic, age 22, x 2, y 252
		console_command give_trait "Volo_Robert" NaturalHereticSkill 2
		console_command give_trait "Volo_Robert" StrongFaith 1

		spawn_character slave, Denisot_Karembeu, heretic, age 36, x 11, y 266
		console_command give_trait "Denisot_Karembeu" NaturalHereticSkill 3
		console_command give_trait "Denisot_Karembeu" StrongFaith 1

		spawn_character slave, Arthur_Tristram, heretic, age 28, x 16, y 176
		console_command give_trait "Arthur_Tristram" NaturalHereticSkill 1 
		console_command give_trait "Arthur_Tristram" StrongFaith 3

		add_settlement_turmoil Dijon 25
		add_settlement_turmoil Lyon 25
		add_settlement_turmoil Grenoble 25
		add_settlement_turmoil Chaumont 25

		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Jesuiten
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnEnd FactionType slave
		and I_TurnNumber = 163

		historic_event	jesuiten

		set_event_counter jesuiten 1

		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Sublimus Dei
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnEnd FactionType slave
		and I_TurnNumber >= 175

		historic_event	sublimus_dei

		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Andreas Vesalius
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnEnd FactionType slave
		and I_TurnNumber >= 199

		historic_event	andreas_vesalius

		set_event_counter andreas_vesalius 1

		terminate_monitor
	end_monitor


	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Augsburger Religionsfrieden
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnStart FactionType normans
		and FactionReligion orthodox

		set_event_counter normans_orthodox 1

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType saxons
		and FactionReligion orthodox

		set_event_counter saxons_orthodox 1

		terminate_monitor
	end_monitor


	monitor_event FactionTurnEnd FactionType slave
		and I_TurnNumber = 243

		historic_event	augsburger_frieden

		if I_EventCounter normans_orthodox = 1

			console_command diplomatic_stance normans hre neutral

		end_if

		if I_EventCounter saxons_orthodox = 1

			console_command diplomatic_stance saxons hre neutral

		end_if

		terminate_monitor
	end_monitor

	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Frieden von Cateau Cambresis
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	monitor_event FactionTurnEnd FactionType slave
		and I_TurnNumber = 255

		historic_event	chateau_cambresis

		terminate_monitor
	end_monitor


	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Rebellion in Afrika
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


	monitor_event FactionTurnStart FactionIsLocal
		and I_EventCounter eroberung_tunis = 1

		inc_event_counter tunis_time_counter 1

	end_monitor

	monitor_event FactionTurnStart FactionType slave
		and I_EventCounter eroberung_tunis = 1
		and I_EventCounter tunis_time_counter = 10
		and not I_SettlementOwner Tunis = turks

		historic_event rebellion_afrika

		spawn_army 
			faction slave, sub_faction turks
			character Baraka Gazi, named character, age 54, x 77, y 28, label siege_tunis
			traits GoodCommander 2 , NaturalMilitarySkill 1, ReligionStarter 1, GoodAttacker 2
			unit		Tuareg Camel Spearmens			exp 7 armour 0 weapon_lvl 0
			unit		Bedouin Camel Riders			exp 2 armour 0 weapon_lvl 0
			unit		Bedouin Camel Riders			exp 1 armour 0 weapon_lvl 0
			unit		Akinjis					exp 4 armour 0 weapon_lvl 0
			unit		Bedouin Cavalry				exp 3 armour 0 weapon_lvl 0
			unit		Sudanese Javelinmen			exp 2 armour 0 weapon_lvl 0
			unit		Sudanese Javelinmen			exp 4 armour 0 weapon_lvl 0
			unit		Desert Archers				exp 3 armour 0 weapon_lvl 0
			unit		Desert Archers				exp 1 armour 1 weapon_lvl 0
			unit		Desert Archers				exp 4 armour 1 weapon_lvl 0
			unit		Sudanese Tribesmen			exp 3 armour 0 weapon_lvl 0
			unit		Sudanese Tribesmen			exp 2 armour 0 weapon_lvl 0
			unit		Sudanese Tribesmen			exp 4 armour 0 weapon_lvl 0
			unit		Sudanese Tribesmen			exp 0 armour 0 weapon_lvl 0
			unit		Ghazis					exp 5 armour 0 weapon_lvl 0
			unit		Ghazis					exp 2 armour 0 weapon_lvl 0
			unit		Ghazis					exp 3 armour 0 weapon_lvl 0
			unit		Saracen Militia				exp 0 armour 1 weapon_lvl 0
			unit		Saracen Militia				exp 6 armour 0 weapon_lvl 0
		end

		add_settlement_turmoil Tunis 15

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType slave

		and I_CharacterExists siege_tunis

		if I_SettlementOwner Tunis = slave
			terminate_monitor
		end_if

		if I_SettlementUnderSiege Tunis
			and I_EventCounter tunis_engage = 0
			terminate_monitor 
		end_if

		if I_EventCounter tunis_engage = 1
			siege_settlement siege_tunis, Tunis, attack
			terminate_monitor
		end_if

		if I_EventCounter tunis_engage = 0
			siege_settlement siege_tunis, Tunis, maintain
			set_event_counter tunis_engage 1
		end_if
	end_monitor
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Seuchen
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	;Moved to descr_events

	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;;;;;;;;;;;;				Script Ende
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	;------------------------------------------------------------------------------
	;---------------------- Papst erwählen ----------------------------------------
	;------------------------------------------------------------------------------

	declare_counter papst_erwahlt

	monitor_event FactionTurnStart TrueCondition
		and not I_EventCounter papst_suchen = 1
		and I_NumberOfSettlements papal_states < 1 

		if I_SettlementOwner Rome = france

			historic_event papst_wahlen 

			set_event_counter papst_suchen 1

			terminate_monitor
		end_if

		if I_SettlementOwner Rome = hre

			historic_event papst_wahlen 

			set_event_counter papst_suchen 1

			terminate_monitor
		end_if

		if I_SettlementOwner Rome = hungary

			historic_event papst_wahlen 

			set_event_counter papst_suchen 1

			terminate_monitor
		end_if

		if I_SettlementOwner Rome = milan

			historic_event papst_wahlen 

			set_event_counter papst_suchen 1

			terminate_monitor
		end_if

		if I_SettlementOwner Rome = venice

			historic_event papst_wahlen 

			set_event_counter papst_suchen 1

			terminate_monitor
		end_if

		if I_SettlementOwner Rome = sicily

			historic_event papst_wahlen 

			set_event_counter papst_suchen 1

			terminate_monitor
		end_if

		if I_SettlementOwner Rome = spain

			historic_event papst_wahlen 

			set_event_counter papst_suchen 1

			terminate_monitor
		end_if

		if I_SettlementOwner Rome = poland

			historic_event papst_wahlen 

			set_event_counter papst_suchen 1

			terminate_monitor
		end_if


	end_monitor

	monitor_event SettlementSelected SettlementName Rome
		and I_EventCounter papst_suchen = 1
		and not I_WorldwideAncillaryExists papst 

		if I_SettlementOwner Rome = poland

			historic_event neuer_papst

			set_event_counter papst_aussuchen 1

		end_if

		if I_SettlementOwner Rome = spain

			historic_event neuer_papst

			set_event_counter papst_aussuchen 1

		end_if

		if I_SettlementOwner Rome = sicily

			historic_event neuer_papst

			set_event_counter papst_aussuchen 1

		end_if

		if I_SettlementOwner Rome = venice

			historic_event neuer_papst

			set_event_counter papst_aussuchen 1

		end_if

		if I_SettlementOwner Rome = milan

			historic_event neuer_papst

			set_event_counter papst_aussuchen 1

		end_if

		if I_SettlementOwner Rome = hungary

			historic_event neuer_papst

			set_event_counter papst_aussuchen 1

		end_if

		if I_SettlementOwner Rome = hre

			historic_event neuer_papst

			set_event_counter papst_aussuchen 1

		end_if

		if I_SettlementOwner Rome = france

			historic_event neuer_papst

			set_event_counter papst_aussuchen 1

		end_if

	end_monitor

	monitor_event CharacterSelected I_EventCounter papst_aussuchen = 1
		and not AgentType = spy
		and not AgentType = admiral
		and not AgentType = diplomat
		and not AgentType = assassin
		and not AgentType = princess
		and not AgentType = merchant
		and not IsFactionHeir
		and not IsFactionLeader
		and not IsMarried
		and FactionIsLocal
		and not CharacterReligion pagan
		and not CharacterReligion islam
		and not CharacterReligion orthodox

		campaign_wait 0.1

		set_event_counter papst_aussuchen 0
		set_counter papst_erwahlt 1

	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Unabhängigkeit Ragusa ---------------------------------
	;------------------------------------------------------------------------------

	monitor_event SettlementTurnStart SettlementName Ragusa

		if I_SettlementOwner Ragusa = scotland
			set_event_counter ragusa_un 1
		end_if

		if not I_SettlementOwner Ragusa = scotland
			set_event_counter ragusa_un 0
		end_if

		if I_TurnNumber = 1
			and I_SettlementOwner Ragusa = scotland
			historic_event ragusa_info factions { turks, }
			terminate_monitor
		end_if

	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Unabhängigkeit Genua ----------------------------------
	;------------------------------------------------------------------------------

	monitor_event SettlementTurnStart SettlementName Genua

		if I_SettlementOwner Genua = denmark
			set_event_counter genua_un 1
		end_if

		if not I_SettlementOwner Genua = denmark
			set_event_counter genua_un 0
		end_if

		if I_TurnNumber = 1
			and I_SettlementOwner Genua = denmark
			historic_event genua_info factions { milan, }
			terminate_monitor
		end_if

	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Unabhängigkeit Gaeta ----------------------------------
	;------------------------------------------------------------------------------
	monitor_event SettlementTurnStart SettlementName Gaeta

		if I_SettlementOwner Gaeta = slave
			set_event_counter gaeta_un 1
		end_if

		if not I_SettlementOwner Gaeta = slave
			set_event_counter gaeta_un 0
		end_if

		if I_TurnNumber = 1
			and I_SettlementOwner Gaeta = slave
			historic_event gaeta_info factions { sicily, }
			terminate_monitor
		end_if

	end_monitor
	;------------------------------------------------------------------------------
	;---------------------- Unabhängigkeit Ancona ---------------------------------
	;------------------------------------------------------------------------------
	monitor_event SettlementTurnStart SettlementName Ancona

		if I_SettlementOwner Ancona = slave
			set_event_counter ancona_un 1
		end_if

		if not I_SettlementOwner Ancona = slave
			set_event_counter ancona_un 0
		end_if

		if I_TurnNumber = 1
			and I_SettlementOwner Ancona = slave
			historic_event ancona_info factions { papal_states, }
			terminate_monitor
		end_if

	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Johanniter Unterstützung ------------------------------
	;------------------------------------------------------------------------------
	declare_counter johanniter

	monitor_event FactionTurnStart I_TurnNumber = 112

		if I_LocalFaction milan
			historic_event johanniter_help true
		end_if

		if I_LocalFaction venice
			historic_event johanniter_help true
		end_if

		if I_LocalFaction poland
			historic_event johanniter_help true
		end_if

		if I_LocalFaction papal_states
			historic_event johanniter_help true
		end_if

		if I_LocalFaction sicily
			historic_event johanniter_help true
		end_if

		if I_LocalFaction spain
			historic_event johanniter_help true
		end_if

		if I_LocalFaction denmark
			historic_event johanniter_help true
		end_if

		terminate_monitor
	end_monitor

	monitor_event EventCounter EventCounterType johanniter_help_accepted

		console_command add_money -10000

		historic_event johanniter_help_ja

		set_counter johanniter 1
		terminate_monitor
	end_monitor


	monitor_event EventCounter EventCounterType johanniter_help_declined


		historic_event johanniter_help_nein

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart I_TurnNumber = 116
		and I_CompareCounter johanniter = 1

		if I_LocalFaction milan

			historic_event johanniter_dank

			console_command add_money 5000

			spawn_army
				faction	milan
				character	random_name, admiral, age 40, x 217, y 61, direction W
				unit		war galley			exp 0 armour 0 weapon_lvl 0
			end

			spawn_army 
				faction milan
				character	random_name, named character, age 33, x 217, y 61
				traits johanniter_ritter 1
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
			end

			snap_strat_camera 217, 71		
			zoom_strat_camera 0.1
		end_if

		if I_LocalFaction venice

			historic_event johanniter_dank

			console_command add_money 5000

			spawn_army
				faction	venice
				character	random_name, admiral, age 40, x 217, y 61, direction W
				unit		war galley			exp 0 armour 0 weapon_lvl 0
			end

			spawn_army 
				faction venice
				character	random_name, named character, age 33, x 217, y 61
				traits johanniter_ritter 1
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
			end

			snap_strat_camera 217, 71		
			zoom_strat_camera 0.1
		end_if

		if I_LocalFaction poland

			historic_event johanniter_dank

			console_command add_money 5000

			spawn_army
				faction	poland
				character	random_name, admiral, age 40, x 217, y 61, direction W
				unit		war galley			exp 0 armour 0 weapon_lvl 0
			end

			spawn_army 
				faction poland
				character	random_name, named character, age 33, x 217, y 61
				traits johanniter_ritter 1
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
			end

			snap_strat_camera 217, 71		
			zoom_strat_camera 0.1
		end_if

		if I_LocalFaction papal_states

			historic_event johanniter_dank

			console_command add_money 5000

			spawn_army
				faction	papal_states
				character	random_name, admiral, age 40, x 217, y 61, direction W
				unit		war galley			exp 0 armour 0 weapon_lvl 0
			end

			spawn_army 
				faction papal_states
				character	random_name, named character, age 33, x 217, y 61
				traits johanniter_ritter 1
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
			end

			snap_strat_camera 217, 71		
			zoom_strat_camera 0.1
		end_if

		if I_LocalFaction sicily

			historic_event johanniter_dank

			console_command add_money 5000

			spawn_army
				faction	sicily
				character	random_name, admiral, age 40, x 217, y 61, direction W
				unit		war galley			exp 0 armour 0 weapon_lvl 0
			end

			spawn_army 
				faction sicily
				character	random_name, named character, age 33, x 217, y 61
				traits johanniter_ritter 1
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
			end


			snap_strat_camera 217, 71	
			zoom_strat_camera 0.1
		end_if

		if I_LocalFaction spain

			historic_event johanniter_dank

			console_command add_money 5000

			spawn_army
				faction		spain
				character	random_name, admiral, age 40, x 217, y 61, direction W
				unit		war galley			exp 0 armour 0 weapon_lvl 0
			end

			spawn_army 
				faction spain
				character	random_name, named character, age 33, x 217, y 61
				traits johanniter_ritter 1
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
			end

			snap_strat_camera 217, 71		
			zoom_strat_camera 0.1
		end_if

		if I_LocalFaction denmark

			historic_event johanniter_dank

			console_command add_money 5000

			spawn_army
				faction	denmark
				character	random_name, admiral, age 40, x 217, y 61, direction W
				unit		war galley			exp 0 armour 0 weapon_lvl 0
			end

			spawn_army 
				faction denmark
				character	random_name, named character, age 33, x 217, y 61
				traits johanniter_ritter 1
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
				unit		Johanniter Beritten		exp 1 armour 0 weapon_lvl 0
			end

			snap_strat_camera 217, 71		
			zoom_strat_camera 0.1
		end_if

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Italienzug von Charles --------------------------------
	;------------------------------------------------------------------------------

	declare_counter italienzug	;Findet der Italienzug statt?
	declare_counter invasion_klein
	declare_counter invasion_gross

	;------------------------------------------------------------------------------
	;---------------------- Erster Akt --------------------------------------------
	;------------------------------------------------------------------------------

	;------------------------------------------------------------------------------
	;---------------------- Frankreich (Akt I) ------------------------------------
	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart FactionType france

		historic_event frankreich_info true factions { france, }

		send_character_off_map Charles de Valois

		terminate_monitor
	end_monitor

	;---------------------- Angenommen 
	monitor_event EventCounter EventCounterType frankreich_info_accepted
		and I_CompareCounter Spieler_ist_Frankreich = 1

		set_counter italienzug 1

		set_faction_standing france sicily -1.0
		set_faction_standing sicily france -1.0

		set_faction_standing france venice -0.5
		set_faction_standing venice france -0.5

		set_faction_standing france milan 1.0
		set_faction_standing milan france 1.0

		set_faction_standing france savoy 1.0
		set_faction_standing savoy france 1.0

		set_faction_standing france montferrat 1.0
		set_faction_standing montferrat france 1.0

		set_faction_standing france denmark 1.0
		set_faction_standing denmark france 1.0

		set_faction_standing france lucca 0.5
		set_faction_standing lucca france 0.5

		console_command diplomatic_stance france sicily War
		console_command diplomatic_stance france milan Allied

		console_command add_money france, -5000

		historic_event frankreich_info_yes

		terminate_monitor
	end_monitor

	;---------------------- Abgelehnt
	monitor_event EventCounter EventCounterType frankreich_info_declined
		and I_CompareCounter Spieler_ist_Frankreich = 1

		add_settlement_turmoil Torino 80
		add_settlement_turmoil Nice 80
		add_settlement_turmoil Chaumont 80
		add_settlement_turmoil Grenoble 80
		add_settlement_turmoil Dijon 80
		add_settlement_turmoil Vienne 80
		add_settlement_turmoil Marseille 80
		add_settlement_turmoil Lyon 80

		spawn_army 
			faction france
			character	Charles de Valois, named character, age 23, x 9, y 229 
			traits Factionleader 1 , GoodCommander 2 , Intelligent 2 , Austere 1 , PublicFaith 1 , StrategyChivalry 1 , ReligionStarter 1 
			unit		NE Late Bodyguard			exp 5 armour 0 weapon_lvl 0
			unit		Frz Gendarmes				exp 3 armour 0 weapon_lvl 0
			unit		Frz Gendarmes				exp 3 armour 0 weapon_lvl 0
			unit		Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
		end

		historic_event frankreich_info_no

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Neapel (Akt I) ----------------------------------------
	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart I_CompareCounter Spieler_ist_Neapel = 1
		historic_event neapel_florenz true

		terminate_monitor
	end_monitor

	;---------------------- Angenommen 


	monitor_event EventCounter EventCounterType neapel_florenz_accepted
		and I_CompareCounter Spieler_ist_Neapel = 1

		generate_random_counter	florenz_geschenk_accepted 1 2

		if I_EventCounter florenz_geschenk_accepted = 1

			set_counter invasion_klein 1
			set_counter invasion_gross 5

			set_faction_standing france sicily -1.0
			set_faction_standing sicily france -1.0

			set_faction_standing denmark sicily 1.0
			set_faction_standing sicily denmark 1.0

			set_faction_standing france venice -0.5
			set_faction_standing venice france -0.5

			set_faction_standing france milan 1.0
			set_faction_standing milan france 1.0

			set_faction_standing france savoy 1.0
			set_faction_standing savoy france 1.0

			set_faction_standing france montferrat 1.0
			set_faction_standing montferrat france 1.0

			set_faction_standing france denmark -0.5
			set_faction_standing denmark france -0.5

			set_faction_standing france lucca 0.5
			set_faction_standing lucca france 0.5

			console_command diplomatic_stance france sicily War
			console_command diplomatic_stance france denmark War
			console_command diplomatic_stance denmark sicily Allied
			console_command diplomatic_stance france milan Allied

			console_command add_money sicily, -5000

			historic_event neapel_florenz_gut_yes
		end_if

		if I_EventCounter florenz_geschenk_accepted = 2

			set_counter invasion_gross 1
			set_counter invasion_klein 5

			set_faction_standing france sicily -1.0
			set_faction_standing sicily france -1.0

			set_faction_standing denmark sicily -1.0
			set_faction_standing sicily denmark -1.0

			set_faction_standing france venice -0.5
			set_faction_standing venice france -0.5

			set_faction_standing france milan 1.0
			set_faction_standing milan france 1.0

			set_faction_standing france savoy 1.0
			set_faction_standing savoy france 1.0

			set_faction_standing france montferrat 1.0
			set_faction_standing montferrat france 1.0

			set_faction_standing france denmark 1.0
			set_faction_standing denmark france 1.0

			set_faction_standing france lucca 0.5
			set_faction_standing lucca france 0.5

			console_command diplomatic_stance france sicily War
			console_command diplomatic_stance france milan Allied

			console_command add_money sicily, -5000

			historic_event neapel_florenz_schlecht_yes
		end_if

		terminate_monitor
	end_monitor

	;---------------------- Abgelehnt
	monitor_event EventCounter EventCounterType neapel_florenz_declined
		and I_CompareCounter Spieler_ist_Neapel = 1

		set_counter invasion_gross 1
		set_counter invasion_klein 5


		set_faction_standing france sicily -1.0
		set_faction_standing sicily france -1.0

		set_faction_standing france venice -0.5
		set_faction_standing venice france -0.5

		set_faction_standing france milan 1.0
		set_faction_standing milan france 1.0

		set_faction_standing france savoy 1.0
		set_faction_standing savoy france 1.0

		set_faction_standing france montferrat 1.0
		set_faction_standing montferrat france 1.0

		set_faction_standing france denmark 1.0
		set_faction_standing denmark france 1.0

		set_faction_standing france lucca 0.5
		set_faction_standing lucca france 0.5

		console_command diplomatic_stance france sicily War
		console_command diplomatic_stance france milan Allied

		historic_event neapel_florenz_no

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Mailand (Akt I) ---------------------------------------
	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart I_CompareCounter Spieler_ist_Mailand = 1

		historic_event mailand_frankreich true

		terminate_monitor
	end_monitor


	;---------------------- Angenommen 

	monitor_event EventCounter EventCounterType mailand_frankreich_accepted
		and I_CompareCounter Spieler_ist_Mailand = 1

		set_faction_standing france sicily -0.5
		set_faction_standing sicily france -0.5

		set_faction_standing venice france -0.5
		set_faction_standing france venice -0.5

		set_faction_standing venice milan -0.5
		set_faction_standing milan venice -0.5

		set_faction_standing france milan 0.5
		set_faction_standing milan france 0.5

		set_faction_standing france savoy 1.0
		set_faction_standing savoy france 1.0

		set_faction_standing france montferrat 1.0
		set_faction_standing montferrat france 1.0

		set_faction_standing france denmark 1.0
		set_faction_standing denmark france 1.0

		set_faction_standing france lucca 0.5
		set_faction_standing lucca france 0.5

		console_command diplomatic_stance france sicily War
		console_command diplomatic_stance france milan Allied

		historic_event mailand_frankreich_ja


		terminate_monitor
	end_monitor

	;---------------------- Abgelehnt
	monitor_event EventCounter EventCounterType mailand_frankreich_declined
		and I_CompareCounter Spieler_ist_Mailand = 1

		set_faction_standing france sicily -0.5
		set_faction_standing sicily france -0.5

		set_faction_standing venice france -0.5
		set_faction_standing france venice -0.5

		set_faction_standing sicily milan 0.5
		set_faction_standing milan sicily 0.5

		set_faction_standing france savoy 1.0
		set_faction_standing savoy france 1.0

		set_faction_standing france montferrat 1.0
		set_faction_standing montferrat france 1.0

		set_faction_standing france denmark 1.0
		set_faction_standing denmark france 1.0

		set_faction_standing france lucca 0.5
		set_faction_standing lucca france 0.5

		console_command diplomatic_stance france sicily War
		console_command diplomatic_stance france milan War

		historic_event mailand_frankreich_nein

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Florenz (Akt I) ---------------------------------------
	;------------------------------------------------------------------------------

	declare_counter florenz_angegriffen	;Wird Florenz belagert JA/NEIN?

	monitor_event FactionTurnStart I_CompareCounter Spieler_ist_Florenz = 1
		and I_TurnNumber = 1
		historic_event florenz_tribut true

		terminate_monitor
	end_monitor

	;---------------------- Angenommen 
	monitor_event EventCounter EventCounterType florenz_tribut_accepted

		console_command add_money poland, -5000

		send_character_off_map Piero de Medici
		send_character_off_map Giovanni de Medici

		set_counter florenz_angegriffen 1

		set_event_counter medici_abwesend 1		;löst ANC "gonfaloniere" aus, Events: Wiedereinsetzung der Medici
		set_event_counter florenz_tribut_angenommen 1	;löst Events: Drohung des Papstes, Das Feuer der Eitelkeiten - Folgeevents: Hinrichtung Savonarola
		;löst Events: Der Krieg mit Pisa

		spawn_army 					;Piero bekommt auch noch das ANC "gonfaloniere"
			faction poland 
			character	Piero Capponi, named character, age 33, x 100, y 171 
			traits GoodCommander 3, Intelligent 1, PublicFaith 1, PoliticsSkill 1, ReligionStarter 1
			unit		M Lancers		exp 4 armour 0 weapon_lvl 0
			unit		FL Landsknecht Pikeniere		exp 2 armour 0 weapon_lvl 0
			unit		FL Landsknecht Pikeniere		exp 2 armour 0 weapon_lvl 0
			unit		FL Landsknecht Pikeniere		exp 2 armour 0 weapon_lvl 0
		end

		console_command give_ancillary "Piero Capponi" gonfaloniere

		console_command diplomatic_stance france poland War

		historic_event florenz_tribut_yes

		terminate_monitor
	end_monitor

	;-- Abgelehnt
	monitor_event EventCounter EventCounterType florenz_tribut_declined
		and I_CompareCounter Spieler_ist_Florenz = 1

		generate_random_counter	florenz_tribut 1 3

		if I_EventCounter florenz_tribut = 1

			set_counter florenz_angegriffen 1

			set_faction_standing france poland -1.0
			set_faction_standing poland france -1.0

			console_command diplomatic_stance france poland War

			spawn_army 
				faction poland
				character	Baldassare, general, age 30, x 100, y 171 
				unit		FL Landsknecht Pikeniere		exp 4 armour 0 weapon_lvl 0
				unit		FL Landsknecht Pikeniere		exp 2 armour 0 weapon_lvl 0
				unit		FL Landsknecht Pikeniere		exp 2 armour 0 weapon_lvl 0
			end

			historic_event florenz_tribut_schlecht_no
		end_if

		if I_EventCounter florenz_tribut = 2

			set_faction_standing france poland -1.0
			set_faction_standing poland france -1.0

			historic_event florenz_tribut_gut_no
		end_if

		if I_EventCounter florenz_tribut = 3

			set_counter florenz_angegriffen 1

			set_faction_standing france poland -1.0
			set_faction_standing poland france -1.0

			console_command diplomatic_stance france poland War

			spawn_army 
				faction poland
				character	Baldassare, general, age 30, x 100, y 171 
				unit		FL Landsknecht Pikeniere		exp 4 armour 0 weapon_lvl 0
				unit		FL Landsknecht Pikeniere		exp 2 armour 0 weapon_lvl 0
				unit		FL Landsknecht Pikeniere		exp 2 armour 0 weapon_lvl 0
			end

			historic_event florenz_tribut_schlecht_no
		end_if

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Genua (Akt I) -----------------------------------------
	;------------------------------------------------------------------------------

	declare_counter genua_granted_permission	;Genoa has granted France permission to march through

	monitor_event FactionTurnStart I_CompareCounter Spieler_ist_Genua = 1

		historic_event genua_frankreich true

		terminate_monitor
	end_monitor


	;---------------------- Angenommen 

	monitor_event EventCounter EventCounterType genua_frankreich_accepted
		and I_CompareCounter Spieler_ist_Genua = 1

		set_faction_standing france sicily -0.5
		set_faction_standing sicily france -0.5

		set_faction_standing venice france -0.5
		set_faction_standing france venice -0.5

		set_faction_standing venice milan -0.5
		set_faction_standing milan venice -0.5

		set_faction_standing venice denmark -0.5
		set_faction_standing denmark venice -0.5

		set_faction_standing denmark sicily -0.5
		set_faction_standing sicily denmark -0.5

		set_faction_standing france denmark 0.5
		set_faction_standing denmark france 0.5

		set_faction_standing france savoy 1.0
		set_faction_standing savoy france 1.0

		set_faction_standing france montferrat 1.0
		set_faction_standing montferrat france 1.0

		set_faction_standing france lucca 0.5
		set_faction_standing lucca france 0.5

		console_command diplomatic_stance france sicily War
		console_command diplomatic_stance savoy sicily War
		console_command diplomatic_stance france milan Allied

		historic_event genua_frankreich_ja

		set_counter genua_granted_permission 1

		terminate_monitor
	end_monitor

	;---------------------- Abgelehnt
	monitor_event EventCounter EventCounterType genua_frankreich_declined
		and I_CompareCounter Spieler_ist_Genua = 1

		set_faction_standing france sicily -0.5
		set_faction_standing sicily france -0.5

		set_faction_standing venice france -0.5
		set_faction_standing france venice -0.5

		set_faction_standing denmark france -0.5
		set_faction_standing france denmark -0.5

		set_faction_standing sicily denmark 0.5
		set_faction_standing denmark sicily 0.5

		set_faction_standing france savoy 1.0
		set_faction_standing savoy france 1.0

		set_faction_standing france montferrat 1.0
		set_faction_standing montferrat france 1.0

		set_faction_standing france lucca 0.5
		set_faction_standing lucca france 0.5

		console_command diplomatic_stance france sicily War
		console_command diplomatic_stance france denmark War
		console_command diplomatic_stance france milan Allied

		historic_event genua_frankreich_nein

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Savoyen (Akt I) ---------------------------------------
	;------------------------------------------------------------------------------

	declare_counter savoy_granted_permission	;Savoy has granted France permission to march through

	monitor_event FactionTurnStart I_CompareCounter Spieler_ist_Savoyen = 1

		historic_event savoyen_frankreich true

		terminate_monitor
	end_monitor


	;---------------------- Angenommen 

	monitor_event EventCounter EventCounterType savoyen_frankreich_accepted
		and I_CompareCounter Spieler_ist_Savoyen = 1

		set_faction_standing france sicily -0.5
		set_faction_standing sicily france -0.5

		set_faction_standing venice france -0.5
		set_faction_standing france venice -0.5

		set_faction_standing venice milan -0.5
		set_faction_standing milan venice -0.5

		set_faction_standing venice savoy -0.5
		set_faction_standing savoy venice -0.5

		set_faction_standing savoy sicily -0.5
		set_faction_standing sicily savoy -0.5

		set_faction_standing france savoy 0.5
		set_faction_standing savoy france 0.5

		set_faction_standing france denmark 1.0
		set_faction_standing denmark france 1.0

		set_faction_standing france montferrat 1.0
		set_faction_standing montferrat france 1.0

		set_faction_standing france lucca 0.5
		set_faction_standing lucca france 0.5

		console_command diplomatic_stance france sicily War
		console_command diplomatic_stance savoy sicily War 
		console_command diplomatic_stance france milan Allied

		historic_event savoyen_frankreich_ja

		set_counter savoy_granted_permission 1

		terminate_monitor
	end_monitor

	;---------------------- Abgelehnt
	monitor_event EventCounter EventCounterType savoyen_frankreich_declined
		and I_CompareCounter Spieler_ist_Savoyen = 1

		set_faction_standing france sicily -0.5
		set_faction_standing sicily france -0.5

		set_faction_standing venice france -0.5
		set_faction_standing france venice -0.5

		set_faction_standing savoy france -0.9
		set_faction_standing france savoy -0.9

		set_faction_standing sicily savoy 0.5
		set_faction_standing savoy sicily 0.5

		set_faction_standing france denmark 1.0
		set_faction_standing denmark france 1.0

		set_faction_standing france montferrat 1.0
		set_faction_standing montferrat france 1.0

		set_faction_standing france lucca 0.5
		set_faction_standing lucca france 0.5

		console_command diplomatic_stance france sicily War
		console_command diplomatic_stance france milan Allied

		historic_event savoyen_frankreich_nein

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Montferrat (Akt I) ------------------------------------
	;------------------------------------------------------------------------------

	declare_counter montferrat_granted_permission	;Montferrat has granted France permission to march through

	monitor_event FactionTurnStart I_CompareCounter Spieler_ist_Montferrat = 1

		historic_event montferrat_frankreich true

		terminate_monitor
	end_monitor


	;---------------------- Angenommen 

	monitor_event EventCounter EventCounterType montferrat_frankreich_accepted
		and I_CompareCounter Spieler_ist_Montferrat = 1

		set_faction_standing france sicily -0.5
		set_faction_standing sicily france -0.5

		set_faction_standing venice france -0.5
		set_faction_standing france venice -0.5

		set_faction_standing venice milan -0.5
		set_faction_standing milan venice -0.5

		set_faction_standing venice montferrat -0.5
		set_faction_standing montferrat venice -0.5

		set_faction_standing montferrat sicily -0.5
		set_faction_standing sicily montferrat -0.5

		set_faction_standing france montferrat 0.5
		set_faction_standing montferrat france 0.5

		set_faction_standing france denmark 1.0
		set_faction_standing denmark france 1.0

		set_faction_standing france savoy 1.0
		set_faction_standing savoy france 1.0

		set_faction_standing france lucca 0.5
		set_faction_standing lucca france 0.5

		console_command diplomatic_stance france sicily War
		console_command diplomatic_stance montferrat sicily War
		console_command diplomatic_stance france milan Allied

		historic_event montferrat_frankreich_ja

		set_counter montferrat_granted_permission 1

		terminate_monitor
	end_monitor

	;---------------------- Abgelehnt
	monitor_event EventCounter EventCounterType montferrat_frankreich_declined
		and I_CompareCounter Spieler_ist_Montferrat = 1

		set_faction_standing france sicily -0.5
		set_faction_standing sicily france -0.5

		set_faction_standing venice france -0.5
		set_faction_standing france venice -0.5

		set_faction_standing montferrat france -0.9
		set_faction_standing france montferrat -0.9

		set_faction_standing sicily montferrat 0.5
		set_faction_standing montferrat sicily 0.5

		set_faction_standing france denmark 1.0
		set_faction_standing denmark france 1.0

		set_faction_standing france savoy 1.0
		set_faction_standing savoy france 1.0

		set_faction_standing france lucca 0.5
		set_faction_standing lucca france 0.5

		console_command diplomatic_stance france sicily War
		console_command diplomatic_stance france milan Allied

		historic_event montferrat_frankreich_nein

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Lucca (Akt I) ------------------------------------
	;------------------------------------------------------------------------------

	declare_counter lucca_granted_permission	;Lucca has granted France permission to march through

	monitor_event FactionTurnStart I_CompareCounter Spieler_ist_Lucca = 1

		historic_event lucca_frankreich true

		terminate_monitor
	end_monitor


	;---------------------- Angenommen 

	monitor_event EventCounter EventCounterType lucca_frankreich_accepted
		and I_CompareCounter Spieler_ist_Lucca = 1

		set_faction_standing france sicily -0.5
		set_faction_standing sicily france -0.5

		set_faction_standing venice france -0.5
		set_faction_standing france venice -0.5

		set_faction_standing venice milan -0.5
		set_faction_standing milan venice -0.5

		set_faction_standing venice lucca -0.5
		set_faction_standing lucca venice -0.5

		set_faction_standing lucca sicily -0.5
		set_faction_standing sicily lucca -0.5

		set_faction_standing france lucca 0.5
		set_faction_standing lucca france 0.5

		set_faction_standing france denmark 1.0
		set_faction_standing denmark france 1.0

		set_faction_standing france savoy 1.0
		set_faction_standing savoy france 1.0

		set_faction_standing france montferrat 1.0
		set_faction_standing montferrat france 1.0

		console_command diplomatic_stance france sicily War
		console_command diplomatic_stance france lucca Allied

		historic_event lucca_frankreich_ja

		set_counter lucca_granted_permission 1

		terminate_monitor
	end_monitor

	;---------------------- Abgelehnt
	monitor_event EventCounter EventCounterType lucca_frankreich_declined
		and I_CompareCounter Spieler_ist_Lucca = 1

		set_faction_standing france sicily -0.5
		set_faction_standing sicily france -0.5

		set_faction_standing venice france -0.5
		set_faction_standing france venice -0.5

		set_faction_standing lucca france -0.9
		set_faction_standing france lucca -0.9

		set_faction_standing sicily lucca 0.5
		set_faction_standing lucca sicily 0.5

		set_faction_standing france denmark 1.0
		set_faction_standing denmark france 1.0

		set_faction_standing france savoy 1.0
		set_faction_standing savoy france 1.0

		set_faction_standing france montferrat 1.0
		set_faction_standing montferrat france 1.0

		console_command diplomatic_stance france sicily War
		console_command diplomatic_stance france milan Allied

		historic_event lucca_frankreich_nein

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Andere Fraktionen (Akt I) -----------------------------
	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart FactionIsLocal
		and not FactionType france
		and not FactionType sicily
		and not FactionType montferrat
		and not FactionType savoy
		and not FactionType milan
		and not FactionType denmark
		and not FactionType lucca

		console_command diplomatic_stance france sicily War
		console_command diplomatic_stance milan sicily War
		console_command diplomatic_stance france milan Allied

		set_faction_standing france sicily -1.0
		set_faction_standing sicily france -1.0

		set_faction_standing france venice -0.5
		set_faction_standing venice france -0.5

		set_faction_standing denmark sicily -0.5
		set_faction_standing sicily denmark -0.5

		set_faction_standing montferrat sicily -0.5
		set_faction_standing sicily montferrat -0.5

		set_faction_standing savoy sicily -0.5
		set_faction_standing sicily savoy -0.5

		set_faction_standing france milan 1.0
		set_faction_standing milan france 1.0

		set_faction_standing france savoy 1.0
		set_faction_standing savoy france 1.0

		set_faction_standing france montferrat 1.0
		set_faction_standing montferrat france 1.0

		set_faction_standing france denmark 1.0
		set_faction_standing denmark france 1.0

		set_faction_standing france lucca 0.5
		set_faction_standing lucca france 0.5

		historic_event italienzug factions { poland, hre, saxons, hungary, venice, papal_states, normans, turks, spain, byzantium, denmark, england, russia, scotland, egypt, timurids, urbino, }

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Zweiter Akt -------------------------------------------
	;------------------------------------------------------------------------------

	;------------------------------------------------------------------------------
	;---------------------- Frankreich (Akt II A) ---------------------------------
	;------------------------------------------------------------------------------

	declare_counter florenz_erobern		;Muss Florenz erobert werden?

	monitor_event FactionTurnStart I_CompareCounter Spieler_ist_Frankreich = 1
		and I_TurnNumber = 1
		and I_CompareCounter italienzug = 1

		historic_event frankreich_info_zwei true

		terminate_monitor
	end_monitor

	;---------------------- Angenommen 
	monitor_event EventCounter EventCounterType frankreich_info_zwei_accepted
		and I_CompareCounter Spieler_ist_Frankreich = 1

		set_counter florenz_erobern 1

		set_faction_standing france poland -1.0
		set_faction_standing poland france -1.0


		console_command diplomatic_stance france poland War

		console_command add_money france, 5000

		historic_event frankreich_info_zwei_yes

		terminate_monitor
	end_monitor

	;---------------------- Abgelehnt
	monitor_event EventCounter EventCounterType frankreich_info_zwei_declined
		and I_CompareCounter Spieler_ist_Frankreich = 1

		generate_random_counter	frankreich_tribut 1 3

		if I_EventCounter frankreich_tribut = 1

			set_counter florenz_erobern 1

			set_faction_standing france poland -1.0
			set_faction_standing poland france -1.0

			console_command diplomatic_stance france poland War

			spawn_army 
				faction poland
				character	Baldassare, general, age 30, x 100, y 171
				unit		FL Landsknecht Pikeniere		exp 4 armour 0 weapon_lvl 0
				unit		FL Landsknecht Pikeniere		exp 2 armour 0 weapon_lvl 0
				unit		FL Landsknecht Pikeniere		exp 2 armour 0 weapon_lvl 0
			end

			historic_event frankreich_info_zwei_schlecht_no
		end_if

		if I_EventCounter frankreich_tribut = 2

			set_counter invasion_klein 1

			set_faction_standing france poland -1.0
			set_faction_standing poland france -1.0

			historic_event frankreich_info_zwei_gut_no
		end_if

		if I_EventCounter frankreich_tribut = 3

			set_counter florenz_erobern 1

			set_faction_standing france poland -1.0
			set_faction_standing poland france -1.0

			console_command diplomatic_stance france poland War

			spawn_army 
				faction poland
				character	Baldassare, general, age 30, x 100, y 171
				unit		FL Landsknecht Pikeniere		exp 4 armour 0 weapon_lvl 0
				unit		FL Landsknecht Pikeniere		exp 2 armour 0 weapon_lvl 0
				unit		FL Landsknecht Pikeniere		exp 2 armour 0 weapon_lvl 0
			end

			historic_event frankreich_info_zwei_schlecht_no
		end_if

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Florenz (Akt II) --------------------------------------
	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart FactionType france
		and I_TurnNumber = 2
		and I_CompareCounter florenz_angegriffen = 1

		set_counter florenz_angegriffen 2

		spawn_army 
			faction france
			character	random_name, named character, age 23, x 98, y 177, label siege_florenz, direction E
			traits GoodCommander 2 , Intelligent 2 , Austere 1 , PublicFaith 1 , StrategyChivalry 1 , ReligionStarter 1 
			unit		NE Late Bodyguard			exp 5 armour 0 weapon_lvl 0
			unit		F Frz Gendarmes				exp 3 armour 0 weapon_lvl 0
			unit		F Frz Gendarmes				exp 3 armour 0 weapon_lvl 0
			unit		F Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		F Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		F Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		F Swiss Pikemen Mercs			exp 4 armour 0 weapon_lvl 0
			unit		F Swiss Pikemen Mercs			exp 4 armour 0 weapon_lvl 0
			unit		F Aventurier				exp 2 armour 0 weapon_lvl 0
			unit		F Aventurier				exp 2 armour 0 weapon_lvl 0
			unit		F NE Basilisk				exp 2 armour 0 weapon_lvl 0
		end

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType france
		and I_CompareCounter florenz_angegriffen = 2

		if I_SettlementOwner Florenz = france
			terminate_monitor
		end_if

		if I_SettlementUnderSiege Florenz
			and I_EventCounter florenz_engage = 0
			terminate_monitor 
		end_if

		if I_EventCounter florenz_engage = 1
			siege_settlement siege_florenz, Florenz, attack
			terminate_monitor
		end_if

		if I_EventCounter florenz_engage = 0
			siege_settlement siege_florenz, Florenz, maintain
			set_event_counter florenz_engage 1
		end_if
	end_monitor


	monitor_event PostBattle FactionType poland
		and I_SettlementOwner Florenz = poland 
		and WonBattle
		and I_CompareCounter florenz_angegriffen = 2
		and not I_SettlementUnderSiege Florenz


		historic_event florenz_sieg factions { poland, }

		set_counter invasion_klein 1
		set_counter invasion_gross 5

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Frankreich (Akt II B) ---------------------------------
	;------------------------------------------------------------------------------

	declare_counter battle_won	;Wurde die Belagerung gewonnen und Florenz von Frankreich erobert? - Flogen: Abzug der Truppen?

	monitor_event FactionTurnStart I_CompareCounter Spieler_ist_Frankreich = 1
		and I_TurnNumber = 2
		and I_CompareCounter italienzug = 1
		and I_CompareCounter florenz_erobern = 1

		historic_event frankreich_angriff true

		terminate_monitor
	end_monitor

	;---------------------- Angenommen 
	monitor_event EventCounter EventCounterType frankreich_angriff_accepted
		and I_CompareCounter Spieler_ist_Frankreich = 1

		set_counter florenz_erobern 2

		spawn_army 
			faction france
			character	Charles de Valois, named character, age 23, x 98, y 177, direction E
			traits Factionleader 1 , GoodCommander 2 , Intelligent 2 , Austere 1 , PublicFaith 1 , StrategyChivalry 1 , ReligionStarter 1 
			unit		NE Late Bodyguard			exp 5 armour 0 weapon_lvl 0
			unit		F Frz Gendarmes				exp 3 armour 0 weapon_lvl 0
			unit		F Frz Gendarmes				exp 3 armour 0 weapon_lvl 0
			unit		F Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		F Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		F Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		F Swiss Pikemen Mercs			exp 4 armour 0 weapon_lvl 0
			unit		F Swiss Pikemen Mercs			exp 4 armour 0 weapon_lvl 0
			unit		F Aventurier				exp 2 armour 0 weapon_lvl 0
			unit		F Aventurier				exp 2 armour 0 weapon_lvl 0
			unit		F NE Basilisk				exp 2 armour 0 weapon_lvl 0
		end

		snap_strat_camera 98, 187		
		zoom_strat_camera 0.1

		siege_settlement Charles de Valois, Florenz, attack

		terminate_monitor
	end_monitor


	monitor_event GeneralCaptureSettlement SettlementName Florenz
		and I_LocalFaction france

		set_counter battle_won 1

		historic_event sieg_florenz factions { france, }

		terminate_monitor
	end_monitor

	monitor_event PostBattle FactionType france
		and not I_SettlementOwner Florenz = france
		;and not WonBattle
		and I_CompareCounter florenz_erobern = 2
		and not I_CompareCounter battle_won = 1

		set_counter invasion_klein 1
		set_counter invasion_gross 5

		historic_event verloren_florenz factions { france, }

		terminate_monitor
	end_monitor

	monitor_event SackSettlement IsRegionOneOf Florenz_Province
		and I_CompareCounter Spieler_ist_Frankreich = 1
		and I_CompareCounter battle_won = 1

		destroy_units france F Frz Gendarmes
		destroy_units france F Frz Pike Militia
		destroy_units france F Swiss Pikemen Mercs
		destroy_units france F Aventurier
		destroy_units france F NE Basilisk

		send_character_off_map Charles de Valois

		historic_event abgezogen_sack factions { france, }

		set_counter invasion_gross 1
		set_counter invasion_klein 5

		terminate_monitor
	end_monitor

	monitor_event OccupySettlement IsRegionOneOf Florenz_Province
		and I_CompareCounter Spieler_ist_Frankreich = 1
		and I_CompareCounter battle_won = 1

		destroy_units france F Frz Gendarmes
		destroy_units france F Frz Pike Militia
		destroy_units france F Swiss Pikemen Mercs
		destroy_units france F Aventurier
		destroy_units france F NE Basilisk

		send_character_off_map Charles de Valois

		historic_event abgezogen_occupy factions { france, }

		set_counter invasion_klein 1
		set_counter invasion_gross 5

		terminate_monitor
	end_monitor

	;---------------------- Abgelehnt
	monitor_event EventCounter EventCounterType frankreich_angriff_declined
		and I_CompareCounter Spieler_ist_Frankreich = 1

		set_counter invasion_gross 1
		set_counter invasion_klein 5

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Siena (Akt II) ----------------------------------------
	;------------------------------------------------------------------------------

	declare_counter siena_granted_permission	;Siena has granted France permission to march through

	monitor_event FactionTurnStart I_CompareCounter Spieler_ist_Siena = 1
		and I_TurnNumber = 2
		
		historic_event siena_frankreich true

		terminate_monitor
	end_monitor


	;---------------------- Angenommen 

	monitor_event EventCounter EventCounterType siena_frankreich_accepted
		and I_CompareCounter Spieler_ist_Siena = 1


		set_faction_standing france russia 0.5
		set_faction_standing russia france 0.5


		console_command add_money russia, -5000

		historic_event siena_frankreich_ja

		set_counter siena_granted_permission 1

		terminate_monitor
	end_monitor

	;---------------------- Abgelehnt
	monitor_event EventCounter EventCounterType siena_frankreich_declined
		and I_CompareCounter Spieler_ist_Siena = 1


			spawn_army 
				faction russia
				character	random_name, general, age 30, x 100, y 161 
				unit		FL Pike Militia		exp 4 armour 0 weapon_lvl 0
				unit		S Halberd Militia		exp 2 armour 0 weapon_lvl 0
				unit		S Halberd Militia		exp 2 armour 0 weapon_lvl 0
				unit		C Crossbowmen		exp 2 armour 0 weapon_lvl 0
				unit		C Crossbowmen		exp 2 armour 0 weapon_lvl 0
			end

		;French vanguards 

			spawn_army 
				faction france
				character	random_name, general, age 30, x 91, y 163 
				unit		Partisan Militia			exp 0 armour 0 weapon_lvl 0
				unit		Dismounted French Archers		exp 0 armour 0 weapon_lvl 0
				unit		Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			end

			spawn_army 
				faction france
				character	random_name, general, age 30, x 95, y 166 
				unit		Noble Knights			exp 3 armour 0 weapon_lvl 0
				unit		Noble Knights		exp 3 armour 0 weapon_lvl 0
				unit		Dismounted Noble Knights			exp 1 armour 1 weapon_lvl 0
			end			

			spawn_army 
				faction france
				character	random_name, general, age 30, x 92, y 160 
				unit		NE Spear Militia			exp 0 armour 0 weapon_lvl 0
				unit		NE Spear Militia			exp 0 armour 0 weapon_lvl 0
				unit		NE Grand Bombard			exp 1 armour 0 weapon_lvl 0
			end

		set_faction_standing russia france -0.5
		set_faction_standing france russia -0.5

		set_faction_standing sicily russia 0.5
		set_faction_standing russia sicily 0.5

		console_command diplomatic_stance france russia War

		historic_event siena_frankreich_nein

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Neapel (Akt II) ---------------------------------------
	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart I_CompareCounter Spieler_ist_Neapel = 1
		and I_TurnNumber = 3

		historic_event warnung_neapel factions { sicily, }

		terminate_monitor
	end_monitor



	;------------------------------------------------------------------------------
	;---------------------- Dritter Akt -------------------------------------------
	;------------------------------------------------------------------------------

	;------------------------------------------------------------------------------
	;---------------------- Frankreich (Akt III) Klein ----------------------------
	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart I_CompareCounter Spieler_ist_Frankreich = 1
		and I_TurnNumber = 5
		and I_CompareCounter italienzug = 1
		and I_CompareCounter invasion_klein = 1
		and I_CompareCounter invasion_gross = 5

		set_counter invasion_klein 2	;dient nur zum triggern des Niederlageevents

		spawn_army 
			faction france
			character	Charles de Valois, named character, age 23, x 140, y 113, direction S
			traits Factionleader 1 , GoodCommander 3 , Intelligent 2 , Austere 1 , PublicFaith 1 , StrategyChivalry 1 , ReligionStarter 1 
			unit		NE Late Bodyguard			exp 5 armour 0 weapon_lvl 0
			unit		Frz Gendarmes				exp 3 armour 0 weapon_lvl 0
			unit		Frz Pike Militia			exp 3 armour 0 weapon_lvl 0
			unit		Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		Aventurier				exp 2 armour 0 weapon_lvl 0
			unit		Aventurier				exp 2 armour 0 weapon_lvl 0
			unit		NE Basilisk				exp 2 armour 0 weapon_lvl 0
		end

		snap_strat_camera 140, 123		
		zoom_strat_camera 0.1

		siege_settlement Charles de Valois, Neapel, maintain

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Neapel (Akt III) Klein --------------------------------
	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart FactionType france
		and I_CompareCounter Spieler_ist_Neapel = 1
		and I_TurnNumber = 5
		and I_CompareCounter invasion_klein = 1
		and I_CompareCounter invasion_gross = 5

		set_counter invasion_klein 2	;dient nur zum triggern des Niederlageevents

		spawn_army 
			faction france
			character	random_name, named character, age 23, x 140, y 113, label neapel01, direction E
			traits GoodCommander 3 , Intelligent 2 , Austere 1 , PublicFaith 1 , StrategyChivalry 1 , ReligionStarter 1 
			unit		NE Late Bodyguard			exp 5 armour 0 weapon_lvl 0
			unit		Frz Gendarmes				exp 3 armour 0 weapon_lvl 0
			unit		Frz Pike Militia			exp 3 armour 0 weapon_lvl 0
			unit		Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		Aventurier				exp 2 armour 0 weapon_lvl 0
			unit		Aventurier				exp 2 armour 0 weapon_lvl 0
			unit		NE Basilisk				exp 2 armour 0 weapon_lvl 0
		end

		snap_strat_camera 140, 123		
		zoom_strat_camera 0.1


		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType france
		and I_CharacterExists neapel01

		if I_SettlementOwner Neapel = france
			terminate_monitor
		end_if

		if I_SettlementUnderSiege Neapel
			and I_EventCounter neapel_engage = 0
			terminate_monitor 
		end_if

		if I_EventCounter neapel_engage = 1
			siege_settlement neapel01, Neapel, attack
			terminate_monitor
		end_if

		if I_EventCounter neapel_engage = 0
			siege_settlement neapel01, Neapel, maintain
			set_event_counter neapel_engage 1
		end_if
	end_monitor

	monitor_event PostBattle FactionType france
		and I_SettlementOwner Neapel = sicily
		;and not WonBattle
		and I_CompareCounter invasion_gross = 5
		and I_CompareCounter invasion_klein = 2

		historic_event invasion_ende_neapel factions { sicily, }

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Akt IV ------------------------------------------------
	;------------------------------------------------------------------------------

	;------------------------------------------------------------------------------
	;---------------------- Frankreich (Akt IV) Gross -----------------------------
	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart I_CompareCounter Spieler_ist_Frankreich = 1
		and I_TurnNumber = 5
		and I_CompareCounter italienzug = 1
		and I_CompareCounter invasion_gross = 1
		and I_CompareCounter invasion_klein = 5

		set_counter invasion_gross 2

		spawn_army 
			faction france
			character	Charles de Valois, named character, age 23, x 140, y 113, direction S
			traits Factionleader 1 , GoodCommander 3 , Intelligent 2 , Austere 1 , PublicFaith 1 , StrategyChivalry 1 , ReligionStarter 1 
			unit		NE Late Bodyguard			exp 5 armour 0 weapon_lvl 0
			unit		Frz Gendarmes				exp 3 armour 0 weapon_lvl 0
			unit		Frz Gendarmes				exp 3 armour 0 weapon_lvl 0
			unit		Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		Swiss Pikemen Mercs			exp 4 armour 0 weapon_lvl 0
			unit		Swiss Pikemen Mercs			exp 4 armour 0 weapon_lvl 0
			unit		Aventurier				exp 2 armour 0 weapon_lvl 0
			unit		Aventurier				exp 2 armour 0 weapon_lvl 0
			unit		NE Basilisk				exp 2 armour 0 weapon_lvl 0
		end

		snap_strat_camera 140, 123		
		zoom_strat_camera 0.1

		siege_settlement Charles de Valois, Neapel, maintain

		terminate_monitor
	end_monitor

	monitor_event PostBattle FactionType france
		and I_SettlementOwner Neapel = sicily
		and not WonBattle
		and I_CompareCounter invasion_gross = 2
		and I_CompareCounter invasion_klein = 5

		historic_event invasion_ende_fran factions { france, }

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Neapel (Akt IV) ---------------------------------------
	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart FactionType france
		and I_TurnNumber = 5
		and I_CompareCounter invasion_gross = 1
		and I_CompareCounter invasion_klein = 5

		set_counter invasion_gross 2

		spawn_army 
			faction france
			character	random_name, named character, age 23, x 140, y 113, label neapel02 direction E
			traits GoodCommander 3 , Intelligent 2 , Austere 1 , PublicFaith 1 , StrategyChivalry 1 , ReligionStarter 1 
			unit		NE Late Bodyguard			exp 5 armour 0 weapon_lvl 0
			unit		Frz Gendarmes				exp 3 armour 0 weapon_lvl 0
			unit		Frz Gendarmes				exp 3 armour 0 weapon_lvl 0
			unit		Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		Swiss Pikemen Mercs			exp 4 armour 0 weapon_lvl 0
			unit		Swiss Pikemen Mercs			exp 4 armour 0 weapon_lvl 0
			unit		Aventurier				exp 2 armour 0 weapon_lvl 0
			unit		Aventurier				exp 2 armour 0 weapon_lvl 0
			unit		NE Basilisk				exp 2 armour 0 weapon_lvl 0
		end

		terminate_monitor
	end_monitor

	monitor_event FactionTurnStart FactionType france

		and I_CharacterExists neapel02

		if I_SettlementOwner Neapel = france
			terminate_monitor
		end_if

		if I_SettlementUnderSiege Neapel
			and I_EventCounter neapel_engage = 0
			terminate_monitor 
		end_if

		if I_EventCounter neapel_engage = 1
			siege_settlement neapel02, Neapel, attack
			terminate_monitor
		end_if

		if I_EventCounter neapel_engage = 0
			siege_settlement neapel02, Neapel, maintain
			set_event_counter neapel_engage 1
		end_if
	end_monitor

	monitor_event PostBattle FactionType sicily
		and I_SettlementOwner Neapel = sicily 
		and WonBattle
		and I_CompareCounter invasion_gross = 2
		and I_CompareCounter invasion_klein = 5

		historic_event invasion_ende_neapel factions { sicily, }

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- KI Frankreich (Akt IV) --------------------------------
	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart FactionType france
		and I_IsFactionAIControlled france
		and I_IsFactionAIControlled sicily
		and I_TurnNumber = 4

		spawn_army 
			faction france
			character	Charles, named character, age 23, x 140, y 113, label neapel03, direction S
			traits Factionleader 1 , GoodCommander 3 , Intelligent 2 , Austere 1 , PublicFaith 1 , StrategyChivalry 1 , ReligionStarter 1 
			unit		NE Late Bodyguard			exp 5 armour 0 weapon_lvl 0
			unit		Frz Gendarmes				exp 3 armour 0 weapon_lvl 0
			unit		Frz Gendarmes				exp 3 armour 0 weapon_lvl 0
			unit		Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		Frz Pike Militia			exp 1 armour 1 weapon_lvl 0
			unit		Swiss Pikemen Mercs			exp 4 armour 0 weapon_lvl 0
			unit		Swiss Pikemen Mercs			exp 4 armour 0 weapon_lvl 0
			unit		Swiss Pikemen Mercs			exp 4 armour 0 weapon_lvl 0
			unit		Aventurier				exp 2 armour 0 weapon_lvl 0
			unit		Aventurier				exp 2 armour 0 weapon_lvl 0
			unit		NE Basilisk				exp 2 armour 0 weapon_lvl 0
			unit		NE Basilisk				exp 2 armour 0 weapon_lvl 0
		end

		console_command auto_win attacker

		siege_settlement neapel03, Neapel, attack

		snap_strat_camera 141, 122		
		zoom_strat_camera 0.1

		reveal_tile 141, 112
		wait 4.0


		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Andere Fraktionen (Akt IV) ----------------------------
	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart FactionIsLocal
		and I_CompareCounter frankreich_own_neapel = 1
		and I_TurnNumber <= 7

		historic_event venedig_liga_info factions { hre, saxons, hungary, milan, venice, papal_states, normans, turks, spain, denmark, byzantium, england, russia, scotland, egypt, savoy, montferrat, timurids, urbino, lucca, }

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Italienzug Charles Ende -------------------------------
	;------------------------------------------------------------------------------

	;------------------------------------------------------------------------------
	;---------------------- Eroberung Neapels -------------------------------------
	;------------------------------------------------------------------------------

	monitor_event GeneralCaptureSettlement FactionType hre	;HRR
		and SettlementName Neapel
		and I_EventCounter eroberung_neapels = 0

		historic_event eroberung_neapels factions { hre, }

		console_command add_money hre, 5000

		terminate_monitor
	end_monitor

	monitor_event GeneralCaptureSettlement FactionType papal_states	;Papststaaten
		and SettlementName Neapel
		and I_EventCounter eroberung_neapels = 0

		historic_event eroberung_neapels factions { papal_states, }

		console_command add_money papal_states, 5000

		terminate_monitor
	end_monitor

	monitor_event GeneralCaptureSettlement FactionType hungary	;Ungarn
		and SettlementName Neapel
		and I_EventCounter eroberung_neapels = 0

		historic_event eroberung_neapels factions { hungary, }

		console_command add_money hungary, 5000

		terminate_monitor
	end_monitor

	monitor_event GeneralCaptureSettlement FactionType spain	;Spanien
		and SettlementName Neapel
		and I_EventCounter eroberung_neapels = 0

		historic_event eroberung_neapels factions { spain, }

		console_command add_money spain, 5000

		terminate_monitor
	end_monitor

	monitor_event GeneralCaptureSettlement FactionType venice	;Venedig
		and SettlementName Neapel
		and I_EventCounter eroberung_neapels = 0

		historic_event eroberung_neapels factions { venice, }

		console_command add_money venice, 5000

		terminate_monitor
	end_monitor

	monitor_event GeneralCaptureSettlement FactionType milan	;Mailand
		and SettlementName Neapel
		and I_EventCounter eroberung_neapels = 0

		historic_event eroberung_neapels factions { milan, }

		console_command add_money milan, 5000

		terminate_monitor
	end_monitor

	monitor_event GeneralCaptureSettlement FactionType saxons	;Schweiz
		and SettlementName Neapel
		and I_EventCounter eroberung_neapels = 0

		historic_event eroberung_neapels factions { saxons, }

		console_command add_money saxons, 5000

		terminate_monitor
	end_monitor

	declare_counter frankreich_own_neapel

	monitor_event GeneralCaptureSettlement FactionType france	;Frankreich
		and SettlementName Neapel
		and I_EventCounter eroberung_neapels = 0

		set_counter frankreich_own_neapel 1

		historic_event eroberung_neapels factions { france, }

		console_command add_money france, 5000

		terminate_monitor
	end_monitor

	monitor_event GeneralCaptureSettlement FactionType poland	;Florenz
		and SettlementName Neapel
		and I_EventCounter eroberung_neapels = 0

		historic_event eroberung_neapels factions { poland, }

		console_command add_money poland, 5000

		terminate_monitor
	end_monitor

	monitor_event GeneralCaptureSettlement FactionType turks	;Türken
		and SettlementName Neapel
		and I_EventCounter eroberung_neapels = 0

		historic_event eroberung_neapels factions { turks, }

		console_command add_money turks, 5000

		terminate_monitor
	end_monitor

	monitor_event GeneralCaptureSettlement FactionType normans	;Schwaben
		and SettlementName Neapel
		and I_EventCounter eroberung_neapels = 0

		historic_event eroberung_neapels factions { normans, }

		console_command add_money normans, 5000

		terminate_monitor
	end_monitor

	monitor_event GeneralCaptureSettlement FactionType savoy	;Savoyen
		and SettlementName Neapel
		and I_EventCounter eroberung_neapels = 0

		historic_event eroberung_neapels factions { savoy, }

		console_command add_money savoy, 5000

		terminate_monitor
	end_monitor

	monitor_event GeneralCaptureSettlement FactionType montferrat	;Montferrat
		and SettlementName Neapel
		and I_EventCounter eroberung_neapels = 0

		historic_event eroberung_neapels factions { montferrat, }

		console_command add_money montferrat, 5000

		terminate_monitor
	end_monitor

	monitor_event GeneralCaptureSettlement FactionType timurids	;Bologna
		and SettlementName Neapel
		and I_EventCounter eroberung_neapels = 0

		historic_event eroberung_neapels factions { timurids, }

		console_command add_money timurids, 5000

		terminate_monitor
	end_monitor

	monitor_event GeneralCaptureSettlement FactionType urbino	;Urbino
		and SettlementName Neapel
		and I_EventCounter eroberung_neapels = 0

		historic_event eroberung_neapels factions { urbino, }

		console_command add_money urbino, 5000

		terminate_monitor
	end_monitor

	monitor_event GeneralCaptureSettlement FactionType lucca	;Lucca
		and SettlementName Neapel
		and I_EventCounter eroberung_neapels = 0

		historic_event eroberung_neapels factions { lucca, }

		console_command add_money lucca, 5000

		terminate_monitor
	end_monitor

	monitor_event GeneralCaptureSettlement FactionType denmark	;Genua
		and SettlementName Neapel
		and I_EventCounter eroberung_neapels = 0

		historic_event eroberung_neapels factions { denmark, }

		console_command add_money denmark, 5000

		terminate_monitor
	end_monitor

	monitor_event GeneralCaptureSettlement FactionType byzantium	;Mantua
		and SettlementName Neapel
		and I_EventCounter eroberung_neapels = 0

		historic_event eroberung_neapels factions { byzantium, }

		console_command add_money byzantium, 5000

		terminate_monitor
	end_monitor

	monitor_event GeneralCaptureSettlement FactionType england	;Ferrara
		and SettlementName Neapel
		and I_EventCounter eroberung_neapels = 0

		historic_event eroberung_neapels factions { england, }

		console_command add_money england, 5000

		terminate_monitor
	end_monitor

	monitor_event GeneralCaptureSettlement FactionType russia	;Siena
		and SettlementName Neapel
		and I_EventCounter eroberung_neapels = 0

		historic_event eroberung_neapels factions { russia, }

		console_command add_money russia, 5000

		terminate_monitor
	end_monitor

	monitor_event GeneralCaptureSettlement FactionType scotland	;Ragusa
		and SettlementName Neapel
		and I_EventCounter eroberung_neapels = 0

		historic_event eroberung_neapels factions { scotland, }

		console_command add_money scotland, 5000

		terminate_monitor
	end_monitor

	monitor_event GeneralCaptureSettlement FactionType egypt	;Hafsiden
		and SettlementName Neapel
		and I_EventCounter eroberung_neapels = 0

		historic_event eroberung_neapels factions { egypt, }

		console_command add_money egypt, 5000

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Liga von Venedig --------------------------------------
	;------------------------------------------------------------------------------

	declare_counter liga_v_besteht	;Besteht die Liga von Venedig?
	declare_counter liga_v_nein_venice	;Venedig tritt nicht bei
	declare_counter liga_v_nein_milan	;Mailand tritt nicht bei
	declare_counter liga_v_nein_spain	;Spanien tritt nicht bei
	declare_counter liga_v_nein_hre		;HRR tritt nicht bei
	declare_counter liga_v_nein_florenz ;Florenz tritt nicht bei
	declare_counter liga_v_nein_mantua ;Mantua tritt nicht bei
	declare_counter liga_v_nein_bologna ;Bologna tritt nicht bei
	declare_counter liga_v_nein_lucca ;Lucca tritt nicht bei


	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart I_TurnNumber = 8
		and I_SettlementOwner Neapel = france

		historic_event liga_v_france factions { france, }
		historic_event liga_v_mitglieder true factions { venice, milan, spain, hre, poland, byzantium, timurids, lucca, }
		historic_event liga_v_info factions { saxons, turks, normans, hungary, sicily, denmark, england, russia, scotland, egypt, savoy, montferrat, urbino, }
		historic_event liga_v_papst true factions { papal_states, }


		if I_IsFactionAIControlled venice
			and I_IsFactionAIControlled milan
			and I_IsFactionAIControlled spain
			and I_IsFactionAIControlled hre
			and I_IsFactionAIControlled papal_states
			and I_IsFactionAIControlled sicily
			and I_IsFactionAIControlled poland
			and I_IsFactionAIControlled byzantium
			and I_IsFactionAIControlled timurids
			and I_IsFactionAIControlled lucca

			set_counter liga_v_besteht 1

			;---------------------- Beziehungen zur Liga
			set_faction_standing france venice -1.0
			set_faction_standing venice france -1.0

			set_faction_standing france milan -1.0
			set_faction_standing milan france -1.0

			set_faction_standing france papal_states -1.0
			set_faction_standing papal_states france -1.0

			set_faction_standing france spain -1.0
			set_faction_standing spain france -1.0

			set_faction_standing france hre -1.0
			set_faction_standing hre france -1.0

			set_faction_standing france sicily -1.0
			set_faction_standing sicily france -1.0

			set_faction_standing france poland -1.0
			set_faction_standing poland france -1.0

			set_faction_standing france byzantium -0.7
			set_faction_standing byzantium france -0.7

			set_faction_standing france timurids -0.5
			set_faction_standing timurids france -0.5

			set_faction_standing france lucca -0.5
			set_faction_standing lucca france -0.5

			console_command diplomatic_stance france milan War
			console_command diplomatic_stance france venice War
			console_command diplomatic_stance france papal_states War
			console_command diplomatic_stance france spain War
			console_command diplomatic_stance france hre War
			console_command diplomatic_stance france sicily War
			console_command diplomatic_stance france poland War
			console_command diplomatic_stance france byzantium War
			console_command diplomatic_stance france timurids War
			console_command diplomatic_stance france lucca War

			;---------------------- Beziehungen der Mitglieder
			;------------------------------------------------------------------------------

			;---------------------- Venice
			set_faction_standing venice milan 1.0
			set_faction_standing venice spain 1.0
			set_faction_standing venice hre 1.0
			set_faction_standing venice papal_states 1.0
			set_faction_standing venice sicily 1.0
			set_faction_standing venice poland 1.0
			set_faction_standing venice byzantium 1.0
			set_faction_standing venice timurids 1.0
			set_faction_standing venice lucca 1.0

			;---------------------- Milan
			set_faction_standing milan venice 1.0
			set_faction_standing milan spain 1.0
			set_faction_standing milan hre 1.0
			set_faction_standing milan papal_states 1.0
			set_faction_standing milan sicily 1.0
			set_faction_standing milan poland 1.0
			set_faction_standing milan byzantium 1.0
			set_faction_standing milan timurids 1.0
			set_faction_standing milan lucca 1.0

			;---------------------- Spain
			set_faction_standing spain venice 1.0
			set_faction_standing spain milan 1.0
			set_faction_standing spain hre 1.0
			set_faction_standing spain papal_states 1.0
			set_faction_standing spain sicily 1.0
			set_faction_standing spain poland 1.0
			set_faction_standing spain byzantium 1.0
			set_faction_standing spain timurids 1.0
			set_faction_standing spain lucca 1.0

			;---------------------- HRE
			set_faction_standing hre venice 1.0
			set_faction_standing hre milan 1.0
			set_faction_standing hre spain 1.0
			set_faction_standing hre papal_states 1.0
			set_faction_standing hre sicily 1.0
			set_faction_standing hre poland 1.0
			set_faction_standing hre byzantium 1.0
			set_faction_standing hre timurids 1.0
			set_faction_standing hre lucca 1.0

			;---------------------- Papal States
			set_faction_standing papal_states venice 1.0
			set_faction_standing papal_states milan 1.0
			set_faction_standing papal_states spain 1.0
			set_faction_standing papal_states hre 1.0
			set_faction_standing papal_states sicily 1.0
			set_faction_standing papal_states poland 1.0
			set_faction_standing papal_states byzantium 1.0
			set_faction_standing papal_states timurids 1.0
			set_faction_standing papal_states lucca 1.0

			;---------------------- Naples
			set_faction_standing sicily venice 1.0
			set_faction_standing sicily milan 1.0
			set_faction_standing sicily spain 1.0
			set_faction_standing sicily hre 1.0
			set_faction_standing sicily papal_states 1.0
			set_faction_standing sicily poland 1.0
			set_faction_standing sicily byzantium 1.0
			set_faction_standing sicily timurids 1.0
			set_faction_standing sicily lucca 1.0

			;---------------------- Florence
			set_faction_standing poland venice 1.0
			set_faction_standing poland milan 1.0
			set_faction_standing poland spain 1.0
			set_faction_standing poland hre 1.0
			set_faction_standing poland papal_states 1.0
			set_faction_standing poland sicily 1.0
			set_faction_standing poland byzantium 1.0
			set_faction_standing poland timurids 1.0
			set_faction_standing poland lucca 1.0

			;---------------------- Mantua
			set_faction_standing byzantium venice 1.0
			set_faction_standing byzantium milan 1.0
			set_faction_standing byzantium spain 1.0
			set_faction_standing byzantium hre 1.0
			set_faction_standing byzantium papal_states 1.0
			set_faction_standing byzantium sicily 1.0
			set_faction_standing byzantium poland 1.0
			set_faction_standing byzantium timurids 1.0
			set_faction_standing byzantium lucca 1.0

			;---------------------- Bologna
			set_faction_standing timurids venice 1.0
			set_faction_standing timurids milan 1.0
			set_faction_standing timurids spain 1.0
			set_faction_standing timurids hre 1.0
			set_faction_standing timurids papal_states 1.0
			set_faction_standing timurids sicily 1.0
			set_faction_standing timurids poland 1.0
			set_faction_standing timurids byzantium 1.0
			set_faction_standing timurids lucca 1.0

			;---------------------- Lucca
			set_faction_standing lucca venice 1.0
			set_faction_standing lucca milan 1.0
			set_faction_standing lucca spain 1.0
			set_faction_standing lucca hre 1.0
			set_faction_standing lucca papal_states 1.0
			set_faction_standing lucca sicily 1.0
			set_faction_standing lucca poland 1.0
			set_faction_standing lucca byzantium 1.0
			set_faction_standing lucca timurids 1.0

			console_command diplomatic_stance sicily venice Allied
			console_command diplomatic_stance sicily milan Allied
			console_command diplomatic_stance sicily papal_states Allied
			console_command diplomatic_stance sicily spain Allied
			console_command diplomatic_stance sicily hre Allied
			console_command diplomatic_stance sicily poland Allied
			console_command diplomatic_stance sicily byzantium Allied
			console_command diplomatic_stance sicily timurids Allied
			console_command diplomatic_stance sicily lucca Allied

			console_command diplomatic_stance venice milan Allied
			console_command diplomatic_stance venice papal_states Allied
			console_command diplomatic_stance venice spain Allied
			console_command diplomatic_stance venice hre Allied
			console_command diplomatic_stance venice poland Allied
			console_command diplomatic_stance venice byzantium Allied
			console_command diplomatic_stance venice timurids Allied
			console_command diplomatic_stance venice lucca Allied

			console_command diplomatic_stance milan papal_states Allied
			console_command diplomatic_stance milan spain Allied
			console_command diplomatic_stance milan hre Allied
			console_command diplomatic_stance milan poland Allied
			console_command diplomatic_stance milan byzantium Allied
			console_command diplomatic_stance milan timurids Allied
			console_command diplomatic_stance milan lucca Allied

			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states poland Allied
			console_command diplomatic_stance papal_states byzantium Allied
			console_command diplomatic_stance papal_states timurids Allied
			console_command diplomatic_stance papal_states lucca Allied

			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance spain poland Allied
			console_command diplomatic_stance spain byzantium Allied
			console_command diplomatic_stance spain timurids Allied
			console_command diplomatic_stance spain lucca Allied

			console_command diplomatic_stance hre poland Allied
			console_command diplomatic_stance hre byzantium Allied
			console_command diplomatic_stance hre timurids Allied
			console_command diplomatic_stance hre lucca Allied

			console_command diplomatic_stance poland byzantium Allied
			console_command diplomatic_stance poland timurids Allied
			console_command diplomatic_stance poland lucca Allied

			console_command diplomatic_stance byzantium timurids Allied

			console_command diplomatic_stance lucca byzantium Allied
			console_command diplomatic_stance lucca timurids Allied

			end_if

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Angenommen Papst --------------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType liga_v_papst_accepted

		set_counter liga_v_besteht 1

			;---------------------- Beziehungen zur Liga
			set_faction_standing france venice -1.0
			set_faction_standing venice france -1.0

			set_faction_standing france milan -1.0
			set_faction_standing milan france -1.0

			set_faction_standing france papal_states -1.0
			set_faction_standing papal_states france -1.0

			set_faction_standing france spain -1.0
			set_faction_standing spain france -1.0

			set_faction_standing france hre -1.0
			set_faction_standing hre france -1.0

			set_faction_standing france sicily -1.0
			set_faction_standing sicily france -1.0

			set_faction_standing france poland -1.0
			set_faction_standing poland france -1.0

			set_faction_standing france byzantium -0.7
			set_faction_standing byzantium france -0.7

			set_faction_standing france timurids -0.5
			set_faction_standing timurids france -0.5

			set_faction_standing france lucca -0.5
			set_faction_standing lucca france -0.5

			console_command diplomatic_stance france milan War
			console_command diplomatic_stance france venice War
			console_command diplomatic_stance france papal_states War
			console_command diplomatic_stance france spain War
			console_command diplomatic_stance france hre War
			console_command diplomatic_stance france sicily War
			console_command diplomatic_stance france poland War
			console_command diplomatic_stance france byzantium War
			console_command diplomatic_stance france timurids War
			console_command diplomatic_stance france lucca War

			;---------------------- Beziehungen der Mitglieder
			;------------------------------------------------------------------------------

			;---------------------- Venice
			set_faction_standing venice milan 1.0
			set_faction_standing venice spain 1.0
			set_faction_standing venice hre 1.0
			set_faction_standing venice papal_states 1.0
			set_faction_standing venice sicily 1.0
			set_faction_standing venice poland 1.0
			set_faction_standing venice byzantium 1.0
			set_faction_standing venice timurids 1.0
			set_faction_standing venice lucca 1.0

			;---------------------- Milan
			set_faction_standing milan venice 1.0
			set_faction_standing milan spain 1.0
			set_faction_standing milan hre 1.0
			set_faction_standing milan papal_states 1.0
			set_faction_standing milan sicily 1.0
			set_faction_standing milan poland 1.0
			set_faction_standing milan byzantium 1.0
			set_faction_standing milan timurids 1.0
			set_faction_standing milan lucca 1.0

			;---------------------- Spain
			set_faction_standing spain venice 1.0
			set_faction_standing spain milan 1.0
			set_faction_standing spain hre 1.0
			set_faction_standing spain papal_states 1.0
			set_faction_standing spain sicily 1.0
			set_faction_standing spain poland 1.0
			set_faction_standing spain byzantium 1.0
			set_faction_standing spain timurids 1.0
			set_faction_standing spain lucca 1.0

			;---------------------- HRE
			set_faction_standing hre venice 1.0
			set_faction_standing hre milan 1.0
			set_faction_standing hre spain 1.0
			set_faction_standing hre papal_states 1.0
			set_faction_standing hre sicily 1.0
			set_faction_standing hre poland 1.0
			set_faction_standing hre byzantium 1.0
			set_faction_standing hre timurids 1.0
			set_faction_standing hre lucca 1.0

			;---------------------- Papal States
			set_faction_standing papal_states venice 1.0
			set_faction_standing papal_states milan 1.0
			set_faction_standing papal_states spain 1.0
			set_faction_standing papal_states hre 1.0
			set_faction_standing papal_states sicily 1.0
			set_faction_standing papal_states poland 1.0
			set_faction_standing papal_states byzantium 1.0
			set_faction_standing papal_states timurids 1.0
			set_faction_standing papal_states lucca 1.0

			;---------------------- Naples
			set_faction_standing sicily venice 1.0
			set_faction_standing sicily milan 1.0
			set_faction_standing sicily spain 1.0
			set_faction_standing sicily hre 1.0
			set_faction_standing sicily papal_states 1.0
			set_faction_standing sicily poland 1.0
			set_faction_standing sicily byzantium 1.0
			set_faction_standing sicily timurids 1.0
			set_faction_standing sicily lucca 1.0

			;---------------------- Florence
			set_faction_standing poland venice 1.0
			set_faction_standing poland milan 1.0
			set_faction_standing poland spain 1.0
			set_faction_standing poland hre 1.0
			set_faction_standing poland papal_states 1.0
			set_faction_standing poland sicily 1.0
			set_faction_standing poland byzantium 1.0
			set_faction_standing poland timurids 1.0
			set_faction_standing poland lucca 1.0

			;---------------------- Mantua
			set_faction_standing byzantium venice 1.0
			set_faction_standing byzantium milan 1.0
			set_faction_standing byzantium spain 1.0
			set_faction_standing byzantium hre 1.0
			set_faction_standing byzantium papal_states 1.0
			set_faction_standing byzantium sicily 1.0
			set_faction_standing byzantium poland 1.0
			set_faction_standing byzantium timurids 1.0
			set_faction_standing byzantium lucca 1.0

			;---------------------- Bologna
			set_faction_standing timurids venice 1.0
			set_faction_standing timurids milan 1.0
			set_faction_standing timurids spain 1.0
			set_faction_standing timurids hre 1.0
			set_faction_standing timurids papal_states 1.0
			set_faction_standing timurids sicily 1.0
			set_faction_standing timurids poland 1.0
			set_faction_standing timurids byzantium 1.0
			set_faction_standing timurids lucca 1.0

			;---------------------- Lucca
			set_faction_standing lucca venice 1.0
			set_faction_standing lucca milan 1.0
			set_faction_standing lucca spain 1.0
			set_faction_standing lucca hre 1.0
			set_faction_standing lucca papal_states 1.0
			set_faction_standing lucca sicily 1.0
			set_faction_standing lucca poland 1.0
			set_faction_standing lucca byzantium 1.0
			set_faction_standing lucca timurids 1.0

			console_command diplomatic_stance sicily venice Allied
			console_command diplomatic_stance sicily milan Allied
			console_command diplomatic_stance sicily papal_states Allied
			console_command diplomatic_stance sicily spain Allied
			console_command diplomatic_stance sicily hre Allied
			console_command diplomatic_stance sicily poland Allied
			console_command diplomatic_stance sicily byzantium Allied
			console_command diplomatic_stance sicily timurids Allied
			console_command diplomatic_stance sicily lucca Allied

			console_command diplomatic_stance venice milan Allied
			console_command diplomatic_stance venice papal_states Allied
			console_command diplomatic_stance venice spain Allied
			console_command diplomatic_stance venice hre Allied
			console_command diplomatic_stance venice poland Allied
			console_command diplomatic_stance venice byzantium Allied
			console_command diplomatic_stance venice timurids Allied
			console_command diplomatic_stance venice lucca Allied

			console_command diplomatic_stance milan papal_states Allied
			console_command diplomatic_stance milan spain Allied
			console_command diplomatic_stance milan hre Allied
			console_command diplomatic_stance milan poland Allied
			console_command diplomatic_stance milan byzantium Allied
			console_command diplomatic_stance milan timurids Allied
			console_command diplomatic_stance milan lucca Allied

			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states poland Allied
			console_command diplomatic_stance papal_states byzantium Allied
			console_command diplomatic_stance papal_states timurids Allied
			console_command diplomatic_stance papal_states lucca Allied

			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance spain poland Allied
			console_command diplomatic_stance spain byzantium Allied
			console_command diplomatic_stance spain timurids Allied
			console_command diplomatic_stance spain lucca Allied

			console_command diplomatic_stance hre poland Allied
			console_command diplomatic_stance hre byzantium Allied
			console_command diplomatic_stance hre timurids Allied
			console_command diplomatic_stance hre lucca Allied

			console_command diplomatic_stance poland byzantium Allied
			console_command diplomatic_stance poland timurids Allied
			console_command diplomatic_stance poland lucca Allied

			console_command diplomatic_stance byzantium timurids Allied

			console_command diplomatic_stance lucca byzantium Allied
			console_command diplomatic_stance lucca timurids Allied

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Angenommen Ligamitglieder -----------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType liga_v_mitglieder_accepted

		set_counter liga_v_besteht 1

			;---------------------- Beziehungen zur Liga
			set_faction_standing france venice -1.0
			set_faction_standing venice france -1.0

			set_faction_standing france milan -1.0
			set_faction_standing milan france -1.0

			set_faction_standing france papal_states -1.0
			set_faction_standing papal_states france -1.0

			set_faction_standing france spain -1.0
			set_faction_standing spain france -1.0

			set_faction_standing france hre -1.0
			set_faction_standing hre france -1.0

			set_faction_standing france sicily -1.0
			set_faction_standing sicily france -1.0

			set_faction_standing france poland -1.0
			set_faction_standing poland france -1.0

			set_faction_standing france byzantium -0.7
			set_faction_standing byzantium france -0.7

			set_faction_standing france timurids -0.5
			set_faction_standing timurids france -0.5

			set_faction_standing france lucca -0.5
			set_faction_standing lucca france -0.5

			console_command diplomatic_stance france milan War
			console_command diplomatic_stance france venice War
			console_command diplomatic_stance france papal_states War
			console_command diplomatic_stance france spain War
			console_command diplomatic_stance france hre War
			console_command diplomatic_stance france sicily War
			console_command diplomatic_stance france poland War
			console_command diplomatic_stance france byzantium War
			console_command diplomatic_stance france timurids War
			console_command diplomatic_stance france lucca War

			;---------------------- Beziehungen der Mitglieder
			;------------------------------------------------------------------------------

			;---------------------- Venice
			set_faction_standing venice milan 1.0
			set_faction_standing venice spain 1.0
			set_faction_standing venice hre 1.0
			set_faction_standing venice papal_states 1.0
			set_faction_standing venice sicily 1.0
			set_faction_standing venice poland 1.0
			set_faction_standing venice byzantium 1.0
			set_faction_standing venice timurids 1.0
			set_faction_standing venice lucca 1.0

			;---------------------- Milan
			set_faction_standing milan venice 1.0
			set_faction_standing milan spain 1.0
			set_faction_standing milan hre 1.0
			set_faction_standing milan papal_states 1.0
			set_faction_standing milan sicily 1.0
			set_faction_standing milan poland 1.0
			set_faction_standing milan byzantium 1.0
			set_faction_standing milan timurids 1.0
			set_faction_standing milan lucca 1.0

			;---------------------- Spain
			set_faction_standing spain venice 1.0
			set_faction_standing spain milan 1.0
			set_faction_standing spain hre 1.0
			set_faction_standing spain papal_states 1.0
			set_faction_standing spain sicily 1.0
			set_faction_standing spain poland 1.0
			set_faction_standing spain byzantium 1.0
			set_faction_standing spain timurids 1.0
			set_faction_standing spain lucca 1.0

			;---------------------- HRE
			set_faction_standing hre venice 1.0
			set_faction_standing hre milan 1.0
			set_faction_standing hre spain 1.0
			set_faction_standing hre papal_states 1.0
			set_faction_standing hre sicily 1.0
			set_faction_standing hre poland 1.0
			set_faction_standing hre byzantium 1.0
			set_faction_standing hre timurids 1.0
			set_faction_standing hre lucca 1.0

			;---------------------- Papal States
			set_faction_standing papal_states venice 1.0
			set_faction_standing papal_states milan 1.0
			set_faction_standing papal_states spain 1.0
			set_faction_standing papal_states hre 1.0
			set_faction_standing papal_states sicily 1.0
			set_faction_standing papal_states poland 1.0
			set_faction_standing papal_states byzantium 1.0
			set_faction_standing papal_states timurids 1.0
			set_faction_standing papal_states lucca 1.0

			;---------------------- Naples
			set_faction_standing sicily venice 1.0
			set_faction_standing sicily milan 1.0
			set_faction_standing sicily spain 1.0
			set_faction_standing sicily hre 1.0
			set_faction_standing sicily papal_states 1.0
			set_faction_standing sicily poland 1.0
			set_faction_standing sicily byzantium 1.0
			set_faction_standing sicily timurids 1.0
			set_faction_standing sicily lucca 1.0

			;---------------------- Florence
			set_faction_standing poland venice 1.0
			set_faction_standing poland milan 1.0
			set_faction_standing poland spain 1.0
			set_faction_standing poland hre 1.0
			set_faction_standing poland papal_states 1.0
			set_faction_standing poland sicily 1.0
			set_faction_standing poland byzantium 1.0
			set_faction_standing poland timurids 1.0
			set_faction_standing poland lucca 1.0

			;---------------------- Mantua
			set_faction_standing byzantium venice 1.0
			set_faction_standing byzantium milan 1.0
			set_faction_standing byzantium spain 1.0
			set_faction_standing byzantium hre 1.0
			set_faction_standing byzantium papal_states 1.0
			set_faction_standing byzantium sicily 1.0
			set_faction_standing byzantium poland 1.0
			set_faction_standing byzantium timurids 1.0
			set_faction_standing byzantium lucca 1.0

			;---------------------- Bologna
			set_faction_standing timurids venice 1.0
			set_faction_standing timurids milan 1.0
			set_faction_standing timurids spain 1.0
			set_faction_standing timurids hre 1.0
			set_faction_standing timurids papal_states 1.0
			set_faction_standing timurids sicily 1.0
			set_faction_standing timurids poland 1.0
			set_faction_standing timurids byzantium 1.0
			set_faction_standing timurids lucca 1.0

			;---------------------- Lucca
			set_faction_standing lucca venice 1.0
			set_faction_standing lucca milan 1.0
			set_faction_standing lucca spain 1.0
			set_faction_standing lucca hre 1.0
			set_faction_standing lucca papal_states 1.0
			set_faction_standing lucca sicily 1.0
			set_faction_standing lucca poland 1.0
			set_faction_standing lucca byzantium 1.0
			set_faction_standing lucca timurids 1.0

			console_command diplomatic_stance sicily venice Allied
			console_command diplomatic_stance sicily milan Allied
			console_command diplomatic_stance sicily papal_states Allied
			console_command diplomatic_stance sicily spain Allied
			console_command diplomatic_stance sicily hre Allied
			console_command diplomatic_stance sicily poland Allied
			console_command diplomatic_stance sicily byzantium Allied
			console_command diplomatic_stance sicily timurids Allied
			console_command diplomatic_stance sicily lucca Allied

			console_command diplomatic_stance venice milan Allied
			console_command diplomatic_stance venice papal_states Allied
			console_command diplomatic_stance venice spain Allied
			console_command diplomatic_stance venice hre Allied
			console_command diplomatic_stance venice poland Allied
			console_command diplomatic_stance venice byzantium Allied
			console_command diplomatic_stance venice timurids Allied
			console_command diplomatic_stance venice lucca Allied

			console_command diplomatic_stance milan papal_states Allied
			console_command diplomatic_stance milan spain Allied
			console_command diplomatic_stance milan hre Allied
			console_command diplomatic_stance milan poland Allied
			console_command diplomatic_stance milan byzantium Allied
			console_command diplomatic_stance milan timurids Allied
			console_command diplomatic_stance milan lucca Allied

			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states poland Allied
			console_command diplomatic_stance papal_states byzantium Allied
			console_command diplomatic_stance papal_states timurids Allied
			console_command diplomatic_stance papal_states lucca Allied

			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance spain poland Allied
			console_command diplomatic_stance spain byzantium Allied
			console_command diplomatic_stance spain timurids Allied
			console_command diplomatic_stance spain lucca Allied

			console_command diplomatic_stance hre poland Allied
			console_command diplomatic_stance hre byzantium Allied
			console_command diplomatic_stance hre timurids Allied
			console_command diplomatic_stance hre lucca Allied

			console_command diplomatic_stance poland byzantium Allied
			console_command diplomatic_stance poland timurids Allied
			console_command diplomatic_stance poland lucca Allied

			console_command diplomatic_stance byzantium timurids Allied

			console_command diplomatic_stance lucca byzantium Allied
			console_command diplomatic_stance lucca timurids Allied

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Abgelehnt Ligamitglieder ------------------------------
	;------------------------------------------------------------------------------

	;---------------------- Abgelehnt Papst

	monitor_event EventCounter EventCounterType liga_v_papst_declined
		and I_LocalFaction papal_states

		historic_event liga_v_papst_nein

		add_settlement_turmoil Rom 30
		add_settlement_turmoil Perugia 15
		add_settlement_turmoil Avignon 15
		add_settlement_turmoil Benevento 15
		add_settlement_turmoil Forli 15
		add_settlement_turmoil Assisi 15
		add_settlement_turmoil Fermo 15
		add_settlement_turmoil Rimini 15
		add_settlement_turmoil Spoleto 15
		add_settlement_turmoil Sinigaglia 15
		add_settlement_turmoil Pontecorvo 15
		add_settlement_turmoil Camerion 25

			;---------------------- Beziehungen zur Liga
			set_faction_standing france venice -1.0
			set_faction_standing venice france -1.0

			set_faction_standing france milan -1.0
			set_faction_standing milan france -1.0

			set_faction_standing france papal_states 0.5
			set_faction_standing papal_states france 0.5

			set_faction_standing france spain -1.0
			set_faction_standing spain france -1.0

			set_faction_standing france hre -1.0
			set_faction_standing hre france -1.0

			set_faction_standing france sicily -1.0
			set_faction_standing sicily france -1.0

			set_faction_standing france poland -1.0
			set_faction_standing poland france -1.0

			set_faction_standing france byzantium -0.7
			set_faction_standing byzantium france -0.7

			set_faction_standing france timurids -0.5
			set_faction_standing timurids france -0.5

			set_faction_standing france lucca -0.5
			set_faction_standing lucca france -0.5

			console_command diplomatic_stance france milan War
			console_command diplomatic_stance france venice War
			console_command diplomatic_stance france spain War
			console_command diplomatic_stance france hre War
			console_command diplomatic_stance france sicily War
			console_command diplomatic_stance france poland War
			console_command diplomatic_stance france byzantium War
			console_command diplomatic_stance france timurids War
			console_command diplomatic_stance france lucca War

			;---------------------- Beziehungen der Mitglieder
			;------------------------------------------------------------------------------

			;---------------------- Venice
			set_faction_standing venice milan 1.0
			set_faction_standing venice spain 1.0
			set_faction_standing venice hre 1.0
			set_faction_standing venice papal_states -0.5
			set_faction_standing venice sicily 1.0
			set_faction_standing venice poland 1.0
			set_faction_standing venice byzantium 1.0
			set_faction_standing venice timurids 1.0
			set_faction_standing venice lucca 1.0

			;---------------------- Milan
			set_faction_standing milan venice 1.0
			set_faction_standing milan spain 1.0
			set_faction_standing milan hre 1.0
			set_faction_standing milan papal_states -0.5
			set_faction_standing milan sicily 1.0
			set_faction_standing milan poland 1.0
			set_faction_standing milan byzantium 1.0
			set_faction_standing milan timurids 1.0
			set_faction_standing milan lucca 1.0

			;---------------------- Spain
			set_faction_standing spain venice 1.0
			set_faction_standing spain milan 1.0
			set_faction_standing spain hre 1.0
			set_faction_standing spain papal_states -0.5
			set_faction_standing spain sicily 1.0
			set_faction_standing spain poland 1.0
			set_faction_standing spain byzantium 1.0
			set_faction_standing spain timurids 1.0
			set_faction_standing spain lucca 1.0

			;---------------------- HRE
			set_faction_standing hre venice 1.0
			set_faction_standing hre milan 1.0
			set_faction_standing hre spain 1.0
			set_faction_standing hre papal_states -0.5
			set_faction_standing hre sicily 1.0
			set_faction_standing hre poland 1.0
			set_faction_standing hre byzantium 1.0
			set_faction_standing hre timurids 1.0
			set_faction_standing hre lucca 1.0

			;---------------------- Papal States
			set_faction_standing papal_states venice -0.5
			set_faction_standing papal_states milan -0.5
			set_faction_standing papal_states spain -0.5
			set_faction_standing papal_states hre -0.5
			set_faction_standing papal_states sicily -0.5
			set_faction_standing papal_states poland -0.5
			set_faction_standing papal_states byzantium -0.5
			set_faction_standing papal_states timurids -0.5
			set_faction_standing papal_states lucca -0.5

			;---------------------- Naples
			set_faction_standing sicily venice 1.0
			set_faction_standing sicily milan 1.0
			set_faction_standing sicily spain 1.0
			set_faction_standing sicily hre 1.0
			set_faction_standing sicily papal_states -1.0
			set_faction_standing sicily poland 1.0
			set_faction_standing sicily byzantium 1.0
			set_faction_standing sicily timurids 1.0
			set_faction_standing sicily lucca 1.0

			;---------------------- Florence
			set_faction_standing poland venice 1.0
			set_faction_standing poland milan 1.0
			set_faction_standing poland spain 1.0
			set_faction_standing poland hre 1.0
			set_faction_standing poland papal_states -0.5
			set_faction_standing poland sicily 1.0
			set_faction_standing poland byzantium 1.0
			set_faction_standing poland timurids 1.0
			set_faction_standing poland lucca 1.0

			;---------------------- Mantua
			set_faction_standing byzantium venice 1.0
			set_faction_standing byzantium milan 1.0
			set_faction_standing byzantium spain 1.0
			set_faction_standing byzantium hre 1.0
			set_faction_standing byzantium papal_states -0.5
			set_faction_standing byzantium sicily 1.0
			set_faction_standing byzantium poland 1.0
			set_faction_standing byzantium timurids 1.0
			set_faction_standing byzantium lucca 1.0

			;---------------------- Bologna
			set_faction_standing timurids venice 1.0
			set_faction_standing timurids milan 1.0
			set_faction_standing timurids spain 1.0
			set_faction_standing timurids hre 1.0
			set_faction_standing timurids papal_states -0.5
			set_faction_standing timurids sicily 1.0
			set_faction_standing timurids poland 1.0
			set_faction_standing timurids byzantium 1.0
			set_faction_standing timurids lucca 1.0

			;---------------------- Lucca
			set_faction_standing lucca venice 1.0
			set_faction_standing lucca milan 1.0
			set_faction_standing lucca spain 1.0
			set_faction_standing lucca hre 1.0
			set_faction_standing lucca papal_states -0.5
			set_faction_standing lucca sicily 1.0
			set_faction_standing lucca poland 1.0
			set_faction_standing lucca byzantium 1.0
			set_faction_standing lucca timurids 1.0

			console_command diplomatic_stance sicily venice Allied
			console_command diplomatic_stance sicily milan Allied
			console_command diplomatic_stance sicily spain Allied
			console_command diplomatic_stance sicily hre Allied
			console_command diplomatic_stance sicily poland Allied
			console_command diplomatic_stance sicily byzantium Allied
			console_command diplomatic_stance sicily timurids Allied
			console_command diplomatic_stance sicily lucca Allied

			console_command diplomatic_stance venice milan Allied
			console_command diplomatic_stance venice spain Allied
			console_command diplomatic_stance venice hre Allied
			console_command diplomatic_stance venice poland Allied
			console_command diplomatic_stance venice byzantium Allied
			console_command diplomatic_stance venice timurids Allied
			console_command diplomatic_stance venice lucca Allied

			console_command diplomatic_stance milan spain Allied
			console_command diplomatic_stance milan hre Allied
			console_command diplomatic_stance milan poland Allied
			console_command diplomatic_stance milan byzantium Allied
			console_command diplomatic_stance milan timurids Allied
			console_command diplomatic_stance milan lucca Allied

			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance spain poland Allied
			console_command diplomatic_stance spain byzantium Allied
			console_command diplomatic_stance spain timurids Allied
			console_command diplomatic_stance spain lucca Allied

			console_command diplomatic_stance hre poland Allied
			console_command diplomatic_stance hre byzantium Allied
			console_command diplomatic_stance hre timurids Allied
			console_command diplomatic_stance hre lucca Allied

			console_command diplomatic_stance poland byzantium Allied
			console_command diplomatic_stance poland timurids Allied
			console_command diplomatic_stance poland lucca Allied

			console_command diplomatic_stance byzantium timurids Allied

			console_command diplomatic_stance lucca byzantium Allied
			console_command diplomatic_stance lucca timurids Allied

		terminate_monitor
	end_monitor    


		;---------------------- Abgelehnt Venedig

	monitor_event EventCounter EventCounterType liga_v_mitglieder_declined
		and I_LocalFaction venice

		set_counter liga_v_besteht 1
		set_counter liga_v_nein_venice 1

			;---------------------- Beziehungen zur Liga
			set_faction_standing france venice 0.5
			set_faction_standing venice france 0.5

			set_faction_standing france milan -1.0
			set_faction_standing milan france -1.0

			set_faction_standing france papal_states -1.0
			set_faction_standing papal_states france -1.0

			set_faction_standing france spain -1.0
			set_faction_standing spain france -1.0

			set_faction_standing france hre -1.0
			set_faction_standing hre france -1.0

			set_faction_standing france sicily -1.0
			set_faction_standing sicily france -1.0

			set_faction_standing france poland -1.0
			set_faction_standing poland france -1.0

			set_faction_standing france byzantium -0.7
			set_faction_standing byzantium france -0.7

			set_faction_standing france timurids -0.5
			set_faction_standing timurids france -0.5

			set_faction_standing france lucca -0.5
			set_faction_standing lucca france -0.5

			console_command diplomatic_stance france milan War
			console_command diplomatic_stance france papal_states War
			console_command diplomatic_stance france spain War
			console_command diplomatic_stance france hre War
			console_command diplomatic_stance france sicily War
			console_command diplomatic_stance france poland War
			console_command diplomatic_stance france byzantium War
			console_command diplomatic_stance france timurids War
			console_command diplomatic_stance france lucca War

			;---------------------- Beziehungen der Mitglieder
			;------------------------------------------------------------------------------

			;---------------------- Venice
			set_faction_standing venice milan -0.5
			set_faction_standing venice spain -0.5
			set_faction_standing venice hre -0.5
			set_faction_standing venice papal_states -0.5
			set_faction_standing venice sicily -0.5
			set_faction_standing venice poland -0.5
			set_faction_standing venice byzantium -0.5
			set_faction_standing venice timurids -0.5
			set_faction_standing venice lucca -0.5

			;---------------------- Milan
			set_faction_standing milan venice -0.5
			set_faction_standing milan spain 1.0
			set_faction_standing milan hre 1.0
			set_faction_standing milan papal_states 1.0
			set_faction_standing milan sicily 1.0
			set_faction_standing milan poland 1.0
			set_faction_standing milan byzantium 1.0
			set_faction_standing milan timurids 1.0
			set_faction_standing milan lucca 1.0

			;---------------------- Spain
			set_faction_standing spain venice -0.5
			set_faction_standing spain milan 1.0
			set_faction_standing spain hre 1.0
			set_faction_standing spain papal_states 1.0
			set_faction_standing spain sicily 1.0
			set_faction_standing spain poland 1.0
			set_faction_standing spain byzantium 1.0
			set_faction_standing spain timurids 1.0
			set_faction_standing spain lucca 1.0

			;---------------------- HRE
			set_faction_standing hre venice -0.5
			set_faction_standing hre milan 1.0
			set_faction_standing hre spain 1.0
			set_faction_standing hre papal_states 1.0
			set_faction_standing hre sicily 1.0
			set_faction_standing hre poland 1.0
			set_faction_standing hre byzantium 1.0
			set_faction_standing hre timurids 1.0
			set_faction_standing hre lucca 1.0

			;---------------------- Papal States
			set_faction_standing papal_states venice -0.5
			set_faction_standing papal_states milan 1.0
			set_faction_standing papal_states spain 1.0
			set_faction_standing papal_states hre 1.0
			set_faction_standing papal_states sicily 1.0
			set_faction_standing papal_states poland 1.0
			set_faction_standing papal_states byzantium 1.0
			set_faction_standing papal_states timurids 1.0
			set_faction_standing papal_states lucca 1.0

			;---------------------- Naples
			set_faction_standing sicily venice -1.0
			set_faction_standing sicily milan 1.0
			set_faction_standing sicily spain 1.0
			set_faction_standing sicily hre 1.0
			set_faction_standing sicily papal_states 1.0
			set_faction_standing sicily poland 1.0
			set_faction_standing sicily byzantium 1.0
			set_faction_standing sicily timurids 1.0
			set_faction_standing sicily lucca 1.0

			;---------------------- Florence
			set_faction_standing poland venice -0.5
			set_faction_standing poland milan 1.0
			set_faction_standing poland spain 1.0
			set_faction_standing poland hre 1.0
			set_faction_standing poland papal_states 1.0
			set_faction_standing poland sicily 1.0
			set_faction_standing poland byzantium 1.0
			set_faction_standing poland timurids 1.0
			set_faction_standing poland lucca 1.0

			;---------------------- Mantua
			set_faction_standing byzantium venice -0.5
			set_faction_standing byzantium milan 1.0
			set_faction_standing byzantium spain 1.0
			set_faction_standing byzantium hre 1.0
			set_faction_standing byzantium papal_states 1.0
			set_faction_standing byzantium sicily 1.0
			set_faction_standing byzantium poland 1.0
			set_faction_standing byzantium timurids 1.0
			set_faction_standing byzantium lucca 1.0

			;---------------------- Bologna
			set_faction_standing timurids venice -0.5
			set_faction_standing timurids milan 1.0
			set_faction_standing timurids spain 1.0
			set_faction_standing timurids hre 1.0
			set_faction_standing timurids papal_states 1.0
			set_faction_standing timurids sicily 1.0
			set_faction_standing timurids poland 1.0
			set_faction_standing timurids byzantium 1.0
			set_faction_standing timurids lucca 1.0

			;---------------------- Lucca
			set_faction_standing lucca venice -0.5
			set_faction_standing lucca milan 1.0
			set_faction_standing lucca spain 1.0
			set_faction_standing lucca hre 1.0
			set_faction_standing lucca papal_states 1.0
			set_faction_standing lucca sicily 1.0
			set_faction_standing lucca poland 1.0
			set_faction_standing lucca byzantium 1.0
			set_faction_standing lucca timurids 1.0

			console_command diplomatic_stance sicily milan Allied
			console_command diplomatic_stance sicily papal_states Allied
			console_command diplomatic_stance sicily spain Allied
			console_command diplomatic_stance sicily hre Allied
			console_command diplomatic_stance sicily poland Allied
			console_command diplomatic_stance sicily byzantium Allied
			console_command diplomatic_stance sicily timurids Allied
			console_command diplomatic_stance sicily lucca Allied

			console_command diplomatic_stance milan papal_states Allied
			console_command diplomatic_stance milan spain Allied
			console_command diplomatic_stance milan hre Allied
			console_command diplomatic_stance milan poland Allied
			console_command diplomatic_stance milan byzantium Allied
			console_command diplomatic_stance milan timurids Allied
			console_command diplomatic_stance milan lucca Allied

			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states poland Allied
			console_command diplomatic_stance papal_states byzantium Allied
			console_command diplomatic_stance papal_states timurids Allied
			console_command diplomatic_stance papal_states lucca Allied

			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance spain poland Allied
			console_command diplomatic_stance spain byzantium Allied
			console_command diplomatic_stance spain timurids Allied
			console_command diplomatic_stance spain lucca Allied

			console_command diplomatic_stance hre poland Allied
			console_command diplomatic_stance hre byzantium Allied
			console_command diplomatic_stance hre timurids Allied
			console_command diplomatic_stance hre lucca Allied

			console_command diplomatic_stance poland byzantium Allied
			console_command diplomatic_stance poland timurids Allied
			console_command diplomatic_stance poland lucca Allied

			console_command diplomatic_stance byzantium timurids Allied

			console_command diplomatic_stance lucca byzantium Allied
			console_command diplomatic_stance lucca timurids Allied

		terminate_monitor
	end_monitor


	;---------------------- Abgelehnt Mailand

	monitor_event EventCounter EventCounterType liga_v_mitglieder_declined
		and I_LocalFaction milan

		set_counter liga_v_besteht 1
		set_counter liga_v_nein_milan 1

			;---------------------- Beziehungen zur Liga
			set_faction_standing france venice -1.0
			set_faction_standing venice france -1.0

			set_faction_standing france milan 0.5
			set_faction_standing milan france 0.5

			set_faction_standing france papal_states -1.0
			set_faction_standing papal_states france -1.0

			set_faction_standing france spain -1.0
			set_faction_standing spain france -1.0

			set_faction_standing france hre -1.0
			set_faction_standing hre france -1.0

			set_faction_standing france sicily -1.0
			set_faction_standing sicily france -1.0

			set_faction_standing france poland -1.0
			set_faction_standing poland france -1.0

			set_faction_standing france byzantium -0.7
			set_faction_standing byzantium france -0.7

			set_faction_standing france timurids -0.5
			set_faction_standing timurids france -0.5

			set_faction_standing france lucca -0.5
			set_faction_standing lucca france -0.5

			console_command diplomatic_stance france venice War
			console_command diplomatic_stance france papal_states War
			console_command diplomatic_stance france spain War
			console_command diplomatic_stance france hre War
			console_command diplomatic_stance france sicily War
			console_command diplomatic_stance france poland War
			console_command diplomatic_stance france byzantium War
			console_command diplomatic_stance france timurids War
			console_command diplomatic_stance france lucca War

			;---------------------- Beziehungen der Mitglieder
			;------------------------------------------------------------------------------

			;---------------------- Venice
			set_faction_standing venice milan -0.5
			set_faction_standing venice spain 1.0
			set_faction_standing venice hre 1.0
			set_faction_standing venice papal_states 1.0
			set_faction_standing venice sicily 1.0
			set_faction_standing venice poland 1.0
			set_faction_standing venice byzantium 1.0
			set_faction_standing venice timurids 1.0
			set_faction_standing venice lucca 1.0

			;---------------------- Milan
			set_faction_standing milan venice -0.5
			set_faction_standing milan spain -0.5
			set_faction_standing milan hre -0.5
			set_faction_standing milan papal_states -0.5
			set_faction_standing milan sicily -0.5
			set_faction_standing milan poland -0.5
			set_faction_standing milan byzantium -0.5
			set_faction_standing milan timurids -0.5
			set_faction_standing milan lucca -0.5

			;---------------------- Spain
			set_faction_standing spain venice 1.0
			set_faction_standing spain milan -0.5
			set_faction_standing spain hre 1.0
			set_faction_standing spain papal_states 1.0
			set_faction_standing spain sicily 1.0
			set_faction_standing spain poland 1.0
			set_faction_standing spain byzantium 1.0
			set_faction_standing spain timurids 1.0
			set_faction_standing spain lucca 1.0

			;---------------------- HRE
			set_faction_standing hre venice 1.0
			set_faction_standing hre milan -0.5
			set_faction_standing hre spain 1.0
			set_faction_standing hre papal_states 1.0
			set_faction_standing hre sicily 1.0
			set_faction_standing hre poland 1.0
			set_faction_standing hre byzantium 1.0
			set_faction_standing hre timurids 1.0
			set_faction_standing hre lucca 1.0

			;---------------------- Papal States
			set_faction_standing papal_states venice 1.0
			set_faction_standing papal_states milan -0.5
			set_faction_standing papal_states spain 1.0
			set_faction_standing papal_states hre 1.0
			set_faction_standing papal_states sicily 1.0
			set_faction_standing papal_states poland 1.0
			set_faction_standing papal_states byzantium 1.0
			set_faction_standing papal_states timurids 1.0
			set_faction_standing papal_states lucca 1.0

			;---------------------- Naples
			set_faction_standing sicily venice 1.0
			set_faction_standing sicily milan -1.0
			set_faction_standing sicily spain 1.0
			set_faction_standing sicily hre 1.0
			set_faction_standing sicily papal_states 1.0
			set_faction_standing sicily poland 1.0
			set_faction_standing sicily byzantium 1.0
			set_faction_standing sicily timurids 1.0
			set_faction_standing sicily lucca 1.0

			;---------------------- Florence
			set_faction_standing poland venice 1.0
			set_faction_standing poland milan -0.5
			set_faction_standing poland spain 1.0
			set_faction_standing poland hre 1.0
			set_faction_standing poland papal_states 1.0
			set_faction_standing poland sicily 1.0
			set_faction_standing poland byzantium 1.0
			set_faction_standing poland timurids 1.0
			set_faction_standing poland lucca 1.0

			;---------------------- Mantua
			set_faction_standing byzantium venice 1.0
			set_faction_standing byzantium milan -0.5
			set_faction_standing byzantium spain 1.0
			set_faction_standing byzantium hre 1.0
			set_faction_standing byzantium papal_states 1.0
			set_faction_standing byzantium sicily 1.0
			set_faction_standing byzantium poland 1.0
			set_faction_standing byzantium timurids 1.0
			set_faction_standing byzantium lucca 1.0

			;---------------------- Bologna
			set_faction_standing timurids venice 1.0
			set_faction_standing timurids milan -0.5
			set_faction_standing timurids spain 1.0
			set_faction_standing timurids hre 1.0
			set_faction_standing timurids papal_states 1.0
			set_faction_standing timurids sicily 1.0
			set_faction_standing timurids poland 1.0
			set_faction_standing timurids byzantium 1.0
			set_faction_standing timurids lucca 1.0

			;---------------------- Lucca
			set_faction_standing lucca venice 1.0
			set_faction_standing lucca milan -0.5
			set_faction_standing lucca spain 1.0
			set_faction_standing lucca hre 1.0
			set_faction_standing lucca papal_states 1.0
			set_faction_standing lucca sicily 1.0
			set_faction_standing lucca poland 1.0
			set_faction_standing lucca byzantium 1.0
			set_faction_standing lucca timurids 1.0

			console_command diplomatic_stance sicily venice Allied
			console_command diplomatic_stance sicily papal_states Allied
			console_command diplomatic_stance sicily spain Allied
			console_command diplomatic_stance sicily hre Allied
			console_command diplomatic_stance sicily poland Allied
			console_command diplomatic_stance sicily byzantium Allied
			console_command diplomatic_stance sicily timurids Allied
			console_command diplomatic_stance sicily lucca Allied

			console_command diplomatic_stance venice papal_states Allied
			console_command diplomatic_stance venice spain Allied
			console_command diplomatic_stance venice hre Allied
			console_command diplomatic_stance venice poland Allied
			console_command diplomatic_stance venice byzantium Allied
			console_command diplomatic_stance venice timurids Allied
			console_command diplomatic_stance venice lucca Allied

			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states poland Allied
			console_command diplomatic_stance papal_states byzantium Allied
			console_command diplomatic_stance papal_states timurids Allied
			console_command diplomatic_stance papal_states lucca Allied

			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance spain poland Allied
			console_command diplomatic_stance spain byzantium Allied
			console_command diplomatic_stance spain timurids Allied
			console_command diplomatic_stance spain lucca Allied

			console_command diplomatic_stance hre poland Allied
			console_command diplomatic_stance hre byzantium Allied
			console_command diplomatic_stance hre timurids Allied
			console_command diplomatic_stance hre lucca Allied

			console_command diplomatic_stance poland byzantium Allied
			console_command diplomatic_stance poland timurids Allied
			console_command diplomatic_stance poland lucca Allied

			console_command diplomatic_stance byzantium timurids Allied

			console_command diplomatic_stance lucca byzantium Allied
			console_command diplomatic_stance lucca timurids Allied

		terminate_monitor
	end_monitor


	;----------------------- Abgelehnt Spanien
	monitor_event EventCounter EventCounterType liga_v_mitglieder_declined
		and I_LocalFaction spain

		set_counter liga_v_besteht 1
		set_counter liga_v_nein_spain 1

			;---------------------- Beziehungen zur Liga
			set_faction_standing france venice -1.0
			set_faction_standing venice france -1.0

			set_faction_standing france milan -1.0
			set_faction_standing milan france -1.0

			set_faction_standing france papal_states -1.0
			set_faction_standing papal_states france -1.0

			set_faction_standing france spain 0.5
			set_faction_standing spain france 0.5

			set_faction_standing france hre -1.0
			set_faction_standing hre france -1.0

			set_faction_standing france sicily -1.0
			set_faction_standing sicily france -1.0

			set_faction_standing france poland -1.0
			set_faction_standing poland france -1.0

			set_faction_standing france byzantium -0.7
			set_faction_standing byzantium france -0.7

			set_faction_standing france timurids -0.5
			set_faction_standing timurids france -0.5

			set_faction_standing france lucca -0.5
			set_faction_standing lucca france -0.5

			console_command diplomatic_stance france milan War
			console_command diplomatic_stance france venice War
			console_command diplomatic_stance france papal_states War
			console_command diplomatic_stance france hre War
			console_command diplomatic_stance france sicily War
			console_command diplomatic_stance france poland War
			console_command diplomatic_stance france byzantium War
			console_command diplomatic_stance france timurids War
			console_command diplomatic_stance france lucca War

			;---------------------- Beziehungen der Mitglieder
			;------------------------------------------------------------------------------

			;---------------------- Venice
			set_faction_standing venice milan 1.0
			set_faction_standing venice spain -0.5
			set_faction_standing venice hre 1.0
			set_faction_standing venice papal_states 1.0
			set_faction_standing venice sicily 1.0
			set_faction_standing venice poland 1.0
			set_faction_standing venice byzantium 1.0
			set_faction_standing venice timurids 1.0
			set_faction_standing venice lucca 1.0

			;---------------------- Milan
			set_faction_standing milan venice 1.0
			set_faction_standing milan spain -0.5
			set_faction_standing milan hre 1.0
			set_faction_standing milan papal_states 1.0
			set_faction_standing milan sicily 1.0
			set_faction_standing milan poland 1.0
			set_faction_standing milan byzantium 1.0
			set_faction_standing milan timurids 1.0
			set_faction_standing milan lucca 1.0

			;---------------------- Spain
			set_faction_standing spain venice -0.5
			set_faction_standing spain milan -0.5
			set_faction_standing spain hre -0.5
			set_faction_standing spain papal_states -0.5
			set_faction_standing spain sicily -0.5
			set_faction_standing spain poland -0.5
			set_faction_standing spain byzantium -0.5
			set_faction_standing spain timurids -0.5
			set_faction_standing spain lucca -0.5

			;---------------------- HRE
			set_faction_standing hre venice 1.0
			set_faction_standing hre milan 1.0
			set_faction_standing hre spain -0.5
			set_faction_standing hre papal_states 1.0
			set_faction_standing hre sicily 1.0
			set_faction_standing hre poland 1.0
			set_faction_standing hre byzantium 1.0
			set_faction_standing hre timurids 1.0
			set_faction_standing hre lucca 1.0

			;---------------------- Papal States
			set_faction_standing papal_states venice 1.0
			set_faction_standing papal_states milan 1.0
			set_faction_standing papal_states spain -0.5
			set_faction_standing papal_states hre 1.0
			set_faction_standing papal_states sicily 1.0
			set_faction_standing papal_states poland 1.0
			set_faction_standing papal_states byzantium 1.0
			set_faction_standing papal_states timurids 1.0
			set_faction_standing papal_states lucca 1.0

			;---------------------- Naples
			set_faction_standing sicily venice 1.0
			set_faction_standing sicily milan 1.0
			set_faction_standing sicily spain -0.5
			set_faction_standing sicily hre 1.0
			set_faction_standing sicily papal_states 1.0
			set_faction_standing sicily poland 1.0
			set_faction_standing sicily byzantium 1.0
			set_faction_standing sicily timurids 1.0
			set_faction_standing sicily lucca 1.0

			;---------------------- Florence
			set_faction_standing poland venice 1.0
			set_faction_standing poland milan 1.0
			set_faction_standing poland spain -0.5
			set_faction_standing poland hre 1.0
			set_faction_standing poland papal_states 1.0
			set_faction_standing poland sicily 1.0
			set_faction_standing poland byzantium 1.0
			set_faction_standing poland timurids 1.0
			set_faction_standing poland lucca 1.0

			;---------------------- Mantua
			set_faction_standing byzantium venice 1.0
			set_faction_standing byzantium milan 1.0
			set_faction_standing byzantium spain -0.5
			set_faction_standing byzantium hre 1.0
			set_faction_standing byzantium papal_states 1.0
			set_faction_standing byzantium sicily 1.0
			set_faction_standing byzantium poland 1.0
			set_faction_standing byzantium timurids 1.0
			set_faction_standing byzantium lucca 1.0

			;---------------------- Bologna
			set_faction_standing timurids venice 1.0
			set_faction_standing timurids milan 1.0
			set_faction_standing timurids spain -0.5
			set_faction_standing timurids hre 1.0
			set_faction_standing timurids papal_states 1.0
			set_faction_standing timurids sicily 1.0
			set_faction_standing timurids poland 1.0
			set_faction_standing timurids byzantium 1.0
			set_faction_standing timurids lucca 1.0

			;---------------------- Lucca
			set_faction_standing lucca venice 1.0
			set_faction_standing lucca milan 1.0
			set_faction_standing lucca spain -0.5
			set_faction_standing lucca hre 1.0
			set_faction_standing lucca papal_states 1.0
			set_faction_standing lucca sicily 1.0
			set_faction_standing lucca poland 1.0
			set_faction_standing lucca byzantium 1.0
			set_faction_standing lucca timurids 1.0

			console_command diplomatic_stance sicily venice Allied
			console_command diplomatic_stance sicily milan Allied
			console_command diplomatic_stance sicily papal_states Allied
			console_command diplomatic_stance sicily hre Allied
			console_command diplomatic_stance sicily poland Allied
			console_command diplomatic_stance sicily byzantium Allied
			console_command diplomatic_stance sicily timurids Allied
			console_command diplomatic_stance sicily lucca Allied

			console_command diplomatic_stance venice milan Allied
			console_command diplomatic_stance venice papal_states Allied
			console_command diplomatic_stance venice hre Allied
			console_command diplomatic_stance venice poland Allied
			console_command diplomatic_stance venice byzantium Allied
			console_command diplomatic_stance venice timurids Allied
			console_command diplomatic_stance venice lucca Allied

			console_command diplomatic_stance milan papal_states Allied
			console_command diplomatic_stance milan hre Allied
			console_command diplomatic_stance milan poland Allied
			console_command diplomatic_stance milan byzantium Allied
			console_command diplomatic_stance milan timurids Allied
			console_command diplomatic_stance milan lucca Allied

			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states poland Allied
			console_command diplomatic_stance papal_states byzantium Allied
			console_command diplomatic_stance papal_states timurids Allied
			console_command diplomatic_stance papal_states lucca Allied

			console_command diplomatic_stance hre poland Allied
			console_command diplomatic_stance hre byzantium Allied
			console_command diplomatic_stance hre timurids Allied
			console_command diplomatic_stance hre lucca Allied

			console_command diplomatic_stance poland byzantium Allied
			console_command diplomatic_stance poland timurids Allied
			console_command diplomatic_stance poland lucca Allied

			console_command diplomatic_stance byzantium timurids Allied

			console_command diplomatic_stance lucca byzantium Allied
			console_command diplomatic_stance lucca timurids Allied

		terminate_monitor
	end_monitor


	;------------------------ Abgelehnt HRR

	monitor_event EventCounter EventCounterType liga_v_mitglieder_declined
		and I_LocalFaction hre

		set_counter liga_v_besteht 1
		set_counter liga_v_nein_hre 1

			;---------------------- Beziehungen zur Liga
			set_faction_standing france venice -1.0
			set_faction_standing venice france -1.0

			set_faction_standing france milan -1.0
			set_faction_standing milan france -1.0

			set_faction_standing france papal_states -1.0
			set_faction_standing papal_states france -1.0

			set_faction_standing france spain -1.0
			set_faction_standing spain france -1.0

			set_faction_standing france hre 0.5
			set_faction_standing hre france 0.5

			set_faction_standing france sicily -1.0
			set_faction_standing sicily france -1.0

			set_faction_standing france poland -1.0
			set_faction_standing poland france -1.0

			set_faction_standing france byzantium -0.7
			set_faction_standing byzantium france -0.7

			set_faction_standing france timurids -0.5
			set_faction_standing timurids france -0.5

			set_faction_standing france lucca -0.5
			set_faction_standing lucca france -0.5

			console_command diplomatic_stance france milan War
			console_command diplomatic_stance france venice War
			console_command diplomatic_stance france papal_states War
			console_command diplomatic_stance france spain War
			console_command diplomatic_stance france sicily War
			console_command diplomatic_stance france poland War
			console_command diplomatic_stance france byzantium War
			console_command diplomatic_stance france timurids War
			console_command diplomatic_stance france lucca War

			;---------------------- Beziehungen der Mitglieder
			;------------------------------------------------------------------------------

			;---------------------- Venice
			set_faction_standing venice milan 1.0
			set_faction_standing venice spain 1.0
			set_faction_standing venice hre -0.5
			set_faction_standing venice papal_states 1.0
			set_faction_standing venice sicily 1.0
			set_faction_standing venice poland 1.0
			set_faction_standing venice byzantium 1.0
			set_faction_standing venice timurids 1.0
			set_faction_standing venice lucca 1.0

			;---------------------- Milan
			set_faction_standing milan venice 1.0
			set_faction_standing milan spain 1.0
			set_faction_standing milan hre -0.5
			set_faction_standing milan papal_states 1.0
			set_faction_standing milan sicily 1.0
			set_faction_standing milan poland 1.0
			set_faction_standing milan byzantium 1.0
			set_faction_standing milan timurids 1.0
			set_faction_standing milan lucca 1.0

			;---------------------- Spain
			set_faction_standing spain venice 1.0
			set_faction_standing spain milan 1.0
			set_faction_standing spain hre -0.5
			set_faction_standing spain papal_states 1.0
			set_faction_standing spain sicily 1.0
			set_faction_standing spain poland 1.0
			set_faction_standing spain byzantium 1.0
			set_faction_standing spain timurids 1.0
			set_faction_standing spain lucca 1.0

			;---------------------- HRE
			set_faction_standing hre venice -0.5
			set_faction_standing hre milan -0.5
			set_faction_standing hre spain -0.5
			set_faction_standing hre papal_states -0.5
			set_faction_standing hre sicily -0.5
			set_faction_standing hre poland -0.5
			set_faction_standing hre byzantium -0.5
			set_faction_standing hre timurids -0.5
			set_faction_standing hre lucca -0.5

			;---------------------- Papal States
			set_faction_standing papal_states venice 1.0
			set_faction_standing papal_states milan 1.0
			set_faction_standing papal_states spain 1.0
			set_faction_standing papal_states hre -0.5
			set_faction_standing papal_states sicily 1.0
			set_faction_standing papal_states poland 1.0
			set_faction_standing papal_states byzantium 1.0
			set_faction_standing papal_states timurids 1.0
			set_faction_standing papal_states lucca 1.0

			;---------------------- Naples
			set_faction_standing sicily venice 1.0
			set_faction_standing sicily milan 1.0
			set_faction_standing sicily spain 1.0
			set_faction_standing sicily hre -0.5
			set_faction_standing sicily papal_states 1.0
			set_faction_standing sicily poland 1.0
			set_faction_standing sicily byzantium 1.0
			set_faction_standing sicily timurids 1.0
			set_faction_standing sicily lucca 1.0

			;---------------------- Florence
			set_faction_standing poland venice 1.0
			set_faction_standing poland milan 1.0
			set_faction_standing poland spain 1.0
			set_faction_standing poland hre -0.5
			set_faction_standing poland papal_states 1.0
			set_faction_standing poland sicily 1.0
			set_faction_standing poland byzantium 1.0
			set_faction_standing poland timurids 1.0
			set_faction_standing poland lucca 1.0

			;---------------------- Mantua
			set_faction_standing byzantium venice 1.0
			set_faction_standing byzantium milan 1.0
			set_faction_standing byzantium spain 1.0
			set_faction_standing byzantium hre -0.5
			set_faction_standing byzantium papal_states 1.0
			set_faction_standing byzantium sicily 1.0
			set_faction_standing byzantium poland 1.0
			set_faction_standing byzantium timurids 1.0
			set_faction_standing byzantium lucca 1.0

			;---------------------- Bologna
			set_faction_standing timurids venice 1.0
			set_faction_standing timurids milan 1.0
			set_faction_standing timurids spain 1.0
			set_faction_standing timurids hre -0.5
			set_faction_standing timurids papal_states 1.0
			set_faction_standing timurids sicily 1.0
			set_faction_standing timurids poland 1.0
			set_faction_standing timurids byzantium 1.0
			set_faction_standing timurids lucca 1.0

			;---------------------- Lucca
			set_faction_standing lucca venice 1.0
			set_faction_standing lucca milan 1.0
			set_faction_standing lucca spain 1.0
			set_faction_standing lucca hre -0.5
			set_faction_standing lucca papal_states 1.0
			set_faction_standing lucca sicily 1.0
			set_faction_standing lucca poland 1.0
			set_faction_standing lucca byzantium 1.0
			set_faction_standing lucca timurids 1.0

			console_command diplomatic_stance sicily venice Allied
			console_command diplomatic_stance sicily milan Allied
			console_command diplomatic_stance sicily papal_states Allied
			console_command diplomatic_stance sicily spain Allied
			console_command diplomatic_stance sicily poland Allied
			console_command diplomatic_stance sicily byzantium Allied
			console_command diplomatic_stance sicily timurids Allied
			console_command diplomatic_stance sicily lucca Allied

			console_command diplomatic_stance venice milan Allied
			console_command diplomatic_stance venice papal_states Allied
			console_command diplomatic_stance venice spain Allied
			console_command diplomatic_stance venice poland Allied
			console_command diplomatic_stance venice byzantium Allied
			console_command diplomatic_stance venice timurids Allied
			console_command diplomatic_stance venice lucca Allied

			console_command diplomatic_stance milan papal_states Allied
			console_command diplomatic_stance milan spain Allied
			console_command diplomatic_stance milan poland Allied
			console_command diplomatic_stance milan byzantium Allied
			console_command diplomatic_stance milan timurids Allied
			console_command diplomatic_stance milan lucca Allied

			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance papal_states poland Allied
			console_command diplomatic_stance papal_states byzantium Allied
			console_command diplomatic_stance papal_states timurids Allied
			console_command diplomatic_stance papal_states lucca Allied

			console_command diplomatic_stance spain poland Allied
			console_command diplomatic_stance spain byzantium Allied
			console_command diplomatic_stance spain timurids Allied
			console_command diplomatic_stance spain lucca Allied

			console_command diplomatic_stance poland byzantium Allied
			console_command diplomatic_stance poland timurids Allied
			console_command diplomatic_stance poland lucca Allied

			console_command diplomatic_stance byzantium timurids Allied

			console_command diplomatic_stance lucca byzantium Allied
			console_command diplomatic_stance lucca timurids Allied

		terminate_monitor
	end_monitor


	;------------------------ Abgelehnt Florenz

	monitor_event EventCounter EventCounterType liga_v_mitglieder_declined
		and I_LocalFaction poland

		set_counter liga_v_besteht 1
		set_counter liga_v_nein_florenz 1

			;---------------------- Beziehungen zur Liga
			set_faction_standing france venice -1.0
			set_faction_standing venice france -1.0

			set_faction_standing france milan -1.0
			set_faction_standing milan france -1.0

			set_faction_standing france papal_states -1.0
			set_faction_standing papal_states france -1.0

			set_faction_standing france spain -1.0
			set_faction_standing spain france -1.0

			set_faction_standing france hre -1.0
			set_faction_standing hre france -1.0

			set_faction_standing france sicily -1.0
			set_faction_standing sicily france -1.0

			set_faction_standing france poland 0.5
			set_faction_standing poland france 0.5

			set_faction_standing france byzantium -0.7
			set_faction_standing byzantium france -0.7

			set_faction_standing france timurids -0.5
			set_faction_standing timurids france -0.5

			set_faction_standing france lucca -0.5
			set_faction_standing lucca france -0.5

			console_command diplomatic_stance france milan War
			console_command diplomatic_stance france venice War
			console_command diplomatic_stance france papal_states War
			console_command diplomatic_stance france spain War
			console_command diplomatic_stance france hre War
			console_command diplomatic_stance france sicily War
			console_command diplomatic_stance france byzantium War
			console_command diplomatic_stance france timurids War
			console_command diplomatic_stance france lucca War

			;---------------------- Beziehungen der Mitglieder
			;------------------------------------------------------------------------------

			;---------------------- Venice
			set_faction_standing venice milan 1.0
			set_faction_standing venice spain 1.0
			set_faction_standing venice hre 1.0
			set_faction_standing venice papal_states 1.0
			set_faction_standing venice sicily 1.0
			set_faction_standing venice poland -0.5
			set_faction_standing venice byzantium 1.0
			set_faction_standing venice timurids 1.0
			set_faction_standing venice lucca 1.0

			;---------------------- Milan
			set_faction_standing milan venice 1.0
			set_faction_standing milan spain 1.0
			set_faction_standing milan hre 1.0
			set_faction_standing milan papal_states 1.0
			set_faction_standing milan sicily 1.0
			set_faction_standing milan poland -0.5
			set_faction_standing milan byzantium 1.0
			set_faction_standing milan timurids 1.0
			set_faction_standing milan lucca 1.0

			;---------------------- Spain
			set_faction_standing spain venice 1.0
			set_faction_standing spain milan 1.0
			set_faction_standing spain hre 1.0
			set_faction_standing spain papal_states 1.0
			set_faction_standing spain sicily 1.0
			set_faction_standing spain poland -0.5
			set_faction_standing spain byzantium 1.0
			set_faction_standing spain timurids 1.0
			set_faction_standing spain lucca 1.0

			;---------------------- HRE
			set_faction_standing hre venice 1.0
			set_faction_standing hre milan 1.0
			set_faction_standing hre spain 1.0
			set_faction_standing hre papal_states 1.0
			set_faction_standing hre sicily 1.0
			set_faction_standing hre poland -0.5
			set_faction_standing hre byzantium 1.0
			set_faction_standing hre timurids 1.0
			set_faction_standing hre lucca 1.0

			;---------------------- Papal States
			set_faction_standing papal_states venice 1.0
			set_faction_standing papal_states milan 1.0
			set_faction_standing papal_states spain 1.0
			set_faction_standing papal_states hre 1.0
			set_faction_standing papal_states sicily 1.0
			set_faction_standing papal_states poland -0.5
			set_faction_standing papal_states byzantium 1.0
			set_faction_standing papal_states timurids 1.0
			set_faction_standing papal_states lucca 1.0

			;---------------------- Naples
			set_faction_standing sicily venice 1.0
			set_faction_standing sicily milan 1.0
			set_faction_standing sicily spain 1.0
			set_faction_standing sicily hre 1.0
			set_faction_standing sicily papal_states 1.0
			set_faction_standing sicily poland -1.0
			set_faction_standing sicily byzantium 1.0
			set_faction_standing sicily timurids 1.0
			set_faction_standing sicily lucca 1.0

			;---------------------- Florence
			set_faction_standing poland venice -0.5
			set_faction_standing poland milan -0.5
			set_faction_standing poland spain -0.5
			set_faction_standing poland hre -0.5
			set_faction_standing poland papal_states -0.5
			set_faction_standing poland sicily -0.5
			set_faction_standing poland byzantium -0.5
			set_faction_standing poland timurids -0.5
			set_faction_standing poland lucca -0.5

			;---------------------- Mantua
			set_faction_standing byzantium venice 1.0
			set_faction_standing byzantium milan 1.0
			set_faction_standing byzantium spain 1.0
			set_faction_standing byzantium hre 1.0
			set_faction_standing byzantium papal_states 1.0
			set_faction_standing byzantium sicily 1.0
			set_faction_standing byzantium poland -0.5
			set_faction_standing byzantium timurids 1.0
			set_faction_standing byzantium lucca 1.0

			;---------------------- Bologna
			set_faction_standing timurids venice 1.0
			set_faction_standing timurids milan 1.0
			set_faction_standing timurids spain 1.0
			set_faction_standing timurids hre 1.0
			set_faction_standing timurids papal_states 1.0
			set_faction_standing timurids sicily 1.0
			set_faction_standing timurids poland -0.5
			set_faction_standing timurids byzantium 1.0
			set_faction_standing timurids lucca 1.0

			;---------------------- Lucca
			set_faction_standing lucca venice 1.0
			set_faction_standing lucca milan 1.0
			set_faction_standing lucca spain 1.0
			set_faction_standing lucca hre 1.0
			set_faction_standing lucca papal_states 1.0
			set_faction_standing lucca sicily 1.0
			set_faction_standing lucca poland -0.5
			set_faction_standing lucca byzantium 1.0
			set_faction_standing lucca timurids 1.0

			console_command diplomatic_stance sicily venice Allied
			console_command diplomatic_stance sicily milan Allied
			console_command diplomatic_stance sicily papal_states Allied
			console_command diplomatic_stance sicily spain Allied
			console_command diplomatic_stance sicily hre Allied
			console_command diplomatic_stance sicily byzantium Allied
			console_command diplomatic_stance sicily timurids Allied
			console_command diplomatic_stance sicily lucca Allied

			console_command diplomatic_stance venice milan Allied
			console_command diplomatic_stance venice papal_states Allied
			console_command diplomatic_stance venice spain Allied
			console_command diplomatic_stance venice hre Allied
			console_command diplomatic_stance venice byzantium Allied
			console_command diplomatic_stance venice timurids Allied
			console_command diplomatic_stance venice lucca Allied

			console_command diplomatic_stance milan papal_states Allied
			console_command diplomatic_stance milan spain Allied
			console_command diplomatic_stance milan hre Allied
			console_command diplomatic_stance milan byzantium Allied
			console_command diplomatic_stance milan timurids Allied
			console_command diplomatic_stance milan lucca Allied

			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states byzantium Allied
			console_command diplomatic_stance papal_states timurids Allied
			console_command diplomatic_stance papal_states lucca Allied

			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance spain byzantium Allied
			console_command diplomatic_stance spain timurids Allied
			console_command diplomatic_stance spain lucca Allied

			console_command diplomatic_stance hre byzantium Allied
			console_command diplomatic_stance hre timurids Allied
			console_command diplomatic_stance hre lucca Allied

			console_command diplomatic_stance byzantium timurids Allied

			console_command diplomatic_stance lucca byzantium Allied
			console_command diplomatic_stance lucca timurids Allied

		terminate_monitor
	end_monitor


	;------------------------ Abgelehnt Mantua

	monitor_event EventCounter EventCounterType liga_v_mitglieder_declined
		and I_LocalFaction byzantium

		set_counter liga_v_besteht 1
		set_counter liga_v_nein_mantua 1

			;---------------------- Beziehungen zur Liga
			set_faction_standing france venice -1.0
			set_faction_standing venice france -1.0

			set_faction_standing france milan -1.0
			set_faction_standing milan france -1.0

			set_faction_standing france papal_states -1.0
			set_faction_standing papal_states france -1.0

			set_faction_standing france spain -1.0
			set_faction_standing spain france -1.0

			set_faction_standing france hre -1.0
			set_faction_standing hre france -1.0

			set_faction_standing france sicily -1.0
			set_faction_standing sicily france -1.0

			set_faction_standing france poland -1.0
			set_faction_standing poland france -1.0

			set_faction_standing france byzantium 0.5
			set_faction_standing byzantium france 0.5

			set_faction_standing france timurids -0.5
			set_faction_standing timurids france -0.5

			set_faction_standing france lucca -0.5
			set_faction_standing lucca france -0.5

			console_command diplomatic_stance france milan War
			console_command diplomatic_stance france venice War
			console_command diplomatic_stance france papal_states War
			console_command diplomatic_stance france spain War
			console_command diplomatic_stance france hre War
			console_command diplomatic_stance france sicily War
			console_command diplomatic_stance france poland War
			console_command diplomatic_stance france timurids War
			console_command diplomatic_stance france lucca War

			;---------------------- Beziehungen der Mitglieder
			;------------------------------------------------------------------------------

			;---------------------- Venice
			set_faction_standing venice milan 1.0
			set_faction_standing venice spain 1.0
			set_faction_standing venice hre 1.0
			set_faction_standing venice papal_states 1.0
			set_faction_standing venice sicily 1.0
			set_faction_standing venice poland 1.0
			set_faction_standing venice byzantium -0.5
			set_faction_standing venice timurids 1.0
			set_faction_standing venice lucca 1.0

			;---------------------- Milan
			set_faction_standing milan venice 1.0
			set_faction_standing milan spain 1.0
			set_faction_standing milan hre 1.0
			set_faction_standing milan papal_states 1.0
			set_faction_standing milan sicily 1.0
			set_faction_standing milan poland 1.0
			set_faction_standing milan byzantium -0.5
			set_faction_standing milan timurids 1.0
			set_faction_standing milan lucca 1.0

			;---------------------- Spain
			set_faction_standing spain venice 1.0
			set_faction_standing spain milan 1.0
			set_faction_standing spain hre 1.0
			set_faction_standing spain papal_states 1.0
			set_faction_standing spain sicily 1.0
			set_faction_standing spain poland 1.0
			set_faction_standing spain byzantium -0.5
			set_faction_standing spain timurids 1.0
			set_faction_standing spain lucca 1.0

			;---------------------- HRE
			set_faction_standing hre venice 1.0
			set_faction_standing hre milan 1.0
			set_faction_standing hre spain 1.0
			set_faction_standing hre papal_states 1.0
			set_faction_standing hre sicily 1.0
			set_faction_standing hre poland 1.0
			set_faction_standing hre byzantium -0.5
			set_faction_standing hre timurids 1.0
			set_faction_standing hre lucca 1.0

			;---------------------- Papal States
			set_faction_standing papal_states venice 1.0
			set_faction_standing papal_states milan 1.0
			set_faction_standing papal_states spain 1.0
			set_faction_standing papal_states hre 1.0
			set_faction_standing papal_states sicily 1.0
			set_faction_standing papal_states poland 1.0
			set_faction_standing papal_states byzantium -0.5
			set_faction_standing papal_states timurids 1.0
			set_faction_standing papal_states lucca 1.0

			;---------------------- Naples
			set_faction_standing sicily venice 1.0
			set_faction_standing sicily milan 1.0
			set_faction_standing sicily spain 1.0
			set_faction_standing sicily hre 1.0
			set_faction_standing sicily papal_states 1.0
			set_faction_standing sicily poland 1.0
			set_faction_standing sicily byzantium -1.0
			set_faction_standing sicily timurids 1.0
			set_faction_standing sicily lucca 1.0

			;---------------------- Florence
			set_faction_standing poland venice 1.0
			set_faction_standing poland milan 1.0
			set_faction_standing poland spain 1.0
			set_faction_standing poland hre 1.0
			set_faction_standing poland papal_states 1.0
			set_faction_standing poland sicily 1.0
			set_faction_standing poland byzantium -0.5
			set_faction_standing poland timurids 1.0
			set_faction_standing poland lucca 1.0

			;---------------------- Mantua
			set_faction_standing byzantium venice -0.5
			set_faction_standing byzantium milan -0.5
			set_faction_standing byzantium spain -0.5
			set_faction_standing byzantium hre -0.5
			set_faction_standing byzantium papal_states -0.5
			set_faction_standing byzantium sicily -0.5
			set_faction_standing byzantium poland -0.5
			set_faction_standing byzantium timurids -0.5
			set_faction_standing byzantium lucca -0.5

			;---------------------- Bologna
			set_faction_standing timurids venice 1.0
			set_faction_standing timurids milan 1.0
			set_faction_standing timurids spain 1.0
			set_faction_standing timurids hre 1.0
			set_faction_standing timurids papal_states 1.0
			set_faction_standing timurids sicily 1.0
			set_faction_standing timurids poland 1.0
			set_faction_standing timurids byzantium -0.5
			set_faction_standing timurids lucca 1.0

			;---------------------- Lucca
			set_faction_standing lucca venice 1.0
			set_faction_standing lucca milan 1.0
			set_faction_standing lucca spain 1.0
			set_faction_standing lucca hre 1.0
			set_faction_standing lucca papal_states 1.0
			set_faction_standing lucca sicily 1.0
			set_faction_standing lucca poland 1.0
			set_faction_standing lucca byzantium -0.5
			set_faction_standing lucca timurids 1.0

			console_command diplomatic_stance sicily venice Allied
			console_command diplomatic_stance sicily milan Allied
			console_command diplomatic_stance sicily papal_states Allied
			console_command diplomatic_stance sicily spain Allied
			console_command diplomatic_stance sicily hre Allied
			console_command diplomatic_stance sicily poland Allied
			console_command diplomatic_stance sicily timurids Allied
			console_command diplomatic_stance sicily lucca Allied

			console_command diplomatic_stance venice milan Allied
			console_command diplomatic_stance venice papal_states Allied
			console_command diplomatic_stance venice spain Allied
			console_command diplomatic_stance venice hre Allied
			console_command diplomatic_stance venice poland Allied
			console_command diplomatic_stance venice timurids Allied
			console_command diplomatic_stance venice lucca Allied

			console_command diplomatic_stance milan papal_states Allied
			console_command diplomatic_stance milan spain Allied
			console_command diplomatic_stance milan hre Allied
			console_command diplomatic_stance milan poland Allied
			console_command diplomatic_stance milan timurids Allied
			console_command diplomatic_stance milan lucca Allied

			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states poland Allied
			console_command diplomatic_stance papal_states timurids Allied
			console_command diplomatic_stance papal_states lucca Allied

			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance spain poland Allied
			console_command diplomatic_stance spain timurids Allied
			console_command diplomatic_stance spain lucca Allied

			console_command diplomatic_stance hre poland Allied
			console_command diplomatic_stance hre timurids Allied
			console_command diplomatic_stance hre lucca Allied

			console_command diplomatic_stance poland timurids Allied
			console_command diplomatic_stance poland lucca Allied

			console_command diplomatic_stance lucca timurids Allied

		terminate_monitor
	end_monitor


	;------------------------ Abgelehnt Bologna

	monitor_event EventCounter EventCounterType liga_v_mitglieder_declined
		and I_LocalFaction timurids

		set_counter liga_v_besteht 1
		set_counter liga_v_nein_bologna 1

			;---------------------- Beziehungen zur Liga
			set_faction_standing france venice -1.0
			set_faction_standing venice france -1.0

			set_faction_standing france milan -1.0
			set_faction_standing milan france -1.0

			set_faction_standing france papal_states -1.0
			set_faction_standing papal_states france -1.0

			set_faction_standing france spain -1.0
			set_faction_standing spain france -1.0

			set_faction_standing france hre -1.0
			set_faction_standing hre france -1.0

			set_faction_standing france sicily -1.0
			set_faction_standing sicily france -1.0

			set_faction_standing france poland -1.0
			set_faction_standing poland france -1.0

			set_faction_standing france byzantium -0.7
			set_faction_standing byzantium france -0.7

			set_faction_standing france timurids 0.5
			set_faction_standing timurids france 0.5

			set_faction_standing france lucca -0.5
			set_faction_standing lucca france -0.5

			console_command diplomatic_stance france milan War
			console_command diplomatic_stance france venice War
			console_command diplomatic_stance france papal_states War
			console_command diplomatic_stance france spain War
			console_command diplomatic_stance france hre War
			console_command diplomatic_stance france sicily War
			console_command diplomatic_stance france poland War
			console_command diplomatic_stance france byzantium War
			console_command diplomatic_stance france lucca War

			;---------------------- Beziehungen der Mitglieder
			;------------------------------------------------------------------------------

			;---------------------- Venice
			set_faction_standing venice milan 1.0
			set_faction_standing venice spain 1.0
			set_faction_standing venice hre 1.0
			set_faction_standing venice papal_states 1.0
			set_faction_standing venice sicily 1.0
			set_faction_standing venice poland 1.0
			set_faction_standing venice byzantium 1.0
			set_faction_standing venice timurids -0.5
			set_faction_standing venice lucca 1.0

			;---------------------- Milan
			set_faction_standing milan venice 1.0
			set_faction_standing milan spain 1.0
			set_faction_standing milan hre 1.0
			set_faction_standing milan papal_states 1.0
			set_faction_standing milan sicily 1.0
			set_faction_standing milan poland 1.0
			set_faction_standing milan byzantium 1.0
			set_faction_standing milan timurids -0.5
			set_faction_standing milan lucca 1.0
			
			;---------------------- Spain
			set_faction_standing spain venice 1.0
			set_faction_standing spain milan 1.0
			set_faction_standing spain hre 1.0
			set_faction_standing spain papal_states 1.0
			set_faction_standing spain sicily 1.0
			set_faction_standing spain poland 1.0
			set_faction_standing spain byzantium 1.0
			set_faction_standing spain timurids -0.5
			set_faction_standing spain lucca 1.0
			
			;---------------------- HRE
			set_faction_standing hre venice 1.0
			set_faction_standing hre milan 1.0
			set_faction_standing hre spain 1.0
			set_faction_standing hre papal_states 1.0
			set_faction_standing hre sicily 1.0
			set_faction_standing hre poland 1.0
			set_faction_standing hre byzantium 1.0
			set_faction_standing hre timurids -0.5
			set_faction_standing hre lucca 1.0
			
			;---------------------- Papal States
			set_faction_standing papal_states venice 1.0
			set_faction_standing papal_states milan 1.0
			set_faction_standing papal_states spain 1.0
			set_faction_standing papal_states hre 1.0
			set_faction_standing papal_states sicily 1.0
			set_faction_standing papal_states poland 1.0
			set_faction_standing papal_states byzantium 1.0
			set_faction_standing papal_states timurids -0.7
			set_faction_standing papal_states lucca 1.0
			
			;---------------------- Naples
			set_faction_standing sicily venice 1.0
			set_faction_standing sicily milan 1.0
			set_faction_standing sicily spain 1.0
			set_faction_standing sicily hre 1.0
			set_faction_standing sicily papal_states 1.0
			set_faction_standing sicily poland 1.0
			set_faction_standing sicily byzantium 1.0
			set_faction_standing sicily timurids -1.0
			set_faction_standing sicily lucca 1.0
			
			;---------------------- Florence
			set_faction_standing poland venice 1.0
			set_faction_standing poland milan 1.0
			set_faction_standing poland spain 1.0
			set_faction_standing poland hre 1.0
			set_faction_standing poland papal_states 1.0
			set_faction_standing poland sicily 1.0
			set_faction_standing poland byzantium 1.0
			set_faction_standing poland timurids -0.5
			set_faction_standing poland lucca 1.0
			
			;---------------------- Mantua
			set_faction_standing byzantium venice 1.0
			set_faction_standing byzantium milan 1.0
			set_faction_standing byzantium spain 1.0
			set_faction_standing byzantium hre 1.0
			set_faction_standing byzantium papal_states 1.0
			set_faction_standing byzantium sicily 1.0
			set_faction_standing byzantium poland 1.0
			set_faction_standing byzantium timurids -0.5
			set_faction_standing byzantium lucca 1.0
			
			;---------------------- Bologna
			set_faction_standing timurids venice -0.5
			set_faction_standing timurids milan -0.5
			set_faction_standing timurids spain -0.5
			set_faction_standing timurids hre -0.5
			set_faction_standing timurids papal_states -0.5
			set_faction_standing timurids sicily -0.5
			set_faction_standing timurids poland -0.5
			set_faction_standing timurids byzantium -0.5
			set_faction_standing timurids lucca -0.5
			
			;---------------------- Lucca
			set_faction_standing lucca venice 1.0
			set_faction_standing lucca milan 1.0
			set_faction_standing lucca spain 1.0
			set_faction_standing lucca hre 1.0
			set_faction_standing lucca papal_states 1.0
			set_faction_standing lucca sicily 1.0
			set_faction_standing lucca poland 1.0
			set_faction_standing lucca byzantium 1.0
			set_faction_standing lucca timurids -0.5

			console_command diplomatic_stance sicily venice Allied
			console_command diplomatic_stance sicily milan Allied
			console_command diplomatic_stance sicily papal_states Allied
			console_command diplomatic_stance sicily spain Allied
			console_command diplomatic_stance sicily hre Allied
			console_command diplomatic_stance sicily poland Allied
			console_command diplomatic_stance sicily byzantium Allied
			console_command diplomatic_stance sicily lucca Allied

			console_command diplomatic_stance venice milan Allied
			console_command diplomatic_stance venice papal_states Allied
			console_command diplomatic_stance venice spain Allied
			console_command diplomatic_stance venice hre Allied
			console_command diplomatic_stance venice poland Allied
			console_command diplomatic_stance venice byzantium Allied
			console_command diplomatic_stance venice lucca Allied

			console_command diplomatic_stance milan papal_states Allied
			console_command diplomatic_stance milan spain Allied
			console_command diplomatic_stance milan hre Allied
			console_command diplomatic_stance milan poland Allied
			console_command diplomatic_stance milan byzantium Allied
			console_command diplomatic_stance milan lucca Allied

			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states poland Allied
			console_command diplomatic_stance papal_states byzantium Allied
			console_command diplomatic_stance papal_states lucca Allied

			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance spain poland Allied
			console_command diplomatic_stance spain byzantium Allied
			console_command diplomatic_stance spain lucca Allied

			console_command diplomatic_stance hre poland Allied
			console_command diplomatic_stance hre byzantium Allied
			console_command diplomatic_stance hre lucca Allied

			console_command diplomatic_stance poland byzantium Allied
			console_command diplomatic_stance poland lucca Allied

			console_command diplomatic_stance lucca byzantium Allied

		terminate_monitor
	end_monitor


	;------------------------ Abgelehnt Lucca

	monitor_event EventCounter EventCounterType liga_v_mitglieder_declined
		and I_LocalFaction lucca

		set_counter liga_v_besteht 1
		set_counter liga_v_nein_lucca 1

			;---------------------- Beziehungen zur Liga
			set_faction_standing france venice -1.0
			set_faction_standing venice france -1.0

			set_faction_standing france milan -1.0
			set_faction_standing milan france -1.0

			set_faction_standing france papal_states -1.0
			set_faction_standing papal_states france -1.0

			set_faction_standing france spain -1.0
			set_faction_standing spain france -1.0

			set_faction_standing france hre -1.0
			set_faction_standing hre france -1.0

			set_faction_standing france sicily -1.0
			set_faction_standing sicily france -1.0

			set_faction_standing france poland -1.0
			set_faction_standing poland france -1.0

			set_faction_standing france byzantium -0.7
			set_faction_standing byzantium france -0.7

			set_faction_standing france timurids -0.5
			set_faction_standing timurids france -0.5

			set_faction_standing france lucca 0.5
			set_faction_standing lucca france 0.5

			console_command diplomatic_stance france milan War
			console_command diplomatic_stance france venice War
			console_command diplomatic_stance france papal_states War
			console_command diplomatic_stance france spain War
			console_command diplomatic_stance france hre War
			console_command diplomatic_stance france sicily War
			console_command diplomatic_stance france poland War
			console_command diplomatic_stance france timurids War
			console_command diplomatic_stance france byzantium War

			;---------------------- Beziehungen der Mitglieder
			;------------------------------------------------------------------------------

			;---------------------- Venice
			set_faction_standing venice milan 1.0
			set_faction_standing venice spain 1.0
			set_faction_standing venice hre 1.0
			set_faction_standing venice papal_states 1.0
			set_faction_standing venice sicily 1.0
			set_faction_standing venice poland 1.0
			set_faction_standing venice byzantium 1.0
			set_faction_standing venice timurids 1.0
			set_faction_standing venice lucca -0.5

			;---------------------- Milan
			set_faction_standing milan venice 1.0
			set_faction_standing milan spain 1.0
			set_faction_standing milan hre 1.0
			set_faction_standing milan papal_states 1.0
			set_faction_standing milan sicily 1.0
			set_faction_standing milan poland 1.0
			set_faction_standing milan byzantium 1.0
			set_faction_standing milan timurids 1.0
			set_faction_standing milan lucca -0.5

			;---------------------- Spain
			set_faction_standing spain venice 1.0
			set_faction_standing spain milan 1.0
			set_faction_standing spain hre 1.0
			set_faction_standing spain papal_states 1.0
			set_faction_standing spain sicily 1.0
			set_faction_standing spain poland 1.0
			set_faction_standing spain byzantium 1.0
			set_faction_standing spain timurids 1.0
			set_faction_standing spain lucca -0.5

			;---------------------- HRE
			set_faction_standing hre venice 1.0
			set_faction_standing hre milan 1.0
			set_faction_standing hre spain 1.0
			set_faction_standing hre papal_states 1.0
			set_faction_standing hre sicily 1.0
			set_faction_standing hre poland 1.0
			set_faction_standing hre byzantium 1.0
			set_faction_standing hre timurids 1.0
			set_faction_standing hre lucca -0.5

			;---------------------- Papal States
			set_faction_standing papal_states venice 1.0
			set_faction_standing papal_states milan 1.0
			set_faction_standing papal_states spain 1.0
			set_faction_standing papal_states hre 1.0
			set_faction_standing papal_states sicily 1.0
			set_faction_standing papal_states poland 1.0
			set_faction_standing papal_states byzantium 1.0
			set_faction_standing papal_states timurids 1.0
			set_faction_standing papal_states lucca -0.5

			;---------------------- Naples
			set_faction_standing sicily venice 1.0
			set_faction_standing sicily milan 1.0
			set_faction_standing sicily spain 1.0
			set_faction_standing sicily hre 1.0
			set_faction_standing sicily papal_states 1.0
			set_faction_standing sicily poland 1.0
			set_faction_standing sicily byzantium 1.0
			set_faction_standing sicily timurids 1.0
			set_faction_standing sicily lucca -0.5

			;---------------------- Florence
			set_faction_standing poland venice 1.0
			set_faction_standing poland milan 1.0
			set_faction_standing poland spain 1.0
			set_faction_standing poland hre 1.0
			set_faction_standing poland papal_states 1.0
			set_faction_standing poland sicily 1.0
			set_faction_standing poland byzantium 1.0
			set_faction_standing poland timurids 1.0
			set_faction_standing poland lucca -0.5

			;---------------------- Mantua
			set_faction_standing byzantium venice 1.0
			set_faction_standing byzantium milan 1.0
			set_faction_standing byzantium spain 1.0
			set_faction_standing byzantium hre 1.0
			set_faction_standing byzantium papal_states 1.0
			set_faction_standing byzantium sicily 1.0
			set_faction_standing byzantium poland 1.0
			set_faction_standing byzantium timurids 1.0
			set_faction_standing byzantium lucca -0.5

			;---------------------- Bologna
			set_faction_standing timurids venice 1.0
			set_faction_standing timurids milan 1.0
			set_faction_standing timurids spain 1.0
			set_faction_standing timurids hre 1.0
			set_faction_standing timurids papal_states 1.0
			set_faction_standing timurids sicily 1.0
			set_faction_standing timurids poland 1.0
			set_faction_standing timurids byzantium 1.0
			set_faction_standing timurids lucca -0.5

			;---------------------- Lucca
			set_faction_standing lucca venice -0.5
			set_faction_standing lucca milan -0.5
			set_faction_standing lucca spain -0.5
			set_faction_standing lucca hre -0.5
			set_faction_standing lucca papal_states -0.5
			set_faction_standing lucca sicily -0.5
			set_faction_standing lucca poland -0.5
			set_faction_standing lucca byzantium -0.5
			set_faction_standing lucca timurids -0.5

			console_command diplomatic_stance sicily venice Allied
			console_command diplomatic_stance sicily milan Allied
			console_command diplomatic_stance sicily papal_states Allied
			console_command diplomatic_stance sicily spain Allied
			console_command diplomatic_stance sicily hre Allied
			console_command diplomatic_stance sicily poland Allied
			console_command diplomatic_stance sicily timurids Allied
			console_command diplomatic_stance sicily byzantium Allied

			console_command diplomatic_stance venice milan Allied
			console_command diplomatic_stance venice papal_states Allied
			console_command diplomatic_stance venice spain Allied
			console_command diplomatic_stance venice hre Allied
			console_command diplomatic_stance venice poland Allied
			console_command diplomatic_stance venice timurids Allied
			console_command diplomatic_stance venice byzantium Allied

			console_command diplomatic_stance milan papal_states Allied
			console_command diplomatic_stance milan spain Allied
			console_command diplomatic_stance milan hre Allied
			console_command diplomatic_stance milan poland Allied
			console_command diplomatic_stance milan timurids Allied
			console_command diplomatic_stance milan byzantium Allied

			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states poland Allied
			console_command diplomatic_stance papal_states timurids Allied
			console_command diplomatic_stance papal_states byzantium Allied

			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance spain poland Allied
			console_command diplomatic_stance spain timurids Allied
			console_command diplomatic_stance spain byzantium Allied

			console_command diplomatic_stance hre poland Allied
			console_command diplomatic_stance hre timurids Allied
			console_command diplomatic_stance hre byzantium Allied

			console_command diplomatic_stance poland timurids Allied
			console_command diplomatic_stance poland byzantium Allied

			console_command diplomatic_stance byzantium timurids Allied

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---- Rückeroberung 

	monitor_event FactionTurnStart I_TurnNumber > 8
		and I_TurnNumber < 28
		and not I_SettlementOwner Neapel = france
		and not I_SettlementOwner Neapel = slave

		hide_all_revealed_tiles

		if I_CompareCounter liga_v_besteht = 1
			historic_event liga_v_sieg_frankreich factions { france, }
			historic_event liga_v_sieg_mitglieder factions { venice, milan, papal_states, spain, hre, sicily, poland, byzantium, timurids, lucca, }
			historic_event liga_v_sieg_andere factions { saxons, turks, normans, hungary, denmark, england, russia, scotland, egypt, savoy, montferrat, urbino, }

			generate_random_counter set_peace 1 3

			if I_EventCounter set_peace = 1

				console_command diplomatic_stance france milan neutral
				console_command diplomatic_stance france venice neutral
				console_command diplomatic_stance france papal_states neutral
				console_command diplomatic_stance france spain neutral
				console_command diplomatic_stance france hre neutral
				console_command diplomatic_stance france poland neutral
				console_command diplomatic_stance france byzantium neutral
				console_command diplomatic_stance france timurids neutral
				console_command diplomatic_stance france lucca neutral

				console_command diplomatic_stance sicily venice neutral
				console_command diplomatic_stance sicily milan neutral
				console_command diplomatic_stance sicily papal_states neutral
				console_command diplomatic_stance sicily spain neutral
				console_command diplomatic_stance sicily hre neutral
				console_command diplomatic_stance sicily poland neutral
				console_command diplomatic_stance sicily byzantium neutral
				console_command diplomatic_stance sicily timurids neutral
				console_command diplomatic_stance sicily lucca neutral

				console_command diplomatic_stance venice milan neutral
				console_command diplomatic_stance venice papal_states neutral
				console_command diplomatic_stance venice spain neutral
				console_command diplomatic_stance venice hre neutral
				console_command diplomatic_stance venice poland neutral
				console_command diplomatic_stance venice byzantium neutral
				console_command diplomatic_stance venice timurids neutral
				console_command diplomatic_stance venice lucca neutral

				console_command diplomatic_stance milan papal_states neutral
				console_command diplomatic_stance milan spain neutral
				console_command diplomatic_stance milan hre neutral
				console_command diplomatic_stance milan poland neutral
				console_command diplomatic_stance milan byzantium neutral
				console_command diplomatic_stance milan timurids neutral
				console_command diplomatic_stance milan lucca neutral

				console_command diplomatic_stance papal_states spain neutral
				console_command diplomatic_stance papal_states hre neutral
				console_command diplomatic_stance papal_states poland neutral
				console_command diplomatic_stance papal_states byzantium neutral
				console_command diplomatic_stance papal_states timurids neutral
				console_command diplomatic_stance papal_states lucca neutral

				console_command diplomatic_stance spain hre neutral
				console_command diplomatic_stance spain poland neutral
				console_command diplomatic_stance spain byzantium neutral
				console_command diplomatic_stance spain timurids neutral
				console_command diplomatic_stance spain lucca neutral

				console_command diplomatic_stance hre poland neutral
				console_command diplomatic_stance hre byzantium neutral
				console_command diplomatic_stance hre timurids neutral
				console_command diplomatic_stance hre lucca neutral

				console_command diplomatic_stance poland byzantium neutral
				console_command diplomatic_stance poland timurids neutral
				console_command diplomatic_stance poland lucca neutral

				console_command diplomatic_stance byzantium timurids neutral

				console_command diplomatic_stance lucca byzantium neutral
				console_command diplomatic_stance lucca timurids neutral

			end_if 

			if I_EventCounter set_peace = 2


				console_command diplomatic_stance france milan neutral
				console_command diplomatic_stance france papal_states neutral
				console_command diplomatic_stance france spain neutral
				console_command diplomatic_stance france poland neutral
				console_command diplomatic_stance france byzantium neutral
				console_command diplomatic_stance france timurids neutral
				console_command diplomatic_stance france lucca neutral

				console_command diplomatic_stance sicily venice neutral
				console_command diplomatic_stance sicily milan neutral
				console_command diplomatic_stance sicily papal_states neutral
				console_command diplomatic_stance sicily spain neutral
				console_command diplomatic_stance sicily hre neutral
				console_command diplomatic_stance sicily poland neutral
				console_command diplomatic_stance sicily byzantium neutral
				console_command diplomatic_stance sicily timurids neutral
				console_command diplomatic_stance sicily lucca neutral

				console_command diplomatic_stance venice milan neutral
				console_command diplomatic_stance venice papal_states neutral
				console_command diplomatic_stance venice spain neutral
				console_command diplomatic_stance venice hre neutral
				console_command diplomatic_stance venice poland neutral
				console_command diplomatic_stance venice byzantium neutral
				console_command diplomatic_stance venice timurids neutral
				console_command diplomatic_stance venice lucca neutral

				console_command diplomatic_stance milan papal_states neutral
				console_command diplomatic_stance milan spain neutral
				console_command diplomatic_stance milan hre neutral
				console_command diplomatic_stance milan poland neutral
				console_command diplomatic_stance milan byzantium neutral
				console_command diplomatic_stance milan timurids neutral
				console_command diplomatic_stance milan lucca neutral

				console_command diplomatic_stance papal_states spain neutral
				console_command diplomatic_stance papal_states hre neutral
				console_command diplomatic_stance papal_states poland neutral
				console_command diplomatic_stance papal_states byzantium neutral
				console_command diplomatic_stance papal_states timurids neutral
				console_command diplomatic_stance papal_states lucca neutral

				console_command diplomatic_stance spain hre neutral
				console_command diplomatic_stance spain poland neutral
				console_command diplomatic_stance spain byzantium neutral
				console_command diplomatic_stance spain timurids neutral
				console_command diplomatic_stance spain lucca neutral

				console_command diplomatic_stance hre poland neutral
				console_command diplomatic_stance hre byzantium neutral
				console_command diplomatic_stance hre timurids neutral
				console_command diplomatic_stance hre lucca neutral

				console_command diplomatic_stance poland byzantium neutral
				console_command diplomatic_stance poland timurids neutral
				console_command diplomatic_stance poland lucca neutral

				console_command diplomatic_stance byzantium timurids neutral

				console_command diplomatic_stance lucca byzantium neutral
				console_command diplomatic_stance lucca timurids neutral

			end_if

			if I_EventCounter set_peace = 3

				console_command diplomatic_stance france papal_states neutral
				console_command diplomatic_stance france spain neutral
				console_command diplomatic_stance france hre neutral

				console_command diplomatic_stance sicily venice neutral
				console_command diplomatic_stance sicily milan neutral
				console_command diplomatic_stance sicily papal_states neutral
				console_command diplomatic_stance sicily spain neutral
				console_command diplomatic_stance sicily hre neutral
				console_command diplomatic_stance sicily poland neutral
				console_command diplomatic_stance sicily byzantium neutral
				console_command diplomatic_stance sicily timurids neutral
				console_command diplomatic_stance sicily lucca neutral

				console_command diplomatic_stance venice milan neutral
				console_command diplomatic_stance venice papal_states neutral
				console_command diplomatic_stance venice spain neutral
				console_command diplomatic_stance venice hre neutral
				console_command diplomatic_stance venice poland neutral
				console_command diplomatic_stance venice byzantium neutral
				console_command diplomatic_stance venice timurids neutral
				console_command diplomatic_stance venice lucca neutral

				console_command diplomatic_stance milan papal_states neutral
				console_command diplomatic_stance milan spain neutral
				console_command diplomatic_stance milan hre neutral
				console_command diplomatic_stance milan poland neutral
				console_command diplomatic_stance milan byzantium neutral
				console_command diplomatic_stance milan timurids neutral
				console_command diplomatic_stance milan lucca neutral

				console_command diplomatic_stance papal_states spain neutral
				console_command diplomatic_stance papal_states hre neutral
				console_command diplomatic_stance papal_states poland neutral
				console_command diplomatic_stance papal_states byzantium neutral
				console_command diplomatic_stance papal_states timurids neutral
				console_command diplomatic_stance papal_states lucca neutral

				console_command diplomatic_stance spain hre neutral
				console_command diplomatic_stance spain poland neutral
				console_command diplomatic_stance spain byzantium neutral
				console_command diplomatic_stance spain timurids neutral
				console_command diplomatic_stance spain lucca neutral

				console_command diplomatic_stance hre poland neutral
				console_command diplomatic_stance hre byzantium neutral
				console_command diplomatic_stance hre timurids neutral
				console_command diplomatic_stance hre lucca neutral

				console_command diplomatic_stance poland byzantium neutral
				console_command diplomatic_stance poland timurids neutral
				console_command diplomatic_stance poland lucca neutral

				console_command diplomatic_stance byzantium timurids neutral

				console_command diplomatic_stance lucca byzantium neutral
				console_command diplomatic_stance lucca timurids neutral

			end_if

			terminate_monitor
		end_if

		if I_CompareCounter liga_v_besteht = 1
			and I_CompareCounter liga_v_nein_venice = 1
			historic_event liga_v_sieg_frankreich factions { france, }
			historic_event liga_v_sieg_mitglieder factions { milan, papal_states, spain, hre, sicily, poland, byzantium, timurids, lucca, }
			historic_event liga_v_sieg_andere factions { saxons, turks, normans, hungary, poland, venice, denmark, byzantium, england, russia, scotland, egypt, savoy, montferrat, urbino, }
			generate_random_counter set_peace 1 3

			if I_EventCounter set_peace = 1

				console_command diplomatic_stance france milan neutral
				console_command diplomatic_stance france papal_states neutral
				console_command diplomatic_stance france spain neutral
				console_command diplomatic_stance france hre neutral
				console_command diplomatic_stance france poland neutral
				console_command diplomatic_stance france byzantium neutral
				console_command diplomatic_stance france timurids neutral
				console_command diplomatic_stance france lucca neutral

				console_command diplomatic_stance sicily milan neutral
				console_command diplomatic_stance sicily papal_states neutral
				console_command diplomatic_stance sicily spain neutral
				console_command diplomatic_stance sicily hre neutral
				console_command diplomatic_stance sicily poland neutral
				console_command diplomatic_stance sicily byzantium neutral
				console_command diplomatic_stance sicily timurids neutral
				console_command diplomatic_stance sicily lucca neutral

				console_command diplomatic_stance milan papal_states neutral
				console_command diplomatic_stance milan spain neutral
				console_command diplomatic_stance milan hre neutral
				console_command diplomatic_stance milan poland neutral
				console_command diplomatic_stance milan byzantium neutral
				console_command diplomatic_stance milan timurids neutral
				console_command diplomatic_stance milan lucca neutral

				console_command diplomatic_stance papal_states spain neutral
				console_command diplomatic_stance papal_states hre neutral
				console_command diplomatic_stance papal_states poland neutral
				console_command diplomatic_stance papal_states byzantium neutral
				console_command diplomatic_stance papal_states timurids neutral
				console_command diplomatic_stance papal_states lucca neutral

				console_command diplomatic_stance spain hre neutral
				console_command diplomatic_stance spain poland neutral
				console_command diplomatic_stance spain byzantium neutral
				console_command diplomatic_stance spain timurids neutral
				console_command diplomatic_stance spain lucca neutral

				console_command diplomatic_stance hre poland neutral
				console_command diplomatic_stance hre byzantium neutral
				console_command diplomatic_stance hre timurids neutral
				console_command diplomatic_stance hre lucca neutral

				console_command diplomatic_stance poland byzantium neutral
				console_command diplomatic_stance poland timurids neutral
				console_command diplomatic_stance poland lucca neutral

				console_command diplomatic_stance byzantium timurids neutral

				console_command diplomatic_stance lucca byzantium neutral
				console_command diplomatic_stance lucca timurids neutral

			end_if 

			if I_EventCounter set_peace = 2

				console_command diplomatic_stance france milan neutral
				console_command diplomatic_stance france papal_states neutral
				console_command diplomatic_stance france spain neutral
				console_command diplomatic_stance france byzantium neutral
				console_command diplomatic_stance france timurids neutral
				console_command diplomatic_stance france lucca neutral

				console_command diplomatic_stance sicily milan neutral
				console_command diplomatic_stance sicily papal_states neutral
				console_command diplomatic_stance sicily spain neutral
				console_command diplomatic_stance sicily hre neutral
				console_command diplomatic_stance sicily poland neutral
				console_command diplomatic_stance sicily byzantium neutral
				console_command diplomatic_stance sicily timurids neutral
				console_command diplomatic_stance sicily lucca neutral

				console_command diplomatic_stance milan papal_states neutral
				console_command diplomatic_stance milan spain neutral
				console_command diplomatic_stance milan hre neutral
				console_command diplomatic_stance milan poland neutral
				console_command diplomatic_stance milan byzantium neutral
				console_command diplomatic_stance milan timurids neutral
				console_command diplomatic_stance milan lucca neutral

				console_command diplomatic_stance papal_states spain neutral
				console_command diplomatic_stance papal_states hre neutral
				console_command diplomatic_stance papal_states poland neutral
				console_command diplomatic_stance papal_states byzantium neutral
				console_command diplomatic_stance papal_states timurids neutral
				console_command diplomatic_stance papal_states lucca neutral

				console_command diplomatic_stance spain hre neutral
				console_command diplomatic_stance spain poland neutral
				console_command diplomatic_stance spain byzantium neutral
				console_command diplomatic_stance spain timurids neutral
				console_command diplomatic_stance spain lucca neutral

				console_command diplomatic_stance hre poland neutral
				console_command diplomatic_stance hre byzantium neutral
				console_command diplomatic_stance hre timurids neutral
				console_command diplomatic_stance hre lucca neutral

				console_command diplomatic_stance poland byzantium neutral
				console_command diplomatic_stance poland timurids neutral
				console_command diplomatic_stance poland lucca neutral

				console_command diplomatic_stance byzantium timurids neutral

				console_command diplomatic_stance lucca byzantium neutral
				console_command diplomatic_stance lucca timurids neutral

			end_if

			if I_EventCounter set_peace = 3

				console_command diplomatic_stance france milan neutral
				console_command diplomatic_stance france papal_states neutral
				console_command diplomatic_stance france spain neutral
				console_command diplomatic_stance france hre neutral


				console_command diplomatic_stance sicily milan neutral
				console_command diplomatic_stance sicily papal_states neutral
				console_command diplomatic_stance sicily spain neutral
				console_command diplomatic_stance sicily hre neutral
				console_command diplomatic_stance sicily poland neutral
				console_command diplomatic_stance sicily byzantium neutral
				console_command diplomatic_stance sicily timurids neutral
				console_command diplomatic_stance sicily lucca neutral


				console_command diplomatic_stance milan papal_states neutral
				console_command diplomatic_stance milan spain neutral
				console_command diplomatic_stance milan hre neutral
				console_command diplomatic_stance milan poland neutral
				console_command diplomatic_stance milan byzantium neutral
				console_command diplomatic_stance milan timurids neutral
				console_command diplomatic_stance milan lucca neutral

				console_command diplomatic_stance papal_states spain neutral
				console_command diplomatic_stance papal_states hre neutral
				console_command diplomatic_stance papal_states poland neutral
				console_command diplomatic_stance papal_states byzantium neutral
				console_command diplomatic_stance papal_states timurids neutral
				console_command diplomatic_stance papal_states lucca neutral

				console_command diplomatic_stance spain hre neutral
				console_command diplomatic_stance spain poland neutral
				console_command diplomatic_stance spain byzantium neutral
				console_command diplomatic_stance spain timurids neutral
				console_command diplomatic_stance spain lucca neutral

				console_command diplomatic_stance hre poland neutral
				console_command diplomatic_stance hre byzantium neutral
				console_command diplomatic_stance hre timurids neutral
				console_command diplomatic_stance hre lucca neutral

				console_command diplomatic_stance poland byzantium neutral
				console_command diplomatic_stance poland timurids neutral
				console_command diplomatic_stance poland lucca neutral

				console_command diplomatic_stance byzantium timurids neutral

				console_command diplomatic_stance lucca byzantium neutral
				console_command diplomatic_stance lucca timurids neutral

			end_if


			terminate_monitor
		end_if

		if I_CompareCounter liga_v_besteht = 1
			and I_CompareCounter liga_v_nein_milan = 1
			historic_event liga_v_sieg_frankreich factions { france, }
			historic_event liga_v_sieg_mitglieder factions { venice, papal_states, spain, hre, sicily, poland, byzantium, timurids, lucca, }
			historic_event liga_v_sieg_andere factions { saxons, turks, normans, hungary, poland, milan, denmark, byzantium, england, russia, scotland, egypt, }
			generate_random_counter set_peace 1 3

			if I_EventCounter set_peace = 1

				  console_command diplomatic_stance france venice neutral
				  console_command diplomatic_stance france papal_states neutral
				  console_command diplomatic_stance france spain neutral
				  console_command diplomatic_stance france hre neutral
				  console_command diplomatic_stance france poland neutral
				  console_command diplomatic_stance france byzantium neutral
				  console_command diplomatic_stance france timurids neutral
				  console_command diplomatic_stance france lucca neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily spain neutral
				  console_command diplomatic_stance sicily hre neutral
				  console_command diplomatic_stance sicily poland neutral
				  console_command diplomatic_stance sicily byzantium neutral
				  console_command diplomatic_stance sicily timurids neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice spain neutral
				  console_command diplomatic_stance venice hre neutral
				  console_command diplomatic_stance venice poland neutral
				  console_command diplomatic_stance venice byzantium neutral
				  console_command diplomatic_stance venice timurids neutral
				  console_command diplomatic_stance venice lucca neutral

				  console_command diplomatic_stance papal_states spain neutral
				  console_command diplomatic_stance papal_states hre neutral
				  console_command diplomatic_stance papal_states poland neutral
				  console_command diplomatic_stance papal_states byzantium neutral
				  console_command diplomatic_stance papal_states timurids neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance spain hre neutral
				  console_command diplomatic_stance spain poland neutral
				  console_command diplomatic_stance spain byzantium neutral
				  console_command diplomatic_stance spain timurids neutral
				  console_command diplomatic_stance spain lucca neutral

				  console_command diplomatic_stance hre poland neutral
				  console_command diplomatic_stance hre byzantium neutral
				  console_command diplomatic_stance hre timurids neutral
				  console_command diplomatic_stance hre lucca neutral

				  console_command diplomatic_stance poland byzantium neutral
				  console_command diplomatic_stance poland timurids neutral
				  console_command diplomatic_stance poland lucca neutral

				  console_command diplomatic_stance byzantium timurids neutral

				  console_command diplomatic_stance lucca byzantium neutral
				  console_command diplomatic_stance lucca timurids neutral

			end_if 

			if I_EventCounter set_peace = 2

				  console_command diplomatic_stance france venice neutral
				  console_command diplomatic_stance france papal_states neutral
				  console_command diplomatic_stance france poland neutral
				  console_command diplomatic_stance france byzantium neutral
				  console_command diplomatic_stance france timurids neutral
				  console_command diplomatic_stance france lucca neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily spain neutral
				  console_command diplomatic_stance sicily hre neutral
				  console_command diplomatic_stance sicily poland neutral
				  console_command diplomatic_stance sicily byzantium neutral
				  console_command diplomatic_stance sicily timurids neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice spain neutral
				  console_command diplomatic_stance venice hre neutral
				  console_command diplomatic_stance venice poland neutral
				  console_command diplomatic_stance venice byzantium neutral
				  console_command diplomatic_stance venice timurids neutral
				  console_command diplomatic_stance venice lucca neutral

				  console_command diplomatic_stance papal_states spain neutral
				  console_command diplomatic_stance papal_states hre neutral
				  console_command diplomatic_stance papal_states poland neutral
				  console_command diplomatic_stance papal_states byzantium neutral
				  console_command diplomatic_stance papal_states timurids neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance spain hre neutral
				  console_command diplomatic_stance spain poland neutral
				  console_command diplomatic_stance spain byzantium neutral
				  console_command diplomatic_stance spain timurids neutral
				  console_command diplomatic_stance spain lucca neutral

				  console_command diplomatic_stance hre poland neutral
				  console_command diplomatic_stance hre byzantium neutral
				  console_command diplomatic_stance hre timurids neutral
				  console_command diplomatic_stance hre lucca neutral

				  console_command diplomatic_stance poland byzantium neutral
				  console_command diplomatic_stance poland timurids neutral
				  console_command diplomatic_stance poland lucca neutral

				  console_command diplomatic_stance byzantium timurids neutral

				  console_command diplomatic_stance lucca byzantium neutral
				  console_command diplomatic_stance lucca timurids neutral

			end_if

			if I_EventCounter set_peace = 3

				  console_command diplomatic_stance france venice neutral
				  console_command diplomatic_stance france papal_states neutral
				  console_command diplomatic_stance france spain neutral
				  console_command diplomatic_stance france hre neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily spain neutral
				  console_command diplomatic_stance sicily hre neutral
				  console_command diplomatic_stance sicily poland neutral
				  console_command diplomatic_stance sicily byzantium neutral
				  console_command diplomatic_stance sicily timurids neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice spain neutral
				  console_command diplomatic_stance venice hre neutral
				  console_command diplomatic_stance venice poland neutral
				  console_command diplomatic_stance venice byzantium neutral
				  console_command diplomatic_stance venice timurids neutral
				  console_command diplomatic_stance venice lucca neutral

				  console_command diplomatic_stance papal_states spain neutral
				  console_command diplomatic_stance papal_states hre neutral
				  console_command diplomatic_stance papal_states poland neutral
				  console_command diplomatic_stance papal_states byzantium neutral
				  console_command diplomatic_stance papal_states timurids neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance spain hre neutral
				  console_command diplomatic_stance spain poland neutral
				  console_command diplomatic_stance spain byzantium neutral
				  console_command diplomatic_stance spain timurids neutral
				  console_command diplomatic_stance spain lucca neutral

				  console_command diplomatic_stance hre poland neutral
				  console_command diplomatic_stance hre byzantium neutral
				  console_command diplomatic_stance hre timurids neutral
				  console_command diplomatic_stance hre lucca neutral

				  console_command diplomatic_stance poland byzantium neutral
				  console_command diplomatic_stance poland timurids neutral
				  console_command diplomatic_stance poland lucca neutral

				  console_command diplomatic_stance byzantium timurids neutral

				  console_command diplomatic_stance lucca byzantium neutral
				  console_command diplomatic_stance lucca timurids neutral

			end_if

			terminate_monitor
		end_if

		if I_CompareCounter liga_v_besteht = 1
			and I_CompareCounter liga_v_nein_spain = 1
			historic_event liga_v_sieg_frankreich factions { france, }
			historic_event liga_v_sieg_mitglieder factions { venice, milan, papal_states, hre, sicily, poland, byzantium, timurids, lucca, }
			historic_event liga_v_sieg_andere factions { saxons, turks, normans, hungary, spain, denmark, england, russia, scotland, egypt, }
			generate_random_counter set_peace 1 3

			if I_EventCounter set_peace = 1

				  console_command diplomatic_stance france milan neutral
				  console_command diplomatic_stance france venice neutral
				  console_command diplomatic_stance france papal_states neutral
				  console_command diplomatic_stance france hre neutral
				  console_command diplomatic_stance france poland neutral
				  console_command diplomatic_stance france byzantium neutral
				  console_command diplomatic_stance france timurids neutral
				  console_command diplomatic_stance france lucca neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily milan neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily hre neutral
				  console_command diplomatic_stance sicily poland neutral
				  console_command diplomatic_stance sicily byzantium neutral
				  console_command diplomatic_stance sicily timurids neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance venice milan neutral
				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice hre neutral
				  console_command diplomatic_stance venice poland neutral
				  console_command diplomatic_stance venice byzantium neutral
				  console_command diplomatic_stance venice timurids neutral
				  console_command diplomatic_stance venice lucca neutral

				  console_command diplomatic_stance milan papal_states neutral
				  console_command diplomatic_stance milan hre neutral
				  console_command diplomatic_stance milan poland neutral
				  console_command diplomatic_stance milan byzantium neutral
				  console_command diplomatic_stance milan timurids neutral
				  console_command diplomatic_stance milan lucca neutral

				  console_command diplomatic_stance papal_states hre neutral
				  console_command diplomatic_stance papal_states poland neutral
				  console_command diplomatic_stance papal_states byzantium neutral
				  console_command diplomatic_stance papal_states timurids neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance hre poland neutral
				  console_command diplomatic_stance hre byzantium neutral
				  console_command diplomatic_stance hre timurids neutral
				  console_command diplomatic_stance hre lucca neutral

				  console_command diplomatic_stance poland byzantium neutral
				  console_command diplomatic_stance poland timurids neutral
				  console_command diplomatic_stance poland lucca neutral

				  console_command diplomatic_stance byzantium timurids neutral

				  console_command diplomatic_stance lucca byzantium neutral
				  console_command diplomatic_stance lucca timurids neutral
			end_if 

			if I_EventCounter set_peace = 2

				  console_command diplomatic_stance france milan neutral
				  console_command diplomatic_stance france poland neutral
				  console_command diplomatic_stance france byzantium neutral
				  console_command diplomatic_stance france timurids neutral
				  console_command diplomatic_stance france lucca neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily milan neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily hre neutral
				  console_command diplomatic_stance sicily poland neutral
				  console_command diplomatic_stance sicily byzantium neutral
				  console_command diplomatic_stance sicily timurids neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance venice milan neutral
				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice hre neutral
				  console_command diplomatic_stance venice poland neutral
				  console_command diplomatic_stance venice byzantium neutral
				  console_command diplomatic_stance venice timurids neutral
				  console_command diplomatic_stance venice lucca neutral

				  console_command diplomatic_stance milan papal_states neutral
				  console_command diplomatic_stance milan hre neutral
				  console_command diplomatic_stance milan poland neutral
				  console_command diplomatic_stance milan byzantium neutral
				  console_command diplomatic_stance milan timurids neutral
				  console_command diplomatic_stance milan lucca neutral

				  console_command diplomatic_stance papal_states hre neutral
				  console_command diplomatic_stance papal_states poland neutral
				  console_command diplomatic_stance papal_states byzantium neutral
				  console_command diplomatic_stance papal_states timurids neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance hre poland neutral
				  console_command diplomatic_stance hre byzantium neutral
				  console_command diplomatic_stance hre timurids neutral
				  console_command diplomatic_stance hre lucca neutral

				  console_command diplomatic_stance poland byzantium neutral
				  console_command diplomatic_stance poland timurids neutral
				  console_command diplomatic_stance poland lucca neutral

				  console_command diplomatic_stance byzantium timurids neutral

				  console_command diplomatic_stance lucca byzantium neutral
				  console_command diplomatic_stance lucca timurids neutral

			end_if

			if I_EventCounter set_peace = 3

				  console_command diplomatic_stance france papal_states neutral
				  console_command diplomatic_stance france hre neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily milan neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily hre neutral
				  console_command diplomatic_stance sicily poland neutral
				  console_command diplomatic_stance sicily byzantium neutral
				  console_command diplomatic_stance sicily timurids neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance venice milan neutral
				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice hre neutral
				  console_command diplomatic_stance venice poland neutral
				  console_command diplomatic_stance venice byzantium neutral
				  console_command diplomatic_stance venice timurids neutral
				  console_command diplomatic_stance venice lucca neutral

				  console_command diplomatic_stance milan papal_states neutral
				  console_command diplomatic_stance milan hre neutral
				  console_command diplomatic_stance milan poland neutral
				  console_command diplomatic_stance milan byzantium neutral
				  console_command diplomatic_stance milan timurids neutral
				  console_command diplomatic_stance milan lucca neutral

				  console_command diplomatic_stance papal_states hre neutral
				  console_command diplomatic_stance papal_states poland neutral
				  console_command diplomatic_stance papal_states byzantium neutral
				  console_command diplomatic_stance papal_states timurids neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance hre poland neutral
				  console_command diplomatic_stance hre byzantium neutral
				  console_command diplomatic_stance hre timurids neutral
				  console_command diplomatic_stance hre lucca neutral

				  console_command diplomatic_stance poland byzantium neutral
				  console_command diplomatic_stance poland timurids neutral
				  console_command diplomatic_stance poland lucca neutral

				  console_command diplomatic_stance byzantium timurids neutral

				  console_command diplomatic_stance lucca byzantium neutral
				  console_command diplomatic_stance lucca timurids neutral

			end_if

			terminate_monitor
		end_if

		if I_CompareCounter liga_v_besteht = 1
			and I_CompareCounter liga_v_nein_hre = 1
			historic_event liga_v_sieg_frankreich factions { france, }
			historic_event liga_v_sieg_mitglieder factions { venice, milan, papal_states, spain, sicily, poland, byzantium, timurids, lucca, }
			historic_event liga_v_sieg_andere factions { saxons, turks, normans, hungary, hre, denmark, england, russia, scotland, egypt, savoy, montferrat, urbino, }
			generate_random_counter set_peace 1 3

			if I_EventCounter set_peace = 1

				  console_command diplomatic_stance france milan neutral
				  console_command diplomatic_stance france venice neutral
				  console_command diplomatic_stance france papal_states neutral
				  console_command diplomatic_stance france spain neutral
				  console_command diplomatic_stance france poland neutral
				  console_command diplomatic_stance france byzantium neutral
				  console_command diplomatic_stance france timurids neutral
				  console_command diplomatic_stance france lucca neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily milan neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily spain neutral
				  console_command diplomatic_stance sicily poland neutral
				  console_command diplomatic_stance sicily byzantium neutral
				  console_command diplomatic_stance sicily timurids neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance venice milan neutral
				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice spain neutral
				  console_command diplomatic_stance venice poland neutral
				  console_command diplomatic_stance venice byzantium neutral
				  console_command diplomatic_stance venice timurids neutral
				  console_command diplomatic_stance venice lucca neutral

				  console_command diplomatic_stance milan papal_states neutral
				  console_command diplomatic_stance milan spain neutral
				  console_command diplomatic_stance milan poland neutral
				  console_command diplomatic_stance milan byzantium neutral
				  console_command diplomatic_stance milan timurids neutral
				  console_command diplomatic_stance milan lucca neutral

				  console_command diplomatic_stance papal_states spain neutral
				  console_command diplomatic_stance papal_states poland neutral
				  console_command diplomatic_stance papal_states byzantium neutral
				  console_command diplomatic_stance papal_states timurids neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance spain poland neutral
				  console_command diplomatic_stance spain byzantium neutral
				  console_command diplomatic_stance spain timurids neutral
				  console_command diplomatic_stance spain lucca neutral

				  console_command diplomatic_stance poland byzantium neutral
				  console_command diplomatic_stance poland timurids neutral
				  console_command diplomatic_stance poland lucca neutral

				  console_command diplomatic_stance byzantium timurids neutral

				  console_command diplomatic_stance lucca byzantium neutral
				  console_command diplomatic_stance lucca timurids neutral

			end_if 

			if I_EventCounter set_peace = 2

				  console_command diplomatic_stance france milan neutral
				  console_command diplomatic_stance france poland neutral
				  console_command diplomatic_stance france byzantium neutral
				  console_command diplomatic_stance france timurids neutral
				  console_command diplomatic_stance france lucca neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily milan neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily spain neutral
				  console_command diplomatic_stance sicily poland neutral
				  console_command diplomatic_stance sicily byzantium neutral
				  console_command diplomatic_stance sicily timurids neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance venice milan neutral
				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice spain neutral
				  console_command diplomatic_stance venice poland neutral
				  console_command diplomatic_stance venice byzantium neutral
				  console_command diplomatic_stance venice timurids neutral
				  console_command diplomatic_stance venice lucca neutral

				  console_command diplomatic_stance milan papal_states neutral
				  console_command diplomatic_stance milan spain neutral
				  console_command diplomatic_stance milan poland neutral
				  console_command diplomatic_stance milan byzantium neutral
				  console_command diplomatic_stance milan timurids neutral
				  console_command diplomatic_stance milan lucca neutral

				  console_command diplomatic_stance papal_states spain neutral
				  console_command diplomatic_stance papal_states poland neutral
				  console_command diplomatic_stance papal_states byzantium neutral
				  console_command diplomatic_stance papal_states timurids neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance spain poland neutral
				  console_command diplomatic_stance spain byzantium neutral
				  console_command diplomatic_stance spain timurids neutral
				  console_command diplomatic_stance spain lucca neutral

				  console_command diplomatic_stance poland byzantium neutral
				  console_command diplomatic_stance poland timurids neutral
				  console_command diplomatic_stance poland lucca neutral

				  console_command diplomatic_stance byzantium timurids neutral

				  console_command diplomatic_stance lucca byzantium neutral
				  console_command diplomatic_stance lucca timurids neutral

			end_if

			if I_EventCounter set_peace = 3

				  console_command diplomatic_stance france venice neutral
				  console_command diplomatic_stance france papal_states neutral
				  console_command diplomatic_stance france spain neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily milan neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily spain neutral
				  console_command diplomatic_stance sicily poland neutral
				  console_command diplomatic_stance sicily byzantium neutral
				  console_command diplomatic_stance sicily timurids neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance venice milan neutral
				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice spain neutral
				  console_command diplomatic_stance venice poland neutral
				  console_command diplomatic_stance venice byzantium neutral
				  console_command diplomatic_stance venice timurids neutral
				  console_command diplomatic_stance venice lucca neutral

				  console_command diplomatic_stance milan papal_states neutral
				  console_command diplomatic_stance milan spain neutral
				  console_command diplomatic_stance milan poland neutral
				  console_command diplomatic_stance milan byzantium neutral
				  console_command diplomatic_stance milan timurids neutral
				  console_command diplomatic_stance milan lucca neutral

				  console_command diplomatic_stance papal_states spain neutral
				  console_command diplomatic_stance papal_states poland neutral
				  console_command diplomatic_stance papal_states byzantium neutral
				  console_command diplomatic_stance papal_states timurids neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance spain poland neutral
				  console_command diplomatic_stance spain byzantium neutral
				  console_command diplomatic_stance spain timurids neutral
				  console_command diplomatic_stance spain lucca neutral

				  console_command diplomatic_stance poland byzantium neutral
				  console_command diplomatic_stance poland timurids neutral
				  console_command diplomatic_stance poland lucca neutral

				  console_command diplomatic_stance byzantium timurids neutral

				  console_command diplomatic_stance lucca byzantium neutral
				  console_command diplomatic_stance lucca timurids neutral

			end_if

			terminate_monitor
		end_if

		if I_CompareCounter liga_v_besteht = 1
			and I_CompareCounter liga_v_nein_florenz = 1
			historic_event liga_v_sieg_frankreich factions { france, }
			historic_event liga_v_sieg_mitglieder factions { venice, milan, papal_states, spain, hre, sicily, byzantium, timurids, lucca, }
			historic_event liga_v_sieg_andere factions { saxons, turks, normans, hungary, poland, denmark, england, russia, scotland, egypt, savoy, montferrat, urbino, }
			generate_random_counter set_peace 1 3

			if I_EventCounter set_peace = 1

				  console_command diplomatic_stance france milan neutral
				  console_command diplomatic_stance france venice neutral
				  console_command diplomatic_stance france papal_states neutral
				  console_command diplomatic_stance france spain neutral
				  console_command diplomatic_stance france hre neutral
				  console_command diplomatic_stance france byzantium neutral
				  console_command diplomatic_stance france timurids neutral
				  console_command diplomatic_stance france lucca neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily milan neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily spain neutral
				  console_command diplomatic_stance sicily hre neutral
				  console_command diplomatic_stance sicily byzantium neutral
				  console_command diplomatic_stance sicily timurids neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance venice milan neutral
				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice spain neutral
				  console_command diplomatic_stance venice hre neutral
				  console_command diplomatic_stance venice byzantium neutral
				  console_command diplomatic_stance venice timurids neutral
				  console_command diplomatic_stance venice lucca neutral

				  console_command diplomatic_stance milan papal_states neutral
				  console_command diplomatic_stance milan spain neutral
				  console_command diplomatic_stance milan hre neutral
				  console_command diplomatic_stance milan byzantium neutral
				  console_command diplomatic_stance milan timurids neutral
				  console_command diplomatic_stance milan lucca neutral

				  console_command diplomatic_stance papal_states spain neutral
				  console_command diplomatic_stance papal_states hre neutral
				  console_command diplomatic_stance papal_states byzantium neutral
				  console_command diplomatic_stance papal_states timurids neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance spain hre neutral
				  console_command diplomatic_stance spain byzantium neutral
				  console_command diplomatic_stance spain timurids neutral
				  console_command diplomatic_stance spain lucca neutral

				  console_command diplomatic_stance hre byzantium neutral
				  console_command diplomatic_stance hre timurids neutral
				  console_command diplomatic_stance hre lucca neutral

				  console_command diplomatic_stance byzantium timurids neutral

				  console_command diplomatic_stance lucca byzantium neutral
				  console_command diplomatic_stance lucca timurids neutral

			end_if 

			if I_EventCounter set_peace = 2

				  console_command diplomatic_stance france milan neutral
				  console_command diplomatic_stance france byzantium neutral
				  console_command diplomatic_stance france timurids neutral
				  console_command diplomatic_stance france lucca neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily milan neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily spain neutral
				  console_command diplomatic_stance sicily hre neutral
				  console_command diplomatic_stance sicily byzantium neutral
				  console_command diplomatic_stance sicily timurids neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance venice milan neutral
				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice spain neutral
				  console_command diplomatic_stance venice hre neutral
				  console_command diplomatic_stance venice byzantium neutral
				  console_command diplomatic_stance venice timurids neutral
				  console_command diplomatic_stance venice lucca neutral

				  console_command diplomatic_stance milan papal_states neutral
				  console_command diplomatic_stance milan spain neutral
				  console_command diplomatic_stance milan hre neutral
				  console_command diplomatic_stance milan byzantium neutral
				  console_command diplomatic_stance milan timurids neutral
				  console_command diplomatic_stance milan lucca neutral

				  console_command diplomatic_stance papal_states spain neutral
				  console_command diplomatic_stance papal_states hre neutral
				  console_command diplomatic_stance papal_states byzantium neutral
				  console_command diplomatic_stance papal_states timurids neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance spain hre neutral
				  console_command diplomatic_stance spain byzantium neutral
				  console_command diplomatic_stance spain timurids neutral
				  console_command diplomatic_stance spain lucca neutral

				  console_command diplomatic_stance hre byzantium neutral
				  console_command diplomatic_stance hre timurids neutral
				  console_command diplomatic_stance hre lucca neutral

				  console_command diplomatic_stance byzantium timurids neutral

				  console_command diplomatic_stance lucca byzantium neutral
				  console_command diplomatic_stance lucca timurids neutral

			end_if

			if I_EventCounter set_peace = 3

				  console_command diplomatic_stance france venice neutral
				  console_command diplomatic_stance france papal_states neutral
				  console_command diplomatic_stance france spain neutral
				  console_command diplomatic_stance france hre neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily milan neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily spain neutral
				  console_command diplomatic_stance sicily hre neutral
				  console_command diplomatic_stance sicily byzantium neutral
				  console_command diplomatic_stance sicily timurids neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance venice milan neutral
				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice spain neutral
				  console_command diplomatic_stance venice hre neutral
				  console_command diplomatic_stance venice byzantium neutral
				  console_command diplomatic_stance venice timurids neutral
				  console_command diplomatic_stance venice lucca neutral

				  console_command diplomatic_stance milan papal_states neutral
				  console_command diplomatic_stance milan spain neutral
				  console_command diplomatic_stance milan hre neutral
				  console_command diplomatic_stance milan byzantium neutral
				  console_command diplomatic_stance milan timurids neutral
				  console_command diplomatic_stance milan lucca neutral

				  console_command diplomatic_stance papal_states spain neutral
				  console_command diplomatic_stance papal_states hre neutral
				  console_command diplomatic_stance papal_states byzantium neutral
				  console_command diplomatic_stance papal_states timurids neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance spain hre neutral
				  console_command diplomatic_stance spain byzantium neutral
				  console_command diplomatic_stance spain timurids neutral
				  console_command diplomatic_stance spain lucca neutral

				  console_command diplomatic_stance hre byzantium neutral
				  console_command diplomatic_stance hre timurids neutral
				  console_command diplomatic_stance hre lucca neutral

				  console_command diplomatic_stance byzantium timurids neutral

				  console_command diplomatic_stance lucca byzantium neutral
				  console_command diplomatic_stance lucca timurids neutral

			end_if

			terminate_monitor
		end_if

		if I_CompareCounter liga_v_besteht = 1
			and I_CompareCounter liga_v_nein_mantua = 1
			historic_event liga_v_sieg_frankreich factions { france, }
			historic_event liga_v_sieg_mitglieder factions { venice, milan, papal_states, spain, hre, sicily, poland, timurids, lucca, }
			historic_event liga_v_sieg_andere factions { saxons, turks, normans, hungary, denmark, byzantium, england, russia, scotland, egypt, savoy, montferrat, urbino, }
			generate_random_counter set_peace 1 3

			if I_EventCounter set_peace = 1

				  console_command diplomatic_stance france milan neutral
				  console_command diplomatic_stance france venice neutral
				  console_command diplomatic_stance france papal_states neutral
				  console_command diplomatic_stance france spain neutral
				  console_command diplomatic_stance france hre neutral
				  console_command diplomatic_stance france poland neutral
				  console_command diplomatic_stance france timurids neutral
				  console_command diplomatic_stance france lucca neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily milan neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily spain neutral
				  console_command diplomatic_stance sicily hre neutral
				  console_command diplomatic_stance sicily poland neutral
				  console_command diplomatic_stance sicily timurids neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance venice milan neutral
				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice spain neutral
				  console_command diplomatic_stance venice hre neutral
				  console_command diplomatic_stance venice poland neutral
				  console_command diplomatic_stance venice timurids neutral
				  console_command diplomatic_stance venice lucca neutral

				  console_command diplomatic_stance milan papal_states neutral
				  console_command diplomatic_stance milan spain neutral
				  console_command diplomatic_stance milan hre neutral
				  console_command diplomatic_stance milan poland neutral
				  console_command diplomatic_stance milan timurids neutral
				  console_command diplomatic_stance milan lucca neutral

				  console_command diplomatic_stance papal_states spain neutral
				  console_command diplomatic_stance papal_states hre neutral
				  console_command diplomatic_stance papal_states poland neutral
				  console_command diplomatic_stance papal_states timurids neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance spain hre neutral
				  console_command diplomatic_stance spain poland neutral
				  console_command diplomatic_stance spain timurids neutral
				  console_command diplomatic_stance spain lucca neutral

				  console_command diplomatic_stance hre poland neutral
				  console_command diplomatic_stance hre timurids neutral
				  console_command diplomatic_stance hre lucca neutral

				  console_command diplomatic_stance poland timurids neutral
				  console_command diplomatic_stance poland lucca neutral

				  console_command diplomatic_stance lucca timurids neutral

			end_if 

			if I_EventCounter set_peace = 2

				  console_command diplomatic_stance france milan neutral
				  console_command diplomatic_stance france poland neutral
				  console_command diplomatic_stance france timurids neutral
				  console_command diplomatic_stance france lucca neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily milan neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily spain neutral
				  console_command diplomatic_stance sicily hre neutral
				  console_command diplomatic_stance sicily poland neutral
				  console_command diplomatic_stance sicily timurids neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance venice milan neutral
				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice spain neutral
				  console_command diplomatic_stance venice hre neutral
				  console_command diplomatic_stance venice poland neutral
				  console_command diplomatic_stance venice timurids neutral
				  console_command diplomatic_stance venice lucca neutral

				  console_command diplomatic_stance milan papal_states neutral
				  console_command diplomatic_stance milan spain neutral
				  console_command diplomatic_stance milan hre neutral
				  console_command diplomatic_stance milan poland neutral
				  console_command diplomatic_stance milan timurids neutral
				  console_command diplomatic_stance milan lucca neutral

				  console_command diplomatic_stance papal_states spain neutral
				  console_command diplomatic_stance papal_states hre neutral
				  console_command diplomatic_stance papal_states poland neutral
				  console_command diplomatic_stance papal_states timurids neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance spain hre neutral
				  console_command diplomatic_stance spain poland neutral
				  console_command diplomatic_stance spain timurids neutral
				  console_command diplomatic_stance spain lucca neutral

				  console_command diplomatic_stance hre poland neutral
				  console_command diplomatic_stance hre timurids neutral
				  console_command diplomatic_stance hre lucca neutral

				  console_command diplomatic_stance poland timurids neutral
				  console_command diplomatic_stance poland lucca neutral

				  console_command diplomatic_stance lucca timurids neutral

			end_if

			if I_EventCounter set_peace = 3

				  console_command diplomatic_stance france venice neutral
				  console_command diplomatic_stance france papal_states neutral
				  console_command diplomatic_stance france spain neutral
				  console_command diplomatic_stance france hre neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily milan neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily spain neutral
				  console_command diplomatic_stance sicily hre neutral
				  console_command diplomatic_stance sicily poland neutral
				  console_command diplomatic_stance sicily timurids neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance venice milan neutral
				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice spain neutral
				  console_command diplomatic_stance venice hre neutral
				  console_command diplomatic_stance venice poland neutral
				  console_command diplomatic_stance venice timurids neutral
				  console_command diplomatic_stance venice lucca neutral

				  console_command diplomatic_stance milan papal_states neutral
				  console_command diplomatic_stance milan spain neutral
				  console_command diplomatic_stance milan hre neutral
				  console_command diplomatic_stance milan poland neutral
				  console_command diplomatic_stance milan timurids neutral
				  console_command diplomatic_stance milan lucca neutral

				  console_command diplomatic_stance papal_states spain neutral
				  console_command diplomatic_stance papal_states hre neutral
				  console_command diplomatic_stance papal_states poland neutral
				  console_command diplomatic_stance papal_states timurids neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance spain hre neutral
				  console_command diplomatic_stance spain poland neutral
				  console_command diplomatic_stance spain timurids neutral
				  console_command diplomatic_stance spain lucca neutral

				  console_command diplomatic_stance hre poland neutral
				  console_command diplomatic_stance hre timurids neutral
				  console_command diplomatic_stance hre lucca neutral

				  console_command diplomatic_stance poland timurids neutral
				  console_command diplomatic_stance poland lucca neutral

				  console_command diplomatic_stance lucca timurids neutral

			end_if

			terminate_monitor
		end_if


		if I_CompareCounter liga_v_besteht = 1
			and I_CompareCounter liga_v_nein_bologna = 1
			historic_event liga_v_sieg_frankreich factions { france, }
			historic_event liga_v_sieg_mitglieder factions { venice, milan, papal_states, spain, hre, sicily, poland, byzantium, lucca, }
			historic_event liga_v_sieg_andere factions { saxons, turks, normans, hungary, denmark, timurids, england, russia, scotland, egypt, savoy, montferrat, urbino, }
			generate_random_counter set_peace 1 3

			if I_EventCounter set_peace = 1

				  console_command diplomatic_stance france milan neutral
				  console_command diplomatic_stance france venice neutral
				  console_command diplomatic_stance france papal_states neutral
				  console_command diplomatic_stance france spain neutral
				  console_command diplomatic_stance france hre neutral
				  console_command diplomatic_stance france poland neutral
				  console_command diplomatic_stance france byzantium neutral
				  console_command diplomatic_stance france lucca neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily milan neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily spain neutral
				  console_command diplomatic_stance sicily hre neutral
				  console_command diplomatic_stance sicily poland neutral
				  console_command diplomatic_stance sicily byzantium neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance venice milan neutral
				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice spain neutral
				  console_command diplomatic_stance venice hre neutral
				  console_command diplomatic_stance venice poland neutral
				  console_command diplomatic_stance venice byzantium neutral
				  console_command diplomatic_stance venice lucca neutral

				  console_command diplomatic_stance milan papal_states neutral
				  console_command diplomatic_stance milan spain neutral
				  console_command diplomatic_stance milan hre neutral
				  console_command diplomatic_stance milan poland neutral
				  console_command diplomatic_stance milan byzantium neutral
				  console_command diplomatic_stance milan lucca neutral

				  console_command diplomatic_stance papal_states spain neutral
				  console_command diplomatic_stance papal_states hre neutral
				  console_command diplomatic_stance papal_states poland neutral
				  console_command diplomatic_stance papal_states byzantium neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance spain hre neutral
				  console_command diplomatic_stance spain poland neutral
				  console_command diplomatic_stance spain byzantium neutral
				  console_command diplomatic_stance spain lucca neutral

				  console_command diplomatic_stance hre poland neutral
				  console_command diplomatic_stance hre byzantium neutral
				  console_command diplomatic_stance hre lucca neutral

				  console_command diplomatic_stance poland byzantium neutral
				  console_command diplomatic_stance poland lucca neutral

				  console_command diplomatic_stance lucca byzantium neutral

			end_if 

			if I_EventCounter set_peace = 2

				  console_command diplomatic_stance france milan neutral
				  console_command diplomatic_stance france poland neutral
				  console_command diplomatic_stance france byzantium neutral
				  console_command diplomatic_stance france lucca neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily milan neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily spain neutral
				  console_command diplomatic_stance sicily hre neutral
				  console_command diplomatic_stance sicily poland neutral
				  console_command diplomatic_stance sicily byzantium neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance venice milan neutral
				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice spain neutral
				  console_command diplomatic_stance venice hre neutral
				  console_command diplomatic_stance venice poland neutral
				  console_command diplomatic_stance venice byzantium neutral
				  console_command diplomatic_stance venice lucca neutral

				  console_command diplomatic_stance milan papal_states neutral
				  console_command diplomatic_stance milan spain neutral
				  console_command diplomatic_stance milan hre neutral
				  console_command diplomatic_stance milan poland neutral
				  console_command diplomatic_stance milan byzantium neutral
				  console_command diplomatic_stance milan lucca neutral

				  console_command diplomatic_stance papal_states spain neutral
				  console_command diplomatic_stance papal_states hre neutral
				  console_command diplomatic_stance papal_states poland neutral
				  console_command diplomatic_stance papal_states byzantium neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance spain hre neutral
				  console_command diplomatic_stance spain poland neutral
				  console_command diplomatic_stance spain byzantium neutral
				  console_command diplomatic_stance spain lucca neutral

				  console_command diplomatic_stance hre poland neutral
				  console_command diplomatic_stance hre byzantium neutral
				  console_command diplomatic_stance hre lucca neutral

				  console_command diplomatic_stance poland byzantium neutral
				  console_command diplomatic_stance poland lucca neutral

				  console_command diplomatic_stance lucca byzantium neutral

			end_if

			if I_EventCounter set_peace = 3

				  console_command diplomatic_stance france venice neutral
				  console_command diplomatic_stance france papal_states neutral
				  console_command diplomatic_stance france spain neutral
				  console_command diplomatic_stance france hre neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily milan neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily spain neutral
				  console_command diplomatic_stance sicily hre neutral
				  console_command diplomatic_stance sicily poland neutral
				  console_command diplomatic_stance sicily byzantium neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance venice milan neutral
				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice spain neutral
				  console_command diplomatic_stance venice hre neutral
				  console_command diplomatic_stance venice poland neutral
				  console_command diplomatic_stance venice byzantium neutral
				  console_command diplomatic_stance venice lucca neutral

				  console_command diplomatic_stance milan papal_states neutral
				  console_command diplomatic_stance milan spain neutral
				  console_command diplomatic_stance milan hre neutral
				  console_command diplomatic_stance milan poland neutral
				  console_command diplomatic_stance milan byzantium neutral
				  console_command diplomatic_stance milan lucca neutral

				  console_command diplomatic_stance papal_states spain neutral
				  console_command diplomatic_stance papal_states hre neutral
				  console_command diplomatic_stance papal_states poland neutral
				  console_command diplomatic_stance papal_states byzantium neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance spain hre neutral
				  console_command diplomatic_stance spain poland neutral
				  console_command diplomatic_stance spain byzantium neutral
				  console_command diplomatic_stance spain lucca neutral

				  console_command diplomatic_stance hre poland neutral
				  console_command diplomatic_stance hre byzantium neutral
				  console_command diplomatic_stance hre lucca neutral

				  console_command diplomatic_stance poland byzantium neutral
				  console_command diplomatic_stance poland lucca neutral

				  console_command diplomatic_stance lucca byzantium neutral

			end_if

			terminate_monitor
		end_if

		if I_CompareCounter liga_v_besteht = 1
			and I_CompareCounter liga_v_nein_lucca = 1
			historic_event liga_v_sieg_frankreich factions { france, }
			historic_event liga_v_sieg_mitglieder factions { venice, milan, papal_states, spain, hre, sicily, poland, byzantium, timurids, }
			historic_event liga_v_sieg_andere factions { saxons, turks, normans, hungary, denmark, england, russia, scotland, egypt, savoy, montferrat, urbino, lucca, }

			generate_random_counter set_peace 1 3

			if I_EventCounter set_peace = 1

				console_command diplomatic_stance france milan neutral
				console_command diplomatic_stance france venice neutral
				console_command diplomatic_stance france papal_states neutral
				console_command diplomatic_stance france spain neutral
				console_command diplomatic_stance france hre neutral
				console_command diplomatic_stance france poland neutral
				console_command diplomatic_stance france byzantium neutral
				console_command diplomatic_stance france timurids neutral

				console_command diplomatic_stance sicily venice neutral
				console_command diplomatic_stance sicily milan neutral
				console_command diplomatic_stance sicily papal_states neutral
				console_command diplomatic_stance sicily spain neutral
				console_command diplomatic_stance sicily hre neutral
				console_command diplomatic_stance sicily poland neutral
				console_command diplomatic_stance sicily byzantium neutral
				console_command diplomatic_stance sicily timurids neutral

				console_command diplomatic_stance venice milan neutral
				console_command diplomatic_stance venice papal_states neutral
				console_command diplomatic_stance venice spain neutral
				console_command diplomatic_stance venice hre neutral
				console_command diplomatic_stance venice poland neutral
				console_command diplomatic_stance venice byzantium neutral
				console_command diplomatic_stance venice timurids neutral

				console_command diplomatic_stance milan papal_states neutral
				console_command diplomatic_stance milan spain neutral
				console_command diplomatic_stance milan hre neutral
				console_command diplomatic_stance milan poland neutral
				console_command diplomatic_stance milan byzantium neutral
				console_command diplomatic_stance milan timurids neutral

				console_command diplomatic_stance papal_states spain neutral
				console_command diplomatic_stance papal_states hre neutral
				console_command diplomatic_stance papal_states poland neutral
				console_command diplomatic_stance papal_states byzantium neutral
				console_command diplomatic_stance papal_states timurids neutral

				console_command diplomatic_stance spain hre neutral
				console_command diplomatic_stance spain poland neutral
				console_command diplomatic_stance spain byzantium neutral
				console_command diplomatic_stance spain timurids neutral

				console_command diplomatic_stance hre poland neutral
				console_command diplomatic_stance hre byzantium neutral
				console_command diplomatic_stance hre timurids neutral

				console_command diplomatic_stance poland byzantium neutral
				console_command diplomatic_stance poland timurids neutral

				console_command diplomatic_stance byzantium timurids neutral

			end_if 

			if I_EventCounter set_peace = 2


				console_command diplomatic_stance france milan neutral
				console_command diplomatic_stance france papal_states neutral
				console_command diplomatic_stance france spain neutral
				console_command diplomatic_stance france poland neutral
				console_command diplomatic_stance france byzantium neutral
				console_command diplomatic_stance france timurids neutral

				console_command diplomatic_stance sicily venice neutral
				console_command diplomatic_stance sicily milan neutral
				console_command diplomatic_stance sicily papal_states neutral
				console_command diplomatic_stance sicily spain neutral
				console_command diplomatic_stance sicily hre neutral
				console_command diplomatic_stance sicily poland neutral
				console_command diplomatic_stance sicily byzantium neutral
				console_command diplomatic_stance sicily timurids neutral

				console_command diplomatic_stance venice milan neutral
				console_command diplomatic_stance venice papal_states neutral
				console_command diplomatic_stance venice spain neutral
				console_command diplomatic_stance venice hre neutral
				console_command diplomatic_stance venice poland neutral
				console_command diplomatic_stance venice byzantium neutral
				console_command diplomatic_stance venice timurids neutral

				console_command diplomatic_stance milan papal_states neutral
				console_command diplomatic_stance milan spain neutral
				console_command diplomatic_stance milan hre neutral
				console_command diplomatic_stance milan poland neutral
				console_command diplomatic_stance milan byzantium neutral
				console_command diplomatic_stance milan timurids neutral

				console_command diplomatic_stance papal_states spain neutral
				console_command diplomatic_stance papal_states hre neutral
				console_command diplomatic_stance papal_states poland neutral
				console_command diplomatic_stance papal_states byzantium neutral
				console_command diplomatic_stance papal_states timurids neutral

				console_command diplomatic_stance spain hre neutral
				console_command diplomatic_stance spain poland neutral
				console_command diplomatic_stance spain byzantium neutral
				console_command diplomatic_stance spain timurids neutral

				console_command diplomatic_stance hre poland neutral
				console_command diplomatic_stance hre byzantium neutral
				console_command diplomatic_stance hre timurids neutral

				console_command diplomatic_stance poland byzantium neutral
				console_command diplomatic_stance poland timurids neutral

				console_command diplomatic_stance byzantium timurids neutral

			end_if

			if I_EventCounter set_peace = 3

				console_command diplomatic_stance france papal_states neutral
				console_command diplomatic_stance france spain neutral
				console_command diplomatic_stance france hre neutral

				console_command diplomatic_stance sicily venice neutral
				console_command diplomatic_stance sicily milan neutral
				console_command diplomatic_stance sicily papal_states neutral
				console_command diplomatic_stance sicily spain neutral
				console_command diplomatic_stance sicily hre neutral
				console_command diplomatic_stance sicily poland neutral
				console_command diplomatic_stance sicily byzantium neutral
				console_command diplomatic_stance sicily timurids neutral

				console_command diplomatic_stance venice milan neutral
				console_command diplomatic_stance venice papal_states neutral
				console_command diplomatic_stance venice spain neutral
				console_command diplomatic_stance venice hre neutral
				console_command diplomatic_stance venice poland neutral
				console_command diplomatic_stance venice byzantium neutral
				console_command diplomatic_stance venice timurids neutral

				console_command diplomatic_stance milan papal_states neutral
				console_command diplomatic_stance milan spain neutral
				console_command diplomatic_stance milan hre neutral
				console_command diplomatic_stance milan poland neutral
				console_command diplomatic_stance milan byzantium neutral
				console_command diplomatic_stance milan timurids neutral

				console_command diplomatic_stance papal_states spain neutral
				console_command diplomatic_stance papal_states hre neutral
				console_command diplomatic_stance papal_states poland neutral
				console_command diplomatic_stance papal_states byzantium neutral
				console_command diplomatic_stance papal_states timurids neutral

				console_command diplomatic_stance spain hre neutral
				console_command diplomatic_stance spain poland neutral
				console_command diplomatic_stance spain byzantium neutral
				console_command diplomatic_stance spain timurids neutral

				console_command diplomatic_stance hre poland neutral
				console_command diplomatic_stance hre byzantium neutral
				console_command diplomatic_stance hre timurids neutral

				console_command diplomatic_stance poland byzantium neutral
				console_command diplomatic_stance poland timurids neutral

				console_command diplomatic_stance byzantium timurids neutral

			end_if

			terminate_monitor
		end_if

	end_monitor


	;------------------------------------------------------------------------------
	;---- Rückeroberung gescheitert

	monitor_event FactionTurnStart I_TurnNumber = 27
		and I_SettlementOwner Neapel = france

		historic_event venice_league_disband

		hide_all_revealed_tiles


		if I_CompareCounter liga_v_besteht = 1

				  console_command diplomatic_stance france milan neutral
				  console_command diplomatic_stance france venice neutral
				  console_command diplomatic_stance france papal_states neutral
				  console_command diplomatic_stance france spain neutral
				  console_command diplomatic_stance france hre neutral
				  console_command diplomatic_stance france poland neutral
				  console_command diplomatic_stance france byzantium neutral
				  console_command diplomatic_stance france timurids neutral
				  console_command diplomatic_stance france lucca neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily milan neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily spain neutral
				  console_command diplomatic_stance sicily hre neutral
				  console_command diplomatic_stance sicily poland neutral
				  console_command diplomatic_stance sicily byzantium neutral
				  console_command diplomatic_stance sicily timurids neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance venice milan neutral
				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice spain neutral
				  console_command diplomatic_stance venice hre neutral
				  console_command diplomatic_stance venice poland neutral
				  console_command diplomatic_stance venice byzantium neutral
				  console_command diplomatic_stance venice timurids neutral
				  console_command diplomatic_stance venice lucca neutral

				  console_command diplomatic_stance milan papal_states neutral
				  console_command diplomatic_stance milan spain neutral
				  console_command diplomatic_stance milan hre neutral
				  console_command diplomatic_stance milan poland neutral
				  console_command diplomatic_stance milan byzantium neutral
				  console_command diplomatic_stance milan timurids neutral
				  console_command diplomatic_stance milan lucca neutral

				  console_command diplomatic_stance papal_states spain neutral
				  console_command diplomatic_stance papal_states hre neutral
				  console_command diplomatic_stance papal_states poland neutral
				  console_command diplomatic_stance papal_states byzantium neutral
				  console_command diplomatic_stance papal_states timurids neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance spain hre neutral
				  console_command diplomatic_stance spain poland neutral
				  console_command diplomatic_stance spain byzantium neutral
				  console_command diplomatic_stance spain timurids neutral
				  console_command diplomatic_stance spain lucca neutral

				  console_command diplomatic_stance hre poland neutral
				  console_command diplomatic_stance hre byzantium neutral
				  console_command diplomatic_stance hre timurids neutral
				  console_command diplomatic_stance hre lucca neutral

				  console_command diplomatic_stance poland byzantium neutral
				  console_command diplomatic_stance poland timurids neutral
				  console_command diplomatic_stance poland lucca neutral

				  console_command diplomatic_stance timurids byzantium neutral
				  
				  console_command diplomatic_stance lucca timurids neutral
				  console_command diplomatic_stance lucca byzantium neutral

			terminate_monitor
		end_if

		if I_CompareCounter liga_v_besteht = 1
			and I_CompareCounter liga_v_nein_venice = 1


				  console_command diplomatic_stance france milan neutral
				  console_command diplomatic_stance france papal_states neutral
				  console_command diplomatic_stance france spain neutral
				  console_command diplomatic_stance france hre neutral
				  console_command diplomatic_stance france poland neutral
				  console_command diplomatic_stance france byzantium neutral
				  console_command diplomatic_stance france timurids neutral
				  console_command diplomatic_stance france lucca neutral

				  console_command diplomatic_stance sicily milan neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily spain neutral
				  console_command diplomatic_stance sicily hre neutral
				  console_command diplomatic_stance sicily poland neutral
				  console_command diplomatic_stance sicily byzantium neutral
				  console_command diplomatic_stance sicily timurids neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance milan papal_states neutral
				  console_command diplomatic_stance milan spain neutral
				  console_command diplomatic_stance milan hre neutral
				  console_command diplomatic_stance milan poland neutral
				  console_command diplomatic_stance milan byzantium neutral
				  console_command diplomatic_stance milan timurids neutral
				  console_command diplomatic_stance milan lucca neutral

				  console_command diplomatic_stance papal_states spain neutral
				  console_command diplomatic_stance papal_states hre neutral
				  console_command diplomatic_stance papal_states poland neutral
				  console_command diplomatic_stance papal_states byzantium neutral
				  console_command diplomatic_stance papal_states timurids neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance spain hre neutral
				  console_command diplomatic_stance spain poland neutral
				  console_command diplomatic_stance spain byzantium neutral
				  console_command diplomatic_stance spain timurids neutral
				  console_command diplomatic_stance spain lucca neutral

				  console_command diplomatic_stance hre poland neutral
				  console_command diplomatic_stance hre byzantium neutral
				  console_command diplomatic_stance hre timurids neutral
				  console_command diplomatic_stance hre lucca neutral

				  console_command diplomatic_stance poland byzantium neutral
				  console_command diplomatic_stance poland timurids neutral
				  console_command diplomatic_stance poland lucca neutral

				  console_command diplomatic_stance byzantium timurids neutral

				  console_command diplomatic_stance lucca byzantium neutral
				  console_command diplomatic_stance lucca timurids neutral

			terminate_monitor
		end_if

		if I_CompareCounter liga_v_besteht = 1
			and I_CompareCounter liga_v_nein_milan = 1

				  console_command diplomatic_stance france venice neutral
				  console_command diplomatic_stance france papal_states neutral
				  console_command diplomatic_stance france spain neutral
				  console_command diplomatic_stance france hre neutral
				  console_command diplomatic_stance france poland neutral
				  console_command diplomatic_stance france byzantium neutral
				  console_command diplomatic_stance france timurids neutral
				  console_command diplomatic_stance france lucca neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily spain neutral
				  console_command diplomatic_stance sicily hre neutral
				  console_command diplomatic_stance sicily poland neutral
				  console_command diplomatic_stance sicily byzantium neutral
				  console_command diplomatic_stance sicily timurids neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice spain neutral
				  console_command diplomatic_stance venice hre neutral
				  console_command diplomatic_stance venice poland neutral
				  console_command diplomatic_stance venice byzantium neutral
				  console_command diplomatic_stance venice timurids neutral
				  console_command diplomatic_stance venice lucca neutral

				  console_command diplomatic_stance papal_states spain neutral
				  console_command diplomatic_stance papal_states hre neutral
				  console_command diplomatic_stance papal_states poland neutral
				  console_command diplomatic_stance papal_states byzantium neutral
				  console_command diplomatic_stance papal_states timurids neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance spain hre neutral
				  console_command diplomatic_stance spain poland neutral
				  console_command diplomatic_stance spain byzantium neutral
				  console_command diplomatic_stance spain timurids neutral
				  console_command diplomatic_stance spain lucca neutral

				  console_command diplomatic_stance hre poland neutral
				  console_command diplomatic_stance hre byzantium neutral
				  console_command diplomatic_stance hre timurids neutral
				  console_command diplomatic_stance hre lucca neutral

				  console_command diplomatic_stance poland byzantium neutral
				  console_command diplomatic_stance poland timurids neutral
				  console_command diplomatic_stance poland lucca neutral

				  console_command diplomatic_stance byzantium timurids neutral

				  console_command diplomatic_stance lucca byzantium neutral
				  console_command diplomatic_stance lucca timurids neutral

			terminate_monitor
		end_if

		if I_CompareCounter liga_v_besteht = 1
			and I_CompareCounter liga_v_nein_spain = 1

				  console_command diplomatic_stance france milan neutral
				  console_command diplomatic_stance france venice neutral
				  console_command diplomatic_stance france papal_states neutral
				  console_command diplomatic_stance france hre neutral
				  console_command diplomatic_stance france poland neutral
				  console_command diplomatic_stance france byzantium neutral
				  console_command diplomatic_stance france timurids neutral
				  console_command diplomatic_stance france lucca neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily milan neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily hre neutral
				  console_command diplomatic_stance sicily poland neutral
				  console_command diplomatic_stance sicily byzantium neutral
				  console_command diplomatic_stance sicily timurids neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance venice milan neutral
				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice hre neutral
				  console_command diplomatic_stance venice poland neutral
				  console_command diplomatic_stance venice byzantium neutral
				  console_command diplomatic_stance venice timurids neutral
				  console_command diplomatic_stance venice lucca neutral

				  console_command diplomatic_stance milan papal_states neutral
				  console_command diplomatic_stance milan hre neutral
				  console_command diplomatic_stance milan poland neutral
				  console_command diplomatic_stance milan byzantium neutral
				  console_command diplomatic_stance milan timurids neutral
				  console_command diplomatic_stance milan lucca neutral

				  console_command diplomatic_stance papal_states hre neutral
				  console_command diplomatic_stance papal_states poland neutral
				  console_command diplomatic_stance papal_states byzantium neutral
				  console_command diplomatic_stance papal_states timurids neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance hre poland neutral
				  console_command diplomatic_stance hre byzantium neutral
				  console_command diplomatic_stance hre timurids neutral
				  console_command diplomatic_stance hre lucca neutral

				  console_command diplomatic_stance poland byzantium neutral
				  console_command diplomatic_stance poland timurids neutral
				  console_command diplomatic_stance poland lucca neutral

				  console_command diplomatic_stance timurids byzantium neutral

				  console_command diplomatic_stance lucca byzantium neutral
				  console_command diplomatic_stance lucca timurids neutral

			terminate_monitor
		end_if

		if I_CompareCounter liga_v_besteht = 1
			and I_CompareCounter liga_v_nein_hre = 1

				  console_command diplomatic_stance france milan neutral
				  console_command diplomatic_stance france venice neutral
				  console_command diplomatic_stance france papal_states neutral
				  console_command diplomatic_stance france spain neutral
				  console_command diplomatic_stance france poland neutral
				  console_command diplomatic_stance france byzantium neutral
				  console_command diplomatic_stance france timurids neutral
				  console_command diplomatic_stance france lucca neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily milan neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily spain neutral
				  console_command diplomatic_stance sicily poland neutral
				  console_command diplomatic_stance sicily byzantium neutral
				  console_command diplomatic_stance sicily timurids neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance venice milan neutral
				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice spain neutral
				  console_command diplomatic_stance venice poland neutral
				  console_command diplomatic_stance venice byzantium neutral
				  console_command diplomatic_stance venice timurids neutral
				  console_command diplomatic_stance venice lucca neutral

				  console_command diplomatic_stance milan papal_states neutral
				  console_command diplomatic_stance milan spain neutral
				  console_command diplomatic_stance milan poland neutral
				  console_command diplomatic_stance milan byzantium neutral
				  console_command diplomatic_stance milan timurids neutral
				  console_command diplomatic_stance milan lucca neutral

				  console_command diplomatic_stance papal_states spain neutral
				  console_command diplomatic_stance papal_states poland neutral
				  console_command diplomatic_stance papal_states byzantium neutral
				  console_command diplomatic_stance papal_states timurids neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance spain poland neutral
				  console_command diplomatic_stance spain byzantium neutral
				  console_command diplomatic_stance spain timurids neutral
				  console_command diplomatic_stance spain lucca neutral

				  console_command diplomatic_stance poland byzantium neutral
				  console_command diplomatic_stance poland timurids neutral
				  console_command diplomatic_stance poland lucca neutral

				  console_command diplomatic_stance timurids byzantium neutral

				  console_command diplomatic_stance lucca byzantium neutral
				  console_command diplomatic_stance lucca timurids neutral

			terminate_monitor
		end_if

		if I_CompareCounter liga_v_besteht = 1
			and I_CompareCounter liga_v_nein_florenz = 1

				  console_command diplomatic_stance france milan neutral
				  console_command diplomatic_stance france venice neutral
				  console_command diplomatic_stance france papal_states neutral
				  console_command diplomatic_stance france spain neutral
				  console_command diplomatic_stance france hre neutral
				  console_command diplomatic_stance france byzantium neutral
				  console_command diplomatic_stance france timurids neutral
				  console_command diplomatic_stance france lucca neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily milan neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily spain neutral
				  console_command diplomatic_stance sicily hre neutral
				  console_command diplomatic_stance sicily byzantium neutral
				  console_command diplomatic_stance sicily timurids neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance venice milan neutral
				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice spain neutral
				  console_command diplomatic_stance venice hre neutral
				  console_command diplomatic_stance venice byzantium neutral
				  console_command diplomatic_stance venice timurids neutral
				  console_command diplomatic_stance venice lucca neutral

				  console_command diplomatic_stance milan papal_states neutral
				  console_command diplomatic_stance milan spain neutral
				  console_command diplomatic_stance milan hre neutral
				  console_command diplomatic_stance milan byzantium neutral
				  console_command diplomatic_stance milan timurids neutral
				  console_command diplomatic_stance milan lucca neutral

				  console_command diplomatic_stance papal_states spain neutral
				  console_command diplomatic_stance papal_states hre neutral
				  console_command diplomatic_stance papal_states byzantium neutral
				  console_command diplomatic_stance papal_states timurids neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance spain hre neutral
				  console_command diplomatic_stance spain byzantium neutral
				  console_command diplomatic_stance spain timurids neutral
				  console_command diplomatic_stance spain lucca neutral

				  console_command diplomatic_stance hre byzantium neutral
				  console_command diplomatic_stance hre timurids neutral
				  console_command diplomatic_stance hre lucca neutral

				  console_command diplomatic_stance timurids byzantium neutral

				  console_command diplomatic_stance lucca byzantium neutral
				  console_command diplomatic_stance lucca timurids neutral

			terminate_monitor
		end_if

		if I_CompareCounter liga_v_besteht = 1
			and I_CompareCounter liga_v_nein_mantua = 1

				  console_command diplomatic_stance france milan neutral
				  console_command diplomatic_stance france venice neutral
				  console_command diplomatic_stance france papal_states neutral
				  console_command diplomatic_stance france spain neutral
				  console_command diplomatic_stance france hre neutral
				  console_command diplomatic_stance france poland neutral
				  console_command diplomatic_stance france timurids neutral
				  console_command diplomatic_stance france lucca neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily milan neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily spain neutral
				  console_command diplomatic_stance sicily hre neutral
				  console_command diplomatic_stance sicily poland neutral
				  console_command diplomatic_stance sicily timurids neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance venice milan neutral
				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice spain neutral
				  console_command diplomatic_stance venice hre neutral
				  console_command diplomatic_stance venice poland neutral
				  console_command diplomatic_stance venice timurids neutral
				  console_command diplomatic_stance venice lucca neutral

				  console_command diplomatic_stance milan papal_states neutral
				  console_command diplomatic_stance milan spain neutral
				  console_command diplomatic_stance milan hre neutral
				  console_command diplomatic_stance milan poland neutral
				  console_command diplomatic_stance milan timurids neutral
				  console_command diplomatic_stance milan lucca neutral

				  console_command diplomatic_stance papal_states spain neutral
				  console_command diplomatic_stance papal_states hre neutral
				  console_command diplomatic_stance papal_states poland neutral
				  console_command diplomatic_stance papal_states timurids neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance spain hre neutral
				  console_command diplomatic_stance spain poland neutral
				  console_command diplomatic_stance spain timurids neutral
				  console_command diplomatic_stance spain lucca neutral

				  console_command diplomatic_stance hre poland neutral
				  console_command diplomatic_stance hre timurids neutral
				  console_command diplomatic_stance hre lucca neutral

				  console_command diplomatic_stance poland timurids neutral
				  console_command diplomatic_stance poland lucca neutral

				  console_command diplomatic_stance lucca timurids neutral

			terminate_monitor
		end_if

		if I_CompareCounter liga_v_besteht = 1
			and I_CompareCounter liga_v_nein_bologna = 1

				  console_command diplomatic_stance france milan neutral
				  console_command diplomatic_stance france venice neutral
				  console_command diplomatic_stance france papal_states neutral
				  console_command diplomatic_stance france spain neutral
				  console_command diplomatic_stance france hre neutral
				  console_command diplomatic_stance france poland neutral
				  console_command diplomatic_stance france byzantium neutral
				  console_command diplomatic_stance france lucca neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily milan neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily spain neutral
				  console_command diplomatic_stance sicily hre neutral
				  console_command diplomatic_stance sicily poland neutral
				  console_command diplomatic_stance sicily byzantium neutral
				  console_command diplomatic_stance sicily lucca neutral

				  console_command diplomatic_stance venice milan neutral
				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice spain neutral
				  console_command diplomatic_stance venice hre neutral
				  console_command diplomatic_stance venice poland neutral
				  console_command diplomatic_stance venice byzantium neutral
				  console_command diplomatic_stance venice lucca neutral

				  console_command diplomatic_stance milan papal_states neutral
				  console_command diplomatic_stance milan spain neutral
				  console_command diplomatic_stance milan hre neutral
				  console_command diplomatic_stance milan poland neutral
				  console_command diplomatic_stance milan byzantium neutral
				  console_command diplomatic_stance milan lucca neutral

				  console_command diplomatic_stance papal_states spain neutral
				  console_command diplomatic_stance papal_states hre neutral
				  console_command diplomatic_stance papal_states poland neutral
				  console_command diplomatic_stance papal_states byzantium neutral
				  console_command diplomatic_stance papal_states lucca neutral

				  console_command diplomatic_stance spain hre neutral
				  console_command diplomatic_stance spain poland neutral
				  console_command diplomatic_stance spain byzantium neutral
				  console_command diplomatic_stance spain lucca neutral

				  console_command diplomatic_stance hre poland neutral
				  console_command diplomatic_stance hre byzantium neutral
				  console_command diplomatic_stance hre lucca neutral

				  console_command diplomatic_stance poland byzantium neutral
				  console_command diplomatic_stance poland lucca neutral

				  console_command diplomatic_stance lucca byzantium neutral

			terminate_monitor
		end_if

		if I_CompareCounter liga_v_besteht = 1
			and I_CompareCounter liga_v_nein_lucca = 1

				  console_command diplomatic_stance france milan neutral
				  console_command diplomatic_stance france venice neutral
				  console_command diplomatic_stance france papal_states neutral
				  console_command diplomatic_stance france spain neutral
				  console_command diplomatic_stance france hre neutral
				  console_command diplomatic_stance france poland neutral
				  console_command diplomatic_stance france byzantium neutral
				  console_command diplomatic_stance france timurids neutral

				  console_command diplomatic_stance sicily venice neutral
				  console_command diplomatic_stance sicily milan neutral
				  console_command diplomatic_stance sicily papal_states neutral
				  console_command diplomatic_stance sicily spain neutral
				  console_command diplomatic_stance sicily hre neutral
				  console_command diplomatic_stance sicily poland neutral
				  console_command diplomatic_stance sicily byzantium neutral
				  console_command diplomatic_stance sicily timurids neutral

				  console_command diplomatic_stance venice milan neutral
				  console_command diplomatic_stance venice papal_states neutral
				  console_command diplomatic_stance venice spain neutral
				  console_command diplomatic_stance venice hre neutral
				  console_command diplomatic_stance venice poland neutral
				  console_command diplomatic_stance venice byzantium neutral

				  console_command diplomatic_stance milan papal_states neutral
				  console_command diplomatic_stance milan spain neutral
				  console_command diplomatic_stance milan hre neutral
				  console_command diplomatic_stance milan poland neutral
				  console_command diplomatic_stance milan byzantium neutral
				  console_command diplomatic_stance milan timurids neutral

				  console_command diplomatic_stance papal_states spain neutral
				  console_command diplomatic_stance papal_states hre neutral
				  console_command diplomatic_stance papal_states poland neutral
				  console_command diplomatic_stance papal_states byzantium neutral
				  console_command diplomatic_stance papal_states timurids neutral

				  console_command diplomatic_stance spain hre neutral
				  console_command diplomatic_stance spain poland neutral
				  console_command diplomatic_stance spain byzantium neutral
				  console_command diplomatic_stance spain timurids neutral

				  console_command diplomatic_stance hre poland neutral
				  console_command diplomatic_stance hre byzantium neutral
				  console_command diplomatic_stance hre timurids neutral

				  console_command diplomatic_stance poland byzantium neutral
				  console_command diplomatic_stance poland timurids neutral

				  console_command diplomatic_stance timurids byzantium neutral

			terminate_monitor
		end_if

	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Allianz von Blois -------------------------------------
	;------------------------------------------------------------------------------
	declare_counter allianz		;Besteht die Allianz von Blois

	monitor_event FactionTurnStart I_TurnNumber = 40
		and I_SettlementOwner Verona = venice
		and I_SettlementOwner Brescia = venice

		if I_LocalFaction venice
			historic_event allianz_venice true factions { venice, }
		end_if

		if not I_LocalFaction venice
		and not I_LocalFaction france
		and not I_LocalFaction papal_states
		and not I_LocalFaction hre 

			generate_random_counter allianz 1 2

			if I_EventCounter allianz = 1
				historic_event allianz_andere_ja factions { saxons, turks, normans, hungary, poland, sicily, spain, milan, england, denmark, byzantium, russia, scotland, egypt, savoy, montferrat, urbino, lucca, timurids, }

				console_command diplomatic_stance venice france War
				console_command diplomatic_stance venice papal_states War
				console_command diplomatic_stance venice hre War

				console_command diplomatic_stance france papal_states Allied
				console_command diplomatic_stance france hre Allied
				console_command diplomatic_stance hre papal_states Allied

				set_counter allianz 1
			end_if

			if I_EventCounter allianz = 2
				historic_event allianz_andere_nein factions { saxons, turks, normans, hungary, poland, sicily, spain, milan, england, denmark, byzantium, russia, scotland, egypt, savoy, montferrat, urbino, lucca, timurids, }
			end_if

		end_if

		if I_LocalFaction france
			historic_event allianz_frankreich true factions { france, }
		end_if

		if I_LocalFaction hre
			historic_event allianz_hre true factions { hre, }
		end_if

		if I_LocalFaction papal_states
			historic_event allianz_papst true factions { papal_states, }
		end_if

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Angenommen Venedig ------------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType allianz_venice_accepted

		set_counter allianz 1

		console_command diplomatic_stance venice france War
		console_command diplomatic_stance venice papal_states War
		console_command diplomatic_stance venice hre War

		console_command diplomatic_stance france papal_states Allied
		console_command diplomatic_stance france hre Allied
		console_command diplomatic_stance papal_states hre Allied

		console_command add_money venice, -15000

		spawn_army 
			faction venice
			character	Bartolomeo Alviano, named character, age 50, x 116, y 212
			traits soeldner 1
			unit		SE Late Bodyguard		exp 1 armour 0 weapon_lvl 0
			unit		Condottieri			exp 3 armour 0 weapon_lvl 0
			unit		Condottieri			exp 3 armour 0 weapon_lvl 0
			unit		Pike Militia			exp 2 armour 2 weapon_lvl 0
			unit		Pike Militia			exp 2 armour 2 weapon_lvl 0
			unit		Arquebusiers			exp 2 armour 2 weapon_lvl 0
			unit		Arquebusiers			exp 2 armour 2 weapon_lvl 0
			unit		Mercenary Pavise Crossbowmen			exp 1 armour 0 weapon_lvl 0
			unit		Mercenary Pavise Crossbowmen			exp 1 armour 0 weapon_lvl 0
		end

		snap_strat_camera 116, 222		
		zoom_strat_camera 0.1
		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Abgelehnt Venedig -------------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType allianz_venice_declined

		set_counter allianz 1

		console_command diplomatic_stance venice france War
		console_command diplomatic_stance venice papal_states War
		console_command diplomatic_stance venice hre War

		console_command diplomatic_stance france papal_states Allied
		console_command diplomatic_stance france hre Allied
		console_command diplomatic_stance papal_states hre Allied

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Angenommen Frankreich ---------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType allianz_frankreich_accepted

		set_counter allianz 2

		console_command diplomatic_stance venice france War
		console_command diplomatic_stance venice papal_states War
		console_command diplomatic_stance venice hre War

		console_command diplomatic_stance france papal_states Allied
		console_command diplomatic_stance france hre Allied
		console_command diplomatic_stance papal_states hre Allied

		set_faction_standing france hre 0.5
		set_faction_standing france papal_states 0.5

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Abgelehnt Frankreich ----------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType allianz_frankreich_declined

		set_counter allianz 3

		console_command diplomatic_stance venice papal_states War
		console_command diplomatic_stance venice hre War

		console_command diplomatic_stance papal_states hre Allied

		set_faction_standing france papal_states -0.5

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Angenommen HRR ----------------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType allianz_hre_accepted

		set_counter allianz 4

		console_command diplomatic_stance venice france War
		console_command diplomatic_stance venice papal_states War
		console_command diplomatic_stance venice hre War

		console_command diplomatic_stance france papal_states Allied
		console_command diplomatic_stance france hre Allied
		console_command diplomatic_stance papal_states hre Allied

		set_faction_standing hre france 0.5
		set_faction_standing hre papal_states 0.5

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Abgelehnt HRR -----------------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType allianz_hre_declined

		set_counter allianz 5

		console_command diplomatic_stance venice papal_states War
		console_command diplomatic_stance venice france War

		console_command diplomatic_stance papal_states france Allied

		set_faction_standing hre papal_states -0.5

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Angenommen Papst --------------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType allianz_papst_accepted

		set_counter allianz 6

		console_command diplomatic_stance venice france War
		console_command diplomatic_stance venice papal_states War
		console_command diplomatic_stance venice hre War

		console_command diplomatic_stance france papal_states Allied
		console_command diplomatic_stance france hre Allied
		console_command diplomatic_stance papal_states hre Allied

		set_faction_standing papal_states hre 0.5
		set_faction_standing papal_states france 0.5

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Liga von Cambrai --------------------------------------
	;------------------------------------------------------------------------------

	declare_counter cambrai		;Besteht die Liga von Cambrai

	monitor_event FactionTurnStart I_TurnNumber = 56
		and I_CompareCounter allianz > 0
		and I_SettlementOwner Verona = venice
		and I_SettlementOwner Padua = venice
		and I_SettlementOwner Brescia = venice

		send_character_off_map Bartolomeo Alviano

		if I_LocalFaction venice
			historic_event cambrai_venice true factions { venice, }
		end_if

		if not I_LocalFaction venice
		and not I_LocalFaction france
		and not I_LocalFaction hre
		and not I_LocalFaction spain
		and not I_LocalFaction papal_states
		and not I_LocalFaction england
		and not I_LocalFaction byzantium

			historic_event cambrai_andere_ja factions { saxons, turks, normans, hungary, poland, sicily, milan, savoy, montferrat, timurids, urbino, lucca, denmark, russia, scotland, egypt, }

			console_command diplomatic_stance venice france War
			console_command diplomatic_stance venice papal_states War
			console_command diplomatic_stance venice hre War
			console_command diplomatic_stance venice spain War
			console_command diplomatic_stance venice england War
			console_command diplomatic_stance venice byzantium War

			console_command diplomatic_stance france papal_states Allied
			console_command diplomatic_stance france hre Allied
			console_command diplomatic_stance france spain Allied
			console_command diplomatic_stance france england Allied
			console_command diplomatic_stance france byzantium Allied
			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance papal_states england Allied
			console_command diplomatic_stance papal_states byzantium Allied
			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance spain england Allied
			console_command diplomatic_stance spain byzantium Allied
			console_command diplomatic_stance hre england Allied
			console_command diplomatic_stance hre byzantium Allied
			console_command diplomatic_stance england byzantium Allied

			set_counter cambrai 1

			spawn_army 
				faction england
				character	random_name, named character, age 18, x 96, y 197
				traits GoodCommander 2 , ReligionStarter 1 
				unit		NE Late Bodyguard		exp 1 armour 0 weapon_lvl 0
				unit		Condottieri			exp 3 armour 0 weapon_lvl 0
				unit		Pike Militia			exp 3 armour 0 weapon_lvl 0
				unit		Pike Militia			exp 2 armour 2 weapon_lvl 0
				unit		Pike Militia			exp 2 armour 2 weapon_lvl 0
				unit		Fer Arquebusiers			exp 2 armour 2 weapon_lvl 0
				unit		Fer Arquebusiers			exp 1 armour 0 weapon_lvl 0
			end

			spawn_army 
				faction venice
				character	Bartolomeo Alviano, named character, age 54, x 121, y 213
				traits soeldner 1
				unit		SE Late Bodyguard		exp 1 armour 0 weapon_lvl 0
				unit		Condottieri			exp 3 armour 0 weapon_lvl 0
				unit		Condottieri			exp 3 armour 0 weapon_lvl 0
				unit		Pike Militia			exp 2 armour 2 weapon_lvl 0
				unit		Pike Militia			exp 2 armour 2 weapon_lvl 0
				unit		Arquebusiers			exp 2 armour 2 weapon_lvl 0
				unit		Mercenary Pavise Crossbowmen			exp 1 armour 0 weapon_lvl 0
			end

			spawn_army 
				faction venice
				character	Nicolo di Pitigliano, named character, age 66, x 114, y 209
				traits soeldner 1
				unit		SE Late Bodyguard		exp 1 armour 0 weapon_lvl 0
				unit		Condottieri			exp 3 armour 0 weapon_lvl 0
				unit		Condottieri			exp 3 armour 0 weapon_lvl 0
				unit		Pike Militia			exp 2 armour 2 weapon_lvl 0
				unit		Pike Militia			exp 2 armour 2 weapon_lvl 0
				unit		Arquebusiers			exp 2 armour 2 weapon_lvl 0
				unit		Mercenary Pavise Crossbowmen			exp 1 armour 0 weapon_lvl 0
			end

		end_if

		if I_LocalFaction france
			historic_event cambrai_frankreich true
		end_if

		if I_LocalFaction hre
			historic_event cambrai_hre true
		end_if

		if I_LocalFaction spain
			historic_event cambrai_spain true
		end_if

		if I_LocalFaction papal_states
			historic_event cambrai_papst true
		end_if

		if I_LocalFaction england
			historic_event cambrai_ferrara true
		end_if

		if I_LocalFaction byzantium
			historic_event cambrai_mantua true
		end_if


		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Angenommen Venedig ------------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType cambrai_venice_accepted

		set_counter cambrai 1

			console_command diplomatic_stance venice france War
			console_command diplomatic_stance venice papal_states War
			console_command diplomatic_stance venice hre War
			console_command diplomatic_stance venice spain War
			console_command diplomatic_stance venice england War

			console_command diplomatic_stance france papal_states Allied
			console_command diplomatic_stance france hre Allied
			console_command diplomatic_stance france spain Allied
			console_command diplomatic_stance france england Allied
			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states england Allied
			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance spain england Allied
			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance hre england Allied

		console_command add_money venice, -20000

		spawn_army 
			faction venice
			character	Bartolomeo Alviano, named character, age 54, x 121, y 213
			traits soeldner 1
			unit		SE Late Bodyguard		exp 1 armour 0 weapon_lvl 0
			unit		Condottieri			exp 3 armour 0 weapon_lvl 0
			unit		Condottieri			exp 3 armour 0 weapon_lvl 0
			unit		Pike Militia			exp 2 armour 2 weapon_lvl 0
			unit		Pike Militia			exp 2 armour 2 weapon_lvl 0
			unit		Arquebusiers			exp 2 armour 2 weapon_lvl 0
			unit		Mercenary Pavise Crossbowmen			exp 1 armour 0 weapon_lvl 0
		end

		spawn_army 
			faction venice
			character	Nicolo di Pitigliano, named character, age 66, x 114, y 209
			traits soeldner 1
			unit		SE Late Bodyguard		exp 1 armour 0 weapon_lvl 0
			unit		Condottieri			exp 3 armour 0 weapon_lvl 0
			unit		Condottieri			exp 3 armour 0 weapon_lvl 0
			unit		Pike Militia			exp 2 armour 2 weapon_lvl 0
			unit		Pike Militia			exp 2 armour 2 weapon_lvl 0
			unit		Arquebusiers			exp 2 armour 2 weapon_lvl 0
			unit		Mercenary Pavise Crossbowmen			exp 1 armour 0 weapon_lvl 0
		end

		terminate_monitor
	end_monitor
	;------------------------------------------------------------------------------
	;---------------------- Abgelehnt Venedig -------------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType cambrai_venice_declined

		set_counter cambrai 1

			console_command diplomatic_stance venice france War
			console_command diplomatic_stance venice papal_states War
			console_command diplomatic_stance venice hre War
			console_command diplomatic_stance venice spain War
			console_command diplomatic_stance venice england War

			console_command diplomatic_stance france papal_states Allied
			console_command diplomatic_stance france hre Allied
			console_command diplomatic_stance france spain Allied
			console_command diplomatic_stance france england Allied
			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states england Allied
			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance spain england Allied
			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance hre england Allied

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Angenommen Frankreich ---------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType cambrai_frankreich_accepted

		set_counter cambrai 2

			console_command diplomatic_stance venice france War
			console_command diplomatic_stance venice papal_states War
			console_command diplomatic_stance venice hre War
			console_command diplomatic_stance venice spain War
			console_command diplomatic_stance venice england War

			console_command diplomatic_stance france papal_states Allied
			console_command diplomatic_stance france hre Allied
			console_command diplomatic_stance france spain Allied
			console_command diplomatic_stance france england Allied
			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states england Allied
			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance spain england Allied
			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance hre england Allied

		set_faction_standing france hre 0.5
		set_faction_standing france papal_states 0.5
		set_faction_standing france spain 0.5
		set_faction_standing france england 0.5

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Abgelehnt Frankreich ----------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType allianz_frankreich_declined

		set_counter allianz 3

			console_command diplomatic_stance venice papal_states War
			console_command diplomatic_stance venice hre War
			console_command diplomatic_stance venice spain War
			console_command diplomatic_stance venice england War

			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states england Allied
			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance spain england Allied
			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance hre england Allied


		set_faction_standing france papal_states -0.5

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Angenommen HRR ----------------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType cambrai_hre_accepted

		set_counter cambrai 4

			console_command diplomatic_stance venice france War
			console_command diplomatic_stance venice papal_states War
			console_command diplomatic_stance venice hre War
			console_command diplomatic_stance venice spain War
			console_command diplomatic_stance venice england War

			console_command diplomatic_stance france papal_states Allied
			console_command diplomatic_stance france hre Allied
			console_command diplomatic_stance france spain Allied
			console_command diplomatic_stance france england Allied
			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states england Allied
			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance spain england Allied
			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance hre england Allied

		set_faction_standing hre france 0.5
		set_faction_standing hre papal_states 0.5
		set_faction_standing hre spain 0.5
		set_faction_standing hre england 0.5

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Abgelehnt HRR -----------------------------------------
	;------------------------------------------------------------------------------
	monitor_event EventCounter EventCounterType cambrai_hre_declined

		set_counter cambrai 5

			console_command diplomatic_stance venice france War
			console_command diplomatic_stance venice papal_states War
			console_command diplomatic_stance venice spain War
			console_command diplomatic_stance venice england War

			console_command diplomatic_stance france papal_states Allied
			console_command diplomatic_stance france spain Allied
			console_command diplomatic_stance france england Allied
			console_command diplomatic_stance papal_states england Allied
			console_command diplomatic_stance spain england Allied
			console_command diplomatic_stance papal_states spain Allied

		set_faction_standing hre papal_states -0.5

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;----------------------- Angenommen Spanien -----------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType cambrai_spain_accepted

		set_counter cambrai 6

			console_command diplomatic_stance venice france War
			console_command diplomatic_stance venice papal_states War
			console_command diplomatic_stance venice hre War
			console_command diplomatic_stance venice spain War
			console_command diplomatic_stance venice england War

			console_command diplomatic_stance france papal_states Allied
			console_command diplomatic_stance france hre Allied
			console_command diplomatic_stance france spain Allied
			console_command diplomatic_stance france england Allied
			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states england Allied
			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance spain england Allied
			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance hre england Allied

		set_faction_standing spain hre 0.5
		set_faction_standing spain papal_states 0.5
		set_faction_standing spain france 0.5
		set_faction_standing spain england 0.5

		terminate_monitor
	end_monitor
	;------------------------------------------------------------------------------
	;---------------------- Abgelehnt Spanien -------------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType cambrai_spain_declined

		set_counter cambrai 7

			console_command diplomatic_stance venice france War
			console_command diplomatic_stance venice papal_states War
			console_command diplomatic_stance venice hre War
			console_command diplomatic_stance venice england War

			console_command diplomatic_stance france papal_states Allied
			console_command diplomatic_stance france hre Allied
			console_command diplomatic_stance france england Allied
			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states england Allied
			console_command diplomatic_stance hre england Allied

		set_faction_standing spain papal_states -0.5

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;----------------------- Angenommen Ferrara -----------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType cambrai_ferrara_accepted

		set_counter cambrai 8

			console_command diplomatic_stance venice france War
			console_command diplomatic_stance venice papal_states War
			console_command diplomatic_stance venice hre War
			console_command diplomatic_stance venice spain War
			console_command diplomatic_stance venice england War

			console_command diplomatic_stance france papal_states Allied
			console_command diplomatic_stance france hre Allied
			console_command diplomatic_stance france spain Allied
			console_command diplomatic_stance france england Allied
			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states england Allied
			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance spain england Allied
			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance hre england Allied

		set_faction_standing england hre 0.5
		set_faction_standing england papal_states 0.5
		set_faction_standing england france 0.5
		set_faction_standing england spain 0.5

		terminate_monitor
	end_monitor
	;------------------------------------------------------------------------------
	;---------------------- Abgelehnt Ferrara -------------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType cambrai_spain_declined

		set_counter cambrai 9

			console_command diplomatic_stance venice france War
			console_command diplomatic_stance venice papal_states War
			console_command diplomatic_stance venice hre War
			console_command diplomatic_stance venice spain War

			console_command diplomatic_stance france papal_states Allied
			console_command diplomatic_stance france hre Allied
			console_command diplomatic_stance france spain Allied
			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance papal_states spain Allied

		set_faction_standing england papal_states -0.5

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Angenommen Papst --------------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType cambrai_papst_accepted

		set_counter cambrai 10

		console_command add_money papal_states, -4000

			console_command diplomatic_stance venice france War
			console_command diplomatic_stance venice papal_states War
			console_command diplomatic_stance venice hre War
			console_command diplomatic_stance venice spain War
			console_command diplomatic_stance venice england War

			console_command diplomatic_stance france papal_states Allied
			console_command diplomatic_stance france hre Allied
			console_command diplomatic_stance france spain Allied
			console_command diplomatic_stance france england Allied
			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states england Allied
			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance spain england Allied
			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance hre england Allied

		set_faction_standing papal_states hre 0.5
		set_faction_standing papal_states spain 0.5
		set_faction_standing papal_states france 0.5
		set_faction_standing papal_states england 0.5

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Veneto-Päpstliche Allianz -----------------------------
	;------------------------------------------------------------------------------

	declare_counter v_p_allianz	;Besteht die Veneto-Päpstliche Allianz

	monitor_event FactionTurnStart I_TurnNumber = 64
		and I_SettlementOwner Asti = france
		and I_CompareCounter cambrai > 0

		if I_LocalFaction venice
			historic_event v_p_allianz_venice true
		end_if

		if I_LocalFaction france
			historic_event v_p_allianz_france true
		end_if

		if I_LocalFaction hre
			historic_event v_p_allianz_hre true
		end_if

		if I_LocalFaction spain
			historic_event v_p_allianz_spain true
		end_if

		if I_LocalFaction papal_states
			historic_event v_p_allianz_papal_states true
		end_if

		if I_LocalFaction england
			historic_event v_p_allianz_ferrara true
		end_if

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Angenommen Venedig ------------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType v_p_allianz_venice_accepted

		set_counter v_p_allianz 1

		console_command diplomatic_stance venice france War
		console_command diplomatic_stance papal_states france War
		console_command diplomatic_stance papal_states england War

		console_command diplomatic_stance venice papal_states Allied

		console_command diplomatic_stance venice hre Peace
		console_command diplomatic_stance spain venice Peace

		console_command add_money venice, -5000
		console_command add_money hre, 5000

		spawn_army 
			faction france
			character	random_name, named character, age 32, x 92, y 196, direction E
			traits soeldner 1 , ReligionStarter 1 
			unit		SE Late Bodyguard		exp 1 armour 0 weapon_lvl 0
			unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
			unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
			unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
			unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
			unit		Fer Arquebusiers			exp 2 armour 2 weapon_lvl 0
			unit		Fer Arquebusiers			exp 1 armour 0 weapon_lvl 0
		end

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Abgelehnt Venedig -------------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType v_p_allianz_venice_declined

		set_faction_standing papal_states venice -1.0

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Angenommen Frankreich ---------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType v_p_allianz_france_accepted

		set_counter v_p_allianz 1

		console_command diplomatic_stance venice france War
		console_command diplomatic_stance papal_states france War
		console_command diplomatic_stance papal_states england War

		console_command diplomatic_stance venice papal_states Allied

		console_command diplomatic_stance venice hre Peace
		console_command diplomatic_stance spain venice Peace

		console_command add_money france, -10000
		console_command add_money venice, -5000
		console_command add_money hre, 5000
		console_command add_money england, 10000

		spawn_army 
			faction france
			character	random_name, named character, age 32, x 92, y 196, direction E
			traits soeldner 1 , ReligionStarter 1 
			unit		SE Late Bodyguard		exp 1 armour 0 weapon_lvl 0
			unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
			unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
			unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
			unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
			unit		Fer Arquebusiers			exp 2 armour 2 weapon_lvl 0
			unit		Fer Arquebusiers			exp 1 armour 0 weapon_lvl 0
		end

		set_faction_standing papal_states venice 0.5
		set_faction_standing venice papal_states 0.5
		set_faction_standing papal_states france -0.5
		set_faction_standing france papal_states -0.5		
		set_faction_standing papal_states england -0.5
		set_faction_standing england papal_states -0.5		

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Abgelehnt Frankreich ----------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType v_p_allianz_france_declined

		set_counter v_p_allianz 1

		console_command diplomatic_stance venice france War
		console_command diplomatic_stance papal_states france War
		console_command diplomatic_stance papal_states england War

		console_command diplomatic_stance venice papal_states Allied

		console_command diplomatic_stance venice hre Peace
		console_command diplomatic_stance spain venice Peace

		console_command add_money venice, -5000
		console_command add_money hre, 5000

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Angenommen HRE ----------------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType v_p_allianz_hre_accepted

		set_counter v_p_allianz 1

		console_command diplomatic_stance venice france War
		console_command diplomatic_stance papal_states france War
		console_command diplomatic_stance papal_states england War

		console_command diplomatic_stance venice papal_states Allied

		console_command diplomatic_stance venice hre Peace
		console_command diplomatic_stance spain venice Peace

		console_command add_money venice, -5000
		console_command add_money hre, 5000

		spawn_army 
			faction france
			character	random_name, named character, age 32, x 92, y 196, direction E
			traits soeldner 1 , ReligionStarter 1 
			unit		SE Late Bodyguard		exp 1 armour 0 weapon_lvl 0
			unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
			unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
			unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
			unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
			unit		Fer Arquebusiers			exp 2 armour 2 weapon_lvl 0
			unit		Fer Arquebusiers			exp 1 armour 0 weapon_lvl 0
		end

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Abgelehnt HRE -----------------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType v_p_allianz_hre_declined

		set_counter v_p_allianz 1

		console_command diplomatic_stance venice france War
		console_command diplomatic_stance papal_states france War
		console_command diplomatic_stance papal_states england War

		console_command diplomatic_stance venice papal_states Allied

		console_command diplomatic_stance venice hre Peace
		console_command diplomatic_stance spain venice Peace

		set_faction_standing papal_states hre -1.0

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Angenommen Spanien ------------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType v_p_allianz_spain_accepted

		set_counter v_p_allianz 1

		console_command diplomatic_stance venice france War
		console_command diplomatic_stance papal_states france War
		console_command diplomatic_stance papal_states england War

		console_command diplomatic_stance venice papal_states Allied

		console_command diplomatic_stance venice hre Peace
		console_command diplomatic_stance spain venice Peace

		console_command add_money venice, -5000
		console_command add_money hre, 5000

		spawn_army 
			faction france
			character	random_name, named character, age 32, x 92, y 196, direction E
			traits soeldner 1 , ReligionStarter 1 
			unit		SE Late Bodyguard		exp 1 armour 0 weapon_lvl 0
			unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
			unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
			unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
			unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
			unit		Fer Arquebusiers			exp 2 armour 2 weapon_lvl 0
			unit		Fer Arquebusiers			exp 1 armour 0 weapon_lvl 0
		end

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Abgelehnt Spanien -------------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType v_p_allianz_spain_declined

		set_counter v_p_allianz 1

		console_command diplomatic_stance venice france War
		console_command diplomatic_stance papal_states france War
		console_command diplomatic_stance papal_states england War

		console_command diplomatic_stance venice papal_states Allied

		console_command diplomatic_stance venice hre Peace
		console_command diplomatic_stance spain venice Peace

		console_command add_money venice, -5000
		console_command add_money hre, 5000

		set_faction_standing papal_states spain -1.0

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Angenommen Papst --------------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType v_p_allianz_papal_states_accepted

		set_counter v_p_allianz 1

		console_command add_money papal_states, -5000

		console_command diplomatic_stance venice france War
		console_command diplomatic_stance papal_states france War
		console_command diplomatic_stance papal_states england War

		console_command diplomatic_stance venice papal_states Allied

		console_command diplomatic_stance venice hre Peace
		console_command diplomatic_stance spain venice Peace

		console_command add_money venice, -5000
		console_command add_money hre, 5000

		spawn_army 
			faction france
			character	random_name, named character, age 32, x 92, y 196, direction E
			traits soeldner 1 , ReligionStarter 1 
			unit		SE Late Bodyguard		exp 1 armour 0 weapon_lvl 0
			unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
			unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
			unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
			unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
			unit		Fer Arquebusiers			exp 2 armour 2 weapon_lvl 0
			unit		Fer Arquebusiers			exp 1 armour 0 weapon_lvl 0
		end

		terminate_monitor
	end_monitor
	
	;------------------------------------------------------------------------------
	;---------------------- Angenommen Ferrara ------------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType v_p_allianz_ferrara_accepted

		set_counter v_p_allianz 1

		console_command diplomatic_stance venice france War
		console_command diplomatic_stance papal_states france War
		console_command diplomatic_stance papal_states england War

		console_command diplomatic_stance venice papal_states Allied

		console_command diplomatic_stance venice hre Peace
		console_command diplomatic_stance spain venice Peace

		console_command add_money france, -10000
		console_command add_money venice, -5000
		console_command add_money hre, 5000
		console_command add_money england, 10000

		set_faction_standing papal_states venice 0.5
		set_faction_standing venice papal_states 0.5
		set_faction_standing papal_states france -0.5
		set_faction_standing france papal_states -0.5		
		set_faction_standing papal_states england -0.5
		set_faction_standing england papal_states -0.5		

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Abgelehnt Ferrara -------------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType v_p_allianz_ferrara_declined

		set_counter v_p_allianz 1

		console_command diplomatic_stance venice france War
		console_command diplomatic_stance papal_states france War

		console_command diplomatic_stance venice papal_states Allied

		console_command diplomatic_stance venice hre Peace
		console_command diplomatic_stance spain venice Peace
		console_command diplomatic_stance venice england Peace

		console_command add_money venice, -5000
		console_command add_money hre, 5000

		set_faction_standing papal_states venice 0.5
		set_faction_standing venice papal_states 0.5
		set_faction_standing papal_states france -0.5
		set_faction_standing france papal_states -0.5		
		set_faction_standing france england -0.5
		set_faction_standing england france -0.5		

		terminate_monitor
	end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- Verstärkung aus Spanien -------------------------------
    ;------------------------------------------------------------------------------

    ;-------------------------------------- Erste Flotte

    monitor_event FactionTurnStart I_TurnNumber = 36

        historic_event first_spain_fleet event/spanische_flotte.bik factions { spain, }

        console_command add_money spain, 3000

        spawn_army
            faction		spain
            character	Hernan, admiral, age 40, x 50, y 70, direction E
            unit		war galley			exp 0 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction spain
            character	Diego de Mendoza, named character, age 34, x 50, y 70
            traits GoodCommander 2 , LoyaltyStarter 1 , ReligionStarter 1 , Austere 1 
            unit		SE Late Bodyguard		exp 1 armour 0 weapon_lvl 0
            unit		Sp Pike Militia			exp 0 armour 0 weapon_lvl 0
            unit		Sp Pike Militia			exp 2 armour 0 weapon_lvl 0
            unit		Swordsmen Militia		exp 1 armour 0 weapon_lvl 0
            unit		Pavise Crossbowmen		exp 0 armour 0 weapon_lvl 0
        end

        if I_LocalFaction spain

            move_strat_camera 50, 80

        end_if

        terminate_monitor	
    end_monitor

    ;-------------------------------------- Zweite Flotte

    monitor_event FactionTurnStart I_TurnNumber = 68

        increment_kings_purse Spain 500

        historic_event second_spain_fleet event/spanische_flotte.bik factions { spain, }

        spawn_army
            faction		spain
            character	Rodrigo, admiral, age 32, x 90, y 65, direction E
            unit		war galley			exp 1 armour 0 weapon_lvl 0
            unit		war galley			exp 0 armour 0 weapon_lvl 0
        end

        spawn_army
            faction		spain
            character	Bernardo, admiral, age 51, x 90, y 63, direction E
            unit		lanternas			exp 0 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction spain
            character	Fernando de Avalos, named character, age 21, x 90, y 65
            traits GoodCommander 2 , BattleDread 3 , LoyaltyStarter 1 , ReligionStarter 1 ,  PublicFaith 1
            unit		SE Late Bodyguard		exp 1 armour 0 weapon_lvl 0
            unit		Tercio Pikemen			exp 1 armour 0 weapon_lvl 0
            unit		Tercio Pikemen			exp 2 armour 0 weapon_lvl 0
            unit		Tercio Pikemen			exp 0 armour 0 weapon_lvl 0
            unit		Gendarmes			exp 1 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction spain
            character	Ramon de Cardona, named character, age 43, x 90, y 63
            traits GoodCommander 1 , LoyaltyStarter 1 , Energetic 1	, ReligionStarter 1 , PoliticsSkill 1		
            unit		SE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Sword and Buckler Men		exp 0 armour 0 weapon_lvl 0
            unit		Arquebusiers			exp 1 armour 0 weapon_lvl 0
        end

        if I_LocalFaction spain

            move_strat_camera 90, 68

        end_if

        terminate_monitor	
    end_monitor

    ;-------------------------------------- Dritte Flotte

    monitor_event FactionTurnStart I_TurnNumber = 136

        historic_event third_spain_fleet event/spanische_flotte.bik factions { spain, }

        console_command add_money spain, 8000

        spawn_army
            faction		spain
            character	Sancho, admiral, age 29, x 129, y 57, direction E
            unit		grande carrack			exp 1 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction spain
            character	Antonio de Leyva, named character, age 47, x 129, y 57
            traits GoodCommander 1 , BattleChivalry 2 , LoyaltyStarter 1 , Intelligent 2 , ReligionStarter 1
            unit		SE Late Bodyguard		exp 1 armour 0 weapon_lvl 0
            unit		Tercio Pikemen			exp 1 armour 0 weapon_lvl 0
            unit		Tercio Pikemen			exp 3 armour 0 weapon_lvl 0
            unit		Tercio Pikemen			exp 0 armour 0 weapon_lvl 0
            unit		Sword and Buckler Men		exp 2 armour 0 weapon_lvl 0
            unit		Sp Musketeers			exp 0 armour 0 weapon_lvl 0
            unit		Sp Musketeers			exp 1 armour 0 weapon_lvl 0
            unit		Conquistadores			exp 2 armour 0 weapon_lvl 0

        end

        if I_LocalFaction spain

            move_strat_camera 129, 67

        end_if

        terminate_monitor	
    end_monitor
	
    ;------------------------------------------------------------------------------
    ;---------------------- Der Vertrag von Granada -------------------------------
    ;------------------------------------------------------------------------------

    monitor_event FactionTurnStart I_TurnNumber = 28

        if I_LocalFaction france

            historic_event vertrag_granada_france true factions { france, }
            terminate_monitor
        end_if

        if I_LocalFaction spain

            historic_event vertrag_granada_spain true factions { spain, }
            terminate_monitor
        end_if

        if not I_LocalFaction spain
            and not I_LocalFaction france

            historic_event vertrag_granada_alle factions { normans, hre, hungary, turks, milan, venice, poland, papal_states, sicily, denmark, byzantium, england, russia, scotland, egypt, savoy, montferrat, timurids, urbino, lucca, }

            set_faction_standing spain france 1.0
            set_faction_standing france spain 1.0

            console_command diplomatic_stance france sicily War
            console_command diplomatic_stance spain sicily War

            console_command diplomatic_stance france spain Allied

            set_faction_standing spain sicily -1.0
            set_faction_standing sicily spain -1.0

            set_faction_standing france sicily -1.0
            set_faction_standing sicily france -1.0

            console_command add_money france, 5000

        end_if

        terminate_monitor
    end_monitor

    ;---------------- Angenommen - Frankreich

    monitor_event EventCounter EventCounterType vertrag_granada_france_accepted = 1

        historic_event vertrag_granada_ja factions { france, }

        set_faction_standing spain france 1.0
        set_faction_standing france spain 1.0

        console_command diplomatic_stance france sicily War
        console_command diplomatic_stance spain sicily War

        console_command diplomatic_stance france spain Allied

        set_faction_standing spain sicily -1.0
        set_faction_standing sicily spain -1.0

        set_faction_standing france sicily -1.0
        set_faction_standing sicily france -1.0

        console_command add_money france, 5000

        terminate_monitor
    end_monitor

    ;---------------- Abgelehnt - Frankreich

    monitor_event EventCounter EventCounterType vertrag_granada_france_declined = 1

        historic_event vertrag_granada_france_nein factions { france, }

        set_faction_standing france spain -0.4

        spawn_army
            faction		spain
            character	random_name, admiral, age 29, x 131, y 96, direction E
            unit		grande carrack			exp 1 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction spain
            character	random_name, named character, age 32, x 131, y 96
            traits GoodCommander 1 , BattleChivalry 2 , LoyaltyStarter 1 , Intelligent 2 , ReligionStarter 1
            unit		SE Late Bodyguard		exp 1 armour 0 weapon_lvl 0
            unit		Tercio Pikemen			exp 1 armour 0 weapon_lvl 0
            unit		Tercio Pikemen			exp 3 armour 0 weapon_lvl 0
            unit		Tercio Pikemen			exp 0 armour 0 weapon_lvl 0
            unit		Sword and Buckler Men		exp 2 armour 0 weapon_lvl 0
            unit		Sp Musketeers			exp 0 armour 0 weapon_lvl 0
            unit		Sp Musketeers			exp 1 armour 0 weapon_lvl 0
            unit		Conquistadores			exp 2 armour 0 weapon_lvl 0

        end

        reveal_tile 131, 106

        terminate_monitor
    end_monitor


    ;---------------- Angenommen - Spanien

    monitor_event EventCounter EventCounterType vertrag_granada_spain_accepted = 1

        historic_event vertrag_granada_ja factions { spain, }

        set_faction_standing spain france 1.0
        set_faction_standing france spain 1.0

        console_command diplomatic_stance france sicily War
        console_command diplomatic_stance spain sicily War

        console_command diplomatic_stance france spain Allied

        set_faction_standing spain sicily -1.0
        set_faction_standing sicily spain -1.0

        set_faction_standing france sicily -1.0
        set_faction_standing sicily france -1.0

        console_command add_money spain, -5000

        add_settlement_turmoil Palermo 25

        terminate_monitor
    end_monitor

    ;---------------- Abgelehnt - Spanien

    monitor_event EventCounter EventCounterType vertrag_granada_spain_declined = 1

        historic_event vertrag_granada_spain_nein factions { spain, }

        set_faction_standing spain france -0.4

        add_settlement_turmoil Palermo 50

        terminate_monitor
    end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- Der Kaiser ist tot.. ----------------------------------
    ;------------------------------------------------------------------------------

    declare_counter off_map		;Welcher Charakter wurde als Fraktionsführer von der Karte geschickt und muss getötet werden?

    monitor_event FactionTurnStart FactionType hre
        and I_TurnNumber = 104

        historic_event kaiser_andere factions { france, normans, hre, hungary, saxons, milan, venice, turks, poland, sicily, spain, denmark, byzantium, england, russia, scotland, egypt, savoy, montferrat, timurids, urbino, lucca, }
        historic_event kaiser_papst factions { papal_states, }

        send_character_off_map Maximilian von Habsburg

        set_event_counter maxi_off 1

        terminate_monitor
    end_monitor


    monitor_event EventCounter EventCounterType maxi_off = 1

        if I_LocalFaction spain
            and DiplomaticStanceFromFaction hre = AtWar
            console_command diplomatic_stance hre spain Allied

            historic_event disput factions { spain, hre, }
            historic_event disput_andere factions { france, normans, hungary, saxons, milan, venice, turks, poland, papal_states, sicily, denmark, byzantium, england, russia, scotland, egypt, savoy, montferrat, timurids, urbino, lucca, }

        end_if

        if I_LocalFaction hre 
            and DiplomaticStanceFromFaction spain = AtWar
            console_command diplomatic_stance hre spain Allied

            historic_event disput factions { spain, hre, }
            historic_event disput_andere factions { france, normans, hungary, saxons, milan, venice, turks, poland, papal_states, sicily, denmark, byzantium, england, russia, scotland, egypt, savoy, montferrat, timurids, urbino, lucca, }

        end_if

        terminate_monitor
    end_monitor

    ;------------------------------------------------------------------------------
    ;---------------------- ...lang lebe der Kaiser! ------------------------------
    ;------------------------------------------------------------------------------

    monitor_event FactionTurnStart FactionType hre
        and I_TurnNumber = 105

        spawn_army 
            faction hre
            character	Maximilian von Habsburg, named character, age 32, x 69, y 161 
            traits Factionleader 1 , GoodCommander 2 , PublicFaith 1 , BattleChivalry 4 , ReligionStarter 1 
            unit		NE Late Bodyguard		exp 1 armour 0 weapon_lvl 0
        end

        kill_character DET_NATURAL Maximilian von Habsburg

        historic_event kaiser_tot_hre factions { hre, }
        historic_event kaiser_tot_france factions { france, }
        historic_event kaiser_tot_spain factions { spain, }
        historic_event kaiser_tot_pope factions { papal_states, }
        historic_event kaiser_tot_other factions { normans, hungary, saxons, milan, venice, turks, poland, sicily, denmark, byzantium, england, russia, scotland, egypt, savoy, montferrat, timurids, urbino, lucca, }

        set_event_counter maxi_off 0

        set_faction_standing papal_states france 1.0
        set_faction_standing france papal_states 1.0

        set_faction_standing spain hre 1.0
        set_faction_standing hre spain 1.0

        set_faction_standing papal_states hre -0.5
        set_faction_standing hre papal_states -0.5

        set_faction_standing france hre -0.5
        set_faction_standing hre france -0.5

        set_faction_standing papal_states spain -0.5
        set_faction_standing spain papal_states -0.5

        set_faction_standing france spain -0.5
        set_faction_standing spain france -0.5

        console_command diplomatic_stance hre spain Allied
        console_command diplomatic_stance france papal_states Allied

        if I_LocalFaction france 
            and DiplomaticStanceFromFaction hre = Allied
            console_command diplomatic_stance hre france neutral
        end_if

        if I_LocalFaction hre 
            and DiplomaticStanceFromFaction france = Allied
            console_command diplomatic_stance hre france neutral
        end_if

        increment_kings_purse Spain -500
        increment_kings_purse France -500
        increment_kings_purse Hre -500

        terminate_monitor
    end_monitor

    ;------------------------------------------------------------------------------

    monitor_event CharacterTurnStart AgentType = family
        and FactionType hre
        and FactionwideAncillaryExists konig_spanien
        and IsFactionHeir
        and I_EventCounter king_sp_alive = 0

        set_event_counter konig_sp_alive 1

        terminate_monitor
    end_monitor


    monitor_event CharacterTurnStart AgentType = family
        and FactionType hre
        and not FactionwideAncillaryExists konig_spanien
        and I_EventCounter konig_sp_alive = 1

        historic_event band_bruch factions { spain, hre, }
        historic_event band_bruch_andere factions { france, normans, hungary, turks, milan, venice, poland, papal_states, sicily, denmark, byzantium, england, russia, scotland, egypt, savoy, montferrat, timurids, urbino, lucca, }

        console_command diplomatic_stance hre spain neutral

        set_event_counter konig_sp_alive 0

        terminate_monitor
    end_monitor

    ;------------------------------------------------------------------------------
    ;---------------------- Krieg von 1521 - 1526 ---------------------------------
    ;------------------------------------------------------------------------------

    monitor_event FactionTurnStart I_TurnNumber = 112

        if I_LocalFaction france

            historic_event auftakt_france true factions { france, }

        end_if

        if I_LocalFaction papal_states

            historic_event auftakt_pope true factions { papal_states, }

        end_if

        if I_LocalFaction hre

            historic_event auftakt_hre true factions { hre, }

        end_if

        if I_LocalFaction venice

            historic_event auftakt_venice true factions { venice, }

        end_if

        terminate_monitor
    end_monitor

    ;------------------------------------------------------------------------------

    monitor_event FactionTurnStart FactionType spain
        and I_TurnNumber = 112
        and I_EventCounter king_sp_alive = 1
        and I_CompareCounter Spieler_ist_Spanien = 1

        historic_event auftakt_spain_konig factions { spain, }

        set_faction_standing papal_states spain 0.5
        set_faction_standing papal_states hre 0.5

        set_faction_standing papal_states france -0.5

        console_command diplomatic_stance france papal_states War
        console_command diplomatic_stance venice papal_states War
        console_command diplomatic_stance hre france War
        console_command diplomatic_stance venice hre War
        console_command diplomatic_stance venice spain War	
        console_command diplomatic_stance france spain War

        console_command diplomatic_stance france venice Allied
        console_command diplomatic_stance hre papal_states Allied
        console_command diplomatic_stance spain papal_states Allied
        console_command diplomatic_stance hre spain Allied

        terminate_monitor
    end_monitor

    ;------------------------------------------------------------------------------

    monitor_event FactionTurnStart FactionType spain
        and I_TurnNumber = 112
        and I_EventCounter king_sp_alive = 0
        and I_CompareCounter Spieler_ist_Spanien = 1

        historic_event auftakt_andere factions { spain, }

        set_faction_standing papal_states spain 0.5
        set_faction_standing papal_states hre 0.5

        set_faction_standing papal_states france -0.5

        console_command diplomatic_stance france papal_states War
        console_command diplomatic_stance venice papal_states War
        console_command diplomatic_stance hre france War
        console_command diplomatic_stance venice hre War
        console_command diplomatic_stance venice spain War	
        console_command diplomatic_stance france spain War

        console_command diplomatic_stance france venice Allied
        console_command diplomatic_stance hre papal_states Allied
        console_command diplomatic_stance spain papal_states Allied
        console_command diplomatic_stance hre spain Allied

        terminate_monitor
    end_monitor

    ;------------------------------------------------------------------------------

    monitor_event FactionTurnStart FactionIsLocal
        and I_TurnNumber = 112
        and not I_LocalFaction spain
        and not I_LocalFaction france
        and not I_LocalFaction papal_states
        and not I_LocalFaction hre
        and not I_LocalFaction venice

        historic_event auftakt_andere

        set_faction_standing papal_states spain 0.5
        set_faction_standing papal_states hre 0.5

        set_faction_standing papal_states france -0.5

        console_command diplomatic_stance france papal_states War
        console_command diplomatic_stance venice papal_states War
        console_command diplomatic_stance hre france War
        console_command diplomatic_stance venice hre War
        console_command diplomatic_stance venice spain War	
        console_command diplomatic_stance france spain War

        console_command diplomatic_stance france venice Allied
        console_command diplomatic_stance hre papal_states Allied
        console_command diplomatic_stance spain papal_states Allied
        console_command diplomatic_stance hre spain Allied

        terminate_monitor
    end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- Angenommen Frankreich ---------------------------------
    ;------------------------------------------------------------------------------

    monitor_event EventCounter EventCounterType auftakt_france_accepted = 1

        historic_event auftakt_france_ja factions { france, }

        set_faction_standing papal_states spain 0.5
        set_faction_standing papal_states hre 0.5

        set_faction_standing papal_states france -0.5

        console_command diplomatic_stance france papal_states War
        console_command diplomatic_stance venice papal_states War
        console_command diplomatic_stance hre france War
        console_command diplomatic_stance venice hre War
        console_command diplomatic_stance venice spain War	
        console_command diplomatic_stance france spain War

        console_command diplomatic_stance france venice Allied
        console_command diplomatic_stance hre papal_states Allied
        console_command diplomatic_stance spain papal_states Allied
        console_command diplomatic_stance hre spain Allied

        terminate_monitor
    end_monitor

    ;------------------------------------------------------------------------------
    ;---------------------- Abgelehnt Frankreich ----------------------------------
    ;------------------------------------------------------------------------------

    monitor_event EventCounter EventCounterType auftakt_france_declined = 1

        historic_event auftakt_france_nein factions { france, }

        set_faction_standing papal_states spain 0.5
        set_faction_standing papal_states hre 0.5

        set_faction_standing papal_states france -0.5
        set_faction_standing france papal_states -0.5
        set_faction_standing papal_states venice -0.5

        console_command diplomatic_stance france papal_states neutral

        console_command diplomatic_stance hre papal_states Allied
        console_command diplomatic_stance spain papal_states Allied
        console_command diplomatic_stance hre spain Allied


        terminate_monitor
    end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- Angenommen Papst --------------------------------------
    ;------------------------------------------------------------------------------

    monitor_event EventCounter EventCounterType auftakt_pope_accepted = 1

        historic_event auftakt_pope_ja factions { papal_states, }

        console_command diplomatic_stance hre papal_states War
        console_command diplomatic_stance spain papal_states War
        console_command diplomatic_stance hre france War
        console_command diplomatic_stance venice hre War
        console_command diplomatic_stance venice spain War	
        console_command diplomatic_stance france spain War

        console_command diplomatic_stance france venice Allied
        console_command diplomatic_stance france papal_states Allied
        console_command diplomatic_stance venice papal_states Allied
        console_command diplomatic_stance hre spain Allied


        add_settlement_turmoil Rom 70

        terminate_monitor
    end_monitor

    ;------------------------------------------------------------------------------
    ;---------------------- Abgelehnt Papst ---------------------------------------
    ;------------------------------------------------------------------------------

    monitor_event EventCounter EventCounterType auftakt_pope_declined = 1

        historic_event auftakt_pope_nein factions { papal_states, }

        set_faction_standing papal_states spain 0.5
        set_faction_standing papal_states hre 0.5

        set_faction_standing papal_states france -0.5

        console_command diplomatic_stance france papal_states War
        console_command diplomatic_stance venice papal_states War
        console_command diplomatic_stance hre france War
        console_command diplomatic_stance venice hre War
        console_command diplomatic_stance venice spain War	
        console_command diplomatic_stance france spain War

        console_command diplomatic_stance france venice Allied
        console_command diplomatic_stance hre papal_states Allied
        console_command diplomatic_stance spain papal_states Allied
        console_command diplomatic_stance hre spain Allied

        terminate_monitor
    end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- Angenommen HRE ----------------------------------------
    ;------------------------------------------------------------------------------

    monitor_event EventCounter EventCounterType auftakt_hre_accepted = 1

        historic_event auftakt_hre_ja factions { hre, }

        set_faction_standing papal_states spain 0.5
        set_faction_standing papal_states hre 0.5

        set_faction_standing papal_states france -0.5

        console_command diplomatic_stance france papal_states War
        console_command diplomatic_stance venice papal_states War
        console_command diplomatic_stance hre france War
        console_command diplomatic_stance venice hre War
        console_command diplomatic_stance venice spain War	
        console_command diplomatic_stance france spain War

        console_command diplomatic_stance france venice Allied
        console_command diplomatic_stance hre papal_states Allied
        console_command diplomatic_stance spain papal_states Allied
        console_command diplomatic_stance hre spain Allied

        spawn_character hre, Johannes, priest, age 31, x 104, y 251
        console_command give_trait "Johannes" StrongFaith 3
        console_command give_trait "Johannes" dominikaner_werden 1

        spawn_character hre, Ruprecht, priest, age 45, x 47, y 267
        console_command give_trait "Ruprecht" StrongFaith 3
        console_command give_trait "Ruprecht" dominikaner_werden 1

        spawn_character hre, Anton, priest, age 45, x 145, y 223
        console_command give_trait "Anton" StrongFaith 3
        console_command give_trait "Anton" dominikaner_werden 1

        spawn_character hre, Kaspar, priest, age 45, x 174, y 278
        console_command give_trait "Kaspar" StrongFaith 3
        console_command give_trait "Kaspar" dominikaner_werden 1

        terminate_monitor
    end_monitor

    ;------------------------------------------------------------------------------
    ;---------------------- Abgelehnt HRE -----------------------------------------
    ;------------------------------------------------------------------------------

    monitor_event EventCounter EventCounterType auftakt_hre_declined = 1

        historic_event auftakt_hre_nein factions { hre, }

        console_command diplomatic_stance hre papal_states War
        console_command diplomatic_stance spain papal_states War
        console_command diplomatic_stance hre france War
        console_command diplomatic_stance venice hre War
        console_command diplomatic_stance venice spain War	
        console_command diplomatic_stance france spain War

        console_command diplomatic_stance france venice Allied
        console_command diplomatic_stance france papal_states Allied
        console_command diplomatic_stance venice papal_states Allied
        console_command diplomatic_stance hre spain Allied

        add_settlement_turmoil Innsbruck 70
        add_settlement_turmoil Wien 70

        terminate_monitor
    end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- Angenommen Venedig ------------------------------------
    ;------------------------------------------------------------------------------

    monitor_event EventCounter EventCounterType auftakt_venice_accepted = 1

        historic_event auftakt_venice_ja factions { venice, }

        set_faction_standing papal_states spain 0.5
        set_faction_standing papal_states hre 0.5

        set_faction_standing papal_states france -0.5

        console_command diplomatic_stance france papal_states War
        console_command diplomatic_stance venice papal_states War
        console_command diplomatic_stance hre france War
        console_command diplomatic_stance venice hre War
        console_command diplomatic_stance venice spain War	
        console_command diplomatic_stance france spain War

        console_command diplomatic_stance france venice Allied
        console_command diplomatic_stance hre papal_states Allied
        console_command diplomatic_stance spain papal_states Allied
        console_command diplomatic_stance hre spain Allied

        terminate_monitor
    end_monitor

    ;------------------------------------------------------------------------------
    ;---------------------- Abgelehnt Venedig -------------------------------------
    ;------------------------------------------------------------------------------

    monitor_event EventCounter EventCounterType auftakt_venice_declined = 1

        historic_event auftakt_venice_nein factions { venice, }

        set_faction_standing papal_states spain 0.5
        set_faction_standing papal_states hre 0.5

        set_faction_standing papal_states france -0.5
        set_faction_standing venice france -0.5

        console_command diplomatic_stance france papal_states War
        console_command diplomatic_stance hre france War	
        console_command diplomatic_stance france spain War

        console_command diplomatic_stance hre papal_states Allied
        console_command diplomatic_stance spain papal_states Allied
        console_command diplomatic_stance hre spain Allied

        terminate_monitor
    end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- + Der Fall Bourbon ------------------------------------
    ;------------------------------------------------------------------------------


    ;---------------------- Frankreich

    monitor_event FactionTurnStart FactionType france
        and DiplomaticStanceFromFaction hre = AtWar
        and I_TurnNumber = 120

        historic_event bourbon_france true factions { france, }

        terminate_monitor
    end_monitor


    monitor_event EventCounter EventCounterType bourbon_france_accepted = 1

        historic_event bourbon_france_ja factions { france, }

        console_command add_money france, 10000

        increment_kings_purse france 500



        spawn_army 
            faction hre 
            character	Charles de Bourbon, named character, age 34, x 21, y 260, direction W
            traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
            unit		NE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
            unit		Imperial Knights				exp 5 armour 0 weapon_lvl 0
            unit		Imperial Knights				exp 3 armour 0 weapon_lvl 0
            unit		Hre Pike Militia				exp 4 armour 0 weapon_lvl 0
            unit		Hre Pike Militia				exp 2 armour 1 weapon_lvl 0
            unit		Hre Pike Militia				exp 4 armour 0 weapon_lvl 0
            unit		Hre Pike Militia				exp 3 armour 2 weapon_lvl 0
            unit		Hre Pike Militia				exp 3 armour 2 weapon_lvl 0
            unit		Hre Pike Militia				exp 3 armour 2 weapon_lvl 0
            unit		NE Basilisk			exp 2 armour 0 weapon_lvl 0
            unit		Pavise Crossbowmen			exp 3 armour 1 weapon_lvl 0
            unit		Pavise Crossbowmen			exp 3 armour 1 weapon_lvl 0
        end

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType bourbon_france_declined = 1

        historic_event bourbon_france_nein factions { france, }

        spawn_army 
            faction france
            character	Charles de Bourbon, named character, age 34, x 13, y 261, direction E
            traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
            unit		NE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
            unit		Lancers				exp 5 armour 0 weapon_lvl 0
            unit		Lancers				exp 3 armour 0 weapon_lvl 0
            unit		Frz Pike Militia				exp 4 armour 0 weapon_lvl 0
            unit		Frz Pike Militia				exp 2 armour 1 weapon_lvl 0
            unit		Frz Pike Militia				exp 4 armour 0 weapon_lvl 0
            unit		Partisan Militia				exp 3 armour 2 weapon_lvl 0
            unit		Partisan Militia				exp 3 armour 2 weapon_lvl 0
            unit		Partisan Militia				exp 3 armour 2 weapon_lvl 0
            unit		NE Basilisk			exp 2 armour 0 weapon_lvl 0
            unit		Arquebusiers		exp 3 armour 1 weapon_lvl 0
            unit		Arquebusiers     	exp 3 armour 1 weapon_lvl 0
        end

        terminate_monitor
    end_monitor

    ;---------------------- HRE
    monitor_event FactionTurnStart FactionType hre
        and DiplomaticStanceFromFaction france = AtWar
        and I_TurnNumber = 120

        historic_event bourbon_hre true factions { hre, }

        terminate_monitor
    end_monitor


    monitor_event EventCounter EventCounterType bourbon_france_accepted = 1

        historic_event bourbon_hre_ja factions { hre, }

        console_command add_money hre, -5000

        spawn_army 
            faction hre 
            character	Charles de Bourbon, named character, age 34, x 21, y 260, direction W
            traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
            unit		NE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
            unit		Imperial Knights				exp 5 armour 0 weapon_lvl 0
            unit		Imperial Knights				exp 3 armour 0 weapon_lvl 0
            unit		Hre Pike Militia				exp 4 armour 0 weapon_lvl 0
            unit		Hre Pike Militia				exp 2 armour 1 weapon_lvl 0
            unit		Hre Pike Militia				exp 4 armour 0 weapon_lvl 0
            unit		Hre Pike Militia				exp 3 armour 2 weapon_lvl 0
            unit		Hre Pike Militia				exp 3 armour 2 weapon_lvl 0
            unit		Hre Pike Militia				exp 3 armour 2 weapon_lvl 0
            unit		NE Basilisk			exp 2 armour 0 weapon_lvl 0
            unit		Pavise Crossbowmen			exp 3 armour 1 weapon_lvl 0
            unit		Pavise Crossbowmen			exp 3 armour 1 weapon_lvl 0
        end

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType bourbon_hre_declined = 1

        historic_event bourbon_hre_nein factions { hre, }

        spawn_army 
            faction france
            character	Charles de Bourbon, named character, age 34, x 13, y 261, direction E
            traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
            unit		NE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
            unit		Lancers				exp 5 armour 0 weapon_lvl 0
            unit		Lancers				exp 3 armour 0 weapon_lvl 0
            unit		Frz Pike Militia				exp 4 armour 0 weapon_lvl 0
            unit		Frz Pike Militia				exp 2 armour 1 weapon_lvl 0
            unit		Frz Pike Militia				exp 4 armour 0 weapon_lvl 0
            unit		Partisan Militia				exp 3 armour 2 weapon_lvl 0
            unit		Partisan Militia				exp 3 armour 2 weapon_lvl 0
            unit		Partisan Militia				exp 3 armour 2 weapon_lvl 0
            unit		NE Basilisk			exp 2 armour 0 weapon_lvl 0
            unit		Arquebusiers			exp 3 armour 1 weapon_lvl 0
            unit		Arquebusiers			exp 3 armour 1 weapon_lvl 0
        end

        terminate_monitor
    end_monitor

    ;---------------------- Andere
    monitor_event FactionTurnStart I_TurnNumber = 120
        and not I_LocalFaction hre
        and not I_LocalFaction france

        historic_event bourbon_andere factions { normans, hungary, turks, saxons, milan, venice, poland, papal_states, sicily, spain, denmark, byzantium, england, russia, scotland, egypt, savoy, montferrat, timurids, urbino, lucca, }

        console_command add_money france, 10000

        increment_kings_purse france 500

        spawn_army 
            faction hre 
            character	Charles de Bourbon, named character, age 34, x 21, y 260, direction W
            traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
            unit		NE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
            unit		Imperial Knights				exp 5 armour 0 weapon_lvl 0
            unit		Imperial Knights				exp 3 armour 0 weapon_lvl 0
            unit		Hre Pike Militia				exp 4 armour 0 weapon_lvl 0
            unit		Hre Pike Militia				exp 2 armour 1 weapon_lvl 0
            unit		Hre Pike Militia				exp 4 armour 0 weapon_lvl 0
            unit		Hre Pike Militia				exp 3 armour 2 weapon_lvl 0
            unit		Hre Pike Militia				exp 3 armour 2 weapon_lvl 0
            unit		Hre Pike Militia				exp 3 armour 2 weapon_lvl 0
            unit		NE Basilisk			exp 2 armour 0 weapon_lvl 0
            unit		Pavise Crossbowmen			exp 3 armour 1 weapon_lvl 0
            unit		Pavise Crossbowmen			exp 3 armour 1 weapon_lvl 0
        end
        terminate_monitor
    end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- + Eine ungewöhnliche Allianz --------------------------
    ;------------------------------------------------------------------------------

    ;---------------------- Frankreich

    monitor_event FactionTurnStart FactionType france
        and DiplomaticStanceFromFaction hre = AtWar
        and not DiplomaticStanceFromFaction turks = Allied
        and I_TurnNumber = 128

        historic_event ung_allianz_france true factions { france, }

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType ung_allianz_france_accepted = 1

        historic_event ung_allianz_france_ja factions { france, }

        set_faction_standing turks france 0.5
        set_faction_standing papal_states france -1.0
        set_faction_standing hre france -1.0

        console_command diplomatic_stance france turks Allied
        console_command diplomatic_stance hre turks War

        add_settlement_turmoil Lyon 40
        add_settlement_turmoil Marseille 40
        add_settlement_turmoil Dijon 40

        spawn_army 
            faction turks
            character random_name, general, age 23, x 208, y 220, direction S
            unit		Akinjis			exp 3 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
            unit		Akinjis				exp 1 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction turks
            character random_name, general, age 23, x 195, y 215, direction N
            unit		Akinjis			exp 3 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
            unit		Akinjis				exp 1 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction turks
            character random_name, general, age 23, x 181, y 196, direction W
            unit		Akinjis			exp 3 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
            unit		Akinjis				exp 1 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction turks
            character random_name, general, age 23, x 173, y 204, direction N
            unit		Akinjis			exp 3 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
            unit		Akinjis				exp 1 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction turks
            character random_name, general, age 23, x 203, y 213, direction E
            unit		Akinjis			exp 3 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
            unit		Akinjis				exp 1 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
        end


        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType ung_allianz_france_declined = 1

        historic_event ung_allianz_france_nein factions { france, }

        set_faction_standing turks france -0.5
        set_faction_standing france turks -0.5

        terminate_monitor
    end_monitor

    ;-- HRE

    monitor_event FactionTurnStart FactionType hre
        and DiplomaticStanceFromFaction france = AtWar
        and not DiplomaticStanceFromFaction turks = Allied
        and I_TurnNumber = 128

        historic_event ung_allianz_hre factions { hre, }

        set_faction_standing turks france 0.5
        set_faction_standing papal_states france -1.0
        set_faction_standing hre france -1.0

        console_command diplomatic_stance france turks Allied
        console_command diplomatic_stance hre turks War

        add_settlement_turmoil Lyon 40
        add_settlement_turmoil Marseille 40
        add_settlement_turmoil Dijon 40

        spawn_army 
            faction turks
            character random_name, general, age 23, x 208, y 220, direction S
            unit		Akinjis			exp 3 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
            unit		Akinjis				exp 1 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction turks
            character random_name, general, age 23, x 195, y 215, direction N
            unit		Akinjis			exp 3 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
            unit		Akinjis				exp 1 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction turks
            character random_name, general, age 23, x 181, y 196, direction W
            unit		Akinjis			exp 3 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
            unit		Akinjis				exp 1 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction turks
            character random_name, general, age 23, x 173, y 204, direction N
            unit		Akinjis			exp 3 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
            unit		Akinjis				exp 1 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction turks
            character random_name, general, age 23, x 203, y 213, direction E
            unit		Akinjis			exp 3 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
            unit		Akinjis				exp 1 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
        end

        terminate_monitor
    end_monitor

    ;--- Osmanen

    monitor_event FactionTurnStart FactionType turks
        and not DiplomaticStanceFromFaction france = Allied
        and I_TurnNumber = 128

        historic_event ung_allianz_turks true factions { turks, }

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType ung_allianz_turks_accepted = 1

        historic_event ung_allianz_turks_ja factions { turks, }

        set_faction_standing turks france 0.5
        set_faction_standing papal_states france -1.0
        set_faction_standing hre france -1.0

        console_command diplomatic_stance france turks Allied
        console_command diplomatic_stance hre turks War

        add_settlement_turmoil Lyon 40
        add_settlement_turmoil Marseille 40
        add_settlement_turmoil Dijon 40

        spawn_army 
            faction turks
            character random_name, general, age 23, x 208, y 220, direction S
            unit		Akinjis			exp 3 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
            unit		Akinjis				exp 1 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction turks
            character random_name, general, age 23, x 195, y 215, direction N
            unit		Akinjis			exp 3 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
            unit		Akinjis				exp 1 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction turks
            character random_name, general, age 23, x 181, y 196, direction W
            unit		Akinjis			exp 3 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
            unit		Akinjis				exp 1 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction turks
            character random_name, general, age 23, x 173, y 204, direction N
            unit		Akinjis			exp 3 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
            unit		Akinjis				exp 1 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction turks
            character random_name, general, age 23, x 203, y 213, direction E
            unit		Akinjis			exp 3 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
            unit		Akinjis				exp 1 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
        end


        terminate_monitor
    end_monitor


    monitor_event EventCounter EventCounterType ung_allianz_turks_declined = 1

        historic_event ung_allianz_turks_nein factions { turks, }

        set_faction_standing turks france -0.5
        set_faction_standing france turks -0.5

        terminate_monitor
    end_monitor

    ;-- Alle

    monitor_event FactionTurnStart I_TurnNumber = 128
        and not I_LocalFaction turks
        and not I_LocalFaction hre
        and not I_LocalFaction france

        historic_event ung_allianz_all

        set_faction_standing turks france 0.5
        set_faction_standing papal_states france -1.0
        set_faction_standing hre france -1.0

        console_command diplomatic_stance france turks Allied
        console_command diplomatic_stance hre turks War

        add_settlement_turmoil Lyon 40
        add_settlement_turmoil Marseille 40
        add_settlement_turmoil Dijon 40

        spawn_army 
            faction turks
            character random_name, general, age 23, x 208, y 220, direction S
            unit		Akinjis			exp 3 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
            unit		Akinjis				exp 1 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction turks
            character random_name, general, age 23, x 195, y 215, direction N
            unit		Akinjis			exp 3 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
            unit		Akinjis				exp 1 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction turks
            character random_name, general, age 23, x 181, y 196, direction W
            unit		Akinjis			exp 3 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
            unit		Akinjis				exp 1 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction turks
            character random_name, general, age 23, x 173, y 204, direction N
            unit		Akinjis			exp 3 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
            unit		Akinjis				exp 1 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction turks
            character random_name, general, age 23, x 203, y 213, direction E
            unit		Akinjis			exp 3 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
            unit		Akinjis				exp 1 armour 0 weapon_lvl 0
            unit		Akinjis				exp 2 armour 0 weapon_lvl 0
        end

        terminate_monitor
    end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- + Der Vertrag von Madrid ------------------------------
    ;------------------------------------------------------------------------------

    ;---------------------- Frankreich

    monitor_event FactionTurnStart FactionType france
        and DiplomaticStanceFromFaction hre = AtWar
        and I_TurnNumber = 135

        historic_event madrid_france true factions { france, }

        terminate_monitor
    end_monitor

    ;---------------------- Venedig

    monitor_event FactionTurnStart FactionType venice
        and DiplomaticStanceFromFaction hre = AtWar
        and I_TurnNumber = 135

        historic_event madrid_france true factions { venice, }

        terminate_monitor
    end_monitor

    ;---------------------- Angenommen Venedig / Frankreich

    monitor_event EventCounter EventCounterType madrid_france_accepted = 1

        historic_event madrid_france_ja factions { venice, france, }

        console_command diplomatic_stance hre france neutral
        console_command diplomatic_stance hre venice neutral
        console_command diplomatic_stance papal_states france neutral
        console_command diplomatic_stance papal_states venice neutral
        console_command diplomatic_stance spain france neutral
        console_command diplomatic_stance spain venice neutral

        terminate_monitor
    end_monitor

    ;---------------------- Abgelehnt Venedig / Frankreich

    monitor_event EventCounter EventCounterType madrid_france_declined = 1
        and I_LocalFaction venice

        historic_event madrid_france_nein factions { venice, }

        console_command diplomatic_stance hre france neutral
        console_command diplomatic_stance papal_states france neutral
        console_command diplomatic_stance spain france neutral

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType madrid_france_declined = 1
        and I_LocalFaction france

        historic_event madrid_france_nein factions { france, }

        console_command diplomatic_stance hre venice neutral
        console_command diplomatic_stance papal_states venice neutral
        console_command diplomatic_stance spain venice neutral

        terminate_monitor
    end_monitor

    ;---------------------- HRE

    monitor_event FactionTurnStart FactionType hre
        and DiplomaticStanceFromFaction france = AtWar
        and I_TurnNumber = 135

        historic_event madrid_hre true factions { hre, }

        terminate_monitor
    end_monitor

    ;---------------------- Papst

    monitor_event FactionTurnStart FactionType papal_states
        and DiplomaticStanceFromFaction france = AtWar
        and I_TurnNumber = 135

        historic_event madrid_hre true factions { papal_states, }

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType madrid_france_accepted = 1

        historic_event madrid_hre_ja factions { hre, papal_states, }

        console_command diplomatic_stance hre france neutral
        console_command diplomatic_stance hre venice neutral
        console_command diplomatic_stance papal_states france neutral
        console_command diplomatic_stance papal_states venice neutral
        console_command diplomatic_stance spain france neutral
        console_command diplomatic_stance spain venice neutral

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType madrid_hre_declined = 1
        and I_LocalFaction hre

        historic_event madrid_hre_nein factions { hre, }

        console_command diplomatic_stance papal_states venice neutral
        console_command diplomatic_stance papal_states france neutral
        console_command diplomatic_stance spain france neutral
        console_command diplomatic_stance spain venice neutral


        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType madrid_hre_declined = 1
        and I_LocalFaction papal_states

        historic_event madrid_hre_nein factions { papal_states, }

        console_command diplomatic_stance hre venice neutral
        console_command diplomatic_stance hre france neutral
        console_command diplomatic_stance spain france neutral
        console_command diplomatic_stance spain venice neutral

        terminate_monitor
    end_monitor

    ;---------------------- Spanien I

    monitor_event FactionTurnStart FactionType spain
        and I_TurnNumber = 135
        and FactionwideAncillaryExists konig_spanien

        historic_event madrid_spain factions { spain, }

        console_command diplomatic_stance hre france neutral
        console_command diplomatic_stance hre venice neutral
        console_command diplomatic_stance papal_states france neutral
        console_command diplomatic_stance papal_states venice neutral
        console_command diplomatic_stance spain france neutral
        console_command diplomatic_stance spain venice neutral

        terminate_monitor
    end_monitor

    ;---------------------- Spanien II

    monitor_event FactionTurnStart FactionType spain
        and I_TurnNumber = 135
        and not FactionwideAncillaryExists konig_spanien

        historic_event madrid_andere factions { spain, }

        console_command diplomatic_stance hre france neutral
        console_command diplomatic_stance hre venice neutral
        console_command diplomatic_stance papal_states france neutral
        console_command diplomatic_stance papal_states venice neutral
        console_command diplomatic_stance spain france neutral
        console_command diplomatic_stance spain venice neutral

        terminate_monitor
    end_monitor

    ;---------------------- Andere 

    monitor_event FactionTurnStart I_TurnNumber = 135
        and not I_LocalFaction hre
        and not I_LocalFaction france
        and not I_LocalFaction papal_states
        and not I_LocalFaction venice
        and not I_LocalFaction spain

        historic_event madrid_andere factions { normans, hungary, turks, saxons, milan, poland, sicily, denmark, byzantium, england, russia, scotland, egypt, savoy, montferrat, timurids, urbino, lucca, }

        console_command diplomatic_stance hre france neutral
        console_command diplomatic_stance hre venice neutral
        console_command diplomatic_stance papal_states france neutral
        console_command diplomatic_stance papal_states venice neutral
        console_command diplomatic_stance spain france neutral
        console_command diplomatic_stance spain venice neutral

        terminate_monitor
    end_monitor



	;------------------------------------------------------------------------------
	;---------------------- Heilige Liga ------------------------------------------
	;------------------------------------------------------------------------------
	declare_counter heilige_liga	;Besteht die Heilige Liga

	monitor_event FactionTurnStart I_TurnNumber = 68
		and I_SettlementOwner Asti = france

		if I_LocalFaction france
			historic_event heilige_liga_france

			set_counter heilige_liga 1

			;---------------------- Beziehungen zur Liga

			set_faction_standing venice france -1.0

			set_faction_standing milan france -1.0

			set_faction_standing papal_states france -1.0

			set_faction_standing spain france -1.0

			set_faction_standing hre france -1.0

			set_faction_standing poland france -1.0

			set_faction_standing france england 1.0

			set_faction_standing papal_states england -1.0


			console_command diplomatic_stance france milan War
			console_command diplomatic_stance france venice War
			console_command diplomatic_stance france papal_states War
			console_command diplomatic_stance france spain War
			console_command diplomatic_stance france hre War
			console_command diplomatic_stance france poland War

			console_command diplomatic_stance england milan War
			console_command diplomatic_stance england venice War
			console_command diplomatic_stance england papal_states War
			console_command diplomatic_stance england spain War
			console_command diplomatic_stance england hre War
			console_command diplomatic_stance england poland War

			console_command diplomatic_stance venice milan Allied
			console_command diplomatic_stance venice papal_states Allied
			console_command diplomatic_stance venice spain Allied
			console_command diplomatic_stance venice hre Allied
			console_command diplomatic_stance venice poland Allied

			console_command diplomatic_stance milan papal_states Allied
			console_command diplomatic_stance milan spain Allied
			console_command diplomatic_stance milan hre Allied
			console_command diplomatic_stance milan poland Allied

			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states poland Allied

			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance spain poland Allied

			console_command diplomatic_stance hre poland Allied

			spawn_army 
				faction france
				character	random_name, named character, age 32, x 92, y 196, direction E
				traits soeldner 1 , ReligionStarter 1 
				unit		SE Late Bodyguard		exp 1 armour 0 weapon_lvl 0
				unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
				unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
				unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Fer Arquebusiers			exp 2 armour 2 weapon_lvl 0
				unit		Fer Arquebusiers			exp 1 armour 0 weapon_lvl 0
				unit		Fer Arquebusiers			exp 1 armour 0 weapon_lvl 0
				unit		Fer Arquebusiers			exp 1 armour 0 weapon_lvl 0
			end

		end_if

		if I_LocalFaction papal_states
			historic_event heilige_liga_papal_states true factions { papal_states, }
		end_if

		if I_LocalFaction venice

			historic_event heilige_liga_mitglieder true factions { venice, milan, poland, spain, hre, }
		end_if

		if I_LocalFaction milan

			historic_event heilige_liga_mitglieder true factions { venice, milan, poland, spain, hre, }
		end_if

		if I_LocalFaction poland

			historic_event heilige_liga_mitglieder true factions { venice, milan, poland, spain, hre, }
		end_if

		if I_LocalFaction spain

			historic_event heilige_liga_mitglieder true factions { venice, milan, poland, spain, hre, }
		end_if

		if I_LocalFaction hre

			historic_event heilige_liga_mitglieder true factions { venice, milan, poland, spain, hre, }
		end_if

		if not I_LocalFaction france
		and not I_LocalFaction papal_states
		and not I_LocalFaction venice
		and not I_LocalFaction milan
		and not I_LocalFaction poland
		and not I_LocalFaction spain
		and not I_LocalFaction hre


			historic_event heilige_liga_andere

			set_counter heilige_liga 1

			;---------------------- Beziehungen zur Liga

			set_faction_standing venice france -1.0

			set_faction_standing milan france -1.0

			set_faction_standing papal_states france -1.0

			set_faction_standing spain france -1.0

			set_faction_standing hre france -1.0

			set_faction_standing poland france -1.0

			set_faction_standing france england 1.0
			
			set_faction_standing papal_states england -1.0

			console_command diplomatic_stance france milan War
			console_command diplomatic_stance france venice War
			console_command diplomatic_stance france papal_states War
			console_command diplomatic_stance france spain War
			console_command diplomatic_stance france hre War
			console_command diplomatic_stance france poland War

			console_command diplomatic_stance england milan War
			console_command diplomatic_stance england venice War
			console_command diplomatic_stance england papal_states War
			console_command diplomatic_stance england spain War
			console_command diplomatic_stance england hre War
			console_command diplomatic_stance england poland War

			console_command diplomatic_stance venice milan Allied
			console_command diplomatic_stance venice papal_states Allied
			console_command diplomatic_stance venice spain Allied
			console_command diplomatic_stance venice hre Allied
			console_command diplomatic_stance venice poland Allied

			console_command diplomatic_stance milan papal_states Allied
			console_command diplomatic_stance milan spain Allied
			console_command diplomatic_stance milan hre Allied
			console_command diplomatic_stance milan poland Allied

			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states poland Allied

			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance spain poland Allied

			console_command diplomatic_stance hre poland Allied

			spawn_army 
				faction france
				character	random_name, named character, age 32, x 92, y 196, direction E
				traits soeldner 1 , ReligionStarter 1 
				unit		SE Late Bodyguard		exp 1 armour 0 weapon_lvl 0
				unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
				unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
				unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Fer Arquebusiers			exp 2 armour 2 weapon_lvl 0
				unit		Fer Arquebusiers			exp 1 armour 0 weapon_lvl 0
				unit		Fer Arquebusiers			exp 1 armour 0 weapon_lvl 0
				unit		Fer Arquebusiers			exp 1 armour 0 weapon_lvl 0
			end

		end_if

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Angenommen papst --------------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType heilige_liga_papal_states_accepted

		set_counter heilige_liga 1

		console_command add_money papal_states, -3000

		generate_random_counter liga 1 2

		if I_EventCounter liga = 1

			;---------------------- Beziehungen zur Liga

			set_faction_standing venice france -1.0

			set_faction_standing milan france -1.0

			set_faction_standing papal_states france -1.0

			set_faction_standing spain france -1.0

			set_faction_standing hre france -1.0

			set_faction_standing poland france -1.0

			set_faction_standing france england 1.0
			
			set_faction_standing papal_states england -1.0

			console_command diplomatic_stance france milan War
			console_command diplomatic_stance france venice War
			console_command diplomatic_stance france papal_states War
			console_command diplomatic_stance france spain War
			console_command diplomatic_stance france hre War
			console_command diplomatic_stance france poland War

			console_command diplomatic_stance england milan War
			console_command diplomatic_stance england venice War
			console_command diplomatic_stance england papal_states War
			console_command diplomatic_stance england spain War
			console_command diplomatic_stance england hre War
			console_command diplomatic_stance england poland War

			console_command diplomatic_stance venice milan Allied
			console_command diplomatic_stance venice papal_states Allied
			console_command diplomatic_stance venice spain Allied
			console_command diplomatic_stance venice hre Allied
			console_command diplomatic_stance venice poland Allied

			console_command diplomatic_stance milan papal_states Allied
			console_command diplomatic_stance milan spain Allied
			console_command diplomatic_stance milan hre Allied
			console_command diplomatic_stance milan poland Allied

			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states poland Allied

			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance spain poland Allied

			console_command diplomatic_stance hre poland Allied

			spawn_army 
				faction france
				character	random_name, named character, age 32, x 92, y 196, direction E
				traits soeldner 1 , ReligionStarter 1 
				unit		SE Late Bodyguard		exp 1 armour 0 weapon_lvl 0
				unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
				unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
				unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Fer Arquebusiers			exp 2 armour 2 weapon_lvl 0
				unit		Fer Arquebusiers			exp 1 armour 0 weapon_lvl 0
				unit		Fer Arquebusiers			exp 1 armour 0 weapon_lvl 0
				unit		Fer Arquebusiers			exp 1 armour 0 weapon_lvl 0
			end


		end_if

		if I_EventCounter liga = 2

			set_counter heilige_liga 7

			historic_event verrat_florenz true factions { papal_states, }

			;---------------------- Beziehungen zur Liga

			set_faction_standing venice france -1.0

			set_faction_standing milan france -1.0

			set_faction_standing papal_states france -1.0

			set_faction_standing spain france -1.0

			set_faction_standing hre france -1.0

			set_faction_standing france england 1.0
			
			set_faction_standing papal_states england -1.0

			console_command diplomatic_stance france milan War
			console_command diplomatic_stance france venice War
			console_command diplomatic_stance france papal_states War
			console_command diplomatic_stance france spain War
			console_command diplomatic_stance france hre War

			console_command diplomatic_stance england milan War
			console_command diplomatic_stance england venice War
			console_command diplomatic_stance england papal_states War
			console_command diplomatic_stance england spain War
			console_command diplomatic_stance england hre War

			console_command diplomatic_stance venice milan Allied
			console_command diplomatic_stance venice papal_states Allied
			console_command diplomatic_stance venice spain Allied
			console_command diplomatic_stance venice hre Allied

			console_command diplomatic_stance milan papal_states Allied
			console_command diplomatic_stance milan spain Allied
			console_command diplomatic_stance milan hre Allied

			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance papal_states hre Allied

			console_command diplomatic_stance spain hre Allied

			spawn_army 
				faction france
				character	random_name, named character, age 32, x 92, y 196, direction E
				traits soeldner 1 , ReligionStarter 1 
				unit		SE Late Bodyguard		exp 1 armour 0 weapon_lvl 0
				unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
				unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
				unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Fer Arquebusiers			exp 2 armour 2 weapon_lvl 0
				unit		Fer Arquebusiers			exp 1 armour 0 weapon_lvl 0
				unit		Fer Arquebusiers			exp 1 armour 0 weapon_lvl 0
				unit		Fer Arquebusiers			exp 1 armour 0 weapon_lvl 0
			end

		end_if

		terminate_monitor
	end_monitor

	;---------------------- Papst angenommen Florenz-Krieg

	monitor_event EventCounter EventCounterType verrat_florenz_accepted

		set_faction_standing papal_states poland -1.0
		set_faction_standing poland papal_states -1.0

		console_command diplomatic_stance papal_states poland War

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Angenommen Mitglieder ---------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType heilige_liga_mitglieder_accepted

		set_counter heilige_liga 1

		;--- Beziehungen zur Liga
			set_faction_standing venice france -1.0

			set_faction_standing milan france -1.0

			set_faction_standing papal_states france -1.0

			set_faction_standing spain france -1.0

			set_faction_standing hre france -1.0

			set_faction_standing poland france -1.0

			set_faction_standing france england 1.0
			
			set_faction_standing papal_states england -1.0

			console_command diplomatic_stance france milan War
			console_command diplomatic_stance france venice War
			console_command diplomatic_stance france papal_states War
			console_command diplomatic_stance france spain War
			console_command diplomatic_stance france hre War
			console_command diplomatic_stance france poland War

			console_command diplomatic_stance england milan War
			console_command diplomatic_stance england venice War
			console_command diplomatic_stance england papal_states War
			console_command diplomatic_stance england spain War
			console_command diplomatic_stance england hre War
			console_command diplomatic_stance england poland War

			console_command diplomatic_stance venice milan Allied
			console_command diplomatic_stance venice papal_states Allied
			console_command diplomatic_stance venice spain Allied
			console_command diplomatic_stance venice hre Allied
			console_command diplomatic_stance venice poland Allied

			console_command diplomatic_stance milan papal_states Allied
			console_command diplomatic_stance milan spain Allied
			console_command diplomatic_stance milan hre Allied
			console_command diplomatic_stance milan poland Allied

			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states poland Allied

			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance spain poland Allied

			console_command diplomatic_stance hre poland Allied

			spawn_army 
				faction france
				character	random_name, named character, age 32, x 92, y 196, direction E
				traits soeldner 1 , ReligionStarter 1 
				unit		SE Late Bodyguard		exp 1 armour 0 weapon_lvl 0
				unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
				unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
				unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Fer Arquebusiers			exp 2 armour 2 weapon_lvl 0
				unit		Fer Arquebusiers			exp 1 armour 0 weapon_lvl 0
				unit		Fer Arquebusiers			exp 1 armour 0 weapon_lvl 0
				unit		Fer Arquebusiers			exp 1 armour 0 weapon_lvl 0
			end

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Abgelehnt Mitglieder ----------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType heilige_liga_mitglieder_declined

			spawn_army 
				faction france
				character	random_name, named character, age 32, x 92, y 196, direction E
				traits soeldner 1 , ReligionStarter 1 
				unit		SE Late Bodyguard		exp 1 armour 0 weapon_lvl 0
				unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
				unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
				unit		Fer Knights			exp 3 armour 0 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Ferrareser Hellebardiere			exp 2 armour 2 weapon_lvl 0
				unit		Fer Arquebusiers			exp 2 armour 2 weapon_lvl 0
				unit		Fer Arquebusiers			exp 1 armour 0 weapon_lvl 0
				unit		Fer Arquebusiers			exp 1 armour 0 weapon_lvl 0
				unit		Fer Arquebusiers			exp 1 armour 0 weapon_lvl 0
			end

		;------------------------------------------------------------------------------
		;---------------------- Venedig -----------------------------------------------
		;------------------------------------------------------------------------------

		if I_LocalFaction venice

			set_counter heilige_liga 2

			;---------------------- Beziehungen zur Liga

			set_faction_standing papal_states venice -1.0

			set_faction_standing milan france -1.0

			set_faction_standing papal_states france -1.0

			set_faction_standing spain france -1.0

			set_faction_standing hre france -1.0

			set_faction_standing poland france -1.0

			set_faction_standing papal_states england -1.0

			console_command diplomatic_stance france milan War
			console_command diplomatic_stance france papal_states War
			console_command diplomatic_stance france spain War
			console_command diplomatic_stance france hre War
			console_command diplomatic_stance france poland War

			console_command diplomatic_stance england milan War
			console_command diplomatic_stance england papal_states War
			console_command diplomatic_stance england spain War
			console_command diplomatic_stance england hre War
			console_command diplomatic_stance england poland War

			console_command diplomatic_stance milan papal_states Allied
			console_command diplomatic_stance milan spain Allied
			console_command diplomatic_stance milan hre Allied
			console_command diplomatic_stance milan poland Allied

			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states poland Allied

			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance spain poland Allied

			console_command diplomatic_stance hre poland Allied
		end_if

		;------------------------------------------------------------------------------
		;---------------------- Mailand -----------------------------------------------
		;------------------------------------------------------------------------------

		if I_LocalFaction milan

			set_counter heilige_liga 3

			;---------------------- Beziehungen zur Liga

			set_faction_standing venice france -1.0

			set_faction_standing papal_states milan -1.0

			set_faction_standing papal_states france -1.0

			set_faction_standing spain france -1.0

			set_faction_standing hre france -1.0

			set_faction_standing poland france -1.0

			set_faction_standing france england 1.0
			
			set_faction_standing papal_states england -1.0

			console_command diplomatic_stance france venice War
			console_command diplomatic_stance france papal_states War
			console_command diplomatic_stance france spain War
			console_command diplomatic_stance france hre War
			console_command diplomatic_stance france poland War

			console_command diplomatic_stance england venice War
			console_command diplomatic_stance england papal_states War
			console_command diplomatic_stance england spain War
			console_command diplomatic_stance england hre War
			console_command diplomatic_stance england poland War

			console_command diplomatic_stance venice papal_states Allied
			console_command diplomatic_stance venice spain Allied
			console_command diplomatic_stance venice hre Allied
			console_command diplomatic_stance venice poland Allied

			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states poland Allied

			console_command diplomatic_stance spain hre Allied
			console_command diplomatic_stance spain poland Allied

			console_command diplomatic_stance hre poland Allied

		end_if


		;------------------------------------------------------------------------------
		;---------------------- HRR ---------------------------------------------------
		;------------------------------------------------------------------------------

		if I_LocalFaction hre

			set_counter heilige_liga 4

			;---------------------- Beziehungen zur Liga

			set_faction_standing venice france -1.0

			set_faction_standing milan france -1.0

			set_faction_standing papal_states france -1.0

			set_faction_standing spain france -1.0

			set_faction_standing papal_states hre -1.0

			set_faction_standing poland france -1.0


			set_faction_standing france england 1.0
			
			set_faction_standing papal_states england -1.0

			console_command diplomatic_stance france milan War
			console_command diplomatic_stance france venice War
			console_command diplomatic_stance france papal_states War
			console_command diplomatic_stance france spain War
			console_command diplomatic_stance france poland War

			console_command diplomatic_stance england milan War
			console_command diplomatic_stance england venice War
			console_command diplomatic_stance england papal_states War
			console_command diplomatic_stance england spain War
			console_command diplomatic_stance england poland War

			console_command diplomatic_stance venice milan Allied
			console_command diplomatic_stance venice papal_states Allied
			console_command diplomatic_stance venice spain Allied
			console_command diplomatic_stance venice poland Allied

			console_command diplomatic_stance milan papal_states Allied
			console_command diplomatic_stance milan spain Allied
			console_command diplomatic_stance milan poland Allied

			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance papal_states poland Allied

			console_command diplomatic_stance spain poland Allied

		end_if

		;------------------------------------------------------------------------------
		;---------------------- Florenz -----------------------------------------------
		;------------------------------------------------------------------------------

		if I_LocalFaction poland

			set_counter heilige_liga 5

			generate_random_counter verrater 1 2

			if I_EventCounter verrater = 1

				;---------------------- Beziehungen zur Liga
				set_faction_standing venice france -1.0

				set_faction_standing milan france -1.0

				set_faction_standing papal_states france -1.0

				set_faction_standing spain france -1.0

				set_faction_standing hre france -1.0

				set_faction_standing papal_states poland -1.0

			set_faction_standing france england 1.0
			
			set_faction_standing papal_states england -1.0

			console_command diplomatic_stance france milan War
			console_command diplomatic_stance france venice War
			console_command diplomatic_stance france papal_states War
			console_command diplomatic_stance france spain War
			console_command diplomatic_stance france hre War

			console_command diplomatic_stance england milan War
			console_command diplomatic_stance england venice War
			console_command diplomatic_stance england papal_states War
			console_command diplomatic_stance england spain War
			console_command diplomatic_stance england hre War

			console_command diplomatic_stance venice milan Allied
			console_command diplomatic_stance venice papal_states Allied
			console_command diplomatic_stance venice spain Allied
			console_command diplomatic_stance venice hre Allied

			console_command diplomatic_stance milan papal_states Allied
			console_command diplomatic_stance milan spain Allied
			console_command diplomatic_stance milan hre Allied

			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance papal_states hre Allied

			console_command diplomatic_stance spain hre Allied

			end_if

			if I_EventCounter verrater = 2

				historic_event verrat_papst factions { poland, }

				;---------------------- Beziehungen zur Liga

				set_faction_standing venice france -1.0

				set_faction_standing milan france -1.0

				set_faction_standing papal_states france -1.0

				set_faction_standing spain france -1.0

				set_faction_standing hre france -1.0

				set_faction_standing papal_states poland -1.0

			set_faction_standing france england 1.0
			
			set_faction_standing papal_states england -1.0

			console_command diplomatic_stance france milan War
			console_command diplomatic_stance france venice War
			console_command diplomatic_stance france papal_states War
			console_command diplomatic_stance france spain War
			console_command diplomatic_stance france hre War

			console_command diplomatic_stance england milan War
			console_command diplomatic_stance england venice War
			console_command diplomatic_stance england papal_states War
			console_command diplomatic_stance england spain War
			console_command diplomatic_stance england hre War

			console_command diplomatic_stance papal_states poland War

			console_command diplomatic_stance venice milan Allied
			console_command diplomatic_stance venice papal_states Allied
			console_command diplomatic_stance venice spain Allied
			console_command diplomatic_stance venice hre Allied

			console_command diplomatic_stance milan papal_states Allied
			console_command diplomatic_stance milan spain Allied
			console_command diplomatic_stance milan hre Allied

			console_command diplomatic_stance papal_states spain Allied
			console_command diplomatic_stance papal_states hre Allied

			console_command diplomatic_stance spain hre Allied

			end_if

		end_if


		;------------------------------------------------------------------------------
		;---------------------- Spanien -----------------------------------------------
		;------------------------------------------------------------------------------

		if I_LocalFaction spain

			set_counter heilige_liga 6

			;---------------------- Beziehungen zur Liga

			set_faction_standing venice france -1.0

			set_faction_standing milan france -1.0

			set_faction_standing papal_states france -1.0

			set_faction_standing papal_states spain -1.0

			set_faction_standing hre france -1.0

			set_faction_standing poland france -1.0

			set_faction_standing france england 1.0
			
			set_faction_standing papal_states england -1.0

			console_command diplomatic_stance france milan War
			console_command diplomatic_stance france venice War
			console_command diplomatic_stance france papal_states War
			console_command diplomatic_stance france hre War
			console_command diplomatic_stance france poland War

			console_command diplomatic_stance england milan War
			console_command diplomatic_stance england venice War
			console_command diplomatic_stance england papal_states War
			console_command diplomatic_stance england hre War
			console_command diplomatic_stance england poland War

			console_command diplomatic_stance venice milan Allied
			console_command diplomatic_stance venice papal_states Allied
			console_command diplomatic_stance venice hre Allied
			console_command diplomatic_stance venice poland Allied

			console_command diplomatic_stance milan papal_states Allied
			console_command diplomatic_stance milan hre Allied
			console_command diplomatic_stance milan poland Allied

			console_command diplomatic_stance papal_states hre Allied
			console_command diplomatic_stance papal_states poland Allied

			console_command diplomatic_stance hre poland Allied
		end_if

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Ende einer Liga ---------------------------------------
	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart I_TurnNumber = 92

		if I_LocalFaction papal_states
			and DiplomaticStanceFromFaction hre = Allied
			and DiplomaticStanceFromFaction spain = Allied
			and DiplomaticStanceFromFaction milan = Allied
			and I_CompareCounter heilige_liga = 1

			console_command diplomatic_stance venice milan neutral
			console_command diplomatic_stance venice papal_states neutral
			console_command diplomatic_stance venice spain neutral
			console_command diplomatic_stance venice hre neutral
			console_command diplomatic_stance venice poland neutral

			console_command diplomatic_stance milan papal_states neutral
			console_command diplomatic_stance milan spain neutral
			console_command diplomatic_stance milan hre neutral
			console_command diplomatic_stance milan poland neutral

			console_command diplomatic_stance papal_states spain neutral
			console_command diplomatic_stance papal_states hre neutral
			console_command diplomatic_stance papal_states poland neutral

			console_command diplomatic_stance spain hre neutral
			console_command diplomatic_stance spain poland neutral

			console_command diplomatic_stance hre poland neutral

			historic_event holy_league_disband factions { papal_states, }

		end_if

		if I_LocalFaction hre
			and DiplomaticStanceFromFaction papal_states = Allied
			and DiplomaticStanceFromFaction spain = Allied
			and DiplomaticStanceFromFaction milan = Allied
			and I_CompareCounter heilige_liga = 1

			console_command diplomatic_stance venice milan neutral
			console_command diplomatic_stance venice papal_states neutral
			console_command diplomatic_stance venice spain neutral
			console_command diplomatic_stance venice hre neutral
			console_command diplomatic_stance venice poland neutral

			console_command diplomatic_stance milan papal_states neutral
			console_command diplomatic_stance milan spain neutral
			console_command diplomatic_stance milan hre neutral
			console_command diplomatic_stance milan poland neutral

			console_command diplomatic_stance papal_states spain neutral
			console_command diplomatic_stance papal_states hre neutral
			console_command diplomatic_stance papal_states poland neutral

			console_command diplomatic_stance spain hre neutral
			console_command diplomatic_stance spain poland neutral

			console_command diplomatic_stance hre poland neutral

			historic_event holy_league_disband factions { hre, }

		end_if

		if I_LocalFaction spain
			and DiplomaticStanceFromFaction papal_states = Allied
			and DiplomaticStanceFromFaction hre = Allied
			and DiplomaticStanceFromFaction milan = Allied
			and I_CompareCounter heilige_liga = 1

			console_command diplomatic_stance venice milan neutral
			console_command diplomatic_stance venice papal_states neutral
			console_command diplomatic_stance venice spain neutral
			console_command diplomatic_stance venice hre neutral
			console_command diplomatic_stance venice poland neutral

			console_command diplomatic_stance milan papal_states neutral
			console_command diplomatic_stance milan spain neutral
			console_command diplomatic_stance milan hre neutral
			console_command diplomatic_stance milan poland neutral

			console_command diplomatic_stance papal_states spain neutral
			console_command diplomatic_stance papal_states hre neutral
			console_command diplomatic_stance papal_states poland neutral

			console_command diplomatic_stance spain hre neutral
			console_command diplomatic_stance spain poland neutral

			console_command diplomatic_stance hre poland neutral

			historic_event holy_league_disband factions { spain, }

		end_if

		if I_LocalFaction milan
			and DiplomaticStanceFromFaction papal_states = Allied
			and DiplomaticStanceFromFaction spain = Allied
			and DiplomaticStanceFromFaction hre = Allied
			and I_CompareCounter heilige_liga = 1

			console_command diplomatic_stance venice milan neutral
			console_command diplomatic_stance venice papal_states neutral
			console_command diplomatic_stance venice spain neutral
			console_command diplomatic_stance venice hre neutral
			console_command diplomatic_stance venice poland neutral

			console_command diplomatic_stance milan papal_states neutral
			console_command diplomatic_stance milan spain neutral
			console_command diplomatic_stance milan hre neutral
			console_command diplomatic_stance milan poland neutral

			console_command diplomatic_stance papal_states spain neutral
			console_command diplomatic_stance papal_states hre neutral
			console_command diplomatic_stance papal_states poland neutral

			console_command diplomatic_stance spain hre neutral
			console_command diplomatic_stance spain poland neutral

			console_command diplomatic_stance hre poland neutral

			historic_event holy_league_disband factions { milan, }

		end_if

		if I_LocalFaction poland
			and DiplomaticStanceFromFaction papal_states = Allied
			and DiplomaticStanceFromFaction spain = Allied
			and DiplomaticStanceFromFaction hre = Allied
			and DiplomaticStanceFromFaction milan = Allied
			and I_CompareCounter heilige_liga = 1

			console_command diplomatic_stance venice milan neutral
			console_command diplomatic_stance venice papal_states neutral
			console_command diplomatic_stance venice spain neutral
			console_command diplomatic_stance venice hre neutral
			console_command diplomatic_stance venice poland neutral

			console_command diplomatic_stance milan papal_states neutral
			console_command diplomatic_stance milan spain neutral
			console_command diplomatic_stance milan hre neutral
			console_command diplomatic_stance milan poland neutral

			console_command diplomatic_stance papal_states spain neutral
			console_command diplomatic_stance papal_states hre neutral
			console_command diplomatic_stance papal_states poland neutral

			console_command diplomatic_stance spain hre neutral
			console_command diplomatic_stance spain poland neutral

			console_command diplomatic_stance hre poland neutral

			historic_event holy_league_disband factions { poland, }

		end_if
		;------------------------------------------------------------------------------
		;------- Abgelehnt

		if I_CompareCounter heilige_liga = 2

			console_command diplomatic_stance milan papal_states neutral
			console_command diplomatic_stance milan spain neutral
			console_command diplomatic_stance milan hre neutral
			console_command diplomatic_stance milan poland neutral

			console_command diplomatic_stance papal_states spain neutral
			console_command diplomatic_stance papal_states hre neutral
			console_command diplomatic_stance papal_states poland neutral

			console_command diplomatic_stance spain hre neutral
			console_command diplomatic_stance spain poland neutral

			console_command diplomatic_stance hre poland neutral

			historic_event holy_league_disband factions { venice, }

		end_if

		if I_CompareCounter heilige_liga = 3

			console_command diplomatic_stance venice papal_states neutral
			console_command diplomatic_stance venice spain neutral
			console_command diplomatic_stance venice hre neutral
			console_command diplomatic_stance venice poland neutral

			console_command diplomatic_stance papal_states spain neutral
			console_command diplomatic_stance papal_states hre neutral
			console_command diplomatic_stance papal_states poland neutral

			console_command diplomatic_stance spain hre neutral
			console_command diplomatic_stance spain poland neutral

			console_command diplomatic_stance hre poland neutral

			historic_event holy_league_disband factions { milan, }

		end_if

		if I_CompareCounter heilige_liga = 4

			console_command diplomatic_stance venice milan neutral
			console_command diplomatic_stance venice papal_states neutral
			console_command diplomatic_stance venice spain neutral
			console_command diplomatic_stance venice poland neutral

			console_command diplomatic_stance milan papal_states neutral
			console_command diplomatic_stance milan spain neutral
			console_command diplomatic_stance milan poland neutral

			console_command diplomatic_stance papal_states spain neutral
			console_command diplomatic_stance papal_states poland neutral

			console_command diplomatic_stance spain poland neutral

			historic_event holy_league_disband factions { hre, }

		end_if

		if I_CompareCounter heilige_liga = 5

			console_command diplomatic_stance venice milan neutral
			console_command diplomatic_stance venice papal_states neutral
			console_command diplomatic_stance venice spain neutral
			console_command diplomatic_stance venice hre neutral

			console_command diplomatic_stance milan papal_states neutral
			console_command diplomatic_stance milan spain neutral
			console_command diplomatic_stance milan hre neutral

			console_command diplomatic_stance papal_states spain neutral
			console_command diplomatic_stance papal_states hre neutral

			console_command diplomatic_stance spain hre neutral

			historic_event holy_league_disband factions { poland, }

		end_if

		if I_CompareCounter heilige_liga = 6

			console_command diplomatic_stance venice milan neutral
			console_command diplomatic_stance venice papal_states neutral
			console_command diplomatic_stance venice hre neutral
			console_command diplomatic_stance venice poland neutral

			console_command diplomatic_stance milan papal_states neutral
			console_command diplomatic_stance milan hre neutral
			console_command diplomatic_stance milan poland neutral

			console_command diplomatic_stance papal_states hre neutral
			console_command diplomatic_stance papal_states poland neutral

			console_command diplomatic_stance hre poland neutral

			historic_event holy_league_disband factions { spain, }

		end_if

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------ 
	;---------------------- Veneto-Französische Allianz ---------------------------
	;------------------------------------------------------------------------------
	monitor_event FactionTurnStart I_TurnNumber > 76

		if I_CompareCounter heilige_liga = 1

			generate_random_counter venedig_verrat 1 2

			historic_event v_f_allianz_venice true factions { venice, }
			historic_event v_f_allianz_france true factions { france, }
			historic_event v_f_allianz_andere factions { normans, saxons, hungary, turks, sicily, savoy, montferrat, denmark, byzantium, timurids, russia, urbino, lucca, england, }


			if I_EventCounter venedig_verrat = 1
				and not I_LocalFaction france
				and not I_LocalFaction venice 

				historic_event v_f_allianz_mitglieder_verrat factions { papal_states, poland, spain, hre, milan, }

				;--- Beziehungen der Liga

				set_faction_standing venice france 1.0
				set_faction_standing france venice 1.0

				set_faction_standing papal_states venice -1.0
				set_faction_standing papal_states france -1.0

				set_faction_standing spain france -1.0
				set_faction_standing spain venice -1.0

				set_faction_standing hre france -1.0
				set_faction_standing hre venice -1.0

				set_faction_standing poland france -1.0
				set_faction_standing poland venice -1.0

				set_faction_standing milan france -1.0
				set_faction_standing milan venice -1.0

				console_command diplomatic_stance venice papal_states War
				console_command diplomatic_stance venice spain War
				console_command diplomatic_stance venice hre War
				console_command diplomatic_stance venice poland War
				console_command diplomatic_stance venice milan War

				console_command diplomatic_stance france venice Allied
				console_command diplomatic_stance venice england Allied

			end_if

		end_if

		;---------------------- Mailand

		if I_CompareCounter heilige_liga = 3

			historic_event v_f_allianz_andere factions { milan, }

			;---------------------- Beziehungen der Liga

			set_faction_standing venice france 1.0
			set_faction_standing france venice 1.0

			set_faction_standing papal_states venice -1.0
			set_faction_standing papal_states france -1.0

			set_faction_standing spain france -1.0
			set_faction_standing spain venice -1.0

			set_faction_standing hre france -1.0
			set_faction_standing hre venice -1.0

			set_faction_standing poland france -1.0
			set_faction_standing poland venice -1.0

			console_command diplomatic_stance venice papal_states War
			console_command diplomatic_stance venice spain War
			console_command diplomatic_stance venice hre War
			console_command diplomatic_stance venice poland War

			console_command diplomatic_stance france venice Allied
			console_command diplomatic_stance venice england Allied            

		end_if

		;---------------------- HRR

		if I_CompareCounter heilige_liga = 4

			historic_event v_f_allianz_andere factions { hre, }

			;---------------------- Beziehungen der Liga

			set_faction_standing venice france 1.0
			set_faction_standing france venice 1.0

			set_faction_standing papal_states venice -1.0
			set_faction_standing papal_states france -1.0

			set_faction_standing spain france -1.0
			set_faction_standing spain venice -1.0

			set_faction_standing milan france -1.0
			set_faction_standing milan venice -1.0

			set_faction_standing poland france -1.0
			set_faction_standing poland venice -1.0

			console_command diplomatic_stance venice papal_states War
			console_command diplomatic_stance venice spain War
			console_command diplomatic_stance venice milan War
			console_command diplomatic_stance venice poland War

			console_command diplomatic_stance france venice Allied
			console_command diplomatic_stance venice england Allied            


		end_if

		;---------------------- Florenz

		if I_CompareCounter heilige_liga = 5

			historic_event v_f_allianz_andere factions { poland, }

			;---------------------- Beziehungen der Liga

			set_faction_standing venice france 1.0
			set_faction_standing france venice 1.0

			set_faction_standing papal_states venice -1.0
			set_faction_standing papal_states france -1.0

			set_faction_standing spain france -1.0
			set_faction_standing spain venice -1.0

			set_faction_standing milan france -1.0
			set_faction_standing milan venice -1.0

			set_faction_standing hre france -1.0
			set_faction_standing hre venice -1.0



			console_command diplomatic_stance venice papal_states War
			console_command diplomatic_stance venice spain War
			console_command diplomatic_stance venice milan War
			console_command diplomatic_stance venice hre War

			console_command diplomatic_stance france venice Allied
			console_command diplomatic_stance venice england Allied            

		end_if

		;---------------------- Spanien

		if I_CompareCounter heilige_liga = 6

			historic_event v_f_allianz_andere factions { spain, }

			;---------------------- Beziehungen der Liga

			set_faction_standing venice france 1.0
			set_faction_standing france venice 1.0

			set_faction_standing papal_states venice -1.0
			set_faction_standing papal_states france -1.0

			set_faction_standing poland france -1.0
			set_faction_standing poland venice -1.0

			set_faction_standing milan france -1.0
			set_faction_standing milan venice -1.0

			set_faction_standing hre france -1.0
			set_faction_standing hre venice -1.0



			console_command diplomatic_stance venice papal_states War
			console_command diplomatic_stance venice poland War
			console_command diplomatic_stance venice milan War
			console_command diplomatic_stance venice hre War

			console_command diplomatic_stance france venice Allied
			console_command diplomatic_stance venice england Allied            

		end_if

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Angenommen Venedig ------------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType v_f_allianz_venice_accepted

		set_faction_standing venice france 1.0
		set_faction_standing france venice 1.0

		set_faction_standing papal_states venice -1.0
		set_faction_standing papal_states france -1.0

		set_faction_standing spain france -1.0
		set_faction_standing spain venice -1.0

		set_faction_standing hre france -1.0
		set_faction_standing hre venice -1.0

		set_faction_standing poland france -1.0
		set_faction_standing poland venice -1.0

		set_faction_standing milan france -1.0
		set_faction_standing milan venice -1.0

		console_command diplomatic_stance venice papal_states War
		console_command diplomatic_stance venice spain War
		console_command diplomatic_stance venice hre War
		console_command diplomatic_stance venice poland War
		console_command diplomatic_stance venice milan War

		console_command diplomatic_stance france venice Allied
		console_command diplomatic_stance venice england Allied  

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Abgelehnt Venedig -------------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType v_f_allianz_venice_declined
		add_settlement_turmoil Venedig 80

		terminate_monitor
	end_monitor


	;------------------------------------------------------------------------------
	;---------------------- Angenommen Frankreich ---------------------------------
	;------------------------------------------------------------------------------

	monitor_event EventCounter EventCounterType v_f_allianz_france_accepted

		set_faction_standing venice france 1.0
		set_faction_standing france venice 1.0

		set_faction_standing papal_states venice -1.0
		set_faction_standing papal_states france -1.0

		set_faction_standing spain france -1.0
		set_faction_standing spain venice -1.0

		set_faction_standing hre france -1.0
		set_faction_standing hre venice -1.0

		set_faction_standing poland france -1.0
		set_faction_standing poland venice -1.0

		set_faction_standing milan france -1.0
		set_faction_standing milan venice -1.0

		console_command diplomatic_stance venice papal_states War
		console_command diplomatic_stance venice spain War
		console_command diplomatic_stance venice hre War
		console_command diplomatic_stance venice poland War
		console_command diplomatic_stance venice milan War

		console_command diplomatic_stance france venice Allied
		console_command diplomatic_stance venice england Allied  

		terminate_monitor
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Abwesenheit des Sultans -------------------------------
	;------------------------------------------------------------------------------

	monitor_event FactionTurnStart I_TurnNumber = 0
		and I_LocalFaction turks

		historic_event info_turks factions { turks, }

		send_character_off_map Bayezid

		terminate_monitor
	end_monitor

    ;------------------------------------------------------------------------------
    ;---------------------- Herrschaften und Seerepubliken ------------------------
    ;------------------------------------------------------------------------------

    monitor_event FactionTurnStart I_TurnNumber = 1 

        historic_event info_herrschaften

        terminate_monitor
    end_monitor

    ;---------------------- Counter für Städte ------------------------------------
    declare_counter noli_bundnis 0

    declare_counter monferrat_engage 0
    declare_counter noli_engage 0
    declare_counter ragusa_engage 0
    declare_counter ancona_engage 0
    declare_counter gaeta_engage 0
    declare_counter mantua_engage 0
    declare_counter modena_engage 0
    declare_counter lucca_engage 0
    declare_counter siena_engage 0
    declare_counter piombino_engage 0
    declare_counter portoferraio_engage 0

    declare_counter monferrat_engage_zwei 0
    declare_counter noli_engage_zwei 0
    declare_counter ragusa_engage_zwei 0
    declare_counter ancona_engage_zwei 0
    declare_counter gaeta_engage_zwei 0
    declare_counter mantua_engage_zwei 0
    declare_counter modena_engage_zwei 0
    declare_counter lucca_engage_zwei 0
    declare_counter siena_engage_zwei 0
    declare_counter piombino_engage_zwei 0

    declare_counter monferrat_engage1 0
    declare_counter noli_engage1 0
    declare_counter ragusa_engage1 0
    declare_counter ancona_engage1 0
    declare_counter gaeta_engage1 0
    declare_counter mantua_engage1 0
    declare_counter modena_engage1 0
    declare_counter lucca_engage1 0
    declare_counter siena_engage1 0
    declare_counter piombino_engage1 0
    declare_counter portoferraio_engage1 0


    ;---------------------- Monferrat ---------------------------------------------
    monitor_event GeneralCaptureSettlement SettlementName Casale
        and not FactionType montferrat
        add_settlement_turmoil Casale 70

    end_monitor 

    monitor_event FactionTurnStart FactionType slave


        if not I_SettlementOwner Casale = montferrat

            inc_counter monferrat_engage1 1	


            if I_CompareCounter monferrat_engage1 = 1
                spawn_army 
                    faction montferrat
                    character	random_name, named character, age 36, x 56, y 207, label monferrat02, direction E
                    traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
                    unit		SE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 5 armour 0 weapon_lvl 0
                    unit		Nobile				exp 3 armour 0 weapon_lvl 0
                    unit		Nobile				exp 4 armour 0 weapon_lvl 0
                    unit		Provisionati Infantry				exp 2 armour 1 weapon_lvl 0
                    unit		Provisionati Infantry				exp 4 armour 0 weapon_lvl 0
                    unit		Provisionati Infantry				exp 3 armour 2 weapon_lvl 0
                    unit		NE Serpentine		exp 2 armour 0 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                end

            end_if


            if I_CompareCounter monferrat_engage1 = 3
                spawn_army 
                    faction montferrat
                    character	random_name, named character, age 36, x 56, y 207, label monferrat01, direction E
                    traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
                    unit		SE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 5 armour 0 weapon_lvl 0
                    unit		Nobile				exp 3 armour 0 weapon_lvl 0
                    unit		Nobile				exp 4 armour 0 weapon_lvl 0
                    unit		Provisionati Infantry				exp 2 armour 1 weapon_lvl 0
                    unit		Provisionati Infantry				exp 4 armour 0 weapon_lvl 0
                    unit		Provisionati Infantry				exp 3 armour 2 weapon_lvl 0
                    unit		NE Serpentine		exp 2 armour 0 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                end
                terminate_monitor
            end_if

        end_if
    end_monitor

    monitor_event FactionTurnStart FactionType slave 

        and I_CharacterExists monferrat01

        if I_SettlementOwner Casale = montferrat
            terminate_monitor
        end_if

        if I_SettlementUnderSiege Casale
            and I_EventCounter monferrat_engage = 0
            terminate_monitor 
        end_if

        if I_EventCounter monferrat_engage = 1
            siege_settlement monferrat01, Casale, attack
            terminate_monitor
        end_if

        if I_EventCounter monferrat_engage = 0
            siege_settlement monferrat01, Casale, maintain
            set_event_counter monferrat_engage 1
        end_if
    end_monitor



    monitor_event FactionTurnStart FactionType slave 

        and I_CharacterExists monferrat02

        if I_SettlementOwner Monferrat = montferrat
            terminate_monitor
        end_if

        if I_SettlementUnderSiege Monferrat
            and I_EventCounter monferrat_engage_zwei = 0
            terminate_monitor 
        end_if

        if I_EventCounter monferrat_engage_zwei = 1
            siege_settlement monferrat02, Monferrat, attack
            terminate_monitor
        end_if

        if I_EventCounter monferrat_engage_zwei = 0
            siege_settlement monferrat02, Monferrat, maintain
            set_event_counter monferrat_engage_zwei 1
        end_if
    end_monitor

    ;--------------------------- Noli ---------------------------------------------
    monitor_event GeneralCaptureSettlement SettlementName Noli
        and not FactionType slave
        and I_EventCounter noli_angebot_accepted > 0

        add_settlement_turmoil Noli 70

    end_monitor 

    monitor_event FactionTurnStart FactionType slave
        and I_EventCounter noli_angebot_accepted > 0

        if not I_SettlementOwner Noli = slave
            and not I_CompareCounter noli_bundnis = 1


            inc_counter noli_engage1 1	


            if I_CompareCounter noli_engage1 == 2
                spawn_army 
                    faction slave 
                    character	Fantino, named character, age 36, x 51, y 185, label noli02, direction W
                    traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
                    unit		NE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 5 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 3 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 4 armour 0 weapon_lvl 0
                    unit		Halberd Militia				exp 2 armour 1 weapon_lvl 0
                    unit		Halberd Militia				exp 4 armour 0 weapon_lvl 0
                    unit		Halberd Militia				exp 3 armour 2 weapon_lvl 0
                    unit		Mercenary Monster Ribault		exp 2 armour 0 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                end

            end_if


            if I_CompareCounter noli_engage1 = 4
                spawn_army 
                    faction slave 
                    character	Gian, named character, age 36, x 51, y 185, label noli01, direction W
                    traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
                    unit		NE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 5 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 3 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 4 armour 0 weapon_lvl 0
                    unit		Halberd Militia				exp 2 armour 1 weapon_lvl 0
                    unit		Halberd Militia				exp 4 armour 0 weapon_lvl 0
                    unit		Halberd Militia				exp 3 armour 2 weapon_lvl 0
                    unit		Mercenary Monster Ribault		exp 2 armour 0 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                end
                terminate_monitor
            end_if

        end_if
    end_monitor

    monitor_event FactionTurnStart FactionType slave 
        and not I_CompareCounter noli_bundnis = 1
        and I_CharacterExists noli01

        if I_SettlementOwner Noli = slave
            terminate_monitor
        end_if

        if I_SettlementUnderSiege Noli
            and I_EventCounter noli_engage = 0
            terminate_monitor 
        end_if

        if I_EventCounter noli_engage = 1
            siege_settlement noli01, Noli, attack
            terminate_monitor
        end_if

        if I_EventCounter noli_engage = 0
            siege_settlement noli01, Noli, maintain
            set_event_counter noli_engage 1
        end_if
    end_monitor



    monitor_event FactionTurnStart FactionType slave 
        and not I_CompareCounter noli_bundnis = 1
        and I_CharacterExists noli02

        if I_SettlementOwner Noli = slave
            terminate_monitor
        end_if

        if I_SettlementUnderSiege Noli
            and I_EventCounter noli_engage_zwei = 0
            terminate_monitor 
        end_if

        if I_EventCounter noli_engage_zwei = 1
            siege_settlement noli02, Noli, attack
            terminate_monitor
        end_if

        if I_EventCounter noli_engage_zwei = 0
            siege_settlement noli02, Noli, maintain
            set_event_counter noli_engage_zwei 1
        end_if
    end_monitor


    ;------------------------- Mantua ---------------------------------------------
    monitor_event GeneralCaptureSettlement SettlementName Mantua
        and not FactionType byzantium
        and not FactionType slave
        add_settlement_turmoil Mantua 70

    end_monitor 

    monitor_event FactionTurnStart FactionType slave


        if not I_SettlementOwner Mantua = slave
            and not I_SettlementOwner Mantua = byzantium

            inc_counter mantua_engage1 1	


            if I_CompareCounter mantua_engage1 = 1
                spawn_army 
                    faction byzantium
                    character	random_name, named character, age 36, x 93, y 207, label mantua02, direction E
                    traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
                    unit		SE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
                    unit		Italian Condottiere				exp 5 armour 0 weapon_lvl 0
                    unit		Italian Condottiere				exp 3 armour 0 weapon_lvl 0
                    unit		Italian Condottiere				exp 4 armour 0 weapon_lvl 0
                    unit		C Pike Militia				exp 2 armour 1 weapon_lvl 0
                    unit		C Pike Militia				exp 4 armour 0 weapon_lvl 0
                    unit		C Pike Militia				exp 3 armour 2 weapon_lvl 0
                    unit		NE Serpentine		exp 2 armour 0 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                end

            end_if


            if I_CompareCounter mantua_engage1 = 3
                spawn_army 
                    faction byzantium 
                    character	random_name, named character, age 36, x 93, y 207, label mantua01, direction E
                    traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
                    unit		SE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
                    unit		Italian Condottiere				exp 5 armour 0 weapon_lvl 0
                    unit		Italian Condottiere				exp 3 armour 0 weapon_lvl 0
                    unit		Italian Condottiere				exp 4 armour 0 weapon_lvl 0
                    unit		C Pike Militia				exp 2 armour 1 weapon_lvl 0
                    unit		C Pike Militia				exp 4 armour 0 weapon_lvl 0
                    unit		C Pike Militia				exp 3 armour 2 weapon_lvl 0
                    unit		NE Serpentine		exp 2 armour 0 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                end
                terminate_monitor
            end_if

        end_if
    end_monitor

    monitor_event FactionTurnStart FactionType slave 

        and I_CharacterExists mantua01

        if I_SettlementOwner Mantua = byzantium
            terminate_monitor
        end_if

        if I_SettlementUnderSiege Mantua
            and I_EventCounter mantua_engage = 0
            terminate_monitor 
        end_if

        if I_EventCounter mantua_engage = 1
            siege_settlement mantua01, Mantua, attack
            terminate_monitor
        end_if

        if I_EventCounter mantua_engage = 0
            siege_settlement mantua01, Mantua, maintain
            set_event_counter mantua_engage 1
        end_if
    end_monitor

    monitor_event FactionTurnStart FactionType slave 

        and I_CharacterExists mantua02

        if I_SettlementOwner Mantua = byzantium
            terminate_monitor
        end_if

        if I_SettlementUnderSiege Mantua
            and I_EventCounter mantua_engage_zwei = 0
            terminate_monitor 
        end_if

        if I_EventCounter mantua_engage_zwei = 1
            siege_settlement mantua02, Mantua, attack
            terminate_monitor
        end_if

        if I_EventCounter mantua_engage_zwei = 0
            siege_settlement mantua02, Mantua, maintain
            set_event_counter mantua_engage_zwei 1
        end_if
    end_monitor


    ;------------------------- Modena ---------------------------------------------
    monitor_event GeneralCaptureSettlement SettlementName Modena
        and not FactionType england
        and not FactionType slave
        add_settlement_turmoil Modena 70

    end_monitor 

    monitor_event FactionTurnStart FactionType slave


        if not I_SettlementOwner Modena = slave
            and not I_SettlementOwner Modena = england

            inc_counter modena_engage1 1	


            if I_CompareCounter modena_engage1 = 1
                spawn_army 
                    faction england 
                    character	random_name, named character, age 36, x 95, y 193, label modena02, direction W
                    traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
                    unit		SE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
                    unit		Fer Knights				exp 5 armour 0 weapon_lvl 0
                    unit		Fer Knights				exp 3 armour 0 weapon_lvl 0
                    unit		Fer Knights				exp 4 armour 0 weapon_lvl 0
                    unit		Pike Militia				exp 2 armour 1 weapon_lvl 0
                    unit		Pike Militia				exp 4 armour 0 weapon_lvl 0
                    unit		Pike Militia				exp 3 armour 2 weapon_lvl 0
                    unit		NE Serpentine		exp 2 armour 0 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                end

            end_if


            if I_CompareCounter modena_engage1 = 3
                spawn_army 
                    faction england 
                    character	random_name, named character, age 36, x 95, y 193, label modena01, direction W
                    traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
                    unit		SE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
                    unit		Fer Knights				exp 5 armour 0 weapon_lvl 0
                    unit		Fer Knights				exp 3 armour 0 weapon_lvl 0
                    unit		Fer Knights				exp 4 armour 0 weapon_lvl 0
                    unit		Pike Militia				exp 2 armour 1 weapon_lvl 0
                    unit		Pike Militia				exp 4 armour 0 weapon_lvl 0
                    unit		Pike Militia				exp 3 armour 2 weapon_lvl 0
                    unit		NE Serpentine		exp 2 armour 0 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                end
                terminate_monitor
            end_if

        end_if
    end_monitor

    monitor_event FactionTurnStart FactionType slave 

        and I_CharacterExists modena01

        if I_SettlementOwner Modena = england
            terminate_monitor
        end_if

        if I_SettlementUnderSiege Modena
            and I_EventCounter modena_engage = 0
            terminate_monitor 
        end_if

        if I_EventCounter modena_engage = 1
            siege_settlement modena01, Modena, attack
            terminate_monitor
        end_if

        if I_EventCounter modena_engage = 0
            siege_settlement modena01, Modena, maintain
            set_event_counter modena_engage 1
        end_if
    end_monitor



    monitor_event FactionTurnStart FactionType slave 

        and I_CharacterExists modena02

        if I_SettlementOwner Modena = england
            terminate_monitor
        end_if

        if I_SettlementUnderSiege Modena
            and I_EventCounter modena_engage_zwei = 0
            terminate_monitor 
        end_if

        if I_EventCounter modena_engage_zwei = 1
            siege_settlement modena02, Modena, attack
            terminate_monitor
        end_if

        if I_EventCounter modena_engage_zwei = 0
            siege_settlement modena02, Modena, maintain
            set_event_counter modena_engage_zwei 1
        end_if
    end_monitor



    ;------------------------- Lucca ----------------------------------------------
    monitor_event GeneralCaptureSettlement SettlementName Lucca
        and not FactionType lucca
        and not FactionType slave
        add_settlement_turmoil Lucca 70

    end_monitor 

    monitor_event FactionTurnStart FactionType slave


        if not I_SettlementOwner Lucca = slave
            and not I_SettlementOwner Lucca = lucca

            inc_counter lucca_engage1 1	


            if I_CompareCounter lucca_engage1 = 1
                spawn_army 
                    faction lucca 
                    character	random_name, named character, age 36, x 87, y 183, label lucca02, direction E
                    traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
                    unit		SE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 5 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 3 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 4 armour 0 weapon_lvl 0
                    unit		Halberd Militia				exp 2 armour 1 weapon_lvl 0
                    unit		Halberd Militia				exp 4 armour 0 weapon_lvl 0
                    unit		Halberd Militia				exp 3 armour 2 weapon_lvl 0
                    unit		NE Serpentine		exp 2 armour 0 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                end

            end_if


            if I_CompareCounter lucca_engage1 = 3
                spawn_army 
                    faction lucca 
                    character	random_name, named character, age 36, x 87, y 183, label lucca01, direction E
                    traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
                    unit		SE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 5 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 3 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 4 armour 0 weapon_lvl 0
                    unit		Halberd Militia				exp 2 armour 1 weapon_lvl 0
                    unit		Halberd Militia				exp 4 armour 0 weapon_lvl 0
                    unit		Halberd Militia				exp 3 armour 2 weapon_lvl 0
                    unit		NE Serpentine		exp 2 armour 0 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                end
                terminate_monitor
            end_if

        end_if
    end_monitor

    monitor_event FactionTurnStart FactionType slave 

        and I_CharacterExists lucca01

        if I_SettlementOwner Lucca = lucca
            terminate_monitor
        end_if

        if I_SettlementUnderSiege Lucca
            and I_EventCounter lucca_engage = 0
            terminate_monitor 
        end_if

        if I_EventCounter lucca_engage = 1
            siege_settlement lucca01, Lucca, attack
            terminate_monitor
        end_if

        if I_EventCounter lucca_engage = 0
            siege_settlement lucca01, Lucca, maintain
            set_event_counter lucca_engage 1
        end_if
    end_monitor



    monitor_event FactionTurnStart FactionType slave 

        and I_CharacterExists lucca02

        if I_SettlementOwner Lucca = lucca
            terminate_monitor
        end_if

        if I_SettlementUnderSiege Lucca
            and I_EventCounter lucca_engage_zwei = 0
            terminate_monitor 
        end_if

        if I_EventCounter lucca_engage_zwei = 1
            siege_settlement lucca02, Lucca, attack
            terminate_monitor
        end_if

        if I_EventCounter lucca_engage_zwei = 0
            siege_settlement lucca02, Lucca, maintain
            set_event_counter lucca_engage_zwei 1
        end_if
    end_monitor


    ;------------------------- Piombino -------------------------------------------
    monitor_event GeneralCaptureSettlement SettlementName Piombino
        and not FactionType slave
        add_settlement_turmoil Piombino 70

    end_monitor 

    monitor_event FactionTurnStart FactionType slave


        if not I_SettlementOwner Piombino = slave

            inc_counter piombino_engage1 1	


            if I_CompareCounter piombino_engage1 = 1
                spawn_army 
                    faction slave 
                    character	Francesco, named character, age 36, x 88, y 158, label piombino02, direction W
                    traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
                    unit		NE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 5 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 3 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 4 armour 0 weapon_lvl 0
                    unit		Halberd Militia				exp 2 armour 1 weapon_lvl 0
                    unit		Halberd Militia				exp 4 armour 0 weapon_lvl 0
                    unit		Halberd Militia				exp 3 armour 2 weapon_lvl 0
                    unit		Mercenary Monster Ribault		exp 2 armour 0 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                end

            end_if


            if I_CompareCounter piombino_engage1 = 3
                spawn_army 
                    faction slave 
                    character	Girolamo, named character, age 36, x 88, y 158, label piombino01, direction W
                    traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
                    unit		NE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 5 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 3 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 4 armour 0 weapon_lvl 0
                    unit		Halberd Militia				exp 2 armour 1 weapon_lvl 0
                    unit		Halberd Militia				exp 4 armour 0 weapon_lvl 0
                    unit		Halberd Militia				exp 3 armour 2 weapon_lvl 0
                    unit		Mercenary Monster Ribault		exp 2 armour 0 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                end
                terminate_monitor
            end_if

        end_if
    end_monitor

    monitor_event FactionTurnStart FactionType slave 

        and I_CharacterExists piombino01

        if I_SettlementOwner Piombino = slave
            terminate_monitor
        end_if

        if I_SettlementUnderSiege Piombino
            and I_EventCounter piombino_engage = 0
            terminate_monitor 
        end_if

        if I_EventCounter piombino_engage = 1
            siege_settlement piombino01, Piombino, attack
            terminate_monitor
        end_if

        if I_EventCounter piombino_engage = 0
            siege_settlement piombino01, Piombino, maintain
            set_event_counter piombino_engage 1
        end_if
    end_monitor



    monitor_event FactionTurnStart FactionType slave 

        and I_CharacterExists piombino02

        if I_SettlementOwner Piombino = slave
            terminate_monitor
        end_if

        if I_SettlementUnderSiege Piombino
            and I_EventCounter piombino_engage_zwei = 0
            terminate_monitor 
        end_if

        if I_EventCounter piombino_engage_zwei = 1
            siege_settlement piombino02, Piombino, attack
            terminate_monitor
        end_if

        if I_EventCounter piombino_engage_zwei = 0
            siege_settlement piombino02, Piombino, maintain
            set_event_counter piombino_engage_zwei 1
        end_if
    end_monitor

    ;------------------------- Portoferraio -------------------------------------------
    monitor_event GeneralCaptureSettlement SettlementName Portoferraio
        and not FactionType slave
        add_settlement_turmoil Portoferraio 70

    end_monitor 

    monitor_event FactionTurnStart FactionType slave


        if not I_SettlementOwner Portoferraio = slave

            inc_counter portoferraio_engage1 1	


            if I_CompareCounter portoferraio_engage1 = 1
                spawn_army 
                    faction slave 
                    character	Gilio, named character, age 36, x 82, y 153, label portoferraio01, direction W
                    traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
                    unit		NE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 5 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 3 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 4 armour 0 weapon_lvl 0
                    unit		Halberd Militia				exp 2 armour 1 weapon_lvl 0
                    unit		Halberd Militia				exp 4 armour 0 weapon_lvl 0
                    unit		Halberd Militia				exp 3 armour 2 weapon_lvl 0
                    unit		Mercenary Monster Ribault		exp 2 armour 0 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                end
                terminate_monitor
            end_if

        end_if
    end_monitor


    monitor_event FactionTurnStart FactionType slave 

        and I_CharacterExists portoferraio01

        if I_SettlementOwner Portoferraio = slave
            terminate_monitor
        end_if

        if I_SettlementUnderSiege Portoferraio
            and I_EventCounter portoferraio_engage = 0
            terminate_monitor 
        end_if

        if I_EventCounter portoferraio_engage = 1
            siege_settlement portoferraio01, Portoferraio, attack
            terminate_monitor
        end_if

        if I_EventCounter portoferraio_engage = 0
            siege_settlement portoferraio01, Portoferraio, maintain
            set_event_counter portoferraio_engage 1
        end_if
    end_monitor


    ;------------------------- Gaeta ----------------------------------------------
    monitor_event GeneralCaptureSettlement SettlementName Gaeta
        and not FactionType slave
        add_settlement_turmoil Gaeta 70

    end_monitor 

    monitor_event FactionTurnStart FactionType slave


        if not I_SettlementOwner Gaeta = slave

            inc_counter gaeta_engage1 1	


            if I_CompareCounter gaeta_engage1 = 1
                spawn_army 
                    faction slave 
                    character	Francesco, named character, age 36, x 131, y 121, label gaeta02, direction W
                    traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
                    unit		NE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 5 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 3 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 4 armour 0 weapon_lvl 0
                    unit		Halberd Militia				exp 2 armour 1 weapon_lvl 0
                    unit		Halberd Militia				exp 4 armour 0 weapon_lvl 0
                    unit		Halberd Militia				exp 3 armour 2 weapon_lvl 0
                    unit		Mercenary Monster Ribault		exp 2 armour 0 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                end

            end_if


            if I_CompareCounter gaeta_engage1 = 3
                spawn_army 
                    faction slave 
                    character	Evio, named character, age 36, x 131, y 121, label gaeta01, direction W
                    traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
                    unit		NE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 5 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 3 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 4 armour 0 weapon_lvl 0
                    unit		Halberd Militia				exp 2 armour 1 weapon_lvl 0
                    unit		Halberd Militia				exp 4 armour 0 weapon_lvl 0
                    unit		Halberd Militia				exp 3 armour 2 weapon_lvl 0
                    unit		Mercenary Monster Ribault		exp 2 armour 0 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                end
                terminate_monitor
            end_if

        end_if
    end_monitor

    monitor_event FactionTurnStart FactionType slave 

        and I_CharacterExists gaeta01

        if I_SettlementOwner Gaeta = slave
            terminate_monitor
        end_if

        if I_SettlementUnderSiege Gaeta
            and I_EventCounter gaeta_engage = 0
            terminate_monitor 
        end_if

        if I_EventCounter gaeta_engage = 1
            siege_settlement gaeta01, Gaeta, attack
            terminate_monitor
        end_if

        if I_EventCounter gaeta_engage = 0
            siege_settlement gaeta01, Gaeta, maintain
            set_event_counter gaeta_engage 1
        end_if
    end_monitor



    monitor_event FactionTurnStart FactionType slave 

        and I_CharacterExists gaeta02

        if I_SettlementOwner Gaeta = slave
            terminate_monitor
        end_if

        if I_SettlementUnderSiege Gaeta
            and I_EventCounter gaeta_engage_zwei = 0
            terminate_monitor 
        end_if

        if I_EventCounter gaeta_engage_zwei = 1
            siege_settlement gaeta02, Gaeta, attack
            terminate_monitor
        end_if

        if I_EventCounter gaeta_engage_zwei = 0
            siege_settlement gaeta02, Gaeta, maintain
            set_event_counter gaeta_engage_zwei 1
        end_if
    end_monitor

    ;------------------------- Ancona ---------------------------------------------
    monitor_event GeneralCaptureSettlement SettlementName Ancona
        and not FactionType slave
        add_settlement_turmoil Ancona 70

    end_monitor 

    monitor_event FactionTurnStart FactionType slave


        if not I_SettlementOwner Ancona = slave

            inc_counter ancona_engage1 1	


            if I_CompareCounter ancona_engage1 = 1
                spawn_army 
                    faction slave 
                    character	Francesco, named character, age 36, x 135, y 169, label ancona02, direction N
                    traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
                    unit		NE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 5 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 3 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 4 armour 0 weapon_lvl 0
                    unit		Halberd Militia				exp 2 armour 1 weapon_lvl 0
                    unit		Halberd Militia				exp 4 armour 0 weapon_lvl 0
                    unit		Halberd Militia				exp 3 armour 2 weapon_lvl 0
                    unit		Mercenary Monster Ribault		exp 2 armour 0 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                end

            end_if


            if I_CompareCounter ancona_engage1 = 3
                spawn_army 
                    faction slave 
                    character	Girolamo, named character, age 36, x 135, y 169, label ancona01, direction N
                    traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
                    unit		NE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 5 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 3 armour 0 weapon_lvl 0
                    unit		Condottieri				exp 4 armour 0 weapon_lvl 0
                    unit		Halberd Militia				exp 2 armour 1 weapon_lvl 0
                    unit		Halberd Militia				exp 4 armour 0 weapon_lvl 0
                    unit		Halberd Militia				exp 3 armour 2 weapon_lvl 0
                    unit		Mercenary Monster Ribault		exp 2 armour 0 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                end
                terminate_monitor
            end_if

        end_if
    end_monitor

    monitor_event FactionTurnStart FactionType slave 

        and I_CharacterExists ancona01

        if I_SettlementOwner Ancona = slave
            terminate_monitor
        end_if

        if I_SettlementUnderSiege Ancona
            and I_EventCounter ancona_engage = 0
            terminate_monitor 
        end_if

        if I_EventCounter ancona_engage = 1
            siege_settlement ancona01, Ancona, attack
            terminate_monitor
        end_if

        if I_EventCounter ancona_engage = 0
            siege_settlement ancona01, Ancona, maintain
            set_event_counter ancona_engage 1
        end_if
    end_monitor



    monitor_event FactionTurnStart FactionType slave 

        and I_CharacterExists ancona02

        if I_SettlementOwner Ancona = slave
            terminate_monitor
        end_if

        if I_SettlementUnderSiege Ancona
            and I_EventCounter ancona_engage_zwei = 0
            terminate_monitor 
        end_if

        if I_EventCounter ancona_engage_zwei = 1
            siege_settlement ancona02, Ancona, attack
            terminate_monitor
        end_if

        if I_EventCounter ancona_engage_zwei = 0
            siege_settlement ancona02, Ancona, maintain
            set_event_counter ancona_engage_zwei 1
        end_if
    end_monitor


    ;------------------------- Ragusa ---------------------------------------------
    monitor_event GeneralCaptureSettlement SettlementName Ragusa
        and not FactionType scotland
        and not FactionType slave
        add_settlement_turmoil Ragusa 70

    end_monitor 

    monitor_event FactionTurnStart FactionType slave


        if not I_SettlementOwner Ragusa = slave
            and not I_SettlementOwner Ragusa = scotland

            inc_counter ragusa_engage1 1	


            if I_CompareCounter ragusa_engage1 = 1
                spawn_army 
                    faction scotland 
                    character	random_name, named character, age 36, x 207, y 151, label ragusa02, direction W
                    traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
                    unit		SE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
                    unit		Ragusan Knights				exp 5 armour 0 weapon_lvl 0
                    unit		Ragusan Knights				exp 3 armour 0 weapon_lvl 0
                    unit		Ragusan Knights				exp 4 armour 0 weapon_lvl 0
                    unit		R Pike Militia				exp 2 armour 1 weapon_lvl 0
                    unit		R Pike Militia				exp 4 armour 0 weapon_lvl 0
                    unit		R Pike Militia				exp 3 armour 2 weapon_lvl 0
                    unit		NE Serpentine		exp 2 armour 0 weapon_lvl 0
                    unit		Ragusan Sword Militia			exp 3 armour 1 weapon_lvl 0
                    unit		Ragusan Sword Militia			exp 3 armour 1 weapon_lvl 0
                end

            end_if


            if I_CompareCounter ragusa_engage1 = 3
                spawn_army 
                    faction scotland
                    character	random_name, named character, age 36, x 207, y 151, label ragusa01, direction W
                    traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
                    unit		SE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
                    unit		Ragusan Knights				exp 5 armour 0 weapon_lvl 0
                    unit		Ragusan Knights				exp 3 armour 0 weapon_lvl 0
                    unit		Ragusan Knights				exp 4 armour 0 weapon_lvl 0
                    unit		R Pike Militia				exp 2 armour 1 weapon_lvl 0
                    unit		R Pike Militia				exp 4 armour 0 weapon_lvl 0
                    unit		R Pike Militia				exp 3 armour 2 weapon_lvl 0
                    unit		NE Serpentine		exp 2 armour 0 weapon_lvl 0
                    unit		Ragusan Sword Militia			exp 3 armour 1 weapon_lvl 0
                    unit		Ragusan Sword Militia			exp 3 armour 1 weapon_lvl 0
                end
                terminate_monitor
            end_if

        end_if
    end_monitor

    monitor_event FactionTurnStart FactionType slave 

        and I_CharacterExists ragusa01

        if I_SettlementOwner Ragusa = scotland
            terminate_monitor
        end_if

        if I_SettlementUnderSiege Ragusa
            and I_EventCounter ragusa_engage = 0
            terminate_monitor 
        end_if

        if I_EventCounter ragusa_engage = 1
            siege_settlement ragusa01, Ragusa, attack
            terminate_monitor
        end_if

        if I_EventCounter ragusa_engage = 0
            siege_settlement ragusa01, Ragusa, maintain
            set_event_counter ragusa_engage 1
        end_if
    end_monitor



    monitor_event FactionTurnStart FactionType slave 

        and I_CharacterExists ragusa02

        if I_SettlementOwner Ragusa = scotland
            terminate_monitor
        end_if

        if I_SettlementUnderSiege Ragusa
            and I_EventCounter ragusa_engage_zwei = 0
            terminate_monitor 
        end_if

        if I_EventCounter ragusa_engage_zwei = 1
            siege_settlement ragusa02, Ragusa, attack
            terminate_monitor
        end_if

        if I_EventCounter ragusa_engage_zwei = 0
            siege_settlement ragusa02, Ragusa, maintain
            set_event_counter ragusa_engage_zwei 1
        end_if
    end_monitor


    ;------------------------- Siena ----------------------------------------------
    monitor_event GeneralCaptureSettlement SettlementName Siena
        and not FactionType russia
        and not FactionType slave
        and not FactionType mongols
        add_settlement_turmoil Siena 70

    end_monitor 

    monitor_event FactionTurnStart FactionType slave


        if not I_SettlementOwner Siena = slave
            and not I_SettlementOwner Siena = russia
            and not I_SettlementOwner Siena = mongols

            inc_counter siena_engage1 1	


            if I_CompareCounter siena_engage1 = 1
                spawn_army 
                    faction russia 
                    character	random_name, named character, age 36, x 99, y 166, label siena02, direction S
                    traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
                    unit		SE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
                    unit		S Italian Knights				exp 5 armour 0 weapon_lvl 0
                    unit		S Italian Knights				exp 3 armour 0 weapon_lvl 0
                    unit		S Italian Knights				exp 4 armour 0 weapon_lvl 0
                    unit		FL Pike Militia				exp 2 armour 1 weapon_lvl 0
                    unit		FL Pike Militia				exp 4 armour 0 weapon_lvl 0
                    unit		FL Pike Militia				exp 3 armour 2 weapon_lvl 0
                    unit		NE Serpentine		exp 2 armour 0 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                end

            end_if


            if I_CompareCounter siena_engage1 = 3
                spawn_army 
                    faction russia
                    character	random_name, named character, age 36, x 99, y 166, label siena01, direction S
                    traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
                    unit		SE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
                    unit		S Italian Knights				exp 5 armour 0 weapon_lvl 0
                    unit		S Italian Knights				exp 3 armour 0 weapon_lvl 0
                    unit		S Italian Knights				exp 4 armour 0 weapon_lvl 0
                    unit		FL Pike Militia				exp 2 armour 1 weapon_lvl 0
                    unit		FL Pike Militia				exp 4 armour 0 weapon_lvl 0
                    unit		FL Pike Militia				exp 3 armour 2 weapon_lvl 0
                    unit		NE Serpentine		exp 2 armour 0 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                    unit		Italian Spear Militia			exp 3 armour 1 weapon_lvl 0
                end
                terminate_monitor
            end_if

        end_if
    end_monitor

    monitor_event FactionTurnStart FactionType slave 

        and I_CharacterExists siena01

        if I_SettlementOwner Siena = russia
            terminate_monitor
        end_if

        if I_SettlementUnderSiege Siena
            and I_EventCounter siena_engage = 0
            terminate_monitor 
        end_if

        if I_EventCounter siena_engage = 1
            siege_settlement siena01, Siena, attack
            terminate_monitor
        end_if

        if I_EventCounter siena_engage = 0
            siege_settlement siena01, Siena, maintain
            set_event_counter siena_engage 1
        end_if
    end_monitor



    monitor_event FactionTurnStart FactionType slave 

        and I_CharacterExists siena02

        if I_SettlementOwner Siena = russia
            terminate_monitor
        end_if

        if I_SettlementUnderSiege Siena
            and I_EventCounter siena_engage_zwei = 0
            terminate_monitor 
        end_if

        if I_EventCounter siena_engage_zwei = 1
            siege_settlement siena02, Siena, attack
            terminate_monitor
        end_if

        if I_EventCounter siena_engage_zwei = 0
            siege_settlement siena02, Siena, maintain
            set_event_counter siena_engage_zwei 1
        end_if
    end_monitor

    ;------------------------------------------------------------------------------
    ;---------------------- Der Krieg mit Pisa ------------------------------------
    ;------------------------------------------------------------------------------

    declare_counter krieg_mit_pisa		;Wieviele Runden sind bereits seit dem Beginn des Krieges vergangen?
    ;declare_counter rebellion_pisa		;Runden bis zur Beendigung der Rebellion, Runde 16

    ;---------------------- Florenz: AI
    monitor_event FactionTurnStart FactionType poland
        and I_TurnNumber = 3
        and I_SettlementOwner Pisa = poland
        and not I_SettlementUnderSiege Pisa
        and I_IsFactionAIControlled poland

        historic_event revolte_pisa factions { poland, }

        console_command create_building Perugia ros_po_bonus
        console_command create_building Aquila ros_po_bonus
        console_command create_building Pontecorvo ros_po_bonus
        console_command create_building Capua ros_po_bonus
        console_command create_building Brindisi ros_po_bonus
        console_command create_building Pantelleria ros_po_bonus
        console_command create_building Marsala ros_po_bonus
        console_command create_building Terranova ros_po_bonus
        console_command create_building Montepulciano ros_po_bonus
        console_command create_building Urbino ros_po_bonus
        console_command create_building Piacenza ros_po_bonus
        console_command create_building Alessandria ros_po_bonus
        console_command create_building Camerino ros_po_bonus
        console_command create_building Mompelgard ros_po_bonus
        console_command create_building Mondovi ros_po_bonus
        console_command create_building Barcelonnette ros_po_bonus
        console_command create_building Gimignano ros_po_bonus
        console_command create_building Livorno ros_po_bonus
        console_command create_building Massa ros_po_bonus
        console_command create_building Novara ros_po_bonus
        console_command create_building Nuoro ros_po_bonus
        console_command create_building Biserta ros_po_bonus
        console_command create_building Rom ros_po_bonus
        console_command create_building Neapel ros_po_bonus
        console_command create_building Bologna ros_po_bonus
        console_command create_building Mailand ros_po_bonus
        console_command create_building Turin ros_po_bonus
        console_command create_building Genua ros_po_bonus
        console_command create_building Volterra ros_po_bonus
        console_command create_building Arezzo ros_po_bonus
        console_command create_building Siena ros_po_bonus
        console_command create_building Piombino ros_po_bonus
        console_command create_building Portoferraio ros_po_bonus
        console_command create_building Grosseto ros_po_bonus
        console_command create_building Orvieto ros_po_bonus
        console_command create_building Civita ros_po_bonus
        console_command create_building Lucca ros_po_bonus
        console_command create_building Mantua ros_po_bonus
        console_command create_building Ferrara ros_po_bonus
        console_command create_building Fivizanno ros_po_bonus
        console_command create_building Guastalla ros_po_bonus
        console_command create_building Modena ros_po_bonus
        console_command create_building Parma ros_po_bonus
        console_command create_building Pavia ros_po_bonus
        console_command create_building Brescia ros_po_bonus
        console_command create_building Cremona ros_po_bonus
        console_command create_building Verona ros_po_bonus
        console_command create_building Casale ros_po_bonus
        console_command create_building Asti ros_po_bonus
        console_command create_building Rovigo ros_po_bonus
        console_command create_building Forli ros_po_bonus
        console_command create_building Ravenna ros_po_bonus
        console_command create_building Rimini ros_po_bonus
        console_command create_building Ancona ros_po_bonus
        console_command create_building Fermo ros_po_bonus
        console_command create_building Spoleto ros_po_bonus
        console_command create_building Gaeta ros_po_bonus
        console_command create_building Foggia ros_po_bonus
        console_command create_building Pescara ros_po_bonus
        console_command create_building Benevento ros_po_bonus
        console_command create_building Otranto ros_po_bonus
        console_command create_building Bari ros_po_bonus
        console_command create_building Salerno ros_po_bonus
        console_command create_building Potenza ros_po_bonus
        console_command create_building Policastro ros_po_bonus
        console_command create_building Cosenza ros_po_bonus
        console_command create_building Reggio ros_po_bonus
        console_command create_building Messina ros_po_bonus
        console_command create_building Syrakus ros_po_bonus
        console_command create_building Girgenti ros_po_bonus
        console_command create_building Palermo ros_po_bonus
        console_command create_building Malta ros_po_bonus
        console_command create_building Tunis ros_po_bonus
        console_command create_building Qairawan ros_po_bonus
        console_command create_building Al_Kaf ros_po_bonus
        console_command create_building Annaba ros_po_bonus
        console_command create_building Qusantina ros_po_bonus
        console_command create_building Cagliari ros_po_bonus
        console_command create_building Oristano ros_po_bonus
        console_command create_building Sassari ros_po_bonus
        console_command create_building Bonifacio ros_po_bonus
        console_command create_building Ajaccio ros_po_bonus
        console_command create_building Bastia ros_po_bonus
        console_command create_building Noli ros_po_bonus
        console_command create_building Nice ros_po_bonus
        console_command create_building Toulon ros_po_bonus
        console_command create_building Marseille ros_po_bonus
        console_command create_building Saluzzo ros_po_bonus
        console_command create_building Avignon ros_po_bonus
        console_command create_building Vienne ros_po_bonus
        console_command create_building Grenoble ros_po_bonus
        console_command create_building Lyon ros_po_bonus
        console_command create_building Genf ros_po_bonus
        console_command create_building Chalon ros_po_bonus
        console_command create_building Dijon ros_po_bonus
        console_command create_building Chaumont ros_po_bonus
        console_command create_building Besancon ros_po_bonus
        console_command create_building Lausanne ros_po_bonus
        console_command create_building Bern ros_po_bonus
        console_command create_building Sion ros_po_bonus
        console_command create_building Zurich ros_po_bonus
        console_command create_building Chur ros_po_bonus
        console_command create_building Nancy ros_po_bonus
        console_command create_building Strassburg ros_po_bonus
        console_command create_building Mulhouse ros_po_bonus
        console_command create_building Baden ros_po_bonus
        console_command create_building Freiburg ros_po_bonus
        console_command create_building Stuttgart ros_po_bonus
        console_command create_building Rottweil ros_po_bonus
        console_command create_building Bregenz ros_po_bonus
        console_command create_building Augsburg ros_po_bonus
        console_command create_building Ulm ros_po_bonus
        console_command create_building Ravensburg ros_po_bonus
        console_command create_building Krk ros_po_bonus
        console_command create_building Supetar ros_po_bonus
        console_command create_building Cattaro ros_po_bonus
        console_command create_building Ragusa ros_po_bonus
        console_command create_building Ston ros_po_bonus
        console_command create_building Trient ros_po_bonus
        console_command create_building Venedig ros_po_bonus
        console_command create_building Padua ros_po_bonus
        console_command create_building Treviso ros_po_bonus
        console_command create_building Trieste ros_po_bonus
        console_command create_building Pola ros_po_bonus
        console_command create_building Fiume ros_po_bonus
        console_command create_building Bihac ros_po_bonus
        console_command create_building Sinj ros_po_bonus
        console_command create_building Zara ros_po_bonus
        console_command create_building Spalato ros_po_bonus
        console_command create_building Innsbruck ros_po_bonus
        console_command create_building Munchen ros_po_bonus
        console_command create_building Freising ros_po_bonus
        console_command create_building Passau ros_po_bonus
        console_command create_building Laibach ros_po_bonus
        console_command create_building Villach ros_po_bonus
        console_command create_building Salzburg ros_po_bonus
        console_command create_building Sissek ros_po_bonus
        console_command create_building Trebinje ros_po_bonus
        console_command create_building Mostar ros_po_bonus
        console_command create_building Sarajevo ros_po_bonus
        console_command create_building Jajce ros_po_bonus
        console_command create_building Eszek ros_po_bonus
        console_command create_building Warasdin ros_po_bonus
        console_command create_building Zagreb ros_po_bonus
        console_command create_building Marburg ros_po_bonus
        console_command create_building Wien ros_po_bonus
        console_command create_building Linz ros_po_bonus
        console_command create_building Graz ros_po_bonus
        console_command create_building Odenburg ros_po_bonus
        console_command create_building Buda ros_po_bonus
        console_command create_building Nyitra ros_po_bonus
        console_command create_building Pressburg ros_po_bonus
        console_command create_building Pecs ros_po_bonus
        console_command create_building Stuhlweisenberg ros_po_bonus
        console_command create_building Kanizsa ros_po_bonus
        console_command create_building Keszthely ros_po_bonus
        console_command create_building Veszprem ros_po_bonus
        console_command create_building Susa ros_po_bonus
        console_command create_building Die ros_po_bonus
        console_command create_building Aix ros_po_bonus
        console_command create_building Gallen ros_po_bonus
        console_command create_building Basel ros_po_bonus
        console_command create_building Bellinzona ros_po_bonus
        console_command create_building Adelsberg ros_po_bonus
        console_command create_building Severin ros_po_bonus
        console_command create_building Banjaluka ros_po_bonus
        console_command create_building Mljet ros_po_bonus
        console_command create_building Neuenburg ros_po_bonus
        console_command create_building Lipari ros_po_bonus
        console_command create_building Brixen ros_po_bonus
        console_command create_building Pago ros_po_bonus
        console_command create_building Drijeva ros_po_bonus
        console_command create_building Landshut ros_po_bonus
        console_command create_building Salins ros_po_bonus
        console_command create_building Udine ros_po_bonus
        console_command create_building Gastein ros_po_bonus
        console_command create_building Chambery ros_po_bonus
        console_command create_building Aosta ros_po_bonus
        console_command create_building Kelibia ros_po_bonus
        console_command create_building Sinigaglia    ros_po_bonus
        console_command create_building Faenza   ros_po_bonus
        console_command create_building Incisa  ros_po_bonus
        console_command create_building Kempten ros_po_bonus
        console_command create_building Mirandola ros_po_bonus
        console_command create_building Montechiarugolo ros_po_bonus
        console_command create_building Cavtat ros_po_bonus
        console_command create_building Virovitica ros_po_bonus
        console_command create_building Raab ros_po_bonus
        console_command create_building Papa ros_po_bonus
        console_command create_building Eisenburg ros_po_bonus
        console_command create_building Gran ros_po_bonus
        console_command create_building Ostrovica ros_po_bonus
        console_command create_building Vranduk   ros_po_bonus
        console_command create_building Florenz   ros_po_bonus

        console_command create_building Pisa ros_target    
        console_command create_unit Pisa ros_Peasants 1 0 0

        faction_emerge moors poland 1 400.0 0.0 1.2 town false unused_label1 unused_name 30


        campaign_wait 0.1

        if I_NumberOfSettlements moors == 0
            give_everything_to_faction moors poland false 
        end_if                                                                        

        if I_NumberOfSettlements moors > 0
            if not I_SettlementOwner Pisa = moors
                give_everything_to_faction moors poland false
            end_if

            if I_SettlementOwner Pisa = moors 
                give_everything_to_faction moors slave false
            end_if
        end_if    

        destroy_units venice ros_Peasants
        destroy_buildings venice ros_temp_buildings false
        destroy_buildings venice ros_temp_buildings false
        destroy_units spain ros_Peasants
        destroy_buildings spain ros_temp_buildings false
        destroy_buildings spain ros_temp_buildings false
        destroy_units france ros_Peasants
        destroy_buildings france ros_temp_buildings false
        destroy_buildings france ros_temp_buildings false
        destroy_units hre ros_Peasants
        destroy_buildings hre ros_temp_buildings false
        destroy_buildings hre ros_temp_buildings false
        destroy_units milan ros_Peasants
        destroy_buildings milan ros_temp_buildings false
        destroy_buildings milan ros_temp_buildings false
        destroy_units turks ros_Peasants
        destroy_buildings turks ros_temp_buildings false
        destroy_buildings turks ros_temp_buildings false
        destroy_units hungary ros_Peasants
        destroy_buildings hungary ros_temp_buildings false
        destroy_buildings hungary ros_temp_buildings false
        destroy_units papal_states ros_Peasants
        destroy_buildings papal_states ros_temp_buildings false
        destroy_buildings papal_states ros_temp_buildings false
        destroy_units saxons ros_Peasants
        destroy_buildings saxons ros_temp_buildings false
        destroy_buildings saxons ros_temp_buildings false
        destroy_units poland ros_Peasants
        destroy_buildings poland ros_temp_buildings false
        destroy_buildings poland ros_temp_buildings false
        destroy_units sicily ros_Peasants
        destroy_buildings sicily ros_temp_buildings false
        destroy_buildings sicily ros_temp_buildings false 
        destroy_units slave ros_Peasants
        destroy_buildings slave ros_temp_buildings false
        destroy_buildings slave ros_temp_buildings false
        destroy_units normans ros_Peasants
        destroy_buildings normans ros_temp_buildings false
        destroy_buildings normans ros_temp_buildings false 
        destroy_units denmark ros_Peasants
        destroy_buildings denmark ros_temp_buildings false
        destroy_buildings denmark ros_temp_buildings false 
        destroy_units byzantium ros_Peasants
        destroy_buildings byzantium ros_temp_buildings false
        destroy_buildings byzantium ros_temp_buildings false 
        destroy_units england ros_Peasants
        destroy_buildings england ros_temp_buildings false
        destroy_buildings england ros_temp_buildings false 
        destroy_units russia ros_Peasants
        destroy_buildings russia ros_temp_buildings false
        destroy_buildings russia ros_temp_buildings false 
        destroy_units scotland ros_Peasants
        destroy_buildings scotland ros_temp_buildings false
        destroy_buildings scotland ros_temp_buildings false 
        destroy_units egypt ros_Peasants
        destroy_buildings egypt ros_temp_buildings false
        destroy_buildings egypt ros_temp_buildings false 
        destroy_units savoy ros_Peasants
        destroy_buildings savoy ros_temp_buildings false
        destroy_buildings savoy ros_temp_buildings false 
        destroy_units montferrat ros_Peasants
        destroy_buildings montferrat ros_temp_buildings false
        destroy_buildings montferrat ros_temp_buildings false 
        destroy_units timurids ros_Peasants
        destroy_buildings timurids ros_temp_buildings false
        destroy_buildings timurids ros_temp_buildings false 
        destroy_units urbino ros_Peasants
        destroy_buildings urbino ros_temp_buildings false
        destroy_buildings urbino ros_temp_buildings false 
        destroy_units lucca ros_Peasants
        destroy_buildings lucca ros_temp_buildings false
        destroy_buildings lucca ros_temp_buildings false 

        create_unit Pisa, Rebel Pikemen, num 4, exp 3, arm 1, wep 0 
        create_unit Pisa, Italian MAA, num 2, exp 1, arm 0, wep 0   
        create_unit Pisa, Pavise Crossbowmen, num 2, exp 1, arm 0, wep 0 
        create_unit Pisa, Mercenary Arquebusiers, num 2, exp 2, arm 0, wep 0

        terminate_monitor
    end_monitor

    ;---------------------- Florenz: Mensch
    monitor_event FactionTurnStart FactionType poland
        and I_TurnNumber = 3
        and I_SettlementOwner Pisa = poland
        and not I_SettlementUnderSiege Pisa
        and I_EventCounter florenz_tribut_angenommen = 1	;Event triggert nur, wenn man Charles Angebot angenommen hat

        historic_event revolte_pisa factions { poland, }

        console_command create_building Perugia ros_po_bonus
        console_command create_building Aquila ros_po_bonus
        console_command create_building Pontecorvo ros_po_bonus
        console_command create_building Capua ros_po_bonus
        console_command create_building Brindisi ros_po_bonus
        console_command create_building Pantelleria ros_po_bonus
        console_command create_building Marsala ros_po_bonus
        console_command create_building Terranova ros_po_bonus
        console_command create_building Montepulciano ros_po_bonus
        console_command create_building Urbino ros_po_bonus
        console_command create_building Piacenza ros_po_bonus
        console_command create_building Alessandria ros_po_bonus
        console_command create_building Camerino ros_po_bonus
        console_command create_building Mompelgard ros_po_bonus
        console_command create_building Mondovi ros_po_bonus
        console_command create_building Barcelonnette ros_po_bonus
        console_command create_building Gimignano ros_po_bonus
        console_command create_building Livorno ros_po_bonus
        console_command create_building Massa ros_po_bonus
        console_command create_building Novara ros_po_bonus
        console_command create_building Nuoro ros_po_bonus
        console_command create_building Biserta ros_po_bonus
        console_command create_building Rom ros_po_bonus
        console_command create_building Neapel ros_po_bonus
        console_command create_building Bologna ros_po_bonus
        console_command create_building Mailand ros_po_bonus
        console_command create_building Turin ros_po_bonus
        console_command create_building Genua ros_po_bonus
        console_command create_building Volterra ros_po_bonus
        console_command create_building Arezzo ros_po_bonus
        console_command create_building Siena ros_po_bonus
        console_command create_building Piombino ros_po_bonus
        console_command create_building Portoferraio ros_po_bonus
        console_command create_building Grosseto ros_po_bonus
        console_command create_building Orvieto ros_po_bonus
        console_command create_building Civita ros_po_bonus
        console_command create_building Lucca ros_po_bonus
        console_command create_building Mantua ros_po_bonus
        console_command create_building Ferrara ros_po_bonus
        console_command create_building Fivizanno ros_po_bonus
        console_command create_building Guastalla ros_po_bonus
        console_command create_building Modena ros_po_bonus
        console_command create_building Parma ros_po_bonus
        console_command create_building Pavia ros_po_bonus
        console_command create_building Brescia ros_po_bonus
        console_command create_building Cremona ros_po_bonus
        console_command create_building Verona ros_po_bonus
        console_command create_building Casale ros_po_bonus
        console_command create_building Asti ros_po_bonus
        console_command create_building Rovigo ros_po_bonus
        console_command create_building Forli ros_po_bonus
        console_command create_building Ravenna ros_po_bonus
        console_command create_building Rimini ros_po_bonus
        console_command create_building Ancona ros_po_bonus
        console_command create_building Fermo ros_po_bonus
        console_command create_building Spoleto ros_po_bonus
        console_command create_building Gaeta ros_po_bonus
        console_command create_building Foggia ros_po_bonus
        console_command create_building Pescara ros_po_bonus
        console_command create_building Benevento ros_po_bonus
        console_command create_building Otranto ros_po_bonus
        console_command create_building Bari ros_po_bonus
        console_command create_building Salerno ros_po_bonus
        console_command create_building Potenza ros_po_bonus
        console_command create_building Policastro ros_po_bonus
        console_command create_building Cosenza ros_po_bonus
        console_command create_building Reggio ros_po_bonus
        console_command create_building Messina ros_po_bonus
        console_command create_building Syrakus ros_po_bonus
        console_command create_building Girgenti ros_po_bonus
        console_command create_building Palermo ros_po_bonus
        console_command create_building Malta ros_po_bonus
        console_command create_building Tunis ros_po_bonus
        console_command create_building Qairawan ros_po_bonus
        console_command create_building Al_Kaf ros_po_bonus
        console_command create_building Annaba ros_po_bonus
        console_command create_building Qusantina ros_po_bonus
        console_command create_building Cagliari ros_po_bonus
        console_command create_building Oristano ros_po_bonus
        console_command create_building Sassari ros_po_bonus
        console_command create_building Bonifacio ros_po_bonus
        console_command create_building Ajaccio ros_po_bonus
        console_command create_building Bastia ros_po_bonus
        console_command create_building Noli ros_po_bonus
        console_command create_building Nice ros_po_bonus
        console_command create_building Toulon ros_po_bonus
        console_command create_building Marseille ros_po_bonus
        console_command create_building Saluzzo ros_po_bonus
        console_command create_building Avignon ros_po_bonus
        console_command create_building Vienne ros_po_bonus
        console_command create_building Grenoble ros_po_bonus
        console_command create_building Lyon ros_po_bonus
        console_command create_building Genf ros_po_bonus
        console_command create_building Chalon ros_po_bonus
        console_command create_building Dijon ros_po_bonus
        console_command create_building Chaumont ros_po_bonus
        console_command create_building Besancon ros_po_bonus
        console_command create_building Lausanne ros_po_bonus
        console_command create_building Bern ros_po_bonus
        console_command create_building Sion ros_po_bonus
        console_command create_building Zurich ros_po_bonus
        console_command create_building Chur ros_po_bonus
        console_command create_building Nancy ros_po_bonus
        console_command create_building Strassburg ros_po_bonus
        console_command create_building Mulhouse ros_po_bonus
        console_command create_building Baden ros_po_bonus
        console_command create_building Freiburg ros_po_bonus
        console_command create_building Stuttgart ros_po_bonus
        console_command create_building Rottweil ros_po_bonus
        console_command create_building Bregenz ros_po_bonus
        console_command create_building Augsburg ros_po_bonus
        console_command create_building Ulm ros_po_bonus
        console_command create_building Ravensburg ros_po_bonus
        console_command create_building Krk ros_po_bonus
        console_command create_building Supetar ros_po_bonus
        console_command create_building Cattaro ros_po_bonus
        console_command create_building Ragusa ros_po_bonus
        console_command create_building Ston ros_po_bonus
        console_command create_building Trient ros_po_bonus
        console_command create_building Venedig ros_po_bonus
        console_command create_building Padua ros_po_bonus
        console_command create_building Treviso ros_po_bonus
        console_command create_building Trieste ros_po_bonus
        console_command create_building Pola ros_po_bonus
        console_command create_building Fiume ros_po_bonus
        console_command create_building Bihac ros_po_bonus
        console_command create_building Sinj ros_po_bonus
        console_command create_building Zara ros_po_bonus
        console_command create_building Spalato ros_po_bonus
        console_command create_building Innsbruck ros_po_bonus
        console_command create_building Munchen ros_po_bonus
        console_command create_building Freising ros_po_bonus
        console_command create_building Passau ros_po_bonus
        console_command create_building Laibach ros_po_bonus
        console_command create_building Villach ros_po_bonus
        console_command create_building Salzburg ros_po_bonus
        console_command create_building Sissek ros_po_bonus
        console_command create_building Trebinje ros_po_bonus
        console_command create_building Mostar ros_po_bonus
        console_command create_building Sarajevo ros_po_bonus
        console_command create_building Jajce ros_po_bonus
        console_command create_building Eszek ros_po_bonus
        console_command create_building Warasdin ros_po_bonus
        console_command create_building Zagreb ros_po_bonus
        console_command create_building Marburg ros_po_bonus
        console_command create_building Wien ros_po_bonus
        console_command create_building Linz ros_po_bonus
        console_command create_building Graz ros_po_bonus
        console_command create_building Odenburg ros_po_bonus
        console_command create_building Buda ros_po_bonus
        console_command create_building Nyitra ros_po_bonus
        console_command create_building Pressburg ros_po_bonus
        console_command create_building Pecs ros_po_bonus
        console_command create_building Stuhlweisenberg ros_po_bonus
        console_command create_building Kanizsa ros_po_bonus
        console_command create_building Keszthely ros_po_bonus
        console_command create_building Veszprem ros_po_bonus
        console_command create_building Susa ros_po_bonus
        console_command create_building Die ros_po_bonus
        console_command create_building Aix ros_po_bonus
        console_command create_building Gallen ros_po_bonus
        console_command create_building Basel ros_po_bonus
        console_command create_building Bellinzona ros_po_bonus
        console_command create_building Adelsberg ros_po_bonus
        console_command create_building Severin ros_po_bonus
        console_command create_building Banjaluka ros_po_bonus
        console_command create_building Mljet ros_po_bonus
        console_command create_building Neuenburg ros_po_bonus
        console_command create_building Lipari ros_po_bonus
        console_command create_building Brixen ros_po_bonus
        console_command create_building Pago ros_po_bonus
        console_command create_building Drijeva ros_po_bonus
        console_command create_building Landshut ros_po_bonus
        console_command create_building Salins ros_po_bonus
        console_command create_building Udine ros_po_bonus
        console_command create_building Gastein ros_po_bonus
        console_command create_building Chambery ros_po_bonus
        console_command create_building Aosta ros_po_bonus
        console_command create_building Kelibia ros_po_bonus
        console_command create_building Sinigaglia    ros_po_bonus
        console_command create_building Faenza   ros_po_bonus
        console_command create_building Incisa  ros_po_bonus
        console_command create_building Kempten ros_po_bonus
        console_command create_building Mirandola ros_po_bonus
        console_command create_building Montechiarugolo ros_po_bonus
        console_command create_building Cavtat ros_po_bonus
        console_command create_building Virovitica ros_po_bonus
        console_command create_building Raab ros_po_bonus
        console_command create_building Papa ros_po_bonus
        console_command create_building Eisenburg ros_po_bonus
        console_command create_building Gran ros_po_bonus
        console_command create_building Ostrovica ros_po_bonus
        console_command create_building Vranduk   ros_po_bonus
        console_command create_building Florenz   ros_po_bonus


        console_command create_building Pisa ros_target    
        console_command create_unit Pisa ros_Peasants 1 0 0

        faction_emerge moors poland 1 400.0 0.0 1.2 town false unused_label1 unused_name 30


        campaign_wait 0.1

        if I_NumberOfSettlements moors == 0
            give_everything_to_faction moors poland false 
        end_if                                                                        

        if I_NumberOfSettlements moors > 0
            if not I_SettlementOwner Pisa = moors
                give_everything_to_faction moors poland false
            end_if

            if I_SettlementOwner Pisa = moors 
                give_everything_to_faction moors slave false
            end_if
        end_if    

        destroy_units venice ros_Peasants
        destroy_buildings venice ros_temp_buildings false
        destroy_buildings venice ros_temp_buildings false
        destroy_units spain ros_Peasants
        destroy_buildings spain ros_temp_buildings false
        destroy_buildings spain ros_temp_buildings false
        destroy_units france ros_Peasants
        destroy_buildings france ros_temp_buildings false
        destroy_buildings france ros_temp_buildings false
        destroy_units hre ros_Peasants
        destroy_buildings hre ros_temp_buildings false
        destroy_buildings hre ros_temp_buildings false
        destroy_units milan ros_Peasants
        destroy_buildings milan ros_temp_buildings false
        destroy_buildings milan ros_temp_buildings false
        destroy_units turks ros_Peasants
        destroy_buildings turks ros_temp_buildings false
        destroy_buildings turks ros_temp_buildings false
        destroy_units hungary ros_Peasants
        destroy_buildings hungary ros_temp_buildings false
        destroy_buildings hungary ros_temp_buildings false
        destroy_units papal_states ros_Peasants
        destroy_buildings papal_states ros_temp_buildings false
        destroy_buildings papal_states ros_temp_buildings false
        destroy_units saxons ros_Peasants
        destroy_buildings saxons ros_temp_buildings false
        destroy_buildings saxons ros_temp_buildings false
        destroy_units poland ros_Peasants
        destroy_buildings poland ros_temp_buildings false
        destroy_buildings poland ros_temp_buildings false
        destroy_units sicily ros_Peasants
        destroy_buildings sicily ros_temp_buildings false
        destroy_buildings sicily ros_temp_buildings false 
        destroy_units slave ros_Peasants
        destroy_buildings slave ros_temp_buildings false
        destroy_buildings slave ros_temp_buildings false
        destroy_units normans ros_Peasants
        destroy_buildings normans ros_temp_buildings false
        destroy_buildings normans ros_temp_buildings false 
        destroy_units denmark ros_Peasants
        destroy_buildings denmark ros_temp_buildings false
        destroy_buildings denmark ros_temp_buildings false 
        destroy_units byzantium ros_Peasants
        destroy_buildings byzantium ros_temp_buildings false
        destroy_buildings byzantium ros_temp_buildings false 
        destroy_units england ros_Peasants
        destroy_buildings england ros_temp_buildings false
        destroy_buildings england ros_temp_buildings false 
        destroy_units russia ros_Peasants
        destroy_buildings russia ros_temp_buildings false
        destroy_buildings russia ros_temp_buildings false 
        destroy_units scotland ros_Peasants
        destroy_buildings scotland ros_temp_buildings false
        destroy_buildings scotland ros_temp_buildings false 
        destroy_units egypt ros_Peasants
        destroy_buildings egypt ros_temp_buildings false
        destroy_buildings egypt ros_temp_buildings false 
        destroy_units savoy ros_Peasants
        destroy_buildings savoy ros_temp_buildings false
        destroy_buildings savoy ros_temp_buildings false 
        destroy_units montferrat ros_Peasants
        destroy_buildings montferrat ros_temp_buildings false
        destroy_buildings montferrat ros_temp_buildings false 
        destroy_units timurids ros_Peasants
        destroy_buildings timurids ros_temp_buildings false
        destroy_buildings timurids ros_temp_buildings false 
        destroy_units urbino ros_Peasants
        destroy_buildings urbino ros_temp_buildings false
        destroy_buildings urbino ros_temp_buildings false 
        destroy_units lucca ros_Peasants
        destroy_buildings lucca ros_temp_buildings false
        destroy_buildings lucca ros_temp_buildings false 

        create_unit Pisa, Rebel Pikemen, num 4, exp 3, arm 1, wep 0 
        create_unit Pisa, Italian MAA, num 2, exp 1, arm 0, wep 0   
        create_unit Pisa, Pavise Crossbowmen, num 2, exp 1, arm 0, wep 0 
        create_unit Pisa, Mercenary Arquebusiers, num 2, exp 2, arm 0, wep 0

        terminate_monitor
    end_monitor

    monitor_event FactionTurnStart FactionType poland
        and I_CompareCounter Spieler_ist_Florenz = 1
        and I_TurnNumber = 16
        and I_SettlementOwner Pisa = slave
        and not I_SettlementOwner Pisa = poland
        and I_EventCounter florenz_tribut_angenommen = 1	;Event triggert nur, wenn man Charles Angebot angenommen hat

        historic_event krieg_Pisa factions { poland, }

        terminate_monitor 
    end_monitor

    monitor_event FactionTurnStart FactionType poland
        and I_CompareCounter Spieler_ist_Florenz = 1
        and I_TurnNumber > 15

        inc_counter krieg_mit_pisa 1 

        if I_CompareCounter krieg_mit_pisa = 1
            historic_event start_pisa
        end_if

        if I_SettlementOwner Pisa = poland
            and I_CompareCounter krieg_mit_pisa < 6

            terminate_monitor
        end_if

        if I_CompareCounter krieg_mit_pisa = 6
            and not I_SettlementOwner Pisa = poland
            historic_event fail_pisa factions { poland, }
            add_settlement_turmoil Florenz 40
            increment_kings_purse Poland, -500
            terminate_monitor
        end_if

    end_monitor	

    monitor_event GeneralCaptureSettlement SettlementName Pisa
        and I_LocalFaction poland
        and I_CompareCounter krieg_mit_pisa > 0
        and I_CompareCounter krieg_mit_pisa < 6
        and I_TurnNumber > 15
        and I_SettlementOwner Pisa = poland

        historic_event ende_pisa factions { poland, }
        console_command give_ancillary "Piero de Medici" banner_florenz

        terminate_monitor
    end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- Eroberung der Toskana ---------------------------------
    ;------------------------------------------------------------------------------

    monitor_event FactionTurnStart FactionType poland
        and I_TurnNumber = 0

        historic_event toskana_erobern factions { poland, }

        terminate_monitor
    end_monitor

    monitor_event FactionTurnStart FactionType poland
        and I_TurnNumber > 148
        and I_LocalFaction poland 
        and DiplomaticStanceFromFaction hre = Allied
        and I_SettlementOwner Florenz = poland	
        and I_SettlementOwner Volterra = poland
        and I_SettlementOwner Gimignano = poland
        and I_SettlementOwner Livorno = poland
        and I_SettlementOwner Grosseto = poland
        and I_SettlementOwner Montepulciano = poland
        and I_SettlementOwner Arezzo = poland
        and I_SettlementOwner Piombino = poland
        and I_SettlementOwner Siena = poland
        and I_SettlementOwner Pisa = poland
        and I_SettlementOwner Lucca = poland

        historic_event toskana_erobert true factions { poland, }


        terminate_monitor
    end_monitor


    monitor_event EventCounter EventCounterType toskana_erobert_accepted

        set_faction_banner
            faction poland
            banner portugal
        end_set_faction_banner

        give_everything_to_faction portugal poland false

        historic_event ghz_entstanden

        set_event_counter ghz_erstellt 1
        set_event_counter miliz 0

        set_faction_standing poland france -0.5
        set_faction_standing poland papal_states -0.5

        console_command diplomatic_stance hre poland Allied
        console_command diplomatic_stance spain poland Allied

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType toskana_erobert_declined

        historic_event ghz_abgelehnt

        set_event_counter ghz_abgelehnt 1

        set_faction_standing poland france 0.5
        set_faction_standing france poland 0.5
        set_faction_standing poland hre -0.5
        set_faction_standing hre poland -0.5

        terminate_monitor
    end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- Aufstand der Republikaner -----------------------------
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and I_TurnNumber = 176
        and I_EventCounter ghz_erstellt = 1

        historic_event aufstand_republik factions { poland, }

        add_settlement_turmoil Florenz 60

        console_command diplomatic_stance poland france War

        spawn_army 
            faction slave, sub_faction france 
            character	Pietro Strozzi, named character, age 27, x 98, y 174, label pietro01, direction N
            traits LoyaltyStarter 1 , GoodCommander 1 , ReligionStarter 1 
            unit		NE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
            unit		Condottieri				exp 5 armour 0 weapon_lvl 0
            unit		Condottieri				exp 3 armour 0 weapon_lvl 0
            unit		Frz Pike Militia				exp 4 armour 0 weapon_lvl 0
            unit		Frz Pike Militia				exp 2 armour 1 weapon_lvl 0
            unit		Frz Pike Militia				exp 4 armour 0 weapon_lvl 0
            unit		Partisan Militia				exp 3 armour 2 weapon_lvl 0
            unit		Partisan Militia				exp 3 armour 2 weapon_lvl 0
            unit		Partisan Militia				exp 3 armour 2 weapon_lvl 0
            unit		NE Basilisk			exp 2 armour 0 weapon_lvl 0
            unit		Arquebusiers			exp 3 armour 1 weapon_lvl 0
            unit		Arquebusiers			exp 3 armour 1 weapon_lvl 0
        end

        terminate_monitor
    end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- Strafgericht ------------------------------------------
    ;------------------------------------------------------------------------------

    monitor_event FactionTurnStart FactionType poland
        and I_EventCounter ghz_erstellt = 1
        and I_TurnNumber > 176

        if not I_CharacterExists pietro01
            and I_TurnNumber < 181

            historic_event strafgericht factions { poland, }

            console_command add_money 1000

            set_event_counter strafgericht 1

            set_faction_standing milan poland -0.1

            set_faction_standing venice poland -0.1

            set_faction_standing papal_states poland -0.1

            set_faction_standing sicily poland -0.1

            terminate_monitor
        end_if

        if I_CharacterExists pietro01
            and I_TurnNumber = 180

            kill_character pietro01

            historic_event strafgericht factions { poland, }

            console_command add_money 1000

            set_event_counter strafgericht 1

            set_faction_standing milan poland -0.1

            set_faction_standing venice poland -0.1

            set_faction_standing papal_states poland -0.1

            set_faction_standing sicily poland -0.1

            terminate_monitor
        end_if


    end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- Unterstützung gegen Frankreich ------------------------
    ;------------------------------------------------------------------------------

    declare_counter krieg_hre_france_ghz

    monitor_event FactionWarDeclared FactionType france
        and TargetFactionType Hre

        set_counter krieg_hre_france_ghz 1

    end_monitor

    monitor_event FactionWarDeclared FactionType hre
        and TargetFactionType France

        set_counter krieg_hre_france_ghz 1

    end_monitor

    monitor_event FactionTurnStart FactionType poland
        and not DiplomaticStanceFromFaction hre = AtWar
        and I_CompareCounter krieg_hre_france_ghz = 1
        and I_EventCounter ghz_erstellt = 1

        historic_event ghz_support_habsburg true factions { poland, }


    end_monitor
    ;------------------------------------------------------------------------------

    monitor_event EventCounter EventCounterType ghz_support_habsburg_accepted


        if I_CompareCounter krieg_hre_france_ghz = 1

            set_counter krieg_hre_france_ghz 0

            spawn_army 
                faction poland
                character random_name, named character, age 46, x 84, y 182
                traits GoodCommander 3 , BattleDread 2, NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
                unit		SE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
                unit		GHZ FL Pike Militia		exp 2 armour 0 weapon_lvl 0
                unit		GHZ FL Pike Militia			exp 2 armour 0 weapon_lvl 0
                unit		GHZ Halberd Militia				exp 1 armour 1 weapon_lvl 0
                unit		GHZ Halberd Militia				exp 1 armour 1 weapon_lvl 0
                unit		Spanish Dragoons				exp 1 armour 1 weapon_lvl 0
                unit		GHZ Lancers			exp 2 armour 0 weapon_lvl 0
                unit		GHZ Lancers			exp 2 armour 0 weapon_lvl 0
                unit		GHZ Arquebusiers			exp 1 armour 1 weapon_lvl 0
                unit		GHZ Arquebusiers			exp 1 armour 1 weapon_lvl 0
                unit		GHZ Arquebusiers			exp 1 armour 1 weapon_lvl 0
            end

            console_command diplomatic_stance poland france War


        end_if

        console_command add_money poland, -5000

        set_faction_standing hre poland 1.0
        set_faction_standing poland hre 1.0

    end_monitor
    ;------------------------------------------------------------------------------

    monitor_event EventCounter EventCounterType ghz_support_habsburg_declined

        set_faction_standing hre poland -1.0
        set_faction_standing poland hre -1.0

        set_counter krieg_hre_france_ghz 0

    end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- Untergang des Mamelukenreichs -------------------------
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and I_TurnNumber = 96

        historic_event mamelukenreich factions { turks, }

        set_event_counter mameluken_bonus 1

        terminate_monitor
    end_monitor

    ;------------------------------------------------------------------------------
    ;---------------------- Eroberung Belgrads ------------------------------------
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and I_TurnNumber = 112

        historic_event belgrad factions { turks, }

        set_event_counter balkan_bonus 1

        terminate_monitor
    end_monitor

    ;------------------------------------------------------------------------------
    ;---------------------- Ban von Bosnien ---------------------------------------
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and I_TurnNumber = 60
        and I_SettlementOwner Sinj = turks
        and I_SettlementOwner Jajce = turks
        and I_SettlementOwner Mostar = turks

        historic_event ban_bosnien factions { turks, }

        spawn_army 
            faction slave, sub_faction hungary
            character Matej Tomasevic, named character, age 36, x 193, y 174
            traits GoodCommander 3 , BattleDread 2, NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Hussars		exp 3 armour 0 weapon_lvl 0
            unit		Hussars		exp 3 armour 0 weapon_lvl 0
            unit		Hussars		exp 3 armour 0 weapon_lvl 0
            unit		EE Spear Militia		exp 3 armour 0 weapon_lvl 0
            unit		EE Spear Militia		exp 3 armour 0 weapon_lvl 0
            unit		Footmen		exp 3 armour 0 weapon_lvl 0
            unit		Footmen		exp 3 armour 0 weapon_lvl 0
            unit		Arquebusiers_ug		exp 3 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction slave, sub_faction hungary
            character Michael, named character, age 28, x 189, y 170
            traits GoodCommander 3 , BattleDread 2, NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Footmen		exp 3 armour 0 weapon_lvl 0
            unit		Footmen 	exp 3 armour 0 weapon_lvl 0
            unit		Arquebusiers_ug		exp 3 armour 0 weapon_lvl 0
            unit		Bosnian Archers		exp 3 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction slave, sub_faction hungary
            character Vlad, named character, age 50, x 190, y 183
            traits GoodCommander 3 , BattleDread 2, NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Hussars		exp 3 armour 0 weapon_lvl 0
            unit		Hussars		exp 3 armour 0 weapon_lvl 0
            unit		Hussars		exp 3 armour 0 weapon_lvl 0
            unit		Hussars		exp 3 armour 0 weapon_lvl 0
        end

        add_settlement_turmoil Sarajevo 15
        add_settlement_turmoil Sinj 25
        add_settlement_turmoil Mostar 30
        add_settlement_turmoil Jajce 15

        terminate_monitor
    end_monitor

    ;------------------------------------------------------------------------------
    ;---------------------- Fall von Rhodos  --------------------------------------
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and I_TurnNumber = 120

        historic_event rhodos factions { turks, }

        increment_kings_purse turks 800

        terminate_monitor
    end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- Respawn -----------------------------------------------
    ;------------------------------------------------------------------------------

    declare_counter respawn		;Wann werden die Türken wieder gespawnt?
    declare_counter anzahl		;Wie oft wurden die Türken schon gespawnt?

    monitor_event FactionTurnEnd FactionIsLocal
        and I_NumberOfSettlements turks < 1 
        and I_CompareCounter anzahl < 4

        if I_CompareCounter respawn = 0

            historic_event osmanen_spawn

            set_counter respawn 1

        end_if

        if I_CompareCounter respawn > 0

            inc_counter respawn 1

        end_if

        if I_CompareCounter respawn = 2

            spawn_army
                faction turks
                character random_name, named character, age 45, x 217, y 187, family
                traits GoodCommander 3 , PoliticsSkill 2 , GoodAdministrator 1 , ReligionStarter 1 , PublicFaith 3 , Aesthetic 1
                unit		ME Late Bodyguard		exp 4 armour 0 weapon_lvl 0
                unit		Sipahis				exp 4 armour 0 weapon_lvl 0
                unit		Cebeli		exp 5 armour 0 weapon_lvl 0
                unit		Sipahis		exp 2 armour 0 weapon_lvl 0
                unit		Turkmen		exp 2 armour 0 weapon_lvl 0
                unit		Serdengecti		exp 2 armour 0 weapon_lvl 0
                unit		Serdengecti		exp 4 armour 0 weapon_lvl 0
                unit		Dismounted Sipahi Lancers		exp 5 armour 0 weapon_lvl 0
                unit		Dismounted Sipahi Lancers		exp 0 armour 0 weapon_lvl 0
                unit		Janissary Heavy Inf		exp 1 armour 0 weapon_lvl 0
                unit		Janissary Archers		exp 3 armour 0 weapon_lvl 0
                unit		Anatolian Javelineers		exp 2 armour 0 weapon_lvl 0
                unit		Azab		exp 2 armour 0 weapon_lvl 0
                unit		ME Cannon		exp 3 armour 0 weapon_lvl 0
            end

            spawn_army
                faction turks
                character random_name, named character, age 26, x 218, y 197, family
                traits GoodCommander 3 , PoliticsSkill 2 , GoodAdministrator 1 , ReligionStarter 1 , PublicFaith 3 , Aesthetic 1
                unit		ME Late Bodyguard		exp 4 armour 0 weapon_lvl 0
                unit		Sipahis				exp 4 armour 0 weapon_lvl 0
                unit		Cebeli		exp 5 armour 0 weapon_lvl 0
                unit		Sipahis		exp 3 armour 0 weapon_lvl 0
                unit		Sipahis		exp 3 armour 0 weapon_lvl 0
                unit		Sipahis		exp 3 armour 0 weapon_lvl 0
                unit		Dismounted Sipahi Lancers		exp 3 armour 0 weapon_lvl 0
                unit		Dismounted Sipahi Lancers		exp 3 armour 0 weapon_lvl 0
                unit		Dismounted Sipahi Lancers		exp 3 armour 0 weapon_lvl 0
                unit		Azab		exp 3 armour 0 weapon_lvl 0
                unit		Azab		exp 3 armour 0 weapon_lvl 0
            end

            spawn_army
                faction turks
                character random_name, named character, age 33, x 218, y 178, family
                traits GoodCommander 3 , PoliticsSkill 2 , GoodAdministrator 1 , ReligionStarter 1 , PublicFaith 3 , Aesthetic 1
                unit		ME Late Bodyguard		exp 4 armour 0 weapon_lvl 0
                unit		Sipahis				exp 4 armour 0 weapon_lvl 0
                unit		Cebeli		exp 5 armour 0 weapon_lvl 0
                unit		Sipahis		exp 2 armour 0 weapon_lvl 0
                unit		Turkmen		exp 2 armour 0 weapon_lvl 0
                unit		Serdengecti		exp 2 armour 0 weapon_lvl 0
                unit		Serdengecti		exp 4 armour 0 weapon_lvl 0
                unit		Dismounted Sipahi Lancers		exp 5 armour 0 weapon_lvl 0
                unit		Dismounted Sipahi Lancers		exp 0 armour 0 weapon_lvl 0
                unit		Janissary Heavy Inf		exp 1 armour 0 weapon_lvl 0
                unit		Janissary Archers		exp 3 armour 0 weapon_lvl 0
                unit		Anatolian Javelineers		exp 2 armour 0 weapon_lvl 0
                unit		Azab		exp 2 armour 0 weapon_lvl 0
                unit		ME Cannon		exp 3 armour 0 weapon_lvl 0
            end


            set_counter respawn -10
            inc_counter anzahl 1

        end_if

        if I_CompareCounter respawn < 0

            inc_counter respawn 1

        end_if
    end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- Fall von Sinj -----------------------------------------
    ;------------------------------------------------------------------------------

    monitor_event GeneralCaptureSettlement SettlementName Sinj
	and FactionIsLocal
	
        if I_LocalFaction hungary

            historic_event sinj_hungary

            set_event_counter sinj_ungarn 1

        end_if

        if I_LocalFaction turks

            historic_event sinj_turks

            set_event_counter sinj_ungarn 1

        end_if

        terminate_monitor
    end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- Fall von Bihac ----------------------------------------
    ;------------------------------------------------------------------------------
    monitor_event GeneralCaptureSettlement SettlementName Bihac
	and FactionIsLocal
	
        if I_LocalFaction hungary

            historic_event bihac_hungary

            set_event_counter bihac_ungarn 1

        end_if

        if I_LocalFaction turks

            historic_event bihac_turks

            set_event_counter bihac_ungarn 1

        end_if

        terminate_monitor
    end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- Auflösung Serbiens ------------------------------------
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and I_LocalFaction hungary
        and I_TurnNumber = 116

        historic_event despot_exil true

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType despot_exil_accepted = 1

        historic_event despot_exil_yes

        console_command add_money hungary, -10000

        spawn_army
            faction hungary
            character Stevan Berislavic, named character, age 41, x 214, y 218, direction S
            traits GoodCommander 3 , BattleDread 2, NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
            unit		NE Late Bodyguard		exp 5 armour 0 weapon_lvl 0
            unit		Hussars		exp 3 armour 0 weapon_lvl 0
            unit		Hussars		exp 3 armour 0 weapon_lvl 0
            unit		Hussars		exp 3 armour 0 weapon_lvl 0
            unit		Halberd Militia_ug		exp 3 armour 0 weapon_lvl 0
            unit		Halberd Militia_ug		exp 3 armour 0 weapon_lvl 0
            unit		Halberd Militia_ug		exp 3 armour 0 weapon_lvl 0
            unit		Arquebusiers_ug		exp 3 armour 0 weapon_lvl 0
            unit		Bosnian Archers		exp 3 armour 0 weapon_lvl 0
        end

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType despot_exil_declined = 1

        historic_event despot_exil_no

        spawn_army
            faction turks
            character Stevan Berislavic, named character, age 41, x 214, y 218, direction N
            traits GoodCommander 3 , NaturalMilitarySkill 1 , GoodAttacker 3
            unit		ME Late Bodyguard		exp 5 armour 0 weapon_lvl 0
            unit		Sipahis		exp 3 armour 0 weapon_lvl 0
            unit		Sipahis		exp 3 armour 0 weapon_lvl 0
            unit		Sipahis		exp 3 armour 0 weapon_lvl 0
            unit		Dismounted Sipahi Lancers		exp 3 armour 0 weapon_lvl 0
            unit		Dismounted Sipahi Lancers		exp 3 armour 0 weapon_lvl 0
            unit		Dismounted Sipahi Lancers		exp 3 armour 0 weapon_lvl 0
            unit		Azab		exp 3 armour 0 weapon_lvl 0
            unit		Azab		exp 3 armour 0 weapon_lvl 0
        end

        terminate_monitor
    end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- Belagerung Kanizsas -----------------------------------
    ;------------------------------------------------------------------------------

    declare_counter Belagerung_Kanizsa

    monitor_event FactionTurnStart FactionType turks
        and I_TurnNumber >= 120
        and I_CompareCounter Spieler_ist_Ungarn = 1
        and I_SettlementOwner Virovitica = turks
        and not I_SettlementOwner Kanizsa = turks


        historic_event belagerung_kanizsa

        spawn_army
            faction turks
            character random_name, named character, age 39, x 189, y 233, label siege_kanizsa
            traits GoodCommander 2 , BattleDread 3, LoyaltyStarter 1, GoodAttacker 2
            unit		ME Late Bodyguard		exp 4 armour 0 weapon_lvl 0
            unit		Sipahis				exp 4 armour 0 weapon_lvl 0
            unit		Cebeli		exp 5 armour 0 weapon_lvl 0
            unit		Sipahis		exp 2 armour 0 weapon_lvl 0
            unit		Turkmen		exp 2 armour 0 weapon_lvl 0
            unit		Serdengecti		exp 2 armour 0 weapon_lvl 0
            unit		Serdengecti		exp 4 armour 0 weapon_lvl 0
            unit		Dismounted Sipahi Lancers		exp 5 armour 0 weapon_lvl 0
            unit		Dismounted Sipahi Lancers		exp 0 armour 0 weapon_lvl 0
            unit		Janissary Heavy Inf		exp 1 armour 0 weapon_lvl 0
            unit		Janissary Archers		exp 3 armour 0 weapon_lvl 0
            unit		Anatolian Javelineers		exp 2 armour 0 weapon_lvl 0
            unit		Azab		exp 2 armour 0 weapon_lvl 0
            unit		ME Cannon		exp 3 armour 0 weapon_lvl 0
        end

        set_counter Belagerung_Kanizsa 1

        set_faction_standing hungary turks -1.0
        set_faction_standing turks hungary -1.0

        console_command diplomatic_stance turks hungary War

        terminate_monitor
    end_monitor

    monitor_event FactionTurnStart FactionType turks

        and I_CharacterExists siege_kanizsa

        if I_SettlementOwner Kanizsa = turks
            terminate_monitor
        end_if

        if I_SettlementUnderSiege Kanizsa
            and I_EventCounter kanizsa_engage = 0
            terminate_monitor
        end_if

        if I_EventCounter kanizsa_engage = 1
            siege_settlement siege_kanizsa, Kanizsa, attack
            terminate_monitor
        end_if

        if I_EventCounter kanizsa_engage = 0
            siege_settlement siege_kanizsa, Kanizsa, maintain
            set_event_counter kanizsa_engage 1
        end_if
    end_monitor

    ;------------------------------------------------------------------------------
    ;---------------------------- Übergabe von Noli -------------------------------
    ;------------------------------------------------------------------------------
    monitor_event GeneralCaptureSettlement SettlementName Genua
        and FactionIsLocal
        and I_SettlementOwner Noli = slave
        and I_EventCounter noli_switched = 0

        if I_LocalFaction venice
            historic_event noli_angebot true
        end_if

        if I_LocalFaction spain
            historic_event noli_angebot true
        end_if

        if I_LocalFaction france
            historic_event noli_angebot true
        end_if

        if I_LocalFaction hre
            historic_event noli_angebot true
        end_if

        if I_LocalFaction milan
            historic_event noli_angebot true
        end_if

        if I_LocalFaction hungary
            historic_event noli_angebot true
        end_if

        if I_LocalFaction papal_states
            historic_event noli_angebot true
        end_if

        if I_LocalFaction poland
            historic_event noli_angebot true
        end_if

        if I_LocalFaction sicily
            historic_event noli_angebot true
        end_if

        terminate_monitor
    end_monitor

    ;--------------------------------- Venedig angenommen -------------------------

    monitor_event EventCounter EventCounterType noli_angebot_accepted
        and I_CompareCounter Spieler_ist_Venedig = 1
        and I_SettlementOwner Noli = slave
        and not I_SettlementUnderSiege Noli

        console_command add_money -10000
        historic_event noli_angebot_yes
        set_event_counter noli_switched 1

        console_command create_building Perugia ros_po_bonus
        console_command create_building Aquila ros_po_bonus
        console_command create_building Pontecorvo ros_po_bonus
        console_command create_building Capua ros_po_bonus
        console_command create_building Brindisi ros_po_bonus
        console_command create_building Pantelleria ros_po_bonus
        console_command create_building Marsala ros_po_bonus
        console_command create_building Terranova ros_po_bonus
        console_command create_building Montepulciano ros_po_bonus
        console_command create_building Urbino ros_po_bonus
        console_command create_building Piacenza ros_po_bonus
        console_command create_building Alessandria ros_po_bonus
        console_command create_building Camerino ros_po_bonus
        console_command create_building Mompelgard ros_po_bonus
        console_command create_building Mondovi ros_po_bonus
        console_command create_building Barcelonnette ros_po_bonus
        console_command create_building Gimignano ros_po_bonus
        console_command create_building Livorno ros_po_bonus
        console_command create_building Massa ros_po_bonus
        console_command create_building Novara ros_po_bonus
        console_command create_building Nuoro ros_po_bonus
        console_command create_building Biserta ros_po_bonus
        console_command create_building Rom ros_po_bonus
        console_command create_building Neapel ros_po_bonus
        console_command create_building Bologna ros_po_bonus
        console_command create_building Mailand ros_po_bonus
        console_command create_building Turin ros_po_bonus
        console_command create_building Genua ros_po_bonus
        console_command create_building Volterra ros_po_bonus
        console_command create_building Arezzo ros_po_bonus
        console_command create_building Siena ros_po_bonus
        console_command create_building Piombino ros_po_bonus
        console_command create_building Portoferraio ros_po_bonus
        console_command create_building Grosseto ros_po_bonus
        console_command create_building Orvieto ros_po_bonus
        console_command create_building Civita ros_po_bonus
        console_command create_building Lucca ros_po_bonus
        console_command create_building Mantua ros_po_bonus
        console_command create_building Ferrara ros_po_bonus
        console_command create_building Fivizanno ros_po_bonus
        console_command create_building Guastalla ros_po_bonus
        console_command create_building Modena ros_po_bonus
        console_command create_building Parma ros_po_bonus
        console_command create_building Pavia ros_po_bonus
        console_command create_building Brescia ros_po_bonus
        console_command create_building Cremona ros_po_bonus
        console_command create_building Verona ros_po_bonus
        console_command create_building Casale ros_po_bonus
        console_command create_building Asti ros_po_bonus
        console_command create_building Rovigo ros_po_bonus
        console_command create_building Forli ros_po_bonus
        console_command create_building Ravenna ros_po_bonus
        console_command create_building Rimini ros_po_bonus
        console_command create_building Ancona ros_po_bonus
        console_command create_building Fermo ros_po_bonus
        console_command create_building Spoleto ros_po_bonus
        console_command create_building Gaeta ros_po_bonus
        console_command create_building Foggia ros_po_bonus
        console_command create_building Pescara ros_po_bonus
        console_command create_building Benevento ros_po_bonus
        console_command create_building Otranto ros_po_bonus
        console_command create_building Bari ros_po_bonus
        console_command create_building Salerno ros_po_bonus
        console_command create_building Potenza ros_po_bonus
        console_command create_building Policastro ros_po_bonus
        console_command create_building Cosenza ros_po_bonus
        console_command create_building Reggio ros_po_bonus
        console_command create_building Messina ros_po_bonus
        console_command create_building Syrakus ros_po_bonus
        console_command create_building Girgenti ros_po_bonus
        console_command create_building Palermo ros_po_bonus
        console_command create_building Malta ros_po_bonus
        console_command create_building Tunis ros_po_bonus
        console_command create_building Qairawan ros_po_bonus
        console_command create_building Al_Kaf ros_po_bonus
        console_command create_building Annaba ros_po_bonus
        console_command create_building Qusantina ros_po_bonus
        console_command create_building Cagliari ros_po_bonus
        console_command create_building Oristano ros_po_bonus
        console_command create_building Sassari ros_po_bonus
        console_command create_building Bonifacio ros_po_bonus
        console_command create_building Ajaccio ros_po_bonus
        console_command create_building Bastia ros_po_bonus
        console_command create_building Nice ros_po_bonus
        console_command create_building Toulon ros_po_bonus
        console_command create_building Marseille ros_po_bonus
        console_command create_building Saluzzo ros_po_bonus
        console_command create_building Avignon ros_po_bonus
        console_command create_building Vienne ros_po_bonus
        console_command create_building Grenoble ros_po_bonus
        console_command create_building Lyon ros_po_bonus
        console_command create_building Genf ros_po_bonus
        console_command create_building Chalon ros_po_bonus
        console_command create_building Dijon ros_po_bonus
        console_command create_building Chaumont ros_po_bonus
        console_command create_building Besancon ros_po_bonus
        console_command create_building Lausanne ros_po_bonus
        console_command create_building Bern ros_po_bonus
        console_command create_building Sion ros_po_bonus
        console_command create_building Zurich ros_po_bonus
        console_command create_building Chur ros_po_bonus
        console_command create_building Nancy ros_po_bonus
        console_command create_building Strassburg ros_po_bonus
        console_command create_building Mulhouse ros_po_bonus
        console_command create_building Baden ros_po_bonus
        console_command create_building Freiburg ros_po_bonus
        console_command create_building Stuttgart ros_po_bonus
        console_command create_building Rottweil ros_po_bonus
        console_command create_building Bregenz ros_po_bonus
        console_command create_building Augsburg ros_po_bonus
        console_command create_building Ulm ros_po_bonus
        console_command create_building Ravensburg ros_po_bonus
        console_command create_building Krk ros_po_bonus
        console_command create_building Supetar ros_po_bonus
        console_command create_building Cattaro ros_po_bonus
        console_command create_building Ragusa ros_po_bonus
        console_command create_building Ston ros_po_bonus
        console_command create_building Trient ros_po_bonus
        console_command create_building Venedig ros_po_bonus
        console_command create_building Padua ros_po_bonus
        console_command create_building Treviso ros_po_bonus
        console_command create_building Trieste ros_po_bonus
        console_command create_building Pola ros_po_bonus
        console_command create_building Fiume ros_po_bonus
        console_command create_building Bihac ros_po_bonus
        console_command create_building Sinj ros_po_bonus
        console_command create_building Zara ros_po_bonus
        console_command create_building Spalato ros_po_bonus
        console_command create_building Innsbruck ros_po_bonus
        console_command create_building Munchen ros_po_bonus
        console_command create_building Freising ros_po_bonus
        console_command create_building Passau ros_po_bonus
        console_command create_building Laibach ros_po_bonus
        console_command create_building Villach ros_po_bonus
        console_command create_building Salzburg ros_po_bonus
        console_command create_building Sissek ros_po_bonus
        console_command create_building Trebinje ros_po_bonus
        console_command create_building Mostar ros_po_bonus
        console_command create_building Sarajevo ros_po_bonus
        console_command create_building Jajce ros_po_bonus
        console_command create_building Eszek ros_po_bonus
        console_command create_building Warasdin ros_po_bonus
        console_command create_building Zagreb ros_po_bonus
        console_command create_building Marburg ros_po_bonus
        console_command create_building Wien ros_po_bonus
        console_command create_building Linz ros_po_bonus
        console_command create_building Graz ros_po_bonus
        console_command create_building Odenburg ros_po_bonus
        console_command create_building Buda ros_po_bonus
        console_command create_building Nyitra ros_po_bonus
        console_command create_building Pressburg ros_po_bonus
        console_command create_building Pecs ros_po_bonus
        console_command create_building Stuhlweisenberg ros_po_bonus
        console_command create_building Kanizsa ros_po_bonus
        console_command create_building Keszthely ros_po_bonus
        console_command create_building Veszprem ros_po_bonus
        console_command create_building Susa ros_po_bonus
        console_command create_building Die ros_po_bonus
        console_command create_building Aix ros_po_bonus
        console_command create_building Gallen ros_po_bonus
        console_command create_building Basel ros_po_bonus
        console_command create_building Bellinzona ros_po_bonus
        console_command create_building Adelsberg ros_po_bonus
        console_command create_building Severin ros_po_bonus
        console_command create_building Banjaluka ros_po_bonus
        console_command create_building Mljet ros_po_bonus
        console_command create_building Neuenburg ros_po_bonus
        console_command create_building Lipari ros_po_bonus
        console_command create_building Brixen ros_po_bonus
        console_command create_building Pago ros_po_bonus
        console_command create_building Drijeva ros_po_bonus
        console_command create_building Landshut ros_po_bonus
        console_command create_building Salins ros_po_bonus
        console_command create_building Udine ros_po_bonus
        console_command create_building Gastein ros_po_bonus
        console_command create_building Chambery ros_po_bonus
        console_command create_building Aosta ros_po_bonus
        console_command create_building Kelibia ros_po_bonus
        console_command create_building Sinigaglia    ros_po_bonus
        console_command create_building Faenza   ros_po_bonus
        console_command create_building Incisa  ros_po_bonus
        console_command create_building Kempten ros_po_bonus
        console_command create_building Mirandola ros_po_bonus
        console_command create_building Montechiarugolo ros_po_bonus
        console_command create_building Cavtat ros_po_bonus
        console_command create_building Virovitica ros_po_bonus
        console_command create_building Raab ros_po_bonus
        console_command create_building Papa ros_po_bonus
        console_command create_building Eisenburg ros_po_bonus
        console_command create_building Gran ros_po_bonus
        console_command create_building Ostrovica ros_po_bonus
        console_command create_building Vranduk   ros_po_bonus
        console_command create_building Pisa   ros_po_bonus
        console_command create_building Florenz   ros_po_bonus

        console_command create_building Noli ros_target    
        console_command create_unit Noli ros_Peasants 1 0 0

        faction_emerge moors slave 1 400.0 0.0 1.2 town false unused_label1 unused_name 30


        campaign_wait 0.1

        if I_NumberOfSettlements moors == 0
            give_everything_to_faction moors slave false 
        end_if                                                                        

        if I_NumberOfSettlements moors > 0
            if not I_SettlementOwner Noli = moors
                give_everything_to_faction moors slave false
            end_if

            if I_SettlementOwner Noli = moors 
                give_everything_to_faction moors venice false
            end_if
        end_if    

        destroy_units venice ros_Peasants
        destroy_buildings venice ros_temp_buildings false
        destroy_buildings venice ros_temp_buildings false
        destroy_units spain ros_Peasants
        destroy_buildings spain ros_temp_buildings false
        destroy_buildings spain ros_temp_buildings false
        destroy_units france ros_Peasants
        destroy_buildings france ros_temp_buildings false
        destroy_buildings france ros_temp_buildings false
        destroy_units hre ros_Peasants
        destroy_buildings hre ros_temp_buildings false
        destroy_buildings hre ros_temp_buildings false
        destroy_units milan ros_Peasants
        destroy_buildings milan ros_temp_buildings false
        destroy_buildings milan ros_temp_buildings false
        destroy_units turks ros_Peasants
        destroy_buildings turks ros_temp_buildings false
        destroy_buildings turks ros_temp_buildings false
        destroy_units hungary ros_Peasants
        destroy_buildings hungary ros_temp_buildings false
        destroy_buildings hungary ros_temp_buildings false
        destroy_units papal_states ros_Peasants
        destroy_buildings papal_states ros_temp_buildings false
        destroy_buildings papal_states ros_temp_buildings false
        destroy_units saxons ros_Peasants
        destroy_buildings saxons ros_temp_buildings false
        destroy_buildings saxons ros_temp_buildings false
        destroy_units poland ros_Peasants
        destroy_buildings poland ros_temp_buildings false
        destroy_buildings poland ros_temp_buildings false
        destroy_units sicily ros_Peasants
        destroy_buildings sicily ros_temp_buildings false
        destroy_buildings sicily ros_temp_buildings false 
        destroy_units slave ros_Peasants
        destroy_buildings slave ros_temp_buildings false
        destroy_buildings slave ros_temp_buildings false
        destroy_units normans ros_Peasants
        destroy_buildings normans ros_temp_buildings false
        destroy_buildings normans ros_temp_buildings false 
        destroy_units denmark ros_Peasants
        destroy_buildings denmark ros_temp_buildings false
        destroy_buildings denmark ros_temp_buildings false 
        destroy_units byzantium ros_Peasants
        destroy_buildings byzantium ros_temp_buildings false
        destroy_buildings byzantium ros_temp_buildings false 
        destroy_units england ros_Peasants
        destroy_buildings england ros_temp_buildings false
        destroy_buildings england ros_temp_buildings false 
        destroy_units russia ros_Peasants
        destroy_buildings russia ros_temp_buildings false
        destroy_buildings russia ros_temp_buildings false 
        destroy_units scotland ros_Peasants
        destroy_buildings scotland ros_temp_buildings false
        destroy_buildings scotland ros_temp_buildings false 
        destroy_units egypt ros_Peasants
        destroy_buildings egypt ros_temp_buildings false
        destroy_buildings egypt ros_temp_buildings false 
        destroy_units savoy ros_Peasants
        destroy_buildings savoy ros_temp_buildings false
        destroy_buildings savoy ros_temp_buildings false 
        destroy_units montferrat ros_Peasants
        destroy_buildings montferrat ros_temp_buildings false
        destroy_buildings montferrat ros_temp_buildings false 
        destroy_units timurids ros_Peasants
        destroy_buildings timurids ros_temp_buildings false
        destroy_buildings timurids ros_temp_buildings false 
        destroy_units urbino ros_Peasants
        destroy_buildings urbino ros_temp_buildings false
        destroy_buildings urbino ros_temp_buildings false 
        destroy_units lucca ros_Peasants
        destroy_buildings lucca ros_temp_buildings false
        destroy_buildings lucca ros_temp_buildings false 

        create_unit Noli, Italian Spear Militia, num 2, exp 1, arm 0, wep 0 
        create_unit Noli, Italian Cavalry Militia, num 1, exp 1, arm 0, wep 0   


        terminate_monitor
    end_monitor


    ;--------------------------------- Mailand angenommen -------------------------

    monitor_event EventCounter EventCounterType noli_angebot_accepted
        and I_CompareCounter Spieler_ist_Mailand = 1
        and I_SettlementOwner Noli = slave
        and not I_SettlementUnderSiege Noli



        console_command add_money -10000
        historic_event noli_angebot_yes
        set_event_counter noli_switched 1

        console_command create_building Perugia ros_po_bonus
        console_command create_building Aquila ros_po_bonus
        console_command create_building Pontecorvo ros_po_bonus
        console_command create_building Capua ros_po_bonus
        console_command create_building Brindisi ros_po_bonus
        console_command create_building Pantelleria ros_po_bonus
        console_command create_building Marsala ros_po_bonus
        console_command create_building Terranova ros_po_bonus
        console_command create_building Montepulciano ros_po_bonus
        console_command create_building Urbino ros_po_bonus
        console_command create_building Piacenza ros_po_bonus
        console_command create_building Alessandria ros_po_bonus
        console_command create_building Camerino ros_po_bonus
        console_command create_building Mompelgard ros_po_bonus
        console_command create_building Mondovi ros_po_bonus
        console_command create_building Barcelonnette ros_po_bonus
        console_command create_building Gimignano ros_po_bonus
        console_command create_building Livorno ros_po_bonus
        console_command create_building Massa ros_po_bonus
        console_command create_building Novara ros_po_bonus
        console_command create_building Nuoro ros_po_bonus
        console_command create_building Biserta ros_po_bonus
        console_command create_building Rom ros_po_bonus
        console_command create_building Neapel ros_po_bonus
        console_command create_building Bologna ros_po_bonus
        console_command create_building Mailand ros_po_bonus
        console_command create_building Turin ros_po_bonus
        console_command create_building Genua ros_po_bonus
        console_command create_building Volterra ros_po_bonus
        console_command create_building Arezzo ros_po_bonus
        console_command create_building Siena ros_po_bonus
        console_command create_building Piombino ros_po_bonus
        console_command create_building Portoferraio ros_po_bonus
        console_command create_building Grosseto ros_po_bonus
        console_command create_building Orvieto ros_po_bonus
        console_command create_building Civita ros_po_bonus
        console_command create_building Lucca ros_po_bonus
        console_command create_building Mantua ros_po_bonus
        console_command create_building Ferrara ros_po_bonus
        console_command create_building Fivizanno ros_po_bonus
        console_command create_building Guastalla ros_po_bonus
        console_command create_building Modena ros_po_bonus
        console_command create_building Parma ros_po_bonus
        console_command create_building Pavia ros_po_bonus
        console_command create_building Brescia ros_po_bonus
        console_command create_building Cremona ros_po_bonus
        console_command create_building Verona ros_po_bonus
        console_command create_building Casale ros_po_bonus
        console_command create_building Asti ros_po_bonus
        console_command create_building Rovigo ros_po_bonus
        console_command create_building Forli ros_po_bonus
        console_command create_building Ravenna ros_po_bonus
        console_command create_building Rimini ros_po_bonus
        console_command create_building Ancona ros_po_bonus
        console_command create_building Fermo ros_po_bonus
        console_command create_building Spoleto ros_po_bonus
        console_command create_building Gaeta ros_po_bonus
        console_command create_building Foggia ros_po_bonus
        console_command create_building Pescara ros_po_bonus
        console_command create_building Benevento ros_po_bonus
        console_command create_building Otranto ros_po_bonus
        console_command create_building Bari ros_po_bonus
        console_command create_building Salerno ros_po_bonus
        console_command create_building Potenza ros_po_bonus
        console_command create_building Policastro ros_po_bonus
        console_command create_building Cosenza ros_po_bonus
        console_command create_building Reggio ros_po_bonus
        console_command create_building Messina ros_po_bonus
        console_command create_building Syrakus ros_po_bonus
        console_command create_building Girgenti ros_po_bonus
        console_command create_building Palermo ros_po_bonus
        console_command create_building Malta ros_po_bonus
        console_command create_building Tunis ros_po_bonus
        console_command create_building Qairawan ros_po_bonus
        console_command create_building Al_Kaf ros_po_bonus
        console_command create_building Annaba ros_po_bonus
        console_command create_building Qusantina ros_po_bonus
        console_command create_building Cagliari ros_po_bonus
        console_command create_building Oristano ros_po_bonus
        console_command create_building Sassari ros_po_bonus
        console_command create_building Bonifacio ros_po_bonus
        console_command create_building Ajaccio ros_po_bonus
        console_command create_building Bastia ros_po_bonus
        console_command create_building Nice ros_po_bonus
        console_command create_building Toulon ros_po_bonus
        console_command create_building Marseille ros_po_bonus
        console_command create_building Saluzzo ros_po_bonus
        console_command create_building Avignon ros_po_bonus
        console_command create_building Vienne ros_po_bonus
        console_command create_building Grenoble ros_po_bonus
        console_command create_building Lyon ros_po_bonus
        console_command create_building Genf ros_po_bonus
        console_command create_building Chalon ros_po_bonus
        console_command create_building Dijon ros_po_bonus
        console_command create_building Chaumont ros_po_bonus
        console_command create_building Besancon ros_po_bonus
        console_command create_building Lausanne ros_po_bonus
        console_command create_building Bern ros_po_bonus
        console_command create_building Sion ros_po_bonus
        console_command create_building Zurich ros_po_bonus
        console_command create_building Chur ros_po_bonus
        console_command create_building Nancy ros_po_bonus
        console_command create_building Strassburg ros_po_bonus
        console_command create_building Mulhouse ros_po_bonus
        console_command create_building Baden ros_po_bonus
        console_command create_building Freiburg ros_po_bonus
        console_command create_building Stuttgart ros_po_bonus
        console_command create_building Rottweil ros_po_bonus
        console_command create_building Bregenz ros_po_bonus
        console_command create_building Augsburg ros_po_bonus
        console_command create_building Ulm ros_po_bonus
        console_command create_building Ravensburg ros_po_bonus
        console_command create_building Krk ros_po_bonus
        console_command create_building Supetar ros_po_bonus
        console_command create_building Cattaro ros_po_bonus
        console_command create_building Ragusa ros_po_bonus
        console_command create_building Ston ros_po_bonus
        console_command create_building Trient ros_po_bonus
        console_command create_building Venedig ros_po_bonus
        console_command create_building Padua ros_po_bonus
        console_command create_building Treviso ros_po_bonus
        console_command create_building Trieste ros_po_bonus
        console_command create_building Pola ros_po_bonus
        console_command create_building Fiume ros_po_bonus
        console_command create_building Bihac ros_po_bonus
        console_command create_building Sinj ros_po_bonus
        console_command create_building Zara ros_po_bonus
        console_command create_building Spalato ros_po_bonus
        console_command create_building Innsbruck ros_po_bonus
        console_command create_building Munchen ros_po_bonus
        console_command create_building Freising ros_po_bonus
        console_command create_building Passau ros_po_bonus
        console_command create_building Laibach ros_po_bonus
        console_command create_building Villach ros_po_bonus
        console_command create_building Salzburg ros_po_bonus
        console_command create_building Sissek ros_po_bonus
        console_command create_building Trebinje ros_po_bonus
        console_command create_building Mostar ros_po_bonus
        console_command create_building Sarajevo ros_po_bonus
        console_command create_building Jajce ros_po_bonus
        console_command create_building Eszek ros_po_bonus
        console_command create_building Warasdin ros_po_bonus
        console_command create_building Zagreb ros_po_bonus
        console_command create_building Marburg ros_po_bonus
        console_command create_building Wien ros_po_bonus
        console_command create_building Linz ros_po_bonus
        console_command create_building Graz ros_po_bonus
        console_command create_building Odenburg ros_po_bonus
        console_command create_building Buda ros_po_bonus
        console_command create_building Nyitra ros_po_bonus
        console_command create_building Pressburg ros_po_bonus
        console_command create_building Pecs ros_po_bonus
        console_command create_building Stuhlweisenberg ros_po_bonus
        console_command create_building Kanizsa ros_po_bonus
        console_command create_building Keszthely ros_po_bonus
        console_command create_building Veszprem ros_po_bonus
        console_command create_building Susa ros_po_bonus
        console_command create_building Die ros_po_bonus
        console_command create_building Aix ros_po_bonus
        console_command create_building Gallen ros_po_bonus
        console_command create_building Basel ros_po_bonus
        console_command create_building Bellinzona ros_po_bonus
        console_command create_building Adelsberg ros_po_bonus
        console_command create_building Severin ros_po_bonus
        console_command create_building Banjaluka ros_po_bonus
        console_command create_building Mljet ros_po_bonus
        console_command create_building Neuenburg ros_po_bonus
        console_command create_building Lipari ros_po_bonus
        console_command create_building Brixen ros_po_bonus
        console_command create_building Pago ros_po_bonus
        console_command create_building Drijeva ros_po_bonus
        console_command create_building Landshut ros_po_bonus
        console_command create_building Salins ros_po_bonus
        console_command create_building Udine ros_po_bonus
        console_command create_building Gastein ros_po_bonus
        console_command create_building Chambery ros_po_bonus
        console_command create_building Aosta ros_po_bonus
        console_command create_building Kelibia ros_po_bonus
        console_command create_building Sinigaglia    ros_po_bonus
        console_command create_building Faenza   ros_po_bonus
        console_command create_building Incisa  ros_po_bonus
        console_command create_building Kempten ros_po_bonus
        console_command create_building Mirandola ros_po_bonus
        console_command create_building Montechiarugolo ros_po_bonus
        console_command create_building Cavtat ros_po_bonus
        console_command create_building Virovitica ros_po_bonus
        console_command create_building Raab ros_po_bonus
        console_command create_building Papa ros_po_bonus
        console_command create_building Eisenburg ros_po_bonus
        console_command create_building Gran ros_po_bonus
        console_command create_building Ostrovica ros_po_bonus
        console_command create_building Vranduk   ros_po_bonus
        console_command create_building Pisa   ros_po_bonus
        console_command create_building Florenz   ros_po_bonus

        console_command create_building Noli ros_target    
        console_command create_unit Noli ros_Peasants 1 0 0


        faction_emerge moors slave 1 400.0 0.0 1.2 town false unused_label1 unused_name 30

        campaign_wait 0.1

        if I_NumberOfSettlements moors == 0
            give_everything_to_faction moors slave false 
        end_if                                                                        

        if I_NumberOfSettlements moors > 0
            if not I_SettlementOwner Noli = moors
                give_everything_to_faction moors slave false
            end_if

            if I_SettlementOwner Noli = moors 
                give_everything_to_faction moors milan false
            end_if
        end_if    

        destroy_units venice ros_Peasants
        destroy_buildings venice ros_temp_buildings false
        destroy_buildings venice ros_temp_buildings false
        destroy_units spain ros_Peasants
        destroy_buildings spain ros_temp_buildings false
        destroy_buildings spain ros_temp_buildings false
        destroy_units france ros_Peasants
        destroy_buildings france ros_temp_buildings false
        destroy_buildings france ros_temp_buildings false
        destroy_units hre ros_Peasants
        destroy_buildings hre ros_temp_buildings false
        destroy_buildings hre ros_temp_buildings false
        destroy_units milan ros_Peasants
        destroy_buildings milan ros_temp_buildings false
        destroy_buildings milan ros_temp_buildings false
        destroy_units turks ros_Peasants
        destroy_buildings turks ros_temp_buildings false
        destroy_buildings turks ros_temp_buildings false
        destroy_units hungary ros_Peasants
        destroy_buildings hungary ros_temp_buildings false
        destroy_buildings hungary ros_temp_buildings false
        destroy_units papal_states ros_Peasants
        destroy_buildings papal_states ros_temp_buildings false
        destroy_buildings papal_states ros_temp_buildings false
        destroy_units saxons ros_Peasants
        destroy_buildings saxons ros_temp_buildings false
        destroy_buildings saxons ros_temp_buildings false
        destroy_units poland ros_Peasants
        destroy_buildings poland ros_temp_buildings false
        destroy_buildings poland ros_temp_buildings false
        destroy_units sicily ros_Peasants
        destroy_buildings sicily ros_temp_buildings false
        destroy_buildings sicily ros_temp_buildings false 
        destroy_units slave ros_Peasants
        destroy_buildings slave ros_temp_buildings false
        destroy_buildings slave ros_temp_buildings false
        destroy_units normans ros_Peasants
        destroy_buildings normans ros_temp_buildings false
        destroy_buildings normans ros_temp_buildings false  
        destroy_units denmark ros_Peasants
        destroy_buildings denmark ros_temp_buildings false
        destroy_buildings denmark ros_temp_buildings false 
        destroy_units byzantium ros_Peasants
        destroy_buildings byzantium ros_temp_buildings false
        destroy_buildings byzantium ros_temp_buildings false 
        destroy_units england ros_Peasants
        destroy_buildings england ros_temp_buildings false
        destroy_buildings england ros_temp_buildings false 
        destroy_units russia ros_Peasants
        destroy_buildings russia ros_temp_buildings false
        destroy_buildings russia ros_temp_buildings false 
        destroy_units scotland ros_Peasants
        destroy_buildings scotland ros_temp_buildings false
        destroy_buildings scotland ros_temp_buildings false 
        destroy_units egypt ros_Peasants
        destroy_buildings egypt ros_temp_buildings false
        destroy_buildings egypt ros_temp_buildings false 
        destroy_units savoy ros_Peasants
        destroy_buildings savoy ros_temp_buildings false
        destroy_buildings savoy ros_temp_buildings false 
        destroy_units montferrat ros_Peasants
        destroy_buildings montferrat ros_temp_buildings false
        destroy_buildings montferrat ros_temp_buildings false 
        destroy_units timurids ros_Peasants
        destroy_buildings timurids ros_temp_buildings false
        destroy_buildings timurids ros_temp_buildings false 
        destroy_units urbino ros_Peasants
        destroy_buildings urbino ros_temp_buildings false
        destroy_buildings urbino ros_temp_buildings false 
        destroy_units lucca ros_Peasants
        destroy_buildings lucca ros_temp_buildings false
        destroy_buildings lucca ros_temp_buildings false 

        create_unit Noli, Italian Spear Militia, num 2, exp 1, arm 0, wep 0 
        create_unit Noli, Italian Cavalry Militia, num 1, exp 1, arm 0, wep 0   

        terminate_monitor
    end_monitor


    ;--------------------------------- Spanien angenommen -------------------------

    monitor_event EventCounter EventCounterType noli_angebot_accepted
        and I_CompareCounter Spieler_ist_Spanien = 1
        and I_SettlementOwner Noli = slave
        and not I_SettlementUnderSiege Noli

        console_command add_money -10000
        historic_event noli_angebot_yes
        set_event_counter noli_switched 1

        console_command create_building Perugia ros_po_bonus
        console_command create_building Aquila ros_po_bonus
        console_command create_building Pontecorvo ros_po_bonus
        console_command create_building Capua ros_po_bonus
        console_command create_building Brindisi ros_po_bonus
        console_command create_building Pantelleria ros_po_bonus
        console_command create_building Marsala ros_po_bonus
        console_command create_building Terranova ros_po_bonus
        console_command create_building Montepulciano ros_po_bonus
        console_command create_building Urbino ros_po_bonus
        console_command create_building Piacenza ros_po_bonus
        console_command create_building Alessandria ros_po_bonus
        console_command create_building Camerino ros_po_bonus
        console_command create_building Mompelgard ros_po_bonus
        console_command create_building Mondovi ros_po_bonus
        console_command create_building Barcelonnette ros_po_bonus
        console_command create_building Gimignano ros_po_bonus
        console_command create_building Livorno ros_po_bonus
        console_command create_building Massa ros_po_bonus
        console_command create_building Novara ros_po_bonus
        console_command create_building Nuoro ros_po_bonus
        console_command create_building Biserta ros_po_bonus
        console_command create_building Rom ros_po_bonus
        console_command create_building Neapel ros_po_bonus
        console_command create_building Bologna ros_po_bonus
        console_command create_building Mailand ros_po_bonus
        console_command create_building Turin ros_po_bonus
        console_command create_building Genua ros_po_bonus
        console_command create_building Volterra ros_po_bonus
        console_command create_building Arezzo ros_po_bonus
        console_command create_building Siena ros_po_bonus
        console_command create_building Piombino ros_po_bonus
        console_command create_building Portoferraio ros_po_bonus
        console_command create_building Grosseto ros_po_bonus
        console_command create_building Orvieto ros_po_bonus
        console_command create_building Civita ros_po_bonus
        console_command create_building Lucca ros_po_bonus
        console_command create_building Mantua ros_po_bonus
        console_command create_building Ferrara ros_po_bonus
        console_command create_building Fivizanno ros_po_bonus
        console_command create_building Guastalla ros_po_bonus
        console_command create_building Modena ros_po_bonus
        console_command create_building Parma ros_po_bonus
        console_command create_building Pavia ros_po_bonus
        console_command create_building Brescia ros_po_bonus
        console_command create_building Cremona ros_po_bonus
        console_command create_building Verona ros_po_bonus
        console_command create_building Casale ros_po_bonus
        console_command create_building Asti ros_po_bonus
        console_command create_building Rovigo ros_po_bonus
        console_command create_building Forli ros_po_bonus
        console_command create_building Ravenna ros_po_bonus
        console_command create_building Rimini ros_po_bonus
        console_command create_building Ancona ros_po_bonus
        console_command create_building Fermo ros_po_bonus
        console_command create_building Spoleto ros_po_bonus
        console_command create_building Gaeta ros_po_bonus
        console_command create_building Foggia ros_po_bonus
        console_command create_building Pescara ros_po_bonus
        console_command create_building Benevento ros_po_bonus
        console_command create_building Otranto ros_po_bonus
        console_command create_building Bari ros_po_bonus
        console_command create_building Salerno ros_po_bonus
        console_command create_building Potenza ros_po_bonus
        console_command create_building Policastro ros_po_bonus
        console_command create_building Cosenza ros_po_bonus
        console_command create_building Reggio ros_po_bonus
        console_command create_building Messina ros_po_bonus
        console_command create_building Syrakus ros_po_bonus
        console_command create_building Girgenti ros_po_bonus
        console_command create_building Palermo ros_po_bonus
        console_command create_building Malta ros_po_bonus
        console_command create_building Tunis ros_po_bonus
        console_command create_building Qairawan ros_po_bonus
        console_command create_building Al_Kaf ros_po_bonus
        console_command create_building Annaba ros_po_bonus
        console_command create_building Qusantina ros_po_bonus
        console_command create_building Cagliari ros_po_bonus
        console_command create_building Oristano ros_po_bonus
        console_command create_building Sassari ros_po_bonus
        console_command create_building Bonifacio ros_po_bonus
        console_command create_building Ajaccio ros_po_bonus
        console_command create_building Bastia ros_po_bonus
        console_command create_building Nice ros_po_bonus
        console_command create_building Toulon ros_po_bonus
        console_command create_building Marseille ros_po_bonus
        console_command create_building Saluzzo ros_po_bonus
        console_command create_building Avignon ros_po_bonus
        console_command create_building Vienne ros_po_bonus
        console_command create_building Grenoble ros_po_bonus
        console_command create_building Lyon ros_po_bonus
        console_command create_building Genf ros_po_bonus
        console_command create_building Chalon ros_po_bonus
        console_command create_building Dijon ros_po_bonus
        console_command create_building Chaumont ros_po_bonus
        console_command create_building Besancon ros_po_bonus
        console_command create_building Lausanne ros_po_bonus
        console_command create_building Bern ros_po_bonus
        console_command create_building Sion ros_po_bonus
        console_command create_building Zurich ros_po_bonus
        console_command create_building Chur ros_po_bonus
        console_command create_building Nancy ros_po_bonus
        console_command create_building Strassburg ros_po_bonus
        console_command create_building Mulhouse ros_po_bonus
        console_command create_building Baden ros_po_bonus
        console_command create_building Freiburg ros_po_bonus
        console_command create_building Stuttgart ros_po_bonus
        console_command create_building Rottweil ros_po_bonus
        console_command create_building Bregenz ros_po_bonus
        console_command create_building Augsburg ros_po_bonus
        console_command create_building Ulm ros_po_bonus
        console_command create_building Ravensburg ros_po_bonus
        console_command create_building Krk ros_po_bonus
        console_command create_building Supetar ros_po_bonus
        console_command create_building Cattaro ros_po_bonus
        console_command create_building Ragusa ros_po_bonus
        console_command create_building Ston ros_po_bonus
        console_command create_building Trient ros_po_bonus
        console_command create_building Venedig ros_po_bonus
        console_command create_building Padua ros_po_bonus
        console_command create_building Treviso ros_po_bonus
        console_command create_building Trieste ros_po_bonus
        console_command create_building Pola ros_po_bonus
        console_command create_building Fiume ros_po_bonus
        console_command create_building Bihac ros_po_bonus
        console_command create_building Sinj ros_po_bonus
        console_command create_building Zara ros_po_bonus
        console_command create_building Spalato ros_po_bonus
        console_command create_building Innsbruck ros_po_bonus
        console_command create_building Munchen ros_po_bonus
        console_command create_building Freising ros_po_bonus
        console_command create_building Passau ros_po_bonus
        console_command create_building Laibach ros_po_bonus
        console_command create_building Villach ros_po_bonus
        console_command create_building Salzburg ros_po_bonus
        console_command create_building Sissek ros_po_bonus
        console_command create_building Trebinje ros_po_bonus
        console_command create_building Mostar ros_po_bonus
        console_command create_building Sarajevo ros_po_bonus
        console_command create_building Jajce ros_po_bonus
        console_command create_building Eszek ros_po_bonus
        console_command create_building Warasdin ros_po_bonus
        console_command create_building Zagreb ros_po_bonus
        console_command create_building Marburg ros_po_bonus
        console_command create_building Wien ros_po_bonus
        console_command create_building Linz ros_po_bonus
        console_command create_building Graz ros_po_bonus
        console_command create_building Odenburg ros_po_bonus
        console_command create_building Buda ros_po_bonus
        console_command create_building Nyitra ros_po_bonus
        console_command create_building Pressburg ros_po_bonus
        console_command create_building Pecs ros_po_bonus
        console_command create_building Stuhlweisenberg ros_po_bonus
        console_command create_building Kanizsa ros_po_bonus
        console_command create_building Keszthely ros_po_bonus
        console_command create_building Veszprem ros_po_bonus
        console_command create_building Susa ros_po_bonus
        console_command create_building Die ros_po_bonus
        console_command create_building Aix ros_po_bonus
        console_command create_building Gallen ros_po_bonus
        console_command create_building Basel ros_po_bonus
        console_command create_building Bellinzona ros_po_bonus
        console_command create_building Adelsberg ros_po_bonus
        console_command create_building Severin ros_po_bonus
        console_command create_building Banjaluka ros_po_bonus
        console_command create_building Mljet ros_po_bonus
        console_command create_building Neuenburg ros_po_bonus
        console_command create_building Lipari ros_po_bonus
        console_command create_building Brixen ros_po_bonus
        console_command create_building Pago ros_po_bonus
        console_command create_building Drijeva ros_po_bonus
        console_command create_building Landshut ros_po_bonus
        console_command create_building Salins ros_po_bonus
        console_command create_building Udine ros_po_bonus
        console_command create_building Gastein ros_po_bonus
        console_command create_building Chambery ros_po_bonus
        console_command create_building Aosta ros_po_bonus
        console_command create_building Kelibia ros_po_bonus
        console_command create_building Sinigaglia    ros_po_bonus
        console_command create_building Faenza   ros_po_bonus
        console_command create_building Incisa  ros_po_bonus
        console_command create_building Kempten ros_po_bonus
        console_command create_building Mirandola ros_po_bonus
        console_command create_building Montechiarugolo ros_po_bonus
        console_command create_building Cavtat ros_po_bonus
        console_command create_building Virovitica ros_po_bonus
        console_command create_building Raab ros_po_bonus
        console_command create_building Papa ros_po_bonus
        console_command create_building Eisenburg ros_po_bonus
        console_command create_building Gran ros_po_bonus
        console_command create_building Ostrovica ros_po_bonus
        console_command create_building Vranduk   ros_po_bonus
        console_command create_building Pisa   ros_po_bonus
        console_command create_building Florenz   ros_po_bonus

        console_command create_building Noli ros_target    
        console_command create_unit Noli ros_Peasants 1 0 0

        faction_emerge moors slave 1 400.0 0.0 1.2 town false unused_label1 unused_name 30


        campaign_wait 0.1

        if I_NumberOfSettlements moors == 0
            give_everything_to_faction moors slave false 
        end_if                                                                        

        if I_NumberOfSettlements moors > 0
            if not I_SettlementOwner Noli = moors
                give_everything_to_faction moors slave false
            end_if

            if I_SettlementOwner Noli = moors 
                give_everything_to_faction moors spain false
            end_if
        end_if    

        destroy_units venice ros_Peasants
        destroy_buildings venice ros_temp_buildings false
        destroy_buildings venice ros_temp_buildings false
        destroy_units spain ros_Peasants
        destroy_buildings spain ros_temp_buildings false
        destroy_buildings spain ros_temp_buildings false
        destroy_units france ros_Peasants
        destroy_buildings france ros_temp_buildings false
        destroy_buildings france ros_temp_buildings false
        destroy_units hre ros_Peasants
        destroy_buildings hre ros_temp_buildings false
        destroy_buildings hre ros_temp_buildings false
        destroy_units milan ros_Peasants
        destroy_buildings milan ros_temp_buildings false
        destroy_buildings milan ros_temp_buildings false
        destroy_units turks ros_Peasants
        destroy_buildings turks ros_temp_buildings false
        destroy_buildings turks ros_temp_buildings false
        destroy_units hungary ros_Peasants
        destroy_buildings hungary ros_temp_buildings false
        destroy_buildings hungary ros_temp_buildings false
        destroy_units papal_states ros_Peasants
        destroy_buildings papal_states ros_temp_buildings false
        destroy_buildings papal_states ros_temp_buildings false
        destroy_units saxons ros_Peasants
        destroy_buildings saxons ros_temp_buildings false
        destroy_buildings saxons ros_temp_buildings false
        destroy_units poland ros_Peasants
        destroy_buildings poland ros_temp_buildings false
        destroy_buildings poland ros_temp_buildings false
        destroy_units sicily ros_Peasants
        destroy_buildings sicily ros_temp_buildings false
        destroy_buildings sicily ros_temp_buildings false 
        destroy_units slave ros_Peasants
        destroy_buildings slave ros_temp_buildings false
        destroy_buildings slave ros_temp_buildings false
        destroy_units normans ros_Peasants
        destroy_buildings normans ros_temp_buildings false
        destroy_buildings normans ros_temp_buildings false  
        destroy_units denmark ros_Peasants
        destroy_buildings denmark ros_temp_buildings false
        destroy_buildings denmark ros_temp_buildings false 
        destroy_units byzantium ros_Peasants
        destroy_buildings byzantium ros_temp_buildings false
        destroy_buildings byzantium ros_temp_buildings false 
        destroy_units england ros_Peasants
        destroy_buildings england ros_temp_buildings false
        destroy_buildings england ros_temp_buildings false 
        destroy_units russia ros_Peasants
        destroy_buildings russia ros_temp_buildings false
        destroy_buildings russia ros_temp_buildings false 
        destroy_units scotland ros_Peasants
        destroy_buildings scotland ros_temp_buildings false
        destroy_buildings scotland ros_temp_buildings false 
        destroy_units egypt ros_Peasants
        destroy_buildings egypt ros_temp_buildings false
        destroy_buildings egypt ros_temp_buildings false 
        destroy_units savoy ros_Peasants
        destroy_buildings savoy ros_temp_buildings false
        destroy_buildings savoy ros_temp_buildings false 
        destroy_units montferrat ros_Peasants
        destroy_buildings montferrat ros_temp_buildings false
        destroy_buildings montferrat ros_temp_buildings false 
        destroy_units timurids ros_Peasants
        destroy_buildings timurids ros_temp_buildings false
        destroy_buildings timurids ros_temp_buildings false 
        destroy_units urbino ros_Peasants
        destroy_buildings urbino ros_temp_buildings false
        destroy_buildings urbino ros_temp_buildings false 
        destroy_units lucca ros_Peasants
        destroy_buildings lucca ros_temp_buildings false
        destroy_buildings lucca ros_temp_buildings false 

        create_unit Noli, Sword and Buckler Men, num 2, exp 1, arm 0, wep 0 
        create_unit Noli, Mounted Crossbowmen, num 1, exp 1, arm 0, wep 0   


        terminate_monitor
    end_monitor

    ;--------------------------------- Frankreich angenommen ----------------------

    monitor_event EventCounter EventCounterType noli_angebot_accepted
        and I_CompareCounter Spieler_ist_Frankreich = 1
        and I_SettlementOwner Noli = slave
        and not I_SettlementUnderSiege Noli


        console_command add_money -10000
        historic_event noli_angebot_yes
        set_event_counter noli_switched 1

        console_command create_building Perugia ros_po_bonus
        console_command create_building Aquila ros_po_bonus
        console_command create_building Pontecorvo ros_po_bonus
        console_command create_building Capua ros_po_bonus
        console_command create_building Brindisi ros_po_bonus
        console_command create_building Pantelleria ros_po_bonus
        console_command create_building Marsala ros_po_bonus
        console_command create_building Terranova ros_po_bonus
        console_command create_building Montepulciano ros_po_bonus
        console_command create_building Urbino ros_po_bonus
        console_command create_building Piacenza ros_po_bonus
        console_command create_building Alessandria ros_po_bonus
        console_command create_building Camerino ros_po_bonus
        console_command create_building Mompelgard ros_po_bonus
        console_command create_building Mondovi ros_po_bonus
        console_command create_building Barcelonnette ros_po_bonus
        console_command create_building Gimignano ros_po_bonus
        console_command create_building Livorno ros_po_bonus
        console_command create_building Massa ros_po_bonus
        console_command create_building Novara ros_po_bonus
        console_command create_building Nuoro ros_po_bonus
        console_command create_building Biserta ros_po_bonus
        console_command create_building Rom ros_po_bonus
        console_command create_building Neapel ros_po_bonus
        console_command create_building Bologna ros_po_bonus
        console_command create_building Mailand ros_po_bonus
        console_command create_building Turin ros_po_bonus
        console_command create_building Genua ros_po_bonus
        console_command create_building Volterra ros_po_bonus
        console_command create_building Arezzo ros_po_bonus
        console_command create_building Siena ros_po_bonus
        console_command create_building Piombino ros_po_bonus
        console_command create_building Portoferraio ros_po_bonus
        console_command create_building Grosseto ros_po_bonus
        console_command create_building Orvieto ros_po_bonus
        console_command create_building Civita ros_po_bonus
        console_command create_building Lucca ros_po_bonus
        console_command create_building Mantua ros_po_bonus
        console_command create_building Ferrara ros_po_bonus
        console_command create_building Fivizanno ros_po_bonus
        console_command create_building Guastalla ros_po_bonus
        console_command create_building Modena ros_po_bonus
        console_command create_building Parma ros_po_bonus
        console_command create_building Pavia ros_po_bonus
        console_command create_building Brescia ros_po_bonus
        console_command create_building Cremona ros_po_bonus
        console_command create_building Verona ros_po_bonus
        console_command create_building Casale ros_po_bonus
        console_command create_building Asti ros_po_bonus
        console_command create_building Rovigo ros_po_bonus
        console_command create_building Forli ros_po_bonus
        console_command create_building Ravenna ros_po_bonus
        console_command create_building Rimini ros_po_bonus
        console_command create_building Ancona ros_po_bonus
        console_command create_building Fermo ros_po_bonus
        console_command create_building Spoleto ros_po_bonus
        console_command create_building Gaeta ros_po_bonus
        console_command create_building Foggia ros_po_bonus
        console_command create_building Pescara ros_po_bonus
        console_command create_building Benevento ros_po_bonus
        console_command create_building Otranto ros_po_bonus
        console_command create_building Bari ros_po_bonus
        console_command create_building Salerno ros_po_bonus
        console_command create_building Potenza ros_po_bonus
        console_command create_building Policastro ros_po_bonus
        console_command create_building Cosenza ros_po_bonus
        console_command create_building Reggio ros_po_bonus
        console_command create_building Messina ros_po_bonus
        console_command create_building Syrakus ros_po_bonus
        console_command create_building Girgenti ros_po_bonus
        console_command create_building Palermo ros_po_bonus
        console_command create_building Malta ros_po_bonus
        console_command create_building Tunis ros_po_bonus
        console_command create_building Qairawan ros_po_bonus
        console_command create_building Al_Kaf ros_po_bonus
        console_command create_building Annaba ros_po_bonus
        console_command create_building Qusantina ros_po_bonus
        console_command create_building Cagliari ros_po_bonus
        console_command create_building Oristano ros_po_bonus
        console_command create_building Sassari ros_po_bonus
        console_command create_building Bonifacio ros_po_bonus
        console_command create_building Ajaccio ros_po_bonus
        console_command create_building Bastia ros_po_bonus
        console_command create_building Nice ros_po_bonus
        console_command create_building Toulon ros_po_bonus
        console_command create_building Marseille ros_po_bonus
        console_command create_building Saluzzo ros_po_bonus
        console_command create_building Avignon ros_po_bonus
        console_command create_building Vienne ros_po_bonus
        console_command create_building Grenoble ros_po_bonus
        console_command create_building Lyon ros_po_bonus
        console_command create_building Genf ros_po_bonus
        console_command create_building Chalon ros_po_bonus
        console_command create_building Dijon ros_po_bonus
        console_command create_building Chaumont ros_po_bonus
        console_command create_building Besancon ros_po_bonus
        console_command create_building Lausanne ros_po_bonus
        console_command create_building Bern ros_po_bonus
        console_command create_building Sion ros_po_bonus
        console_command create_building Zurich ros_po_bonus
        console_command create_building Chur ros_po_bonus
        console_command create_building Nancy ros_po_bonus
        console_command create_building Strassburg ros_po_bonus
        console_command create_building Mulhouse ros_po_bonus
        console_command create_building Baden ros_po_bonus
        console_command create_building Freiburg ros_po_bonus
        console_command create_building Stuttgart ros_po_bonus
        console_command create_building Rottweil ros_po_bonus
        console_command create_building Bregenz ros_po_bonus
        console_command create_building Augsburg ros_po_bonus
        console_command create_building Ulm ros_po_bonus
        console_command create_building Ravensburg ros_po_bonus
        console_command create_building Krk ros_po_bonus
        console_command create_building Supetar ros_po_bonus
        console_command create_building Cattaro ros_po_bonus
        console_command create_building Ragusa ros_po_bonus
        console_command create_building Ston ros_po_bonus
        console_command create_building Trient ros_po_bonus
        console_command create_building Venedig ros_po_bonus
        console_command create_building Padua ros_po_bonus
        console_command create_building Treviso ros_po_bonus
        console_command create_building Trieste ros_po_bonus
        console_command create_building Pola ros_po_bonus
        console_command create_building Fiume ros_po_bonus
        console_command create_building Bihac ros_po_bonus
        console_command create_building Sinj ros_po_bonus
        console_command create_building Zara ros_po_bonus
        console_command create_building Spalato ros_po_bonus
        console_command create_building Innsbruck ros_po_bonus
        console_command create_building Munchen ros_po_bonus
        console_command create_building Freising ros_po_bonus
        console_command create_building Passau ros_po_bonus
        console_command create_building Laibach ros_po_bonus
        console_command create_building Villach ros_po_bonus
        console_command create_building Salzburg ros_po_bonus
        console_command create_building Sissek ros_po_bonus
        console_command create_building Trebinje ros_po_bonus
        console_command create_building Mostar ros_po_bonus
        console_command create_building Sarajevo ros_po_bonus
        console_command create_building Jajce ros_po_bonus
        console_command create_building Eszek ros_po_bonus
        console_command create_building Warasdin ros_po_bonus
        console_command create_building Zagreb ros_po_bonus
        console_command create_building Marburg ros_po_bonus
        console_command create_building Wien ros_po_bonus
        console_command create_building Linz ros_po_bonus
        console_command create_building Graz ros_po_bonus
        console_command create_building Odenburg ros_po_bonus
        console_command create_building Buda ros_po_bonus
        console_command create_building Nyitra ros_po_bonus
        console_command create_building Pressburg ros_po_bonus
        console_command create_building Pecs ros_po_bonus
        console_command create_building Stuhlweisenberg ros_po_bonus
        console_command create_building Kanizsa ros_po_bonus
        console_command create_building Keszthely ros_po_bonus
        console_command create_building Veszprem ros_po_bonus
        console_command create_building Susa ros_po_bonus
        console_command create_building Die ros_po_bonus
        console_command create_building Aix ros_po_bonus
        console_command create_building Gallen ros_po_bonus
        console_command create_building Basel ros_po_bonus
        console_command create_building Bellinzona ros_po_bonus
        console_command create_building Adelsberg ros_po_bonus
        console_command create_building Severin ros_po_bonus
        console_command create_building Banjaluka ros_po_bonus
        console_command create_building Mljet ros_po_bonus
        console_command create_building Neuenburg ros_po_bonus
        console_command create_building Lipari ros_po_bonus
        console_command create_building Brixen ros_po_bonus
        console_command create_building Pago ros_po_bonus
        console_command create_building Drijeva ros_po_bonus
        console_command create_building Landshut ros_po_bonus
        console_command create_building Salins ros_po_bonus
        console_command create_building Udine ros_po_bonus
        console_command create_building Gastein ros_po_bonus
        console_command create_building Chambery ros_po_bonus
        console_command create_building Aosta ros_po_bonus
        console_command create_building Kelibia ros_po_bonus
        console_command create_building Sinigaglia    ros_po_bonus
        console_command create_building Faenza   ros_po_bonus
        console_command create_building Incisa  ros_po_bonus
        console_command create_building Kempten ros_po_bonus
        console_command create_building Mirandola ros_po_bonus
        console_command create_building Montechiarugolo ros_po_bonus
        console_command create_building Cavtat ros_po_bonus
        console_command create_building Virovitica ros_po_bonus
        console_command create_building Raab ros_po_bonus
        console_command create_building Papa ros_po_bonus
        console_command create_building Eisenburg ros_po_bonus
        console_command create_building Gran ros_po_bonus
        console_command create_building Ostrovica ros_po_bonus
        console_command create_building Vranduk   ros_po_bonus
        console_command create_building Pisa   ros_po_bonus
        console_command create_building Florenz   ros_po_bonus

        console_command create_building Noli ros_target    
        console_command create_unit Noli ros_Peasants 1 0 0

        faction_emerge moors slave 1 400.0 0.0 1.2 town false unused_label1 unused_name 30


        campaign_wait 0.1

        if I_NumberOfSettlements moors == 0
            give_everything_to_faction moors slave false 
        end_if                                                                        

        if I_NumberOfSettlements moors > 0
            if not I_SettlementOwner Noli = moors
                give_everything_to_faction moors slave false
            end_if

            if I_SettlementOwner Noli = moors 
                give_everything_to_faction moors france false
            end_if
        end_if    

        destroy_units venice ros_Peasants
        destroy_buildings venice ros_temp_buildings false
        destroy_buildings venice ros_temp_buildings false
        destroy_units spain ros_Peasants
        destroy_buildings spain ros_temp_buildings false
        destroy_buildings spain ros_temp_buildings false
        destroy_units france ros_Peasants
        destroy_buildings france ros_temp_buildings false
        destroy_buildings france ros_temp_buildings false
        destroy_units hre ros_Peasants
        destroy_buildings hre ros_temp_buildings false
        destroy_buildings hre ros_temp_buildings false
        destroy_units milan ros_Peasants
        destroy_buildings milan ros_temp_buildings false
        destroy_buildings milan ros_temp_buildings false
        destroy_units turks ros_Peasants
        destroy_buildings turks ros_temp_buildings false
        destroy_buildings turks ros_temp_buildings false
        destroy_units hungary ros_Peasants
        destroy_buildings hungary ros_temp_buildings false
        destroy_buildings hungary ros_temp_buildings false
        destroy_units papal_states ros_Peasants
        destroy_buildings papal_states ros_temp_buildings false
        destroy_buildings papal_states ros_temp_buildings false
        destroy_units saxons ros_Peasants
        destroy_buildings saxons ros_temp_buildings false
        destroy_buildings saxons ros_temp_buildings false
        destroy_units poland ros_Peasants
        destroy_buildings poland ros_temp_buildings false
        destroy_buildings poland ros_temp_buildings false
        destroy_units sicily ros_Peasants
        destroy_buildings sicily ros_temp_buildings false
        destroy_buildings sicily ros_temp_buildings false 
        destroy_units slave ros_Peasants
        destroy_buildings slave ros_temp_buildings false
        destroy_buildings slave ros_temp_buildings false 
        destroy_units normans ros_Peasants
        destroy_buildings normans ros_temp_buildings false
        destroy_buildings normans ros_temp_buildings false 
        destroy_units denmark ros_Peasants
        destroy_buildings denmark ros_temp_buildings false
        destroy_buildings denmark ros_temp_buildings false 
        destroy_units byzantium ros_Peasants
        destroy_buildings byzantium ros_temp_buildings false
        destroy_buildings byzantium ros_temp_buildings false 
        destroy_units england ros_Peasants
        destroy_buildings england ros_temp_buildings false
        destroy_buildings england ros_temp_buildings false 
        destroy_units russia ros_Peasants
        destroy_buildings russia ros_temp_buildings false
        destroy_buildings russia ros_temp_buildings false 
        destroy_units scotland ros_Peasants
        destroy_buildings scotland ros_temp_buildings false
        destroy_buildings scotland ros_temp_buildings false 
        destroy_units egypt ros_Peasants
        destroy_buildings egypt ros_temp_buildings false
        destroy_buildings egypt ros_temp_buildings false 
        destroy_units savoy ros_Peasants
        destroy_buildings savoy ros_temp_buildings false
        destroy_buildings savoy ros_temp_buildings false 
        destroy_units montferrat ros_Peasants
        destroy_buildings montferrat ros_temp_buildings false
        destroy_buildings montferrat ros_temp_buildings false 
        destroy_units timurids ros_Peasants
        destroy_buildings timurids ros_temp_buildings false
        destroy_buildings timurids ros_temp_buildings false 
        destroy_units urbino ros_Peasants
        destroy_buildings urbino ros_temp_buildings false
        destroy_buildings urbino ros_temp_buildings false 
        destroy_units lucca ros_Peasants
        destroy_buildings lucca ros_temp_buildings false
        destroy_buildings lucca ros_temp_buildings false 

        create_unit Noli, NE Spear Militia, num 2, exp 1, arm 0, wep 0 
        create_unit Noli, Aventurier, num 1, exp 1, arm 0, wep 0   


        terminate_monitor
    end_monitor

    ;--------------------------------- HRR angenommen -----------------------------

    monitor_event EventCounter EventCounterType noli_angebot_accepted
        and I_CompareCounter Spieler_ist_HRR = 1
        and I_SettlementOwner Noli = slave
        and not I_SettlementUnderSiege Noli

        console_command add_money -10000
        historic_event noli_angebot_yes
        set_event_counter noli_switched 1

        console_command create_building Perugia ros_po_bonus
        console_command create_building Aquila ros_po_bonus
        console_command create_building Pontecorvo ros_po_bonus
        console_command create_building Capua ros_po_bonus
        console_command create_building Brindisi ros_po_bonus
        console_command create_building Pantelleria ros_po_bonus
        console_command create_building Marsala ros_po_bonus
        console_command create_building Terranova ros_po_bonus
        console_command create_building Montepulciano ros_po_bonus
        console_command create_building Urbino ros_po_bonus
        console_command create_building Piacenza ros_po_bonus
        console_command create_building Alessandria ros_po_bonus
        console_command create_building Camerino ros_po_bonus
        console_command create_building Mompelgard ros_po_bonus
        console_command create_building Mondovi ros_po_bonus
        console_command create_building Barcelonnette ros_po_bonus
        console_command create_building Gimignano ros_po_bonus
        console_command create_building Livorno ros_po_bonus
        console_command create_building Massa ros_po_bonus
        console_command create_building Novara ros_po_bonus
        console_command create_building Nuoro ros_po_bonus
        console_command create_building Biserta ros_po_bonus
        console_command create_building Rom ros_po_bonus
        console_command create_building Neapel ros_po_bonus
        console_command create_building Bologna ros_po_bonus
        console_command create_building Mailand ros_po_bonus
        console_command create_building Turin ros_po_bonus
        console_command create_building Genua ros_po_bonus
        console_command create_building Volterra ros_po_bonus
        console_command create_building Arezzo ros_po_bonus
        console_command create_building Siena ros_po_bonus
        console_command create_building Piombino ros_po_bonus
        console_command create_building Portoferraio ros_po_bonus
        console_command create_building Grosseto ros_po_bonus
        console_command create_building Orvieto ros_po_bonus
        console_command create_building Civita ros_po_bonus
        console_command create_building Lucca ros_po_bonus
        console_command create_building Mantua ros_po_bonus
        console_command create_building Ferrara ros_po_bonus
        console_command create_building Fivizanno ros_po_bonus
        console_command create_building Guastalla ros_po_bonus
        console_command create_building Modena ros_po_bonus
        console_command create_building Parma ros_po_bonus
        console_command create_building Pavia ros_po_bonus
        console_command create_building Brescia ros_po_bonus
        console_command create_building Cremona ros_po_bonus
        console_command create_building Verona ros_po_bonus
        console_command create_building Casale ros_po_bonus
        console_command create_building Asti ros_po_bonus
        console_command create_building Rovigo ros_po_bonus
        console_command create_building Forli ros_po_bonus
        console_command create_building Ravenna ros_po_bonus
        console_command create_building Rimini ros_po_bonus
        console_command create_building Ancona ros_po_bonus
        console_command create_building Fermo ros_po_bonus
        console_command create_building Spoleto ros_po_bonus
        console_command create_building Gaeta ros_po_bonus
        console_command create_building Foggia ros_po_bonus
        console_command create_building Pescara ros_po_bonus
        console_command create_building Benevento ros_po_bonus
        console_command create_building Otranto ros_po_bonus
        console_command create_building Bari ros_po_bonus
        console_command create_building Salerno ros_po_bonus
        console_command create_building Potenza ros_po_bonus
        console_command create_building Policastro ros_po_bonus
        console_command create_building Cosenza ros_po_bonus
        console_command create_building Reggio ros_po_bonus
        console_command create_building Messina ros_po_bonus
        console_command create_building Syrakus ros_po_bonus
        console_command create_building Girgenti ros_po_bonus
        console_command create_building Palermo ros_po_bonus
        console_command create_building Malta ros_po_bonus
        console_command create_building Tunis ros_po_bonus
        console_command create_building Qairawan ros_po_bonus
        console_command create_building Al_Kaf ros_po_bonus
        console_command create_building Annaba ros_po_bonus
        console_command create_building Qusantina ros_po_bonus
        console_command create_building Cagliari ros_po_bonus
        console_command create_building Oristano ros_po_bonus
        console_command create_building Sassari ros_po_bonus
        console_command create_building Bonifacio ros_po_bonus
        console_command create_building Ajaccio ros_po_bonus
        console_command create_building Bastia ros_po_bonus
        console_command create_building Nice ros_po_bonus
        console_command create_building Toulon ros_po_bonus
        console_command create_building Marseille ros_po_bonus
        console_command create_building Saluzzo ros_po_bonus
        console_command create_building Avignon ros_po_bonus
        console_command create_building Vienne ros_po_bonus
        console_command create_building Grenoble ros_po_bonus
        console_command create_building Lyon ros_po_bonus
        console_command create_building Genf ros_po_bonus
        console_command create_building Chalon ros_po_bonus
        console_command create_building Dijon ros_po_bonus
        console_command create_building Chaumont ros_po_bonus
        console_command create_building Besancon ros_po_bonus
        console_command create_building Lausanne ros_po_bonus
        console_command create_building Bern ros_po_bonus
        console_command create_building Sion ros_po_bonus
        console_command create_building Zurich ros_po_bonus
        console_command create_building Chur ros_po_bonus
        console_command create_building Nancy ros_po_bonus
        console_command create_building Strassburg ros_po_bonus
        console_command create_building Mulhouse ros_po_bonus
        console_command create_building Baden ros_po_bonus
        console_command create_building Freiburg ros_po_bonus
        console_command create_building Stuttgart ros_po_bonus
        console_command create_building Rottweil ros_po_bonus
        console_command create_building Bregenz ros_po_bonus
        console_command create_building Augsburg ros_po_bonus
        console_command create_building Ulm ros_po_bonus
        console_command create_building Ravensburg ros_po_bonus
        console_command create_building Krk ros_po_bonus
        console_command create_building Supetar ros_po_bonus
        console_command create_building Cattaro ros_po_bonus
        console_command create_building Ragusa ros_po_bonus
        console_command create_building Ston ros_po_bonus
        console_command create_building Trient ros_po_bonus
        console_command create_building Venedig ros_po_bonus
        console_command create_building Padua ros_po_bonus
        console_command create_building Treviso ros_po_bonus
        console_command create_building Trieste ros_po_bonus
        console_command create_building Pola ros_po_bonus
        console_command create_building Fiume ros_po_bonus
        console_command create_building Bihac ros_po_bonus
        console_command create_building Sinj ros_po_bonus
        console_command create_building Zara ros_po_bonus
        console_command create_building Spalato ros_po_bonus
        console_command create_building Innsbruck ros_po_bonus
        console_command create_building Munchen ros_po_bonus
        console_command create_building Freising ros_po_bonus
        console_command create_building Passau ros_po_bonus
        console_command create_building Laibach ros_po_bonus
        console_command create_building Villach ros_po_bonus
        console_command create_building Salzburg ros_po_bonus
        console_command create_building Sissek ros_po_bonus
        console_command create_building Trebinje ros_po_bonus
        console_command create_building Mostar ros_po_bonus
        console_command create_building Sarajevo ros_po_bonus
        console_command create_building Jajce ros_po_bonus
        console_command create_building Eszek ros_po_bonus
        console_command create_building Warasdin ros_po_bonus
        console_command create_building Zagreb ros_po_bonus
        console_command create_building Marburg ros_po_bonus
        console_command create_building Wien ros_po_bonus
        console_command create_building Linz ros_po_bonus
        console_command create_building Graz ros_po_bonus
        console_command create_building Odenburg ros_po_bonus
        console_command create_building Buda ros_po_bonus
        console_command create_building Nyitra ros_po_bonus
        console_command create_building Pressburg ros_po_bonus
        console_command create_building Pecs ros_po_bonus
        console_command create_building Stuhlweisenberg ros_po_bonus
        console_command create_building Kanizsa ros_po_bonus
        console_command create_building Keszthely ros_po_bonus
        console_command create_building Veszprem ros_po_bonus
        console_command create_building Susa ros_po_bonus
        console_command create_building Die ros_po_bonus
        console_command create_building Aix ros_po_bonus
        console_command create_building Gallen ros_po_bonus
        console_command create_building Basel ros_po_bonus
        console_command create_building Bellinzona ros_po_bonus
        console_command create_building Adelsberg ros_po_bonus
        console_command create_building Severin ros_po_bonus
        console_command create_building Banjaluka ros_po_bonus
        console_command create_building Mljet ros_po_bonus
        console_command create_building Neuenburg ros_po_bonus
        console_command create_building Lipari ros_po_bonus
        console_command create_building Brixen ros_po_bonus
        console_command create_building Pago ros_po_bonus
        console_command create_building Drijeva ros_po_bonus
        console_command create_building Landshut ros_po_bonus
        console_command create_building Salins ros_po_bonus
        console_command create_building Udine ros_po_bonus
        console_command create_building Gastein ros_po_bonus
        console_command create_building Chambery ros_po_bonus
        console_command create_building Aosta ros_po_bonus
        console_command create_building Kelibia ros_po_bonus
        console_command create_building Sinigaglia    ros_po_bonus
        console_command create_building Faenza   ros_po_bonus
        console_command create_building Incisa  ros_po_bonus
        console_command create_building Kempten ros_po_bonus
        console_command create_building Mirandola ros_po_bonus
        console_command create_building Montechiarugolo ros_po_bonus
        console_command create_building Cavtat ros_po_bonus
        console_command create_building Virovitica ros_po_bonus
        console_command create_building Raab ros_po_bonus
        console_command create_building Papa ros_po_bonus
        console_command create_building Eisenburg ros_po_bonus
        console_command create_building Gran ros_po_bonus
        console_command create_building Ostrovica ros_po_bonus
        console_command create_building Vranduk   ros_po_bonus
        console_command create_building Pisa   ros_po_bonus
        console_command create_building Florenz   ros_po_bonus

        console_command create_building Noli ros_target    
        console_command create_unit Noli ros_Peasants 1 0 0

        faction_emerge moors slave 1 400.0 0.0 1.2 town false unused_label1 unused_name 30


        campaign_wait 0.1

        if I_NumberOfSettlements moors == 0
            give_everything_to_faction moors slave false 
        end_if                                                                        

        if I_NumberOfSettlements moors > 0
            if not I_SettlementOwner Noli = moors
                give_everything_to_faction moors slave false
            end_if

            if I_SettlementOwner Noli = moors 
                give_everything_to_faction moors hre false
            end_if
        end_if    

        destroy_units venice ros_Peasants
        destroy_buildings venice ros_temp_buildings false
        destroy_buildings venice ros_temp_buildings false
        destroy_units spain ros_Peasants
        destroy_buildings spain ros_temp_buildings false
        destroy_buildings spain ros_temp_buildings false
        destroy_units france ros_Peasants
        destroy_buildings france ros_temp_buildings false
        destroy_buildings france ros_temp_buildings false
        destroy_units hre ros_Peasants
        destroy_buildings hre ros_temp_buildings false
        destroy_buildings hre ros_temp_buildings false
        destroy_units milan ros_Peasants
        destroy_buildings milan ros_temp_buildings false
        destroy_buildings milan ros_temp_buildings false
        destroy_units turks ros_Peasants
        destroy_buildings turks ros_temp_buildings false
        destroy_buildings turks ros_temp_buildings false
        destroy_units hungary ros_Peasants
        destroy_buildings hungary ros_temp_buildings false
        destroy_buildings hungary ros_temp_buildings false
        destroy_units papal_states ros_Peasants
        destroy_buildings papal_states ros_temp_buildings false
        destroy_buildings papal_states ros_temp_buildings false
        destroy_units saxons ros_Peasants
        destroy_buildings saxons ros_temp_buildings false
        destroy_buildings saxons ros_temp_buildings false
        destroy_units poland ros_Peasants
        destroy_buildings poland ros_temp_buildings false
        destroy_buildings poland ros_temp_buildings false
        destroy_units sicily ros_Peasants
        destroy_buildings sicily ros_temp_buildings false
        destroy_buildings sicily ros_temp_buildings false 
        destroy_units slave ros_Peasants
        destroy_buildings slave ros_temp_buildings false
        destroy_buildings slave ros_temp_buildings false 
        destroy_units normans ros_Peasants
        destroy_buildings normans ros_temp_buildings false
        destroy_buildings normans ros_temp_buildings false 
        destroy_units denmark ros_Peasants
        destroy_buildings denmark ros_temp_buildings false
        destroy_buildings denmark ros_temp_buildings false 
        destroy_units byzantium ros_Peasants
        destroy_buildings byzantium ros_temp_buildings false
        destroy_buildings byzantium ros_temp_buildings false 
        destroy_units england ros_Peasants
        destroy_buildings england ros_temp_buildings false
        destroy_buildings england ros_temp_buildings false 
        destroy_units russia ros_Peasants
        destroy_buildings russia ros_temp_buildings false
        destroy_buildings russia ros_temp_buildings false 
        destroy_units scotland ros_Peasants
        destroy_buildings scotland ros_temp_buildings false
        destroy_buildings scotland ros_temp_buildings false 
        destroy_units egypt ros_Peasants
        destroy_buildings egypt ros_temp_buildings false
        destroy_buildings egypt ros_temp_buildings false 
        destroy_units savoy ros_Peasants
        destroy_buildings savoy ros_temp_buildings false
        destroy_buildings savoy ros_temp_buildings false 
        destroy_units montferrat ros_Peasants
        destroy_buildings montferrat ros_temp_buildings false
        destroy_buildings montferrat ros_temp_buildings false 
        destroy_units timurids ros_Peasants
        destroy_buildings timurids ros_temp_buildings false
        destroy_buildings timurids ros_temp_buildings false 
        destroy_units urbino ros_Peasants
        destroy_buildings urbino ros_temp_buildings false
        destroy_buildings urbino ros_temp_buildings false 
        destroy_units lucca ros_Peasants
        destroy_buildings lucca ros_temp_buildings false
        destroy_buildings lucca ros_temp_buildings false 

        create_unit Noli, NE Spear Militia, num 2, exp 1, arm 0, wep 0 
        create_unit Noli, Pavise Crossbowmen, num 1, exp 1, arm 0, wep 0   


        terminate_monitor
    end_monitor


    ;--------------------------------- Ungarn angenommen --------------------------

    monitor_event EventCounter EventCounterType noli_angebot_accepted
        and I_CompareCounter Spieler_ist_Ungarn = 1
        and I_SettlementOwner Noli = slave
        and not I_SettlementUnderSiege Noli


        console_command add_money -10000
        historic_event noli_angebot_yes
        set_event_counter noli_switched 1

        console_command create_building Perugia ros_po_bonus
        console_command create_building Aquila ros_po_bonus
        console_command create_building Pontecorvo ros_po_bonus
        console_command create_building Capua ros_po_bonus
        console_command create_building Brindisi ros_po_bonus
        console_command create_building Pantelleria ros_po_bonus
        console_command create_building Marsala ros_po_bonus
        console_command create_building Terranova ros_po_bonus
        console_command create_building Montepulciano ros_po_bonus
        console_command create_building Urbino ros_po_bonus
        console_command create_building Piacenza ros_po_bonus
        console_command create_building Alessandria ros_po_bonus
        console_command create_building Camerino ros_po_bonus
        console_command create_building Mompelgard ros_po_bonus
        console_command create_building Mondovi ros_po_bonus
        console_command create_building Barcelonnette ros_po_bonus
        console_command create_building Gimignano ros_po_bonus
        console_command create_building Livorno ros_po_bonus
        console_command create_building Massa ros_po_bonus
        console_command create_building Novara ros_po_bonus
        console_command create_building Nuoro ros_po_bonus
        console_command create_building Biserta ros_po_bonus
        console_command create_building Rom ros_po_bonus
        console_command create_building Neapel ros_po_bonus
        console_command create_building Bologna ros_po_bonus
        console_command create_building Mailand ros_po_bonus
        console_command create_building Turin ros_po_bonus
        console_command create_building Genua ros_po_bonus
        console_command create_building Volterra ros_po_bonus
        console_command create_building Arezzo ros_po_bonus
        console_command create_building Siena ros_po_bonus
        console_command create_building Piombino ros_po_bonus
        console_command create_building Portoferraio ros_po_bonus
        console_command create_building Grosseto ros_po_bonus
        console_command create_building Orvieto ros_po_bonus
        console_command create_building Civita ros_po_bonus
        console_command create_building Lucca ros_po_bonus
        console_command create_building Mantua ros_po_bonus
        console_command create_building Ferrara ros_po_bonus
        console_command create_building Fivizanno ros_po_bonus
        console_command create_building Guastalla ros_po_bonus
        console_command create_building Modena ros_po_bonus
        console_command create_building Parma ros_po_bonus
        console_command create_building Pavia ros_po_bonus
        console_command create_building Brescia ros_po_bonus
        console_command create_building Cremona ros_po_bonus
        console_command create_building Verona ros_po_bonus
        console_command create_building Casale ros_po_bonus
        console_command create_building Asti ros_po_bonus
        console_command create_building Rovigo ros_po_bonus
        console_command create_building Forli ros_po_bonus
        console_command create_building Ravenna ros_po_bonus
        console_command create_building Rimini ros_po_bonus
        console_command create_building Ancona ros_po_bonus
        console_command create_building Fermo ros_po_bonus
        console_command create_building Spoleto ros_po_bonus
        console_command create_building Gaeta ros_po_bonus
        console_command create_building Foggia ros_po_bonus
        console_command create_building Pescara ros_po_bonus
        console_command create_building Benevento ros_po_bonus
        console_command create_building Otranto ros_po_bonus
        console_command create_building Bari ros_po_bonus
        console_command create_building Salerno ros_po_bonus
        console_command create_building Potenza ros_po_bonus
        console_command create_building Policastro ros_po_bonus
        console_command create_building Cosenza ros_po_bonus
        console_command create_building Reggio ros_po_bonus
        console_command create_building Messina ros_po_bonus
        console_command create_building Syrakus ros_po_bonus
        console_command create_building Girgenti ros_po_bonus
        console_command create_building Palermo ros_po_bonus
        console_command create_building Malta ros_po_bonus
        console_command create_building Tunis ros_po_bonus
        console_command create_building Qairawan ros_po_bonus
        console_command create_building Al_Kaf ros_po_bonus
        console_command create_building Annaba ros_po_bonus
        console_command create_building Qusantina ros_po_bonus
        console_command create_building Cagliari ros_po_bonus
        console_command create_building Oristano ros_po_bonus
        console_command create_building Sassari ros_po_bonus
        console_command create_building Bonifacio ros_po_bonus
        console_command create_building Ajaccio ros_po_bonus
        console_command create_building Bastia ros_po_bonus
        console_command create_building Nice ros_po_bonus
        console_command create_building Toulon ros_po_bonus
        console_command create_building Marseille ros_po_bonus
        console_command create_building Saluzzo ros_po_bonus
        console_command create_building Avignon ros_po_bonus
        console_command create_building Vienne ros_po_bonus
        console_command create_building Grenoble ros_po_bonus
        console_command create_building Lyon ros_po_bonus
        console_command create_building Genf ros_po_bonus
        console_command create_building Chalon ros_po_bonus
        console_command create_building Dijon ros_po_bonus
        console_command create_building Chaumont ros_po_bonus
        console_command create_building Besancon ros_po_bonus
        console_command create_building Lausanne ros_po_bonus
        console_command create_building Bern ros_po_bonus
        console_command create_building Sion ros_po_bonus
        console_command create_building Zurich ros_po_bonus
        console_command create_building Chur ros_po_bonus
        console_command create_building Nancy ros_po_bonus
        console_command create_building Strassburg ros_po_bonus
        console_command create_building Mulhouse ros_po_bonus
        console_command create_building Baden ros_po_bonus
        console_command create_building Freiburg ros_po_bonus
        console_command create_building Stuttgart ros_po_bonus
        console_command create_building Rottweil ros_po_bonus
        console_command create_building Bregenz ros_po_bonus
        console_command create_building Augsburg ros_po_bonus
        console_command create_building Ulm ros_po_bonus
        console_command create_building Ravensburg ros_po_bonus
        console_command create_building Krk ros_po_bonus
        console_command create_building Supetar ros_po_bonus
        console_command create_building Cattaro ros_po_bonus
        console_command create_building Ragusa ros_po_bonus
        console_command create_building Ston ros_po_bonus
        console_command create_building Trient ros_po_bonus
        console_command create_building Venedig ros_po_bonus
        console_command create_building Padua ros_po_bonus
        console_command create_building Treviso ros_po_bonus
        console_command create_building Trieste ros_po_bonus
        console_command create_building Pola ros_po_bonus
        console_command create_building Fiume ros_po_bonus
        console_command create_building Bihac ros_po_bonus
        console_command create_building Sinj ros_po_bonus
        console_command create_building Zara ros_po_bonus
        console_command create_building Spalato ros_po_bonus
        console_command create_building Innsbruck ros_po_bonus
        console_command create_building Munchen ros_po_bonus
        console_command create_building Freising ros_po_bonus
        console_command create_building Passau ros_po_bonus
        console_command create_building Laibach ros_po_bonus
        console_command create_building Villach ros_po_bonus
        console_command create_building Salzburg ros_po_bonus
        console_command create_building Sissek ros_po_bonus
        console_command create_building Trebinje ros_po_bonus
        console_command create_building Mostar ros_po_bonus
        console_command create_building Sarajevo ros_po_bonus
        console_command create_building Jajce ros_po_bonus
        console_command create_building Eszek ros_po_bonus
        console_command create_building Warasdin ros_po_bonus
        console_command create_building Zagreb ros_po_bonus
        console_command create_building Marburg ros_po_bonus
        console_command create_building Wien ros_po_bonus
        console_command create_building Linz ros_po_bonus
        console_command create_building Graz ros_po_bonus
        console_command create_building Odenburg ros_po_bonus
        console_command create_building Buda ros_po_bonus
        console_command create_building Nyitra ros_po_bonus
        console_command create_building Pressburg ros_po_bonus
        console_command create_building Pecs ros_po_bonus
        console_command create_building Stuhlweisenberg ros_po_bonus
        console_command create_building Kanizsa ros_po_bonus
        console_command create_building Keszthely ros_po_bonus
        console_command create_building Veszprem ros_po_bonus
        console_command create_building Susa ros_po_bonus
        console_command create_building Die ros_po_bonus
        console_command create_building Aix ros_po_bonus
        console_command create_building Gallen ros_po_bonus
        console_command create_building Basel ros_po_bonus
        console_command create_building Bellinzona ros_po_bonus
        console_command create_building Adelsberg ros_po_bonus
        console_command create_building Severin ros_po_bonus
        console_command create_building Banjaluka ros_po_bonus
        console_command create_building Mljet ros_po_bonus
        console_command create_building Neuenburg ros_po_bonus
        console_command create_building Lipari ros_po_bonus
        console_command create_building Brixen ros_po_bonus
        console_command create_building Pago ros_po_bonus
        console_command create_building Drijeva ros_po_bonus
        console_command create_building Landshut ros_po_bonus
        console_command create_building Salins ros_po_bonus
        console_command create_building Udine ros_po_bonus
        console_command create_building Gastein ros_po_bonus
        console_command create_building Chambery ros_po_bonus
        console_command create_building Aosta ros_po_bonus
        console_command create_building Kelibia ros_po_bonus
        console_command create_building Sinigaglia    ros_po_bonus
        console_command create_building Faenza   ros_po_bonus
        console_command create_building Incisa  ros_po_bonus
        console_command create_building Kempten ros_po_bonus
        console_command create_building Mirandola ros_po_bonus
        console_command create_building Montechiarugolo ros_po_bonus
        console_command create_building Cavtat ros_po_bonus
        console_command create_building Virovitica ros_po_bonus
        console_command create_building Raab ros_po_bonus
        console_command create_building Papa ros_po_bonus
        console_command create_building Eisenburg ros_po_bonus
        console_command create_building Gran ros_po_bonus
        console_command create_building Ostrovica ros_po_bonus
        console_command create_building Vranduk   ros_po_bonus
        console_command create_building Pisa   ros_po_bonus
        console_command create_building Florenz   ros_po_bonus

        console_command create_building Noli ros_target    
        console_command create_unit Noli ros_Peasants 1 0 0

        faction_emerge moors slave 1 400.0 0.0 1.2 town false unused_label1 unused_name 30


        campaign_wait 0.1

        if I_NumberOfSettlements moors == 0
            give_everything_to_faction moors slave false 
        end_if                                                                        

        if I_NumberOfSettlements moors > 0
            if not I_SettlementOwner Noli = moors
                give_everything_to_faction moors slave false
            end_if

            if I_SettlementOwner Noli = moors 
                give_everything_to_faction moors hungary false
            end_if
        end_if    

        destroy_units venice ros_Peasants
        destroy_buildings venice ros_temp_buildings false
        destroy_buildings venice ros_temp_buildings false
        destroy_units spain ros_Peasants
        destroy_buildings spain ros_temp_buildings false
        destroy_buildings spain ros_temp_buildings false
        destroy_units france ros_Peasants
        destroy_buildings france ros_temp_buildings false
        destroy_buildings france ros_temp_buildings false
        destroy_units hre ros_Peasants
        destroy_buildings hre ros_temp_buildings false
        destroy_buildings hre ros_temp_buildings false
        destroy_units milan ros_Peasants
        destroy_buildings milan ros_temp_buildings false
        destroy_buildings milan ros_temp_buildings false
        destroy_units turks ros_Peasants
        destroy_buildings turks ros_temp_buildings false
        destroy_buildings turks ros_temp_buildings false
        destroy_units hungary ros_Peasants
        destroy_buildings hungary ros_temp_buildings false
        destroy_buildings hungary ros_temp_buildings false
        destroy_units papal_states ros_Peasants
        destroy_buildings papal_states ros_temp_buildings false
        destroy_buildings papal_states ros_temp_buildings false
        destroy_units saxons ros_Peasants
        destroy_buildings saxons ros_temp_buildings false
        destroy_buildings saxons ros_temp_buildings false
        destroy_units poland ros_Peasants
        destroy_buildings poland ros_temp_buildings false
        destroy_buildings poland ros_temp_buildings false
        destroy_units sicily ros_Peasants
        destroy_buildings sicily ros_temp_buildings false
        destroy_buildings sicily ros_temp_buildings false 
        destroy_units slave ros_Peasants
        destroy_buildings slave ros_temp_buildings false
        destroy_buildings slave ros_temp_buildings false 
        destroy_units normans ros_Peasants
        destroy_buildings normans ros_temp_buildings false
        destroy_buildings normans ros_temp_buildings false 
        destroy_units denmark ros_Peasants
        destroy_buildings denmark ros_temp_buildings false
        destroy_buildings denmark ros_temp_buildings false 
        destroy_units byzantium ros_Peasants
        destroy_buildings byzantium ros_temp_buildings false
        destroy_buildings byzantium ros_temp_buildings false 
        destroy_units england ros_Peasants
        destroy_buildings england ros_temp_buildings false
        destroy_buildings england ros_temp_buildings false 
        destroy_units russia ros_Peasants
        destroy_buildings russia ros_temp_buildings false
        destroy_buildings russia ros_temp_buildings false 
        destroy_units scotland ros_Peasants
        destroy_buildings scotland ros_temp_buildings false
        destroy_buildings scotland ros_temp_buildings false 
        destroy_units egypt ros_Peasants
        destroy_buildings egypt ros_temp_buildings false
        destroy_buildings egypt ros_temp_buildings false 
        destroy_units savoy ros_Peasants
        destroy_buildings savoy ros_temp_buildings false
        destroy_buildings savoy ros_temp_buildings false 
        destroy_units montferrat ros_Peasants
        destroy_buildings montferrat ros_temp_buildings false
        destroy_buildings montferrat ros_temp_buildings false 
        destroy_units timurids ros_Peasants
        destroy_buildings timurids ros_temp_buildings false
        destroy_buildings timurids ros_temp_buildings false 
        destroy_units urbino ros_Peasants
        destroy_buildings urbino ros_temp_buildings false
        destroy_buildings urbino ros_temp_buildings false 
        destroy_units lucca ros_Peasants
        destroy_buildings lucca ros_temp_buildings false
        destroy_buildings lucca ros_temp_buildings false 

        create_unit Noli, EE Spear Militia, num 2, exp 1, arm 0, wep 0 
        create_unit Noli, Bosnian Archers, num 1, exp 1, arm 0, wep 0   


        terminate_monitor
    end_monitor

    ;--------------------------------- Papststaaten angenommen --------------------

    monitor_event EventCounter EventCounterType noli_angebot_accepted
        and I_CompareCounter Spieler_ist_Papststaaten = 1
        and I_SettlementOwner Noli = slave
        and not I_SettlementUnderSiege Noli


        console_command add_money -10000
        historic_event noli_angebot_yes
        set_event_counter noli_switched 1

        console_command create_building Perugia ros_po_bonus
        console_command create_building Aquila ros_po_bonus
        console_command create_building Pontecorvo ros_po_bonus
        console_command create_building Capua ros_po_bonus
        console_command create_building Brindisi ros_po_bonus
        console_command create_building Pantelleria ros_po_bonus
        console_command create_building Marsala ros_po_bonus
        console_command create_building Terranova ros_po_bonus
        console_command create_building Montepulciano ros_po_bonus
        console_command create_building Urbino ros_po_bonus
        console_command create_building Piacenza ros_po_bonus
        console_command create_building Alessandria ros_po_bonus
        console_command create_building Camerino ros_po_bonus
        console_command create_building Mompelgard ros_po_bonus
        console_command create_building Mondovi ros_po_bonus
        console_command create_building Barcelonnette ros_po_bonus
        console_command create_building Gimignano ros_po_bonus
        console_command create_building Livorno ros_po_bonus
        console_command create_building Massa ros_po_bonus
        console_command create_building Novara ros_po_bonus
        console_command create_building Nuoro ros_po_bonus
        console_command create_building Biserta ros_po_bonus
        console_command create_building Rom ros_po_bonus
        console_command create_building Neapel ros_po_bonus
        console_command create_building Bologna ros_po_bonus
        console_command create_building Mailand ros_po_bonus
        console_command create_building Turin ros_po_bonus
        console_command create_building Genua ros_po_bonus
        console_command create_building Volterra ros_po_bonus
        console_command create_building Arezzo ros_po_bonus
        console_command create_building Siena ros_po_bonus
        console_command create_building Piombino ros_po_bonus
        console_command create_building Portoferraio ros_po_bonus
        console_command create_building Grosseto ros_po_bonus
        console_command create_building Orvieto ros_po_bonus
        console_command create_building Civita ros_po_bonus
        console_command create_building Lucca ros_po_bonus
        console_command create_building Mantua ros_po_bonus
        console_command create_building Ferrara ros_po_bonus
        console_command create_building Fivizanno ros_po_bonus
        console_command create_building Guastalla ros_po_bonus
        console_command create_building Modena ros_po_bonus
        console_command create_building Parma ros_po_bonus
        console_command create_building Pavia ros_po_bonus
        console_command create_building Brescia ros_po_bonus
        console_command create_building Cremona ros_po_bonus
        console_command create_building Verona ros_po_bonus
        console_command create_building Casale ros_po_bonus
        console_command create_building Asti ros_po_bonus
        console_command create_building Rovigo ros_po_bonus
        console_command create_building Forli ros_po_bonus
        console_command create_building Ravenna ros_po_bonus
        console_command create_building Rimini ros_po_bonus
        console_command create_building Ancona ros_po_bonus
        console_command create_building Fermo ros_po_bonus
        console_command create_building Spoleto ros_po_bonus
        console_command create_building Gaeta ros_po_bonus
        console_command create_building Foggia ros_po_bonus
        console_command create_building Pescara ros_po_bonus
        console_command create_building Benevento ros_po_bonus
        console_command create_building Otranto ros_po_bonus
        console_command create_building Bari ros_po_bonus
        console_command create_building Salerno ros_po_bonus
        console_command create_building Potenza ros_po_bonus
        console_command create_building Policastro ros_po_bonus
        console_command create_building Cosenza ros_po_bonus
        console_command create_building Reggio ros_po_bonus
        console_command create_building Messina ros_po_bonus
        console_command create_building Syrakus ros_po_bonus
        console_command create_building Girgenti ros_po_bonus
        console_command create_building Palermo ros_po_bonus
        console_command create_building Malta ros_po_bonus
        console_command create_building Tunis ros_po_bonus
        console_command create_building Qairawan ros_po_bonus
        console_command create_building Al_Kaf ros_po_bonus
        console_command create_building Annaba ros_po_bonus
        console_command create_building Qusantina ros_po_bonus
        console_command create_building Cagliari ros_po_bonus
        console_command create_building Oristano ros_po_bonus
        console_command create_building Sassari ros_po_bonus
        console_command create_building Bonifacio ros_po_bonus
        console_command create_building Ajaccio ros_po_bonus
        console_command create_building Bastia ros_po_bonus
        console_command create_building Nice ros_po_bonus
        console_command create_building Toulon ros_po_bonus
        console_command create_building Marseille ros_po_bonus
        console_command create_building Saluzzo ros_po_bonus
        console_command create_building Avignon ros_po_bonus
        console_command create_building Vienne ros_po_bonus
        console_command create_building Grenoble ros_po_bonus
        console_command create_building Lyon ros_po_bonus
        console_command create_building Genf ros_po_bonus
        console_command create_building Chalon ros_po_bonus
        console_command create_building Dijon ros_po_bonus
        console_command create_building Chaumont ros_po_bonus
        console_command create_building Besancon ros_po_bonus
        console_command create_building Lausanne ros_po_bonus
        console_command create_building Bern ros_po_bonus
        console_command create_building Sion ros_po_bonus
        console_command create_building Zurich ros_po_bonus
        console_command create_building Chur ros_po_bonus
        console_command create_building Nancy ros_po_bonus
        console_command create_building Strassburg ros_po_bonus
        console_command create_building Mulhouse ros_po_bonus
        console_command create_building Baden ros_po_bonus
        console_command create_building Freiburg ros_po_bonus
        console_command create_building Stuttgart ros_po_bonus
        console_command create_building Rottweil ros_po_bonus
        console_command create_building Bregenz ros_po_bonus
        console_command create_building Augsburg ros_po_bonus
        console_command create_building Ulm ros_po_bonus
        console_command create_building Ravensburg ros_po_bonus
        console_command create_building Krk ros_po_bonus
        console_command create_building Supetar ros_po_bonus
        console_command create_building Cattaro ros_po_bonus
        console_command create_building Ragusa ros_po_bonus
        console_command create_building Ston ros_po_bonus
        console_command create_building Trient ros_po_bonus
        console_command create_building Venedig ros_po_bonus
        console_command create_building Padua ros_po_bonus
        console_command create_building Treviso ros_po_bonus
        console_command create_building Trieste ros_po_bonus
        console_command create_building Pola ros_po_bonus
        console_command create_building Fiume ros_po_bonus
        console_command create_building Bihac ros_po_bonus
        console_command create_building Sinj ros_po_bonus
        console_command create_building Zara ros_po_bonus
        console_command create_building Spalato ros_po_bonus
        console_command create_building Innsbruck ros_po_bonus
        console_command create_building Munchen ros_po_bonus
        console_command create_building Freising ros_po_bonus
        console_command create_building Passau ros_po_bonus
        console_command create_building Laibach ros_po_bonus
        console_command create_building Villach ros_po_bonus
        console_command create_building Salzburg ros_po_bonus
        console_command create_building Sissek ros_po_bonus
        console_command create_building Trebinje ros_po_bonus
        console_command create_building Mostar ros_po_bonus
        console_command create_building Sarajevo ros_po_bonus
        console_command create_building Jajce ros_po_bonus
        console_command create_building Eszek ros_po_bonus
        console_command create_building Warasdin ros_po_bonus
        console_command create_building Zagreb ros_po_bonus
        console_command create_building Marburg ros_po_bonus
        console_command create_building Wien ros_po_bonus
        console_command create_building Linz ros_po_bonus
        console_command create_building Graz ros_po_bonus
        console_command create_building Odenburg ros_po_bonus
        console_command create_building Buda ros_po_bonus
        console_command create_building Nyitra ros_po_bonus
        console_command create_building Pressburg ros_po_bonus
        console_command create_building Pecs ros_po_bonus
        console_command create_building Stuhlweisenberg ros_po_bonus
        console_command create_building Kanizsa ros_po_bonus
        console_command create_building Keszthely ros_po_bonus
        console_command create_building Veszprem ros_po_bonus
        console_command create_building Susa ros_po_bonus
        console_command create_building Die ros_po_bonus
        console_command create_building Aix ros_po_bonus
        console_command create_building Gallen ros_po_bonus
        console_command create_building Basel ros_po_bonus
        console_command create_building Bellinzona ros_po_bonus
        console_command create_building Adelsberg ros_po_bonus
        console_command create_building Severin ros_po_bonus
        console_command create_building Banjaluka ros_po_bonus
        console_command create_building Mljet ros_po_bonus
        console_command create_building Neuenburg ros_po_bonus
        console_command create_building Lipari ros_po_bonus
        console_command create_building Brixen ros_po_bonus
        console_command create_building Pago ros_po_bonus
        console_command create_building Drijeva ros_po_bonus
        console_command create_building Landshut ros_po_bonus
        console_command create_building Salins ros_po_bonus
        console_command create_building Udine ros_po_bonus
        console_command create_building Gastein ros_po_bonus
        console_command create_building Chambery ros_po_bonus
        console_command create_building Aosta ros_po_bonus
        console_command create_building Kelibia ros_po_bonus
        console_command create_building Sinigaglia    ros_po_bonus
        console_command create_building Faenza   ros_po_bonus
        console_command create_building Incisa  ros_po_bonus
        console_command create_building Kempten ros_po_bonus
        console_command create_building Mirandola ros_po_bonus
        console_command create_building Montechiarugolo ros_po_bonus
        console_command create_building Cavtat ros_po_bonus
        console_command create_building Virovitica ros_po_bonus
        console_command create_building Raab ros_po_bonus
        console_command create_building Papa ros_po_bonus
        console_command create_building Eisenburg ros_po_bonus
        console_command create_building Gran ros_po_bonus
        console_command create_building Ostrovica ros_po_bonus
        console_command create_building Vranduk   ros_po_bonus
        console_command create_building Pisa   ros_po_bonus
        console_command create_building Florenz   ros_po_bonus

        console_command create_building Noli ros_target    
        console_command create_unit Noli ros_Peasants 1 0 0

        faction_emerge moors slave 1 400.0 0.0 1.2 town false unused_label1 unused_name 30


        campaign_wait 0.1

        if I_NumberOfSettlements moors == 0
            give_everything_to_faction moors slave false 
        end_if                                                                        

        if I_NumberOfSettlements moors > 0
            if not I_SettlementOwner Noli = moors
                give_everything_to_faction moors slave false
            end_if

            if I_SettlementOwner Noli = moors 
                give_everything_to_faction moors papal_states false
            end_if
        end_if    

        destroy_units venice ros_Peasants
        destroy_buildings venice ros_temp_buildings false
        destroy_buildings venice ros_temp_buildings false
        destroy_units spain ros_Peasants
        destroy_buildings spain ros_temp_buildings false
        destroy_buildings spain ros_temp_buildings false
        destroy_units france ros_Peasants
        destroy_buildings france ros_temp_buildings false
        destroy_buildings france ros_temp_buildings false
        destroy_units hre ros_Peasants
        destroy_buildings hre ros_temp_buildings false
        destroy_buildings hre ros_temp_buildings false
        destroy_units milan ros_Peasants
        destroy_buildings milan ros_temp_buildings false
        destroy_buildings milan ros_temp_buildings false
        destroy_units turks ros_Peasants
        destroy_buildings turks ros_temp_buildings false
        destroy_buildings turks ros_temp_buildings false
        destroy_units hungary ros_Peasants
        destroy_buildings hungary ros_temp_buildings false
        destroy_buildings hungary ros_temp_buildings false
        destroy_units papal_states ros_Peasants
        destroy_buildings papal_states ros_temp_buildings false
        destroy_buildings papal_states ros_temp_buildings false
        destroy_units saxons ros_Peasants
        destroy_buildings saxons ros_temp_buildings false
        destroy_buildings saxons ros_temp_buildings false
        destroy_units poland ros_Peasants
        destroy_buildings poland ros_temp_buildings false
        destroy_buildings poland ros_temp_buildings false
        destroy_units sicily ros_Peasants
        destroy_buildings sicily ros_temp_buildings false
        destroy_buildings sicily ros_temp_buildings false 
        destroy_units slave ros_Peasants
        destroy_buildings slave ros_temp_buildings false
        destroy_buildings slave ros_temp_buildings false
        destroy_units normans ros_Peasants
        destroy_buildings normans ros_temp_buildings false
        destroy_buildings normans ros_temp_buildings false  
        destroy_units denmark ros_Peasants
        destroy_buildings denmark ros_temp_buildings false
        destroy_buildings denmark ros_temp_buildings false 
        destroy_units byzantium ros_Peasants
        destroy_buildings byzantium ros_temp_buildings false
        destroy_buildings byzantium ros_temp_buildings false 
        destroy_units england ros_Peasants
        destroy_buildings england ros_temp_buildings false
        destroy_buildings england ros_temp_buildings false 
        destroy_units russia ros_Peasants
        destroy_buildings russia ros_temp_buildings false
        destroy_buildings russia ros_temp_buildings false 
        destroy_units scotland ros_Peasants
        destroy_buildings scotland ros_temp_buildings false
        destroy_buildings scotland ros_temp_buildings false 
        destroy_units egypt ros_Peasants
        destroy_buildings egypt ros_temp_buildings false
        destroy_buildings egypt ros_temp_buildings false 
        destroy_units savoy ros_Peasants
        destroy_buildings savoy ros_temp_buildings false
        destroy_buildings savoy ros_temp_buildings false 
        destroy_units montferrat ros_Peasants
        destroy_buildings montferrat ros_temp_buildings false
        destroy_buildings montferrat ros_temp_buildings false 
        destroy_units timurids ros_Peasants
        destroy_buildings timurids ros_temp_buildings false
        destroy_buildings timurids ros_temp_buildings false 
        destroy_units urbino ros_Peasants
        destroy_buildings urbino ros_temp_buildings false
        destroy_buildings urbino ros_temp_buildings false 
        destroy_units lucca ros_Peasants
        destroy_buildings lucca ros_temp_buildings false
        destroy_buildings lucca ros_temp_buildings false 

        create_unit Noli, Italian Spear Militia, num 2, exp 1, arm 0, wep 0 
        create_unit Noli, Italian Cavalry Militia, num 1, exp 1, arm 0, wep 0   


        terminate_monitor
    end_monitor

    ;---------------------------- Florenz angenommen ------------------------------

    monitor_event EventCounter EventCounterType noli_angebot_accepted
        and I_CompareCounter Spieler_ist_Florenz = 1
        and I_SettlementOwner Noli = slave
        and not I_SettlementUnderSiege Noli

        console_command add_money -10000
        historic_event noli_angebot_yes
        set_event_counter noli_switched 1

        console_command create_building Perugia ros_po_bonus
        console_command create_building Aquila ros_po_bonus
        console_command create_building Pontecorvo ros_po_bonus
        console_command create_building Capua ros_po_bonus
        console_command create_building Brindisi ros_po_bonus
        console_command create_building Pantelleria ros_po_bonus
        console_command create_building Marsala ros_po_bonus
        console_command create_building Terranova ros_po_bonus
        console_command create_building Montepulciano ros_po_bonus
        console_command create_building Urbino ros_po_bonus
        console_command create_building Piacenza ros_po_bonus
        console_command create_building Alessandria ros_po_bonus
        console_command create_building Camerino ros_po_bonus
        console_command create_building Mompelgard ros_po_bonus
        console_command create_building Mondovi ros_po_bonus
        console_command create_building Barcelonnette ros_po_bonus
        console_command create_building Gimignano ros_po_bonus
        console_command create_building Livorno ros_po_bonus
        console_command create_building Massa ros_po_bonus
        console_command create_building Novara ros_po_bonus
        console_command create_building Nuoro ros_po_bonus
        console_command create_building Biserta ros_po_bonus
        console_command create_building Rom ros_po_bonus
        console_command create_building Neapel ros_po_bonus
        console_command create_building Bologna ros_po_bonus
        console_command create_building Mailand ros_po_bonus
        console_command create_building Turin ros_po_bonus
        console_command create_building Genua ros_po_bonus
        console_command create_building Volterra ros_po_bonus
        console_command create_building Arezzo ros_po_bonus
        console_command create_building Siena ros_po_bonus
        console_command create_building Piombino ros_po_bonus
        console_command create_building Portoferraio ros_po_bonus
        console_command create_building Grosseto ros_po_bonus
        console_command create_building Orvieto ros_po_bonus
        console_command create_building Civita ros_po_bonus
        console_command create_building Lucca ros_po_bonus
        console_command create_building Mantua ros_po_bonus
        console_command create_building Ferrara ros_po_bonus
        console_command create_building Fivizanno ros_po_bonus
        console_command create_building Guastalla ros_po_bonus
        console_command create_building Modena ros_po_bonus
        console_command create_building Parma ros_po_bonus
        console_command create_building Pavia ros_po_bonus
        console_command create_building Brescia ros_po_bonus
        console_command create_building Cremona ros_po_bonus
        console_command create_building Verona ros_po_bonus
        console_command create_building Casale ros_po_bonus
        console_command create_building Asti ros_po_bonus
        console_command create_building Rovigo ros_po_bonus
        console_command create_building Forli ros_po_bonus
        console_command create_building Ravenna ros_po_bonus
        console_command create_building Rimini ros_po_bonus
        console_command create_building Ancona ros_po_bonus
        console_command create_building Fermo ros_po_bonus
        console_command create_building Spoleto ros_po_bonus
        console_command create_building Gaeta ros_po_bonus
        console_command create_building Foggia ros_po_bonus
        console_command create_building Pescara ros_po_bonus
        console_command create_building Benevento ros_po_bonus
        console_command create_building Otranto ros_po_bonus
        console_command create_building Bari ros_po_bonus
        console_command create_building Salerno ros_po_bonus
        console_command create_building Potenza ros_po_bonus
        console_command create_building Policastro ros_po_bonus
        console_command create_building Cosenza ros_po_bonus
        console_command create_building Reggio ros_po_bonus
        console_command create_building Messina ros_po_bonus
        console_command create_building Syrakus ros_po_bonus
        console_command create_building Girgenti ros_po_bonus
        console_command create_building Palermo ros_po_bonus
        console_command create_building Malta ros_po_bonus
        console_command create_building Tunis ros_po_bonus
        console_command create_building Qairawan ros_po_bonus
        console_command create_building Al_Kaf ros_po_bonus
        console_command create_building Annaba ros_po_bonus
        console_command create_building Qusantina ros_po_bonus
        console_command create_building Cagliari ros_po_bonus
        console_command create_building Oristano ros_po_bonus
        console_command create_building Sassari ros_po_bonus
        console_command create_building Bonifacio ros_po_bonus
        console_command create_building Ajaccio ros_po_bonus
        console_command create_building Bastia ros_po_bonus
        console_command create_building Nice ros_po_bonus
        console_command create_building Toulon ros_po_bonus
        console_command create_building Marseille ros_po_bonus
        console_command create_building Saluzzo ros_po_bonus
        console_command create_building Avignon ros_po_bonus
        console_command create_building Vienne ros_po_bonus
        console_command create_building Grenoble ros_po_bonus
        console_command create_building Lyon ros_po_bonus
        console_command create_building Genf ros_po_bonus
        console_command create_building Chalon ros_po_bonus
        console_command create_building Dijon ros_po_bonus
        console_command create_building Chaumont ros_po_bonus
        console_command create_building Besancon ros_po_bonus
        console_command create_building Lausanne ros_po_bonus
        console_command create_building Bern ros_po_bonus
        console_command create_building Sion ros_po_bonus
        console_command create_building Zurich ros_po_bonus
        console_command create_building Chur ros_po_bonus
        console_command create_building Nancy ros_po_bonus
        console_command create_building Strassburg ros_po_bonus
        console_command create_building Mulhouse ros_po_bonus
        console_command create_building Baden ros_po_bonus
        console_command create_building Freiburg ros_po_bonus
        console_command create_building Stuttgart ros_po_bonus
        console_command create_building Rottweil ros_po_bonus
        console_command create_building Bregenz ros_po_bonus
        console_command create_building Augsburg ros_po_bonus
        console_command create_building Ulm ros_po_bonus
        console_command create_building Ravensburg ros_po_bonus
        console_command create_building Krk ros_po_bonus
        console_command create_building Supetar ros_po_bonus
        console_command create_building Cattaro ros_po_bonus
        console_command create_building Ragusa ros_po_bonus
        console_command create_building Ston ros_po_bonus
        console_command create_building Trient ros_po_bonus
        console_command create_building Venedig ros_po_bonus
        console_command create_building Padua ros_po_bonus
        console_command create_building Treviso ros_po_bonus
        console_command create_building Trieste ros_po_bonus
        console_command create_building Pola ros_po_bonus
        console_command create_building Fiume ros_po_bonus
        console_command create_building Bihac ros_po_bonus
        console_command create_building Sinj ros_po_bonus
        console_command create_building Zara ros_po_bonus
        console_command create_building Spalato ros_po_bonus
        console_command create_building Innsbruck ros_po_bonus
        console_command create_building Munchen ros_po_bonus
        console_command create_building Freising ros_po_bonus
        console_command create_building Passau ros_po_bonus
        console_command create_building Laibach ros_po_bonus
        console_command create_building Villach ros_po_bonus
        console_command create_building Salzburg ros_po_bonus
        console_command create_building Sissek ros_po_bonus
        console_command create_building Trebinje ros_po_bonus
        console_command create_building Mostar ros_po_bonus
        console_command create_building Sarajevo ros_po_bonus
        console_command create_building Jajce ros_po_bonus
        console_command create_building Eszek ros_po_bonus
        console_command create_building Warasdin ros_po_bonus
        console_command create_building Zagreb ros_po_bonus
        console_command create_building Marburg ros_po_bonus
        console_command create_building Wien ros_po_bonus
        console_command create_building Linz ros_po_bonus
        console_command create_building Graz ros_po_bonus
        console_command create_building Odenburg ros_po_bonus
        console_command create_building Buda ros_po_bonus
        console_command create_building Nyitra ros_po_bonus
        console_command create_building Pressburg ros_po_bonus
        console_command create_building Pecs ros_po_bonus
        console_command create_building Stuhlweisenberg ros_po_bonus
        console_command create_building Kanizsa ros_po_bonus
        console_command create_building Keszthely ros_po_bonus
        console_command create_building Veszprem ros_po_bonus
        console_command create_building Susa ros_po_bonus
        console_command create_building Die ros_po_bonus
        console_command create_building Aix ros_po_bonus
        console_command create_building Gallen ros_po_bonus
        console_command create_building Basel ros_po_bonus
        console_command create_building Bellinzona ros_po_bonus
        console_command create_building Adelsberg ros_po_bonus
        console_command create_building Severin ros_po_bonus
        console_command create_building Banjaluka ros_po_bonus
        console_command create_building Mljet ros_po_bonus
        console_command create_building Neuenburg ros_po_bonus
        console_command create_building Lipari ros_po_bonus
        console_command create_building Brixen ros_po_bonus
        console_command create_building Pago ros_po_bonus
        console_command create_building Drijeva ros_po_bonus
        console_command create_building Landshut ros_po_bonus
        console_command create_building Salins ros_po_bonus
        console_command create_building Udine ros_po_bonus
        console_command create_building Gastein ros_po_bonus
        console_command create_building Chambery ros_po_bonus
        console_command create_building Aosta ros_po_bonus
        console_command create_building Kelibia ros_po_bonus
        console_command create_building Sinigaglia    ros_po_bonus
        console_command create_building Faenza   ros_po_bonus
        console_command create_building Incisa  ros_po_bonus
        console_command create_building Kempten ros_po_bonus
        console_command create_building Mirandola ros_po_bonus
        console_command create_building Montechiarugolo ros_po_bonus
        console_command create_building Cavtat ros_po_bonus
        console_command create_building Virovitica ros_po_bonus
        console_command create_building Raab ros_po_bonus
        console_command create_building Papa ros_po_bonus
        console_command create_building Eisenburg ros_po_bonus
        console_command create_building Gran ros_po_bonus
        console_command create_building Ostrovica ros_po_bonus
        console_command create_building Vranduk   ros_po_bonus
        console_command create_building Pisa   ros_po_bonus
        console_command create_building Florenz   ros_po_bonus

        console_command create_building Noli ros_target    
        console_command create_unit Noli ros_Peasants 1 0 0

        faction_emerge moors slave 1 400.0 0.0 1.2 town false unused_label1 unused_name 30


        campaign_wait 0.1

        if I_NumberOfSettlements moors == 0
            give_everything_to_faction moors slave false 
        end_if                                                                        

        if I_NumberOfSettlements moors > 0
            if not I_SettlementOwner Noli = moors
                give_everything_to_faction moors slave false
            end_if

            if I_SettlementOwner Noli = moors 
                give_everything_to_faction moors poland false
            end_if
        end_if    

        destroy_units venice ros_Peasants
        destroy_buildings venice ros_temp_buildings false
        destroy_buildings venice ros_temp_buildings false
        destroy_units spain ros_Peasants
        destroy_buildings spain ros_temp_buildings false
        destroy_buildings spain ros_temp_buildings false
        destroy_units france ros_Peasants
        destroy_buildings france ros_temp_buildings false
        destroy_buildings france ros_temp_buildings false
        destroy_units hre ros_Peasants
        destroy_buildings hre ros_temp_buildings false
        destroy_buildings hre ros_temp_buildings false
        destroy_units milan ros_Peasants
        destroy_buildings milan ros_temp_buildings false
        destroy_buildings milan ros_temp_buildings false
        destroy_units turks ros_Peasants
        destroy_buildings turks ros_temp_buildings false
        destroy_buildings turks ros_temp_buildings false
        destroy_units hungary ros_Peasants
        destroy_buildings hungary ros_temp_buildings false
        destroy_buildings hungary ros_temp_buildings false
        destroy_units papal_states ros_Peasants
        destroy_buildings papal_states ros_temp_buildings false
        destroy_buildings papal_states ros_temp_buildings false
        destroy_units saxons ros_Peasants
        destroy_buildings saxons ros_temp_buildings false
        destroy_buildings saxons ros_temp_buildings false
        destroy_units poland ros_Peasants
        destroy_buildings poland ros_temp_buildings false
        destroy_buildings poland ros_temp_buildings false
        destroy_units sicily ros_Peasants
        destroy_buildings sicily ros_temp_buildings false
        destroy_buildings sicily ros_temp_buildings false 
        destroy_units slave ros_Peasants
        destroy_buildings slave ros_temp_buildings false
        destroy_buildings slave ros_temp_buildings false 
        destroy_units normans ros_Peasants
        destroy_buildings normans ros_temp_buildings false
        destroy_buildings normans ros_temp_buildings false 
        destroy_units denmark ros_Peasants
        destroy_buildings denmark ros_temp_buildings false
        destroy_buildings denmark ros_temp_buildings false 
        destroy_units byzantium ros_Peasants
        destroy_buildings byzantium ros_temp_buildings false
        destroy_buildings byzantium ros_temp_buildings false 
        destroy_units england ros_Peasants
        destroy_buildings england ros_temp_buildings false
        destroy_buildings england ros_temp_buildings false 
        destroy_units russia ros_Peasants
        destroy_buildings russia ros_temp_buildings false
        destroy_buildings russia ros_temp_buildings false 
        destroy_units scotland ros_Peasants
        destroy_buildings scotland ros_temp_buildings false
        destroy_buildings scotland ros_temp_buildings false 
        destroy_units egypt ros_Peasants
        destroy_buildings egypt ros_temp_buildings false
        destroy_buildings egypt ros_temp_buildings false 
        destroy_units savoy ros_Peasants
        destroy_buildings savoy ros_temp_buildings false
        destroy_buildings savoy ros_temp_buildings false 
        destroy_units montferrat ros_Peasants
        destroy_buildings montferrat ros_temp_buildings false
        destroy_buildings montferrat ros_temp_buildings false 
        destroy_units timurids ros_Peasants
        destroy_buildings timurids ros_temp_buildings false
        destroy_buildings timurids ros_temp_buildings false 
        destroy_units urbino ros_Peasants
        destroy_buildings urbino ros_temp_buildings false
        destroy_buildings urbino ros_temp_buildings false 
        destroy_units lucca ros_Peasants
        destroy_buildings lucca ros_temp_buildings false
        destroy_buildings lucca ros_temp_buildings false 

        create_unit Noli, Italian Spear Militia, num 2, exp 1, arm 0, wep 0 
        create_unit Noli, Italian Cavalry Militia, num 1, exp 1, arm 0, wep 0   


        terminate_monitor
    end_monitor

    ;--------------------------------- Neapel angenommen --------------------------

    monitor_event EventCounter EventCounterType noli_angebot_accepted
        and I_CompareCounter Spieler_ist_Neapel = 1
        and I_SettlementOwner Noli = slave
        and not I_SettlementUnderSiege Noli


        console_command add_money -10000
        historic_event noli_angebot_yes
        set_event_counter noli_switched 1

        console_command create_building Perugia ros_po_bonus
        console_command create_building Aquila ros_po_bonus
        console_command create_building Pontecorvo ros_po_bonus
        console_command create_building Capua ros_po_bonus
        console_command create_building Brindisi ros_po_bonus
        console_command create_building Pantelleria ros_po_bonus
        console_command create_building Marsala ros_po_bonus
        console_command create_building Terranova ros_po_bonus
        console_command create_building Montepulciano ros_po_bonus
        console_command create_building Urbino ros_po_bonus
        console_command create_building Piacenza ros_po_bonus
        console_command create_building Alessandria ros_po_bonus
        console_command create_building Camerino ros_po_bonus
        console_command create_building Mompelgard ros_po_bonus
        console_command create_building Mondovi ros_po_bonus
        console_command create_building Barcelonnette ros_po_bonus
        console_command create_building Gimignano ros_po_bonus
        console_command create_building Livorno ros_po_bonus
        console_command create_building Massa ros_po_bonus
        console_command create_building Novara ros_po_bonus
        console_command create_building Nuoro ros_po_bonus
        console_command create_building Biserta ros_po_bonus
        console_command create_building Rom ros_po_bonus
        console_command create_building Neapel ros_po_bonus
        console_command create_building Bologna ros_po_bonus
        console_command create_building Mailand ros_po_bonus
        console_command create_building Turin ros_po_bonus
        console_command create_building Genua ros_po_bonus
        console_command create_building Volterra ros_po_bonus
        console_command create_building Arezzo ros_po_bonus
        console_command create_building Siena ros_po_bonus
        console_command create_building Piombino ros_po_bonus
        console_command create_building Portoferraio ros_po_bonus
        console_command create_building Grosseto ros_po_bonus
        console_command create_building Orvieto ros_po_bonus
        console_command create_building Civita ros_po_bonus
        console_command create_building Lucca ros_po_bonus
        console_command create_building Mantua ros_po_bonus
        console_command create_building Ferrara ros_po_bonus
        console_command create_building Fivizanno ros_po_bonus
        console_command create_building Guastalla ros_po_bonus
        console_command create_building Modena ros_po_bonus
        console_command create_building Parma ros_po_bonus
        console_command create_building Pavia ros_po_bonus
        console_command create_building Brescia ros_po_bonus
        console_command create_building Cremona ros_po_bonus
        console_command create_building Verona ros_po_bonus
        console_command create_building Casale ros_po_bonus
        console_command create_building Asti ros_po_bonus
        console_command create_building Rovigo ros_po_bonus
        console_command create_building Forli ros_po_bonus
        console_command create_building Ravenna ros_po_bonus
        console_command create_building Rimini ros_po_bonus
        console_command create_building Ancona ros_po_bonus
        console_command create_building Fermo ros_po_bonus
        console_command create_building Spoleto ros_po_bonus
        console_command create_building Gaeta ros_po_bonus
        console_command create_building Foggia ros_po_bonus
        console_command create_building Pescara ros_po_bonus
        console_command create_building Benevento ros_po_bonus
        console_command create_building Otranto ros_po_bonus
        console_command create_building Bari ros_po_bonus
        console_command create_building Salerno ros_po_bonus
        console_command create_building Potenza ros_po_bonus
        console_command create_building Policastro ros_po_bonus
        console_command create_building Cosenza ros_po_bonus
        console_command create_building Reggio ros_po_bonus
        console_command create_building Messina ros_po_bonus
        console_command create_building Syrakus ros_po_bonus
        console_command create_building Girgenti ros_po_bonus
        console_command create_building Palermo ros_po_bonus
        console_command create_building Malta ros_po_bonus
        console_command create_building Tunis ros_po_bonus
        console_command create_building Qairawan ros_po_bonus
        console_command create_building Al_Kaf ros_po_bonus
        console_command create_building Annaba ros_po_bonus
        console_command create_building Qusantina ros_po_bonus
        console_command create_building Cagliari ros_po_bonus
        console_command create_building Oristano ros_po_bonus
        console_command create_building Sassari ros_po_bonus
        console_command create_building Bonifacio ros_po_bonus
        console_command create_building Ajaccio ros_po_bonus
        console_command create_building Bastia ros_po_bonus
        console_command create_building Nice ros_po_bonus
        console_command create_building Toulon ros_po_bonus
        console_command create_building Marseille ros_po_bonus
        console_command create_building Saluzzo ros_po_bonus
        console_command create_building Avignon ros_po_bonus
        console_command create_building Vienne ros_po_bonus
        console_command create_building Grenoble ros_po_bonus
        console_command create_building Lyon ros_po_bonus
        console_command create_building Genf ros_po_bonus
        console_command create_building Chalon ros_po_bonus
        console_command create_building Dijon ros_po_bonus
        console_command create_building Chaumont ros_po_bonus
        console_command create_building Besancon ros_po_bonus
        console_command create_building Lausanne ros_po_bonus
        console_command create_building Bern ros_po_bonus
        console_command create_building Sion ros_po_bonus
        console_command create_building Zurich ros_po_bonus
        console_command create_building Chur ros_po_bonus
        console_command create_building Nancy ros_po_bonus
        console_command create_building Strassburg ros_po_bonus
        console_command create_building Mulhouse ros_po_bonus
        console_command create_building Baden ros_po_bonus
        console_command create_building Freiburg ros_po_bonus
        console_command create_building Stuttgart ros_po_bonus
        console_command create_building Rottweil ros_po_bonus
        console_command create_building Bregenz ros_po_bonus
        console_command create_building Augsburg ros_po_bonus
        console_command create_building Ulm ros_po_bonus
        console_command create_building Ravensburg ros_po_bonus
        console_command create_building Krk ros_po_bonus
        console_command create_building Supetar ros_po_bonus
        console_command create_building Cattaro ros_po_bonus
        console_command create_building Ragusa ros_po_bonus
        console_command create_building Ston ros_po_bonus
        console_command create_building Trient ros_po_bonus
        console_command create_building Venedig ros_po_bonus
        console_command create_building Padua ros_po_bonus
        console_command create_building Treviso ros_po_bonus
        console_command create_building Trieste ros_po_bonus
        console_command create_building Pola ros_po_bonus
        console_command create_building Fiume ros_po_bonus
        console_command create_building Bihac ros_po_bonus
        console_command create_building Sinj ros_po_bonus
        console_command create_building Zara ros_po_bonus
        console_command create_building Spalato ros_po_bonus
        console_command create_building Innsbruck ros_po_bonus
        console_command create_building Munchen ros_po_bonus
        console_command create_building Freising ros_po_bonus
        console_command create_building Passau ros_po_bonus
        console_command create_building Laibach ros_po_bonus
        console_command create_building Villach ros_po_bonus
        console_command create_building Salzburg ros_po_bonus
        console_command create_building Sissek ros_po_bonus
        console_command create_building Trebinje ros_po_bonus
        console_command create_building Mostar ros_po_bonus
        console_command create_building Sarajevo ros_po_bonus
        console_command create_building Jajce ros_po_bonus
        console_command create_building Eszek ros_po_bonus
        console_command create_building Warasdin ros_po_bonus
        console_command create_building Zagreb ros_po_bonus
        console_command create_building Marburg ros_po_bonus
        console_command create_building Wien ros_po_bonus
        console_command create_building Linz ros_po_bonus
        console_command create_building Graz ros_po_bonus
        console_command create_building Odenburg ros_po_bonus
        console_command create_building Buda ros_po_bonus
        console_command create_building Nyitra ros_po_bonus
        console_command create_building Pressburg ros_po_bonus
        console_command create_building Pecs ros_po_bonus
        console_command create_building Stuhlweisenberg ros_po_bonus
        console_command create_building Kanizsa ros_po_bonus
        console_command create_building Keszthely ros_po_bonus
        console_command create_building Veszprem ros_po_bonus
        console_command create_building Susa ros_po_bonus
        console_command create_building Die ros_po_bonus
        console_command create_building Aix ros_po_bonus
        console_command create_building Gallen ros_po_bonus
        console_command create_building Basel ros_po_bonus
        console_command create_building Bellinzona ros_po_bonus
        console_command create_building Adelsberg ros_po_bonus
        console_command create_building Severin ros_po_bonus
        console_command create_building Banjaluka ros_po_bonus
        console_command create_building Mljet ros_po_bonus
        console_command create_building Neuenburg ros_po_bonus
        console_command create_building Lipari ros_po_bonus
        console_command create_building Brixen ros_po_bonus
        console_command create_building Pago ros_po_bonus
        console_command create_building Drijeva ros_po_bonus
        console_command create_building Landshut ros_po_bonus
        console_command create_building Salins ros_po_bonus
        console_command create_building Udine ros_po_bonus
        console_command create_building Gastein ros_po_bonus
        console_command create_building Chambery ros_po_bonus
        console_command create_building Aosta ros_po_bonus
        console_command create_building Kelibia ros_po_bonus
        console_command create_building Sinigaglia    ros_po_bonus
        console_command create_building Faenza   ros_po_bonus
        console_command create_building Incisa  ros_po_bonus
        console_command create_building Kempten ros_po_bonus
        console_command create_building Mirandola ros_po_bonus
        console_command create_building Montechiarugolo ros_po_bonus
        console_command create_building Cavtat ros_po_bonus
        console_command create_building Virovitica ros_po_bonus
        console_command create_building Raab ros_po_bonus
        console_command create_building Papa ros_po_bonus
        console_command create_building Eisenburg ros_po_bonus
        console_command create_building Gran ros_po_bonus
        console_command create_building Ostrovica ros_po_bonus
        console_command create_building Vranduk   ros_po_bonus
        console_command create_building Pisa   ros_po_bonus
        console_command create_building Florenz   ros_po_bonus

        console_command create_building Noli ros_target    
        console_command create_unit Noli ros_Peasants 1 0 0

        faction_emerge moors slave 1 400.0 0.0 1.2 town false unused_label1 unused_name 30


        campaign_wait 0.1

        if I_NumberOfSettlements moors == 0
            give_everything_to_faction moors slave false 
        end_if                                                                        

        if I_NumberOfSettlements moors > 0
            if not I_SettlementOwner Noli = moors
                give_everything_to_faction moors slave false
            end_if

            if I_SettlementOwner Noli = moors 
                give_everything_to_faction moors sicily false
            end_if
        end_if    

        destroy_units venice ros_Peasants
        destroy_buildings venice ros_temp_buildings false
        destroy_buildings venice ros_temp_buildings false
        destroy_units spain ros_Peasants
        destroy_buildings spain ros_temp_buildings false
        destroy_buildings spain ros_temp_buildings false
        destroy_units france ros_Peasants
        destroy_buildings france ros_temp_buildings false
        destroy_buildings france ros_temp_buildings false
        destroy_units hre ros_Peasants
        destroy_buildings hre ros_temp_buildings false
        destroy_buildings hre ros_temp_buildings false
        destroy_units milan ros_Peasants
        destroy_buildings milan ros_temp_buildings false
        destroy_buildings milan ros_temp_buildings false
        destroy_units turks ros_Peasants
        destroy_buildings turks ros_temp_buildings false
        destroy_buildings turks ros_temp_buildings false
        destroy_units hungary ros_Peasants
        destroy_buildings hungary ros_temp_buildings false
        destroy_buildings hungary ros_temp_buildings false
        destroy_units papal_states ros_Peasants
        destroy_buildings papal_states ros_temp_buildings false
        destroy_buildings papal_states ros_temp_buildings false
        destroy_units saxons ros_Peasants
        destroy_buildings saxons ros_temp_buildings false
        destroy_buildings saxons ros_temp_buildings false
        destroy_units poland ros_Peasants
        destroy_buildings poland ros_temp_buildings false
        destroy_buildings poland ros_temp_buildings false
        destroy_units sicily ros_Peasants
        destroy_buildings sicily ros_temp_buildings false
        destroy_buildings sicily ros_temp_buildings false 
        destroy_units slave ros_Peasants
        destroy_buildings slave ros_temp_buildings false
        destroy_buildings slave ros_temp_buildings false
        destroy_units normans ros_Peasants
        destroy_buildings normans ros_temp_buildings false
        destroy_buildings normans ros_temp_buildings false  
        destroy_units denmark ros_Peasants
        destroy_buildings denmark ros_temp_buildings false
        destroy_buildings denmark ros_temp_buildings false 
        destroy_units byzantium ros_Peasants
        destroy_buildings byzantium ros_temp_buildings false
        destroy_buildings byzantium ros_temp_buildings false 
        destroy_units england ros_Peasants
        destroy_buildings england ros_temp_buildings false
        destroy_buildings england ros_temp_buildings false 
        destroy_units russia ros_Peasants
        destroy_buildings russia ros_temp_buildings false
        destroy_buildings russia ros_temp_buildings false 
        destroy_units scotland ros_Peasants
        destroy_buildings scotland ros_temp_buildings false
        destroy_buildings scotland ros_temp_buildings false 
        destroy_units egypt ros_Peasants
        destroy_buildings egypt ros_temp_buildings false
        destroy_buildings egypt ros_temp_buildings false 
        destroy_units savoy ros_Peasants
        destroy_buildings savoy ros_temp_buildings false
        destroy_buildings savoy ros_temp_buildings false 
        destroy_units montferrat ros_Peasants
        destroy_buildings montferrat ros_temp_buildings false
        destroy_buildings montferrat ros_temp_buildings false 
        destroy_units timurids ros_Peasants
        destroy_buildings timurids ros_temp_buildings false
        destroy_buildings timurids ros_temp_buildings false 
        destroy_units urbino ros_Peasants
        destroy_buildings urbino ros_temp_buildings false
        destroy_buildings urbino ros_temp_buildings false 
        destroy_units lucca ros_Peasants
        destroy_buildings lucca ros_temp_buildings false
        destroy_buildings lucca ros_temp_buildings false 

        create_unit Noli, Italian Spear Militia, num 2, exp 1, arm 0, wep 0 
        create_unit Noli, Italian Cavalry Militia, num 1, exp 1, arm 0, wep 0   


        terminate_monitor
    end_monitor

    ;--------------------------------- Abgelehnt ----------------------------------

    monitor_event EventCounter EventCounterType noli_angebot_declined

        historic_event noli_angebot_no

        terminate_monitor
    end_monitor

    ;------------------------------------------------------------------------------
    ;---------------------------- Feldkosten --------------------------------------
    ;------------------------------------------------------------------------------

    monitor_event CharacterTurnEnd FactionIsLocal
        and not EndedInSettlement
        and not IsBesieging
        and not AgentType = admiral
        and not AgentType = spy
        and not AgentType = diplomat
        and not AgentType = assassin
        and not AgentType = priest
        and not AgentType = princess
        and not AgentType = merchant
        and InEnemyLands
        console_command add_money -800
    end_monitor

    monitor_event CharacterTurnEnd FactionIsLocal
        and not EndedInSettlement
        and not AgentType = admiral
        and not AgentType = spy
        and not AgentType = diplomat
        and not AgentType = assassin
        and not AgentType = priest
        and not AgentType = princess
        and not AgentType = merchant
        and not InEnemyLands
        console_command add_money -300
    end_monitor

    monitor_event CharacterTurnEnd FactionIsLocal
        and not EndedInSettlement
        and IsBesieging
        and not AgentType = admiral
        and not AgentType = spy
        and not AgentType = diplomat
        and not AgentType = assassin
        and not AgentType = priest
        and not AgentType = princess
        and not AgentType = merchant
        and InEnemyLands
        console_command add_money -1000
    end_monitor

    declare_counter finance_open

    monitor_event DiplomaticStandingPanelOpen
        if I_CompareCounter finance_open < 1
            historic_event feldkosten
        end_if

        set_counter finance_open 1

    end_monitor

    monitor_event ButtonPressed ButtonPressed end_turn

        set_counter finance_open 0

    end_monitor

    ;------------------------------------------------------------------------------
    ;----------------------- VI Darlehenscript ------------------------------------
    ;------------------------------------------------------------------------------

    ;--------------------------- 1 Geldabfrage ------------------------------------

    monitor_event PreFactionTurnStart FactionIsLocal
        and not FactionType turks 
        and not FactionType egypt
        and I_EventCounter geld < 1
        and Treasury < -5000
        and Treasury > -14000
        historic_event geldwechsler true 
    end_monitor

    ;--------------------------------- 2 angenommen -------------------------------

    monitor_event EventCounter EventCounterType geldwechsler_accepted
        and I_EventCounter geldwechsler_accepted = 1
        and I_EventCounter geld < 1
        console_command add_money 15000
        historic_event geldwechsler_a
        set_event_counter geld 1
    end_monitor

    ;--------------------------------- 3 abgelehnt --------------------------------

    monitor_event EventCounter EventCounterType geldwechsler_declined
        and I_EventCounter geldwechsler_declined = 1
        historic_event geldwechsler_ab
        set_event_counter geld 1
        terminate_monitor
    end_monitor

    ;--------------------------------- 4 Darlehen ---------------------------------

    monitor_event PreFactionTurnStart FactionIsLocal
        and I_EventCounter geldwechsler_accepted > 0
        inc_event_counter gelda 1
        if I_EventCounter gelda > 12
            historic_event geldwechsler_z
            console_command add_money -20000
            set_event_counter geld 0
            set_event_counter gelda 0
            set_event_counter geldwechsler_accepted 0
        end_if
    end_monitor


    ;------------------------------------------------------------------------------
    ;------------------------------- Söldnerunwesen -------------------------------
    ;------------------------------------------------------------------------------

    ;------------------------------------------------------------------------------
    ;------------------- Mailand

    declare_counter war_milan_hre
    declare_counter war_milan_france
    declare_counter war_milan_saxons
    declare_counter war_milan_hungary
    declare_counter war_milan_turks
    declare_counter war_milan_venice
    declare_counter war_milan_poland
    declare_counter war_milan_papal_states
    declare_counter war_milan_sicily
    declare_counter war_milan_spain
    declare_counter war_milan_normans
    declare_counter war_milan_savoy
    declare_counter war_milan_montferrat
    declare_counter war_milan_bologna
    declare_counter war_milan_urbino
    declare_counter war_milan_lucca
    declare_counter war_milan_peasants
    declare_counter war_milan_hafsids

    declare_counter milan_zahler
    declare_counter milan_con

    ;------------------- Frankreich

    declare_counter war_france_hre
    declare_counter war_france_milan
    declare_counter war_france_saxons
    declare_counter war_france_hungary
    declare_counter war_france_turks
    declare_counter war_france_venice
    declare_counter war_france_poland
    declare_counter war_france_papal_states
    declare_counter war_france_sicily
    declare_counter war_france_spain
    declare_counter war_france_normans
    declare_counter war_france_savoy
    declare_counter war_france_montferrat
    declare_counter war_france_bologna
    declare_counter war_france_urbino
    declare_counter war_france_lucca
    declare_counter war_france_peasants
    declare_counter war_france_hafsids

    declare_counter france_zahler
    declare_counter france_con

    ;------------------- HRE

    declare_counter war_hre_france
    declare_counter war_hre_saxons
    declare_counter war_hre_milan
    declare_counter war_hre_hungary
    declare_counter war_hre_turks
    declare_counter war_hre_venice
    declare_counter war_hre_poland
    declare_counter war_hre_papal_states
    declare_counter war_hre_sicily
    declare_counter war_hre_spain
    declare_counter war_hre_normans
    declare_counter war_hre_savoy
    declare_counter war_hre_montferrat
    declare_counter war_hre_bologna
    declare_counter war_hre_urbino
    declare_counter war_hre_lucca
    declare_counter war_hre_peasants
    declare_counter war_hre_hafsids

    declare_counter hre_zahler
    declare_counter hre_con

    ;------------------- Ungaren

    declare_counter war_hungary_france
    declare_counter war_hungary_hre
    declare_counter war_hungary_saxons
    declare_counter war_hungary_milan
    declare_counter war_hungary_turks
    declare_counter war_hungary_venice
    declare_counter war_hungary_poland
    declare_counter war_hungary_papal_states
    declare_counter war_hungary_sicily
    declare_counter war_hungary_spain
    declare_counter war_hungary_normans
    declare_counter war_hungary_savoy
    declare_counter war_hungary_montferrat
    declare_counter war_hungary_bologna
    declare_counter war_hungary_urbino
    declare_counter war_hungary_lucca
    declare_counter war_hungary_peasants
    declare_counter war_hungary_hafsids    

    declare_counter hungary_zahler
    declare_counter hungary_con

    ;------------------- Venedig

    declare_counter war_venice_france
    declare_counter war_venice_saxons
    declare_counter war_venice_hre
    declare_counter war_venice_milan
    declare_counter war_venice_hungary
    declare_counter war_venice_turks
    declare_counter war_venice_poland
    declare_counter war_venice_papal_states
    declare_counter war_venice_sicily
    declare_counter war_venice_spain
    declare_counter war_venice_normans
    declare_counter war_venice_savoy
    declare_counter war_venice_montferrat
    declare_counter war_venice_bologna
    declare_counter war_venice_urbino
    declare_counter war_venice_lucca
    declare_counter war_venice_peasants
    declare_counter war_venice_hafsids

    declare_counter venice_zahler
    declare_counter venice_con

    ;------------------- Florenz

    declare_counter war_poland_france
    declare_counter war_poland_hre
    declare_counter war_poland_saxons
    declare_counter war_poland_milan
    declare_counter war_poland_hungary
    declare_counter war_poland_turks
    declare_counter war_poland_venice
    declare_counter war_poland_papal_states
    declare_counter war_poland_sicily
    declare_counter war_poland_spain
    declare_counter war_poland_normans
    declare_counter war_poland_savoy
    declare_counter war_poland_montferrat
    declare_counter war_poland_bologna
    declare_counter war_poland_urbino
    declare_counter war_poland_lucca
    declare_counter war_poland_peasants
    declare_counter war_poland_hafsids

    declare_counter poland_zahler
    declare_counter poland_con

    ;------------------- Papststaaten

    declare_counter war_papal_states_france
    declare_counter war_papal_states_saxons
    declare_counter war_papal_states_hre
    declare_counter war_papal_states_milan
    declare_counter war_papal_states_hungary
    declare_counter war_papal_states_turks
    declare_counter war_papal_states_venice
    declare_counter war_papal_states_poland
    declare_counter war_papal_states_sicily
    declare_counter war_papal_states_spain
    declare_counter war_papal_states_normans
    declare_counter war_papal_states_savoy
    declare_counter war_papal_states_montferrat
    declare_counter war_papal_states_bologna
    declare_counter war_papal_states_urbino
    declare_counter war_papal_states_lucca
    declare_counter war_papal_states_peasants
    declare_counter war_papal_states_hafsids

    declare_counter papal_states_zahler
    declare_counter papal_states_con

    ;------------------- Neapel

    declare_counter war_sicily_france
    declare_counter war_sicily_saxons
    declare_counter war_sicily_hre
    declare_counter war_sicily_milan
    declare_counter war_sicily_hungary
    declare_counter war_sicily_turks
    declare_counter war_sicily_venice
    declare_counter war_sicily_poland
    declare_counter war_sicily_papal_states
    declare_counter war_sicily_spain
    declare_counter war_sicily_normans
    declare_counter war_sicily_savoy
    declare_counter war_sicily_montferrat
    declare_counter war_sicily_bologna
    declare_counter war_sicily_urbino
    declare_counter war_sicily_lucca
    declare_counter war_sicily_peasants
    declare_counter war_sicily_hafsids

    declare_counter sicily_zahler
    declare_counter sicily_con

    ;------------------- Spanien

    declare_counter war_spain_france
    declare_counter war_spain_saxons
    declare_counter war_spain_hre
    declare_counter war_spain_milan
    declare_counter war_spain_hungary
    declare_counter war_spain_turks
    declare_counter war_spain_venice
    declare_counter war_spain_poland
    declare_counter war_spain_papal_states
    declare_counter war_spain_sicily
    declare_counter war_spain_normans
    declare_counter war_spain_savoy
    declare_counter war_spain_montferrat
    declare_counter war_spain_bologna
    declare_counter war_spain_urbino
    declare_counter war_spain_lucca
    declare_counter war_spain_peasants
    declare_counter war_spain_hafsids

    declare_counter spain_zahler
    declare_counter spain_con

    ;------------------- Türken

    declare_counter war_turks_france
    declare_counter war_turks_saxons
    declare_counter war_turks_hre
    declare_counter war_turks_milan
    declare_counter war_turks_hungary
    declare_counter war_turks_venice
    declare_counter war_turks_poland
    declare_counter war_turks_papal_states
    declare_counter war_turks_sicily
    declare_counter war_turks_spain
    declare_counter war_turks_normans
    declare_counter war_turks_savoy
    declare_counter war_turks_montferrat
    declare_counter war_turks_bologna
    declare_counter war_turks_urbino
    declare_counter war_turks_lucca
    declare_counter war_turks_peasants
    declare_counter war_turks_hafsids

    declare_counter turks_zahler
    declare_counter turks_con

    ;------------------- Schwaben

    declare_counter war_normans_france
    declare_counter war_normans_saxons
    declare_counter war_normans_hre
    declare_counter war_normans_milan
    declare_counter war_normans_hungary
    declare_counter war_normans_venice
    declare_counter war_normans_poland
    declare_counter war_normans_papal_states
    declare_counter war_normans_sicily
    declare_counter war_normans_spain
    declare_counter war_normans_turks
    declare_counter war_normans_savoy
    declare_counter war_normans_montferrat
    declare_counter war_normans_bologna
    declare_counter war_normans_urbino
    declare_counter war_normans_lucca
    declare_counter war_normans_peasants
    declare_counter war_normans_hafsids

    declare_counter normans_zahler
    declare_counter normans_con


    ;------------------------------------------------------------------------------
    ;------------------------------- Abfrage Krieg --------------------------------
    ;------------------------------------------------------------------------------

    ;------------------------------------------------------------------------------
    ;------------------------------- Mailand --------------------------------------
    ;------ Frankreich
    monitor_event FactionWarDeclared FactionType milan
        and TargetFactionType france
        and I_CompareCounter milan_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_milan_france = 0
            historic_event war_milan true factions { milan, }
            set_counter war_milan_france 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and DiplomaticStanceFromFaction france < AtWar
        and I_CompareCounter war_milan_france = 1
        and I_CompareCounter milan_con = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_france 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and I_CompareCounter milan_con = 1
        and I_CharacterExists merc_milan
        and I_CompareCounter france_dead = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_france 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor

    ;------ HRE
    monitor_event FactionWarDeclared FactionType milan
        and TargetFactionType hre
        and I_CompareCounter milan_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_milan_hre = 0
            historic_event war_milan true factions { milan, }
            set_counter war_milan_hre 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and DiplomaticStanceFromFaction hre < AtWar
        and I_CompareCounter war_milan_hre = 1
        and I_EventCounter war_milan_accepted = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_hre 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and I_CompareCounter milan_con = 1
        and I_CharacterExists merc_milan
        and I_CompareCounter hre_dead = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_hre 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor

    ;------ Schweizer
    monitor_event FactionWarDeclared FactionType milan
        and TargetFactionType saxons
        and I_CompareCounter milan_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_milan_saxons = 0
            historic_event war_milan true factions { milan, }
            set_counter war_milan_saxons 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and DiplomaticStanceFromFaction saxons < AtWar
        and I_CompareCounter war_milan_saxons = 1
        and I_EventCounter war_milan_accepted = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_saxons 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and I_CompareCounter milan_con = 1
        and I_CharacterExists merc_milan
        and I_CompareCounter saxons_dead = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_saxons 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor

    ;------ Ungarn
    monitor_event FactionWarDeclared FactionType milan
        and TargetFactionType hungary
        and I_CompareCounter milan_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_milan_hungary = 0
            historic_event war_milan true factions { milan, }
            set_counter war_milan_hungary 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and DiplomaticStanceFromFaction hungary < AtWar
        and I_CompareCounter war_milan_hungary = 1
        and I_EventCounter war_milan_accepted = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_hungary 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and I_CompareCounter milan_con = 1
        and I_CharacterExists merc_milan
        and I_CompareCounter hungary_dead = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_hungary 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor

    ;------ Türken
    monitor_event FactionWarDeclared FactionType milan
        and TargetFactionType turks
        and I_CompareCounter milan_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_milan_turks = 0
            historic_event war_milan true factions { milan, }
            set_counter war_milan_turks 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and DiplomaticStanceFromFaction turks < AtWar
        and I_CompareCounter war_milan_turks = 1
        and I_EventCounter war_milan_accepted = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_turks 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and I_CompareCounter milan_con = 1
        and I_CharacterExists merc_milan
        and I_CompareCounter turks_dead = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_turks 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor


    ;------ Venedig
    monitor_event FactionWarDeclared FactionType milan
        and TargetFactionType venice
        and I_CompareCounter milan_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_milan_venice = 0
            historic_event war_milan true factions { milan, }
            set_counter war_milan_venice 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and DiplomaticStanceFromFaction venice < AtWar
        and I_CompareCounter war_milan_venice = 1
        and I_EventCounter war_milan_accepted = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_venice 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and I_CompareCounter milan_con = 1
        and I_CharacterExists merc_milan
        and I_CompareCounter venice_dead = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_venice 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor

    ;------ Florenz
    monitor_event FactionWarDeclared FactionType milan
        and TargetFactionType poland
        and I_CompareCounter milan_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_milan_poland = 0
            historic_event war_milan true factions { milan, }
            set_counter war_milan_poland 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and DiplomaticStanceFromFaction poland < AtWar
        and I_CompareCounter war_milan_poland = 1
        and I_EventCounter war_milan_accepted = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_poland 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and I_CompareCounter milan_con = 1
        and I_CharacterExists merc_milan
        and I_CompareCounter poland_dead = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_poland 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor

    ;------ Papststaaten
    monitor_event FactionWarDeclared FactionType milan
        and TargetFactionType papal_states
        and I_CompareCounter milan_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_milan_papal_states = 0
            historic_event war_milan true factions { milan, }
            set_counter war_milan_papal_states 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and DiplomaticStanceFromFaction papal_states < AtWar
        and I_CompareCounter war_milan_papal_states = 1
        and I_EventCounter war_milan_accepted = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_papal_states 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and I_CompareCounter milan_con = 1
        and I_CharacterExists merc_milan
        and I_CompareCounter papal_states_dead = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_papal_states 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor


    ;------ Neapel
    monitor_event FactionWarDeclared FactionType milan
        and TargetFactionType sicily
        and I_CompareCounter milan_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_milan_sicily = 0
            historic_event war_milan true factions { milan, }
            set_counter war_milan_sicily 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and DiplomaticStanceFromFaction sicily < AtWar
        and I_CompareCounter war_milan_sicily = 1
        and I_EventCounter war_milan_accepted = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_sicily 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and I_CompareCounter milan_con = 1
        and I_CharacterExists merc_milan
        and I_CompareCounter sicily_dead = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_sicily 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor

    ;------ Spanien
    monitor_event FactionWarDeclared FactionType milan
        and TargetFactionType spain
        and I_CompareCounter milan_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_milan_spain = 0
            historic_event war_milan true factions { milan, }
            set_counter war_milan_spain 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and DiplomaticStanceFromFaction spain < AtWar
        and I_CompareCounter war_milan_spain = 1
        and I_EventCounter war_milan_accepted = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_spain 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and I_CompareCounter milan_con = 1
        and I_CharacterExists merc_milan
        and I_CompareCounter spain_dead = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_spain 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor

    ;------ Schwaben
    monitor_event FactionWarDeclared FactionType milan
        and TargetFactionType normans
        and I_CompareCounter milan_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_milan_normans = 0
            historic_event war_milan true factions { milan, }
            set_counter war_milan_normans 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and DiplomaticStanceFromFaction normans < AtWar
        and I_CompareCounter war_milan_normans = 1
        and I_EventCounter war_milan_accepted = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_normans 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and I_CompareCounter milan_con = 1
        and I_CharacterExists merc_milan
        and I_CompareCounter normans_dead = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_normans 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor

    ;------ savoy
    monitor_event FactionWarDeclared FactionType milan
        and TargetFactionType savoy
        and I_CompareCounter milan_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_milan_savoy = 0
            historic_event war_milan true factions { milan, }
            set_counter war_milan_savoy 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and DiplomaticStanceFromFaction savoy < AtWar
        and I_CompareCounter war_milan_savoy = 1
        and I_EventCounter war_milan_accepted = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_savoy 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and I_CompareCounter milan_con = 1
        and I_CharacterExists merc_milan
        and I_CompareCounter savoy_dead = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_savoy 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor


    ;------ montferrat
    monitor_event FactionWarDeclared FactionType milan
        and TargetFactionType montferrat
        and I_CompareCounter milan_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_milan_montferrat = 0
            historic_event war_milan true factions { milan, }
            set_counter war_milan_montferrat 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and DiplomaticStanceFromFaction montferrat < AtWar
        and I_CompareCounter war_milan_montferrat = 1
        and I_EventCounter war_milan_accepted = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_montferrat 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and I_CompareCounter milan_con = 1
        and I_CharacterExists merc_milan
        and I_CompareCounter montferrat_dead = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_montferrat 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor


    ;------ bologna
    monitor_event FactionWarDeclared FactionType milan
        and TargetFactionType timurids
        and I_CompareCounter milan_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_milan_bologna = 0
            historic_event war_milan true factions { milan, }
            set_counter war_milan_bologna 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and DiplomaticStanceFromFaction timurids < AtWar
        and I_CompareCounter war_milan_bologna = 1
        and I_EventCounter war_milan_accepted = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_bologna 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and I_CompareCounter milan_con = 1
        and I_CharacterExists merc_milan
        and I_CompareCounter bologna_dead = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_bologna 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor


    ;------ urbino
    monitor_event FactionWarDeclared FactionType milan
        and TargetFactionType urbino
        and I_CompareCounter milan_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_milan_urbino = 0
            historic_event war_milan true factions { milan, }
            set_counter war_milan_urbino 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and DiplomaticStanceFromFaction urbino < AtWar
        and I_CompareCounter war_milan_urbino = 1
        and I_EventCounter war_milan_accepted = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_urbino 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and I_CompareCounter milan_con = 1
        and I_CharacterExists merc_milan
        and I_CompareCounter urbino_dead = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_urbino 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor

    ;------ lucca
    monitor_event FactionWarDeclared FactionType milan
        and TargetFactionType lucca
        and I_CompareCounter milan_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_milan_lucca = 0
            historic_event war_milan true factions { milan, }
            set_counter war_milan_lucca 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and DiplomaticStanceFromFaction lucca < AtWar
        and I_CompareCounter war_milan_lucca = 1
        and I_EventCounter war_milan_accepted = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_lucca 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and I_CompareCounter milan_con = 1
        and I_CharacterExists merc_milan
        and I_CompareCounter lucca_dead = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_lucca 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor

    ;------ peasants
    monitor_event FactionWarDeclared FactionType milan
        and TargetFactionType peasants
        and I_CompareCounter milan_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_milan_peasants = 0
            historic_event war_milan true factions { milan, }
            set_counter war_milan_peasants 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and DiplomaticStanceFromFaction peasants < AtWar
        and I_CompareCounter war_milan_peasants = 1
        and I_EventCounter war_milan_accepted = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_peasants 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and I_CompareCounter milan_con = 1
        and I_CharacterExists merc_milan
        and I_CompareCounter peasantry_dead = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_peasants 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor


    ;------ hafsids
    monitor_event FactionWarDeclared FactionType milan
        and TargetFactionType egypt
        and I_CompareCounter milan_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_milan_hafsids = 0
            historic_event war_milan true factions { milan, }
            set_counter war_milan_hafsids 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and DiplomaticStanceFromFaction egypt < AtWar
        and I_CompareCounter war_milan_hafsids = 1
        and I_EventCounter war_milan_accepted = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_hafsids 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType milan
        and I_CompareCounter milan_con = 1
        and I_CharacterExists merc_milan
        and I_CompareCounter hafsids_dead = 1

        historic_event war_milan_ende true factions { milan, }

        set_counter war_milan_hafsids 0
        set_counter milan_zahler 0
        set_counter milan_con 0
    end_monitor


    ;---------------------------------------------------------------------------------
    ;------------------------------- Frankreich --------------------------------------
    ;------ HRE
    monitor_event FactionWarDeclared FactionType france
        and TargetFactionType hre
        and I_CompareCounter france_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_france_hre = 0
            historic_event war_france true factions { france, }
            set_counter war_france_hre 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and DiplomaticStanceFromFaction hre < AtWar
        and I_CompareCounter war_france_hre = 1
        and I_CompareCounter france_con = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_hre 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and I_CompareCounter france_con = 1
        and I_CharacterExists merc_france
        and I_CompareCounter hre_dead = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_hre 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor

    ;------ Mailand
    monitor_event FactionWarDeclared FactionType france
        and TargetFactionType milan
        and I_CompareCounter france_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_france_milan = 0
            historic_event war_france true factions { france, }
            set_counter war_france_milan 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and DiplomaticStanceFromFaction milan < AtWar
        and I_CompareCounter war_france_milan = 1
        and I_CompareCounter france_con = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_milan 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and I_CompareCounter france_con = 1
        and I_CharacterExists merc_france
        and I_CompareCounter milan_dead = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_milan 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor

    ;------ Schweizer
    monitor_event FactionWarDeclared FactionType france
        and TargetFactionType saxons
        and I_CompareCounter france_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_france_saxons = 0
            historic_event war_france true factions { france, }
            set_counter war_france_saxons 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and DiplomaticStanceFromFaction saxons < AtWar
        and I_CompareCounter war_france_saxons = 1
        and I_CompareCounter france_con = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_saxons 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and I_CompareCounter france_con = 1
        and I_CharacterExists merc_france
        and I_CompareCounter saxons_dead = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_saxons 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor

    ;------ Ungarn
    monitor_event FactionWarDeclared FactionType france
        and TargetFactionType hungary
        and I_CompareCounter france_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_france_hungary = 0
            historic_event war_france true factions { france, }
            set_counter war_france_hungary 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and DiplomaticStanceFromFaction hungary < AtWar
        and I_CompareCounter war_france_hungary = 1
        and I_CompareCounter france_con = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_hungary 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and I_CompareCounter france_con = 1
        and I_CharacterExists merc_france
        and I_CompareCounter hungary_dead = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_hungary 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor

    ;------ Türken
    monitor_event FactionWarDeclared FactionType france
        and TargetFactionType turks
        and I_CompareCounter france_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_france_turks = 0
            historic_event war_france true factions { france, }
            set_counter war_france_turks 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and DiplomaticStanceFromFaction turks < AtWar
        and I_CompareCounter war_france_turks = 1
        and I_CompareCounter france_con = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_turks 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and I_CompareCounter france_con = 1
        and I_CharacterExists merc_france
        and I_CompareCounter turks_dead = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_turks 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor

    ;------ Venedig
    monitor_event FactionWarDeclared FactionType france
        and TargetFactionType venice
        and I_CompareCounter france_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_france_venice = 0
            historic_event war_france true factions { france, }
            set_counter war_france_venice 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and DiplomaticStanceFromFaction venice < AtWar
        and I_CompareCounter war_france_venice = 1
        and I_CompareCounter france_con = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_venice 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and I_CompareCounter france_con = 1
        and I_CharacterExists merc_france
        and I_CompareCounter venice_dead = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_venice 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor

    ;------ Florenz
    monitor_event FactionWarDeclared FactionType france
        and TargetFactionType poland
        and I_CompareCounter france_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_france_poland = 0
            historic_event war_france true factions { france, }
            set_counter war_france_poland 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and DiplomaticStanceFromFaction poland < AtWar
        and I_CompareCounter war_france_poland = 1
        and I_CompareCounter france_con = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_poland 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and I_CompareCounter france_con = 1
        and I_CharacterExists merc_france
        and I_CompareCounter poland_dead = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_poland 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor

    ;------ Papststaaten
    monitor_event FactionWarDeclared FactionType france
        and TargetFactionType papal_states
        and I_CompareCounter france_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_france_papal_states = 0
            historic_event war_france true factions { france, }
            set_counter war_france_papal_states 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and DiplomaticStanceFromFaction papal_states < AtWar
        and I_CompareCounter war_france_papal_states = 1
        and I_CompareCounter france_con = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_papal_states 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and I_CompareCounter france_con = 1
        and I_CharacterExists merc_france
        and I_CompareCounter papal_states_dead = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_papal_states 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor

    ;------ Neapel
    monitor_event FactionWarDeclared FactionType france
        and TargetFactionType sicily
        and I_CompareCounter france_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_france_sicily = 0
            historic_event war_france true factions { france, }
            set_counter war_france_sicily 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and DiplomaticStanceFromFaction sicily < AtWar
        and I_CompareCounter war_france_sicily = 1
        and I_CompareCounter france_con = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_sicily 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and I_CompareCounter france_con = 1
        and I_CharacterExists merc_france
        and I_CompareCounter sicily_dead = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_sicily 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor

    ;------ Spanien
    monitor_event FactionWarDeclared FactionType france
        and TargetFactionType spain
        and I_CompareCounter france_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_france_spain = 0
            historic_event war_france true factions { france, }
            set_counter war_france_spain 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and DiplomaticStanceFromFaction spain < AtWar
        and I_CompareCounter war_france_spain = 1
        and I_CompareCounter france_con = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_spain 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and I_CompareCounter france_con = 1
        and I_CharacterExists merc_france
        and I_CompareCounter spain_dead = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_spain 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor

    ;------ Schwaben
    monitor_event FactionWarDeclared FactionType france
        and TargetFactionType normans
        and I_CompareCounter france_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_france_normans = 0
            historic_event war_france true factions { france, }
            set_counter war_france_normans 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and DiplomaticStanceFromFaction normans < AtWar
        and I_CompareCounter war_france_normans = 1
        and I_EventCounter war_france_accepted = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_normans 0
        set_counter france_zahler 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and I_CompareCounter france_con = 1
        and I_CharacterExists merc_france
        and I_CompareCounter normans_dead = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_normans 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor

    ;------ savoy
    monitor_event FactionWarDeclared FactionType france
        and TargetFactionType savoy
        and I_CompareCounter france_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_france_savoy = 0
            historic_event war_france true factions { france, }
            set_counter war_france_savoy 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and DiplomaticStanceFromFaction savoy < AtWar
        and I_CompareCounter war_france_savoy = 1
        and I_EventCounter war_france_accepted = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_savoy 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and I_CompareCounter france_con = 1
        and I_CharacterExists merc_france
        and I_CompareCounter savoy_dead = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_savoy 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor


    ;------ montferrat
    monitor_event FactionWarDeclared FactionType france
        and TargetFactionType montferrat
        and I_CompareCounter france_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_france_montferrat = 0
            historic_event war_france true factions { france, }
            set_counter war_france_montferrat 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and DiplomaticStanceFromFaction montferrat < AtWar
        and I_CompareCounter war_france_montferrat = 1
        and I_EventCounter war_france_accepted = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_montferrat 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and I_CompareCounter france_con = 1
        and I_CharacterExists merc_france
        and I_CompareCounter montferrat_dead = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_montferrat 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor


    ;------ bologna
    monitor_event FactionWarDeclared FactionType france
        and TargetFactionType timurids
        and I_CompareCounter france_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_france_bologna = 0
            historic_event war_france true factions { france, }
            set_counter war_france_bologna 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and DiplomaticStanceFromFaction timurids < AtWar
        and I_CompareCounter war_france_bologna = 1
        and I_EventCounter war_france_accepted = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_bologna 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and I_CompareCounter france_con = 1
        and I_CharacterExists merc_france
        and I_CompareCounter bologna_dead = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_bologna 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor


    ;------ urbino
    monitor_event FactionWarDeclared FactionType france
        and TargetFactionType urbino
        and I_CompareCounter france_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_france_urbino = 0
            historic_event war_france true factions { france, }
            set_counter war_france_urbino 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and DiplomaticStanceFromFaction urbino < AtWar
        and I_CompareCounter war_france_urbino = 1
        and I_EventCounter war_france_accepted = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_urbino 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and I_CompareCounter france_con = 1
        and I_CharacterExists merc_france
        and I_CompareCounter urbino_dead = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_urbino 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor

    ;------ lucca
    monitor_event FactionWarDeclared FactionType france
        and TargetFactionType lucca
        and I_CompareCounter france_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_france_lucca = 0
            historic_event war_france true factions { france, }
            set_counter war_france_lucca 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and DiplomaticStanceFromFaction lucca < AtWar
        and I_CompareCounter war_france_lucca = 1
        and I_EventCounter war_france_accepted = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_lucca 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and I_CompareCounter france_con = 1
        and I_CharacterExists merc_france
        and I_CompareCounter lucca_dead = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_lucca 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor


    ;------ peasants
    monitor_event FactionWarDeclared FactionType france
        and TargetFactionType peasants
        and I_CompareCounter france_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_france_peasants = 0
            historic_event war_france true factions { france, }
            set_counter war_france_peasants 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and DiplomaticStanceFromFaction peasants < AtWar
        and I_CompareCounter war_france_peasants = 1
        and I_EventCounter war_france_accepted = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_peasants 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and I_CompareCounter france_con = 1
        and I_CharacterExists merc_france
        and I_CompareCounter peasants_dead = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_peasants 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor


    ;------ hafsids
    monitor_event FactionWarDeclared FactionType france
        and TargetFactionType egypt
        and I_CompareCounter france_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_france_hafsids = 0
            historic_event war_france true factions { france, }
            set_counter war_france_hafsids 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and DiplomaticStanceFromFaction egypt < AtWar
        and I_CompareCounter war_france_hafsids = 1
        and I_EventCounter war_france_accepted = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_hafsids 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType france
        and I_CompareCounter france_con = 1
        and I_CharacterExists merc_france
        and I_CompareCounter hafsids_dead = 1

        historic_event war_france_ende true factions { france, }

        set_counter war_france_hafsids 0
        set_counter france_zahler 0
        set_counter france_con 0
    end_monitor



    ;---------------------------------------------------------------------------------
    ;------------------------------- HRE ---------------------------------------------
    ;------ Frankreich
    monitor_event FactionWarDeclared FactionType hre
        and TargetFactionType france
        and I_CompareCounter hre_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hre_france = 0
            historic_event war_hre true factions { hre, }
            set_counter war_hre_france 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and DiplomaticStanceFromFaction france < AtWar
        and I_CompareCounter war_hre_france = 1
        and I_CompareCounter hre_con = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_france 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and I_CompareCounter hre_con = 1
        and I_CharacterExists merc_hre
        and I_CompareCounter france_dead = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_france 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor

    ;------ Schweizer
    monitor_event FactionWarDeclared FactionType hre
        and TargetFactionType saxons
        and I_CompareCounter hre_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hre_saxons = 0
            historic_event war_hre true factions { hre, }
            set_counter war_hre_saxons 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and DiplomaticStanceFromFaction saxons < AtWar
        and I_CompareCounter war_hre_saxons = 1
        and I_CompareCounter hre_con = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_saxons 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and I_CompareCounter hre_con = 1
        and I_CharacterExists merc_hre
        and I_CompareCounter saxons_dead = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_saxons 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor

    ;------ Mailand
    monitor_event FactionWarDeclared FactionType hre
        and TargetFactionType milan
        and I_CompareCounter hre_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hre_milan = 0
            historic_event war_hre true factions { hre, }
            set_counter war_hre_milan 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and DiplomaticStanceFromFaction milan < AtWar
        and I_CompareCounter war_hre_milan = 1
        and I_CompareCounter hre_con = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_milan 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and I_CompareCounter hre_con = 1
        and I_CharacterExists merc_hre
        and I_CompareCounter milan_dead = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_milan 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor

    ;------ Ungarn
    monitor_event FactionWarDeclared FactionType hre
        and TargetFactionType hungary
        and I_CompareCounter hre_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hre_hungary = 0
            historic_event war_hre true factions { hre, }
            set_counter war_hre_hungary 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and DiplomaticStanceFromFaction hungary < AtWar
        and I_CompareCounter war_hre_hungary = 1
        and I_CompareCounter hre_con = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_hungary 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and I_CompareCounter hre_con = 1
        and I_CharacterExists merc_hre
        and I_CompareCounter hungary_dead = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_hungary 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor

    ;------ Türken
    monitor_event FactionWarDeclared FactionType hre
        and TargetFactionType turks
        and I_CompareCounter hre_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hre_turks = 0
            historic_event war_hre true factions { hre, }
            set_counter war_hre_turks 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and DiplomaticStanceFromFaction turks < AtWar
        and I_CompareCounter war_hre_turks = 1
        and I_CompareCounter hre_con = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_turks 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and I_CompareCounter hre_con = 1
        and I_CharacterExists merc_hre
        and I_CompareCounter turks_dead = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_turks 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor

    ;------ Venedig
    monitor_event FactionWarDeclared FactionType hre
        and TargetFactionType venice
        and I_CompareCounter hre_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hre_venice = 0
            historic_event war_hre true factions { hre, }
            set_counter war_hre_venice 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and DiplomaticStanceFromFaction venice < AtWar
        and I_CompareCounter war_hre_venice = 1
        and I_CompareCounter hre_con = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_venice 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and I_CompareCounter hre_con = 1
        and I_CharacterExists merc_hre
        and I_CompareCounter venice_dead = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_venice 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor

    ;------ Florenz
    monitor_event FactionWarDeclared FactionType hre
        and TargetFactionType poland
        and I_CompareCounter hre_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hre_poland = 0
            historic_event war_hre true factions { hre, }
            set_counter war_hre_poland 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and DiplomaticStanceFromFaction poland < AtWar
        and I_CompareCounter war_hre_poland = 1
        and I_CompareCounter hre_con = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_poland 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and I_CompareCounter hre_con = 1
        and I_CharacterExists merc_hre
        and I_CompareCounter poland_dead = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_poland 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor

    ;------ Papststaaten
    monitor_event FactionWarDeclared FactionType hre
        and TargetFactionType papal_states
        and I_CompareCounter hre_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hre_papal_states = 0
            historic_event war_hre true factions { hre, }
            set_counter war_hre_papal_states 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and DiplomaticStanceFromFaction papal_states < AtWar
        and I_CompareCounter war_hre_papal_states = 1
        and I_CompareCounter hre_con = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_papal_states 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and I_CompareCounter hre_con = 1
        and I_CharacterExists merc_hre
        and I_CompareCounter papal_states_dead = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_papal_states 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor

    ;------ Neapel
    monitor_event FactionWarDeclared FactionType hre
        and TargetFactionType sicily
        and I_CompareCounter hre_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hre_sicily = 0
            historic_event war_hre true factions { hre, }
            set_counter war_hre_sicily 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and DiplomaticStanceFromFaction sicily < AtWar
        and I_CompareCounter war_hre_sicily = 1
        and I_CompareCounter hre_con = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_sicily 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and I_CompareCounter hre_con = 1
        and I_CharacterExists merc_hre
        and I_CompareCounter sicily_dead = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_sicily 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor

    ;------ Spanien
    monitor_event FactionWarDeclared FactionType hre
        and TargetFactionType spain
        and I_CompareCounter hre_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hre_spain = 0
            historic_event war_hre true factions { hre, }
            set_counter war_hre_spain 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and DiplomaticStanceFromFaction spain < AtWar
        and I_CompareCounter war_hre_spain = 1
        and I_CompareCounter hre_con = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_spain 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and I_CompareCounter hre_con = 1
        and I_CharacterExists merc_hre
        and I_CompareCounter spain_dead = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_spain 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor

    ;------ Schwaben
    monitor_event FactionWarDeclared FactionType hre
        and TargetFactionType normans
        and I_CompareCounter hre_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hre_normans = 0
            historic_event war_hre true factions { hre, }
            set_counter war_hre_normans 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and DiplomaticStanceFromFaction normans < AtWar
        and I_CompareCounter war_hre_normans = 1
        and I_CompareCounter hre_con = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_normans 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and I_CompareCounter hre_con = 1
        and I_CharacterExists merc_hre
        and I_CompareCounter spain_dead = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_spain 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor

    ;------ savoy
    monitor_event FactionWarDeclared FactionType hre
        and TargetFactionType savoy
        and I_CompareCounter hre_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hre_savoy = 0
            historic_event war_hre true factions { hre, }
            set_counter war_hre_savoy 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and DiplomaticStanceFromFaction savoy < AtWar
        and I_CompareCounter war_hre_savoy = 1
        and I_EventCounter war_hre_accepted = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_savoy 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and I_CompareCounter hre_con = 1
        and I_CharacterExists merc_hre
        and I_CompareCounter savoy_dead = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_savoy 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor


    ;------ montferrat
    monitor_event FactionWarDeclared FactionType hre
        and TargetFactionType montferrat
        and I_CompareCounter hre_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hre_montferrat = 0
            historic_event war_hre true factions { hre, }
            set_counter war_hre_montferrat 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and DiplomaticStanceFromFaction montferrat < AtWar
        and I_CompareCounter war_hre_montferrat = 1
        and I_EventCounter war_hre_accepted = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_montferrat 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and I_CompareCounter hre_con = 1
        and I_CharacterExists merc_hre
        and I_CompareCounter montferrat_dead = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_montferrat 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor


    ;------ bologna
    monitor_event FactionWarDeclared FactionType hre
        and TargetFactionType timurids
        and I_CompareCounter hre_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hre_bologna = 0
            historic_event war_hre true factions { hre, }
            set_counter war_hre_bologna 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and DiplomaticStanceFromFaction timurids < AtWar
        and I_CompareCounter war_hre_bologna = 1
        and I_EventCounter war_hre_accepted = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_bologna 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and I_CompareCounter hre_con = 1
        and I_CharacterExists merc_hre
        and I_CompareCounter bologna_dead = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_bologna 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor


    ;------ urbino
    monitor_event FactionWarDeclared FactionType hre
        and TargetFactionType urbino
        and I_CompareCounter hre_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hre_urbino = 0
            historic_event war_hre true factions { hre, }
            set_counter war_hre_urbino 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and DiplomaticStanceFromFaction urbino < AtWar
        and I_CompareCounter war_hre_urbino = 1
        and I_EventCounter war_hre_accepted = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_urbino 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and I_CompareCounter hre_con = 1
        and I_CharacterExists merc_hre
        and I_CompareCounter urbino_dead = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_urbino 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor


    ;------ lucca
    monitor_event FactionWarDeclared FactionType hre
        and TargetFactionType lucca
        and I_CompareCounter hre_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hre_lucca = 0
            historic_event war_hre true factions { hre, }
            set_counter war_hre_lucca 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and DiplomaticStanceFromFaction lucca < AtWar
        and I_CompareCounter war_hre_lucca = 1
        and I_EventCounter war_hre_accepted = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_lucca 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and I_CompareCounter hre_con = 1
        and I_CharacterExists merc_hre
        and I_CompareCounter lucca_dead = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_lucca 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor


    ;------ peasants
    monitor_event FactionWarDeclared FactionType hre
        and TargetFactionType peasants
        and I_CompareCounter hre_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hre_peasants = 0
            historic_event war_hre true factions { hre, }
            set_counter war_hre_peasants 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and DiplomaticStanceFromFaction peasants < AtWar
        and I_CompareCounter war_hre_peasants = 1
        and I_EventCounter war_hre_accepted = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_peasants 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and I_CompareCounter hre_con = 1
        and I_CharacterExists merc_hre
        and I_CompareCounter peasants_dead = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_peasants 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor


    ;------ hafsids
    monitor_event FactionWarDeclared FactionType hre
        and TargetFactionType egypt
        and I_CompareCounter hre_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hre_hafsids = 0
            historic_event war_hre true factions { hre, }
            set_counter war_hre_hafsids 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and DiplomaticStanceFromFaction egypt < AtWar
        and I_CompareCounter war_hre_hafsids = 1
        and I_EventCounter war_hre_accepted = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_hafsids 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hre
        and I_CompareCounter hre_con = 1
        and I_CharacterExists merc_hre
        and I_CompareCounter hafsids_dead = 1

        historic_event war_hre_ende true factions { hre, }

        set_counter war_hre_hafsids 0
        set_counter hre_zahler 0
        set_counter hre_con 0
    end_monitor


    ;---------------------------------------------------------------------------------
    ;------------------------------- Ungarn ------------------------------------------
    ;------ Frankreich
    monitor_event FactionWarDeclared FactionType hungary
        and TargetFactionType france
        and I_CompareCounter hungary_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hungary_france = 0
            historic_event war_hungary true factions { hungary, }
            set_counter war_hungary_france 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and DiplomaticStanceFromFaction france < AtWar
        and I_CompareCounter war_hungary_france = 1
        and I_CompareCounter hungary_con = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_france 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and I_CompareCounter hungary_con = 1
        and I_CharacterExists merc_hungary
        and I_CompareCounter france_dead = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_france 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor

    ;------ HRE
    monitor_event FactionWarDeclared FactionType hungary
        and TargetFactionType hre
        and I_CompareCounter hungary_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hungary_hre = 0
            historic_event war_hungary true factions { hungary, }
            set_counter war_hungary_hre 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and DiplomaticStanceFromFaction hre < AtWar
        and I_CompareCounter war_hungary_hre = 1
        and I_CompareCounter hungary_con = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_hre 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and I_CompareCounter hungary_con = 1
        and I_CharacterExists merc_hungary
        and I_CompareCounter hre_dead = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_hre 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor

    ;------ Schweizer
    monitor_event FactionWarDeclared FactionType hungary
        and TargetFactionType saxons
        and I_CompareCounter hungary_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hungary_saxons = 0
            historic_event war_hungary true factions { hungary, }
            set_counter war_hungary_saxons 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and DiplomaticStanceFromFaction saxons < AtWar
        and I_CompareCounter war_hungary_saxons = 1
        and I_CompareCounter hungary_con = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_saxons 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and I_CompareCounter hungary_con = 1
        and I_CharacterExists merc_hungary
        and I_CompareCounter saxons_dead = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_saxons 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor

    ;------ Mailand
    monitor_event FactionWarDeclared FactionType hungary
        and TargetFactionType milan
        and I_CompareCounter hungary_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hungary_milan = 0
            historic_event war_hungary true factions { hungary, }
            set_counter war_hungary_milan 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and DiplomaticStanceFromFaction milan < AtWar
        and I_CompareCounter war_hungary_milan = 1
        and I_CompareCounter hungary_con = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_milan 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and I_CompareCounter hungary_con = 1
        and I_CharacterExists merc_hungary
        and I_CompareCounter milan_dead = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_milan 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor

    ;------ Türken
    monitor_event FactionWarDeclared FactionType hungary
        and TargetFactionType turks
        and I_CompareCounter hungary_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hungary_turks = 0
            historic_event war_hungary true factions { hungary, }
            set_counter war_hungary_turks 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and DiplomaticStanceFromFaction turks < AtWar
        and I_CompareCounter war_hungary_turks = 1
        and I_CompareCounter hungary_con = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_turks 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and I_CompareCounter hungary_con = 1
        and I_CharacterExists merc_hungary
        and I_CompareCounter turks_dead = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_turks 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor

    ;------ venedig
    monitor_event FactionWarDeclared FactionType hungary
        and TargetFactionType venice
        and I_CompareCounter hungary_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hungary_venice = 0
            historic_event war_hungary true factions { hungary, }
            set_counter war_hungary_venice 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and DiplomaticStanceFromFaction venice < AtWar
        and I_CompareCounter war_hungary_venice = 1
        and I_CompareCounter hungary_con = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_venice 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and I_CompareCounter hungary_con = 1
        and I_CharacterExists merc_hungary
        and I_CompareCounter venice_dead = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_venice 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor

    ;------ Florenz
    monitor_event FactionWarDeclared FactionType hungary
        and TargetFactionType poland
        and I_CompareCounter hungary_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hungary_poland = 0
            historic_event war_hungary true factions { hungary, }
            set_counter war_hungary_poland 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and DiplomaticStanceFromFaction poland < AtWar
        and I_CompareCounter war_hungary_poland = 1
        and I_CompareCounter hungary_con = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_poland 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and I_CompareCounter hungary_con = 1
        and I_CharacterExists merc_hungary
        and I_CompareCounter poland_dead = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_poland 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor

    ;------ Papststaaten
    monitor_event FactionWarDeclared FactionType hungary
        and TargetFactionType papal_states
        and I_CompareCounter hungary_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hungary_papal_states = 0
            historic_event war_hungary true factions { hungary, }
            set_counter war_hungary_papal_states 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and DiplomaticStanceFromFaction papal_states < AtWar
        and I_CompareCounter war_hungary_papal_states = 1
        and I_CompareCounter hungary_con = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_papal_states 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and I_CompareCounter hungary_con = 1
        and I_CharacterExists merc_hungary
        and I_CompareCounter papal_states_dead = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_papal_states 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor

    ;------ Neapel
    monitor_event FactionWarDeclared FactionType hungary
        and TargetFactionType sicily
        and I_CompareCounter hungary_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hungary_sicily = 0
            historic_event war_hungary true factions { hungary, }
            set_counter war_hungary_sicily 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and DiplomaticStanceFromFaction sicily < AtWar
        and I_CompareCounter war_hungary_sicily = 1
        and I_CompareCounter hungary_con = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_sicily 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and I_CompareCounter hungary_con = 1
        and I_CharacterExists merc_hungary
        and I_CompareCounter sicily_dead = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_sicily 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor

    ;------ Spanien
    monitor_event FactionWarDeclared FactionType hungary
        and TargetFactionType spain
        and I_CompareCounter hungary_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hungary_spain = 0
            historic_event war_hungary true factions { hungary, }
            set_counter war_hungary_spain 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and DiplomaticStanceFromFaction spain < AtWar
        and I_CompareCounter war_hungary_spain = 1
        and I_CompareCounter hungary_con = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_spain 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and I_CompareCounter hungary_con = 1
        and I_CharacterExists merc_hungary
        and I_CompareCounter spain_dead = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_spain 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor

    ;------ Schwaben
    monitor_event FactionWarDeclared FactionType hungary
        and TargetFactionType normans
        and I_CompareCounter hungary_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hungary_normans = 0
            historic_event war_hungary true factions { hungary, }
            set_counter war_hungary_normans 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and DiplomaticStanceFromFaction normans < AtWar
        and I_CompareCounter war_hungary_normans = 1
        and I_CompareCounter hungary_con = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_normans 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and I_CompareCounter hungary_con = 1
        and I_CharacterExists merc_hungary
        and I_CompareCounter normans_dead = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_normans 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor

    ;------ savoy
    monitor_event FactionWarDeclared FactionType hungary
        and TargetFactionType savoy
        and I_CompareCounter hungary_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hungary_savoy = 0
            historic_event war_hungary true factions { hungary, }
            set_counter war_hungary_savoy 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and DiplomaticStanceFromFaction savoy < AtWar
        and I_CompareCounter war_hungary_savoy = 1
        and I_EventCounter war_hungary_accepted = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_savoy 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and I_CompareCounter hungary_con = 1
        and I_CharacterExists merc_hungary
        and I_CompareCounter savoy_dead = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_savoy 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor


    ;------ montferrat
    monitor_event FactionWarDeclared FactionType hungary
        and TargetFactionType montferrat
        and I_CompareCounter hungary_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hungary_montferrat = 0
            historic_event war_hungary true factions { hungary, }
            set_counter war_hungary_montferrat 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and DiplomaticStanceFromFaction montferrat < AtWar
        and I_CompareCounter war_hungary_montferrat = 1
        and I_EventCounter war_hungary_accepted = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_montferrat 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and I_CompareCounter hungary_con = 1
        and I_CharacterExists merc_hungary
        and I_CompareCounter montferrat_dead = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_montferrat 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor


    ;------ bologna
    monitor_event FactionWarDeclared FactionType hungary
        and TargetFactionType timurids
        and I_CompareCounter hungary_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hungary_bologna = 0
            historic_event war_hungary true factions { hungary, }
            set_counter war_hungary_bologna 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and DiplomaticStanceFromFaction timurids < AtWar
        and I_CompareCounter war_hungary_bologna = 1
        and I_EventCounter war_hungary_accepted = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_bologna 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and I_CompareCounter hungary_con = 1
        and I_CharacterExists merc_hungary
        and I_CompareCounter bologna_dead = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_bologna 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor


    ;------ urbino
    monitor_event FactionWarDeclared FactionType hungary
        and TargetFactionType urbino
        and I_CompareCounter hungary_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hungary_urbino = 0
            historic_event war_hungary true factions { hungary, }
            set_counter war_hungary_urbino 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and DiplomaticStanceFromFaction urbino < AtWar
        and I_CompareCounter war_hungary_urbino = 1
        and I_EventCounter war_hungary_accepted = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_urbino 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and I_CompareCounter hungary_con = 1
        and I_CharacterExists merc_hungary
        and I_CompareCounter urbino_dead = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_urbino 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor


    ;------ lucca
    monitor_event FactionWarDeclared FactionType hungary
        and TargetFactionType lucca
        and I_CompareCounter hungary_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hungary_lucca = 0
            historic_event war_hungary true factions { hungary, }
            set_counter war_hungary_lucca 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and DiplomaticStanceFromFaction lucca < AtWar
        and I_CompareCounter war_hungary_lucca = 1
        and I_EventCounter war_hungary_accepted = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_lucca 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and I_CompareCounter hungary_con = 1
        and I_CharacterExists merc_hungary
        and I_CompareCounter lucca_dead = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_lucca 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor


    ;------ peasants
    monitor_event FactionWarDeclared FactionType hungary
        and TargetFactionType peasants
        and I_CompareCounter hungary_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hungary_peasants = 0
            historic_event war_hungary true factions { hungary, }
            set_counter war_hungary_peasants 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and DiplomaticStanceFromFaction peasants < AtWar
        and I_CompareCounter war_hungary_peasants = 1
        and I_EventCounter war_hungary_accepted = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_peasants 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and I_CompareCounter hungary_con = 1
        and I_CharacterExists merc_hungary
        and I_CompareCounter peasants_dead = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_peasants 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor


    ;------ hafsids
    monitor_event FactionWarDeclared FactionType hungary
        and TargetFactionType egypt
        and I_CompareCounter hungary_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_hungary_hafsids = 0
            historic_event war_hungary true factions { hungary, }
            set_counter war_hungary_hafsids 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and DiplomaticStanceFromFaction egypt < AtWar
        and I_CompareCounter war_hungary_hafsids = 1
        and I_EventCounter war_hungary_accepted = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_hafsids 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType hungary
        and I_CompareCounter hungary_con = 1
        and I_CharacterExists merc_hungary
        and I_CompareCounter hafsids_dead = 1

        historic_event war_hungary_ende true factions { hungary, }

        set_counter war_hungary_hafsids 0
        set_counter hungary_zahler 0
        set_counter hungary_con 0
    end_monitor


    ;---------------------------------------------------------------------------------
    ;------------------------------- Türken ------------------------------------------
    ;------ Frankreich
    monitor_event FactionWarDeclared FactionType turks
        and TargetFactionType france
        and I_CompareCounter turks_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_turks_france = 0
            historic_event war_turks true factions { turks, }
            set_counter war_turks_france 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and DiplomaticStanceFromFaction france < AtWar
        and I_CompareCounter war_turks_france = 1
        and I_CompareCounter turks_con = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_france 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and I_CompareCounter turks_con = 1
        and I_CharacterExists merc_turks
        and I_CompareCounter france_dead = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_france 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor

    ;------ HRE
    monitor_event FactionWarDeclared FactionType turks
        and TargetFactionType hre
        and I_CompareCounter turks_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_turks_hre = 0
            historic_event war_turks true factions { turks, }
            set_counter war_turks_hre 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and DiplomaticStanceFromFaction hre < AtWar
        and I_CompareCounter war_turks_hre = 1
        and I_CompareCounter turks_con = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_hre 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and I_CompareCounter turks_con = 1
        and I_CharacterExists merc_turks
        and I_CompareCounter hre_dead = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_hre 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor

    ;------ Mailand
    monitor_event FactionWarDeclared FactionType turks
        and TargetFactionType milan
        and I_CompareCounter turks_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_turks_milan = 0
            historic_event war_turks true factions { turks, }
            set_counter war_turks_milan 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and DiplomaticStanceFromFaction milan < AtWar
        and I_CompareCounter war_turks_milan = 1
        and I_CompareCounter turks_con = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_milan 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and I_CompareCounter turks_con = 1
        and I_CharacterExists merc_turks
        and I_CompareCounter milan_dead = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_milan 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor

    ;------ Ungarn
    monitor_event FactionWarDeclared FactionType turks
        and TargetFactionType hungary
        and I_CompareCounter turks_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_turks_hungary = 0
            historic_event war_turks true factions { turks, }
            set_counter war_turks_hungary 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and DiplomaticStanceFromFaction hungary < AtWar
        and I_CompareCounter war_turks_hungary = 1
        and I_CompareCounter turks_con = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_hungary 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and I_CompareCounter turks_con = 1
        and I_CharacterExists merc_turks
        and I_CompareCounter hungary_dead = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_hungary 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor

    ;------ Venedig
    monitor_event FactionWarDeclared FactionType turks
        and TargetFactionType venice
        and I_CompareCounter turks_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_turks_venice = 0
            historic_event war_turks true factions { turks, }
            set_counter war_turks_venice 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and DiplomaticStanceFromFaction venice < AtWar
        and I_CompareCounter war_turks_venice = 1
        and I_CompareCounter turks_con = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_venice 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and I_CompareCounter turks_con = 1
        and I_CharacterExists merc_turks
        and I_CompareCounter venice_dead = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_venice 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor

    ;------ Florenz
    monitor_event FactionWarDeclared FactionType turks
        and TargetFactionType poland
        and I_CompareCounter turks_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_turks_poland = 0
            historic_event war_turks true factions { turks, }
            set_counter war_turks_poland 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and DiplomaticStanceFromFaction poland < AtWar
        and I_CompareCounter war_turks_poland = 1
        and I_CompareCounter turks_con = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_poland 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and I_CompareCounter turks_con = 1
        and I_CharacterExists merc_turks
        and I_CompareCounter poland_dead = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_poland 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor

    ;------ Papststaaten
    monitor_event FactionWarDeclared FactionType turks
        and TargetFactionType papal_states
        and I_CompareCounter turks_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_turks_papal_states = 0
            historic_event war_turks true factions { turks, }
            set_counter war_turks_papal_states 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and DiplomaticStanceFromFaction papal_states < AtWar
        and I_CompareCounter war_turks_papal_states = 1
        and I_CompareCounter turks_con = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_papal_states 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and I_CompareCounter turks_con = 1
        and I_CharacterExists merc_turks
        and I_CompareCounter papal_states_dead = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_papal_states 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor

    ;------ Neapel
    monitor_event FactionWarDeclared FactionType turks
        and TargetFactionType sicily
        and I_CompareCounter turks_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_turks_sicily = 0
            historic_event war_turks true factions { turks, }
            set_counter war_turks_sicily 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and DiplomaticStanceFromFaction sicily < AtWar
        and I_CompareCounter war_turks_sicily = 1
        and I_CompareCounter turks_con = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_sicily 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and I_CompareCounter turks_con = 1
        and I_CharacterExists merc_turks
        and I_CompareCounter sicily_dead = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_sicily 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor

    ;------ Spanien
    monitor_event FactionWarDeclared FactionType turks
        and TargetFactionType spain
        and I_CompareCounter turks_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_turks_spain = 0
            historic_event war_turks true factions { turks, }
            set_counter war_turks_spain 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and DiplomaticStanceFromFaction spain < AtWar
        and I_CompareCounter war_turks_spain = 1
        and I_CompareCounter turks_con = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_spain 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and I_CompareCounter turks_con = 1
        and I_CharacterExists merc_turks
        and I_CompareCounter spain_dead = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_spain 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor

    ;------ Schwaben
    monitor_event FactionWarDeclared FactionType turks
        and TargetFactionType normans
        and I_CompareCounter turks_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_turks_normans = 0
            historic_event war_turks true factions { turks, }
            set_counter war_turks_normans 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and DiplomaticStanceFromFaction normans < AtWar
        and I_CompareCounter war_turks_normans = 1
        and I_CompareCounter turks_con = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_normans 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and I_CompareCounter turks_con = 1
        and I_CharacterExists merc_turks
        and I_CompareCounter normans_dead = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_normans 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor

    ;------ savoy
    monitor_event FactionWarDeclared FactionType turks
        and TargetFactionType savoy
        and I_CompareCounter turks_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_turks_savoy = 0
            historic_event war_turks true factions { turks, }
            set_counter war_turks_savoy 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and DiplomaticStanceFromFaction savoy < AtWar
        and I_CompareCounter war_turks_savoy = 1
        and I_EventCounter war_turks_accepted = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_savoy 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and I_CompareCounter turks_con = 1
        and I_CharacterExists merc_turks
        and I_CompareCounter savoy_dead = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_savoy 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor


    ;------ montferrat
    monitor_event FactionWarDeclared FactionType turks
        and TargetFactionType montferrat
        and I_CompareCounter turks_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_turks_montferrat = 0
            historic_event war_turks true factions { turks, }
            set_counter war_turks_montferrat 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and DiplomaticStanceFromFaction montferrat < AtWar
        and I_CompareCounter war_turks_montferrat = 1
        and I_EventCounter war_turks_accepted = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_montferrat 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and I_CompareCounter turks_con = 1
        and I_CharacterExists merc_turks
        and I_CompareCounter montferrat_dead = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_montferrat 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor


    ;------ bologna
    monitor_event FactionWarDeclared FactionType turks
        and TargetFactionType timurids
        and I_CompareCounter turks_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_turks_bologna = 0
            historic_event war_turks true factions { turks, }
            set_counter war_turks_bologna 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and DiplomaticStanceFromFaction timurids < AtWar
        and I_CompareCounter war_turks_bologna = 1
        and I_EventCounter war_turks_accepted = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_bologna 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and I_CompareCounter turks_con = 1
        and I_CharacterExists merc_turks
        and I_CompareCounter bologna_dead = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_bologna 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor


    ;------ urbino
    monitor_event FactionWarDeclared FactionType turks
        and TargetFactionType urbino
        and I_CompareCounter turks_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_turks_urbino = 0
            historic_event war_turks true factions { turks, }
            set_counter war_turks_urbino 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and DiplomaticStanceFromFaction urbino < AtWar
        and I_CompareCounter war_turks_urbino = 1
        and I_EventCounter war_turks_accepted = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_urbino 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and I_CompareCounter turks_con = 1
        and I_CharacterExists merc_turks
        and I_CompareCounter urbino_dead = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_urbino 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor


    ;------ lucca
    monitor_event FactionWarDeclared FactionType turks
        and TargetFactionType lucca
        and I_CompareCounter turks_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_turks_lucca = 0
            historic_event war_turks true factions { turks, }
            set_counter war_turks_lucca 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and DiplomaticStanceFromFaction lucca < AtWar
        and I_CompareCounter war_turks_lucca = 1
        and I_EventCounter war_turks_accepted = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_lucca 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and I_CompareCounter turks_con = 1
        and I_CharacterExists merc_turks
        and I_CompareCounter lucca_dead = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_lucca 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor


    ;------ peasants
    monitor_event FactionWarDeclared FactionType turks
        and TargetFactionType peasants
        and I_CompareCounter turks_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_turks_peasants = 0
            historic_event war_turks true factions { turks, }
            set_counter war_turks_peasants 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and DiplomaticStanceFromFaction peasants < AtWar
        and I_CompareCounter war_turks_peasants = 1
        and I_EventCounter war_turks_accepted = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_peasants 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and I_CompareCounter turks_con = 1
        and I_CharacterExists merc_turks
        and I_CompareCounter peasants_dead = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_peasants 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor


    ;------ hafsids
    monitor_event FactionWarDeclared FactionType turks
        and TargetFactionType egypt
        and I_CompareCounter turks_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_turks_hafsids = 0
            historic_event war_turks true factions { turks, }
            set_counter war_turks_hafsids 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and DiplomaticStanceFromFaction egypt < AtWar
        and I_CompareCounter war_turks_hafsids = 1
        and I_EventCounter war_turks_accepted = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_hafsids 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType turks
        and I_CompareCounter turks_con = 1
        and I_CharacterExists merc_turks
        and I_CompareCounter hafsids_dead = 1

        historic_event war_turks_ende true factions { turks, }

        set_counter war_turks_hafsids 0
        set_counter turks_zahler 0
        set_counter turks_con 0
    end_monitor


    ;---------------------------------------------------------------------------------
    ;------------------------------- Venedig -----------------------------------------
    ;------ Frankreich
    monitor_event FactionWarDeclared FactionType venice
        and TargetFactionType france
        and I_CompareCounter venice_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_venice_france = 0
            historic_event war_venice true factions { venice, }
            set_counter war_venice_france 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and DiplomaticStanceFromFaction france < AtWar
        and I_CompareCounter war_venice_france = 1
        and I_CompareCounter venice_con = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_france 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and I_CompareCounter venice_con = 1
        and I_CharacterExists merc_venice
        and I_CompareCounter france_dead = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_france 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor

    ;------ Schweizer
    monitor_event FactionWarDeclared FactionType venice
        and TargetFactionType saxons
        and I_CompareCounter venice_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_venice_saxons = 0
            historic_event war_venice true factions { venice, }
            set_counter war_venice_saxons 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and DiplomaticStanceFromFaction saxons < AtWar
        and I_CompareCounter war_venice_saxons = 1
        and I_CompareCounter venice_con = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_saxons 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and I_CompareCounter venice_con = 1
        and I_CharacterExists merc_venice
        and I_CompareCounter saxons_dead = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_saxons 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor

    ;------ HRE
    monitor_event FactionWarDeclared FactionType venice
        and TargetFactionType hre
        and I_CompareCounter venice_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_venice_hre = 0
            historic_event war_venice true factions { venice, }
            set_counter war_venice_hre 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and DiplomaticStanceFromFaction hre < AtWar
        and I_CompareCounter war_venice_hre = 1
        and I_CompareCounter venice_con = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_hre 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and I_CompareCounter venice_con = 1
        and I_CharacterExists merc_venice
        and I_CompareCounter hre_dead = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_hre 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor

    ;------ Mailand
    monitor_event FactionWarDeclared FactionType venice
        and TargetFactionType milan
        and I_CompareCounter venice_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_venice_milan = 0
            historic_event war_venice true factions { venice, }
            set_counter war_venice_milan 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and DiplomaticStanceFromFaction milan < AtWar
        and I_CompareCounter war_venice_milan = 1
        and I_CompareCounter venice_con = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_milan 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and I_CompareCounter venice_con = 1
        and I_CharacterExists merc_venice
        and I_CompareCounter milan_dead = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_milan 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor

    ;------ Ungarn
    monitor_event FactionWarDeclared FactionType venice
        and TargetFactionType hungary
        and I_CompareCounter venice_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_venice_hungary = 0
            historic_event war_venice true factions { venice, }
            set_counter war_venice_hungary 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and DiplomaticStanceFromFaction hungary < AtWar
        and I_CompareCounter war_venice_hungary = 1
        and I_CompareCounter venice_con = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_hungary 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and I_CompareCounter venice_con = 1
        and I_CharacterExists merc_venice
        and I_CompareCounter hungary_dead = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_hungary 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor

    ;------ Türken
    monitor_event FactionWarDeclared FactionType venice
        and TargetFactionType turks
        and I_CompareCounter venice_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_venice_turks = 0
            historic_event war_venice true factions { venice, }
            set_counter war_venice_turks 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and DiplomaticStanceFromFaction turks < AtWar
        and I_CompareCounter war_venice_turks = 1
        and I_CompareCounter venice_con = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_turks 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and I_CompareCounter venice_con = 1
        and I_CharacterExists merc_venice
        and I_CompareCounter turks_dead = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_turks 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor

    ;------ Florenz
    monitor_event FactionWarDeclared FactionType venice
        and TargetFactionType poland
        and I_CompareCounter venice_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_venice_poland = 0
            historic_event war_venice true factions { venice, }
            set_counter war_venice_poland 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and DiplomaticStanceFromFaction poland < AtWar
        and I_CompareCounter war_venice_poland = 1
        and I_CompareCounter venice_con = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_poland 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and I_CompareCounter venice_con = 1
        and I_CharacterExists merc_venice
        and I_CompareCounter poland_dead = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_poland 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor

    ;------ Papststaaten
    monitor_event FactionWarDeclared FactionType venice
        and TargetFactionType papal_states
        and I_CompareCounter venice_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_venice_papal_states = 0
            historic_event war_venice true factions { venice, }
            set_counter war_venice_papal_states 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and DiplomaticStanceFromFaction papal_states < AtWar
        and I_CompareCounter war_venice_papal_states = 1
        and I_CompareCounter venice_con = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_papal_states 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and I_CompareCounter venice_con = 1
        and I_CharacterExists merc_venice
        and I_CompareCounter papal_states_dead = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_papal_states 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor

    ;------ Neapel
    monitor_event FactionWarDeclared FactionType venice
        and TargetFactionType sicily
        and I_CompareCounter venice_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_venice_sicily = 0
            historic_event war_venice true factions { venice, }
            set_counter war_venice_sicily 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and DiplomaticStanceFromFaction sicily < AtWar
        and I_CompareCounter war_venice_sicily = 1
        and I_CompareCounter venice_con = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_sicily 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and I_CompareCounter venice_con = 1
        and I_CharacterExists merc_venice
        and I_CompareCounter sicily_dead = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_sicily 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor

    ;------ Spanien
    monitor_event FactionWarDeclared FactionType venice
        and TargetFactionType spain
        and I_CompareCounter venice_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_venice_spain = 0
            historic_event war_venice true factions { venice, }
            set_counter war_venice_spain 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and DiplomaticStanceFromFaction spain < AtWar
        and I_CompareCounter war_venice_spain = 1
        and I_CompareCounter venice_con = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_spain 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and I_CompareCounter venice_con = 1
        and I_CharacterExists merc_venice
        and I_CompareCounter spain_dead = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_spain 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor

    ;------ Schwaben
    monitor_event FactionWarDeclared FactionType venice
        and TargetFactionType normans
        and I_CompareCounter venice_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_venice_normans = 0
            historic_event war_venice true factions { venice, }
            set_counter war_venice_normans 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and DiplomaticStanceFromFaction normans < AtWar
        and I_CompareCounter war_venice_normans = 1
        and I_CompareCounter venice_con = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_normans 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and I_CompareCounter venice_con = 1
        and I_CharacterExists merc_venice
        and I_CompareCounter normans_dead = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_normans 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor

    ;------ savoy
    monitor_event FactionWarDeclared FactionType venice
        and TargetFactionType savoy
        and I_CompareCounter venice_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_venice_savoy = 0
            historic_event war_venice true factions { venice, }
            set_counter war_venice_savoy 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and DiplomaticStanceFromFaction savoy < AtWar
        and I_CompareCounter war_venice_savoy = 1
        and I_EventCounter war_venice_accepted = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_savoy 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and I_CompareCounter venice_con = 1
        and I_CharacterExists merc_venice
        and I_CompareCounter savoy_dead = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_savoy 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor


    ;------ montferrat
    monitor_event FactionWarDeclared FactionType venice
        and TargetFactionType montferrat
        and I_CompareCounter venice_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_venice_montferrat = 0
            historic_event war_venice true factions { venice, }
            set_counter war_venice_montferrat 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and DiplomaticStanceFromFaction montferrat < AtWar
        and I_CompareCounter war_venice_montferrat = 1
        and I_EventCounter war_venice_accepted = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_montferrat 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and I_CompareCounter venice_con = 1
        and I_CharacterExists merc_venice
        and I_CompareCounter montferrat_dead = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_montferrat 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor


    ;------ bologna
    monitor_event FactionWarDeclared FactionType venice
        and TargetFactionType timurids
        and I_CompareCounter venice_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_venice_bologna = 0
            historic_event war_venice true factions { venice, }
            set_counter war_venice_bologna 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and DiplomaticStanceFromFaction timurids < AtWar
        and I_CompareCounter war_venice_bologna = 1
        and I_EventCounter war_venice_accepted = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_bologna 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and I_CompareCounter venice_con = 1
        and I_CharacterExists merc_venice
        and I_CompareCounter bologna_dead = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_bologna 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor


    ;------ urbino
    monitor_event FactionWarDeclared FactionType venice
        and TargetFactionType urbino
        and I_CompareCounter venice_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_venice_urbino = 0
            historic_event war_venice true factions { venice, }
            set_counter war_venice_urbino 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and DiplomaticStanceFromFaction urbino < AtWar
        and I_CompareCounter war_venice_urbino = 1
        and I_EventCounter war_venice_accepted = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_urbino 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and I_CompareCounter venice_con = 1
        and I_CharacterExists merc_venice
        and I_CompareCounter urbino_dead = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_urbino 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor


    ;------ lucca
    monitor_event FactionWarDeclared FactionType venice
        and TargetFactionType lucca
        and I_CompareCounter venice_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_venice_lucca = 0
            historic_event war_venice true factions { venice, }
            set_counter war_venice_lucca 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and DiplomaticStanceFromFaction lucca < AtWar
        and I_CompareCounter war_venice_lucca = 1
        and I_EventCounter war_venice_accepted = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_lucca 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and I_CompareCounter venice_con = 1
        and I_CharacterExists merc_venice
        and I_CompareCounter lucca_dead = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_lucca 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor


    ;------ peasants
    monitor_event FactionWarDeclared FactionType venice
        and TargetFactionType peasants
        and I_CompareCounter venice_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_venice_peasants = 0
            historic_event war_venice true factions { venice, }
            set_counter war_venice_peasants 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and DiplomaticStanceFromFaction peasants < AtWar
        and I_CompareCounter war_venice_peasants = 1
        and I_EventCounter war_venice_accepted = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_peasants 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and I_CompareCounter venice_con = 1
        and I_CharacterExists merc_venice
        and I_CompareCounter peasants_dead = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_peasants 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor


    ;------ hafsids
    monitor_event FactionWarDeclared FactionType venice
        and TargetFactionType egypt
        and I_CompareCounter venice_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_venice_hafsids = 0
            historic_event war_venice true factions { venice, }
            set_counter war_venice_hafsids 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and DiplomaticStanceFromFaction egypt < AtWar
        and I_CompareCounter war_venice_hafsids = 1
        and I_EventCounter war_venice_accepted = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_hafsids 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType venice
        and I_CompareCounter venice_con = 1
        and I_CharacterExists merc_venice
        and I_CompareCounter hafsids_dead = 1

        historic_event war_venice_ende true factions { venice, }

        set_counter war_venice_hafsids 0
        set_counter venice_zahler 0
        set_counter venice_con 0
    end_monitor


    ;---------------------------------------------------------------------------------
    ;------------------------------- Florenz -----------------------------------------
    ;------ Frankreich
    monitor_event FactionWarDeclared FactionType poland
        and TargetFactionType france
        and I_CompareCounter poland_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_poland_france = 0
            historic_event war_poland true factions { poland, }
            set_counter war_poland_france 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and DiplomaticStanceFromFaction france < AtWar
        and I_CompareCounter war_poland_france = 1
        and I_CompareCounter poland_con = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_france 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and I_CompareCounter poland_con = 1
        and I_CharacterExists merc_poland
        and I_CompareCounter france_dead = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_france 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor

    ;------ HRE
    monitor_event FactionWarDeclared FactionType poland
        and TargetFactionType hre
        and I_CompareCounter poland_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_poland_hre = 0
            historic_event war_poland true factions { poland, }
            set_counter war_poland_hre 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and DiplomaticStanceFromFaction hre < AtWar
        and I_CompareCounter war_poland_hre = 1
        and I_CompareCounter poland_con = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_hre 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and I_CompareCounter poland_con = 1
        and I_CharacterExists merc_poland
        and I_CompareCounter hre_dead = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_hre 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor

    ;------ Schweizer
    monitor_event FactionWarDeclared FactionType poland
        and TargetFactionType saxons
        and I_CompareCounter poland_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_poland_saxons = 0
            historic_event war_poland true factions { poland, }
            set_counter war_poland_saxons 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and DiplomaticStanceFromFaction saxons < AtWar
        and I_CompareCounter war_poland_saxons = 1
        and I_CompareCounter poland_con = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_saxons 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and I_CompareCounter poland_con = 1
        and I_CharacterExists merc_poland
        and I_CompareCounter saxons_dead = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_saxons 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor

    ;------ Mailand
    monitor_event FactionWarDeclared FactionType poland
        and TargetFactionType milan
        and I_CompareCounter poland_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_poland_milan = 0
            historic_event war_poland true factions { poland, }
            set_counter war_poland_milan 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and DiplomaticStanceFromFaction milan < AtWar
        and I_CompareCounter war_poland_milan = 1
        and I_CompareCounter poland_con = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_milan 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and I_CompareCounter poland_con = 1
        and I_CharacterExists merc_poland
        and I_CompareCounter milan_dead = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_milan 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor

    ;------ Ungarn
    monitor_event FactionWarDeclared FactionType poland
        and TargetFactionType hungary
        and I_CompareCounter poland_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_poland_hungary = 0
            historic_event war_poland true factions { poland, }
            set_counter war_poland_hungary 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and DiplomaticStanceFromFaction hungary < AtWar
        and I_CompareCounter war_poland_hungary = 1
        and I_CompareCounter poland_con = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_hungary 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and I_CompareCounter poland_con = 1
        and I_CharacterExists merc_poland
        and I_CompareCounter hungary_dead = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_hungary 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor

    ;------ Türken
    monitor_event FactionWarDeclared FactionType poland
        and TargetFactionType turks
        and I_CompareCounter poland_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_poland_turks = 0
            historic_event war_poland true factions { poland, }
            set_counter war_poland_turks 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and DiplomaticStanceFromFaction turks < AtWar
        and I_CompareCounter war_poland_turks = 1
        and I_CompareCounter poland_con = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_turks 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and I_CompareCounter poland_con = 1
        and I_CharacterExists merc_poland
        and I_CompareCounter turks_dead = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_turks 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor

    ;------ Venedig
    monitor_event FactionWarDeclared FactionType poland
        and TargetFactionType venice
        and I_CompareCounter poland_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_poland_venice = 0
            historic_event war_poland true factions { poland, }
            set_counter war_poland_venice 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and DiplomaticStanceFromFaction venice < AtWar
        and I_CompareCounter war_poland_venice = 1
        and I_CompareCounter poland_con = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_venice 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and I_CompareCounter poland_con = 1
        and I_CharacterExists merc_poland
        and I_CompareCounter venice_dead = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_venice 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor

    ;------ Papststaaten
    monitor_event FactionWarDeclared FactionType poland
        and TargetFactionType papal_states
        and I_CompareCounter poland_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_poland_papal_states = 0
            historic_event war_poland true factions { poland, }
            set_counter war_poland_papal_states 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and DiplomaticStanceFromFaction papal_states < AtWar
        and I_CompareCounter war_poland_papal_states = 1
        and I_CompareCounter poland_con = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_papal_states 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and I_CompareCounter poland_con = 1
        and I_CharacterExists merc_poland
        and I_CompareCounter papal_states_dead = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_papal_states 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor

    ;------ Neapel
    monitor_event FactionWarDeclared FactionType poland
        and TargetFactionType sicily
        and I_CompareCounter poland_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_poland_sicily = 0
            historic_event war_poland true factions { poland, }
            set_counter war_poland_sicily 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and DiplomaticStanceFromFaction sicily < AtWar
        and I_CompareCounter war_poland_sicily = 1
        and I_CompareCounter poland_con = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_sicily 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and I_CompareCounter poland_con = 1
        and I_CharacterExists merc_poland
        and I_CompareCounter sicily_dead = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_sicily 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor

    ;------ Spanien
    monitor_event FactionWarDeclared FactionType poland
        and TargetFactionType spain
        and I_CompareCounter poland_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_poland_spain = 0
            historic_event war_poland true factions { poland, }
            set_counter war_poland_spain 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and DiplomaticStanceFromFaction spain < AtWar
        and I_CompareCounter war_poland_spain = 1
        and I_CompareCounter poland_con = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_spain 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and I_CompareCounter poland_con = 1
        and I_CharacterExists merc_poland
        and I_CompareCounter sicily_dead = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_sicily 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor

    ;------ Schwaben
    monitor_event FactionWarDeclared FactionType poland
        and TargetFactionType normans
        and I_CompareCounter poland_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_poland_normans = 0
            historic_event war_poland true factions { poland, }
            set_counter war_poland_normans 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and DiplomaticStanceFromFaction normans < AtWar
        and I_CompareCounter war_poland_normans = 1
        and I_CompareCounter poland_con = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_normans 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and I_CompareCounter poland_con = 1
        and I_CharacterExists merc_poland
        and I_CompareCounter normans_dead = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_normans 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor

    ;------ savoy
    monitor_event FactionWarDeclared FactionType poland
        and TargetFactionType savoy
        and I_CompareCounter poland_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_poland_savoy = 0
            historic_event war_poland true factions { poland, }
            set_counter war_poland_savoy 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and DiplomaticStanceFromFaction savoy < AtWar
        and I_CompareCounter war_poland_savoy = 1
        and I_EventCounter war_poland_accepted = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_savoy 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and I_CompareCounter poland_con = 1
        and I_CharacterExists merc_poland
        and I_CompareCounter savoy_dead = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_savoy 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor


    ;------ montferrat
    monitor_event FactionWarDeclared FactionType poland
        and TargetFactionType montferrat
        and I_CompareCounter poland_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_poland_montferrat = 0
            historic_event war_poland true factions { poland, }
            set_counter war_poland_montferrat 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and DiplomaticStanceFromFaction montferrat < AtWar
        and I_CompareCounter war_poland_montferrat = 1
        and I_EventCounter war_poland_accepted = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_montferrat 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and I_CompareCounter poland_con = 1
        and I_CharacterExists merc_poland
        and I_CompareCounter montferrat_dead = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_montferrat 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor


    ;------ bologna
    monitor_event FactionWarDeclared FactionType poland
        and TargetFactionType timurids
        and I_CompareCounter poland_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_poland_bologna = 0
            historic_event war_poland true factions { poland, }
            set_counter war_poland_bologna 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and DiplomaticStanceFromFaction timurids < AtWar
        and I_CompareCounter war_poland_bologna = 1
        and I_EventCounter war_poland_accepted = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_bologna 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and I_CompareCounter poland_con = 1
        and I_CharacterExists merc_poland
        and I_CompareCounter bologna_dead = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_bologna 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor


    ;------ urbino
    monitor_event FactionWarDeclared FactionType poland
        and TargetFactionType urbino
        and I_CompareCounter poland_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_poland_urbino = 0
            historic_event war_poland true factions { poland, }
            set_counter war_poland_urbino 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and DiplomaticStanceFromFaction urbino < AtWar
        and I_CompareCounter war_poland_urbino = 1
        and I_EventCounter war_poland_accepted = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_urbino 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and I_CompareCounter poland_con = 1
        and I_CharacterExists merc_poland
        and I_CompareCounter urbino_dead = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_urbino 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor


    ;------ lucca
    monitor_event FactionWarDeclared FactionType poland
        and TargetFactionType lucca
        and I_CompareCounter poland_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_poland_lucca = 0
            historic_event war_poland true factions { poland, }
            set_counter war_poland_lucca 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and DiplomaticStanceFromFaction lucca < AtWar
        and I_CompareCounter war_poland_lucca = 1
        and I_EventCounter war_poland_accepted = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_lucca 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and I_CompareCounter poland_con = 1
        and I_CharacterExists merc_poland
        and I_CompareCounter lucca_dead = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_lucca 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor


    ;------ peasants
    monitor_event FactionWarDeclared FactionType poland
        and TargetFactionType peasants
        and I_CompareCounter poland_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_poland_peasants = 0
            historic_event war_poland true factions { poland, }
            set_counter war_poland_peasants 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and DiplomaticStanceFromFaction peasants < AtWar
        and I_CompareCounter war_poland_peasants = 1
        and I_EventCounter war_poland_accepted = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_peasants 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and I_CompareCounter poland_con = 1
        and I_CharacterExists merc_poland
        and I_CompareCounter peasants_dead = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_peasants 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor


    ;------ hafsids
    monitor_event FactionWarDeclared FactionType poland
        and TargetFactionType egypt
        and I_CompareCounter poland_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_poland_hafsids = 0
            historic_event war_poland true factions { poland, }
            set_counter war_poland_hafsids 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and DiplomaticStanceFromFaction egypt < AtWar
        and I_CompareCounter war_poland_hafsids = 1
        and I_EventCounter war_poland_accepted = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_hafsids 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType poland
        and I_CompareCounter poland_con = 1
        and I_CharacterExists merc_poland
        and I_CompareCounter hafsids_dead = 1

        historic_event war_poland_ende true factions { poland, }

        set_counter war_poland_hafsids 0
        set_counter poland_zahler 0
        set_counter poland_con 0
    end_monitor


    ;---------------------------------------------------------------------------------
    ;------------------------------- Papststaaten ------------------------------------
    ;------ Frankreich
    monitor_event FactionWarDeclared FactionType papal_states
        and TargetFactionType france
        and I_CompareCounter papal_states_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_papal_states_france = 0
            historic_event war_papal_states true factions { papal_states, }
            set_counter war_papal_states_france 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and DiplomaticStanceFromFaction france < AtWar
        and I_CompareCounter war_papal_states_france = 1
        and I_CompareCounter papal_states_con = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_france 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and I_CompareCounter papal_states_con = 1
        and I_CharacterExists merc_papal_states
        and I_CompareCounter france_dead = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_france 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor

    ;------ Schweizer
    monitor_event FactionWarDeclared FactionType papal_states
        and TargetFactionType saxons
        and I_CompareCounter papal_states_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_papal_states_saxons = 0
            historic_event war_papal_states true factions { papal_states, }
            set_counter war_papal_states_saxons 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and DiplomaticStanceFromFaction saxons < AtWar
        and I_CompareCounter war_papal_states_saxons = 1
        and I_CompareCounter papal_states_con = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_saxons 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and I_CompareCounter papal_states_con = 1
        and I_CharacterExists merc_papal_states
        and I_CompareCounter saxons_dead = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_saxons 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor

    ;------ HRE
    monitor_event FactionWarDeclared FactionType papal_states
        and TargetFactionType hre
        and I_CompareCounter papal_states_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_papal_states_hre = 0
            historic_event war_papal_states true factions { papal_states, }
            set_counter war_papal_states_hre 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and DiplomaticStanceFromFaction hre < AtWar
        and I_CompareCounter war_papal_states_hre = 1
        and I_CompareCounter papal_states_con = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_hre 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and I_CompareCounter papal_states_con = 1
        and I_CharacterExists merc_papal_states
        and I_CompareCounter hre_dead = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_hre 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor

    ;------ Mailand
    monitor_event FactionWarDeclared FactionType papal_states
        and TargetFactionType milan
        and I_CompareCounter papal_states_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_papal_states_milan = 0
            historic_event war_papal_states true factions { papal_states, }
            set_counter war_papal_states_milan 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and DiplomaticStanceFromFaction milan < AtWar
        and I_CompareCounter war_papal_states_milan = 1
        and I_CompareCounter papal_states_con = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_milan 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and I_CompareCounter papal_states_con = 1
        and I_CharacterExists merc_papal_states
        and I_CompareCounter milan_dead = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_milan 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor

    ;------ Ungarn
    monitor_event FactionWarDeclared FactionType papal_states
        and TargetFactionType hungary
        and I_CompareCounter papal_states_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_papal_states_hungary = 0
            historic_event war_papal_states true factions { papal_states, }
            set_counter war_papal_states_hungary 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and DiplomaticStanceFromFaction hungary < AtWar
        and I_CompareCounter war_papal_states_hungary = 1
        and I_CompareCounter papal_states_con = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_hungary 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and I_CompareCounter papal_states_con = 1
        and I_CharacterExists merc_papal_states
        and I_CompareCounter hungary_dead = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_hungary 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor

    ;------ Türken
    monitor_event FactionWarDeclared FactionType papal_states
        and TargetFactionType turks
        and I_CompareCounter papal_states_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_papal_states_turks = 0
            historic_event war_papal_states true factions { papal_states, }
            set_counter war_papal_states_turks 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and DiplomaticStanceFromFaction turks < AtWar
        and I_CompareCounter war_papal_states_turks = 1
        and I_CompareCounter papal_states_con = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_turks 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and I_CompareCounter papal_states_con = 1
        and I_CharacterExists merc_papal_states
        and I_CompareCounter turks_dead = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_turks 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor

    ;------ Venedig
    monitor_event FactionWarDeclared FactionType papal_states
        and TargetFactionType venice
        and I_CompareCounter papal_states_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_papal_states_venice = 0
            historic_event war_papal_states true factions { papal_states, }
            set_counter war_papal_states_venice 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and DiplomaticStanceFromFaction venice < AtWar
        and I_CompareCounter war_papal_states_venice = 1
        and I_CompareCounter papal_states_con = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_venice 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and I_CompareCounter papal_states_con = 1
        and I_CharacterExists merc_papal_states
        and I_CompareCounter venice_dead = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_venice 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor

    ;------ Florenz
    monitor_event FactionWarDeclared FactionType papal_states
        and TargetFactionType poland
        and I_CompareCounter papal_states_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_papal_states_poland = 0
            historic_event war_papal_states true factions { papal_states, }
            set_counter war_papal_states_poland 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and DiplomaticStanceFromFaction poland < AtWar
        and I_CompareCounter war_papal_states_poland = 1
        and I_CompareCounter papal_states_con = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_poland 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and I_CompareCounter papal_states_con = 1
        and I_CharacterExists merc_papal_states
        and I_CompareCounter poland_dead = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_poland 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor

    ;------ Neapel
    monitor_event FactionWarDeclared FactionType papal_states
        and TargetFactionType sicily
        and I_CompareCounter papal_states_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_papal_states_sicily = 0
            historic_event war_papal_states true factions { papal_states, }
            set_counter war_papal_states_sicily 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and DiplomaticStanceFromFaction sicily < AtWar
        and I_CompareCounter war_papal_states_sicily = 1
        and I_CompareCounter papal_states_con = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_sicily 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and I_CompareCounter papal_states_con = 1
        and I_CharacterExists merc_papal_states
        and I_CompareCounter sicily_dead = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_sicily 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor

    ;------ Spanien
    monitor_event FactionWarDeclared FactionType papal_states
        and TargetFactionType spain
        and I_CompareCounter papal_states_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_papal_states_spain = 0
            historic_event war_papal_states true factions { papal_states, }
            set_counter war_papal_states_spain 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and DiplomaticStanceFromFaction spain < AtWar
        and I_CompareCounter war_papal_states_spain = 1
        and I_CompareCounter papal_states_con = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_spain 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and I_CompareCounter papal_states_con = 1
        and I_CharacterExists merc_papal_states
        and I_CompareCounter spain_dead = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_spain 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor

    ;------ Schwaben
    monitor_event FactionWarDeclared FactionType papal_states
        and TargetFactionType normans
        and I_CompareCounter papal_states_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_papal_states_normans = 0
            historic_event war_papal_states true factions { papal_states, }
            set_counter war_papal_states_normans 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and DiplomaticStanceFromFaction normans < AtWar
        and I_CompareCounter war_papal_states_normans = 1
        and I_CompareCounter papal_states_con = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_normans 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and I_CompareCounter papal_states_con = 1
        and I_CharacterExists merc_papal_states
        and I_CompareCounter normans_dead = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_normans 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor

    ;------ savoy
    monitor_event FactionWarDeclared FactionType papal_states
        and TargetFactionType savoy
        and I_CompareCounter papal_states_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_papal_states_savoy = 0
            historic_event war_papal_states true factions { papal_states, }
            set_counter war_papal_states_savoy 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and DiplomaticStanceFromFaction savoy < AtWar
        and I_CompareCounter war_papal_states_savoy = 1
        and I_EventCounter war_papal_states_accepted = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_savoy 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and I_CompareCounter papal_states_con = 1
        and I_CharacterExists merc_papal_states
        and I_CompareCounter savoy_dead = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_savoy 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor


    ;------ montferrat
    monitor_event FactionWarDeclared FactionType papal_states
        and TargetFactionType montferrat
        and I_CompareCounter papal_states_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_papal_states_montferrat = 0
            historic_event war_papal_states true factions { papal_states, }
            set_counter war_papal_states_montferrat 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and DiplomaticStanceFromFaction montferrat < AtWar
        and I_CompareCounter war_papal_states_montferrat = 1
        and I_EventCounter war_papal_states_accepted = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_montferrat 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and I_CompareCounter papal_states_con = 1
        and I_CharacterExists merc_papal_states
        and I_CompareCounter montferrat_dead = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_montferrat 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor


    ;------ bologna
    monitor_event FactionWarDeclared FactionType papal_states
        and TargetFactionType timurids
        and I_CompareCounter papal_states_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_papal_states_bologna = 0
            historic_event war_papal_states true factions { papal_states, }
            set_counter war_papal_states_bologna 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and DiplomaticStanceFromFaction timurids < AtWar
        and I_CompareCounter war_papal_states_bologna = 1
        and I_EventCounter war_papal_states_accepted = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_bologna 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and I_CompareCounter papal_states_con = 1
        and I_CharacterExists merc_papal_states
        and I_CompareCounter bologna_dead = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_bologna 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor


    ;------ urbino
    monitor_event FactionWarDeclared FactionType papal_states
        and TargetFactionType urbino
        and I_CompareCounter papal_states_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_papal_states_urbino = 0
            historic_event war_papal_states true factions { papal_states, }
            set_counter war_papal_states_urbino 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and DiplomaticStanceFromFaction urbino < AtWar
        and I_CompareCounter war_papal_states_urbino = 1
        and I_EventCounter war_papal_states_accepted = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_urbino 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and I_CompareCounter papal_states_con = 1
        and I_CharacterExists merc_papal_states
        and I_CompareCounter urbino_dead = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_urbino 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor


    ;------ lucca
    monitor_event FactionWarDeclared FactionType papal_states
        and TargetFactionType lucca
        and I_CompareCounter papal_states_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_papal_states_lucca = 0
            historic_event war_papal_states true factions { papal_states, }
            set_counter war_papal_states_lucca 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and DiplomaticStanceFromFaction lucca < AtWar
        and I_CompareCounter war_papal_states_lucca = 1
        and I_EventCounter war_papal_states_accepted = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_lucca 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and I_CompareCounter papal_states_con = 1
        and I_CharacterExists merc_papal_states
        and I_CompareCounter lucca_dead = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_lucca 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor


    ;------ peasants
    monitor_event FactionWarDeclared FactionType papal_states
        and TargetFactionType peasants
        and I_CompareCounter papal_states_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_papal_states_peasants = 0
            historic_event war_papal_states true factions { papal_states, }
            set_counter war_papal_states_peasants 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and DiplomaticStanceFromFaction peasants < AtWar
        and I_CompareCounter war_papal_states_peasants = 1
        and I_EventCounter war_papal_states_accepted = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_peasants 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and I_CompareCounter papal_states_con = 1
        and I_CharacterExists merc_papal_states
        and I_CompareCounter peasants_dead = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_peasants 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor


    ;------ hafsids
    monitor_event FactionWarDeclared FactionType papal_states
        and TargetFactionType egypt
        and I_CompareCounter papal_states_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_papal_states_hafsids = 0
            historic_event war_papal_states true factions { papal_states, }
            set_counter war_papal_states_hafsids 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and DiplomaticStanceFromFaction egypt < AtWar
        and I_CompareCounter war_papal_states_hafsids = 1
        and I_EventCounter war_papal_states_accepted = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_hafsids 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and I_CompareCounter papal_states_con = 1
        and I_CharacterExists merc_papal_states
        and I_CompareCounter hafsids_dead = 1

        historic_event war_papal_states_ende true factions { papal_states, }

        set_counter war_papal_states_hafsids 0
        set_counter papal_states_zahler 0
        set_counter papal_states_con 0
    end_monitor


    ;---------------------------------------------------------------------------------
    ;------------------------------- Neapel ------------------------------------------
    ;------ Frankreich
    monitor_event FactionWarDeclared FactionType sicily
        and TargetFactionType france
        and I_CompareCounter sicily_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_sicily_france = 0
            historic_event war_sicily true factions { sicily, }
            set_counter war_sicily_france 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and DiplomaticStanceFromFaction france < AtWar
        and I_CompareCounter war_sicily_france = 1
        and I_CompareCounter sicily_con = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_france 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and I_CompareCounter sicily_con = 1
        and I_CharacterExists merc_sicily
        and I_CompareCounter france_dead = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_france 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor

    ;------ Schweizer
    monitor_event FactionWarDeclared FactionType sicily
        and TargetFactionType saxons
        and I_CompareCounter sicily_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_sicily_saxons = 0
            historic_event war_sicily true factions { sicily, }
            set_counter war_sicily_saxons 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and DiplomaticStanceFromFaction saxons < AtWar
        and I_CompareCounter war_sicily_saxons = 1
        and I_CompareCounter sicily_con = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_saxons 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and I_CompareCounter sicily_con = 1
        and I_CharacterExists merc_sicily
        and I_CompareCounter saxons_dead = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_saxons 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor

    ;------ HRE
    monitor_event FactionWarDeclared FactionType sicily
        and TargetFactionType hre
        and I_CompareCounter sicily_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_sicily_hre = 0
            historic_event war_sicily true factions { sicily, }
            set_counter war_sicily_hre 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and DiplomaticStanceFromFaction hre < AtWar
        and I_CompareCounter war_sicily_hre = 1
        and I_CompareCounter sicily_con = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_hre 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and I_CompareCounter sicily_con = 1
        and I_CharacterExists merc_sicily
        and I_CompareCounter hre_dead = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_hre 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor

    ;------ Mailand
    monitor_event FactionWarDeclared FactionType sicily
        and TargetFactionType milan
        and I_CompareCounter sicily_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_sicily_milan = 0
            historic_event war_sicily true factions { sicily, }
            set_counter war_sicily_milan 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and DiplomaticStanceFromFaction milan < AtWar
        and I_CompareCounter war_sicily_milan = 1
        and I_CompareCounter sicily_con = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_milan 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and I_CompareCounter sicily_con = 1
        and I_CharacterExists merc_sicily
        and I_CompareCounter milan_dead = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_milan 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor

    ;------ Ungarn
    monitor_event FactionWarDeclared FactionType sicily
        and TargetFactionType hungary
        and I_CompareCounter sicily_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_sicily_hungary = 0
            historic_event war_sicily true factions { sicily, }
            set_counter war_sicily_hungary 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and DiplomaticStanceFromFaction hungary < AtWar
        and I_CompareCounter war_sicily_hungary = 1
        and I_CompareCounter sicily_con = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_hungary 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and I_CompareCounter sicily_con = 1
        and I_CharacterExists merc_sicily
        and I_CompareCounter hungary_dead = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_hungary 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor

    ;------ Türken
    monitor_event FactionWarDeclared FactionType sicily
        and TargetFactionType turks
        and I_CompareCounter sicily_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_sicily_turks = 0
            historic_event war_sicily true factions { sicily, }
            set_counter war_sicily_turks 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and DiplomaticStanceFromFaction turks < AtWar
        and I_CompareCounter war_sicily_turks = 1
        and I_CompareCounter sicily_con = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_turks 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and I_CompareCounter sicily_con = 1
        and I_CharacterExists merc_sicily
        and I_CompareCounter turks_dead = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_turks 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor

    ;------ Venedig
    monitor_event FactionWarDeclared FactionType sicily
        and TargetFactionType venice
        and I_CompareCounter sicily_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_sicily_venice = 0
            historic_event war_sicily true factions { sicily, }
            set_counter war_sicily_venice 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and DiplomaticStanceFromFaction venice < AtWar
        and I_CompareCounter war_sicily_venice = 1
        and I_CompareCounter sicily_con = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_venice 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and I_CompareCounter sicily_con = 1
        and I_CharacterExists merc_sicily
        and I_CompareCounter venice_dead = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_venice 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor

    ;------ Florenz
    monitor_event FactionWarDeclared FactionType sicily
        and TargetFactionType poland
        and I_CompareCounter sicily_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_sicily_poland = 0
            historic_event war_sicily true factions { sicily, }
            set_counter war_sicily_poland 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and DiplomaticStanceFromFaction poland < AtWar
        and I_CompareCounter war_sicily_poland = 1
        and I_CompareCounter sicily_con = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_poland 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and I_CompareCounter sicily_con = 1
        and I_CharacterExists merc_sicily
        and I_CompareCounter poland_dead = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_poland 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor

    ;------ Papststaaten
    monitor_event FactionWarDeclared FactionType sicily
        and TargetFactionType papal_states
        and I_CompareCounter sicily_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_sicily_papal_states = 0
            historic_event war_sicily true factions { sicily, }
            set_counter war_sicily_papal_states 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and DiplomaticStanceFromFaction papal_states < AtWar
        and I_CompareCounter war_sicily_papal_states = 1
        and I_CompareCounter sicily_con = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_papal_states 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and I_CompareCounter sicily_con = 1
        and I_CharacterExists merc_sicily
        and I_CompareCounter papal_states_dead = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_papal_states 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor

    ;------ Spanien
    monitor_event FactionWarDeclared FactionType sicily
        and TargetFactionType spain
        and I_CompareCounter sicily_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_sicily_spain = 0
            historic_event war_sicily true factions { sicily, }
            set_counter war_sicily_spain 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and DiplomaticStanceFromFaction spain < AtWar
        and I_CompareCounter war_sicily_spain = 1
        and I_CompareCounter sicily_con = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_spain 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and I_CompareCounter sicily_con = 1
        and I_CharacterExists merc_sicily
        and I_CompareCounter spain_dead = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_spain 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor

    ;------ Schwaben
    monitor_event FactionWarDeclared FactionType sicily
        and TargetFactionType normans
        and I_CompareCounter sicily_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_sicily_normans = 0
            historic_event war_sicily true factions { sicily, }
            set_counter war_sicily_normans 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and DiplomaticStanceFromFaction normans < AtWar
        and I_CompareCounter war_sicily_normans = 1
        and I_CompareCounter sicily_con = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_normans 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and I_CompareCounter sicily_con = 1
        and I_CharacterExists merc_sicily
        and I_CompareCounter normans_dead = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_normans 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor

    ;------ savoy
    monitor_event FactionWarDeclared FactionType sicily
        and TargetFactionType savoy
        and I_CompareCounter sicily_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_sicily_savoy = 0
            historic_event war_sicily true factions { sicily, }
            set_counter war_sicily_savoy 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and DiplomaticStanceFromFaction savoy < AtWar
        and I_CompareCounter war_sicily_savoy = 1
        and I_EventCounter war_sicily_accepted = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_savoy 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and I_CompareCounter sicily_con = 1
        and I_CharacterExists merc_sicily
        and I_CompareCounter savoy_dead = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_savoy 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor


    ;------ montferrat
    monitor_event FactionWarDeclared FactionType sicily
        and TargetFactionType montferrat
        and I_CompareCounter sicily_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_sicily_montferrat = 0
            historic_event war_sicily true factions { sicily, }
            set_counter war_sicily_montferrat 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and DiplomaticStanceFromFaction montferrat < AtWar
        and I_CompareCounter war_sicily_montferrat = 1
        and I_EventCounter war_sicily_accepted = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_montferrat 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and I_CompareCounter sicily_con = 1
        and I_CharacterExists merc_sicily
        and I_CompareCounter montferrat_dead = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_montferrat 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor


    ;------ bologna
    monitor_event FactionWarDeclared FactionType sicily
        and TargetFactionType timurids
        and I_CompareCounter sicily_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_sicily_bologna = 0
            historic_event war_sicily true factions { sicily, }
            set_counter war_sicily_bologna 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and DiplomaticStanceFromFaction timurids < AtWar
        and I_CompareCounter war_sicily_bologna = 1
        and I_EventCounter war_sicily_accepted = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_bologna 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and I_CompareCounter sicily_con = 1
        and I_CharacterExists merc_sicily
        and I_CompareCounter bologna_dead = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_bologna 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor


    ;------ urbino
    monitor_event FactionWarDeclared FactionType sicily
        and TargetFactionType urbino
        and I_CompareCounter sicily_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_sicily_urbino = 0
            historic_event war_sicily true factions { sicily, }
            set_counter war_sicily_urbino 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and DiplomaticStanceFromFaction urbino < AtWar
        and I_CompareCounter war_sicily_urbino = 1
        and I_EventCounter war_sicily_accepted = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_urbino 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and I_CompareCounter sicily_con = 1
        and I_CharacterExists merc_sicily
        and I_CompareCounter urbino_dead = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_urbino 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor


    ;------ lucca
    monitor_event FactionWarDeclared FactionType sicily
        and TargetFactionType lucca
        and I_CompareCounter sicily_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_sicily_lucca = 0
            historic_event war_sicily true factions { sicily, }
            set_counter war_sicily_lucca 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and DiplomaticStanceFromFaction lucca < AtWar
        and I_CompareCounter war_sicily_lucca = 1
        and I_EventCounter war_sicily_accepted = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_lucca 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and I_CompareCounter sicily_con = 1
        and I_CharacterExists merc_sicily
        and I_CompareCounter lucca_dead = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_lucca 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor


    ;------ peasants
    monitor_event FactionWarDeclared FactionType sicily
        and TargetFactionType peasants
        and I_CompareCounter sicily_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_sicily_peasants = 0
            historic_event war_sicily true factions { sicily, }
            set_counter war_sicily_peasants 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and DiplomaticStanceFromFaction peasants < AtWar
        and I_CompareCounter war_sicily_peasants = 1
        and I_EventCounter war_sicily_accepted = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_peasants 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and I_CompareCounter sicily_con = 1
        and I_CharacterExists merc_sicily
        and I_CompareCounter peasants_dead = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_peasants 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor


    ;------ hafsids
    monitor_event FactionWarDeclared FactionType sicily
        and TargetFactionType egypt
        and I_CompareCounter sicily_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_sicily_hafsids = 0
            historic_event war_sicily true factions { sicily, }
            set_counter war_sicily_hafsids 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and DiplomaticStanceFromFaction egypt < AtWar
        and I_CompareCounter war_sicily_hafsids = 1
        and I_EventCounter war_sicily_accepted = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_hafsids 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType sicily
        and I_CompareCounter sicily_con = 1
        and I_CharacterExists merc_sicily
        and I_CompareCounter hafsids_dead = 1

        historic_event war_sicily_ende true factions { sicily, }

        set_counter war_sicily_hafsids 0
        set_counter sicily_zahler 0
        set_counter sicily_con 0
    end_monitor


    ;---------------------------------------------------------------------------------
    ;------------------------------- Spanien -----------------------------------------
    ;------ Frankreich
    monitor_event FactionWarDeclared FactionType spain
        and TargetFactionType france
        and I_CompareCounter spain_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_spain_france = 0
            historic_event war_spain true factions { spain, }
            set_counter war_spain_france 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and DiplomaticStanceFromFaction france < AtWar
        and I_CompareCounter war_spain_france = 1
        and I_CompareCounter spain_con = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_france 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and I_CompareCounter spain_con = 1
        and I_CharacterExists merc_spain
        and I_CompareCounter france_dead = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_france 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor

    ;------ Schweizer
    monitor_event FactionWarDeclared FactionType spain
        and TargetFactionType saxons
        and I_CompareCounter spain_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_spain_saxons = 0
            historic_event war_spain true factions { spain, }
            set_counter war_spain_saxons 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and DiplomaticStanceFromFaction saxons < AtWar
        and I_CompareCounter war_spain_saxons = 1
        and I_CompareCounter spain_con = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_saxons 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and I_CompareCounter spain_con = 1
        and I_CharacterExists merc_spain
        and I_CompareCounter saxons_dead = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_saxons 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor

    ;------ HRE
    monitor_event FactionWarDeclared FactionType spain
        and TargetFactionType hre
        and I_CompareCounter spain_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_spain_hre = 0
            historic_event war_spain true factions { spain, }
            set_counter war_spain_hre 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and DiplomaticStanceFromFaction hre < AtWar
        and I_CompareCounter war_spain_hre = 1
        and I_CompareCounter spain_con = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_hre 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and I_CompareCounter spain_con = 1
        and I_CharacterExists merc_spain
        and I_CompareCounter hre_dead = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_hre 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor

    ;------ Mailand
    monitor_event FactionWarDeclared FactionType spain
        and TargetFactionType milan
        and I_CompareCounter spain_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_spain_milan = 0
            historic_event war_spain true factions { spain, }
            set_counter war_spain_milan 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and DiplomaticStanceFromFaction milan < AtWar
        and I_CompareCounter war_spain_milan = 1
        and I_CompareCounter spain_con = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_milan 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and I_CompareCounter spain_con = 1
        and I_CharacterExists merc_spain
        and I_CompareCounter milan_dead = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_milan 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor

    ;------ Ungarn
    monitor_event FactionWarDeclared FactionType spain
        and TargetFactionType hungary
        and I_CompareCounter spain_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_spain_hungary = 0
            historic_event war_spain true factions { spain, }
            set_counter war_spain_hungary 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and DiplomaticStanceFromFaction hungary < AtWar
        and I_CompareCounter war_spain_hungary = 1
        and I_CompareCounter spain_con = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_hungary 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and I_CompareCounter spain_con = 1
        and I_CharacterExists merc_spain
        and I_CompareCounter hungary_dead = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_hungary 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor

    ;------ Türken
    monitor_event FactionWarDeclared FactionType spain
        and TargetFactionType turks
        and I_CompareCounter spain_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_spain_turks = 0
            historic_event war_spain true factions { spain, }
            set_counter war_spain_turks 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and DiplomaticStanceFromFaction turks < AtWar
        and I_CompareCounter war_spain_turks = 1
        and I_CompareCounter spain_con = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_turks 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and I_CompareCounter spain_con = 1
        and I_CharacterExists merc_spain
        and I_CompareCounter turks_dead = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_turks 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor

    ;------ Venedig
    monitor_event FactionWarDeclared FactionType spain
        and TargetFactionType venice
        and I_CompareCounter spain_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_spain_venice = 0
            historic_event war_spain true factions { spain, }
            set_counter war_spain_venice 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and DiplomaticStanceFromFaction venice < AtWar
        and I_CompareCounter war_spain_venice = 1
        and I_CompareCounter spain_con = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_venice 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and I_CompareCounter spain_con = 1
        and I_CharacterExists merc_spain
        and I_CompareCounter venice_dead = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_venice 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor

    ;------ Florenz
    monitor_event FactionWarDeclared FactionType spain
        and TargetFactionType poland
        and I_CompareCounter spain_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_spain_poland = 0
            historic_event war_spain true factions { spain, }
            set_counter war_spain_poland 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and DiplomaticStanceFromFaction poland < AtWar
        and I_CompareCounter war_spain_poland = 1
        and I_CompareCounter spain_con = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_poland 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and I_CompareCounter spain_con = 1
        and I_CharacterExists merc_spain
        and I_CompareCounter poland_dead = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_poland 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor

    ;------ Papststaaten
    monitor_event FactionWarDeclared FactionType spain
        and TargetFactionType papal_states
        and I_CompareCounter spain_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_spain_papal_states = 0
            historic_event war_spain true factions { spain, }
            set_counter war_spain_france 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and DiplomaticStanceFromFaction papal_states < AtWar
        and I_CompareCounter war_spain_papal_states = 1
        and I_CompareCounter spain_con = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_papal_states 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and I_CompareCounter spain_con = 1
        and I_CharacterExists merc_spain
        and I_CompareCounter papal_states_dead = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_papal_states 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor

    ;------ Neapel
    monitor_event FactionWarDeclared FactionType spain
        and TargetFactionType sicily
        and I_CompareCounter spain_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_spain_sicily = 0
            historic_event war_spain true factions { spain, }
            set_counter war_spain_sicily 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and DiplomaticStanceFromFaction sicily < AtWar
        and I_CompareCounter war_spain_sicily = 1
        and I_CompareCounter spain_con = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_sicily 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and I_CompareCounter spain_con = 1
        and I_CharacterExists merc_spain
        and I_CompareCounter sicily_dead = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_sicily 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor

    ;------ Schwaben
    monitor_event FactionWarDeclared FactionType spain
        and TargetFactionType normans
        and I_CompareCounter spain_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_spain_normans = 0
            historic_event war_spain true factions { spain, }
            set_counter war_spain_normans 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and DiplomaticStanceFromFaction normans < AtWar
        and I_CompareCounter war_spain_normans = 1
        and I_CompareCounter spain_con = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_normans 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and I_CompareCounter spain_con = 1
        and I_CharacterExists merc_spain
        and I_CompareCounter normans_dead = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_normans 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor

    ;------ savoy
    monitor_event FactionWarDeclared FactionType spain
        and TargetFactionType savoy
        and I_CompareCounter spain_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_spain_savoy = 0
            historic_event war_spain true factions { spain, }
            set_counter war_spain_savoy 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and DiplomaticStanceFromFaction savoy < AtWar
        and I_CompareCounter war_spain_savoy = 1
        and I_EventCounter war_spain_accepted = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_savoy 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and I_CompareCounter spain_con = 1
        and I_CharacterExists merc_spain
        and I_CompareCounter savoy_dead = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_savoy 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor


    ;------ montferrat
    monitor_event FactionWarDeclared FactionType spain
        and TargetFactionType montferrat
        and I_CompareCounter spain_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_spain_montferrat = 0
            historic_event war_spain true factions { spain, }
            set_counter war_spain_montferrat 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and DiplomaticStanceFromFaction montferrat < AtWar
        and I_CompareCounter war_spain_montferrat = 1
        and I_EventCounter war_spain_accepted = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_montferrat 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and I_CompareCounter spain_con = 1
        and I_CharacterExists merc_spain
        and I_CompareCounter montferrat_dead = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_montferrat 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor


    ;------ bologna
    monitor_event FactionWarDeclared FactionType spain
        and TargetFactionType timurids
        and I_CompareCounter spain_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_spain_bologna = 0
            historic_event war_spain true factions { spain, }
            set_counter war_spain_bologna 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and DiplomaticStanceFromFaction timurids < AtWar
        and I_CompareCounter war_spain_bologna = 1
        and I_EventCounter war_spain_accepted = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_bologna 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and I_CompareCounter spain_con = 1
        and I_CharacterExists merc_spain
        and I_CompareCounter bologna_dead = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_bologna 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor


    ;------ urbino
    monitor_event FactionWarDeclared FactionType spain
        and TargetFactionType urbino
        and I_CompareCounter spain_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_spain_urbino = 0
            historic_event war_spain true factions { spain, }
            set_counter war_spain_urbino 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and DiplomaticStanceFromFaction urbino < AtWar
        and I_CompareCounter war_spain_urbino = 1
        and I_EventCounter war_spain_accepted = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_urbino 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and I_CompareCounter spain_con = 1
        and I_CharacterExists merc_spain
        and I_CompareCounter urbino_dead = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_urbino 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor


    ;------ lucca
    monitor_event FactionWarDeclared FactionType spain
        and TargetFactionType lucca
        and I_CompareCounter spain_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_spain_lucca = 0
            historic_event war_spain true factions { spain, }
            set_counter war_spain_lucca 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and DiplomaticStanceFromFaction lucca < AtWar
        and I_CompareCounter war_spain_lucca = 1
        and I_EventCounter war_spain_accepted = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_lucca 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and I_CompareCounter spain_con = 1
        and I_CharacterExists merc_spain
        and I_CompareCounter lucca_dead = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_lucca 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor


    ;------ peasants
    monitor_event FactionWarDeclared FactionType spain
        and TargetFactionType peasants
        and I_CompareCounter spain_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_spain_peasants = 0
            historic_event war_spain true factions { spain, }
            set_counter war_spain_peasants 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and DiplomaticStanceFromFaction peasants < AtWar
        and I_CompareCounter war_spain_peasants = 1
        and I_EventCounter war_spain_accepted = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_peasants 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and I_CompareCounter spain_con = 1
        and I_CharacterExists merc_spain
        and I_CompareCounter peasants_dead = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_peasants 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor


    ;------ hafsids
    monitor_event FactionWarDeclared FactionType spain
        and TargetFactionType egypt
        and I_CompareCounter spain_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_spain_hafsids = 0
            historic_event war_spain true factions { spain, }
            set_counter war_spain_hafsids 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and DiplomaticStanceFromFaction egypt < AtWar
        and I_CompareCounter war_spain_hafsids = 1
        and I_EventCounter war_spain_accepted = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_hafsids 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType spain
        and I_CompareCounter spain_con = 1
        and I_CharacterExists merc_spain
        and I_CompareCounter hafsids_dead = 1

        historic_event war_spain_ende true factions { spain, }

        set_counter war_spain_hafsids 0
        set_counter spain_zahler 0
        set_counter spain_con 0
    end_monitor


    ;---------------------------------------------------------------------------------
    ;------------------------------- Schwaben ----------------------------------------
    ;------ Frankreich
    monitor_event FactionWarDeclared FactionType normans
        and TargetFactionType france
        and I_CompareCounter normans_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_normans_france = 0
            historic_event war_normans true factions { normans, }
            set_counter war_normans_france 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and DiplomaticStanceFromFaction france < AtWar
        and I_CompareCounter war_normans_france = 1
        and I_CompareCounter normans_con = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_france 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and I_CompareCounter normans_con = 1
        and I_CharacterExists merc_normans
        and I_CompareCounter france_dead = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_france 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor

    ;------ Schweizer
    monitor_event FactionWarDeclared FactionType normans
        and TargetFactionType saxons
        and I_CompareCounter normans_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_normans_saxons = 0
            historic_event war_normans true factions { normans, }
            set_counter war_normans_saxons 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and DiplomaticStanceFromFaction saxons < AtWar
        and I_CompareCounter war_normans_saxons = 1
        and I_CompareCounter normans_con = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_saxons 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and I_CompareCounter normans_con = 1
        and I_CharacterExists merc_normans
        and I_CompareCounter saxons_dead = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_saxons 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor

    ;------ HRR
    monitor_event FactionWarDeclared FactionType normans
        and TargetFactionType hre
        and I_CompareCounter normans_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_normans_hre = 0
            historic_event war_normans true factions { normans, }
            set_counter war_normans_hre 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and DiplomaticStanceFromFaction hre < AtWar
        and I_CompareCounter war_normans_hre = 1
        and I_CompareCounter normans_con = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_hre 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and I_CompareCounter normans_con = 1
        and I_CharacterExists merc_normans
        and I_CompareCounter hre_dead = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_hre 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor

    ;------ Ungarn
    monitor_event FactionWarDeclared FactionType normans
        and TargetFactionType hungary
        and I_CompareCounter normans_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_normans_hungary = 0
            historic_event war_normans true factions { normans, }
            set_counter war_normans_hungary 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and DiplomaticStanceFromFaction hungary < AtWar
        and I_CompareCounter war_normans_hungary = 1
        and I_CompareCounter normans_con = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_hungary 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and I_CompareCounter normans_con = 1
        and I_CharacterExists merc_normans
        and I_CompareCounter hungary_dead = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_hungary 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor

    ;------ Türken
    monitor_event FactionWarDeclared FactionType normans
        and TargetFactionType turks
        and I_CompareCounter normans_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_normans_turks = 0
            historic_event war_normans true factions { normans, }
            set_counter war_normans_turks 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and DiplomaticStanceFromFaction turks < AtWar
        and I_CompareCounter war_normans_turks = 1
        and I_CompareCounter normans_con = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_turks 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and I_CompareCounter normans_con = 1
        and I_CharacterExists merc_normans
        and I_CompareCounter turks_dead = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_turks 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor

    ;------ Mailand
    monitor_event FactionWarDeclared FactionType normans
        and TargetFactionType milan
        and I_CompareCounter normans_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_normans_milan = 0
            historic_event war_normans true factions { normans, }
            set_counter war_normans_milan 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and DiplomaticStanceFromFaction milan < AtWar
        and I_CompareCounter war_normans_milan = 1
        and I_CompareCounter normans_con = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_milan 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and I_CompareCounter normans_con = 1
        and I_CharacterExists merc_normans
        and I_CompareCounter milan_dead = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_milan 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor

    ;------ Venedig
    monitor_event FactionWarDeclared FactionType normans
        and TargetFactionType venice
        and I_CompareCounter normans_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_normans_venice = 0
            historic_event war_normans true factions { normans, }
            set_counter war_normans_venice 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and DiplomaticStanceFromFaction venice < AtWar
        and I_CompareCounter war_normans_venice = 1
        and I_CompareCounter normans_con = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_venice 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and I_CompareCounter normans_con = 1
        and I_CharacterExists merc_normans
        and I_CompareCounter venice_dead = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_venice 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor

    ;------ Florenz
    monitor_event FactionWarDeclared FactionType normans
        and TargetFactionType poland
        and I_CompareCounter normans_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_normans_poland = 0
            historic_event war_normans true factions { normans, }
            set_counter war_normans_poland 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and DiplomaticStanceFromFaction poland < AtWar
        and I_CompareCounter war_normans_poland = 1
        and I_CompareCounter normans_con = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_poland 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and I_CompareCounter normans_con = 1
        and I_CharacterExists merc_normans
        and I_CompareCounter poland_dead = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_poland 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor

    ;------ Papststaaten
    monitor_event FactionWarDeclared FactionType normans
        and TargetFactionType papal_states
        and I_CompareCounter normans_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_normans_papal_states = 0
            historic_event war_normans true factions { normans, }
            set_counter war_normans_papal_states 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and DiplomaticStanceFromFaction papal_states < AtWar
        and I_CompareCounter war_normans_papal_states = 1
        and I_CompareCounter normans_con = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_papal_states 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and I_CompareCounter normans_con = 1
        and I_CharacterExists merc_normans
        and I_CompareCounter papal_states_dead = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_papal_states 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor

    ;------ Neapel
    monitor_event FactionWarDeclared FactionType normans
        and TargetFactionType sicily
        and I_CompareCounter normans_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_normans_sicily = 0
            historic_event war_normans true factions { normans, }
            set_counter war_normans_sicily 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and DiplomaticStanceFromFaction sicily < AtWar
        and I_CompareCounter war_normans_sicily = 1
        and I_CompareCounter normans_con = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_sicily 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and I_CompareCounter normans_con = 1
        and I_CharacterExists merc_normans
        and I_CompareCounter sicily_dead = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_sicily 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor

    ;------ Spanien
    monitor_event FactionWarDeclared FactionType normans
        and TargetFactionType spain
        and I_CompareCounter normans_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_normans_spain = 0
            historic_event war_normans true factions { normans, }
            set_counter war_normans_spain 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and DiplomaticStanceFromFaction spain < AtWar
        and I_CompareCounter war_normans_spain = 1
        and I_CompareCounter normans_con = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_spain 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and I_CompareCounter normans_con = 1
        and I_CharacterExists merc_normans
        and I_CompareCounter spain_dead = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_spain 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor

    ;------ savoy
    monitor_event FactionWarDeclared FactionType normans
        and TargetFactionType savoy
        and I_CompareCounter normans_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_normans_savoy = 0
            historic_event war_normans true factions { normans, }
            set_counter war_normans_savoy 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and DiplomaticStanceFromFaction savoy < AtWar
        and I_CompareCounter war_normans_savoy = 1
        and I_EventCounter war_normans_accepted = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_savoy 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and I_CompareCounter normans_con = 1
        and I_CharacterExists merc_normans
        and I_CompareCounter savoy_dead = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_savoy 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor


    ;------ montferrat
    monitor_event FactionWarDeclared FactionType normans
        and TargetFactionType montferrat
        and I_CompareCounter normans_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_normans_montferrat = 0
            historic_event war_normans true factions { normans, }
            set_counter war_normans_montferrat 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and DiplomaticStanceFromFaction montferrat < AtWar
        and I_CompareCounter war_normans_montferrat = 1
        and I_EventCounter war_normans_accepted = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_montferrat 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and I_CompareCounter normans_con = 1
        and I_CharacterExists merc_normans
        and I_CompareCounter montferrat_dead = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_montferrat 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor


    ;------ bologna
    monitor_event FactionWarDeclared FactionType normans
        and TargetFactionType timurids
        and I_CompareCounter normans_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_normans_bologna = 0
            historic_event war_normans true factions { normans, }
            set_counter war_normans_bologna 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and DiplomaticStanceFromFaction timurids < AtWar
        and I_CompareCounter war_normans_bologna = 1
        and I_EventCounter war_normans_accepted = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_bologna 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and I_CompareCounter normans_con = 1
        and I_CharacterExists merc_normans
        and I_CompareCounter bologna_dead = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_bologna 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor


    ;------ urbino
    monitor_event FactionWarDeclared FactionType normans
        and TargetFactionType urbino
        and I_CompareCounter normans_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_normans_urbino = 0
            historic_event war_normans true factions { normans, }
            set_counter war_normans_urbino 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and DiplomaticStanceFromFaction urbino < AtWar
        and I_CompareCounter war_normans_urbino = 1
        and I_EventCounter war_normans_accepted = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_urbino 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and I_CompareCounter normans_con = 1
        and I_CharacterExists merc_normans
        and I_CompareCounter urbino_dead = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_urbino 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor


    ;------ lucca
    monitor_event FactionWarDeclared FactionType normans
        and TargetFactionType lucca
        and I_CompareCounter normans_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_normans_lucca = 0
            historic_event war_normans true factions { normans, }
            set_counter war_normans_lucca 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and DiplomaticStanceFromFaction lucca < AtWar
        and I_CompareCounter war_normans_lucca = 1
        and I_EventCounter war_normans_accepted = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_lucca 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and I_CompareCounter normans_con = 1
        and I_CharacterExists merc_normans
        and I_CompareCounter lucca_dead = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_lucca 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor


    ;------ peasants
    monitor_event FactionWarDeclared FactionType normans
        and TargetFactionType peasants
        and I_CompareCounter normans_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_normans_peasants = 0
            historic_event war_normans true factions { normans, }
            set_counter war_normans_peasants 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and DiplomaticStanceFromFaction peasants < AtWar
        and I_CompareCounter war_normans_peasants = 1
        and I_EventCounter war_normans_accepted = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_peasants 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and I_CompareCounter normans_con = 1
        and I_CharacterExists merc_normans
        and I_CompareCounter peasants_dead = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_peasants 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor


    ;------ hafsids
    monitor_event FactionWarDeclared FactionType normans
        and TargetFactionType egypt
        and I_CompareCounter normans_zahler < 1 

        generate_random_counter	random_war 1 2

        if I_EventCounter random_war < 2
            and I_CompareCounter war_normans_hafsids = 0
            historic_event war_normans true factions { normans, }
            set_counter war_normans_hafsids 1

        end_if
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and DiplomaticStanceFromFaction egypt < AtWar
        and I_CompareCounter war_normans_hafsids = 1
        and I_EventCounter war_normans_accepted = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_hafsids 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType normans
        and I_CompareCounter normans_con = 1
        and I_CharacterExists merc_normans
        and I_CompareCounter hafsids_dead = 1

        historic_event war_normans_ende true factions { normans, }

        set_counter war_normans_hafsids 0
        set_counter normans_zahler 0
        set_counter normans_con 0
    end_monitor


    ;------------------------------------------------------------------------------
    ;------------------------------ Söldnerverbände -------------------------------
    ;------------------------------------------------------------------------------

    ;------------------------------ Existenz prüfen -------------------------------

    monitor_event FactionTurnStart I_TurnNumber > 1

        ;------------------------------ Existenz Verbände
        ;----- Spanien
        if I_CompareCounter spain_con = 1
            and not I_CharacterExists merc_spain

            set_counter spain_con 0
            set_counter Spain_zahler 0

            historic_event vertrag factions { spain, }

            destroy_units spain S Mercenary Arquebusiers
            destroy_units spain S Flemish Pikemen Mercs
            destroy_units spain S Condottieri

        end_if

        ;----- Frankreich
        if I_CompareCounter france_con = 1
            and not I_CharacterExists merc_france

            set_counter france_con 0
            set_counter france_zahler 0

            historic_event vertrag factions { france, }

            destroy_units france Prussian Archers
            destroy_units france S Chivalric Knights
            destroy_units france S Dismounted Mercenary German Knights

        end_if

        ;----- Mailand
        if I_CompareCounter milan_con = 1
            and not I_CharacterExists merc_milan

            set_counter milan_con 0
            set_counter milan_zahler 0

            historic_event vertrag factions { milan, }

            destroy_units milan S Mercenary Arquebusiers
            destroy_units milan S Flemish Pikemen Mercs
            destroy_units milan S Condottieri

        end_if

        ;----- Venedig
        if I_CompareCounter venice_con = 1
            and not I_CharacterExists merc_venice

            set_counter venice_con 0
            set_counter venice_zahler 0

            historic_event vertrag factions { venice, }

            destroy_units venice S Mercenary Arquebusiers
            destroy_units venice S Flemish Pikemen Mercs
            destroy_units venice S Condottieri

        end_if

        ;----- HRE
        if I_CompareCounter hre_con = 1
            and not I_CharacterExists merc_hre

            set_counter hre_con 0
            set_counter hre_zahler 0

            historic_event vertrag factions { hre, }

            destroy_units hre Doppelsoldner
            destroy_units hre S Landschneckt Pikemen

        end_if

        ;----- Ungarn
        if I_CompareCounter hungary_con = 1
            and not I_CharacterExists merc_hungary

            set_counter hungary_con 0
            set_counter hungary_zahler 0

            historic_event vertrag factions { hungary, }

            destroy_units hungary S Albanian Cavalry
            destroy_units hungary S Serbian Hussars
            destroy_units hungary Balkan Archers

        end_if

        ;----- Türken
        if I_CompareCounter turks_con = 1
            and not I_CharacterExists merc_turks

            set_counter turks_con 0
            set_counter turks_zahler 0

            historic_event vertrag factions { turks, }

            destroy_units turks Boyar Sons Spain
            destroy_units turks Cossack Musketeers Serbien
            destroy_units turks Battlefield Assassins Serbien

        end_if

        ;----- Florenz
        if I_CompareCounter poland_con = 1
            and not I_CharacterExists merc_poland

            set_counter poland_con 0
            set_counter poland_zahler 0

            historic_event vertrag factions { poland, }

            destroy_units poland S Mercenary Arquebusiers
            destroy_units poland S Flemish Pikemen Mercs
            destroy_units poland S Condottieri

        end_if

        ;----- Papststaaten
        if I_CompareCounter papal_states_con = 1
            and not I_CharacterExists merc_papal_states

            set_counter papal_states_con 0
            set_counter papal_states_zahler 0

            historic_event vertrag factions { papal_states, }

            destroy_units papal_states S Mercenary Arquebusiers
            destroy_units papal_states S Flemish Pikemen Mercs
            destroy_units papal_states S Condottieri

        end_if

        ;----- Neapel
        if I_CompareCounter sicily_con = 1
            and not I_CharacterExists merc_sicily

            set_counter sicily_con 0
            set_counter sicily_zahler 0

            historic_event vertrag factions { sicily, }

            destroy_units sicily S Mercenary Arquebusiers
            destroy_units sicily S Flemish Pikemen Mercs
            destroy_units sicily S Condottieri

        end_if

        ;----- Schwaben
        if I_CompareCounter normans_con = 1
            and not I_CharacterExists merc_normans

            set_counter normans_con 0
            set_counter normans_zahler 0

            historic_event vertrag factions { normans, }

            destroy_units normans Doppelsoldner
            destroy_units normans S Landschneckt Pikemen

        end_if

    end_monitor

    ;------------------------------ Spanien JA ANFANG -----------------------------
    monitor_event EventCounter EventCounterType war_spain_accepted = 1
        historic_event war_spain_yes
        console_command add_money -6000, spain

        spawn_army 
            faction spain
            character	random_name, named character, age 36, x 124, y 51, label merc_spain
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 6
            unit		SE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		S Condottieri			exp 2 armour 0 weapon_lvl 0
            unit		S Condottieri			exp 2 armour 0 weapon_lvl 0
            unit		S Flemish Pikemen Mercs		exp 2 armour 0 weapon_lvl 0
            unit		S Flemish Pikemen Mercs		exp 2 armour 0 weapon_lvl 0
            unit		S Mercenary Arquebusiers	exp 1 armour 0 weapon_lvl 0
            unit		S Mercenary Arquebusiers	exp 1 armour 0 weapon_lvl 0
        end


        wait 1.0
        snap_strat_camera 124, 61
        zoom_strat_camera 0.1

        set_counter spain_zahler 1
        set_counter spain_con 1
        set_event_counter war_spain_accepted 0
    end_monitor


    ;----------------------------- Spanien Nein ANFANG ----------------------------
    monitor_event EventCounter EventCounterType war_spain_declined = 1
        historic_event war_spain_no

        spawn_army 
            faction slave
            character	Francisco, named character, age 36, x 124, y 51
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 6
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 1 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 0 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 0 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Ribault		exp 2 armour 0 weapon_lvl 0			
        end


        wait 1.0
        snap_strat_camera 124, 61
        zoom_strat_camera 0.1

        set_counter spain_zahler 0
        set_event_counter war_spain_declined 0
    end_monitor

    ;------------------------------ Spanien JA ENDE -------------------------------
    monitor_event EventCounter EventCounterType war_spain_ende_accepted = 1
        historic_event war_spain_ende_yes 

        console_command add_money -1500, spain

        destroy_units spain S Mercenary Arquebusiers
        destroy_units spain S Flemish Pikemen Mercs
        destroy_units spain S Condottieri
        kill_character merc_spain

        set_event_counter war_spain_ende_accepted 0
    end_monitor

    ;----------------------------- Spanien Nein ENDE -------------------------------
    monitor_event EventCounter EventCounterType war_spain_ende_declined = 1
        historic_event war_spain_ende_no

        destroy_units spain S Mercenary Arquebusiers
        destroy_units spain S Flemish Pikemen Mercs
        destroy_units spain S Condottieri
        kill_character merc_spain

        wait 1.0

        spawn_army 
            faction slave
            character	Francisco, named character, age 36, x 124, y 51
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 5
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 1 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 0 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 0 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Ribault		exp 2 armour 0 weapon_lvl 0
        end

        wait 1.0
        snap_strat_camera 124, 51
        zoom_strat_camera 0.1

        set_event_counter war_spain_ende_declined 0
    end_monitor

    ;------------------------------ Neapel JA ANFANG ------------------------------
    monitor_event EventCounter EventCounterType war_sicily_accepted = 1
        historic_event war_sicily_yes
        console_command add_money -6000, sicily

        spawn_army 
            faction sicily
            character	random_name, named character, age 36, x 139, y 115, label merc_sicily
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 1
            unit		SE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		S Condottieri			exp 2 armour 0 weapon_lvl 0
            unit		S Condottieri			exp 2 armour 0 weapon_lvl 0
            unit		S Flemish Pikemen Mercs		exp 2 armour 0 weapon_lvl 0
            unit		S Flemish Pikemen Mercs		exp 2 armour 0 weapon_lvl 0
            unit		S Mercenary Arquebusiers	exp 1 armour 0 weapon_lvl 0
            unit		S Mercenary Arquebusiers	exp 1 armour 0 weapon_lvl 0
        end


        wait 1.0
        snap_strat_camera 139, 125
        zoom_strat_camera 0.1

        set_counter sicily_zahler 1
        set_counter sicily_con 1
        set_event_counter war_sicily_accepted 0
    end_monitor


    ;----------------------------- Neapel Nein ANFANG -----------------------------
    monitor_event EventCounter EventCounterType war_sicily_declined = 1
        historic_event war_sicily_no

        spawn_army 
            faction slave
            character	Papero, named character, age 36, x 139, y 115
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 1
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 1 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 0 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 0 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Ribault		exp 2 armour 0 weapon_lvl 0			
        end


        wait 1.0
        snap_strat_camera 139, 115
        zoom_strat_camera 0.1

        set_counter sicily_zahler 0
        set_event_counter war_sicily_declined 0
    end_monitor

    ;------------------------------ Neapel JA ENDE --------------------------
    monitor_event EventCounter EventCounterType war_sicily_ende_accepted = 1
        historic_event war_sicily_ende_yes 

        console_command add_money -1500, sicily

        destroy_units sicily S Mercenary Arquebusiers
        destroy_units sicily S Flemish Pikemen Mercs
        destroy_units sicily S Condottieri

        kill_character merc_sicily

        set_event_counter war_sicily_accepted 0
    end_monitor

    ;----------------------------- Neapel Nein ENDE -------------------------
    monitor_event EventCounter EventCounterType war_sicily_ende_declined = 1
        historic_event war_sicily_ende_no

        destroy_units sicily S Mercenary Arquebusiers
        destroy_units sicily S Flemish Pikemen Mercs
        destroy_units sicily S Condottieri
        kill_character merc_sicily

        wait 1.0

        spawn_army 
            faction slave
            character	Papero, named character, age 36, x 139, y 115
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 1
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 1 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 0 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 0 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Ribault		exp 2 armour 0 weapon_lvl 0
        end

        wait 1.0
        snap_strat_camera 93, 85
        zoom_strat_camera 0.1

        set_event_counter war_sicily_ende_declined 0
    end_monitor

    ;------------------------------ Papststaaten JA ANFANG ------------------------
    monitor_event EventCounter EventCounterType war_papal_states_accepted = 1
        historic_event war_papal_states_yes
        console_command add_money -6000, papal_states

        spawn_army 
            faction papal_states
            character	random_name, named character, age 36, x 120, y 127, label merc_papal_states
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 1
            unit		SE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		S Condottieri			exp 2 armour 0 weapon_lvl 0
            unit		S Condottieri			exp 2 armour 0 weapon_lvl 0
            unit		S Flemish Pikemen Mercs		exp 2 armour 0 weapon_lvl 0
            unit		S Flemish Pikemen Mercs		exp 2 armour 0 weapon_lvl 0
            unit		S Mercenary Arquebusiers	exp 1 armour 0 weapon_lvl 0
            unit		S Mercenary Arquebusiers	exp 1 armour 0 weapon_lvl 0
        end


        wait 1.0
        snap_strat_camera 120, 137
        zoom_strat_camera 0.1

        set_counter papal_states_zahler 1
        set_counter papal_states_con 1
        set_event_counter war_papal_states_accepted 0
    end_monitor


    ;----------------------------- Papststaaten Nein ANFANG -----------------------
    monitor_event EventCounter EventCounterType war_papal_states_declined = 1
        historic_event war_papal_states_no

        spawn_army 
            faction slave
            character	Giannis, named character, age 36, x 120, y 127
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 1
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 1 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 0 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 0 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Ribault		exp 2 armour 0 weapon_lvl 0			
        end


        wait 1.0
        snap_strat_camera 120, 137
        zoom_strat_camera 0.1

        set_counter papal_states_zahler 0
        set_event_counter war_papal_states_declined 0
    end_monitor

    ;------------------------------ Papststaaten JA ENDE --------------------------
    monitor_event EventCounter EventCounterType war_papal_states_ende_accepted = 1
        historic_event war_papal_states_ende_yes 

        console_command add_money -1500, papal_states

        destroy_units papal_states S Mercenary Arquebusiers
        destroy_units papal_states S Flemish Pikemen Mercs
        destroy_units papal_states S Condottieri

        kill_character merc_papal_states

        set_event_counter war_papal_states_accepted 0
    end_monitor

    ;----------------------------- Papststaaten Nein ENDE -------------------------
    monitor_event EventCounter EventCounterType war_papal_states_ende_declined = 1
        historic_event war_papal_states_ende_no

        destroy_units papal_states S Mercenary Arquebusiers
        destroy_units papal_states S Flemish Pikemen Mercs
        destroy_units papal_states S Condottieri
        kill_character merc_papal_states

        wait 1.0

        spawn_army 
            faction slave
            character	Giannis, named character, age 36, x 120, y 127
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 1
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 1 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 0 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 0 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Ribault		exp 2 armour 0 weapon_lvl 0
        end

        wait 1.0
        snap_strat_camera 120, 137
        zoom_strat_camera 0.1

        set_event_counter war_papal_states_ende_declined 0
    end_monitor

    ;------------------------------ Florenz JA ANFANG -----------------------------
    monitor_event EventCounter EventCounterType war_poland_accepted = 1
        historic_event war_poland_yes
        console_command add_money -6000, poland

        spawn_army 
            faction poland
            character	random_name, named character, age 36, x 97, y 171, label merc_poland
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 1
            unit		SE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		S Condottieri			exp 2 armour 0 weapon_lvl 0
            unit		S Condottieri			exp 2 armour 0 weapon_lvl 0
            unit		S Flemish Pikemen Mercs		exp 2 armour 0 weapon_lvl 0
            unit		S Flemish Pikemen Mercs		exp 2 armour 0 weapon_lvl 0
            unit		S Mercenary Arquebusiers	exp 1 armour 0 weapon_lvl 0
            unit		S Mercenary Arquebusiers	exp 1 armour 0 weapon_lvl 0
        end


        wait 1.0
        snap_strat_camera 97, 181
        zoom_strat_camera 0.1

        set_counter poland_zahler 1
        set_counter poland_con 1
        set_event_counter war_poland_accepted 0
    end_monitor


    ;----------------------------- Florenz Nein ANFANG ----------------------------
    monitor_event EventCounter EventCounterType war_poland_declined = 1
        historic_event war_poland_no

        spawn_army 
            faction slave
            character	Migianino, named character, age 36, x 97, y 171
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 1
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 1 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 0 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 0 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Ribault		exp 2 armour 0 weapon_lvl 0			
        end


        wait 1.0
        snap_strat_camera 97, 181
        zoom_strat_camera 0.1

        set_counter poland_zahler 0
        set_event_counter war_poland_declined 0
    end_monitor

    ;------------------------------ Florenz JA ENDE -------------------------------
    monitor_event EventCounter EventCounterType war_poland_ende_accepted = 1
        historic_event war_poland_ende_yes 

        console_command add_money -1500, poland

        destroy_units poland S Mercenary Arquebusiers
        destroy_units poland S Flemish Pikemen Mercs
        destroy_units poland S Condottieri

        kill_character merc_poland

        set_event_counter war_poland_accepted 0
    end_monitor

    ;----------------------------- Florenz Nein ENDE ------------------------------
    monitor_event EventCounter EventCounterType war_poland_ende_declined = 1
        historic_event war_poland_ende_no

        destroy_units poland S Mercenary Arquebusiers
        destroy_units poland S Flemish Pikemen Mercs
        destroy_units poland S Condottieri
        kill_character merc_poland

        wait 1.0

        spawn_army 
            faction slave
            character	Migianino, named character, age 36, x 97, y 171
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 1
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 1 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 0 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 0 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Ribault		exp 2 armour 0 weapon_lvl 0
        end

        wait 1.0
        snap_strat_camera 97, 171
        zoom_strat_camera 0.1

        set_event_counter war_poland_ende_declined 0
    end_monitor

    ;------------------------------ Venedig JA ANFANG -----------------------------
    monitor_event EventCounter EventCounterType war_venice_accepted = 1
        historic_event war_venice_yes
        console_command add_money -6000, venice

        spawn_army 
            faction venice
            character	random_name, named character, age 36, x 120, y 212, label merc_venice
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 1
            unit		SE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		S Condottieri			exp 2 armour 0 weapon_lvl 0
            unit		S Condottieri			exp 2 armour 0 weapon_lvl 0
            unit		S Flemish Pikemen Mercs		exp 2 armour 0 weapon_lvl 0
            unit		S Flemish Pikemen Mercs		exp 2 armour 0 weapon_lvl 0
            unit		S Mercenary Arquebusiers	exp 1 armour 0 weapon_lvl 0
            unit		S Mercenary Arquebusiers	exp 1 armour 0 weapon_lvl 0
        end


        wait 1.0
        snap_strat_camera 120, 222
        zoom_strat_camera 0.1

        set_counter venice_zahler 1
        set_counter venice_con 1
        set_event_counter war_venice_accepted 0
    end_monitor


    ;----------------------------- Venedig Nein ANFANG ----------------------------
    monitor_event EventCounter EventCounterType war_venice_declined = 1
        historic_event war_venice_no

        spawn_army 
            faction slave
            character	Bernardo, named character, age 36, x 120, y 212
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 1
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 1 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 0 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 0 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Ribault		exp 2 armour 0 weapon_lvl 0			
        end


        wait 1.0
        snap_strat_camera 120, 222
        zoom_strat_camera 0.1

        set_counter venice_zahler 0
        set_event_counter war_venice_declined 0
    end_monitor

    ;------------------------------ Venedig JA ENDE -------------------------------
    monitor_event EventCounter EventCounterType war_venice_ende_accepted = 1
        historic_event war_venice_ende_yes 

        console_command add_money -1500, venice

        destroy_units venice S Mercenary Arquebusiers
        destroy_units venice S Flemish Pikemen Mercs
        destroy_units venice S Condottieri

        kill_character merc_venice

        set_event_counter war_venice_accepted 0
    end_monitor

    ;----------------------------- Venedig Nein ENDE ------------------------------
    monitor_event EventCounter EventCounterType war_venice_ende_declined = 1
        historic_event war_venice_ende_no

        destroy_units venice S Mercenary Arquebusiers
        destroy_units venice S Flemish Pikemen Mercs
        destroy_units venice S Condottieri
        kill_character label merc_venice

        wait 1.0

        spawn_army 
            faction slave
            character	Guadagno, named character, age 36, x 120, y 212
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 1
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 1 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 0 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 0 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Ribault		exp 2 armour 0 weapon_lvl 0
        end

        wait 1.0
        snap_strat_camera 120, 222
        zoom_strat_camera 0.1

        set_event_counter war_venice_ende_declined 0
    end_monitor

    ;------------------------------ Türken JA ANFANG ------------------------------
    monitor_event EventCounter EventCounterType war_turks_accepted = 1
        historic_event war_turks_yes
        console_command add_money -6000, turks

        spawn_army 
            faction turks
            character	random_name, named character, age 36, x 208, y 182, label merc_turks
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 5
            unit		ME Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Battlefield Assassins Serbien	exp 2 armour 0 weapon_lvl 0
            unit		Battlefield Assassins Serbien	exp 2 armour 0 weapon_lvl 0
            unit		Cossack Musketeers Serbien	exp 1 armour 0 weapon_lvl 0
            unit		Cossack Musketeers Serbien	exp 1 armour 0 weapon_lvl 0
            unit		Boyar Sons Spain		exp 1 armour 0 weapon_lvl 0
            unit		Boyar Sons Spain		exp 1 armour 0 weapon_lvl 0
        end


        wait 1.0
        snap_strat_camera 208, 192
        zoom_strat_camera 0.1

        set_counter turks_zahler 1
        set_counter turks_con 1
        set_event_counter war_turks_accepted 0
    end_monitor


    ;----------------------------- Türken Nein ANFANG -----------------------------
    monitor_event EventCounter EventCounterType war_turks_declined = 1
        historic_event war_turks_no

        spawn_army 
            faction slave
            character	Gyorgy, named character, age 36, x 208, y 182
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 5
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Flemish Pikemen 		exp 1 armour 0 weapon_lvl 0
            unit		Magyar Cavalry 			exp 0 armour 0 weapon_lvl 0
            unit		Magyar Cavalry 			exp 0 armour 0 weapon_lvl 0
            unit		Pavise Crossbow Militia  	exp 2 armour 0 weapon_lvl 0
            unit		Pavise Crossbow Militia  	exp 2 armour 0 weapon_lvl 0
            unit		Flemish Pikemen			exp 2 armour 0 weapon_lvl 0
        end


        wait 1.0
        snap_strat_camera 208, 192
        zoom_strat_camera 0.1

        set_counter turks_zahler 0
        set_event_counter war_turks_declined 0
    end_monitor

    ;------------------------------ Türken JA ENDE --------------------------------
    monitor_event EventCounter EventCounterType war_turks_ende_accepted = 1
        historic_event war_turks_ende_yes 

        console_command add_money -1500, turks

        destroy_units turks Boyar Sons Spain
        destroy_units turks Cossack Musketeers Serbien
        destroy_units turks Battlefield Assassins Serbien

        kill_character merc_turks

        set_event_counter war_turks_ende_accepted 0
    end_monitor

    ;----------------------------- Türken Nein ENDE -------------------------------
    monitor_event EventCounter EventCounterType war_turks_ende_declined = 1
        historic_event war_turks_ende_no

        destroy_units turks Boyar Sons Spain
        destroy_units turks Cossack Musketeers Serbien
        destroy_units turks Battlefield Assassins Serbien

        kill_character merc_turks

        wait 1.0

        spawn_army 
            faction slave
            character	Gyorgy, named character, age 36, x 208, y 182
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 5
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Flemish Pikemen 		exp 1 armour 0 weapon_lvl 0
            unit		Magyar Cavalry 			exp 0 armour 0 weapon_lvl 0
            unit		Magyar Cavalry 			exp 0 armour 0 weapon_lvl 0
            unit		Pavise Crossbow Militia  	exp 2 armour 0 weapon_lvl 0
            unit		Pavise Crossbow Militia  	exp 2 armour 0 weapon_lvl 0
            unit		Flemish Pikemen			exp 2 armour 0 weapon_lvl 0
        end

        wait 1.0
        snap_strat_camera 208, 192
        zoom_strat_camera 0.1

        set_event_counter war_turks_ende_declined 0
    end_monitor

    ;------------------------------ Ungarn JA ANFANG ------------------------------
    monitor_event EventCounter EventCounterType war_hungary_accepted = 1
        historic_event war_hungary_yes
        console_command add_money -6000, hungary

        spawn_army 
            faction hungary
            character	random_name, named character, age 36, x 214, y 258, label merc_hungary
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 4
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		S Serbian Hussars		exp 1 armour 0 weapon_lvl 0
            unit		S Serbian Hussars		exp 1 armour 0 weapon_lvl 0
            unit		S Albanian Cavalry		exp 2 armour 0 weapon_lvl 0
            unit		S Albanian Cavalry		exp 2 armour 0 weapon_lvl 0
            unit		Balkan Archers			exp 2 armour 0 weapon_lvl 0
            unit		Balkan Archers			exp 2 armour 0 weapon_lvl 0
        end


        wait 1.0
        snap_strat_camera 214, 268
        zoom_strat_camera 0.1

        set_counter hungary_zahler 1
        set_counter hungary_con 1
        set_event_counter war_hungary_accepted 0
    end_monitor


    ;----------------------------- Ungarn Nein ANFANG -----------------------------
    monitor_event EventCounter EventCounterType war_hungary_declined = 1
        historic_event war_hungary_no

        spawn_army 
            faction slave
            character	Vlad, named character, age 36, x 214, y 258
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 4
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Flemish Pikemen 		exp 1 armour 0 weapon_lvl 0
            unit		Magyar Cavalry 			exp 0 armour 0 weapon_lvl 0
            unit		Magyar Cavalry 			exp 0 armour 0 weapon_lvl 0
            unit		Pavise Crossbow Militia  	exp 2 armour 0 weapon_lvl 0
            unit		Pavise Crossbow Militia  	exp 2 armour 0 weapon_lvl 0
            unit		Flemish Pikemen			exp 2 armour 0 weapon_lvl 0
        end


        wait 1.0
        snap_strat_camera 214, 268
        zoom_strat_camera 0.1

        set_counter hungary_zahler 0
        set_event_counter war_hungary_declined 0
    end_monitor

    ;------------------------------ Ungarn JA ENDE --------------------------------
    monitor_event EventCounter EventCounterType war_hungary_ende_accepted = 1
        historic_event war_hungary_ende_yes 

        console_command add_money -1500, hungary

        destroy_units hungary S Albanian Cavalry
        destroy_units hungary S Serbian Hussars
        destroy_units hungary Balkan Archers

        kill_character merc_hungary

        set_event_counter war_hungary_ende_accepted 0
    end_monitor

    ;----------------------------- Ungarn Nein ENDE -------------------------------
    monitor_event EventCounter EventCounterType war_hungary_ende_declined = 1
        historic_event war_hungary_ende_no

        destroy_units hungary S Albanian Cavalry
        destroy_units hungary S Serbian Hussars
        destroy_units hungary Balkan Archers

        kill_character label merc_hungary

        wait 1.0

        spawn_army 
            faction slave
            character	Vlad, named character, age 36, x 214, y 258
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 4
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Flemish Pikemen 		exp 1 armour 0 weapon_lvl 0
            unit		Magyar Cavalry 			exp 0 armour 0 weapon_lvl 0
            unit		Magyar Cavalry 			exp 0 armour 0 weapon_lvl 0
            unit		Pavise Crossbow Militia  	exp 2 armour 0 weapon_lvl 0
            unit		Pavise Crossbow Militia  	exp 2 armour 0 weapon_lvl 0
            unit		Flemish Pikemen			exp 2 armour 0 weapon_lvl 0
        end

        wait 1.0
        snap_strat_camera 214, 268
        zoom_strat_camera 0.1

        set_event_counter war_hungary_ende_declined 0
    end_monitor

    ;------------------------------ HRE JA ANFANG ---------------------------------
    monitor_event EventCounter EventCounterType war_hre_accepted = 1
        historic_event war_hre_yes
        console_command add_money -6000, hre

        spawn_army 
            faction hre
            character	random_name, named character, age 36, x 103, y 251, label merc_hre
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 3
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Doppelsoldner			exp 2 armour 0 weapon_lvl 0
            unit		Doppelsoldner			exp 2 armour 0 weapon_lvl 0
            unit		S Landschneckt Pikemen		exp 1 armour 0 weapon_lvl 0
            unit		S Landschneckt Pikemen		exp 1 armour 0 weapon_lvl 0
            unit		S Landschneckt Pikemen		exp 1 armour 0 weapon_lvl 0
        end


        wait 1.0
        snap_strat_camera 103, 261
        zoom_strat_camera 0.1

        set_counter hre_zahler 1
        set_counter hre_con 1
        set_event_counter war_hre_accepted 0
    end_monitor


    ;----------------------------- HRE Nein ANFANG --------------------------------
    monitor_event EventCounter EventCounterType war_hre_declined = 1
        historic_event war_hre_no

        spawn_army 
            faction slave
            character	Otto, named character, age 36, x 103, y 251
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 3
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Mercenary German Knights 			exp 1 armour 0 weapon_lvl 0
            unit		Mercenary German Knights 			exp 0 armour 0 weapon_lvl 0
            unit		Landschneckt Pikemen 			exp 0 armour 0 weapon_lvl 0
            unit		Landschneckt Pikemen  		exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers		exp 2 armour 0 weapon_lvl 0			
        end


        wait 1.0
        snap_strat_camera 103, 261
        zoom_strat_camera 0.1

        set_counter hre_zahler 0
        set_event_counter war_hre_declined 0
    end_monitor

    ;------------------------------ HRE JA ENDE -----------------------------------
    monitor_event EventCounter EventCounterType war_hre_ende_accepted = 1
        historic_event war_hre_ende_yes 

        console_command add_money -1500, hre

        destroy_units hre Doppelsoldner
        destroy_units hre S Landschneckt Pikemen

        kill_character merc_hre

        set_event_counter war_hre_ende_accepted 0
    end_monitor

    ;----------------------------- HRE Nein ENDE ----------------------------------
    monitor_event EventCounter EventCounterType war_hre_ende_declined = 1
        historic_event war_hre_ende_no

        destroy_units hre Doppelsoldner
        destroy_units hre S Landschneckt Pikemen

        kill_character merc_hre

        wait 1.0

        spawn_army 
            faction slave
            character	Otto, named character, age 36, x 103, y 251
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 3
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Mercenary German Knights 			exp 1 armour 0 weapon_lvl 0
            unit		Mercenary German Knights 			exp 0 armour 0 weapon_lvl 0
            unit		Landschneckt Pikemen 			exp 0 armour 0 weapon_lvl 0
            unit		Landschneckt Pikemen  		exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers		exp 2 armour 0 weapon_lvl 0			
        end

        wait 1.0
        snap_strat_camera 103, 261
        zoom_strat_camera 0.1

        set_event_counter war_hre_ende_declined 0
    end_monitor

    ;------------------------------ Frankreich JA ANFANG --------------------------
    monitor_event EventCounter EventCounterType war_france_accepted = 1
        historic_event war_france_yes
        console_command add_money -6000, france

        spawn_army 
            faction france
            character	random_name, named character, age 36, x 9, y 227, label merc_france
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 2
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Prussian Archers		exp 1 armour 0 weapon_lvl 0
            unit		Prussian Archers		exp 1 armour 0 weapon_lvl 0
            unit		S Chivalric Knights		exp 1 armour 0 weapon_lvl 0
            unit		S Chivalric Knights		exp 1 armour 0 weapon_lvl 0
            unit		S Dismounted Mercenary German Knights	exp 1 armour 0 weapon_lvl 0
            unit		S Dismounted Mercenary German Knights	exp 1 armour 0 weapon_lvl 0
        end


        wait 1.0
        snap_strat_camera 9, 237
        zoom_strat_camera 0.1

        set_counter france_zahler 1
        set_counter france_con 1
        set_event_counter war_france_accepted 0
    end_monitor


    ;----------------------------- Frankreich Nein ANFANG -------------------------
    monitor_event EventCounter EventCounterType war_france_declined = 1
        historic_event war_france_no

        spawn_army 
            faction slave
            character	Bernard, named character, age 36, x 9, y 227
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 2
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Chivalric Knights 			exp 1 armour 0 weapon_lvl 0
            unit		Chivalric Knights 			exp 0 armour 0 weapon_lvl 0
            unit		Dismounted Mercenary German Knights 			exp 0 armour 0 weapon_lvl 0
            unit		Dismounted Mercenary German Knights  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers		exp 2 armour 0 weapon_lvl 0
        end


        wait 1.0
        snap_strat_camera 9, 237
        zoom_strat_camera 0.1

        set_counter france_zahler 0
        set_event_counter war_france_declined 0
    end_monitor

    ;------------------------------ Frankreich JA ENDE ----------------------------
    monitor_event EventCounter EventCounterType war_france_ende_accepted = 1
        historic_event war_france_ende_yes 

        console_command add_money -1500, france

        destroy_units france Prussian Archers
        destroy_units france S Chivalric Knights
        destroy_units france S Dismounted Mercenary German Knights

        kill_character merc_hre

        set_event_counter war_france_ende_accepted 0
    end_monitor

    ;----------------------------- Frankreich Nein ENDE ---------------------------
    monitor_event EventCounter EventCounterType war_france_ende_declined = 1
        historic_event war_france_ende_no

        destroy_units france Prussian Archers
        destroy_units france S Chivalric Knights
        destroy_units france S Dismounted Mercenary German Knights

        kill_character merc_hre

        wait 1.0

        spawn_army 
            faction slave
            character	Bernard, named character, age 36, x 9, y 227
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 2
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Chivalric Knights 			exp 1 armour 0 weapon_lvl 0
            unit		Chivalric Knights 			exp 0 armour 0 weapon_lvl 0
            unit		Dismounted Mercenary German Knights 			exp 0 armour 0 weapon_lvl 0
            unit		Dismounted Mercenary German Knights  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers		exp 2 armour 0 weapon_lvl 0
        end

        wait 1.0
        snap_strat_camera 9, 237
        zoom_strat_camera 0.1

        set_event_counter war_france_ende_declined 0
    end_monitor

    ;------------------------------ Mailand JA ANFANG -----------------------------
    monitor_event EventCounter EventCounterType war_milan_accepted = 1
        historic_event war_milan_yes
        console_command add_money -6000, milan

        spawn_army 
            faction milan
            character	random_name, named character, age 36, x 71, y 218, label merc_milan
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 1
            unit		SE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		S Condottieri			exp 2 armour 0 weapon_lvl 0
            unit		S Condottieri			exp 2 armour 0 weapon_lvl 0
            unit		S Flemish Pikemen Mercs		exp 2 armour 0 weapon_lvl 0
            unit		S Flemish Pikemen Mercs		exp 2 armour 0 weapon_lvl 0
            unit		S Mercenary Arquebusiers	exp 1 armour 0 weapon_lvl 0
            unit		S Mercenary Arquebusiers	exp 1 armour 0 weapon_lvl 0
        end


        wait 1.0
        snap_strat_camera 71, 228
        zoom_strat_camera 0.1

        set_counter milan_zahler 1
        set_counter milan_con 1
        set_event_counter war_milan_accepted 0
    end_monitor


    ;----------------------------- Mailand Nein ANFANG ----------------------------
    monitor_event EventCounter EventCounterType war_milan_declined = 1
        historic_event war_milan_no

        spawn_army 
            faction slave
            character	Guadagno, named character, age 36, x 71, y 218
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 1
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 1 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 0 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 0 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Ribault		exp 2 armour 0 weapon_lvl 0			
        end


        wait 1.0
        snap_strat_camera 71, 228
        zoom_strat_camera 0.1

        set_counter milan_zahler 0
        set_event_counter war_milan_declined 0
    end_monitor

    ;------------------------------ Mailand JA ENDE -------------------------------
    monitor_event EventCounter EventCounterType war_milan_ende_accepted = 1
        historic_event war_milan_ende_yes 

        console_command add_money -1500, milan

        destroy_units milan S Mercenary Arquebusiers
        destroy_units milan S Flemish Pikemen Mercs
        destroy_units milan S Condottieri
        kill_character merc_milan


        set_event_counter war_milan_ende_accepted 0
    end_monitor

    ;----------------------------- Mailand Nein ENDE -------------------------------
    monitor_event EventCounter EventCounterType war_milan_ende_declined = 1
        historic_event war_milan_ende_no

        destroy_units milan S Mercenary Arquebusiers
        destroy_units milan S Flemish Pikemen Mercs
        destroy_units milan S Condottieri
        kill_character merc_milan

        wait 1.0

        spawn_army 
            faction slave
            character	Guadagno, named character, age 36, x 71, y 218
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 1
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 1 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 0 armour 0 weapon_lvl 0
            unit		Condottieri 			exp 0 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Ribault		exp 2 armour 0 weapon_lvl 0
        end

        wait 1.0
        snap_strat_camera 71, 228
        zoom_strat_camera 0.1

        set_event_counter war_milan_ende_declined 0
    end_monitor

    ;------------------------------ Schwaben JA ANFANG ----------------------------
    monitor_event EventCounter EventCounterType war_normans_accepted = 1
        historic_event war_normans_yes
        console_command add_money -6000, normans

        spawn_army 
            faction normans
            character	random_name, named character, age 36, x 80, y 277, label merc_normans
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 3
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Doppelsoldner			exp 2 armour 0 weapon_lvl 0
            unit		Doppelsoldner			exp 2 armour 0 weapon_lvl 0
            unit		S Landschneckt Pikemen		exp 1 armour 0 weapon_lvl 0
            unit		S Landschneckt Pikemen		exp 1 armour 0 weapon_lvl 0
            unit		S Landschneckt Pikemen		exp 1 armour 0 weapon_lvl 0
        end


        wait 1.0
        snap_strat_camera 80, 287
        zoom_strat_camera 0.1

        set_counter normans_zahler 1
        set_counter normans_con 1
        set_event_counter war_normans_accepted 0
    end_monitor


    ;----------------------------- Schwaben Nein ANFANG ---------------------------
    monitor_event EventCounter EventCounterType war_normans_declined = 1
        historic_event war_normans_no

        spawn_army 
            faction slave
            character	Heinrich, named character, age 36, x 80, y 277
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 3
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Mercenary German Knights 			exp 1 armour 0 weapon_lvl 0
            unit		Mercenary German Knights 			exp 0 armour 0 weapon_lvl 0
            unit		Landschneckt Pikemen 			exp 0 armour 0 weapon_lvl 0
            unit		Landschneckt Pikemen  		exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers		exp 2 armour 0 weapon_lvl 0			
        end


        wait 1.0
        snap_strat_camera 80, 287
        zoom_strat_camera 0.1

        set_counter normans_zahler 0
        set_event_counter war_normans_declined 0
    end_monitor

    ;------------------------------ Schwaben JA ENDE ------------------------------
    monitor_event EventCounter EventCounterType war_normans_ende_accepted = 1
        historic_event war_normans_ende_yes 

        console_command add_money -1500, normans

        destroy_units normans Doppelsoldner
        destroy_units normans S Landschneckt Pikemen

        kill_character merc_normans

        set_event_counter war_normans_ende_accepted 0
    end_monitor

    ;----------------------------- Schwaben Nein ENDE -----------------------------
    monitor_event EventCounter EventCounterType war_normans_ende_declined = 1
        historic_event war_normans_ende_no

        destroy_units normans Doppelsoldner
        destroy_units normans S Landschneckt Pikemen

        kill_character merc_normans

        wait 1.0

        spawn_army 
            faction slave
            character	Heinrich, named character, age 36, x 80, y 277
            traits LoyaltyStarter 1 , ReligionStarter 2 , soeldner 3
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Mercenary German Knights 			exp 1 armour 0 weapon_lvl 0
            unit		Mercenary German Knights 			exp 0 armour 0 weapon_lvl 0
            unit		Landschneckt Pikemen 			exp 0 armour 0 weapon_lvl 0
            unit		Landschneckt Pikemen  		exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers  	exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers		exp 2 armour 0 weapon_lvl 0			
        end

        wait 1.0
        snap_strat_camera 80, 287
        zoom_strat_camera 0.1

        set_event_counter war_normans_ende_declined 0
    end_monitor







    ;end
    ;------------------------------------------------------------------------------
    ;---------------------- Landshuter Erbfolgekrieg ------------------------------
    ;------------------------------------------------------------------------------

    declare_counter landshut
    set_counter landshut 0

    monitor_event FactionTurnStart FactionType normans
        and I_TurnNumber >= 44
        and I_SettlementOwner Landshut = slave


        if I_CompareCounter landshut = 0
            historic_event ingolstadt_start factions { normans, }

            spawn_army 
                faction normans
                character random_name, named character, age 32, x 106, y 280, direction E
                traits GoodCommander 2 , ReligionStarter 1, LoyaltyStarter 1, Loyal 3
                unit		NE Late Bodyguard				exp 3 armour 0 weapon_lvl 0
                unit		NE Cannon				exp 0 armour 0 weapon_lvl 0
                unit		S Doppelsoldner				exp 3 armour 1 weapon_lvl 1
                unit		SW Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
                unit		SW Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
                unit		Landsknecht Halberd			exp 1 armour 0 weapon_lvl 0
                unit		Landsknecht Halberd			exp 1 armour 0 weapon_lvl 0
                unit		Arquebusiers				exp 2 armour 0 weapon_lvl 0
                unit		Arquebusiers				exp 2 armour 0 weapon_lvl 0
            end

        end_if

        if I_CompareCounter landshut >= 0
            and I_CompareCounter landshut < 10

            inc_counter landshut 1

        end_if

        if I_CompareCounter landshut < 10
            and I_SettlementOwner Landshut = normans

            historic_event ingolstadt_erfolg factions { normans, }

            increment_kings_purse normans 500
            terminate_monitor

        end_if

        if I_CompareCounter landshut = 10
            and not I_SettlementOwner Landshut = normans

            historic_event ingolstadt_failed factions { normans, }

            increment_kings_purse normans -500

            add_settlement_turmoil Augsburg 25
            add_settlement_turmoil Ulm 25
            terminate_monitor

        end_if

    end_monitor               

    ;------------------------------------------------------------------------------
    ;---------------------- Raubritter --------------------------------------------
    ;------------------------------------------------------------------------------

    monitor_event FactionTurnStart FactionType normans
        and I_TurnNumber = 76

        spawn_army 
            faction slave, sub_faction normans
            character Stefan Hausner, named character, age 49, x 80, y 285, direction E
            traits GoodCommander 2 , ReligionStarter 1, LoyaltyStarter 1
            unit		NE Late Bodyguard				exp 0 armour 0 weapon_lvl 0
            unit		R Mercenary German Knights				exp 3 armour 1 weapon_lvl 1
            unit		R Mercenary German Knights			exp 2 armour 0 weapon_lvl 0
            unit		Halberd Militia			exp 1 armour 0 weapon_lvl 0
            unit		Halberd Militia			exp 1 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers				exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers				exp 2 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction slave, sub_faction normans
            character Goetz von Berchlingen, named character, age 40, x 93, y 283, direction S
            traits GoodCommander 2 , ReligionStarter 1, LoyaltyStarter 1
            unit		NE Late Bodyguard				exp 0 armour 0 weapon_lvl 0
            unit		R Mercenary German Knights				exp 3 armour 1 weapon_lvl 1
            unit		R Mercenary German Knights			exp 2 armour 0 weapon_lvl 0
            unit		R Mercenary German Knights			exp 2 armour 0 weapon_lvl 0
            unit		Halberd Militia			exp 1 armour 0 weapon_lvl 0
            unit		Halberd Militia			exp 1 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers				exp 2 armour 0 weapon_lvl 0
            unit		Mercenary Arquebusiers				exp 2 armour 0 weapon_lvl 0
        end



        generate_random_counter	geld 1 3

        if I_EventCounter geld = 1

            historic_event raubritter_500 factions { normans, }

            console_command add_money normans, -500

        end_if

        if I_EventCounter geld = 2

            historic_event raubritter_2000 factions { normans, }

            console_command add_money normans, -2000

        end_if

        if I_EventCounter geld = 3

            historic_event raubritter_7000 factions { normans, }

            console_command add_money normans, -7000

        end_if

        terminate_monitor
    end_monitor

    ;------------------------------------------------------------------------------
    ;---------------------- Ritterkrieg -------------------------------------------
    ;------------------------------------------------------------------------------

    monitor_event FactionTurnStart FactionType normans
        and I_TurnNumber = 120

        historic_event ritterkrieg true factions { normans, }

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType ritterkrieg_accepted

        historic_event ritterkrieg_ja

        console_command add_money normans, -7500

        set_event_counter ritterkrieg_ja

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType ritterkrieg_declined

        historic_event ritterkrieg_nein

        increment_kings_purse normans -500

        spawn_army 
            faction slave, sub_faction normans
            character Georg von Freyberg, named character, age 55, x 58, y 278, direction E
            traits GoodCommander 2 , ReligionStarter 1, LoyaltyStarter 1
            unit		NE Late Bodyguard				exp 0 armour 0 weapon_lvl 0
            unit		S Imperial Knights				exp 3 armour 1 weapon_lvl 1
            unit		S Imperial Knights			exp 2 armour 0 weapon_lvl 0
            unit		S Imperial Knights			exp 2 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction slave, sub_faction normans
            character Philipp von Badenb, named character, age 44, x 67, y 279, direction E
            traits GoodCommander 2 , ReligionStarter 1, LoyaltyStarter 1
            unit		NE Late Bodyguard				exp 0 armour 0 weapon_lvl 0
            unit		S Imperial Knights				exp 3 armour 1 weapon_lvl 1
            unit		S Imperial Knights			exp 2 armour 0 weapon_lvl 0
            unit		S Imperial Knights			exp 2 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction slave, sub_faction normans
            character Haug von Weissenberg, named character, age 41, x 48, y 282, direction E
            traits GoodCommander 2 , ReligionStarter 1, LoyaltyStarter 1
            unit		NE Late Bodyguard				exp 0 armour 0 weapon_lvl 0
            unit		S Imperial Knights				exp 3 armour 1 weapon_lvl 1
            unit		S Imperial Knights			exp 2 armour 0 weapon_lvl 0
            unit		S Imperial Knights			exp 2 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction slave, sub_faction normans
            character Ulrich von Tuebingen, named character, age 48, x 75, y 286, direction S
            traits GoodCommander 2 , ReligionStarter 1, LoyaltyStarter 1
            unit		NE Late Bodyguard				exp 0 armour 0 weapon_lvl 0
            unit		S Imperial Knights				exp 3 armour 1 weapon_lvl 1
            unit		S Imperial Knights			exp 2 armour 0 weapon_lvl 0
            unit		S Imperial Knights			exp 2 armour 0 weapon_lvl 0
        end

        terminate_monitor
    end_monitor


    ;------------------------------------------------------------------------------
    ;--------------------------- Taschenuhr ---------------------------------------
    ;------------------------------------------------------------------------------

    monitor_event FactionTurnEnd FactionType slave
        and I_TurnNumber >= 43

        historic_event	taschenuhr

        terminate_monitor
    end_monitor

    ;------------------------------------------------------------------------------
    ;--------------------------- Englands Kriegseintritt --------------------------
    ;------------------------------------------------------------------------------

    monitor_event FactionTurnStart FactionType france
        and I_LocalFaction france	
        and I_TurnNumber = 116

        historic_event einfall_englands true 

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType einfall_englands_accepted
        and I_EventCounter einfall_englands > 0

        historic_event einfall_englands_yes

        console_command add_money france, -20000

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType einfall_englands_declined
        and I_EventCounter einfall_englands > 0

        historic_event einfall_englands_no

        increment_kings_purse france -1000

        add_settlement_turmoil Lyon 40
        add_settlement_turmoil Marseille 40
        add_settlement_turmoil Dijon 40

        terminate_monitor
    end_monitor

    monitor_event FactionTurnStart FactionType hre
        and I_TurnNumber = 116

        historic_event einfall_englands_hre true factions { hre, }

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType einfall_englands_hre_accepted = 1

        historic_event einfall_englands_hre_ja factions { hre, }

        console_command add_money hre, -30000

        destroy_units france NE Spear Militia
        destroy_units france Partisan Militia 

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType einfall_englands_hre_declined = 1

        historic_event einfall_engalnds_hre_nein factions { hre, }

        terminate_monitor
    end_monitor

    monitor_event FactionTurnStart I_TurnNumber = 116
        and not I_LocalFaction hre
        and not I_LocalFaction france

        historic_event einfall_englands_andere factions { normans, hungary, turks, saxons, milan, venice, poland, papal_states, sicily, spain, savoy, montferrat, timurids, urbino, lucca, denmark, byzantium, england, russia, scotland, }

        console_command add_money hre, -20000

        destroy_units france NE Spear Militia
        destroy_units france Partisan Militia 

        terminate_monitor
    end_monitor


    ;------------------------------------------------------------------------------
    ;--------------------------- Comuneros Aufstand -------------------------------
    ;------------------------------------------------------------------------------

    monitor_event FactionTurnStart FactionType spain
        and I_LocalFaction spain	
        and I_TurnNumber = 107

        historic_event comuneros_aufstand true 

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType comuneros_aufstand_accepted
        and I_EventCounter comuneros_aufstand > 0

        historic_event comuneros_aufstand_yes

        console_command add_money spain, -25000

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType comuneros_aufstand_declined
        and I_EventCounter comuneros_aufstand > 0

        historic_event comuneros_aufstand_no

        increment_kings_purse spain -1500

        terminate_monitor
    end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- Siebenbürgen in Gefahr --------------------------------
    ;------------------------------------------------------------------------------

    monitor_event FactionTurnStart FactionType hungary
        and I_LocalFaction hungary	
        and I_TurnNumber = 47

        historic_event siebenburgen true 

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType siebenburgen_accepted
        and I_EventCounter siebenburgen_accepted > 0

        historic_event siebenburgen_yes

        console_command add_money hungary, -15000

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType siebenburgen_declined
        and I_EventCounter siebenburgen_declined > 0

        historic_event siebenburgen_no

        increment_kings_purse hungary -500

        add_settlement_turmoil Buda 25

        terminate_monitor
    end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- Bürgerkrieg -------------------------------------------
    ;------------------------------------------------------------------------------

    ;---------------------- Bürgerkrieg - Unruhe
    ;monitor_event FactionTurnEnd FactionType russia
    ;    and I_TurnNumber > 0


    ;    faction_emerge mongols russia 6 80.0 155.0 0.9 town false niccolo1 Niccolo Borghese 55

    ;    if I_NumberOfSettlements mongols > 0
    ;        and I_EventCounter aufstand = 0

    ;        set_event_counter aufstand 1

    ;        if I_CharacterExists Niccolo Borghese
    ;            and I_LocalFaction russia
    ;            send_character_off_map Niccolo Borghese
    ;        end_if

    ;        historic_event burgerkrieg_beginn factions { russia, }

    ;        set_faction_standing russia mongols -0.6
    ;        set_faction_standing mongols russia -0.6
    ;    end_if	

    ;    if I_NumberOfSettlements mongols < 0
    ;        and I_EventCounter aufstand = 1 

    ;        set_event_counter aufstand 0
    ;    end_if

    ;    console_command diplomatic_stance russia mongols War

    ;end_monitor

    ;---------------------- Bürgerkrieg - Autoriät
    ;monitor_event FactionTurnEnd FactionType russia
    ;    and I_NumberOfSettlements russia > 5
    ;    and I_NumberOfSettlements mongols = 0

    ;    generate_random_counter	authority_value 1 50

    ;    if I_FactionLeaderAttribute russia Authority = 0

    ;        if I_EventCounter authority_value <= 33
    ;            faction_emerge mongols russia 5 50.0 145.0 0.9 town false
    ;        end_if

    ;    end_if

    ;    if I_FactionLeaderAttribute russia Authority = 1

    ;        if I_EventCounter authority_value <= 25
    ;            faction_emerge mongols russia 6 60.0 135.0 0.9 town false
    ;        end_if

    ;    end_if

    ;    if I_FactionLeaderAttribute russia Authority = 2

    ;        if I_EventCounter authority_value <= 20
    ;            faction_emerge mongols russia 6 65.0 130.0 0.85 town false
    ;        end_if

    ;    end_if

    ;    if I_FactionLeaderAttribute russia Authority = 3

    ;        if I_EventCounter authority_value <= 15
    ;            faction_emerge mongols russia 6 70.0 120.0 0.85 town false
    ;        end_if

    ;    end_if

    ;    if I_FactionLeaderAttribute russia Authority = 4

    ;        if I_EventCounter authority_value <= 10
    ;            faction_emerge mongols russia 6 80.0 120.0 0.85 town false
    ;        end_if

    ;    end_if

    ;    if I_FactionLeaderAttribute russia Authority = 5

    ;        if I_EventCounter authority_value <= 5
    ;            faction_emerge mongols russia 6 85.0 120.0 0.85 town false
    ;        end_if

    ;    end_if	

    ;    if I_NumberOfSettlements mongols > 0
    ;        historic_event burgerkrieg_beginn factions { russia, }
    ;        add_money mongols 10000
    ;    end_if	

    ;end_monitor

    ;---------------------- Bürgerkrieg - Schlechte Politik

    ;declare_counter status
    ;declare_counter status_burgerkrieg

    ;--- To be continued!!!

    ;------------------------------------------------------------------------------
    ;---------------------- Schweizerkrieg ----------------------------------------
    ;------------------------------------------------------------------------------

    monitor_event FactionTurnStart FactionType normans		;KI
        and I_IsFactionAIControlled normans
        and I_IsFactionAIControlled hre
        and I_IsFactionAIControlled saxons
        and I_TurnNumber = 23

        historic_event schweizerkrieg_other

        spawn_army 
            faction normans
            character Heinrich von Fuerstenberg, named character, age 26, x 59, y 265, direction S
            traits GoodCommander 2 , ReligionStarter 1, LoyaltyStarter 1 , GoodAttacker 1, Loyal 3
            unit		NE Late Bodyguard			exp 3 armour 0 weapon_lvl 0
            unit		NE Cannon				exp 0 armour 0 weapon_lvl 0
            unit		S Doppelsoldner				exp 3 armour 1 weapon_lvl 1
            unit		SW Landsknecht Pikeniere			exp 4 armour 0 weapon_lvl 0
            unit		SW Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
            unit		SW Landsknecht Pikeniere			exp 3 armour 0 weapon_lvl 0
            unit		SW Landsknecht Pikeniere			exp 3 armour 0 weapon_lvl 0
            unit		Arquebusiers				exp 2 armour 0 weapon_lvl 0
            unit		Landsknecht Halberd			exp 7 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction hre
            character Georg von Frundsberg, named character, age 26, x 61, y 266, direction S
            traits GoodCommander 3 , ReligionStarter 1, LoyaltyStarter 1 , GoodAttacker 2 , GoodInfantryGeneral 2 , Loyal 3 , Generous 1
            unit		NE Cannon				exp 0 armour 0 weapon_lvl 0
            unit		Forlorn Hope				exp 3 armour 1 weapon_lvl 1
            unit		Landsknecht Pikeniere			exp 4 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 3 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 3 armour 0 weapon_lvl 0
            unit		Hre Arquebusiers			exp 2 armour 0 weapon_lvl 0
            unit		Forlorn Hope			exp 7 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction saxons
            character Lorenz, general, age 26, x 58, y 258, direction N
            unit		Swiss Knights				exp 5 armour 0 weapon_lvl 0
            unit		Swiss Guard Pikemen			exp 3 armour 0 weapon_lvl 1
            unit		Swiss Pike				exp 1 armour 0 weapon_lvl 0
            unit		Swiss Arquebusiers			exp 2 armour 0 weapon_lvl 0
            unit		Swiss Arquebusiers			exp 0 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction saxons
            character Ruprecht, general, age 26, x 64, y 258, direction N 
            unit		Swiss Pike				exp 4 armour 0 weapon_lvl 0
            unit		Swiss Pike				exp 3 armour 0 weapon_lvl 0
            unit		Swiss Pike				exp 1 armour 0 weapon_lvl 0
            unit		Swiss Halbediers			exp 0 armour 0 weapon_lvl 0
            unit		Swiss Halbediers			exp 3 armour 0 weapon_lvl 0
            unit		Swiss Crossbowmen			exp 2 armour 0 weapon_lvl 0
            unit		Swiss Crossbowmen			exp 0 armour 0 weapon_lvl 0
        end

        set_faction_standing saxons hre -0.6
        set_faction_standing hre saxons -0.6
        set_faction_standing saxons normans -0.6

        console_command diplomatic_stance hre saxons War
        console_command diplomatic_stance saxons normans War

        terminate_monitor
    end_monitor


    monitor_event FactionTurnStart FactionType normans		;Schwaben
        and I_LocalFaction normans
        and I_TurnNumber = 23

        historic_event schweizerkrieg_hilfe true 

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType schweizerkrieg_hilfe_accepted
        and I_EventCounter schweizerkrieg_hilfe_accepted > 0

        historic_event schweizerkrieg_hilfe_yes

        spawn_army 
            faction normans
            character Heinrich von Fuerstenberg, named character, age 26, x 59, y 265, direction S
            traits GoodCommander 2 , ReligionStarter 1, LoyaltyStarter 1 , GoodAttacker 1, Loyal 3
            unit		NE Late Bodyguard			exp 3 armour 0 weapon_lvl 0
            unit		NE Cannon				exp 0 armour 0 weapon_lvl 0
            unit		S Doppelsoldner				exp 3 armour 1 weapon_lvl 1
            unit		SW Landsknecht Pikeniere			exp 4 armour 0 weapon_lvl 0
            unit		SW Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
            unit		SW Landsknecht Pikeniere			exp 3 armour 0 weapon_lvl 0
            unit		SW Landsknecht Pikeniere			exp 3 armour 0 weapon_lvl 0
            unit		Arquebusiers				exp 2 armour 0 weapon_lvl 0
            unit		Landsknecht Halberd			exp 7 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction hre
            character Georg von Frundsberg, named character, age 26, x 61, y 266, direction S
            traits GoodCommander 3 , ReligionStarter 1, LoyaltyStarter 1 , GoodAttacker 2 , GoodInfantryGeneral 2 , Loyal 3 , Generous 1
            unit		NE Cannon				exp 0 armour 0 weapon_lvl 0
            unit		Forlorn Hope				exp 3 armour 1 weapon_lvl 1
            unit		Landsknecht Pikeniere			exp 4 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 3 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 3 armour 0 weapon_lvl 0
            unit		Hre Arquebusiers			exp 2 armour 0 weapon_lvl 0
            unit		Forlorn Hope			exp 7 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction saxons
            character Lorenz, general, age 26, x 58, y 258, direction N
            unit		Swiss Knights				exp 5 armour 0 weapon_lvl 0
            unit		Swiss Guard Pikemen			exp 3 armour 0 weapon_lvl 1
            unit		Swiss Pike				exp 1 armour 0 weapon_lvl 0
            unit		Swiss Arquebusiers			exp 2 armour 0 weapon_lvl 0
            unit		Swiss Arquebusiers			exp 0 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction saxons
            character Ruprecht, general, age 26, x 64, y 258, direction N 
            unit		Swiss Pike				exp 4 armour 0 weapon_lvl 0
            unit		Swiss Pike				exp 3 armour 0 weapon_lvl 0
            unit		Swiss Pike				exp 1 armour 0 weapon_lvl 0
            unit		Swiss Halbediers			exp 0 armour 0 weapon_lvl 0
            unit		Swiss Halbediers			exp 3 armour 0 weapon_lvl 0
            unit		Swiss Crossbowmen			exp 2 armour 0 weapon_lvl 0
            unit		Swiss Crossbowmen			exp 0 armour 0 weapon_lvl 0
        end

        set_faction_standing saxons hre -0.6
        set_faction_standing hre saxons -0.6
        set_faction_standing saxons normans -0.6

        console_command diplomatic_stance hre saxons War
        console_command diplomatic_stance saxons normans War

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType schweizerkrieg_hilfe_declined
        and I_EventCounter schweizerkrieg_hilfe_declined > 0

        spawn_army 
            faction hre
            character Georg von Frundsberg, named character, age 26, x 59, y 265, direction S
            traits GoodCommander 3 , ReligionStarter 1, LoyaltyStarter 1 , GoodAttacker 2 , GoodInfantryGeneral 2 , Loyal 3 , Generous 1
            unit		NE Cannon				exp 0 armour 0 weapon_lvl 0
            unit		Forlorn Hope				exp 3 armour 1 weapon_lvl 1
            unit		Landsknecht Pikeniere			exp 4 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 3 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 3 armour 0 weapon_lvl 0
            unit		Hre Arquebusiers			exp 2 armour 0 weapon_lvl 0
            unit		Forlorn Hope			exp 7 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction saxons
            character Lorenz, general, age 26, x 58, y 258, direction N
            unit		Swiss Knights				exp 5 armour 0 weapon_lvl 0
            unit		Swiss Guard Pikemen			exp 3 armour 0 weapon_lvl 1
            unit		Swiss Pike				exp 1 armour 0 weapon_lvl 0
            unit		Swiss Arquebusiers			exp 2 armour 0 weapon_lvl 0
            unit		Swiss Arquebusiers			exp 0 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction saxons
            character Ruprecht, general, age 26, x 64, y 258, direction N 
            unit		Swiss Pike				exp 4 armour 0 weapon_lvl 0
            unit		Swiss Pike				exp 3 armour 0 weapon_lvl 0
            unit		Swiss Pike				exp 1 armour 0 weapon_lvl 0
            unit		Swiss Halbediers			exp 0 armour 0 weapon_lvl 0
            unit		Swiss Halbediers			exp 3 armour 0 weapon_lvl 0
            unit		Swiss Crossbowmen			exp 2 armour 0 weapon_lvl 0
            unit		Swiss Crossbowmen			exp 0 armour 0 weapon_lvl 0
        end

        historic_event schweizerkrieg_hilfe_no

        increment_kings_purse normans -1000
        increment_kings_purse saxons 1000

        set_faction_standing saxons hre -0.6
        set_faction_standing hre saxons -0.6
        set_faction_standing hre normans -0.2

        console_command diplomatic_stance hre saxons War

        terminate_monitor
    end_monitor

    monitor_event FactionTurnStart FactionType hre		;HRR
        and I_LocalFaction hre	
        and I_TurnNumber = 23

        historic_event schweizerkrieg true 

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType schweizerkrieg_accepted
        and I_EventCounter schweizerkrieg_accepted > 0

        historic_event schweizerkrieg_yes

        spawn_army 
            faction normans
            character Heinrich von Fuerstenberg, named character, age 26, x 59, y 265, direction S
            traits GoodCommander 2 , ReligionStarter 1, LoyaltyStarter 1 , GoodAttacker 1, Loyal 3
            unit		NE Late Bodyguard			exp 3 armour 0 weapon_lvl 0
            unit		NE Cannon				exp 0 armour 0 weapon_lvl 0
            unit		S Doppelsoldner				exp 3 armour 1 weapon_lvl 1
            unit		SW Landsknecht Pikeniere			exp 4 armour 0 weapon_lvl 0
            unit		SW Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
            unit		SW Landsknecht Pikeniere			exp 3 armour 0 weapon_lvl 0
            unit		SW Landsknecht Pikeniere			exp 3 armour 0 weapon_lvl 0
            unit		Arquebusiers				exp 2 armour 0 weapon_lvl 0
            unit		Landsknecht Halberd			exp 7 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction hre
            character Georg von Frundsberg, named character, age 26, x 61, y 266, direction S
            traits GoodCommander 3 , ReligionStarter 1, LoyaltyStarter 1 , GoodAttacker 2 , GoodInfantryGeneral 2 , Loyal 3 , Generous 1
            unit		NE Cannon				exp 0 armour 0 weapon_lvl 0
            unit		Forlorn Hope				exp 3 armour 1 weapon_lvl 1
            unit		Landsknecht Pikeniere			exp 4 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 3 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 3 armour 0 weapon_lvl 0
            unit		Hre Arquebusiers			exp 2 armour 0 weapon_lvl 0
            unit		Forlorn Hope			exp 7 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction saxons
            character Lorenz, general, age 26, x 58, y 258, direction N
            unit		Swiss Knights				exp 5 armour 0 weapon_lvl 0
            unit		Swiss Guard Pikemen			exp 3 armour 0 weapon_lvl 1
            unit		Swiss Pike				exp 1 armour 0 weapon_lvl 0
            unit		Swiss Arquebusiers			exp 2 armour 0 weapon_lvl 0
            unit		Swiss Arquebusiers			exp 0 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction saxons
            character Ruprecht, general, age 26, x 64, y 258, direction N 
            unit		Swiss Pike				exp 4 armour 0 weapon_lvl 0
            unit		Swiss Pike				exp 3 armour 0 weapon_lvl 0
            unit		Swiss Pike				exp 1 armour 0 weapon_lvl 0
            unit		Swiss Halbediers			exp 0 armour 0 weapon_lvl 0
            unit		Swiss Halbediers			exp 3 armour 0 weapon_lvl 0
            unit		Swiss Crossbowmen			exp 2 armour 0 weapon_lvl 0
            unit		Swiss Crossbowmen			exp 0 armour 0 weapon_lvl 0
        end

        set_faction_standing saxons hre -0.6
        set_faction_standing hre saxons -0.6
        set_faction_standing saxons normans -0.6

        console_command diplomatic_stance hre saxons War
        console_command diplomatic_stance saxons normans War

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType schweizerkrieg_declined
        and I_EventCounter schweizerkrieg_declined > 0

        historic_event schweizerkrieg_no

        increment_kings_purse hre -1000
        increment_kings_purse saxons 1000

        set_faction_standing saxons hre 0.6
        set_faction_standing hre saxons 0.6

        terminate_monitor
    end_monitor



    monitor_event FactionTurnStart FactionType saxons		;Schweizer
        and I_LocalFaction saxons	
        and I_TurnNumber = 23

        historic_event schwabenkrieg true 

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType schwabenkrieg_accepted
        and I_EventCounter schwabenkrieg_accepted > 0

        historic_event schwabenkrieg_yes

        spawn_army 
            faction hre
            character Georg von Frundsberg, named character, age 26, x 61, y 266, direction S
            traits GoodCommander 3 , ReligionStarter 1, LoyaltyStarter 1 , GoodAttacker 2 , GoodInfantryGeneral 2 , Loyal 3 , Generous 1
            unit		Forlorn Hope				exp 7 armour 1 weapon_lvl 1
            unit		Landsknecht Pikeniere			exp 4 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 3 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 3 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 0 armour 0 weapon_lvl 0
            unit		Hre Arquebusiers			exp 2 armour 0 weapon_lvl 0
            unit		Hre Arquebusiers			exp 1 armour 0 weapon_lvl 0
            unit		NE Cannon				exp 0 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction hre
            character Heinrich, general, age 26, x 56, y 266, direction S
            unit		Forlorn Hope				exp 3 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 1 armour 0 weapon_lvl 0
            unit		Imperial Knights			exp 2 armour 0 weapon_lvl 0
            unit		Imperial Knights			exp 3 armour 0 weapon_lvl 0
            unit		Imperial Knights			exp 2 armour 0 weapon_lvl 0
            unit		Hre Arquebusiers			exp 0 armour 0 weapon_lvl 0
        end

        spawn_army 
            faction hre
            character Eberhard, general, age 26, x 58, y 268, direction S 
            unit		Imperial Knights			exp 4 armour 0 weapon_lvl 0
            unit		Hre Pike Militia			exp 3 armour 2 weapon_lvl 0
            unit		Hre Pike Militia			exp 1 armour 0 weapon_lvl 0
            unit		Halberd Militia				exp 0 armour 1 weapon_lvl 0
            unit		Halberd Militia				exp 3 armour 2 weapon_lvl 0
            unit		Halberd Militia				exp 2 armour 0 weapon_lvl 0
            unit		NE Grand Bombard			exp 0 armour 0 weapon_lvl 0
        end

        set_faction_standing saxons hre -0.6
        set_faction_standing hre saxons -0.6

        console_command diplomatic_stance hre saxons War

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType schwabenkrieg_declined
        and I_EventCounter schwabenkrieg_declined > 0

        historic_event schwabenkrieg_no

        increment_kings_purse saxons -1000
        increment_kings_purse hre 1000

        set_faction_standing saxons hre 0.6
        set_faction_standing hre saxons 0.6

        terminate_monitor
    end_monitor


    ;;;;;;;;;;;;;;;;;;;;;;;;;;;Waldseemüllers Weltkarte;;;;;;;;;;;;;;;;;;;;;;;;;;;

    monitor_event FactionTurnEnd FactionType slave
        and I_TurnNumber >= 55

        historic_event	weltkarte

        terminate_monitor
    end_monitor


    ;;;;;;;;;;;;;;;;;;;;;;;;;;;Rhinocerus;;;;;;;;;;;;;;;;;;;;;;;;;;;

    monitor_event FactionTurnEnd FactionType slave
        and I_TurnNumber >= 87

        historic_event	nashorn

        terminate_monitor
    end_monitor


    ;;;;;;;;;;;;;;;;;;;;;;;;;;;Königswahl Gustav Wasas;;;;;;;;;;;;;;;;;;;;;;;;;;;

    monitor_event FactionTurnEnd FactionType slave
        and I_TurnNumber >= 119

        historic_event	gustav_wasa

        terminate_monitor
    end_monitor


    ;;;;;;;;;;;;;;;;;;;;;;;;;;;Englischer Schweiß;;;;;;;;;;;;;;;;;;;;;;;;;;;

    monitor_event FactionTurnEnd FactionType slave
        and I_TurnNumber >= 139

        historic_event	englischer_schweiss

        terminate_monitor
    end_monitor


    ;;;;;;;;;;;;;;;;;;;;;;;;;;;Täuferreich von Münster;;;;;;;;;;;;;;;;;;;;;;;;;;;

    monitor_event FactionTurnEnd FactionType slave
        and I_TurnNumber >= 167

        historic_event	taeufer_muenster

        terminate_monitor
    end_monitor


    ;;;;;;;;;;;;;;;;;;;;;;;;;;;Ankunft in Tanegashima;;;;;;;;;;;;;;;;;;;;;;;;;;;

    monitor_event FactionTurnEnd FactionType slave
        and I_TurnNumber >= 199

        historic_event	tanegashima

        terminate_monitor
    end_monitor


    ;;;;;;;;;;;;;;;;;;;;;;;;;;;Eroberung von Kasan;;;;;;;;;;;;;;;;;;;;;;;;;;;

    monitor_event FactionTurnEnd FactionType slave
        and I_TurnNumber >= 235

        historic_event	eroberung_kasan

        terminate_monitor
    end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- Eroberung Mexikos -------------------------------------
    ;------------------------------------------------------------------------------

    monitor_event FactionTurnStart FactionType spain
        and I_LocalFaction spain
        and I_TurnNumber = 104

        historic_event	cortes_a ;Aufbruch zum Festland (1519)

        terminate_monitor
    end_monitor

    monitor_event FactionTurnStart FactionType spain
        and I_LocalFaction spain
        and I_TurnNumber = 105

        historic_event	cortes_b ;La Malinche (1519)

        terminate_monitor
    end_monitor

    monitor_event FactionTurnStart FactionType spain
        and I_LocalFaction spain
        and I_TurnNumber = 106

        historic_event	cortes_c ;Bündnis mit den Tlaxcalteken (1519)

        terminate_monitor
    end_monitor

    monitor_event FactionTurnStart FactionType spain
        and I_LocalFaction spain
        and I_TurnNumber = 107

        historic_event	cortes_d ;Ankunft in Tenochtitlan (1519)

        terminate_monitor
    end_monitor

    monitor_event FactionTurnStart FactionType spain
        and I_LocalFaction spain
        and I_TurnNumber = 108

        historic_event	cortes_e ;Verrat an Moctezuma (1520)

        terminate_monitor
    end_monitor

    monitor_event FactionTurnStart FactionType spain
        and I_LocalFaction spain
        and I_TurnNumber = 109

        historic_event	cortes_f ;Bestechung von Narvaez (1520)

        terminate_monitor
    end_monitor

    monitor_event FactionTurnStart FactionType spain
        and I_LocalFaction spain
        and I_TurnNumber = 110

        historic_event	cortes_g ;La Noche Triste (1520)

        terminate_monitor
    end_monitor

    monitor_event FactionTurnStart FactionType spain
        and I_LocalFaction spain
        and I_TurnNumber = 111

        historic_event	cortes_h ;Die Pockenepedemie (1520)

        terminate_monitor
    end_monitor

    monitor_event FactionTurnStart FactionType spain
        and I_LocalFaction spain
        and I_TurnNumber = 112

        historic_event	cortes_i ;Beginn der Belagerung (1521)

        terminate_monitor
    end_monitor

    monitor_event FactionTurnStart FactionType spain
        and I_LocalFaction spain
        and I_TurnNumber = 113

        historic_event	cortes_j ;Die Seeblockade (1521)

        terminate_monitor
    end_monitor

    monitor_event FactionTurnStart FactionType spain
        and I_LocalFaction spain
        and I_TurnNumber = 114

        historic_event	cortes_k ;Fall Tenochtitlans (1521)

        terminate_monitor
    end_monitor

    monitor_event FactionTurnStart FactionType spain
        and I_LocalFaction spain
        and I_TurnNumber = 115

        historic_event	cortes_l ;Konsolidierung der Herrschaft (1521)

        terminate_monitor
    end_monitor

    monitor_event FactionTurnStart FactionType spain
        and I_LocalFaction spain
        and I_TurnNumber = 116

        historic_event	cortes_m ;Der Aztekenschatz (1522)

        console_command add_money spain, 20000

        spawn_army
            faction		spain
            character	Alonso de Avila, admiral, age 36, x 11, y 84, direction E
            traits Sailor 2 
            unit		grande carrack			exp 1 armour 0 weapon_lvl 0
        end

        move_strat_camera 11, 94

        terminate_monitor
    end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- Korsar des Königs -------------------------------------
    ;------------------------------------------------------------------------------

    declare_counter Korsar

    monitor_event FactionTurnStart FactionType france
        and I_LocalFaction france	
        and I_TurnNumber = 114

        historic_event korsar_entsenden true 

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType korsar_entsenden_accepted
        and I_EventCounter korsar_entsenden_accepted > 0

        historic_event korsar_entsenden_yes

        console_command add_money france, -2500

        set_counter Korsar 1

        set_faction_standing france spain -0.3
        set_faction_standing spain france -0.3

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType korsar_entsenden_declined
        and I_EventCounter korsar_entsenden_declined > 0

        historic_event korsar_entsenden_no

        set_faction_standing france spain 0.2
        set_faction_standing spain france 0.2

        terminate_monitor
    end_monitor

    monitor_event FactionTurnStart FactionType france
        and I_LocalFaction france
        and I_CompareCounter Korsar = 1
        and I_TurnNumber = 116



        historic_event korsar_schatz ;Piraten kapern den Aztekenschatz

        console_command add_money france, 10000

        spawn_army
            faction		france
            character	Jean Fleury, admiral, age 29, x 8, y 154, direction E
            traits Sailor 1 , FamousPirate 2 
            unit		carrack				exp 3 armour 0 weapon_lvl 0
            unit		carrack				exp 2 armour 0 weapon_lvl 0
        end

        move_strat_camera 8, 164

        terminate_monitor
    end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- Ritter ohne Furcht und Tadel --------------------------
    ;------------------------------------------------------------------------------

    monitor_event PostBattle FactionType france
        and I_EventCounter chevalier_bayard = 0
        and GeneralFoughtFaction spain
        and WonBattle

        historic_event chevalier_bayard

        set_event_counter chevalier_bayard 1

        terminate_monitor
    end_monitor

    monitor_event CharacterTurnStart AgentType = family
        and not FactionwideAncillaryExists chevalier_de_bayard

        if I_EventCounter chevalier_bayard = 1
            set_event_counter chevalier_bayard 0
        end_if

    end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- Kampf den Orsini --------------------------------------
    ;------------------------------------------------------------------------------
    monitor_event FactionTurnStart FactionType papal_states
        and I_TurnNumber = 15

        historic_event kampf_den_orsini factions { papal_states, }

        spawn_army 
            faction slave, sub_faction papal_states
            character random_name, named character, age 42, x 125, y 131
            traits GoodCommander 1 , NaturalMilitarySkill 1, ReligionStarter 1, GoodAttacker 1 , LoyaltyStarter 1 , soeldner 1 
            unit		SE Late Bodyguard			exp 3 armour 0 weapon_lvl 0
            unit		Condottieri				exp 0 armour 0 weapon_lvl 0
            unit		Condottieri				exp 0 armour 0 weapon_lvl 0
            unit		Pike Militia				exp 0 armour 0 weapon_lvl 0
            unit		Pike Militia				exp 0 armour 0 weapon_lvl 0
            unit		Halberd Militia		exp 1 armour 0 weapon_lvl 0
            unit		Halberd Militia		exp 1 armour 0 weapon_lvl 0
            unit		Halberd Militia		exp 1 armour 0 weapon_lvl 0
            unit		Italian Spear Militia		exp 1 armour 0 weapon_lvl 0
            unit		Italian Spear Militia		exp 1 armour 0 weapon_lvl 0
            unit		Pavise Crossbowmen		exp 1 armour 0 weapon_lvl 0
            unit		Pavise Crossbowmen		exp 1 armour 0 weapon_lvl 0
            unit		Pavise Crossbowmen		exp 1 armour 0 weapon_lvl 0

        end

        add_settlement_turmoil Rom 15

        terminate_monitor
    end_monitor


    ;------------------------------------------------------------------------------
    ;---------------------- Petersdom ---------------------------------------------
    ;------------------------------------------------------------------------------

    declare_counter petersdom_bauen
    declare_counter petersdom_ablass
    declare_counter petersdom_kein_ablass
    declare_counter petersdom_counter


    monitor_event SettlementTurnStart SettlementName Rome
        and SettlementBuildingExists = huge_cathedral

        historic_event petersdom true factions { papal_states, }

        terminate_monitor
    end_monitor



    monitor_event EventCounter EventCounterType petersdom_accepted


        historic_event ablasshandel_ja factions { papal_states, }

        add_settlement_turmoil Rome 25

        set_counter petersdom_bauen 1
        set_counter petersdom_ablass 1

        spawn_character slave, Bindello, heretic, age 27, x 123, y 126
        console_command give_trait "Bindello" StrongFaith 3

        spawn_character slave, Lerino, heretic, age 45, x 116, y 154
        console_command give_trait "Lerino" StrongFaith 3

        spawn_character slave, Giovanni, heretic, age 22, x 132, y 163
        console_command give_trait "Giovanni" StrongFaith 3

        terminate_monitor
    end_monitor

    monitor_event EventCounter EventCounterType petersdom_declined

        historic_event ablasshandel_nein factions { papal_states, }

        set_counter petersdom_bauen 1

        set_counter petersdom_kein_ablass 1

        terminate_monitor
    end_monitor

    monitor_event FactionTurnStart FactionType papal_states
        and I_CompareCounter Spieler_ist_Papststaaten = 1

        if I_CompareCounter petersdom_bauen = 1
            and I_CompareCounter petersdom_ablass = 1

            inc_counter petersdom_counter 1

        end_if

        if I_CompareCounter petersdom_bauen = 1
            and I_CompareCounter petersdom_kein_ablass = 1

            console_command add_money papal_states, -5000

            inc_counter petersdom_counter 1

        end_if

        if I_CompareCounter petersdom_bauen = 1
            and I_CompareCounter petersdom_counter = 12

            historic_event petersdom_completed

            console_command create_building Rome petersdom

            set_event_counter petersdom_priester 1


            set_counter petersdom_bauen 0
            terminate_monitor
        end_if

    end_monitor
 

    ;------------------------------------------------------------------------------
    ;---------------------- KI-Expansion ------------------------------------------
    ;------------------------------------------------------------------------------

    ;---------------------- HRE
    monitor_event FactionTurnEnd FactionType hre		;Unterstützungstruppen Salzburg
        and I_IsFactionAIControlled hre
        and I_TurnNumber = 10

        spawn_army 
            faction hre
            character random_name, named character, age 41, x 134, y 242, direction N
            traits GoodCommander 3 , ReligionStarter 1, LoyaltyStarter 1 , GoodAttacker 2, Loyal 3
            unit		NE Late Bodyguard				exp 7 armour 1 weapon_lvl 1
            unit		Landsknecht Pikeniere			exp 4 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 3 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 3 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 0 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 3 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 3 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 0 armour 0 weapon_lvl 0
            unit		Hre Arquebusiers			exp 2 armour 0 weapon_lvl 0				
            unit		Hre Arquebusiers			exp 2 armour 0 weapon_lvl 0
            unit		Hre Arquebusiers			exp 1 armour 0 weapon_lvl 0
            unit		NE Cannon				exp 0 armour 0 weapon_lvl 0
        end

        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType hre		;Unterstützungstruppen Passau
        and I_IsFactionAIControlled hre
        and I_TurnNumber = 12

        spawn_army 
            faction hre
            character random_name, named character, age 41, x 141, y 279, direction N
            traits GoodCommander 3 , ReligionStarter 1, LoyaltyStarter 1 , GoodAttacker 2, Loyal 3
            unit		NE Late Bodyguard				exp 7 armour 1 weapon_lvl 1
            unit		Imperial Knights			exp 4 armour 0 weapon_lvl 0
            unit		Hre Pike Militia			exp 3 armour 2 weapon_lvl 0
            unit		Hre Pike Militia			exp 1 armour 0 weapon_lvl 0
            unit		Halberd Militia				exp 0 armour 1 weapon_lvl 0
            unit		Halberd Militia				exp 3 armour 2 weapon_lvl 0
            unit		Halberd Militia				exp 2 armour 0 weapon_lvl 0
            unit		NE Grand Bombard			exp 0 armour 0 weapon_lvl 0
        end

        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType hre		;Unterstützungstruppen München
        and I_IsFactionAIControlled hre
        and I_TurnNumber = 11

        spawn_army 
            faction hre
            character random_name, named character, age 41, x 106, y 264, direction W
            traits GoodCommander 3 , ReligionStarter 1, LoyaltyStarter 1 , GoodAttacker 2, Loyal 3
            unit		NE Late Bodyguard				exp 7 armour 1 weapon_lvl 1
            unit		Imperial Knights			exp 4 armour 0 weapon_lvl 0
            unit		Hre Arquebusiers			exp 3 armour 2 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 1 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere				exp 0 armour 1 weapon_lvl 0
            unit		Landsknecht Pikeniere				exp 3 armour 2 weapon_lvl 0
            unit		Halberd Militia				exp 2 armour 0 weapon_lvl 0
            unit		NE Cannon			exp 0 armour 0 weapon_lvl 0
        end

        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType hre		;Unterstützungstruppen Ödenburg
        and I_IsFactionAIControlled hre
        and I_TurnNumber = 14

        spawn_army 
            faction hre
            character random_name, named character, age 41, x 183, y 268, direction S
            traits GoodCommander 3 , ReligionStarter 1, LoyaltyStarter 1 , GoodAttacker 2, Loyal 3
            unit		NE Late Bodyguard				exp 7 armour 1 weapon_lvl 1
            unit		Imperial Knights			exp 4 armour 0 weapon_lvl 0
            unit		Hre Arquebusiers			exp 3 armour 2 weapon_lvl 0
            unit		Hre Arquebusiers			exp 1 armour 0 weapon_lvl 0
            unit		Halberd Militia				exp 0 armour 1 weapon_lvl 0
            unit		Halberd Militia				exp 3 armour 2 weapon_lvl 0
            unit		Halberd Militia				exp 2 armour 0 weapon_lvl 0
            unit		NE Cannon			exp 0 armour 0 weapon_lvl 0
        end

        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType hre		;Unterstützungstruppen Marburg
        and I_IsFactionAIControlled hre
        and I_TurnNumber = 15

        spawn_army 
            faction hre
            character random_name, named character, age 41, x 171, y 242, direction E
            traits GoodCommander 3 , ReligionStarter 1, LoyaltyStarter 1 , GoodAttacker 2, Loyal 3
            unit		NE Late Bodyguard				exp 7 armour 1 weapon_lvl 1
            unit		Landsknecht Pikeniere			exp 4 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 2 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 3 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 3 armour 0 weapon_lvl 0
            unit		Landsknecht Pikeniere			exp 0 armour 0 weapon_lvl 0
            unit		Hre Arquebusiers			exp 2 armour 0 weapon_lvl 0
            unit		Hre Arquebusiers			exp 1 armour 0 weapon_lvl 0
            unit		NE Cannon				exp 0 armour 0 weapon_lvl 0
        end

        terminate_monitor
    end_monitor

    ;---------------------- France

    monitor_event FactionTurnEnd FactionType france		;Unterstützungstruppen Nice
        and I_IsFactionAIControlled france
        and I_TurnNumber = 9

        spawn_army 
            faction france
            character random_name, named character, age 28, x 37, y 179
            traits GoodCommander 3 , NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Arquebusiers				exp 2 armour 0 weapon_lvl 0
            unit		Arquebusiers				exp 2 armour 0 weapon_lvl 0
            unit		Frz Gendarmes			exp 1 armour 1 weapon_lvl 0 
            unit		Frz Gendarmes			exp 2 armour 0 weapon_lvl 0
            unit		Pikemen				exp 2 armour 0 weapon_lvl 0
            unit		Pikemen				exp 2 armour 0 weapon_lvl 0
            unit		Pikemen				exp 2 armour 0 weapon_lvl 0
            unit		Pikemen				exp 1 armour 1 weapon_lvl 0
            unit		Pikemen				exp 1 armour 1 weapon_lvl 0
            unit		Pikemen				exp 2 armour 0 weapon_lvl 0
            unit		NE Serpentine				exp 1 armour 1 weapon_lvl 0
            unit		NE Serpentine				exp 1 armour 1 weapon_lvl 0
        end

        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType france		;Unterstützungstruppen Noli
        and I_IsFactionAIControlled france
        and I_TurnNumber > 8
        and I_SettlementOwner Nice = france

        spawn_army 
            faction france
            character random_name, named character, age 48, x 48, y 183
            traits GoodCommander 3 , NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Arquebusiers				exp 2 armour 0 weapon_lvl 0
            unit		Arquebusiers				exp 2 armour 0 weapon_lvl 0
            unit		Frz Gendarmes			exp 1 armour 1 weapon_lvl 0 
            unit		Frz Gendarmes			exp 2 armour 0 weapon_lvl 0
            unit		Pikemen				exp 2 armour 0 weapon_lvl 0
            unit		Pikemen				exp 2 armour 0 weapon_lvl 0
            unit		Pikemen				exp 2 armour 0 weapon_lvl 0
            unit		Pikemen				exp 1 armour 1 weapon_lvl 0
            unit		Pikemen				exp 1 armour 1 weapon_lvl 0
            unit		Pikemen				exp 2 armour 0 weapon_lvl 0
            unit		NE Serpentine				exp 1 armour 1 weapon_lvl 0
            unit		NE Serpentine				exp 1 armour 1 weapon_lvl 0
        end

        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType france		;Unterstützungstruppen Avignon 
        and I_IsFactionAIControlled france
        and DiplomaticStanceFromFaction papal_states = AtWar

        spawn_army 
            faction france
            character random_name, named character, age 28, x 7, y 197
            traits GoodCommander 3 , NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Arquebusiers				exp 2 armour 0 weapon_lvl 0
            unit		Arquebusiers				exp 2 armour 0 weapon_lvl 0
            unit		Frz Gendarmes			exp 1 armour 1 weapon_lvl 0 
            unit		Frz Gendarmes			exp 2 armour 0 weapon_lvl 0
            unit		Pikemen				exp 2 armour 0 weapon_lvl 0
            unit		Pikemen				exp 2 armour 0 weapon_lvl 0
            unit		Pikemen				exp 2 armour 0 weapon_lvl 0
            unit		Pikemen				exp 1 armour 1 weapon_lvl 0
            unit		Pikemen				exp 1 armour 1 weapon_lvl 0
            unit		Pikemen				exp 2 armour 0 weapon_lvl 0
            unit		NE Serpentine				exp 1 armour 1 weapon_lvl 0
            unit		NE Serpentine				exp 1 armour 1 weapon_lvl 0
        end

        spawn_army 
            faction france
            character random_name, named character, age 19, x 8, y 190, label siege_avignon
            traits GoodCommander 3 , NaturalMilitarySkill 1, LoyaltyStarter 1, GoodAttacker 2
            unit		NE Late Bodyguard		exp 3 armour 0 weapon_lvl 0
            unit		Arquebusiers				exp 2 armour 0 weapon_lvl 0
            unit		Arquebusiers				exp 2 armour 0 weapon_lvl 0
            unit		Frz Gendarmes			exp 1 armour 1 weapon_lvl 0 
            unit		Frz Gendarmes			exp 2 armour 0 weapon_lvl 0
            unit		Pikemen				exp 2 armour 0 weapon_lvl 0
            unit		Pikemen				exp 2 armour 0 weapon_lvl 0
            unit		Pikemen				exp 2 armour 0 weapon_lvl 0
            unit		Pikemen				exp 1 armour 1 weapon_lvl 0
            unit		Pikemen				exp 1 armour 1 weapon_lvl 0
            unit		Pikemen				exp 2 armour 0 weapon_lvl 0
            unit		NE Serpentine				exp 1 armour 1 weapon_lvl 0
            unit		NE Serpentine				exp 1 armour 1 weapon_lvl 0
        end

        terminate_monitor
    end_monitor


    monitor_event FactionTurnStart FactionType france
        and I_CharacterExists siege_avignon

        if I_SettlementOwner Avignon = france
            terminate_monitor
        end_if

        if I_SettlementUnderSiege Avignon
            and I_EventCounter avignon_engage = 0
            terminate_monitor 
        end_if

        if I_EventCounter avignon_engage = 1
            siege_settlement siege_avignon, Avignon, attack
            terminate_monitor
        end_if

        if I_EventCounter avignon_engage = 0
            siege_settlement siege_avignon, Avignon, maintain
            set_event_counter avignon_engage 1
        end_if
    end_monitor

    ;------------------------------------------------------------------------------
    ;---------------------- Einzigartigkeit Montfort, Waldburg, La Giulia ---------
    ;------------------------------------------------------------------------------

    monitor_event FactionTurnStart FactionType normans
        and I_EventCounter no_montfort = 0
        and I_UnitExists normans mont_Imperial Knights

        set_event_counter no_montfort 1
    end_monitor

    monitor_event FactionTurnStart FactionType normans
        and I_EventCounter no_montfort = 1
        and not I_UnitExists normans mont_Imperial Knights

        set_event_counter no_montfort 0
    end_monitor

    monitor_event FactionTurnStart FactionType normans
        and I_EventCounter no_waldburg = 0
        and I_UnitExists normans wald_Imperial Knights

        set_event_counter no_waldburg 1
    end_monitor

    monitor_event FactionTurnStart FactionType normans
        and I_EventCounter no_waldburg = 1
        and not I_UnitExists normans wald_Imperial Knights

        set_event_counter no_waldburg 0
    end_monitor

    monitor_event FactionTurnStart FactionType england
        and I_EventCounter no_cannon = 0
        and I_UnitExists england F Basilisk

        set_event_counter no_cannon 1
    end_monitor

    monitor_event FactionTurnStart FactionType england
        and I_EventCounter no_cannon = 1
        and not I_UnitExists england F Basilisk

        set_event_counter no_cannon 0
    end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Zustätzliche Fraktionsanführertitel -------------------
	;------------------------------------------------------------------------------
	;- Testing if a faction controlls a certain large settlement
	;- Gives reference to ancs -> specifc titles according to the faction type
	;- Faction types: 
	;- BK = Big Kingdoms: France, HRE, Spain, Naples, Hungary
	;- IL = Italian Lordships: Milan, Savoy, Mantua, Montferrat, Ferrara, Urbino, Grand Duchy of Tuscany
	;- IR = Italian Republics: Venice, Ragusa, Siena, Bologna, Firenze, Genoa
	;- PS = Papal States
	;- SL = Swabian League
	;- SW = Switzerland
	;- FL = Factionleader
	;- GIS = General in settlement
	;------------------------------------------------------------------------------
	;- Italian Lordships
	;- 1. Milan
	;- - Duke of Milan (FL) (BK, IL, SL)
	;- - Governor-general of Milan (GIS) (IR, BK)
	;- - Vicar-general of Milan (GIS) (PS)
	;- - Mayor of Milan (GIS) (SW)
	;- 2. Mantua
	;- - Marquis of Mantua (FL) (BK, IL, SL)
	;- - Governor-General of Mantua (GIS) (IR, BK)
	;- - Vicar-general of Mantua (GIS) (PS)
	;- - Mayor of Mantua (GIS) (SW)
	;- 3. Ferrara
	;- - Duke of Ferrara (FL) (BK, IL, SL)
	;- - Governor-General of Ferrara (GIS) (IR, BK)
	;- - Vicar-General of Ferrara (GIS) (PS)
	;- - Mayor of Ferrara (GIS) (SW)
	;- 4. Montferrat
	;- - Marquis of Montferrat (FL) (BK, IL, SL)
	;- - Governor-General of Montferrat (GIS) (IR, BK)
	;- - Vicar-General of Montferrat (GIS) (PS) 
	;- - Mayor of (Casale?) (GIS) (SW)
	;- 5. Urbino
	;- - Duke of Urbino (FL) (BK, IL, SL)
	;- - Governor-General of Urbino (GIS) (IR, BK)
	;- - Vicar-General of Urbino (GIS) (PS)
	;- - Mayor of Urbino (GIS) (SW)
	;- 6. Savoy
	;- - Duke of Savoy (FL) (BK, IL, SL)
	;- - Governor-General of Savoy (GIS) (IR, BK)
	;- - Vicar-General of Savoy (GIS) (PS)
	;- - Mayor of Torino (GIS) (SW)
	;- Italian Republics
	;- 7. Firenze
	;- - Grand Duke of Tuscany (FL) / Podesta of Firenze (GIS) (BK, IL, SL)
	;- - Governor-General of Firenze (GIS) (IR)
	;- - Vicar-General of Firenze (GIS) (PS)
	;- - Mayor of Firenze (GIS) (SW)
	;- 8. Genoa
	;- - Duke of Genoa (FL) (BK, IL, SL)
	;- - Doge of Genoa (FL) (IR) / Governor-General of Genoa (GIS) (IR, BK)
	;- - Vicar-General of Genoa (GIS) (PS)
	;- - Mayor of Genoa (GIS) (SW) 
	;- 9. Venice
	;- - Duke of Venice (FL) (BK, IL, SL)
	;- - Doge of Venice (FL) / Governor-General of Venice (GIS) (IR, BK)
	;- - Vicar-General of Venice (GIS) (PS)
	;- - Mayor of Venice (GIS) (SW)
	;- 10. Ragusa
	;- - Rector of Ragusa (FL) (IL, SL, IR) / Governor-General of Ragusa (GIS) (IR, BK)
	;- - Vicar-General of Ragusa (GIS) (PS)
	;- - Mayor of Ragusa (GIS) (SW)
	;- 11. Siena
	;- - Lord of Siena (FL) (BK, IL, SL)
	;- - Consul of Siena (FL) (IR) / Governor-General of Siena (GIS) (IR, BK)
	;- - Vicar-General of Siena (GIS) (PS)
	;- - Mayor of Siena (GIS) (SW)
	;- Big kingdoms
	;- 12. Lyon (France)
	;- - King of France (FL) / Viceroy of Lyon (GIS) (BK)
	;- - Mayor of Lyon (GIS) (IL, SW, SL)
	;- - Governor-General of Lyon (GIS) (IR)
	;- - Vicar-General of Lyon (GIS) (PS)
	;- 13. Naples (Naples)
	;- - King of Naples (FL) / Viceroy of Naples (GIS) (BK)
	;- - Duke of Naples (FL) (IL, SL)
	;- - Governor-General of Naples (GIS) (IR)
	;- - Vicar-General of Naples (GIS) (PS)
	;- - Mayor of Naples (GIS) (SW)
	;- 14. Palermo (Spain)
	;- - King of Sicily (FL) (BK) / Viceroy of Sicily (GIS) (BK)
	;- - Duke of Palermo (FL) (IL, SL)
	;- - Governor-General of Sicily (GIS) (IR)
	;- - Vicar-General of Palermo (GIS) (PS)
	;- - Mayor of Palermo (GIS) (SW)
	;------------------------------------------------------------------------------


	;- Milan
	; Monitor checks if one of the respective factions is in control of Milan,
	; is that the case an event counter will be set 1
	; The event counter will be used to trigger the respective ancillaries 

	monitor_event SettlementTurnStart SettlementName Mailand

	;- France
		if I_SettlementOwner Mailand = france
			set_event_counter fr_m 1
			;historic_event test
		end_if

	;- HRE
		if I_SettlementOwner Mailand = hre
			set_event_counter hre_m 1
		end_if

	;- Spain
		if I_SettlementOwner Mailand = spain
			set_event_counter sp_m 1
		end_if

	;- Naples
		if I_SettlementOwner Mailand = sicily
			set_event_counter sc_m 1
		end_if

	;- Hungary
		if I_SettlementOwner Mailand = hungary
			set_event_counter hr_m 1
		end_if

	end_monitor

	;- Mantua
	monitor_event SettlementTurnStart SettlementName Mantua

	;- France
		if I_SettlementOwner Mantua = france
			set_event_counter fr_man 1
		end_if

	;- HRE
		if I_SettlementOwner Mantua = hre
			set_event_counter hre_man 1
		end_if

	;- Spain
		if I_SettlementOwner Mantua = spain
			set_event_counter sp_man 1
		end_if

	;- Naples
		if I_SettlementOwner Mantua = sicily
			set_event_counter sc_man 1
		end_if

	;- Hungary 
		if I_SettlementOwner Mantua = hungary
			set_event_counter hr_man 1
		end_if

	end_monitor

	;- Ferrara
	monitor_event SettlementTurnStart SettlementName Ferrara

	;- France
		if I_SettlementOwner Ferrara = france
			set_event_counter fr_fer 1
		end_if

	;- HRE
		if I_SettlementOwner Ferrara = hre
			set_event_counter hre_fer 1
		end_if

	;- Spain
		if I_SettlementOwner Ferrara = spain
			set_event_counter sp_fer 1
		end_if

	;- Naples
		if I_SettlementOwner Ferrara = sicily
			set_event_counter sc_fer 1
		end_if

	;- Hungary 
		if I_SettlementOwner Ferrara = hungary
			set_event_counter hr_fer 1
		end_if

	end_monitor

	;- Montferrat
	monitor_event SettlementTurnStart SettlementName Montferrat

	;- France
		if I_SettlementOwner Montferrat = france
			set_event_counter fr_mon 1
		end_if

	;- HRE
		if I_SettlementOwner Montferrat = hre
			set_event_counter hre_mon 1
		end_if

	;- Spain
		if I_SettlementOwner Montferrat = spain
			set_event_counter sp_mon 1
		end_if

	;- Naples
		if I_SettlementOwner Montferrat = sicily
			set_event_counter sc_mon 1
		end_if

	;- Hungary 
		if I_SettlementOwner Montferrat = hungary
			set_event_counter hr_mon 1
		end_if

	end_monitor

	;- Urbino
	monitor_event SettlementTurnStart SettlementName Urbino

	;- France
		if I_SettlementOwner Urbino = france
			set_event_counter fr_ur 1
		end_if

	;- HRE
		if I_SettlementOwner Urbino = hre
			set_event_counter hre_ur 1
		end_if

	;- Spain
		if I_SettlementOwner Urbino = spain
			set_event_counter sp_ur 1
		end_if

	;- Naples
		if I_SettlementOwner Urbino = sicily
			set_event_counter sc_ur 1
		end_if

	;- Hungary 
		if I_SettlementOwner Urbino = hungary
			set_event_counter hr_ur 1
		end_if

	end_monitor

	;- Turin
	monitor_event SettlementTurnStart SettlementName Turin

	;- France
		if I_SettlementOwner Turin = france
			set_event_counter fr_tur 1
		end_if

	;- HRE
		if I_SettlementOwner Turin = hre
			set_event_counter hre_tur 1
		end_if

	;- Spain
		if I_SettlementOwner Turin = spain
			set_event_counter sp_tur 1
		end_if

	;- Naples
		if I_SettlementOwner Turin = sicily
			set_event_counter sc_tur 1
		end_if

	;- Hungary 
		if I_SettlementOwner Turin = hungary
			set_event_counter hr_tur 1
		end_if

	end_monitor

	;- Florence
	monitor_event SettlementTurnStart SettlementName Florenz

	;- France
		if I_SettlementOwner Florenz = france
			set_event_counter fr_fl 1
		end_if

	;- HRE
		if I_SettlementOwner Florenz = hre
			set_event_counter hre_fl 1
		end_if

	;- Spain
		if I_SettlementOwner Florenz = spain
			set_event_counter sp_fl 1
		end_if

	;- Naples
		if I_SettlementOwner Florenz = sicily
			set_event_counter sc_fl 1
		end_if

	;- Hungary 
		if I_SettlementOwner Florenz = hungary
			set_event_counter hr_fl 1
		end_if

	end_monitor

	;- Genoa
	monitor_event SettlementTurnStart SettlementName Genua

	;- France
		if I_SettlementOwner Genua = france
			set_event_counter fr_g 1
			historic_event test
		end_if

	;- HRE
		if I_SettlementOwner Genua = hre
			set_event_counter hre_g 1
		end_if

	;- Spain
		if I_SettlementOwner Genua = spain
			set_event_counter sp_g 1
		end_if

	;- Naples
		if I_SettlementOwner Genua = sicily
			set_event_counter sc_g 1
		end_if

	;- Hungary 
		if I_SettlementOwner Genua = hungary
			set_event_counter hr_g 1
		end_if

	end_monitor

	;- Venice
	monitor_event SettlementTurnStart SettlementName Venedig

	;- France
		if I_SettlementOwner Venedig = france
			set_event_counter fr_v 1
		end_if

	;- HRE
		if I_SettlementOwner Venedig = hre
			set_event_counter hre_v 1
		end_if

	;- Spain
		if I_SettlementOwner Venedig = spain
			set_event_counter sp_v 1
		end_if

	;- Naples
		if I_SettlementOwner Venedig = sicily
			set_event_counter sc_v 1
		end_if

	;- Hungary 
		if I_SettlementOwner Venedig = hungary
			set_event_counter hr_v 1
		end_if

	end_monitor

	;- Ragusa
	monitor_event SettlementTurnStart SettlementName Ragusa

	;- France
		if I_SettlementOwner Ragusa = france
			set_event_counter fr_r 1
		end_if

	;- HRE
		if I_SettlementOwner Ragusa = hre
			set_event_counter hre_r 1
		end_if

	;- Spain
		if I_SettlementOwner Ragusa = spain
			set_event_counter sp_r 1
		end_if

	;- Naples
		if I_SettlementOwner Ragusa = sicily
			set_event_counter sc_r 1
		end_if

	;- Hungary 
		if I_SettlementOwner Ragusa = hungary
			set_event_counter hr_r 1
		end_if

	end_monitor

	;- Siena
	monitor_event SettlementTurnStart SettlementName Siena

	;- France
		if I_SettlementOwner Siena = france
			set_event_counter fr_si 1
		end_if

	;- HRE
		if I_SettlementOwner Siena = hre
			set_event_counter hre_si 1
		end_if

	;- Spain
		if I_SettlementOwner Siena = spain
			set_event_counter sp_si 1
		end_if

	;- Naples
		if I_SettlementOwner Siena = sicily
			set_event_counter sc_si 1
		end_if

	;- Hungary 
		if I_SettlementOwner Siena = hungary
			set_event_counter hr_si 1
		end_if

	end_monitor

	;- Naples
	monitor_event SettlementTurnStart SettlementName Neapel

	;- France
		if I_SettlementOwner Neapel = france
			set_event_counter fr_nap 1
		end_if

	;- HRE
		if I_SettlementOwner Neapel = hre
			set_event_counter hre_nap 1
		end_if

	;- Spain
		if I_SettlementOwner Neapel = spain
			set_event_counter sp_nap 1
		end_if

	;- Naples
	;    if I_SettlementOwner Neapel = sicily
	;        set_event_counter sc_nap 1
	;    end_if

	;- Hungary 
		if I_SettlementOwner Neapel = hungary
			set_event_counter hr_nap 1
		end_if

	end_monitor


	; Monitor checks if  one of the respective faction is STILL in control of Milan,
	; is that NOT the case any more, event counter will be set 0 

	monitor_event FactionTurnEnd FactionIsLocal

	;--------------------------------------------------------------------------
	;- Milan 
	;- France
		if I_SettlementOwner Mailand != france
			set_event_counter fr_m 0
			;historic_event test
		end_if
	
	;- HRE
		if I_SettlementOwner Mailand != hre
			set_event_counter hre_m 0
		end_if

	;- Spain
		if I_SettlementOwner Mailand != spain
			set_event_counter sp_m 0
		end_if

	;- Naples
		if I_SettlementOwner Mailand != sicily
			set_event_counter sc_m 0
		end_if

	;- Hungary
		if I_SettlementOwner Mailand != hungary
			set_event_counter hr_m 0
		end_if

	;--------------------------------------------------------------------------
	;- Mantua 
	;- France
		if I_SettlementOwner Mantua != france
			set_event_counter fr_man 0
		end_if

	;- HRE
		if I_SettlementOwner Mantua != hre
			set_event_counter hre_man 0
		end_if

	;- Spain 
		if I_SettlementOwner Mantua != spain
			set_event_counter sp_man 0
		end_if

	;- Naples 
		if I_SettlementOwner Mantua != sicily
			set_event_counter sc_man 0
		end_if

	;- Hungary
		if I_SettlementOwner Mantua != hungary
			set_event_counter hr_man 0
		end_if

	;--------------------------------------------------------------------------
	;- Ferrara
	;- France
		if I_SettlementOwner Ferrara != france
			set_event_counter fr_fer 0
		end_if

	;- HRE
		if I_SettlementOwner Ferrara != hre
			set_event_counter hre_fer 0
		end_if

	;- Spain 
		if I_SettlementOwner Ferrara != spain
			set_event_counter sp_fer 0
		end_if

	;- Naples 
		if I_SettlementOwner Ferrara != sicily
			set_event_counter sc_fer 0
		end_if

	;- Hungary
		if I_SettlementOwner Ferrara != hungary
			set_event_counter hr_fer 0
		end_if

	;--------------------------------------------------------------------------
	;- Montferrat
	;- France
		if I_SettlementOwner Montferrat != france
			set_event_counter fr_mon 0
		end_if

	;- HRE
		if I_SettlementOwner Montferrat != hre
			set_event_counter hre_mon 0
		end_if

	;- Spain 
		if I_SettlementOwner Montferrat != spain
			set_event_counter sp_mon 0
		end_if

	;- Naples 
		if I_SettlementOwner Montferrat != sicily
			set_event_counter sc_mon 0
		end_if

	;- Hungary
		if I_SettlementOwner Montferrat != hungary
			set_event_counter hr_mon 0
		end_if

	;--------------------------------------------------------------------------
	;- Urbino
	;- France
		if I_SettlementOwner Urbino != france
			set_event_counter fr_ur 0
		end_if

	;- HRE
		if I_SettlementOwner Urbino != hre
			set_event_counter hre_ur 0
		end_if

	;- Spain 
		if I_SettlementOwner Urbino != spain
			set_event_counter sp_ur 0
		end_if

	;- Naples 
		if I_SettlementOwner Urbino != sicily
			set_event_counter sc_ur 0
		end_if

	;- Hungary
		if I_SettlementOwner Urbino != hungary
			set_event_counter hr_ur 0
		end_if

	;--------------------------------------------------------------------------
	;- Turin
	;- France
		if I_SettlementOwner Turin != france
			set_event_counter fr_tur 0
		end_if

	;- HRE
		if I_SettlementOwner Turin != hre
			set_event_counter hre_tur 0
		end_if

	;- Spain 
		if I_SettlementOwner Turin != spain
			set_event_counter sp_tur 0
		end_if

	;- Naples 
		if I_SettlementOwner Turin != sicily
			set_event_counter sc_tur 0
		end_if

	;- Hungary
		if I_SettlementOwner Turin != hungary
			set_event_counter hr_tur 0
		end_if

	;--------------------------------------------------------------------------
	;- Florence
	;- France
		if I_SettlementOwner Florenz != france
			set_event_counter fr_fl 0
		end_if

	;- HRE
		if I_SettlementOwner Florenz != hre
			set_event_counter hre_fl 0
		end_if

	;- Spain 
		if I_SettlementOwner Florenz != spain
			set_event_counter sp_fl 0
		end_if

	;- Naples 
		if I_SettlementOwner Florenz != sicily
			set_event_counter sc_fl 0
		end_if

	;- Hungary
		if I_SettlementOwner Florenz != hungary
			set_event_counter hr_fl 0
		end_if

	;--------------------------------------------------------------------------
	;- Genoa
	;- France
		if I_SettlementOwner Genua != france
			set_event_counter fr_g 0
		end_if

	;- HRE
		if I_SettlementOwner Genua != hre
			set_event_counter hre_g 0
		end_if

	;- Spain 
		if I_SettlementOwner Genua != spain
			set_event_counter sp_g 0
		end_if

	;- Naples 
		if I_SettlementOwner Genua != sicily
			set_event_counter sc_g 0
		end_if

	;- Hungary
		if I_SettlementOwner Genua != hungary
			set_event_counter hr_g 0
		end_if

	;--------------------------------------------------------------------------
	;- Venice
	;- France
		if I_SettlementOwner Venedig != france
			set_event_counter fr_v 0
		end_if

	;- HRE
		if I_SettlementOwner Venedig != hre
			set_event_counter hre_v 0
		end_if

	;- Spain 
		if I_SettlementOwner Venedig != spain
			set_event_counter sp_v 0
		end_if

	;- Naples 
		if I_SettlementOwner Venedig != sicily
			set_event_counter sc_v 0
		end_if

	;- Hungary
		if I_SettlementOwner Venedig != hungary
			set_event_counter hr_v 0
		end_if

	;--------------------------------------------------------------------------
	;- Ragusa
	;- France
		if I_SettlementOwner Ragusa != france
			set_event_counter fr_r 0
		end_if

	;- HRE
		if I_SettlementOwner Ragusa != hre
			set_event_counter hre_r 0
		end_if

	;- Spain 
		if I_SettlementOwner Ragusa != spain
			set_event_counter sp_r 0
		end_if

	;- Naples 
		if I_SettlementOwner Ragusa != sicily
			set_event_counter sc_r 0
		end_if

	;- Hungary
		if I_SettlementOwner Ragusa != hungary
			set_event_counter hr_r 0
		end_if

	;--------------------------------------------------------------------------
	;- Siena
	;- France
		if I_SettlementOwner Siena != france
			set_event_counter fr_si 0
		end_if

	;- HRE
		if I_SettlementOwner Siena != hre
			set_event_counter hre_si 0
		end_if

	;- Spain 
		if I_SettlementOwner Siena != spain
			set_event_counter sp_si 0
		end_if

	;- Naples 
		if I_SettlementOwner Siena != sicily
			set_event_counter sc_si 0
		end_if

	;- Hungary
		if I_SettlementOwner Siena != hungary
			set_event_counter hr_si 0
		end_if

	;--------------------------------------------------------------------------
	;- Naples
	;- France
		if I_SettlementOwner Neapel != france
			set_event_counter fr_nap 0
		end_if

	;- HRE
		if I_SettlementOwner Neapel != hre
			set_event_counter hre_nap 0
		end_if

	;- Spain 
		if I_SettlementOwner Neapel != spain
			set_event_counter sp_nap 0
		end_if

	;- Naples 
		if I_SettlementOwner Neapel != sicily
			set_event_counter sc_nap 0
		end_if

	;- Hungary
		if I_SettlementOwner Neapel != hungary
			set_event_counter hr_nap 0
		end_if

	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Erbentitel entfernen ----------------------------------
	;------------------------------------------------------------------------------
	;- Testing Heir Title
	; If an heir apparent becomes the actual faction leader, the Anc is deleted and moved to the next heir apparent

	;- France
	monitor_event CharacterTurnEnd IsFactionLeader
	and FactionType france
	and HasAncType Heir

		e_select_character
		console_command remove_ancillary this heir_france
	end_monitor

	;- Hre
	monitor_event CharacterTurnEnd IsFactionLeader
	and FactionType hre
	and HasAncType Heir

		e_select_character
		console_command remove_ancillary this heir_hre
	end_monitor

	;- Hungary
	monitor_event CharacterTurnEnd IsFactionLeader
	and FactionType hungary
	and HasAncType Heir

		e_select_character
		console_command remove_ancillary this heir_hungary
	end_monitor

	;- Naples
	monitor_event CharacterTurnEnd IsFactionLeader
	and FactionType sicily
	and HasAncType Heir

		e_select_character
		console_command remove_ancillary this heir_naples
	end_monitor

	;- Turks
	monitor_event CharacterTurnEnd IsFactionLeader
	and FactionType turks
	and HasAncType Heir

		e_select_character
		console_command remove_ancillary this heir_turks
	end_monitor

	;------------------------------------------------------------------------------
	;---------------------- Bischofzähler -----------------------------------------
	;------------------------------------------------------------------------------

	;- Gran
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_gran

		if I_EventCounter bishop_gran = 0
			set_event_counter bishop_gran 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_gran

		if I_EventCounter bishop_gran = 1
			set_event_counter bishop_gran 0
		end_if

	end_monitor
	
	;- Freising
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_freising

		if I_EventCounter bishop_freising = 0
			set_event_counter bishop_freising 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_freising

		if I_EventCounter bishop_freising = 1
			set_event_counter bishop_freising 0
		end_if

	end_monitor
	
	;- Brixen
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_brixen

		if I_EventCounter bishop_brixen = 0
			set_event_counter bishop_brixen 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_brixen

		if I_EventCounter bishop_brixen = 1
			set_event_counter bishop_brixen 0
		end_if

	end_monitor
	
	;- Basel
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_basel

		if I_EventCounter bishop_basel = 0
			set_event_counter bishop_basel 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_basel

		if I_EventCounter bishop_basel = 1
			set_event_counter bishop_basel 0
		end_if

	end_monitor
	
	;- Aix
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_aix

		if I_EventCounter bishop_aix = 0
			set_event_counter bishop_aix 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_aix

		if I_EventCounter bishop_aix = 1
			set_event_counter bishop_aix 0
		end_if

	end_monitor
	
	;- Die
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_die

		if I_EventCounter bishop_die = 0
			set_event_counter bishop_die 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_die

		if I_EventCounter bishop_die = 1
			set_event_counter bishop_die 0
		end_if

	end_monitor

	
	;- Mantua
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_mantua

		if I_EventCounter bishop_mantua = 0
			set_event_counter bishop_mantua 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_mantua

		if I_EventCounter bishop_mantua = 1
			set_event_counter bishop_mantua 0
		end_if

	end_monitor

	;- Malta
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_malta 

		if I_EventCounter bishop_malta = 0
			set_event_counter bishop_malta 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_malta 

		if I_EventCounter bishop_malta = 1
			set_event_counter bishop_malta 0
		end_if

	end_monitor

	;- Ajaccio
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_ajaccio

		if I_EventCounter bishop_ajaccio = 0
			set_event_counter bishop_ajaccio 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_ajaccio

		if I_EventCounter bishop_ajaccio = 1
			set_event_counter bishop_ajaccio 0
		end_if

	end_monitor

	;- Augsburg
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_augsburg

		if I_EventCounter bishop_augsburg = 0
			set_event_counter bishop_augsburg 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_augsburg

		if I_EventCounter bishop_augsburg = 1
			set_event_counter bishop_augsburg 0
		end_if

	end_monitor

	;- Cagliari
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_cagliari

		if I_EventCounter bishop_cagliari = 0
			set_event_counter bishop_cagliari 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_cagliari

		if I_EventCounter bishop_cagliari = 1
			set_event_counter bishop_cagliari 0
		end_if

	end_monitor

	;- Tunis
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_tunis

		if I_EventCounter bishop_tunis = 0
			set_event_counter bishop_tunis 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_tunis

		if I_EventCounter bishop_tunis = 1
			set_event_counter bishop_tunis 0
		end_if

	end_monitor

	;- Venedig
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_venice

		if I_EventCounter bishop_venedig = 0
			set_event_counter bishop_venedig 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_venice

		if I_EventCounter bishop_venedig = 1
			set_event_counter bishop_venedig 0
		end_if

	end_monitor

	;- Mailand
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_milan

		if I_EventCounter bishop_mailand = 0
			set_event_counter bishop_mailand 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_milan

		if I_EventCounter bishop_mailand = 1
			set_event_counter bishop_mailand 0
		end_if

	end_monitor

	;- Marseille
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_marseille

		if I_EventCounter bishop_marseille = 0
			set_event_counter bishop_marseille 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_marseille

		if I_EventCounter bishop_marseille = 1
			set_event_counter bishop_marseille 0
		end_if

	end_monitor

	;- Genua
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_genua

		if I_EventCounter bishop_genua = 0
			set_event_counter bishop_genua 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_genua

		if I_EventCounter bishop_genua = 1
			set_event_counter bishop_genua 0
		end_if

	end_monitor

	;- Palermo
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_palermo

		if I_EventCounter bishop_palermo = 0
			set_event_counter bishop_palermo 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_palermo

		if I_EventCounter bishop_palermo = 1
			set_event_counter bishop_palermo 0
		end_if

	end_monitor

	;- Neapel
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_neapel

		if I_EventCounter bishop_neapel = 0
			set_event_counter bishop_neapel 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_neapel

		if I_EventCounter bishop_neapel = 1
			set_event_counter bishop_neapel 0
		end_if

	end_monitor

	;- Florenz
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_florenz

		if I_EventCounter bishop_florenz = 0
			set_event_counter bishop_florenz 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_florenz

		if I_EventCounter bishop_florenz = 1
			set_event_counter bishop_florenz 0
		end_if

	end_monitor

	;- Ravenna
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_ravenna

		if I_EventCounter bishop_ravenna = 0
			set_event_counter bishop_ravenna 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_ravenna

		if I_EventCounter bishop_ravenna = 1
			set_event_counter bishop_ravenna 0
		end_if

	end_monitor

	;- Zara
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_zara

		if I_EventCounter bishop_zara = 0
			set_event_counter bishop_zara 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_zara

		if I_EventCounter bishop_zara = 1
			set_event_counter bishop_zara 0
		end_if

	end_monitor

	;- Veszprem
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_veszprem

		if I_EventCounter bishop_veszprem = 0
			set_event_counter bishop_veszprem 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_veszprem

		if I_EventCounter bishop_veszprem = 1
			set_event_counter bishop_veszprem 0
		end_if

	end_monitor

	;- Wien
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_wien

		if I_EventCounter bishop_wien = 0
			set_event_counter bishop_wien 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_wien

		if I_EventCounter bishop_wien = 1
			set_event_counter bishop_wien 0
		end_if

	end_monitor

	;- Zagreb
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_zagreb

		if I_EventCounter bishop_zagreb = 0
			set_event_counter bishop_zagreb 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_zagreb

		if I_EventCounter bishop_zagreb = 1
			set_event_counter bishop_zagreb 0
		end_if

	end_monitor

	;- Bari
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_bari

		if I_EventCounter bishop_bari = 0
			set_event_counter bishop_bari 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_bari

		if I_EventCounter bishop_bari = 1
			set_event_counter bishop_bari 0
		end_if

	end_monitor

	;- Trient
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_trient

		if I_EventCounter bishop_trient = 0
			set_event_counter bishop_trient 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_trient

		if I_EventCounter bishop_trient = 1
			set_event_counter bishop_trient 0
		end_if

	end_monitor

	;- Pecs
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_pecs

		if I_EventCounter bishop_pecs = 0
			set_event_counter bishop_pecs 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_pecs

		if I_EventCounter bishop_pecs = 1
			set_event_counter bishop_pecs 0
		end_if

	end_monitor

	;- Chur
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_chur

		if I_EventCounter bishop_chur = 0
			set_event_counter bishop_chur 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_chur

		if I_EventCounter bishop_chur = 1
			set_event_counter bishop_chur 0
		end_if

	end_monitor

	;- Lausanne
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_lausanne

		if I_EventCounter bishop_lausanne = 0
			set_event_counter bishop_lausanne 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_lausanne

		if I_EventCounter bishop_lausanne = 1
			set_event_counter bishop_lausanne 0
		end_if

	end_monitor

	;- Salzburg
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_salzburg

		if I_EventCounter bishop_salzburg = 0
			set_event_counter bishop_salzburg 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_salzburg

		if I_EventCounter bishop_salzburg = 1
			set_event_counter bishop_salzburg 0
		end_if

	end_monitor

	;- Lyon
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_lyon

		if I_EventCounter bishop_lyon = 0
			set_event_counter bishop_lyon 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_lyon

		if I_EventCounter bishop_lyon = 1
			set_event_counter bishop_lyon 0
		end_if

	end_monitor

	;- Strassburg
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_strassburg

		if I_EventCounter bishop_strassburg = 0
			set_event_counter bishop_strassburg 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_strassburg

		if I_EventCounter bishop_strassburg = 1
			set_event_counter bishop_strassburg 0
		end_if

	end_monitor

	;- Sarajevo
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_sarajevo

		if I_EventCounter bishop_sarajevo = 0
			set_event_counter bishop_sarajevo 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_sarajevo

		if I_EventCounter bishop_sarajevo = 1
			set_event_counter bishop_sarajevo 0
		end_if

	end_monitor

	;- Ingolstadt
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_ingolstadt

		if I_EventCounter bishop_ingolstadt = 0
			set_event_counter bishop_ingolstadt 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_ingolstadt

		if I_EventCounter bishop_ingolstadt = 1
			set_event_counter bishop_ingolstadt 0
		end_if

	end_monitor

	;- Dijon
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_dijon

		if I_EventCounter bishop_dijon = 0
			set_event_counter bishop_dijon 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_dijon

		if I_EventCounter bishop_dijon = 1
			set_event_counter bishop_dijon 0
		end_if

	end_monitor

	;- Turin
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_turin

		if I_EventCounter bishop_turin = 0
			set_event_counter bishop_turin 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_turin

		if I_EventCounter bishop_turin = 1
			set_event_counter bishop_turin 0
		end_if

	end_monitor

	;- Reggio
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_reggio

		if I_EventCounter bishop_reggio = 0
			set_event_counter bishop_reggio 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_reggio

		if I_EventCounter bishop_reggio = 1
			set_event_counter bishop_reggio 0
		end_if

	end_monitor

	;- Parma
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_parma

		if I_EventCounter bishop_parma = 0
			set_event_counter bishop_parma 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_parma

		if I_EventCounter bishop_parma = 1
			set_event_counter bishop_parma 0
		end_if

	end_monitor

	;- Spoleto
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_spoleto

		if I_EventCounter bishop_spoleto = 0
			set_event_counter bishop_spoleto 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_spoleto

		if I_EventCounter bishop_spoleto = 1
			set_event_counter bishop_spoleto 0
		end_if

	end_monitor

	;- Triest
	monitor_event CharacterTurnStart AgentType = priest
		and FactionwideAncillaryExists bishop_triest

		if I_EventCounter bishop_triest = 0
			set_event_counter bishop_triest 1
		end_if

	end_monitor

	monitor_event CharacterTurnStart AgentType = priest
		and not FactionwideAncillaryExists bishop_triest

		if I_EventCounter bishop_triest = 1
			set_event_counter bishop_triest 0
		end_if

	end_monitor

	;------------------------------------------------------------------------------
	;----------------------- Log-Hilfe --------------------------------------------
	;------------------------------------------------------------------------------

	declare_counter france_turn
	monitor_event PreFactionTurnStart FactionType france
		set_counter france_turn 1
		log always Turn Start france
	end_monitor
	monitor_event FactionTurnEnd FactionType france
		set_counter france_turn 0
		log always Turn End france
	end_monitor


	declare_counter normans_turn
	monitor_event PreFactionTurnStart FactionType normans
		set_counter normans_turn 1
		log always Turn Start normans
	end_monitor
	monitor_event FactionTurnEnd FactionType normans
		set_counter normans_turn 0
		log always Turn End normans
	end_monitor


	declare_counter hre_turn
	monitor_event PreFactionTurnStart FactionType hre
		set_counter hre_turn 1
		log always Turn Start hre
	end_monitor
	monitor_event FactionTurnEnd FactionType hre
		set_counter hre_turn 0
		log always Turn End hre
	end_monitor


	declare_counter hungary_turn
	monitor_event PreFactionTurnStart FactionType hungary
		set_counter hungary_turn 1
		log always Turn Start hungary
	end_monitor
	monitor_event FactionTurnEnd FactionType hungary
		set_counter hungary_turn 0
		log always Turn End hungary
	end_monitor


	declare_counter saxons_turn
	monitor_event PreFactionTurnStart FactionType saxons
		set_counter saxons_turn 1
		log always Turn Start saxons
	end_monitor
	monitor_event FactionTurnEnd FactionType saxons
		set_counter saxons_turn 0
		log always Turn End saxons
	end_monitor


	declare_counter milan_turn
	monitor_event PreFactionTurnStart FactionType milan
		set_counter milan_turn 1
		log always Turn Start milan
	end_monitor
	monitor_event FactionTurnEnd FactionType milan
		set_counter milan_turn 0
		log always Turn End milan
	end_monitor


	declare_counter venice_turn
	monitor_event PreFactionTurnStart FactionType venice
		set_counter venice_turn 1
		log always Turn Start venice
	end_monitor
	monitor_event FactionTurnEnd FactionType venice
		set_counter venice_turn 0
		log always Turn End venice
	end_monitor


	declare_counter turks_turn
	monitor_event PreFactionTurnStart FactionType turks
		set_counter turks_turn 1
		log always Turn Start turks
	end_monitor
	monitor_event FactionTurnEnd FactionType turks
		set_counter turks_turn 0
		log always Turn End turks
	end_monitor


	declare_counter poland_turn
	monitor_event PreFactionTurnStart FactionType poland
		set_counter poland_turn 1
		log always Turn Start poland
	end_monitor
	monitor_event FactionTurnEnd FactionType poland
		set_counter poland_turn 0
		log always Turn End poland
	end_monitor


	declare_counter papal_states_turn
	monitor_event PreFactionTurnStart FactionType papal_states
		set_counter papal_states_turn 1
		log always Turn Start papal_states
	end_monitor
	monitor_event FactionTurnEnd FactionType papal_states
		set_counter papal_states_turn 0
		log always Turn End papal_states
	end_monitor


	declare_counter sicily_turn
	monitor_event PreFactionTurnStart FactionType sicily
		set_counter sicily_turn 1
		log always Turn Start sicily
	end_monitor
	monitor_event FactionTurnEnd FactionType sicily
		set_counter sicily_turn 0
		log always Turn End sicily
	end_monitor


	declare_counter spain_turn
	monitor_event PreFactionTurnStart FactionType spain
		set_counter spain_turn 1
		log always Turn Start spain
	end_monitor
	monitor_event FactionTurnEnd FactionType spain
		set_counter spain_turn 0
		log always Turn End spain
	end_monitor

	declare_counter england_turn
	monitor_event PreFactionTurnStart FactionType england
		set_counter england_turn 1
		log always Turn Start england
	end_monitor
	monitor_event FactionTurnEnd FactionType england
		set_counter england_turn 0
		log always Turn End england
	end_monitor

	declare_counter denmark_turn
	monitor_event PreFactionTurnStart FactionType denmark
		set_counter denmark_turn 1
		log always Turn Start denmark
	end_monitor
	monitor_event FactionTurnEnd FactionType denmark
		set_counter denmark_turn 0
		log always Turn End denmark
	end_monitor
	
	declare_counter byzantium_turn
	monitor_event PreFactionTurnStart FactionType byzantium
		set_counter byzantium_turn 1
		log always Turn Start byzantium
	end_monitor
	monitor_event FactionTurnEnd FactionType byzantium
		set_counter byzantium_turn 0
		log always Turn End byzantium
	end_monitor
	
	declare_counter russia_turn
	monitor_event PreFactionTurnStart FactionType russia
		set_counter russia_turn 1
		log always Turn Start russia
	end_monitor
	monitor_event FactionTurnEnd FactionType russia
		set_counter russia_turn 0
		log always Turn End russia
	end_monitor
		
	declare_counter scotland_turn
	monitor_event PreFactionTurnStart FactionType scotland
		set_counter scotland_turn 1
		log always Turn Start scotland
	end_monitor
	monitor_event FactionTurnEnd FactionType scotland
		set_counter scotland_turn 0
		log always Turn End scotland
	end_monitor
	
	declare_counter savoy_turn
	monitor_event PreFactionTurnStart FactionType savoy
		set_counter savoy_turn 1
		log always Turn Start savoy
	end_monitor
	monitor_event FactionTurnEnd FactionType savoy
		set_counter savoy_turn 0
		log always Turn End savoy
	end_monitor

	declare_counter montferrat_turn
	monitor_event PreFactionTurnStart FactionType montferrat
		set_counter montferrat_turn 1
		log always Turn Start montferrat
	end_monitor
	monitor_event FactionTurnEnd FactionType montferrat
		set_counter montferrat_turn 0
		log always Turn End montferrat
	end_monitor

	declare_counter urbino_turn
	monitor_event PreFactionTurnStart FactionType urbino
		set_counter urbino_turn 1
		log always Turn Start urbino
	end_monitor
	monitor_event FactionTurnEnd FactionType urbino
		set_counter urbino_turn 0
		log always Turn End urbino
	end_monitor

	declare_counter lucca_turn
	monitor_event PreFactionTurnStart FactionType lucca
		set_counter lucca_turn 1
		log always Turn Start lucca
	end_monitor
	monitor_event FactionTurnEnd FactionType lucca
		set_counter lucca_turn 0
		log always Turn End lucca
	end_monitor

	declare_counter timurids_turn
	monitor_event PreFactionTurnStart FactionType timurids
		set_counter timurids_turn 1
		log always Turn Start bologna
	end_monitor
	monitor_event FactionTurnEnd FactionType timurids
		set_counter timurids_turn 0
		log always Turn End bologna
	end_monitor

    ;------------------------------------------------------------------------------
    ;---------------------- Testen Fraktion am Leben? -----------------------------
    ;------------------------------------------------------------------------------
    declare_counter france_dead
    declare_counter saxons_dead
    declare_counter normans_dead
    declare_counter hre_dead
    declare_counter hungary_dead
    declare_counter turks_dead
    declare_counter venice_dead
    declare_counter milan_dead
    declare_counter poland_dead
    declare_counter papal_states_dead
    declare_counter sicily_dead
    declare_counter spain_dead
    declare_counter savoy_dead
    declare_counter montferrat_dead
    declare_counter timurids_dead
    declare_counter urbino_dead
    declare_counter lucca_dead
    declare_counter egypt_dead
    declare_counter denmark_dead
    declare_counter byzantium_dead
    declare_counter russia_dead
    declare_counter scotland_dead
    declare_counter england_dead

    ;------------------ Existiert die fragliche Fraktion?

    monitor_event FactionTurnEnd FactionType slave
        and I_NumberOfSettlements france < 0
        set_counter france_dead 1
        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType slave
        and I_NumberOfSettlements saxons < 0
        set_counter saxons_dead 1
        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType slave
        and I_NumberOfSettlements normans < 0
        set_counter normans_dead 1
        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType slave
        and I_NumberOfSettlements hre < 0
        set_counter hre_dead 1
        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType slave
        and I_NumberOfSettlements hungary < 0
        set_counter hungary_dead 1
        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType slave
        and I_NumberOfSettlements turks < 0
        set_counter turks_dead 1
        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType slave
        and I_NumberOfSettlements venice < 0
        set_counter venice_dead 1
        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType slave
        and I_NumberOfSettlements milan < 0
        set_counter milan_dead 1
        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType slave
        and I_NumberOfSettlements poland < 0
        set_counter poland_dead 1
        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType slave
        and I_NumberOfSettlements papal_states < 0
        set_counter papal_states_dead 1
        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType slave
        and I_NumberOfSettlements sicily < 0
        set_counter sicily_dead 1
        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType slave
        and I_NumberOfSettlements spain < 0
        set_counter spain_dead 1
        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType slave
        and I_NumberOfSettlements savoy < 0
        set_counter savoy_dead 1
        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType slave
        and I_NumberOfSettlements montferrat < 0
        set_counter montferrat_dead 1
        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType slave
        and I_NumberOfSettlements denmark < 0
        set_counter denmark_dead 1
        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType slave
        and I_NumberOfSettlements byzantium < 0
        set_counter byzantium_dead 1
        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType slave
        and I_NumberOfSettlements england < 0
        set_counter england_dead 1
        terminate_monitor
    end_monitor
    monitor_event FactionTurnEnd FactionType slave
        and I_NumberOfSettlements timurids < 0
        set_counter timurids_dead 1
        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType slave
        and I_NumberOfSettlements russia < 0
        set_counter russia_dead 1
        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType slave
        and I_NumberOfSettlements urbino < 0
        set_counter urbino_dead 1
        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType slave
        and I_NumberOfSettlements lucca < 0
        set_counter lucca_dead 1
        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType slave
        and I_NumberOfSettlements scotland < 0
        set_counter scotland_dead 1
        terminate_monitor
    end_monitor

    monitor_event FactionTurnEnd FactionType slave
        and I_NumberOfSettlements egypt < 0
        set_counter egypt_dead 1
        terminate_monitor
    end_monitor


	;========================================================
	;===================== G5 BAI STUFF =====================
	;========================================================

	;### Germanicu5 ReallyBadAI Battle System Scrips v5.x
	;### This file contains manually programmed AI behaviour eliminating previously unfixable, hardcoded bugs and greatly influences battle performance
	;### Support available at http://www.twcenter.net/forums/forumdisplay.php?f=1745 , http://www.twcenter.net/forums/showthread.php?t=257970 and http://www.twcenter.net/forums/showthread.php?t=253132
	;### Non-private use of code only by permission,
	;### coded by Germanicu5

	;;;;;;;Print Info
	log always Germanicu5 ReallyBadAI v5.7 Running. Please upload log and savegames when reporting battle CTDs for SS.
	monitor_event GameReloaded
		log always Germanicu5 ReallyBadAI v5.7 Running. Please upload log and savegames when reporting battle CTDs for SS.
	end_monitor

	;;;;;;;
	declare_counter g5_battle_difficulty_high
	;;;;;;;
	declare_counter fire_labels
	declare_counter panel_check
	declare_counter player_unit_count
	declare_counter enemy_unit_count
	declare_counter open_battle
	declare_counter labels_only
	declare_counter stakes_lock
	;;;;;;;
	declare_counter pu1_missile
	declare_counter pu2_missile
	declare_counter pu3_missile
	declare_counter pu4_missile
	declare_counter pu5_missile
	declare_counter pu6_missile
	declare_counter pu7_missile
	declare_counter pu8_missile
	declare_counter pu9_missile
	declare_counter pu10_missile
	declare_counter pu11_missile
	declare_counter pu12_missile
	declare_counter pu13_missile
	declare_counter pu14_missile
	declare_counter pu15_missile
	declare_counter pu16_missile
	declare_counter pu17_missile
	declare_counter pu18_missile
	declare_counter pu19_missile
	declare_counter pu20_missile
	;;;;;;;Checks
	declare_counter check_timer
	declare_counter elephant_fix_check
	declare_counter elephant_fix_check_sally
	declare_counter script_delay
	declare_counter reinf_check
	declare_counter sally_defense_check
	declare_counter sally_check
	;;;;;;;Stakes
	declare_counter label_ready
	declare_counter stakes_on
	;;;;;;;Reinforcements
	declare_counter army4_ready
	declare_counter reinf_late

	declare_counter distance_trigger1
	declare_counter distance_trigger2
	declare_counter distance_trigger3
	declare_counter distance_trigger4
	declare_counter distance_trigger5

	declare_counter kill_labelling_reinf_allied
	declare_counter army3_reinf_allied
	declare_counter army4_reinf_allied
	declare_counter army5_reinf_allied
	declare_counter army6_reinf_allied
	declare_counter army7_reinf_allied
	declare_counter army8_reinf_allied
	declare_counter army9_reinf_allied
	declare_counter army10_reinf_allied
	declare_counter army11_reinf_allied
	declare_counter army12_reinf_allied
	declare_counter army13_reinf_allied
	declare_counter army14_reinf_allied
	declare_counter army15_reinf_allied
	declare_counter army16_reinf_allied
	declare_counter launch_alliance_0
	declare_counter launch_alliance_1

	declare_counter apply_strategy
	declare_counter relaunch_movement

	declare_counter att_alliance_ready
	declare_counter def_alliance_ready
	declare_counter def_alliance_ready_siege

	declare_counter army3_moving
	declare_counter army3_run
	declare_counter army3_reinf_late
	declare_counter army4_moving
	declare_counter army4_run
	declare_counter army4_reinf_late
	declare_counter army5_moving
	declare_counter army5_run
	declare_counter army5_reinf_late
	declare_counter army6_moving
	declare_counter army6_run
	declare_counter army6_reinf_late
	declare_counter army7_moving
	declare_counter army7_run
	declare_counter army7_reinf_late
	declare_counter army8_moving
	declare_counter army8_run
	declare_counter army8_reinf_late
	declare_counter army9_moving
	declare_counter army9_run
	declare_counter army9_reinf_late
	declare_counter army10_moving
	declare_counter army10_run
	declare_counter army10_reinf_late
	declare_counter army11_moving
	declare_counter army11_run
	declare_counter army11_reinf_late
	declare_counter army12_moving
	declare_counter army12_run
	declare_counter army12_reinf_late
	declare_counter army13_moving
	declare_counter army13_run
	declare_counter army13_reinf_late
	declare_counter army14_moving
	declare_counter army14_run
	declare_counter army14_reinf_late
	declare_counter army15_moving
	declare_counter army15_run
	declare_counter army15_reinf_late
	declare_counter army16_moving
	declare_counter army16_run
	declare_counter army16_reinf_late

	declare_counter army4_ready_siege ; acts as launching counter
	declare_counter army4_moving_siege
	declare_counter army4_run_siege
	declare_counter reinf_check_interval

	;;;;;;;HA Fix
	declare_counter ha_fix
	;;;;;;;Elephant Fix
	declare_counter elephant_fix
	declare_counter elephant_gate
	declare_counter elephant_gate_s
	declare_counter elephant_gate_tier2
	declare_counter elephant_gate_tier3
	declare_counter elephant_gate_tier2s
	declare_counter elephant_gate_tier3s
	declare_counter rally_walls
	declare_counter rally_walls_s
	declare_counter second_ring
	declare_counter third_ring
	declare_counter second_ring_s
	declare_counter third_ring_s
	declare_counter del_objective
	declare_counter del_objective_s
	;;;;;;;Sally-out
	declare_counter sally-out_fix
	declare_counter sally_defense
	declare_counter reform_back
	declare_counter reform_multi
	declare_counter unit_under_fire
	declare_counter kill_sally
	declare_counter sally_reinf
	declare_counter reset_position
	declare_counter defend_location
	declare_counter reset_army2
	declare_counter assign_labels
	;;;;;;;Siege
	declare_counter siege_fix
	declare_counter army_sieging
	declare_counter army_south
	declare_counter army_north
	declare_counter army_east
	declare_counter army_west
	declare_counter emergency_stop
	declare_counter omfg_cannon_tower
	declare_counter army2_sally
	declare_counter wall_advance_s
	;;;;;;;Protect General
	declare_counter protect_general
	declare_counter general_wait
	declare_counter protect_siege
	declare_counter g_stop
	;;;;;;;Sally-out, AI defending
	declare_counter army4_ready_sally
	declare_counter army4_location
	declare_counter path_n
	declare_counter path_ne
	declare_counter path_e
	declare_counter path_se
	declare_counter path_s
	declare_counter path_sw
	declare_counter path_w
	declare_counter path_nw
	declare_counter obstacle_check
	declare_counter label_army4
	declare_counter army4_moving_s
	declare_counter army4_idle_s
	declare_counter line_passed
	declare_counter army2_idle_s
	declare_counter army4_idle_r
	declare_counter wall_line_passed
	declare_counter reset_position_s
	declare_counter repeat_test1
	declare_counter repeat_test2
	declare_counter repeat_test3
	declare_counter repeat_test4
	declare_counter repeat_test5
	declare_counter repeat_test6
	;;;;;;;Open Battles
	declare_counter ob_defense_launch
	declare_counter ob_defend
	declare_counter ob_siege_attack
	declare_counter ob_under_fire
	declare_counter ob_repeat_test
	declare_counter ob_engaged
	declare_counter player_units_closing
	declare_counter player_enveloping
	declare_counter player_engaged_reinf
	;;;;;;;AI Stuck Fix
	declare_counter ai_stuck_launch
	declare_counter a2u1_stuck
	declare_counter a2u2_stuck
	declare_counter a2u3_stuck
	declare_counter a2u4_stuck
	declare_counter a2u5_stuck
	declare_counter a2u6_stuck
	declare_counter a2u7_stuck
	declare_counter a2u8_stuck
	declare_counter a2u9_stuck
	declare_counter a2u10_stuck
	declare_counter a2u11_stuck
	declare_counter a2u12_stuck
	declare_counter a2u13_stuck
	declare_counter a2u14_stuck
	declare_counter a2u15_stuck
	declare_counter a2u16_stuck
	declare_counter a2u17_stuck
	declare_counter a2u18_stuck
	declare_counter a2u19_stuck
	declare_counter a2u20_stuck
	declare_counter a2u1_status
	declare_counter a2u2_status
	declare_counter a2u3_status
	declare_counter a2u4_status
	declare_counter a2u5_status
	declare_counter a2u6_status
	declare_counter a2u7_status
	declare_counter a2u8_status
	declare_counter a2u9_status
	declare_counter a2u10_status
	declare_counter a2u11_status
	declare_counter a2u12_status
	declare_counter a2u13_status
	declare_counter a2u14_status
	declare_counter a2u15_status
	declare_counter a2u16_status
	declare_counter a2u17_status
	declare_counter a2u18_status
	declare_counter a2u19_status
	declare_counter a2u20_status
	declare_counter a2u1_distance
	declare_counter a2u2_distance
	declare_counter a2u3_distance
	declare_counter a2u4_distance
	declare_counter a2u5_distance
	declare_counter a2u6_distance
	declare_counter a2u7_distance
	declare_counter a2u8_distance
	declare_counter a2u9_distance
	declare_counter a2u10_distance
	declare_counter a2u11_distance
	declare_counter a2u12_distance
	declare_counter a2u13_distance
	declare_counter a2u14_distance
	declare_counter a2u15_distance
	declare_counter a2u16_distance
	declare_counter a2u17_distance
	declare_counter a2u18_distance
	declare_counter a2u19_distance
	declare_counter a2u20_distance
	;;;;;;;
	set_event_counter no_advice 1

	monitor_event PreFactionTurnStart FactionIsLocal
		and BattleDifficulty > medium

		set_counter g5_battle_difficulty_high 1
		terminate_monitor
	end_monitor

	monitor_event PreFactionTurnStart FactionIsLocal
		and I_CompareCounter panel_check != 1

		set_counter panel_check 1
	end_monitor

	monitor_event GeneralAssaultsGeneral TargetFactionIsLocal
		and I_CompareCounter panel_check != 1

		set_counter panel_check 1
	end_monitor

	monitor_event GeneralAssaultsGeneral ! FactionIsLocal
		and ! TargetFactionIsLocal
		and I_CompareCounter panel_check != 2

		set_counter panel_check 2
	end_monitor

	monitor_event GeneralAssaultsResidence TargetFactionIsLocal
		and I_CompareCounter panel_check != 1

		set_counter panel_check 1
	end_monitor

	monitor_event GeneralAssaultsResidence ! FactionIsLocal
		and ! TargetFactionIsLocal
		and I_CompareCounter panel_check != 2

		set_counter panel_check 2
	end_monitor

	monitor_event ButtonPressed ButtonPressed prebattle_fight_button
		and I_CompareCounter panel_check = 1

		;    suspend_unscripted_advice true
		set_counter fire_labels 10
		;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
		set_counter player_unit_count 0
		set_counter enemy_unit_count 0
		set_counter open_battle 0
		set_counter labels_only 0
		set_counter stakes_lock 0
		;;;;;;;
		set_counter pu1_missile 0
		set_counter pu2_missile 0
		set_counter pu3_missile 0
		set_counter pu4_missile 0
		set_counter pu5_missile 0
		set_counter pu6_missile 0
		set_counter pu7_missile 0
		set_counter pu8_missile 0
		set_counter pu9_missile 0
		set_counter pu10_missile 0
		set_counter pu11_missile 0
		set_counter pu12_missile 0
		set_counter pu13_missile 0
		set_counter pu14_missile 0
		set_counter pu15_missile 0
		set_counter pu16_missile 0
		set_counter pu17_missile 0
		set_counter pu18_missile 0
		set_counter pu19_missile 0
		set_counter pu20_missile 0
		;;;;;;;Checks
		set_counter check_timer 0
		set_counter elephant_fix_check 0
		set_counter elephant_fix_check_sally 0
		set_counter reinf_check 0
		set_counter script_delay 0
		set_counter sally_defense_check 0
		set_counter sally_check 0
		;;;;;;;Stakes
		set_counter label_ready 0
		set_counter stakes_on 0
		;;;;;;;Reinforcements
		set_counter army4_ready 0
		set_counter reinf_late 0

		set_counter distance_trigger1 0
		set_counter distance_trigger2 0
		set_counter distance_trigger3 0
		set_counter distance_trigger4 0
		set_counter distance_trigger5 0

		set_counter kill_labelling_reinf_allied 0
		set_counter army3_reinf_allied 0
		set_counter army4_reinf_allied 0
		set_counter army5_reinf_allied 0
		set_counter army6_reinf_allied 0
		set_counter army7_reinf_allied 0
		set_counter army8_reinf_allied 0
		set_counter army9_reinf_allied 0
		set_counter army10_reinf_allied 0
		set_counter army11_reinf_allied 0
		set_counter army12_reinf_allied 0
		set_counter army13_reinf_allied 0
		set_counter army14_reinf_allied 0
		set_counter army15_reinf_allied 0
		set_counter army16_reinf_allied 0
		set_counter launch_alliance_0 0
		set_counter launch_alliance_1 0

		set_counter apply_strategy 0
		set_counter relaunch_movement 0

		set_counter att_alliance_ready 0
		set_counter def_alliance_ready 0
		set_counter def_alliance_ready_siege 0

		set_counter army3_moving 0
		set_counter army3_run 0
		set_counter army3_reinf_late 0
		set_counter army4_moving 0
		set_counter army4_run 0
		set_counter army4_reinf_late 0
		set_counter army5_moving 0
		set_counter army5_run 0
		set_counter army5_reinf_late 0
		set_counter army6_moving 0
		set_counter army6_run 0
		set_counter army6_reinf_late 0
		set_counter army7_moving 0
		set_counter army7_run 0
		set_counter army7_reinf_late 0
		set_counter army8_moving 0
		set_counter army8_run 0
		set_counter army8_reinf_late 0
		set_counter army9_moving 0
		set_counter army9_run 0
		set_counter army9_reinf_late 0
		set_counter army10_moving 0
		set_counter army10_run 0
		set_counter army10_reinf_late 0
		set_counter army11_moving 0
		set_counter army11_run 0
		set_counter army11_reinf_late 0
		set_counter army12_moving 0
		set_counter army12_run 0
		set_counter army12_reinf_late 0
		set_counter army13_moving 0
		set_counter army13_run 0
		set_counter army13_reinf_late 0
		set_counter army14_moving 0
		set_counter army14_run 0
		set_counter army14_reinf_late 0
		set_counter army15_moving 0
		set_counter army15_run 0
		set_counter army15_reinf_late 0
		set_counter army16_moving 0
		set_counter army16_run 0
		set_counter army16_reinf_late 0

		set_counter army4_ready_siege 0 ; acts as launching counter
		set_counter army4_moving_siege 0
		set_counter army4_run_siege 0
		set_counter reinf_check_interval 0

		;;;;;;;HA Fix
		set_counter ha_fix 0
		;;;;;;;Elephant Fix
		set_counter elephant_fix 0
		set_counter elephant_gate 0
		set_counter elephant_gate_s 0
		set_counter elephant_gate_tier2 0
		set_counter elephant_gate_tier3 0
		set_counter elephant_gate_tier2s 0
		set_counter elephant_gate_tier3s 0
		set_counter rally_walls 0
		set_counter rally_walls_s 0
		set_counter second_ring 0
		set_counter third_ring 0
		set_counter second_ring_s 0
		set_counter third_ring_s 0
		set_counter del_objective 0
		set_counter del_objective_s 0
		;;;;;;;Sally-out
		set_counter sally-out_fix 0
		set_counter sally_defense 0
		set_counter reform_back 0
		set_counter reform_multi 0
		set_counter unit_under_fire 0
		set_counter kill_sally 0
		set_counter sally_reinf 0
		set_counter reset_position 0
		set_counter defend_location 0
		set_counter reset_army2 0
		set_counter assign_labels 0
		;;;;;;;Siege
		set_counter siege_fix 0
		set_counter army_sieging 0
		set_counter army_south 0
		set_counter army_north 0
		set_counter army_east 0
		set_counter army_west 0
		set_counter emergency_stop 0
		set_counter omfg_cannon_tower 0
		set_counter army2_sally 0
		set_counter wall_advance_s 0
		;;;;;;;Protect General
		set_counter protect_general 0
		set_counter general_wait 0
		set_counter protect_siege 0
		set_counter g_stop 0
		;;;;;;;Sally-out, AI defending
		set_counter army4_ready_sally 0
		set_counter army4_location 0
		set_counter path_n 0
		set_counter path_ne 0
		set_counter path_e 0
		set_counter path_se 0
		set_counter path_s 0
		set_counter path_sw 0
		set_counter path_w 0
		set_counter path_nw 0
		set_counter obstacle_check 0
		set_counter label_army4 0
		set_counter army4_moving_s 0
		set_counter army4_idle_s 0
		set_counter line_passed 0
		set_counter army2_idle_s 0
		set_counter army4_idle_r 0
		set_counter wall_line_passed 0
		set_counter reset_position_s 0
		set_counter repeat_test1 0
		set_counter repeat_test2 0
		set_counter repeat_test3 0
		set_counter repeat_test4 0
		set_counter repeat_test5 0
		set_counter repeat_test6 0
		;;;;;;;Open Battles
		set_counter ob_defense_launch 0
		set_counter ob_defend 0
		set_counter ob_siege_attack 0
		set_counter ob_under_fire 0
		set_counter ob_repeat_test 0
		set_counter ob_engaged 0
		set_counter player_units_closing 0
		set_counter player_enveloping 0
		set_counter player_engaged_reinf 0
		;;;;;;;AI Stuck Fix
		set_counter ai_stuck_launch 0
		set_counter a2u1_stuck 0
		set_counter a2u2_stuck 0
		set_counter a2u3_stuck 0
		set_counter a2u4_stuck 0
		set_counter a2u5_stuck 0
		set_counter a2u6_stuck 0
		set_counter a2u7_stuck 0
		set_counter a2u8_stuck 0
		set_counter a2u9_stuck 0
		set_counter a2u10_stuck 0
		set_counter a2u11_stuck 0
		set_counter a2u12_stuck 0
		set_counter a2u13_stuck 0
		set_counter a2u14_stuck 0
		set_counter a2u15_stuck 0
		set_counter a2u16_stuck 0
		set_counter a2u17_stuck 0
		set_counter a2u18_stuck 0
		set_counter a2u19_stuck 0
		set_counter a2u20_stuck 0
		set_counter a2u1_status 0
		set_counter a2u2_status 0
		set_counter a2u3_status 0
		set_counter a2u4_status 0
		set_counter a2u5_status 0
		set_counter a2u6_status 0
		set_counter a2u7_status 0
		set_counter a2u8_status 0
		set_counter a2u9_status 0
		set_counter a2u10_status 0
		set_counter a2u11_status 0
		set_counter a2u12_status 0
		set_counter a2u13_status 0
		set_counter a2u14_status 0
		set_counter a2u15_status 0
		set_counter a2u16_status 0
		set_counter a2u17_status 0
		set_counter a2u18_status 0
		set_counter a2u19_status 0
		set_counter a2u20_status 0
		set_counter a2u1_distance 0
		set_counter a2u2_distance 0
		set_counter a2u3_distance 0
		set_counter a2u4_distance 0
		set_counter a2u5_distance 0
		set_counter a2u6_distance 0
		set_counter a2u7_distance 0
		set_counter a2u8_distance 0
		set_counter a2u9_distance 0
		set_counter a2u10_distance 0
		set_counter a2u11_distance 0
		set_counter a2u12_distance 0
		set_counter a2u13_distance 0
		set_counter a2u14_distance 0
		set_counter a2u15_distance 0
		set_counter a2u16_distance 0
		set_counter a2u17_distance 0
		set_counter a2u18_distance 0
		set_counter a2u19_distance 0
		set_counter a2u20_distance 0
		prepare_for_battle
	end_monitor

	monitor_conditions I_InBattle
		and I_CompareCounter fire_labels = 10

		set_counter fire_labels 0
		battle_wait 0.1

		if ! I_BattleIsSiegeBattle
			set_counter fire_labels 1
		end_if

		if I_BattleIsSiegeBattle
			and I_BattleEnemyArmyNumberOfMountClass elephant > 0
			set_counter fire_labels 1
		end_if

		if I_BattlePlayerArmyIsAttacker

			;;;Army 1
			set_counter player_unit_count 0
			if I_BattlePlayerArmyNumberOfUnits > 0
				label_unit 0 0 0 a1u1
				inc_counter player_unit_count 1
				if I_BattlePlayerArmyNumberOfUnits > 1
					label_unit 0 0 1 a1u2
					inc_counter player_unit_count 1
					if I_BattlePlayerArmyNumberOfUnits > 2
						label_unit 0 0 2 a1u3
						inc_counter player_unit_count 1
						if I_BattlePlayerArmyNumberOfUnits > 3
							label_unit 0 0 3 a1u4
							inc_counter player_unit_count 1
							if I_BattlePlayerArmyNumberOfUnits > 4
								label_unit 0 0 4 a1u5
								inc_counter player_unit_count 1
								if I_BattlePlayerArmyNumberOfUnits > 5
									label_unit 0 0 5 a1u6
									inc_counter player_unit_count 1
									if I_BattlePlayerArmyNumberOfUnits > 6
										label_unit 0 0 6 a1u7
										inc_counter player_unit_count 1
										if I_BattlePlayerArmyNumberOfUnits > 7
											label_unit 0 0 7 a1u8
											inc_counter player_unit_count 1
											if I_BattlePlayerArmyNumberOfUnits > 8
												label_unit 0 0 8 a1u9
												inc_counter player_unit_count 1
												if I_BattlePlayerArmyNumberOfUnits > 9
													label_unit 0 0 9 a1u10
													inc_counter player_unit_count 1
													if I_BattlePlayerArmyNumberOfUnits > 10
														label_unit 0 0 10 a1u11
														inc_counter player_unit_count 1
														if I_BattlePlayerArmyNumberOfUnits > 11
															label_unit 0 0 11 a1u12
															inc_counter player_unit_count 1
															if I_BattlePlayerArmyNumberOfUnits > 12
																label_unit 0 0 12 a1u13
																inc_counter player_unit_count 1
																if I_BattlePlayerArmyNumberOfUnits > 13
																	label_unit 0 0 13 a1u14
																	inc_counter player_unit_count 1
																	if I_BattlePlayerArmyNumberOfUnits > 14
																		label_unit 0 0 14 a1u15
																		inc_counter player_unit_count 1
																		if I_BattlePlayerArmyNumberOfUnits > 15
																			label_unit 0 0 15 a1u16
																			inc_counter player_unit_count 1
																			if I_BattlePlayerArmyNumberOfUnits > 16
																				label_unit 0 0 16 a1u17
																				inc_counter player_unit_count 1
																				if I_BattlePlayerArmyNumberOfUnits > 17
																					label_unit 0 0 17 a1u18
																					inc_counter player_unit_count 1
																					if I_BattlePlayerArmyNumberOfUnits > 18
																						label_unit 0 0 18 a1u19
																						inc_counter player_unit_count 1
																						if I_BattlePlayerArmyNumberOfUnits = 20
																							label_unit 0 0 19 a1u20
																							inc_counter player_unit_count 1
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if
		if I_BattlePlayerArmyIsAttacker
			;    and ! I_BattleIsSiegeBattle
			;;;Army 2
			set_counter enemy_unit_count 0
			if I_BattleEnemyArmyNumberOfUnits > 0
				label_unit 1 0 0 a2u1
				inc_counter enemy_unit_count 1
				if I_BattleEnemyArmyNumberOfUnits > 1
					label_unit 1 0 1 a2u2
					inc_counter enemy_unit_count 1
					if I_BattleEnemyArmyNumberOfUnits > 2
						label_unit 1 0 2 a2u3
						inc_counter enemy_unit_count 1
						if I_BattleEnemyArmyNumberOfUnits > 3
							label_unit 1 0 3 a2u4
							inc_counter enemy_unit_count 1
							if I_BattleEnemyArmyNumberOfUnits > 4
								label_unit 1 0 4 a2u5
								inc_counter enemy_unit_count 1
								if I_BattleEnemyArmyNumberOfUnits > 5
									label_unit 1 0 5 a2u6
									inc_counter enemy_unit_count 1
									if I_BattleEnemyArmyNumberOfUnits > 6
										label_unit 1 0 6 a2u7
										inc_counter enemy_unit_count 1
										if I_BattleEnemyArmyNumberOfUnits > 7
											label_unit 1 0 7 a2u8
											inc_counter enemy_unit_count 1
											if I_BattleEnemyArmyNumberOfUnits > 8
												label_unit 1 0 8 a2u9
												inc_counter enemy_unit_count 1
												if I_BattleEnemyArmyNumberOfUnits > 9
													label_unit 1 0 9 a2u10
													inc_counter enemy_unit_count 1
													if I_BattleEnemyArmyNumberOfUnits > 10
														label_unit 1 0 10 a2u11
														inc_counter enemy_unit_count 1
														if I_BattleEnemyArmyNumberOfUnits > 11
															label_unit 1 0 11 a2u12
															inc_counter enemy_unit_count 1
															if I_BattleEnemyArmyNumberOfUnits > 12
																label_unit 1 0 12 a2u13
																inc_counter enemy_unit_count 1
																if I_BattleEnemyArmyNumberOfUnits > 13
																	label_unit 1 0 13 a2u14
																	inc_counter enemy_unit_count 1
																	if I_BattleEnemyArmyNumberOfUnits > 14
																		label_unit 1 0 14 a2u15
																		inc_counter enemy_unit_count 1
																		if I_BattleEnemyArmyNumberOfUnits > 15
																			label_unit 1 0 15 a2u16
																			inc_counter enemy_unit_count 1
																			if I_BattleEnemyArmyNumberOfUnits > 16
																				label_unit 1 0 16 a2u17
																				inc_counter enemy_unit_count 1
																				if I_BattleEnemyArmyNumberOfUnits > 17
																					label_unit 1 0 17 a2u18
																					inc_counter enemy_unit_count 1
																					if I_BattleEnemyArmyNumberOfUnits > 18
																						label_unit 1 0 18 a2u19
																						inc_counter enemy_unit_count 1
																						if I_BattleEnemyArmyNumberOfUnits = 20
																							label_unit 1 0 19 a2u20
																							inc_counter enemy_unit_count 1
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if

		if I_BattlePlayerArmyIsAttacker

			if I_BattlePlayerArmyNumberOfUnits = 1
				define_unit_group army1 a1u1
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 2
				define_unit_group army1 a1u1 a1u2
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 3
				define_unit_group army1 a1u1 a1u2 a1u3
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 4
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 5
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 6
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 7
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 8
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 9
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 10
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 11
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a1u11
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 12
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a1u11 a1u12
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 13
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a1u11 a1u12 a1u13
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 14
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a1u11 a1u12 a1u13 a1u14
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 15
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a1u11 a1u12 a1u13 a1u14 a1u15
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 16
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a1u11 a1u12 a1u13 a1u14 a1u15 a1u16
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 17
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a1u11 a1u12 a1u13 a1u14 a1u15 a1u16 a1u17
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 18
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a1u11 a1u12 a1u13 a1u14 a1u15 a1u16 a1u17 a1u18
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 19
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a1u11 a1u12 a1u13 a1u14 a1u15 a1u16 a1u17 a1u18 a1u19
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 20
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a1u11 a1u12 a1u13 a1u14 a1u15 a1u16 a1u17 a1u18 a1u19 a1u20
			end_if
		end_if

		if I_BattlePlayerArmyIsAttacker
			;    and ! I_BattleIsSiegeBattle
			if I_BattleEnemyArmyNumberOfUnits = 1
				define_unit_group army2 a2u1
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 2
				define_unit_group army2 a2u1 a2u2
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 3
				define_unit_group army2 a2u1 a2u2 a2u3
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 4
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 5
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 6
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 7
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 8
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 9
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 10
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 11
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a2u11
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 12
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a2u11 a2u12
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 13
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a2u11 a2u12 a2u13
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 14
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a2u11 a2u12 a2u13 a2u14
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 15
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a2u11 a2u12 a2u13 a2u14 a2u15
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 16
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a2u11 a2u12 a2u13 a2u14 a2u15 a2u16
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 17
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a2u11 a2u12 a2u13 a2u14 a2u15 a2u16 a2u17
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 18
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a2u11 a2u12 a2u13 a2u14 a2u15 a2u16 a2u17 a2u18
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 19
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a2u11 a2u12 a2u13 a2u14 a2u15 a2u16 a2u17 a2u18 a2u19
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 20
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a2u11 a2u12 a2u13 a2u14 a2u15 a2u16 a2u17 a2u18 a2u19 a2u20
			end_if
		end_if
		if ! I_BattlePlayerArmyIsAttacker
			;;;Army 1
			set_counter enemy_unit_count 0
			if I_BattleEnemyArmyNumberOfUnits > 0
				label_unit 0 0 0 a1u1
				inc_counter enemy_unit_count 1
				if I_BattleEnemyArmyNumberOfUnits > 1
					label_unit 0 0 1 a1u2
					inc_counter enemy_unit_count 1
					if I_BattleEnemyArmyNumberOfUnits > 2
						label_unit 0 0 2 a1u3
						inc_counter enemy_unit_count 1
						if I_BattleEnemyArmyNumberOfUnits > 3
							label_unit 0 0 3 a1u4
							inc_counter enemy_unit_count 1
							if I_BattleEnemyArmyNumberOfUnits > 4
								label_unit 0 0 4 a1u5
								inc_counter enemy_unit_count 1
								if I_BattleEnemyArmyNumberOfUnits > 5
									label_unit 0 0 5 a1u6
									inc_counter enemy_unit_count 1
									if I_BattleEnemyArmyNumberOfUnits > 6
										label_unit 0 0 6 a1u7
										inc_counter enemy_unit_count 1
										if I_BattleEnemyArmyNumberOfUnits > 7
											label_unit 0 0 7 a1u8
											inc_counter enemy_unit_count 1
											if I_BattleEnemyArmyNumberOfUnits > 8
												label_unit 0 0 8 a1u9
												inc_counter enemy_unit_count 1
												if I_BattleEnemyArmyNumberOfUnits > 9
													label_unit 0 0 9 a1u10
													inc_counter enemy_unit_count 1
													if I_BattleEnemyArmyNumberOfUnits > 10
														label_unit 0 0 10 a1u11
														inc_counter enemy_unit_count 1
														if I_BattleEnemyArmyNumberOfUnits > 11
															label_unit 0 0 11 a1u12
															inc_counter enemy_unit_count 1
															if I_BattleEnemyArmyNumberOfUnits > 12
																label_unit 0 0 12 a1u13
																inc_counter enemy_unit_count 1
																if I_BattleEnemyArmyNumberOfUnits > 13
																	label_unit 0 0 13 a1u14
																	inc_counter enemy_unit_count 1
																	if I_BattleEnemyArmyNumberOfUnits > 14
																		label_unit 0 0 14 a1u15
																		inc_counter enemy_unit_count 1
																		if I_BattleEnemyArmyNumberOfUnits > 15
																			label_unit 0 0 15 a1u16
																			inc_counter enemy_unit_count 1
																			if I_BattleEnemyArmyNumberOfUnits > 16
																				label_unit 0 0 16 a1u17
																				inc_counter enemy_unit_count 1
																				if I_BattleEnemyArmyNumberOfUnits > 17
																					label_unit 0 0 17 a1u18
																					inc_counter enemy_unit_count 1
																					if I_BattleEnemyArmyNumberOfUnits > 18
																						label_unit 0 0 18 a1u19
																						inc_counter enemy_unit_count 1
																						if I_BattleEnemyArmyNumberOfUnits = 20
																							label_unit 0 0 19 a1u20
																							inc_counter enemy_unit_count 1
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if

			;;;Army 2
			set_counter player_unit_count 0
			if I_BattlePlayerArmyNumberOfUnits > 0
				label_unit 1 0 0 a2u1
				inc_counter player_unit_count 1
				if I_BattlePlayerArmyNumberOfUnits > 1
					label_unit 1 0 1 a2u2
					inc_counter player_unit_count 1
					if I_BattlePlayerArmyNumberOfUnits > 2
						label_unit 1 0 2 a2u3
						inc_counter player_unit_count 1
						if I_BattlePlayerArmyNumberOfUnits > 3
							label_unit 1 0 3 a2u4
							inc_counter player_unit_count 1
							if I_BattlePlayerArmyNumberOfUnits > 4
								label_unit 1 0 4 a2u5
								inc_counter player_unit_count 1
								if I_BattlePlayerArmyNumberOfUnits > 5
									label_unit 1 0 5 a2u6
									inc_counter player_unit_count 1
									if I_BattlePlayerArmyNumberOfUnits > 6
										label_unit 1 0 6 a2u7
										inc_counter player_unit_count 1
										if I_BattlePlayerArmyNumberOfUnits > 7
											label_unit 1 0 7 a2u8
											inc_counter player_unit_count 1
											if I_BattlePlayerArmyNumberOfUnits > 8
												label_unit 1 0 8 a2u9
												inc_counter player_unit_count 1
												if I_BattlePlayerArmyNumberOfUnits > 9
													label_unit 1 0 9 a2u10
													inc_counter player_unit_count 1
													if I_BattlePlayerArmyNumberOfUnits > 10
														label_unit 1 0 10 a2u11
														inc_counter player_unit_count 1
														if I_BattlePlayerArmyNumberOfUnits > 11
															label_unit 1 0 11 a2u12
															inc_counter player_unit_count 1
															if I_BattlePlayerArmyNumberOfUnits > 12
																label_unit 1 0 12 a2u13
																inc_counter player_unit_count 1
																if I_BattlePlayerArmyNumberOfUnits > 13
																	label_unit 1 0 13 a2u14
																	inc_counter player_unit_count 1
																	if I_BattlePlayerArmyNumberOfUnits > 14
																		label_unit 1 0 14 a2u15
																		inc_counter player_unit_count 1
																		if I_BattlePlayerArmyNumberOfUnits > 15
																			label_unit 1 0 15 a2u16
																			inc_counter player_unit_count 1
																			if I_BattlePlayerArmyNumberOfUnits > 16
																				label_unit 1 0 16 a2u17
																				inc_counter player_unit_count 1
																				if I_BattlePlayerArmyNumberOfUnits > 17
																					label_unit 1 0 17 a2u18
																					inc_counter player_unit_count 1
																					if I_BattlePlayerArmyNumberOfUnits > 18
																						label_unit 1 0 18 a2u19
																						inc_counter player_unit_count 1
																						if I_BattlePlayerArmyNumberOfUnits = 20
																							label_unit 1 0 19 a2u20
																							inc_counter player_unit_count 1
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if

			if I_BattleEnemyArmyNumberOfUnits = 1
				define_unit_group army1 a1u1
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 2
				define_unit_group army1 a1u1 a1u2
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 3
				define_unit_group army1 a1u1 a1u2 a1u3
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 4
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 5
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 6
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 7
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 8
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 9
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 10
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 11
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a1u11
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 12
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a1u11 a1u12
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 13
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a1u11 a1u12 a1u13
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 14
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a1u11 a1u12 a1u13 a1u14
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 15
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a1u11 a1u12 a1u13 a1u14 a1u15
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 16
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a1u11 a1u12 a1u13 a1u14 a1u15 a1u16
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 17
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a1u11 a1u12 a1u13 a1u14 a1u15 a1u16 a1u17
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 18
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a1u11 a1u12 a1u13 a1u14 a1u15 a1u16 a1u17 a1u18
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 19
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a1u11 a1u12 a1u13 a1u14 a1u15 a1u16 a1u17 a1u18 a1u19
			end_if
			if I_BattleEnemyArmyNumberOfUnits = 20
				define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a1u11 a1u12 a1u13 a1u14 a1u15 a1u16 a1u17 a1u18 a1u19 a1u20
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 1
				define_unit_group army2 a2u1
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 2
				define_unit_group army2 a2u1 a2u2
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 3
				define_unit_group army2 a2u1 a2u2 a2u3
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 4
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 5
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 6
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 7
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 8
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 9
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 10
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 11
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a2u11
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 12
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a2u11 a2u12
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 13
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a2u11 a2u12 a2u13
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 14
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a2u11 a2u12 a2u13 a2u14
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 15
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a2u11 a2u12 a2u13 a2u14 a2u15
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 16
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a2u11 a2u12 a2u13 a2u14 a2u15 a2u16
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 17
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a2u11 a2u12 a2u13 a2u14 a2u15 a2u16 a2u17
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 18
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a2u11 a2u12 a2u13 a2u14 a2u15 a2u16 a2u17 a2u18
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 19
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a2u11 a2u12 a2u13 a2u14 a2u15 a2u16 a2u17 a2u18 a2u19
			end_if
			if I_BattlePlayerArmyNumberOfUnits = 20
				define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a2u11 a2u12 a2u13 a2u14 a2u15 a2u16 a2u17 a2u18 a2u19 a2u20
			end_if
		end_if

		if I_BattlePlayerArmyIsAttacker
			if I_CompareCounter player_unit_count >= 1
				if I_UnitPercentageAmmoLeft a1u1 > 0
					set_counter pu1_missile 1
					if I_BattleEnemyArmyNumberOfMountClass elephant > 0
						and I_UnitFormation a1u1 = horde
						set_counter pu1_missile 2
					end_if
				end_if

				if I_CompareCounter player_unit_count >= 2
					if I_UnitPercentageAmmoLeft a1u2 > 0
						set_counter pu2_missile 1
						if I_BattleEnemyArmyNumberOfMountClass elephant > 0
							and I_UnitFormation a1u2 = horde
							set_counter pu2_missile 2
						end_if
					end_if

					if I_CompareCounter player_unit_count >= 3
						if I_UnitPercentageAmmoLeft a1u3 > 0
							set_counter pu3_missile 1
							if I_BattleEnemyArmyNumberOfMountClass elephant > 0
								and I_UnitFormation a1u3 = horde
								set_counter pu3_missile 2
							end_if
						end_if

						if I_CompareCounter player_unit_count >= 4
							if I_UnitPercentageAmmoLeft a1u4 > 0
								set_counter pu4_missile 1
								if I_BattleEnemyArmyNumberOfMountClass elephant > 0
									and I_UnitFormation a1u4 = horde
									set_counter pu4_missile 2
								end_if
							end_if

							if I_CompareCounter player_unit_count >= 5
								if I_UnitPercentageAmmoLeft a1u5 > 0
									set_counter pu5_missile 1
									if I_BattleEnemyArmyNumberOfMountClass elephant > 0
										and I_UnitFormation a1u5 = horde
										set_counter pu5_missile 2
									end_if
								end_if

								if I_CompareCounter player_unit_count >= 6
									if I_UnitPercentageAmmoLeft a1u6 > 0
										set_counter pu6_missile 1
										if I_BattleEnemyArmyNumberOfMountClass elephant > 0
											and I_UnitFormation a1u6 = horde
											set_counter pu6_missile 2
										end_if
									end_if

									if I_CompareCounter player_unit_count >= 7
										if I_UnitPercentageAmmoLeft a1u7 > 0
											set_counter pu7_missile 1
											if I_BattleEnemyArmyNumberOfMountClass elephant > 0
												and I_UnitFormation a1u7 = horde
												set_counter pu7_missile 2
											end_if
										end_if

										if I_CompareCounter player_unit_count >= 8
											if I_UnitPercentageAmmoLeft a1u8 > 0
												set_counter pu8_missile 1
												if I_BattleEnemyArmyNumberOfMountClass elephant > 0
													and I_UnitFormation a1u8 = horde
													set_counter pu8_missile 2
												end_if
											end_if

											if I_CompareCounter player_unit_count >= 9
												if I_UnitPercentageAmmoLeft a1u9 > 0
													set_counter pu9_missile 1
													if I_BattleEnemyArmyNumberOfMountClass elephant > 0
														and I_UnitFormation a1u9 = horde
														set_counter pu9_missile 2
													end_if
												end_if

												if I_CompareCounter player_unit_count >= 10
													if I_UnitPercentageAmmoLeft a1u10 > 0
														set_counter pu10_missile 1
														if I_BattleEnemyArmyNumberOfMountClass elephant > 0
															and I_UnitFormation a1u10 = horde
															set_counter pu10_missile 2
														end_if
													end_if

													if I_CompareCounter player_unit_count >= 11
														if I_UnitPercentageAmmoLeft a1u11 > 0
															set_counter pu11_missile 1
															if I_BattleEnemyArmyNumberOfMountClass elephant > 0
																and I_UnitFormation a1u11 = horde
																set_counter pu11_missile 2
															end_if
														end_if

														if I_CompareCounter player_unit_count >= 12
															if I_UnitPercentageAmmoLeft a1u12 > 0
																set_counter pu12_missile 1
																if I_BattleEnemyArmyNumberOfMountClass elephant > 0
																	and I_UnitFormation a1u12 = horde
																	set_counter pu12_missile 2
																end_if
															end_if

															if I_CompareCounter player_unit_count >= 13
																if I_UnitPercentageAmmoLeft a1u13 > 0
																	set_counter pu13_missile 1
																	if I_BattleEnemyArmyNumberOfMountClass elephant > 0
																		and I_UnitFormation a1u13 = horde
																		set_counter pu13_missile 2
																	end_if
																end_if

																if I_CompareCounter player_unit_count >= 14
																	if I_UnitPercentageAmmoLeft a1u14 > 0
																		set_counter pu14_missile 1
																		if I_BattleEnemyArmyNumberOfMountClass elephant > 0
																			and I_UnitFormation a1u14 = horde
																			set_counter pu14_missile 2
																		end_if
																	end_if

																	if I_CompareCounter player_unit_count >= 15
																		if I_UnitPercentageAmmoLeft a1u15 > 0
																			set_counter pu15_missile 1
																			if I_BattleEnemyArmyNumberOfMountClass elephant > 0
																				and I_UnitFormation a1u15 = horde
																				set_counter pu15_missile 2
																			end_if
																		end_if

																		if I_CompareCounter player_unit_count >= 16
																			if I_UnitPercentageAmmoLeft a1u16 > 0
																				set_counter pu16_missile 1
																				if I_BattleEnemyArmyNumberOfMountClass elephant > 0
																					and I_UnitFormation a1u16 = horde
																					set_counter pu16_missile 2
																				end_if
																			end_if

																			if I_CompareCounter player_unit_count >= 17
																				if I_UnitPercentageAmmoLeft a1u17 > 0
																					set_counter pu17_missile 1
																					if I_BattleEnemyArmyNumberOfMountClass elephant > 0
																						and I_UnitFormation a1u17 = horde
																						set_counter pu17_missile 2
																					end_if
																				end_if

																				if I_CompareCounter player_unit_count >= 18
																					if I_UnitPercentageAmmoLeft a1u18 > 0
																						set_counter pu18_missile 1
																						if I_BattleEnemyArmyNumberOfMountClass elephant > 0
																							and I_UnitFormation a1u18 = horde
																							set_counter pu18_missile 2
																						end_if
																					end_if

																					if I_CompareCounter player_unit_count >= 19
																						if I_UnitPercentageAmmoLeft a1u19 > 0
																							set_counter pu19_missile 1
																							if I_BattleEnemyArmyNumberOfMountClass elephant > 0
																								and I_UnitFormation a1u19 = horde
																								set_counter pu19_missile 2
																							end_if
																						end_if

																						if I_CompareCounter player_unit_count = 20
																							if I_UnitPercentageAmmoLeft a1u20 > 0
																								set_counter pu20_missile 1
																								if I_BattleEnemyArmyNumberOfMountClass elephant > 0
																									and I_UnitFormation a1u20 = horde
																									set_counter pu20_missile 2
																								end_if
																							end_if

																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if

		if ! I_BattlePlayerArmyIsAttacker
			if I_CompareCounter player_unit_count >= 1
				if I_UnitPercentageAmmoLeft a2u1 > 0
					set_counter pu1_missile 1
					if I_BattleEnemyArmyNumberOfMountClass elephant > 0
						and I_UnitFormation a2u1 = horde
						set_counter pu1_missile 2
					end_if
				end_if

				if I_CompareCounter player_unit_count >= 2
					if I_UnitPercentageAmmoLeft a2u2 > 0
						set_counter pu2_missile 1
						if I_BattleEnemyArmyNumberOfMountClass elephant > 0
							and I_UnitFormation a2u2 = horde
							set_counter pu2_missile 2
						end_if
					end_if

					if I_CompareCounter player_unit_count >= 3
						if I_UnitPercentageAmmoLeft a2u3 > 0
							set_counter pu3_missile 1
							if I_BattleEnemyArmyNumberOfMountClass elephant > 0
								and I_UnitFormation a2u3 = horde
								set_counter pu3_missile 2
							end_if
						end_if

						if I_CompareCounter player_unit_count >= 4
							if I_UnitPercentageAmmoLeft a2u4 > 0
								set_counter pu4_missile 1
								if I_BattleEnemyArmyNumberOfMountClass elephant > 0
									and I_UnitFormation a2u4 = horde
									set_counter pu4_missile 2
								end_if
							end_if

							if I_CompareCounter player_unit_count >= 5
								if I_UnitPercentageAmmoLeft a2u5 > 0
									set_counter pu5_missile 1
									if I_BattleEnemyArmyNumberOfMountClass elephant > 0
										and I_UnitFormation a2u5 = horde
										set_counter pu5_missile 2
									end_if
								end_if

								if I_CompareCounter player_unit_count >= 6
									if I_UnitPercentageAmmoLeft a2u6 > 0
										set_counter pu6_missile 1
										if I_BattleEnemyArmyNumberOfMountClass elephant > 0
											and I_UnitFormation a2u6 = horde
											set_counter pu6_missile 2
										end_if
									end_if

									if I_CompareCounter player_unit_count >= 7
										if I_UnitPercentageAmmoLeft a2u7 > 0
											set_counter pu7_missile 1
											if I_BattleEnemyArmyNumberOfMountClass elephant > 0
												and I_UnitFormation a2u7 = horde
												set_counter pu7_missile 2
											end_if
										end_if

										if I_CompareCounter player_unit_count >= 8
											if I_UnitPercentageAmmoLeft a2u8 > 0
												set_counter pu8_missile 1
												if I_BattleEnemyArmyNumberOfMountClass elephant > 0
													and I_UnitFormation a2u8 = horde
													set_counter pu8_missile 2
												end_if
											end_if

											if I_CompareCounter player_unit_count >= 9
												if I_UnitPercentageAmmoLeft a2u9 > 0
													set_counter pu9_missile 1
													if I_BattleEnemyArmyNumberOfMountClass elephant > 0
														and I_UnitFormation a2u9 = horde
														set_counter pu9_missile 2
													end_if
												end_if

												if I_CompareCounter player_unit_count >= 10
													if I_UnitPercentageAmmoLeft a2u10 > 0
														set_counter pu10_missile 1
														if I_BattleEnemyArmyNumberOfMountClass elephant > 0
															and I_UnitFormation a2u10 = horde
															set_counter pu10_missile 2
														end_if
													end_if

													if I_CompareCounter player_unit_count >= 11
														if I_UnitPercentageAmmoLeft a2u11 > 0
															set_counter pu11_missile 1
															if I_BattleEnemyArmyNumberOfMountClass elephant > 0
																and I_UnitFormation a2u11 = horde
																set_counter pu11_missile 2
															end_if
														end_if

														if I_CompareCounter player_unit_count >= 12
															if I_UnitPercentageAmmoLeft a2u12 > 0
																set_counter pu12_missile 1
																if I_BattleEnemyArmyNumberOfMountClass elephant > 0
																	and I_UnitFormation a2u12 = horde
																	set_counter pu12_missile 2
																end_if
															end_if

															if I_CompareCounter player_unit_count >= 13
																if I_UnitPercentageAmmoLeft a2u13 > 0
																	set_counter pu13_missile 1
																	if I_BattleEnemyArmyNumberOfMountClass elephant > 0
																		and I_UnitFormation a2u13 = horde
																		set_counter pu13_missile 2
																	end_if
																end_if

																if I_CompareCounter player_unit_count >= 14
																	if I_UnitPercentageAmmoLeft a2u14 > 0
																		set_counter pu14_missile 1
																		if I_BattleEnemyArmyNumberOfMountClass elephant > 0
																			and I_UnitFormation a2u14 = horde
																			set_counter pu14_missile 2
																		end_if
																	end_if

																	if I_CompareCounter player_unit_count >= 15
																		if I_UnitPercentageAmmoLeft a2u15 > 0
																			set_counter pu15_missile 1
																			if I_BattleEnemyArmyNumberOfMountClass elephant > 0
																				and I_UnitFormation a2u15 = horde
																				set_counter pu15_missile 2
																			end_if
																		end_if

																		if I_CompareCounter player_unit_count >= 16
																			if I_UnitPercentageAmmoLeft a2u16 > 0
																				set_counter pu16_missile 1
																				if I_BattleEnemyArmyNumberOfMountClass elephant > 0
																					and I_UnitFormation a2u16 = horde
																					set_counter pu16_missile 2
																				end_if
																			end_if

																			if I_CompareCounter player_unit_count >= 17
																				if I_UnitPercentageAmmoLeft a2u17 > 0
																					set_counter pu17_missile 1
																					if I_BattleEnemyArmyNumberOfMountClass elephant > 0
																						and I_UnitFormation a2u17 = horde
																						set_counter pu17_missile 2
																					end_if
																				end_if

																				if I_CompareCounter player_unit_count >= 18
																					if I_UnitPercentageAmmoLeft a2u18 > 0
																						set_counter pu18_missile 1
																						if I_BattleEnemyArmyNumberOfMountClass elephant > 0
																							and I_UnitFormation a2u18 = horde
																							set_counter pu18_missile 2
																						end_if
																					end_if

																					if I_CompareCounter player_unit_count >= 19
																						if I_UnitPercentageAmmoLeft a2u19 > 0
																							set_counter pu19_missile 1
																							if I_BattleEnemyArmyNumberOfMountClass elephant > 0
																								and I_UnitFormation a2u19 = horde
																								set_counter pu19_missile 2
																							end_if
																						end_if

																						if I_CompareCounter player_unit_count = 20
																							if I_UnitPercentageAmmoLeft a2u20 > 0
																								set_counter pu20_missile 1
																								if I_BattleEnemyArmyNumberOfMountClass elephant > 0
																									and I_UnitFormation a2u20 = horde
																									set_counter pu20_missile 2
																								end_if
																							end_if

																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if
		;    battle_wait 0.1
		;    ai_active_set off
		battle_wait 0.1
		ai_active_set on
		set_counter labels_only 1

		if I_BattleIsSiegeBattle
			and I_BattlePlayerArmyIsAttacker
			set_counter ai_stuck_launch 1
		end_if

		if I_BattleIsSiegeBattle
			and ! I_BattlePlayerArmyIsAttacker
			and I_BattlePlayerArmyNumberOfAttribute stakes > 0
			set_counter stakes_lock 1
		end_if

		if I_BattleIsSiegeBattle
			and ! I_BattlePlayerArmyIsAttacker
			;    and I_BattleEnemyArmyNumberOfSpecialAbility rally > 0
			set_counter protect_siege 1
		end_if

		if ! I_BattleIsSiegeBattle
			and ! I_BattleIsSallyOutBattle
			and ! I_BattleIsRiverBattle
			and ! I_ConflictType SuccessfulAmbush
			set_counter open_battle 1
		end_if

		if I_CompareCounter fire_labels = 1
			if I_BattleIsSiegeBattle
				label_location 0, -850, south_side
				label_location 0, 850, north_side
				label_location -850, 0, west_side
				label_location 850, 0, east_side
			end_if

			if I_BattleIsSallyOutBattle
				label_location 0, -850, south_side
				label_location 0, 850, north_side
				label_location -850, 0, west_side
				label_location 850, 0, east_side
			end_if

			if I_BattleIsSallyOutBattle
				and I_BattlePlayerArmyIsAttacker
				label_location -470, -470, sw
				label_location 470, -470, se
				label_location -470, 470, nw
				label_location 470, 470, ne
				label_location -400, -400, sw_wall
				label_location 400, -400, se_wall
				label_location -400, 400, nw_wall
				label_location 400, 400, ne_wall
			end_if

			if I_BattleIsSiegeBattle
				and ! I_BattlePlayerArmyIsAttacker
				and I_UnitDistanceFromLine a1u1 west_side east_side > 200
				set_counter army_south 1
			end_if
			if I_BattleIsSiegeBattle
				and ! I_BattlePlayerArmyIsAttacker
				and I_UnitDistanceFromLine a1u1 west_side east_side < -200
				set_counter army_north 1
			end_if
			if I_BattleIsSiegeBattle
				and ! I_BattlePlayerArmyIsAttacker
				and I_UnitDistanceFromLine a1u1 south_side north_side > 200
				set_counter army_east 1
			end_if
			if I_BattleIsSiegeBattle
				and ! I_BattlePlayerArmyIsAttacker
				and I_UnitDistanceFromLine a1u1 south_side north_side < -200
				set_counter army_west 1
			end_if

			if I_BattleIsSallyOutBattle
				and I_BattlePlayerArmyIsAttacker
				and I_UnitDistanceFromLine a2u1 west_side east_side > 200
				set_counter army_south 1
			end_if
			if I_BattleIsSallyOutBattle
				and I_BattlePlayerArmyIsAttacker
				and I_UnitDistanceFromLine a2u1 west_side east_side < -200
				set_counter army_north 1
			end_if
			if I_BattleIsSallyOutBattle
				and I_BattlePlayerArmyIsAttacker
				and I_UnitDistanceFromLine a2u1 south_side north_side > 200
				set_counter army_east 1
			end_if
			if I_BattleIsSallyOutBattle
				and I_BattlePlayerArmyIsAttacker
				and I_UnitDistanceFromLine a2u1 south_side north_side < -200
				set_counter army_west 1
			end_if
			if I_BattleIsSallyOutBattle
				and I_BattlePlayerArmyIsAttacker
				set_counter sally-out_fix 1
			end_if

			if I_BattleIsSallyOutBattle
				and I_BattlePlayerArmyIsAttacker
				set_counter siege_fix 1
			end_if

			if I_BattleEnemyArmyNumberOfMountClass elephant > 0
				and I_BattleIsSiegeBattle
				set_counter elephant_fix 1
			end_if

		end_if
	end_monitor

	monitor_event BattleConflictPhaseCommenced FactionIsLocal
		and I_CompareCounter panel_check = 1

		set_counter script_delay 1
		battle_wait 15
		if I_CompareCounter script_delay = 1

			if I_CompareCounter fire_labels = 0
				and I_BattleEnemyArmyNumberOfAttribute stakes > 0
				and I_CompareCounter g5_battle_difficulty_high = 1
				and I_BattleIsSiegeBattle
				set_counter label_ready 1
			end_if

			if I_CompareCounter fire_labels = 1
				if I_BattleEnemyArmyNumberOfAttribute stakes > 0
					and I_CompareCounter g5_battle_difficulty_high = 1
					and ! I_BattleIsSiegeBattle
					set_counter label_ready 1
				end_if

				if I_BattlePlayerArmyIsAttacker
					and I_CompareCounter open_battle = 1
					ai_gta_plan_set 1 DEFEND_FEATURE
					battle_wait 1
					ai_active_set on
					set_counter ob_defense_launch 1
				end_if
			end_if

			if ! I_BattleIsSiegeBattle
				and ! I_BattleIsSallyOutBattle
				and ! I_BattleIsRiverBattle
				and ! I_ConflictType SuccessfulAmbush
				and I_BattleEnemyArmyNumberOfUnits > 2
				set_counter g_stop 1
			end_if

			if I_BattleStarted
				and I_CompareCounter kill_sally = 0
				and I_CompareCounter fire_labels = 1
				and I_BattleIsSallyOutBattle
				and I_BattlePlayerArmyIsAttacker
				set_counter sally_defense 1
				set_counter assign_labels 1
			end_if

			if I_BattleStarted
				and I_CompareCounter fire_labels = 1
				and I_CompareCounter open_battle = 1
				set_counter ha_fix 1
			end_if

			if I_BattleStarted
				and I_CompareCounter fire_labels = 1
				and I_BattleIsRiverBattle
				and ! I_BattlePlayerArmyIsAttacker
				set_counter ha_fix 1
			end_if
			set_counter script_delay 0
		end_if
	end_monitor

	monitor_event BattleReinforcementsArrive ! ArmyIsLocal
		and I_CompareCounter panel_check = 1
		and I_CompareCounter fire_labels = 1

		set_counter reinf_check 1
		battle_wait 15
		if I_CompareCounter reinf_check = 1
			set_counter reinf_check 2
			battle_wait 15
			if I_CompareCounter reinf_check = 2
				set_counter reinf_check 3
				battle_wait 15
				if I_CompareCounter reinf_check = 3
					if ! I_BattlePlayerArmyIsAttacker
						;;;Army 3
						label_unit 0 1 0 a3u1
						define_unit_group army3a a3u1
						if ! I_PercentageUnitGroupKilled army3a = 100
							undefine_unit_group army3a
							;;;Army 3
							label_unit 0 1 0 a3u1
							label_unit 0 1 1 a3u2
							label_unit 0 1 2 a3u3
							label_unit 0 1 3 a3u4
							label_unit 0 1 4 a3u5
							label_unit 0 1 5 a3u6
							label_unit 0 1 6 a3u7
							label_unit 0 1 7 a3u8
							label_unit 0 1 8 a3u9
							label_unit 0 1 9 a3u10
							label_unit 0 1 10 a3u11
							label_unit 0 1 11 a3u12
							label_unit 0 1 12 a3u13
							label_unit 0 1 13 a3u14
							label_unit 0 1 14 a3u15
							label_unit 0 1 15 a3u16
							label_unit 0 1 16 a3u17
							label_unit 0 1 17 a3u18
							label_unit 0 1 18 a3u19
							label_unit 0 1 19 a3u20

							define_unit_group army3 a3u1 a3u2 a3u3 a3u4 a3u5 a3u6 a3u7 a3u8 a3u9 a3u10 a3u11 a3u12 a3u13 a3u14 a3u15 a3u16 a3u17 a3u18 a3u19 a3u20
						end_if
					end_if
					if I_BattlePlayerArmyIsAttacker

						;;;Army 4
						label_unit 1 1 0 a4u1
						define_unit_group army4a a4u1
						if ! I_PercentageUnitGroupKilled army4a = 100
							undefine_unit_group army4a
							;;;Army 4
							label_unit 1 1 0 a4u1
							label_unit 1 1 1 a4u2
							label_unit 1 1 2 a4u3
							label_unit 1 1 3 a4u4
							label_unit 1 1 4 a4u5
							label_unit 1 1 5 a4u6
							label_unit 1 1 6 a4u7
							label_unit 1 1 7 a4u8
							label_unit 1 1 8 a4u9
							label_unit 1 1 9 a4u10
							label_unit 1 1 10 a4u11
							label_unit 1 1 11 a4u12
							label_unit 1 1 12 a4u13
							label_unit 1 1 13 a4u14
							label_unit 1 1 14 a4u15
							label_unit 1 1 15 a4u16
							label_unit 1 1 16 a4u17
							label_unit 1 1 17 a4u18
							label_unit 1 1 18 a4u19
							label_unit 1 1 19 a4u20

							define_unit_group army4 a4u1 a4u2 a4u3 a4u4 a4u5 a4u6 a4u7 a4u8 a4u9 a4u10 a4u11 a4u12 a4u13 a4u14 a4u15 a4u16 a4u17 a4u18 a4u19 a4u20
						end_if
					end_if

					if ! I_PercentageUnitGroupKilled army3 = 100
						set_counter army3_reinf_allied 1
					end_if

					if ! I_PercentageUnitGroupKilled army4 = 100
						set_counter army4_reinf_allied 1
					end_if

					if I_PercentageUnitGroupKilled army3 = 100
						and I_PercentageUnitGroupKilled army4 = 100
						set_counter kill_labelling_reinf_allied 1
					end_if

					if ! I_BattleIsSallyOutBattle

						if I_CompareCounter kill_labelling_reinf_allied = 0

							if ! I_BattlePlayerArmyIsAttacker
								;;;Army 5
								label_unit 0 2 0 a5u1
								define_unit_group army5a a5u1
								if ! I_PercentageUnitGroupKilled army5a = 100
									undefine_unit_group army5a
									;;;Army 5
									label_unit 0 2 0 a5u1
									label_unit 0 2 1 a5u2
									label_unit 0 2 2 a5u3
									label_unit 0 2 3 a5u4
									label_unit 0 2 4 a5u5
									label_unit 0 2 5 a5u6
									label_unit 0 2 6 a5u7
									label_unit 0 2 7 a5u8
									label_unit 0 2 8 a5u9
									label_unit 0 2 9 a5u10
									label_unit 0 2 10 a5u11
									label_unit 0 2 11 a5u12
									label_unit 0 2 12 a5u13
									label_unit 0 2 13 a5u14
									label_unit 0 2 14 a5u15
									label_unit 0 2 15 a5u16
									label_unit 0 2 16 a5u17
									label_unit 0 2 17 a5u18
									label_unit 0 2 18 a5u19
									label_unit 0 2 19 a5u20

									define_unit_group army5 a5u1 a5u2 a5u3 a5u4 a5u5 a5u6 a5u7 a5u8 a5u9 a5u10 a5u11 a5u12 a5u13 a5u14 a5u15 a5u16 a5u17 a5u18 a5u19 a5u20
								end_if
							end_if
							if I_BattlePlayerArmyIsAttacker
								;;;Army 6
								label_unit 1 2 0 a6u1
								define_unit_group army6a a6u1
								if ! I_PercentageUnitGroupKilled army6a = 100
									undefine_unit_group army6a 	
									;;;Army 6
									label_unit 1 2 0 a6u1
									label_unit 1 2 1 a6u2
									label_unit 1 2 2 a6u3
									label_unit 1 2 3 a6u4
									label_unit 1 2 4 a6u5
									label_unit 1 2 5 a6u6
									label_unit 1 2 6 a6u7
									label_unit 1 2 7 a6u8
									label_unit 1 2 8 a6u9
									label_unit 1 2 9 a6u10
									label_unit 1 2 10 a6u11
									label_unit 1 2 11 a6u12
									label_unit 1 2 12 a6u13
									label_unit 1 2 13 a6u14
									label_unit 1 2 14 a6u15
									label_unit 1 2 15 a6u16
									label_unit 1 2 16 a6u17
									label_unit 1 2 17 a6u18
									label_unit 1 2 18 a6u19
									label_unit 1 2 19 a6u20

									define_unit_group army6 a6u1 a6u2 a6u3 a6u4 a6u5 a6u6 a6u7 a6u8 a6u9 a6u10 a6u11 a6u12 a6u13 a6u14 a6u15 a6u16 a6u17 a6u18 a6u19 a6u20
								end_if
							end_if

							if ! I_PercentageUnitGroupKilled army5 = 100
								set_counter army5_reinf_allied 1
							end_if

							if ! I_PercentageUnitGroupKilled army6 = 100
								set_counter army6_reinf_allied 1
							end_if
							if I_PercentageUnitGroupKilled army5 = 100
								and I_PercentageUnitGroupKilled army6 = 100
								set_counter kill_labelling_reinf_allied 1
							end_if

						end_if

						if I_CompareCounter kill_labelling_reinf_allied = 0

							if ! I_BattlePlayerArmyIsAttacker
								;;;Army 7
								label_unit 0 3 0 a7u1
								define_unit_group army7a a7u1
								if ! I_PercentageUnitGroupKilled army7a = 100
									undefine_unit_group army7a 	
									;;;Army 7
									label_unit 0 3 0 a7u1
									label_unit 0 3 1 a7u2
									label_unit 0 3 2 a7u3
									label_unit 0 3 3 a7u4
									label_unit 0 3 4 a7u5
									label_unit 0 3 5 a7u6
									label_unit 0 3 6 a7u7
									label_unit 0 3 7 a7u8
									label_unit 0 3 8 a7u9
									label_unit 0 3 9 a7u10
									label_unit 0 3 10 a7u11
									label_unit 0 3 11 a7u12
									label_unit 0 3 12 a7u13
									label_unit 0 3 13 a7u14
									label_unit 0 3 14 a7u15
									label_unit 0 3 15 a7u16
									label_unit 0 3 16 a7u17
									label_unit 0 3 17 a7u18
									label_unit 0 3 18 a7u19
									label_unit 0 3 19 a7u20

									define_unit_group army7 a7u1 a7u2 a7u3 a7u4 a7u5 a7u6 a7u7 a7u8 a7u9 a7u10 a7u11 a7u12 a7u13 a7u14 a7u15 a7u16 a7u17 a7u18 a7u19 a7u20
								end_if
							end_if
							if I_BattlePlayerArmyIsAttacker 	
								;;;Army 8
								label_unit 1 3 0 a8u1
								define_unit_group army8a a8u1
								if ! I_PercentageUnitGroupKilled army8a = 100
									undefine_unit_group army8a 	
									;;;Army 8
									label_unit 1 3 0 a8u1
									label_unit 1 3 1 a8u2
									label_unit 1 3 2 a8u3
									label_unit 1 3 3 a8u4
									label_unit 1 3 4 a8u5
									label_unit 1 3 5 a8u6
									label_unit 1 3 6 a8u7
									label_unit 1 3 7 a8u8
									label_unit 1 3 8 a8u9
									label_unit 1 3 9 a8u10
									label_unit 1 3 10 a8u11
									label_unit 1 3 11 a8u12
									label_unit 1 3 12 a8u13
									label_unit 1 3 13 a8u14
									label_unit 1 3 14 a8u15
									label_unit 1 3 15 a8u16
									label_unit 1 3 16 a8u17
									label_unit 1 3 17 a8u18
									label_unit 1 3 18 a8u19
									label_unit 1 3 19 a8u20

									define_unit_group army8 a8u1 a8u2 a8u3 a8u4 a8u5 a8u6 a8u7 a8u8 a8u9 a8u10 a8u11 a8u12 a8u13 a8u14 a8u15 a8u16 a8u17 a8u18 a8u19 a8u20
								end_if
							end_if

							if ! I_PercentageUnitGroupKilled army7 = 100
								set_counter army7_reinf_allied 1
							end_if

							if ! I_PercentageUnitGroupKilled army8 = 100
								set_counter army8_reinf_allied 1
							end_if
							if I_PercentageUnitGroupKilled army7 = 100
								and I_PercentageUnitGroupKilled army8 = 100
								set_counter kill_labelling_reinf_allied 1
							end_if

						end_if

						if I_CompareCounter kill_labelling_reinf_allied = 0

							if ! I_BattlePlayerArmyIsAttacker
								;;;Army 9
								label_unit 0 4 0 a9u1
								define_unit_group army9a a9u1
								if ! I_PercentageUnitGroupKilled army9a = 100
									undefine_unit_group army9a 	
									;;;Army 9
									label_unit 0 4 0 a9u1
									label_unit 0 4 1 a9u2
									label_unit 0 4 2 a9u3
									label_unit 0 4 3 a9u4
									label_unit 0 4 4 a9u5
									label_unit 0 4 5 a9u6
									label_unit 0 4 6 a9u7
									label_unit 0 4 7 a9u8
									label_unit 0 4 8 a9u9
									label_unit 0 4 9 a9u10
									label_unit 0 4 10 a9u11
									label_unit 0 4 11 a9u12
									label_unit 0 4 12 a9u13
									label_unit 0 4 13 a9u14
									label_unit 0 4 14 a9u15
									label_unit 0 4 15 a9u16
									label_unit 0 4 16 a9u17
									label_unit 0 4 17 a9u18
									label_unit 0 4 18 a9u19
									label_unit 0 4 19 a9u20

									define_unit_group army9 a9u1 a9u2 a9u3 a9u4 a9u5 a9u6 a9u7 a9u8 a9u9 a9u10 a9u11 a9u12 a9u13 a9u14 a9u15 a9u16 a9u17 a9u18 a9u19 a9u20
								end_if
							end_if
							if I_BattlePlayerArmyIsAttacker 	
								;;;Army 10
								label_unit 1 4 0 a10u1
								define_unit_group army10a a10u1
								if ! I_PercentageUnitGroupKilled army10a = 100
									undefine_unit_group army10a 	
									;;;Army 10
									label_unit 1 4 0 a10u1
									label_unit 1 4 1 a10u2
									label_unit 1 4 2 a10u3
									label_unit 1 4 3 a10u4
									label_unit 1 4 4 a10u5
									label_unit 1 4 5 a10u6
									label_unit 1 4 6 a10u7
									label_unit 1 4 7 a10u8
									label_unit 1 4 8 a10u9
									label_unit 1 4 9 a10u10
									label_unit 1 4 10 a10u11
									label_unit 1 4 11 a10u12
									label_unit 1 4 12 a10u13
									label_unit 1 4 13 a10u14
									label_unit 1 4 14 a10u15
									label_unit 1 4 15 a10u16
									label_unit 1 4 16 a10u17
									label_unit 1 4 17 a10u18
									label_unit 1 4 18 a10u19
									label_unit 1 4 19 a10u20

									define_unit_group army10 a10u1 a10u2 a10u3 a10u4 a10u5 a10u6 a10u7 a10u8 a10u9 a10u10 a10u11 a10u12 a10u13 a10u14 a10u15 a10u16 a10u17 a10u18 a10u19 a10u20
								end_if
							end_if

							if ! I_PercentageUnitGroupKilled army9 = 100
								set_counter army9_reinf_allied 1
							end_if

							if ! I_PercentageUnitGroupKilled army10 = 100
								set_counter army10_reinf_allied 1
							end_if
							if I_PercentageUnitGroupKilled army9 = 100
								and I_PercentageUnitGroupKilled army10 = 100
								set_counter kill_labelling_reinf_allied 1
							end_if

						end_if

						if I_CompareCounter kill_labelling_reinf_allied = 0

							if ! I_BattlePlayerArmyIsAttacker
								;;;Army 11
								label_unit 0 5 0 a11u1
								define_unit_group army11a a11u1
								if ! I_PercentageUnitGroupKilled army11a = 100
									undefine_unit_group army11a 	
									;;;Army 11
									label_unit 0 5 0 a11u1
									label_unit 0 5 1 a11u2
									label_unit 0 5 2 a11u3
									label_unit 0 5 3 a11u4
									label_unit 0 5 4 a11u5
									label_unit 0 5 5 a11u6
									label_unit 0 5 6 a11u7
									label_unit 0 5 7 a11u8
									label_unit 0 5 8 a11u9
									label_unit 0 5 9 a11u10
									label_unit 0 5 10 a11u11
									label_unit 0 5 11 a11u12
									label_unit 0 5 12 a11u13
									label_unit 0 5 13 a11u14
									label_unit 0 5 14 a11u15
									label_unit 0 5 15 a11u16
									label_unit 0 5 16 a11u17
									label_unit 0 5 17 a11u18
									label_unit 0 5 18 a11u19
									label_unit 0 5 19 a11u20

									define_unit_group army11 a11u1 a11u2 a11u3 a11u4 a11u5 a11u6 a11u7 a11u8 a11u9 a11u10 a11u11 a11u12 a11u13 a11u14 a11u15 a11u16 a11u17 a11u18 a11u19 a11u20
								end_if
							end_if
							if I_BattlePlayerArmyIsAttacker 	
								;;;Army 12
								label_unit 1 5 0 a12u1
								define_unit_group army12a a12u1
								if ! I_PercentageUnitGroupKilled army12a = 100
									undefine_unit_group army12a 	
									;;;Army 12
									label_unit 1 5 0 a12u1
									label_unit 1 5 1 a12u2
									label_unit 1 5 2 a12u3
									label_unit 1 5 3 a12u4
									label_unit 1 5 4 a12u5
									label_unit 1 5 5 a12u6
									label_unit 1 5 6 a12u7
									label_unit 1 5 7 a12u8
									label_unit 1 5 8 a12u9
									label_unit 1 5 9 a12u10
									label_unit 1 5 10 a12u11
									label_unit 1 5 11 a12u12
									label_unit 1 5 12 a12u13
									label_unit 1 5 13 a12u14
									label_unit 1 5 14 a12u15
									label_unit 1 5 15 a12u16
									label_unit 1 5 16 a12u17
									label_unit 1 5 17 a12u18
									label_unit 1 5 18 a12u19
									label_unit 1 5 19 a12u20

									define_unit_group army12 a12u1 a12u2 a12u3 a12u4 a12u5 a12u6 a12u7 a12u8 a12u9 a12u10 a12u11 a12u12 a12u13 a12u14 a12u15 a12u16 a12u17 a12u18 a12u19 a12u20
								end_if
							end_if

							if ! I_PercentageUnitGroupKilled army11 = 100
								set_counter army11_reinf_allied 1
							end_if

							if ! I_PercentageUnitGroupKilled army12 = 100
								set_counter army12_reinf_allied 1
							end_if
							if I_PercentageUnitGroupKilled army11 = 100
								and I_PercentageUnitGroupKilled army12 = 100
								set_counter kill_labelling_reinf_allied 1
							end_if

						end_if

						if I_CompareCounter kill_labelling_reinf_allied = 0

							if ! I_BattlePlayerArmyIsAttacker
								;;;Army 13
								label_unit 0 6 0 a13u1
								define_unit_group army13a a13u1
								if ! I_PercentageUnitGroupKilled army13a = 100
									undefine_unit_group army13a 	
									;;;Army 13
									label_unit 0 6 0 a13u1
									label_unit 0 6 1 a13u2
									label_unit 0 6 2 a13u3
									label_unit 0 6 3 a13u4
									label_unit 0 6 4 a13u5
									label_unit 0 6 5 a13u6
									label_unit 0 6 6 a13u7
									label_unit 0 6 7 a13u8
									label_unit 0 6 8 a13u9
									label_unit 0 6 9 a13u10
									label_unit 0 6 10 a13u11
									label_unit 0 6 11 a13u12
									label_unit 0 6 12 a13u13
									label_unit 0 6 13 a13u14
									label_unit 0 6 14 a13u15
									label_unit 0 6 15 a13u16
									label_unit 0 6 16 a13u17
									label_unit 0 6 17 a13u18
									label_unit 0 6 18 a13u19
									label_unit 0 6 19 a13u20

									define_unit_group army13 a13u1 a13u2 a13u3 a13u4 a13u5 a13u6 a13u7 a13u8 a13u9 a13u10 a13u11 a13u12 a13u13 a13u14 a13u15 a13u16 a13u17 a13u18 a13u19 a13u20
								end_if
							end_if

							if I_BattlePlayerArmyIsAttacker	
								;;;Army 14
								label_unit 1 6 0 a14u1
								define_unit_group army14a a14u1
								if ! I_PercentageUnitGroupKilled army14a = 100
									undefine_unit_group army14a 	
									;;;Army 14
									label_unit 1 6 0 a14u1
									label_unit 1 6 1 a14u2
									label_unit 1 6 2 a14u3
									label_unit 1 6 3 a14u4
									label_unit 1 6 4 a14u5
									label_unit 1 6 5 a14u6
									label_unit 1 6 6 a14u7
									label_unit 1 6 7 a14u8
									label_unit 1 6 8 a14u9
									label_unit 1 6 9 a14u10
									label_unit 1 6 10 a14u11
									label_unit 1 6 11 a14u12
									label_unit 1 6 12 a14u13
									label_unit 1 6 13 a14u14
									label_unit 1 6 14 a14u15
									label_unit 1 6 15 a14u16
									label_unit 1 6 16 a14u17
									label_unit 1 6 17 a14u18
									label_unit 1 6 18 a14u19
									label_unit 1 6 19 a14u20

									define_unit_group army14 a14u1 a14u2 a14u3 a14u4 a14u5 a14u6 a14u7 a14u8 a14u9 a14u10 a14u11 a14u12 a14u13 a14u14 a14u15 a14u16 a14u17 a14u18 a14u19 a14u20
								end_if
							end_if

							if ! I_PercentageUnitGroupKilled army13 = 100
								set_counter army13_reinf_allied 1
							end_if

							if ! I_PercentageUnitGroupKilled army14 = 100
								set_counter army14_reinf_allied 1
							end_if
							if I_PercentageUnitGroupKilled army13 = 100
								and I_PercentageUnitGroupKilled army14 = 100
								set_counter kill_labelling_reinf_allied 1
							end_if

						end_if

						if I_CompareCounter kill_labelling_reinf_allied = 0

							if ! I_BattlePlayerArmyIsAttacker
								;;;Army 15
								label_unit 0 7 0 a15u1
								define_unit_group army15a a15u1
								if ! I_PercentageUnitGroupKilled army15a = 100
									undefine_unit_group army15a 	
									;;;Army 15
									label_unit 0 7 0 a15u1
									label_unit 0 7 1 a15u2
									label_unit 0 7 2 a15u3
									label_unit 0 7 3 a15u4
									label_unit 0 7 4 a15u5
									label_unit 0 7 5 a15u6
									label_unit 0 7 6 a15u7
									label_unit 0 7 7 a15u8
									label_unit 0 7 8 a15u9
									label_unit 0 7 9 a15u10
									label_unit 0 7 10 a15u11
									label_unit 0 7 11 a15u12
									label_unit 0 7 12 a15u13
									label_unit 0 7 13 a15u14
									label_unit 0 7 14 a15u15
									label_unit 0 7 15 a15u16
									label_unit 0 7 16 a15u17
									label_unit 0 7 17 a15u18
									label_unit 0 7 18 a15u19
									label_unit 0 7 19 a15u20

									define_unit_group army15 a15u1 a15u2 a15u3 a15u4 a15u5 a15u6 a15u7 a15u8 a15u9 a15u10 a15u11 a15u12 a15u13 a15u14 a15u15 a15u16 a15u17 a15u18 a15u19 a15u20
								end_if
							end_if

							if I_BattlePlayerArmyIsAttacker	
								;;;Army 16
								label_unit 1 7 0 a16u1
								define_unit_group army16a a16u1
								if ! I_PercentageUnitGroupKilled army16a = 100
									undefine_unit_group army16a 	
									;;;Army 16
									label_unit 1 7 0 a16u1
									label_unit 1 7 1 a16u2
									label_unit 1 7 2 a16u3
									label_unit 1 7 3 a16u4
									label_unit 1 7 4 a16u5
									label_unit 1 7 5 a16u6
									label_unit 1 7 6 a16u7
									label_unit 1 7 7 a16u8
									label_unit 1 7 8 a16u9
									label_unit 1 7 9 a16u10
									label_unit 1 7 10 a16u11
									label_unit 1 7 11 a16u12
									label_unit 1 7 12 a16u13
									label_unit 1 7 13 a16u14
									label_unit 1 7 14 a16u15
									label_unit 1 7 15 a16u16
									label_unit 1 7 16 a16u17
									label_unit 1 7 17 a16u18
									label_unit 1 7 18 a16u19
									label_unit 1 7 19 a16u20

									define_unit_group army16 a16u1 a16u2 a16u3 a16u4 a16u5 a16u6 a16u7 a16u8 a16u9 a16u10 a16u11 a16u12 a16u13 a16u14 a16u15 a16u16 a16u17 a16u18 a16u19 a16u20
								end_if
							end_if

							if ! I_PercentageUnitGroupKilled army15 = 100
								set_counter army15_reinf_allied 1
							end_if

							if ! I_PercentageUnitGroupKilled army16 = 100
								set_counter army16_reinf_allied 1
							end_if
						end_if

					end_if
					battle_wait 0.5
					ai_active_set on

					;;;;;;;Reinforcements

					;;;;;;; Attacking
					if ! I_BattlePlayerArmyIsAttacker
						and ! I_ConflictType SuccessfulAmbush
						;    and ! I_ConflictType FailedAmbush
						and ! I_BattleIsSiegeBattle
						and I_CompareCounter army3_reinf_allied = 1

						set_counter apply_strategy 1
						;    battle_wait 1
						;    set_counter att_alliance_ready 1
					end_if

					;;;;;;; Defending
					if I_BattlePlayerArmyIsAttacker
						and ! I_ConflictType SuccessfulAmbush
						;    and ! I_ConflictType FailedAmbush
						and I_CompareCounter army4_reinf_allied = 1

						if ! I_BattleIsSiegeBattle
							and ! I_BattleIsSallyOutBattle
							set_counter army4_ready 1
							set_counter def_alliance_ready 1
						end_if
						if ! I_BattleIsSiegeBattle
							and I_BattleIsSallyOutBattle
							set_counter army4_ready_sally 1
							set_counter sally_reinf 1
						end_if

						;;;;;;; Siege
						if I_BattleIsSiegeBattle
							set_counter def_alliance_ready_siege 1
						end_if
					end_if
				end_if
			end_if
		end_if
	end_monitor

	;Apply Strategy

	monitor_conditions I_BattleStarted
		and I_CompareCounter apply_strategy = 1

		if ! I_BattlePlayerArmyIsAttacker
			and I_CompareCounter open_battle = 1

			;    ai_gta_plan_set 0 ATTACK_ALL
			ai_gta_add_objective 0 ATTACK_ENEMY_BATTLEGROUP 999
			set_counter launch_alliance_0 1
		end_if

		if I_BattlePlayerArmyIsAttacker
			and I_CompareCounter open_battle = 1

			;    ai_gta_plan_set 1 ATTACK_ALL
			ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999
			set_counter launch_alliance_1 1
		end_if

		if I_CompareCounter launch_alliance_0 = 1
			and I_CompareCounter army3_reinf_allied = 1

			;;;Army 1
			ai_gta_add_unit_label 0 G5_OBJECTIVE a1u1
			ai_gta_add_unit_label 0 G5_OBJECTIVE a1u2
			ai_gta_add_unit_label 0 G5_OBJECTIVE a1u3
			ai_gta_add_unit_label 0 G5_OBJECTIVE a1u4
			ai_gta_add_unit_label 0 G5_OBJECTIVE a1u5
			ai_gta_add_unit_label 0 G5_OBJECTIVE a1u6
			ai_gta_add_unit_label 0 G5_OBJECTIVE a1u7
			ai_gta_add_unit_label 0 G5_OBJECTIVE a1u8
			ai_gta_add_unit_label 0 G5_OBJECTIVE a1u9
			ai_gta_add_unit_label 0 G5_OBJECTIVE a1u10
			ai_gta_add_unit_label 0 G5_OBJECTIVE a1u11
			ai_gta_add_unit_label 0 G5_OBJECTIVE a1u12
			ai_gta_add_unit_label 0 G5_OBJECTIVE a1u13
			ai_gta_add_unit_label 0 G5_OBJECTIVE a1u14
			ai_gta_add_unit_label 0 G5_OBJECTIVE a1u15
			ai_gta_add_unit_label 0 G5_OBJECTIVE a1u16
			ai_gta_add_unit_label 0 G5_OBJECTIVE a1u17
			ai_gta_add_unit_label 0 G5_OBJECTIVE a1u18
			ai_gta_add_unit_label 0 G5_OBJECTIVE a1u19
			ai_gta_add_unit_label 0 G5_OBJECTIVE a1u20
			;;;Army 3
			ai_gta_add_unit_label 0 G5_OBJECTIVE a3u1
			ai_gta_add_unit_label 0 G5_OBJECTIVE a3u2
			ai_gta_add_unit_label 0 G5_OBJECTIVE a3u3
			ai_gta_add_unit_label 0 G5_OBJECTIVE a3u4
			ai_gta_add_unit_label 0 G5_OBJECTIVE a3u5
			ai_gta_add_unit_label 0 G5_OBJECTIVE a3u6
			ai_gta_add_unit_label 0 G5_OBJECTIVE a3u7
			ai_gta_add_unit_label 0 G5_OBJECTIVE a3u8
			ai_gta_add_unit_label 0 G5_OBJECTIVE a3u9
			ai_gta_add_unit_label 0 G5_OBJECTIVE a3u10
			ai_gta_add_unit_label 0 G5_OBJECTIVE a3u11
			ai_gta_add_unit_label 0 G5_OBJECTIVE a3u12
			ai_gta_add_unit_label 0 G5_OBJECTIVE a3u13
			ai_gta_add_unit_label 0 G5_OBJECTIVE a3u14
			ai_gta_add_unit_label 0 G5_OBJECTIVE a3u15
			ai_gta_add_unit_label 0 G5_OBJECTIVE a3u16
			ai_gta_add_unit_label 0 G5_OBJECTIVE a3u17
			ai_gta_add_unit_label 0 G5_OBJECTIVE a3u18
			ai_gta_add_unit_label 0 G5_OBJECTIVE a3u19
			ai_gta_add_unit_label 0 G5_OBJECTIVE a3u20
			if I_CompareCounter army5_reinf_allied = 1
				;;;Army 5
				ai_gta_add_unit_label 0 G5_OBJECTIVE a5u1
				ai_gta_add_unit_label 0 G5_OBJECTIVE a5u2
				ai_gta_add_unit_label 0 G5_OBJECTIVE a5u3
				ai_gta_add_unit_label 0 G5_OBJECTIVE a5u4
				ai_gta_add_unit_label 0 G5_OBJECTIVE a5u5
				ai_gta_add_unit_label 0 G5_OBJECTIVE a5u6
				ai_gta_add_unit_label 0 G5_OBJECTIVE a5u7
				ai_gta_add_unit_label 0 G5_OBJECTIVE a5u8
				ai_gta_add_unit_label 0 G5_OBJECTIVE a5u9
				ai_gta_add_unit_label 0 G5_OBJECTIVE a5u10
				ai_gta_add_unit_label 0 G5_OBJECTIVE a5u11
				ai_gta_add_unit_label 0 G5_OBJECTIVE a5u12
				ai_gta_add_unit_label 0 G5_OBJECTIVE a5u13
				ai_gta_add_unit_label 0 G5_OBJECTIVE a5u14
				ai_gta_add_unit_label 0 G5_OBJECTIVE a5u15
				ai_gta_add_unit_label 0 G5_OBJECTIVE a5u16
				ai_gta_add_unit_label 0 G5_OBJECTIVE a5u17
				ai_gta_add_unit_label 0 G5_OBJECTIVE a5u18
				ai_gta_add_unit_label 0 G5_OBJECTIVE a5u19
				ai_gta_add_unit_label 0 G5_OBJECTIVE a5u20
				if I_CompareCounter army7_reinf_allied = 1
					;;;Army 7
					ai_gta_add_unit_label 0 G5_OBJECTIVE a7u1
					ai_gta_add_unit_label 0 G5_OBJECTIVE a7u2
					ai_gta_add_unit_label 0 G5_OBJECTIVE a7u3
					ai_gta_add_unit_label 0 G5_OBJECTIVE a7u4
					ai_gta_add_unit_label 0 G5_OBJECTIVE a7u5
					ai_gta_add_unit_label 0 G5_OBJECTIVE a7u6
					ai_gta_add_unit_label 0 G5_OBJECTIVE a7u7
					ai_gta_add_unit_label 0 G5_OBJECTIVE a7u8
					ai_gta_add_unit_label 0 G5_OBJECTIVE a7u9
					ai_gta_add_unit_label 0 G5_OBJECTIVE a7u10
					ai_gta_add_unit_label 0 G5_OBJECTIVE a7u11
					ai_gta_add_unit_label 0 G5_OBJECTIVE a7u12
					ai_gta_add_unit_label 0 G5_OBJECTIVE a7u13
					ai_gta_add_unit_label 0 G5_OBJECTIVE a7u14
					ai_gta_add_unit_label 0 G5_OBJECTIVE a7u15
					ai_gta_add_unit_label 0 G5_OBJECTIVE a7u16
					ai_gta_add_unit_label 0 G5_OBJECTIVE a7u17
					ai_gta_add_unit_label 0 G5_OBJECTIVE a7u18
					ai_gta_add_unit_label 0 G5_OBJECTIVE a7u19
					ai_gta_add_unit_label 0 G5_OBJECTIVE a7u20
					if I_CompareCounter army9_reinf_allied = 1
						;;;Army 9
						ai_gta_add_unit_label 0 G5_OBJECTIVE a9u1
						ai_gta_add_unit_label 0 G5_OBJECTIVE a9u2
						ai_gta_add_unit_label 0 G5_OBJECTIVE a9u3
						ai_gta_add_unit_label 0 G5_OBJECTIVE a9u4
						ai_gta_add_unit_label 0 G5_OBJECTIVE a9u5
						ai_gta_add_unit_label 0 G5_OBJECTIVE a9u6
						ai_gta_add_unit_label 0 G5_OBJECTIVE a9u7
						ai_gta_add_unit_label 0 G5_OBJECTIVE a9u8
						ai_gta_add_unit_label 0 G5_OBJECTIVE a9u9
						ai_gta_add_unit_label 0 G5_OBJECTIVE a9u10
						ai_gta_add_unit_label 0 G5_OBJECTIVE a9u11
						ai_gta_add_unit_label 0 G5_OBJECTIVE a9u12
						ai_gta_add_unit_label 0 G5_OBJECTIVE a9u13
						ai_gta_add_unit_label 0 G5_OBJECTIVE a9u14
						ai_gta_add_unit_label 0 G5_OBJECTIVE a9u15
						ai_gta_add_unit_label 0 G5_OBJECTIVE a9u16
						ai_gta_add_unit_label 0 G5_OBJECTIVE a9u17
						ai_gta_add_unit_label 0 G5_OBJECTIVE a9u18
						ai_gta_add_unit_label 0 G5_OBJECTIVE a9u19
						ai_gta_add_unit_label 0 G5_OBJECTIVE a9u20
						if I_CompareCounter army11_reinf_allied = 1
							;;;Army 11
							ai_gta_add_unit_label 0 G5_OBJECTIVE a11u1
							ai_gta_add_unit_label 0 G5_OBJECTIVE a11u2
							ai_gta_add_unit_label 0 G5_OBJECTIVE a11u3
							ai_gta_add_unit_label 0 G5_OBJECTIVE a11u4
							ai_gta_add_unit_label 0 G5_OBJECTIVE a11u5
							ai_gta_add_unit_label 0 G5_OBJECTIVE a11u6
							ai_gta_add_unit_label 0 G5_OBJECTIVE a11u7
							ai_gta_add_unit_label 0 G5_OBJECTIVE a11u8
							ai_gta_add_unit_label 0 G5_OBJECTIVE a11u9
							ai_gta_add_unit_label 0 G5_OBJECTIVE a11u10
							ai_gta_add_unit_label 0 G5_OBJECTIVE a11u11
							ai_gta_add_unit_label 0 G5_OBJECTIVE a11u12
							ai_gta_add_unit_label 0 G5_OBJECTIVE a11u13
							ai_gta_add_unit_label 0 G5_OBJECTIVE a11u14
							ai_gta_add_unit_label 0 G5_OBJECTIVE a11u15
							ai_gta_add_unit_label 0 G5_OBJECTIVE a11u16
							ai_gta_add_unit_label 0 G5_OBJECTIVE a11u17
							ai_gta_add_unit_label 0 G5_OBJECTIVE a11u18
							ai_gta_add_unit_label 0 G5_OBJECTIVE a11u19
							ai_gta_add_unit_label 0 G5_OBJECTIVE a11u20
							if I_CompareCounter army13_reinf_allied = 1
								;;;Army 13
								ai_gta_add_unit_label 0 G5_OBJECTIVE a13u1
								ai_gta_add_unit_label 0 G5_OBJECTIVE a13u2
								ai_gta_add_unit_label 0 G5_OBJECTIVE a13u3
								ai_gta_add_unit_label 0 G5_OBJECTIVE a13u4
								ai_gta_add_unit_label 0 G5_OBJECTIVE a13u5
								ai_gta_add_unit_label 0 G5_OBJECTIVE a13u6
								ai_gta_add_unit_label 0 G5_OBJECTIVE a13u7
								ai_gta_add_unit_label 0 G5_OBJECTIVE a13u8
								ai_gta_add_unit_label 0 G5_OBJECTIVE a13u9
								ai_gta_add_unit_label 0 G5_OBJECTIVE a13u10
								ai_gta_add_unit_label 0 G5_OBJECTIVE a13u11
								ai_gta_add_unit_label 0 G5_OBJECTIVE a13u12
								ai_gta_add_unit_label 0 G5_OBJECTIVE a13u13
								ai_gta_add_unit_label 0 G5_OBJECTIVE a13u14
								ai_gta_add_unit_label 0 G5_OBJECTIVE a13u15
								ai_gta_add_unit_label 0 G5_OBJECTIVE a13u16
								ai_gta_add_unit_label 0 G5_OBJECTIVE a13u17
								ai_gta_add_unit_label 0 G5_OBJECTIVE a13u18
								ai_gta_add_unit_label 0 G5_OBJECTIVE a13u19
								ai_gta_add_unit_label 0 G5_OBJECTIVE a13u20
								if I_CompareCounter army15_reinf_allied = 1
									;;;Army 15
									ai_gta_add_unit_label 0 G5_OBJECTIVE a15u1
									ai_gta_add_unit_label 0 G5_OBJECTIVE a15u2
									ai_gta_add_unit_label 0 G5_OBJECTIVE a15u3
									ai_gta_add_unit_label 0 G5_OBJECTIVE a15u4
									ai_gta_add_unit_label 0 G5_OBJECTIVE a15u5
									ai_gta_add_unit_label 0 G5_OBJECTIVE a15u6
									ai_gta_add_unit_label 0 G5_OBJECTIVE a15u7
									ai_gta_add_unit_label 0 G5_OBJECTIVE a15u8
									ai_gta_add_unit_label 0 G5_OBJECTIVE a15u9
									ai_gta_add_unit_label 0 G5_OBJECTIVE a15u10
									ai_gta_add_unit_label 0 G5_OBJECTIVE a15u11
									ai_gta_add_unit_label 0 G5_OBJECTIVE a15u12
									ai_gta_add_unit_label 0 G5_OBJECTIVE a15u13
									ai_gta_add_unit_label 0 G5_OBJECTIVE a15u14
									ai_gta_add_unit_label 0 G5_OBJECTIVE a15u15
									ai_gta_add_unit_label 0 G5_OBJECTIVE a15u16
									ai_gta_add_unit_label 0 G5_OBJECTIVE a15u17
									ai_gta_add_unit_label 0 G5_OBJECTIVE a15u18
									ai_gta_add_unit_label 0 G5_OBJECTIVE a15u19
									ai_gta_add_unit_label 0 G5_OBJECTIVE a15u20
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if

		if I_CompareCounter launch_alliance_1 = 1
			and I_CompareCounter army4_reinf_allied = 1

			;;;Army 2
			ai_gta_add_unit_label 1 G5_OBJECTIVE a2u1
			ai_gta_add_unit_label 1 G5_OBJECTIVE a2u2
			ai_gta_add_unit_label 1 G5_OBJECTIVE a2u3
			ai_gta_add_unit_label 1 G5_OBJECTIVE a2u4
			ai_gta_add_unit_label 1 G5_OBJECTIVE a2u5
			ai_gta_add_unit_label 1 G5_OBJECTIVE a2u6
			ai_gta_add_unit_label 1 G5_OBJECTIVE a2u7
			ai_gta_add_unit_label 1 G5_OBJECTIVE a2u8
			ai_gta_add_unit_label 1 G5_OBJECTIVE a2u9
			ai_gta_add_unit_label 1 G5_OBJECTIVE a2u10
			ai_gta_add_unit_label 1 G5_OBJECTIVE a2u11
			ai_gta_add_unit_label 1 G5_OBJECTIVE a2u12
			ai_gta_add_unit_label 1 G5_OBJECTIVE a2u13
			ai_gta_add_unit_label 1 G5_OBJECTIVE a2u14
			ai_gta_add_unit_label 1 G5_OBJECTIVE a2u15
			ai_gta_add_unit_label 1 G5_OBJECTIVE a2u16
			ai_gta_add_unit_label 1 G5_OBJECTIVE a2u17
			ai_gta_add_unit_label 1 G5_OBJECTIVE a2u18
			ai_gta_add_unit_label 1 G5_OBJECTIVE a2u19
			ai_gta_add_unit_label 1 G5_OBJECTIVE a2u20
			;;;Army 4
			ai_gta_add_unit_label 1 G5_OBJECTIVE a4u1
			ai_gta_add_unit_label 1 G5_OBJECTIVE a4u2
			ai_gta_add_unit_label 1 G5_OBJECTIVE a4u3
			ai_gta_add_unit_label 1 G5_OBJECTIVE a4u4
			ai_gta_add_unit_label 1 G5_OBJECTIVE a4u5
			ai_gta_add_unit_label 1 G5_OBJECTIVE a4u6
			ai_gta_add_unit_label 1 G5_OBJECTIVE a4u7
			ai_gta_add_unit_label 1 G5_OBJECTIVE a4u8
			ai_gta_add_unit_label 1 G5_OBJECTIVE a4u9
			ai_gta_add_unit_label 1 G5_OBJECTIVE a4u10
			ai_gta_add_unit_label 1 G5_OBJECTIVE a4u11
			ai_gta_add_unit_label 1 G5_OBJECTIVE a4u12
			ai_gta_add_unit_label 1 G5_OBJECTIVE a4u13
			ai_gta_add_unit_label 1 G5_OBJECTIVE a4u14
			ai_gta_add_unit_label 1 G5_OBJECTIVE a4u15
			ai_gta_add_unit_label 1 G5_OBJECTIVE a4u16
			ai_gta_add_unit_label 1 G5_OBJECTIVE a4u17
			ai_gta_add_unit_label 1 G5_OBJECTIVE a4u18
			ai_gta_add_unit_label 1 G5_OBJECTIVE a4u19
			ai_gta_add_unit_label 1 G5_OBJECTIVE a4u20
			if I_CompareCounter army6_reinf_allied = 1
				;;;Army 6
				ai_gta_add_unit_label 1 G5_OBJECTIVE a6u1
				ai_gta_add_unit_label 1 G5_OBJECTIVE a6u2
				ai_gta_add_unit_label 1 G5_OBJECTIVE a6u3
				ai_gta_add_unit_label 1 G5_OBJECTIVE a6u4
				ai_gta_add_unit_label 1 G5_OBJECTIVE a6u5
				ai_gta_add_unit_label 1 G5_OBJECTIVE a6u6
				ai_gta_add_unit_label 1 G5_OBJECTIVE a6u7
				ai_gta_add_unit_label 1 G5_OBJECTIVE a6u8
				ai_gta_add_unit_label 1 G5_OBJECTIVE a6u9
				ai_gta_add_unit_label 1 G5_OBJECTIVE a6u10
				ai_gta_add_unit_label 1 G5_OBJECTIVE a6u11
				ai_gta_add_unit_label 1 G5_OBJECTIVE a6u12
				ai_gta_add_unit_label 1 G5_OBJECTIVE a6u13
				ai_gta_add_unit_label 1 G5_OBJECTIVE a6u14
				ai_gta_add_unit_label 1 G5_OBJECTIVE a6u15
				ai_gta_add_unit_label 1 G5_OBJECTIVE a6u16
				ai_gta_add_unit_label 1 G5_OBJECTIVE a6u17
				ai_gta_add_unit_label 1 G5_OBJECTIVE a6u18
				ai_gta_add_unit_label 1 G5_OBJECTIVE a6u19
				ai_gta_add_unit_label 1 G5_OBJECTIVE a6u20
				if I_CompareCounter army8_reinf_allied = 1
					;;;Army 8
					ai_gta_add_unit_label 1 G5_OBJECTIVE a8u1
					ai_gta_add_unit_label 1 G5_OBJECTIVE a8u2
					ai_gta_add_unit_label 1 G5_OBJECTIVE a8u3
					ai_gta_add_unit_label 1 G5_OBJECTIVE a8u4
					ai_gta_add_unit_label 1 G5_OBJECTIVE a8u5
					ai_gta_add_unit_label 1 G5_OBJECTIVE a8u6
					ai_gta_add_unit_label 1 G5_OBJECTIVE a8u7
					ai_gta_add_unit_label 1 G5_OBJECTIVE a8u8
					ai_gta_add_unit_label 1 G5_OBJECTIVE a8u9
					ai_gta_add_unit_label 1 G5_OBJECTIVE a8u10
					ai_gta_add_unit_label 1 G5_OBJECTIVE a8u11
					ai_gta_add_unit_label 1 G5_OBJECTIVE a8u12
					ai_gta_add_unit_label 1 G5_OBJECTIVE a8u13
					ai_gta_add_unit_label 1 G5_OBJECTIVE a8u14
					ai_gta_add_unit_label 1 G5_OBJECTIVE a8u15
					ai_gta_add_unit_label 1 G5_OBJECTIVE a8u16
					ai_gta_add_unit_label 1 G5_OBJECTIVE a8u17
					ai_gta_add_unit_label 1 G5_OBJECTIVE a8u18
					ai_gta_add_unit_label 1 G5_OBJECTIVE a8u19
					ai_gta_add_unit_label 1 G5_OBJECTIVE a8u20
					if I_CompareCounter army10_reinf_allied = 1
						;;;Army 10
						ai_gta_add_unit_label 1 G5_OBJECTIVE a10u1
						ai_gta_add_unit_label 1 G5_OBJECTIVE a10u2
						ai_gta_add_unit_label 1 G5_OBJECTIVE a10u3
						ai_gta_add_unit_label 1 G5_OBJECTIVE a10u4
						ai_gta_add_unit_label 1 G5_OBJECTIVE a10u5
						ai_gta_add_unit_label 1 G5_OBJECTIVE a10u6
						ai_gta_add_unit_label 1 G5_OBJECTIVE a10u7
						ai_gta_add_unit_label 1 G5_OBJECTIVE a10u8
						ai_gta_add_unit_label 1 G5_OBJECTIVE a10u9
						ai_gta_add_unit_label 1 G5_OBJECTIVE a10u10
						ai_gta_add_unit_label 1 G5_OBJECTIVE a10u11
						ai_gta_add_unit_label 1 G5_OBJECTIVE a10u12
						ai_gta_add_unit_label 1 G5_OBJECTIVE a10u13
						ai_gta_add_unit_label 1 G5_OBJECTIVE a10u14
						ai_gta_add_unit_label 1 G5_OBJECTIVE a10u15
						ai_gta_add_unit_label 1 G5_OBJECTIVE a10u16
						ai_gta_add_unit_label 1 G5_OBJECTIVE a10u17
						ai_gta_add_unit_label 1 G5_OBJECTIVE a10u18
						ai_gta_add_unit_label 1 G5_OBJECTIVE a10u19
						ai_gta_add_unit_label 1 G5_OBJECTIVE a10u20
						if I_CompareCounter army12_reinf_allied = 1
							;;;Army 12
							ai_gta_add_unit_label 1 G5_OBJECTIVE a12u1
							ai_gta_add_unit_label 1 G5_OBJECTIVE a12u2
							ai_gta_add_unit_label 1 G5_OBJECTIVE a12u3
							ai_gta_add_unit_label 1 G5_OBJECTIVE a12u4
							ai_gta_add_unit_label 1 G5_OBJECTIVE a12u5
							ai_gta_add_unit_label 1 G5_OBJECTIVE a12u6
							ai_gta_add_unit_label 1 G5_OBJECTIVE a12u7
							ai_gta_add_unit_label 1 G5_OBJECTIVE a12u8
							ai_gta_add_unit_label 1 G5_OBJECTIVE a12u9
							ai_gta_add_unit_label 1 G5_OBJECTIVE a12u10
							ai_gta_add_unit_label 1 G5_OBJECTIVE a12u11
							ai_gta_add_unit_label 1 G5_OBJECTIVE a12u12
							ai_gta_add_unit_label 1 G5_OBJECTIVE a12u13
							ai_gta_add_unit_label 1 G5_OBJECTIVE a12u14
							ai_gta_add_unit_label 1 G5_OBJECTIVE a12u15
							ai_gta_add_unit_label 1 G5_OBJECTIVE a12u16
							ai_gta_add_unit_label 1 G5_OBJECTIVE a12u17
							ai_gta_add_unit_label 1 G5_OBJECTIVE a12u18
							ai_gta_add_unit_label 1 G5_OBJECTIVE a12u19
							ai_gta_add_unit_label 1 G5_OBJECTIVE a12u20
							if I_CompareCounter army14_reinf_allied = 1
								;;;Army 14
								ai_gta_add_unit_label 1 G5_OBJECTIVE a14u1
								ai_gta_add_unit_label 1 G5_OBJECTIVE a14u2
								ai_gta_add_unit_label 1 G5_OBJECTIVE a14u3
								ai_gta_add_unit_label 1 G5_OBJECTIVE a14u4
								ai_gta_add_unit_label 1 G5_OBJECTIVE a14u5
								ai_gta_add_unit_label 1 G5_OBJECTIVE a14u6
								ai_gta_add_unit_label 1 G5_OBJECTIVE a14u7
								ai_gta_add_unit_label 1 G5_OBJECTIVE a14u8
								ai_gta_add_unit_label 1 G5_OBJECTIVE a14u9
								ai_gta_add_unit_label 1 G5_OBJECTIVE a14u10
								ai_gta_add_unit_label 1 G5_OBJECTIVE a14u11
								ai_gta_add_unit_label 1 G5_OBJECTIVE a14u12
								ai_gta_add_unit_label 1 G5_OBJECTIVE a14u13
								ai_gta_add_unit_label 1 G5_OBJECTIVE a14u14
								ai_gta_add_unit_label 1 G5_OBJECTIVE a14u15
								ai_gta_add_unit_label 1 G5_OBJECTIVE a14u16
								ai_gta_add_unit_label 1 G5_OBJECTIVE a14u17
								ai_gta_add_unit_label 1 G5_OBJECTIVE a14u18
								ai_gta_add_unit_label 1 G5_OBJECTIVE a14u19
								ai_gta_add_unit_label 1 G5_OBJECTIVE a14u20
								if I_CompareCounter army16_reinf_allied = 1
									;;;Army 16
									ai_gta_add_unit_label 1 G5_OBJECTIVE a16u1
									ai_gta_add_unit_label 1 G5_OBJECTIVE a16u2
									ai_gta_add_unit_label 1 G5_OBJECTIVE a16u3
									ai_gta_add_unit_label 1 G5_OBJECTIVE a16u4
									ai_gta_add_unit_label 1 G5_OBJECTIVE a16u5
									ai_gta_add_unit_label 1 G5_OBJECTIVE a16u6
									ai_gta_add_unit_label 1 G5_OBJECTIVE a16u7
									ai_gta_add_unit_label 1 G5_OBJECTIVE a16u8
									ai_gta_add_unit_label 1 G5_OBJECTIVE a16u9
									ai_gta_add_unit_label 1 G5_OBJECTIVE a16u10
									ai_gta_add_unit_label 1 G5_OBJECTIVE a16u11
									ai_gta_add_unit_label 1 G5_OBJECTIVE a16u12
									ai_gta_add_unit_label 1 G5_OBJECTIVE a16u13
									ai_gta_add_unit_label 1 G5_OBJECTIVE a16u14
									ai_gta_add_unit_label 1 G5_OBJECTIVE a16u15
									ai_gta_add_unit_label 1 G5_OBJECTIVE a16u16
									ai_gta_add_unit_label 1 G5_OBJECTIVE a16u17
									ai_gta_add_unit_label 1 G5_OBJECTIVE a16u18
									ai_gta_add_unit_label 1 G5_OBJECTIVE a16u19
									ai_gta_add_unit_label 1 G5_OBJECTIVE a16u20
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if
		battle_wait 0.5
		ai_active_set on
		set_counter apply_strategy 0
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter relaunch_movement = 1

		ai_active_set on
		battle_wait 0.5
		set_counter army3_moving 0
		set_counter army4_moving 0
		set_counter army5_moving 0
		set_counter army6_moving 0
		set_counter army7_moving 0
		set_counter army8_moving 0
		set_counter army9_moving 0
		set_counter army10_moving 0
		set_counter army11_moving 0
		set_counter army12_moving 0
		set_counter army13_moving 0
		set_counter army14_moving 0
		set_counter army15_moving 0
		set_counter army16_moving 0

		battle_wait 5
		set_counter relaunch_movement 0
	end_monitor

	;;;;;;; Attacking

	monitor_conditions I_BattleStarted
		and I_CompareCounter att_alliance_ready = 1
		and ! I_BattlePlayerArmyIsAttacker
		;    inc_counter reinf_check_interval 1
		if I_CompareCounter army3_reinf_allied = 1

			if I_CompareCounter army3_reinf_allied = 1
				and I_CompareCounter army3_moving = 1
				and I_UnitEnemyUnitInRadius a3u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army1 army3

				unit_group_order_halt army3
				battle_wait 0.5
				set_counter relaunch_movement 1
				set_counter army3_moving 0
			end_if

			if I_CompareCounter army3_reinf_allied = 1
				and I_CompareCounter army3_moving = 1
				and ! I_UnitEnemyUnitInRadius a3u1 160
				and I_UnitDistanceFromUnit a1u1 a3u1 > 150
				and I_IsUnitIdle a3u1

				set_counter army3_reinf_late 1
				battle_wait 1
				set_counter army3_moving 1
			end_if

			if I_CompareCounter army3_reinf_allied = 1
				and I_CompareCounter army3_moving = 0
				and ! I_UnitEnemyUnitInRadius a3u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army1 army3

				set_counter army3_run 1
				set_counter army3_moving 1
			end_if

			if I_CompareCounter army3_reinf_allied = 1
				and I_CompareCounter distance_trigger1 = 0
				and I_UnitDistanceFromUnit a3u1 a1u1 < 1000

				set_counter army3_reinf_late 1
				set_counter distance_trigger1 1
			end_if

			if I_CompareCounter army3_reinf_allied = 1
				and I_CompareCounter distance_trigger2 = 0
				and I_UnitDistanceFromUnit a3u1 a1u1 < 750

				set_counter army3_reinf_late 1
				set_counter distance_trigger2 1
			end_if

			if I_CompareCounter army3_reinf_allied = 1
				and I_CompareCounter distance_trigger3 = 0
				and I_UnitDistanceFromUnit a3u1 a1u1 < 500

				set_counter army3_reinf_late 1
				set_counter distance_trigger3 1
			end_if

			if I_CompareCounter army3_reinf_allied = 1
				and I_CompareCounter distance_trigger4 = 0
				and I_UnitDistanceFromUnit a3u1 a1u1 < 300

				set_counter army3_reinf_late 1
				set_counter distance_trigger4 1
			end_if

			if I_CompareCounter army3_reinf_allied = 1
				and I_CompareCounter distance_trigger5 = 0
				and I_UnitDistanceFromUnit a3u1 a1u1 < 200

				set_counter army3_reinf_late 1
				set_counter distance_trigger5 1
			end_if

			if I_CompareCounter army3_reinf_allied = 1
				and I_CompareCounter army3_reinf_late = 1
				and ! I_UnitEnemyUnitInRadius a3u1 160
				;    and ! I_UnitGroupInRangeOfUnitGroup army1 army3

				set_counter army3_run 1
				battle_wait 0.5
				set_counter army3_moving 1
				set_counter army3_reinf_late 0
			end_if

			if I_CompareCounter army3_reinf_allied = 1
				and I_UnitDistanceFromUnit a3u1 a1u1 < 150
				and I_UnitEnemyUnitInRadius a1u1 100

				set_counter army3_reinf_allied 0
				unit_group_order_halt army3
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army3_reinf_allied = 1
				and I_UnitDistanceFromUnit a3u1 a1u1 < 100

				set_counter army3_reinf_allied 0
				unit_group_order_halt army3
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army3_reinf_allied = 1
				and I_PercentageUnitKilled a3u1 > 60

				set_counter army3_reinf_allied 0
				unit_group_order_halt army3
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army3_reinf_allied = 1
				and I_UnitDistanceFromUnit a3u1 a2u1 < 200
				and I_UnitDistanceFromUnit a1u1 a2u1 < 200

				set_counter army3_reinf_allied 0
				unit_group_order_halt army3
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army3_reinf_allied = 1
				and I_PercentageUnitGroupKilled army3 > 50

				set_counter army3_reinf_allied 0
				unit_group_order_halt army3
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army3_reinf_allied = 1
				and I_UnitDistanceFromUnit a3u1 a1u1 < 250
				and I_UnitGroupInRangeOfUnit army3 a1u1

				set_counter army3_reinf_allied 0
				unit_group_order_halt army3
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army3_reinf_allied = 1
				and I_UnitDistanceFromUnit a1u1 a3u1 < 250
				and I_IsUnitIdle a3u1

				set_counter army3_reinf_allied 0
				unit_group_order_halt army3
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army3_reinf_allied = 1
				and I_IsUnitRouting a1u1

				set_counter army3_reinf_allied 0
				unit_group_order_halt army3
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army3_reinf_allied = 1
				and I_PercentageUnitKilled a1u1 > 80

				set_counter army3_reinf_allied 0
				unit_group_order_halt army3
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army3_reinf_allied = 1
				and I_UnitDistanceFromUnit a1u1 a3u1 < 250
				and I_IsUnitUnderFire a3u1

				set_counter army3_reinf_allied 0
				unit_group_order_halt army3
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army3_reinf_allied = 1
				and I_CompareCounter army3_run = 1

				;    unit_group_order_halt army3
				battle_wait 0.5
				unit_group_move_to_missile_range_of_unit army3 a1u1 run
				battle_wait 0.5
				set_counter army3_run 0
			end_if

		end_if

		if I_CompareCounter army5_reinf_allied = 1

			if I_CompareCounter army5_reinf_allied = 1
				and I_CompareCounter army5_moving = 1
				and I_UnitEnemyUnitInRadius a5u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army1 army5

				unit_group_order_halt army5
				battle_wait 0.5
				set_counter relaunch_movement 1
				set_counter army5_moving 0
			end_if

			if I_CompareCounter army5_reinf_allied = 1
				and I_CompareCounter army5_moving = 1
				and ! I_UnitEnemyUnitInRadius a5u1 160
				and I_UnitDistanceFromUnit a1u1 a5u1 > 150
				and I_IsUnitIdle a5u1

				set_counter army5_reinf_late 1
				battle_wait 1
				set_counter army5_moving 1
			end_if

			if I_CompareCounter army5_reinf_allied = 1
				and I_CompareCounter army5_moving = 0
				and ! I_UnitEnemyUnitInRadius a5u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army1 army5

				set_counter army5_run 1
				set_counter army5_moving 1
			end_if

			if I_CompareCounter army5_reinf_allied = 1
				and I_CompareCounter distance_trigger1 = 0
				and I_UnitDistanceFromUnit a5u1 a1u1 < 1000

				set_counter army5_reinf_late 1
				set_counter distance_trigger1 1
			end_if

			if I_CompareCounter army5_reinf_allied = 1
				and I_CompareCounter distance_trigger2 = 0
				and I_UnitDistanceFromUnit a5u1 a1u1 < 750

				set_counter army5_reinf_late 1
				set_counter distance_trigger2 1
			end_if

			if I_CompareCounter army5_reinf_allied = 1
				and I_CompareCounter distance_trigger3 = 0
				and I_UnitDistanceFromUnit a5u1 a1u1 < 500

				set_counter army5_reinf_late 1
				set_counter distance_trigger3 1
			end_if

			if I_CompareCounter army5_reinf_allied = 1
				and I_CompareCounter distance_trigger4 = 0
				and I_UnitDistanceFromUnit a5u1 a1u1 < 300

				set_counter army5_reinf_late 1
				set_counter distance_trigger4 1
			end_if

			if I_CompareCounter army5_reinf_allied = 1
				and I_CompareCounter distance_trigger5 = 0
				and I_UnitDistanceFromUnit a5u1 a1u1 < 200

				set_counter army5_reinf_late 1
				set_counter distance_trigger5 1
			end_if

			if I_CompareCounter army5_reinf_allied = 1
				and I_CompareCounter army5_reinf_late = 1
				and ! I_UnitEnemyUnitInRadius a5u1 160
				;    and ! I_UnitGroupInRangeOfUnitGroup army1 army5

				set_counter army5_run 1
				battle_wait 0.5
				set_counter army5_moving 1
				set_counter army5_reinf_late 0
			end_if

			if I_CompareCounter army5_reinf_allied = 1
				and I_UnitDistanceFromUnit a5u1 a1u1 < 150
				and I_UnitEnemyUnitInRadius a1u1 100

				set_counter army5_reinf_allied 0
				unit_group_order_halt army5
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army5_reinf_allied = 1
				and I_UnitDistanceFromUnit a5u1 a1u1 < 100

				set_counter army5_reinf_allied 0
				unit_group_order_halt army5
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army5_reinf_allied = 1
				and I_PercentageUnitKilled a5u1 > 60

				set_counter army5_reinf_allied 0
				unit_group_order_halt army5
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army5_reinf_allied = 1
				and I_UnitDistanceFromUnit a5u1 a2u1 < 200
				and I_UnitDistanceFromUnit a1u1 a2u1 < 200

				set_counter army5_reinf_allied 0
				unit_group_order_halt army5
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army5_reinf_allied = 1
				and I_PercentageUnitGroupKilled army5 > 50

				set_counter army5_reinf_allied 0
				unit_group_order_halt army5
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army5_reinf_allied = 1
				and I_UnitDistanceFromUnit a5u1 a1u1 < 250
				and I_UnitGroupInRangeOfUnit army5 a1u1

				set_counter army5_reinf_allied 0
				unit_group_order_halt army5
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army5_reinf_allied = 1
				and I_UnitDistanceFromUnit a1u1 a5u1 < 250
				and I_IsUnitIdle a5u1

				set_counter army5_reinf_allied 0
				unit_group_order_halt army5
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army5_reinf_allied = 1
				and I_IsUnitRouting a1u1

				set_counter army5_reinf_allied 0
				unit_group_order_halt army5
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army5_reinf_allied = 1
				and I_PercentageUnitKilled a1u1 > 80

				set_counter army5_reinf_allied 0
				unit_group_order_halt army5
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army5_reinf_allied = 1
				and I_UnitDistanceFromUnit a1u1 a5u1 < 250
				and I_IsUnitUnderFire a5u1

				set_counter army5_reinf_allied 0
				unit_group_order_halt army5
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army5_reinf_allied = 1
				and I_CompareCounter army5_run = 1

				;    unit_group_order_halt army5
				battle_wait 0.5
				unit_group_move_to_missile_range_of_unit army5 a1u1 run
				battle_wait 0.5
				set_counter army5_run 0
			end_if

		end_if

		if I_CompareCounter army7_reinf_allied = 1

			if I_CompareCounter army7_reinf_allied = 1
				and I_CompareCounter army7_moving = 1
				and I_UnitEnemyUnitInRadius a7u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army1 army7

				unit_group_order_halt army7
				battle_wait 0.5
				set_counter relaunch_movement 1
				set_counter army7_moving 0
			end_if

			if I_CompareCounter army7_reinf_allied = 1
				and I_CompareCounter army7_moving = 1
				and ! I_UnitEnemyUnitInRadius a7u1 160
				and I_UnitDistanceFromUnit a1u1 a7u1 > 150
				and I_IsUnitIdle a7u1

				set_counter army7_reinf_late 1
				battle_wait 1
				set_counter army7_moving 1
			end_if

			if I_CompareCounter army7_reinf_allied = 1
				and I_CompareCounter army7_moving = 0
				and ! I_UnitEnemyUnitInRadius a7u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army1 army7

				set_counter army7_run 1
				set_counter army7_moving 1
			end_if

			if I_CompareCounter army7_reinf_allied = 1
				and I_CompareCounter distance_trigger1 = 0
				and I_UnitDistanceFromUnit a7u1 a1u1 < 1000

				set_counter army7_reinf_late 1
				set_counter distance_trigger1 1
			end_if

			if I_CompareCounter army7_reinf_allied = 1
				and I_CompareCounter distance_trigger2 = 0
				and I_UnitDistanceFromUnit a7u1 a1u1 < 750

				set_counter army7_reinf_late 1
				set_counter distance_trigger2 1
			end_if

			if I_CompareCounter army7_reinf_allied = 1
				and I_CompareCounter distance_trigger3 = 0
				and I_UnitDistanceFromUnit a7u1 a1u1 < 500

				set_counter army7_reinf_late 1
				set_counter distance_trigger3 1
			end_if

			if I_CompareCounter army7_reinf_allied = 1
				and I_CompareCounter distance_trigger4 = 0
				and I_UnitDistanceFromUnit a7u1 a1u1 < 300

				set_counter army7_reinf_late 1
				set_counter distance_trigger4 1
			end_if

			if I_CompareCounter army7_reinf_allied = 1
				and I_CompareCounter distance_trigger5 = 0
				and I_UnitDistanceFromUnit a7u1 a1u1 < 200

				set_counter army7_reinf_late 1
				set_counter distance_trigger5 1
			end_if

			if I_CompareCounter army7_reinf_allied = 1
				and I_CompareCounter army7_reinf_late = 1
				and ! I_UnitEnemyUnitInRadius a7u1 160
				;    and ! I_UnitGroupInRangeOfUnitGroup army1 army7

				set_counter army7_run 1
				battle_wait 0.5
				set_counter army7_moving 1
				set_counter army7_reinf_late 0
			end_if

			if I_CompareCounter army7_reinf_allied = 1
				and I_UnitDistanceFromUnit a7u1 a1u1 < 150
				and I_UnitEnemyUnitInRadius a1u1 100

				set_counter army7_reinf_allied 0
				unit_group_order_halt army7
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army7_reinf_allied = 1
				and I_UnitDistanceFromUnit a7u1 a1u1 < 100

				set_counter army7_reinf_allied 0
				unit_group_order_halt army7
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army7_reinf_allied = 1
				and I_PercentageUnitKilled a7u1 > 60

				set_counter army7_reinf_allied 0
				unit_group_order_halt army7
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army7_reinf_allied = 1
				and I_UnitDistanceFromUnit a7u1 a2u1 < 200
				and I_UnitDistanceFromUnit a1u1 a2u1 < 200

				set_counter army7_reinf_allied 0
				unit_group_order_halt army7
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army7_reinf_allied = 1
				and I_PercentageUnitGroupKilled army7 > 50

				set_counter army7_reinf_allied 0
				unit_group_order_halt army7
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army7_reinf_allied = 1
				and I_UnitDistanceFromUnit a7u1 a1u1 < 250
				and I_UnitGroupInRangeOfUnit army7 a1u1

				set_counter army7_reinf_allied 0
				unit_group_order_halt army7
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army7_reinf_allied = 1
				and I_UnitDistanceFromUnit a1u1 a7u1 < 250
				and I_IsUnitIdle a7u1

				set_counter army7_reinf_allied 0
				unit_group_order_halt army7
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army7_reinf_allied = 1
				and I_IsUnitRouting a1u1

				set_counter army7_reinf_allied 0
				unit_group_order_halt army7
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army7_reinf_allied = 1
				and I_PercentageUnitKilled a1u1 > 80

				set_counter army7_reinf_allied 0
				unit_group_order_halt army7
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army7_reinf_allied = 1
				and I_UnitDistanceFromUnit a1u1 a7u1 < 250
				and I_IsUnitUnderFire a7u1

				set_counter army7_reinf_allied 0
				unit_group_order_halt army7
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army7_reinf_allied = 1
				and I_CompareCounter army7_run = 1

				;    unit_group_order_halt army7
				battle_wait 0.5
				unit_group_move_to_missile_range_of_unit army7 a1u1 run
				battle_wait 0.5
				set_counter army7_run 0
			end_if

		end_if

		if I_CompareCounter army9_reinf_allied = 1

			if I_CompareCounter army9_reinf_allied = 1
				and I_CompareCounter army9_moving = 1
				and I_UnitEnemyUnitInRadius a9u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army1 army9

				unit_group_order_halt army9
				battle_wait 0.5
				set_counter relaunch_movement 1
				set_counter army9_moving 0
			end_if

			if I_CompareCounter army9_reinf_allied = 1
				and I_CompareCounter army9_moving = 1
				and ! I_UnitEnemyUnitInRadius a9u1 160
				and I_UnitDistanceFromUnit a1u1 a9u1 > 150
				and I_IsUnitIdle a9u1

				set_counter army9_reinf_late 1
				battle_wait 1
				set_counter army9_moving 1
			end_if

			if I_CompareCounter army9_reinf_allied = 1
				and I_CompareCounter army9_moving = 0
				and ! I_UnitEnemyUnitInRadius a9u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army1 army9

				set_counter army9_run 1
				set_counter army9_moving 1
			end_if

			if I_CompareCounter army9_reinf_allied = 1
				and I_CompareCounter distance_trigger1 = 0
				and I_UnitDistanceFromUnit a9u1 a1u1 < 1000

				set_counter army9_reinf_late 1
				set_counter distance_trigger1 1
			end_if

			if I_CompareCounter army9_reinf_allied = 1
				and I_CompareCounter distance_trigger2 = 0
				and I_UnitDistanceFromUnit a9u1 a1u1 < 750

				set_counter army9_reinf_late 1
				set_counter distance_trigger2 1
			end_if

			if I_CompareCounter army9_reinf_allied = 1
				and I_CompareCounter distance_trigger3 = 0
				and I_UnitDistanceFromUnit a9u1 a1u1 < 500

				set_counter army9_reinf_late 1
				set_counter distance_trigger3 1
			end_if

			if I_CompareCounter army9_reinf_allied = 1
				and I_CompareCounter distance_trigger4 = 0
				and I_UnitDistanceFromUnit a9u1 a1u1 < 300

				set_counter army9_reinf_late 1
				set_counter distance_trigger4 1
			end_if

			if I_CompareCounter army9_reinf_allied = 1
				and I_CompareCounter distance_trigger5 = 0
				and I_UnitDistanceFromUnit a9u1 a1u1 < 200

				set_counter army9_reinf_late 1
				set_counter distance_trigger5 1
			end_if

			if I_CompareCounter army9_reinf_allied = 1
				and I_CompareCounter army9_reinf_late = 1
				and ! I_UnitEnemyUnitInRadius a9u1 160
				;    and ! I_UnitGroupInRangeOfUnitGroup army1 army9

				set_counter army9_run 1
				battle_wait 0.5
				set_counter army9_moving 1
				set_counter army9_reinf_late 0
			end_if

			if I_CompareCounter army9_reinf_allied = 1
				and I_UnitDistanceFromUnit a9u1 a1u1 < 150
				and I_UnitEnemyUnitInRadius a1u1 100

				set_counter army9_reinf_allied 0
				unit_group_order_halt army9
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army9_reinf_allied = 1
				and I_UnitDistanceFromUnit a9u1 a1u1 < 100

				set_counter army9_reinf_allied 0
				unit_group_order_halt army9
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army9_reinf_allied = 1
				and I_PercentageUnitKilled a9u1 > 60

				set_counter army9_reinf_allied 0
				unit_group_order_halt army9
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army9_reinf_allied = 1
				and I_UnitDistanceFromUnit a9u1 a2u1 < 200
				and I_UnitDistanceFromUnit a1u1 a2u1 < 200

				set_counter army9_reinf_allied 0
				unit_group_order_halt army9
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army9_reinf_allied = 1
				and I_PercentageUnitGroupKilled army9 > 50

				set_counter army9_reinf_allied 0
				unit_group_order_halt army9
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army9_reinf_allied = 1
				and I_UnitDistanceFromUnit a9u1 a1u1 < 250
				and I_UnitGroupInRangeOfUnit army9 a1u1

				set_counter army9_reinf_allied 0
				unit_group_order_halt army9
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army9_reinf_allied = 1
				and I_UnitDistanceFromUnit a1u1 a9u1 < 250
				and I_IsUnitIdle a9u1

				set_counter army9_reinf_allied 0
				unit_group_order_halt army9
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army9_reinf_allied = 1
				and I_IsUnitRouting a1u1

				set_counter army9_reinf_allied 0
				unit_group_order_halt army9
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army9_reinf_allied = 1
				and I_PercentageUnitKilled a1u1 > 80

				set_counter army9_reinf_allied 0
				unit_group_order_halt army9
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army9_reinf_allied = 1
				and I_UnitDistanceFromUnit a1u1 a9u1 < 250
				and I_IsUnitUnderFire a9u1

				set_counter army9_reinf_allied 0
				unit_group_order_halt army9
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army9_reinf_allied = 1
				and I_CompareCounter army9_run = 1

				;    unit_group_order_halt army9
				battle_wait 0.5
				unit_group_move_to_missile_range_of_unit army9 a1u1 run
				battle_wait 0.5
				set_counter army9_run 0
			end_if

		end_if

		if I_CompareCounter army11_reinf_allied = 1

			if I_CompareCounter army11_reinf_allied = 1
				and I_CompareCounter army11_moving = 1
				and I_UnitEnemyUnitInRadius a11u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army1 army11

				unit_group_order_halt army11
				battle_wait 0.5
				set_counter relaunch_movement 1
				set_counter army11_moving 0
			end_if

			if I_CompareCounter army11_reinf_allied = 1
				and I_CompareCounter army11_moving = 1
				and ! I_UnitEnemyUnitInRadius a11u1 160
				and I_UnitDistanceFromUnit a1u1 a11u1 > 150
				and I_IsUnitIdle a11u1

				set_counter army11_reinf_late 1
				battle_wait 1
				set_counter army11_moving 1
			end_if

			if I_CompareCounter army11_reinf_allied = 1
				and I_CompareCounter army11_moving = 0
				and ! I_UnitEnemyUnitInRadius a11u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army1 army11

				set_counter army11_run 1
				set_counter army11_moving 1
			end_if

			if I_CompareCounter army11_reinf_allied = 1
				and I_CompareCounter distance_trigger1 = 0
				and I_UnitDistanceFromUnit a11u1 a1u1 < 1000

				set_counter army11_reinf_late 1
				set_counter distance_trigger1 1
			end_if

			if I_CompareCounter army11_reinf_allied = 1
				and I_CompareCounter distance_trigger2 = 0
				and I_UnitDistanceFromUnit a11u1 a1u1 < 750

				set_counter army11_reinf_late 1
				set_counter distance_trigger2 1
			end_if

			if I_CompareCounter army11_reinf_allied = 1
				and I_CompareCounter distance_trigger3 = 0
				and I_UnitDistanceFromUnit a11u1 a1u1 < 500

				set_counter army11_reinf_late 1
				set_counter distance_trigger3 1
			end_if

			if I_CompareCounter army11_reinf_allied = 1
				and I_CompareCounter distance_trigger4 = 0
				and I_UnitDistanceFromUnit a11u1 a1u1 < 300

				set_counter army11_reinf_late 1
				set_counter distance_trigger4 1
			end_if

			if I_CompareCounter army11_reinf_allied = 1
				and I_CompareCounter distance_trigger5 = 0
				and I_UnitDistanceFromUnit a11u1 a1u1 < 200

				set_counter army11_reinf_late 1
				set_counter distance_trigger5 1
			end_if

			if I_CompareCounter army11_reinf_allied = 1
				and I_CompareCounter army11_reinf_late = 1
				and ! I_UnitEnemyUnitInRadius a11u1 160
				;    and ! I_UnitGroupInRangeOfUnitGroup army1 army11

				set_counter army11_run 1
				battle_wait 0.5
				set_counter army11_moving 1
				set_counter army11_reinf_late 0
			end_if

			if I_CompareCounter army11_reinf_allied = 1
				and I_UnitDistanceFromUnit a11u1 a1u1 < 150
				and I_UnitEnemyUnitInRadius a1u1 100

				set_counter army11_reinf_allied 0
				unit_group_order_halt army11
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army11_reinf_allied = 1
				and I_UnitDistanceFromUnit a11u1 a1u1 < 100

				set_counter army11_reinf_allied 0
				unit_group_order_halt army11
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army11_reinf_allied = 1
				and I_PercentageUnitKilled a11u1 > 60

				set_counter army11_reinf_allied 0
				unit_group_order_halt army11
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army11_reinf_allied = 1
				and I_UnitDistanceFromUnit a11u1 a2u1 < 200
				and I_UnitDistanceFromUnit a1u1 a2u1 < 200

				set_counter army11_reinf_allied 0
				unit_group_order_halt army11
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army11_reinf_allied = 1
				and I_PercentageUnitGroupKilled army11 > 50

				set_counter army11_reinf_allied 0
				unit_group_order_halt army11
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army11_reinf_allied = 1
				and I_UnitDistanceFromUnit a11u1 a1u1 < 250
				and I_UnitGroupInRangeOfUnit army11 a1u1

				set_counter army11_reinf_allied 0
				unit_group_order_halt army11
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army11_reinf_allied = 1
				and I_UnitDistanceFromUnit a1u1 a11u1 < 250
				and I_IsUnitIdle a11u1

				set_counter army11_reinf_allied 0
				unit_group_order_halt army11
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army11_reinf_allied = 1
				and I_IsUnitRouting a1u1

				set_counter army11_reinf_allied 0
				unit_group_order_halt army11
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army11_reinf_allied = 1
				and I_PercentageUnitKilled a1u1 > 80

				set_counter army11_reinf_allied 0
				unit_group_order_halt army11
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army11_reinf_allied = 1
				and I_UnitDistanceFromUnit a1u1 a11u1 < 250
				and I_IsUnitUnderFire a11u1

				set_counter army11_reinf_allied 0
				unit_group_order_halt army11
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army11_reinf_allied = 1
				and I_CompareCounter army11_run = 1

				;    unit_group_order_halt army11
				battle_wait 0.5
				unit_group_move_to_missile_range_of_unit army11 a1u1 run
				battle_wait 0.5
				set_counter army11_run 0
			end_if

		end_if

		if I_CompareCounter army13_reinf_allied = 1

			if I_CompareCounter army13_reinf_allied = 1
				and I_CompareCounter army13_moving = 1
				and I_UnitEnemyUnitInRadius a13u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army1 army13

				unit_group_order_halt army13
				battle_wait 0.5
				set_counter relaunch_movement 1
				set_counter army13_moving 0
			end_if

			if I_CompareCounter army13_reinf_allied = 1
				and I_CompareCounter army13_moving = 1
				and ! I_UnitEnemyUnitInRadius a13u1 160
				and I_UnitDistanceFromUnit a1u1 a13u1 > 150
				and I_IsUnitIdle a13u1

				set_counter army13_reinf_late 1
				battle_wait 1
				set_counter army13_moving 1
			end_if

			if I_CompareCounter army13_reinf_allied = 1
				and I_CompareCounter army13_moving = 0
				and ! I_UnitEnemyUnitInRadius a13u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army1 army13

				set_counter army13_run 1
				set_counter army13_moving 1
			end_if

			if I_CompareCounter army13_reinf_allied = 1
				and I_CompareCounter distance_trigger1 = 0
				and I_UnitDistanceFromUnit a13u1 a1u1 < 1000

				set_counter army13_reinf_late 1
				set_counter distance_trigger1 1
			end_if

			if I_CompareCounter army13_reinf_allied = 1
				and I_CompareCounter distance_trigger2 = 0
				and I_UnitDistanceFromUnit a13u1 a1u1 < 750

				set_counter army13_reinf_late 1
				set_counter distance_trigger2 1
			end_if

			if I_CompareCounter army13_reinf_allied = 1
				and I_CompareCounter distance_trigger3 = 0
				and I_UnitDistanceFromUnit a13u1 a1u1 < 500

				set_counter army13_reinf_late 1
				set_counter distance_trigger3 1
			end_if

			if I_CompareCounter army13_reinf_allied = 1
				and I_CompareCounter distance_trigger4 = 0
				and I_UnitDistanceFromUnit a13u1 a1u1 < 300

				set_counter army13_reinf_late 1
				set_counter distance_trigger4 1
			end_if

			if I_CompareCounter army13_reinf_allied = 1
				and I_CompareCounter distance_trigger5 = 0
				and I_UnitDistanceFromUnit a13u1 a1u1 < 200

				set_counter army13_reinf_late 1
				set_counter distance_trigger5 1
			end_if

			if I_CompareCounter army13_reinf_allied = 1
				and I_CompareCounter army13_reinf_late = 1
				and ! I_UnitEnemyUnitInRadius a13u1 160
				;    and ! I_UnitGroupInRangeOfUnitGroup army1 army13

				set_counter army13_run 1
				battle_wait 0.5
				set_counter army13_moving 1
				set_counter army13_reinf_late 0
			end_if

			if I_CompareCounter army13_reinf_allied = 1
				and I_UnitDistanceFromUnit a13u1 a1u1 < 150
				and I_UnitEnemyUnitInRadius a1u1 100

				set_counter army13_reinf_allied 0
				unit_group_order_halt army13
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army13_reinf_allied = 1
				and I_UnitDistanceFromUnit a13u1 a1u1 < 100

				set_counter army13_reinf_allied 0
				unit_group_order_halt army13
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army13_reinf_allied = 1
				and I_PercentageUnitKilled a13u1 > 60

				set_counter army13_reinf_allied 0
				unit_group_order_halt army13
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army13_reinf_allied = 1
				and I_UnitDistanceFromUnit a13u1 a2u1 < 200
				and I_UnitDistanceFromUnit a1u1 a2u1 < 200

				set_counter army13_reinf_allied 0
				unit_group_order_halt army13
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army13_reinf_allied = 1
				and I_PercentageUnitGroupKilled army13 > 50

				set_counter army13_reinf_allied 0
				unit_group_order_halt army13
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army13_reinf_allied = 1
				and I_UnitDistanceFromUnit a13u1 a1u1 < 250
				and I_UnitGroupInRangeOfUnit army13 a1u1

				set_counter army13_reinf_allied 0
				unit_group_order_halt army13
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army13_reinf_allied = 1
				and I_UnitDistanceFromUnit a1u1 a13u1 < 250
				and I_IsUnitIdle a13u1

				set_counter army13_reinf_allied 0
				unit_group_order_halt army13
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army13_reinf_allied = 1
				and I_IsUnitRouting a1u1

				set_counter army13_reinf_allied 0
				unit_group_order_halt army13
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army13_reinf_allied = 1
				and I_PercentageUnitKilled a1u1 > 80

				set_counter army13_reinf_allied 0
				unit_group_order_halt army13
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army13_reinf_allied = 1
				and I_UnitDistanceFromUnit a1u1 a13u1 < 250
				and I_IsUnitUnderFire a13u1

				set_counter army13_reinf_allied 0
				unit_group_order_halt army13
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army13_reinf_allied = 1
				and I_CompareCounter army13_run = 1

				;    unit_group_order_halt army13
				battle_wait 0.5
				unit_group_move_to_missile_range_of_unit army13 a1u1 run
				battle_wait 0.5
				set_counter army13_run 0
			end_if

		end_if

		if I_CompareCounter army15_reinf_allied = 1

			if I_CompareCounter army15_reinf_allied = 1
				and I_CompareCounter army15_moving = 1
				and I_UnitEnemyUnitInRadius a15u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army1 army15

				unit_group_order_halt army15
				battle_wait 0.5
				set_counter relaunch_movement 1
				set_counter army15_moving 0
			end_if

			if I_CompareCounter army15_reinf_allied = 1
				and I_CompareCounter army15_moving = 1
				and ! I_UnitEnemyUnitInRadius a15u1 160
				and I_UnitDistanceFromUnit a1u1 a15u1 > 150
				and I_IsUnitIdle a15u1

				set_counter army15_reinf_late 1
				battle_wait 1
				set_counter army15_moving 1
			end_if

			if I_CompareCounter army15_reinf_allied = 1
				and I_CompareCounter army15_moving = 0
				and ! I_UnitEnemyUnitInRadius a15u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army1 army15

				set_counter army15_run 1
				set_counter army15_moving 1
			end_if

			if I_CompareCounter army15_reinf_allied = 1
				and I_CompareCounter distance_trigger1 = 0
				and I_UnitDistanceFromUnit a15u1 a1u1 < 1000

				set_counter army15_reinf_late 1
				set_counter distance_trigger1 1
			end_if

			if I_CompareCounter army15_reinf_allied = 1
				and I_CompareCounter distance_trigger2 = 0
				and I_UnitDistanceFromUnit a15u1 a1u1 < 750

				set_counter army15_reinf_late 1
				set_counter distance_trigger2 1
			end_if

			if I_CompareCounter army15_reinf_allied = 1
				and I_CompareCounter distance_trigger3 = 0
				and I_UnitDistanceFromUnit a15u1 a1u1 < 500

				set_counter army15_reinf_late 1
				set_counter distance_trigger3 1
			end_if

			if I_CompareCounter army15_reinf_allied = 1
				and I_CompareCounter distance_trigger4 = 0
				and I_UnitDistanceFromUnit a15u1 a1u1 < 300

				set_counter army15_reinf_late 1
				set_counter distance_trigger4 1
			end_if

			if I_CompareCounter army15_reinf_allied = 1
				and I_CompareCounter distance_trigger5 = 0
				and I_UnitDistanceFromUnit a15u1 a1u1 < 200

				set_counter army15_reinf_late 1
				set_counter distance_trigger5 1
			end_if

			if I_CompareCounter army15_reinf_allied = 1
				and I_CompareCounter army15_reinf_late = 1
				and ! I_UnitEnemyUnitInRadius a15u1 160
				;    and ! I_UnitGroupInRangeOfUnitGroup army1 army15

				set_counter army15_run 1
				battle_wait 0.5
				set_counter army15_moving 1
				set_counter army15_reinf_late 0
			end_if

			if I_CompareCounter army15_reinf_allied = 1
				and I_UnitDistanceFromUnit a15u1 a1u1 < 150
				and I_UnitEnemyUnitInRadius a1u1 100

				set_counter army15_reinf_allied 0
				unit_group_order_halt army15
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army15_reinf_allied = 1
				and I_UnitDistanceFromUnit a15u1 a1u1 < 100

				set_counter army15_reinf_allied 0
				unit_group_order_halt army15
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army15_reinf_allied = 1
				and I_PercentageUnitKilled a15u1 > 60

				set_counter army15_reinf_allied 0
				unit_group_order_halt army15
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army15_reinf_allied = 1
				and I_UnitDistanceFromUnit a15u1 a2u1 < 200
				and I_UnitDistanceFromUnit a1u1 a2u1 < 200

				set_counter army15_reinf_allied 0
				unit_group_order_halt army15
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army15_reinf_allied = 1
				and I_PercentageUnitGroupKilled army15 > 50

				set_counter army15_reinf_allied 0
				unit_group_order_halt army15
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army15_reinf_allied = 1
				and I_UnitDistanceFromUnit a15u1 a1u1 < 250
				and I_UnitGroupInRangeOfUnit army15 a1u1

				set_counter army15_reinf_allied 0
				unit_group_order_halt army15
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army15_reinf_allied = 1
				and I_UnitDistanceFromUnit a1u1 a15u1 < 250
				and I_IsUnitIdle a15u1

				set_counter army15_reinf_allied 0
				unit_group_order_halt army15
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army15_reinf_allied = 1
				and I_IsUnitRouting a1u1

				set_counter army15_reinf_allied 0
				unit_group_order_halt army15
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army15_reinf_allied = 1
				and I_PercentageUnitKilled a1u1 > 80

				set_counter army15_reinf_allied 0
				unit_group_order_halt army15
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army15_reinf_allied = 1
				and I_UnitDistanceFromUnit a1u1 a15u1 < 250
				and I_IsUnitUnderFire a15u1

				set_counter army15_reinf_allied 0
				unit_group_order_halt army15
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army15_reinf_allied = 1
				and I_CompareCounter army15_run = 1

				;    unit_group_order_halt army15
				battle_wait 0.5
				unit_group_move_to_missile_range_of_unit army15 a1u1 run
				battle_wait 0.5
				set_counter army15_run 0
			end_if

		end_if

		;    if I_CompareCounter reinf_check_interval = 2
		;    set_counter reinf_check_interval 0
		;    end_if
		battle_wait 5
	end_monitor

	;;;;;;; Defending

	monitor_conditions I_BattleStarted
		and I_CompareCounter def_alliance_ready = 1
		and I_BattlePlayerArmyIsAttacker

		;    inc_counter reinf_check_interval 1

		if I_CompareCounter army4_reinf_allied = 1

			if I_CompareCounter army4_reinf_allied = 1
				and I_CompareCounter army4_moving = 1
				and I_UnitEnemyUnitInRadius a4u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army2 army4

				unit_group_order_halt army4
				battle_wait 0.5
				set_counter relaunch_movement 1
				set_counter army4_moving 0
			end_if

			if I_CompareCounter army4_reinf_allied = 1
				and I_CompareCounter army4_moving = 1
				and ! I_UnitEnemyUnitInRadius a4u1 160
				and I_UnitDistanceFromUnit a2u1 a4u1 > 150
				and I_IsUnitIdle a4u1

				set_counter army4_reinf_late 1
				battle_wait 1
				set_counter army4_moving 1
			end_if

			if I_CompareCounter army4_reinf_allied = 1
				and I_CompareCounter army4_moving = 0
				and ! I_UnitEnemyUnitInRadius a4u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army2 army4

				set_counter army4_run 1
				set_counter army4_moving 1
			end_if

			if I_CompareCounter army4_reinf_allied = 1
				and I_CompareCounter distance_trigger1 = 0
				and I_UnitDistanceFromUnit a4u1 a2u1 < 1000

				set_counter army4_reinf_late 1
				set_counter distance_trigger1 1
			end_if

			if I_CompareCounter army4_reinf_allied = 1
				and I_CompareCounter distance_trigger2 = 0
				and I_UnitDistanceFromUnit a4u1 a2u1 < 750

				set_counter army4_reinf_late 1
				set_counter distance_trigger2 1
			end_if

			if I_CompareCounter army4_reinf_allied = 1
				and I_CompareCounter distance_trigger3 = 0
				and I_UnitDistanceFromUnit a4u1 a2u1 < 500

				set_counter army4_reinf_late 1
				set_counter distance_trigger3 1
			end_if

			if I_CompareCounter army4_reinf_allied = 1
				and I_CompareCounter distance_trigger4 = 0
				and I_UnitDistanceFromUnit a4u1 a2u1 < 300

				set_counter army4_reinf_late 1
				set_counter distance_trigger4 1
			end_if

			if I_CompareCounter army4_reinf_allied = 1
				and I_CompareCounter distance_trigger5 = 0
				and I_UnitDistanceFromUnit a4u1 a2u1 < 200

				set_counter army4_reinf_late 1
				set_counter distance_trigger5 1
			end_if

			if I_CompareCounter army4_reinf_allied = 1
				and I_CompareCounter army4_reinf_late = 1
				and ! I_UnitEnemyUnitInRadius a4u1 160
				;    and ! I_UnitGroupInRangeOfUnitGroup army2 army4

				set_counter army4_run 1
				battle_wait 0.5
				set_counter army4_moving 1
				set_counter army4_reinf_late 0
			end_if

			if I_CompareCounter army4_reinf_allied = 1
				and I_UnitDistanceFromUnit a4u1 a2u1 < 150
				and I_UnitEnemyUnitInRadius a2u1 100

				set_counter army4_reinf_allied 0
				unit_group_order_halt army4
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army4_reinf_allied = 1
				and I_UnitDistanceFromUnit a4u1 a2u1 < 100

				set_counter army4_reinf_allied 0
				unit_group_order_halt army4
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army4_reinf_allied = 1
				and I_PercentageUnitKilled a4u1 > 60

				set_counter army4_reinf_allied 0
				unit_group_order_halt army4
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army4_reinf_allied = 1
				and I_UnitDistanceFromUnit a4u1 a2u1 < 200
				and I_UnitDistanceFromUnit a2u1 a2u1 < 200

				set_counter army4_reinf_allied 0
				unit_group_order_halt army4
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army4_reinf_allied = 1
				and I_PercentageUnitGroupKilled army4 > 50

				set_counter army4_reinf_allied 0
				unit_group_order_halt army4
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army4_reinf_allied = 1
				and I_UnitDistanceFromUnit a4u1 a2u1 < 250
				and I_UnitGroupInRangeOfUnit army4 a2u1

				set_counter army4_reinf_allied 0
				unit_group_order_halt army4
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army4_reinf_allied = 1
				and I_UnitDistanceFromUnit a2u1 a4u1 < 250
				and I_IsUnitIdle a4u1

				set_counter army4_reinf_allied 0
				unit_group_order_halt army4
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army4_reinf_allied = 1
				and I_IsUnitRouting a2u1

				set_counter army4_reinf_allied 0
				unit_group_order_halt army4
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army4_reinf_allied = 1
				and I_PercentageUnitKilled a2u1 > 80

				set_counter army4_reinf_allied 0
				unit_group_order_halt army4
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army4_reinf_allied = 1
				and I_UnitDistanceFromUnit a2u1 a4u1 < 250
				and I_IsUnitUnderFire a4u1

				set_counter army4_reinf_allied 0
				unit_group_order_halt army4
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army4_reinf_allied = 1
				and I_CompareCounter army4_run = 1

				;    unit_group_order_halt army4
				battle_wait 0.5
				unit_group_move_to_missile_range_of_unit army4 a2u1 run
				battle_wait 0.5
				set_counter army4_run 0
			end_if

		end_if

		if I_CompareCounter army6_reinf_allied = 1

			if I_CompareCounter army6_reinf_allied = 1
				and I_CompareCounter army6_moving = 1
				and I_UnitEnemyUnitInRadius a6u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army2 army6

				unit_group_order_halt army6
				battle_wait 0.5
				set_counter relaunch_movement 1
				set_counter army6_moving 0
			end_if

			if I_CompareCounter army6_reinf_allied = 1
				and I_CompareCounter army6_moving = 1
				and ! I_UnitEnemyUnitInRadius a6u1 160
				and I_UnitDistanceFromUnit a2u1 a6u1 > 150
				and I_IsUnitIdle a6u1

				set_counter army6_reinf_late 1
				battle_wait 1
				set_counter army6_moving 1
			end_if

			if I_CompareCounter army6_reinf_allied = 1
				and I_CompareCounter army6_moving = 0
				and ! I_UnitEnemyUnitInRadius a6u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army2 army6

				set_counter army6_run 1
				set_counter army6_moving 1
			end_if

			if I_CompareCounter army6_reinf_allied = 1
				and I_CompareCounter distance_trigger1 = 0
				and I_UnitDistanceFromUnit a6u1 a2u1 < 1000

				set_counter army6_reinf_late 1
				set_counter distance_trigger1 1
			end_if

			if I_CompareCounter army6_reinf_allied = 1
				and I_CompareCounter distance_trigger2 = 0
				and I_UnitDistanceFromUnit a6u1 a2u1 < 750

				set_counter army6_reinf_late 1
				set_counter distance_trigger2 1
			end_if

			if I_CompareCounter army6_reinf_allied = 1
				and I_CompareCounter distance_trigger3 = 0
				and I_UnitDistanceFromUnit a6u1 a2u1 < 500

				set_counter army6_reinf_late 1
				set_counter distance_trigger3 1
			end_if

			if I_CompareCounter army6_reinf_allied = 1
				and I_CompareCounter distance_trigger4 = 0
				and I_UnitDistanceFromUnit a6u1 a2u1 < 300

				set_counter army6_reinf_late 1
				set_counter distance_trigger4 1
			end_if

			if I_CompareCounter army6_reinf_allied = 1
				and I_CompareCounter distance_trigger5 = 0
				and I_UnitDistanceFromUnit a6u1 a2u1 < 200

				set_counter army6_reinf_late 1
				set_counter distance_trigger5 1
			end_if

			if I_CompareCounter army6_reinf_allied = 1
				and I_CompareCounter army6_reinf_late = 1
				and ! I_UnitEnemyUnitInRadius a6u1 160
				;    and ! I_UnitGroupInRangeOfUnitGroup army2 army6

				set_counter army6_run 1
				battle_wait 0.5
				set_counter army6_moving 1
				set_counter army6_reinf_late 0
			end_if

			if I_CompareCounter army6_reinf_allied = 1
				and I_UnitDistanceFromUnit a6u1 a2u1 < 150
				and I_UnitEnemyUnitInRadius a2u1 100

				set_counter army6_reinf_allied 0
				unit_group_order_halt army6
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army6_reinf_allied = 1
				and I_UnitDistanceFromUnit a6u1 a2u1 < 100

				set_counter army6_reinf_allied 0
				unit_group_order_halt army6
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army6_reinf_allied = 1
				and I_PercentageUnitKilled a6u1 > 60

				set_counter army6_reinf_allied 0
				unit_group_order_halt army6
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army6_reinf_allied = 1
				and I_UnitDistanceFromUnit a6u1 a2u1 < 200
				and I_UnitDistanceFromUnit a2u1 a2u1 < 200

				set_counter army6_reinf_allied 0
				unit_group_order_halt army6
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army6_reinf_allied = 1
				and I_PercentageUnitGroupKilled army6 > 50

				set_counter army6_reinf_allied 0
				unit_group_order_halt army6
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army6_reinf_allied = 1
				and I_UnitDistanceFromUnit a6u1 a2u1 < 250
				and I_UnitGroupInRangeOfUnit army6 a2u1

				set_counter army6_reinf_allied 0
				unit_group_order_halt army6
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army6_reinf_allied = 1
				and I_UnitDistanceFromUnit a2u1 a6u1 < 250
				and I_IsUnitIdle a6u1

				set_counter army6_reinf_allied 0
				unit_group_order_halt army6
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army6_reinf_allied = 1
				and I_IsUnitRouting a2u1

				set_counter army6_reinf_allied 0
				unit_group_order_halt army6
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army6_reinf_allied = 1
				and I_PercentageUnitKilled a2u1 > 80

				set_counter army6_reinf_allied 0
				unit_group_order_halt army6
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army6_reinf_allied = 1
				and I_UnitDistanceFromUnit a2u1 a6u1 < 250
				and I_IsUnitUnderFire a6u1

				set_counter army6_reinf_allied 0
				unit_group_order_halt army6
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army6_reinf_allied = 1
				and I_CompareCounter army6_run = 1

				;    unit_group_order_halt army6
				battle_wait 0.5
				unit_group_move_to_missile_range_of_unit army6 a2u1 run
				battle_wait 0.5
				set_counter army6_run 0
			end_if

		end_if

		if I_CompareCounter army8_reinf_allied = 1

			if I_CompareCounter army8_reinf_allied = 1
				and I_CompareCounter army8_moving = 1
				and I_UnitEnemyUnitInRadius a8u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army2 army8

				unit_group_order_halt army8
				battle_wait 0.5
				set_counter relaunch_movement 1
				set_counter army8_moving 0
			end_if

			if I_CompareCounter army8_reinf_allied = 1
				and I_CompareCounter army8_moving = 1
				and ! I_UnitEnemyUnitInRadius a8u1 160
				and I_UnitDistanceFromUnit a2u1 a8u1 > 150
				and I_IsUnitIdle a8u1

				set_counter army8_reinf_late 1
				battle_wait 1
				set_counter army8_moving 1
			end_if

			if I_CompareCounter army8_reinf_allied = 1
				and I_CompareCounter army8_moving = 0
				and ! I_UnitEnemyUnitInRadius a8u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army2 army8

				set_counter army8_run 1
				set_counter army8_moving 1
			end_if

			if I_CompareCounter army8_reinf_allied = 1
				and I_CompareCounter distance_trigger1 = 0
				and I_UnitDistanceFromUnit a8u1 a2u1 < 1000

				set_counter army8_reinf_late 1
				set_counter distance_trigger1 1
			end_if

			if I_CompareCounter army8_reinf_allied = 1
				and I_CompareCounter distance_trigger2 = 0
				and I_UnitDistanceFromUnit a8u1 a2u1 < 750

				set_counter army8_reinf_late 1
				set_counter distance_trigger2 1
			end_if

			if I_CompareCounter army8_reinf_allied = 1
				and I_CompareCounter distance_trigger3 = 0
				and I_UnitDistanceFromUnit a8u1 a2u1 < 500

				set_counter army8_reinf_late 1
				set_counter distance_trigger3 1
			end_if

			if I_CompareCounter army8_reinf_allied = 1
				and I_CompareCounter distance_trigger4 = 0
				and I_UnitDistanceFromUnit a8u1 a2u1 < 300

				set_counter army8_reinf_late 1
				set_counter distance_trigger4 1
			end_if

			if I_CompareCounter army8_reinf_allied = 1
				and I_CompareCounter distance_trigger5 = 0
				and I_UnitDistanceFromUnit a8u1 a2u1 < 200

				set_counter army8_reinf_late 1
				set_counter distance_trigger5 1
			end_if

			if I_CompareCounter army8_reinf_allied = 1
				and I_CompareCounter army8_reinf_late = 1
				and ! I_UnitEnemyUnitInRadius a8u1 160
				;    and ! I_UnitGroupInRangeOfUnitGroup army2 army8

				set_counter army8_run 1
				battle_wait 0.5
				set_counter army8_moving 1
				set_counter army8_reinf_late 0
			end_if

			if I_CompareCounter army8_reinf_allied = 1
				and I_UnitDistanceFromUnit a8u1 a2u1 < 150
				and I_UnitEnemyUnitInRadius a2u1 100

				set_counter army8_reinf_allied 0
				unit_group_order_halt army8
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army8_reinf_allied = 1
				and I_UnitDistanceFromUnit a8u1 a2u1 < 100

				set_counter army8_reinf_allied 0
				unit_group_order_halt army8
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army8_reinf_allied = 1
				and I_PercentageUnitKilled a8u1 > 60

				set_counter army8_reinf_allied 0
				unit_group_order_halt army8
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army8_reinf_allied = 1
				and I_UnitDistanceFromUnit a8u1 a2u1 < 200
				and I_UnitDistanceFromUnit a2u1 a2u1 < 200

				set_counter army8_reinf_allied 0
				unit_group_order_halt army8
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army8_reinf_allied = 1
				and I_PercentageUnitGroupKilled army8 > 50

				set_counter army8_reinf_allied 0
				unit_group_order_halt army8
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army8_reinf_allied = 1
				and I_UnitDistanceFromUnit a8u1 a2u1 < 250
				and I_UnitGroupInRangeOfUnit army8 a2u1

				set_counter army8_reinf_allied 0
				unit_group_order_halt army8
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army8_reinf_allied = 1
				and I_UnitDistanceFromUnit a2u1 a8u1 < 250
				and I_IsUnitIdle a8u1

				set_counter army8_reinf_allied 0
				unit_group_order_halt army8
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army8_reinf_allied = 1
				and I_IsUnitRouting a2u1

				set_counter army8_reinf_allied 0
				unit_group_order_halt army8
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army8_reinf_allied = 1
				and I_PercentageUnitKilled a2u1 > 80

				set_counter army8_reinf_allied 0
				unit_group_order_halt army8
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army8_reinf_allied = 1
				and I_UnitDistanceFromUnit a2u1 a8u1 < 250
				and I_IsUnitUnderFire a8u1

				set_counter army8_reinf_allied 0
				unit_group_order_halt army8
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army8_reinf_allied = 1
				and I_CompareCounter army8_run = 1

				;    unit_group_order_halt army8
				battle_wait 0.5
				unit_group_move_to_missile_range_of_unit army8 a2u1 run
				battle_wait 0.5
				set_counter army8_run 0
			end_if

		end_if

		if I_CompareCounter army10_reinf_allied = 1

			if I_CompareCounter army10_reinf_allied = 1
				and I_CompareCounter army10_moving = 1
				and I_UnitEnemyUnitInRadius a10u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army2 army10

				unit_group_order_halt army10
				battle_wait 0.5
				set_counter relaunch_movement 1
				set_counter army10_moving 0
			end_if

			if I_CompareCounter army10_reinf_allied = 1
				and I_CompareCounter army10_moving = 1
				and ! I_UnitEnemyUnitInRadius a10u1 160
				and I_UnitDistanceFromUnit a2u1 a10u1 > 150
				and I_IsUnitIdle a10u1

				set_counter army10_reinf_late 1
				battle_wait 1
				set_counter army10_moving 1
			end_if

			if I_CompareCounter army10_reinf_allied = 1
				and I_CompareCounter army10_moving = 0
				and ! I_UnitEnemyUnitInRadius a10u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army2 army10

				set_counter army10_run 1
				set_counter army10_moving 1
			end_if

			if I_CompareCounter army10_reinf_allied = 1
				and I_CompareCounter distance_trigger1 = 0
				and I_UnitDistanceFromUnit a10u1 a2u1 < 1000

				set_counter army10_reinf_late 1
				set_counter distance_trigger1 1
			end_if

			if I_CompareCounter army10_reinf_allied = 1
				and I_CompareCounter distance_trigger2 = 0
				and I_UnitDistanceFromUnit a10u1 a2u1 < 750

				set_counter army10_reinf_late 1
				set_counter distance_trigger2 1
			end_if

			if I_CompareCounter army10_reinf_allied = 1
				and I_CompareCounter distance_trigger3 = 0
				and I_UnitDistanceFromUnit a10u1 a2u1 < 500

				set_counter army10_reinf_late 1
				set_counter distance_trigger3 1
			end_if

			if I_CompareCounter army10_reinf_allied = 1
				and I_CompareCounter distance_trigger4 = 0
				and I_UnitDistanceFromUnit a10u1 a2u1 < 300

				set_counter army10_reinf_late 1
				set_counter distance_trigger4 1
			end_if

			if I_CompareCounter army10_reinf_allied = 1
				and I_CompareCounter distance_trigger5 = 0
				and I_UnitDistanceFromUnit a10u1 a2u1 < 200

				set_counter army10_reinf_late 1
				set_counter distance_trigger5 1
			end_if

			if I_CompareCounter army10_reinf_allied = 1
				and I_CompareCounter army10_reinf_late = 1
				and ! I_UnitEnemyUnitInRadius a10u1 160
				;    and ! I_UnitGroupInRangeOfUnitGroup army2 army10

				set_counter army10_run 1
				battle_wait 0.5
				set_counter army10_moving 1
				set_counter army10_reinf_late 0
			end_if

			if I_CompareCounter army10_reinf_allied = 1
				and I_UnitDistanceFromUnit a10u1 a2u1 < 150
				and I_UnitEnemyUnitInRadius a2u1 100

				set_counter army10_reinf_allied 0
				unit_group_order_halt army10
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army10_reinf_allied = 1
				and I_UnitDistanceFromUnit a10u1 a2u1 < 100

				set_counter army10_reinf_allied 0
				unit_group_order_halt army10
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army10_reinf_allied = 1
				and I_PercentageUnitKilled a10u1 > 60

				set_counter army10_reinf_allied 0
				unit_group_order_halt army10
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army10_reinf_allied = 1
				and I_UnitDistanceFromUnit a10u1 a2u1 < 200
				and I_UnitDistanceFromUnit a2u1 a2u1 < 200

				set_counter army10_reinf_allied 0
				unit_group_order_halt army10
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army10_reinf_allied = 1
				and I_PercentageUnitGroupKilled army10 > 50

				set_counter army10_reinf_allied 0
				unit_group_order_halt army10
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army10_reinf_allied = 1
				and I_UnitDistanceFromUnit a10u1 a2u1 < 250
				and I_UnitGroupInRangeOfUnit army10 a2u1

				set_counter army10_reinf_allied 0
				unit_group_order_halt army10
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army10_reinf_allied = 1
				and I_UnitDistanceFromUnit a2u1 a10u1 < 250
				and I_IsUnitIdle a10u1

				set_counter army10_reinf_allied 0
				unit_group_order_halt army10
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army10_reinf_allied = 1
				and I_IsUnitRouting a2u1

				set_counter army10_reinf_allied 0
				unit_group_order_halt army10
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army10_reinf_allied = 1
				and I_PercentageUnitKilled a2u1 > 80

				set_counter army10_reinf_allied 0
				unit_group_order_halt army10
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army10_reinf_allied = 1
				and I_UnitDistanceFromUnit a2u1 a10u1 < 250
				and I_IsUnitUnderFire a10u1

				set_counter army10_reinf_allied 0
				unit_group_order_halt army10
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army10_reinf_allied = 1
				and I_CompareCounter army10_run = 1

				;    unit_group_order_halt army10
				battle_wait 0.5
				unit_group_move_to_missile_range_of_unit army10 a2u1 run
				battle_wait 0.5
				set_counter army10_run 0
			end_if

		end_if

		if I_CompareCounter army12_reinf_allied = 1

			if I_CompareCounter army12_reinf_allied = 1
				and I_CompareCounter army12_moving = 1
				and I_UnitEnemyUnitInRadius a12u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army2 army12

				unit_group_order_halt army12
				battle_wait 0.5
				set_counter relaunch_movement 1
				set_counter army12_moving 0
			end_if

			if I_CompareCounter army12_reinf_allied = 1
				and I_CompareCounter army12_moving = 1
				and ! I_UnitEnemyUnitInRadius a12u1 160
				and I_UnitDistanceFromUnit a2u1 a12u1 > 150
				and I_IsUnitIdle a12u1

				set_counter army12_reinf_late 1
				battle_wait 1
				set_counter army12_moving 1
			end_if

			if I_CompareCounter army12_reinf_allied = 1
				and I_CompareCounter army12_moving = 0
				and ! I_UnitEnemyUnitInRadius a12u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army2 army12

				set_counter army12_run 1
				set_counter army12_moving 1
			end_if

			if I_CompareCounter army12_reinf_allied = 1
				and I_CompareCounter distance_trigger1 = 0
				and I_UnitDistanceFromUnit a12u1 a2u1 < 1000

				set_counter army12_reinf_late 1
				set_counter distance_trigger1 1
			end_if

			if I_CompareCounter army12_reinf_allied = 1
				and I_CompareCounter distance_trigger2 = 0
				and I_UnitDistanceFromUnit a12u1 a2u1 < 750

				set_counter army12_reinf_late 1
				set_counter distance_trigger2 1
			end_if

			if I_CompareCounter army12_reinf_allied = 1
				and I_CompareCounter distance_trigger3 = 0
				and I_UnitDistanceFromUnit a12u1 a2u1 < 500

				set_counter army12_reinf_late 1
				set_counter distance_trigger3 1
			end_if

			if I_CompareCounter army12_reinf_allied = 1
				and I_CompareCounter distance_trigger4 = 0
				and I_UnitDistanceFromUnit a12u1 a2u1 < 300

				set_counter army12_reinf_late 1
				set_counter distance_trigger4 1
			end_if

			if I_CompareCounter army12_reinf_allied = 1
				and I_CompareCounter distance_trigger5 = 0
				and I_UnitDistanceFromUnit a12u1 a2u1 < 200

				set_counter army12_reinf_late 1
				set_counter distance_trigger5 1
			end_if

			if I_CompareCounter army12_reinf_allied = 1
				and I_CompareCounter army12_reinf_late = 1
				and ! I_UnitEnemyUnitInRadius a12u1 160
				;    and ! I_UnitGroupInRangeOfUnitGroup army2 army12

				set_counter army12_run 1
				battle_wait 0.5
				set_counter army12_moving 1
				set_counter army12_reinf_late 0
			end_if

			if I_CompareCounter army12_reinf_allied = 1
				and I_UnitDistanceFromUnit a12u1 a2u1 < 150
				and I_UnitEnemyUnitInRadius a2u1 100

				set_counter army12_reinf_allied 0
				unit_group_order_halt army12
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army12_reinf_allied = 1
				and I_UnitDistanceFromUnit a12u1 a2u1 < 100

				set_counter army12_reinf_allied 0
				unit_group_order_halt army12
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army12_reinf_allied = 1
				and I_PercentageUnitKilled a12u1 > 60

				set_counter army12_reinf_allied 0
				unit_group_order_halt army12
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army12_reinf_allied = 1
				and I_UnitDistanceFromUnit a12u1 a2u1 < 200
				and I_UnitDistanceFromUnit a2u1 a2u1 < 200

				set_counter army12_reinf_allied 0
				unit_group_order_halt army12
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army12_reinf_allied = 1
				and I_PercentageUnitGroupKilled army12 > 50

				set_counter army12_reinf_allied 0
				unit_group_order_halt army12
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army12_reinf_allied = 1
				and I_UnitDistanceFromUnit a12u1 a2u1 < 250
				and I_UnitGroupInRangeOfUnit army12 a2u1

				set_counter army12_reinf_allied 0
				unit_group_order_halt army12
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army12_reinf_allied = 1
				and I_UnitDistanceFromUnit a2u1 a12u1 < 250
				and I_IsUnitIdle a12u1

				set_counter army12_reinf_allied 0
				unit_group_order_halt army12
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army12_reinf_allied = 1
				and I_IsUnitRouting a2u1

				set_counter army12_reinf_allied 0
				unit_group_order_halt army12
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army12_reinf_allied = 1
				and I_PercentageUnitKilled a2u1 > 80

				set_counter army12_reinf_allied 0
				unit_group_order_halt army12
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army12_reinf_allied = 1
				and I_UnitDistanceFromUnit a2u1 a12u1 < 250
				and I_IsUnitUnderFire a12u1

				set_counter army12_reinf_allied 0
				unit_group_order_halt army12
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army12_reinf_allied = 1
				and I_CompareCounter army12_run = 1

				;    unit_group_order_halt army12
				battle_wait 0.5
				unit_group_move_to_missile_range_of_unit army12 a2u1 run
				battle_wait 0.5
				set_counter army12_run 0
			end_if

		end_if

		if I_CompareCounter army14_reinf_allied = 1

			if I_CompareCounter army14_reinf_allied = 1
				and I_CompareCounter army14_moving = 1
				and I_UnitEnemyUnitInRadius a14u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army2 army14

				unit_group_order_halt army14
				battle_wait 0.5
				set_counter relaunch_movement 1
				set_counter army14_moving 0
			end_if

			if I_CompareCounter army14_reinf_allied = 1
				and I_CompareCounter army14_moving = 1
				and ! I_UnitEnemyUnitInRadius a14u1 160
				and I_UnitDistanceFromUnit a2u1 a14u1 > 150
				and I_IsUnitIdle a14u1

				set_counter army14_reinf_late 1
				battle_wait 1
				set_counter army14_moving 1
			end_if

			if I_CompareCounter army14_reinf_allied = 1
				and I_CompareCounter army14_moving = 0
				and ! I_UnitEnemyUnitInRadius a14u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army2 army14

				set_counter army14_run 1
				set_counter army14_moving 1
			end_if

			if I_CompareCounter army14_reinf_allied = 1
				and I_CompareCounter distance_trigger1 = 0
				and I_UnitDistanceFromUnit a14u1 a2u1 < 1000

				set_counter army14_reinf_late 1
				set_counter distance_trigger1 1
			end_if

			if I_CompareCounter army14_reinf_allied = 1
				and I_CompareCounter distance_trigger2 = 0
				and I_UnitDistanceFromUnit a14u1 a2u1 < 750

				set_counter army14_reinf_late 1
				set_counter distance_trigger2 1
			end_if

			if I_CompareCounter army14_reinf_allied = 1
				and I_CompareCounter distance_trigger3 = 0
				and I_UnitDistanceFromUnit a14u1 a2u1 < 500

				set_counter army14_reinf_late 1
				set_counter distance_trigger3 1
			end_if

			if I_CompareCounter army14_reinf_allied = 1
				and I_CompareCounter distance_trigger4 = 0
				and I_UnitDistanceFromUnit a14u1 a2u1 < 300

				set_counter army14_reinf_late 1
				set_counter distance_trigger4 1
			end_if

			if I_CompareCounter army14_reinf_allied = 1
				and I_CompareCounter distance_trigger5 = 0
				and I_UnitDistanceFromUnit a14u1 a2u1 < 200

				set_counter army14_reinf_late 1
				set_counter distance_trigger5 1
			end_if

			if I_CompareCounter army14_reinf_allied = 1
				and I_CompareCounter army14_reinf_late = 1
				and ! I_UnitEnemyUnitInRadius a14u1 160
				;    and ! I_UnitGroupInRangeOfUnitGroup army2 army14

				set_counter army14_run 1
				battle_wait 0.5
				set_counter army14_moving 1
				set_counter army14_reinf_late 0
			end_if

			if I_CompareCounter army14_reinf_allied = 1
				and I_UnitDistanceFromUnit a14u1 a2u1 < 150
				and I_UnitEnemyUnitInRadius a2u1 100

				set_counter army14_reinf_allied 0
				unit_group_order_halt army14
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army14_reinf_allied = 1
				and I_UnitDistanceFromUnit a14u1 a2u1 < 100

				set_counter army14_reinf_allied 0
				unit_group_order_halt army14
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army14_reinf_allied = 1
				and I_PercentageUnitKilled a14u1 > 60

				set_counter army14_reinf_allied 0
				unit_group_order_halt army14
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army14_reinf_allied = 1
				and I_UnitDistanceFromUnit a14u1 a2u1 < 200
				and I_UnitDistanceFromUnit a2u1 a2u1 < 200

				set_counter army14_reinf_allied 0
				unit_group_order_halt army14
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army14_reinf_allied = 1
				and I_PercentageUnitGroupKilled army14 > 50

				set_counter army14_reinf_allied 0
				unit_group_order_halt army14
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army14_reinf_allied = 1
				and I_UnitDistanceFromUnit a14u1 a2u1 < 250
				and I_UnitGroupInRangeOfUnit army14 a2u1

				set_counter army14_reinf_allied 0
				unit_group_order_halt army14
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army14_reinf_allied = 1
				and I_UnitDistanceFromUnit a2u1 a14u1 < 250
				and I_IsUnitIdle a14u1

				set_counter army14_reinf_allied 0
				unit_group_order_halt army14
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army14_reinf_allied = 1
				and I_IsUnitRouting a2u1

				set_counter army14_reinf_allied 0
				unit_group_order_halt army14
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army14_reinf_allied = 1
				and I_PercentageUnitKilled a2u1 > 80

				set_counter army14_reinf_allied 0
				unit_group_order_halt army14
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army14_reinf_allied = 1
				and I_UnitDistanceFromUnit a2u1 a14u1 < 250
				and I_IsUnitUnderFire a14u1

				set_counter army14_reinf_allied 0
				unit_group_order_halt army14
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army14_reinf_allied = 1
				and I_CompareCounter army14_run = 1

				;    unit_group_order_halt army14
				battle_wait 0.5
				unit_group_move_to_missile_range_of_unit army14 a2u1 run
				battle_wait 0.5
				set_counter army14_run 0
			end_if

		end_if

		if I_CompareCounter army16_reinf_allied = 1

			if I_CompareCounter army16_reinf_allied = 1
				and I_CompareCounter army16_moving = 1
				and I_UnitEnemyUnitInRadius a16u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army2 army16

				unit_group_order_halt army16
				battle_wait 0.5
				set_counter relaunch_movement 1
				set_counter army16_moving 0
			end_if

			if I_CompareCounter army16_reinf_allied = 1
				and I_CompareCounter army16_moving = 1
				and ! I_UnitEnemyUnitInRadius a16u1 160
				and I_UnitDistanceFromUnit a2u1 a16u1 > 150
				and I_IsUnitIdle a16u1

				set_counter army16_reinf_late 1
				battle_wait 1
				set_counter army16_moving 1
			end_if

			if I_CompareCounter army16_reinf_allied = 1
				and I_CompareCounter army16_moving = 0
				and ! I_UnitEnemyUnitInRadius a16u1 160
				and ! I_UnitGroupInRangeOfUnitGroup army2 army16

				set_counter army16_run 1
				set_counter army16_moving 1
			end_if

			if I_CompareCounter army16_reinf_allied = 1
				and I_CompareCounter distance_trigger1 = 0
				and I_UnitDistanceFromUnit a16u1 a2u1 < 1000

				set_counter army16_reinf_late 1
				set_counter distance_trigger1 1
			end_if

			if I_CompareCounter army16_reinf_allied = 1
				and I_CompareCounter distance_trigger2 = 0
				and I_UnitDistanceFromUnit a16u1 a2u1 < 750

				set_counter army16_reinf_late 1
				set_counter distance_trigger2 1
			end_if

			if I_CompareCounter army16_reinf_allied = 1
				and I_CompareCounter distance_trigger3 = 0
				and I_UnitDistanceFromUnit a16u1 a2u1 < 500

				set_counter army16_reinf_late 1
				set_counter distance_trigger3 1
			end_if

			if I_CompareCounter army16_reinf_allied = 1
				and I_CompareCounter distance_trigger4 = 0
				and I_UnitDistanceFromUnit a16u1 a2u1 < 300

				set_counter army16_reinf_late 1
				set_counter distance_trigger4 1
			end_if

			if I_CompareCounter army16_reinf_allied = 1
				and I_CompareCounter distance_trigger5 = 0
				and I_UnitDistanceFromUnit a16u1 a2u1 < 200

				set_counter army16_reinf_late 1
				set_counter distance_trigger5 1
			end_if

			if I_CompareCounter army16_reinf_allied = 1
				and I_CompareCounter army16_reinf_late = 1
				and ! I_UnitEnemyUnitInRadius a16u1 160
				;    and ! I_UnitGroupInRangeOfUnitGroup army2 army16

				set_counter army16_run 1
				battle_wait 0.5
				set_counter army16_moving 1
				set_counter army16_reinf_late 0
			end_if

			if I_CompareCounter army16_reinf_allied = 1
				and I_UnitDistanceFromUnit a16u1 a2u1 < 150
				and I_UnitEnemyUnitInRadius a2u1 100

				set_counter army16_reinf_allied 0
				unit_group_order_halt army16
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army16_reinf_allied = 1
				and I_UnitDistanceFromUnit a16u1 a2u1 < 100

				set_counter army16_reinf_allied 0
				unit_group_order_halt army16
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army16_reinf_allied = 1
				and I_PercentageUnitKilled a16u1 > 60

				set_counter army16_reinf_allied 0
				unit_group_order_halt army16
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army16_reinf_allied = 1
				and I_UnitDistanceFromUnit a16u1 a2u1 < 200
				and I_UnitDistanceFromUnit a2u1 a2u1 < 200

				set_counter army16_reinf_allied 0
				unit_group_order_halt army16
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army16_reinf_allied = 1
				and I_PercentageUnitGroupKilled army16 > 50

				set_counter army16_reinf_allied 0
				unit_group_order_halt army16
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army16_reinf_allied = 1
				and I_UnitDistanceFromUnit a16u1 a2u1 < 250
				and I_UnitGroupInRangeOfUnit army16 a2u1

				set_counter army16_reinf_allied 0
				unit_group_order_halt army16
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army16_reinf_allied = 1
				and I_UnitDistanceFromUnit a2u1 a16u1 < 250
				and I_IsUnitIdle a16u1

				set_counter army16_reinf_allied 0
				unit_group_order_halt army16
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army16_reinf_allied = 1
				and I_IsUnitRouting a2u1

				set_counter army16_reinf_allied 0
				unit_group_order_halt army16
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army16_reinf_allied = 1
				and I_PercentageUnitKilled a2u1 > 80

				set_counter army16_reinf_allied 0
				unit_group_order_halt army16
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army16_reinf_allied = 1
				and I_UnitDistanceFromUnit a2u1 a16u1 < 250
				and I_IsUnitUnderFire a16u1

				set_counter army16_reinf_allied 0
				unit_group_order_halt army16
				battle_wait 0.5
				set_counter relaunch_movement 1
			end_if

			if I_CompareCounter army16_reinf_allied = 1
				and I_CompareCounter army16_run = 1

				;    unit_group_order_halt army16
				battle_wait 0.5
				unit_group_move_to_missile_range_of_unit army16 a2u1 run
				battle_wait 0.5
				set_counter army16_run 0
			end_if

		end_if

		;    if I_CompareCounter reinf_check_interval = 2
		;    set_counter reinf_check_interval 0
		;    end_if
		battle_wait 5
	end_monitor

	;;;;;;; Defending Siege

	monitor_conditions I_BattleStarted
		and I_CompareCounter def_alliance_ready_siege = 1
		and I_BattlePlayerArmyIsAttacker
		and I_CompareCounter army4_ready_siege = 1

		;    inc_counter reinf_check_interval 1

		if I_CompareCounter army4_ready_siege = 1
			and I_CompareCounter army4_moving_siege = 1
			and I_UnitEnemyUnitInRadius a4u1 160

			unit_group_order_halt army4
			battle_wait 0.5
			ai_active_set on
			set_counter army4_moving_siege 0
		end_if

		if I_CompareCounter army4_ready_siege = 1
			and I_CompareCounter army4_moving_siege = 1
			and ! I_UnitEnemyUnitInRadius a4u1 160
			and I_UnitDistanceFromUnit a2u1 a4u1 > 150
			and I_IsUnitIdle a4u1

			set_counter army4_run_siege 1
			battle_wait 2
			set_counter army4_moving_siege 1
		end_if

		if I_CompareCounter army4_ready_siege = 1
			and I_CompareCounter army4_moving_siege = 0
			and ! I_UnitEnemyUnitInRadius a4u1 160
			and ! I_UnitGroupInRangeOfUnitGroup army2 army4

			set_counter army4_run_siege 1
			set_counter army4_moving_siege 1
		end_if

		if I_CompareCounter army4_ready_siege = 1
			and I_UnitDistanceFromUnit a4u1 a2u1 < 200

			set_counter army4_ready_siege 0
			unit_group_order_halt army4
			battle_wait 0.5
			ai_active_set on
		end_if

		if I_CompareCounter army4_ready_siege = 1
			and I_UnitDistanceFromPosition a4u1 1 1 < 150

			set_counter army4_ready_siege 0
			unit_group_order_halt army4
			battle_wait 0.5
			ai_active_set on
		end_if

		if I_CompareCounter army4_ready_siege = 1
			and I_UnitDistanceFromUnit a2u1 a4u1 < 250
			and I_IsUnitIdle a4u1

			set_counter army4_ready_siege 0
			unit_group_order_halt army4
			battle_wait 0.5
			ai_active_set on
		end_if

		if I_CompareCounter army4_ready_siege = 1
			and I_UnitDistanceFromUnit a2u1 a4u1 < 250
			and I_IsUnitUnderFire a4u1

			set_counter army4_ready_siege 0
			unit_group_order_halt army4
			battle_wait 0.5
			ai_active_set on
		end_if

		if I_CompareCounter army4_ready_siege = 1
			and I_PercentageUnitGroupKilled army4 > 50

			set_counter army4_ready_siege 0
			unit_group_order_halt army4
			battle_wait 0.5
			ai_active_set on
		end_if

		if I_CompareCounter army4_ready_siege = 1
			and I_CompareCounter army4_run_siege = 1

			unit_group_order_halt army4
			battle_wait 0.5
			unit_group_order_move_formed army4 1 1 run
			set_counter army4_run_siege 0
		end_if

		;    if I_CompareCounter reinf_check_interval = 2
		;    set_counter reinf_check_interval 0
		;    end_if
		battle_wait 5
	end_monitor

	;;;;;;;;;;;Sally-out, AI defending

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter army4_ready_sally = 1

		if I_UnitDistanceFromPosition a4u1 0 850 < 200
			set_counter army4_location 1 ;north
		end_if
		if I_UnitDistanceFromPosition a4u1 0 -850 < 200
			set_counter army4_location 2 ;south
		end_if
		if I_UnitDistanceFromPosition a4u1 -850 0 < 200
			set_counter army4_location 3 ;west
		end_if
		if I_UnitDistanceFromPosition a4u1 850 0 < 200
			set_counter army4_location 4 ;east
		end_if
		if I_UnitDistanceFromPosition a4u1 -850 850 < 200
			set_counter army4_location 5 ;nw
		end_if
		if I_UnitDistanceFromPosition a4u1 850 850 < 200
			set_counter army4_location 6 ;ne
		end_if
		if I_UnitDistanceFromPosition a4u1 -850 850 < 200
			set_counter army4_location 7 ;sw
		end_if
		if I_UnitDistanceFromPosition a4u1 850 -850 < 200
			set_counter army4_location 8 ;se
		end_if

		if I_CompareCounter army4_location = 1
			and I_CompareCounter army_west = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_n 1
				set_counter	path_w 2
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_n 1
				set_counter	path_nw 2
				set_counter	path_w 3
			end_if
		end_if
		if I_CompareCounter army4_location = 1
			and I_CompareCounter army_south = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_n 1
				set_counter	path_w 2
				set_counter	path_s 3
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_n 1
				set_counter	path_nw 2
				set_counter	path_w 3
				set_counter	path_sw 4
				set_counter	path_s 5
			end_if
		end_if
		if I_CompareCounter army4_location = 1
			and I_CompareCounter army_east = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_n 1
				set_counter	path_e 2
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_n 1
				set_counter	path_ne 2
				set_counter	path_e 3
			end_if
		end_if
		if I_CompareCounter army4_location = 2
			and I_CompareCounter army_west = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_s 1
				set_counter	path_w 2
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_s 1
				set_counter	path_sw 2
				set_counter	path_w 3
			end_if
		end_if
		if I_CompareCounter army4_location = 2
			and I_CompareCounter army_north = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_s 1
				set_counter	path_w 2
				set_counter	path_n 3
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_s 1
				set_counter	path_sw 2
				set_counter	path_w 3
				set_counter	path_nw 4
				set_counter	path_n 5
			end_if
		end_if

		if I_CompareCounter army4_location = 2
			and I_CompareCounter army_east = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_s 1
				set_counter	path_e 2
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_s 1
				set_counter	path_se 2
				set_counter	path_e 3
			end_if
		end_if
		if I_CompareCounter army4_location = 3
			and I_CompareCounter army_north = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_w 1
				set_counter	path_n 2
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_w 1
				set_counter	path_nw 2
				set_counter	path_n 3
			end_if
		end_if
		if I_CompareCounter army4_location = 3
			and I_CompareCounter army_east = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_w 1
				set_counter	path_n 2
				set_counter	path_e 3
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_w 1
				set_counter	path_nw 2
				set_counter	path_n 3
				set_counter	path_ne 4
				set_counter	path_e 5
			end_if
		end_if
		if I_CompareCounter army4_location = 3
			and I_CompareCounter army_south = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_w 1
				set_counter	path_s 2
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_w 1
				set_counter	path_sw 2
				set_counter	path_s 3
			end_if
		end_if

		if I_CompareCounter army4_location = 4
			and I_CompareCounter army_south = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_e 1
				set_counter	path_s 2
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_e 1
				set_counter	path_se 2
				set_counter	path_s 3
			end_if
		end_if
		if I_CompareCounter army4_location = 4
			and I_CompareCounter army_west = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_e 1
				set_counter	path_s 2
				set_counter	path_w 3
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_e 1
				set_counter	path_se 2
				set_counter	path_s 3
				set_counter	path_sw 4
				set_counter	path_w 5
			end_if
		end_if
		if I_CompareCounter army4_location = 4
			and I_CompareCounter army_north = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_e 1
				set_counter	path_n 2
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_e 1
				set_counter	path_ne 2
				set_counter	path_n 3
			end_if
		end_if

		if I_CompareCounter army4_location = 5 ;nw
			and I_CompareCounter army_north = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_n 1
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_n 1
			end_if
		end_if

		if I_CompareCounter army4_location = 5
			and I_CompareCounter army_west = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_w 1
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_w 1
			end_if
		end_if
		if I_CompareCounter army4_location = 5
			and I_CompareCounter army_south = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_w 1
				set_counter	path_s 2
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_w 1
				set_counter	path_sw 2
				set_counter	path_s 3
			end_if
		end_if
		if I_CompareCounter army4_location = 5
			and I_CompareCounter army_east = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_n 1
				set_counter	path_e 2
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_n 1
				set_counter	path_ne 2
				set_counter	path_e 3
			end_if
		end_if

		if I_CompareCounter army4_location = 6 ;ne
			and I_CompareCounter army_west = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_n 1
				set_counter	path_w 2
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_n 1
				set_counter	path_nw 2
				set_counter	path_w 3
			end_if
		end_if
		if I_CompareCounter army4_location = 6
			and I_CompareCounter army_north = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_n 1
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_n 1
			end_if
		end_if

		if I_CompareCounter army4_location = 6
			and I_CompareCounter army_east = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_e 1
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_e 1
			end_if
		end_if
		if I_CompareCounter army4_location = 6
			and I_CompareCounter army_south = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_e 1
				set_counter	path_s 2
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_e 1
				set_counter	path_se 2
				set_counter	path_s 3
			end_if
		end_if
		if I_CompareCounter army4_location = 7 ;sw
			and I_CompareCounter army_north = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_w 1
				set_counter	path_n 2
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_w 1
				set_counter	path_nw 2
				set_counter	path_n 3
			end_if
		end_if
		if I_CompareCounter army4_location = 7
			and I_CompareCounter army_east = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_s 1
				set_counter	path_e 2
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_s 1
				set_counter	path_se 2
				set_counter	path_e 3
			end_if
		end_if
		if I_CompareCounter army4_location = 7
			and I_CompareCounter army_south = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_s 1
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_s 1
			end_if
		end_if
		if I_CompareCounter army4_location = 7
			and I_CompareCounter army_west = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_w 1
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_w 1
			end_if
		end_if

		if I_CompareCounter army4_location = 8 ;se
			and I_CompareCounter army_south = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_s 1
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_s 1
			end_if
		end_if
		if I_CompareCounter army4_location = 8
			and I_CompareCounter army_west = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_s 1
				set_counter	path_w 2
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_s 1
				set_counter	path_sw 2
				set_counter	path_w 3
			end_if
		end_if
		if I_CompareCounter army4_location = 8
			and I_CompareCounter army_north = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_e 1
				set_counter	path_n 2
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_e 1
				set_counter	path_ne 2
				set_counter	path_n 3
			end_if
		end_if
		if I_CompareCounter army4_location = 8
			and I_CompareCounter army_east = 1
			if I_BattleSettlementFortificationLevel < 2
				set_counter	path_e 1
			end_if
			if I_BattleSettlementFortificationLevel > 1
				set_counter	path_e 1
			end_if
		end_if

		if I_CompareCounter army4_location = 1
			and I_CompareCounter army_north = 1
			set_counter	army4_ready_sally 3
			set_counter	army4_ready 0
		end_if
		if I_CompareCounter army4_location = 2
			and I_CompareCounter army_south = 1
			set_counter	army4_ready_sally 3
			set_counter	army4_ready 0
		end_if
		if I_CompareCounter army4_location = 3
			and I_CompareCounter army_west = 1
			set_counter	army4_ready_sally 3
			set_counter	army4_ready 0
		end_if

		if I_CompareCounter army4_location = 4
			and I_CompareCounter army_east = 1
			set_counter	army4_ready_sally 3
			set_counter	army4_ready 0
		end_if
		if I_CompareCounter army4_ready_sally = 1
			unit_group_order_halt army4
			battle_wait 0.5
			unit_group_order_change_group_formation army4 ai_infantry_protecting
			;	battle_wait 45
			battle_wait 20
			if I_CompareCounter army4_ready_sally = 1
				and I_BattleIsSallyOutBattle
				battle_wait 25
			end_if
			if I_CompareCounter army4_ready_sally = 1
				and I_BattleIsSallyOutBattle
				set_counter army4_ready_sally 2
			end_if
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter label_army4 = 1

		label_unit 1 1 0 a4u1
		label_unit 1 1 1 a4u2
		label_unit 1 1 2 a4u3
		label_unit 1 1 3 a4u4
		label_unit 1 1 4 a4u5
		label_unit 1 1 5 a4u6
		label_unit 1 1 6 a4u7
		label_unit 1 1 7 a4u8
		label_unit 1 1 8 a4u9
		label_unit 1 1 9 a4u10
		label_unit 1 1 10 a4u11
		label_unit 1 1 11 a4u12
		label_unit 1 1 12 a4u13
		label_unit 1 1 13 a4u14
		label_unit 1 1 14 a4u15
		label_unit 1 1 15 a4u16
		label_unit 1 1 16 a4u17
		label_unit 1 1 17 a4u18
		label_unit 1 1 18 a4u19
		label_unit 1 1 19 a4u20

		;    unit_group_order_halt army4
		set_counter label_army4 0
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter army4_ready_sally = 2
		and I_CompareCounter army4_moving_s = 1
		and I_UnitEnemyUnitInRadius a4u1 130
		and ! I_UnitGroupInRangeOfUnitGroup army2 army4

		unit_group_order_halt army4
		;    ai_active_set off
		battle_wait 0.5
		ai_active_set on

		set_counter army4_moving_s 0
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter army4_ready_sally = 2
		and I_CompareCounter path_n = 1
		and ! I_UnitEnemyUnitInRadius a4u1 130

		if I_UnitGroupDistanceFromPosition army4 0 700 > 100
			and I_BattleSettlementFortificationLevel > 2
			set_counter label_army4 1
			battle_wait 0.5
			unit_group_order_move_formed army4 0 700 run
			set_counter army4_moving_s 1
		end_if

		if I_UnitGroupDistanceFromPosition army4 0 500 > 100
			and I_BattleSettlementFortificationLevel < 3
			set_counter label_army4 1
			battle_wait 0.5
			unit_group_order_move_formed army4 0 500 run
			set_counter army4_moving_s 1
		end_if

		if I_UnitGroupDistanceFromPosition army4 0 700 < 100
			and I_BattleSettlementFortificationLevel > 2
			unit_group_order_halt army4
			battle_wait 0.5
			if I_UnitGroupDistanceFromPosition army4 0 700 < 100
				set_counter path_n 0
				if I_CompareCounter path_nw > 1
					set_counter path_nw 1
				end_if
				if I_CompareCounter path_ne > 1
					set_counter path_ne 1
				end_if
				if I_CompareCounter path_nw = 0
					and I_CompareCounter path_ne = 0
					set_counter army4_ready_sally 3
					set_counter army4_ready 0
				end_if
			end_if
		end_if

		if I_UnitGroupDistanceFromPosition army4 0 500 < 100
			and I_BattleSettlementFortificationLevel < 3
			unit_group_order_halt army4
			battle_wait 0.5
			if I_UnitGroupDistanceFromPosition army4 0 500 < 100
				set_counter path_n 0
				if I_CompareCounter path_w > 1
					set_counter path_w 1
				end_if
				if I_CompareCounter path_e > 1
					set_counter path_e 1
				end_if
				if I_CompareCounter path_w = 0
					and I_CompareCounter path_e = 0
					set_counter army4_ready_sally 3
					set_counter army4_ready 0
				end_if
			end_if
		end_if

		battle_wait 30
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter army4_ready_sally = 2
		and I_CompareCounter path_s = 1
		and ! I_UnitEnemyUnitInRadius a4u1 130

		if I_UnitGroupDistanceFromPosition army4 0 -700 > 100
			and I_BattleSettlementFortificationLevel > 2
			set_counter label_army4 1
			battle_wait 0.5
			unit_group_order_move_formed army4 0 -700 run
			set_counter army4_moving_s 1
		end_if

		if I_UnitGroupDistanceFromPosition army4 0 -500 > 100
			and I_BattleSettlementFortificationLevel < 3
			set_counter label_army4 1
			battle_wait 0.5
			unit_group_order_move_formed army4 0 -500 run
			set_counter army4_moving_s 1
		end_if

		if I_UnitGroupDistanceFromPosition army4 0 -700 < 100
			and I_BattleSettlementFortificationLevel > 2
			unit_group_order_halt army4
			battle_wait 0.5
			if I_UnitGroupDistanceFromPosition army4 0 -700 < 100
				set_counter path_s 0
				if I_CompareCounter path_sw > 1
					set_counter path_sw 1
				end_if
				if I_CompareCounter path_se > 1
					set_counter path_se 1
				end_if
				if I_CompareCounter path_sw = 0
					and I_CompareCounter path_se = 0
					set_counter army4_ready_sally 3
					set_counter army4_ready 0
				end_if
			end_if
		end_if

		if I_UnitGroupDistanceFromPosition army4 0 -500 < 100
			and I_BattleSettlementFortificationLevel < 3
			unit_group_order_halt army4
			battle_wait 0.5
			if I_UnitGroupDistanceFromPosition army4 0 -500 < 100
				set_counter path_s 0
				if I_CompareCounter path_w > 1
					set_counter path_w 1
				end_if
				if I_CompareCounter path_e > 1
					set_counter path_e 1
				end_if
				if I_CompareCounter path_w = 0
					and I_CompareCounter path_e = 0
					set_counter army4_ready_sally 3
					set_counter army4_ready 0
				end_if
			end_if
		end_if

		battle_wait 20
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter army4_ready_sally = 2
		and I_CompareCounter path_w = 1
		and ! I_UnitEnemyUnitInRadius a4u1 130

		if I_UnitGroupDistanceFromPosition army4 -700 0 > 100
			and I_BattleSettlementFortificationLevel > 2
			set_counter label_army4 1
			battle_wait 0.5
			unit_group_order_move_formed army4 -700 0 run
			set_counter army4_moving_s 1
		end_if

		if I_UnitGroupDistanceFromPosition army4 -500 0 > 100
			and I_BattleSettlementFortificationLevel < 3
			set_counter label_army4 1
			battle_wait 0.5
			unit_group_order_move_formed army4 -500 0 run
			set_counter army4_moving_s 1
		end_if

		if I_UnitGroupDistanceFromPosition army4 -700 0 < 100
			and I_BattleSettlementFortificationLevel > 2
			unit_group_order_halt army4
			battle_wait 0.5
			if I_UnitGroupDistanceFromPosition army4 -700 0 < 100
				set_counter path_w 0
				if I_CompareCounter path_nw > 1
					set_counter path_nw 1
				end_if
				if I_CompareCounter path_sw > 1
					set_counter path_sw 1
				end_if
				if I_CompareCounter path_nw = 0
					and I_CompareCounter path_sw = 0
					set_counter army4_ready_sally 3
					set_counter army4_ready 0
				end_if
			end_if
		end_if

		if I_UnitGroupDistanceFromPosition army4 -500 0 < 100
			and I_BattleSettlementFortificationLevel < 3
			unit_group_order_halt army4
			battle_wait 0.5
			if I_UnitGroupDistanceFromPosition army4 -500 0 < 100
				set_counter path_w 0
				if I_CompareCounter path_n > 1
					set_counter path_n 1
				end_if
				if I_CompareCounter path_s > 1
					set_counter path_s 1
				end_if
				if I_CompareCounter path_n = 0
					and I_CompareCounter path_s = 0
					set_counter army4_ready_sally 3
					set_counter army4_ready 0
				end_if
			end_if
		end_if

		battle_wait 20
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter army4_ready_sally = 2
		and I_CompareCounter path_e = 1
		and ! I_UnitEnemyUnitInRadius a4u1 130

		if I_UnitGroupDistanceFromPosition army4 700 0 > 100
			and I_BattleSettlementFortificationLevel > 2
			set_counter label_army4 1
			battle_wait 0.5
			unit_group_order_move_formed army4 700 0 run
			set_counter army4_moving_s 1
		end_if

		if I_UnitGroupDistanceFromPosition army4 500 0 > 100
			and I_BattleSettlementFortificationLevel < 3
			set_counter label_army4 1
			battle_wait 0.5
			unit_group_order_move_formed army4 500 0 run
			set_counter army4_moving_s 1
		end_if

		if I_UnitGroupDistanceFromPosition army4 700 0 < 100
			and I_BattleSettlementFortificationLevel > 2
			unit_group_order_halt army4
			battle_wait 0.5
			if I_UnitGroupDistanceFromPosition army4 700 0 < 100
				set_counter path_e 0
				if I_CompareCounter path_ne > 1
					set_counter path_ne 1
				end_if
				if I_CompareCounter path_se > 1
					set_counter path_se 1
				end_if
				if I_CompareCounter path_ne = 0
					and I_CompareCounter path_se = 0
					set_counter army4_ready_sally 3
					set_counter army4_ready 0
				end_if
			end_if
		end_if

		if I_UnitGroupDistanceFromPosition army4 500 0 < 100
			and I_BattleSettlementFortificationLevel < 3
			unit_group_order_halt army4
			battle_wait 0.5
			if I_UnitGroupDistanceFromPosition army4 500 0 < 100
				set_counter path_e 0
				if I_CompareCounter path_n > 1
					set_counter path_n 1
				end_if
				if I_CompareCounter path_s > 1
					set_counter path_s 1
				end_if
				if I_CompareCounter path_n = 0
					and I_CompareCounter path_s = 0
					set_counter army4_ready_sally 3
					set_counter army4_ready 0
				end_if
			end_if
		end_if

		battle_wait 20
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter army4_ready_sally = 2
		and I_CompareCounter path_nw = 1
		and I_BattleSettlementFortificationLevel > 2
		and ! I_UnitEnemyUnitInRadius a4u1 130

		if I_UnitGroupDistanceFromPosition army4 -700 700 > 100
			set_counter label_army4 1
			battle_wait 0.5
			unit_group_order_move_formed army4 -700 700 run
			set_counter army4_moving_s 1
		end_if

		if I_UnitGroupDistanceFromPosition army4 -700 700 < 100
			unit_group_order_halt army4
			battle_wait 0.5
			if I_UnitGroupDistanceFromPosition army4 -700 700 < 100
				set_counter path_nw 0
				if I_CompareCounter path_n > 1
					set_counter path_n 1
				end_if
				if I_CompareCounter path_w > 1
					set_counter path_w 1
				end_if
				if I_CompareCounter path_n = 0
					and I_CompareCounter path_w = 0
					set_counter army4_ready_sally 3
					set_counter army4_ready 0
				end_if
			end_if
		end_if

		battle_wait 20
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter army4_ready_sally = 2
		and I_CompareCounter path_ne = 1
		and I_BattleSettlementFortificationLevel > 2
		and ! I_UnitEnemyUnitInRadius a4u1 130

		if I_UnitGroupDistanceFromPosition army4 700 700 > 100
			set_counter label_army4 1
			battle_wait 0.5
			unit_group_order_move_formed army4 700 700 run
			set_counter army4_moving_s 1
		end_if

		if I_UnitGroupDistanceFromPosition army4 700 700 < 100
			unit_group_order_halt army4
			battle_wait 0.5
			if I_UnitGroupDistanceFromPosition army4 700 700 < 100
				set_counter path_ne 0
				if I_CompareCounter path_e > 1
					set_counter path_e 1
				end_if
				if I_CompareCounter path_n > 1
					set_counter path_n 1
				end_if
				if I_CompareCounter path_e = 0
					and I_CompareCounter path_n = 0
					set_counter army4_ready_sally 3
					set_counter army4_ready 0
				end_if
			end_if
		end_if

		battle_wait 20
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter army4_ready_sally = 2
		and I_CompareCounter path_sw = 1
		and I_BattleSettlementFortificationLevel > 2
		and ! I_UnitEnemyUnitInRadius a4u1 130

		if I_UnitGroupDistanceFromPosition army4 -700 -700 > 100
			set_counter label_army4 1
			battle_wait 0.5
			unit_group_order_move_formed army4 -700 -700 run
			set_counter army4_moving_s 1
		end_if

		if I_UnitGroupDistanceFromPosition army4 -700 -700 < 100
			unit_group_order_halt army4
			battle_wait 0.5
			if I_UnitGroupDistanceFromPosition army4 -700 -700 < 100
				set_counter path_sw 0
				if I_CompareCounter path_w > 1
					set_counter path_w 1
				end_if
				if I_CompareCounter path_s > 1
					set_counter path_s 1
				end_if
				if I_CompareCounter path_w = 0
					and I_CompareCounter path_s = 0
					set_counter army4_ready_sally 3
					set_counter army4_ready 0
				end_if
			end_if
		end_if

		battle_wait 20
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter army4_ready_sally = 2
		and I_CompareCounter path_se = 1
		and I_BattleSettlementFortificationLevel > 2
		and ! I_UnitEnemyUnitInRadius a4u1 130

		if I_UnitGroupDistanceFromPosition army4 700 -700 > 100
			set_counter label_army4 1
			battle_wait 0.5
			unit_group_order_move_formed army4 700 -700 run
			set_counter army4_moving_s 1
		end_if

		if I_UnitGroupDistanceFromPosition army4 700 -700 < 100
			unit_group_order_halt army4
			battle_wait 0.5
			if I_UnitGroupDistanceFromPosition army4 700 -700 < 100
				set_counter path_se 0
				if I_CompareCounter path_s > 1
					set_counter path_s 1
				end_if
				if I_CompareCounter path_e > 1
					set_counter path_e 1
				end_if
				if I_CompareCounter path_s = 0
					and I_CompareCounter path_e = 0
					set_counter army4_ready_sally 3
					set_counter army4_ready 0
				end_if
			end_if
		end_if

		battle_wait 20
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter army4_ready_sally = 3

		set_counter army4_ready_sally 0
		unit_group_order_halt army4
		;   ai_active_set off
		battle_wait 0.5
		ai_active_set on
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter army4_ready_sally = 2
		and I_IsUnitRouting a4u1

		set_counter army4_ready_sally 3
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter army4_ready_sally = 2
		and I_PercentageUnitKilled a4u1 > 80

		set_counter army4_ready_sally 3
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter army4_ready_sally = 2

		if I_IsUnitGroupIdle army4
			inc_counter army4_idle_r 1
		end_if

		if ! I_IsUnitGroupIdle army4
			set_counter army4_idle_r 0
		end_if

		if I_CompareCounter army4_idle_r > 12
			set_counter army4_ready_sally 0
		end_if
		battle_wait 10
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter army4_ready_sally = 2
		and ! I_UnitEnemyUnitInRadius a4u1 130
		and I_CompareCounter path_n = 1

		set_counter check_timer 1
		;	battle_wait 600
		battle_wait 30
		if I_CompareCounter path_n = 1
			and I_CompareCounter army4_ready_sally = 2
			and I_CompareCounter check_timer = 1
			set_counter check_timer 2
			battle_wait 30
			if I_CompareCounter path_n = 1
				and I_CompareCounter army4_ready_sally = 2
				and I_CompareCounter check_timer = 2
				set_counter check_timer 3
				battle_wait 30
				if I_CompareCounter path_n = 1
					and I_CompareCounter army4_ready_sally = 2
					and I_CompareCounter check_timer = 3
					set_counter check_timer 4
					battle_wait 30
					if I_CompareCounter path_n = 1
						and I_CompareCounter army4_ready_sally = 2
						and I_CompareCounter check_timer = 4
						set_counter check_timer 5
						battle_wait 30
						if I_CompareCounter path_n = 1
							and I_CompareCounter army4_ready_sally = 2
							and I_CompareCounter check_timer = 5
							set_counter check_timer 6
							battle_wait 30
							if I_CompareCounter path_n = 1
								and I_CompareCounter army4_ready_sally = 2
								and I_CompareCounter check_timer = 6
								set_counter check_timer 7
								battle_wait 30
								if I_CompareCounter path_n = 1
									and I_CompareCounter army4_ready_sally = 2
									and I_CompareCounter check_timer = 7
									set_counter check_timer 8
									battle_wait 30
									if I_CompareCounter path_n = 1
										and I_CompareCounter army4_ready_sally = 2
										and I_CompareCounter check_timer = 8
										set_counter check_timer 9
										battle_wait 30
										if I_CompareCounter path_n = 1
											and I_CompareCounter army4_ready_sally = 2
											and I_CompareCounter check_timer = 9
											set_counter check_timer 10
											battle_wait 30
											if I_CompareCounter path_n = 1
												and I_CompareCounter army4_ready_sally = 2
												and I_CompareCounter check_timer = 10
												set_counter check_timer 11
												battle_wait 30
												if I_CompareCounter path_n = 1
													and I_CompareCounter army4_ready_sally = 2
													and I_CompareCounter check_timer = 11
													set_counter check_timer 12
													battle_wait 30
													if I_CompareCounter path_n = 1
														and I_CompareCounter army4_ready_sally = 2
														and I_CompareCounter check_timer = 12
														set_counter check_timer 13
														battle_wait 30
														if I_CompareCounter path_n = 1
															and I_CompareCounter army4_ready_sally = 2
															and I_CompareCounter check_timer = 13
															set_counter check_timer 14
															battle_wait 30
															if I_CompareCounter path_n = 1
																and I_CompareCounter army4_ready_sally = 2
																and I_CompareCounter check_timer = 14
																set_counter check_timer 15
																battle_wait 30
																if I_CompareCounter path_n = 1
																	and I_CompareCounter army4_ready_sally = 2
																	and I_CompareCounter check_timer = 15
																	set_counter check_timer 16
																	battle_wait 30
																	if I_CompareCounter path_n = 1
																		and I_CompareCounter army4_ready_sally = 2
																		and I_CompareCounter check_timer = 16
																		set_counter check_timer 17
																		battle_wait 30
																		if I_CompareCounter path_n = 1
																			and I_CompareCounter army4_ready_sally = 2
																			and I_CompareCounter check_timer = 17
																			set_counter check_timer 18
																			battle_wait 30
																			if I_CompareCounter path_n = 1
																				and I_CompareCounter army4_ready_sally = 2
																				and I_CompareCounter check_timer = 18
																				set_counter check_timer 19
																				battle_wait 30
																				if I_CompareCounter path_n = 1
																					and I_CompareCounter army4_ready_sally = 2
																					and I_CompareCounter check_timer = 19
																					set_counter check_timer 20
																					battle_wait 30
																					if I_CompareCounter path_n = 1
																						and I_CompareCounter army4_ready_sally = 2
																						and I_CompareCounter check_timer = 20
																						set_counter path_n 0
																						set_counter sally_reinf 0
																						set_counter army4_ready_sally 0
																						set_counter label_army4 1
																						;    battle_wait 0.5
																						;    ai_active_set off
																						battle_wait 0.5
																						ai_active_set on
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter army4_ready_sally = 2
		and ! I_UnitEnemyUnitInRadius a4u1 130
		and I_CompareCounter path_s = 1

		set_counter check_timer 1
		;	battle_wait 600
		battle_wait 30
		if I_CompareCounter path_s = 1
			and I_CompareCounter army4_ready_sally = 2
			and I_CompareCounter check_timer = 1
			set_counter check_timer 2
			battle_wait 30
			if I_CompareCounter path_s = 1
				and I_CompareCounter army4_ready_sally = 2
				and I_CompareCounter check_timer = 2
				set_counter check_timer 3
				battle_wait 30
				if I_CompareCounter path_s = 1
					and I_CompareCounter army4_ready_sally = 2
					and I_CompareCounter check_timer = 3
					set_counter check_timer 4
					battle_wait 30
					if I_CompareCounter path_s = 1
						and I_CompareCounter army4_ready_sally = 2
						and I_CompareCounter check_timer = 4
						set_counter check_timer 5
						battle_wait 30
						if I_CompareCounter path_s = 1
							and I_CompareCounter army4_ready_sally = 2
							and I_CompareCounter check_timer = 5
							set_counter check_timer 6
							battle_wait 30
							if I_CompareCounter path_s = 1
								and I_CompareCounter army4_ready_sally = 2
								and I_CompareCounter check_timer = 6
								set_counter check_timer 7
								battle_wait 30
								if I_CompareCounter path_s = 1
									and I_CompareCounter army4_ready_sally = 2
									and I_CompareCounter check_timer = 7
									set_counter check_timer 8
									battle_wait 30
									if I_CompareCounter path_s = 1
										and I_CompareCounter army4_ready_sally = 2
										and I_CompareCounter check_timer = 8
										set_counter check_timer 9
										battle_wait 30
										if I_CompareCounter path_s = 1
											and I_CompareCounter army4_ready_sally = 2
											and I_CompareCounter check_timer = 9
											set_counter check_timer 10
											battle_wait 30
											if I_CompareCounter path_s = 1
												and I_CompareCounter army4_ready_sally = 2
												and I_CompareCounter check_timer = 10
												set_counter check_timer 11
												battle_wait 30
												if I_CompareCounter path_s = 1
													and I_CompareCounter army4_ready_sally = 2
													and I_CompareCounter check_timer = 11
													set_counter check_timer 12
													battle_wait 30
													if I_CompareCounter path_s = 1
														and I_CompareCounter army4_ready_sally = 2
														and I_CompareCounter check_timer = 12
														set_counter check_timer 13
														battle_wait 30
														if I_CompareCounter path_s = 1
															and I_CompareCounter army4_ready_sally = 2
															and I_CompareCounter check_timer = 13
															set_counter check_timer 14
															battle_wait 30
															if I_CompareCounter path_s = 1
																and I_CompareCounter army4_ready_sally = 2
																and I_CompareCounter check_timer = 14
																set_counter check_timer 15
																battle_wait 30
																if I_CompareCounter path_s = 1
																	and I_CompareCounter army4_ready_sally = 2
																	and I_CompareCounter check_timer = 15
																	set_counter check_timer 16
																	battle_wait 30
																	if I_CompareCounter path_s = 1
																		and I_CompareCounter army4_ready_sally = 2
																		and I_CompareCounter check_timer = 16
																		set_counter check_timer 17
																		battle_wait 30
																		if I_CompareCounter path_s = 1
																			and I_CompareCounter army4_ready_sally = 2
																			and I_CompareCounter check_timer = 17
																			set_counter check_timer 18
																			battle_wait 30
																			if I_CompareCounter path_s = 1
																				and I_CompareCounter army4_ready_sally = 2
																				and I_CompareCounter check_timer = 18
																				set_counter check_timer 19
																				battle_wait 30
																				if I_CompareCounter path_s = 1
																					and I_CompareCounter army4_ready_sally = 2
																					and I_CompareCounter check_timer = 19
																					set_counter check_timer 20
																					battle_wait 30
																					if I_CompareCounter path_s = 1
																						and I_CompareCounter army4_ready_sally = 2
																						and I_CompareCounter check_timer = 20
																						set_counter path_s 0
																						set_counter sally_reinf 0
																						set_counter army4_ready_sally 0
																						set_counter label_army4 1
																						;    battle_wait 0.5
																						;    ai_active_set off
																						battle_wait 0.5
																						ai_active_set on
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter army4_ready_sally = 2
		and ! I_UnitEnemyUnitInRadius a4u1 130
		and I_CompareCounter path_w = 1

		set_counter check_timer 1
		;	battle_wait 600
		battle_wait 30
		if I_CompareCounter path_w = 1
			and I_CompareCounter army4_ready_sally = 2
			and I_CompareCounter check_timer = 1
			set_counter check_timer 2
			battle_wait 30
			if I_CompareCounter path_w = 1
				and I_CompareCounter army4_ready_sally = 2
				and I_CompareCounter check_timer = 2
				set_counter check_timer 3
				battle_wait 30
				if I_CompareCounter path_w = 1
					and I_CompareCounter army4_ready_sally = 2
					and I_CompareCounter check_timer = 3
					set_counter check_timer 4
					battle_wait 30
					if I_CompareCounter path_w = 1
						and I_CompareCounter army4_ready_sally = 2
						and I_CompareCounter check_timer = 4
						set_counter check_timer 5
						battle_wait 30
						if I_CompareCounter path_w = 1
							and I_CompareCounter army4_ready_sally = 2
							and I_CompareCounter check_timer = 5
							set_counter check_timer 6
							battle_wait 30
							if I_CompareCounter path_w = 1
								and I_CompareCounter army4_ready_sally = 2
								and I_CompareCounter check_timer = 6
								set_counter check_timer 7
								battle_wait 30
								if I_CompareCounter path_w = 1
									and I_CompareCounter army4_ready_sally = 2
									and I_CompareCounter check_timer = 7
									set_counter check_timer 8
									battle_wait 30
									if I_CompareCounter path_w = 1
										and I_CompareCounter army4_ready_sally = 2
										and I_CompareCounter check_timer = 8
										set_counter check_timer 9
										battle_wait 30
										if I_CompareCounter path_w = 1
											and I_CompareCounter army4_ready_sally = 2
											and I_CompareCounter check_timer = 9
											set_counter check_timer 10
											battle_wait 30
											if I_CompareCounter path_w = 1
												and I_CompareCounter army4_ready_sally = 2
												and I_CompareCounter check_timer = 10
												set_counter check_timer 11
												battle_wait 30
												if I_CompareCounter path_w = 1
													and I_CompareCounter army4_ready_sally = 2
													and I_CompareCounter check_timer = 11
													set_counter check_timer 12
													battle_wait 30
													if I_CompareCounter path_w = 1
														and I_CompareCounter army4_ready_sally = 2
														and I_CompareCounter check_timer = 12
														set_counter check_timer 13
														battle_wait 30
														if I_CompareCounter path_w = 1
															and I_CompareCounter army4_ready_sally = 2
															and I_CompareCounter check_timer = 13
															set_counter check_timer 14
															battle_wait 30
															if I_CompareCounter path_w = 1
																and I_CompareCounter army4_ready_sally = 2
																and I_CompareCounter check_timer = 14
																set_counter check_timer 15
																battle_wait 30
																if I_CompareCounter path_w = 1
																	and I_CompareCounter army4_ready_sally = 2
																	and I_CompareCounter check_timer = 15
																	set_counter check_timer 16
																	battle_wait 30
																	if I_CompareCounter path_w = 1
																		and I_CompareCounter army4_ready_sally = 2
																		and I_CompareCounter check_timer = 16
																		set_counter check_timer 17
																		battle_wait 30
																		if I_CompareCounter path_w = 1
																			and I_CompareCounter army4_ready_sally = 2
																			and I_CompareCounter check_timer = 17
																			set_counter check_timer 18
																			battle_wait 30
																			if I_CompareCounter path_w = 1
																				and I_CompareCounter army4_ready_sally = 2
																				and I_CompareCounter check_timer = 18
																				set_counter check_timer 19
																				battle_wait 30
																				if I_CompareCounter path_w = 1
																					and I_CompareCounter army4_ready_sally = 2
																					and I_CompareCounter check_timer = 19
																					set_counter check_timer 20
																					battle_wait 30
																					if I_CompareCounter path_w = 1
																						and I_CompareCounter army4_ready_sally = 2
																						and I_CompareCounter check_timer = 20
																						set_counter path_w 0
																						set_counter sally_reinf 0
																						set_counter army4_ready_sally 0
																						set_counter label_army4 1
																						;    battle_wait 0.5
																						;    ai_active_set off
																						battle_wait 0.5
																						ai_active_set on
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter army4_ready_sally = 2
		and ! I_UnitEnemyUnitInRadius a4u1 130
		and I_CompareCounter path_e = 1

		set_counter check_timer 1
		;	battle_wait 600
		battle_wait 30
		if I_CompareCounter path_e = 1
			and I_CompareCounter army4_ready_sally = 2
			and I_CompareCounter check_timer = 1
			set_counter check_timer 2
			battle_wait 30
			if I_CompareCounter path_e = 1
				and I_CompareCounter army4_ready_sally = 2
				and I_CompareCounter check_timer = 2
				set_counter check_timer 3
				battle_wait 30
				if I_CompareCounter path_e = 1
					and I_CompareCounter army4_ready_sally = 2
					and I_CompareCounter check_timer = 3
					set_counter check_timer 4
					battle_wait 30
					if I_CompareCounter path_e = 1
						and I_CompareCounter army4_ready_sally = 2
						and I_CompareCounter check_timer = 4
						set_counter check_timer 5
						battle_wait 30
						if I_CompareCounter path_e = 1
							and I_CompareCounter army4_ready_sally = 2
							and I_CompareCounter check_timer = 5
							set_counter check_timer 6
							battle_wait 30
							if I_CompareCounter path_e = 1
								and I_CompareCounter army4_ready_sally = 2
								and I_CompareCounter check_timer = 6
								set_counter check_timer 7
								battle_wait 30
								if I_CompareCounter path_e = 1
									and I_CompareCounter army4_ready_sally = 2
									and I_CompareCounter check_timer = 7
									set_counter check_timer 8
									battle_wait 30
									if I_CompareCounter path_e = 1
										and I_CompareCounter army4_ready_sally = 2
										and I_CompareCounter check_timer = 8
										set_counter check_timer 9
										battle_wait 30
										if I_CompareCounter path_e = 1
											and I_CompareCounter army4_ready_sally = 2
											and I_CompareCounter check_timer = 9
											set_counter check_timer 10
											battle_wait 30
											if I_CompareCounter path_e = 1
												and I_CompareCounter army4_ready_sally = 2
												and I_CompareCounter check_timer = 10
												set_counter check_timer 11
												battle_wait 30
												if I_CompareCounter path_e = 1
													and I_CompareCounter army4_ready_sally = 2
													and I_CompareCounter check_timer = 11
													set_counter check_timer 12
													battle_wait 30
													if I_CompareCounter path_e = 1
														and I_CompareCounter army4_ready_sally = 2
														and I_CompareCounter check_timer = 12
														set_counter check_timer 13
														battle_wait 30
														if I_CompareCounter path_e = 1
															and I_CompareCounter army4_ready_sally = 2
															and I_CompareCounter check_timer = 13
															set_counter check_timer 14
															battle_wait 30
															if I_CompareCounter path_e = 1
																and I_CompareCounter army4_ready_sally = 2
																and I_CompareCounter check_timer = 14
																set_counter check_timer 15
																battle_wait 30
																if I_CompareCounter path_e = 1
																	and I_CompareCounter army4_ready_sally = 2
																	and I_CompareCounter check_timer = 15
																	set_counter check_timer 16
																	battle_wait 30
																	if I_CompareCounter path_e = 1
																		and I_CompareCounter army4_ready_sally = 2
																		and I_CompareCounter check_timer = 16
																		set_counter check_timer 17
																		battle_wait 30
																		if I_CompareCounter path_e = 1
																			and I_CompareCounter army4_ready_sally = 2
																			and I_CompareCounter check_timer = 17
																			set_counter check_timer 18
																			battle_wait 30
																			if I_CompareCounter path_e = 1
																				and I_CompareCounter army4_ready_sally = 2
																				and I_CompareCounter check_timer = 18
																				set_counter check_timer 19
																				battle_wait 30
																				if I_CompareCounter path_e = 1
																					and I_CompareCounter army4_ready_sally = 2
																					and I_CompareCounter check_timer = 19
																					set_counter check_timer 20
																					battle_wait 30
																					if I_CompareCounter path_e = 1
																						and I_CompareCounter army4_ready_sally = 2
																						and I_CompareCounter check_timer = 20
																						set_counter path_e 0
																						set_counter sally_reinf 0
																						set_counter army4_ready_sally 0
																						set_counter label_army4 1
																						;    battle_wait 0.5
																						;   ai_active_set off
																						battle_wait 0.5
																						ai_active_set on
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter army4_ready_sally = 2
		and ! I_UnitEnemyUnitInRadius a4u1 130
		and I_CompareCounter path_nw = 1

		set_counter check_timer 1
		;	battle_wait 600
		battle_wait 30
		if I_CompareCounter path_nw = 1
			and I_CompareCounter army4_ready_sally = 2
			and I_CompareCounter check_timer = 1
			set_counter check_timer 2
			battle_wait 30
			if I_CompareCounter path_nw = 1
				and I_CompareCounter army4_ready_sally = 2
				and I_CompareCounter check_timer = 2
				set_counter check_timer 3
				battle_wait 30
				if I_CompareCounter path_nw = 1
					and I_CompareCounter army4_ready_sally = 2
					and I_CompareCounter check_timer = 3
					set_counter check_timer 4
					battle_wait 30
					if I_CompareCounter path_nw = 1
						and I_CompareCounter army4_ready_sally = 2
						and I_CompareCounter check_timer = 4
						set_counter check_timer 5
						battle_wait 30
						if I_CompareCounter path_nw = 1
							and I_CompareCounter army4_ready_sally = 2
							and I_CompareCounter check_timer = 5
							set_counter check_timer 6
							battle_wait 30
							if I_CompareCounter path_nw = 1
								and I_CompareCounter army4_ready_sally = 2
								and I_CompareCounter check_timer = 6
								set_counter check_timer 7
								battle_wait 30
								if I_CompareCounter path_nw = 1
									and I_CompareCounter army4_ready_sally = 2
									and I_CompareCounter check_timer = 7
									set_counter check_timer 8
									battle_wait 30
									if I_CompareCounter path_nw = 1
										and I_CompareCounter army4_ready_sally = 2
										and I_CompareCounter check_timer = 8
										set_counter check_timer 9
										battle_wait 30
										if I_CompareCounter path_nw = 1
											and I_CompareCounter army4_ready_sally = 2
											and I_CompareCounter check_timer = 9
											set_counter check_timer 10
											battle_wait 30
											if I_CompareCounter path_nw = 1
												and I_CompareCounter army4_ready_sally = 2
												and I_CompareCounter check_timer = 10
												set_counter check_timer 11
												battle_wait 30
												if I_CompareCounter path_nw = 1
													and I_CompareCounter army4_ready_sally = 2
													and I_CompareCounter check_timer = 11
													set_counter check_timer 12
													battle_wait 30
													if I_CompareCounter path_nw = 1
														and I_CompareCounter army4_ready_sally = 2
														and I_CompareCounter check_timer = 12
														set_counter check_timer 13
														battle_wait 30
														if I_CompareCounter path_nw = 1
															and I_CompareCounter army4_ready_sally = 2
															and I_CompareCounter check_timer = 13
															set_counter check_timer 14
															battle_wait 30
															if I_CompareCounter path_nw = 1
																and I_CompareCounter army4_ready_sally = 2
																and I_CompareCounter check_timer = 14
																set_counter check_timer 15
																battle_wait 30
																if I_CompareCounter path_nw = 1
																	and I_CompareCounter army4_ready_sally = 2
																	and I_CompareCounter check_timer = 15
																	set_counter check_timer 16
																	battle_wait 30
																	if I_CompareCounter path_nw = 1
																		and I_CompareCounter army4_ready_sally = 2
																		and I_CompareCounter check_timer = 16
																		set_counter check_timer 17
																		battle_wait 30
																		if I_CompareCounter path_nw = 1
																			and I_CompareCounter army4_ready_sally = 2
																			and I_CompareCounter check_timer = 17
																			set_counter check_timer 18
																			battle_wait 30
																			if I_CompareCounter path_nw = 1
																				and I_CompareCounter army4_ready_sally = 2
																				and I_CompareCounter check_timer = 18
																				set_counter check_timer 19
																				battle_wait 30
																				if I_CompareCounter path_nw = 1
																					and I_CompareCounter army4_ready_sally = 2
																					and I_CompareCounter check_timer = 19
																					set_counter check_timer 20
																					battle_wait 30
																					if I_CompareCounter path_nw = 1
																						and I_CompareCounter army4_ready_sally = 2
																						and I_CompareCounter check_timer = 20
																						set_counter path_nw 0
																						set_counter sally_reinf 0
																						set_counter army4_ready_sally 0
																						set_counter label_army4 1
																						;    battle_wait 0.5
																						;    ai_active_set off
																						battle_wait 0.5
																						ai_active_set on
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter army4_ready_sally = 2
		and ! I_UnitEnemyUnitInRadius a4u1 130
		and I_CompareCounter path_ne = 1

		set_counter check_timer 1
		;	battle_wait 600
		battle_wait 30
		if I_CompareCounter path_ne = 1
			and I_CompareCounter army4_ready_sally = 2
			and I_CompareCounter check_timer = 1
			set_counter check_timer 2
			battle_wait 30
			if I_CompareCounter path_ne = 1
				and I_CompareCounter army4_ready_sally = 2
				and I_CompareCounter check_timer = 2
				set_counter check_timer 3
				battle_wait 30
				if I_CompareCounter path_ne = 1
					and I_CompareCounter army4_ready_sally = 2
					and I_CompareCounter check_timer = 3
					set_counter check_timer 4
					battle_wait 30
					if I_CompareCounter path_ne = 1
						and I_CompareCounter army4_ready_sally = 2
						and I_CompareCounter check_timer = 4
						set_counter check_timer 5
						battle_wait 30
						if I_CompareCounter path_ne = 1
							and I_CompareCounter army4_ready_sally = 2
							and I_CompareCounter check_timer = 5
							set_counter check_timer 6
							battle_wait 30
							if I_CompareCounter path_ne = 1
								and I_CompareCounter army4_ready_sally = 2
								and I_CompareCounter check_timer = 6
								set_counter check_timer 7
								battle_wait 30
								if I_CompareCounter path_ne = 1
									and I_CompareCounter army4_ready_sally = 2
									and I_CompareCounter check_timer = 7
									set_counter check_timer 8
									battle_wait 30
									if I_CompareCounter path_ne = 1
										and I_CompareCounter army4_ready_sally = 2
										and I_CompareCounter check_timer = 8
										set_counter check_timer 9
										battle_wait 30
										if I_CompareCounter path_ne = 1
											and I_CompareCounter army4_ready_sally = 2
											and I_CompareCounter check_timer = 9
											set_counter check_timer 10
											battle_wait 30
											if I_CompareCounter path_ne = 1
												and I_CompareCounter army4_ready_sally = 2
												and I_CompareCounter check_timer = 10
												set_counter check_timer 11
												battle_wait 30
												if I_CompareCounter path_ne = 1
													and I_CompareCounter army4_ready_sally = 2
													and I_CompareCounter check_timer = 11
													set_counter check_timer 12
													battle_wait 30
													if I_CompareCounter path_ne = 1
														and I_CompareCounter army4_ready_sally = 2
														and I_CompareCounter check_timer = 12
														set_counter check_timer 13
														battle_wait 30
														if I_CompareCounter path_ne = 1
															and I_CompareCounter army4_ready_sally = 2
															and I_CompareCounter check_timer = 13
															set_counter check_timer 14
															battle_wait 30
															if I_CompareCounter path_ne = 1
																and I_CompareCounter army4_ready_sally = 2
																and I_CompareCounter check_timer = 14
																set_counter check_timer 15
																battle_wait 30
																if I_CompareCounter path_ne = 1
																	and I_CompareCounter army4_ready_sally = 2
																	and I_CompareCounter check_timer = 15
																	set_counter check_timer 16
																	battle_wait 30
																	if I_CompareCounter path_ne = 1
																		and I_CompareCounter army4_ready_sally = 2
																		and I_CompareCounter check_timer = 16
																		set_counter check_timer 17
																		battle_wait 30
																		if I_CompareCounter path_ne = 1
																			and I_CompareCounter army4_ready_sally = 2
																			and I_CompareCounter check_timer = 17
																			set_counter check_timer 18
																			battle_wait 30
																			if I_CompareCounter path_ne = 1
																				and I_CompareCounter army4_ready_sally = 2
																				and I_CompareCounter check_timer = 18
																				set_counter check_timer 19
																				battle_wait 30
																				if I_CompareCounter path_ne = 1
																					and I_CompareCounter army4_ready_sally = 2
																					and I_CompareCounter check_timer = 19
																					set_counter check_timer 20
																					battle_wait 30
																					if I_CompareCounter path_ne = 1
																						and I_CompareCounter army4_ready_sally = 2
																						and I_CompareCounter check_timer = 20
																						set_counter path_ne 0
																						set_counter sally_reinf 0
																						set_counter army4_ready_sally 0
																						set_counter label_army4 1
																						;    battle_wait 0.5
																						;    ai_active_set off
																						battle_wait 0.5
																						ai_active_set on
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter army4_ready_sally = 2
		and ! I_UnitEnemyUnitInRadius a4u1 130
		and I_CompareCounter path_sw = 1

		set_counter check_timer 1
		;	battle_wait 600
		battle_wait 30
		if I_CompareCounter path_sw = 1
			and I_CompareCounter army4_ready_sally = 2
			and I_CompareCounter check_timer = 1
			set_counter check_timer 2
			battle_wait 30
			if I_CompareCounter path_sw = 1
				and I_CompareCounter army4_ready_sally = 2
				and I_CompareCounter check_timer = 2
				set_counter check_timer 3
				battle_wait 30
				if I_CompareCounter path_sw = 1
					and I_CompareCounter army4_ready_sally = 2
					and I_CompareCounter check_timer = 3
					set_counter check_timer 4
					battle_wait 30
					if I_CompareCounter path_sw = 1
						and I_CompareCounter army4_ready_sally = 2
						and I_CompareCounter check_timer = 4
						set_counter check_timer 5
						battle_wait 30
						if I_CompareCounter path_sw = 1
							and I_CompareCounter army4_ready_sally = 2
							and I_CompareCounter check_timer = 5
							set_counter check_timer 6
							battle_wait 30
							if I_CompareCounter path_sw = 1
								and I_CompareCounter army4_ready_sally = 2
								and I_CompareCounter check_timer = 6
								set_counter check_timer 7
								battle_wait 30
								if I_CompareCounter path_sw = 1
									and I_CompareCounter army4_ready_sally = 2
									and I_CompareCounter check_timer = 7
									set_counter check_timer 8
									battle_wait 30
									if I_CompareCounter path_sw = 1
										and I_CompareCounter army4_ready_sally = 2
										and I_CompareCounter check_timer = 8
										set_counter check_timer 9
										battle_wait 30
										if I_CompareCounter path_sw = 1
											and I_CompareCounter army4_ready_sally = 2
											and I_CompareCounter check_timer = 9
											set_counter check_timer 10
											battle_wait 30
											if I_CompareCounter path_sw = 1
												and I_CompareCounter army4_ready_sally = 2
												and I_CompareCounter check_timer = 10
												set_counter check_timer 11
												battle_wait 30
												if I_CompareCounter path_sw = 1
													and I_CompareCounter army4_ready_sally = 2
													and I_CompareCounter check_timer = 11
													set_counter check_timer 12
													battle_wait 30
													if I_CompareCounter path_sw = 1
														and I_CompareCounter army4_ready_sally = 2
														and I_CompareCounter check_timer = 12
														set_counter check_timer 13
														battle_wait 30
														if I_CompareCounter path_sw = 1
															and I_CompareCounter army4_ready_sally = 2
															and I_CompareCounter check_timer = 13
															set_counter check_timer 14
															battle_wait 30
															if I_CompareCounter path_sw = 1
																and I_CompareCounter army4_ready_sally = 2
																and I_CompareCounter check_timer = 14
																set_counter check_timer 15
																battle_wait 30
																if I_CompareCounter path_sw = 1
																	and I_CompareCounter army4_ready_sally = 2
																	and I_CompareCounter check_timer = 15
																	set_counter check_timer 16
																	battle_wait 30
																	if I_CompareCounter path_sw = 1
																		and I_CompareCounter army4_ready_sally = 2
																		and I_CompareCounter check_timer = 16
																		set_counter check_timer 17
																		battle_wait 30
																		if I_CompareCounter path_sw = 1
																			and I_CompareCounter army4_ready_sally = 2
																			and I_CompareCounter check_timer = 17
																			set_counter check_timer 18
																			battle_wait 30
																			if I_CompareCounter path_sw = 1
																				and I_CompareCounter army4_ready_sally = 2
																				and I_CompareCounter check_timer = 18
																				set_counter check_timer 19
																				battle_wait 30
																				if I_CompareCounter path_sw = 1
																					and I_CompareCounter army4_ready_sally = 2
																					and I_CompareCounter check_timer = 19
																					set_counter check_timer 20
																					battle_wait 30
																					if I_CompareCounter path_sw = 1
																						and I_CompareCounter army4_ready_sally = 2
																						and I_CompareCounter check_timer = 20
																						set_counter path_sw 0
																						set_counter sally_reinf 0
																						set_counter army4_ready_sally 0
																						set_counter label_army4 1
																						;    battle_wait 0.5
																						;    ai_active_set off
																						battle_wait 0.5
																						ai_active_set on
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter army4_ready_sally = 2
		and ! I_UnitEnemyUnitInRadius a4u1 130
		and I_CompareCounter path_se = 1

		set_counter check_timer 1
		;	battle_wait 600
		battle_wait 30
		if I_CompareCounter path_se = 1
			and I_CompareCounter army4_ready_sally = 2
			and I_CompareCounter check_timer = 1
			set_counter check_timer 2
			battle_wait 30
			if I_CompareCounter path_se = 1
				and I_CompareCounter army4_ready_sally = 2
				and I_CompareCounter check_timer = 2
				set_counter check_timer 3
				battle_wait 30
				if I_CompareCounter path_se = 1
					and I_CompareCounter army4_ready_sally = 2
					and I_CompareCounter check_timer = 3
					set_counter check_timer 4
					battle_wait 30
					if I_CompareCounter path_se = 1
						and I_CompareCounter army4_ready_sally = 2
						and I_CompareCounter check_timer = 4
						set_counter check_timer 5
						battle_wait 30
						if I_CompareCounter path_se = 1
							and I_CompareCounter army4_ready_sally = 2
							and I_CompareCounter check_timer = 5
							set_counter check_timer 6
							battle_wait 30
							if I_CompareCounter path_se = 1
								and I_CompareCounter army4_ready_sally = 2
								and I_CompareCounter check_timer = 6
								set_counter check_timer 7
								battle_wait 30
								if I_CompareCounter path_se = 1
									and I_CompareCounter army4_ready_sally = 2
									and I_CompareCounter check_timer = 7
									set_counter check_timer 8
									battle_wait 30
									if I_CompareCounter path_se = 1
										and I_CompareCounter army4_ready_sally = 2
										and I_CompareCounter check_timer = 8
										set_counter check_timer 9
										battle_wait 30
										if I_CompareCounter path_se = 1
											and I_CompareCounter army4_ready_sally = 2
											and I_CompareCounter check_timer = 9
											set_counter check_timer 10
											battle_wait 30
											if I_CompareCounter path_se = 1
												and I_CompareCounter army4_ready_sally = 2
												and I_CompareCounter check_timer = 10
												set_counter check_timer 11
												battle_wait 30
												if I_CompareCounter path_se = 1
													and I_CompareCounter army4_ready_sally = 2
													and I_CompareCounter check_timer = 11
													set_counter check_timer 12
													battle_wait 30
													if I_CompareCounter path_se = 1
														and I_CompareCounter army4_ready_sally = 2
														and I_CompareCounter check_timer = 12
														set_counter check_timer 13
														battle_wait 30
														if I_CompareCounter path_se = 1
															and I_CompareCounter army4_ready_sally = 2
															and I_CompareCounter check_timer = 13
															set_counter check_timer 14
															battle_wait 30
															if I_CompareCounter path_se = 1
																and I_CompareCounter army4_ready_sally = 2
																and I_CompareCounter check_timer = 14
																set_counter check_timer 15
																battle_wait 30
																if I_CompareCounter path_se = 1
																	and I_CompareCounter army4_ready_sally = 2
																	and I_CompareCounter check_timer = 15
																	set_counter check_timer 16
																	battle_wait 30
																	if I_CompareCounter path_se = 1
																		and I_CompareCounter army4_ready_sally = 2
																		and I_CompareCounter check_timer = 16
																		set_counter check_timer 17
																		battle_wait 30
																		if I_CompareCounter path_se = 1
																			and I_CompareCounter army4_ready_sally = 2
																			and I_CompareCounter check_timer = 17
																			set_counter check_timer 18
																			battle_wait 30
																			if I_CompareCounter path_se = 1
																				and I_CompareCounter army4_ready_sally = 2
																				and I_CompareCounter check_timer = 18
																				set_counter check_timer 19
																				battle_wait 30
																				if I_CompareCounter path_se = 1
																					and I_CompareCounter army4_ready_sally = 2
																					and I_CompareCounter check_timer = 19
																					set_counter check_timer 20
																					battle_wait 30
																					if I_CompareCounter path_se = 1
																						and I_CompareCounter army4_ready_sally = 2
																						and I_CompareCounter check_timer = 20
																						set_counter path_se 0
																						set_counter sally_reinf 0
																						set_counter army4_ready_sally 0
																						set_counter label_army4 1
																						;    battle_wait 0.5
																						;   ai_active_set off
																						battle_wait 0.5
																						ai_active_set on
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if
	end_monitor

	;################## Germanicu5 Integrated Stakes script ###########################

	monitor_conditions I_BattleStarted
		and I_CompareCounter label_ready = 1
		and I_BattlePlayerArmyIsAttacker
		and ! I_BattleAiAttacking
		and ! I_ConflictType SuccessfulAmbush
		and ! I_BattleIsSiegeBattle
		and ! I_BattleIsSallyOutBattle
		and I_BattlePlayerArmyNumberOfUnitCategory cavalry > 0
		and I_BattleEnemyArmyNumberOfAttribute stakes > 0
		and I_UnitEnemyUnitInRadius a2u1 150

		set_counter stakes_on 1
		set_counter label_ready 0
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter label_ready = 1
		and I_BattlePlayerArmyIsAttacker
		;    and ! I_BattleAiAttacking
		and I_BattleIsSallyOutBattle
		and I_BattleSettlementFortificationLevel < 3
		and I_IsBattleSettlementCastle
		and I_BattlePlayerAllianceOddsAgainst < 2.0
		and I_BattleEnemyArmyNumberOfSpecialAbility drop_engines < 3
		and I_BattlePlayerArmyNumberOfUnitCategory cavalry > 0
		and I_BattleEnemyArmyNumberOfAttribute stakes > 0
		and I_BattleEnemyArmyNumberOfUnitCategory cavalry = 0
		and I_UnitEnemyUnitInRadius a2u1 150

		set_counter stakes_on 1
		set_counter label_ready 0
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter label_ready = 1
		and I_BattlePlayerArmyIsAttacker
		;    and ! I_BattleAiAttacking
		and I_BattleIsSallyOutBattle
		and I_BattleSettlementFortificationLevel > 2
		and I_IsBattleSettlementCastle
		and I_BattlePlayerAllianceOddsAgainst < 2.5
		and I_BattleEnemyArmyNumberOfSpecialAbility drop_engines < 4
		and I_BattlePlayerArmyNumberOfUnitCategory cavalry > 0
		and I_BattleEnemyArmyNumberOfAttribute stakes > 0
		and I_BattleEnemyArmyNumberOfUnitCategory cavalry = 0
		and I_UnitEnemyUnitInRadius a2u1 150

		set_counter stakes_on 1
		set_counter label_ready 0
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter label_ready = 1
		and I_BattlePlayerArmyIsAttacker
		;    and ! I_BattleAiAttacking
		and I_BattleIsSallyOutBattle
		and I_BattleSettlementFortificationLevel < 3
		and ! I_IsBattleSettlementCastle
		and I_BattleEnemyArmyNumberOfSpecialAbility drop_engines < 3
		and I_BattlePlayerAllianceOddsAgainst < 1.7
		and I_BattlePlayerArmyNumberOfUnitCategory cavalry > 0
		and I_BattleEnemyArmyNumberOfAttribute stakes > 0
		and I_BattleEnemyArmyNumberOfUnitCategory cavalry = 0
		and I_UnitEnemyUnitInRadius a2u1 150

		set_counter stakes_on 1
		set_counter label_ready 0
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter label_ready = 1
		and I_BattlePlayerArmyIsAttacker
		;    and ! I_BattleAiAttacking
		and I_BattleIsSallyOutBattle
		and I_BattleSettlementFortificationLevel > 2
		and ! I_IsBattleSettlementCastle
		and I_BattleEnemyArmyNumberOfSpecialAbility drop_engines < 3
		and I_BattlePlayerAllianceOddsAgainst < 2.2
		and I_BattlePlayerArmyNumberOfUnitCategory cavalry > 0
		and I_BattleEnemyArmyNumberOfAttribute stakes > 0
		and I_BattleEnemyArmyNumberOfUnitCategory cavalry = 0
		and I_UnitEnemyUnitInRadius a2u1 150

		set_counter stakes_on 1
		set_counter label_ready 0
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter stakes_on = 1
		and I_BattlePlayerArmyNumberOfUnitCategory cavalry > 0
		and I_BattleEnemyArmyNumberOfAttribute stakes > 0

		if I_CompareCounter enemy_unit_count > 0
			if ! I_UnitDestroyed a2u1
				and ! I_UnitStatus a2u1 left_battle
				and ! I_IsUnitRouting a2u1
				and I_UnitEnemyUnitInRadius a2u1 60
				and I_CompareCounter stakes_on != 2
				set_counter stakes_on 2
			end_if

			if I_CompareCounter enemy_unit_count > 1
				if ! I_UnitDestroyed a2u2
					and ! I_UnitStatus a2u2 left_battle
					and ! I_IsUnitRouting a2u2
					and I_UnitEnemyUnitInRadius a2u2 60
					and I_CompareCounter stakes_on != 2
					set_counter stakes_on 2
				end_if

				if I_CompareCounter enemy_unit_count > 2
					if ! I_UnitDestroyed a2u3
						and ! I_UnitStatus a2u3 left_battle
						and ! I_IsUnitRouting a2u3
						and I_UnitEnemyUnitInRadius a2u3 60
						and I_CompareCounter stakes_on != 2
						set_counter stakes_on 2
					end_if

					if I_CompareCounter enemy_unit_count > 3
						if ! I_UnitDestroyed a2u4
							and ! I_UnitStatus a2u4 left_battle
							and ! I_IsUnitRouting a2u4
							and I_UnitEnemyUnitInRadius a2u4 60
							and I_CompareCounter stakes_on != 2
							set_counter stakes_on 2
						end_if

						if I_CompareCounter enemy_unit_count > 4
							if ! I_UnitDestroyed a2u5
								and ! I_UnitStatus a2u5 left_battle
								and ! I_IsUnitRouting a2u5
								and I_UnitEnemyUnitInRadius a2u5 60
								and I_CompareCounter stakes_on != 2
								set_counter stakes_on 2
							end_if

							if I_CompareCounter enemy_unit_count > 5
								if ! I_UnitDestroyed a2u6
									and ! I_UnitStatus a2u6 left_battle
									and ! I_IsUnitRouting a2u6
									and I_UnitEnemyUnitInRadius a2u6 60
									and I_CompareCounter stakes_on != 2
									set_counter stakes_on 2
								end_if

								if I_CompareCounter enemy_unit_count > 6
									if ! I_UnitDestroyed a2u7
										and ! I_UnitStatus a2u7 left_battle
										and ! I_IsUnitRouting a2u7
										and I_UnitEnemyUnitInRadius a2u7 60
										and I_CompareCounter stakes_on != 2
										set_counter stakes_on 2
									end_if

									if I_CompareCounter enemy_unit_count > 7
										if ! I_UnitDestroyed a2u8
											and ! I_UnitStatus a2u8 left_battle
											and ! I_IsUnitRouting a2u8
											and I_UnitEnemyUnitInRadius a2u8 60
											and I_CompareCounter stakes_on != 2
											set_counter stakes_on 2
										end_if

										if I_CompareCounter enemy_unit_count > 8
											if ! I_UnitDestroyed a2u9
												and ! I_UnitStatus a2u9 left_battle
												and ! I_IsUnitRouting a2u9
												and I_UnitEnemyUnitInRadius a2u9 60
												and I_CompareCounter stakes_on != 2
												set_counter stakes_on 2
											end_if

											if I_CompareCounter enemy_unit_count > 9
												if ! I_UnitDestroyed a2u10
													and ! I_UnitStatus a2u10 left_battle
													and ! I_IsUnitRouting a2u10
													and I_UnitEnemyUnitInRadius a2u10 60
													and I_CompareCounter stakes_on != 2
													set_counter stakes_on 2
												end_if

												if I_CompareCounter enemy_unit_count > 10
													if ! I_UnitDestroyed a2u11
														and ! I_UnitStatus a2u11 left_battle
														and ! I_IsUnitRouting a2u11
														and I_UnitEnemyUnitInRadius a2u11 60
														and I_CompareCounter stakes_on != 2
														set_counter stakes_on 2
													end_if

													if I_CompareCounter enemy_unit_count > 11
														if ! I_UnitDestroyed a2u12
															and ! I_UnitStatus a2u12 left_battle
															and ! I_IsUnitRouting a2u12
															and I_UnitEnemyUnitInRadius a2u12 60
															and I_CompareCounter stakes_on != 2
															set_counter stakes_on 2
														end_if

														if I_CompareCounter enemy_unit_count > 12
															if ! I_UnitDestroyed a2u13
																and ! I_UnitStatus a2u13 left_battle
																and ! I_IsUnitRouting a2u13
																and I_UnitEnemyUnitInRadius a2u13 60
																and I_CompareCounter stakes_on != 2
																set_counter stakes_on 2
															end_if

															if I_CompareCounter enemy_unit_count > 13
																if ! I_UnitDestroyed a2u14
																	and ! I_UnitStatus a2u14 left_battle
																	and ! I_IsUnitRouting a2u14
																	and I_UnitEnemyUnitInRadius a2u14 60
																	and I_CompareCounter stakes_on != 2
																	set_counter stakes_on 2
																end_if

																if I_CompareCounter enemy_unit_count > 14
																	if ! I_UnitDestroyed a2u15
																		and ! I_UnitStatus a2u15 left_battle
																		and ! I_IsUnitRouting a2u15
																		and I_UnitEnemyUnitInRadius a2u15 60
																		and I_CompareCounter stakes_on != 2
																		set_counter stakes_on 2
																	end_if

																	if I_CompareCounter enemy_unit_count > 15
																		if ! I_UnitDestroyed a2u16
																			and ! I_UnitStatus a2u16 left_battle
																			and ! I_IsUnitRouting a2u16
																			and I_UnitEnemyUnitInRadius a2u16 60
																			and I_CompareCounter stakes_on != 2
																			set_counter stakes_on 2
																		end_if

																		if I_CompareCounter enemy_unit_count > 16
																			if ! I_UnitDestroyed a2u17
																				and ! I_UnitStatus a2u17 left_battle
																				and ! I_IsUnitRouting a2u17
																				and I_UnitEnemyUnitInRadius a2u17 60
																				and I_CompareCounter stakes_on != 2
																				set_counter stakes_on 2
																			end_if

																			if I_CompareCounter enemy_unit_count > 17
																				if ! I_UnitDestroyed a2u18
																					and ! I_UnitStatus a2u18 left_battle
																					and ! I_IsUnitRouting a2u18
																					and I_UnitEnemyUnitInRadius a2u18 60
																					and I_CompareCounter stakes_on != 2
																					set_counter stakes_on 2
																				end_if

																				if I_CompareCounter enemy_unit_count > 18
																					if ! I_UnitDestroyed a2u19
																						and ! I_UnitStatus a2u19 left_battle
																						and ! I_IsUnitRouting a2u19
																						and I_UnitEnemyUnitInRadius a2u19 60
																						and I_CompareCounter stakes_on != 2
																						set_counter stakes_on 2
																					end_if

																					if I_CompareCounter enemy_unit_count = 20
																						if ! I_UnitDestroyed a2u20
																							and ! I_UnitStatus a2u20 left_battle
																							and ! I_IsUnitRouting a2u20
																							and I_UnitEnemyUnitInRadius a2u20 60
																							and I_CompareCounter stakes_on != 2
																							set_counter stakes_on 2
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if

		if I_CompareCounter stakes_on = 2
			;    ai_active_set off
			unit_group_order_halt army2

			if I_CompareCounter enemy_unit_count > 0
				if ! I_UnitDestroyed a2u1
					and ! I_UnitStatus a2u1 left_battle
					and ! I_IsUnitRouting a2u1
					unit_deploy_stakes a2u1
				end_if

				if I_CompareCounter enemy_unit_count > 1
					if ! I_UnitDestroyed a2u2
						and ! I_UnitStatus a2u2 left_battle
						and ! I_IsUnitRouting a2u2
						unit_deploy_stakes a2u2
					end_if

					if I_CompareCounter enemy_unit_count > 2
						if ! I_UnitDestroyed a2u3
							and ! I_UnitStatus a2u3 left_battle
							and ! I_IsUnitRouting a2u3
							unit_deploy_stakes a2u3
						end_if

						if I_CompareCounter enemy_unit_count > 3
							if ! I_UnitDestroyed a2u4
								and ! I_UnitStatus a2u4 left_battle
								and ! I_IsUnitRouting a2u4
								unit_deploy_stakes a2u4
							end_if

							if I_CompareCounter enemy_unit_count > 4
								if ! I_UnitDestroyed a2u5
									and ! I_UnitStatus a2u5 left_battle
									and ! I_IsUnitRouting a2u5
									unit_deploy_stakes a2u5
								end_if

								if I_CompareCounter enemy_unit_count > 5
									if ! I_UnitDestroyed a2u6
										and ! I_UnitStatus a2u6 left_battle
										and ! I_IsUnitRouting a2u6
										unit_deploy_stakes a2u6
									end_if

									if I_CompareCounter enemy_unit_count > 6
										if ! I_UnitDestroyed a2u7
											and ! I_UnitStatus a2u7 left_battle
											and ! I_IsUnitRouting a2u7
											unit_deploy_stakes a2u7
										end_if

										if I_CompareCounter enemy_unit_count > 7
											if ! I_UnitDestroyed a2u8
												and ! I_UnitStatus a2u8 left_battle
												and ! I_IsUnitRouting a2u8
												unit_deploy_stakes a2u8
											end_if

											if I_CompareCounter enemy_unit_count > 8
												if ! I_UnitDestroyed a2u9
													and ! I_UnitStatus a2u9 left_battle
													and ! I_IsUnitRouting a2u9
													unit_deploy_stakes a2u9
												end_if

												if I_CompareCounter enemy_unit_count > 9
													if ! I_UnitDestroyed a2u10
														and ! I_UnitStatus a2u10 left_battle
														and ! I_IsUnitRouting a2u10
														unit_deploy_stakes a2u10
													end_if

													if I_CompareCounter enemy_unit_count > 10
														if ! I_UnitDestroyed a2u11
															and ! I_UnitStatus a2u11 left_battle
															and ! I_IsUnitRouting a2u11
															unit_deploy_stakes a2u11
														end_if

														if I_CompareCounter enemy_unit_count > 11
															if ! I_UnitDestroyed a2u12
																and ! I_UnitStatus a2u12 left_battle
																and ! I_IsUnitRouting a2u12
																unit_deploy_stakes a2u12
															end_if

															if I_CompareCounter enemy_unit_count > 12
																if ! I_UnitDestroyed a2u13
																	and ! I_UnitStatus a2u13 left_battle
																	and ! I_IsUnitRouting a2u13
																	unit_deploy_stakes a2u13
																end_if

																if I_CompareCounter enemy_unit_count > 13
																	if ! I_UnitDestroyed a2u14
																		and ! I_UnitStatus a2u14 left_battle
																		and ! I_IsUnitRouting a2u14
																		unit_deploy_stakes a2u14
																	end_if

																	if I_CompareCounter enemy_unit_count > 14
																		if ! I_UnitDestroyed a2u15
																			and ! I_UnitStatus a2u15 left_battle
																			and ! I_IsUnitRouting a2u15
																			unit_deploy_stakes a2u15
																		end_if

																		if I_CompareCounter enemy_unit_count > 15
																			if ! I_UnitDestroyed a2u16
																				and ! I_UnitStatus a2u16 left_battle
																				and ! I_IsUnitRouting a2u16
																				unit_deploy_stakes a2u16
																			end_if

																			if I_CompareCounter enemy_unit_count > 16
																				if ! I_UnitDestroyed a2u17
																					and ! I_UnitStatus a2u17 left_battle
																					and ! I_IsUnitRouting a2u17
																					unit_deploy_stakes a2u17
																				end_if

																				if I_CompareCounter enemy_unit_count > 17
																					if ! I_UnitDestroyed a2u18
																						and ! I_UnitStatus a2u18 left_battle
																						and ! I_IsUnitRouting a2u18
																						unit_deploy_stakes a2u18
																					end_if

																					if I_CompareCounter enemy_unit_count > 18
																						if ! I_UnitDestroyed a2u19
																							and ! I_UnitStatus a2u19 left_battle
																							and ! I_IsUnitRouting a2u19
																							unit_deploy_stakes a2u19
																						end_if

																						if I_CompareCounter enemy_unit_count = 20
																							if ! I_UnitDestroyed a2u20
																								and ! I_UnitStatus a2u20 left_battle
																								and ! I_IsUnitRouting a2u20
																								unit_deploy_stakes a2u20
																							end_if
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if

			battle_wait 0.5
			ai_active_set on
			set_counter stakes_on 0
		end_if
		battle_wait 1.5
	end_monitor

	monitor_event BattleDeploymentPhaseCommenced FactionIsLocal
		and I_BattlePlayerArmyIsAttacker
		and I_BattleIsSiegeBattle
		and I_CompareCounter panel_check = 1
		and I_CompareCounter label_ready = 1
		and I_BattlePlayerArmyNumberOfUnitCategory cavalry > 0
		and I_BattleEnemyArmyNumberOfUnitCategory cavalry = 0
		and I_BattleEnemyArmyNumberOfAttribute stakes > 0

		if I_CompareCounter enemy_unit_count > 0
			unit_deploy_stakes a2u1

			if I_CompareCounter enemy_unit_count > 1
				unit_deploy_stakes a2u2

				if I_CompareCounter enemy_unit_count > 2
					unit_deploy_stakes a2u3

					if I_CompareCounter enemy_unit_count > 3
						unit_deploy_stakes a2u4

						if I_CompareCounter enemy_unit_count > 4
							unit_deploy_stakes a2u5

							if I_CompareCounter enemy_unit_count > 5
								unit_deploy_stakes a2u6

								if I_CompareCounter enemy_unit_count > 6
									unit_deploy_stakes a2u7

									if I_CompareCounter enemy_unit_count > 7
										unit_deploy_stakes a2u8

										if I_CompareCounter enemy_unit_count > 8
											unit_deploy_stakes a2u9

											if I_CompareCounter enemy_unit_count > 9
												unit_deploy_stakes a2u10

												if I_CompareCounter enemy_unit_count > 10
													unit_deploy_stakes a2u11

													if I_CompareCounter enemy_unit_count > 11
														unit_deploy_stakes a2u12

														if I_CompareCounter enemy_unit_count > 12
															unit_deploy_stakes a2u13

															if I_CompareCounter enemy_unit_count > 13
																unit_deploy_stakes a2u14

																if I_CompareCounter enemy_unit_count > 14
																	unit_deploy_stakes a2u15

																	if I_CompareCounter enemy_unit_count > 15
																		unit_deploy_stakes a2u16

																		if I_CompareCounter enemy_unit_count > 16
																			unit_deploy_stakes a2u17

																			if I_CompareCounter enemy_unit_count > 17
																				unit_deploy_stakes a2u18

																				if I_CompareCounter enemy_unit_count > 18
																					unit_deploy_stakes a2u19

																					if I_CompareCounter enemy_unit_count = 20
																						unit_deploy_stakes a2u20
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if

		battle_wait 0.5
		ai_active_set on
		set_counter label_ready 0
	end_monitor

	;;;;;;;;HA fix;;;;;;;;;;;;

	;monitor_conditions I_BattleStarted
	;    and I_CompareCounter ha_fix = 1
	;    and I_CompareCounter open_battle = 1
	;    and I_BattlePlayerArmyIsAttacker
	;    and ! I_BattleAiAttacking
	;    and I_BattleEnemyArmyPercentageOfUnitCategory cavalry > 60
	;    and I_UnitEnemyUnitInRadius a2u1 250
	;    ai_gta_plan_set 1 ATTACK_ALL
	;    set_counter ha_fix 0
	;    set_counter ob_defense_launch 0
	;    set_counter ob_defend 4
	;end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter ha_fix = 1
		and I_CompareCounter open_battle = 1
		and ! I_BattlePlayerArmyIsAttacker
		and ! I_BattleAiAttacking
		;	and I_BattleEnemyArmyPercentageOfUnitCategory cavalry > 60

		ai_gta_plan_set 0 ATTACK_ALL
		set_counter apply_strategy 1
		set_counter ha_fix 0
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter ha_fix = 1
		and I_BattleIsRiverBattle
		and ! I_BattlePlayerArmyIsAttacker
		and ! I_BattleAiAssaultingCrossing
		;	and I_BattleEnemyArmyPercentageOfUnitCategory cavalry >= 60

		ai_gta_add_objective 0 ASSAULT_CROSSING 999

		;    ai_active_set off

		if I_CompareCounter enemy_unit_count > 0
			ai_gta_add_unit_label 0 0 a1u1

			if I_CompareCounter enemy_unit_count > 1
				ai_gta_add_unit_label 0 0 a1u2

				if I_CompareCounter enemy_unit_count > 2
					ai_gta_add_unit_label 0 0 a1u3

					if I_CompareCounter enemy_unit_count > 3
						ai_gta_add_unit_label 0 0 a1u4

						if I_CompareCounter enemy_unit_count > 4
							ai_gta_add_unit_label 0 0 a1u5

							if I_CompareCounter enemy_unit_count > 5
								ai_gta_add_unit_label 0 0 a1u6

								if I_CompareCounter enemy_unit_count > 6
									ai_gta_add_unit_label 0 0 a1u7

									if I_CompareCounter enemy_unit_count > 7
										ai_gta_add_unit_label 0 0 a1u8

										if I_CompareCounter enemy_unit_count > 8
											ai_gta_add_unit_label 0 0 a1u9

											if I_CompareCounter enemy_unit_count > 9
												ai_gta_add_unit_label 0 0 a1u10

												if I_CompareCounter enemy_unit_count > 10
													ai_gta_add_unit_label 0 0 a1u11

													if I_CompareCounter enemy_unit_count > 11
														ai_gta_add_unit_label 0 0 a1u12

														if I_CompareCounter enemy_unit_count > 12
															ai_gta_add_unit_label 0 0 a1u13

															if I_CompareCounter enemy_unit_count > 13
																ai_gta_add_unit_label 0 0 a1u14

																if I_CompareCounter enemy_unit_count > 14
																	ai_gta_add_unit_label 0 0 a1u15

																	if I_CompareCounter enemy_unit_count > 15
																		ai_gta_add_unit_label 0 0 a1u16

																		if I_CompareCounter enemy_unit_count > 16
																			ai_gta_add_unit_label 0 0 a1u17

																			if I_CompareCounter enemy_unit_count > 17
																				ai_gta_add_unit_label 0 0 a1u18

																				if I_CompareCounter enemy_unit_count > 18
																					ai_gta_add_unit_label 0 0 a1u19

																					if I_CompareCounter enemy_unit_count = 20
																						ai_gta_add_unit_label 0 0 a1u20
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if
		battle_wait 0.5
		ai_active_set on

		set_counter ha_fix 0
	end_monitor

	;;;;;;;;Elephant;;;;;;;;;;;;

	monitor_conditions I_BattleStarted
		and I_CompareCounter elephant_fix = 1
		and I_BattleIsSiegeBattle
		and ! I_BattleIsFortBattle
		and ! I_BattlePlayerArmyIsAttacker
		and I_IsBattleSettlementCastle
		and I_BattleEnemyArmyNumberOfMountClass elephant > 0

		ai_gta_add_objective 0 ATTACK_ENEMY_BATTLEGROUP 999
		;    ai_active_set off

		if I_CompareCounter enemy_unit_count > 0
			if I_UnitFormation a1u1 = horde
				and ! I_UnitStatus a1u1 running_amok
				and ! I_UnitDestroyed a1u1
				and ! I_UnitStatus a1u1 left_battle
				and ! I_IsUnitRouting a1u1
				ai_gta_add_unit_label 0 0 a1u1
			end_if

			if I_CompareCounter enemy_unit_count > 1
				if I_UnitFormation a1u2 = horde
					and ! I_UnitStatus a1u2 running_amok
					and ! I_UnitDestroyed a1u2
					and ! I_UnitStatus a1u2 left_battle
					and ! I_IsUnitRouting a1u2
					ai_gta_add_unit_label 0 0 a1u2
				end_if

				if I_CompareCounter enemy_unit_count > 2
					if I_UnitFormation a1u3 = horde
						and ! I_UnitStatus a1u3 running_amok
						and ! I_UnitDestroyed a1u3
						and ! I_UnitStatus a1u3 left_battle
						and ! I_IsUnitRouting a1u3
						ai_gta_add_unit_label 0 0 a1u3
					end_if

					if I_CompareCounter enemy_unit_count > 3
						if I_UnitFormation a1u4 = horde
							and ! I_UnitStatus a1u4 running_amok
							and ! I_UnitDestroyed a1u4
							and ! I_UnitStatus a1u4 left_battle
							and ! I_IsUnitRouting a1u4
							ai_gta_add_unit_label 0 0 a1u4
						end_if

						if I_CompareCounter enemy_unit_count > 4
							if I_UnitFormation a1u5 = horde
								and ! I_UnitStatus a1u5 running_amok
								and ! I_UnitDestroyed a1u5
								and ! I_UnitStatus a1u5 left_battle
								and ! I_IsUnitRouting a1u5
								ai_gta_add_unit_label 0 0 a1u5
							end_if

							if I_CompareCounter enemy_unit_count > 5
								if I_UnitFormation a1u6 = horde
									and ! I_UnitStatus a1u6 running_amok
									and ! I_UnitDestroyed a1u6
									and ! I_UnitStatus a1u6 left_battle
									and ! I_IsUnitRouting a1u6
									ai_gta_add_unit_label 0 0 a1u6
								end_if

								if I_CompareCounter enemy_unit_count > 6
									if I_UnitFormation a1u7 = horde
										and ! I_UnitStatus a1u7 running_amok
										and ! I_UnitDestroyed a1u7
										and ! I_UnitStatus a1u7 left_battle
										and ! I_IsUnitRouting a1u7
										ai_gta_add_unit_label 0 0 a1u7
									end_if

									if I_CompareCounter enemy_unit_count > 7
										if I_UnitFormation a1u8 = horde
											and ! I_UnitStatus a1u8 running_amok
											and ! I_UnitDestroyed a1u8
											and ! I_UnitStatus a1u8 left_battle
											and ! I_IsUnitRouting a1u8
											ai_gta_add_unit_label 0 0 a1u8
										end_if

										if I_CompareCounter enemy_unit_count > 8
											if I_UnitFormation a1u9 = horde
												and ! I_UnitStatus a1u9 running_amok
												and ! I_UnitDestroyed a1u9
												and ! I_UnitStatus a1u9 left_battle
												and ! I_IsUnitRouting a1u9
												ai_gta_add_unit_label 0 0 a1u9
											end_if

											if I_CompareCounter enemy_unit_count > 9
												if I_UnitFormation a1u10 = horde
													and ! I_UnitStatus a1u10 running_amok
													and ! I_UnitDestroyed a1u10
													and ! I_UnitStatus a1u10 left_battle
													and ! I_IsUnitRouting a1u10
													ai_gta_add_unit_label 0 0 a1u10
												end_if

												if I_CompareCounter enemy_unit_count > 10
													if I_UnitFormation a1u11 = horde
														and ! I_UnitStatus a1u11 running_amok
														and ! I_UnitDestroyed a1u11
														and ! I_UnitStatus a1u11 left_battle
														and ! I_IsUnitRouting a1u11
														ai_gta_add_unit_label 0 0 a1u11
													end_if

													if I_CompareCounter enemy_unit_count > 11
														if I_UnitFormation a1u12 = horde
															and ! I_UnitStatus a1u12 running_amok
															and ! I_UnitDestroyed a1u12
															and ! I_UnitStatus a1u12 left_battle
															and ! I_IsUnitRouting a1u12
															ai_gta_add_unit_label 0 0 a1u12
														end_if

														if I_CompareCounter enemy_unit_count > 12
															if I_UnitFormation a1u13 = horde
																and ! I_UnitStatus a1u13 running_amok
																and ! I_UnitDestroyed a1u13
																and ! I_UnitStatus a1u13 left_battle
																and ! I_IsUnitRouting a1u13
																ai_gta_add_unit_label 0 0 a1u13
															end_if

															if I_CompareCounter enemy_unit_count > 13
																if I_UnitFormation a1u14 = horde
																	and ! I_UnitStatus a1u14 running_amok
																	and ! I_UnitDestroyed a1u14
																	and ! I_UnitStatus a1u14 left_battle
																	and ! I_IsUnitRouting a1u14
																	ai_gta_add_unit_label 0 0 a1u14
																end_if

																if I_CompareCounter enemy_unit_count > 14
																	if I_UnitFormation a1u15 = horde
																		and ! I_UnitStatus a1u15 running_amok
																		and ! I_UnitDestroyed a1u15
																		and ! I_UnitStatus a1u15 left_battle
																		and ! I_IsUnitRouting a1u15
																		ai_gta_add_unit_label 0 0 a1u15
																	end_if

																	if I_CompareCounter enemy_unit_count > 15
																		if I_UnitFormation a1u16 = horde
																			and ! I_UnitStatus a1u16 running_amok
																			and ! I_UnitDestroyed a1u16
																			and ! I_UnitStatus a1u16 left_battle
																			and ! I_IsUnitRouting a1u16
																			ai_gta_add_unit_label 0 0 a1u16
																		end_if

																		if I_CompareCounter enemy_unit_count > 16
																			if I_UnitFormation a1u17 = horde
																				and ! I_UnitStatus a1u17 running_amok
																				and ! I_UnitDestroyed a1u17
																				and ! I_UnitStatus a1u17 left_battle
																				and ! I_IsUnitRouting a1u17
																				ai_gta_add_unit_label 0 0 a1u17
																			end_if

																			if I_CompareCounter enemy_unit_count > 17
																				if I_UnitFormation a1u18 = horde
																					and ! I_UnitStatus a1u18 running_amok
																					and ! I_UnitDestroyed a1u18
																					and ! I_UnitStatus a1u18 left_battle
																					and ! I_IsUnitRouting a1u18
																					ai_gta_add_unit_label 0 0 a1u18
																				end_if

																				if I_CompareCounter enemy_unit_count > 18
																					if I_UnitFormation a1u19 = horde
																						and ! I_UnitStatus a1u19 running_amok
																						and ! I_UnitDestroyed a1u19
																						and ! I_UnitStatus a1u19 left_battle
																						and ! I_IsUnitRouting a1u19
																						ai_gta_add_unit_label 0 0 a1u19
																					end_if

																					if I_CompareCounter enemy_unit_count = 20
																						if I_UnitFormation a1u20 = horde
																							and ! I_UnitStatus a1u20 running_amok
																							and ! I_UnitDestroyed a1u20
																							and ! I_UnitStatus a1u20 left_battle
																							and ! I_IsUnitRouting a1u20
																							ai_gta_add_unit_label 0 0 a1u20
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if

		battle_wait 0.5
		ai_active_set on
		set_counter elephant_gate 1
		set_counter elephant_fix 0
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter elephant_fix = 1
		and I_BattleIsSiegeBattle
		and ! I_BattleIsFortBattle
		and ! I_BattlePlayerArmyIsAttacker
		and ! I_IsBattleSettlementCastle
		and I_BattleEnemyArmyNumberOfMountClass elephant > 0

		ai_gta_add_objective 0 ATTACK_ENEMY_BATTLEGROUP 999
		;    ai_active_set off
		unit_group_order_halt army1

		if I_CompareCounter enemy_unit_count > 0
			if I_UnitFormation a1u1 = horde
				and ! I_UnitStatus a1u1 running_amok
				and ! I_UnitDestroyed a1u1
				and ! I_UnitStatus a1u1 left_battle
				and ! I_IsUnitRouting a1u1
				ai_gta_add_unit_label 0 0 a1u1
			end_if

			if I_CompareCounter enemy_unit_count > 1
				if I_UnitFormation a1u2 = horde
					and ! I_UnitStatus a1u2 running_amok
					and ! I_UnitDestroyed a1u2
					and ! I_UnitStatus a1u2 left_battle
					and ! I_IsUnitRouting a1u2
					ai_gta_add_unit_label 0 0 a1u2
				end_if

				if I_CompareCounter enemy_unit_count > 2
					if I_UnitFormation a1u3 = horde
						and ! I_UnitStatus a1u3 running_amok
						and ! I_UnitDestroyed a1u3
						and ! I_UnitStatus a1u3 left_battle
						and ! I_IsUnitRouting a1u3
						ai_gta_add_unit_label 0 0 a1u3
					end_if

					if I_CompareCounter enemy_unit_count > 3
						if I_UnitFormation a1u4 = horde
							and ! I_UnitStatus a1u4 running_amok
							and ! I_UnitDestroyed a1u4
							and ! I_UnitStatus a1u4 left_battle
							and ! I_IsUnitRouting a1u4
							ai_gta_add_unit_label 0 0 a1u4
						end_if

						if I_CompareCounter enemy_unit_count > 4
							if I_UnitFormation a1u5 = horde
								and ! I_UnitStatus a1u5 running_amok
								and ! I_UnitDestroyed a1u5
								and ! I_UnitStatus a1u5 left_battle
								and ! I_IsUnitRouting a1u5
								ai_gta_add_unit_label 0 0 a1u5
							end_if

							if I_CompareCounter enemy_unit_count > 5
								if I_UnitFormation a1u6 = horde
									and ! I_UnitStatus a1u6 running_amok
									and ! I_UnitDestroyed a1u6
									and ! I_UnitStatus a1u6 left_battle
									and ! I_IsUnitRouting a1u6
									ai_gta_add_unit_label 0 0 a1u6
								end_if

								if I_CompareCounter enemy_unit_count > 6
									if I_UnitFormation a1u7 = horde
										and ! I_UnitStatus a1u7 running_amok
										and ! I_UnitDestroyed a1u7
										and ! I_UnitStatus a1u7 left_battle
										and ! I_IsUnitRouting a1u7
										ai_gta_add_unit_label 0 0 a1u7
									end_if

									if I_CompareCounter enemy_unit_count > 7
										if I_UnitFormation a1u8 = horde
											and ! I_UnitStatus a1u8 running_amok
											and ! I_UnitDestroyed a1u8
											and ! I_UnitStatus a1u8 left_battle
											and ! I_IsUnitRouting a1u8
											ai_gta_add_unit_label 0 0 a1u8
										end_if

										if I_CompareCounter enemy_unit_count > 8
											if I_UnitFormation a1u9 = horde
												and ! I_UnitStatus a1u9 running_amok
												and ! I_UnitDestroyed a1u9
												and ! I_UnitStatus a1u9 left_battle
												and ! I_IsUnitRouting a1u9
												ai_gta_add_unit_label 0 0 a1u9
											end_if

											if I_CompareCounter enemy_unit_count > 9
												if I_UnitFormation a1u10 = horde
													and ! I_UnitStatus a1u10 running_amok
													and ! I_UnitDestroyed a1u10
													and ! I_UnitStatus a1u10 left_battle
													and ! I_IsUnitRouting a1u10
													ai_gta_add_unit_label 0 0 a1u10
												end_if

												if I_CompareCounter enemy_unit_count > 10
													if I_UnitFormation a1u11 = horde
														and ! I_UnitStatus a1u11 running_amok
														and ! I_UnitDestroyed a1u11
														and ! I_UnitStatus a1u11 left_battle
														and ! I_IsUnitRouting a1u11
														ai_gta_add_unit_label 0 0 a1u11
													end_if

													if I_CompareCounter enemy_unit_count > 11
														if I_UnitFormation a1u12 = horde
															and ! I_UnitStatus a1u12 running_amok
															and ! I_UnitDestroyed a1u12
															and ! I_UnitStatus a1u12 left_battle
															and ! I_IsUnitRouting a1u12
															ai_gta_add_unit_label 0 0 a1u12
														end_if

														if I_CompareCounter enemy_unit_count > 12
															if I_UnitFormation a1u13 = horde
																and ! I_UnitStatus a1u13 running_amok
																and ! I_UnitDestroyed a1u13
																and ! I_UnitStatus a1u13 left_battle
																and ! I_IsUnitRouting a1u13
																ai_gta_add_unit_label 0 0 a1u13
															end_if

															if I_CompareCounter enemy_unit_count > 13
																if I_UnitFormation a1u14 = horde
																	and ! I_UnitStatus a1u14 running_amok
																	and ! I_UnitDestroyed a1u14
																	and ! I_UnitStatus a1u14 left_battle
																	and ! I_IsUnitRouting a1u14
																	ai_gta_add_unit_label 0 0 a1u14
																end_if

																if I_CompareCounter enemy_unit_count > 14
																	if I_UnitFormation a1u15 = horde
																		and ! I_UnitStatus a1u15 running_amok
																		and ! I_UnitDestroyed a1u15
																		and ! I_UnitStatus a1u15 left_battle
																		and ! I_IsUnitRouting a1u15
																		ai_gta_add_unit_label 0 0 a1u15
																	end_if

																	if I_CompareCounter enemy_unit_count > 15
																		if I_UnitFormation a1u16 = horde
																			and ! I_UnitStatus a1u16 running_amok
																			and ! I_UnitDestroyed a1u16
																			and ! I_UnitStatus a1u16 left_battle
																			and ! I_IsUnitRouting a1u16
																			ai_gta_add_unit_label 0 0 a1u16
																		end_if

																		if I_CompareCounter enemy_unit_count > 16
																			if I_UnitFormation a1u17 = horde
																				and ! I_UnitStatus a1u17 running_amok
																				and ! I_UnitDestroyed a1u17
																				and ! I_UnitStatus a1u17 left_battle
																				and ! I_IsUnitRouting a1u17
																				ai_gta_add_unit_label 0 0 a1u17
																			end_if

																			if I_CompareCounter enemy_unit_count > 17
																				if I_UnitFormation a1u18 = horde
																					and ! I_UnitStatus a1u18 running_amok
																					and ! I_UnitDestroyed a1u18
																					and ! I_UnitStatus a1u18 left_battle
																					and ! I_IsUnitRouting a1u18
																					ai_gta_add_unit_label 0 0 a1u18
																				end_if

																				if I_CompareCounter enemy_unit_count > 18
																					if I_UnitFormation a1u19 = horde
																						and ! I_UnitStatus a1u19 running_amok
																						and ! I_UnitDestroyed a1u19
																						and ! I_UnitStatus a1u19 left_battle
																						and ! I_IsUnitRouting a1u19
																						ai_gta_add_unit_label 0 0 a1u19
																					end_if

																					if I_CompareCounter enemy_unit_count = 20
																						if I_UnitFormation a1u20 = horde
																							and ! I_UnitStatus a1u20 running_amok
																							and ! I_UnitDestroyed a1u20
																							and ! I_UnitStatus a1u20 left_battle
																							and ! I_IsUnitRouting a1u20
																							ai_gta_add_unit_label 0 0 a1u20
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if

		unit_group_order_halt army1
		battle_wait 0.5
		unit_group_order_change_group_formation army1 ai_wall_assault
		battle_wait 0.5
		ai_active_set on
		set_counter elephant_gate 1
		set_counter elephant_fix 0
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter elephant_fix = 1
		and I_BattleIsSiegeBattle
		and I_BattleIsFortBattle
		and ! I_BattlePlayerArmyIsAttacker
		and I_BattleEnemyArmyNumberOfMountClass elephant > 0

		ai_gta_add_objective 0 ATTACK_ENEMY_BATTLEGROUP 999
		;    ai_active_set off

		if I_CompareCounter enemy_unit_count > 0
			if I_UnitFormation a1u1 = horde
				and ! I_UnitStatus a1u1 running_amok
				and ! I_UnitDestroyed a1u1
				and ! I_UnitStatus a1u1 left_battle
				and ! I_IsUnitRouting a1u1
				ai_gta_add_unit_label 0 0 a1u1
			end_if

			if I_CompareCounter enemy_unit_count > 1
				if I_UnitFormation a1u2 = horde
					and ! I_UnitStatus a1u2 running_amok
					and ! I_UnitDestroyed a1u2
					and ! I_UnitStatus a1u2 left_battle
					and ! I_IsUnitRouting a1u2
					ai_gta_add_unit_label 0 0 a1u2
				end_if

				if I_CompareCounter enemy_unit_count > 2
					if I_UnitFormation a1u3 = horde
						and ! I_UnitStatus a1u3 running_amok
						and ! I_UnitDestroyed a1u3
						and ! I_UnitStatus a1u3 left_battle
						and ! I_IsUnitRouting a1u3
						ai_gta_add_unit_label 0 0 a1u3
					end_if

					if I_CompareCounter enemy_unit_count > 3
						if I_UnitFormation a1u4 = horde
							and ! I_UnitStatus a1u4 running_amok
							and ! I_UnitDestroyed a1u4
							and ! I_UnitStatus a1u4 left_battle
							and ! I_IsUnitRouting a1u4
							ai_gta_add_unit_label 0 0 a1u4
						end_if

						if I_CompareCounter enemy_unit_count > 4
							if I_UnitFormation a1u5 = horde
								and ! I_UnitStatus a1u5 running_amok
								and ! I_UnitDestroyed a1u5
								and ! I_UnitStatus a1u5 left_battle
								and ! I_IsUnitRouting a1u5
								ai_gta_add_unit_label 0 0 a1u5
							end_if

							if I_CompareCounter enemy_unit_count > 5
								if I_UnitFormation a1u6 = horde
									and ! I_UnitStatus a1u6 running_amok
									and ! I_UnitDestroyed a1u6
									and ! I_UnitStatus a1u6 left_battle
									and ! I_IsUnitRouting a1u6
									ai_gta_add_unit_label 0 0 a1u6
								end_if

								if I_CompareCounter enemy_unit_count > 6
									if I_UnitFormation a1u7 = horde
										and ! I_UnitStatus a1u7 running_amok
										and ! I_UnitDestroyed a1u7
										and ! I_UnitStatus a1u7 left_battle
										and ! I_IsUnitRouting a1u7
										ai_gta_add_unit_label 0 0 a1u7
									end_if

									if I_CompareCounter enemy_unit_count > 7
										if I_UnitFormation a1u8 = horde
											and ! I_UnitStatus a1u8 running_amok
											and ! I_UnitDestroyed a1u8
											and ! I_UnitStatus a1u8 left_battle
											and ! I_IsUnitRouting a1u8
											ai_gta_add_unit_label 0 0 a1u8
										end_if

										if I_CompareCounter enemy_unit_count > 8
											if I_UnitFormation a1u9 = horde
												and ! I_UnitStatus a1u9 running_amok
												and ! I_UnitDestroyed a1u9
												and ! I_UnitStatus a1u9 left_battle
												and ! I_IsUnitRouting a1u9
												ai_gta_add_unit_label 0 0 a1u9
											end_if

											if I_CompareCounter enemy_unit_count > 9
												if I_UnitFormation a1u10 = horde
													and ! I_UnitStatus a1u10 running_amok
													and ! I_UnitDestroyed a1u10
													and ! I_UnitStatus a1u10 left_battle
													and ! I_IsUnitRouting a1u10
													ai_gta_add_unit_label 0 0 a1u10
												end_if

												if I_CompareCounter enemy_unit_count > 10
													if I_UnitFormation a1u11 = horde
														and ! I_UnitStatus a1u11 running_amok
														and ! I_UnitDestroyed a1u11
														and ! I_UnitStatus a1u11 left_battle
														and ! I_IsUnitRouting a1u11
														ai_gta_add_unit_label 0 0 a1u11
													end_if

													if I_CompareCounter enemy_unit_count > 11
														if I_UnitFormation a1u12 = horde
															and ! I_UnitStatus a1u12 running_amok
															and ! I_UnitDestroyed a1u12
															and ! I_UnitStatus a1u12 left_battle
															and ! I_IsUnitRouting a1u12
															ai_gta_add_unit_label 0 0 a1u12
														end_if

														if I_CompareCounter enemy_unit_count > 12
															if I_UnitFormation a1u13 = horde
																and ! I_UnitStatus a1u13 running_amok
																and ! I_UnitDestroyed a1u13
																and ! I_UnitStatus a1u13 left_battle
																and ! I_IsUnitRouting a1u13
																ai_gta_add_unit_label 0 0 a1u13
															end_if

															if I_CompareCounter enemy_unit_count > 13
																if I_UnitFormation a1u14 = horde
																	and ! I_UnitStatus a1u14 running_amok
																	and ! I_UnitDestroyed a1u14
																	and ! I_UnitStatus a1u14 left_battle
																	and ! I_IsUnitRouting a1u14
																	ai_gta_add_unit_label 0 0 a1u14
																end_if

																if I_CompareCounter enemy_unit_count > 14
																	if I_UnitFormation a1u15 = horde
																		and ! I_UnitStatus a1u15 running_amok
																		and ! I_UnitDestroyed a1u15
																		and ! I_UnitStatus a1u15 left_battle
																		and ! I_IsUnitRouting a1u15
																		ai_gta_add_unit_label 0 0 a1u15
																	end_if

																	if I_CompareCounter enemy_unit_count > 15
																		if I_UnitFormation a1u16 = horde
																			and ! I_UnitStatus a1u16 running_amok
																			and ! I_UnitDestroyed a1u16
																			and ! I_UnitStatus a1u16 left_battle
																			and ! I_IsUnitRouting a1u16
																			ai_gta_add_unit_label 0 0 a1u16
																		end_if

																		if I_CompareCounter enemy_unit_count > 16
																			if I_UnitFormation a1u17 = horde
																				and ! I_UnitStatus a1u17 running_amok
																				and ! I_UnitDestroyed a1u17
																				and ! I_UnitStatus a1u17 left_battle
																				and ! I_IsUnitRouting a1u17
																				ai_gta_add_unit_label 0 0 a1u17
																			end_if

																			if I_CompareCounter enemy_unit_count > 17
																				if I_UnitFormation a1u18 = horde
																					and ! I_UnitStatus a1u18 running_amok
																					and ! I_UnitDestroyed a1u18
																					and ! I_UnitStatus a1u18 left_battle
																					and ! I_IsUnitRouting a1u18
																					ai_gta_add_unit_label 0 0 a1u18
																				end_if

																				if I_CompareCounter enemy_unit_count > 18
																					if I_UnitFormation a1u19 = horde
																						and ! I_UnitStatus a1u19 running_amok
																						and ! I_UnitDestroyed a1u19
																						and ! I_UnitStatus a1u19 left_battle
																						and ! I_IsUnitRouting a1u19
																						ai_gta_add_unit_label 0 0 a1u19
																					end_if

																					if I_CompareCounter enemy_unit_count = 20
																						if I_UnitFormation a1u20 = horde
																							and ! I_UnitStatus a1u20 running_amok
																							and ! I_UnitDestroyed a1u20
																							and ! I_UnitStatus a1u20 left_battle
																							and ! I_IsUnitRouting a1u20
																							ai_gta_add_unit_label 0 0 a1u20
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if

		battle_wait 0.5
		ai_active_set on
		set_counter elephant_gate 1
		set_counter elephant_fix 0
	end_monitor

	monitor_event BattleEnemyUnitAttacksPlayerUnit TrueCondition
		and I_CompareCounter panel_check = 1
		and I_CompareCounter rally_walls = 1
		and BattleIsMeleeAttack
		and ! BattlePlayerUnitOnWalls
		and ! BattleEnemyUnitOnWalls

		if I_CompareCounter elephant_gate != 2
			set_counter elephant_gate 0
			set_counter del_objective 1
		end_if
		set_counter elephant_fix_check 1
		set_counter rally_walls 3
		;	battle_wait 180
		battle_wait 30
		if I_CompareCounter rally_walls = 3
			and I_CompareCounter elephant_fix_check = 1
			set_counter elephant_fix_check 2
			battle_wait 30
			if I_CompareCounter rally_walls = 3
				and I_CompareCounter elephant_fix_check = 2
				set_counter elephant_fix_check 3
				battle_wait 30
				if I_CompareCounter rally_walls = 3
					and I_CompareCounter elephant_fix_check = 3
					set_counter elephant_fix_check 4
					battle_wait 30
					if I_CompareCounter rally_walls = 3
						and I_CompareCounter elephant_fix_check = 4
						set_counter elephant_fix_check 5
						battle_wait 30
						if I_CompareCounter rally_walls = 3
							and I_CompareCounter elephant_fix_check = 5
							set_counter elephant_fix_check 6
							battle_wait 30
							if I_CompareCounter rally_walls = 3
								and I_CompareCounter elephant_fix_check = 6
								set_counter elephant_gate_tier2 1
								set_counter rally_walls 0
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if
	end_monitor

	monitor_event BattlePlayerUnitAttacksEnemyUnit BattleIsMeleeAttack
		and I_CompareCounter panel_check = 1
		and I_CompareCounter rally_walls = 1
		and ! BattlePlayerUnitOnWalls
		and ! BattleEnemyUnitOnWalls

		if I_CompareCounter elephant_gate != 2
			set_counter elephant_gate 0
			set_counter del_objective 1
		end_if
		set_counter elephant_fix_check 1
		set_counter rally_walls 3
		;	battle_wait 180
		battle_wait 30
		if I_CompareCounter rally_walls = 3
			and I_CompareCounter elephant_fix_check = 1
			set_counter elephant_fix_check 2
			battle_wait 30
			if I_CompareCounter rally_walls = 3
				and I_CompareCounter elephant_fix_check = 2
				set_counter elephant_fix_check 3
				battle_wait 30
				if I_CompareCounter rally_walls = 3
					and I_CompareCounter elephant_fix_check = 3
					set_counter elephant_fix_check 4
					battle_wait 30
					if I_CompareCounter rally_walls = 3
						and I_CompareCounter elephant_fix_check = 4
						set_counter elephant_fix_check 5
						battle_wait 30
						if I_CompareCounter rally_walls = 3
							and I_CompareCounter elephant_fix_check = 5
							set_counter elephant_fix_check 6
							battle_wait 30
							if I_CompareCounter rally_walls = 3
								and I_CompareCounter elephant_fix_check = 6
								set_counter elephant_gate_tier2 1
								set_counter rally_walls 0
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter del_objective = 1
		and I_BattleIsSiegeBattle
		and ! I_BattlePlayerArmyIsAttacker
		and I_BattleEnemyArmyNumberOfMountClass elephant > 0

		set_counter del_objective 2
		battle_wait 15
		if I_CompareCounter del_objective = 2
			ai_gta_del_objective 0
			ai_active_set off
			battle_wait 0.5
			ai_active_set on
			set_counter del_objective 0
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter elephant_gate_tier2 = 1
		and ! I_BattleIsFortBattle
		and I_BattleIsSiegeBattle
		and I_IsBattleSettlementCastle
		and I_BattleSettlementFortificationLevel > 2

		ai_gta_add_objective 0 ATTACK_ENEMY_BATTLEGROUP 999

		if I_CompareCounter enemy_unit_count > 0
			if I_UnitFormation a1u1 = horde
				and ! I_UnitStatus a1u1 running_amok
				and ! I_UnitDestroyed a1u1
				and ! I_UnitStatus a1u1 left_battle
				and ! I_IsUnitRouting a1u1
				ai_gta_add_unit_label 0 0 a1u1
			end_if

			if I_CompareCounter enemy_unit_count > 1
				if I_UnitFormation a1u2 = horde
					and ! I_UnitStatus a1u2 running_amok
					and ! I_UnitDestroyed a1u2
					and ! I_UnitStatus a1u2 left_battle
					and ! I_IsUnitRouting a1u2
					ai_gta_add_unit_label 0 0 a1u2
				end_if

				if I_CompareCounter enemy_unit_count > 2
					if I_UnitFormation a1u3 = horde
						and ! I_UnitStatus a1u3 running_amok
						and ! I_UnitDestroyed a1u3
						and ! I_UnitStatus a1u3 left_battle
						and ! I_IsUnitRouting a1u3
						ai_gta_add_unit_label 0 0 a1u3
					end_if

					if I_CompareCounter enemy_unit_count > 3
						if I_UnitFormation a1u4 = horde
							and ! I_UnitStatus a1u4 running_amok
							and ! I_UnitDestroyed a1u4
							and ! I_UnitStatus a1u4 left_battle
							and ! I_IsUnitRouting a1u4
							ai_gta_add_unit_label 0 0 a1u4
						end_if

						if I_CompareCounter enemy_unit_count > 4
							if I_UnitFormation a1u5 = horde
								and ! I_UnitStatus a1u5 running_amok
								and ! I_UnitDestroyed a1u5
								and ! I_UnitStatus a1u5 left_battle
								and ! I_IsUnitRouting a1u5
								ai_gta_add_unit_label 0 0 a1u5
							end_if

							if I_CompareCounter enemy_unit_count > 5
								if I_UnitFormation a1u6 = horde
									and ! I_UnitStatus a1u6 running_amok
									and ! I_UnitDestroyed a1u6
									and ! I_UnitStatus a1u6 left_battle
									and ! I_IsUnitRouting a1u6
									ai_gta_add_unit_label 0 0 a1u6
								end_if

								if I_CompareCounter enemy_unit_count > 6
									if I_UnitFormation a1u7 = horde
										and ! I_UnitStatus a1u7 running_amok
										and ! I_UnitDestroyed a1u7
										and ! I_UnitStatus a1u7 left_battle
										and ! I_IsUnitRouting a1u7
										ai_gta_add_unit_label 0 0 a1u7
									end_if

									if I_CompareCounter enemy_unit_count > 7
										if I_UnitFormation a1u8 = horde
											and ! I_UnitStatus a1u8 running_amok
											and ! I_UnitDestroyed a1u8
											and ! I_UnitStatus a1u8 left_battle
											and ! I_IsUnitRouting a1u8
											ai_gta_add_unit_label 0 0 a1u8
										end_if

										if I_CompareCounter enemy_unit_count > 8
											if I_UnitFormation a1u9 = horde
												and ! I_UnitStatus a1u9 running_amok
												and ! I_UnitDestroyed a1u9
												and ! I_UnitStatus a1u9 left_battle
												and ! I_IsUnitRouting a1u9
												ai_gta_add_unit_label 0 0 a1u9
											end_if

											if I_CompareCounter enemy_unit_count > 9
												if I_UnitFormation a1u10 = horde
													and ! I_UnitStatus a1u10 running_amok
													and ! I_UnitDestroyed a1u10
													and ! I_UnitStatus a1u10 left_battle
													and ! I_IsUnitRouting a1u10
													ai_gta_add_unit_label 0 0 a1u10
												end_if

												if I_CompareCounter enemy_unit_count > 10
													if I_UnitFormation a1u11 = horde
														and ! I_UnitStatus a1u11 running_amok
														and ! I_UnitDestroyed a1u11
														and ! I_UnitStatus a1u11 left_battle
														and ! I_IsUnitRouting a1u11
														ai_gta_add_unit_label 0 0 a1u11
													end_if

													if I_CompareCounter enemy_unit_count > 11
														if I_UnitFormation a1u12 = horde
															and ! I_UnitStatus a1u12 running_amok
															and ! I_UnitDestroyed a1u12
															and ! I_UnitStatus a1u12 left_battle
															and ! I_IsUnitRouting a1u12
															ai_gta_add_unit_label 0 0 a1u12
														end_if

														if I_CompareCounter enemy_unit_count > 12
															if I_UnitFormation a1u13 = horde
																and ! I_UnitStatus a1u13 running_amok
																and ! I_UnitDestroyed a1u13
																and ! I_UnitStatus a1u13 left_battle
																and ! I_IsUnitRouting a1u13
																ai_gta_add_unit_label 0 0 a1u13
															end_if

															if I_CompareCounter enemy_unit_count > 13
																if I_UnitFormation a1u14 = horde
																	and ! I_UnitStatus a1u14 running_amok
																	and ! I_UnitDestroyed a1u14
																	and ! I_UnitStatus a1u14 left_battle
																	and ! I_IsUnitRouting a1u14
																	ai_gta_add_unit_label 0 0 a1u14
																end_if

																if I_CompareCounter enemy_unit_count > 14
																	if I_UnitFormation a1u15 = horde
																		and ! I_UnitStatus a1u15 running_amok
																		and ! I_UnitDestroyed a1u15
																		and ! I_UnitStatus a1u15 left_battle
																		and ! I_IsUnitRouting a1u15
																		ai_gta_add_unit_label 0 0 a1u15
																	end_if

																	if I_CompareCounter enemy_unit_count > 15
																		if I_UnitFormation a1u16 = horde
																			and ! I_UnitStatus a1u16 running_amok
																			and ! I_UnitDestroyed a1u16
																			and ! I_UnitStatus a1u16 left_battle
																			and ! I_IsUnitRouting a1u16
																			ai_gta_add_unit_label 0 0 a1u16
																		end_if

																		if I_CompareCounter enemy_unit_count > 16
																			if I_UnitFormation a1u17 = horde
																				and ! I_UnitStatus a1u17 running_amok
																				and ! I_UnitDestroyed a1u17
																				and ! I_UnitStatus a1u17 left_battle
																				and ! I_IsUnitRouting a1u17
																				ai_gta_add_unit_label 0 0 a1u17
																			end_if

																			if I_CompareCounter enemy_unit_count > 17
																				if I_UnitFormation a1u18 = horde
																					and ! I_UnitStatus a1u18 running_amok
																					and ! I_UnitDestroyed a1u18
																					and ! I_UnitStatus a1u18 left_battle
																					and ! I_IsUnitRouting a1u18
																					ai_gta_add_unit_label 0 0 a1u18
																				end_if

																				if I_CompareCounter enemy_unit_count > 18
																					if I_UnitFormation a1u19 = horde
																						and ! I_UnitStatus a1u19 running_amok
																						and ! I_UnitDestroyed a1u19
																						and ! I_UnitStatus a1u19 left_battle
																						and ! I_IsUnitRouting a1u19
																						ai_gta_add_unit_label 0 0 a1u19
																					end_if

																					if I_CompareCounter enemy_unit_count = 20
																						if I_UnitFormation a1u20 = horde
																							and ! I_UnitStatus a1u20 running_amok
																							and ! I_UnitDestroyed a1u20
																							and ! I_UnitStatus a1u20 left_battle
																							and ! I_IsUnitRouting a1u20
																							ai_gta_add_unit_label 0 0 a1u20
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if

		battle_wait 0.5
		ai_active_set on
		set_counter second_ring 1
		set_counter elephant_gate_tier2 0
	end_monitor

	monitor_event BattleEnemyUnitAttacksPlayerUnit TrueCondition
		and I_CompareCounter panel_check = 1
		and I_CompareCounter rally_walls = 2
		and BattleIsMeleeAttack
		and ! BattlePlayerUnitOnWalls
		and ! BattleEnemyUnitOnWalls

		if I_CompareCounter second_ring != 2
			set_counter second_ring 0
			set_counter del_objective 1
		end_if
		set_counter elephant_fix_check 1
		set_counter rally_walls 4
		;	battle_wait 180
		battle_wait 30
		if I_CompareCounter rally_walls = 4
			and I_CompareCounter elephant_fix_check = 1
			set_counter elephant_fix_check 2
			battle_wait 30
			if I_CompareCounter rally_walls = 4
				and I_CompareCounter elephant_fix_check = 2
				set_counter elephant_fix_check 3
				battle_wait 30
				if I_CompareCounter rally_walls = 4
					and I_CompareCounter elephant_fix_check = 3
					set_counter elephant_fix_check 4
					battle_wait 30
					if I_CompareCounter rally_walls = 4
						and I_CompareCounter elephant_fix_check = 4
						set_counter elephant_fix_check 5
						battle_wait 30
						if I_CompareCounter rally_walls = 4
							and I_CompareCounter elephant_fix_check = 5
							set_counter elephant_fix_check 6
							battle_wait 30
							if I_CompareCounter rally_walls = 4
								and I_CompareCounter elephant_fix_check = 6
								set_counter elephant_gate_tier3 1
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if
	end_monitor

	monitor_event BattlePlayerUnitAttacksEnemyUnit BattleIsMeleeAttack
		and I_CompareCounter panel_check = 1
		and I_CompareCounter rally_walls = 2
		and ! BattlePlayerUnitOnWalls
		and ! BattleEnemyUnitOnWalls

		if I_CompareCounter second_ring != 2
			set_counter second_ring 0
			set_counter del_objective 1
		end_if
		set_counter elephant_fix_check 1
		set_counter rally_walls 4
		;	battle_wait 180
		battle_wait 30
		if I_CompareCounter rally_walls = 4
			and I_CompareCounter elephant_fix_check = 1
			set_counter elephant_fix_check 2
			battle_wait 30
			if I_CompareCounter rally_walls = 4
				and I_CompareCounter elephant_fix_check = 2
				set_counter elephant_fix_check 3
				battle_wait 30
				if I_CompareCounter rally_walls = 4
					and I_CompareCounter elephant_fix_check = 3
					set_counter elephant_fix_check 4
					battle_wait 30
					if I_CompareCounter rally_walls = 4
						and I_CompareCounter elephant_fix_check = 4
						set_counter elephant_fix_check 5
						battle_wait 30
						if I_CompareCounter rally_walls = 4
							and I_CompareCounter elephant_fix_check = 5
							set_counter elephant_fix_check 6
							battle_wait 30
							if I_CompareCounter rally_walls = 4
								and I_CompareCounter elephant_fix_check = 6
								set_counter elephant_gate_tier3 1
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter elephant_gate_tier3 = 1
		and I_IsBattleSettlementCastle
		and I_BattleSettlementFortificationLevel > 2

		ai_gta_add_objective 0 ATTACK_ENEMY_BATTLEGROUP 999

		if I_CompareCounter enemy_unit_count > 0
			if I_UnitFormation a1u1 = horde
				and ! I_UnitStatus a1u1 running_amok
				and ! I_UnitDestroyed a1u1
				and ! I_UnitStatus a1u1 left_battle
				and ! I_IsUnitRouting a1u1
				ai_gta_add_unit_label 0 0 a1u1
			end_if

			if I_CompareCounter enemy_unit_count > 1
				if I_UnitFormation a1u2 = horde
					and ! I_UnitStatus a1u2 running_amok
					and ! I_UnitDestroyed a1u2
					and ! I_UnitStatus a1u2 left_battle
					and ! I_IsUnitRouting a1u2
					ai_gta_add_unit_label 0 0 a1u2
				end_if

				if I_CompareCounter enemy_unit_count > 2
					if I_UnitFormation a1u3 = horde
						and ! I_UnitStatus a1u3 running_amok
						and ! I_UnitDestroyed a1u3
						and ! I_UnitStatus a1u3 left_battle
						and ! I_IsUnitRouting a1u3
						ai_gta_add_unit_label 0 0 a1u3
					end_if

					if I_CompareCounter enemy_unit_count > 3
						if I_UnitFormation a1u4 = horde
							and ! I_UnitStatus a1u4 running_amok
							and ! I_UnitDestroyed a1u4
							and ! I_UnitStatus a1u4 left_battle
							and ! I_IsUnitRouting a1u4
							ai_gta_add_unit_label 0 0 a1u4
						end_if

						if I_CompareCounter enemy_unit_count > 4
							if I_UnitFormation a1u5 = horde
								and ! I_UnitStatus a1u5 running_amok
								and ! I_UnitDestroyed a1u5
								and ! I_UnitStatus a1u5 left_battle
								and ! I_IsUnitRouting a1u5
								ai_gta_add_unit_label 0 0 a1u5
							end_if

							if I_CompareCounter enemy_unit_count > 5
								if I_UnitFormation a1u6 = horde
									and ! I_UnitStatus a1u6 running_amok
									and ! I_UnitDestroyed a1u6
									and ! I_UnitStatus a1u6 left_battle
									and ! I_IsUnitRouting a1u6
									ai_gta_add_unit_label 0 0 a1u6
								end_if

								if I_CompareCounter enemy_unit_count > 6
									if I_UnitFormation a1u7 = horde
										and ! I_UnitStatus a1u7 running_amok
										and ! I_UnitDestroyed a1u7
										and ! I_UnitStatus a1u7 left_battle
										and ! I_IsUnitRouting a1u7
										ai_gta_add_unit_label 0 0 a1u7
									end_if

									if I_CompareCounter enemy_unit_count > 7
										if I_UnitFormation a1u8 = horde
											and ! I_UnitStatus a1u8 running_amok
											and ! I_UnitDestroyed a1u8
											and ! I_UnitStatus a1u8 left_battle
											and ! I_IsUnitRouting a1u8
											ai_gta_add_unit_label 0 0 a1u8
										end_if

										if I_CompareCounter enemy_unit_count > 8
											if I_UnitFormation a1u9 = horde
												and ! I_UnitStatus a1u9 running_amok
												and ! I_UnitDestroyed a1u9
												and ! I_UnitStatus a1u9 left_battle
												and ! I_IsUnitRouting a1u9
												ai_gta_add_unit_label 0 0 a1u9
											end_if

											if I_CompareCounter enemy_unit_count > 9
												if I_UnitFormation a1u10 = horde
													and ! I_UnitStatus a1u10 running_amok
													and ! I_UnitDestroyed a1u10
													and ! I_UnitStatus a1u10 left_battle
													and ! I_IsUnitRouting a1u10
													ai_gta_add_unit_label 0 0 a1u10
												end_if

												if I_CompareCounter enemy_unit_count > 10
													if I_UnitFormation a1u11 = horde
														and ! I_UnitStatus a1u11 running_amok
														and ! I_UnitDestroyed a1u11
														and ! I_UnitStatus a1u11 left_battle
														and ! I_IsUnitRouting a1u11
														ai_gta_add_unit_label 0 0 a1u11
													end_if

													if I_CompareCounter enemy_unit_count > 11
														if I_UnitFormation a1u12 = horde
															and ! I_UnitStatus a1u12 running_amok
															and ! I_UnitDestroyed a1u12
															and ! I_UnitStatus a1u12 left_battle
															and ! I_IsUnitRouting a1u12
															ai_gta_add_unit_label 0 0 a1u12
														end_if

														if I_CompareCounter enemy_unit_count > 12
															if I_UnitFormation a1u13 = horde
																and ! I_UnitStatus a1u13 running_amok
																and ! I_UnitDestroyed a1u13
																and ! I_UnitStatus a1u13 left_battle
																and ! I_IsUnitRouting a1u13
																ai_gta_add_unit_label 0 0 a1u13
															end_if

															if I_CompareCounter enemy_unit_count > 13
																if I_UnitFormation a1u14 = horde
																	and ! I_UnitStatus a1u14 running_amok
																	and ! I_UnitDestroyed a1u14
																	and ! I_UnitStatus a1u14 left_battle
																	and ! I_IsUnitRouting a1u14
																	ai_gta_add_unit_label 0 0 a1u14
																end_if

																if I_CompareCounter enemy_unit_count > 14
																	if I_UnitFormation a1u15 = horde
																		and ! I_UnitStatus a1u15 running_amok
																		and ! I_UnitDestroyed a1u15
																		and ! I_UnitStatus a1u15 left_battle
																		and ! I_IsUnitRouting a1u15
																		ai_gta_add_unit_label 0 0 a1u15
																	end_if

																	if I_CompareCounter enemy_unit_count > 15
																		if I_UnitFormation a1u16 = horde
																			and ! I_UnitStatus a1u16 running_amok
																			and ! I_UnitDestroyed a1u16
																			and ! I_UnitStatus a1u16 left_battle
																			and ! I_IsUnitRouting a1u16
																			ai_gta_add_unit_label 0 0 a1u16
																		end_if

																		if I_CompareCounter enemy_unit_count > 16
																			if I_UnitFormation a1u17 = horde
																				and ! I_UnitStatus a1u17 running_amok
																				and ! I_UnitDestroyed a1u17
																				and ! I_UnitStatus a1u17 left_battle
																				and ! I_IsUnitRouting a1u17
																				ai_gta_add_unit_label 0 0 a1u17
																			end_if

																			if I_CompareCounter enemy_unit_count > 17
																				if I_UnitFormation a1u18 = horde
																					and ! I_UnitStatus a1u18 running_amok
																					and ! I_UnitDestroyed a1u18
																					and ! I_UnitStatus a1u18 left_battle
																					and ! I_IsUnitRouting a1u18
																					ai_gta_add_unit_label 0 0 a1u18
																				end_if

																				if I_CompareCounter enemy_unit_count > 18
																					if I_UnitFormation a1u19 = horde
																						and ! I_UnitStatus a1u19 running_amok
																						and ! I_UnitDestroyed a1u19
																						and ! I_UnitStatus a1u19 left_battle
																						and ! I_IsUnitRouting a1u19
																						ai_gta_add_unit_label 0 0 a1u19
																					end_if

																					if I_CompareCounter enemy_unit_count = 20
																						if I_UnitFormation a1u20 = horde
																							and ! I_UnitStatus a1u20 running_amok
																							and ! I_UnitDestroyed a1u20
																							and ! I_UnitStatus a1u20 left_battle
																							and ! I_IsUnitRouting a1u20
																							ai_gta_add_unit_label 0 0 a1u20
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if

		ai_active_set on
		set_counter third_ring 1
		set_counter elephant_gate_tier3 0
	end_monitor

	;;;;;;;;Sally-Out Elephant;;;;;;;;;;;;

	monitor_conditions I_BattleStarted
		and I_CompareCounter elephant_fix = 1
		and I_BattleIsSallyOutBattle
		and ! I_BattleIsFortBattle
		and I_BattlePlayerArmyIsAttacker
		and I_BattleEnemyArmyNumberOfMountClass elephant > 0

		;	set_counter sally-out_fix 1
		ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999

		if I_CompareCounter enemy_unit_count > 0
			if I_UnitFormation a2u1 = horde
				and ! I_UnitStatus a2u1 running_amok
				and ! I_UnitDestroyed a2u1
				and ! I_UnitStatus a2u1 left_battle
				and ! I_IsUnitRouting a2u1
				ai_gta_add_unit_label 1 0 a2u1
			end_if

			if I_CompareCounter enemy_unit_count > 1
				if I_UnitFormation a2u2 = horde
					and ! I_UnitStatus a2u2 running_amok
					and ! I_UnitDestroyed a2u2
					and ! I_UnitStatus a2u2 left_battle
					and ! I_IsUnitRouting a2u2
					ai_gta_add_unit_label 1 0 a2u2
				end_if

				if I_CompareCounter enemy_unit_count > 2
					if I_UnitFormation a2u3 = horde
						and ! I_UnitStatus a2u3 running_amok
						and ! I_UnitDestroyed a2u3
						and ! I_UnitStatus a2u3 left_battle
						and ! I_IsUnitRouting a2u3
						ai_gta_add_unit_label 1 0 a2u3
					end_if

					if I_CompareCounter enemy_unit_count > 3
						if I_UnitFormation a2u4 = horde
							and ! I_UnitStatus a2u4 running_amok
							and ! I_UnitDestroyed a2u4
							and ! I_UnitStatus a2u4 left_battle
							and ! I_IsUnitRouting a2u4
							ai_gta_add_unit_label 1 0 a2u4
						end_if

						if I_CompareCounter enemy_unit_count > 4
							if I_UnitFormation a2u5 = horde
								and ! I_UnitStatus a2u5 running_amok
								and ! I_UnitDestroyed a2u5
								and ! I_UnitStatus a2u5 left_battle
								and ! I_IsUnitRouting a2u5
								ai_gta_add_unit_label 1 0 a2u5
							end_if

							if I_CompareCounter enemy_unit_count > 5
								if I_UnitFormation a2u6 = horde
									and ! I_UnitStatus a2u6 running_amok
									and ! I_UnitDestroyed a2u6
									and ! I_UnitStatus a2u6 left_battle
									and ! I_IsUnitRouting a2u6
									ai_gta_add_unit_label 1 0 a2u6
								end_if

								if I_CompareCounter enemy_unit_count > 6
									if I_UnitFormation a2u7 = horde
										and ! I_UnitStatus a2u7 running_amok
										and ! I_UnitDestroyed a2u7
										and ! I_UnitStatus a2u7 left_battle
										and ! I_IsUnitRouting a2u7
										ai_gta_add_unit_label 1 0 a2u7
									end_if

									if I_CompareCounter enemy_unit_count > 7
										if I_UnitFormation a2u8 = horde
											and ! I_UnitStatus a2u8 running_amok
											and ! I_UnitDestroyed a2u8
											and ! I_UnitStatus a2u8 left_battle
											and ! I_IsUnitRouting a2u8
											ai_gta_add_unit_label 1 0 a2u8
										end_if

										if I_CompareCounter enemy_unit_count > 8
											if I_UnitFormation a2u9 = horde
												and ! I_UnitStatus a2u9 running_amok
												and ! I_UnitDestroyed a2u9
												and ! I_UnitStatus a2u9 left_battle
												and ! I_IsUnitRouting a2u9
												ai_gta_add_unit_label 1 0 a2u9
											end_if

											if I_CompareCounter enemy_unit_count > 9
												if I_UnitFormation a2u10 = horde
													and ! I_UnitStatus a2u10 running_amok
													and ! I_UnitDestroyed a2u10
													and ! I_UnitStatus a2u10 left_battle
													and ! I_IsUnitRouting a2u10
													ai_gta_add_unit_label 1 0 a2u10
												end_if

												if I_CompareCounter enemy_unit_count > 10
													if I_UnitFormation a2u11 = horde
														and ! I_UnitStatus a2u11 running_amok
														and ! I_UnitDestroyed a2u11
														and ! I_UnitStatus a2u11 left_battle
														and ! I_IsUnitRouting a2u11
														ai_gta_add_unit_label 1 0 a2u11
													end_if

													if I_CompareCounter enemy_unit_count > 11
														if I_UnitFormation a2u12 = horde
															and ! I_UnitStatus a2u12 running_amok
															and ! I_UnitDestroyed a2u12
															and ! I_UnitStatus a2u12 left_battle
															and ! I_IsUnitRouting a2u12
															ai_gta_add_unit_label 1 0 a2u12
														end_if

														if I_CompareCounter enemy_unit_count > 12
															if I_UnitFormation a2u13 = horde
																and ! I_UnitStatus a2u13 running_amok
																and ! I_UnitDestroyed a2u13
																and ! I_UnitStatus a2u13 left_battle
																and ! I_IsUnitRouting a2u13
																ai_gta_add_unit_label 1 0 a2u13
															end_if

															if I_CompareCounter enemy_unit_count > 13
																if I_UnitFormation a2u14 = horde
																	and ! I_UnitStatus a2u14 running_amok
																	and ! I_UnitDestroyed a2u14
																	and ! I_UnitStatus a2u14 left_battle
																	and ! I_IsUnitRouting a2u14
																	ai_gta_add_unit_label 1 0 a2u14
																end_if

																if I_CompareCounter enemy_unit_count > 14
																	if I_UnitFormation a2u15 = horde
																		and ! I_UnitStatus a2u15 running_amok
																		and ! I_UnitDestroyed a2u15
																		and ! I_UnitStatus a2u15 left_battle
																		and ! I_IsUnitRouting a2u15
																		ai_gta_add_unit_label 1 0 a2u15
																	end_if

																	if I_CompareCounter enemy_unit_count > 15
																		if I_UnitFormation a2u16 = horde
																			and ! I_UnitStatus a2u16 running_amok
																			and ! I_UnitDestroyed a2u16
																			and ! I_UnitStatus a2u16 left_battle
																			and ! I_IsUnitRouting a2u16
																			ai_gta_add_unit_label 1 0 a2u16
																		end_if

																		if I_CompareCounter enemy_unit_count > 16
																			if I_UnitFormation a2u17 = horde
																				and ! I_UnitStatus a2u17 running_amok
																				and ! I_UnitDestroyed a2u17
																				and ! I_UnitStatus a2u17 left_battle
																				and ! I_IsUnitRouting a2u17
																				ai_gta_add_unit_label 1 0 a2u17
																			end_if

																			if I_CompareCounter enemy_unit_count > 17
																				if I_UnitFormation a2u18 = horde
																					and ! I_UnitStatus a2u18 running_amok
																					and ! I_UnitDestroyed a2u18
																					and ! I_UnitStatus a2u18 left_battle
																					and ! I_IsUnitRouting a2u18
																					ai_gta_add_unit_label 1 0 a2u18
																				end_if

																				if I_CompareCounter enemy_unit_count > 18
																					if I_UnitFormation a2u19 = horde
																						and ! I_UnitStatus a2u19 running_amok
																						and ! I_UnitDestroyed a2u19
																						and ! I_UnitStatus a2u19 left_battle
																						and ! I_IsUnitRouting a2u19
																						ai_gta_add_unit_label 1 0 a2u19
																					end_if

																					if I_CompareCounter enemy_unit_count = 20
																						if I_UnitFormation a2u20 = horde
																							and ! I_UnitStatus a2u20 running_amok
																							and ! I_UnitDestroyed a2u20
																							and ! I_UnitStatus a2u20 left_battle
																							and ! I_IsUnitRouting a2u20
																							ai_gta_add_unit_label 1 0 a2u20
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if

		ai_active_set on
		set_counter elephant_gate_s 1
		set_counter elephant_fix 0
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter elephant_fix = 1
		and I_BattleIsSallyOutBattle
		and I_BattleIsFortBattle
		and I_BattlePlayerArmyIsAttacker
		and I_BattleEnemyArmyNumberOfMountClass elephant > 0

		;	set_counter sally-out_fix 1
		ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999

		if I_CompareCounter enemy_unit_count > 0
			if I_UnitFormation a2u1 = horde
				and ! I_UnitStatus a2u1 running_amok
				and ! I_UnitDestroyed a2u1
				and ! I_UnitStatus a2u1 left_battle
				and ! I_IsUnitRouting a2u1
				ai_gta_add_unit_label 1 0 a2u1
			end_if

			if I_CompareCounter enemy_unit_count > 1
				if I_UnitFormation a2u2 = horde
					and ! I_UnitStatus a2u2 running_amok
					and ! I_UnitDestroyed a2u2
					and ! I_UnitStatus a2u2 left_battle
					and ! I_IsUnitRouting a2u2
					ai_gta_add_unit_label 1 0 a2u2
				end_if

				if I_CompareCounter enemy_unit_count > 2
					if I_UnitFormation a2u3 = horde
						and ! I_UnitStatus a2u3 running_amok
						and ! I_UnitDestroyed a2u3
						and ! I_UnitStatus a2u3 left_battle
						and ! I_IsUnitRouting a2u3
						ai_gta_add_unit_label 1 0 a2u3
					end_if

					if I_CompareCounter enemy_unit_count > 3
						if I_UnitFormation a2u4 = horde
							and ! I_UnitStatus a2u4 running_amok
							and ! I_UnitDestroyed a2u4
							and ! I_UnitStatus a2u4 left_battle
							and ! I_IsUnitRouting a2u4
							ai_gta_add_unit_label 1 0 a2u4
						end_if

						if I_CompareCounter enemy_unit_count > 4
							if I_UnitFormation a2u5 = horde
								and ! I_UnitStatus a2u5 running_amok
								and ! I_UnitDestroyed a2u5
								and ! I_UnitStatus a2u5 left_battle
								and ! I_IsUnitRouting a2u5
								ai_gta_add_unit_label 1 0 a2u5
							end_if

							if I_CompareCounter enemy_unit_count > 5
								if I_UnitFormation a2u6 = horde
									and ! I_UnitStatus a2u6 running_amok
									and ! I_UnitDestroyed a2u6
									and ! I_UnitStatus a2u6 left_battle
									and ! I_IsUnitRouting a2u6
									ai_gta_add_unit_label 1 0 a2u6
								end_if

								if I_CompareCounter enemy_unit_count > 6
									if I_UnitFormation a2u7 = horde
										and ! I_UnitStatus a2u7 running_amok
										and ! I_UnitDestroyed a2u7
										and ! I_UnitStatus a2u7 left_battle
										and ! I_IsUnitRouting a2u7
										ai_gta_add_unit_label 1 0 a2u7
									end_if

									if I_CompareCounter enemy_unit_count > 7
										if I_UnitFormation a2u8 = horde
											and ! I_UnitStatus a2u8 running_amok
											and ! I_UnitDestroyed a2u8
											and ! I_UnitStatus a2u8 left_battle
											and ! I_IsUnitRouting a2u8
											ai_gta_add_unit_label 1 0 a2u8
										end_if

										if I_CompareCounter enemy_unit_count > 8
											if I_UnitFormation a2u9 = horde
												and ! I_UnitStatus a2u9 running_amok
												and ! I_UnitDestroyed a2u9
												and ! I_UnitStatus a2u9 left_battle
												and ! I_IsUnitRouting a2u9
												ai_gta_add_unit_label 1 0 a2u9
											end_if

											if I_CompareCounter enemy_unit_count > 9
												if I_UnitFormation a2u10 = horde
													and ! I_UnitStatus a2u10 running_amok
													and ! I_UnitDestroyed a2u10
													and ! I_UnitStatus a2u10 left_battle
													and ! I_IsUnitRouting a2u10
													ai_gta_add_unit_label 1 0 a2u10
												end_if

												if I_CompareCounter enemy_unit_count > 10
													if I_UnitFormation a2u11 = horde
														and ! I_UnitStatus a2u11 running_amok
														and ! I_UnitDestroyed a2u11
														and ! I_UnitStatus a2u11 left_battle
														and ! I_IsUnitRouting a2u11
														ai_gta_add_unit_label 1 0 a2u11
													end_if

													if I_CompareCounter enemy_unit_count > 11
														if I_UnitFormation a2u12 = horde
															and ! I_UnitStatus a2u12 running_amok
															and ! I_UnitDestroyed a2u12
															and ! I_UnitStatus a2u12 left_battle
															and ! I_IsUnitRouting a2u12
															ai_gta_add_unit_label 1 0 a2u12
														end_if

														if I_CompareCounter enemy_unit_count > 12
															if I_UnitFormation a2u13 = horde
																and ! I_UnitStatus a2u13 running_amok
																and ! I_UnitDestroyed a2u13
																and ! I_UnitStatus a2u13 left_battle
																and ! I_IsUnitRouting a2u13
																ai_gta_add_unit_label 1 0 a2u13
															end_if

															if I_CompareCounter enemy_unit_count > 13
																if I_UnitFormation a2u14 = horde
																	and ! I_UnitStatus a2u14 running_amok
																	and ! I_UnitDestroyed a2u14
																	and ! I_UnitStatus a2u14 left_battle
																	and ! I_IsUnitRouting a2u14
																	ai_gta_add_unit_label 1 0 a2u14
																end_if

																if I_CompareCounter enemy_unit_count > 14
																	if I_UnitFormation a2u15 = horde
																		and ! I_UnitStatus a2u15 running_amok
																		and ! I_UnitDestroyed a2u15
																		and ! I_UnitStatus a2u15 left_battle
																		and ! I_IsUnitRouting a2u15
																		ai_gta_add_unit_label 1 0 a2u15
																	end_if

																	if I_CompareCounter enemy_unit_count > 15
																		if I_UnitFormation a2u16 = horde
																			and ! I_UnitStatus a2u16 running_amok
																			and ! I_UnitDestroyed a2u16
																			and ! I_UnitStatus a2u16 left_battle
																			and ! I_IsUnitRouting a2u16
																			ai_gta_add_unit_label 1 0 a2u16
																		end_if

																		if I_CompareCounter enemy_unit_count > 16
																			if I_UnitFormation a2u17 = horde
																				and ! I_UnitStatus a2u17 running_amok
																				and ! I_UnitDestroyed a2u17
																				and ! I_UnitStatus a2u17 left_battle
																				and ! I_IsUnitRouting a2u17
																				ai_gta_add_unit_label 1 0 a2u17
																			end_if

																			if I_CompareCounter enemy_unit_count > 17
																				if I_UnitFormation a2u18 = horde
																					and ! I_UnitStatus a2u18 running_amok
																					and ! I_UnitDestroyed a2u18
																					and ! I_UnitStatus a2u18 left_battle
																					and ! I_IsUnitRouting a2u18
																					ai_gta_add_unit_label 1 0 a2u18
																				end_if

																				if I_CompareCounter enemy_unit_count > 18
																					if I_UnitFormation a2u19 = horde
																						and ! I_UnitStatus a2u19 running_amok
																						and ! I_UnitDestroyed a2u19
																						and ! I_UnitStatus a2u19 left_battle
																						and ! I_IsUnitRouting a2u19
																						ai_gta_add_unit_label 1 0 a2u19
																					end_if

																					if I_CompareCounter enemy_unit_count = 20
																						if I_UnitFormation a2u20 = horde
																							and ! I_UnitStatus a2u20 running_amok
																							and ! I_UnitDestroyed a2u20
																							and ! I_UnitStatus a2u20 left_battle
																							and ! I_IsUnitRouting a2u20
																							ai_gta_add_unit_label 1 0 a2u20
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if

		ai_active_set on
		set_counter elephant_gate_s 1
		set_counter elephant_fix 0
	end_monitor

	monitor_event BattleEnemyUnitAttacksPlayerUnit TrueCondition
		and I_CompareCounter panel_check = 1
		and I_CompareCounter rally_walls_s = 1
		and BattleIsMeleeAttack
		and ! BattlePlayerUnitOnWalls
		and ! BattleEnemyUnitOnWalls

		if I_CompareCounter elephant_gate_s != 2
			set_counter elephant_gate_s 0
			set_counter del_objective_s 1
		end_if
		set_counter elephant_fix_check_sally 1
		set_counter rally_walls_s 3
		;	battle_wait 180
		battle_wait 30
		if I_CompareCounter rally_walls_s = 3
			and I_CompareCounter elephant_fix_check_sally = 1
			set_counter elephant_fix_check_sally 2
			battle_wait 30
			if I_CompareCounter rally_walls_s = 3
				and I_CompareCounter elephant_fix_check_sally = 2
				set_counter elephant_fix_check_sally 3
				battle_wait 30
				if I_CompareCounter rally_walls_s = 3
					and I_CompareCounter elephant_fix_check_sally = 3
					set_counter elephant_fix_check_sally 4
					battle_wait 30
					if I_CompareCounter rally_walls_s = 3
						and I_CompareCounter elephant_fix_check_sally = 4
						set_counter elephant_fix_check_sally 5
						battle_wait 30
						if I_CompareCounter rally_walls_s = 3
							and I_CompareCounter elephant_fix_check_sally = 5
							set_counter elephant_fix_check_sally 6
							battle_wait 30
							if I_CompareCounter rally_walls_s = 3
								and I_CompareCounter elephant_fix_check_sally = 6
								set_counter elephant_gate_tier2s 1
								set_counter rally_walls_s 0
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if
	end_monitor

	monitor_event BattlePlayerUnitAttacksEnemyUnit BattleIsMeleeAttack
		and I_CompareCounter panel_check = 1
		and I_CompareCounter rally_walls_s = 1
		and ! BattlePlayerUnitOnWalls
		and ! BattleEnemyUnitOnWalls

		if I_CompareCounter elephant_gate_s != 2
			set_counter elephant_gate_s 0
			set_counter del_objective_s 1
		end_if
		set_counter elephant_fix_check_sally 1
		set_counter rally_walls_s 3
		;	battle_wait 180
		battle_wait 30
		if I_CompareCounter rally_walls_s = 3
			and I_CompareCounter elephant_fix_check_sally = 1
			set_counter elephant_fix_check_sally 2
			battle_wait 30
			if I_CompareCounter rally_walls_s = 3
				and I_CompareCounter elephant_fix_check_sally = 2
				set_counter elephant_fix_check_sally 3
				battle_wait 30
				if I_CompareCounter rally_walls_s = 3
					and I_CompareCounter elephant_fix_check_sally = 3
					set_counter elephant_fix_check_sally 4
					battle_wait 30
					if I_CompareCounter rally_walls_s = 3
						and I_CompareCounter elephant_fix_check_sally = 4
						set_counter elephant_fix_check_sally 5
						battle_wait 30
						if I_CompareCounter rally_walls_s = 3
							and I_CompareCounter elephant_fix_check_sally = 5
							set_counter elephant_fix_check_sally 6
							battle_wait 30
							if I_CompareCounter rally_walls_s = 3
								and I_CompareCounter elephant_fix_check_sally = 6
								set_counter elephant_gate_tier2s 1
								set_counter rally_walls_s 0
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter del_objective_s = 1
		and I_BattleIsSallyOutBattle
		and I_BattlePlayerArmyIsAttacker
		and I_BattleEnemyArmyNumberOfMountClass elephant > 0

		set_counter del_objective_s 2
		battle_wait 15
		if I_CompareCounter del_objective_s = 2
			ai_gta_del_objective 1
			ai_active_set off
			battle_wait 0.5
			ai_active_set on
			set_counter del_objective_s 0
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter elephant_gate_tier2s = 1
		and I_BattleIsSallyOutBattle
		and I_BattlePlayerArmyIsAttacker
		and I_IsBattleSettlementCastle
		and I_BattleSettlementFortificationLevel > 2
		and I_BattleEnemyArmyNumberOfMountClass elephant > 0

		ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999

		if I_CompareCounter enemy_unit_count > 0
			if I_UnitFormation a2u1 = horde
				and ! I_UnitStatus a2u1 running_amok
				and ! I_UnitDestroyed a2u1
				and ! I_UnitStatus a2u1 left_battle
				and ! I_IsUnitRouting a2u1
				ai_gta_add_unit_label 1 0 a2u1
			end_if

			if I_CompareCounter enemy_unit_count > 1
				if I_UnitFormation a2u2 = horde
					and ! I_UnitStatus a2u2 running_amok
					and ! I_UnitDestroyed a2u2
					and ! I_UnitStatus a2u2 left_battle
					and ! I_IsUnitRouting a2u2
					ai_gta_add_unit_label 1 0 a2u2
				end_if

				if I_CompareCounter enemy_unit_count > 2
					if I_UnitFormation a2u3 = horde
						and ! I_UnitStatus a2u3 running_amok
						and ! I_UnitDestroyed a2u3
						and ! I_UnitStatus a2u3 left_battle
						and ! I_IsUnitRouting a2u3
						ai_gta_add_unit_label 1 0 a2u3
					end_if

					if I_CompareCounter enemy_unit_count > 3
						if I_UnitFormation a2u4 = horde
							and ! I_UnitStatus a2u4 running_amok
							and ! I_UnitDestroyed a2u4
							and ! I_UnitStatus a2u4 left_battle
							and ! I_IsUnitRouting a2u4
							ai_gta_add_unit_label 1 0 a2u4
						end_if

						if I_CompareCounter enemy_unit_count > 4
							if I_UnitFormation a2u5 = horde
								and ! I_UnitStatus a2u5 running_amok
								and ! I_UnitDestroyed a2u5
								and ! I_UnitStatus a2u5 left_battle
								and ! I_IsUnitRouting a2u5
								ai_gta_add_unit_label 1 0 a2u5
							end_if

							if I_CompareCounter enemy_unit_count > 5
								if I_UnitFormation a2u6 = horde
									and ! I_UnitStatus a2u6 running_amok
									and ! I_UnitDestroyed a2u6
									and ! I_UnitStatus a2u6 left_battle
									and ! I_IsUnitRouting a2u6
									ai_gta_add_unit_label 1 0 a2u6
								end_if

								if I_CompareCounter enemy_unit_count > 6
									if I_UnitFormation a2u7 = horde
										and ! I_UnitStatus a2u7 running_amok
										and ! I_UnitDestroyed a2u7
										and ! I_UnitStatus a2u7 left_battle
										and ! I_IsUnitRouting a2u7
										ai_gta_add_unit_label 1 0 a2u7
									end_if

									if I_CompareCounter enemy_unit_count > 7
										if I_UnitFormation a2u8 = horde
											and ! I_UnitStatus a2u8 running_amok
											and ! I_UnitDestroyed a2u8
											and ! I_UnitStatus a2u8 left_battle
											and ! I_IsUnitRouting a2u8
											ai_gta_add_unit_label 1 0 a2u8
										end_if

										if I_CompareCounter enemy_unit_count > 8
											if I_UnitFormation a2u9 = horde
												and ! I_UnitStatus a2u9 running_amok
												and ! I_UnitDestroyed a2u9
												and ! I_UnitStatus a2u9 left_battle
												and ! I_IsUnitRouting a2u9
												ai_gta_add_unit_label 1 0 a2u9
											end_if

											if I_CompareCounter enemy_unit_count > 9
												if I_UnitFormation a2u10 = horde
													and ! I_UnitStatus a2u10 running_amok
													and ! I_UnitDestroyed a2u10
													and ! I_UnitStatus a2u10 left_battle
													and ! I_IsUnitRouting a2u10
													ai_gta_add_unit_label 1 0 a2u10
												end_if

												if I_CompareCounter enemy_unit_count > 10
													if I_UnitFormation a2u11 = horde
														and ! I_UnitStatus a2u11 running_amok
														and ! I_UnitDestroyed a2u11
														and ! I_UnitStatus a2u11 left_battle
														and ! I_IsUnitRouting a2u11
														ai_gta_add_unit_label 1 0 a2u11
													end_if

													if I_CompareCounter enemy_unit_count > 11
														if I_UnitFormation a2u12 = horde
															and ! I_UnitStatus a2u12 running_amok
															and ! I_UnitDestroyed a2u12
															and ! I_UnitStatus a2u12 left_battle
															and ! I_IsUnitRouting a2u12
															ai_gta_add_unit_label 1 0 a2u12
														end_if

														if I_CompareCounter enemy_unit_count > 12
															if I_UnitFormation a2u13 = horde
																and ! I_UnitStatus a2u13 running_amok
																and ! I_UnitDestroyed a2u13
																and ! I_UnitStatus a2u13 left_battle
																and ! I_IsUnitRouting a2u13
																ai_gta_add_unit_label 1 0 a2u13
															end_if

															if I_CompareCounter enemy_unit_count > 13
																if I_UnitFormation a2u14 = horde
																	and ! I_UnitStatus a2u14 running_amok
																	and ! I_UnitDestroyed a2u14
																	and ! I_UnitStatus a2u14 left_battle
																	and ! I_IsUnitRouting a2u14
																	ai_gta_add_unit_label 1 0 a2u14
																end_if

																if I_CompareCounter enemy_unit_count > 14
																	if I_UnitFormation a2u15 = horde
																		and ! I_UnitStatus a2u15 running_amok
																		and ! I_UnitDestroyed a2u15
																		and ! I_UnitStatus a2u15 left_battle
																		and ! I_IsUnitRouting a2u15
																		ai_gta_add_unit_label 1 0 a2u15
																	end_if

																	if I_CompareCounter enemy_unit_count > 15
																		if I_UnitFormation a2u16 = horde
																			and ! I_UnitStatus a2u16 running_amok
																			and ! I_UnitDestroyed a2u16
																			and ! I_UnitStatus a2u16 left_battle
																			and ! I_IsUnitRouting a2u16
																			ai_gta_add_unit_label 1 0 a2u16
																		end_if

																		if I_CompareCounter enemy_unit_count > 16
																			if I_UnitFormation a2u17 = horde
																				and ! I_UnitStatus a2u17 running_amok
																				and ! I_UnitDestroyed a2u17
																				and ! I_UnitStatus a2u17 left_battle
																				and ! I_IsUnitRouting a2u17
																				ai_gta_add_unit_label 1 0 a2u17
																			end_if

																			if I_CompareCounter enemy_unit_count > 17
																				if I_UnitFormation a2u18 = horde
																					and ! I_UnitStatus a2u18 running_amok
																					and ! I_UnitDestroyed a2u18
																					and ! I_UnitStatus a2u18 left_battle
																					and ! I_IsUnitRouting a2u18
																					ai_gta_add_unit_label 1 0 a2u18
																				end_if

																				if I_CompareCounter enemy_unit_count > 18
																					if I_UnitFormation a2u19 = horde
																						and ! I_UnitStatus a2u19 running_amok
																						and ! I_UnitDestroyed a2u19
																						and ! I_UnitStatus a2u19 left_battle
																						and ! I_IsUnitRouting a2u19
																						ai_gta_add_unit_label 1 0 a2u19
																					end_if

																					if I_CompareCounter enemy_unit_count = 20
																						if I_UnitFormation a2u20 = horde
																							and ! I_UnitStatus a2u20 running_amok
																							and ! I_UnitDestroyed a2u20
																							and ! I_UnitStatus a2u20 left_battle
																							and ! I_IsUnitRouting a2u20
																							ai_gta_add_unit_label 1 0 a2u20
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if

		ai_active_set on
		set_counter second_ring_s 1
		set_counter elephant_gate_tier2s 0
	end_monitor

	monitor_event BattleEnemyUnitAttacksPlayerUnit TrueCondition
		and I_CompareCounter panel_check = 1
		and I_CompareCounter rally_walls_s = 2
		and BattleIsMeleeAttack
		and ! BattlePlayerUnitOnWalls
		and ! BattleEnemyUnitOnWalls

		if I_CompareCounter second_ring_s != 2
			set_counter second_ring_s 0
			set_counter del_objective_s 1
		end_if
		set_counter elephant_fix_check_sally 1
		set_counter rally_walls_s 4
		;	battle_wait 180
		battle_wait 30
		if I_CompareCounter rally_walls_s = 4
			and I_CompareCounter elephant_fix_check_sally = 1
			set_counter elephant_fix_check_sally 2
			battle_wait 30
			if I_CompareCounter rally_walls_s = 4
				and I_CompareCounter elephant_fix_check_sally = 2
				set_counter elephant_fix_check_sally 3
				battle_wait 30
				if I_CompareCounter rally_walls_s = 4
					and I_CompareCounter elephant_fix_check_sally = 3
					set_counter elephant_fix_check_sally 4
					battle_wait 30
					if I_CompareCounter rally_walls_s = 4
						and I_CompareCounter elephant_fix_check_sally = 4
						set_counter elephant_fix_check_sally 5
						battle_wait 30
						if I_CompareCounter rally_walls_s = 4
							and I_CompareCounter elephant_fix_check_sally = 5
							set_counter elephant_fix_check_sally 6
							battle_wait 30
							if I_CompareCounter rally_walls_s = 4
								and I_CompareCounter elephant_fix_check_sally = 6
								set_counter elephant_gate_tier3s 1
								set_counter rally_walls_s 0
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if
	end_monitor

	monitor_event BattlePlayerUnitAttacksEnemyUnit BattleIsMeleeAttack
		and I_CompareCounter panel_check = 1
		and I_CompareCounter rally_walls_s = 2
		and ! BattlePlayerUnitOnWalls
		and ! BattleEnemyUnitOnWalls

		if I_CompareCounter second_ring_s != 2
			set_counter second_ring_s 0
			set_counter del_objective_s 1
		end_if
		set_counter elephant_fix_check_sally 1
		set_counter rally_walls_s 4
		;	battle_wait 180
		battle_wait 30
		if I_CompareCounter rally_walls_s = 4
			and I_CompareCounter elephant_fix_check_sally = 1
			set_counter elephant_fix_check_sally 2
			battle_wait 30
			if I_CompareCounter rally_walls_s = 4
				and I_CompareCounter elephant_fix_check_sally = 2
				set_counter elephant_fix_check_sally 3
				battle_wait 30
				if I_CompareCounter rally_walls_s = 4
					and I_CompareCounter elephant_fix_check_sally = 3
					set_counter elephant_fix_check_sally 4
					battle_wait 30
					if I_CompareCounter rally_walls_s = 4
						and I_CompareCounter elephant_fix_check_sally = 4
						set_counter elephant_fix_check_sally 5
						battle_wait 30
						if I_CompareCounter rally_walls_s = 4
							and I_CompareCounter elephant_fix_check_sally = 5
							set_counter elephant_fix_check_sally 6
							battle_wait 30
							if I_CompareCounter rally_walls_s = 4
								and I_CompareCounter elephant_fix_check_sally = 6
								set_counter elephant_gate_tier3s 1
								set_counter rally_walls_s 0
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter elephant_gate_tier3s = 1
		and I_BattleIsSallyOutBattle
		and I_BattlePlayerArmyIsAttacker
		and I_IsBattleSettlementCastle
		and I_BattleSettlementFortificationLevel > 2
		and I_BattleEnemyArmyNumberOfMountClass elephant > 0

		ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999

		if I_CompareCounter enemy_unit_count > 0
			if I_UnitFormation a2u1 = horde
				and ! I_UnitStatus a2u1 running_amok
				and ! I_UnitDestroyed a2u1
				and ! I_UnitStatus a2u1 left_battle
				and ! I_IsUnitRouting a2u1
				ai_gta_add_unit_label 1 0 a2u1
			end_if

			if I_CompareCounter enemy_unit_count > 1
				if I_UnitFormation a2u2 = horde
					and ! I_UnitStatus a2u2 running_amok
					and ! I_UnitDestroyed a2u2
					and ! I_UnitStatus a2u2 left_battle
					and ! I_IsUnitRouting a2u2
					ai_gta_add_unit_label 1 0 a2u2
				end_if

				if I_CompareCounter enemy_unit_count > 2
					if I_UnitFormation a2u3 = horde
						and ! I_UnitStatus a2u3 running_amok
						and ! I_UnitDestroyed a2u3
						and ! I_UnitStatus a2u3 left_battle
						and ! I_IsUnitRouting a2u3
						ai_gta_add_unit_label 1 0 a2u3
					end_if

					if I_CompareCounter enemy_unit_count > 3
						if I_UnitFormation a2u4 = horde
							and ! I_UnitStatus a2u4 running_amok
							and ! I_UnitDestroyed a2u4
							and ! I_UnitStatus a2u4 left_battle
							and ! I_IsUnitRouting a2u4
							ai_gta_add_unit_label 1 0 a2u4
						end_if

						if I_CompareCounter enemy_unit_count > 4
							if I_UnitFormation a2u5 = horde
								and ! I_UnitStatus a2u5 running_amok
								and ! I_UnitDestroyed a2u5
								and ! I_UnitStatus a2u5 left_battle
								and ! I_IsUnitRouting a2u5
								ai_gta_add_unit_label 1 0 a2u5
							end_if

							if I_CompareCounter enemy_unit_count > 5
								if I_UnitFormation a2u6 = horde
									and ! I_UnitStatus a2u6 running_amok
									and ! I_UnitDestroyed a2u6
									and ! I_UnitStatus a2u6 left_battle
									and ! I_IsUnitRouting a2u6
									ai_gta_add_unit_label 1 0 a2u6
								end_if

								if I_CompareCounter enemy_unit_count > 6
									if I_UnitFormation a2u7 = horde
										and ! I_UnitStatus a2u7 running_amok
										and ! I_UnitDestroyed a2u7
										and ! I_UnitStatus a2u7 left_battle
										and ! I_IsUnitRouting a2u7
										ai_gta_add_unit_label 1 0 a2u7
									end_if

									if I_CompareCounter enemy_unit_count > 7
										if I_UnitFormation a2u8 = horde
											and ! I_UnitStatus a2u8 running_amok
											and ! I_UnitDestroyed a2u8
											and ! I_UnitStatus a2u8 left_battle
											and ! I_IsUnitRouting a2u8
											ai_gta_add_unit_label 1 0 a2u8
										end_if

										if I_CompareCounter enemy_unit_count > 8
											if I_UnitFormation a2u9 = horde
												and ! I_UnitStatus a2u9 running_amok
												and ! I_UnitDestroyed a2u9
												and ! I_UnitStatus a2u9 left_battle
												and ! I_IsUnitRouting a2u9
												ai_gta_add_unit_label 1 0 a2u9
											end_if

											if I_CompareCounter enemy_unit_count > 9
												if I_UnitFormation a2u10 = horde
													and ! I_UnitStatus a2u10 running_amok
													and ! I_UnitDestroyed a2u10
													and ! I_UnitStatus a2u10 left_battle
													and ! I_IsUnitRouting a2u10
													ai_gta_add_unit_label 1 0 a2u10
												end_if

												if I_CompareCounter enemy_unit_count > 10
													if I_UnitFormation a2u11 = horde
														and ! I_UnitStatus a2u11 running_amok
														and ! I_UnitDestroyed a2u11
														and ! I_UnitStatus a2u11 left_battle
														and ! I_IsUnitRouting a2u11
														ai_gta_add_unit_label 1 0 a2u11
													end_if

													if I_CompareCounter enemy_unit_count > 11
														if I_UnitFormation a2u12 = horde
															and ! I_UnitStatus a2u12 running_amok
															and ! I_UnitDestroyed a2u12
															and ! I_UnitStatus a2u12 left_battle
															and ! I_IsUnitRouting a2u12
															ai_gta_add_unit_label 1 0 a2u12
														end_if

														if I_CompareCounter enemy_unit_count > 12
															if I_UnitFormation a2u13 = horde
																and ! I_UnitStatus a2u13 running_amok
																and ! I_UnitDestroyed a2u13
																and ! I_UnitStatus a2u13 left_battle
																and ! I_IsUnitRouting a2u13
																ai_gta_add_unit_label 1 0 a2u13
															end_if

															if I_CompareCounter enemy_unit_count > 13
																if I_UnitFormation a2u14 = horde
																	and ! I_UnitStatus a2u14 running_amok
																	and ! I_UnitDestroyed a2u14
																	and ! I_UnitStatus a2u14 left_battle
																	and ! I_IsUnitRouting a2u14
																	ai_gta_add_unit_label 1 0 a2u14
																end_if

																if I_CompareCounter enemy_unit_count > 14
																	if I_UnitFormation a2u15 = horde
																		and ! I_UnitStatus a2u15 running_amok
																		and ! I_UnitDestroyed a2u15
																		and ! I_UnitStatus a2u15 left_battle
																		and ! I_IsUnitRouting a2u15
																		ai_gta_add_unit_label 1 0 a2u15
																	end_if

																	if I_CompareCounter enemy_unit_count > 15
																		if I_UnitFormation a2u16 = horde
																			and ! I_UnitStatus a2u16 running_amok
																			and ! I_UnitDestroyed a2u16
																			and ! I_UnitStatus a2u16 left_battle
																			and ! I_IsUnitRouting a2u16
																			ai_gta_add_unit_label 1 0 a2u16
																		end_if

																		if I_CompareCounter enemy_unit_count > 16
																			if I_UnitFormation a2u17 = horde
																				and ! I_UnitStatus a2u17 running_amok
																				and ! I_UnitDestroyed a2u17
																				and ! I_UnitStatus a2u17 left_battle
																				and ! I_IsUnitRouting a2u17
																				ai_gta_add_unit_label 1 0 a2u17
																			end_if

																			if I_CompareCounter enemy_unit_count > 17
																				if I_UnitFormation a2u18 = horde
																					and ! I_UnitStatus a2u18 running_amok
																					and ! I_UnitDestroyed a2u18
																					and ! I_UnitStatus a2u18 left_battle
																					and ! I_IsUnitRouting a2u18
																					ai_gta_add_unit_label 1 0 a2u18
																				end_if

																				if I_CompareCounter enemy_unit_count > 18
																					if I_UnitFormation a2u19 = horde
																						and ! I_UnitStatus a2u19 running_amok
																						and ! I_UnitDestroyed a2u19
																						and ! I_UnitStatus a2u19 left_battle
																						and ! I_IsUnitRouting a2u19
																						ai_gta_add_unit_label 1 0 a2u19
																					end_if

																					if I_CompareCounter enemy_unit_count = 20
																						if I_UnitFormation a2u20 = horde
																							and ! I_UnitStatus a2u20 running_amok
																							and ! I_UnitDestroyed a2u20
																							and ! I_UnitStatus a2u20 left_battle
																							and ! I_IsUnitRouting a2u20
																							ai_gta_add_unit_label 1 0 a2u20
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if

		ai_active_set on
		set_counter third_ring_s 1
		set_counter elephant_gate_tier3s 0
	end_monitor

	;;;;;;;Elephants Gate and Walls
	monitor_event BattleBattleGatesDestroyedByEngine TrueCondition ;wtf
		and I_CompareCounter panel_check = 1

		if I_BattleIsSiegeBattle
			and ! I_BattlePlayerArmyIsAttacker
			and I_BattleEnemyArmyNumberOfMountClass elephant > 0

			if I_CompareCounter elephant_gate = 1
				set_counter elephant_gate 0
				set_counter rally_walls 1
			end_if

			if I_CompareCounter second_ring = 1
				and I_IsBattleSettlementCastle
				and I_BattleSettlementFortificationLevel > 2
				set_counter second_ring 0
				set_counter rally_walls 2
			end_if

			if I_CompareCounter third_ring = 1
				and I_IsBattleSettlementCastle
				and I_BattleSettlementFortificationLevel > 2
				set_counter third_ring 0
				set_counter del_objective 1
			end_if

		end_if
		if I_BattleIsSallyOutBattle
			and I_BattlePlayerArmyIsAttacker
			and I_BattleEnemyArmyNumberOfMountClass elephant > 0

			if I_CompareCounter elephant_gate_s = 1
				set_counter elephant_gate_s 0
				set_counter rally_walls_s 1
			end_if

			if I_CompareCounter second_ring_s = 1
				and I_IsBattleSettlementCastle
				and I_BattleSettlementFortificationLevel > 2
				set_counter second_ring_s 0
				set_counter rally_walls_s 2
			end_if

			if I_CompareCounter third_ring_s = 1
				and I_IsBattleSettlementCastle
				and I_BattleSettlementFortificationLevel > 2
				set_counter third_ring_s 0
				set_counter del_objective_s 1
			end_if

		end_if
	end_monitor

	monitor_event BattleWallsCaptured TrueCondition
		and I_CompareCounter panel_check = 1

		if I_BattleIsSiegeBattle
			and ! I_BattlePlayerArmyIsAttacker
			and I_BattleEnemyArmyNumberOfMountClass elephant > 0

			if I_CompareCounter elephant_gate = 1
				set_counter elephant_gate 0
				set_counter rally_walls 1
			end_if

			if I_CompareCounter second_ring = 1
				and I_IsBattleSettlementCastle
				and I_BattleSettlementFortificationLevel > 2
				set_counter second_ring 0
				set_counter rally_walls 2
			end_if

			if I_CompareCounter third_ring = 1
				and I_IsBattleSettlementCastle
				and I_BattleSettlementFortificationLevel > 2
				set_counter third_ring 0
				set_counter del_objective 1
			end_if

		end_if
		if I_BattleIsSallyOutBattle
			and I_BattlePlayerArmyIsAttacker
			and I_BattleEnemyArmyNumberOfMountClass elephant > 0

			if I_CompareCounter elephant_gate_s = 1
				set_counter elephant_gate_s 0
				set_counter rally_walls_s 1
			end_if

			if I_CompareCounter second_ring_s = 1
				and I_IsBattleSettlementCastle
				and I_BattleSettlementFortificationLevel > 2
				set_counter second_ring_s 0
				set_counter rally_walls_s 2
			end_if

			if I_CompareCounter third_ring_s = 1
				and I_IsBattleSettlementCastle
				and I_BattleSettlementFortificationLevel > 2
				set_counter third_ring_s 0
				set_counter del_objective_s 1
			end_if

		end_if
	end_monitor

	monitor_event BattleWallsBreachedByEngine TrueCondition
		and I_CompareCounter panel_check = 1

		if I_BattleIsSiegeBattle
			and ! I_BattlePlayerArmyIsAttacker
			and I_BattleEnemyArmyNumberOfMountClass elephant > 0

			if I_CompareCounter elephant_gate = 1
				ai_gta_del_objective 0
				ai_active_set off
				battle_wait 0.5
				ai_active_set on
				set_counter elephant_gate 2
				set_counter rally_walls 0
			end_if

			if I_CompareCounter second_ring = 1
				and I_IsBattleSettlementCastle
				and I_BattleSettlementFortificationLevel > 2
				ai_gta_del_objective 0
				ai_active_set off
				battle_wait 0.5
				ai_active_set on
				set_counter second_ring 2
				set_counter rally_walls 2
			end_if

			if I_CompareCounter third_ring = 1
				and I_IsBattleSettlementCastle
				and I_BattleSettlementFortificationLevel > 2
				set_counter third_ring 0
				set_counter del_objective 1
			end_if

		end_if
		if I_BattleIsSallyOutBattle
			and I_BattlePlayerArmyIsAttacker
			and I_BattleEnemyArmyNumberOfMountClass elephant > 0

			if I_CompareCounter elephant_gate_s = 1
				ai_gta_del_objective 1
				ai_active_set off
				battle_wait 0.5
				ai_active_set on
				set_counter elephant_gate_s 2
				set_counter rally_walls_s 1
			end_if

			if I_CompareCounter second_ring_s = 1
				and I_IsBattleSettlementCastle
				and I_BattleSettlementFortificationLevel > 2
				ai_gta_del_objective 1
				ai_active_set off
				battle_wait 0.5
				ai_active_set on
				set_counter second_ring_s 2
				set_counter rally_walls_s 2
			end_if

			if I_CompareCounter third_ring_s = 1
				and I_IsBattleSettlementCastle
				and I_BattleSettlementFortificationLevel > 2
				set_counter third_ring_s 0
				set_counter del_objective_s 1
			end_if

		end_if
	end_monitor

	;;;;;;;Sally Out Assault
	monitor_conditions I_BattleStarted
		and I_CompareCounter sally-out_fix = 1
		and ! I_BattleIsFortBattle
		and I_BattleIsSallyOutBattle
		and I_BattlePlayerArmyIsAttacker
		and I_BattleSettlementFortificationLevel < 3
		and I_IsBattleSettlementCastle
		and I_BattleEnemyArmyNumberOfSpecialAbility drop_engines > 2
		and I_BattlePlayerAllianceOddsAgainst > 2.0

		set_counter kill_sally 1
		ai_gta_plan_set 1 ATTACK_SETTLEMENT
		ai_active_set on
		if I_BattleEnemyArmyNumberOfMountClass elephant > 0
			set_counter elephant_fix 1
			battle_wait 1
		end_if
		set_counter army2_sally 1
		if I_BattleEnemyArmyNumberOfClassAndCategory missile siege = 0
			set_counter wall_advance_s 1
		end_if
		set_counter sally-out_fix 0
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter sally-out_fix = 1
		and ! I_BattleIsFortBattle
		and I_BattleIsSallyOutBattle
		and I_BattlePlayerArmyIsAttacker
		and I_BattleSettlementFortificationLevel > 2
		and I_IsBattleSettlementCastle
		and I_BattleEnemyArmyNumberOfSpecialAbility drop_engines > 3
		and I_BattlePlayerAllianceOddsAgainst > 2.5

		set_counter kill_sally 1
		ai_gta_plan_set 1 ATTACK_SETTLEMENT
		ai_active_set on
		if I_BattleEnemyArmyNumberOfMountClass elephant > 0
			set_counter elephant_fix 1
			battle_wait 1
		end_if
		set_counter army2_sally 1
		if I_BattleEnemyArmyNumberOfClassAndCategory missile siege = 0
			set_counter wall_advance_s 1
		end_if
		set_counter sally-out_fix 0
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter sally-out_fix = 1
		and ! I_BattleIsFortBattle
		and I_BattleIsSallyOutBattle
		and I_BattlePlayerArmyIsAttacker
		and I_BattleSettlementFortificationLevel < 3
		and ! I_IsBattleSettlementCastle
		and I_BattleEnemyArmyNumberOfSpecialAbility drop_engines > 2
		and I_BattlePlayerAllianceOddsAgainst > 1.7

		set_counter kill_sally 1
		ai_gta_plan_set 1 ATTACK_SETTLEMENT
		ai_active_set on
		if I_BattleEnemyArmyNumberOfMountClass elephant > 0
			set_counter elephant_fix 1
			battle_wait 1
		end_if
		set_counter army2_sally 1
		if I_BattleEnemyArmyNumberOfClassAndCategory missile siege = 0
			set_counter wall_advance_s 1
		end_if
		set_counter sally-out_fix 0
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter sally-out_fix = 1
		and ! I_BattleIsFortBattle
		and I_BattleIsSallyOutBattle
		and I_BattlePlayerArmyIsAttacker
		and I_BattleSettlementFortificationLevel > 2
		and ! I_IsBattleSettlementCastle
		and I_BattleEnemyArmyNumberOfSpecialAbility drop_engines > 2
		and I_BattlePlayerAllianceOddsAgainst > 2.2

		set_counter kill_sally 1
		ai_gta_plan_set 1 ATTACK_SETTLEMENT
		ai_active_set on
		if I_BattleEnemyArmyNumberOfMountClass elephant > 0
			set_counter elephant_fix 1
			battle_wait 1
		end_if
		set_counter army2_sally 1
		if I_BattleEnemyArmyNumberOfClassAndCategory missile siege = 0
			set_counter wall_advance_s 1
		end_if
		set_counter sally-out_fix 0
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter sally-out_fix = 1
		and I_BattleIsFortBattle
		and I_BattleIsSallyOutBattle
		and I_BattlePlayerArmyIsAttacker
		and I_BattleEnemyArmyNumberOfSpecialAbility drop_engines > 2
		and I_BattlePlayerAllianceOddsAgainst > 1.8

		set_counter kill_sally 1
		ai_gta_plan_set 1 ATTACK_SETTLEMENT
		ai_active_set on
		if I_BattleEnemyArmyNumberOfMountClass elephant > 0
			set_counter elephant_fix 1
			battle_wait 1
		end_if
		set_counter army2_sally 1
		if I_BattleEnemyArmyNumberOfClassAndCategory missile siege = 0
			set_counter wall_advance_s 1
		end_if
		set_counter sally-out_fix 0
	end_monitor

	;;;;;;;Sally Out Defense

	monitor_conditions I_BattleStarted
		and I_CompareCounter sally_defense = 1
		and I_CompareCounter kill_sally = 0
		;	and ! I_BattleIsFortBattle
		and I_BattleIsSallyOutBattle
		and I_BattlePlayerArmyIsAttacker

		if I_CompareCounter army_south = 1
			ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, -750, 100
		end_if
		if I_CompareCounter army_north = 1
			ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, 750, 100
		end_if
		if I_CompareCounter army_east = 1
			ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 750, 0, 100
		end_if
		if I_CompareCounter army_west = 1
			ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 -750, 0, 100
		end_if

		if I_CompareCounter enemy_unit_count > 0
			ai_gta_add_unit_label 1 0 a2u1

			if I_CompareCounter enemy_unit_count > 1
				ai_gta_add_unit_label 1 0 a2u2

				if I_CompareCounter enemy_unit_count > 2
					ai_gta_add_unit_label 1 0 a2u3

					if I_CompareCounter enemy_unit_count > 3
						ai_gta_add_unit_label 1 0 a2u4

						if I_CompareCounter enemy_unit_count > 4
							ai_gta_add_unit_label 1 0 a2u5

							if I_CompareCounter enemy_unit_count > 5
								ai_gta_add_unit_label 1 0 a2u6

								if I_CompareCounter enemy_unit_count > 6
									ai_gta_add_unit_label 1 0 a2u7

									if I_CompareCounter enemy_unit_count > 7
										ai_gta_add_unit_label 1 0 a2u8

										if I_CompareCounter enemy_unit_count > 8
											ai_gta_add_unit_label 1 0 a2u9

											if I_CompareCounter enemy_unit_count > 9
												ai_gta_add_unit_label 1 0 a2u10

												if I_CompareCounter enemy_unit_count > 10
													ai_gta_add_unit_label 1 0 a2u11

													if I_CompareCounter enemy_unit_count > 11
														ai_gta_add_unit_label 1 0 a2u12

														if I_CompareCounter enemy_unit_count > 12
															ai_gta_add_unit_label 1 0 a2u13

															if I_CompareCounter enemy_unit_count > 13
																ai_gta_add_unit_label 1 0 a2u14

																if I_CompareCounter enemy_unit_count > 14
																	ai_gta_add_unit_label 1 0 a2u15

																	if I_CompareCounter enemy_unit_count > 15
																		ai_gta_add_unit_label 1 0 a2u16

																		if I_CompareCounter enemy_unit_count > 16
																			ai_gta_add_unit_label 1 0 a2u17

																			if I_CompareCounter enemy_unit_count > 17
																				ai_gta_add_unit_label 1 0 a2u18

																				if I_CompareCounter enemy_unit_count > 18
																					ai_gta_add_unit_label 1 0 a2u19

																					if I_CompareCounter enemy_unit_count = 20
																						ai_gta_add_unit_label 1 0 a2u20
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if

		set_counter sally_defense 2
		set_counter defend_location 1
		;    ai_active_set off
		battle_wait 0.5
		ai_active_set on
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter sally_defense = 2
		;	and I_BattlePlayerArmyNumberOfClassAndCategory missile siege > 0
		and I_UnitDistanceFromPosition a2u1 1 1 > 630
		and ! I_UnitEnemyUnitInRadius a2u1 160
		and ! I_IsUnitGroupEngaged army2

		set_counter sally_defense 0

		if I_CompareCounter enemy_unit_count > 0
			if I_IsUnitUnderFire a2u1
				inc_counter unit_under_fire 2
			end_if
			if I_UnitStatus a2u1 fighting
				inc_counter reform_back 1
			end_if
			if I_UnitStatus a2u1 pursuing
				inc_counter reform_back 1
			end_if
			if I_UnitStatus a2u1 charging
				inc_counter reform_back 1
			end_if

			if I_CompareCounter enemy_unit_count > 1
				if I_IsUnitUnderFire a2u2
					inc_counter unit_under_fire 1
				end_if
				if I_UnitStatus a2u2 fighting
					inc_counter reform_back 1
				end_if
				if I_UnitStatus a2u2 pursuing
					inc_counter reform_back 1
				end_if
				if I_UnitStatus a2u2 charging
					inc_counter reform_back 1
				end_if

				if I_CompareCounter enemy_unit_count > 2
					if I_IsUnitUnderFire a2u3
						inc_counter unit_under_fire 1
					end_if
					if I_UnitStatus a2u3 fighting
						inc_counter reform_back 1
					end_if
					if I_UnitStatus a2u3 pursuing
						inc_counter reform_back 1
					end_if
					if I_UnitStatus a2u3 charging
						inc_counter reform_back 1
					end_if

					if I_CompareCounter enemy_unit_count > 3
						if I_IsUnitUnderFire a2u4
							inc_counter unit_under_fire 1
						end_if
						if I_UnitStatus a2u4 fighting
							inc_counter reform_back 1
						end_if
						if I_UnitStatus a2u4 pursuing
							inc_counter reform_back 1
						end_if
						if I_UnitStatus a2u4 charging
							inc_counter reform_back 1
						end_if

						if I_CompareCounter enemy_unit_count > 4
							if I_IsUnitUnderFire a2u5
								inc_counter unit_under_fire 1
							end_if
							if I_UnitStatus a2u5 fighting
								inc_counter reform_back 1
							end_if
							if I_UnitStatus a2u5 pursuing
								inc_counter reform_back 1
							end_if
							if I_UnitStatus a2u5 charging
								inc_counter reform_back 1
							end_if

							if I_CompareCounter enemy_unit_count > 5
								if I_IsUnitUnderFire a2u6
									inc_counter unit_under_fire 1
								end_if
								if I_UnitStatus a2u6 fighting
									inc_counter reform_back 1
								end_if
								if I_UnitStatus a2u6 pursuing
									inc_counter reform_back 1
								end_if
								if I_UnitStatus a2u6 charging
									inc_counter reform_back 1
								end_if

								if I_CompareCounter enemy_unit_count > 6
									if I_IsUnitUnderFire a2u7
										inc_counter unit_under_fire 1
									end_if
									if I_UnitStatus a2u7 fighting
										inc_counter reform_back 1
									end_if
									if I_UnitStatus a2u7 pursuing
										inc_counter reform_back 1
									end_if
									if I_UnitStatus a2u7 charging
										inc_counter reform_back 1
									end_if

									if I_CompareCounter enemy_unit_count > 7
										if I_IsUnitUnderFire a2u8
											inc_counter unit_under_fire 1
										end_if
										if I_UnitStatus a2u8 fighting
											inc_counter reform_back 1
										end_if
										if I_UnitStatus a2u8 pursuing
											inc_counter reform_back 1
										end_if
										if I_UnitStatus a2u8 charging
											inc_counter reform_back 1
										end_if

										if I_CompareCounter enemy_unit_count > 8
											if I_IsUnitUnderFire a2u9
												inc_counter unit_under_fire 1
											end_if
											if I_UnitStatus a2u9 fighting
												inc_counter reform_back 1
											end_if
											if I_UnitStatus a2u9 pursuing
												inc_counter reform_back 1
											end_if
											if I_UnitStatus a2u9 charging
												inc_counter reform_back 1
											end_if

											if I_CompareCounter enemy_unit_count > 9
												if I_IsUnitUnderFire a2u10
													inc_counter unit_under_fire 1
												end_if
												if I_UnitStatus a2u10 fighting
													inc_counter reform_back 1
												end_if
												if I_UnitStatus a2u10 pursuing
													inc_counter reform_back 1
												end_if
												if I_UnitStatus a2u10 charging
													inc_counter reform_back 1
												end_if

												if I_CompareCounter enemy_unit_count > 10
													if I_IsUnitUnderFire a2u11
														inc_counter unit_under_fire 1
													end_if
													if I_UnitStatus a2u11 fighting
														inc_counter reform_back 1
													end_if
													if I_UnitStatus a2u11 pursuing
														inc_counter reform_back 1
													end_if
													if I_UnitStatus a2u11 charging
														inc_counter reform_back 1
													end_if

													if I_CompareCounter enemy_unit_count > 11
														if I_IsUnitUnderFire a2u12
															inc_counter unit_under_fire 1
														end_if
														if I_UnitStatus a2u12 fighting
															inc_counter reform_back 1
														end_if
														if I_UnitStatus a2u12 pursuing
															inc_counter reform_back 1
														end_if
														if I_UnitStatus a2u12 charging
															inc_counter reform_back 1
														end_if

														if I_CompareCounter enemy_unit_count > 12
															if I_IsUnitUnderFire a2u13
																inc_counter unit_under_fire 1
															end_if
															if I_UnitStatus a2u13 fighting
																inc_counter reform_back 1
															end_if
															if I_UnitStatus a2u13 pursuing
																inc_counter reform_back 1
															end_if
															if I_UnitStatus a2u13 charging
																inc_counter reform_back 1
															end_if

															if I_CompareCounter enemy_unit_count > 13
																if I_IsUnitUnderFire a2u14
																	inc_counter unit_under_fire 1
																end_if
																if I_UnitStatus a2u14 fighting
																	inc_counter reform_back 1
																end_if
																if I_UnitStatus a2u14 pursuing
																	inc_counter reform_back 1
																end_if
																if I_UnitStatus a2u14 charging
																	inc_counter reform_back 1
																end_if

																if I_CompareCounter enemy_unit_count > 14
																	if I_IsUnitUnderFire a2u15
																		inc_counter unit_under_fire 1
																	end_if
																	if I_UnitStatus a2u15 fighting
																		inc_counter reform_back 1
																	end_if
																	if I_UnitStatus a2u15 pursuing
																		inc_counter reform_back 1
																	end_if
																	if I_UnitStatus a2u15 charging
																		inc_counter reform_back 1
																	end_if

																	if I_CompareCounter enemy_unit_count > 15
																		if I_IsUnitUnderFire a2u16
																			inc_counter unit_under_fire 1
																		end_if
																		if I_UnitStatus a2u16 fighting
																			inc_counter reform_back 1
																		end_if
																		if I_UnitStatus a2u16 pursuing
																			inc_counter reform_back 1
																		end_if
																		if I_UnitStatus a2u16 charging
																			inc_counter reform_back 1
																		end_if

																		if I_CompareCounter enemy_unit_count > 16
																			if I_IsUnitUnderFire a2u17
																				inc_counter unit_under_fire 1
																			end_if
																			if I_UnitStatus a2u17 fighting
																				inc_counter reform_back 1
																			end_if
																			if I_UnitStatus a2u17 pursuing
																				inc_counter reform_back 1
																			end_if
																			if I_UnitStatus a2u17 charging
																				inc_counter reform_back 1
																			end_if

																			if I_CompareCounter enemy_unit_count > 17
																				if I_IsUnitUnderFire a2u18
																					inc_counter unit_under_fire 1
																				end_if
																				if I_UnitStatus a2u18 fighting
																					inc_counter reform_back 1
																				end_if
																				if I_UnitStatus a2u18 pursuing
																					inc_counter reform_back 1
																				end_if
																				if I_UnitStatus a2u18 charging
																					inc_counter reform_back 1
																				end_if

																				if I_CompareCounter enemy_unit_count > 18
																					if I_IsUnitUnderFire a2u19
																						inc_counter unit_under_fire 1
																					end_if
																					if I_UnitStatus a2u19 fighting
																						inc_counter reform_back 1
																					end_if
																					if I_UnitStatus a2u19 pursuing
																						inc_counter reform_back 1
																					end_if
																					if I_UnitStatus a2u19 charging
																						inc_counter reform_back 1
																					end_if

																					if I_CompareCounter enemy_unit_count = 20
																						if I_IsUnitUnderFire a2u20
																							inc_counter unit_under_fire 1
																						end_if
																						if I_UnitStatus a2u20 fighting
																							inc_counter reform_back 1
																						end_if
																						if I_UnitStatus a2u20 pursuing
																							inc_counter reform_back 1
																						end_if
																						if I_UnitStatus a2u20 charging
																							inc_counter reform_back 1
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if

		if I_CompareCounter sally_reinf > 0
			and I_UnitDistanceFromUnit a4u1 a2u1 < 300
			if I_IsUnitUnderFire a4u1
				inc_counter unit_under_fire 2
			end_if
			if I_UnitStatus a4u1 fighting
				inc_counter reform_back 1
			end_if
			if I_UnitStatus a4u1 pursuing
				inc_counter reform_back 1
			end_if
			if I_UnitStatus a4u1 charging
				inc_counter reform_back 1
			end_if
		end_if

		if I_CompareCounter unit_under_fire > 0
			and I_CompareCounter reform_back < 1

			ai_gta_del_objective 1
			battle_wait 0.5
			unit_group_order_halt army2
			battle_wait 0.5

			ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999

			if I_CompareCounter enemy_unit_count > 0
				if ! I_UnitDestroyed a2u1
					and ! I_UnitStatus a2u1 left_battle
					ai_gta_add_unit_label 1 0 a2u1
				end_if

				if I_CompareCounter enemy_unit_count > 1
					if ! I_UnitDestroyed a2u2
						and ! I_UnitStatus a2u2 left_battle
						ai_gta_add_unit_label 1 0 a2u2
					end_if

					if I_CompareCounter enemy_unit_count > 2
						if ! I_UnitDestroyed a2u3
							and ! I_UnitStatus a2u3 left_battle
							ai_gta_add_unit_label 1 0 a2u3
						end_if

						if I_CompareCounter enemy_unit_count > 3
							if ! I_UnitDestroyed a2u4
								and ! I_UnitStatus a2u4 left_battle
								ai_gta_add_unit_label 1 0 a2u4
							end_if

							if I_CompareCounter enemy_unit_count > 4
								if ! I_UnitDestroyed a2u5
									and ! I_UnitStatus a2u5 left_battle
									ai_gta_add_unit_label 1 0 a2u5
								end_if

								if I_CompareCounter enemy_unit_count > 5
									if ! I_UnitDestroyed a2u6
										and ! I_UnitStatus a2u6 left_battle
										ai_gta_add_unit_label 1 0 a2u6
									end_if

									if I_CompareCounter enemy_unit_count > 6
										if ! I_UnitDestroyed a2u7
											and ! I_UnitStatus a2u7 left_battle
											ai_gta_add_unit_label 1 0 a2u7
										end_if

										if I_CompareCounter enemy_unit_count > 7
											if ! I_UnitDestroyed a2u8
												and ! I_UnitStatus a2u8 left_battle
												ai_gta_add_unit_label 1 0 a2u8
											end_if

											if I_CompareCounter enemy_unit_count > 8
												if ! I_UnitDestroyed a2u9
													and ! I_UnitStatus a2u9 left_battle
													ai_gta_add_unit_label 1 0 a2u9
												end_if

												if I_CompareCounter enemy_unit_count > 9
													if ! I_UnitDestroyed a2u10
														and ! I_UnitStatus a2u10 left_battle
														ai_gta_add_unit_label 1 0 a2u10
													end_if

													if I_CompareCounter enemy_unit_count > 10
														if ! I_UnitDestroyed a2u11
															and ! I_UnitStatus a2u11 left_battle
															ai_gta_add_unit_label 1 0 a2u11
														end_if

														if I_CompareCounter enemy_unit_count > 11
															if ! I_UnitDestroyed a2u12
																and ! I_UnitStatus a2u12 left_battle
																ai_gta_add_unit_label 1 0 a2u12
															end_if

															if I_CompareCounter enemy_unit_count > 12
																if ! I_UnitDestroyed a2u13
																	and ! I_UnitStatus a2u13 left_battle
																	ai_gta_add_unit_label 1 0 a2u13
																end_if

																if I_CompareCounter enemy_unit_count > 13
																	if ! I_UnitDestroyed a2u14
																		and ! I_UnitStatus a2u14 left_battle
																		ai_gta_add_unit_label 1 0 a2u14
																	end_if

																	if I_CompareCounter enemy_unit_count > 14
																		if ! I_UnitDestroyed a2u15
																			and ! I_UnitStatus a2u15 left_battle
																			ai_gta_add_unit_label 1 0 a2u15
																		end_if

																		if I_CompareCounter enemy_unit_count > 15
																			if ! I_UnitDestroyed a2u16
																				and ! I_UnitStatus a2u16 left_battle
																				ai_gta_add_unit_label 1 0 a2u16
																			end_if

																			if I_CompareCounter enemy_unit_count > 16
																				if ! I_UnitDestroyed a2u17
																					and ! I_UnitStatus a2u17 left_battle
																					ai_gta_add_unit_label 1 0 a2u17
																				end_if

																				if I_CompareCounter enemy_unit_count > 17
																					if ! I_UnitDestroyed a2u18
																						and ! I_UnitStatus a2u18 left_battle
																						ai_gta_add_unit_label 1 0 a2u18
																					end_if

																					if I_CompareCounter enemy_unit_count > 18
																						if ! I_UnitDestroyed a2u19
																							and ! I_UnitStatus a2u19 left_battle
																							ai_gta_add_unit_label 1 0 a2u19
																						end_if

																						if I_CompareCounter enemy_unit_count = 20
																							if ! I_UnitDestroyed a2u20
																								and ! I_UnitStatus a2u20 left_battle
																								ai_gta_add_unit_label 1 0 a2u20
																							end_if
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if

			;    ai_active_set off
			battle_wait 0.5
			ai_active_set on
			inc_counter reform_multi 1
			set_counter unit_under_fire 0
			set_counter defend_location 2
			set_counter sally_defense_check 1
			battle_wait 30
			if I_CompareCounter sally_defense_check = 1
				set_counter sally_defense 3
			end_if
		end_if

		if I_CompareCounter sally_defense = 0
			set_counter sally_defense 2
		end_if
		set_counter reform_back 0
		battle_wait 7
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter sally_defense = 2
		;	and I_BattlePlayerArmyNumberOfClassAndCategory missile siege > 0
		and I_UnitDistanceFromPosition a2u1 1 1 > 560
		and I_UnitDistanceFromPosition a2u1 1 1 < 630
		and ! I_UnitEnemyUnitInRadius a2u1 160
		and ! I_IsUnitGroupEngaged army2

		set_counter sally_defense 0

		if I_CompareCounter enemy_unit_count > 0
			if I_IsUnitUnderFire a2u1
				inc_counter unit_under_fire 2
			end_if
			if I_UnitStatus a2u1 fighting
				inc_counter reform_back 1
			end_if
			if I_UnitStatus a2u1 pursuing
				inc_counter reform_back 1
			end_if
			if I_UnitStatus a2u1 charging
				inc_counter reform_back 1
			end_if

			if I_CompareCounter enemy_unit_count > 1
				if I_IsUnitUnderFire a2u2
					inc_counter unit_under_fire 1
				end_if
				if I_UnitStatus a2u2 fighting
					inc_counter reform_back 1
				end_if
				if I_UnitStatus a2u2 pursuing
					inc_counter reform_back 1
				end_if
				if I_UnitStatus a2u2 charging
					inc_counter reform_back 1
				end_if

				if I_CompareCounter enemy_unit_count > 2
					if I_IsUnitUnderFire a2u3
						inc_counter unit_under_fire 1
					end_if
					if I_UnitStatus a2u3 fighting
						inc_counter reform_back 1
					end_if
					if I_UnitStatus a2u3 pursuing
						inc_counter reform_back 1
					end_if
					if I_UnitStatus a2u3 charging
						inc_counter reform_back 1
					end_if

					if I_CompareCounter enemy_unit_count > 3
						if I_IsUnitUnderFire a2u4
							inc_counter unit_under_fire 1
						end_if
						if I_UnitStatus a2u4 fighting
							inc_counter reform_back 1
						end_if
						if I_UnitStatus a2u4 pursuing
							inc_counter reform_back 1
						end_if
						if I_UnitStatus a2u4 charging
							inc_counter reform_back 1
						end_if

						if I_CompareCounter enemy_unit_count > 4
							if I_IsUnitUnderFire a2u5
								inc_counter unit_under_fire 1
							end_if
							if I_UnitStatus a2u5 fighting
								inc_counter reform_back 1
							end_if
							if I_UnitStatus a2u5 pursuing
								inc_counter reform_back 1
							end_if
							if I_UnitStatus a2u5 charging
								inc_counter reform_back 1
							end_if

							if I_CompareCounter enemy_unit_count > 5
								if I_IsUnitUnderFire a2u6
									inc_counter unit_under_fire 1
								end_if
								if I_UnitStatus a2u6 fighting
									inc_counter reform_back 1
								end_if
								if I_UnitStatus a2u6 pursuing
									inc_counter reform_back 1
								end_if
								if I_UnitStatus a2u6 charging
									inc_counter reform_back 1
								end_if

								if I_CompareCounter enemy_unit_count > 6
									if I_IsUnitUnderFire a2u7
										inc_counter unit_under_fire 1
									end_if
									if I_UnitStatus a2u7 fighting
										inc_counter reform_back 1
									end_if
									if I_UnitStatus a2u7 pursuing
										inc_counter reform_back 1
									end_if
									if I_UnitStatus a2u7 charging
										inc_counter reform_back 1
									end_if

									if I_CompareCounter enemy_unit_count > 7
										if I_IsUnitUnderFire a2u8
											inc_counter unit_under_fire 1
										end_if
										if I_UnitStatus a2u8 fighting
											inc_counter reform_back 1
										end_if
										if I_UnitStatus a2u8 pursuing
											inc_counter reform_back 1
										end_if
										if I_UnitStatus a2u8 charging
											inc_counter reform_back 1
										end_if

										if I_CompareCounter enemy_unit_count > 8
											if I_IsUnitUnderFire a2u9
												inc_counter unit_under_fire 1
											end_if
											if I_UnitStatus a2u9 fighting
												inc_counter reform_back 1
											end_if
											if I_UnitStatus a2u9 pursuing
												inc_counter reform_back 1
											end_if
											if I_UnitStatus a2u9 charging
												inc_counter reform_back 1
											end_if

											if I_CompareCounter enemy_unit_count > 9
												if I_IsUnitUnderFire a2u10
													inc_counter unit_under_fire 1
												end_if
												if I_UnitStatus a2u10 fighting
													inc_counter reform_back 1
												end_if
												if I_UnitStatus a2u10 pursuing
													inc_counter reform_back 1
												end_if
												if I_UnitStatus a2u10 charging
													inc_counter reform_back 1
												end_if

												if I_CompareCounter enemy_unit_count > 10
													if I_IsUnitUnderFire a2u11
														inc_counter unit_under_fire 1
													end_if
													if I_UnitStatus a2u11 fighting
														inc_counter reform_back 1
													end_if
													if I_UnitStatus a2u11 pursuing
														inc_counter reform_back 1
													end_if
													if I_UnitStatus a2u11 charging
														inc_counter reform_back 1
													end_if

													if I_CompareCounter enemy_unit_count > 11
														if I_IsUnitUnderFire a2u12
															inc_counter unit_under_fire 1
														end_if
														if I_UnitStatus a2u12 fighting
															inc_counter reform_back 1
														end_if
														if I_UnitStatus a2u12 pursuing
															inc_counter reform_back 1
														end_if
														if I_UnitStatus a2u12 charging
															inc_counter reform_back 1
														end_if

														if I_CompareCounter enemy_unit_count > 12
															if I_IsUnitUnderFire a2u13
																inc_counter unit_under_fire 1
															end_if
															if I_UnitStatus a2u13 fighting
																inc_counter reform_back 1
															end_if
															if I_UnitStatus a2u13 pursuing
																inc_counter reform_back 1
															end_if
															if I_UnitStatus a2u13 charging
																inc_counter reform_back 1
															end_if

															if I_CompareCounter enemy_unit_count > 13
																if I_IsUnitUnderFire a2u14
																	inc_counter unit_under_fire 1
																end_if
																if I_UnitStatus a2u14 fighting
																	inc_counter reform_back 1
																end_if
																if I_UnitStatus a2u14 pursuing
																	inc_counter reform_back 1
																end_if
																if I_UnitStatus a2u14 charging
																	inc_counter reform_back 1
																end_if

																if I_CompareCounter enemy_unit_count > 14
																	if I_IsUnitUnderFire a2u15
																		inc_counter unit_under_fire 1
																	end_if
																	if I_UnitStatus a2u15 fighting
																		inc_counter reform_back 1
																	end_if
																	if I_UnitStatus a2u15 pursuing
																		inc_counter reform_back 1
																	end_if
																	if I_UnitStatus a2u15 charging
																		inc_counter reform_back 1
																	end_if

																	if I_CompareCounter enemy_unit_count > 15
																		if I_IsUnitUnderFire a2u16
																			inc_counter unit_under_fire 1
																		end_if
																		if I_UnitStatus a2u16 fighting
																			inc_counter reform_back 1
																		end_if
																		if I_UnitStatus a2u16 pursuing
																			inc_counter reform_back 1
																		end_if
																		if I_UnitStatus a2u16 charging
																			inc_counter reform_back 1
																		end_if

																		if I_CompareCounter enemy_unit_count > 16
																			if I_IsUnitUnderFire a2u17
																				inc_counter unit_under_fire 1
																			end_if
																			if I_UnitStatus a2u17 fighting
																				inc_counter reform_back 1
																			end_if
																			if I_UnitStatus a2u17 pursuing
																				inc_counter reform_back 1
																			end_if
																			if I_UnitStatus a2u17 charging
																				inc_counter reform_back 1
																			end_if

																			if I_CompareCounter enemy_unit_count > 17
																				if I_IsUnitUnderFire a2u18
																					inc_counter unit_under_fire 1
																				end_if
																				if I_UnitStatus a2u18 fighting
																					inc_counter reform_back 1
																				end_if
																				if I_UnitStatus a2u18 pursuing
																					inc_counter reform_back 1
																				end_if
																				if I_UnitStatus a2u18 charging
																					inc_counter reform_back 1
																				end_if

																				if I_CompareCounter enemy_unit_count > 18
																					if I_IsUnitUnderFire a2u19
																						inc_counter unit_under_fire 1
																					end_if
																					if I_UnitStatus a2u19 fighting
																						inc_counter reform_back 1
																					end_if
																					if I_UnitStatus a2u19 pursuing
																						inc_counter reform_back 1
																					end_if
																					if I_UnitStatus a2u19 charging
																						inc_counter reform_back 1
																					end_if

																					if I_CompareCounter enemy_unit_count = 20
																						if I_IsUnitUnderFire a2u20
																							inc_counter unit_under_fire 1
																						end_if
																						if I_UnitStatus a2u20 fighting
																							inc_counter reform_back 1
																						end_if
																						if I_UnitStatus a2u20 pursuing
																							inc_counter reform_back 1
																						end_if
																						if I_UnitStatus a2u20 charging
																							inc_counter reform_back 1
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if

		if I_CompareCounter sally_reinf > 0
			and I_UnitDistanceFromUnit a4u1 a2u1 < 300
			if I_IsUnitUnderFire a4u1
				inc_counter unit_under_fire 2
			end_if
			if I_UnitStatus a4u1 fighting
				inc_counter reform_back 1
			end_if
			if I_UnitStatus a4u1 pursuing
				inc_counter reform_back 1
			end_if
			if I_UnitStatus a4u1 charging
				inc_counter reform_back 1
			end_if
		end_if

		if I_CompareCounter repeat_test1 = 1
			set_counter repeat_test1 2
		end_if
		if I_CompareCounter unit_under_fire > 0
			and I_CompareCounter reform_back < 1
			and I_CompareCounter repeat_test1 = 0

			set_counter unit_under_fire 0
			set_counter repeat_test1 1
			;battle_wait 10
		end_if

		if I_CompareCounter unit_under_fire > 0
			and I_CompareCounter reform_back < 1
			and I_CompareCounter repeat_test1 = 2

			ai_gta_del_objective 1
			battle_wait 0.5
			unit_group_order_halt army2
			battle_wait 0.5

			ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999

			if I_CompareCounter enemy_unit_count > 0
				if ! I_UnitDestroyed a2u1
					and ! I_UnitStatus a2u1 left_battle
					ai_gta_add_unit_label 1 0 a2u1
				end_if

				if I_CompareCounter enemy_unit_count > 1
					if ! I_UnitDestroyed a2u2
						and ! I_UnitStatus a2u2 left_battle
						ai_gta_add_unit_label 1 0 a2u2
					end_if

					if I_CompareCounter enemy_unit_count > 2
						if ! I_UnitDestroyed a2u3
							and ! I_UnitStatus a2u3 left_battle
							ai_gta_add_unit_label 1 0 a2u3
						end_if

						if I_CompareCounter enemy_unit_count > 3
							if ! I_UnitDestroyed a2u4
								and ! I_UnitStatus a2u4 left_battle
								ai_gta_add_unit_label 1 0 a2u4
							end_if

							if I_CompareCounter enemy_unit_count > 4
								if ! I_UnitDestroyed a2u5
									and ! I_UnitStatus a2u5 left_battle
									ai_gta_add_unit_label 1 0 a2u5
								end_if

								if I_CompareCounter enemy_unit_count > 5
									if ! I_UnitDestroyed a2u6
										and ! I_UnitStatus a2u6 left_battle
										ai_gta_add_unit_label 1 0 a2u6
									end_if

									if I_CompareCounter enemy_unit_count > 6
										if ! I_UnitDestroyed a2u7
											and ! I_UnitStatus a2u7 left_battle
											ai_gta_add_unit_label 1 0 a2u7
										end_if

										if I_CompareCounter enemy_unit_count > 7
											if ! I_UnitDestroyed a2u8
												and ! I_UnitStatus a2u8 left_battle
												ai_gta_add_unit_label 1 0 a2u8
											end_if

											if I_CompareCounter enemy_unit_count > 8
												if ! I_UnitDestroyed a2u9
													and ! I_UnitStatus a2u9 left_battle
													ai_gta_add_unit_label 1 0 a2u9
												end_if

												if I_CompareCounter enemy_unit_count > 9
													if ! I_UnitDestroyed a2u10
														and ! I_UnitStatus a2u10 left_battle
														ai_gta_add_unit_label 1 0 a2u10
													end_if

													if I_CompareCounter enemy_unit_count > 10
														if ! I_UnitDestroyed a2u11
															and ! I_UnitStatus a2u11 left_battle
															ai_gta_add_unit_label 1 0 a2u11
														end_if

														if I_CompareCounter enemy_unit_count > 11
															if ! I_UnitDestroyed a2u12
																and ! I_UnitStatus a2u12 left_battle
																ai_gta_add_unit_label 1 0 a2u12
															end_if

															if I_CompareCounter enemy_unit_count > 12
																if ! I_UnitDestroyed a2u13
																	and ! I_UnitStatus a2u13 left_battle
																	ai_gta_add_unit_label 1 0 a2u13
																end_if

																if I_CompareCounter enemy_unit_count > 13
																	if ! I_UnitDestroyed a2u14
																		and ! I_UnitStatus a2u14 left_battle
																		ai_gta_add_unit_label 1 0 a2u14
																	end_if

																	if I_CompareCounter enemy_unit_count > 14
																		if ! I_UnitDestroyed a2u15
																			and ! I_UnitStatus a2u15 left_battle
																			ai_gta_add_unit_label 1 0 a2u15
																		end_if

																		if I_CompareCounter enemy_unit_count > 15
																			if ! I_UnitDestroyed a2u16
																				and ! I_UnitStatus a2u16 left_battle
																				ai_gta_add_unit_label 1 0 a2u16
																			end_if

																			if I_CompareCounter enemy_unit_count > 16
																				if ! I_UnitDestroyed a2u17
																					and ! I_UnitStatus a2u17 left_battle
																					ai_gta_add_unit_label 1 0 a2u17
																				end_if

																				if I_CompareCounter enemy_unit_count > 17
																					if ! I_UnitDestroyed a2u18
																						and ! I_UnitStatus a2u18 left_battle
																						ai_gta_add_unit_label 1 0 a2u18
																					end_if

																					if I_CompareCounter enemy_unit_count > 18
																						if ! I_UnitDestroyed a2u19
																							and ! I_UnitStatus a2u19 left_battle
																							ai_gta_add_unit_label 1 0 a2u19
																						end_if

																						if I_CompareCounter enemy_unit_count = 20
																							if ! I_UnitDestroyed a2u20
																								and ! I_UnitStatus a2u20 left_battle
																								ai_gta_add_unit_label 1 0 a2u20
																							end_if
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if

			;    ai_active_set off
			battle_wait 0.5
			ai_active_set on
			inc_counter reform_multi 1
			set_counter unit_under_fire 0
			set_counter defend_location 2
			set_counter sally_defense_check 1
			battle_wait 30
			if I_CompareCounter sally_defense_check = 1
				set_counter sally_defense 3
			end_if
		end_if

		if I_CompareCounter sally_defense = 0
			set_counter sally_defense 2
		end_if
		set_counter reform_back 0
		battle_wait 7
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter sally_defense = 2
		and I_BattleIsSallyOutBattle
		and I_UnitDistanceFromPosition a2u1 1 1 > 630
		and I_UnitEnemyUnitInRadius a2u1 160

		set_counter sally_defense 0
		ai_gta_del_objective 1
		battle_wait 0.5
		unit_group_order_halt army2
		battle_wait 0.5
		ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999

		if I_CompareCounter enemy_unit_count > 0
			if ! I_UnitDestroyed a2u1
				and ! I_UnitStatus a2u1 left_battle
				ai_gta_add_unit_label 1 0 a2u1
			end_if

			if I_CompareCounter enemy_unit_count > 1
				if ! I_UnitDestroyed a2u2
					and ! I_UnitStatus a2u2 left_battle
					ai_gta_add_unit_label 1 0 a2u2
				end_if

				if I_CompareCounter enemy_unit_count > 2
					if ! I_UnitDestroyed a2u3
						and ! I_UnitStatus a2u3 left_battle
						ai_gta_add_unit_label 1 0 a2u3
					end_if

					if I_CompareCounter enemy_unit_count > 3
						if ! I_UnitDestroyed a2u4
							and ! I_UnitStatus a2u4 left_battle
							ai_gta_add_unit_label 1 0 a2u4
						end_if

						if I_CompareCounter enemy_unit_count > 4
							if ! I_UnitDestroyed a2u5
								and ! I_UnitStatus a2u5 left_battle
								ai_gta_add_unit_label 1 0 a2u5
							end_if

							if I_CompareCounter enemy_unit_count > 5
								if ! I_UnitDestroyed a2u6
									and ! I_UnitStatus a2u6 left_battle
									ai_gta_add_unit_label 1 0 a2u6
								end_if

								if I_CompareCounter enemy_unit_count > 6
									if ! I_UnitDestroyed a2u7
										and ! I_UnitStatus a2u7 left_battle
										ai_gta_add_unit_label 1 0 a2u7
									end_if

									if I_CompareCounter enemy_unit_count > 7
										if ! I_UnitDestroyed a2u8
											and ! I_UnitStatus a2u8 left_battle
											ai_gta_add_unit_label 1 0 a2u8
										end_if

										if I_CompareCounter enemy_unit_count > 8
											if ! I_UnitDestroyed a2u9
												and ! I_UnitStatus a2u9 left_battle
												ai_gta_add_unit_label 1 0 a2u9
											end_if

											if I_CompareCounter enemy_unit_count > 9
												if ! I_UnitDestroyed a2u10
													and ! I_UnitStatus a2u10 left_battle
													ai_gta_add_unit_label 1 0 a2u10
												end_if

												if I_CompareCounter enemy_unit_count > 10
													if ! I_UnitDestroyed a2u11
														and ! I_UnitStatus a2u11 left_battle
														ai_gta_add_unit_label 1 0 a2u11
													end_if

													if I_CompareCounter enemy_unit_count > 11
														if ! I_UnitDestroyed a2u12
															and ! I_UnitStatus a2u12 left_battle
															ai_gta_add_unit_label 1 0 a2u12
														end_if

														if I_CompareCounter enemy_unit_count > 12
															if ! I_UnitDestroyed a2u13
																and ! I_UnitStatus a2u13 left_battle
																ai_gta_add_unit_label 1 0 a2u13
															end_if

															if I_CompareCounter enemy_unit_count > 13
																if ! I_UnitDestroyed a2u14
																	and ! I_UnitStatus a2u14 left_battle
																	ai_gta_add_unit_label 1 0 a2u14
																end_if

																if I_CompareCounter enemy_unit_count > 14
																	if ! I_UnitDestroyed a2u15
																		and ! I_UnitStatus a2u15 left_battle
																		ai_gta_add_unit_label 1 0 a2u15
																	end_if

																	if I_CompareCounter enemy_unit_count > 15
																		if ! I_UnitDestroyed a2u16
																			and ! I_UnitStatus a2u16 left_battle
																			ai_gta_add_unit_label 1 0 a2u16
																		end_if

																		if I_CompareCounter enemy_unit_count > 16
																			if ! I_UnitDestroyed a2u17
																				and ! I_UnitStatus a2u17 left_battle
																				ai_gta_add_unit_label 1 0 a2u17
																			end_if

																			if I_CompareCounter enemy_unit_count > 17
																				if ! I_UnitDestroyed a2u18
																					and ! I_UnitStatus a2u18 left_battle
																					ai_gta_add_unit_label 1 0 a2u18
																				end_if

																				if I_CompareCounter enemy_unit_count > 18
																					if ! I_UnitDestroyed a2u19
																						and ! I_UnitStatus a2u19 left_battle
																						ai_gta_add_unit_label 1 0 a2u19
																					end_if

																					if I_CompareCounter enemy_unit_count = 20
																						if ! I_UnitDestroyed a2u20
																							and ! I_UnitStatus a2u20 left_battle
																							ai_gta_add_unit_label 1 0 a2u20
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if

		;    ai_active_set off
		battle_wait 0.5
		ai_active_set on
		inc_counter reform_multi 1
		set_counter defend_location 2
		set_counter sally_defense_check 1
		battle_wait 30
		if I_CompareCounter sally_defense_check = 1
			set_counter sally_defense 3
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter sally_defense = 2
		and I_UnitDistanceFromPosition a2u1 1 1 > 560
		and I_UnitDistanceFromPosition a2u1 1 1 < 630
		and I_UnitEnemyUnitInRadius a2u1 160

		set_counter sally_defense 0
		ai_gta_del_objective 1
		battle_wait 0.5
		unit_group_order_halt army2
		battle_wait 0.5
		ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999

		if I_CompareCounter enemy_unit_count > 0
			if ! I_UnitDestroyed a2u1
				and ! I_UnitStatus a2u1 left_battle
				ai_gta_add_unit_label 1 0 a2u1
			end_if

			if I_CompareCounter enemy_unit_count > 1
				if ! I_UnitDestroyed a2u2
					and ! I_UnitStatus a2u2 left_battle
					ai_gta_add_unit_label 1 0 a2u2
				end_if

				if I_CompareCounter enemy_unit_count > 2
					if ! I_UnitDestroyed a2u3
						and ! I_UnitStatus a2u3 left_battle
						ai_gta_add_unit_label 1 0 a2u3
					end_if

					if I_CompareCounter enemy_unit_count > 3
						if ! I_UnitDestroyed a2u4
							and ! I_UnitStatus a2u4 left_battle
							ai_gta_add_unit_label 1 0 a2u4
						end_if

						if I_CompareCounter enemy_unit_count > 4
							if ! I_UnitDestroyed a2u5
								and ! I_UnitStatus a2u5 left_battle
								ai_gta_add_unit_label 1 0 a2u5
							end_if

							if I_CompareCounter enemy_unit_count > 5
								if ! I_UnitDestroyed a2u6
									and ! I_UnitStatus a2u6 left_battle
									ai_gta_add_unit_label 1 0 a2u6
								end_if

								if I_CompareCounter enemy_unit_count > 6
									if ! I_UnitDestroyed a2u7
										and ! I_UnitStatus a2u7 left_battle
										ai_gta_add_unit_label 1 0 a2u7
									end_if

									if I_CompareCounter enemy_unit_count > 7
										if ! I_UnitDestroyed a2u8
											and ! I_UnitStatus a2u8 left_battle
											ai_gta_add_unit_label 1 0 a2u8
										end_if

										if I_CompareCounter enemy_unit_count > 8
											if ! I_UnitDestroyed a2u9
												and ! I_UnitStatus a2u9 left_battle
												ai_gta_add_unit_label 1 0 a2u9
											end_if

											if I_CompareCounter enemy_unit_count > 9
												if ! I_UnitDestroyed a2u10
													and ! I_UnitStatus a2u10 left_battle
													ai_gta_add_unit_label 1 0 a2u10
												end_if

												if I_CompareCounter enemy_unit_count > 10
													if ! I_UnitDestroyed a2u11
														and ! I_UnitStatus a2u11 left_battle
														ai_gta_add_unit_label 1 0 a2u11
													end_if

													if I_CompareCounter enemy_unit_count > 11
														if ! I_UnitDestroyed a2u12
															and ! I_UnitStatus a2u12 left_battle
															ai_gta_add_unit_label 1 0 a2u12
														end_if

														if I_CompareCounter enemy_unit_count > 12
															if ! I_UnitDestroyed a2u13
																and ! I_UnitStatus a2u13 left_battle
																ai_gta_add_unit_label 1 0 a2u13
															end_if

															if I_CompareCounter enemy_unit_count > 13
																if ! I_UnitDestroyed a2u14
																	and ! I_UnitStatus a2u14 left_battle
																	ai_gta_add_unit_label 1 0 a2u14
																end_if

																if I_CompareCounter enemy_unit_count > 14
																	if ! I_UnitDestroyed a2u15
																		and ! I_UnitStatus a2u15 left_battle
																		ai_gta_add_unit_label 1 0 a2u15
																	end_if

																	if I_CompareCounter enemy_unit_count > 15
																		if ! I_UnitDestroyed a2u16
																			and ! I_UnitStatus a2u16 left_battle
																			ai_gta_add_unit_label 1 0 a2u16
																		end_if

																		if I_CompareCounter enemy_unit_count > 16
																			if ! I_UnitDestroyed a2u17
																				and ! I_UnitStatus a2u17 left_battle
																				ai_gta_add_unit_label 1 0 a2u17
																			end_if

																			if I_CompareCounter enemy_unit_count > 17
																				if ! I_UnitDestroyed a2u18
																					and ! I_UnitStatus a2u18 left_battle
																					ai_gta_add_unit_label 1 0 a2u18
																				end_if

																				if I_CompareCounter enemy_unit_count > 18
																					if ! I_UnitDestroyed a2u19
																						and ! I_UnitStatus a2u19 left_battle
																						ai_gta_add_unit_label 1 0 a2u19
																					end_if

																					if I_CompareCounter enemy_unit_count = 20
																						if ! I_UnitDestroyed a2u20
																							and ! I_UnitStatus a2u20 left_battle
																							ai_gta_add_unit_label 1 0 a2u20
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if

		;    ai_active_set off
		battle_wait 0.5
		ai_active_set on
		inc_counter reform_multi 1
		set_counter defend_location 2
		set_counter sally_defense_check 1
		battle_wait 30
		if I_CompareCounter sally_defense_check = 1
			set_counter sally_defense 3
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter sally_defense = 3
		and I_CompareCounter reform_multi < 2
		;	and I_UnitDistanceFromPosition a2u1 1 1 < 660
		and I_UnitGroupDistanceFromPosition army2 1 1 < 630
		and ! I_IsUnitGroupEngaged army2

		set_counter sally_defense 6

		if I_CompareCounter enemy_unit_count > 0
			if I_UnitStatus a2u1 fighting
				inc_counter reform_back 3
			end_if
			if I_UnitStatus a2u1 pursuing
				inc_counter reform_back 3
			end_if
			if I_UnitStatus a2u1 charging
				inc_counter reform_back 3
			end_if

			if I_CompareCounter enemy_unit_count > 1
				if I_UnitStatus a2u2 fighting
					inc_counter reform_back 1
				end_if
				if I_UnitStatus a2u2 pursuing
					inc_counter reform_back 1
				end_if
				if I_UnitStatus a2u2 charging
					inc_counter reform_back 1
				end_if

				if I_CompareCounter enemy_unit_count > 2
					if I_UnitStatus a2u3 fighting
						inc_counter reform_back 1
					end_if
					if I_UnitStatus a2u3 pursuing
						inc_counter reform_back 1
					end_if
					if I_UnitStatus a2u3 charging
						inc_counter reform_back 1
					end_if

					if I_CompareCounter enemy_unit_count > 3
						if I_UnitStatus a2u4 fighting
							inc_counter reform_back 1
						end_if
						if I_UnitStatus a2u4 pursuing
							inc_counter reform_back 1
						end_if
						if I_UnitStatus a2u4 charging
							inc_counter reform_back 1
						end_if

						if I_CompareCounter enemy_unit_count > 4
							if I_UnitStatus a2u5 fighting
								inc_counter reform_back 1
							end_if
							if I_UnitStatus a2u5 pursuing
								inc_counter reform_back 1
							end_if
							if I_UnitStatus a2u5 charging
								inc_counter reform_back 1
							end_if

							if I_CompareCounter enemy_unit_count > 5
								if I_UnitStatus a2u6 fighting
									inc_counter reform_back 1
								end_if
								if I_UnitStatus a2u6 pursuing
									inc_counter reform_back 1
								end_if
								if I_UnitStatus a2u6 charging
									inc_counter reform_back 1
								end_if

								if I_CompareCounter enemy_unit_count > 6
									if I_UnitStatus a2u7 fighting
										inc_counter reform_back 1
									end_if
									if I_UnitStatus a2u7 pursuing
										inc_counter reform_back 1
									end_if
									if I_UnitStatus a2u7 charging
										inc_counter reform_back 1
									end_if

									if I_CompareCounter enemy_unit_count > 7
										if I_UnitStatus a2u8 fighting
											inc_counter reform_back 1
										end_if
										if I_UnitStatus a2u8 pursuing
											inc_counter reform_back 1
										end_if
										if I_UnitStatus a2u8 charging
											inc_counter reform_back 1
										end_if

										if I_CompareCounter enemy_unit_count > 8
											if I_UnitStatus a2u9 fighting
												inc_counter reform_back 1
											end_if
											if I_UnitStatus a2u9 pursuing
												inc_counter reform_back 1
											end_if
											if I_UnitStatus a2u9 charging
												inc_counter reform_back 1
											end_if

											if I_CompareCounter enemy_unit_count > 9
												if I_UnitStatus a2u10 fighting
													inc_counter reform_back 1
												end_if
												if I_UnitStatus a2u10 pursuing
													inc_counter reform_back 1
												end_if
												if I_UnitStatus a2u10 charging
													inc_counter reform_back 1
												end_if

												if I_CompareCounter enemy_unit_count > 10
													if I_UnitStatus a2u11 fighting
														inc_counter reform_back 1
													end_if
													if I_UnitStatus a2u11 pursuing
														inc_counter reform_back 1
													end_if
													if I_UnitStatus a2u11 charging
														inc_counter reform_back 1
													end_if

													if I_CompareCounter enemy_unit_count > 11
														if I_UnitStatus a2u12 fighting
															inc_counter reform_back 1
														end_if
														if I_UnitStatus a2u12 pursuing
															inc_counter reform_back 1
														end_if
														if I_UnitStatus a2u12 charging
															inc_counter reform_back 1
														end_if

														if I_CompareCounter enemy_unit_count > 12
															if I_UnitStatus a2u13 fighting
																inc_counter reform_back 1
															end_if
															if I_UnitStatus a2u13 pursuing
																inc_counter reform_back 1
															end_if
															if I_UnitStatus a2u13 charging
																inc_counter reform_back 1
															end_if

															if I_CompareCounter enemy_unit_count > 13
																if I_UnitStatus a2u14 fighting
																	inc_counter reform_back 1
																end_if
																if I_UnitStatus a2u14 pursuing
																	inc_counter reform_back 1
																end_if
																if I_UnitStatus a2u14 charging
																	inc_counter reform_back 1
																end_if

																if I_CompareCounter enemy_unit_count > 14
																	if I_UnitStatus a2u15 fighting
																		inc_counter reform_back 1
																	end_if
																	if I_UnitStatus a2u15 pursuing
																		inc_counter reform_back 1
																	end_if
																	if I_UnitStatus a2u15 charging
																		inc_counter reform_back 1
																	end_if

																	if I_CompareCounter enemy_unit_count > 15
																		if I_UnitStatus a2u16 fighting
																			inc_counter reform_back 1
																		end_if
																		if I_UnitStatus a2u16 pursuing
																			inc_counter reform_back 1
																		end_if
																		if I_UnitStatus a2u16 charging
																			inc_counter reform_back 1
																		end_if

																		if I_CompareCounter enemy_unit_count > 16
																			if I_UnitStatus a2u17 fighting
																				inc_counter reform_back 1
																			end_if
																			if I_UnitStatus a2u17 pursuing
																				inc_counter reform_back 1
																			end_if
																			if I_UnitStatus a2u17 charging
																				inc_counter reform_back 1
																			end_if

																			if I_CompareCounter enemy_unit_count > 17
																				if I_UnitStatus a2u18 fighting
																					inc_counter reform_back 1
																				end_if
																				if I_UnitStatus a2u18 pursuing
																					inc_counter reform_back 1
																				end_if
																				if I_UnitStatus a2u18 charging
																					inc_counter reform_back 1
																				end_if

																				if I_CompareCounter enemy_unit_count > 18
																					if I_UnitStatus a2u19 fighting
																						inc_counter reform_back 1
																					end_if
																					if I_UnitStatus a2u19 pursuing
																						inc_counter reform_back 1
																					end_if
																					if I_UnitStatus a2u19 charging
																						inc_counter reform_back 1
																					end_if

																					if I_CompareCounter enemy_unit_count = 20
																						if I_UnitStatus a2u20 fighting
																							inc_counter reform_back 1
																						end_if
																						if I_UnitStatus a2u20 pursuing
																							inc_counter reform_back 1
																						end_if
																						if I_UnitStatus a2u20 charging
																							inc_counter reform_back 1
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if

		if I_CompareCounter repeat_test2 = 1
			set_counter repeat_test2 2
		end_if
		if I_CompareCounter reform_back = 0
			and I_CompareCounter repeat_test2 = 0

			set_counter repeat_test2 1
			set_counter sally_defense 3
		end_if

		if I_CompareCounter reform_back = 0
			and I_CompareCounter repeat_test2 = 2

			ai_gta_del_objective 1
			battle_wait 0.5
			unit_group_order_halt army2
			battle_wait 0.5

			if I_CompareCounter army_south = 1
				ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, -750, 100
			end_if
			if I_CompareCounter army_north = 1
				ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, 750, 100
			end_if
			if I_CompareCounter army_east = 1
				ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 750, 0, 100
			end_if
			if I_CompareCounter army_west = 1
				ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 -750, 0, 100
			end_if

			if I_CompareCounter enemy_unit_count > 0
				if ! I_UnitDestroyed a2u1
					and ! I_UnitStatus a2u1 left_battle
					ai_gta_add_unit_label 1 0 a2u1
				end_if

				if I_CompareCounter enemy_unit_count > 1
					if ! I_UnitDestroyed a2u2
						and ! I_UnitStatus a2u2 left_battle
						ai_gta_add_unit_label 1 0 a2u2
					end_if

					if I_CompareCounter enemy_unit_count > 2
						if ! I_UnitDestroyed a2u3
							and ! I_UnitStatus a2u3 left_battle
							ai_gta_add_unit_label 1 0 a2u3
						end_if

						if I_CompareCounter enemy_unit_count > 3
							if ! I_UnitDestroyed a2u4
								and ! I_UnitStatus a2u4 left_battle
								ai_gta_add_unit_label 1 0 a2u4
							end_if

							if I_CompareCounter enemy_unit_count > 4
								if ! I_UnitDestroyed a2u5
									and ! I_UnitStatus a2u5 left_battle
									ai_gta_add_unit_label 1 0 a2u5
								end_if

								if I_CompareCounter enemy_unit_count > 5
									if ! I_UnitDestroyed a2u6
										and ! I_UnitStatus a2u6 left_battle
										ai_gta_add_unit_label 1 0 a2u6
									end_if

									if I_CompareCounter enemy_unit_count > 6
										if ! I_UnitDestroyed a2u7
											and ! I_UnitStatus a2u7 left_battle
											ai_gta_add_unit_label 1 0 a2u7
										end_if

										if I_CompareCounter enemy_unit_count > 7
											if ! I_UnitDestroyed a2u8
												and ! I_UnitStatus a2u8 left_battle
												ai_gta_add_unit_label 1 0 a2u8
											end_if

											if I_CompareCounter enemy_unit_count > 8
												if ! I_UnitDestroyed a2u9
													and ! I_UnitStatus a2u9 left_battle
													ai_gta_add_unit_label 1 0 a2u9
												end_if

												if I_CompareCounter enemy_unit_count > 9
													if ! I_UnitDestroyed a2u10
														and ! I_UnitStatus a2u10 left_battle
														ai_gta_add_unit_label 1 0 a2u10
													end_if

													if I_CompareCounter enemy_unit_count > 10
														if ! I_UnitDestroyed a2u11
															and ! I_UnitStatus a2u11 left_battle
															ai_gta_add_unit_label 1 0 a2u11
														end_if

														if I_CompareCounter enemy_unit_count > 11
															if ! I_UnitDestroyed a2u12
																and ! I_UnitStatus a2u12 left_battle
																ai_gta_add_unit_label 1 0 a2u12
															end_if

															if I_CompareCounter enemy_unit_count > 12
																if ! I_UnitDestroyed a2u13
																	and ! I_UnitStatus a2u13 left_battle
																	ai_gta_add_unit_label 1 0 a2u13
																end_if

																if I_CompareCounter enemy_unit_count > 13
																	if ! I_UnitDestroyed a2u14
																		and ! I_UnitStatus a2u14 left_battle
																		ai_gta_add_unit_label 1 0 a2u14
																	end_if

																	if I_CompareCounter enemy_unit_count > 14
																		if ! I_UnitDestroyed a2u15
																			and ! I_UnitStatus a2u15 left_battle
																			ai_gta_add_unit_label 1 0 a2u15
																		end_if

																		if I_CompareCounter enemy_unit_count > 15
																			if ! I_UnitDestroyed a2u16
																				and ! I_UnitStatus a2u16 left_battle
																				ai_gta_add_unit_label 1 0 a2u16
																			end_if

																			if I_CompareCounter enemy_unit_count > 16
																				if ! I_UnitDestroyed a2u17
																					and ! I_UnitStatus a2u17 left_battle
																					ai_gta_add_unit_label 1 0 a2u17
																				end_if

																				if I_CompareCounter enemy_unit_count > 17
																					if ! I_UnitDestroyed a2u18
																						and ! I_UnitStatus a2u18 left_battle
																						ai_gta_add_unit_label 1 0 a2u18
																					end_if

																					if I_CompareCounter enemy_unit_count > 18
																						if ! I_UnitDestroyed a2u19
																							and ! I_UnitStatus a2u19 left_battle
																							ai_gta_add_unit_label 1 0 a2u19
																						end_if

																						if I_CompareCounter enemy_unit_count = 20
																							if ! I_UnitDestroyed a2u20
																								and ! I_UnitStatus a2u20 left_battle
																								ai_gta_add_unit_label 1 0 a2u20
																							end_if
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if

			battle_wait 0.5
			;	unit_group_order_halt army2
			;    ai_active_set off
			battle_wait 0.5
			ai_active_set on
			set_counter sally_defense 2
			set_counter defend_location 1
			set_counter reform_multi 1
			set_counter reset_position 0
			set_counter repeat_test1 0
			set_counter repeat_test2 0
			set_counter repeat_test3 0
			set_counter repeat_test4 0
			set_counter repeat_test5 0
			set_counter repeat_test6 0
		end_if

		if I_CompareCounter reform_back > 0
			and I_CompareCounter reform_back < 3

			set_counter reform_back 0
			set_counter sally_defense 3
			battle_wait 20
		end_if

		if I_CompareCounter reform_back > 2

			set_counter reform_back 0
			set_counter sally_defense 3
			;battle_wait 60
			battle_wait 30
			if I_CompareCounter sally_defense > 2
				battle_wait 30
			end_if
		end_if
		set_counter reform_back 0
		if I_CompareCounter repeat_test2 = 1
			battle_wait 20
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter sally_defense = 3
		and I_CompareCounter reform_multi = 2
		;	and I_UnitDistanceFromPosition a2u1 1 1 < 620
		and I_UnitGroupDistanceFromPosition army2 1 1 < 600
		and ! I_IsUnitGroupEngaged army2

		set_counter sally_defense 6

		if I_CompareCounter enemy_unit_count > 0
			if I_UnitStatus a2u1 fighting
				inc_counter reform_back 3
			end_if
			if I_UnitStatus a2u1 pursuing
				inc_counter reform_back 3
			end_if
			if I_UnitStatus a2u1 charging
				inc_counter reform_back 3
			end_if

			if I_CompareCounter enemy_unit_count > 1
				if I_UnitStatus a2u2 fighting
					inc_counter reform_back 1
				end_if
				if I_UnitStatus a2u2 pursuing
					inc_counter reform_back 1
				end_if
				if I_UnitStatus a2u2 charging
					inc_counter reform_back 1
				end_if

				if I_CompareCounter enemy_unit_count > 2
					if I_UnitStatus a2u3 fighting
						inc_counter reform_back 1
					end_if
					if I_UnitStatus a2u3 pursuing
						inc_counter reform_back 1
					end_if
					if I_UnitStatus a2u3 charging
						inc_counter reform_back 1
					end_if

					if I_CompareCounter enemy_unit_count > 3
						if I_UnitStatus a2u4 fighting
							inc_counter reform_back 1
						end_if
						if I_UnitStatus a2u4 pursuing
							inc_counter reform_back 1
						end_if
						if I_UnitStatus a2u4 charging
							inc_counter reform_back 1
						end_if

						if I_CompareCounter enemy_unit_count > 4
							if I_UnitStatus a2u5 fighting
								inc_counter reform_back 1
							end_if
							if I_UnitStatus a2u5 pursuing
								inc_counter reform_back 1
							end_if
							if I_UnitStatus a2u5 charging
								inc_counter reform_back 1
							end_if

							if I_CompareCounter enemy_unit_count > 5
								if I_UnitStatus a2u6 fighting
									inc_counter reform_back 1
								end_if
								if I_UnitStatus a2u6 pursuing
									inc_counter reform_back 1
								end_if
								if I_UnitStatus a2u6 charging
									inc_counter reform_back 1
								end_if

								if I_CompareCounter enemy_unit_count > 6
									if I_UnitStatus a2u7 fighting
										inc_counter reform_back 1
									end_if
									if I_UnitStatus a2u7 pursuing
										inc_counter reform_back 1
									end_if
									if I_UnitStatus a2u7 charging
										inc_counter reform_back 1
									end_if

									if I_CompareCounter enemy_unit_count > 7
										if I_UnitStatus a2u8 fighting
											inc_counter reform_back 1
										end_if
										if I_UnitStatus a2u8 pursuing
											inc_counter reform_back 1
										end_if
										if I_UnitStatus a2u8 charging
											inc_counter reform_back 1
										end_if

										if I_CompareCounter enemy_unit_count > 8
											if I_UnitStatus a2u9 fighting
												inc_counter reform_back 1
											end_if
											if I_UnitStatus a2u9 pursuing
												inc_counter reform_back 1
											end_if
											if I_UnitStatus a2u9 charging
												inc_counter reform_back 1
											end_if

											if I_CompareCounter enemy_unit_count > 9
												if I_UnitStatus a2u10 fighting
													inc_counter reform_back 1
												end_if
												if I_UnitStatus a2u10 pursuing
													inc_counter reform_back 1
												end_if
												if I_UnitStatus a2u10 charging
													inc_counter reform_back 1
												end_if

												if I_CompareCounter enemy_unit_count > 10
													if I_UnitStatus a2u11 fighting
														inc_counter reform_back 1
													end_if
													if I_UnitStatus a2u11 pursuing
														inc_counter reform_back 1
													end_if
													if I_UnitStatus a2u11 charging
														inc_counter reform_back 1
													end_if

													if I_CompareCounter enemy_unit_count > 11
														if I_UnitStatus a2u12 fighting
															inc_counter reform_back 1
														end_if
														if I_UnitStatus a2u12 pursuing
															inc_counter reform_back 1
														end_if
														if I_UnitStatus a2u12 charging
															inc_counter reform_back 1
														end_if

														if I_CompareCounter enemy_unit_count > 12
															if I_UnitStatus a2u13 fighting
																inc_counter reform_back 1
															end_if
															if I_UnitStatus a2u13 pursuing
																inc_counter reform_back 1
															end_if
															if I_UnitStatus a2u13 charging
																inc_counter reform_back 1
															end_if

															if I_CompareCounter enemy_unit_count > 13
																if I_UnitStatus a2u14 fighting
																	inc_counter reform_back 1
																end_if
																if I_UnitStatus a2u14 pursuing
																	inc_counter reform_back 1
																end_if
																if I_UnitStatus a2u14 charging
																	inc_counter reform_back 1
																end_if

																if I_CompareCounter enemy_unit_count > 14
																	if I_UnitStatus a2u15 fighting
																		inc_counter reform_back 1
																	end_if
																	if I_UnitStatus a2u15 pursuing
																		inc_counter reform_back 1
																	end_if
																	if I_UnitStatus a2u15 charging
																		inc_counter reform_back 1
																	end_if

																	if I_CompareCounter enemy_unit_count > 15
																		if I_UnitStatus a2u16 fighting
																			inc_counter reform_back 1
																		end_if
																		if I_UnitStatus a2u16 pursuing
																			inc_counter reform_back 1
																		end_if
																		if I_UnitStatus a2u16 charging
																			inc_counter reform_back 1
																		end_if

																		if I_CompareCounter enemy_unit_count > 16
																			if I_UnitStatus a2u17 fighting
																				inc_counter reform_back 1
																			end_if
																			if I_UnitStatus a2u17 pursuing
																				inc_counter reform_back 1
																			end_if
																			if I_UnitStatus a2u17 charging
																				inc_counter reform_back 1
																			end_if

																			if I_CompareCounter enemy_unit_count > 17
																				if I_UnitStatus a2u18 fighting
																					inc_counter reform_back 1
																				end_if
																				if I_UnitStatus a2u18 pursuing
																					inc_counter reform_back 1
																				end_if
																				if I_UnitStatus a2u18 charging
																					inc_counter reform_back 1
																				end_if

																				if I_CompareCounter enemy_unit_count > 18
																					if I_UnitStatus a2u19 fighting
																						inc_counter reform_back 1
																					end_if
																					if I_UnitStatus a2u19 pursuing
																						inc_counter reform_back 1
																					end_if
																					if I_UnitStatus a2u19 charging
																						inc_counter reform_back 1
																					end_if

																					if I_CompareCounter enemy_unit_count = 20
																						if I_UnitStatus a2u20 fighting
																							inc_counter reform_back 1
																						end_if
																						if I_UnitStatus a2u20 pursuing
																							inc_counter reform_back 1
																						end_if
																						if I_UnitStatus a2u20 charging
																							inc_counter reform_back 1
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if

		if I_CompareCounter repeat_test3 = 1
			set_counter repeat_test3 2
		end_if
		if I_CompareCounter reform_back = 0
			and I_CompareCounter repeat_test3 = 0

			set_counter repeat_test3 1
			set_counter sally_defense 3
		end_if

		if I_CompareCounter reform_back = 0
			and I_CompareCounter repeat_test3 = 2

			if ! I_UnitEnemyUnitInRadius a2u1 150
				ai_gta_del_objective 1
				battle_wait 0.5
				unit_group_order_halt army2
				battle_wait 0.5
				if I_CompareCounter army_south = 1
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, -750, 100
				end_if
				if I_CompareCounter army_north = 1
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, 750, -100
				end_if
				if I_CompareCounter army_east = 1
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 750, 0, -100
				end_if
				if I_CompareCounter army_west = 1
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 -750, 0, 100
				end_if
				set_counter reform_multi 1

				if I_CompareCounter enemy_unit_count > 0
					if ! I_UnitDestroyed a2u1
						and ! I_UnitStatus a2u1 left_battle
						ai_gta_add_unit_label 1 0 a2u1
					end_if

					if I_CompareCounter enemy_unit_count > 1
						if ! I_UnitDestroyed a2u2
							and ! I_UnitStatus a2u2 left_battle
							ai_gta_add_unit_label 1 0 a2u2
						end_if

						if I_CompareCounter enemy_unit_count > 2
							if ! I_UnitDestroyed a2u3
								and ! I_UnitStatus a2u3 left_battle
								ai_gta_add_unit_label 1 0 a2u3
							end_if

							if I_CompareCounter enemy_unit_count > 3
								if ! I_UnitDestroyed a2u4
									and ! I_UnitStatus a2u4 left_battle
									ai_gta_add_unit_label 1 0 a2u4
								end_if

								if I_CompareCounter enemy_unit_count > 4
									if ! I_UnitDestroyed a2u5
										and ! I_UnitStatus a2u5 left_battle
										ai_gta_add_unit_label 1 0 a2u5
									end_if

									if I_CompareCounter enemy_unit_count > 5
										if ! I_UnitDestroyed a2u6
											and ! I_UnitStatus a2u6 left_battle
											ai_gta_add_unit_label 1 0 a2u6
										end_if

										if I_CompareCounter enemy_unit_count > 6
											if ! I_UnitDestroyed a2u7
												and ! I_UnitStatus a2u7 left_battle
												ai_gta_add_unit_label 1 0 a2u7
											end_if

											if I_CompareCounter enemy_unit_count > 7
												if ! I_UnitDestroyed a2u8
													and ! I_UnitStatus a2u8 left_battle
													ai_gta_add_unit_label 1 0 a2u8
												end_if

												if I_CompareCounter enemy_unit_count > 8
													if ! I_UnitDestroyed a2u9
														and ! I_UnitStatus a2u9 left_battle
														ai_gta_add_unit_label 1 0 a2u9
													end_if

													if I_CompareCounter enemy_unit_count > 9
														if ! I_UnitDestroyed a2u10
															and ! I_UnitStatus a2u10 left_battle
															ai_gta_add_unit_label 1 0 a2u10
														end_if

														if I_CompareCounter enemy_unit_count > 10
															if ! I_UnitDestroyed a2u11
																and ! I_UnitStatus a2u11 left_battle
																ai_gta_add_unit_label 1 0 a2u11
															end_if

															if I_CompareCounter enemy_unit_count > 11
																if ! I_UnitDestroyed a2u12
																	and ! I_UnitStatus a2u12 left_battle
																	ai_gta_add_unit_label 1 0 a2u12
																end_if

																if I_CompareCounter enemy_unit_count > 12
																	if ! I_UnitDestroyed a2u13
																		and ! I_UnitStatus a2u13 left_battle
																		ai_gta_add_unit_label 1 0 a2u13
																	end_if

																	if I_CompareCounter enemy_unit_count > 13
																		if ! I_UnitDestroyed a2u14
																			and ! I_UnitStatus a2u14 left_battle
																			ai_gta_add_unit_label 1 0 a2u14
																		end_if

																		if I_CompareCounter enemy_unit_count > 14
																			if ! I_UnitDestroyed a2u15
																				and ! I_UnitStatus a2u15 left_battle
																				ai_gta_add_unit_label 1 0 a2u15
																			end_if

																			if I_CompareCounter enemy_unit_count > 15
																				if ! I_UnitDestroyed a2u16
																					and ! I_UnitStatus a2u16 left_battle
																					ai_gta_add_unit_label 1 0 a2u16
																				end_if

																				if I_CompareCounter enemy_unit_count > 16
																					if ! I_UnitDestroyed a2u17
																						and ! I_UnitStatus a2u17 left_battle
																						ai_gta_add_unit_label 1 0 a2u17
																					end_if

																					if I_CompareCounter enemy_unit_count > 17
																						if ! I_UnitDestroyed a2u18
																							and ! I_UnitStatus a2u18 left_battle
																							ai_gta_add_unit_label 1 0 a2u18
																						end_if

																						if I_CompareCounter enemy_unit_count > 18
																							if ! I_UnitDestroyed a2u19
																								and ! I_UnitStatus a2u19 left_battle
																								ai_gta_add_unit_label 1 0 a2u19
																							end_if

																							if I_CompareCounter enemy_unit_count = 20
																								if ! I_UnitDestroyed a2u20
																									and ! I_UnitStatus a2u20 left_battle
																									ai_gta_add_unit_label 1 0 a2u20
																								end_if
																							end_if
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if

				battle_wait 0.5
				;	unit_group_order_halt army2
				;    ai_active_set off
				battle_wait 0.5
				ai_active_set on
				set_counter sally_defense 2
				set_counter defend_location 1
				set_counter reset_position 0
				set_counter repeat_test1 0
				set_counter repeat_test2 0
				set_counter repeat_test3 0
				set_counter repeat_test4 0
				set_counter repeat_test5 0
				set_counter repeat_test6 0
			end_if

			if I_UnitEnemyUnitInRadius a2u1 150
				set_counter sally_defense 3
				battle_wait 7
			end_if
		end_if

		if I_CompareCounter reform_back > 0
			and I_CompareCounter reform_back < 3

			set_counter reform_back 0
			set_counter sally_defense 3
			battle_wait 20
		end_if

		if I_CompareCounter reform_back > 2

			set_counter reform_back 0
			set_counter sally_defense 3
			;battle_wait 60
			battle_wait 30
			if I_CompareCounter sally_defense > 2
				battle_wait 30
			end_if
		end_if

		set_counter reform_back 0
		if I_CompareCounter repeat_test3 = 1
			battle_wait 20
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter sally_defense = 3
		and I_CompareCounter reform_multi = 3
		;	and I_UnitDistanceFromPosition a2u1 1 1 < 580
		and I_UnitGroupDistanceFromPosition army2 1 1 < 560
		and ! I_IsUnitGroupEngaged army2

		set_counter sally_defense 6

		if I_CompareCounter enemy_unit_count > 0
			if I_UnitStatus a2u1 fighting
				inc_counter reform_back 3
			end_if
			if I_UnitStatus a2u1 pursuing
				inc_counter reform_back 3
			end_if
			if I_UnitStatus a2u1 charging
				inc_counter reform_back 3
			end_if

			if I_CompareCounter enemy_unit_count > 1
				if I_UnitStatus a2u2 fighting
					inc_counter reform_back 1
				end_if
				if I_UnitStatus a2u2 pursuing
					inc_counter reform_back 1
				end_if
				if I_UnitStatus a2u2 charging
					inc_counter reform_back 1
				end_if

				if I_CompareCounter enemy_unit_count > 2
					if I_UnitStatus a2u3 fighting
						inc_counter reform_back 1
					end_if
					if I_UnitStatus a2u3 pursuing
						inc_counter reform_back 1
					end_if
					if I_UnitStatus a2u3 charging
						inc_counter reform_back 1
					end_if

					if I_CompareCounter enemy_unit_count > 3
						if I_UnitStatus a2u4 fighting
							inc_counter reform_back 1
						end_if
						if I_UnitStatus a2u4 pursuing
							inc_counter reform_back 1
						end_if
						if I_UnitStatus a2u4 charging
							inc_counter reform_back 1
						end_if

						if I_CompareCounter enemy_unit_count > 4
							if I_UnitStatus a2u5 fighting
								inc_counter reform_back 1
							end_if
							if I_UnitStatus a2u5 pursuing
								inc_counter reform_back 1
							end_if
							if I_UnitStatus a2u5 charging
								inc_counter reform_back 1
							end_if

							if I_CompareCounter enemy_unit_count > 5
								if I_UnitStatus a2u6 fighting
									inc_counter reform_back 1
								end_if
								if I_UnitStatus a2u6 pursuing
									inc_counter reform_back 1
								end_if
								if I_UnitStatus a2u6 charging
									inc_counter reform_back 1
								end_if

								if I_CompareCounter enemy_unit_count > 6
									if I_UnitStatus a2u7 fighting
										inc_counter reform_back 1
									end_if
									if I_UnitStatus a2u7 pursuing
										inc_counter reform_back 1
									end_if
									if I_UnitStatus a2u7 charging
										inc_counter reform_back 1
									end_if

									if I_CompareCounter enemy_unit_count > 7
										if I_UnitStatus a2u8 fighting
											inc_counter reform_back 1
										end_if
										if I_UnitStatus a2u8 pursuing
											inc_counter reform_back 1
										end_if
										if I_UnitStatus a2u8 charging
											inc_counter reform_back 1
										end_if

										if I_CompareCounter enemy_unit_count > 8
											if I_UnitStatus a2u9 fighting
												inc_counter reform_back 1
											end_if
											if I_UnitStatus a2u9 pursuing
												inc_counter reform_back 1
											end_if
											if I_UnitStatus a2u9 charging
												inc_counter reform_back 1
											end_if

											if I_CompareCounter enemy_unit_count > 9
												if I_UnitStatus a2u10 fighting
													inc_counter reform_back 1
												end_if
												if I_UnitStatus a2u10 pursuing
													inc_counter reform_back 1
												end_if
												if I_UnitStatus a2u10 charging
													inc_counter reform_back 1
												end_if

												if I_CompareCounter enemy_unit_count > 10
													if I_UnitStatus a2u11 fighting
														inc_counter reform_back 1
													end_if
													if I_UnitStatus a2u11 pursuing
														inc_counter reform_back 1
													end_if
													if I_UnitStatus a2u11 charging
														inc_counter reform_back 1
													end_if

													if I_CompareCounter enemy_unit_count > 11
														if I_UnitStatus a2u12 fighting
															inc_counter reform_back 1
														end_if
														if I_UnitStatus a2u12 pursuing
															inc_counter reform_back 1
														end_if
														if I_UnitStatus a2u12 charging
															inc_counter reform_back 1
														end_if

														if I_CompareCounter enemy_unit_count > 12
															if I_UnitStatus a2u13 fighting
																inc_counter reform_back 1
															end_if
															if I_UnitStatus a2u13 pursuing
																inc_counter reform_back 1
															end_if
															if I_UnitStatus a2u13 charging
																inc_counter reform_back 1
															end_if

															if I_CompareCounter enemy_unit_count > 13
																if I_UnitStatus a2u14 fighting
																	inc_counter reform_back 1
																end_if
																if I_UnitStatus a2u14 pursuing
																	inc_counter reform_back 1
																end_if
																if I_UnitStatus a2u14 charging
																	inc_counter reform_back 1
																end_if

																if I_CompareCounter enemy_unit_count > 14
																	if I_UnitStatus a2u15 fighting
																		inc_counter reform_back 1
																	end_if
																	if I_UnitStatus a2u15 pursuing
																		inc_counter reform_back 1
																	end_if
																	if I_UnitStatus a2u15 charging
																		inc_counter reform_back 1
																	end_if

																	if I_CompareCounter enemy_unit_count > 15
																		if I_UnitStatus a2u16 fighting
																			inc_counter reform_back 1
																		end_if
																		if I_UnitStatus a2u16 pursuing
																			inc_counter reform_back 1
																		end_if
																		if I_UnitStatus a2u16 charging
																			inc_counter reform_back 1
																		end_if

																		if I_CompareCounter enemy_unit_count > 16
																			if I_UnitStatus a2u17 fighting
																				inc_counter reform_back 1
																			end_if
																			if I_UnitStatus a2u17 pursuing
																				inc_counter reform_back 1
																			end_if
																			if I_UnitStatus a2u17 charging
																				inc_counter reform_back 1
																			end_if

																			if I_CompareCounter enemy_unit_count > 17
																				if I_UnitStatus a2u18 fighting
																					inc_counter reform_back 1
																				end_if
																				if I_UnitStatus a2u18 pursuing
																					inc_counter reform_back 1
																				end_if
																				if I_UnitStatus a2u18 charging
																					inc_counter reform_back 1
																				end_if

																				if I_CompareCounter enemy_unit_count > 18
																					if I_UnitStatus a2u19 fighting
																						inc_counter reform_back 1
																					end_if
																					if I_UnitStatus a2u19 pursuing
																						inc_counter reform_back 1
																					end_if
																					if I_UnitStatus a2u19 charging
																						inc_counter reform_back 1
																					end_if

																					if I_CompareCounter enemy_unit_count = 20
																						if I_UnitStatus a2u20 fighting
																							inc_counter reform_back 1
																						end_if
																						if I_UnitStatus a2u20 pursuing
																							inc_counter reform_back 1
																						end_if
																						if I_UnitStatus a2u20 charging
																							inc_counter reform_back 1
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if

		if I_CompareCounter sally_reinf > 0
			and I_UnitDistanceFromUnit a4u1 a2u1 < 300
			if I_UnitStatus a4u1 fighting
				inc_counter reform_back 1
			end_if
			if I_UnitStatus a4u1 pursuing
				inc_counter reform_back 1
			end_if
			if I_UnitStatus a4u1 charging
				inc_counter reform_back 1
			end_if
		end_if

		if I_CompareCounter repeat_test4 = 1
			set_counter repeat_test4 2
		end_if
		if I_CompareCounter reform_back = 0
			and I_CompareCounter repeat_test4 = 0

			set_counter repeat_test4 1
			set_counter sally_defense 3
		end_if

		if I_CompareCounter reform_back = 0
			and I_CompareCounter repeat_test4 = 2

			if I_UnitEnemyUnitInRadius a2u1 180
				ai_gta_del_objective 1
				battle_wait 0.5
				unit_group_order_halt army2
				battle_wait 0.5

				if I_CompareCounter army_south = 1
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, -700, 100
				end_if
				if I_CompareCounter army_north = 1
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, 700, 100
				end_if
				if I_CompareCounter army_east = 1
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 700, 0, 100
				end_if
				if I_CompareCounter army_west = 1
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 -700, 0, 100
				end_if
				set_counter reform_multi 2
			end_if
			if ! I_UnitEnemyUnitInRadius a2u1 180
				ai_gta_del_objective 1
				battle_wait 0.5
				unit_group_order_halt army2
				battle_wait 0.5

				if I_CompareCounter army_south = 1
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, -725, 100
				end_if
				if I_CompareCounter army_north = 1
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, 725, 100
				end_if
				if I_CompareCounter army_east = 1
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 725, 0, 100
				end_if
				if I_CompareCounter army_west = 1
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 -725, 0, 100
				end_if
				set_counter reform_multi 1
			end_if
			if I_CompareCounter enemy_unit_count > 0
				if ! I_UnitDestroyed a2u1
					and ! I_UnitStatus a2u1 left_battle
					ai_gta_add_unit_label 1 0 a2u1
				end_if

				if I_CompareCounter enemy_unit_count > 1
					if ! I_UnitDestroyed a2u2
						and ! I_UnitStatus a2u2 left_battle
						ai_gta_add_unit_label 1 0 a2u2
					end_if

					if I_CompareCounter enemy_unit_count > 2
						if ! I_UnitDestroyed a2u3
							and ! I_UnitStatus a2u3 left_battle
							ai_gta_add_unit_label 1 0 a2u3
						end_if

						if I_CompareCounter enemy_unit_count > 3
							if ! I_UnitDestroyed a2u4
								and ! I_UnitStatus a2u4 left_battle
								ai_gta_add_unit_label 1 0 a2u4
							end_if

							if I_CompareCounter enemy_unit_count > 4
								if ! I_UnitDestroyed a2u5
									and ! I_UnitStatus a2u5 left_battle
									ai_gta_add_unit_label 1 0 a2u5
								end_if

								if I_CompareCounter enemy_unit_count > 5
									if ! I_UnitDestroyed a2u6
										and ! I_UnitStatus a2u6 left_battle
										ai_gta_add_unit_label 1 0 a2u6
									end_if

									if I_CompareCounter enemy_unit_count > 6
										if ! I_UnitDestroyed a2u7
											and ! I_UnitStatus a2u7 left_battle
											ai_gta_add_unit_label 1 0 a2u7
										end_if

										if I_CompareCounter enemy_unit_count > 7
											if ! I_UnitDestroyed a2u8
												and ! I_UnitStatus a2u8 left_battle
												ai_gta_add_unit_label 1 0 a2u8
											end_if

											if I_CompareCounter enemy_unit_count > 8
												if ! I_UnitDestroyed a2u9
													and ! I_UnitStatus a2u9 left_battle
													ai_gta_add_unit_label 1 0 a2u9
												end_if

												if I_CompareCounter enemy_unit_count > 9
													if ! I_UnitDestroyed a2u10
														and ! I_UnitStatus a2u10 left_battle
														ai_gta_add_unit_label 1 0 a2u10
													end_if

													if I_CompareCounter enemy_unit_count > 10
														if ! I_UnitDestroyed a2u11
															and ! I_UnitStatus a2u11 left_battle
															ai_gta_add_unit_label 1 0 a2u11
														end_if

														if I_CompareCounter enemy_unit_count > 11
															if ! I_UnitDestroyed a2u12
																and ! I_UnitStatus a2u12 left_battle
																ai_gta_add_unit_label 1 0 a2u12
															end_if

															if I_CompareCounter enemy_unit_count > 12
																if ! I_UnitDestroyed a2u13
																	and ! I_UnitStatus a2u13 left_battle
																	ai_gta_add_unit_label 1 0 a2u13
																end_if

																if I_CompareCounter enemy_unit_count > 13
																	if ! I_UnitDestroyed a2u14
																		and ! I_UnitStatus a2u14 left_battle
																		ai_gta_add_unit_label 1 0 a2u14
																	end_if

																	if I_CompareCounter enemy_unit_count > 14
																		if ! I_UnitDestroyed a2u15
																			and ! I_UnitStatus a2u15 left_battle
																			ai_gta_add_unit_label 1 0 a2u15
																		end_if

																		if I_CompareCounter enemy_unit_count > 15
																			if ! I_UnitDestroyed a2u16
																				and ! I_UnitStatus a2u16 left_battle
																				ai_gta_add_unit_label 1 0 a2u16
																			end_if

																			if I_CompareCounter enemy_unit_count > 16
																				if ! I_UnitDestroyed a2u17
																					and ! I_UnitStatus a2u17 left_battle
																					ai_gta_add_unit_label 1 0 a2u17
																				end_if

																				if I_CompareCounter enemy_unit_count > 17
																					if ! I_UnitDestroyed a2u18
																						and ! I_UnitStatus a2u18 left_battle
																						ai_gta_add_unit_label 1 0 a2u18
																					end_if

																					if I_CompareCounter enemy_unit_count > 18
																						if ! I_UnitDestroyed a2u19
																							and ! I_UnitStatus a2u19 left_battle
																							ai_gta_add_unit_label 1 0 a2u19
																						end_if

																						if I_CompareCounter enemy_unit_count = 20
																							if ! I_UnitDestroyed a2u20
																								and ! I_UnitStatus a2u20 left_battle
																								ai_gta_add_unit_label 1 0 a2u20
																							end_if
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if

			battle_wait 0.5
			;	unit_group_order_halt army2
			;    ai_active_set off
			battle_wait 0.5
			ai_active_set on
			set_counter sally_defense 2
			set_counter defend_location 1
			set_counter reset_position 0
			set_counter repeat_test1 0
			set_counter repeat_test2 0
			set_counter repeat_test3 0
			set_counter repeat_test4 0
			set_counter repeat_test5 0
			set_counter repeat_test6 0
		end_if

		if I_CompareCounter reform_back > 0
			and I_CompareCounter reform_back < 3

			set_counter reform_back 0
			set_counter sally_defense 3
			battle_wait 20
		end_if

		if I_CompareCounter reform_back > 2

			set_counter reform_back 0
			set_counter sally_defense 3
			;battle_wait 60
			battle_wait 30
			if I_CompareCounter sally_defense > 2
				battle_wait 30
			end_if
		end_if

		set_counter reform_back 0
		if I_CompareCounter repeat_test4 = 1
			battle_wait 20
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter sally_defense = 3
		and I_CompareCounter reform_multi > 3
		and ! I_IsUnitGroupEngaged army2

		set_counter sally_defense 6
		if I_CompareCounter army_south = 1
			and I_UnitDistanceFromLine a2u1 sw se < 0
			set_counter line_passed 1
		end_if
		if I_CompareCounter army_north = 1
			and I_UnitDistanceFromLine a2u1 nw ne > 0
			set_counter line_passed 1
		end_if
		if I_CompareCounter army_west = 1
			and I_UnitDistanceFromLine a2u1 sw nw > 0
			set_counter line_passed 1
		end_if
		if I_CompareCounter army_east = 1
			and I_UnitDistanceFromLine a2u1 se ne < 0
			set_counter line_passed 1
		end_if

		if I_CompareCounter line_passed = 1

			set_counter line_passed 0

			if I_CompareCounter enemy_unit_count > 0
				if I_UnitStatus a2u1 fighting
					inc_counter reform_back 3
				end_if
				if I_UnitStatus a2u1 pursuing
					inc_counter reform_back 3
				end_if
				if I_UnitStatus a2u1 charging
					inc_counter reform_back 3
				end_if

				if I_CompareCounter enemy_unit_count > 1
					if I_UnitStatus a2u2 fighting
						inc_counter reform_back 1
					end_if
					if I_UnitStatus a2u2 pursuing
						inc_counter reform_back 1
					end_if
					if I_UnitStatus a2u2 charging
						inc_counter reform_back 1
					end_if

					if I_CompareCounter enemy_unit_count > 2
						if I_UnitStatus a2u3 fighting
							inc_counter reform_back 1
						end_if
						if I_UnitStatus a2u3 pursuing
							inc_counter reform_back 1
						end_if
						if I_UnitStatus a2u3 charging
							inc_counter reform_back 1
						end_if

						if I_CompareCounter enemy_unit_count > 3
							if I_UnitStatus a2u4 fighting
								inc_counter reform_back 1
							end_if
							if I_UnitStatus a2u4 pursuing
								inc_counter reform_back 1
							end_if
							if I_UnitStatus a2u4 charging
								inc_counter reform_back 1
							end_if

							if I_CompareCounter enemy_unit_count > 4
								if I_UnitStatus a2u5 fighting
									inc_counter reform_back 1
								end_if
								if I_UnitStatus a2u5 pursuing
									inc_counter reform_back 1
								end_if
								if I_UnitStatus a2u5 charging
									inc_counter reform_back 1
								end_if

								if I_CompareCounter enemy_unit_count > 5
									if I_UnitStatus a2u6 fighting
										inc_counter reform_back 1
									end_if
									if I_UnitStatus a2u6 pursuing
										inc_counter reform_back 1
									end_if
									if I_UnitStatus a2u6 charging
										inc_counter reform_back 1
									end_if

									if I_CompareCounter enemy_unit_count > 6
										if I_UnitStatus a2u7 fighting
											inc_counter reform_back 1
										end_if
										if I_UnitStatus a2u7 pursuing
											inc_counter reform_back 1
										end_if
										if I_UnitStatus a2u7 charging
											inc_counter reform_back 1
										end_if

										if I_CompareCounter enemy_unit_count > 7
											if I_UnitStatus a2u8 fighting
												inc_counter reform_back 1
											end_if
											if I_UnitStatus a2u8 pursuing
												inc_counter reform_back 1
											end_if
											if I_UnitStatus a2u8 charging
												inc_counter reform_back 1
											end_if

											if I_CompareCounter enemy_unit_count > 8
												if I_UnitStatus a2u9 fighting
													inc_counter reform_back 1
												end_if
												if I_UnitStatus a2u9 pursuing
													inc_counter reform_back 1
												end_if
												if I_UnitStatus a2u9 charging
													inc_counter reform_back 1
												end_if

												if I_CompareCounter enemy_unit_count > 9
													if I_UnitStatus a2u10 fighting
														inc_counter reform_back 1
													end_if
													if I_UnitStatus a2u10 pursuing
														inc_counter reform_back 1
													end_if
													if I_UnitStatus a2u10 charging
														inc_counter reform_back 1
													end_if

													if I_CompareCounter enemy_unit_count > 10
														if I_UnitStatus a2u11 fighting
															inc_counter reform_back 1
														end_if
														if I_UnitStatus a2u11 pursuing
															inc_counter reform_back 1
														end_if
														if I_UnitStatus a2u11 charging
															inc_counter reform_back 1
														end_if

														if I_CompareCounter enemy_unit_count > 11
															if I_UnitStatus a2u12 fighting
																inc_counter reform_back 1
															end_if
															if I_UnitStatus a2u12 pursuing
																inc_counter reform_back 1
															end_if
															if I_UnitStatus a2u12 charging
																inc_counter reform_back 1
															end_if

															if I_CompareCounter enemy_unit_count > 12
																if I_UnitStatus a2u13 fighting
																	inc_counter reform_back 1
																end_if
																if I_UnitStatus a2u13 pursuing
																	inc_counter reform_back 1
																end_if
																if I_UnitStatus a2u13 charging
																	inc_counter reform_back 1
																end_if

																if I_CompareCounter enemy_unit_count > 13
																	if I_UnitStatus a2u14 fighting
																		inc_counter reform_back 1
																	end_if
																	if I_UnitStatus a2u14 pursuing
																		inc_counter reform_back 1
																	end_if
																	if I_UnitStatus a2u14 charging
																		inc_counter reform_back 1
																	end_if

																	if I_CompareCounter enemy_unit_count > 14
																		if I_UnitStatus a2u15 fighting
																			inc_counter reform_back 1
																		end_if
																		if I_UnitStatus a2u15 pursuing
																			inc_counter reform_back 1
																		end_if
																		if I_UnitStatus a2u15 charging
																			inc_counter reform_back 1
																		end_if

																		if I_CompareCounter enemy_unit_count > 15
																			if I_UnitStatus a2u16 fighting
																				inc_counter reform_back 1
																			end_if
																			if I_UnitStatus a2u16 pursuing
																				inc_counter reform_back 1
																			end_if
																			if I_UnitStatus a2u16 charging
																				inc_counter reform_back 1
																			end_if

																			if I_CompareCounter enemy_unit_count > 16
																				if I_UnitStatus a2u17 fighting
																					inc_counter reform_back 1
																				end_if
																				if I_UnitStatus a2u17 pursuing
																					inc_counter reform_back 1
																				end_if
																				if I_UnitStatus a2u17 charging
																					inc_counter reform_back 1
																				end_if

																				if I_CompareCounter enemy_unit_count > 17
																					if I_UnitStatus a2u18 fighting
																						inc_counter reform_back 1
																					end_if
																					if I_UnitStatus a2u18 pursuing
																						inc_counter reform_back 1
																					end_if
																					if I_UnitStatus a2u18 charging
																						inc_counter reform_back 1
																					end_if

																					if I_CompareCounter enemy_unit_count > 18
																						if I_UnitStatus a2u19 fighting
																							inc_counter reform_back 1
																						end_if
																						if I_UnitStatus a2u19 pursuing
																							inc_counter reform_back 1
																						end_if
																						if I_UnitStatus a2u19 charging
																							inc_counter reform_back 1
																						end_if

																						if I_CompareCounter enemy_unit_count = 20
																							if I_UnitStatus a2u20 fighting
																								inc_counter reform_back 1
																							end_if
																							if I_UnitStatus a2u20 pursuing
																								inc_counter reform_back 1
																							end_if
																							if I_UnitStatus a2u20 charging
																								inc_counter reform_back 1
																							end_if
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if

			if I_CompareCounter sally_reinf > 0
				and I_UnitDistanceFromUnit a4u1 a2u1 < 300
				if I_UnitStatus a4u1 fighting
					inc_counter reform_back 1
				end_if
				if I_UnitStatus a4u1 pursuing
					inc_counter reform_back 1
				end_if
				if I_UnitStatus a4u1 charging
					inc_counter reform_back 1
				end_if
			end_if

			if I_CompareCounter repeat_test5 = 1
				set_counter repeat_test5 2
			end_if
			if I_CompareCounter reform_back = 0
				and I_CompareCounter repeat_test5 = 0

				set_counter repeat_test5 1
			end_if

			if I_CompareCounter reform_back = 0
				and I_CompareCounter repeat_test5 = 2

				if ! I_UnitEnemyUnitInRadius a2u1 20

					if ! I_UnitEnemyUnitInRadius a2u1 20
						and I_BattleSettlementFortificationLevel > 2
						ai_gta_del_objective 1
						battle_wait 0.5
						unit_group_order_halt army2
						battle_wait 0.5
						if I_CompareCounter army_south = 1
							ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, -675, 100
						end_if
						if I_CompareCounter army_north = 1
							ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, 675, 100
						end_if
						if I_CompareCounter army_east = 1
							ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 675, 0, 100
						end_if
						if I_CompareCounter army_west = 1
							ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 -675, 0, 100
						end_if
						set_counter reform_multi 2
					end_if

					if ! I_UnitEnemyUnitInRadius a2u1 150
						and I_BattleSettlementFortificationLevel < 3
						ai_gta_del_objective 1
						battle_wait 0.5
						unit_group_order_halt army2
						battle_wait 0.5
						if I_CompareCounter army_south = 1
							ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, -675, 100
						end_if
						if I_CompareCounter army_north = 1
							ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, 675, 100
						end_if
						if I_CompareCounter army_east = 1
							ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 675, 0, 100
						end_if
						if I_CompareCounter army_west = 1
							ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 -675, 0, 100
						end_if
						set_counter reform_multi 2
					end_if

					if I_CompareCounter enemy_unit_count > 0
						if ! I_UnitDestroyed a2u1
							and ! I_UnitStatus a2u1 left_battle
							ai_gta_add_unit_label 1 0 a2u1
						end_if

						if I_CompareCounter enemy_unit_count > 1
							if ! I_UnitDestroyed a2u2
								and ! I_UnitStatus a2u2 left_battle
								ai_gta_add_unit_label 1 0 a2u2
							end_if

							if I_CompareCounter enemy_unit_count > 2
								if ! I_UnitDestroyed a2u3
									and ! I_UnitStatus a2u3 left_battle
									ai_gta_add_unit_label 1 0 a2u3
								end_if

								if I_CompareCounter enemy_unit_count > 3
									if ! I_UnitDestroyed a2u4
										and ! I_UnitStatus a2u4 left_battle
										ai_gta_add_unit_label 1 0 a2u4
									end_if

									if I_CompareCounter enemy_unit_count > 4
										if ! I_UnitDestroyed a2u5
											and ! I_UnitStatus a2u5 left_battle
											ai_gta_add_unit_label 1 0 a2u5
										end_if

										if I_CompareCounter enemy_unit_count > 5
											if ! I_UnitDestroyed a2u6
												and ! I_UnitStatus a2u6 left_battle
												ai_gta_add_unit_label 1 0 a2u6
											end_if

											if I_CompareCounter enemy_unit_count > 6
												if ! I_UnitDestroyed a2u7
													and ! I_UnitStatus a2u7 left_battle
													ai_gta_add_unit_label 1 0 a2u7
												end_if

												if I_CompareCounter enemy_unit_count > 7
													if ! I_UnitDestroyed a2u8
														and ! I_UnitStatus a2u8 left_battle
														ai_gta_add_unit_label 1 0 a2u8
													end_if

													if I_CompareCounter enemy_unit_count > 8
														if ! I_UnitDestroyed a2u9
															and ! I_UnitStatus a2u9 left_battle
															ai_gta_add_unit_label 1 0 a2u9
														end_if

														if I_CompareCounter enemy_unit_count > 9
															if ! I_UnitDestroyed a2u10
																and ! I_UnitStatus a2u10 left_battle
																ai_gta_add_unit_label 1 0 a2u10
															end_if

															if I_CompareCounter enemy_unit_count > 10
																if ! I_UnitDestroyed a2u11
																	and ! I_UnitStatus a2u11 left_battle
																	ai_gta_add_unit_label 1 0 a2u11
																end_if

																if I_CompareCounter enemy_unit_count > 11
																	if ! I_UnitDestroyed a2u12
																		and ! I_UnitStatus a2u12 left_battle
																		ai_gta_add_unit_label 1 0 a2u12
																	end_if

																	if I_CompareCounter enemy_unit_count > 12
																		if ! I_UnitDestroyed a2u13
																			and ! I_UnitStatus a2u13 left_battle
																			ai_gta_add_unit_label 1 0 a2u13
																		end_if

																		if I_CompareCounter enemy_unit_count > 13
																			if ! I_UnitDestroyed a2u14
																				and ! I_UnitStatus a2u14 left_battle
																				ai_gta_add_unit_label 1 0 a2u14
																			end_if

																			if I_CompareCounter enemy_unit_count > 14
																				if ! I_UnitDestroyed a2u15
																					and ! I_UnitStatus a2u15 left_battle
																					ai_gta_add_unit_label 1 0 a2u15
																				end_if

																				if I_CompareCounter enemy_unit_count > 15
																					if ! I_UnitDestroyed a2u16
																						and ! I_UnitStatus a2u16 left_battle
																						ai_gta_add_unit_label 1 0 a2u16
																					end_if

																					if I_CompareCounter enemy_unit_count > 16
																						if ! I_UnitDestroyed a2u17
																							and ! I_UnitStatus a2u17 left_battle
																							ai_gta_add_unit_label 1 0 a2u17
																						end_if

																						if I_CompareCounter enemy_unit_count > 17
																							if ! I_UnitDestroyed a2u18
																								and ! I_UnitStatus a2u18 left_battle
																								ai_gta_add_unit_label 1 0 a2u18
																							end_if

																							if I_CompareCounter enemy_unit_count > 18
																								if ! I_UnitDestroyed a2u19
																									and ! I_UnitStatus a2u19 left_battle
																									ai_gta_add_unit_label 1 0 a2u19
																								end_if

																								if I_CompareCounter enemy_unit_count = 20
																									if ! I_UnitDestroyed a2u20
																										and ! I_UnitStatus a2u20 left_battle
																										ai_gta_add_unit_label 1 0 a2u20
																									end_if
																								end_if
																							end_if
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if

					battle_wait 0.5
					;	unit_group_order_halt army2
					;    ai_active_set off
					battle_wait 0.5
					ai_active_set on
					set_counter sally_defense 2
					set_counter defend_location 1
					set_counter reset_position 0
					set_counter repeat_test1 0
					set_counter repeat_test2 0
					set_counter repeat_test3 0
					set_counter repeat_test4 0
					set_counter repeat_test5 0
					set_counter repeat_test6 0
				end_if
				if I_UnitEnemyUnitInRadius a2u1 20
					set_counter sally_defense 3
					battle_wait 20
				end_if
			end_if

			if I_CompareCounter reform_back > 0
				and I_CompareCounter reform_back < 3

				set_counter reform_back 0
				set_counter sally_defense 3
				battle_wait 20
			end_if

			if I_CompareCounter reform_back > 2

				set_counter reform_back 0
				set_counter sally_defense 3
				;battle_wait 60
				battle_wait 30
				if I_CompareCounter sally_defense > 2
					battle_wait 30
				end_if
			end_if

			set_counter reform_back 0
			if I_CompareCounter repeat_test5 = 1
				battle_wait 10
			end_if
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter sally_defense > 0  ;check
		and I_CompareCounter reform_multi > 2
		and ! I_IsUnitGroupEngaged army2
		and I_UnitEnemyUnitInRadius a2u1 160
		;	and I_UnitDistanceFromPosition a2u1 1 1 < 560
		and I_UnitGroupDistanceFromPosition army2 1 1 < 560
		;	and I_BattleSettlementFortificationLevel > 2

		if I_CompareCounter enemy_unit_count > 0
			and I_IsUnitUnderFire a2u1
			and ! I_IsUnitEngaged a2u1
			and ! I_UnitStatus a2u1 pursuing
			and ! I_UnitStatus a2u1 charging
			and ! I_UnitStatus a2u1 moving
			inc_counter reset_position 2
		end_if

		if I_CompareCounter enemy_unit_count > 1
			and I_IsUnitUnderFire a2u2
			and ! I_IsUnitEngaged a2u2
			and ! I_UnitStatus a2u2 pursuing
			and ! I_UnitStatus a2u2 charging
			and ! I_UnitStatus a2u2 moving
			inc_counter reset_position 1
		end_if

		if I_CompareCounter enemy_unit_count > 2
			and I_IsUnitUnderFire a2u3
			and ! I_IsUnitEngaged a2u3
			and ! I_UnitStatus a2u3 pursuing
			and ! I_UnitStatus a2u3 charging
			and ! I_UnitStatus a2u3 moving
			inc_counter reset_position 1
		end_if

		if I_CompareCounter enemy_unit_count > 3
			and I_IsUnitUnderFire a2u4
			and ! I_IsUnitEngaged a2u4
			and ! I_UnitStatus a2u4 pursuing
			and ! I_UnitStatus a2u4 charging
			and ! I_UnitStatus a2u4 moving
			inc_counter reset_position 1
		end_if

		if I_CompareCounter enemy_unit_count > 4
			and I_IsUnitUnderFire a2u5
			and ! I_IsUnitEngaged a2u5
			and ! I_UnitStatus a2u5 pursuing
			and ! I_UnitStatus a2u5 charging
			and ! I_UnitStatus a2u5 moving
			inc_counter reset_position 1
		end_if

		if I_CompareCounter enemy_unit_count > 5
			and I_IsUnitUnderFire a2u6
			and ! I_IsUnitEngaged a2u6
			and ! I_UnitStatus a2u6 pursuing
			and ! I_UnitStatus a2u6 charging
			and ! I_UnitStatus a2u6 moving
			inc_counter reset_position 1
		end_if

		if I_CompareCounter enemy_unit_count > 6
			and I_IsUnitUnderFire a2u7
			and ! I_IsUnitEngaged a2u7
			and ! I_UnitStatus a2u7 pursuing
			and ! I_UnitStatus a2u7 charging
			and ! I_UnitStatus a2u7 moving
			inc_counter reset_position 1
		end_if

		if I_CompareCounter enemy_unit_count > 7
			and I_IsUnitUnderFire a2u8
			and ! I_IsUnitEngaged a2u8
			and ! I_UnitStatus a2u8 pursuing
			and ! I_UnitStatus a2u8 charging
			and ! I_UnitStatus a2u8 moving
			inc_counter reset_position 1
		end_if

		if I_CompareCounter enemy_unit_count > 8
			and I_IsUnitUnderFire a2u9
			and ! I_IsUnitEngaged a2u9
			and ! I_UnitStatus a2u9 pursuing
			and ! I_UnitStatus a2u9 charging
			and ! I_UnitStatus a2u9 moving
			inc_counter reset_position 1
		end_if

		if I_CompareCounter enemy_unit_count > 9
			and I_IsUnitUnderFire a2u10
			and ! I_IsUnitEngaged a2u10
			and ! I_UnitStatus a2u10 pursuing
			and ! I_UnitStatus a2u10 charging
			and ! I_UnitStatus a2u10 moving
			inc_counter reset_position 1
		end_if

		if I_CompareCounter enemy_unit_count > 10
			and I_IsUnitUnderFire a2u11
			and ! I_IsUnitEngaged a2u11
			and ! I_UnitStatus a2u11 pursuing
			and ! I_UnitStatus a2u11 charging
			and ! I_UnitStatus a2u11 moving
			inc_counter reset_position 1
		end_if

		if I_CompareCounter enemy_unit_count > 11
			and I_IsUnitUnderFire a2u12
			and ! I_IsUnitEngaged a2u12
			and ! I_UnitStatus a2u12 pursuing
			and ! I_UnitStatus a2u12 charging
			and ! I_UnitStatus a2u12 moving
			inc_counter reset_position 1
		end_if

		if I_CompareCounter enemy_unit_count > 12
			and I_IsUnitUnderFire a2u13
			and ! I_IsUnitEngaged a2u13
			and ! I_UnitStatus a2u13 pursuing
			and ! I_UnitStatus a2u13 charging
			and ! I_UnitStatus a2u13 moving
			inc_counter reset_position 1
		end_if

		if I_CompareCounter enemy_unit_count > 13
			and I_IsUnitUnderFire a2u14
			and ! I_IsUnitEngaged a2u14
			and ! I_UnitStatus a2u14 pursuing
			and ! I_UnitStatus a2u14 charging
			and ! I_UnitStatus a2u14 moving
			inc_counter reset_position 1
		end_if

		if I_CompareCounter enemy_unit_count > 14
			and I_IsUnitUnderFire a2u15
			and ! I_IsUnitEngaged a2u15
			and ! I_UnitStatus a2u15 pursuing
			and ! I_UnitStatus a2u15 charging
			and ! I_UnitStatus a2u15 moving
			inc_counter reset_position 1
		end_if

		if I_CompareCounter enemy_unit_count > 15
			and I_IsUnitUnderFire a2u16
			and ! I_IsUnitEngaged a2u16
			and ! I_UnitStatus a2u16 pursuing
			and ! I_UnitStatus a2u16 charging
			and ! I_UnitStatus a2u16 moving
			inc_counter reset_position 1
		end_if

		if I_CompareCounter enemy_unit_count > 16
			and I_IsUnitUnderFire a2u17
			and ! I_IsUnitEngaged a2u17
			and ! I_UnitStatus a2u17 pursuing
			and ! I_UnitStatus a2u17 charging
			and ! I_UnitStatus a2u17 moving
			inc_counter reset_position 1
		end_if

		if I_CompareCounter enemy_unit_count > 17
			and I_IsUnitUnderFire a2u18
			and ! I_IsUnitEngaged a2u18
			and ! I_UnitStatus a2u18 pursuing
			and ! I_UnitStatus a2u18 charging
			and ! I_UnitStatus a2u18 moving
			inc_counter reset_position 1
		end_if

		if I_CompareCounter enemy_unit_count > 18
			and I_IsUnitUnderFire a2u19
			and ! I_IsUnitEngaged a2u19
			and ! I_UnitStatus a2u19 pursuing
			and ! I_UnitStatus a2u19 charging
			and ! I_UnitStatus a2u19 moving
			inc_counter reset_position 1
		end_if

		if I_CompareCounter enemy_unit_count = 20
			and I_IsUnitUnderFire a2u20
			and ! I_IsUnitEngaged a2u20
			and ! I_UnitStatus a2u20 pursuing
			and ! I_UnitStatus a2u20 charging
			and ! I_UnitStatus a2u20 moving
			inc_counter reset_position 1
		end_if

		if I_CompareCounter sally_reinf > 0
			and I_CompareCounter army4_ready = 0
			and I_IsUnitUnderFire a4u1
			and ! I_IsUnitEngaged a4u1
			and ! I_UnitStatus a4u1 pursuing
			and ! I_UnitStatus a4u1 charging
			and ! I_UnitStatus a4u1 moving
			inc_counter reset_position 2
		end_if

		if I_CompareCounter reset_position > 3

			if ! I_UnitEnemyUnitInRadius a2u1 20
				and I_BattleSettlementFortificationLevel > 2
				ai_gta_del_objective 1
				battle_wait 0.5
				unit_group_order_halt army2
				battle_wait 0.5
				if I_CompareCounter army_south = 1
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, -675, 100
				end_if
				if I_CompareCounter army_north = 1
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, 675, 100
				end_if
				if I_CompareCounter army_east = 1
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 675, 0, 100
				end_if
				if I_CompareCounter army_west = 1
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 -675, 0, 100
				end_if
				set_counter reform_multi 1
			end_if

			if ! I_UnitEnemyUnitInRadius a2u1 150
				and I_BattleSettlementFortificationLevel < 3
				ai_gta_del_objective 1
				battle_wait 0.5
				unit_group_order_halt army2
				battle_wait 0.5
				if I_CompareCounter army_south = 1
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, -675, 100
				end_if
				if I_CompareCounter army_north = 1
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, 675, 100
				end_if
				if I_CompareCounter army_east = 1
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 675, 0, 100
				end_if
				if I_CompareCounter army_west = 1
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 -675, 0, 100
				end_if
				set_counter reform_multi 2
			end_if

			if I_CompareCounter enemy_unit_count > 0
				if ! I_UnitDestroyed a2u1
					and ! I_UnitStatus a2u1 left_battle
					ai_gta_add_unit_label 1 0 a2u1
				end_if

				if I_CompareCounter enemy_unit_count > 1
					if ! I_UnitDestroyed a2u2
						and ! I_UnitStatus a2u2 left_battle
						ai_gta_add_unit_label 1 0 a2u2
					end_if

					if I_CompareCounter enemy_unit_count > 2
						if ! I_UnitDestroyed a2u3
							and ! I_UnitStatus a2u3 left_battle
							ai_gta_add_unit_label 1 0 a2u3
						end_if

						if I_CompareCounter enemy_unit_count > 3
							if ! I_UnitDestroyed a2u4
								and ! I_UnitStatus a2u4 left_battle
								ai_gta_add_unit_label 1 0 a2u4
							end_if

							if I_CompareCounter enemy_unit_count > 4
								if ! I_UnitDestroyed a2u5
									and ! I_UnitStatus a2u5 left_battle
									ai_gta_add_unit_label 1 0 a2u5
								end_if

								if I_CompareCounter enemy_unit_count > 5
									if ! I_UnitDestroyed a2u6
										and ! I_UnitStatus a2u6 left_battle
										ai_gta_add_unit_label 1 0 a2u6
									end_if

									if I_CompareCounter enemy_unit_count > 6
										if ! I_UnitDestroyed a2u7
											and ! I_UnitStatus a2u7 left_battle
											ai_gta_add_unit_label 1 0 a2u7
										end_if

										if I_CompareCounter enemy_unit_count > 7
											if ! I_UnitDestroyed a2u8
												and ! I_UnitStatus a2u8 left_battle
												ai_gta_add_unit_label 1 0 a2u8
											end_if

											if I_CompareCounter enemy_unit_count > 8
												if ! I_UnitDestroyed a2u9
													and ! I_UnitStatus a2u9 left_battle
													ai_gta_add_unit_label 1 0 a2u9
												end_if

												if I_CompareCounter enemy_unit_count > 9
													if ! I_UnitDestroyed a2u10
														and ! I_UnitStatus a2u10 left_battle
														ai_gta_add_unit_label 1 0 a2u10
													end_if

													if I_CompareCounter enemy_unit_count > 10
														if ! I_UnitDestroyed a2u11
															and ! I_UnitStatus a2u11 left_battle
															ai_gta_add_unit_label 1 0 a2u11
														end_if

														if I_CompareCounter enemy_unit_count > 11
															if ! I_UnitDestroyed a2u12
																and ! I_UnitStatus a2u12 left_battle
																ai_gta_add_unit_label 1 0 a2u12
															end_if

															if I_CompareCounter enemy_unit_count > 12
																if ! I_UnitDestroyed a2u13
																	and ! I_UnitStatus a2u13 left_battle
																	ai_gta_add_unit_label 1 0 a2u13
																end_if

																if I_CompareCounter enemy_unit_count > 13
																	if ! I_UnitDestroyed a2u14
																		and ! I_UnitStatus a2u14 left_battle
																		ai_gta_add_unit_label 1 0 a2u14
																	end_if

																	if I_CompareCounter enemy_unit_count > 14
																		if ! I_UnitDestroyed a2u15
																			and ! I_UnitStatus a2u15 left_battle
																			ai_gta_add_unit_label 1 0 a2u15
																		end_if

																		if I_CompareCounter enemy_unit_count > 15
																			if ! I_UnitDestroyed a2u16
																				and ! I_UnitStatus a2u16 left_battle
																				ai_gta_add_unit_label 1 0 a2u16
																			end_if

																			if I_CompareCounter enemy_unit_count > 16
																				if ! I_UnitDestroyed a2u17
																					and ! I_UnitStatus a2u17 left_battle
																					ai_gta_add_unit_label 1 0 a2u17
																				end_if

																				if I_CompareCounter enemy_unit_count > 17
																					if ! I_UnitDestroyed a2u18
																						and ! I_UnitStatus a2u18 left_battle
																						ai_gta_add_unit_label 1 0 a2u18
																					end_if

																					if I_CompareCounter enemy_unit_count > 18
																						if ! I_UnitDestroyed a2u19
																							and ! I_UnitStatus a2u19 left_battle
																							ai_gta_add_unit_label 1 0 a2u19
																						end_if

																						if I_CompareCounter enemy_unit_count = 20
																							if ! I_UnitDestroyed a2u20
																								and ! I_UnitStatus a2u20 left_battle
																								ai_gta_add_unit_label 1 0 a2u20
																							end_if
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if

			battle_wait 0.5
			;	unit_group_order_halt army2
			;    ai_active_set off
			battle_wait 0.5
			ai_active_set on
			set_counter reset_position 0
			set_counter sally_defense 2
			set_counter defend_location 1
		end_if

		if I_CompareCounter sally_defense != 2
			set_counter sally_defense 3
			battle_wait 15
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_BattlePlayerArmyIsAttacker
		and I_CompareCounter sally_defense > 0
		and I_UnitEnemyUnitInRadius a2u1 200

		if ! I_IsUnitGroupEngaged army2
			and ! I_IsUnitGroupMoving army2
			and ! I_UnitStatus a2u1 pursuing
			and ! I_UnitStatus a2u1 charging

			inc_counter army2_idle_s 1
		end_if

		if I_CompareCounter army2_idle_s > 5
			set_counter army2_idle_s 0
			ai_gta_del_objective 1
			battle_wait 0.5
			unit_group_order_halt army2
			battle_wait 0.5
			if I_CompareCounter army_south = 1
				if I_CompareCounter reform_multi > 2
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, -675, 100
					set_counter reform_multi 2
				end_if
				if I_CompareCounter reform_multi < 3
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, -725, 100
					set_counter reform_multi 1
				end_if
			end_if
			if I_CompareCounter army_north = 1
				if I_CompareCounter reform_multi > 2
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, 675, 100
					set_counter reform_multi 2
				end_if
				if I_CompareCounter reform_multi < 3
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, 725, 100
					set_counter reform_multi 1
				end_if
			end_if
			if I_CompareCounter army_east = 1
				if I_CompareCounter reform_multi > 2
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 675, 0, 100
					set_counter reform_multi 2
				end_if
				if I_CompareCounter reform_multi < 3
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 725, 0, 100
					set_counter reform_multi 1
				end_if
			end_if
			if I_CompareCounter army_west = 1
				if I_CompareCounter reform_multi > 2
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 -675, 0, 100
					set_counter reform_multi 2
				end_if
				if I_CompareCounter reform_multi < 3
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 -725, 0, 100
					set_counter reform_multi 1
				end_if
			end_if

			if I_CompareCounter enemy_unit_count > 0
				if ! I_UnitDestroyed a2u1
					and ! I_UnitStatus a2u1 left_battle
					ai_gta_add_unit_label 1 0 a2u1
				end_if

				if I_CompareCounter enemy_unit_count > 1
					if ! I_UnitDestroyed a2u2
						and ! I_UnitStatus a2u2 left_battle
						ai_gta_add_unit_label 1 0 a2u2
					end_if

					if I_CompareCounter enemy_unit_count > 2
						if ! I_UnitDestroyed a2u3
							and ! I_UnitStatus a2u3 left_battle
							ai_gta_add_unit_label 1 0 a2u3
						end_if

						if I_CompareCounter enemy_unit_count > 3
							if ! I_UnitDestroyed a2u4
								and ! I_UnitStatus a2u4 left_battle
								ai_gta_add_unit_label 1 0 a2u4
							end_if

							if I_CompareCounter enemy_unit_count > 4
								if ! I_UnitDestroyed a2u5
									and ! I_UnitStatus a2u5 left_battle
									ai_gta_add_unit_label 1 0 a2u5
								end_if

								if I_CompareCounter enemy_unit_count > 5
									if ! I_UnitDestroyed a2u6
										and ! I_UnitStatus a2u6 left_battle
										ai_gta_add_unit_label 1 0 a2u6
									end_if

									if I_CompareCounter enemy_unit_count > 6
										if ! I_UnitDestroyed a2u7
											and ! I_UnitStatus a2u7 left_battle
											ai_gta_add_unit_label 1 0 a2u7
										end_if

										if I_CompareCounter enemy_unit_count > 7
											if ! I_UnitDestroyed a2u8
												and ! I_UnitStatus a2u8 left_battle
												ai_gta_add_unit_label 1 0 a2u8
											end_if

											if I_CompareCounter enemy_unit_count > 8
												if ! I_UnitDestroyed a2u9
													and ! I_UnitStatus a2u9 left_battle
													ai_gta_add_unit_label 1 0 a2u9
												end_if

												if I_CompareCounter enemy_unit_count > 9
													if ! I_UnitDestroyed a2u10
														and ! I_UnitStatus a2u10 left_battle
														ai_gta_add_unit_label 1 0 a2u10
													end_if

													if I_CompareCounter enemy_unit_count > 10
														if ! I_UnitDestroyed a2u11
															and ! I_UnitStatus a2u11 left_battle
															ai_gta_add_unit_label 1 0 a2u11
														end_if

														if I_CompareCounter enemy_unit_count > 11
															if ! I_UnitDestroyed a2u12
																and ! I_UnitStatus a2u12 left_battle
																ai_gta_add_unit_label 1 0 a2u12
															end_if

															if I_CompareCounter enemy_unit_count > 12
																if ! I_UnitDestroyed a2u13
																	and ! I_UnitStatus a2u13 left_battle
																	ai_gta_add_unit_label 1 0 a2u13
																end_if

																if I_CompareCounter enemy_unit_count > 13
																	if ! I_UnitDestroyed a2u14
																		and ! I_UnitStatus a2u14 left_battle
																		ai_gta_add_unit_label 1 0 a2u14
																	end_if

																	if I_CompareCounter enemy_unit_count > 14
																		if ! I_UnitDestroyed a2u15
																			and ! I_UnitStatus a2u15 left_battle
																			ai_gta_add_unit_label 1 0 a2u15
																		end_if

																		if I_CompareCounter enemy_unit_count > 15
																			if ! I_UnitDestroyed a2u16
																				and ! I_UnitStatus a2u16 left_battle
																				ai_gta_add_unit_label 1 0 a2u16
																			end_if

																			if I_CompareCounter enemy_unit_count > 16
																				if ! I_UnitDestroyed a2u17
																					and ! I_UnitStatus a2u17 left_battle
																					ai_gta_add_unit_label 1 0 a2u17
																				end_if

																				if I_CompareCounter enemy_unit_count > 17
																					if ! I_UnitDestroyed a2u18
																						and ! I_UnitStatus a2u18 left_battle
																						ai_gta_add_unit_label 1 0 a2u18
																					end_if

																					if I_CompareCounter enemy_unit_count > 18
																						if ! I_UnitDestroyed a2u19
																							and ! I_UnitStatus a2u19 left_battle
																							ai_gta_add_unit_label 1 0 a2u19
																						end_if

																						if I_CompareCounter enemy_unit_count = 20
																							if ! I_UnitDestroyed a2u20
																								and ! I_UnitStatus a2u20 left_battle
																								ai_gta_add_unit_label 1 0 a2u20
																							end_if
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if

			;    battle_wait 0.5
			;	 unit_group_order_halt army2
			;    ai_active_set off
			battle_wait 0.5
			ai_active_set on
			set_counter reset_position 0
			set_counter sally_defense 2
			set_counter defend_location 1
		end_if

		if I_IsUnitGroupEngaged army2
			set_counter army2_idle_s 0
		end_if
		if I_IsUnitGroupMoving army2
			set_counter army2_idle_s 0
		end_if
		if I_UnitStatus a2u1 pursuing
			set_counter army2_idle_s 0
		end_if
		if I_UnitStatus a2u1 charging
			set_counter army2_idle_s 0
		end_if
		battle_wait 10
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter sally_defense > 2
		and I_BattleSettlementFortificationLevel > 2
		;	and I_CompareCounter reform_multi > 3
		and ! I_IsUnitGroupEngaged army2
		and ! I_UnitEnemyUnitInRadius a2u1 80

		set_counter sally_defense 6
		set_counter wall_line_passed 0
		set_counter reset_position_s 0

		if I_CompareCounter enemy_unit_count > 0
			if I_IsUnitEngaged a2u1
				inc_counter reset_position_s 2
			end_if
			if I_UnitStatus a2u1 pursuing
				inc_counter reset_position_s 2
			end_if
			if I_UnitStatus a2u1 charging
				inc_counter reset_position_s 2
			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 1
			if I_IsUnitEngaged a2u2
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u2 pursuing
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u2 charging
				inc_counter reset_position_s 1
			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 2
			if I_IsUnitEngaged a2u3
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u3 pursuing
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u3 charging
				inc_counter reset_position_s 1
			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 3
			if I_IsUnitEngaged a2u4
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u4 pursuing
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u4 charging
				inc_counter reset_position_s 1
			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 4
			if I_IsUnitEngaged a2u5
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u5 pursuing
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u5 charging
				inc_counter reset_position_s 1
			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 5
			if I_IsUnitEngaged a2u6
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u6 pursuing
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u6 charging
				inc_counter reset_position_s 1
			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 6
			if I_IsUnitEngaged a2u7
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u7 pursuing
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u7 charging
				inc_counter reset_position_s 1
			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 7
			if I_IsUnitEngaged a2u8
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u8 pursuing
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u8 charging
				inc_counter reset_position_s 1
			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 8
			if I_IsUnitEngaged a2u9
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u9 pursuing
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u9 charging
				inc_counter reset_position_s 1
			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 9
			if I_IsUnitEngaged a2u10
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u10 pursuing
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u10 charging
				inc_counter reset_position_s 1
			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 10
			if I_IsUnitEngaged a2u11
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u11 pursuing
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u11 charging
				inc_counter reset_position_s 1
			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 11
			if I_IsUnitEngaged a2u12
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u12 pursuing
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u12 charging
				inc_counter reset_position_s 1
			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 12
			if I_IsUnitEngaged a2u13
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u13 pursuing
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u13 charging
				inc_counter reset_position_s 1
			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 13
			if I_IsUnitEngaged a2u14
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u14 pursuing
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u14 charging
				inc_counter reset_position_s 1
			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 14
			if I_IsUnitEngaged a2u15
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u15 pursuing
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u15 charging
				inc_counter reset_position_s 1
			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 15
			if I_IsUnitEngaged a2u16
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u16 pursuing
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u16 charging
				inc_counter reset_position_s 1
			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 16
			if I_IsUnitEngaged a2u17
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u17 pursuing
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u17 charging
				inc_counter reset_position_s 1
			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 17
			if I_IsUnitEngaged a2u18
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u18 pursuing
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u18 charging
				inc_counter reset_position_s 1
			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 18
			if I_IsUnitEngaged a2u19
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u19 pursuing
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u19 charging
				inc_counter reset_position_s 1
			end_if
		end_if

		if I_CompareCounter enemy_unit_count = 20
			if I_IsUnitEngaged a2u20
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u20 pursuing
				inc_counter reset_position_s 1
			end_if
			if I_UnitStatus a2u20 charging
				inc_counter reset_position_s 1
			end_if
		end_if

		if I_CompareCounter reset_position_s = 0
			if I_CompareCounter army_south = 1
				if I_CompareCounter player_unit_count > 0
					and I_UnitDistanceFromLine a1u1 sw_wall se_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 1
					and I_UnitDistanceFromLine a1u2 sw_wall se_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 2
					and I_UnitDistanceFromLine a1u3 sw_wall se_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 3
					and I_UnitDistanceFromLine a1u4 sw_wall se_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 4
					and I_UnitDistanceFromLine a1u5 sw_wall se_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 5
					and I_UnitDistanceFromLine a1u6 sw_wall se_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 6
					and I_UnitDistanceFromLine a1u7 sw_wall se_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 7
					and I_UnitDistanceFromLine a1u8 sw_wall se_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 8
					and I_UnitDistanceFromLine a1u9 sw_wall se_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 9
					and I_UnitDistanceFromLine a1u10 sw_wall se_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 10
					and I_UnitDistanceFromLine a1u11 sw_wall se_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 11
					and I_UnitDistanceFromLine a1u12 sw_wall se_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 12
					and I_UnitDistanceFromLine a1u13 sw_wall se_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 13
					and I_UnitDistanceFromLine a1u14 sw_wall se_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 14
					and I_UnitDistanceFromLine a1u15 sw_wall se_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 15
					and I_UnitDistanceFromLine a1u16 sw_wall se_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 16
					and I_UnitDistanceFromLine a1u17 sw_wall se_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 17
					and I_UnitDistanceFromLine a1u18 sw_wall se_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 18
					and I_UnitDistanceFromLine a1u19 sw_wall se_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count = 20
					and I_UnitDistanceFromLine a1u20 sw_wall se_wall > 0
					inc_counter wall_line_passed 1
				end_if
			end_if
			if I_CompareCounter army_north = 1
				if I_CompareCounter player_unit_count > 0
					and I_UnitDistanceFromLine a1u1 nw_wall ne_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 1
					and I_UnitDistanceFromLine a1u2 nw_wall ne_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 2
					and I_UnitDistanceFromLine a1u3 nw_wall ne_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 3
					and I_UnitDistanceFromLine a1u4 nw_wall ne_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 4
					and I_UnitDistanceFromLine a1u5 nw_wall ne_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 5
					and I_UnitDistanceFromLine a1u6 nw_wall ne_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 6
					and I_UnitDistanceFromLine a1u7 nw_wall ne_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 7
					and I_UnitDistanceFromLine a1u8 nw_wall ne_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 8
					and I_UnitDistanceFromLine a1u9 nw_wall ne_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 9
					and I_UnitDistanceFromLine a1u10 nw_wall ne_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 10
					and I_UnitDistanceFromLine a1u11 nw_wall ne_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 11
					and I_UnitDistanceFromLine a1u12 nw_wall ne_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 12
					and I_UnitDistanceFromLine a1u13 nw_wall ne_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 13
					and I_UnitDistanceFromLine a1u14 nw_wall ne_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 14
					and I_UnitDistanceFromLine a1u15 nw_wall ne_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 15
					and I_UnitDistanceFromLine a1u16 nw_wall ne_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 16
					and I_UnitDistanceFromLine a1u17 nw_wall ne_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 17
					and I_UnitDistanceFromLine a1u18 nw_wall ne_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 18
					and I_UnitDistanceFromLine a1u19 nw_wall ne_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count = 20
					and I_UnitDistanceFromLine a1u20 nw_wall ne_wall < 0
					inc_counter wall_line_passed 1
				end_if
			end_if
			if I_CompareCounter army_west = 1
				if I_CompareCounter player_unit_count > 0
					and I_UnitDistanceFromLine a1u1 sw_wall nw_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 1
					and I_UnitDistanceFromLine a1u2 sw_wall nw_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 2
					and I_UnitDistanceFromLine a1u3 sw_wall nw_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 3
					and I_UnitDistanceFromLine a1u4 sw_wall nw_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 4
					and I_UnitDistanceFromLine a1u5 sw_wall nw_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 5
					and I_UnitDistanceFromLine a1u6 sw_wall nw_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 6
					and I_UnitDistanceFromLine a1u7 sw_wall nw_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 7
					and I_UnitDistanceFromLine a1u8 sw_wall nw_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 8
					and I_UnitDistanceFromLine a1u9 sw_wall nw_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 9
					and I_UnitDistanceFromLine a1u10 sw_wall nw_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 10
					and I_UnitDistanceFromLine a1u11 sw_wall nw_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 11
					and I_UnitDistanceFromLine a1u12 sw_wall nw_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 12
					and I_UnitDistanceFromLine a1u13 sw_wall nw_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 13
					and I_UnitDistanceFromLine a1u14 sw_wall nw_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 14
					and I_UnitDistanceFromLine a1u15 sw_wall nw_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 15
					and I_UnitDistanceFromLine a1u16 sw_wall nw_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 16
					and I_UnitDistanceFromLine a1u17 sw_wall nw_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 17
					and I_UnitDistanceFromLine a1u18 sw_wall nw_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 18
					and I_UnitDistanceFromLine a1u19 sw_wall nw_wall < 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count = 20
					and I_UnitDistanceFromLine a1u20 sw_wall nw_wall < 0
					inc_counter wall_line_passed 1
				end_if
			end_if
			if I_CompareCounter army_east = 1
				if I_CompareCounter player_unit_count > 0
					and I_UnitDistanceFromLine a1u1 se_wall ne_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 1
					and I_UnitDistanceFromLine a1u2 se_wall ne_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 2
					and I_UnitDistanceFromLine a1u3 se_wall ne_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 3
					and I_UnitDistanceFromLine a1u4 se_wall ne_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 4
					and I_UnitDistanceFromLine a1u5 se_wall ne_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 5
					and I_UnitDistanceFromLine a1u6 se_wall ne_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 6
					and I_UnitDistanceFromLine a1u7 se_wall ne_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 7
					and I_UnitDistanceFromLine a1u8 se_wall ne_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 8
					and I_UnitDistanceFromLine a1u9 se_wall ne_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 9
					and I_UnitDistanceFromLine a1u10 se_wall ne_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 10
					and I_UnitDistanceFromLine a1u11 se_wall ne_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 11
					and I_UnitDistanceFromLine a1u12 se_wall ne_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 12
					and I_UnitDistanceFromLine a1u13 se_wall ne_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 13
					and I_UnitDistanceFromLine a1u14 se_wall ne_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 14
					and I_UnitDistanceFromLine a1u15 se_wall ne_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 15
					and I_UnitDistanceFromLine a1u16 se_wall ne_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 16
					and I_UnitDistanceFromLine a1u17 se_wall ne_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 17
					and I_UnitDistanceFromLine a1u18 se_wall ne_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count > 18
					and I_UnitDistanceFromLine a1u19 se_wall ne_wall > 0
					inc_counter wall_line_passed 1
				end_if

				if I_CompareCounter player_unit_count = 20
					and I_UnitDistanceFromLine a1u20 se_wall ne_wall > 0
					inc_counter wall_line_passed 1
				end_if
			end_if
		end_if

		if I_CompareCounter repeat_test6 = 1
			set_counter repeat_test6 2
		end_if
		if I_CompareCounter wall_line_passed = 0
			and I_CompareCounter reset_position_s = 0
			and I_CompareCounter repeat_test6 = 0

			set_counter repeat_test6 1
		end_if
		if I_CompareCounter wall_line_passed = 0
			and I_CompareCounter reset_position_s = 0
			and I_CompareCounter repeat_test6 = 2
			ai_gta_del_objective 1
			battle_wait 0.5
			unit_group_order_halt army2
			battle_wait 0.5
			if I_CompareCounter army_south = 1
				if I_CompareCounter reform_multi > 2
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, -675, 100
					set_counter reform_multi 2
				end_if
				if I_CompareCounter reform_multi < 3
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, -725, 100
					set_counter reform_multi 1
				end_if
			end_if
			if I_CompareCounter army_north = 1
				if I_CompareCounter reform_multi > 2
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, 675, 100
					set_counter reform_multi 2
				end_if
				if I_CompareCounter reform_multi < 3
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, 725, 100
					set_counter reform_multi 1
				end_if
			end_if
			if I_CompareCounter army_east = 1
				if I_CompareCounter reform_multi > 2
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 675, 0, 100
					set_counter reform_multi 2
				end_if
				if I_CompareCounter reform_multi < 3
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 725, 0, 100
					set_counter reform_multi 1
				end_if
			end_if
			if I_CompareCounter army_west = 1
				if I_CompareCounter reform_multi > 2
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 -675, 0, 100
					set_counter reform_multi 2
				end_if
				if I_CompareCounter reform_multi < 3
					ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 -725, 0, 100
					set_counter reform_multi 1
				end_if
			end_if

			if I_CompareCounter enemy_unit_count > 0
				if ! I_UnitDestroyed a2u1
					and ! I_UnitStatus a2u1 left_battle
					ai_gta_add_unit_label 1 0 a2u1
				end_if

				if I_CompareCounter enemy_unit_count > 1
					if ! I_UnitDestroyed a2u2
						and ! I_UnitStatus a2u2 left_battle
						ai_gta_add_unit_label 1 0 a2u2
					end_if

					if I_CompareCounter enemy_unit_count > 2
						if ! I_UnitDestroyed a2u3
							and ! I_UnitStatus a2u3 left_battle
							ai_gta_add_unit_label 1 0 a2u3
						end_if

						if I_CompareCounter enemy_unit_count > 3
							if ! I_UnitDestroyed a2u4
								and ! I_UnitStatus a2u4 left_battle
								ai_gta_add_unit_label 1 0 a2u4
							end_if

							if I_CompareCounter enemy_unit_count > 4
								if ! I_UnitDestroyed a2u5
									and ! I_UnitStatus a2u5 left_battle
									ai_gta_add_unit_label 1 0 a2u5
								end_if

								if I_CompareCounter enemy_unit_count > 5
									if ! I_UnitDestroyed a2u6
										and ! I_UnitStatus a2u6 left_battle
										ai_gta_add_unit_label 1 0 a2u6
									end_if

									if I_CompareCounter enemy_unit_count > 6
										if ! I_UnitDestroyed a2u7
											and ! I_UnitStatus a2u7 left_battle
											ai_gta_add_unit_label 1 0 a2u7
										end_if

										if I_CompareCounter enemy_unit_count > 7
											if ! I_UnitDestroyed a2u8
												and ! I_UnitStatus a2u8 left_battle
												ai_gta_add_unit_label 1 0 a2u8
											end_if

											if I_CompareCounter enemy_unit_count > 8
												if ! I_UnitDestroyed a2u9
													and ! I_UnitStatus a2u9 left_battle
													ai_gta_add_unit_label 1 0 a2u9
												end_if

												if I_CompareCounter enemy_unit_count > 9
													if ! I_UnitDestroyed a2u10
														and ! I_UnitStatus a2u10 left_battle
														ai_gta_add_unit_label 1 0 a2u10
													end_if

													if I_CompareCounter enemy_unit_count > 10
														if ! I_UnitDestroyed a2u11
															and ! I_UnitStatus a2u11 left_battle
															ai_gta_add_unit_label 1 0 a2u11
														end_if

														if I_CompareCounter enemy_unit_count > 11
															if ! I_UnitDestroyed a2u12
																and ! I_UnitStatus a2u12 left_battle
																ai_gta_add_unit_label 1 0 a2u12
															end_if

															if I_CompareCounter enemy_unit_count > 12
																if ! I_UnitDestroyed a2u13
																	and ! I_UnitStatus a2u13 left_battle
																	ai_gta_add_unit_label 1 0 a2u13
																end_if

																if I_CompareCounter enemy_unit_count > 13
																	if ! I_UnitDestroyed a2u14
																		and ! I_UnitStatus a2u14 left_battle
																		ai_gta_add_unit_label 1 0 a2u14
																	end_if

																	if I_CompareCounter enemy_unit_count > 14
																		if ! I_UnitDestroyed a2u15
																			and ! I_UnitStatus a2u15 left_battle
																			ai_gta_add_unit_label 1 0 a2u15
																		end_if

																		if I_CompareCounter enemy_unit_count > 15
																			if ! I_UnitDestroyed a2u16
																				and ! I_UnitStatus a2u16 left_battle
																				ai_gta_add_unit_label 1 0 a2u16
																			end_if

																			if I_CompareCounter enemy_unit_count > 16
																				if ! I_UnitDestroyed a2u17
																					and ! I_UnitStatus a2u17 left_battle
																					ai_gta_add_unit_label 1 0 a2u17
																				end_if

																				if I_CompareCounter enemy_unit_count > 17
																					if ! I_UnitDestroyed a2u18
																						and ! I_UnitStatus a2u18 left_battle
																						ai_gta_add_unit_label 1 0 a2u18
																					end_if

																					if I_CompareCounter enemy_unit_count > 18
																						if ! I_UnitDestroyed a2u19
																							and ! I_UnitStatus a2u19 left_battle
																							ai_gta_add_unit_label 1 0 a2u19
																						end_if

																						if I_CompareCounter enemy_unit_count = 20
																							if ! I_UnitDestroyed a2u20
																								and ! I_UnitStatus a2u20 left_battle
																								ai_gta_add_unit_label 1 0 a2u20
																							end_if
																						end_if
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if

			;    battle_wait 0.5
			;	 unit_group_order_halt army2
			;    ai_active_set off
			battle_wait 0.5
			ai_active_set on
			set_counter reset_position_s 0
			set_counter sally_defense 2
			set_counter defend_location 1
			set_counter repeat_test1 0
			set_counter repeat_test2 0
			set_counter repeat_test3 0
			set_counter repeat_test4 0
			set_counter repeat_test5 0
			set_counter repeat_test6 0
		end_if

		if I_CompareCounter sally_defense != 2
			set_counter sally_defense 3
		end_if
		if I_CompareCounter wall_line_passed > 0
			battle_wait 15
		end_if
		if I_CompareCounter reset_position_s > 0
			battle_wait 15
		end_if
		if I_CompareCounter repeat_test6 = 1
			battle_wait 20
		end_if
	end_monitor

	;;;;;Termination
	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter sally_defense > 0
		and I_CompareCounter kill_sally = 0
		and I_IsUnitRouting a2u1
		and ! I_IsUnitGroupEngaged army2
		and ! I_IsUnitGroupDestroyed army2

		ai_gta_del_objective 1
		battle_wait 0.5
		unit_group_order_halt army2
		battle_wait 0.5
		if I_CompareCounter army_south = 1
			ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, -725, 100
		end_if
		if I_CompareCounter army_north = 1
			ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, 725, 100
		end_if
		if I_CompareCounter army_east = 1
			ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 725, 0, 100
		end_if
		if I_CompareCounter army_west = 1
			ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 -725, 0, 100
		end_if

		set_counter sally_defense 0
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter kill_sally = 0
		and I_CompareCounter assign_labels = 1
		and I_UnitDestroyed a2u1
		and ! I_IsUnitGroupDestroyed army2

		set_counter reset_army2 1
		;    battle_wait 0.5
		;    ai_active_set off
		battle_wait 0.5
		ai_active_set on
		set_counter assign_labels 2
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter kill_sally = 0
		and I_CompareCounter assign_labels = 2
		and I_UnitDestroyed a2u1
		and ! I_IsUnitGroupDestroyed army2

		set_counter assign_labels 1
	end_monitor

	;;;Sally Reinforcements

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter sally_reinf = 1
		and I_CompareCounter kill_sally = 0
		;	and ! I_BattleIsFortBattle
		and I_BattlePlayerArmyIsAttacker
		and ! I_IsUnitEngaged a4u1

		if I_CompareCounter sally_defense < 3
			set_counter defend_location 1
			set_counter sally_reinf 2
		end_if

		if I_CompareCounter sally_defense > 2

			set_counter defend_location 2
			set_counter sally_reinf 2
		end_if

	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_BattlePlayerArmyIsAttacker
		and I_CompareCounter sally_reinf = 2
		and I_CompareCounter sally_defense < 3
		and I_CompareCounter sally_defense != 1
		and I_CompareCounter defend_location = 1
		and I_CompareCounter army4_ready_sally = 0
		and I_CompareCounter army4_ready = 0
		and ! I_IsUnitGroupEngaged army4
		and ! I_IsUnitGroupEngaged army2
		and ! I_UnitStatus a4u1 pursuing
		and ! I_UnitStatus a4u1 charging
		and ! I_UnitEnemyUnitInRadius a4u1 20

		;;;Army 4
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u1
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u2
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u3
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u4
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u5
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u6
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u7
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u8
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u9
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u10
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u11
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u12
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u13
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u14
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u15
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u16
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u17
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u18
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u19
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u20

		battle_wait 0.5
		ai_active_set on

		set_counter defend_location 0
		;	set_counter army4_idle_s 0
		battle_wait 20
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_BattlePlayerArmyIsAttacker
		and I_CompareCounter sally_reinf = 2
		and I_CompareCounter sally_defense > 2
		and I_CompareCounter defend_location = 2
		and I_CompareCounter army4_ready_sally = 0
		and I_CompareCounter army4_ready = 0

		;;;Army 4
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u1
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u2
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u3
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u4
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u5
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u6
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u7
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u8
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u9
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u10
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u11
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u12
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u13
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u14
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u15
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u16
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u17
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u18
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u19
		ai_gta_add_unit_label 1 G5_OBJECTIVE a4u20

		;    ai_active_set off
		battle_wait 0.5
		ai_active_set on
		set_counter defend_location 0
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_BattlePlayerArmyIsAttacker
		and I_CompareCounter sally_reinf = 2
		;	and I_CompareCounter sally_defense > 2
		and I_CompareCounter army4_ready_sally = 0
		and I_CompareCounter army4_ready = 0
		and I_CompareCounter defend_location = 0
		;    and I_UnitEnemyUnitInRadius a4u1 200

		if ! I_IsUnitGroupEngaged army4
			and ! I_IsUnitGroupMoving army4
			and ! I_UnitStatus a4u1 pursuing
			and ! I_UnitStatus a4u1 charging

			inc_counter army4_idle_s 1
		end_if
		if I_CompareCounter army4_idle_s > 5
			set_counter defend_location 1
			set_counter sally_defense 2
		end_if

		if I_IsUnitGroupEngaged army4
			set_counter army4_idle_s 0
		end_if
		if I_IsUnitGroupMoving army4
			set_counter army4_idle_s 0
		end_if
		if I_UnitStatus a4u1 pursuing
			set_counter army4_idle_s 0
		end_if
		if I_UnitStatus a4u1 charging
			set_counter army4_idle_s 0
		end_if
		battle_wait 10
	end_monitor

	;;;;;Termination
	monitor_conditions I_BattleStarted
		and I_CompareCounter sally_reinf > 0
		and I_CompareCounter army4_ready_sally = 0
		and I_CompareCounter army4_ready = 0
		and I_IsUnitGroupDestroyed army4
		and I_BattleIsSallyOutBattle

		set_counter sally_reinf 0
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter sally_reinf > 0
		and I_CompareCounter army4_ready_sally = 0
		and I_CompareCounter army4_ready = 0
		and I_UnitDestroyed a4u1
		and I_BattleIsSallyOutBattle

		set_counter label_army4 1
		;    battle_wait 0.5
		;    unit_group_enable_automation army4 false
		;    ai_active_set off
		battle_wait 0.5
		ai_active_set on
		set_counter sally_reinf 0
	end_monitor

	;################## Germanicu5 Integrated Protect General script ###########################

	monitor_event BattleConflictPhaseCommenced FactionIsLocal
		and I_CompareCounter panel_check = 1
		and I_BattleEnemyArmyNumberOfMountClass elephant = 0
		and I_CompareCounter enemy_unit_count > 4

		battle_wait 10

		if I_BattleIsSiegeBattle
			and ! I_BattlePlayerArmyIsAttacker
			;    and I_BattleEnemyArmyNumberOfSpecialAbility rally > 0
			and I_CompareCounter protect_siege = 1
			set_counter protect_general 1
		end_if

		if I_BattleIsSallyOutBattle
			and I_BattlePlayerArmyIsAttacker
			;    and I_BattleEnemyArmyNumberOfSpecialAbility rally > 0
			;    and I_CompareCounter labels_only = 1
			and I_CompareCounter kill_sally = 1
			set_counter protect_general 1
		end_if
	end_monitor

	monitor_event BattleBattleGatesDestroyedByEngine TrueCondition
		and I_CompareCounter panel_check = 1
		and I_CompareCounter protect_general = 1

		set_counter protect_general 0
		if I_BattleIsSiegeBattle
			and ! I_BattlePlayerArmyIsAttacker
			set_counter general_wait 1
		end_if

		if I_BattleIsSallyOutBattle
			and I_BattlePlayerArmyIsAttacker
			and I_CompareCounter kill_sally = 1
			set_counter general_wait 1
		end_if
	end_monitor

	monitor_event BattleWallsCaptured TrueCondition
		and I_CompareCounter panel_check = 1
		and I_CompareCounter protect_general = 1

		set_counter protect_general 0
		if I_BattleIsSiegeBattle
			and ! I_BattlePlayerArmyIsAttacker
			set_counter general_wait 1
		end_if

		if I_BattleIsSallyOutBattle
			and I_BattlePlayerArmyIsAttacker
			set_counter general_wait 1
		end_if
	end_monitor

	monitor_event BattleWallsBreachedByEngine TrueCondition
		and I_CompareCounter panel_check = 1
		and I_CompareCounter protect_general = 1

		set_counter protect_general 0
		if I_BattleIsSiegeBattle
			and ! I_BattlePlayerArmyIsAttacker
			set_counter general_wait 1
		end_if

		if I_BattleIsSallyOutBattle
			and I_BattlePlayerArmyIsAttacker
			set_counter general_wait 1
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSiegeBattle
		and I_CompareCounter general_wait = 1
		and I_IsUnitMoveFastSet a1u1
		and I_BattleEnemyArmyNumberOfUnitCategory cavalry > 0

		battle_wait 0.5
		unit_order_halt a1u1
		if I_CompareCounter enemy_unit_count < 7
			set_counter general_wait 2
			battle_wait 20
			if I_BattleIsSiegeBattle
				and I_CompareCounter general_wait = 2
				set_counter general_wait 3
				battle_wait 20
			end_if
		end_if
		if I_CompareCounter enemy_unit_count > 6
			and I_CompareCounter enemy_unit_count < 12
			set_counter general_wait 2
			battle_wait 25
			if I_BattleIsSiegeBattle
				and I_CompareCounter general_wait = 2
				set_counter general_wait 3
				battle_wait 25
			end_if
		end_if
		if I_CompareCounter enemy_unit_count > 11
			and I_CompareCounter enemy_unit_count < 16
			set_counter general_wait 2
			battle_wait 30
			if I_BattleIsSiegeBattle
				and I_CompareCounter general_wait = 2
				set_counter general_wait 3
				battle_wait 30
			end_if
		end_if
		if I_CompareCounter enemy_unit_count > 15
			set_counter general_wait 2
			battle_wait 35
			if I_BattleIsSiegeBattle
				and I_CompareCounter general_wait = 2
				set_counter general_wait 3
				battle_wait 35
			end_if
		end_if
		if I_BattleIsSiegeBattle
			and I_CompareCounter general_wait = 3
			release_unit a1u1
			set_counter general_wait 0
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter general_wait = 1
		and I_IsUnitMoveFastSet a2u1
		and I_BattleEnemyArmyNumberOfUnitCategory cavalry > 0

		battle_wait 0.5
		unit_order_halt a2u1

		if I_CompareCounter enemy_unit_count < 7
			set_counter general_wait 2
			battle_wait 20
			if I_BattleIsSallyOutBattle
				and I_CompareCounter general_wait = 2
				set_counter general_wait 3
				battle_wait 20
			end_if
		end_if
		if I_CompareCounter enemy_unit_count > 6
			and I_CompareCounter enemy_unit_count < 12
			set_counter general_wait 2
			battle_wait 25
			if I_BattleIsSallyOutBattle
				and I_CompareCounter general_wait = 2
				set_counter general_wait 3
				battle_wait 25
			end_if
		end_if
		if I_CompareCounter enemy_unit_count > 11
			and I_CompareCounter enemy_unit_count < 16
			set_counter general_wait 2
			battle_wait 30
			if I_BattleIsSallyOutBattle
				and I_CompareCounter general_wait = 2
				set_counter general_wait 3
				battle_wait 30
			end_if
		end_if
		if I_CompareCounter enemy_unit_count > 15
			set_counter general_wait 2
			battle_wait 35
			if I_BattleIsSallyOutBattle
				and I_CompareCounter general_wait = 2
				set_counter general_wait 3
				battle_wait 35
			end_if
		end_if
		if I_BattleIsSallyOutBattle
			and I_CompareCounter general_wait = 3
			release_unit a2u1
			set_counter general_wait 0
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter general_wait > 1
		and I_BattleIsSiegeBattle
		and ! I_BattlePlayerArmyIsAttacker
		and I_UnitEnemyUnitInRadius a1u1 60

		set_counter general_wait 0
		release_unit a1u1
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter general_wait > 1
		and I_BattleIsSallyOutBattle
		and I_BattlePlayerArmyIsAttacker
		and I_UnitEnemyUnitInRadius a2u1 60

		set_counter general_wait 0
		release_unit a2u1
	end_monitor

	;################## Germanicu5 Integrated Siege script ###########################

	monitor_conditions I_BattleStarted
		and ! I_BattleIsFortBattle
		and I_BattleEnemyArmyNumberOfMountClass elephant = 0
		and I_BattleSettlementFortificationLevel > 0
		and I_CompareCounter siege_fix = 1

		set_counter siege_fix 0

		if I_BattleIsSallyOutBattle
			and I_BattleEnemyArmyNumberOfClassAndCategory missile siege > 0
			set_counter army_sieging 1
		end_if

		if I_BattleIsSallyOutBattle
			and I_BattleEnemyArmyNumberOfClassAndCategory missile siege = 0
			set_counter wall_advance_s 1
		end_if
	end_monitor

	;;;;;;;Sally Out

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_BattlePlayerArmyIsAttacker
		and I_CompareCounter reset_army2 = 1

		set_counter reset_army2 0
		set_counter enemy_unit_count 0

		if I_BattleEnemyArmyNumberOfUnits > 0
			label_unit 1 0 0 a2u1
			inc_counter enemy_unit_count 1
			if I_BattleEnemyArmyNumberOfUnits > 1
				label_unit 1 0 1 a2u2
				inc_counter enemy_unit_count 1
				if I_BattleEnemyArmyNumberOfUnits > 2
					label_unit 1 0 2 a2u3
					inc_counter enemy_unit_count 1
					if I_BattleEnemyArmyNumberOfUnits > 3
						label_unit 1 0 3 a2u4
						inc_counter enemy_unit_count 1
						if I_BattleEnemyArmyNumberOfUnits > 4
							label_unit 1 0 4 a2u5
							inc_counter enemy_unit_count 1
							if I_BattleEnemyArmyNumberOfUnits > 5
								label_unit 1 0 5 a2u6
								inc_counter enemy_unit_count 1
								if I_BattleEnemyArmyNumberOfUnits > 6
									label_unit 1 0 6 a2u7
									inc_counter enemy_unit_count 1
									if I_BattleEnemyArmyNumberOfUnits > 7
										label_unit 1 0 7 a2u8
										inc_counter enemy_unit_count 1
										if I_BattleEnemyArmyNumberOfUnits > 8
											label_unit 1 0 8 a2u9
											inc_counter enemy_unit_count 1
											if I_BattleEnemyArmyNumberOfUnits > 9
												label_unit 1 0 9 a2u10
												inc_counter enemy_unit_count 1
												if I_BattleEnemyArmyNumberOfUnits > 10
													label_unit 1 0 10 a2u11
													inc_counter enemy_unit_count 1
													if I_BattleEnemyArmyNumberOfUnits > 11
														label_unit 1 0 11 a2u12
														inc_counter enemy_unit_count 1
														if I_BattleEnemyArmyNumberOfUnits > 12
															label_unit 1 0 12 a2u13
															inc_counter enemy_unit_count 1
															if I_BattleEnemyArmyNumberOfUnits > 13
																label_unit 1 0 13 a2u14
																inc_counter enemy_unit_count 1
																if I_BattleEnemyArmyNumberOfUnits > 14
																	label_unit 1 0 14 a2u15
																	inc_counter enemy_unit_count 1
																	if I_BattleEnemyArmyNumberOfUnits > 15
																		label_unit 1 0 15 a2u16
																		inc_counter enemy_unit_count 1
																		if I_BattleEnemyArmyNumberOfUnits > 16
																			label_unit 1 0 16 a2u17
																			inc_counter enemy_unit_count 1
																			if I_BattleEnemyArmyNumberOfUnits > 17
																				label_unit 1 0 17 a2u18
																				inc_counter enemy_unit_count 1
																				if I_BattleEnemyArmyNumberOfUnits > 18
																					label_unit 1 0 18 a2u19
																					inc_counter enemy_unit_count 1
																					if I_BattleEnemyArmyNumberOfUnits = 20
																						label_unit 1 0 19 a2u20
																						inc_counter enemy_unit_count 1
																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if
	end_monitor

	;;;;;;;Huge City

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and ! I_BattleIsFortBattle
		and I_CompareCounter army_sieging = 1
		and I_CompareCounter army2_sally = 1
		and I_BattleEnemyArmyNumberOfClassAndCategory missile siege > 0
		and I_BattlePlayerArmyNumberOfAttribute extreme_range > 0
		and I_BattlePlayerArmyIsAttacker
		and ! I_IsBattleSettlementCastle
		and I_BattleSettlementFortificationLevel = 4

		battle_wait 2
		set_counter reset_army2 1
		battle_wait 0.5
		unit_group_order_halt army2
		battle_wait 0.5
		unit_group_order_relative_move_formed army2 0 35

		set_counter emergency_stop 1
		set_counter omfg_cannon_tower 1
		battle_wait 2
		ai_active_set on
		set_counter sally_check 10
		battle_wait 30

		if I_BattleIsSallyOutBattle
			and I_CompareCounter sally_check = 10
			if I_BattleStarted
				and I_CompareCounter omfg_cannon_tower > 0
				set_counter omfg_cannon_tower 0
			end_if

			if I_BattleStarted
				and I_CompareCounter emergency_stop = 1
				if ! I_IsUnitGroupMoving army2
					set_counter emergency_stop 0
					unit_group_order_halt army2
					battle_wait 0.5
					ai_active_set on
				end_if
				if I_IsUnitGroupMoving army2
					;	battle_wait 170
					set_counter sally_check 14
					battle_wait 20
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 14
						set_counter sally_check 15
						battle_wait 30
					end_if
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 15
						set_counter sally_check 16
						battle_wait 30
					end_if
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 16
						set_counter sally_check 17
						battle_wait 30
					end_if
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 17
						set_counter sally_check 18
						battle_wait 30
					end_if
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 18
						set_counter sally_check 19
						battle_wait 30
					end_if
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 19
						set_counter emergency_stop 0
						unit_group_order_halt army2
						battle_wait 0.5
						ai_active_set on
					end_if
				end_if
			end_if

			set_counter army_sieging 0
			set_counter army2_sally 0
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and ! I_BattleIsFortBattle
		and I_CompareCounter army_sieging = 1
		and I_CompareCounter army2_sally = 1
		and I_BattleEnemyArmyNumberOfClassAndCategory missile siege > 0
		and I_BattlePlayerArmyNumberOfAttribute extreme_range = 0
		and I_BattlePlayerArmyIsAttacker
		and ! I_IsBattleSettlementCastle
		and I_BattleSettlementFortificationLevel = 4

		battle_wait 2
		set_counter reset_army2 1
		battle_wait 0.5
		unit_group_order_halt army2
		battle_wait 0.5
		unit_group_order_relative_move_formed army2 0 80

		set_counter emergency_stop 1
		set_counter omfg_cannon_tower 1
		battle_wait 2
		ai_active_set on
		;	battle_wait 60
		set_counter sally_check 20
		battle_wait 30
		if I_BattleIsSallyOutBattle
			and I_CompareCounter sally_check = 20
			set_counter sally_check 21
			battle_wait 30
			if I_BattleIsSallyOutBattle
				and I_CompareCounter sally_check = 21
				if I_BattleStarted
					and I_CompareCounter omfg_cannon_tower > 0
					set_counter omfg_cannon_tower 0
				end_if

				if I_BattleStarted
					and I_CompareCounter emergency_stop = 1
					if ! I_IsUnitGroupMoving army2
						set_counter emergency_stop 0
						unit_group_order_halt army2
						battle_wait 0.5
						ai_active_set on
					end_if
					if I_IsUnitGroupMoving army2
						;	battle_wait 170
						set_counter sally_check 24
						battle_wait 20
						if I_BattleIsSallyOutBattle
							and I_CompareCounter sally_check = 24
							set_counter sally_check 25
							battle_wait 30
						end_if
						if I_BattleIsSallyOutBattle
							and I_CompareCounter sally_check = 25
							set_counter sally_check 26
							battle_wait 30
						end_if
						if I_BattleIsSallyOutBattle
							and I_CompareCounter sally_check = 26
							set_counter sally_check 27
							battle_wait 30
						end_if
						if I_BattleIsSallyOutBattle
							and I_CompareCounter sally_check = 27
							set_counter sally_check 28
							battle_wait 30
						end_if
						if I_BattleIsSallyOutBattle
							and I_CompareCounter sally_check = 28
							set_counter sally_check 29
							battle_wait 30
						end_if
						if I_BattleIsSallyOutBattle
							and I_CompareCounter sally_check = 29
							set_counter emergency_stop 0
							unit_group_order_halt army2
							battle_wait 0.5
							ai_active_set on
						end_if
					end_if
				end_if

				set_counter army_sieging 0
				set_counter army2_sally 0
			end_if
		end_if
	end_monitor

	;;;;;;;Large City

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and ! I_BattleIsFortBattle
		and I_CompareCounter army_sieging = 1
		and I_CompareCounter army2_sally = 1
		and I_BattleEnemyArmyNumberOfClassAndCategory missile siege > 0
		and I_BattlePlayerArmyNumberOfAttribute extreme_range > 0
		and I_BattlePlayerArmyIsAttacker
		and ! I_IsBattleSettlementCastle
		and I_BattleSettlementFortificationLevel = 3

		battle_wait 2
		set_counter reset_army2 1
		battle_wait 0.5
		unit_group_order_halt army2
		battle_wait 0.5
		unit_group_order_relative_move_formed army2 0 45

		set_counter emergency_stop 1
		set_counter omfg_cannon_tower 1
		battle_wait 2
		ai_active_set on
		set_counter sally_check 30
		battle_wait 37

		if I_BattleIsSallyOutBattle
			and I_CompareCounter sally_check = 30
			if I_BattleStarted
				and I_CompareCounter omfg_cannon_tower > 0
				set_counter omfg_cannon_tower 0
			end_if

			if I_BattleStarted
				and I_CompareCounter emergency_stop = 1
				if ! I_IsUnitGroupMoving army2
					set_counter emergency_stop 0
					unit_group_order_halt army2
					battle_wait 0.5
					ai_active_set on
				end_if
				if I_IsUnitGroupMoving army2
					;	battle_wait 170
					set_counter sally_check 34
					battle_wait 20
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 34
						set_counter sally_check 35
						battle_wait 30
					end_if
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 35
						set_counter sally_check 36
						battle_wait 30
					end_if
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 36
						set_counter sally_check 37
						battle_wait 30
					end_if
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 37
						set_counter sally_check 38
						battle_wait 30
					end_if
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 38
						set_counter sally_check 39
						battle_wait 30
					end_if
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 39
						set_counter emergency_stop 0
						unit_group_order_halt army2
						battle_wait 0.5
						ai_active_set on
					end_if
				end_if
			end_if

			set_counter army_sieging 0
			set_counter army2_sally 0
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and ! I_BattleIsFortBattle
		and I_CompareCounter army_sieging = 1
		and I_CompareCounter army2_sally = 1
		and I_BattleEnemyArmyNumberOfClassAndCategory missile siege > 0
		and I_BattlePlayerArmyNumberOfAttribute extreme_range = 0
		and I_BattlePlayerArmyIsAttacker
		and ! I_IsBattleSettlementCastle
		and I_BattleSettlementFortificationLevel = 3

		battle_wait 2
		set_counter reset_army2 1
		battle_wait 0.5
		unit_group_order_halt army2
		battle_wait 0.5
		unit_group_order_relative_move_formed army2 0 90

		set_counter emergency_stop 1
		set_counter omfg_cannon_tower 1
		battle_wait 2
		ai_active_set on
		;	battle_wait 70
		set_counter sally_check 40
		battle_wait 35
		if I_BattleIsSallyOutBattle
			and I_CompareCounter sally_check = 40
			set_counter sally_check 41
			battle_wait 35
		end_if
		if I_BattleIsSallyOutBattle
			and I_CompareCounter sally_check = 41
			if I_BattleStarted
				and I_CompareCounter emergency_stop = 1
				if ! I_IsUnitGroupMoving army2
					set_counter emergency_stop 0
					if I_CompareCounter omfg_cannon_tower > 0
						set_counter omfg_cannon_tower 0
					end_if
					unit_group_order_halt army2
					battle_wait 0.5
					ai_active_set on
				end_if
				if I_IsUnitGroupMoving army2
					;	battle_wait 170
					set_counter sally_check 44
					battle_wait 20
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 44
						set_counter sally_check 45
						battle_wait 30
					end_if
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 45
						set_counter sally_check 46
						battle_wait 30
					end_if
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 46
						set_counter sally_check 47
						battle_wait 30
					end_if
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 47
						set_counter sally_check 48
						battle_wait 30
					end_if
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 48
						set_counter sally_check 49
						battle_wait 30
					end_if
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 49
						set_counter emergency_stop 0
						if I_CompareCounter omfg_cannon_tower > 0
							set_counter omfg_cannon_tower 0
						end_if
						unit_group_order_halt army2
						battle_wait 0.5
						ai_active_set on
					end_if
				end_if
			end_if

			set_counter army_sieging 0
			set_counter army2_sally 0
		end_if
	end_monitor

	;;;;;;;Castle, Citadel and Fortress

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and ! I_BattleIsFortBattle
		and I_CompareCounter army_sieging = 1
		and I_CompareCounter army2_sally = 1
		and I_BattleEnemyArmyNumberOfClassAndCategory missile siege > 0
		and I_BattlePlayerArmyNumberOfAttribute extreme_range > 0
		and I_BattlePlayerArmyIsAttacker
		and I_IsBattleSettlementCastle
		and I_BattleSettlementFortificationLevel = 3

		battle_wait 2
		set_counter reset_army2 1
		battle_wait 0.5
		unit_group_order_halt army2
		battle_wait 0.5
		unit_group_order_relative_move_formed army2 0 100

		set_counter emergency_stop 1
		set_counter omfg_cannon_tower 1
		battle_wait 2
		ai_active_set on
		;	battle_wait 75
		set_counter sally_check 50
		battle_wait 15
		if I_BattleIsSallyOutBattle
			and I_CompareCounter sally_check = 50
			set_counter sally_check 51
			battle_wait 30
		end_if
		if I_BattleIsSallyOutBattle
			and I_CompareCounter sally_check = 51
			set_counter sally_check 52
			battle_wait 30
		end_if
		if I_BattleIsSallyOutBattle
			and I_CompareCounter sally_check = 52
			if I_BattleStarted
				and I_CompareCounter omfg_cannon_tower > 0
				set_counter omfg_cannon_tower 0
			end_if

			if I_BattleStarted
				and I_CompareCounter emergency_stop = 1
				if ! I_IsUnitGroupMoving army2
					set_counter emergency_stop 0
					unit_group_order_halt army2
					battle_wait 0.5
					ai_active_set on
				end_if
				if I_IsUnitGroupMoving army2
					;	battle_wait 170
					set_counter sally_check 54
					battle_wait 20
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 54
						set_counter sally_check 55
						battle_wait 30
					end_if
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 55
						set_counter sally_check 56
						battle_wait 30
					end_if
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 56
						set_counter sally_check 57
						battle_wait 30
					end_if
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 57
						set_counter sally_check 58
						battle_wait 30
					end_if
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 58
						set_counter sally_check 59
						battle_wait 30
					end_if
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 59
						set_counter emergency_stop 0
						unit_group_order_halt army2
						battle_wait 0.5
						ai_active_set on
					end_if
				end_if
			end_if

			set_counter army_sieging 0
			set_counter army2_sally 0
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and ! I_BattleIsFortBattle
		and I_CompareCounter army_sieging = 1
		and I_CompareCounter army2_sally = 1
		and I_BattleEnemyArmyNumberOfClassAndCategory missile siege > 0
		and I_BattlePlayerArmyNumberOfAttribute extreme_range = 0
		and I_BattlePlayerArmyIsAttacker
		and I_IsBattleSettlementCastle
		and I_BattleSettlementFortificationLevel = 3

		battle_wait 2
		set_counter reset_army2 1
		battle_wait 0.5
		unit_group_order_halt army2
		battle_wait 0.5
		unit_group_order_relative_move_formed army2 0 170

		set_counter emergency_stop 1
		set_counter omfg_cannon_tower 1
		battle_wait 2
		ai_active_set on
		;	battle_wait 125
		set_counter sally_check 60
		battle_wait 30
		if I_BattleIsSallyOutBattle
			and I_CompareCounter sally_check = 60
			set_counter sally_check 61
			battle_wait 30
		end_if
		if I_BattleIsSallyOutBattle
			and I_CompareCounter sally_check = 61
			set_counter sally_check 62
			battle_wait 30
		end_if
		if I_BattleIsSallyOutBattle
			and I_CompareCounter sally_check = 62
			set_counter sally_check 63
			battle_wait 35
		end_if
		if I_BattleIsSallyOutBattle
			and I_CompareCounter sally_check = 63
			if I_BattleStarted
				and I_CompareCounter omfg_cannon_tower > 0
				set_counter omfg_cannon_tower 0
			end_if

			if I_BattleStarted
				and I_CompareCounter emergency_stop = 1
				if ! I_IsUnitGroupMoving army2
					set_counter emergency_stop 0
					unit_group_order_halt army2
					battle_wait 0.5
					ai_active_set on
				end_if
				if I_IsUnitGroupMoving army2
					;	battle_wait 170
					set_counter sally_check 64
					battle_wait 20
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 64
						set_counter sally_check 65
						battle_wait 30
					end_if
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 65
						set_counter sally_check 66
						battle_wait 30
					end_if
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 66
						set_counter sally_check 67
						battle_wait 30
					end_if
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 67
						set_counter sally_check 68
						battle_wait 30
					end_if
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 68
						set_counter sally_check 69
						battle_wait 30
					end_if
					if I_BattleIsSallyOutBattle
						and I_CompareCounter sally_check = 69
						set_counter emergency_stop 0
						unit_group_order_halt army2
						battle_wait 0.5
						ai_active_set on
					end_if
				end_if
			end_if

			set_counter army_sieging 0
			set_counter army2_sally 0
		end_if
	end_monitor

	;;;;;;;Wall Advance

	monitor_conditions I_BattleStarted
		and I_CompareCounter wall_advance_s = 1
		and I_CompareCounter kill_sally = 1
		and I_BattleIsSallyOutBattle

		battle_wait 2
		if I_BattleSettlementFortificationLevel < 3
			and I_CompareCounter wall_advance_s = 1
			set_counter reset_army2 1
			battle_wait 0.5
			unit_group_order_halt army2
			battle_wait 0.5
			unit_group_order_relative_move_unformed army2 0 95
		end_if

		if I_BattleSettlementFortificationLevel > 2
			and I_CompareCounter wall_advance_s = 1
			set_counter reset_army2 1
			battle_wait 0.5
			unit_group_order_halt army2
			battle_wait 0.5
			unit_group_order_relative_move_unformed army2 0 200
		end_if

		set_counter emergency_stop 1
		if I_BattleSettlementFortificationLevel < 3
			;	battle_wait 72
			set_counter sally_check 113
			battle_wait 36
			if I_BattleIsSallyOutBattle
				and I_CompareCounter sally_check = 113
				set_counter sally_check 114
				battle_wait 36
			end_if
		end_if
		if I_BattleSettlementFortificationLevel > 2
			;	battle_wait 145
			set_counter sally_check 110
			battle_wait 25
			if I_BattleIsSallyOutBattle
				and I_CompareCounter sally_check = 110
				set_counter sally_check 111
				battle_wait 30
			end_if
			if I_BattleIsSallyOutBattle
				and I_CompareCounter sally_check = 111
				set_counter sally_check 112
				battle_wait 30
			end_if
			if I_BattleIsSallyOutBattle
				and I_CompareCounter sally_check = 112
				set_counter sally_check 113
				battle_wait 30
			end_if
			if I_BattleIsSallyOutBattle
				and I_CompareCounter sally_check = 113
				set_counter sally_check 114
				battle_wait 30
			end_if
		end_if

		if I_BattleIsSallyOutBattle
			and I_CompareCounter sally_check = 114
			if I_BattleStarted
				and I_CompareCounter emergency_stop = 1

				set_counter emergency_stop 0
				unit_group_order_halt army2
				;    battle_wait 0.5
				;    ai_active_set off
				battle_wait 0.5
				ai_active_set on
			end_if
			set_counter wall_advance_s 0
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_BattleIsSallyOutBattle
		and I_CompareCounter omfg_cannon_tower > 0

		set_counter omfg_cannon_tower 2
		if I_CompareCounter player_unit_count > 0
			if I_UnitStatus a1u1 missiles_firing
				set_counter omfg_cannon_tower 1
			end_if
			if I_UnitStatus a1u1 missiles_reloading
				set_counter omfg_cannon_tower 1
			end_if

			if I_CompareCounter player_unit_count > 1
				and I_CompareCounter omfg_cannon_tower != 1
				if I_UnitStatus a1u2 missiles_firing
					set_counter omfg_cannon_tower 1
				end_if
				if I_UnitStatus a1u2 missiles_reloading
					set_counter omfg_cannon_tower 1
				end_if

				if I_CompareCounter player_unit_count > 2
					and I_CompareCounter omfg_cannon_tower != 1
					if I_UnitStatus a1u3 missiles_firing
						set_counter omfg_cannon_tower 1
					end_if
					if I_UnitStatus a1u3 missiles_reloading
						set_counter omfg_cannon_tower 1
					end_if

					if I_CompareCounter player_unit_count > 3
						and I_CompareCounter omfg_cannon_tower != 1
						if I_UnitStatus a1u4 missiles_firing
							set_counter omfg_cannon_tower 1
						end_if
						if I_UnitStatus a1u4 missiles_reloading
							set_counter omfg_cannon_tower 1
						end_if

						if I_CompareCounter player_unit_count > 4
							and I_CompareCounter omfg_cannon_tower != 1
							if I_UnitStatus a1u5 missiles_firing
								set_counter omfg_cannon_tower 1
							end_if
							if I_UnitStatus a1u5 missiles_reloading
								set_counter omfg_cannon_tower 1
							end_if

							if I_CompareCounter player_unit_count > 5
								and I_CompareCounter omfg_cannon_tower != 1
								if I_UnitStatus a1u6 missiles_firing
									set_counter omfg_cannon_tower 1
								end_if
								if I_UnitStatus a1u6 missiles_reloading
									set_counter omfg_cannon_tower 1
								end_if

								if I_CompareCounter player_unit_count > 6
									and I_CompareCounter omfg_cannon_tower != 1
									if I_UnitStatus a1u7 missiles_firing
										set_counter omfg_cannon_tower 1
									end_if
									if I_UnitStatus a1u7 missiles_reloading
										set_counter omfg_cannon_tower 1
									end_if

									if I_CompareCounter player_unit_count > 7
										and I_CompareCounter omfg_cannon_tower != 1
										if I_UnitStatus a1u8 missiles_firing
											set_counter omfg_cannon_tower 1
										end_if
										if I_UnitStatus a1u8 missiles_reloading
											set_counter omfg_cannon_tower 1
										end_if

										if I_CompareCounter player_unit_count > 8
											and I_CompareCounter omfg_cannon_tower != 1
											if I_UnitStatus a1u9 missiles_firing
												set_counter omfg_cannon_tower 1
											end_if
											if I_UnitStatus a1u9 missiles_reloading
												set_counter omfg_cannon_tower 1
											end_if

											if I_CompareCounter player_unit_count > 9
												and I_CompareCounter omfg_cannon_tower != 1
												if I_UnitStatus a1u10 missiles_firing
													set_counter omfg_cannon_tower 1
												end_if
												if I_UnitStatus a1u10 missiles_reloading
													set_counter omfg_cannon_tower 1
												end_if

												if I_CompareCounter player_unit_count > 10
													and I_CompareCounter omfg_cannon_tower != 1
													if I_UnitStatus a1u11 missiles_firing
														set_counter omfg_cannon_tower 1
													end_if
													if I_UnitStatus a1u11 missiles_reloading
														set_counter omfg_cannon_tower 1
													end_if

													if I_CompareCounter player_unit_count > 11
														and I_CompareCounter omfg_cannon_tower != 1
														if I_UnitStatus a1u12 missiles_firing
															set_counter omfg_cannon_tower 1
														end_if
														if I_UnitStatus a1u12 missiles_reloading
															set_counter omfg_cannon_tower 1
														end_if

														if I_CompareCounter player_unit_count > 12
															and I_CompareCounter omfg_cannon_tower != 1
															if I_UnitStatus a1u13 missiles_firing
																set_counter omfg_cannon_tower 1
															end_if
															if I_UnitStatus a1u13 missiles_reloading
																set_counter omfg_cannon_tower 1
															end_if

															if I_CompareCounter player_unit_count > 13
																and I_CompareCounter omfg_cannon_tower != 1
																if I_UnitStatus a1u14 missiles_firing
																	set_counter omfg_cannon_tower 1
																end_if
																if I_UnitStatus a1u14 missiles_reloading
																	set_counter omfg_cannon_tower 1
																end_if

																if I_CompareCounter player_unit_count > 14
																	and I_CompareCounter omfg_cannon_tower != 1
																	if I_UnitStatus a1u15 missiles_firing
																		set_counter omfg_cannon_tower 1
																	end_if
																	if I_UnitStatus a1u15 missiles_reloading
																		set_counter omfg_cannon_tower 1
																	end_if

																	if I_CompareCounter player_unit_count > 15
																		and I_CompareCounter omfg_cannon_tower != 1
																		if I_UnitStatus a1u16 missiles_firing
																			set_counter omfg_cannon_tower 1
																		end_if
																		if I_UnitStatus a1u16 missiles_reloading
																			set_counter omfg_cannon_tower 1
																		end_if

																		if I_CompareCounter player_unit_count > 16
																			and I_CompareCounter omfg_cannon_tower != 1
																			if I_UnitStatus a1u17 missiles_firing
																				set_counter omfg_cannon_tower 1
																			end_if
																			if I_UnitStatus a1u17 missiles_reloading
																				set_counter omfg_cannon_tower 1
																			end_if

																			if I_CompareCounter player_unit_count > 17
																				and I_CompareCounter omfg_cannon_tower != 1
																				if I_UnitStatus a1u18 missiles_firing
																					set_counter omfg_cannon_tower 1
																				end_if
																				if I_UnitStatus a1u18 missiles_reloading
																					set_counter omfg_cannon_tower 1
																				end_if

																				if I_CompareCounter player_unit_count > 18
																					and I_CompareCounter omfg_cannon_tower != 1
																					if I_UnitStatus a1u19 missiles_firing
																						set_counter omfg_cannon_tower 1
																					end_if
																					if I_UnitStatus a1u19 missiles_reloading
																						set_counter omfg_cannon_tower 1
																					end_if

																					if I_CompareCounter player_unit_count > 19
																						and I_CompareCounter omfg_cannon_tower != 1
																						if I_UnitStatus a1u20 missiles_firing
																							set_counter omfg_cannon_tower 1
																						end_if
																						if I_UnitStatus a1u20 missiles_reloading
																							set_counter omfg_cannon_tower 1
																						end_if

																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if

		if I_CompareCounter omfg_cannon_tower = 2

			if I_CompareCounter enemy_unit_count > 0
				and I_CompareCounter omfg_cannon_tower = 2
				and I_IsUnitUnderFire a2u1
				set_counter omfg_cannon_tower 3
			end_if

			if I_CompareCounter enemy_unit_count > 1
				and I_CompareCounter omfg_cannon_tower = 2
				and I_IsUnitUnderFire a2u2
				set_counter omfg_cannon_tower 3
			end_if

			if I_CompareCounter enemy_unit_count > 2
				and I_CompareCounter omfg_cannon_tower = 2
				and I_IsUnitUnderFire a2u3
				set_counter omfg_cannon_tower 3
			end_if

			if I_CompareCounter enemy_unit_count > 3
				and I_CompareCounter omfg_cannon_tower = 2
				and I_IsUnitUnderFire a2u4
				set_counter omfg_cannon_tower 3
			end_if

			if I_CompareCounter enemy_unit_count > 4
				and I_CompareCounter omfg_cannon_tower = 2
				and I_IsUnitUnderFire a2u5
				set_counter omfg_cannon_tower 3
			end_if

			if I_CompareCounter enemy_unit_count > 5
				and I_CompareCounter omfg_cannon_tower = 2
				and I_IsUnitUnderFire a2u6
				set_counter omfg_cannon_tower 3
			end_if

			if I_CompareCounter enemy_unit_count > 6
				and I_CompareCounter omfg_cannon_tower = 2
				and I_IsUnitUnderFire a2u7
				set_counter omfg_cannon_tower 3
			end_if

			if I_CompareCounter enemy_unit_count > 7
				and I_CompareCounter omfg_cannon_tower = 2
				and I_IsUnitUnderFire a2u8
				set_counter omfg_cannon_tower 3
			end_if

			if I_CompareCounter enemy_unit_count > 8
				and I_CompareCounter omfg_cannon_tower = 2
				and I_IsUnitUnderFire a2u9
				set_counter omfg_cannon_tower 3
			end_if

			if I_CompareCounter enemy_unit_count > 9
				and I_CompareCounter omfg_cannon_tower = 2
				and I_IsUnitUnderFire a2u10
				set_counter omfg_cannon_tower 3
			end_if

			if I_CompareCounter enemy_unit_count > 10
				and I_CompareCounter omfg_cannon_tower = 2
				and I_IsUnitUnderFire a2u11
				set_counter omfg_cannon_tower 3
			end_if

			if I_CompareCounter enemy_unit_count > 11
				and I_CompareCounter omfg_cannon_tower = 2
				and I_IsUnitUnderFire a2u12
				set_counter omfg_cannon_tower 3
			end_if

			if I_CompareCounter enemy_unit_count > 12
				and I_CompareCounter omfg_cannon_tower = 2
				and I_IsUnitUnderFire a2u13
				set_counter omfg_cannon_tower 3
			end_if

			if I_CompareCounter enemy_unit_count > 13
				and I_CompareCounter omfg_cannon_tower = 2
				and I_IsUnitUnderFire a2u14
				set_counter omfg_cannon_tower 3
			end_if

			if I_CompareCounter enemy_unit_count > 14
				and I_CompareCounter omfg_cannon_tower = 2
				and I_IsUnitUnderFire a2u15
				set_counter omfg_cannon_tower 3
			end_if

			if I_CompareCounter enemy_unit_count > 15
				and I_CompareCounter omfg_cannon_tower = 2
				and I_IsUnitUnderFire a2u16
				set_counter omfg_cannon_tower 3
			end_if

			if I_CompareCounter enemy_unit_count > 16
				and I_CompareCounter omfg_cannon_tower = 2
				and I_IsUnitUnderFire a2u17
				set_counter omfg_cannon_tower 3
			end_if

			if I_CompareCounter enemy_unit_count > 17
				and I_CompareCounter omfg_cannon_tower = 2
				and I_IsUnitUnderFire a2u18
				set_counter omfg_cannon_tower 3
			end_if

			if I_CompareCounter enemy_unit_count > 18
				and I_CompareCounter omfg_cannon_tower = 2
				and I_IsUnitUnderFire a2u19
				set_counter omfg_cannon_tower 3
			end_if

			if I_CompareCounter enemy_unit_count = 20
				and I_CompareCounter omfg_cannon_tower = 2
				and I_IsUnitUnderFire a2u20
				set_counter omfg_cannon_tower 3
			end_if
		end_if

		if I_CompareCounter omfg_cannon_tower = 3
			set_counter omfg_cannon_tower 0
			set_counter emergency_stop 0
			;    ai_active_set off
			;    battle_wait 0.5
			ai_active_set on
		end_if
		battle_wait 7
	end_monitor

	monitor_event BattlePlayerUnitAttacksEnemyUnit BattleIsMeleeAttack
		and I_CompareCounter panel_check = 1
		and I_CompareCounter emergency_stop = 1
		;    and I_CompareCounter labels_only = 1
		and I_CompareCounter kill_sally = 1

		if I_BattleIsSiegeBattle
			unit_group_order_halt army1
			battle_wait 0.5
			ai_active_set on
			set_counter emergency_stop 0
		end_if
		if I_BattleIsSallyOutBattle
			unit_group_order_halt army2
			battle_wait 0.5
			ai_active_set on
			set_counter emergency_stop 0
		end_if
	end_monitor

	;################## Open Battles #################

	monitor_conditions I_BattleStarted
		and I_CompareCounter ob_defense_launch = 1
		and I_CompareCounter ob_defend = 0
		and I_CompareCounter open_battle = 1
		and I_BattlePlayerArmyIsAttacker

		set_counter ob_defend 2

		if I_UnitDistanceFromUnit a1u1 a2u1 < 220
			and I_BattleEnemyArmyNumberOfUnitClass missile = 0
			and I_BattleEnemyArmyNumberOfUnitClass skirmish = 0
			ai_gta_plan_set 1 ATTACK_ALL
			set_counter apply_strategy 1
			set_counter ob_defend 4
			set_counter ob_defense_launch 0
		end_if

		if I_CompareCounter ob_defend = 2
			and I_BattleEnemyArmyPercentageOfUnitCategory cavalry > 60
			and I_UnitDistanceFromUnit a1u1 a2u1 < 270
			ai_gta_plan_set 1 ATTACK_ALL
			set_counter apply_strategy 1
			set_counter ob_defend 4
			set_counter ob_defense_launch 0
		end_if

		if I_CompareCounter ob_defend = 2
			and I_BattleEnemyArmyPercentageOfUnitCategory cavalry > 60
			set_counter ob_repeat_test 3
		end_if

		if I_CompareCounter ob_defend = 2
			and I_BattlePlayerAllianceOddsInFavour > 1.7
			set_counter ob_repeat_test 3
		end_if

		if I_CompareCounter ob_defend = 2
			and I_BattleEnemyArmyNumberOfUnitClass missile = 0
			and I_BattleEnemyArmyNumberOfUnitClass skirmish = 0
			set_counter ob_repeat_test 1
		end_if
		;    if I_BattlePlayerArmyNumberOfClassAndCategory missile siege > 0
		;    end_if
	end_monitor

	monitor_event BattlePlayerUnitAttacksEnemyUnit BattleIsMeleeAttack
		and I_CompareCounter ob_defense_launch = 1
		and I_CompareCounter open_battle = 1
		and I_CompareCounter ob_defend != 4
		and I_BattlePlayerArmyIsAttacker
		and I_UnitEnemyUnitInRadius a2u1 200
		and BattleEnemyUnitClass != missile
		and BattleEnemyUnitClass != skirmish
		and BattleDirectionOfAttack != front
		and BattleRangeOfAttack < 200

		ai_gta_plan_set 1 ATTACK_ALL
		set_counter ob_defend 4
		set_counter ob_defense_launch 0
	end_monitor

	monitor_event BattlePlayerUnitAttacksEnemyUnit BattleIsMeleeAttack
		and I_CompareCounter ob_defense_launch = 1
		and I_CompareCounter open_battle = 1
		and I_CompareCounter ob_defend != 4
		and I_BattlePlayerArmyIsAttacker
		and BattleDirectionOfAttack != rear
		and I_UnitEnemyUnitInRadius a2u1 200
		and BattleRangeOfAttack < 200
		and BattlePlayerUnitCategory = infantry

		ai_gta_plan_set 1 ATTACK_ALL
		set_counter ob_defend 4
		set_counter ob_defense_launch 0
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter ob_defense_launch = 1
		and I_CompareCounter open_battle = 1
		and I_CompareCounter ob_defend != 4
		and I_UnitEnemyUnitInRadius a2u1 100
		and I_BattlePlayerArmyIsAttacker

		ai_gta_plan_set 1 ATTACK_ALL
		set_counter apply_strategy 1
		set_counter ob_defend 4
		set_counter ob_defense_launch 0
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter ob_defense_launch = 1
		and I_CompareCounter open_battle = 1
		and I_CompareCounter ob_defend != 4
		and I_BattleEnemyArmyPercentageOfUnitCategory cavalry > 60
		and I_UnitEnemyUnitInRadius a2u1 250
		and I_BattlePlayerArmyIsAttacker

		ai_gta_plan_set 1 ATTACK_ALL
		set_counter apply_strategy 1
		set_counter ob_defend 4
		set_counter ob_defense_launch 0
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter ob_defense_launch = 1
		and I_CompareCounter open_battle = 1
		and I_CompareCounter ob_defend != 4

		set_counter player_units_closing 0

		if I_CompareCounter player_unit_count > 0
			and I_UnitDistanceFromUnit a1u1 a2u1 < 180
			and ! I_UnitStatus a1u1 missiles_firing
			and ! I_UnitStatus a1u1 missiles_reloading
			inc_counter player_units_closing 1
		end_if

		if I_CompareCounter player_unit_count > 1
			and I_UnitDistanceFromUnit a1u2 a2u1 < 180
			and ! I_UnitStatus a1u2 missiles_firing
			and ! I_UnitStatus a1u2 missiles_reloading
			inc_counter player_units_closing 1
		end_if

		if I_CompareCounter player_unit_count > 2
			and I_UnitDistanceFromUnit a1u3 a2u1 < 180
			and ! I_UnitStatus a1u3 missiles_firing
			and ! I_UnitStatus a1u3 missiles_reloading
			inc_counter player_units_closing 1
		end_if

		if I_CompareCounter player_unit_count > 3
			and I_UnitDistanceFromUnit a1u4 a2u1 < 180
			and ! I_UnitStatus a1u4 missiles_firing
			and ! I_UnitStatus a1u4 missiles_reloading
			inc_counter player_units_closing 1
		end_if

		if I_CompareCounter player_unit_count > 4
			and I_UnitDistanceFromUnit a1u5 a2u1 < 180
			and ! I_UnitStatus a1u5 missiles_firing
			and ! I_UnitStatus a1u5 missiles_reloading
			inc_counter player_units_closing 1
		end_if

		if I_CompareCounter player_unit_count > 5
			and I_UnitDistanceFromUnit a1u6 a2u1 < 180
			and ! I_UnitStatus a1u6 missiles_firing
			and ! I_UnitStatus a1u6 missiles_reloading
			inc_counter player_units_closing 1
		end_if

		if I_CompareCounter player_unit_count > 6
			and I_UnitDistanceFromUnit a1u7 a2u1 < 180
			and ! I_UnitStatus a1u7 missiles_firing
			and ! I_UnitStatus a1u7 missiles_reloading
			inc_counter player_units_closing 1
		end_if

		if I_CompareCounter player_unit_count > 7
			and I_UnitDistanceFromUnit a1u8 a2u1 < 180
			and ! I_UnitStatus a1u8 missiles_firing
			and ! I_UnitStatus a1u8 missiles_reloading
			inc_counter player_units_closing 1
		end_if

		if I_CompareCounter player_unit_count > 8
			and I_UnitDistanceFromUnit a1u9 a2u1 < 180
			and ! I_UnitStatus a1u9 missiles_firing
			and ! I_UnitStatus a1u9 missiles_reloading
			inc_counter player_units_closing 1
		end_if

		if I_CompareCounter player_unit_count > 9
			and I_UnitDistanceFromUnit a1u10 a2u1 < 180
			and ! I_UnitStatus a1u10 missiles_firing
			and ! I_UnitStatus a1u10 missiles_reloading
			inc_counter player_units_closing 1
		end_if

		if I_CompareCounter player_unit_count > 10
			and I_UnitDistanceFromUnit a1u11 a2u1 < 180
			and ! I_UnitStatus a1u11 missiles_firing
			and ! I_UnitStatus a1u11 missiles_reloading
			inc_counter player_units_closing 1
		end_if

		if I_CompareCounter player_unit_count > 11
			and I_UnitDistanceFromUnit a1u12 a2u1 < 180
			and ! I_UnitStatus a1u12 missiles_firing
			and ! I_UnitStatus a1u12 missiles_reloading
			inc_counter player_units_closing 1
		end_if

		if I_CompareCounter player_unit_count > 12
			and I_UnitDistanceFromUnit a1u13 a2u1 < 180
			and ! I_UnitStatus a1u13 missiles_firing
			and ! I_UnitStatus a1u13 missiles_reloading
			inc_counter player_units_closing 1
		end_if

		if I_CompareCounter player_unit_count > 13
			and I_UnitDistanceFromUnit a1u14 a2u1 < 180
			and ! I_UnitStatus a1u14 missiles_firing
			and ! I_UnitStatus a1u14 missiles_reloading
			inc_counter player_units_closing 1
		end_if

		if I_CompareCounter player_unit_count > 14
			and I_UnitDistanceFromUnit a1u15 a2u1 < 180
			and ! I_UnitStatus a1u15 missiles_firing
			and ! I_UnitStatus a1u15 missiles_reloading
			inc_counter player_units_closing 1
		end_if

		if I_CompareCounter player_unit_count > 15
			and I_UnitDistanceFromUnit a1u16 a2u1 < 180
			and ! I_UnitStatus a1u16 missiles_firing
			and ! I_UnitStatus a1u16 missiles_reloading
			inc_counter player_units_closing 1
		end_if

		if I_CompareCounter player_unit_count > 16
			and I_UnitDistanceFromUnit a1u17 a2u1 < 180
			and ! I_UnitStatus a1u17 missiles_firing
			and ! I_UnitStatus a1u17 missiles_reloading
			inc_counter player_units_closing 1
		end_if

		if I_CompareCounter player_unit_count > 17
			and I_UnitDistanceFromUnit a1u18 a2u1 < 180
			and ! I_UnitStatus a1u18 missiles_firing
			and ! I_UnitStatus a1u18 missiles_reloading
			inc_counter player_units_closing 1
		end_if

		if I_CompareCounter player_unit_count > 18
			and I_UnitDistanceFromUnit a1u19 a2u1 < 180
			and ! I_UnitStatus a1u19 missiles_firing
			and ! I_UnitStatus a1u19 missiles_reloading
			inc_counter player_units_closing 1
		end_if

		if I_CompareCounter player_unit_count = 20
			and I_UnitDistanceFromUnit a1u20 a2u1 < 180
			and ! I_UnitStatus a1u20 missiles_firing
			and ! I_UnitStatus a1u20 missiles_reloading
			inc_counter player_units_closing 1
		end_if

		if I_CompareCounter player_units_closing > 1
			inc_counter player_enveloping 1
		end_if
		if I_CompareCounter player_units_closing < 1
			set_counter player_enveloping 0
		end_if
		if I_CompareCounter player_enveloping > 5
			ai_gta_plan_set 1 ATTACK_ALL
			set_counter apply_strategy 1
			set_counter ob_defend 4
			set_counter ob_defense_launch 0
		end_if

		battle_wait 10
	end_monitor

	monitor_event BattleEnemyUnitAttacksPlayerUnit TrueCondition
		and I_CompareCounter panel_check = 1
		and I_CompareCounter ob_defend > 1
		and I_CompareCounter ob_defend != 4
		and BattleIsMeleeAttack
		and BattleEnemyUnitClass = heavy
		and BattleEnemyUnitCategory = cavalry
		and ! BattlePlayerUnitClass = heavy
		and ! BattlePlayerUnitClass = heavy
		and I_CompareCounter open_battle = 1
		and I_BattlePlayerArmyIsAttacker

		inc_counter ob_engaged -1
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter ob_defend > 1
		and I_CompareCounter ob_defend != 4
		and I_CompareCounter open_battle = 1
		and I_BattlePlayerArmyIsAttacker

		if I_PercentageOfArmyKilled 0 0 < 5
			and I_PercentageOfArmyKilled 1 0 > 10
			set_counter ob_repeat_test 4
		end_if

		if I_PercentageOfArmyKilled 0 0 < 10
			and I_PercentageOfArmyKilled 1 0 > 20
			set_counter ob_repeat_test 4
		end_if

		if I_PercentageOfArmyKilled 0 0 < 15
			and I_PercentageOfArmyKilled 1 0 > 25
			set_counter ob_repeat_test 4
		end_if
		battle_wait 30
	end_monitor

	;monitor_event BattlePlayerUnitAttacksEnemyUnit TrueCondition
	;    and I_CompareCounter panel_check = 1
	;    and I_CompareCounter ob_defense_launch = 1
	;    and ! I_CompareCounter ob_defend > 1
	;    and BattlePlayerUnitCategory siege
	;    and BattlePlayerUnitClass missile
	;    and BattleRangeOfAttack < 400
	;    and I_CompareCounter open_battle = 1
	;    and I_BattlePlayerArmyIsAttacker
	;    set_counter ob_siege_attack 1
	;end_monitor

	;monitor_conditions I_BattleStarted
	;    and I_CompareCounter ob_defense_launch = 1
	;    and I_CompareCounter ob_siege_attack = 1
	;    and I_CompareCounter open_battle = 1
	;    and I_BattlePlayerArmyIsAttacker
	;    if I_PercentageOfArmyKilled 0 0 < 3
	;    and I_PercentageOfArmyKilled 1 0 > 5
	;    set_counter ob_defend 2
	;    set_counter ob_siege_attack 0
	;    end_if
	;    if I_PercentageOfArmyKilled 0 0 < 5
	;    and I_PercentageOfArmyKilled 1 0 > 10
	;    if I_CompareCounter ob_repeat_test < 2
	;    set_counter ob_repeat_test 2
	;    end_if
	;    set_counter ob_defend 2
	;    set_counter ob_siege_attack 0
	;    end_if
	;    battle_wait 30
	;end_monitor

	;;;;;; Reinf triggers

	monitor_conditions I_BattleStarted
		and I_CompareCounter def_alliance_ready = 1
		and I_CompareCounter ob_defense_launch = 1
		and I_CompareCounter open_battle = 1
		and I_CompareCounter ob_defend != 4
		and I_BattlePlayerArmyIsAttacker

		if I_CompareCounter player_engaged_reinf = 4
			ai_gta_plan_set 1 ATTACK_ALL
			set_counter apply_strategy 1
			set_counter ob_defend 4
			set_counter ob_defense_launch 0
			set_counter def_alliance_ready 0
		end_if

		if I_IsUnitGroupEngaged army1
			inc_counter player_engaged_reinf 1
		end_if

		if I_CompareCounter player_engaged_reinf > 0
			and ! I_IsUnitGroupEngaged army1
			set_counter player_engaged_reinf 0
		end_if

		battle_wait 10
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter def_alliance_ready = 1
		and I_CompareCounter ob_defense_launch = 1
		and I_CompareCounter open_battle = 1
		and I_CompareCounter ob_defend != 4
		and I_PercentageUnitGroupKilled army4 > 10
		and I_BattlePlayerArmyIsAttacker

		ai_gta_plan_set 1 ATTACK_ALL
		set_counter apply_strategy 1
		set_counter ob_defend 4
		set_counter ob_defense_launch 0
		set_counter def_alliance_ready 0
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter def_alliance_ready = 1
		and I_CompareCounter ob_defense_launch = 1
		and I_CompareCounter open_battle = 1
		and I_CompareCounter ob_defend != 4
		and I_UnitEnemyUnitInRadius a4u1 100
		and I_BattlePlayerArmyIsAttacker

		ai_gta_plan_set 1 ATTACK_ALL
		set_counter apply_strategy 1
		set_counter ob_defend 4
		set_counter ob_defense_launch 0
		set_counter def_alliance_ready 0
	end_monitor

	;;;;;; Main monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter ob_defense_launch = 1
		and I_CompareCounter ob_defend = 2
		and I_CompareCounter open_battle = 1
		and I_BattlePlayerArmyIsAttacker

		set_counter ob_defend 3

		if I_CompareCounter enemy_unit_count > 0
			if I_IsUnitUnderFire a2u1
				inc_counter ob_under_fire 2
			end_if
			if I_UnitStatus a2u1 fighting
				inc_counter ob_engaged 1
			end_if
			if I_UnitStatus a2u1 pursuing
				inc_counter ob_engaged 1
			end_if
			if I_UnitStatus a2u1 charging
				inc_counter ob_engaged 1
			end_if
			if I_UnitStatus a2u1 missiles_firing
				inc_counter ob_under_fire -1
			end_if
			if I_UnitStatus a2u1 missiles_reloading
				inc_counter ob_under_fire -1
			end_if

			if I_CompareCounter enemy_unit_count > 1
				if I_IsUnitUnderFire a2u2
					inc_counter ob_under_fire 1
				end_if
				if I_UnitStatus a2u2 fighting
					inc_counter ob_engaged 1
				end_if
				if I_UnitStatus a2u2 pursuing
					inc_counter ob_engaged 1
				end_if
				if I_UnitStatus a2u2 charging
					inc_counter ob_engaged 1
				end_if
				if I_UnitStatus a2u2 missiles_firing
					inc_counter ob_under_fire -1
				end_if
				if I_UnitStatus a2u2 missiles_reloading
					inc_counter ob_under_fire -1
				end_if

				if I_CompareCounter enemy_unit_count > 2
					if I_IsUnitUnderFire a2u3
						inc_counter ob_under_fire 1
					end_if
					if I_UnitStatus a2u3 fighting
						inc_counter ob_engaged 1
					end_if
					if I_UnitStatus a2u3 pursuing
						inc_counter ob_engaged 1
					end_if
					if I_UnitStatus a2u3 charging
						inc_counter ob_engaged 1
					end_if
					if I_UnitStatus a2u3 missiles_firing
						inc_counter ob_under_fire -1
					end_if
					if I_UnitStatus a2u3 missiles_reloading
						inc_counter ob_under_fire -1
					end_if

					if I_CompareCounter enemy_unit_count > 3
						if I_IsUnitUnderFire a2u4
							inc_counter ob_under_fire 1
						end_if
						if I_UnitStatus a2u4 fighting
							inc_counter ob_engaged 1
						end_if
						if I_UnitStatus a2u4 pursuing
							inc_counter ob_engaged 1
						end_if
						if I_UnitStatus a2u4 charging
							inc_counter ob_engaged 1
						end_if
						if I_UnitStatus a2u4 missiles_firing
							inc_counter ob_under_fire -1
						end_if
						if I_UnitStatus a2u4 missiles_reloading
							inc_counter ob_under_fire -1
						end_if

						if I_CompareCounter enemy_unit_count > 4
							if I_IsUnitUnderFire a2u5
								inc_counter ob_under_fire 1
							end_if
							if I_UnitStatus a2u5 fighting
								inc_counter ob_engaged 1
							end_if
							if I_UnitStatus a2u5 pursuing
								inc_counter ob_engaged 1
							end_if
							if I_UnitStatus a2u5 charging
								inc_counter ob_engaged 1
							end_if
							if I_UnitStatus a2u5 missiles_firing
								inc_counter ob_under_fire -1
							end_if
							if I_UnitStatus a2u5 missiles_reloading
								inc_counter ob_under_fire -1
							end_if

							if I_CompareCounter enemy_unit_count > 5
								if I_IsUnitUnderFire a2u6
									inc_counter ob_under_fire 1
								end_if
								if I_UnitStatus a2u6 fighting
									inc_counter ob_engaged 1
								end_if
								if I_UnitStatus a2u6 pursuing
									inc_counter ob_engaged 1
								end_if
								if I_UnitStatus a2u6 charging
									inc_counter ob_engaged 1
								end_if
								if I_UnitStatus a2u6 missiles_firing
									inc_counter ob_under_fire -1
								end_if
								if I_UnitStatus a2u6 missiles_reloading
									inc_counter ob_under_fire -1
								end_if

								if I_CompareCounter enemy_unit_count > 6
									if I_IsUnitUnderFire a2u7
										inc_counter ob_under_fire 1
									end_if
									if I_UnitStatus a2u7 fighting
										inc_counter ob_engaged 1
									end_if
									if I_UnitStatus a2u7 pursuing
										inc_counter ob_engaged 1
									end_if
									if I_UnitStatus a2u7 charging
										inc_counter ob_engaged 1
									end_if
									if I_UnitStatus a2u7 missiles_firing
										inc_counter ob_under_fire -1
									end_if
									if I_UnitStatus a2u7 missiles_reloading
										inc_counter ob_under_fire -1
									end_if

									if I_CompareCounter enemy_unit_count > 7
										if I_IsUnitUnderFire a2u8
											inc_counter ob_under_fire 1
										end_if
										if I_UnitStatus a2u8 fighting
											inc_counter ob_engaged 1
										end_if
										if I_UnitStatus a2u8 pursuing
											inc_counter ob_engaged 1
										end_if
										if I_UnitStatus a2u8 charging
											inc_counter ob_engaged 1
										end_if
										if I_UnitStatus a2u8 missiles_firing
											inc_counter ob_under_fire -1
										end_if
										if I_UnitStatus a2u8 missiles_reloading
											inc_counter ob_under_fire -1
										end_if

										if I_CompareCounter enemy_unit_count > 8
											if I_IsUnitUnderFire a2u9
												inc_counter ob_under_fire 1
											end_if
											if I_UnitStatus a2u9 fighting
												inc_counter ob_engaged 1
											end_if
											if I_UnitStatus a2u9 pursuing
												inc_counter ob_engaged 1
											end_if
											if I_UnitStatus a2u9 charging
												inc_counter ob_engaged 1
											end_if
											if I_UnitStatus a2u9 missiles_firing
												inc_counter ob_under_fire -1
											end_if
											if I_UnitStatus a2u9 missiles_reloading
												inc_counter ob_under_fire -1
											end_if

											if I_CompareCounter enemy_unit_count > 9
												if I_IsUnitUnderFire a2u10
													inc_counter ob_under_fire 1
												end_if
												if I_UnitStatus a2u10 fighting
													inc_counter ob_engaged 1
												end_if
												if I_UnitStatus a2u10 pursuing
													inc_counter ob_engaged 1
												end_if
												if I_UnitStatus a2u10 charging
													inc_counter ob_engaged 1
												end_if
												if I_UnitStatus a2u10 missiles_firing
													inc_counter ob_under_fire -1
												end_if
												if I_UnitStatus a2u10 missiles_reloading
													inc_counter ob_under_fire -1
												end_if

												if I_CompareCounter enemy_unit_count > 10
													if I_IsUnitUnderFire a2u11
														inc_counter ob_under_fire 1
													end_if
													if I_UnitStatus a2u11 fighting
														inc_counter ob_engaged 1
													end_if
													if I_UnitStatus a2u11 pursuing
														inc_counter ob_engaged 1
													end_if
													if I_UnitStatus a2u11 charging
														inc_counter ob_engaged 1
													end_if
													if I_UnitStatus a2u11 missiles_firing
														inc_counter ob_under_fire -1
													end_if
													if I_UnitStatus a2u11 missiles_reloading
														inc_counter ob_under_fire -1
													end_if

													if I_CompareCounter enemy_unit_count > 11
														if I_IsUnitUnderFire a2u12
															inc_counter ob_under_fire 1
														end_if
														if I_UnitStatus a2u12 fighting
															inc_counter ob_engaged 1
														end_if
														if I_UnitStatus a2u12 pursuing
															inc_counter ob_engaged 1
														end_if
														if I_UnitStatus a2u12 charging
															inc_counter ob_engaged 1
														end_if
														if I_UnitStatus a2u12 missiles_firing
															inc_counter ob_under_fire -1
														end_if
														if I_UnitStatus a2u12 missiles_reloading
															inc_counter ob_under_fire -1
														end_if

														if I_CompareCounter enemy_unit_count > 12
															if I_IsUnitUnderFire a2u13
																inc_counter ob_under_fire 1
															end_if
															if I_UnitStatus a2u13 fighting
																inc_counter ob_engaged 1
															end_if
															if I_UnitStatus a2u13 pursuing
																inc_counter ob_engaged 1
															end_if
															if I_UnitStatus a2u13 charging
																inc_counter ob_engaged 1
															end_if
															if I_UnitStatus a2u13 missiles_firing
																inc_counter ob_under_fire -1
															end_if
															if I_UnitStatus a2u13 missiles_reloading
																inc_counter ob_under_fire -1
															end_if

															if I_CompareCounter enemy_unit_count > 13
																if I_IsUnitUnderFire a2u14
																	inc_counter ob_under_fire 1
																end_if
																if I_UnitStatus a2u14 fighting
																	inc_counter ob_engaged 1
																end_if
																if I_UnitStatus a2u14 pursuing
																	inc_counter ob_engaged 1
																end_if
																if I_UnitStatus a2u14 charging
																	inc_counter ob_engaged 1
																end_if
																if I_UnitStatus a2u14 missiles_firing
																	inc_counter ob_under_fire -1
																end_if
																if I_UnitStatus a2u14 missiles_reloading
																	inc_counter ob_under_fire -1
																end_if

																if I_CompareCounter enemy_unit_count > 14
																	if I_IsUnitUnderFire a2u15
																		inc_counter ob_under_fire 1
																	end_if
																	if I_UnitStatus a2u15 fighting
																		inc_counter ob_engaged 1
																	end_if
																	if I_UnitStatus a2u15 pursuing
																		inc_counter ob_engaged 1
																	end_if
																	if I_UnitStatus a2u15 charging
																		inc_counter ob_engaged 1
																	end_if
																	if I_UnitStatus a2u15 missiles_firing
																		inc_counter ob_under_fire -1
																	end_if
																	if I_UnitStatus a2u15 missiles_reloading
																		inc_counter ob_under_fire -1
																	end_if

																	if I_CompareCounter enemy_unit_count > 15
																		if I_IsUnitUnderFire a2u16
																			inc_counter ob_under_fire 1
																		end_if
																		if I_UnitStatus a2u16 fighting
																			inc_counter ob_engaged 1
																		end_if
																		if I_UnitStatus a2u16 pursuing
																			inc_counter ob_engaged 1
																		end_if
																		if I_UnitStatus a2u16 charging
																			inc_counter ob_engaged 1
																		end_if
																		if I_UnitStatus a2u16 missiles_firing
																			inc_counter ob_under_fire -1
																		end_if
																		if I_UnitStatus a2u16 missiles_reloading
																			inc_counter ob_under_fire -1
																		end_if

																		if I_CompareCounter enemy_unit_count > 16
																			if I_IsUnitUnderFire a2u17
																				inc_counter ob_under_fire 1
																			end_if
																			if I_UnitStatus a2u17 fighting
																				inc_counter ob_engaged 1
																			end_if
																			if I_UnitStatus a2u17 pursuing
																				inc_counter ob_engaged 1
																			end_if
																			if I_UnitStatus a2u17 charging
																				inc_counter ob_engaged 1
																			end_if
																			if I_UnitStatus a2u17 missiles_firing
																				inc_counter ob_under_fire -1
																			end_if
																			if I_UnitStatus a2u17 missiles_reloading
																				inc_counter ob_under_fire -1
																			end_if

																			if I_CompareCounter enemy_unit_count > 17
																				if I_IsUnitUnderFire a2u18
																					inc_counter ob_under_fire 1
																				end_if
																				if I_UnitStatus a2u18 fighting
																					inc_counter ob_engaged 1
																				end_if
																				if I_UnitStatus a2u18 pursuing
																					inc_counter ob_engaged 1
																				end_if
																				if I_UnitStatus a2u18 charging
																					inc_counter ob_engaged 1
																				end_if
																				if I_UnitStatus a2u18 missiles_firing
																					inc_counter ob_under_fire -1
																				end_if
																				if I_UnitStatus a2u18 missiles_reloading
																					inc_counter ob_under_fire -1
																				end_if

																				if I_CompareCounter enemy_unit_count > 18
																					if I_IsUnitUnderFire a2u19
																						inc_counter ob_under_fire 1
																					end_if
																					if I_UnitStatus a2u19 fighting
																						inc_counter ob_engaged 1
																					end_if
																					if I_UnitStatus a2u19 pursuing
																						inc_counter ob_engaged 1
																					end_if
																					if I_UnitStatus a2u19 charging
																						inc_counter ob_engaged 1
																					end_if
																					if I_UnitStatus a2u19 missiles_firing
																						inc_counter ob_under_fire -1
																					end_if
																					if I_UnitStatus a2u19 missiles_reloading
																						inc_counter ob_under_fire -1
																					end_if

																					if I_CompareCounter enemy_unit_count = 20
																						if I_IsUnitUnderFire a2u20
																							inc_counter ob_under_fire 1
																						end_if
																						if I_UnitStatus a2u20 fighting
																							inc_counter ob_engaged 1
																						end_if
																						if I_UnitStatus a2u20 pursuing
																							inc_counter ob_engaged 1
																						end_if
																						if I_UnitStatus a2u20 charging
																							inc_counter ob_engaged 1
																						end_if
																						if I_UnitStatus a2u20 missiles_firing
																							inc_counter ob_under_fire -1
																						end_if
																						if I_UnitStatus a2u20 missiles_reloading
																							inc_counter ob_under_fire -1
																						end_if

																					end_if
																				end_if
																			end_if
																		end_if
																	end_if
																end_if
															end_if
														end_if
													end_if
												end_if
											end_if
										end_if
									end_if
								end_if
							end_if
						end_if
					end_if
				end_if
			end_if
		end_if

		if I_CompareCounter ob_under_fire < 1
			if I_CompareCounter ob_engaged > 0

				if I_CompareCounter ob_repeat_test = 3
					set_counter ob_repeat_test 4
				end_if

				if I_CompareCounter ob_repeat_test = 2
					set_counter ob_engaged 0
					set_counter ob_repeat_test 3
				end_if

				if I_CompareCounter ob_repeat_test = 1
					set_counter ob_engaged 0
					set_counter ob_under_fire 0
					set_counter ob_repeat_test 2
				end_if

				if I_CompareCounter ob_repeat_test = 0
					set_counter ob_engaged 0
					set_counter ob_under_fire 0
					set_counter ob_repeat_test 1
				end_if
			end_if

			if I_CompareCounter ob_engaged < 1

				if I_CompareCounter ob_repeat_test = 3
					set_counter ob_repeat_test 2
					set_counter ob_under_fire 0
					set_counter ob_engaged 0
				end_if

				if I_CompareCounter ob_repeat_test < 3
					set_counter ob_repeat_test 1
					set_counter ob_under_fire 0
					set_counter ob_engaged 0
				end_if
			end_if

		end_if

		if I_CompareCounter ob_under_fire > 0
			if I_CompareCounter ob_engaged > 0

				if I_CompareCounter ob_repeat_test = 3
					set_counter ob_repeat_test 4
				end_if
				if I_CompareCounter ob_repeat_test = 2
					set_counter ob_engaged 0
					set_counter ob_repeat_test 3
				end_if
				if I_CompareCounter ob_repeat_test < 2
					set_counter ob_under_fire 0
					set_counter ob_engaged 0
					set_counter ob_repeat_test 2
				end_if
			end_if

			if I_CompareCounter ob_engaged < 1

				if I_CompareCounter ob_repeat_test = 3
					set_counter ob_repeat_test 4
				end_if

				if I_CompareCounter ob_repeat_test = 2
					set_counter ob_repeat_test 3
				end_if
				if I_CompareCounter ob_repeat_test = 1
					set_counter ob_under_fire 0
					set_counter ob_repeat_test 2
				end_if

				if I_CompareCounter ob_repeat_test = 0
					set_counter ob_under_fire 0
					set_counter ob_repeat_test 1
				end_if
			end_if

		end_if
		if I_CompareCounter ob_repeat_test = 4
			if I_CompareCounter ob_under_fire < 1
				and I_CompareCounter ob_engaged < 1
				set_counter ob_under_fire 0
				set_counter ob_engaged 0
				set_counter ob_defend 3
				set_counter ob_repeat_test 2
			end_if
			if I_CompareCounter ob_under_fire > 0

				ai_gta_plan_set 1 ATTACK_ALL
				set_counter apply_strategy 1
				set_counter ob_under_fire 0
				set_counter ob_engaged 0
				set_counter ob_defend 4
				set_counter ob_repeat_test 0
				set_counter ob_defense_launch 0
			end_if
			if I_CompareCounter ob_engaged > 0

				ai_gta_plan_set 1 ATTACK_ALL
				set_counter apply_strategy 1
				set_counter ob_under_fire 0
				set_counter ob_engaged 0
				set_counter ob_defend 4
				set_counter ob_repeat_test 0
				set_counter ob_defense_launch 0
			end_if

		end_if

		if I_CompareCounter ob_defend = 3
			set_counter ob_defend 2
		end_if
		battle_wait 15
	end_monitor

	;;;;;;;General Stop

	monitor_conditions I_BattleStarted
		and I_CompareCounter g_stop = 1
		and I_CompareCounter open_battle = 1
		and I_BattleEnemyArmyNumberOfUnits > 2
		and I_BattlePlayerArmyIsAttacker
		and I_BattleAiAttacking
		and I_UnitEnemyUnitInRadius a2u1 120

		set_counter g_stop 2
		label_unit 1 0 0 a2u1
		battle_wait 0.1
		unit_order_halt a2u1
		if I_BattleEnemyArmyNumberOfUnits > 5
			battle_wait 30
		end_if
		if I_BattleEnemyArmyNumberOfUnits < 6
			battle_wait 15
		end_if
		if I_BattlePlayerArmyIsAttacker
			and I_CompareCounter g_stop = 2
			and I_BattleAiAttacking
			release_unit a2u1
			set_counter g_stop 0
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter g_stop = 1
		and I_CompareCounter open_battle = 1
		and ! I_BattlePlayerArmyIsAttacker
		and I_BattleAiAttacking
		and I_UnitEnemyUnitInRadius a1u1 120

		set_counter g_stop 3
		label_unit 0 0 0 a1u1
		battle_wait 0.1
		unit_order_halt a1u1
		battle_wait 30
		if ! I_BattlePlayerArmyIsAttacker
			and I_CompareCounter g_stop = 3
			and I_BattleAiAttacking
			release_unit a1u1
			set_counter g_stop 0
		end_if
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter g_stop = 2
		and I_CompareCounter open_battle = 1
		and I_BattlePlayerArmyIsAttacker
		and I_UnitEnemyUnitInRadius a2u1 60

		release_unit a2u1
		set_counter g_stop 0
	end_monitor

	monitor_conditions I_BattleStarted
		and I_CompareCounter g_stop = 3
		and I_CompareCounter open_battle = 1
		and I_BattlePlayerArmyIsAttacker
		and I_UnitEnemyUnitInRadius a1u1 60

		release_unit a1u1
		set_counter g_stop 0
	end_monitor

	;;;;;;;AI Stuck Fix

	monitor_event BattleEnemyUnitAttacksPlayerUnit TrueCondition
		and I_CompareCounter ai_stuck_launch = 1
		and BattleIsMeleeAttack
		and I_BattleIsSiegeBattle
		set_counter ai_stuck_launch 2
	end_monitor

	monitor_conditions I_CompareCounter ai_stuck_launch = 2
		and I_BattleIsSiegeBattle

		if I_CompareCounter enemy_unit_count > 0
			and ! I_UnitDestroyed a2u1

			if I_UnitStatus a2u1 moving
				if I_CompareCounter a2u1_status = 0
					set_counter a2u1_status 1
				end_if
				if I_CompareCounter a2u1_status != 1
					set_counter a2u1_status 0
				end_if
			end_if

			if I_UnitStatus a2u1 routing
				if I_CompareCounter a2u1_status = 0
					set_counter a2u1_status 2
				end_if
				if I_CompareCounter a2u1_status != 2
					set_counter a2u1_status 0
				end_if
			end_if

			if ! I_UnitStatus a2u1 moving
				and ! I_UnitStatus a2u1 routing
				set_counter a2u1_status 0
			end_if

			if I_CompareCounter a2u1_status > 0

				if I_UnitDistanceFromPosition a2u1 0,0 >= 150
					and I_UnitDistanceFromPosition a2u1 0,0 < 175
					if I_CompareCounter a2u1_distance != 1
						set_counter a2u1_stuck 0
					end_if
					set_counter a2u1_distance 1
					inc_counter a2u1_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u1 0,0 >= 175
					and I_UnitDistanceFromPosition a2u1 0,0 < 200
					if I_CompareCounter a2u1_distance != 2
						set_counter a2u1_stuck 0
					end_if
					set_counter a2u1_distance 2
					inc_counter a2u1_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u1 0,0 >= 200
					and I_UnitDistanceFromPosition a2u1 0,0 < 225
					if I_CompareCounter a2u1_distance != 3
						set_counter a2u1_stuck 0
					end_if
					set_counter a2u1_distance 3
					inc_counter a2u1_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u1 0,0 >= 225
					and I_UnitDistanceFromPosition a2u1 0,0 < 250
					if I_CompareCounter a2u1_distance != 4
						set_counter a2u1_stuck 0
					end_if
					set_counter a2u1_distance 4
					inc_counter a2u1_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u1 0,0 >= 250
					and I_UnitDistanceFromPosition a2u1 0,0 < 275
					if I_CompareCounter a2u1_distance != 5
						set_counter a2u1_stuck 0
					end_if
					set_counter a2u1_distance 5
					inc_counter a2u1_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u1 0,0 >= 275
					and I_UnitDistanceFromPosition a2u1 0,0 < 300
					if I_CompareCounter a2u1_distance != 6
						set_counter a2u1_stuck 0
					end_if
					set_counter a2u1_distance 6
					inc_counter a2u1_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u1 0,0 >= 300
					and I_UnitDistanceFromPosition a2u1 0,0 < 325
					if I_CompareCounter a2u1_distance != 7
						set_counter a2u1_stuck 0
					end_if
					set_counter a2u1_distance 7
					inc_counter a2u1_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u1 0,0 >= 325
					and I_UnitDistanceFromPosition a2u1 0,0 < 350
					if I_CompareCounter a2u1_distance != 8
						set_counter a2u1_stuck 0
					end_if
					set_counter a2u1_distance 8
					inc_counter a2u1_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u1 0,0 >= 350
					and I_UnitDistanceFromPosition a2u1 0,0 < 375
					if I_CompareCounter a2u1_distance != 9
						set_counter a2u1_stuck 0
					end_if
					set_counter a2u1_distance 9
					inc_counter a2u1_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u1 0,0 >= 375
					and I_UnitDistanceFromPosition a2u1 0,0 < 400
					if I_CompareCounter a2u1_distance != 10
						set_counter a2u1_stuck 0
					end_if
					set_counter a2u1_distance 10
					inc_counter a2u1_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u1 0,0 >= 400
					and I_UnitDistanceFromPosition a2u1 0,0 < 425
					if I_CompareCounter a2u1_distance != 11
						set_counter a2u1_stuck 0
					end_if
					set_counter a2u1_distance 11
					inc_counter a2u1_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u1 0,0 >= 425
					and I_UnitDistanceFromPosition a2u1 0,0 < 450
					if I_CompareCounter a2u1_distance != 12
						set_counter a2u1_stuck 0
					end_if
					set_counter a2u1_distance 12
					inc_counter a2u1_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u1 0,0 >= 450
					and I_UnitDistanceFromPosition a2u1 0,0 < 500
					if I_CompareCounter a2u1_distance != 13
						set_counter a2u1_stuck 0
					end_if
					set_counter a2u1_distance 13
					inc_counter a2u1_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u1 0,0 >= 500
					and I_UnitDistanceFromPosition a2u1 0,0 < 550
					if I_CompareCounter a2u1_distance != 14
						set_counter a2u1_stuck 0
					end_if
					set_counter a2u1_distance 14
					inc_counter a2u1_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u1 0,0 >= 550
					and I_UnitDistanceFromPosition a2u1 0,0 < 600
					if I_CompareCounter a2u1_distance != 15
						set_counter a2u1_stuck 0
					end_if
					set_counter a2u1_distance 15
					inc_counter a2u1_stuck 1
				end_if

				if I_CompareCounter a2u1_stuck = 4
					unit_order_halt a2u1
					unit_set_morale a2u1 wavering
					battle_wait 0.1
					unit_unset_morale a2u1
					release_unit a2u1
					set_counter a2u1_stuck 0
				end_if

			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 1
			and ! I_UnitDestroyed a2u2

			if I_UnitStatus a2u2 moving
				if I_CompareCounter a2u2_status = 0
					set_counter a2u2_status 1
				end_if
				if I_CompareCounter a2u2_status != 1
					set_counter a2u2_status 0
				end_if
			end_if

			if I_UnitStatus a2u2 routing
				if I_CompareCounter a2u2_status = 0
					set_counter a2u2_status 2
				end_if
				if I_CompareCounter a2u2_status != 2
					set_counter a2u2_status 0
				end_if
			end_if

			if ! I_UnitStatus a2u2 moving
				and ! I_UnitStatus a2u2 routing
				set_counter a2u2_status 0
			end_if

			if I_CompareCounter a2u2_status > 0

				if I_UnitDistanceFromPosition a2u2 0,0 >= 150
					and I_UnitDistanceFromPosition a2u2 0,0 < 175
					if I_CompareCounter a2u2_distance != 1
						set_counter a2u2_stuck 0
					end_if
					set_counter a2u2_distance 1
					inc_counter a2u2_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u2 0,0 >= 175
					and I_UnitDistanceFromPosition a2u2 0,0 < 200
					if I_CompareCounter a2u2_distance != 2
						set_counter a2u2_stuck 0
					end_if
					set_counter a2u2_distance 2
					inc_counter a2u2_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u2 0,0 >= 200
					and I_UnitDistanceFromPosition a2u2 0,0 < 225
					if I_CompareCounter a2u2_distance != 3
						set_counter a2u2_stuck 0
					end_if
					set_counter a2u2_distance 3
					inc_counter a2u2_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u2 0,0 >= 225
					and I_UnitDistanceFromPosition a2u2 0,0 < 250
					if I_CompareCounter a2u2_distance != 4
						set_counter a2u2_stuck 0
					end_if
					set_counter a2u2_distance 4
					inc_counter a2u2_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u2 0,0 >= 250
					and I_UnitDistanceFromPosition a2u2 0,0 < 275
					if I_CompareCounter a2u2_distance != 5
						set_counter a2u2_stuck 0
					end_if
					set_counter a2u2_distance 5
					inc_counter a2u2_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u2 0,0 >= 275
					and I_UnitDistanceFromPosition a2u2 0,0 < 300
					if I_CompareCounter a2u2_distance != 6
						set_counter a2u2_stuck 0
					end_if
					set_counter a2u2_distance 6
					inc_counter a2u2_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u2 0,0 >= 300
					and I_UnitDistanceFromPosition a2u2 0,0 < 325
					if I_CompareCounter a2u2_distance != 7
						set_counter a2u2_stuck 0
					end_if
					set_counter a2u2_distance 7
					inc_counter a2u2_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u2 0,0 >= 325
					and I_UnitDistanceFromPosition a2u2 0,0 < 350
					if I_CompareCounter a2u2_distance != 8
						set_counter a2u2_stuck 0
					end_if
					set_counter a2u2_distance 8
					inc_counter a2u2_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u2 0,0 >= 350
					and I_UnitDistanceFromPosition a2u2 0,0 < 375
					if I_CompareCounter a2u2_distance != 9
						set_counter a2u2_stuck 0
					end_if
					set_counter a2u2_distance 9
					inc_counter a2u2_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u2 0,0 >= 375
					and I_UnitDistanceFromPosition a2u2 0,0 < 400
					if I_CompareCounter a2u2_distance != 10
						set_counter a2u2_stuck 0
					end_if
					set_counter a2u2_distance 10
					inc_counter a2u2_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u2 0,0 >= 400
					and I_UnitDistanceFromPosition a2u2 0,0 < 425
					if I_CompareCounter a2u2_distance != 11
						set_counter a2u2_stuck 0
					end_if
					set_counter a2u2_distance 11
					inc_counter a2u2_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u2 0,0 >= 425
					and I_UnitDistanceFromPosition a2u2 0,0 < 450
					if I_CompareCounter a2u2_distance != 12
						set_counter a2u2_stuck 0
					end_if
					set_counter a2u2_distance 12
					inc_counter a2u2_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u2 0,0 >= 450
					and I_UnitDistanceFromPosition a2u2 0,0 < 500
					if I_CompareCounter a2u2_distance != 13
						set_counter a2u2_stuck 0
					end_if
					set_counter a2u2_distance 13
					inc_counter a2u2_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u2 0,0 >= 500
					and I_UnitDistanceFromPosition a2u2 0,0 < 550
					if I_CompareCounter a2u2_distance != 14
						set_counter a2u2_stuck 0
					end_if
					set_counter a2u2_distance 14
					inc_counter a2u2_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u2 0,0 >= 550
					and I_UnitDistanceFromPosition a2u2 0,0 < 600
					if I_CompareCounter a2u2_distance != 15
						set_counter a2u2_stuck 0
					end_if
					set_counter a2u2_distance 15
					inc_counter a2u2_stuck 1
				end_if

				if I_CompareCounter a2u2_stuck = 4
					unit_order_halt a2u2
					unit_set_morale a2u2 wavering
					battle_wait 0.1
					unit_unset_morale a2u2
					release_unit a2u2
					set_counter a2u2_stuck 0
				end_if

			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 2
			and ! I_UnitDestroyed a2u3

			if I_UnitStatus a2u3 moving
				if I_CompareCounter a2u3_status = 0
					set_counter a2u3_status 1
				end_if
				if I_CompareCounter a2u3_status != 1
					set_counter a2u3_status 0
				end_if
			end_if

			if I_UnitStatus a2u3 routing
				if I_CompareCounter a2u3_status = 0
					set_counter a2u3_status 2
				end_if
				if I_CompareCounter a2u3_status != 2
					set_counter a2u3_status 0
				end_if
			end_if

			if ! I_UnitStatus a2u3 moving
				and ! I_UnitStatus a2u3 routing
				set_counter a2u3_status 0
			end_if

			if I_CompareCounter a2u3_status > 0

				if I_UnitDistanceFromPosition a2u3 0,0 >= 150
					and I_UnitDistanceFromPosition a2u3 0,0 < 175
					if I_CompareCounter a2u3_distance != 1
						set_counter a2u3_stuck 0
					end_if
					set_counter a2u3_distance 1
					inc_counter a2u3_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u3 0,0 >= 175
					and I_UnitDistanceFromPosition a2u3 0,0 < 200
					if I_CompareCounter a2u3_distance != 2
						set_counter a2u3_stuck 0
					end_if
					set_counter a2u3_distance 2
					inc_counter a2u3_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u3 0,0 >= 200
					and I_UnitDistanceFromPosition a2u3 0,0 < 225
					if I_CompareCounter a2u3_distance != 3
						set_counter a2u3_stuck 0
					end_if
					set_counter a2u3_distance 3
					inc_counter a2u3_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u3 0,0 >= 225
					and I_UnitDistanceFromPosition a2u3 0,0 < 250
					if I_CompareCounter a2u3_distance != 4
						set_counter a2u3_stuck 0
					end_if
					set_counter a2u3_distance 4
					inc_counter a2u3_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u3 0,0 >= 250
					and I_UnitDistanceFromPosition a2u3 0,0 < 275
					if I_CompareCounter a2u3_distance != 5
						set_counter a2u3_stuck 0
					end_if
					set_counter a2u3_distance 5
					inc_counter a2u3_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u3 0,0 >= 275
					and I_UnitDistanceFromPosition a2u3 0,0 < 300
					if I_CompareCounter a2u3_distance != 6
						set_counter a2u3_stuck 0
					end_if
					set_counter a2u3_distance 6
					inc_counter a2u3_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u3 0,0 >= 300
					and I_UnitDistanceFromPosition a2u3 0,0 < 325
					if I_CompareCounter a2u3_distance != 7
						set_counter a2u3_stuck 0
					end_if
					set_counter a2u3_distance 7
					inc_counter a2u3_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u3 0,0 >= 325
					and I_UnitDistanceFromPosition a2u3 0,0 < 350
					if I_CompareCounter a2u3_distance != 8
						set_counter a2u3_stuck 0
					end_if
					set_counter a2u3_distance 8
					inc_counter a2u3_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u3 0,0 >= 350
					and I_UnitDistanceFromPosition a2u3 0,0 < 375
					if I_CompareCounter a2u3_distance != 9
						set_counter a2u3_stuck 0
					end_if
					set_counter a2u3_distance 9
					inc_counter a2u3_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u3 0,0 >= 375
					and I_UnitDistanceFromPosition a2u3 0,0 < 400
					if I_CompareCounter a2u3_distance != 10
						set_counter a2u3_stuck 0
					end_if
					set_counter a2u3_distance 10
					inc_counter a2u3_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u3 0,0 >= 400
					and I_UnitDistanceFromPosition a2u3 0,0 < 425
					if I_CompareCounter a2u3_distance != 11
						set_counter a2u3_stuck 0
					end_if
					set_counter a2u3_distance 11
					inc_counter a2u3_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u3 0,0 >= 425
					and I_UnitDistanceFromPosition a2u3 0,0 < 450
					if I_CompareCounter a2u3_distance != 12
						set_counter a2u3_stuck 0
					end_if
					set_counter a2u3_distance 12
					inc_counter a2u3_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u3 0,0 >= 450
					and I_UnitDistanceFromPosition a2u3 0,0 < 500
					if I_CompareCounter a2u3_distance != 13
						set_counter a2u3_stuck 0
					end_if
					set_counter a2u3_distance 13
					inc_counter a2u3_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u3 0,0 >= 500
					and I_UnitDistanceFromPosition a2u3 0,0 < 550
					if I_CompareCounter a2u3_distance != 14
						set_counter a2u3_stuck 0
					end_if
					set_counter a2u3_distance 14
					inc_counter a2u3_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u3 0,0 >= 550
					and I_UnitDistanceFromPosition a2u3 0,0 < 600
					if I_CompareCounter a2u3_distance != 15
						set_counter a2u3_stuck 0
					end_if
					set_counter a2u3_distance 15
					inc_counter a2u3_stuck 1
				end_if

				if I_CompareCounter a2u3_stuck = 4
					unit_order_halt a2u3
					unit_set_morale a2u3 wavering
					battle_wait 0.1
					unit_unset_morale a2u3
					release_unit a2u3
					set_counter a2u3_stuck 0
				end_if

			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 3
			and ! I_UnitDestroyed a2u4

			if I_UnitStatus a2u4 moving
				if I_CompareCounter a2u4_status = 0
					set_counter a2u4_status 1
				end_if
				if I_CompareCounter a2u4_status != 1
					set_counter a2u4_status 0
				end_if
			end_if

			if I_UnitStatus a2u4 routing
				if I_CompareCounter a2u4_status = 0
					set_counter a2u4_status 2
				end_if
				if I_CompareCounter a2u4_status != 2
					set_counter a2u4_status 0
				end_if
			end_if

			if ! I_UnitStatus a2u4 moving
				and ! I_UnitStatus a2u4 routing
				set_counter a2u4_status 0
			end_if

			if I_CompareCounter a2u4_status > 0

				if I_UnitDistanceFromPosition a2u4 0,0 >= 150
					and I_UnitDistanceFromPosition a2u4 0,0 < 175
					if I_CompareCounter a2u4_distance != 1
						set_counter a2u4_stuck 0
					end_if
					set_counter a2u4_distance 1
					inc_counter a2u4_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u4 0,0 >= 175
					and I_UnitDistanceFromPosition a2u4 0,0 < 200
					if I_CompareCounter a2u4_distance != 2
						set_counter a2u4_stuck 0
					end_if
					set_counter a2u4_distance 2
					inc_counter a2u4_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u4 0,0 >= 200
					and I_UnitDistanceFromPosition a2u4 0,0 < 225
					if I_CompareCounter a2u4_distance != 3
						set_counter a2u4_stuck 0
					end_if
					set_counter a2u4_distance 3
					inc_counter a2u4_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u4 0,0 >= 225
					and I_UnitDistanceFromPosition a2u4 0,0 < 250
					if I_CompareCounter a2u4_distance != 4
						set_counter a2u4_stuck 0
					end_if
					set_counter a2u4_distance 4
					inc_counter a2u4_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u4 0,0 >= 250
					and I_UnitDistanceFromPosition a2u4 0,0 < 275
					if I_CompareCounter a2u4_distance != 5
						set_counter a2u4_stuck 0
					end_if
					set_counter a2u4_distance 5
					inc_counter a2u4_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u4 0,0 >= 275
					and I_UnitDistanceFromPosition a2u4 0,0 < 300
					if I_CompareCounter a2u4_distance != 6
						set_counter a2u4_stuck 0
					end_if
					set_counter a2u4_distance 6
					inc_counter a2u4_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u4 0,0 >= 300
					and I_UnitDistanceFromPosition a2u4 0,0 < 325
					if I_CompareCounter a2u4_distance != 7
						set_counter a2u4_stuck 0
					end_if
					set_counter a2u4_distance 7
					inc_counter a2u4_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u4 0,0 >= 325
					and I_UnitDistanceFromPosition a2u4 0,0 < 350
					if I_CompareCounter a2u4_distance != 8
						set_counter a2u4_stuck 0
					end_if
					set_counter a2u4_distance 8
					inc_counter a2u4_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u4 0,0 >= 350
					and I_UnitDistanceFromPosition a2u4 0,0 < 375
					if I_CompareCounter a2u4_distance != 9
						set_counter a2u4_stuck 0
					end_if
					set_counter a2u4_distance 9
					inc_counter a2u4_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u4 0,0 >= 375
					and I_UnitDistanceFromPosition a2u4 0,0 < 400
					if I_CompareCounter a2u4_distance != 10
						set_counter a2u4_stuck 0
					end_if
					set_counter a2u4_distance 10
					inc_counter a2u4_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u4 0,0 >= 400
					and I_UnitDistanceFromPosition a2u4 0,0 < 425
					if I_CompareCounter a2u4_distance != 11
						set_counter a2u4_stuck 0
					end_if
					set_counter a2u4_distance 11
					inc_counter a2u4_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u4 0,0 >= 425
					and I_UnitDistanceFromPosition a2u4 0,0 < 450
					if I_CompareCounter a2u4_distance != 12
						set_counter a2u4_stuck 0
					end_if
					set_counter a2u4_distance 12
					inc_counter a2u4_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u4 0,0 >= 450
					and I_UnitDistanceFromPosition a2u4 0,0 < 500
					if I_CompareCounter a2u4_distance != 13
						set_counter a2u4_stuck 0
					end_if
					set_counter a2u4_distance 13
					inc_counter a2u4_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u4 0,0 >= 500
					and I_UnitDistanceFromPosition a2u4 0,0 < 550
					if I_CompareCounter a2u4_distance != 14
						set_counter a2u4_stuck 0
					end_if
					set_counter a2u4_distance 14
					inc_counter a2u4_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u4 0,0 >= 550
					and I_UnitDistanceFromPosition a2u4 0,0 < 600
					if I_CompareCounter a2u4_distance != 15
						set_counter a2u4_stuck 0
					end_if
					set_counter a2u4_distance 15
					inc_counter a2u4_stuck 1
				end_if

				if I_CompareCounter a2u4_stuck = 4
					unit_order_halt a2u4
					unit_set_morale a2u4 wavering
					battle_wait 0.1
					unit_unset_morale a2u4
					release_unit a2u4
					set_counter a2u4_stuck 0
				end_if

			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 4
			and ! I_UnitDestroyed a2u5

			if I_UnitStatus a2u5 moving
				if I_CompareCounter a2u5_status = 0
					set_counter a2u5_status 1
				end_if
				if I_CompareCounter a2u5_status != 1
					set_counter a2u5_status 0
				end_if
			end_if

			if I_UnitStatus a2u5 routing
				if I_CompareCounter a2u5_status = 0
					set_counter a2u5_status 2
				end_if
				if I_CompareCounter a2u5_status != 2
					set_counter a2u5_status 0
				end_if
			end_if

			if ! I_UnitStatus a2u5 moving
				and ! I_UnitStatus a2u5 routing
				set_counter a2u5_status 0
			end_if

			if I_CompareCounter a2u5_status > 0

				if I_UnitDistanceFromPosition a2u5 0,0 >= 150
					and I_UnitDistanceFromPosition a2u5 0,0 < 175
					if I_CompareCounter a2u5_distance != 1
						set_counter a2u5_stuck 0
					end_if
					set_counter a2u5_distance 1
					inc_counter a2u5_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u5 0,0 >= 175
					and I_UnitDistanceFromPosition a2u5 0,0 < 200
					if I_CompareCounter a2u5_distance != 2
						set_counter a2u5_stuck 0
					end_if
					set_counter a2u5_distance 2
					inc_counter a2u5_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u5 0,0 >= 200
					and I_UnitDistanceFromPosition a2u5 0,0 < 225
					if I_CompareCounter a2u5_distance != 3
						set_counter a2u5_stuck 0
					end_if
					set_counter a2u5_distance 3
					inc_counter a2u5_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u5 0,0 >= 225
					and I_UnitDistanceFromPosition a2u5 0,0 < 250
					if I_CompareCounter a2u5_distance != 4
						set_counter a2u5_stuck 0
					end_if
					set_counter a2u5_distance 4
					inc_counter a2u5_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u5 0,0 >= 250
					and I_UnitDistanceFromPosition a2u5 0,0 < 275
					if I_CompareCounter a2u5_distance != 5
						set_counter a2u5_stuck 0
					end_if
					set_counter a2u5_distance 5
					inc_counter a2u5_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u5 0,0 >= 275
					and I_UnitDistanceFromPosition a2u5 0,0 < 300
					if I_CompareCounter a2u5_distance != 6
						set_counter a2u5_stuck 0
					end_if
					set_counter a2u5_distance 6
					inc_counter a2u5_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u5 0,0 >= 300
					and I_UnitDistanceFromPosition a2u5 0,0 < 325
					if I_CompareCounter a2u5_distance != 7
						set_counter a2u5_stuck 0
					end_if
					set_counter a2u5_distance 7
					inc_counter a2u5_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u5 0,0 >= 325
					and I_UnitDistanceFromPosition a2u5 0,0 < 350
					if I_CompareCounter a2u5_distance != 8
						set_counter a2u5_stuck 0
					end_if
					set_counter a2u5_distance 8
					inc_counter a2u5_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u5 0,0 >= 350
					and I_UnitDistanceFromPosition a2u5 0,0 < 375
					if I_CompareCounter a2u5_distance != 9
						set_counter a2u5_stuck 0
					end_if
					set_counter a2u5_distance 9
					inc_counter a2u5_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u5 0,0 >= 375
					and I_UnitDistanceFromPosition a2u5 0,0 < 400
					if I_CompareCounter a2u5_distance != 10
						set_counter a2u5_stuck 0
					end_if
					set_counter a2u5_distance 10
					inc_counter a2u5_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u5 0,0 >= 400
					and I_UnitDistanceFromPosition a2u5 0,0 < 425
					if I_CompareCounter a2u5_distance != 11
						set_counter a2u5_stuck 0
					end_if
					set_counter a2u5_distance 11
					inc_counter a2u5_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u5 0,0 >= 425
					and I_UnitDistanceFromPosition a2u5 0,0 < 450
					if I_CompareCounter a2u5_distance != 12
						set_counter a2u5_stuck 0
					end_if
					set_counter a2u5_distance 12
					inc_counter a2u5_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u5 0,0 >= 450
					and I_UnitDistanceFromPosition a2u5 0,0 < 500
					if I_CompareCounter a2u5_distance != 13
						set_counter a2u5_stuck 0
					end_if
					set_counter a2u5_distance 13
					inc_counter a2u5_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u5 0,0 >= 500
					and I_UnitDistanceFromPosition a2u5 0,0 < 550
					if I_CompareCounter a2u5_distance != 14
						set_counter a2u5_stuck 0
					end_if
					set_counter a2u5_distance 14
					inc_counter a2u5_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u5 0,0 >= 550
					and I_UnitDistanceFromPosition a2u5 0,0 < 600
					if I_CompareCounter a2u5_distance != 15
						set_counter a2u5_stuck 0
					end_if
					set_counter a2u5_distance 15
					inc_counter a2u5_stuck 1
				end_if

				if I_CompareCounter a2u5_stuck = 4
					unit_order_halt a2u5
					unit_set_morale a2u5 wavering
					battle_wait 0.1
					unit_unset_morale a2u5
					release_unit a2u5
					set_counter a2u5_stuck 0
				end_if

			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 5
			and ! I_UnitDestroyed a2u6

			if I_UnitStatus a2u6 moving
				if I_CompareCounter a2u6_status = 0
					set_counter a2u6_status 1
				end_if
				if I_CompareCounter a2u6_status != 1
					set_counter a2u6_status 0
				end_if
			end_if

			if I_UnitStatus a2u6 routing
				if I_CompareCounter a2u6_status = 0
					set_counter a2u6_status 2
				end_if
				if I_CompareCounter a2u6_status != 2
					set_counter a2u6_status 0
				end_if
			end_if

			if ! I_UnitStatus a2u6 moving
				and ! I_UnitStatus a2u6 routing
				set_counter a2u6_status 0
			end_if

			if I_CompareCounter a2u6_status > 0

				if I_UnitDistanceFromPosition a2u6 0,0 >= 150
					and I_UnitDistanceFromPosition a2u6 0,0 < 175
					if I_CompareCounter a2u6_distance != 1
						set_counter a2u6_stuck 0
					end_if
					set_counter a2u6_distance 1
					inc_counter a2u6_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u6 0,0 >= 175
					and I_UnitDistanceFromPosition a2u6 0,0 < 200
					if I_CompareCounter a2u6_distance != 2
						set_counter a2u6_stuck 0
					end_if
					set_counter a2u6_distance 2
					inc_counter a2u6_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u6 0,0 >= 200
					and I_UnitDistanceFromPosition a2u6 0,0 < 225
					if I_CompareCounter a2u6_distance != 3
						set_counter a2u6_stuck 0
					end_if
					set_counter a2u6_distance 3
					inc_counter a2u6_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u6 0,0 >= 225
					and I_UnitDistanceFromPosition a2u6 0,0 < 250
					if I_CompareCounter a2u6_distance != 4
						set_counter a2u6_stuck 0
					end_if
					set_counter a2u6_distance 4
					inc_counter a2u6_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u6 0,0 >= 250
					and I_UnitDistanceFromPosition a2u6 0,0 < 275
					if I_CompareCounter a2u6_distance != 5
						set_counter a2u6_stuck 0
					end_if
					set_counter a2u6_distance 5
					inc_counter a2u6_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u6 0,0 >= 275
					and I_UnitDistanceFromPosition a2u6 0,0 < 300
					if I_CompareCounter a2u6_distance != 6
						set_counter a2u6_stuck 0
					end_if
					set_counter a2u6_distance 6
					inc_counter a2u6_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u6 0,0 >= 300
					and I_UnitDistanceFromPosition a2u6 0,0 < 325
					if I_CompareCounter a2u6_distance != 7
						set_counter a2u6_stuck 0
					end_if
					set_counter a2u6_distance 7
					inc_counter a2u6_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u6 0,0 >= 325
					and I_UnitDistanceFromPosition a2u6 0,0 < 350
					if I_CompareCounter a2u6_distance != 8
						set_counter a2u6_stuck 0
					end_if
					set_counter a2u6_distance 8
					inc_counter a2u6_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u6 0,0 >= 350
					and I_UnitDistanceFromPosition a2u6 0,0 < 375
					if I_CompareCounter a2u6_distance != 9
						set_counter a2u6_stuck 0
					end_if
					set_counter a2u6_distance 9
					inc_counter a2u6_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u6 0,0 >= 375
					and I_UnitDistanceFromPosition a2u6 0,0 < 400
					if I_CompareCounter a2u6_distance != 10
						set_counter a2u6_stuck 0
					end_if
					set_counter a2u6_distance 10
					inc_counter a2u6_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u6 0,0 >= 400
					and I_UnitDistanceFromPosition a2u6 0,0 < 425
					if I_CompareCounter a2u6_distance != 11
						set_counter a2u6_stuck 0
					end_if
					set_counter a2u6_distance 11
					inc_counter a2u6_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u6 0,0 >= 425
					and I_UnitDistanceFromPosition a2u6 0,0 < 450
					if I_CompareCounter a2u6_distance != 12
						set_counter a2u6_stuck 0
					end_if
					set_counter a2u6_distance 12
					inc_counter a2u6_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u6 0,0 >= 450
					and I_UnitDistanceFromPosition a2u6 0,0 < 500
					if I_CompareCounter a2u6_distance != 13
						set_counter a2u6_stuck 0
					end_if
					set_counter a2u6_distance 13
					inc_counter a2u6_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u6 0,0 >= 500
					and I_UnitDistanceFromPosition a2u6 0,0 < 550
					if I_CompareCounter a2u6_distance != 14
						set_counter a2u6_stuck 0
					end_if
					set_counter a2u6_distance 14
					inc_counter a2u6_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u6 0,0 >= 550
					and I_UnitDistanceFromPosition a2u6 0,0 < 600
					if I_CompareCounter a2u6_distance != 15
						set_counter a2u6_stuck 0
					end_if
					set_counter a2u6_distance 15
					inc_counter a2u6_stuck 1
				end_if

				if I_CompareCounter a2u6_stuck = 4
					unit_order_halt a2u6
					unit_set_morale a2u6 wavering
					battle_wait 0.1
					unit_unset_morale a2u6
					release_unit a2u6
					set_counter a2u6_stuck 0
				end_if

			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 6
			and ! I_UnitDestroyed a2u7

			if I_UnitStatus a2u7 moving
				if I_CompareCounter a2u7_status = 0
					set_counter a2u7_status 1
				end_if
				if I_CompareCounter a2u7_status != 1
					set_counter a2u7_status 0
				end_if
			end_if

			if I_UnitStatus a2u7 routing
				if I_CompareCounter a2u7_status = 0
					set_counter a2u7_status 2
				end_if
				if I_CompareCounter a2u7_status != 2
					set_counter a2u7_status 0
				end_if
			end_if

			if ! I_UnitStatus a2u7 moving
				and ! I_UnitStatus a2u7 routing
				set_counter a2u7_status 0
			end_if

			if I_CompareCounter a2u7_status > 0

				if I_UnitDistanceFromPosition a2u7 0,0 >= 150
					and I_UnitDistanceFromPosition a2u7 0,0 < 175
					if I_CompareCounter a2u7_distance != 1
						set_counter a2u7_stuck 0
					end_if
					set_counter a2u7_distance 1
					inc_counter a2u7_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u7 0,0 >= 175
					and I_UnitDistanceFromPosition a2u7 0,0 < 200
					if I_CompareCounter a2u7_distance != 2
						set_counter a2u7_stuck 0
					end_if
					set_counter a2u7_distance 2
					inc_counter a2u7_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u7 0,0 >= 200
					and I_UnitDistanceFromPosition a2u7 0,0 < 225
					if I_CompareCounter a2u7_distance != 3
						set_counter a2u7_stuck 0
					end_if
					set_counter a2u7_distance 3
					inc_counter a2u7_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u7 0,0 >= 225
					and I_UnitDistanceFromPosition a2u7 0,0 < 250
					if I_CompareCounter a2u7_distance != 4
						set_counter a2u7_stuck 0
					end_if
					set_counter a2u7_distance 4
					inc_counter a2u7_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u7 0,0 >= 250
					and I_UnitDistanceFromPosition a2u7 0,0 < 275
					if I_CompareCounter a2u7_distance != 5
						set_counter a2u7_stuck 0
					end_if
					set_counter a2u7_distance 5
					inc_counter a2u7_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u7 0,0 >= 275
					and I_UnitDistanceFromPosition a2u7 0,0 < 300
					if I_CompareCounter a2u7_distance != 6
						set_counter a2u7_stuck 0
					end_if
					set_counter a2u7_distance 6
					inc_counter a2u7_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u7 0,0 >= 300
					and I_UnitDistanceFromPosition a2u7 0,0 < 325
					if I_CompareCounter a2u7_distance != 7
						set_counter a2u7_stuck 0
					end_if
					set_counter a2u7_distance 7
					inc_counter a2u7_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u7 0,0 >= 325
					and I_UnitDistanceFromPosition a2u7 0,0 < 350
					if I_CompareCounter a2u7_distance != 8
						set_counter a2u7_stuck 0
					end_if
					set_counter a2u7_distance 8
					inc_counter a2u7_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u7 0,0 >= 350
					and I_UnitDistanceFromPosition a2u7 0,0 < 375
					if I_CompareCounter a2u7_distance != 9
						set_counter a2u7_stuck 0
					end_if
					set_counter a2u7_distance 9
					inc_counter a2u7_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u7 0,0 >= 375
					and I_UnitDistanceFromPosition a2u7 0,0 < 400
					if I_CompareCounter a2u7_distance != 10
						set_counter a2u7_stuck 0
					end_if
					set_counter a2u7_distance 10
					inc_counter a2u7_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u7 0,0 >= 400
					and I_UnitDistanceFromPosition a2u7 0,0 < 425
					if I_CompareCounter a2u7_distance != 11
						set_counter a2u7_stuck 0
					end_if
					set_counter a2u7_distance 11
					inc_counter a2u7_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u7 0,0 >= 425
					and I_UnitDistanceFromPosition a2u7 0,0 < 450
					if I_CompareCounter a2u7_distance != 12
						set_counter a2u7_stuck 0
					end_if
					set_counter a2u7_distance 12
					inc_counter a2u7_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u7 0,0 >= 450
					and I_UnitDistanceFromPosition a2u7 0,0 < 500
					if I_CompareCounter a2u7_distance != 13
						set_counter a2u7_stuck 0
					end_if
					set_counter a2u7_distance 13
					inc_counter a2u7_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u7 0,0 >= 500
					and I_UnitDistanceFromPosition a2u7 0,0 < 550
					if I_CompareCounter a2u7_distance != 14
						set_counter a2u7_stuck 0
					end_if
					set_counter a2u7_distance 14
					inc_counter a2u7_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u7 0,0 >= 550
					and I_UnitDistanceFromPosition a2u7 0,0 < 600
					if I_CompareCounter a2u7_distance != 15
						set_counter a2u7_stuck 0
					end_if
					set_counter a2u7_distance 15
					inc_counter a2u7_stuck 1
				end_if

				if I_CompareCounter a2u7_stuck = 4
					unit_order_halt a2u7
					unit_set_morale a2u7 wavering
					battle_wait 0.1
					unit_unset_morale a2u7
					release_unit a2u7
					set_counter a2u7_stuck 0
				end_if

			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 7
			and ! I_UnitDestroyed a2u8

			if I_UnitStatus a2u8 moving
				if I_CompareCounter a2u8_status = 0
					set_counter a2u8_status 1
				end_if
				if I_CompareCounter a2u8_status != 1
					set_counter a2u8_status 0
				end_if
			end_if

			if I_UnitStatus a2u8 routing
				if I_CompareCounter a2u8_status = 0
					set_counter a2u8_status 2
				end_if
				if I_CompareCounter a2u8_status != 2
					set_counter a2u8_status 0
				end_if
			end_if

			if ! I_UnitStatus a2u8 moving
				and ! I_UnitStatus a2u8 routing
				set_counter a2u8_status 0
			end_if

			if I_CompareCounter a2u8_status > 0

				if I_UnitDistanceFromPosition a2u8 0,0 >= 150
					and I_UnitDistanceFromPosition a2u8 0,0 < 175
					if I_CompareCounter a2u8_distance != 1
						set_counter a2u8_stuck 0
					end_if
					set_counter a2u8_distance 1
					inc_counter a2u8_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u8 0,0 >= 175
					and I_UnitDistanceFromPosition a2u8 0,0 < 200
					if I_CompareCounter a2u8_distance != 2
						set_counter a2u8_stuck 0
					end_if
					set_counter a2u8_distance 2
					inc_counter a2u8_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u8 0,0 >= 200
					and I_UnitDistanceFromPosition a2u8 0,0 < 225
					if I_CompareCounter a2u8_distance != 3
						set_counter a2u8_stuck 0
					end_if
					set_counter a2u8_distance 3
					inc_counter a2u8_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u8 0,0 >= 225
					and I_UnitDistanceFromPosition a2u8 0,0 < 250
					if I_CompareCounter a2u8_distance != 4
						set_counter a2u8_stuck 0
					end_if
					set_counter a2u8_distance 4
					inc_counter a2u8_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u8 0,0 >= 250
					and I_UnitDistanceFromPosition a2u8 0,0 < 275
					if I_CompareCounter a2u8_distance != 5
						set_counter a2u8_stuck 0
					end_if
					set_counter a2u8_distance 5
					inc_counter a2u8_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u8 0,0 >= 275
					and I_UnitDistanceFromPosition a2u8 0,0 < 300
					if I_CompareCounter a2u8_distance != 6
						set_counter a2u8_stuck 0
					end_if
					set_counter a2u8_distance 6
					inc_counter a2u8_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u8 0,0 >= 300
					and I_UnitDistanceFromPosition a2u8 0,0 < 325
					if I_CompareCounter a2u8_distance != 7
						set_counter a2u8_stuck 0
					end_if
					set_counter a2u8_distance 7
					inc_counter a2u8_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u8 0,0 >= 325
					and I_UnitDistanceFromPosition a2u8 0,0 < 350
					if I_CompareCounter a2u8_distance != 8
						set_counter a2u8_stuck 0
					end_if
					set_counter a2u8_distance 8
					inc_counter a2u8_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u8 0,0 >= 350
					and I_UnitDistanceFromPosition a2u8 0,0 < 375
					if I_CompareCounter a2u8_distance != 9
						set_counter a2u8_stuck 0
					end_if
					set_counter a2u8_distance 9
					inc_counter a2u8_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u8 0,0 >= 375
					and I_UnitDistanceFromPosition a2u8 0,0 < 400
					if I_CompareCounter a2u8_distance != 10
						set_counter a2u8_stuck 0
					end_if
					set_counter a2u8_distance 10
					inc_counter a2u8_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u8 0,0 >= 400
					and I_UnitDistanceFromPosition a2u8 0,0 < 425
					if I_CompareCounter a2u8_distance != 11
						set_counter a2u8_stuck 0
					end_if
					set_counter a2u8_distance 11
					inc_counter a2u8_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u8 0,0 >= 425
					and I_UnitDistanceFromPosition a2u8 0,0 < 450
					if I_CompareCounter a2u8_distance != 12
						set_counter a2u8_stuck 0
					end_if
					set_counter a2u8_distance 12
					inc_counter a2u8_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u8 0,0 >= 450
					and I_UnitDistanceFromPosition a2u8 0,0 < 500
					if I_CompareCounter a2u8_distance != 13
						set_counter a2u8_stuck 0
					end_if
					set_counter a2u8_distance 13
					inc_counter a2u8_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u8 0,0 >= 500
					and I_UnitDistanceFromPosition a2u8 0,0 < 550
					if I_CompareCounter a2u8_distance != 14
						set_counter a2u8_stuck 0
					end_if
					set_counter a2u8_distance 14
					inc_counter a2u8_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u8 0,0 >= 550
					and I_UnitDistanceFromPosition a2u8 0,0 < 600
					if I_CompareCounter a2u8_distance != 15
						set_counter a2u8_stuck 0
					end_if
					set_counter a2u8_distance 15
					inc_counter a2u8_stuck 1
				end_if

				if I_CompareCounter a2u8_stuck = 4
					unit_order_halt a2u8
					unit_set_morale a2u8 wavering
					battle_wait 0.1
					unit_unset_morale a2u8
					release_unit a2u8
					set_counter a2u8_stuck 0
				end_if

			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 8
			and ! I_UnitDestroyed a2u9

			if I_UnitStatus a2u9 moving
				if I_CompareCounter a2u9_status = 0
					set_counter a2u9_status 1
				end_if
				if I_CompareCounter a2u9_status != 1
					set_counter a2u9_status 0
				end_if
			end_if

			if I_UnitStatus a2u9 routing
				if I_CompareCounter a2u9_status = 0
					set_counter a2u9_status 2
				end_if
				if I_CompareCounter a2u9_status != 2
					set_counter a2u9_status 0
				end_if
			end_if

			if ! I_UnitStatus a2u9 moving
				and ! I_UnitStatus a2u9 routing
				set_counter a2u9_status 0
			end_if

			if I_CompareCounter a2u9_status > 0

				if I_UnitDistanceFromPosition a2u9 0,0 >= 150
					and I_UnitDistanceFromPosition a2u9 0,0 < 175
					if I_CompareCounter a2u9_distance != 1
						set_counter a2u9_stuck 0
					end_if
					set_counter a2u9_distance 1
					inc_counter a2u9_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u9 0,0 >= 175
					and I_UnitDistanceFromPosition a2u9 0,0 < 200
					if I_CompareCounter a2u9_distance != 2
						set_counter a2u9_stuck 0
					end_if
					set_counter a2u9_distance 2
					inc_counter a2u9_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u9 0,0 >= 200
					and I_UnitDistanceFromPosition a2u9 0,0 < 225
					if I_CompareCounter a2u9_distance != 3
						set_counter a2u9_stuck 0
					end_if
					set_counter a2u9_distance 3
					inc_counter a2u9_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u9 0,0 >= 225
					and I_UnitDistanceFromPosition a2u9 0,0 < 250
					if I_CompareCounter a2u9_distance != 4
						set_counter a2u9_stuck 0
					end_if
					set_counter a2u9_distance 4
					inc_counter a2u9_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u9 0,0 >= 250
					and I_UnitDistanceFromPosition a2u9 0,0 < 275
					if I_CompareCounter a2u9_distance != 5
						set_counter a2u9_stuck 0
					end_if
					set_counter a2u9_distance 5
					inc_counter a2u9_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u9 0,0 >= 275
					and I_UnitDistanceFromPosition a2u9 0,0 < 300
					if I_CompareCounter a2u9_distance != 6
						set_counter a2u9_stuck 0
					end_if
					set_counter a2u9_distance 6
					inc_counter a2u9_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u9 0,0 >= 300
					and I_UnitDistanceFromPosition a2u9 0,0 < 325
					if I_CompareCounter a2u9_distance != 7
						set_counter a2u9_stuck 0
					end_if
					set_counter a2u9_distance 7
					inc_counter a2u9_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u9 0,0 >= 325
					and I_UnitDistanceFromPosition a2u9 0,0 < 350
					if I_CompareCounter a2u9_distance != 8
						set_counter a2u9_stuck 0
					end_if
					set_counter a2u9_distance 8
					inc_counter a2u9_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u9 0,0 >= 350
					and I_UnitDistanceFromPosition a2u9 0,0 < 375
					if I_CompareCounter a2u9_distance != 9
						set_counter a2u9_stuck 0
					end_if
					set_counter a2u9_distance 9
					inc_counter a2u9_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u9 0,0 >= 375
					and I_UnitDistanceFromPosition a2u9 0,0 < 400
					if I_CompareCounter a2u9_distance != 10
						set_counter a2u9_stuck 0
					end_if
					set_counter a2u9_distance 10
					inc_counter a2u9_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u9 0,0 >= 400
					and I_UnitDistanceFromPosition a2u9 0,0 < 425
					if I_CompareCounter a2u9_distance != 11
						set_counter a2u9_stuck 0
					end_if
					set_counter a2u9_distance 11
					inc_counter a2u9_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u9 0,0 >= 425
					and I_UnitDistanceFromPosition a2u9 0,0 < 450
					if I_CompareCounter a2u9_distance != 12
						set_counter a2u9_stuck 0
					end_if
					set_counter a2u9_distance 12
					inc_counter a2u9_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u9 0,0 >= 450
					and I_UnitDistanceFromPosition a2u9 0,0 < 500
					if I_CompareCounter a2u9_distance != 13
						set_counter a2u9_stuck 0
					end_if
					set_counter a2u9_distance 13
					inc_counter a2u9_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u9 0,0 >= 500
					and I_UnitDistanceFromPosition a2u9 0,0 < 550
					if I_CompareCounter a2u9_distance != 14
						set_counter a2u9_stuck 0
					end_if
					set_counter a2u9_distance 14
					inc_counter a2u9_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u9 0,0 >= 550
					and I_UnitDistanceFromPosition a2u9 0,0 < 600
					if I_CompareCounter a2u9_distance != 15
						set_counter a2u9_stuck 0
					end_if
					set_counter a2u9_distance 15
					inc_counter a2u9_stuck 1
				end_if

				if I_CompareCounter a2u9_stuck = 4
					unit_order_halt a2u9
					unit_set_morale a2u9 wavering
					battle_wait 0.1
					unit_unset_morale a2u9
					release_unit a2u9
					set_counter a2u9_stuck 0
				end_if

			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 9
			and ! I_UnitDestroyed a2u10

			if I_UnitStatus a2u10 moving
				if I_CompareCounter a2u10_status = 0
					set_counter a2u10_status 1
				end_if
				if I_CompareCounter a2u10_status != 1
					set_counter a2u10_status 0
				end_if
			end_if

			if I_UnitStatus a2u10 routing
				if I_CompareCounter a2u10_status = 0
					set_counter a2u10_status 2
				end_if
				if I_CompareCounter a2u10_status != 2
					set_counter a2u10_status 0
				end_if
			end_if

			if ! I_UnitStatus a2u10 moving
				and ! I_UnitStatus a2u10 routing
				set_counter a2u10_status 0
			end_if

			if I_CompareCounter a2u10_status > 0

				if I_UnitDistanceFromPosition a2u10 0,0 >= 150
					and I_UnitDistanceFromPosition a2u10 0,0 < 175
					if I_CompareCounter a2u10_distance != 1
						set_counter a2u10_stuck 0
					end_if
					set_counter a2u10_distance 1
					inc_counter a2u10_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u10 0,0 >= 175
					and I_UnitDistanceFromPosition a2u10 0,0 < 200
					if I_CompareCounter a2u10_distance != 2
						set_counter a2u10_stuck 0
					end_if
					set_counter a2u10_distance 2
					inc_counter a2u10_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u10 0,0 >= 200
					and I_UnitDistanceFromPosition a2u10 0,0 < 225
					if I_CompareCounter a2u10_distance != 3
						set_counter a2u10_stuck 0
					end_if
					set_counter a2u10_distance 3
					inc_counter a2u10_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u10 0,0 >= 225
					and I_UnitDistanceFromPosition a2u10 0,0 < 250
					if I_CompareCounter a2u10_distance != 4
						set_counter a2u10_stuck 0
					end_if
					set_counter a2u10_distance 4
					inc_counter a2u10_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u10 0,0 >= 250
					and I_UnitDistanceFromPosition a2u10 0,0 < 275
					if I_CompareCounter a2u10_distance != 5
						set_counter a2u10_stuck 0
					end_if
					set_counter a2u10_distance 5
					inc_counter a2u10_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u10 0,0 >= 275
					and I_UnitDistanceFromPosition a2u10 0,0 < 300
					if I_CompareCounter a2u10_distance != 6
						set_counter a2u10_stuck 0
					end_if
					set_counter a2u10_distance 6
					inc_counter a2u10_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u10 0,0 >= 300
					and I_UnitDistanceFromPosition a2u10 0,0 < 325
					if I_CompareCounter a2u10_distance != 7
						set_counter a2u10_stuck 0
					end_if
					set_counter a2u10_distance 7
					inc_counter a2u10_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u10 0,0 >= 325
					and I_UnitDistanceFromPosition a2u10 0,0 < 350
					if I_CompareCounter a2u10_distance != 8
						set_counter a2u10_stuck 0
					end_if
					set_counter a2u10_distance 8
					inc_counter a2u10_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u10 0,0 >= 350
					and I_UnitDistanceFromPosition a2u10 0,0 < 375
					if I_CompareCounter a2u10_distance != 9
						set_counter a2u10_stuck 0
					end_if
					set_counter a2u10_distance 9
					inc_counter a2u10_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u10 0,0 >= 375
					and I_UnitDistanceFromPosition a2u10 0,0 < 400
					if I_CompareCounter a2u10_distance != 10
						set_counter a2u10_stuck 0
					end_if
					set_counter a2u10_distance 10
					inc_counter a2u10_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u10 0,0 >= 400
					and I_UnitDistanceFromPosition a2u10 0,0 < 425
					if I_CompareCounter a2u10_distance != 11
						set_counter a2u10_stuck 0
					end_if
					set_counter a2u10_distance 11
					inc_counter a2u10_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u10 0,0 >= 425
					and I_UnitDistanceFromPosition a2u10 0,0 < 450
					if I_CompareCounter a2u10_distance != 12
						set_counter a2u10_stuck 0
					end_if
					set_counter a2u10_distance 12
					inc_counter a2u10_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u10 0,0 >= 450
					and I_UnitDistanceFromPosition a2u10 0,0 < 500
					if I_CompareCounter a2u10_distance != 13
						set_counter a2u10_stuck 0
					end_if
					set_counter a2u10_distance 13
					inc_counter a2u10_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u10 0,0 >= 500
					and I_UnitDistanceFromPosition a2u10 0,0 < 550
					if I_CompareCounter a2u10_distance != 14
						set_counter a2u10_stuck 0
					end_if
					set_counter a2u10_distance 14
					inc_counter a2u10_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u10 0,0 >= 550
					and I_UnitDistanceFromPosition a2u10 0,0 < 600
					if I_CompareCounter a2u10_distance != 15
						set_counter a2u10_stuck 0
					end_if
					set_counter a2u10_distance 15
					inc_counter a2u10_stuck 1
				end_if

				if I_CompareCounter a2u10_stuck = 4
					unit_order_halt a2u10
					unit_set_morale a2u10 wavering
					battle_wait 0.1
					unit_unset_morale a2u10
					release_unit a2u10
					set_counter a2u10_stuck 0
				end_if

			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 10
			and ! I_UnitDestroyed a2u11

			if I_UnitStatus a2u11 moving
				if I_CompareCounter a2u11_status = 0
					set_counter a2u11_status 1
				end_if
				if I_CompareCounter a2u11_status != 1
					set_counter a2u11_status 0
				end_if
			end_if

			if I_UnitStatus a2u11 routing
				if I_CompareCounter a2u11_status = 0
					set_counter a2u11_status 2
				end_if
				if I_CompareCounter a2u11_status != 2
					set_counter a2u11_status 0
				end_if
			end_if

			if ! I_UnitStatus a2u11 moving
				and ! I_UnitStatus a2u11 routing
				set_counter a2u11_status 0
			end_if

			if I_CompareCounter a2u11_status > 0

				if I_UnitDistanceFromPosition a2u11 0,0 >= 150
					and I_UnitDistanceFromPosition a2u11 0,0 < 175
					if I_CompareCounter a2u11_distance != 1
						set_counter a2u11_stuck 0
					end_if
					set_counter a2u11_distance 1
					inc_counter a2u11_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u11 0,0 >= 175
					and I_UnitDistanceFromPosition a2u11 0,0 < 200
					if I_CompareCounter a2u11_distance != 2
						set_counter a2u11_stuck 0
					end_if
					set_counter a2u11_distance 2
					inc_counter a2u11_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u11 0,0 >= 200
					and I_UnitDistanceFromPosition a2u11 0,0 < 225
					if I_CompareCounter a2u11_distance != 3
						set_counter a2u11_stuck 0
					end_if
					set_counter a2u11_distance 3
					inc_counter a2u11_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u11 0,0 >= 225
					and I_UnitDistanceFromPosition a2u11 0,0 < 250
					if I_CompareCounter a2u11_distance != 4
						set_counter a2u11_stuck 0
					end_if
					set_counter a2u11_distance 4
					inc_counter a2u11_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u11 0,0 >= 250
					and I_UnitDistanceFromPosition a2u11 0,0 < 275
					if I_CompareCounter a2u11_distance != 5
						set_counter a2u11_stuck 0
					end_if
					set_counter a2u11_distance 5
					inc_counter a2u11_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u11 0,0 >= 275
					and I_UnitDistanceFromPosition a2u11 0,0 < 300
					if I_CompareCounter a2u11_distance != 6
						set_counter a2u11_stuck 0
					end_if
					set_counter a2u11_distance 6
					inc_counter a2u11_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u11 0,0 >= 300
					and I_UnitDistanceFromPosition a2u11 0,0 < 325
					if I_CompareCounter a2u11_distance != 7
						set_counter a2u11_stuck 0
					end_if
					set_counter a2u11_distance 7
					inc_counter a2u11_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u11 0,0 >= 325
					and I_UnitDistanceFromPosition a2u11 0,0 < 350
					if I_CompareCounter a2u11_distance != 8
						set_counter a2u11_stuck 0
					end_if
					set_counter a2u11_distance 8
					inc_counter a2u11_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u11 0,0 >= 350
					and I_UnitDistanceFromPosition a2u11 0,0 < 375
					if I_CompareCounter a2u11_distance != 9
						set_counter a2u11_stuck 0
					end_if
					set_counter a2u11_distance 9
					inc_counter a2u11_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u11 0,0 >= 375
					and I_UnitDistanceFromPosition a2u11 0,0 < 400
					if I_CompareCounter a2u11_distance != 10
						set_counter a2u11_stuck 0
					end_if
					set_counter a2u11_distance 10
					inc_counter a2u11_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u11 0,0 >= 400
					and I_UnitDistanceFromPosition a2u11 0,0 < 425
					if I_CompareCounter a2u11_distance != 11
						set_counter a2u11_stuck 0
					end_if
					set_counter a2u11_distance 11
					inc_counter a2u11_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u11 0,0 >= 425
					and I_UnitDistanceFromPosition a2u11 0,0 < 450
					if I_CompareCounter a2u11_distance != 12
						set_counter a2u11_stuck 0
					end_if
					set_counter a2u11_distance 12
					inc_counter a2u11_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u11 0,0 >= 450
					and I_UnitDistanceFromPosition a2u11 0,0 < 500
					if I_CompareCounter a2u11_distance != 13
						set_counter a2u11_stuck 0
					end_if
					set_counter a2u11_distance 13
					inc_counter a2u11_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u11 0,0 >= 500
					and I_UnitDistanceFromPosition a2u11 0,0 < 550
					if I_CompareCounter a2u11_distance != 14
						set_counter a2u11_stuck 0
					end_if
					set_counter a2u11_distance 14
					inc_counter a2u11_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u11 0,0 >= 550
					and I_UnitDistanceFromPosition a2u11 0,0 < 600
					if I_CompareCounter a2u11_distance != 15
						set_counter a2u11_stuck 0
					end_if
					set_counter a2u11_distance 15
					inc_counter a2u11_stuck 1
				end_if

				if I_CompareCounter a2u11_stuck = 4
					unit_order_halt a2u11
					unit_set_morale a2u11 wavering
					battle_wait 0.1
					unit_unset_morale a2u11
					release_unit a2u11
					set_counter a2u11_stuck 0
				end_if

			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 11
			and ! I_UnitDestroyed a2u12

			if I_UnitStatus a2u12 moving
				if I_CompareCounter a2u12_status = 0
					set_counter a2u12_status 1
				end_if
				if I_CompareCounter a2u12_status != 1
					set_counter a2u12_status 0
				end_if
			end_if

			if I_UnitStatus a2u12 routing
				if I_CompareCounter a2u12_status = 0
					set_counter a2u12_status 2
				end_if
				if I_CompareCounter a2u12_status != 2
					set_counter a2u12_status 0
				end_if
			end_if

			if ! I_UnitStatus a2u12 moving
				and ! I_UnitStatus a2u12 routing
				set_counter a2u12_status 0
			end_if

			if I_CompareCounter a2u12_status > 0

				if I_UnitDistanceFromPosition a2u12 0,0 >= 150
					and I_UnitDistanceFromPosition a2u12 0,0 < 175
					if I_CompareCounter a2u12_distance != 1
						set_counter a2u12_stuck 0
					end_if
					set_counter a2u12_distance 1
					inc_counter a2u12_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u12 0,0 >= 175
					and I_UnitDistanceFromPosition a2u12 0,0 < 200
					if I_CompareCounter a2u12_distance != 2
						set_counter a2u12_stuck 0
					end_if
					set_counter a2u12_distance 2
					inc_counter a2u12_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u12 0,0 >= 200
					and I_UnitDistanceFromPosition a2u12 0,0 < 225
					if I_CompareCounter a2u12_distance != 3
						set_counter a2u12_stuck 0
					end_if
					set_counter a2u12_distance 3
					inc_counter a2u12_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u12 0,0 >= 225
					and I_UnitDistanceFromPosition a2u12 0,0 < 250
					if I_CompareCounter a2u12_distance != 4
						set_counter a2u12_stuck 0
					end_if
					set_counter a2u12_distance 4
					inc_counter a2u12_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u12 0,0 >= 250
					and I_UnitDistanceFromPosition a2u12 0,0 < 275
					if I_CompareCounter a2u12_distance != 5
						set_counter a2u12_stuck 0
					end_if
					set_counter a2u12_distance 5
					inc_counter a2u12_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u12 0,0 >= 275
					and I_UnitDistanceFromPosition a2u12 0,0 < 300
					if I_CompareCounter a2u12_distance != 6
						set_counter a2u12_stuck 0
					end_if
					set_counter a2u12_distance 6
					inc_counter a2u12_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u12 0,0 >= 300
					and I_UnitDistanceFromPosition a2u12 0,0 < 325
					if I_CompareCounter a2u12_distance != 7
						set_counter a2u12_stuck 0
					end_if
					set_counter a2u12_distance 7
					inc_counter a2u12_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u12 0,0 >= 325
					and I_UnitDistanceFromPosition a2u12 0,0 < 350
					if I_CompareCounter a2u12_distance != 8
						set_counter a2u12_stuck 0
					end_if
					set_counter a2u12_distance 8
					inc_counter a2u12_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u12 0,0 >= 350
					and I_UnitDistanceFromPosition a2u12 0,0 < 375
					if I_CompareCounter a2u12_distance != 9
						set_counter a2u12_stuck 0
					end_if
					set_counter a2u12_distance 9
					inc_counter a2u12_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u12 0,0 >= 375
					and I_UnitDistanceFromPosition a2u12 0,0 < 400
					if I_CompareCounter a2u12_distance != 10
						set_counter a2u12_stuck 0
					end_if
					set_counter a2u12_distance 10
					inc_counter a2u12_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u12 0,0 >= 400
					and I_UnitDistanceFromPosition a2u12 0,0 < 425
					if I_CompareCounter a2u12_distance != 11
						set_counter a2u12_stuck 0
					end_if
					set_counter a2u12_distance 11
					inc_counter a2u12_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u12 0,0 >= 425
					and I_UnitDistanceFromPosition a2u12 0,0 < 450
					if I_CompareCounter a2u12_distance != 12
						set_counter a2u12_stuck 0
					end_if
					set_counter a2u12_distance 12
					inc_counter a2u12_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u12 0,0 >= 450
					and I_UnitDistanceFromPosition a2u12 0,0 < 500
					if I_CompareCounter a2u12_distance != 13
						set_counter a2u12_stuck 0
					end_if
					set_counter a2u12_distance 13
					inc_counter a2u12_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u12 0,0 >= 500
					and I_UnitDistanceFromPosition a2u12 0,0 < 550
					if I_CompareCounter a2u12_distance != 14
						set_counter a2u12_stuck 0
					end_if
					set_counter a2u12_distance 14
					inc_counter a2u12_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u12 0,0 >= 550
					and I_UnitDistanceFromPosition a2u12 0,0 < 600
					if I_CompareCounter a2u12_distance != 15
						set_counter a2u12_stuck 0
					end_if
					set_counter a2u12_distance 15
					inc_counter a2u12_stuck 1
				end_if

				if I_CompareCounter a2u12_stuck = 4
					unit_order_halt a2u12
					unit_set_morale a2u12 wavering
					battle_wait 0.1
					unit_unset_morale a2u12
					release_unit a2u12
					set_counter a2u12_stuck 0
				end_if

			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 12
			and ! I_UnitDestroyed a2u13

			if I_UnitStatus a2u13 moving
				if I_CompareCounter a2u13_status = 0
					set_counter a2u13_status 1
				end_if
				if I_CompareCounter a2u13_status != 1
					set_counter a2u13_status 0
				end_if
			end_if

			if I_UnitStatus a2u13 routing
				if I_CompareCounter a2u13_status = 0
					set_counter a2u13_status 2
				end_if
				if I_CompareCounter a2u13_status != 2
					set_counter a2u13_status 0
				end_if
			end_if

			if ! I_UnitStatus a2u13 moving
				and ! I_UnitStatus a2u13 routing
				set_counter a2u13_status 0
			end_if

			if I_CompareCounter a2u13_status > 0

				if I_UnitDistanceFromPosition a2u13 0,0 >= 150
					and I_UnitDistanceFromPosition a2u13 0,0 < 175
					if I_CompareCounter a2u13_distance != 1
						set_counter a2u13_stuck 0
					end_if
					set_counter a2u13_distance 1
					inc_counter a2u13_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u13 0,0 >= 175
					and I_UnitDistanceFromPosition a2u13 0,0 < 200
					if I_CompareCounter a2u13_distance != 2
						set_counter a2u13_stuck 0
					end_if
					set_counter a2u13_distance 2
					inc_counter a2u13_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u13 0,0 >= 200
					and I_UnitDistanceFromPosition a2u13 0,0 < 225
					if I_CompareCounter a2u13_distance != 3
						set_counter a2u13_stuck 0
					end_if
					set_counter a2u13_distance 3
					inc_counter a2u13_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u13 0,0 >= 225
					and I_UnitDistanceFromPosition a2u13 0,0 < 250
					if I_CompareCounter a2u13_distance != 4
						set_counter a2u13_stuck 0
					end_if
					set_counter a2u13_distance 4
					inc_counter a2u13_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u13 0,0 >= 250
					and I_UnitDistanceFromPosition a2u13 0,0 < 275
					if I_CompareCounter a2u13_distance != 5
						set_counter a2u13_stuck 0
					end_if
					set_counter a2u13_distance 5
					inc_counter a2u13_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u13 0,0 >= 275
					and I_UnitDistanceFromPosition a2u13 0,0 < 300
					if I_CompareCounter a2u13_distance != 6
						set_counter a2u13_stuck 0
					end_if
					set_counter a2u13_distance 6
					inc_counter a2u13_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u13 0,0 >= 300
					and I_UnitDistanceFromPosition a2u13 0,0 < 325
					if I_CompareCounter a2u13_distance != 7
						set_counter a2u13_stuck 0
					end_if
					set_counter a2u13_distance 7
					inc_counter a2u13_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u13 0,0 >= 325
					and I_UnitDistanceFromPosition a2u13 0,0 < 350
					if I_CompareCounter a2u13_distance != 8
						set_counter a2u13_stuck 0
					end_if
					set_counter a2u13_distance 8
					inc_counter a2u13_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u13 0,0 >= 350
					and I_UnitDistanceFromPosition a2u13 0,0 < 375
					if I_CompareCounter a2u13_distance != 9
						set_counter a2u13_stuck 0
					end_if
					set_counter a2u13_distance 9
					inc_counter a2u13_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u13 0,0 >= 375
					and I_UnitDistanceFromPosition a2u13 0,0 < 400
					if I_CompareCounter a2u13_distance != 10
						set_counter a2u13_stuck 0
					end_if
					set_counter a2u13_distance 10
					inc_counter a2u13_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u13 0,0 >= 400
					and I_UnitDistanceFromPosition a2u13 0,0 < 425
					if I_CompareCounter a2u13_distance != 11
						set_counter a2u13_stuck 0
					end_if
					set_counter a2u13_distance 11
					inc_counter a2u13_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u13 0,0 >= 425
					and I_UnitDistanceFromPosition a2u13 0,0 < 450
					if I_CompareCounter a2u13_distance != 12
						set_counter a2u13_stuck 0
					end_if
					set_counter a2u13_distance 12
					inc_counter a2u13_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u13 0,0 >= 450
					and I_UnitDistanceFromPosition a2u13 0,0 < 500
					if I_CompareCounter a2u13_distance != 13
						set_counter a2u13_stuck 0
					end_if
					set_counter a2u13_distance 13
					inc_counter a2u13_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u13 0,0 >= 500
					and I_UnitDistanceFromPosition a2u13 0,0 < 550
					if I_CompareCounter a2u13_distance != 14
						set_counter a2u13_stuck 0
					end_if
					set_counter a2u13_distance 14
					inc_counter a2u13_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u13 0,0 >= 550
					and I_UnitDistanceFromPosition a2u13 0,0 < 600
					if I_CompareCounter a2u13_distance != 15
						set_counter a2u13_stuck 0
					end_if
					set_counter a2u13_distance 15
					inc_counter a2u13_stuck 1
				end_if

				if I_CompareCounter a2u13_stuck = 4
					unit_order_halt a2u13
					unit_set_morale a2u13 wavering
					battle_wait 0.1
					unit_unset_morale a2u13
					release_unit a2u13
					set_counter a2u13_stuck 0
				end_if

			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 13
			and ! I_UnitDestroyed a2u14

			if I_UnitStatus a2u14 moving
				if I_CompareCounter a2u14_status = 0
					set_counter a2u14_status 1
				end_if
				if I_CompareCounter a2u14_status != 1
					set_counter a2u14_status 0
				end_if
			end_if

			if I_UnitStatus a2u14 routing
				if I_CompareCounter a2u14_status = 0
					set_counter a2u14_status 2
				end_if
				if I_CompareCounter a2u14_status != 2
					set_counter a2u14_status 0
				end_if
			end_if

			if ! I_UnitStatus a2u14 moving
				and ! I_UnitStatus a2u14 routing
				set_counter a2u14_status 0
			end_if

			if I_CompareCounter a2u14_status > 0

				if I_UnitDistanceFromPosition a2u14 0,0 >= 150
					and I_UnitDistanceFromPosition a2u14 0,0 < 175
					if I_CompareCounter a2u14_distance != 1
						set_counter a2u14_stuck 0
					end_if
					set_counter a2u14_distance 1
					inc_counter a2u14_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u14 0,0 >= 175
					and I_UnitDistanceFromPosition a2u14 0,0 < 200
					if I_CompareCounter a2u14_distance != 2
						set_counter a2u14_stuck 0
					end_if
					set_counter a2u14_distance 2
					inc_counter a2u14_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u14 0,0 >= 200
					and I_UnitDistanceFromPosition a2u14 0,0 < 225
					if I_CompareCounter a2u14_distance != 3
						set_counter a2u14_stuck 0
					end_if
					set_counter a2u14_distance 3
					inc_counter a2u14_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u14 0,0 >= 225
					and I_UnitDistanceFromPosition a2u14 0,0 < 250
					if I_CompareCounter a2u14_distance != 4
						set_counter a2u14_stuck 0
					end_if
					set_counter a2u14_distance 4
					inc_counter a2u14_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u14 0,0 >= 250
					and I_UnitDistanceFromPosition a2u14 0,0 < 275
					if I_CompareCounter a2u14_distance != 5
						set_counter a2u14_stuck 0
					end_if
					set_counter a2u14_distance 5
					inc_counter a2u14_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u14 0,0 >= 275
					and I_UnitDistanceFromPosition a2u14 0,0 < 300
					if I_CompareCounter a2u14_distance != 6
						set_counter a2u14_stuck 0
					end_if
					set_counter a2u14_distance 6
					inc_counter a2u14_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u14 0,0 >= 300
					and I_UnitDistanceFromPosition a2u14 0,0 < 325
					if I_CompareCounter a2u14_distance != 7
						set_counter a2u14_stuck 0
					end_if
					set_counter a2u14_distance 7
					inc_counter a2u14_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u14 0,0 >= 325
					and I_UnitDistanceFromPosition a2u14 0,0 < 350
					if I_CompareCounter a2u14_distance != 8
						set_counter a2u14_stuck 0
					end_if
					set_counter a2u14_distance 8
					inc_counter a2u14_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u14 0,0 >= 350
					and I_UnitDistanceFromPosition a2u14 0,0 < 375
					if I_CompareCounter a2u14_distance != 9
						set_counter a2u14_stuck 0
					end_if
					set_counter a2u14_distance 9
					inc_counter a2u14_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u14 0,0 >= 375
					and I_UnitDistanceFromPosition a2u14 0,0 < 400
					if I_CompareCounter a2u14_distance != 10
						set_counter a2u14_stuck 0
					end_if
					set_counter a2u14_distance 10
					inc_counter a2u14_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u14 0,0 >= 400
					and I_UnitDistanceFromPosition a2u14 0,0 < 425
					if I_CompareCounter a2u14_distance != 11
						set_counter a2u14_stuck 0
					end_if
					set_counter a2u14_distance 11
					inc_counter a2u14_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u14 0,0 >= 425
					and I_UnitDistanceFromPosition a2u14 0,0 < 450
					if I_CompareCounter a2u14_distance != 12
						set_counter a2u14_stuck 0
					end_if
					set_counter a2u14_distance 12
					inc_counter a2u14_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u14 0,0 >= 450
					and I_UnitDistanceFromPosition a2u14 0,0 < 500
					if I_CompareCounter a2u14_distance != 13
						set_counter a2u14_stuck 0
					end_if
					set_counter a2u14_distance 13
					inc_counter a2u14_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u14 0,0 >= 500
					and I_UnitDistanceFromPosition a2u14 0,0 < 550
					if I_CompareCounter a2u14_distance != 14
						set_counter a2u14_stuck 0
					end_if
					set_counter a2u14_distance 14
					inc_counter a2u14_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u14 0,0 >= 550
					and I_UnitDistanceFromPosition a2u14 0,0 < 600
					if I_CompareCounter a2u14_distance != 15
						set_counter a2u14_stuck 0
					end_if
					set_counter a2u14_distance 15
					inc_counter a2u14_stuck 1
				end_if

				if I_CompareCounter a2u14_stuck = 4
					unit_order_halt a2u14
					unit_set_morale a2u14 wavering
					battle_wait 0.1
					unit_unset_morale a2u14
					release_unit a2u14
					set_counter a2u14_stuck 0
				end_if

			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 14
			and ! I_UnitDestroyed a2u15

			if I_UnitStatus a2u15 moving
				if I_CompareCounter a2u15_status = 0
					set_counter a2u15_status 1
				end_if
				if I_CompareCounter a2u15_status != 1
					set_counter a2u15_status 0
				end_if
			end_if

			if I_UnitStatus a2u15 routing
				if I_CompareCounter a2u15_status = 0
					set_counter a2u15_status 2
				end_if
				if I_CompareCounter a2u15_status != 2
					set_counter a2u15_status 0
				end_if
			end_if

			if ! I_UnitStatus a2u15 moving
				and ! I_UnitStatus a2u15 routing
				set_counter a2u15_status 0
			end_if

			if I_CompareCounter a2u15_status > 0

				if I_UnitDistanceFromPosition a2u15 0,0 >= 150
					and I_UnitDistanceFromPosition a2u15 0,0 < 175
					if I_CompareCounter a2u15_distance != 1
						set_counter a2u15_stuck 0
					end_if
					set_counter a2u15_distance 1
					inc_counter a2u15_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u15 0,0 >= 175
					and I_UnitDistanceFromPosition a2u15 0,0 < 200
					if I_CompareCounter a2u15_distance != 2
						set_counter a2u15_stuck 0
					end_if
					set_counter a2u15_distance 2
					inc_counter a2u15_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u15 0,0 >= 200
					and I_UnitDistanceFromPosition a2u15 0,0 < 225
					if I_CompareCounter a2u15_distance != 3
						set_counter a2u15_stuck 0
					end_if
					set_counter a2u15_distance 3
					inc_counter a2u15_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u15 0,0 >= 225
					and I_UnitDistanceFromPosition a2u15 0,0 < 250
					if I_CompareCounter a2u15_distance != 4
						set_counter a2u15_stuck 0
					end_if
					set_counter a2u15_distance 4
					inc_counter a2u15_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u15 0,0 >= 250
					and I_UnitDistanceFromPosition a2u15 0,0 < 275
					if I_CompareCounter a2u15_distance != 5
						set_counter a2u15_stuck 0
					end_if
					set_counter a2u15_distance 5
					inc_counter a2u15_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u15 0,0 >= 275
					and I_UnitDistanceFromPosition a2u15 0,0 < 300
					if I_CompareCounter a2u15_distance != 6
						set_counter a2u15_stuck 0
					end_if
					set_counter a2u15_distance 6
					inc_counter a2u15_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u15 0,0 >= 300
					and I_UnitDistanceFromPosition a2u15 0,0 < 325
					if I_CompareCounter a2u15_distance != 7
						set_counter a2u15_stuck 0
					end_if
					set_counter a2u15_distance 7
					inc_counter a2u15_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u15 0,0 >= 325
					and I_UnitDistanceFromPosition a2u15 0,0 < 350
					if I_CompareCounter a2u15_distance != 8
						set_counter a2u15_stuck 0
					end_if
					set_counter a2u15_distance 8
					inc_counter a2u15_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u15 0,0 >= 350
					and I_UnitDistanceFromPosition a2u15 0,0 < 375
					if I_CompareCounter a2u15_distance != 9
						set_counter a2u15_stuck 0
					end_if
					set_counter a2u15_distance 9
					inc_counter a2u15_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u15 0,0 >= 375
					and I_UnitDistanceFromPosition a2u15 0,0 < 400
					if I_CompareCounter a2u15_distance != 10
						set_counter a2u15_stuck 0
					end_if
					set_counter a2u15_distance 10
					inc_counter a2u15_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u15 0,0 >= 400
					and I_UnitDistanceFromPosition a2u15 0,0 < 425
					if I_CompareCounter a2u15_distance != 11
						set_counter a2u15_stuck 0
					end_if
					set_counter a2u15_distance 11
					inc_counter a2u15_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u15 0,0 >= 425
					and I_UnitDistanceFromPosition a2u15 0,0 < 450
					if I_CompareCounter a2u15_distance != 12
						set_counter a2u15_stuck 0
					end_if
					set_counter a2u15_distance 12
					inc_counter a2u15_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u15 0,0 >= 450
					and I_UnitDistanceFromPosition a2u15 0,0 < 500
					if I_CompareCounter a2u15_distance != 13
						set_counter a2u15_stuck 0
					end_if
					set_counter a2u15_distance 13
					inc_counter a2u15_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u15 0,0 >= 500
					and I_UnitDistanceFromPosition a2u15 0,0 < 550
					if I_CompareCounter a2u15_distance != 14
						set_counter a2u15_stuck 0
					end_if
					set_counter a2u15_distance 14
					inc_counter a2u15_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u15 0,0 >= 550
					and I_UnitDistanceFromPosition a2u15 0,0 < 600
					if I_CompareCounter a2u15_distance != 15
						set_counter a2u15_stuck 0
					end_if
					set_counter a2u15_distance 15
					inc_counter a2u15_stuck 1
				end_if

				if I_CompareCounter a2u15_stuck = 4
					unit_order_halt a2u15
					unit_set_morale a2u15 wavering
					battle_wait 0.1
					unit_unset_morale a2u15
					release_unit a2u15
					set_counter a2u15_stuck 0
				end_if

			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 15
			and ! I_UnitDestroyed a2u16

			if I_UnitStatus a2u16 moving
				if I_CompareCounter a2u16_status = 0
					set_counter a2u16_status 1
				end_if
				if I_CompareCounter a2u16_status != 1
					set_counter a2u16_status 0
				end_if
			end_if

			if I_UnitStatus a2u16 routing
				if I_CompareCounter a2u16_status = 0
					set_counter a2u16_status 2
				end_if
				if I_CompareCounter a2u16_status != 2
					set_counter a2u16_status 0
				end_if
			end_if

			if ! I_UnitStatus a2u16 moving
				and ! I_UnitStatus a2u16 routing
				set_counter a2u16_status 0
			end_if

			if I_CompareCounter a2u16_status > 0

				if I_UnitDistanceFromPosition a2u16 0,0 >= 150
					and I_UnitDistanceFromPosition a2u16 0,0 < 175
					if I_CompareCounter a2u16_distance != 1
						set_counter a2u16_stuck 0
					end_if
					set_counter a2u16_distance 1
					inc_counter a2u16_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u16 0,0 >= 175
					and I_UnitDistanceFromPosition a2u16 0,0 < 200
					if I_CompareCounter a2u16_distance != 2
						set_counter a2u16_stuck 0
					end_if
					set_counter a2u16_distance 2
					inc_counter a2u16_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u16 0,0 >= 200
					and I_UnitDistanceFromPosition a2u16 0,0 < 225
					if I_CompareCounter a2u16_distance != 3
						set_counter a2u16_stuck 0
					end_if
					set_counter a2u16_distance 3
					inc_counter a2u16_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u16 0,0 >= 225
					and I_UnitDistanceFromPosition a2u16 0,0 < 250
					if I_CompareCounter a2u16_distance != 4
						set_counter a2u16_stuck 0
					end_if
					set_counter a2u16_distance 4
					inc_counter a2u16_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u16 0,0 >= 250
					and I_UnitDistanceFromPosition a2u16 0,0 < 275
					if I_CompareCounter a2u16_distance != 5
						set_counter a2u16_stuck 0
					end_if
					set_counter a2u16_distance 5
					inc_counter a2u16_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u16 0,0 >= 275
					and I_UnitDistanceFromPosition a2u16 0,0 < 300
					if I_CompareCounter a2u16_distance != 6
						set_counter a2u16_stuck 0
					end_if
					set_counter a2u16_distance 6
					inc_counter a2u16_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u16 0,0 >= 300
					and I_UnitDistanceFromPosition a2u16 0,0 < 325
					if I_CompareCounter a2u16_distance != 7
						set_counter a2u16_stuck 0
					end_if
					set_counter a2u16_distance 7
					inc_counter a2u16_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u16 0,0 >= 325
					and I_UnitDistanceFromPosition a2u16 0,0 < 350
					if I_CompareCounter a2u16_distance != 8
						set_counter a2u16_stuck 0
					end_if
					set_counter a2u16_distance 8
					inc_counter a2u16_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u16 0,0 >= 350
					and I_UnitDistanceFromPosition a2u16 0,0 < 375
					if I_CompareCounter a2u16_distance != 9
						set_counter a2u16_stuck 0
					end_if
					set_counter a2u16_distance 9
					inc_counter a2u16_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u16 0,0 >= 375
					and I_UnitDistanceFromPosition a2u16 0,0 < 400
					if I_CompareCounter a2u16_distance != 10
						set_counter a2u16_stuck 0
					end_if
					set_counter a2u16_distance 10
					inc_counter a2u16_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u16 0,0 >= 400
					and I_UnitDistanceFromPosition a2u16 0,0 < 425
					if I_CompareCounter a2u16_distance != 11
						set_counter a2u16_stuck 0
					end_if
					set_counter a2u16_distance 11
					inc_counter a2u16_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u16 0,0 >= 425
					and I_UnitDistanceFromPosition a2u16 0,0 < 450
					if I_CompareCounter a2u16_distance != 12
						set_counter a2u16_stuck 0
					end_if
					set_counter a2u16_distance 12
					inc_counter a2u16_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u16 0,0 >= 450
					and I_UnitDistanceFromPosition a2u16 0,0 < 500
					if I_CompareCounter a2u16_distance != 13
						set_counter a2u16_stuck 0
					end_if
					set_counter a2u16_distance 13
					inc_counter a2u16_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u16 0,0 >= 500
					and I_UnitDistanceFromPosition a2u16 0,0 < 550
					if I_CompareCounter a2u16_distance != 14
						set_counter a2u16_stuck 0
					end_if
					set_counter a2u16_distance 14
					inc_counter a2u16_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u16 0,0 >= 550
					and I_UnitDistanceFromPosition a2u16 0,0 < 600
					if I_CompareCounter a2u16_distance != 15
						set_counter a2u16_stuck 0
					end_if
					set_counter a2u16_distance 15
					inc_counter a2u16_stuck 1
				end_if

				if I_CompareCounter a2u16_stuck = 4
					unit_order_halt a2u16
					unit_set_morale a2u16 wavering
					battle_wait 0.1
					unit_unset_morale a2u16
					release_unit a2u16
					set_counter a2u16_stuck 0
				end_if

			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 16
			and ! I_UnitDestroyed a2u17

			if I_UnitStatus a2u17 moving
				if I_CompareCounter a2u17_status = 0
					set_counter a2u17_status 1
				end_if
				if I_CompareCounter a2u17_status != 1
					set_counter a2u17_status 0
				end_if
			end_if

			if I_UnitStatus a2u17 routing
				if I_CompareCounter a2u17_status = 0
					set_counter a2u17_status 2
				end_if
				if I_CompareCounter a2u17_status != 2
					set_counter a2u17_status 0
				end_if
			end_if

			if ! I_UnitStatus a2u17 moving
				and ! I_UnitStatus a2u17 routing
				set_counter a2u17_status 0
			end_if

			if I_CompareCounter a2u17_status > 0

				if I_UnitDistanceFromPosition a2u17 0,0 >= 150
					and I_UnitDistanceFromPosition a2u17 0,0 < 175
					if I_CompareCounter a2u17_distance != 1
						set_counter a2u17_stuck 0
					end_if
					set_counter a2u17_distance 1
					inc_counter a2u17_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u17 0,0 >= 175
					and I_UnitDistanceFromPosition a2u17 0,0 < 200
					if I_CompareCounter a2u17_distance != 2
						set_counter a2u17_stuck 0
					end_if
					set_counter a2u17_distance 2
					inc_counter a2u17_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u17 0,0 >= 200
					and I_UnitDistanceFromPosition a2u17 0,0 < 225
					if I_CompareCounter a2u17_distance != 3
						set_counter a2u17_stuck 0
					end_if
					set_counter a2u17_distance 3
					inc_counter a2u17_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u17 0,0 >= 225
					and I_UnitDistanceFromPosition a2u17 0,0 < 250
					if I_CompareCounter a2u17_distance != 4
						set_counter a2u17_stuck 0
					end_if
					set_counter a2u17_distance 4
					inc_counter a2u17_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u17 0,0 >= 250
					and I_UnitDistanceFromPosition a2u17 0,0 < 275
					if I_CompareCounter a2u17_distance != 5
						set_counter a2u17_stuck 0
					end_if
					set_counter a2u17_distance 5
					inc_counter a2u17_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u17 0,0 >= 275
					and I_UnitDistanceFromPosition a2u17 0,0 < 300
					if I_CompareCounter a2u17_distance != 6
						set_counter a2u17_stuck 0
					end_if
					set_counter a2u17_distance 6
					inc_counter a2u17_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u17 0,0 >= 300
					and I_UnitDistanceFromPosition a2u17 0,0 < 325
					if I_CompareCounter a2u17_distance != 7
						set_counter a2u17_stuck 0
					end_if
					set_counter a2u17_distance 7
					inc_counter a2u17_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u17 0,0 >= 325
					and I_UnitDistanceFromPosition a2u17 0,0 < 350
					if I_CompareCounter a2u17_distance != 8
						set_counter a2u17_stuck 0
					end_if
					set_counter a2u17_distance 8
					inc_counter a2u17_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u17 0,0 >= 350
					and I_UnitDistanceFromPosition a2u17 0,0 < 375
					if I_CompareCounter a2u17_distance != 9
						set_counter a2u17_stuck 0
					end_if
					set_counter a2u17_distance 9
					inc_counter a2u17_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u17 0,0 >= 375
					and I_UnitDistanceFromPosition a2u17 0,0 < 400
					if I_CompareCounter a2u17_distance != 10
						set_counter a2u17_stuck 0
					end_if
					set_counter a2u17_distance 10
					inc_counter a2u17_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u17 0,0 >= 400
					and I_UnitDistanceFromPosition a2u17 0,0 < 425
					if I_CompareCounter a2u17_distance != 11
						set_counter a2u17_stuck 0
					end_if
					set_counter a2u17_distance 11
					inc_counter a2u17_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u17 0,0 >= 425
					and I_UnitDistanceFromPosition a2u17 0,0 < 450
					if I_CompareCounter a2u17_distance != 12
						set_counter a2u17_stuck 0
					end_if
					set_counter a2u17_distance 12
					inc_counter a2u17_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u17 0,0 >= 450
					and I_UnitDistanceFromPosition a2u17 0,0 < 500
					if I_CompareCounter a2u17_distance != 13
						set_counter a2u17_stuck 0
					end_if
					set_counter a2u17_distance 13
					inc_counter a2u17_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u17 0,0 >= 500
					and I_UnitDistanceFromPosition a2u17 0,0 < 550
					if I_CompareCounter a2u17_distance != 14
						set_counter a2u17_stuck 0
					end_if
					set_counter a2u17_distance 14
					inc_counter a2u17_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u17 0,0 >= 550
					and I_UnitDistanceFromPosition a2u17 0,0 < 600
					if I_CompareCounter a2u17_distance != 15
						set_counter a2u17_stuck 0
					end_if
					set_counter a2u17_distance 15
					inc_counter a2u17_stuck 1
				end_if

				if I_CompareCounter a2u17_stuck = 4
					unit_order_halt a2u17
					unit_set_morale a2u17 wavering
					battle_wait 0.1
					unit_unset_morale a2u17
					release_unit a2u17
					set_counter a2u17_stuck 0
				end_if

			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 17
			and ! I_UnitDestroyed a2u18

			if I_UnitStatus a2u18 moving
				if I_CompareCounter a2u18_status = 0
					set_counter a2u18_status 1
				end_if
				if I_CompareCounter a2u18_status != 1
					set_counter a2u18_status 0
				end_if
			end_if

			if I_UnitStatus a2u18 routing
				if I_CompareCounter a2u18_status = 0
					set_counter a2u18_status 2
				end_if
				if I_CompareCounter a2u18_status != 2
					set_counter a2u18_status 0
				end_if
			end_if

			if ! I_UnitStatus a2u18 moving
				and ! I_UnitStatus a2u18 routing
				set_counter a2u18_status 0
			end_if

			if I_CompareCounter a2u18_status > 0

				if I_UnitDistanceFromPosition a2u18 0,0 >= 150
					and I_UnitDistanceFromPosition a2u18 0,0 < 175
					if I_CompareCounter a2u18_distance != 1
						set_counter a2u18_stuck 0
					end_if
					set_counter a2u18_distance 1
					inc_counter a2u18_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u18 0,0 >= 175
					and I_UnitDistanceFromPosition a2u18 0,0 < 200
					if I_CompareCounter a2u18_distance != 2
						set_counter a2u18_stuck 0
					end_if
					set_counter a2u18_distance 2
					inc_counter a2u18_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u18 0,0 >= 200
					and I_UnitDistanceFromPosition a2u18 0,0 < 225
					if I_CompareCounter a2u18_distance != 3
						set_counter a2u18_stuck 0
					end_if
					set_counter a2u18_distance 3
					inc_counter a2u18_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u18 0,0 >= 225
					and I_UnitDistanceFromPosition a2u18 0,0 < 250
					if I_CompareCounter a2u18_distance != 4
						set_counter a2u18_stuck 0
					end_if
					set_counter a2u18_distance 4
					inc_counter a2u18_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u18 0,0 >= 250
					and I_UnitDistanceFromPosition a2u18 0,0 < 275
					if I_CompareCounter a2u18_distance != 5
						set_counter a2u18_stuck 0
					end_if
					set_counter a2u18_distance 5
					inc_counter a2u18_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u18 0,0 >= 275
					and I_UnitDistanceFromPosition a2u18 0,0 < 300
					if I_CompareCounter a2u18_distance != 6
						set_counter a2u18_stuck 0
					end_if
					set_counter a2u18_distance 6
					inc_counter a2u18_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u18 0,0 >= 300
					and I_UnitDistanceFromPosition a2u18 0,0 < 325
					if I_CompareCounter a2u18_distance != 7
						set_counter a2u18_stuck 0
					end_if
					set_counter a2u18_distance 7
					inc_counter a2u18_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u18 0,0 >= 325
					and I_UnitDistanceFromPosition a2u18 0,0 < 350
					if I_CompareCounter a2u18_distance != 8
						set_counter a2u18_stuck 0
					end_if
					set_counter a2u18_distance 8
					inc_counter a2u18_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u18 0,0 >= 350
					and I_UnitDistanceFromPosition a2u18 0,0 < 375
					if I_CompareCounter a2u18_distance != 9
						set_counter a2u18_stuck 0
					end_if
					set_counter a2u18_distance 9
					inc_counter a2u18_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u18 0,0 >= 375
					and I_UnitDistanceFromPosition a2u18 0,0 < 400
					if I_CompareCounter a2u18_distance != 10
						set_counter a2u18_stuck 0
					end_if
					set_counter a2u18_distance 10
					inc_counter a2u18_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u18 0,0 >= 400
					and I_UnitDistanceFromPosition a2u18 0,0 < 425
					if I_CompareCounter a2u18_distance != 11
						set_counter a2u18_stuck 0
					end_if
					set_counter a2u18_distance 11
					inc_counter a2u18_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u18 0,0 >= 425
					and I_UnitDistanceFromPosition a2u18 0,0 < 450
					if I_CompareCounter a2u18_distance != 12
						set_counter a2u18_stuck 0
					end_if
					set_counter a2u18_distance 12
					inc_counter a2u18_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u18 0,0 >= 450
					and I_UnitDistanceFromPosition a2u18 0,0 < 500
					if I_CompareCounter a2u18_distance != 13
						set_counter a2u18_stuck 0
					end_if
					set_counter a2u18_distance 13
					inc_counter a2u18_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u18 0,0 >= 500
					and I_UnitDistanceFromPosition a2u18 0,0 < 550
					if I_CompareCounter a2u18_distance != 14
						set_counter a2u18_stuck 0
					end_if
					set_counter a2u18_distance 14
					inc_counter a2u18_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u18 0,0 >= 550
					and I_UnitDistanceFromPosition a2u18 0,0 < 600
					if I_CompareCounter a2u18_distance != 15
						set_counter a2u18_stuck 0
					end_if
					set_counter a2u18_distance 15
					inc_counter a2u18_stuck 1
				end_if

				if I_CompareCounter a2u18_stuck = 4
					unit_order_halt a2u18
					unit_set_morale a2u18 wavering
					battle_wait 0.1
					unit_unset_morale a2u18
					release_unit a2u18
					set_counter a2u18_stuck 0
				end_if

			end_if
		end_if

		if I_CompareCounter enemy_unit_count > 18
			and ! I_UnitDestroyed a2u19

			if I_UnitStatus a2u19 moving
				if I_CompareCounter a2u19_status = 0
					set_counter a2u19_status 1
				end_if
				if I_CompareCounter a2u19_status != 1
					set_counter a2u19_status 0
				end_if
			end_if

			if I_UnitStatus a2u19 routing
				if I_CompareCounter a2u19_status = 0
					set_counter a2u19_status 2
				end_if
				if I_CompareCounter a2u19_status != 2
					set_counter a2u19_status 0
				end_if
			end_if

			if ! I_UnitStatus a2u19 moving
				and ! I_UnitStatus a2u19 routing
				set_counter a2u19_status 0
			end_if

			if I_CompareCounter a2u19_status > 0

				if I_UnitDistanceFromPosition a2u19 0,0 >= 150
					and I_UnitDistanceFromPosition a2u19 0,0 < 175
					if I_CompareCounter a2u19_distance != 1
						set_counter a2u19_stuck 0
					end_if
					set_counter a2u19_distance 1
					inc_counter a2u19_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u19 0,0 >= 175
					and I_UnitDistanceFromPosition a2u19 0,0 < 200
					if I_CompareCounter a2u19_distance != 2
						set_counter a2u19_stuck 0
					end_if
					set_counter a2u19_distance 2
					inc_counter a2u19_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u19 0,0 >= 200
					and I_UnitDistanceFromPosition a2u19 0,0 < 225
					if I_CompareCounter a2u19_distance != 3
						set_counter a2u19_stuck 0
					end_if
					set_counter a2u19_distance 3
					inc_counter a2u19_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u19 0,0 >= 225
					and I_UnitDistanceFromPosition a2u19 0,0 < 250
					if I_CompareCounter a2u19_distance != 4
						set_counter a2u19_stuck 0
					end_if
					set_counter a2u19_distance 4
					inc_counter a2u19_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u19 0,0 >= 250
					and I_UnitDistanceFromPosition a2u19 0,0 < 275
					if I_CompareCounter a2u19_distance != 5
						set_counter a2u19_stuck 0
					end_if
					set_counter a2u19_distance 5
					inc_counter a2u19_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u19 0,0 >= 275
					and I_UnitDistanceFromPosition a2u19 0,0 < 300
					if I_CompareCounter a2u19_distance != 6
						set_counter a2u19_stuck 0
					end_if
					set_counter a2u19_distance 6
					inc_counter a2u19_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u19 0,0 >= 300
					and I_UnitDistanceFromPosition a2u19 0,0 < 325
					if I_CompareCounter a2u19_distance != 7
						set_counter a2u19_stuck 0
					end_if
					set_counter a2u19_distance 7
					inc_counter a2u19_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u19 0,0 >= 325
					and I_UnitDistanceFromPosition a2u19 0,0 < 350
					if I_CompareCounter a2u19_distance != 8
						set_counter a2u19_stuck 0
					end_if
					set_counter a2u19_distance 8
					inc_counter a2u19_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u19 0,0 >= 350
					and I_UnitDistanceFromPosition a2u19 0,0 < 375
					if I_CompareCounter a2u19_distance != 9
						set_counter a2u19_stuck 0
					end_if
					set_counter a2u19_distance 9
					inc_counter a2u19_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u19 0,0 >= 375
					and I_UnitDistanceFromPosition a2u19 0,0 < 400
					if I_CompareCounter a2u19_distance != 10
						set_counter a2u19_stuck 0
					end_if
					set_counter a2u19_distance 10
					inc_counter a2u19_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u19 0,0 >= 400
					and I_UnitDistanceFromPosition a2u19 0,0 < 425
					if I_CompareCounter a2u19_distance != 11
						set_counter a2u19_stuck 0
					end_if
					set_counter a2u19_distance 11
					inc_counter a2u19_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u19 0,0 >= 425
					and I_UnitDistanceFromPosition a2u19 0,0 < 450
					if I_CompareCounter a2u19_distance != 12
						set_counter a2u19_stuck 0
					end_if
					set_counter a2u19_distance 12
					inc_counter a2u19_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u19 0,0 >= 450
					and I_UnitDistanceFromPosition a2u19 0,0 < 500
					if I_CompareCounter a2u19_distance != 13
						set_counter a2u19_stuck 0
					end_if
					set_counter a2u19_distance 13
					inc_counter a2u19_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u19 0,0 >= 500
					and I_UnitDistanceFromPosition a2u19 0,0 < 550
					if I_CompareCounter a2u19_distance != 14
						set_counter a2u19_stuck 0
					end_if
					set_counter a2u19_distance 14
					inc_counter a2u19_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u19 0,0 >= 550
					and I_UnitDistanceFromPosition a2u19 0,0 < 600
					if I_CompareCounter a2u19_distance != 15
						set_counter a2u19_stuck 0
					end_if
					set_counter a2u19_distance 15
					inc_counter a2u19_stuck 1
				end_if

				if I_CompareCounter a2u19_stuck = 4
					unit_order_halt a2u19
					unit_set_morale a2u19 wavering
					battle_wait 0.1
					unit_unset_morale a2u19
					release_unit a2u19
					set_counter a2u19_stuck 0
				end_if

			end_if
		end_if

		if I_CompareCounter enemy_unit_count = 20
			and ! I_UnitDestroyed a2u20

			if I_UnitStatus a2u20 moving
				if I_CompareCounter a2u20_status = 0
					set_counter a2u20_status 1
				end_if
				if I_CompareCounter a2u20_status != 1
					set_counter a2u20_status 0
				end_if
			end_if

			if I_UnitStatus a2u20 routing
				if I_CompareCounter a2u20_status = 0
					set_counter a2u20_status 2
				end_if
				if I_CompareCounter a2u20_status != 2
					set_counter a2u20_status 0
				end_if
			end_if

			if ! I_UnitStatus a2u20 moving
				and ! I_UnitStatus a2u20 routing
				set_counter a2u20_status 0
			end_if

			if I_CompareCounter a2u20_status > 0

				if I_UnitDistanceFromPosition a2u20 0,0 >= 150
					and I_UnitDistanceFromPosition a2u20 0,0 < 175
					if I_CompareCounter a2u20_distance != 1
						set_counter a2u20_stuck 0
					end_if
					set_counter a2u20_distance 1
					inc_counter a2u20_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u20 0,0 >= 175
					and I_UnitDistanceFromPosition a2u20 0,0 < 200
					if I_CompareCounter a2u20_distance != 2
						set_counter a2u20_stuck 0
					end_if
					set_counter a2u20_distance 2
					inc_counter a2u20_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u20 0,0 >= 200
					and I_UnitDistanceFromPosition a2u20 0,0 < 225
					if I_CompareCounter a2u20_distance != 3
						set_counter a2u20_stuck 0
					end_if
					set_counter a2u20_distance 3
					inc_counter a2u20_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u20 0,0 >= 225
					and I_UnitDistanceFromPosition a2u20 0,0 < 250
					if I_CompareCounter a2u20_distance != 4
						set_counter a2u20_stuck 0
					end_if
					set_counter a2u20_distance 4
					inc_counter a2u20_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u20 0,0 >= 250
					and I_UnitDistanceFromPosition a2u20 0,0 < 275
					if I_CompareCounter a2u20_distance != 5
						set_counter a2u20_stuck 0
					end_if
					set_counter a2u20_distance 5
					inc_counter a2u20_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u20 0,0 >= 275
					and I_UnitDistanceFromPosition a2u20 0,0 < 300
					if I_CompareCounter a2u20_distance != 6
						set_counter a2u20_stuck 0
					end_if
					set_counter a2u20_distance 6
					inc_counter a2u20_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u20 0,0 >= 300
					and I_UnitDistanceFromPosition a2u20 0,0 < 325
					if I_CompareCounter a2u20_distance != 7
						set_counter a2u20_stuck 0
					end_if
					set_counter a2u20_distance 7
					inc_counter a2u20_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u20 0,0 >= 325
					and I_UnitDistanceFromPosition a2u20 0,0 < 350
					if I_CompareCounter a2u20_distance != 8
						set_counter a2u20_stuck 0
					end_if
					set_counter a2u20_distance 8
					inc_counter a2u20_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u20 0,0 >= 350
					and I_UnitDistanceFromPosition a2u20 0,0 < 375
					if I_CompareCounter a2u20_distance != 9
						set_counter a2u20_stuck 0
					end_if
					set_counter a2u20_distance 9
					inc_counter a2u20_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u20 0,0 >= 375
					and I_UnitDistanceFromPosition a2u20 0,0 < 400
					if I_CompareCounter a2u20_distance != 10
						set_counter a2u20_stuck 0
					end_if
					set_counter a2u20_distance 10
					inc_counter a2u20_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u20 0,0 >= 400
					and I_UnitDistanceFromPosition a2u20 0,0 < 425
					if I_CompareCounter a2u20_distance != 11
						set_counter a2u20_stuck 0
					end_if
					set_counter a2u20_distance 11
					inc_counter a2u20_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u20 0,0 >= 425
					and I_UnitDistanceFromPosition a2u20 0,0 < 450
					if I_CompareCounter a2u20_distance != 12
						set_counter a2u20_stuck 0
					end_if
					set_counter a2u20_distance 12
					inc_counter a2u20_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u20 0,0 >= 450
					and I_UnitDistanceFromPosition a2u20 0,0 < 500
					if I_CompareCounter a2u20_distance != 13
						set_counter a2u20_stuck 0
					end_if
					set_counter a2u20_distance 13
					inc_counter a2u20_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u20 0,0 >= 500
					and I_UnitDistanceFromPosition a2u20 0,0 < 550
					if I_CompareCounter a2u20_distance != 14
						set_counter a2u20_stuck 0
					end_if
					set_counter a2u20_distance 14
					inc_counter a2u20_stuck 1
				end_if

				if I_UnitDistanceFromPosition a2u20 0,0 >= 550
					and I_UnitDistanceFromPosition a2u20 0,0 < 600
					if I_CompareCounter a2u20_distance != 15
						set_counter a2u20_stuck 0
					end_if
					set_counter a2u20_distance 15
					inc_counter a2u20_stuck 1
				end_if

				if I_CompareCounter a2u20_stuck = 4
					unit_order_halt a2u20
					unit_set_morale a2u20 wavering
					battle_wait 0.1
					unit_unset_morale a2u20
					release_unit a2u20
					set_counter a2u20_stuck 0
				end_if

			end_if
		end_if

		battle_wait 10
	end_monitor

	;;;;;;;Anti-CTD
	monitor_event BattleDeploymentPhaseCommenced FactionIsLocal
		wait 0.5
		simulate_mouse_click lclick_down
		simulate_mouse_click lclick_up
	end_monitor

	;################## Cleaning up ##################

	monitor_event ScrollOpened ScrollOpened post_battle_scroll

		;;;;;;;
		set_counter fire_labels 0
		;    set_counter panel_check 0
		set_counter player_unit_count 0
		set_counter enemy_unit_count 0
		set_counter open_battle 0
		set_counter labels_only 0
		set_counter stakes_lock 0
		;;;;;;;
		set_counter pu1_missile 0
		set_counter pu2_missile 0
		set_counter pu3_missile 0
		set_counter pu4_missile 0
		set_counter pu5_missile 0
		set_counter pu6_missile 0
		set_counter pu7_missile 0
		set_counter pu8_missile 0
		set_counter pu9_missile 0
		set_counter pu10_missile 0
		set_counter pu11_missile 0
		set_counter pu12_missile 0
		set_counter pu13_missile 0
		set_counter pu14_missile 0
		set_counter pu15_missile 0
		set_counter pu16_missile 0
		set_counter pu17_missile 0
		set_counter pu18_missile 0
		set_counter pu19_missile 0
		set_counter pu20_missile 0
		;;;;;;;Checks
		set_counter check_timer 0
		set_counter elephant_fix_check 0
		set_counter elephant_fix_check_sally 0
		set_counter reinf_check 0
		set_counter script_delay 0
		set_counter sally_defense_check 0
		set_counter sally_check 0
		;;;;;;;Stakes
		set_counter label_ready 0
		set_counter stakes_on 0
		;;;;;;;Reinforcements
		set_counter army4_ready 0
		set_counter reinf_late 0

		set_counter distance_trigger1 0
		set_counter distance_trigger2 0
		set_counter distance_trigger3 0
		set_counter distance_trigger4 0
		set_counter distance_trigger5 0

		set_counter kill_labelling_reinf_allied 0
		set_counter army3_reinf_allied 0
		set_counter army4_reinf_allied 0
		set_counter army5_reinf_allied 0
		set_counter army6_reinf_allied 0
		set_counter army7_reinf_allied 0
		set_counter army8_reinf_allied 0
		set_counter army9_reinf_allied 0
		set_counter army10_reinf_allied 0
		set_counter army11_reinf_allied 0
		set_counter army12_reinf_allied 0
		set_counter army13_reinf_allied 0
		set_counter army14_reinf_allied 0
		set_counter army15_reinf_allied 0
		set_counter army16_reinf_allied 0
		set_counter launch_alliance_0 0
		set_counter launch_alliance_1 0

		set_counter apply_strategy 0
		set_counter relaunch_movement 0

		set_counter att_alliance_ready 0
		set_counter def_alliance_ready 0
		set_counter def_alliance_ready_siege 0

		set_counter army3_moving 0
		set_counter army3_run 0
		set_counter army3_reinf_late 0
		set_counter army4_moving 0
		set_counter army4_run 0
		set_counter army4_reinf_late 0
		set_counter army5_moving 0
		set_counter army5_run 0
		set_counter army5_reinf_late 0
		set_counter army6_moving 0
		set_counter army6_run 0
		set_counter army6_reinf_late 0
		set_counter army7_moving 0
		set_counter army7_run 0
		set_counter army7_reinf_late 0
		set_counter army8_moving 0
		set_counter army8_run 0
		set_counter army8_reinf_late 0
		set_counter army9_moving 0
		set_counter army9_run 0
		set_counter army9_reinf_late 0
		set_counter army10_moving 0
		set_counter army10_run 0
		set_counter army10_reinf_late 0
		set_counter army11_moving 0
		set_counter army11_run 0
		set_counter army11_reinf_late 0
		set_counter army12_moving 0
		set_counter army12_run 0
		set_counter army12_reinf_late 0
		set_counter army13_moving 0
		set_counter army13_run 0
		set_counter army13_reinf_late 0
		set_counter army14_moving 0
		set_counter army14_run 0
		set_counter army14_reinf_late 0
		set_counter army15_moving 0
		set_counter army15_run 0
		set_counter army15_reinf_late 0
		set_counter army16_moving 0
		set_counter army16_run 0
		set_counter army16_reinf_late 0

		set_counter army4_ready_siege 0 ; acts as launching counter
		set_counter army4_moving_siege 0
		set_counter army4_run_siege 0
		set_counter reinf_check_interval 0

		;;;;;;;HA Fix
		set_counter ha_fix 0
		;;;;;;;Elephant Fix
		set_counter elephant_fix 0
		set_counter elephant_gate 0
		set_counter elephant_gate_s 0
		set_counter elephant_gate_tier2 0
		set_counter elephant_gate_tier3 0
		set_counter elephant_gate_tier2s 0
		set_counter elephant_gate_tier3s 0
		set_counter rally_walls 0
		set_counter rally_walls_s 0
		set_counter second_ring 0
		set_counter third_ring 0
		set_counter second_ring_s 0
		set_counter third_ring_s 0
		set_counter del_objective 0
		set_counter del_objective_s 0
		;;;;;;;Sally-out
		set_counter sally-out_fix 0
		set_counter sally_defense 0
		set_counter reform_back 0
		set_counter reform_multi 0
		set_counter unit_under_fire 0
		set_counter kill_sally 0
		set_counter sally_reinf 0
		set_counter reset_position 0
		set_counter defend_location 0
		set_counter reset_army2 0
		set_counter assign_labels 0
		;;;;;;;Siege
		set_counter siege_fix 0
		set_counter army_sieging 0
		set_counter army_south 0
		set_counter army_north 0
		set_counter army_east 0
		set_counter army_west 0
		set_counter emergency_stop 0
		set_counter omfg_cannon_tower 0
		set_counter army2_sally 0
		set_counter wall_advance_s 0
		;;;;;;;Protect General
		set_counter protect_general 0
		set_counter general_wait 0
		set_counter protect_siege 0
		set_counter g_stop 0
		;;;;;;;Sally-out, AI defending
		set_counter army4_ready_sally 0
		set_counter army4_location 0
		set_counter path_n 0
		set_counter path_ne 0
		set_counter path_e 0
		set_counter path_se 0
		set_counter path_s 0
		set_counter path_sw 0
		set_counter path_w 0
		set_counter path_nw 0
		set_counter obstacle_check 0
		set_counter label_army4 0
		set_counter army4_moving_s 0
		set_counter army4_idle_s 0
		set_counter line_passed 0
		set_counter army2_idle_s 0
		set_counter army4_idle_r 0
		set_counter wall_line_passed 0
		set_counter reset_position_s 0
		set_counter repeat_test1 0
		set_counter repeat_test2 0
		set_counter repeat_test3 0
		set_counter repeat_test4 0
		set_counter repeat_test5 0
		set_counter repeat_test6 0
		;;;;;;;Open Battles
		set_counter ob_defense_launch 0
		set_counter ob_defend 0
		set_counter ob_siege_attack 0
		set_counter ob_under_fire 0
		set_counter ob_repeat_test 0
		set_counter ob_engaged 0
		set_counter player_units_closing 0
		set_counter player_enveloping 0
		set_counter player_engaged_reinf 0
		;;;;;;;AI Stuck Fix
		set_counter ai_stuck_launch 0
		set_counter a2u1_stuck 0
		set_counter a2u2_stuck 0
		set_counter a2u3_stuck 0
		set_counter a2u4_stuck 0
		set_counter a2u5_stuck 0
		set_counter a2u6_stuck 0
		set_counter a2u7_stuck 0
		set_counter a2u8_stuck 0
		set_counter a2u9_stuck 0
		set_counter a2u10_stuck 0
		set_counter a2u11_stuck 0
		set_counter a2u12_stuck 0
		set_counter a2u13_stuck 0
		set_counter a2u14_stuck 0
		set_counter a2u15_stuck 0
		set_counter a2u16_stuck 0
		set_counter a2u17_stuck 0
		set_counter a2u18_stuck 0
		set_counter a2u19_stuck 0
		set_counter a2u20_stuck 0
		set_counter a2u1_status 0
		set_counter a2u2_status 0
		set_counter a2u3_status 0
		set_counter a2u4_status 0
		set_counter a2u5_status 0
		set_counter a2u6_status 0
		set_counter a2u7_status 0
		set_counter a2u8_status 0
		set_counter a2u9_status 0
		set_counter a2u10_status 0
		set_counter a2u11_status 0
		set_counter a2u12_status 0
		set_counter a2u13_status 0
		set_counter a2u14_status 0
		set_counter a2u15_status 0
		set_counter a2u16_status 0
		set_counter a2u17_status 0
		set_counter a2u18_status 0
		set_counter a2u19_status 0
		set_counter a2u20_status 0
		set_counter a2u1_distance 0
		set_counter a2u2_distance 0
		set_counter a2u3_distance 0
		set_counter a2u4_distance 0
		set_counter a2u5_distance 0
		set_counter a2u6_distance 0
		set_counter a2u7_distance 0
		set_counter a2u8_distance 0
		set_counter a2u9_distance 0
		set_counter a2u10_distance 0
		set_counter a2u11_distance 0
		set_counter a2u12_distance 0
		set_counter a2u13_distance 0
		set_counter a2u14_distance 0
		set_counter a2u15_distance 0
		set_counter a2u16_distance 0
		set_counter a2u17_distance 0
		set_counter a2u18_distance 0
		set_counter a2u19_distance 0
		set_counter a2u20_distance 0
		;    suspend_unscripted_advice false
	end_monitor

	;=======================================================;
	;================= ADDITIONAL SCRIPTS ==================;
	;=======================================================;

   

	wait_monitors
end_script