///////////////////////////////////////////////////////////////////////////////
//	Land 10 Aztec-Strategy
//	~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
//	Start date:			18.08.16			By:	Boxhead
//	Update date:		17.02.17			By: Boxhead
///////////////////////////////////////////////////////////////////////////////

//ToDo:
//Outro
//Testing
//Maybe General Speeches

global PlannedWall[10]
global WallCounter = 0

global PlannedWall2[10]
global WallCounter2 = 0

global AIHurricane = 0

define script Land10Hurricane(AIHurricane, EpicHurr)
define script Land10BodgingInTheBackground(Hurricane)

begin script LC10_Aztec_Capital_Impressiveness

start

	enable town AztecFirstTown impressiveness override amount 49413
	enable town MinorTown impressiveness override amount 11019
	enable town AztecCapital impressiveness override amount 62013
	enable town AztecPreTown impressiveness override amount 30613

	set migration threshold from AztecFirstTown to PlayerTown 1.0
	set migration threshold from MinorTown to PlayerTown 1.0
	set migration threshold from AztecCapital to PlayerTown 1.0
	set migration threshold from AztecPreTown to PlayerTown 1.0
	
	disable migration from AztecPrison to AztecFirstTown
	disable migration from DisbelieverTown to AztecFirstTown
	disable migration from AztecCapital to AztecFirstTown
	disable migration from MinorTown to AztecFirstTown
	disable migration from AztecPreTown to AztecFirstTown
	
	disable migration from AztecFirstTown to AztecPrison
	disable migration from DisbelieverTown to AztecPrison
	disable migration from AztecCapital to AztecPrison
	disable migration from MinorTown to AztecPrison
	disable migration from AztecPreTown to AztecPrison
	
	disable migration from AztecFirstTown to AztecPreTown
	disable migration from DisbelieverTown to AztecPreTown
	disable migration from AztecCapital to AztecPreTown
	disable migration from MinorTown to AztecPreTown
	disable migration from AztecPrison to AztecPreTown
	
	disable migration from AztecPrison to PlayerTown

begin loop

	if PLAYER of AztecFirstTown == 0
		disable town  AztecFirstTown impressiveness override amount 49413
		set migration threshold from AztecFirstTown to PlayerTown 0.0
		enable migration from AztecCapital to AztecFirstTown
		enable migration from AztecPreTown to AztecFirstTown
		enable migration from MinorTown to AztecFirstTown
		
	elsif PLAYER of AztecFirstTown >= 1
		enable town AztecFirstTown impressiveness override amount 49413
		set migration threshold from AztecFirstTown to PlayerTown 1.0
		disable migration from AztecCapital to AztecFirstTown
		disable migration from AztecPreTown to AztecFirstTown
		disable migration from MinorTown to AztecFirstTown

	end if
	
	if PLAYER of MinorTown == 0
		disable town  MinorTown impressiveness override amount 11019
		set migration threshold from MinorTown to PlayerTown 0.0
		enable migration from AztecCapital to MinorTown
		enable migration from AztecPreTown to MinorTown
		enable migration from AztecFirstTown to MinorTown
		
	elsif PLAYER of MinorTown >= 1
		enable town MinorTown impressiveness override amount 11019
		set migration threshold from MinorTown to PlayerTown 1.0
		disable migration from AztecCapital to MinorTown
		disable migration from AztecPreTown to MinorTown
		disable migration from AztecFirstTown to MinorTown
	end if
	
	if PLAYER of AztecCapital == 0
		disable town  AztecCapital impressiveness override amount 62013
		set migration threshold from AztecCapital to PlayerTown 0.0
		enable migration from MinorTown to AztecCapital
		enable migration from AztecPreTown to AztecCapital
		enable migration from AztecFirstTown to AztecCapital
		
	elsif PLAYER of AztecCapital >= 1
		enable town AztecCapital impressiveness override amount 62013
		set migration threshold from AztecCapital to PlayerTown 1.0
		disable migration from MinorTown to AztecCapital
		disable migration from AztecPreTown to AztecCapital
		disable migration from AztecFirstTown to AztecCapital
		
	end if
	
	if PLAYER of AztecPreTown == 0
		disable town  AztecPreTown impressiveness override amount 30613
		set migration threshold from AztecPreTown to PlayerTown 0.0
		enable migration from MinorTown to AztecPreTown
		enable migration from AztecCapital to AztecPreTown
		enable migration from AztecFirstTown to AztecPreTown
		
	elsif PLAYER of AztecPreTown >= 1
		enable town AztecPreTown impressiveness override amount 30613
		set migration threshold from AztecPreTown to PlayerTown 1.0
		disable migration from MinorTown to AztecPreTown
		disable migration from AztecCapital to AztecPreTown
		disable migration from AztecFirstTown to AztecPreTown
		
	end if

end loop
	
end script LC10_Aztec_Capital_Impressiveness

begin script TownConversion

	isConverted1 = 0
	isConverted2 = 0
	isConverted3 = 0
	isConverted4 = 0
	a = 0
	b = 0
	c = 0
	d = 0
	//testp[10]
	
start

//testp[1] = create platoon PLATOON_INFO_GREEK_MELEE_9 at {PlayerTown} with 100 men and 0 women 
//testp[2] = create platoon PLATOON_INFO_GREEK_MELEE_9 at {PlayerTown} with 100 men and 0 women 
//testp[3] = create platoon PLATOON_INFO_GREEK_MELEE_9 at {PlayerTown} with 100 men and 0 women 
//testp[4] = create platoon PLATOON_INFO_GREEK_RANGED_9 at {PlayerTown} with 100 men and 0 women 
//testp[5] = create platoon PLATOON_INFO_GREEK_RANGED_9 at {PlayerTown} with 100 men and 0 women 
//testp[6] = create platoon PLATOON_INFO_GREEK_RANGED_9 at {PlayerTown} with 100 men and 0 women 
//attach testp[1] to PlayerTown
//attach testp[2] to PlayerTown
//attach testp[3] to PlayerTown
//attach testp[4] to PlayerTown
//attach testp[5] to PlayerTown
//attach testp[6] to PlayerTown
//testp[7] = create siege weapon SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_9 belonging to PlayerTown at {PlayerTown}
//testp[8] = create siege weapon SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_9 belonging to PlayerTown at {PlayerTown}
//testp[9] = create siege weapon SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_9 belonging to PlayerTown at {PlayerTown}

begin loop

	isConverted1 = variable get town MinorTown method of last conversion
	isConverted2 = variable get town AztecFirstTown method of last conversion
	isConverted3 = variable get town AztecCapital method of last conversion
	isConverted4 = variable get town AztecPreTown method of last conversion

	if isConverted1 != 0 and a == 0
		a = 1
		TownsConverted = TownsConverted + 1
	end if
	
	if isConverted2 != 0 and b == 0
		b = 1
		TownsConverted = TownsConverted + 1
	end if
	
	if isConverted3 != 0 and c == 0
		c = 1
		TownsConverted = TownsConverted + 1
	end if
	
	if isConverted4 != 0 and d == 0
		d = 1
		TownsConverted = TownsConverted + 1
	end if
	
end loop

end script TownConversion

begin script Tribute

	mig1 = 0
	mig2 = 0
	mig3 = 0
	mig4 = 0
	a = 0

start

begin loop

	if (variable get town MinorTown status == variable MIGRATION_MIGRATED) and mig1 == 0
		mig1 = 1
		MigrationsAccepted = MigrationsAccepted + 1
	end if
	
	if (variable get town AztecFirstTown status == variable MIGRATION_MIGRATED) and mig2 == 0
		mig2 = 1
		MigrationsAccepted = MigrationsAccepted + 1
	end if
	
	if (variable get town AztecPreTown status == variable MIGRATION_MIGRATED) and mig3 == 0
		mig3 = 1
		MigrationsAccepted = MigrationsAccepted + 1
	end if
	
	if (variable get town AztecCapital status == variable MIGRATION_MIGRATED) and mig4 == 0
		mig4 = 1
		MigrationsAccepted = MigrationsAccepted + 1
	end if

	if MigrationsAccepted >= 1 and a == 0
		a = 1
		increment tribute by 10000
	end if
	
	if MigrationsAccepted >= 2 and a == 1
		a = 2
		increment tribute by 15000
	end if
	
	if MigrationsAccepted >= 3 and a == 2
		a = 3
		increment tribute by 20000
	end if
	
	if MigrationsAccepted >= 4 and a == 3
		a = 4
		increment tribute by 30000
	end if
	
end loop
	
end script Tribute

begin script LC10_Aztec_Capital//Controls most troop recruitment and some other stuff

	PlannedWallPos[10]
	PlannedWallPos2[10]
	WallTimer1 = create timer for 320 seconds//320
	WallTimer2 = create timer for 545 seconds//545
	RecruitTimer1 = 0
	RecruitTimer2 = 0
	RecruitTimer3 = 0
	WarTimer = create timer for 99999 seconds
	PrisonEvent = 0
	Test = 0
	WarStarted = 0
	DefendRecruitTimer = 0
	Player1Impressiveness = 0
	ScriptedAttackTimer = create timer for 99999 seconds
	Attacker2Sent = 0
	ACSentCatapult = 0
	EpicHurr = 0
	Number = 0
	EpicTarget = 0
	EmergencyIsActive = 0
	HurricaneHasBeenShot = 0
	VolcanoHasBeenActivated1 = 0
	VolcanoHasBeenActivated2 = 0
	AztecTroopsSending = 0
	AztecPreTownAttackSent = 0
	AztecFirstTownAttackSent = 0
	Wall[9]
	StaticSiegePos[13]

start

	extend town AztecCapital influence by 40
	extend town AztecPreTown influence by 40
	extend town AztecFirstTown influence by 40

	run background script AztecCapitalTownBuilding

	PlannedWallPos[1] = marker at {1631.634, 218.797, 854.781}
	PlannedWallPos[2] = marker at {1654.253, 222.502, 852.583}
	PlannedWallPos[3] = marker at {1676.061, 210.940, 861.867}
	PlannedWallPos[4] = marker at {1753.088, 205.188, 908.964}
	PlannedWallPos[5] = marker at {1780.836, 205.162, 937.467}
	PlannedWallPos[6] = marker at {1790.219, 207.804, 962.287}
	PlannedWallPos[7] = marker at {1785.644, 221.515, 1139.140}
	PlannedWallPos[8] = marker at {1780.796, 212.335, 1174.270}
	PlannedWallPos[9] = marker at {1718.335, 215.632, 1238.300}
	
	PlannedWallPos2[1] = marker at {924.07,390.79,1634.87}
	PlannedWallPos2[2] = marker at {925.38,393.41,1728.04}
	PlannedWallPos2[3] = marker at {910.61,393.32,1783.58}
	PlannedWallPos2[4] = marker at {867.16,402.08,17891.93}
	PlannedWallPos2[5] = marker at {850.05,402.18,1768.34}
	PlannedWallPos2[6] = marker at {807.16,402.72,1718.91}
	PlannedWallPos2[7] = marker at {781.44,404.49,1704.83}
	PlannedWallPos2[8] = marker at {741.94,408.82,1703.64}
	PlannedWallPos2[9] = marker at {871.18,403.96,1800.36}
	PlannedWallPos2[10] = marker at {725.73,417.73,1703.89}
	
	StaticSiegePos[1] = marker at {1598.89,253.92,878.22}
	StaticSiegePos[2] = marker at {1589.34,235.63,963.80}
	StaticSiegePos[3] = marker at {1747.82,235.79,966.97}
	StaticSiegePos[4] = marker at {1715.63,227.47,992.16}
	StaticSiegePos[5] = marker at {1687.79,240.78,1241.15}
	StaticSiegePos[6] = marker at {1467.34,246.59,1378.96}
	StaticSiegePos[7] = marker at {1427.82,251.78,1432.06}
	StaticSiegePos[8] = marker at {1561.52,258.75,1463.64}
	StaticSiegePos[9] = marker at {1468.27,256.03,1553.85}
	StaticSiegePos[10] = marker at {1322.96,268.58,1631.18}
	StaticSiegePos[11] = marker at {636.87,452.78,1838.70}
	StaticSiegePos[12] = marker at {573.72,482.50,1904.44}
	StaticSiegePos[13] = marker at {545.91,482.50,1843.20}

	//----Create prison platoons----//
	
	LC10_PrisonGuard[0] = create platoon PLATOON_INFO_AZTEC_MELEE_3 at {PrisonPos[0]} with 10 men and 0 women
	attach LC10_PrisonGuard[0] to AztecCapital
	PLAYER of LC10_PrisonGuard[0] = 1
	disable platoon LC10_PrisonGuard[0] camp
	run background script LC10_PrisonGuard0Actions
	
	LC10_PrisonGuard[1] = create platoon PLATOON_INFO_AZTEC_MELEE_3 at {PrisonPos[1]} with 20 men and 0 women
	attach LC10_PrisonGuard[1] to AztecCapital
	PLAYER of LC10_PrisonGuard[1] = 1
	disable platoon LC10_PrisonGuard[1] camp
	run background script LC10_PrisonGuard1Actions
	
	LC10_PrisonGuard[2] = create platoon PLATOON_INFO_AZTEC_MELEE_5 at {PrisonPos[2]} with 20 men and 0 women
	attach LC10_PrisonGuard[2] to AztecCapital
	PLAYER of LC10_PrisonGuard[2] = 1
	disable platoon LC10_PrisonGuard[2] camp
	run background script LC10_PrisonGuard2Actions

	LC10_PrisonGuard[3] = create platoon PLATOON_INFO_AZTEC_RANGED_5 at {PrisonPos[3]} with 35 men and 0 women
	attach LC10_PrisonGuard[3] to AztecCapital
	PLAYER of LC10_PrisonGuard[3] = 1
	disable platoon LC10_PrisonGuard[3] camp
	run background script LC10_PrisonGuard3Actions
	
	//----Create patrol platoons----//
	
	LC10_Platoon[0] = create platoon PLATOON_INFO_AZTEC_MELEE_5 at {PatrolRouteC[0]} with 20 men and 0 women
	attach LC10_Platoon[0] to AztecCapital
	PLAYER of LC10_Platoon[0] = 1
	run background script LC10_Platoon0Actions
	
	LC10_Platoon[1] = create platoon PLATOON_INFO_AZTEC_MELEE_5 at {PatrolRouteB[0]} with 30 men and 0 women
	attach LC10_Platoon[1] to AztecCapital
	PLAYER of LC10_Platoon[1] = 1
	run background script LC10_Platoon1Actions
	
	LC10_Platoon[2] = create platoon PLATOON_INFO_AZTEC_MELEE_5 at {PatrolRouteA[0]} with 40 men and 0 women
	attach LC10_Platoon[2] to AztecCapital
	PLAYER of LC10_Platoon[2] = 1
	run background script LC10_Platoon2Actions
	
	LC10_Platoon[3] = create platoon PLATOON_INFO_AZTEC_MELEE_5 at {PatrolRouteD[0]} with 30 men and 0 women
	attach LC10_Platoon[3] to AztecCapital
	PLAYER of LC10_Platoon[3] = 1
	run background script LC10_Platoon3Actions
	
	//----Create static platoons----//
	
	LC10_Platoon[4] = create platoon PLATOON_INFO_AZTEC_MELEE_5 at {PlatoonPos[0]} with 20 men and 0 women
	attach LC10_Platoon[4] to AztecCapital
	PLAYER of LC10_Platoon[4] = 1
	run background script LC10_Platoon4Actions
	
	LC10_Platoon[5] = create platoon PLATOON_INFO_AZTEC_MELEE_5 at {PlatoonPos[1]} with 50 men and 0 women
	attach LC10_Platoon[5] to AztecCapital
	PLAYER of LC10_Platoon[5] = 1
	run background script LC10_Platoon5Actions
	
	LC10_Platoon[6] = create platoon PLATOON_INFO_AZTEC_MELEE_5 at {PlatoonPos[2]} with 50 men and 0 women
	attach LC10_Platoon[6] to AztecCapital
	PLAYER of LC10_Platoon[6] = 1
	run background script LC10_Platoon6Actions
	
	LC10_Platoon[7] = create platoon PLATOON_INFO_AZTEC_MELEE_5 at {PlatoonPos[3]} with 35 men and 0 women
	attach LC10_Platoon[7] to AztecCapital
	PLAYER of LC10_Platoon[7] = 1
	run background script LC10_Platoon7Actions
	
	LC10_Platoon[8] = create platoon PLATOON_INFO_AZTEC_MELEE_5 at {PlatoonPos[4]} with 35 men and 0 women
	attach LC10_Platoon[8] to AztecCapital
	PLAYER of LC10_Platoon[8] = 1
	run background script LC10_Platoon8Actions
	
	//----Create town static defender platoons----//
	
	LC10_Platoon[9] = create platoon PLATOON_INFO_AZTEC_MELEE_5 at {PlatoonPos[5]} with 50 men and 0 women
	attach LC10_Platoon[9] to AztecCapital
	PLAYER of LC10_Platoon[9] = 1
	run background script LC10_Platoon9Actions
	enable platoon LC10_Platoon[9] respond to town AztecFirstTown attack
	disable platoon LC10_Platoon[9] respond to local platoon attack
	
	LC10_Platoon[10] = create platoon PLATOON_INFO_AZTEC_MELEE_5 at {PlatoonPos[6]} with 50 men and 0 women
	attach LC10_Platoon[10] to AztecCapital
	PLAYER of LC10_Platoon[10] = 1
	run background script LC10_Platoon10Actions
	enable platoon LC10_Platoon[10] respond to town AztecFirstTown attack
	disable platoon LC10_Platoon[10] respond to local platoon attack
	
	LC10_Platoon[11] = create platoon PLATOON_INFO_AZTEC_RANGED_5 at {PlatoonPos[7]} with 50 men and 0 women
	attach LC10_Platoon[11] to AztecCapital
	PLAYER of LC10_Platoon[11] = 1
	run background script LC10_Platoon11Actions
	enable platoon LC10_Platoon[11] respond to town AztecFirstTown attack
	disable platoon LC10_Platoon[11] respond to local platoon attack
	
	LC10_Platoon[12] = create platoon PLATOON_INFO_AZTEC_MELEE_5 at {PlatoonPos[8]} with 50 men and 0 women
	attach LC10_Platoon[12] to AztecCapital
	PLAYER of LC10_Platoon[12] = 1
	run background script LC10_Platoon12Actions
	enable platoon LC10_Platoon[12] respond to town AztecPreTown attack
	
	LC10_Platoon[13] = create platoon PLATOON_INFO_AZTEC_RANGED_5 at {PlatoonPos[9]} with 50 men and 0 women
	attach LC10_Platoon[13] to AztecCapital
	PLAYER of LC10_Platoon[13] = 1
	run background script LC10_Platoon13Actions
	enable platoon LC10_Platoon[13] respond to town AztecPreTown attack
	
	LC10_Platoon[14] = create platoon PLATOON_INFO_AZTEC_MELEE_5 at {PlatoonPos[10]} with 35 men and 0 women
	attach LC10_Platoon[14] to AztecCapital
	PLAYER of LC10_Platoon[14] = 1
	run background script LC10_Platoon14Actions
	enable platoon LC10_Platoon[14] respond to town AztecCapital attack
	
	LC10_Platoon[15] = create platoon PLATOON_INFO_AZTEC_MELEE_5 at {PlatoonPos[11]} with 35 men and 0 women
	attach LC10_Platoon[15] to AztecCapital
	PLAYER of LC10_Platoon[15] = 1
	run background script LC10_Platoon15Actions
	enable platoon LC10_Platoon[15] respond to town AztecCapital attack
	
	LC10_Platoon[16] = create platoon PLATOON_INFO_AZTEC_MELEE_5 at {PlatoonPos[12]} with 50 men and 0 women
	attach LC10_Platoon[16] to AztecCapital
	PLAYER of LC10_Platoon[16] = 1
	run background script LC10_Platoon16Actions
	enable platoon LC10_Platoon[16] respond to town AztecCapital attack
	
	LC10_Platoon[17] = create platoon PLATOON_INFO_AZTEC_RANGED_5 at {PlatoonPos[13]} with 50 men and 0 women
	attach LC10_Platoon[17] to AztecCapital
	PLAYER of LC10_Platoon[17] = 1
	run background script LC10_Platoon17Actions
	enable platoon LC10_Platoon[17] respond to town AztecCapital attack
	
	LC10_Platoon[18] = create platoon PLATOON_INFO_AZTEC_RANGED_5 at {PlatoonPos[14]} with 50 men and 0 women
	attach LC10_Platoon[18] to AztecCapital
	PLAYER of LC10_Platoon[18] = 1
	run background script LC10_Platoon18Actions
	enable platoon LC10_Platoon[18] respond to town AztecCapital attack
	
	//Create static Siege Weapons
	
	LC10_SiegeCatapult[11] = create siege weapon SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 belonging to AztecCapital at {StaticSiegePos[1]}
	set LC10_SiegeCatapult[11] focus to {PlayerTown}
	add action SIEGEWEAPON_AGENDA_ACTION_DEFEND_POSITION using {StaticSiegePos[1]} to siege weapon LC10_SiegeCatapult[11] action queue
	
	LC10_SiegeCatapult[12] = create siege weapon SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 belonging to AztecCapital at {StaticSiegePos[2]}
	set LC10_SiegeCatapult[12] focus to {PlayerTown}
	add action SIEGEWEAPON_AGENDA_ACTION_DEFEND_POSITION using {StaticSiegePos[2]} to siege weapon LC10_SiegeCatapult[12] action queue
	
	LC10_SiegeCatapult[13] = create siege weapon SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 belonging to AztecCapital at {StaticSiegePos[3]}
	set LC10_SiegeCatapult[13] focus to {PlayerTown}
	add action SIEGEWEAPON_AGENDA_ACTION_DEFEND_POSITION using {StaticSiegePos[3]} to siege weapon LC10_SiegeCatapult[13] action queue
	
	LC10_SiegeCatapult[14] = create siege weapon SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 belonging to AztecCapital at {StaticSiegePos[4]}
	set LC10_SiegeCatapult[14] focus to {PlayerTown}
	add action SIEGEWEAPON_AGENDA_ACTION_DEFEND_POSITION using {StaticSiegePos[4]} to siege weapon LC10_SiegeCatapult[14] action queue
	
	LC10_SiegeCatapult[15] = create siege weapon SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 belonging to AztecCapital at {StaticSiegePos[5]}
	set LC10_SiegeCatapult[15] focus to {PlayerTown}
	add action SIEGEWEAPON_AGENDA_ACTION_DEFEND_POSITION using {StaticSiegePos[5]} to siege weapon LC10_SiegeCatapult[15] action queue
	
	LC10_SiegeCatapult[16] = create siege weapon SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 belonging to AztecCapital at {StaticSiegePos[6]}
	set LC10_SiegeCatapult[16] focus to {PlayerTown}
	add action SIEGEWEAPON_AGENDA_ACTION_DEFEND_POSITION using {StaticSiegePos[6]} to siege weapon LC10_SiegeCatapult[16] action queue
	
	LC10_SiegeCatapult[17] = create siege weapon SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 belonging to AztecCapital at {StaticSiegePos[7]}
	set LC10_SiegeCatapult[17] focus to {PlayerTown}
	add action SIEGEWEAPON_AGENDA_ACTION_DEFEND_POSITION using {StaticSiegePos[7]} to siege weapon LC10_SiegeCatapult[17] action queue
	
	LC10_SiegeCatapult[18] = create siege weapon SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 belonging to AztecCapital at {StaticSiegePos[8]}
	set LC10_SiegeCatapult[18] focus to {PlayerTown}
	add action SIEGEWEAPON_AGENDA_ACTION_DEFEND_POSITION using {StaticSiegePos[8]} to siege weapon LC10_SiegeCatapult[18] action queue
	
	LC10_SiegeCatapult[19] = create siege weapon SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 belonging to AztecCapital at {StaticSiegePos[9]}
	set LC10_SiegeCatapult[19] focus to {PlayerTown}
	add action SIEGEWEAPON_AGENDA_ACTION_DEFEND_POSITION using {StaticSiegePos[9]} to siege weapon LC10_SiegeCatapult[19] action queue
	
	LC10_SiegeCatapult[20] = create siege weapon SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 belonging to AztecCapital at {StaticSiegePos[10]}
	set LC10_SiegeCatapult[20] focus to {PlayerTown}
	add action SIEGEWEAPON_AGENDA_ACTION_DEFEND_POSITION using {StaticSiegePos[10]} to siege weapon LC10_SiegeCatapult[20] action queue
	
	LC10_SiegeCatapult[21] = create siege weapon SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 belonging to AztecCapital at {StaticSiegePos[11]}
	set LC10_SiegeCatapult[21] focus to {PlayerTown}
	add action SIEGEWEAPON_AGENDA_ACTION_DEFEND_POSITION using {StaticSiegePos[11]} to siege weapon LC10_SiegeCatapult[21] action queue
	
	LC10_SiegeCatapult[22] = create siege weapon SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 belonging to AztecCapital at {StaticSiegePos[12]}
	set LC10_SiegeCatapult[22] focus to {PlayerTown}
	add action SIEGEWEAPON_AGENDA_ACTION_DEFEND_POSITION using {StaticSiegePos[12]} to siege weapon LC10_SiegeCatapult[22] action queue
	
	LC10_SiegeCatapult[23] = create siege weapon SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 belonging to AztecCapital at {StaticSiegePos[13]}
	set LC10_SiegeCatapult[23] focus to {PlayerTown}
	add action SIEGEWEAPON_AGENDA_ACTION_DEFEND_POSITION using {StaticSiegePos[13]} to siege weapon LC10_SiegeCatapult[23] action queue
	
	//execute these scripts before the loop
	run background script LC10_Platoon29Actions
	run background script LC10_Platoon30Actions
	run background script LC10_Platoon31Actions
	run background script LC10_Platoon32Actions
	run background script LC10_SiegeCatapult2Actions
	
	RecruitTimer1 = create timer for 100 seconds
	RecruitTimer2 = create timer for 100 seconds
	RecruitTimer3 = create timer for 100 seconds
	//RecruitTimers for different towns
	
	AIHurricane = get SCRIPT_OBJECT_TYPE_WONDER EPIC_WONDER_NUMBER_HURRICANE at {1612.80,245.06,1171.41} radius 150

	WallTimer1 = create timer for 320 seconds
	
	begin loop
		
		if get RecruitTimer1 time remaining <= 0 or get RecruitTimer2 time remaining <= 0 or get RecruitTimer3 time remaining <= 0 //Enemy Production. TownDefenders > StaticPlatoons > Patrols > Attackers
		
			if LC10_Platoon[9] not exists and PLAYER of AztecFirstTown == 1 and get RecruitTimer1 time remaining <= 0
				LC10_Platoon[9] = recruit ARMY_UNIT_TYPE_MELEE_3 town AztecFirstTown platoon of size 30
				RecruitTimer1 = create timer for 60 seconds
				enable platoon LC10_Platoon[9] respond to town AztecFirstTown attack
				
			elsif LC10_Platoon[10] not exists and PLAYER of AztecFirstTown == 1 and get RecruitTimer1 time remaining <= 0
				LC10_Platoon[10] = recruit ARMY_UNIT_TYPE_MELEE_3 town AztecFirstTown platoon of size 30
				RecruitTimer1 = create timer for 60 seconds
				enable platoon LC10_Platoon[10] respond to town AztecFirstTown attack
				
			elsif LC10_Platoon[11] not exists and PLAYER of AztecFirstTown == 1 and get RecruitTimer1 time remaining <= 0
				LC10_Platoon[11] = recruit PLATOON_INFO_AZTEC_RANGED_5 town AztecFirstTown platoon of size 30
				RecruitTimer1 = create timer for 60 seconds
				enable platoon LC10_Platoon[11] respond to town AztecFirstTown attack
			
			elsif LC10_Platoon[12] not exists and PLAYER of AztecPreTown == 1 and get RecruitTimer2 time remaining <= 0
				LC10_Platoon[12] = recruit ARMY_UNIT_TYPE_MELEE_3 town AztecPreTown platoon of size 30
				RecruitTimer2 = create timer for 60 seconds
				enable platoon LC10_Platoon[12] respond to town AztecPreTown attack
				
			elsif LC10_Platoon[13] not exists and PLAYER of AztecPreTown == 1 and get RecruitTimer2 time remaining <= 0
				LC10_Platoon[13] = recruit PLATOON_INFO_AZTEC_RANGED_5 town AztecPreTown platoon of size 30
				RecruitTimer2 = create timer for 60 seconds
				enable platoon LC10_Platoon[13] respond to town AztecPreTown attack
				
			elsif LC10_Platoon[14] not exists and PLAYER of AztecCapital == 1 and get RecruitTimer3 time remaining <= 0
				LC10_Platoon[14] = recruit ARMY_UNIT_TYPE_MELEE_3 town AztecCapital platoon of size 30
				RecruitTimer3 = create timer for 60 seconds
				enable platoon LC10_Platoon[14] respond to town AztecCapital attack
				
			elsif LC10_Platoon[15] not exists and PLAYER of AztecCapital == 1 and get RecruitTimer3 time remaining <= 0
				LC10_Platoon[15] = recruit ARMY_UNIT_TYPE_MELEE_3 town AztecCapital platoon of size 30
				RecruitTimer3 = create timer for 60 seconds
				enable platoon LC10_Platoon[15] respond to town AztecCapital attack
				
			elsif LC10_Platoon[16] not exists and PLAYER of AztecCapital == 1 and get RecruitTimer3 time remaining <= 0
				LC10_Platoon[16] = recruit ARMY_UNIT_TYPE_MELEE_3 town AztecCapital platoon of size 30
				RecruitTimer3 = create timer for 60 seconds
				enable platoon LC10_Platoon[16] respond to town AztecCapital attack
				
			elsif LC10_Platoon[17] not exists and PLAYER of AztecCapital == 1 and get RecruitTimer3 time remaining <= 0
				LC10_Platoon[17] = recruit PLATOON_INFO_AZTEC_RANGED_5 town AztecCapital platoon of size 30
				RecruitTimer3 = create timer for 60 seconds
				enable platoon LC10_Platoon[17] respond to town AztecCapital attack
				
			elsif LC10_Platoon[18] not exists and PLAYER of AztecCapital == 1 and get RecruitTimer3 time remaining <= 0
				LC10_Platoon[18] = recruit PLATOON_INFO_AZTEC_RANGED_5 town AztecCapital platoon of size 30
				RecruitTimer3 = create timer for 60 seconds
				enable platoon LC10_Platoon[18] respond to town AztecCapital attack
				
			elsif LC10_Platoon[4] not exists and PLAYER of AztecCapital == 1 and not town AztecCapital is under takeover from player 0 and WarStarted == 1 and get RecruitTimer3 time remaining <= 0
				LC10_Platoon[4] = recruit PLATOON_INFO_AZTEC_MELEE_5 town AztecCapital platoon of size 45
				RecruitTimer3 = create timer for 60 seconds
				
			elsif LC10_Platoon[5] not exists and PLAYER of AztecCapital == 1 and not town AztecCapital is under takeover from player 0 and WarStarted == 1 and get RecruitTimer3 time remaining <= 0
				LC10_Platoon[5] = recruit PLATOON_INFO_AZTEC_MELEE_5 town AztecCapital platoon of size 45
				RecruitTimer3 = create timer for 60 seconds
				
			elsif LC10_Platoon[6] not exists and PLAYER of AztecCapital == 1 and not town AztecCapital is under takeover from player 0 and WarStarted == 1 and get RecruitTimer3 time remaining <= 0
				LC10_Platoon[6] = recruit PLATOON_INFO_AZTEC_MELEE_5 town AztecCapital platoon of size 60
				RecruitTimer3 = create timer for 60 seconds
				
			elsif LC10_Platoon[7] not exists and PLAYER of AztecCapital == 1 and not town AztecCapital is under takeover from player 0 and WarStarted == 1 and get RecruitTimer3 time remaining <= 0
				LC10_Platoon[7] = recruit PLATOON_INFO_AZTEC_MELEE_5 town AztecCapital platoon of size 60
				RecruitTimer3 = create timer for 60 seconds
				
			elsif LC10_Platoon[8] not exists and PLAYER of AztecCapital == 1 and not town AztecCapital is under takeover from player 0 and WarStarted == 1 and get RecruitTimer3 time remaining <= 0
				LC10_Platoon[8] = recruit PLATOON_INFO_AZTEC_MELEE_5 town AztecCapital platoon of size 90
				RecruitTimer3 = create timer for 60 seconds
				
			elsif LC10_Platoon[1] not exists and PLAYER of AztecCapital == 1 and not town AztecCapital is under takeover from player 0 and WarStarted == 1 and get RecruitTimer3 time remaining <= 0
				LC10_Platoon[1] = recruit PLATOON_INFO_AZTEC_MELEE_5 town AztecCapital platoon of size 50
				RecruitTimer3 = create timer for 60 seconds
				
			elsif LC10_Platoon[2] not exists and PLAYER of AztecCapital == 1 and not town AztecCapital is under takeover from player 0 and WarStarted == 1 and get RecruitTimer3 time remaining <= 0
				LC10_Platoon[2] = recruit PLATOON_INFO_AZTEC_MELEE_5 town AztecCapital platoon of size 50
				RecruitTimer3 = create timer for 60 seconds
				
			elsif LC10_Platoon[3] not exists and PLAYER of AztecCapital == 1 and not town AztecCapital is under takeover from player 0 and WarStarted == 1 and get RecruitTimer3 time remaining <= 0
				LC10_Platoon[3] = recruit PLATOON_INFO_AZTEC_MELEE_5 town AztecCapital platoon of size 50
				RecruitTimer3 = create timer for 60 seconds
				
			elsif LC10_Platoon[29] not exists and PLAYER of AztecCapital == 1 and not town AztecCapital is under takeover from player 0 and WarStarted == 1 and get RecruitTimer3 time remaining <= 0
				LC10_Platoon[29] = recruit PLATOON_INFO_AZTEC_MELEE_5 town AztecCapital platoon of size 40
				RecruitTimer3 = create timer for 60 seconds
				
			elsif LC10_Platoon[31] not exists and WarStarted == 1 and AztecTroopsSending == 1
				if PLAYER of AztecFirstTown == 1 and not town AztecFirstTown is under takeover from player 0 and get RecruitTimer1 time remaining <= 0
					LC10_Platoon[31] = recruit PLATOON_INFO_AZTEC_RANGED_5 town AztecFirstTown platoon of size 40
					RecruitTimer1 = create timer for 80 seconds
				elsif PLAYER of AztecCapital == 1 and not town AztecCapital is under takeover from player 0 and get RecruitTimer3 time remaining <= 0
					LC10_Platoon[31] = recruit PLATOON_INFO_AZTEC_RANGED_5 town AztecCapital platoon of size 40
					RecruitTimer3 = create timer for 80 seconds
				end if
				
			elsif LC10_Platoon[32] not exists and WarStarted == 1 and AztecTroopsSending == 1
				if PLAYER of AztecFirstTown == 1 and not town AztecFirstTown is under takeover from player 0 and get RecruitTimer1 time remaining <= 0
					LC10_Platoon[32] = recruit PLATOON_INFO_AZTEC_MELEE_5 town AztecFirstTown platoon of size 40
					RecruitTimer1 = create timer for 80 seconds
				elsif PLAYER of AztecCapital == 1 and not town AztecCapital is under takeover from player 0 and get RecruitTimer3 time remaining <= 0
					LC10_Platoon[32] = recruit PLATOON_INFO_AZTEC_MELEE_5 town AztecCapital platoon of size 40
					RecruitTimer3 = create timer for 80 seconds
				end if
				
				//Attack1
			elsif LC10_Platoon[21] not exists and PLAYER of AztecFirstTown == 1 and not town AztecFirstTown is under takeover from player 0 and WarStarted == 1 and get RecruitTimer1 time remaining <= 0
				LC10_Platoon[21] = recruit PLATOON_INFO_AZTEC_MELEE_5 town AztecFirstTown platoon of size 25
				RecruitTimer1 = create timer for 100 seconds
				
			elsif LC10_Platoon[22] not exists and PLAYER of AztecFirstTown == 1 and not town AztecFirstTown is under takeover from player 0 and WarStarted == 1 and get RecruitTimer1 time remaining <= 0
				LC10_Platoon[22] = recruit PLATOON_INFO_AZTEC_MELEE_5 town AztecFirstTown platoon of size 25
				RecruitTimer1 = create timer for 100 seconds
				
			elsif LC10_SiegeCatapult[0] not exists and PLAYER of AztecFirstTown == 1 and not town AztecFirstTown is under takeover from player 0 and WarStarted == 1 and get RecruitTimer1 time remaining <= 0
				LC10_SiegeCatapult[0] = recruit SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 town AztecFirstTown siege weapon
				RecruitTimer1 = create timer for 75 seconds
				
			elsif LC10_SiegeCatapult[1] not exists and PLAYER of AztecFirstTown == 1 and not town AztecFirstTown is under takeover from player 0 and WarStarted == 1 and get RecruitTimer1 time remaining <= 0
				LC10_SiegeCatapult[1] = recruit SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 town AztecFirstTown siege weapon
				RecruitTimer1 = create timer for 75 seconds
				//Attack1
				
				//AttackAztecPreTown
			elsif LC10_Platoon[33] not exists and PLAYER of AztecCapital == 1 and not town AztecCapital is under takeover from player 0 and get RecruitTimer3 time remaining <= 0 and AztecPreTownAttackSent == 1 and PLAYER of AztecPreTown == 0
				LC10_Platoon[33] = recruit PLATOON_INFO_AZTEC_MELEE_5 town AztecCapital platoon of size number from 40 to 60
				RecruitTimer3 = create timer for 60 seconds
				
			elsif LC10_Platoon[34] not exists and PLAYER of AztecCapital == 1 and not town AztecCapital is under takeover from player 0 and get RecruitTimer3 time remaining <= 0 and AztecPreTownAttackSent == 1 and PLAYER of AztecPreTown == 0
				LC10_Platoon[34] = recruit PLATOON_INFO_AZTEC_MELEE_5 town AztecCapital platoon of size number from 40 to 60
				RecruitTimer3 = create timer for 60 seconds
				
			elsif LC10_SiegeCatapult[7] not exists and PLAYER of AztecCapital == 1 and not town AztecCapital is under takeover from player 0 and get RecruitTimer3 time remaining <= 0 and AztecPreTownAttackSent == 1 and PLAYER of AztecPreTown == 0
				LC10_SiegeCatapult[7] = recruit SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 town AztecCapital siege weapon
				RecruitTimer3 = create timer for 45 seconds
				
			elsif LC10_SiegeCatapult[8] not exists and PLAYER of AztecCapital == 1 and not town AztecCapital is under takeover from player 0 and get RecruitTimer3 time remaining <= 0 and AztecPreTownAttackSent == 1 and PLAYER of AztecPreTown == 0
				LC10_SiegeCatapult[8] = recruit SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 town AztecCapital siege weapon
				RecruitTimer3 = create timer for 45 seconds
				//AttackAztecPreTown
				
				//AttackAztecFirstTown
			elsif LC10_Platoon[35] not exists and PLAYER of AztecCapital == 1 and not town AztecCapital is under takeover from player 0 and get RecruitTimer3 time remaining <= 0 and AztecFirstTownAttackSent == 1 and PLAYER of AztecFirstTown == 0
				LC10_Platoon[35] = recruit PLATOON_INFO_AZTEC_MELEE_5 town AztecCapital platoon of size number from 40 to 60
				RecruitTimer3 = create timer for 60 seconds
				
			elsif LC10_Platoon[36] not exists and PLAYER of AztecCapital == 1 and not town AztecCapital is under takeover from player 0 and get RecruitTimer3 time remaining <= 0 and AztecFirstTownAttackSent == 1 and PLAYER of AztecFirstTown == 0
				LC10_Platoon[36] = recruit PLATOON_INFO_AZTEC_MELEE_5 town AztecCapital platoon of size number from 40 to 60
				RecruitTimer3 = create timer for 60 seconds
				
			elsif LC10_SiegeCatapult[9] not exists and PLAYER of AztecCapital == 1 and not town AztecCapital is under takeover from player 0 and get RecruitTimer3 time remaining <= 0 and AztecFirstTownAttackSent == 1 and PLAYER of AztecFirstTown == 0
				LC10_SiegeCatapult[9] = recruit SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 town AztecCapital siege weapon
				RecruitTimer3 = create timer for 45 seconds
				
			elsif LC10_SiegeCatapult[10] not exists and PLAYER of AztecCapital == 1 and not town AztecCapital is under takeover from player 0 and get RecruitTimer3 time remaining <= 0 and AztecFirstTownAttackSent == 1 and PLAYER of AztecFirstTown == 0
				LC10_SiegeCatapult[10] = recruit SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 town AztecCapital siege weapon
				RecruitTimer3 = create timer for 45 seconds
				//AttackAztecFirstTown
				
				//CapitalCatapult
			elsif LC10_Platoon[30] not exists and PLAYER of AztecCapital == 1 and not town AztecCapital is under takeover from player 0 and ACSentCatapult == 1 and get RecruitTimer3 time remaining <= 0
				LC10_Platoon[30] = recruit PLATOON_INFO_AZTEC_MELEE_5 town AztecCapital platoon of size 25
				RecruitTimer3 = create timer for 100 seconds
				
			elsif LC10_SiegeCatapult[2] not exists and PLAYER of AztecCapital == 1 and not town AztecCapital is under takeover from player 0 and ACSentCatapult == 1 and get RecruitTimer3 time remaining <= 0
				LC10_SiegeCatapult[2] = recruit SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 town AztecCapital siege weapon
				RecruitTimer3 = create timer for 75 seconds
				//CapitalCatapult
				
			end if
			
			//AztecFirstTownWalls
			Wall[1] = get wall segment nearest {1679.27,210.88,857.60} radius 15
			Wall[2] = get wall segment nearest {1757.95,204.83,911.31} radius 15
			Wall[3] = get wall segment nearest {1780.52,212.79,1170.36} radius 15
			Wall[4] = get wall segment nearest {1745.21,213.26,1225.92} radius 15
			//AztecFirstTownWalls
			
			//AztecCapitalWalls
			Wall[5] = get wall segment nearest {922.22,390.87,1634.88} radius 15
			Wall[6] = get wall segment nearest {928.61,393.58,1728.27} radius 15
			Wall[7] = get wall segment nearest {908.01,393.23,1781.78} radius 15
			Wall[8] = get wall segment nearest {852.19,403.47,1766.67} radius 15
			Wall[9] = get wall segment nearest {809.33,402.71,1717.16} radius 15
			//AztecCapitalWalls
			
			if LC10_WallArcher[0] not exists and Wall[1] exists and PLAYER of Wall[1] == 1 and HEALTH of Wall[1] == 1.0 and not town AztecFirstTown is under takeover from player 0 and get RecruitTimer1 time remaining <= 0
				LC10_WallArcher[0] = recruit PLATOON_INFO_AZTEC_RANGED_5 town AztecFirstTown platoon of size number from 30 to 35
				RecruitTimer1 = create timer for 45 seconds
				wait until not LC10_WallArcher[0] recruiting
				enable platoon LC10_WallArcher[0] respond to town AztecFirstTown attack
				add action PLATOON_AGENDA_ACTION_GET_ON_WALL using Wall[1] to LC10_WallArcher[0] action queue
				
			elsif LC10_WallArcher[1] not exists and Wall[2] exists and PLAYER of Wall[2] == 1 and HEALTH of Wall[2] == 1.0 and not town AztecFirstTown is under takeover from player 0 and get RecruitTimer1 time remaining <= 0
				LC10_WallArcher[1] = recruit PLATOON_INFO_AZTEC_RANGED_5 town AztecFirstTown platoon of size number from 30 to 35
				RecruitTimer1 = create timer for 45 seconds
				wait until not LC10_WallArcher[1] recruiting
				enable platoon LC10_WallArcher[1] respond to town AztecFirstTown attack
				add action PLATOON_AGENDA_ACTION_GET_ON_WALL using Wall[2] to LC10_WallArcher[1] action queue
				
			elsif LC10_WallArcher[2] not exists and Wall[3] exists and PLAYER of Wall[3] == 1 and HEALTH of Wall[3] == 1.0 and not town AztecFirstTown is under takeover from player 0 and get RecruitTimer1 time remaining <= 0
				LC10_WallArcher[2] = recruit PLATOON_INFO_AZTEC_RANGED_5 town AztecFirstTown platoon of size number from 30 to 35
				RecruitTimer1 = create timer for 45 seconds
				wait until not LC10_WallArcher[2] recruiting
				enable platoon LC10_WallArcher[2] respond to town AztecFirstTown attack
				add action PLATOON_AGENDA_ACTION_GET_ON_WALL using Wall[3] to LC10_WallArcher[2] action queue
			
			elsif LC10_WallArcher[3] not exists and Wall[4] exists and PLAYER of Wall[4] == 1 and HEALTH of Wall[4] == 1.0 and not town AztecFirstTown is under takeover from player 0 and get RecruitTimer1 time remaining <= 0
				LC10_WallArcher[3] = recruit PLATOON_INFO_AZTEC_RANGED_5 town AztecFirstTown platoon of size number from 30 to 35
				RecruitTimer1 = create timer for 45 seconds
				wait until not LC10_WallArcher[3] recruiting
				enable platoon LC10_WallArcher[3] respond to town AztecFirstTown attack
				add action PLATOON_AGENDA_ACTION_GET_ON_WALL using Wall[4] to LC10_WallArcher[3] action queue

			elsif LC10_WallArcher[4] not exists and Wall[5] exists and PLAYER of Wall[5] == 1 and HEALTH of Wall[5] == 1.0 and not town AztecCapital is under takeover from player 0 and get RecruitTimer3 time remaining <= 0
				LC10_WallArcher[4] = recruit PLATOON_INFO_AZTEC_RANGED_5 town AztecCapital platoon of size number from 30 to 35
				RecruitTimer3 = create timer for 45 seconds
				wait until not LC10_WallArcher[4] recruiting
				enable platoon LC10_WallArcher[4] respond to town AztecCapital attack
				add action PLATOON_AGENDA_ACTION_GET_ON_WALL using Wall[5] to LC10_WallArcher[4] action queue
				
			elsif LC10_WallArcher[5] not exists and Wall[6] exists and PLAYER of Wall[6] == 1 and HEALTH of Wall[6] == 1.0 and not town AztecCapital is under takeover from player 0 and get RecruitTimer3 time remaining <= 0
				LC10_WallArcher[5] = recruit PLATOON_INFO_AZTEC_RANGED_5 town AztecCapital platoon of size number from 30 to 35
				RecruitTimer3 = create timer for 45 seconds
				wait until not LC10_WallArcher[5] recruiting
				enable platoon LC10_WallArcher[5] respond to town AztecCapital attack
				add action PLATOON_AGENDA_ACTION_GET_ON_WALL using Wall[6] to LC10_WallArcher[5] action queue
				
			elsif LC10_WallArcher[6] not exists and Wall[7] exists and PLAYER of Wall[7] == 1 and HEALTH of Wall[7] == 1.0 and not town AztecCapital is under takeover from player 0 and get RecruitTimer3 time remaining <= 0
				LC10_WallArcher[6] = recruit PLATOON_INFO_AZTEC_RANGED_5 town AztecCapital platoon of size number from 30 to 35
				RecruitTimer3 = create timer for 45 seconds
				wait until not LC10_WallArcher[6] recruiting
				enable platoon LC10_WallArcher[6] respond to town AztecCapital attack
				add action PLATOON_AGENDA_ACTION_GET_ON_WALL using Wall[7] to LC10_WallArcher[6] action queue
				
			elsif LC10_WallArcher[7] not exists and Wall[8] exists and PLAYER of Wall[8] == 1 and HEALTH of Wall[8] == 1.0 and not town AztecCapital is under takeover from player 0 and get RecruitTimer3 time remaining <= 0
				LC10_WallArcher[7] = recruit PLATOON_INFO_AZTEC_RANGED_5 town AztecCapital platoon of size number from 30 to 35
				RecruitTimer3 = create timer for 45 seconds
				wait until not LC10_WallArcher[7] recruiting
				enable platoon LC10_WallArcher[7] respond to town AztecCapital attack
				add action PLATOON_AGENDA_ACTION_GET_ON_WALL using Wall[8] to LC10_WallArcher[7] action queue
				
			elsif LC10_WallArcher[8] not exists and Wall[9] exists and PLAYER of Wall[9] == 1 and HEALTH of Wall[9] == 1.0 and not town AztecCapital is under takeover from player 0 and get RecruitTimer3 time remaining <= 0
				LC10_WallArcher[8] = recruit PLATOON_INFO_AZTEC_RANGED_5 town AztecCapital platoon of size number from 30 to 35
				RecruitTimer3 = create timer for 45 seconds
				wait until not LC10_WallArcher[8] recruiting
				enable platoon LC10_WallArcher[8] respond to town AztecCapital attack
				add action PLATOON_AGENDA_ACTION_GET_ON_WALL using Wall[9] to LC10_WallArcher[8] action queue
				
			end if
		end if
		
		if TownsConverted >= 1 and AztecTroopsSending == 0
			AztecTroopsSending = 1
		end if
		
		if town AztecCapital is under takeover from player 0 and LC10_Platoon[23] not exists and LC10_Platoon[24] not exists and get DefendRecruitTimer time remaining <= 0 and PLAYER of AztecCapital == 1 //Makes a couple of defend platoons
			LC10_Platoon[23] = recruit PLATOON_INFO_AZTEC_MELEE_3 town AztecCapital platoon of size 25
			enable platoon LC10_Platoon[23] respond to town AztecCapital attack
			wait until not LC10_Platoon[23] recruiting
			
			LC10_Platoon[24] = recruit PLATOON_INFO_AZTEC_MELEE_3 town AztecCapital platoon of size 25
			enable platoon LC10_Platoon[24] respond to town AztecCapital attack
			wait until not LC10_Platoon[24] recruiting
			
			DefendRecruitTimer = create timer for 75 seconds
		end if
		
		if town AztecPreTown is under takeover from player 0 and LC10_Platoon[25] not exists and LC10_Platoon[26] not exists and get DefendRecruitTimer time remaining <= 0 and PLAYER of AztecPreTown == 1 
			LC10_Platoon[25] = recruit PLATOON_INFO_AZTEC_MELEE_3 town AztecPreTown platoon of size 25
			enable platoon LC10_Platoon[25] respond to town AztecPreTown attack
			wait until not LC10_Platoon[25] recruiting
			
			LC10_Platoon[26] = recruit PLATOON_INFO_AZTEC_MELEE_3 town AztecPreTown platoon of size 25
			enable platoon LC10_Platoon[26] respond to town AztecPreTown attack
			wait until not LC10_Platoon[26] recruiting
			
			DefendRecruitTimer = create timer for 75 seconds
		end if
		
		if town AztecFirstTown is under takeover from player 0 and LC10_Platoon[27] not exists and LC10_Platoon[28] not exists and get DefendRecruitTimer time remaining <= 0 and PLAYER of AztecFirstTown == 1 
			LC10_Platoon[27] = recruit PLATOON_INFO_AZTEC_MELEE_3 town AztecFirstTown platoon of size 25
			enable platoon LC10_Platoon[27] respond to town AztecFirstTown attack
			wait until not LC10_Platoon[27] recruiting
			
			LC10_Platoon[28] = recruit PLATOON_INFO_AZTEC_MELEE_3 town AztecFirstTown platoon of size 25
			enable platoon LC10_Platoon[28] respond to town AztecFirstTown attack
			wait until not LC10_Platoon[28] recruiting
			
			DefendRecruitTimer = create timer for 75 seconds
		end if
		
		if get WallTimer1 time remaining <= 1
			if WallCounter < 10
				PlannedWall[WallCounter] = build building at {PlannedWallPos[WallCounter]} desire 1.0
				add resource RESOURCE_TYPE_ORE number from 4000 to 4250 to PlannedWall[WallCounter]
				WallCounter++
			end if
		end if
		
		if get WallTimer2 time remaining <= 1
			if WallCounter2 < 10
				PlannedWall2[WallCounter2] =  build building at {PlannedWallPos2[WallCounter2]} desire 1.0
				add resource RESOURCE_TYPE_ORE number from 4000 to 5000 to PlannedWall2[WallCounter2]
				WallCounter2++
			end if
		end if
		
		if PrisonDestroyed == 1 and PrisonEvent == 0//Starts War
			LC10_Platoon[19] = recruit PLATOON_INFO_AZTEC_MELEE_5 town AztecPreTown platoon of size 20
			LC10_Platoon[20] = recruit PLATOON_INFO_AZTEC_MELEE_5 town AztecPreTown platoon of size 20
			
			wait until not LC10_Platoon[19] recruiting
			wait until not LC10_Platoon[20] recruiting
			
			attach LC10_Platoon[19] to AztecCapital
			attach LC10_Platoon[20] to AztecCapital
			
			run background script LC10_Platoon19Actions
			run background script LC10_Platoon20Actions
			
			WarTimer = create timer for 30 seconds
			
			PrisonEvent = 1	
		end if
		
		if PrisonPeopleDead == 1 and PrisonEvent == 0//Starts War + Volcano
			wait 30 seconds
			VolcanoActivated = 1
			WarTimer = create timer for 30 seconds
			
			PrisonEvent = 2
		end if 
		
		if get WarTimer time remaining <= 0 and WarStarted == 0
			WarStarted = 1
			
			if not ENEMY_CREATURE_ALLOWED_TO_ATTACK == 1
				ENEMY_CREATURE_ALLOWED_TO_ATTACK = 1
				Enemy_Creature_Attack_Delay = create timer for 900 seconds
			end if
			
			enable platoon LC10_Platoon[9] respond to local platoon attack
			enable platoon LC10_Platoon[10] respond to local platoon attack
			enable platoon LC10_Platoon[11] respond to local platoon attack
			
			LC10_Platoon[21] = recruit PLATOON_INFO_AZTEC_MELEE_5 town AztecFirstTown platoon of size 20
			LC10_Platoon[22] = recruit PLATOON_INFO_AZTEC_MELEE_5 town AztecFirstTown platoon of size 20
			LC10_SiegeCatapult[0] = recruit SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 town AztecFirstTown siege weapon
			LC10_SiegeCatapult[1] = recruit SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 town AztecFirstTown siege weapon
			
			wait until not LC10_Platoon[21] recruiting
			wait until not LC10_Platoon[22] recruiting
			wait until not LC10_SiegeCatapult[0] recruiting
			wait until not LC10_SiegeCatapult[1] recruiting
			
			run background script LC10_Platoon21Actions
			run background script LC10_Platoon22Actions
			run background script LC10_SiegeCatapult0Actions
			run background script LC10_SiegeCatapult1Actions
			
			ScriptedAttackTimer = create timer for 300 seconds
			
		end if
		
		if get Enemy_Creature_Attack_Delay time remaining <= 0
			ENEMY_CREATURE_ALLOWED_TO_ATTACK = 1
			Enemy_Creature_Attack_Delay = create timer for 900 seconds
		end if
		
		if TownsConverted >= 2 and PLAYER of AztecFirstTown == 1 and HurricaneHasBeenShot == 0 and CinemaIsRunning == 0
			HurricaneHasBeenShot = 1
			HurricaneActivated = 1
		end if
		
		if TownsConverted >= 3 and VolcanoHasBeenActivated1 == 0
			VolcanoHasBeenActivated1 = 1
			VolcanoActivated = 1
		end if
		
		if PLAYER of AztecFirstTown == 0 and VolcanoHasBeenActivated2 == 0
			VolcanoHasBeenActivated2 = 1
			VolcanoActivated = 1
		end if
		
		if PLAYER of AztecFirstTown == 0 and AztecFirstTownAttackSent == 0
			AztecFirstTownAttackSent = 1
			LC10_Platoon[35] = recruit PLATOON_INFO_AZTEC_MELEE_5 town AztecCapital platoon of size number from 40 to 60
			LC10_Platoon[36] = recruit PLATOON_INFO_AZTEC_RANGED_5 town AztecCapital platoon of size number from 40 to 60
			
			LC10_SiegeCatapult[9] = recruit SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 town AztecCapital siege weapon
			LC10_SiegeCatapult[10] = recruit SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 town AztecCapital siege weapon
			
			wait until not LC10_Platoon[35] recruiting
			wait until not LC10_Platoon[36] recruiting
			wait until not LC10_SiegeCatapult[9] recruiting
			wait until not LC10_SiegeCatapult[10] recruiting
			
			run background script LC10_Platoon35Actions
			run background script LC10_Platoon36Actions
			run background script LC10_SiegeCatapult9Actions
			run background script LC10_SiegeCatapult10Actions
			
			if not ENEMY_CREATURE_ALLOWED_TO_ATTACK == 1
				ENEMY_CREATURE_ALLOWED_TO_ATTACK = 1
				Enemy_Creature_Attack_Delay = create timer for 900 seconds
			end if
		end if
		
		if PLAYER of AztecPreTown == 0 and AztecPreTownAttackSent == 0
			AztecPreTownAttackSent = 1
			LC10_Platoon[33] = recruit PLATOON_INFO_AZTEC_MELEE_5 town AztecFirstTown platoon of size number from 40 to 60
			LC10_Platoon[34] = recruit PLATOON_INFO_AZTEC_RANGED_5 town AztecFirstTown platoon of size number from 40 to 60
			
			LC10_SiegeCatapult[7] = recruit SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 town AztecCapital siege weapon
			LC10_SiegeCatapult[8] = recruit SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 town AztecCapital siege weapon
			
			wait until not LC10_Platoon[33] recruiting
			wait until not LC10_Platoon[34] recruiting
			wait until not LC10_SiegeCatapult[7] recruiting
			wait until not LC10_SiegeCatapult[8] recruiting
			
			run background script LC10_Platoon33Actions
			run background script LC10_Platoon34Actions
			run background script LC10_SiegeCatapult7Actions
			run background script LC10_SiegeCatapult8Actions
			
			if not ENEMY_CREATURE_ALLOWED_TO_ATTACK == 1
				ENEMY_CREATURE_ALLOWED_TO_ATTACK = 1
				Enemy_Creature_Attack_Delay = create timer for 900 seconds
			end if
			
		end if
		
		Player1Impressiveness = get player 0 impressiveness
		if Player1Impressiveness > 7500 and ACSentCatapult == 0
			ACSentCatapult = 1
			wait 10 seconds
		end if
		
		if get ScriptedAttackTimer time remaining <= 0 and Attacker2Sent == 0
			LC10_SiegeCatapult[3] = recruit SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 town AztecCapital siege weapon
			LC10_SiegeCatapult[4] = recruit SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 town AztecCapital siege weapon

			wait until not LC10_SiegeCatapult[3] recruiting
			wait until not LC10_SiegeCatapult[4] recruiting

			run background script LC10_SiegeCatapult3Actions
			run background script LC10_SiegeCatapult4Actions
			
			Attacker2Sent = 1
			
		end if
		
		if PLAYER of AztecFirstTown == 1
			if TownsConverted >= 2 and HurricaneAttackersSent == 0
				if LC10_SiegeCatapult[0] exists and LC10_SiegeCatapult[1] exists//Combines it with the other 2 Catapults and Hurricane
				
					if not ENEMY_CREATURE_ALLOWED_TO_ATTACK == 1
						ENEMY_CREATURE_ALLOWED_TO_ATTACK = 1
					end if
				
					LC10_SiegeCatapult[5] = recruit SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 town AztecFirstTown siege weapon
					LC10_SiegeCatapult[6] = recruit SIEGE_BALANCE_TYPE_CATAPULT_LEVEL_5 town AztecFirstTown siege weapon

					wait until not LC10_SiegeCatapult[5] recruiting
					wait until not LC10_SiegeCatapult[6] recruiting

					run background script LC10_SiegeCatapult5Actions
					run background script LC10_SiegeCatapult6Actions
					
					HurricaneAttackersSent = 1
				end if
			end if
		end if
		
//		if UnderAttack >= 1 and EmergencyIsActive == 0
//			EmergencyIsActive = 1
//			set PlayerTown emergency for -1 seconds
//		elsif UnderAttack == 0 and EmergencyIsActive == 1
//			EmergencyIsActive = 0
//			stop PlayerTown emergency
//		end if
		
		if HEALTH of AIHurricane >= 1.0 and VolcanoActivated == 0 and HurricaneActivated == 1 and PLAYER of AztecFirstTown == 1 and CinemaIsRunning == 0 and HurricaneIsRunning == 0
			if HurricaneAttackersSent == 1
				HurricaneIsRunning = 1
				
				CHARGE of AIHurricane = 1.0
				
				Number = number from 1 to 3 
				if Number == 1
					CastEpicPos = marker at {1427.69,239.28,652.74}
				elsif Number == 2
					CastEpicPos = marker at {1232.13,224.24,604.32}
				else
					CastEpicPos = marker at {1152.89,235.91,875.48}
				end if
				
				EpicTarget = marker at {1251.28,224.54,738.14}
				
				HurricaneWarning = create visual effect VISUAL_EFFECT_EPIC_TARGET_WARNING at {CastEpicPos} time 15 target {CastEpicPos}
				wait 15 seconds
				EpicHurr = create hurricane at {CastEpicPos} player 1 direction {EpicTarget}
				
				run background script Land10Hurricane(AIHurricane, EpicHurr)
			end if
		end if
		
		if AztecPreTownAttackStarting == 0 and LC10_Platoon[33] exists and LC10_Platoon[34] exists and LC10_SiegeCatapult[7] exists and LC10_SiegeCatapult[8] exists
			AztecPreTownAttackStarting = 1
		end if
		
		if AztecFirstTownAttackStarting == 0 and LC10_Platoon[35] exists and LC10_Platoon[36] exists and LC10_SiegeCatapult[9] exists and LC10_SiegeCatapult[10] exists
			AztecFirstTownAttackStarting = 1
		end if
		
	end loop

end script LC10_Aztec_Capital

begin script AztecCapitalTownBuilding

start

	wait 180 seconds
	build all town AztecCapital buildings in group 0
	
	wait 600 seconds
	build all town AztecCapital buildings in group 1
	
	wait 400 seconds
	build all town AztecCapital buildings in group 2

end script AztecCapitalTownBuilding

begin script LC10_General_Speech

	Dialogue1Played = 0
	Dialogue2Played = 0
	a = 0
	b = 1
	DialogueTimer = 0
	SeenAztecPrison = 0
	SeenGreekMine = 0
	Greekmine = marker at {1391.23,246.59,614.35}
	PrisonDialoguePlayed = 0
	Number = 0
	AttackTimer = 0
	
	mig1 = 0
	mig2 = 0
	mig3 = 0
	mig4 = 0
	mig5 = 0
	mig6 = 0
	
	LoseTimer = create timer for 0 seconds
	LoseDialogue1 = 0
	LoseDialogue2 = 0
	LoseDialogue3 = 0
	LoseDialogue4 = 0
	LoseDialogue5 = 0

start

begin loop

	if (PLAYER of PlayerTown != 0 and PLAYER of AztecFirstTown != 0 and PLAYER of AztecPreTown != 0 and PLAYER of AztecCapital != 0) and get LoseTimer time remaining <= 0
		LoseDialogue1 = number from 1 to 5
		if LoseDialogue1 == 1
			begin dialogue
				make good spirit appear
				say "BW2T_SCRIPT_GENERIC_ADVISORS_SUGGEST_RESTART_10"
				wait until read
				send good spirit home
			end dialogue
		end if
		
		if LoseDialogue1 == 2
			begin dialogue
				make evil spirit appear
				say "BW2T_SCRIPT_GENERIC_ADVISORS_SUGGEST_RESTART_20"
				wait until read
				send evil spirit home
			end dialogue
		end if
		
		if LoseDialogue1 == 3
			begin dialogue
				make good spirit appear
				say "BW2T_SCRIPT_GENERIC_ADVISORS_SUGGEST_RESTART_30"
				wait until read
				send good spirit home
			end dialogue
		end if
		
		if LoseDialogue1 == 4
			begin dialogue
				make evil spirit appear
				say "BW2T_SCRIPT_GENERIC_ADVISORS_SUGGEST_RESTART_40"
				wait until read
				send evil spirit home
			end dialogue
		end if
		
		if LoseDialogue1 == 5
			begin dialogue
				make evil spirit appear
				say "BW2T_SCRIPT_GENERIC_ADVISORS_SUGGEST_RESTART_50"
				wait until read
				send evil spirit home
			end dialogue
		end if
		
		LoseTimer = create timer for 75 seconds
	end if

	if UnderAttack >= 1 and get AttackTimer time remaining <= 0
		UnderAttack = 0
		Number = number from 1 to 14
		if Number == 1
			begin dialogue
				make evil spirit appear
				say "BW2T_HELP_TEXT_GUIDANCE_BATTLE_ALERT_EA_01"
				wait until read
				send evil spirit home
			end dialogue
		end if
		if Number == 2
			begin dialogue
				make evil spirit appear
				say "BW2T_HELP_TEXT_GUIDANCE_BATTLE_ALERT_EA_02"
				wait until read
				send evil spirit home
			end dialogue
		end if
		if Number == 3
			begin dialogue
				make evil spirit appear
				say "BW2T_HELP_TEXT_GUIDANCE_BATTLE_ALERT_EA_05"
				wait until read
				send evil spirit home
			end dialogue
		end if
		if Number == 4
			begin dialogue
				make evil spirit appear
				say "BW2T_HELP_TEXT_GUIDANCE_BATTLE_ALERT_EA_06"
				wait until read
				send evil spirit home
			end dialogue
		end if
		if Number == 5
			begin dialogue
				make evil spirit appear
				say "BW2T_HELP_TEXT_GUIDANCE_BATTLE_ALERT_EA_07"
				wait until read
				send evil spirit home
			end dialogue
		end if
		if Number == 6
			begin dialogue
				make evil spirit appear
				say "BW2T_HELP_TEXT_GUIDANCE_BATTLE_ALERT_EA_08"
				wait until read
				send evil spirit home
			end dialogue
		end if
		if Number == 7
			begin dialogue
				make evil spirit appear
				say "BW2T_HELP_TEXT_GUIDANCE_BATTLE_ALERT_EA_18"
				wait until read
				send evil spirit home
			end dialogue
		end if
		if Number == 8
			begin dialogue
				make good spirit appear
				say "BW2T_HELP_TEXT_GUIDANCE_BATTLE_ALERT_GA_01"
				wait until read
				send good spirit home
			end dialogue
		end if
		if Number == 9
			begin dialogue
				make good spirit appear
				say "BW2T_HELP_TEXT_GUIDANCE_BATTLE_ALERT_GA_02"
				wait until read
				send good spirit home
			end dialogue
		end if
		if Number == 10
			begin dialogue
				make good spirit appear
				say "BW2T_HELP_TEXT_GUIDANCE_BATTLE_ALERT_GA_05"
				wait until read
				send good spirit home
			end dialogue
		end if
		if Number == 11
			begin dialogue
				make good spirit appear
				say "BW2T_HELP_TEXT_GUIDANCE_BATTLE_ALERT_GA_06"
				wait until read
				send good spirit home
			end dialogue
		end if
		if Number == 12
			begin dialogue
				make good spirit appear
				say "BW2T_HELP_TEXT_GUIDANCE_BATTLE_ALERT_GA_07"
				wait until read
				send good spirit home
			end dialogue
		end if
		if Number == 13
			begin dialogue
				make good spirit appear
				say "BW2T_HELP_TEXT_GUIDANCE_BATTLE_ALERT_GA_09"
				wait until read
				send good spirit home
			end dialogue
		end if
		if Number == 14
			begin dialogue
				make good spirit appear
				say "BW2T_HELP_TEXT_GUIDANCE_BATTLE_ALERT_GA_10"
				wait until read
				send good spirit home
			end dialogue
		end if
		AttackTimer = create timer for 45 seconds
	end if

	if PrisonDestroyed == 1 and PrisonDialoguePlayed == 0
		PrisonDialoguePlayed = 1
		begin dialogue
			wait 3 seconds
			say "BW2T_SCRIPT_10FINAL_ADVISORS_AZTEC_ANGER_10"
			wait until read
			say "BW2T_SCRIPT_10FINAL_ADVISORS_AZTEC_ANGER_50"
			wait until read
			make good spirit appear
			wait 0.6 seconds
			say "BW2T_SCRIPT_10FINAL_ADVISORS_AZTEC_ANGER_60"
			wait until read
			make evil spirit appear
			wait 0.3 seconds
			say "BW2T_SCRIPT_10FINAL_ADVISORS_AZTEC_ANGER_70"
			wait until read
			send good spirit home
			send evil spirit home
			wait 10 seconds
			say "BW2T_SCRIPT_10FINAL_ADVISORS_AZTEC_ANGER_80"
			wait until read
		end dialogue
	end if
	
	if PrisonPeopleDead == 1 and PrisonDialoguePlayed == 0
		PrisonDialoguePlayed = 1
		begin dialogue
			say "BW2T_SCRIPT_10FINAL_CATPULTS_KILL_SOME_WOMEN"
			wait until read
			make good spirit appear
			say "BW2T_SCRIPT_10FINAL_EARTHQUAKE_10"
			wait until read
			wait 3 seconds
			send good spirit home
		end dialogue
	end if
	
	if VolcanoActivated == 1 and Dialogue1Played == 0
		Dialogue1Played = 1
		begin dialogue
			say "BW2T_SCRIPT_10FINAL_EPIC_VOLCANO_READY"
			wait until read
		end dialogue
		DialogueTimer = create timer for 100 seconds
		b = 0
	end if
	
	if HurricaneAttackersSent == 1 and Dialogue2Played == 0
		Dialogue2Played = 1
		begin dialogue
			say "BW2T_SCRIPT_09FINAL_EPIC_HURRICANE_READY"
			wait until read
		end dialogue
	end if
	if get DialogueTimer time remaining <= 0 and b == 0
		b = 1
		begin dialogue
			make evil spirit appear
			say "BW2T_SCRIPT_10FINAL_EPILOGUE"
			wait until read
			send evil spirit home
		end dialogue
	end if
	
	if (variable get town AztecCapital status == variable TOWN_STATUS_MIGRATION_ARRIVED) and mig1 == 0
		mig1 = 1
		Number = number from 1 to 2
		if Number == 1
			begin dialogue
				make good spirit appear
				say "BW2T_SCRIPT_GENERIC_PICKUP200"
				wait until read
				send good spirit home
			end dialogue
		end if
		if Number == 2
			begin dialogue
				make evil spirit appear
				say "BW2T_SCRIPT_GENERIC_PICKUP201"
				wait until read
				send evil spirit home
			end dialogue
		end if
	end if
	
	if (variable get town AztecPreTown status == variable TOWN_STATUS_MIGRATION_ARRIVED) and mig2 == 0
		mig2 = 1
		Number = number from 1 to 2
		if Number == 1
			begin dialogue
				make good spirit appear
				say "BW2T_SCRIPT_GENERIC_PICKUP200"
				wait until read
				send good spirit home
			end dialogue
		end if
		if Number == 2
			begin dialogue
				make evil spirit appear
				say "BW2T_SCRIPT_GENERIC_PICKUP201"
				wait until read
				send evil spirit home
			end dialogue
		end if
	end if
	
	if (variable get town AztecPrison status == variable TOWN_STATUS_MIGRATION_ARRIVED) and mig3 == 0
		mig3 = 1
		Number = number from 1 to 2
		if Number == 1
			begin dialogue
				make good spirit appear
				say "BW2T_SCRIPT_GENERIC_PICKUP200"
				wait until read
				send good spirit home
			end dialogue
		end if
		if Number == 2
			begin dialogue
				make evil spirit appear
				say "BW2T_SCRIPT_GENERIC_PICKUP201"
				wait until read
				send evil spirit home
			end dialogue
		end if
	end if
	
	if (variable get town AztecFirstTown status == variable TOWN_STATUS_MIGRATION_ARRIVED) and mig4 == 0
		mig4 = 1
		Number = number from 1 to 2
		if Number == 1
			begin dialogue
				make good spirit appear
				say "BW2T_SCRIPT_GENERIC_PICKUP200"
				wait until read
				send good spirit home
			end dialogue
		end if
		if Number == 2
			begin dialogue
				make evil spirit appear
				say "BW2T_SCRIPT_GENERIC_PICKUP201"
				wait until read
				send evil spirit home
			end dialogue
		end if
	end if
	
	if (variable get town MinorTown status == variable TOWN_STATUS_MIGRATION_ARRIVED) and mig5 == 0
		mig5 = 1
		Number = number from 1 to 2
		if Number == 1
			begin dialogue
				make good spirit appear
				say "BW2T_SCRIPT_GENERIC_PICKUP200"
				wait until read
				send good spirit home
			end dialogue
		end if
		if Number == 2
			begin dialogue
				make evil spirit appear
				say "BW2T_SCRIPT_GENERIC_PICKUP201"
				wait until read
				send evil spirit home
			end dialogue
		end if
	end if
	
	if (variable get town DisbelieverTown status == variable TOWN_STATUS_MIGRATION_ARRIVED) and mig6 == 0
		mig6 = 1
		Number = number from 1 to 2
		if Number == 1
			begin dialogue
				make good spirit appear
				say "BW2T_SCRIPT_GENERIC_PICKUP200"
				wait until read
				send good spirit home
			end dialogue
		end if
		if Number == 2
			begin dialogue
				make evil spirit appear
				say "BW2T_SCRIPT_GENERIC_PICKUP201"
				wait until read
				send evil spirit home
			end dialogue
		end if
	end if
	
	if TownsConverted >= 1 and a == 0
		begin dialogue
			a = 1
			say "BW2T_SCRIPT_10FINAL_GREEKS_TAKE_TOWN_VIA_IMPRESSIVENESS_1"
			wait until read
		end dialogue
	end if
	
	if TownsConverted >= 2 and a == 1
		begin dialogue
			a = 2
			say "BW2T_SCRIPT_10FINAL_GREEKS_TAKE_TOWN_VIA_IMPRESSIVENESS_2"
			wait until read
		end dialogue
	end if
	
	if TownsConverted >= 3 and a == 2
		begin dialogue
			a = 3
			say "BW2T_SCRIPT_10FINAL_GREEKS_TAKE_TOWN_VIA_IMPRESSIVENESS_4"
			wait until read
		end dialogue
	end if

	if get distance from camera position to {PrisonDialoguePos} <= 150 and {PrisonDialoguePos} viewed and SeenAztecPrison == 0 and LC10_Platoon[0] exists
		if PrisonDestroyed == 0 and PrisonPeopleDead == 0
		
			SeenAztecPrison = 1
			begin dialogue
				make evil spirit appear
				say "BW2T_SCRIPT_10FINAL_INTRO_40"
				wait until read
				say "BW2T_SCRIPT_10FINAL_INTRO_50"
				wait until read
				say "BW2T_SCRIPT_10FINAL_INTRO_60"
				wait until read
				say "BW2T_SCRIPT_10FINAL_INTRO_70"
				wait until read
				say "BW2T_SCRIPT_10FINAL_INTRO_80"
				wait until read
				wait 2 seconds
				send evil spirit home
			end dialogue
		
		end if
	end if
	
	if get distance from camera position to {Greekmine} <= 75 and {Greekmine} viewed and SeenGreekMine == 0 
		SeenGreekMine = 1
		begin dialogue
			make evil spirit appear
			say "BW2T_SCRIPT_10FINAL_ADVISORS_OBJECTIVES"
			wait until read
			wait 1 seconds
			send evil spirit home
		end dialogue
	end if
	
	if PrisonDestroyed == 1 or PrisonPeopleDead == 1 //Starts leader speeches.
	
	end if
	
end loop

end script LC10_General_Speech

begin script GatehouseManager

	GatehousePos[7]
	GateHouseT11 = 0
	GateHouseT12 = 0
	GateHouseT21 = 0
	GateHouseT22 = 0
	Counter = 0
	Cnt = 0


	//T1 = AztecCapital
	//T2 = AztecFirstTown
	oCreature = get player 0 creature
	PlayerPlatoonT11 = 0
	CatapultT11 = 0
	TestCreatureT11 = 0
	PlayerPlatoonT12 = 0
	CatapultT12 = 0
	TestCreatureT12 = 0
	PlayerPlatoonT21 = 0
	CatapultT21 = 0
	TestCreatureT21 = 0
	PlayerPlatoonT22 = 0
	CatapultT22 = 0
	TestCreatureT22 = 0
	EnemyNearDoorT11 = 0
	EnemyNearDoorT12 = 0
	EnemyNearDoorT21 = 0
	EnemyNearDoorT22 = 0

start

begin loop
	GateHouseT11 = get SCRIPT_OBJECT_TYPE_ABODE ABODE_NUMBER_GATEHOUSE at {923.15,393.46,1758.10} radius 15
	GateHouseT12 = get SCRIPT_OBJECT_TYPE_ABODE ABODE_NUMBER_GATEHOUSE at {836.60,401.87,1742.40} radius 15
	GateHouseT21 = get SCRIPT_OBJECT_TYPE_ABODE ABODE_NUMBER_GATEHOUSE_F at {1711.16,210.77,866.27} radius 15
	GateHouseT22 = get SCRIPT_OBJECT_TYPE_ABODE ABODE_NUMBER_GATEHOUSE_F at {1764.25,212.67,1202.91} radius 15
	
	oCreature = get player 0 creature

	if PLAYER of AztecCapital == 1

		PlayerPlatoonT11 = get platoon of player 0 nearest {GateHouseT11} radius 100
		CatapultT11 = get siege weapon of player 0 nearest {GateHouseT11} radius 100
		TestCreatureT11 = get distance from {GateHouseT11} to {oCreature}
		
		if PlayerPlatoonT11 exists
			EnemyNearDoorT11 = 1
		elsif CatapultT11 exists
			EnemyNearDoorT11 = 1
		elsif TestCreatureT11 < 200 and SCRIPT_OBJECT_PROPERTY_TYPE_HEALTH of oCreature > 0.00
			EnemyNearDoorT11 = 1
		else
			EnemyNearDoorT11 = 0
		end if
		
		if EnemyNearDoorT11 == 1
			set gate GateHouseT11 close
		else
			set gate GateHouseT11 open
		end if
		
		PlayerPlatoonT12 = get platoon of player 0 nearest {GateHouseT12} radius 100
		CatapultT12 = get siege weapon of player 0 nearest {GateHouseT12} radius 100
		TestCreatureT12 = get distance from {GateHouseT12} to {oCreature}
		
		if PlayerPlatoonT12 exists
			EnemyNearDoorT12 = 1
		elsif CatapultT12 exists
			EnemyNearDoorT12 = 1
		elsif TestCreatureT12 < 200 and SCRIPT_OBJECT_PROPERTY_TYPE_HEALTH of oCreature > 0.00
			EnemyNearDoorT12 = 1
		else
			EnemyNearDoorT12 = 0
		end if
		
		if EnemyNearDoorT12 == 1
			set gate GateHouseT12 close
		else
			set gate GateHouseT12 open
		end if
		
	end if

	if PLAYER of AztecFirstTown == 1
	
		PlayerPlatoonT21 = get platoon of player 0 nearest {GateHouseT21} radius 100
		CatapultT21 = get siege weapon of player 0 nearest {GateHouseT21} radius 100
		TestCreatureT21 = get distance from {GateHouseT21} to {oCreature}
		
		if PlayerPlatoonT21 exists
			EnemyNearDoorT21 = 1
		elsif CatapultT21 exists
			EnemyNearDoorT21 = 1
		elsif TestCreatureT21 < 200 and SCRIPT_OBJECT_PROPERTY_TYPE_HEALTH of oCreature > 0.00
			EnemyNearDoorT21 = 1
		else
			EnemyNearDoorT21 = 0
		end if
		
		if EnemyNearDoorT21 == 1
			set gate GateHouseT21 close
		else
			set gate GateHouseT21 open
		end if
		
		PlayerPlatoonT22 = get platoon of player 0 nearest {GateHouseT22} radius 100
		CatapultT22 = get siege weapon of player 0 nearest {GateHouseT22} radius 100
		TestCreatureT22 = get distance from {GateHouseT22} to {oCreature}
		
		if PlayerPlatoonT22 exists
			EnemyNearDoorT22 = 1
		elsif CatapultT22 exists
			EnemyNearDoorT22 = 1
		elsif TestCreatureT22 < 200 and SCRIPT_OBJECT_PROPERTY_TYPE_HEALTH of oCreature > 0.00
			EnemyNearDoorT22 = 1
		else
			EnemyNearDoorT22 = 0
		end if
		
		if EnemyNearDoorT22 == 1
			set gate GateHouseT22 close
		else
			set gate GateHouseT22 open
		end if
	
	end if
	
end loop

end script GatehouseManager

begin script ResourceManagerAztecCapital

start

begin loop

	wait 5 seconds //To evade the sound bug if storage is burning...

	if PLAYER of AztecCapital == 1
		if (get town AztecCapital RESOURCE_TYPE_ORE total < 17624)
			add resource RESOURCE_TYPE_ORE 500 to AztecCapital
		elsif (get town AztecCapital RESOURCE_TYPE_WOOD total < 18218)
			add resource RESOURCE_TYPE_WOOD 2471 to AztecCapital
		elsif (get town AztecCapital RESOURCE_TYPE_FOOD total < 17822)
			add resource RESOURCE_TYPE_FOOD 2471 to AztecCapital
		end if
	end if
	
	until PLAYER of AztecCapital != 1
end loop	

end script ResourceManagerAztecCapital

begin script ResourceManagerAztecFirstTown

start

begin loop

	wait 5 seconds

	if PLAYER of AztecFirstTown == 1
		if (get town AztecFirstTown RESOURCE_TYPE_ORE total < 31287)
			add resource RESOURCE_TYPE_ORE 500 to AztecFirstTown
		elsif (get town AztecFirstTown RESOURCE_TYPE_WOOD total < 32698)
			add resource RESOURCE_TYPE_WOOD 2471 to AztecFirstTown
		elsif (get town AztecFirstTown RESOURCE_TYPE_FOOD total < 31287)
			add resource RESOURCE_TYPE_FOOD 2471 to AztecFirstTown
		end if
	end if
	
	until PLAYER of AztecFirstTown != 1
end loop	

end script ResourceManagerAztecFirstTown

begin script Volcano

oTown = 0
vEpic = 0
AIVolcano = 0
Number = 0

// Visual effects for the Volcano - 1 to 12
oVisual = 0
oVisual2 = 0
oVisual3 = 0
oVisual3Pos = 0
oVisual4 = 0
oVisual5 = 0
oVisual6 = 0
oVisual7 = 0
oVisual8 = 0
oVisual9 = 0
oVisual10 = 0
oVisual11 = 0
oVisual12 = 0

// Visual effects for the Volcano - 13 to 26
oVisual13 = 0
oVisual14 = 0
oVisual15 = 0
oVisual16 = 0
oVisual17 = 0
oVisual18 = 0
oVisual19 = 0
oVisual20 = 0
oVisual21 = 0
oVisual22 = 0
oVisual23 = 0
oVisual24 = 0
oVisual25 = 0
oVisual26 = 0
pVisual = 0

// Unused variables
VolcanoMixer = 0
VolcanoWorldPos = 0
Sound = 0

// Volcano Epic Positions and focuses
vEpicFoc = 0
vEpicPos = 0
RelativePos = 0
Cam = marker at camera position
PosX = 0
PosZ = 0

// Front of Wonder Pos
WonderPos = 0

start

begin loop
	vEpic = get SCRIPT_OBJECT_TYPE_WONDER EPIC_WONDER_NUMBER_VOLCANO at {517.63,482.50,1897.98} radius 150
	
until vEpic exists
end loop

begin loop
	AIVolcano = 0
	VolcanoStopFireBalls = 0
	wait until VolcanoActivated == 1
	begin loop
			if vEpic exists
				wait 1 second
				if (HEALTH of vEpic == 1.0)
					SCRIPT_OBJECT_PROPERTY_TYPE_CHARGE of vEpic = 1.0
					begin loop
						if VolcanoActivated == 1 and HurricaneActivated == 0 and PLAYER of AztecCapital == 1 and CinemaIsRunning == 0
							wait until (SCRIPT_OBJECT_PROPERTY_TYPE_BUILT_PERCENTAGE of vEpic == 1.0)
							if SCRIPT_OBJECT_PROPERTY_TYPE_CHARGE of vEpic < 1.0
								SCRIPT_OBJECT_PROPERTY_TYPE_CHARGE of vEpic = 1.0
							end if
							wait 10 seconds
							if PLAYER of AztecFirstTown == 0
								VolcanoPosAI = marker at {1756.33,1020.15}
							elsif TownsConverted >= 3
								VolcanoPosAI = marker at {1273.89,934.78}
							else
								VolcanoPosAI = marker at {1319.86,613.35}
							end if
							AIVolcano = create volcano at {VolcanoPosAI} player 1
							enable predefined sky "VOLCANO" time 10
							pVisual = create visual effect VISUAL_EFFECT_EPIC_TARGET_WARNING at {VolcanoPosAI} time 15
							invoke vEpic EPIC_WONDER_STAGE_1
							wait 2 seconds
							invoke vEpic EPIC_WONDER_STAGE_2
							wait 2.2 seconds
							invoke vEpic EPIC_WONDER_STAGE_3
							invoke vEpic EPIC_WONDER_STAGE_4
							wait 2.5 seconds
							invoke vEpic EPIC_WONDER_STAGE_5
							invoke vEpic EPIC_WONDER_STAGE_6
							invoke vEpic EPIC_WONDER_STAGE_7
							wait 2 seconds
							invoke vEpic EPIC_WONDER_STAGE_8
							invoke vEpic EPIC_WONDER_STAGE_9
							invoke vEpic EPIC_WONDER_STAGE_10
							invoke vEpic EPIC_WONDER_STAGE_START_BEAM
							wait 1.5 seconds
							oVisual = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM on vEpic time 1
							oVisual20 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM on vEpic time 1
							oVisual2 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM_PULSE_UP at {vEpic} time 1
							oVisual16 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM_PULSE_UP at {vEpic}+{0,5,0} time 1
							wait 4 seconds
							stop visual effect oVisual
							stop visual effect oVisual2
							run background script VolcanoCinema
							wait 2 seconds
							oVisual3 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM at {VolcanoPosAI} time -1
							play string sound "SCRIPT1_vEpic_BEAMOFLIGHTSTART1"
							invoke AIVolcano EPIC_START_SWIRL
							wait 1 second
							oVisual4 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM_PULSE_DOWN at {AIVolcano}+{0,200,0} time 1
							oVisual10 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM_PULSE_DOWN at {AIVolcano}+{0,205,0} time 1
							play string sound "SCRIPT1_vEpic_DECAYCHARGESPELL"
							wait 2 seconds
							oVisual5 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM_PULSE_DOWN at {AIVolcano}+{0,200,0} time 1
							oVisual11 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM_PULSE_DOWN at {AIVolcano}+{0,205,0} time 1
							play string sound "SCRIPT1_vEpic_DECAYCHARGESPELL"
							wait 2 seconds
							oVisual6 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM_PULSE_DOWN at {AIVolcano}+{0,200,0} time 1
							oVisual12 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM_PULSE_DOWN at {AIVolcano}+{0,205,0} time 1
							play string sound "SCRIPT1_vEpic_DECAYCHARGESPELL"
							invoke AIVolcano EPIC_START_SHOCKWAVE
							start music "volcano_music"
							attach atmos "spells" to AIVolcano
							play string sound "SCRIPT2_EEPIC_EARTHQUAKECRACK"
							wait 1 second
							invoke AIVolcano EPIC_START_RISING
							invoke AIVolcano EPIC_START_SMOKE
							wait 1 second
							oVisual7 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM_PULSE_DOWN at {AIVolcano}+{0,200,0} time 1
							oVisual13 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM_PULSE_DOWN at {AIVolcano}+{0,205,0} time 1
							play string sound "SCRIPT1_vEpic_DECAYCHARGESPELL"
							wait 2 seconds
							oVisual7 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM_PULSE_DOWN at {AIVolcano}+{0,200,0} time 1
							oVisual13 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM_PULSE_DOWN at {AIVolcano}+{0,205,0} time 1
							play string sound "SCRIPT1_vEpic_DECAYCHARGESPELL"
							wait 2 seconds
							oVisual8 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM_PULSE_DOWN at {AIVolcano}+{0,200,0} time 1
							oVisual14 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM_PULSE_DOWN at {AIVolcano}+{0,205,0} time 1
							play string sound "SCRIPT1_vEpic_DECAYCHARGESPELL"
							wait 2 seconds
							oVisual9 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM_PULSE_DOWN at {AIVolcano}+{0,200,0} time 1
							oVisual15 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM_PULSE_DOWN at {AIVolcano}+{0,205,0} time 1
							play string sound "SCRIPT1_vEpic_DECAYCHARGESPELL"
							wait 2 seconds
							oVisual21 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM_PULSE_DOWN at {AIVolcano}+{0,200,0} time 1
							oVisual22 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM_PULSE_DOWN at {AIVolcano}+{0,205,0} time 1
							play string sound "SCRIPT1_vEpic_DECAYCHARGESPELL"
							wait 3 seconds
							stop sound "SCRIPT2_EEPIC_EARTHQUAKECRACK"
							oVisual25 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM_PULSE_DOWN at {AIVolcano}+{0,200,0} time 1
							oVisual26 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM_PULSE_DOWN at {AIVolcano}+{0,205,0} time 1
							play string sound "SCRIPT1_vEpic_DECAYCHARGESPELL"
							play string sound "SCRIPT1_vEpic_EXPLOSION3"
							play string sound "SCRIPT1_vEpic_VOLCANOSHOCKWAVHIGHPITCHED"
							invoke AIVolcano EPIC_START_EXPLOSION
							invoke AIVolcano EPIC_FLASH
							invoke AIVolcano EPIC_FLASH
							oVisual16 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM_PULSE_DOWN at {AIVolcano}+{0,200,0} time 1
							oVisual17 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM_PULSE_DOWN at {AIVolcano}+{0,205,0} time 1
							play string sound "SCRIPT1_vEpic_DECAYCHARGESPELL"
							wait 2 seconds
							oVisual23 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM_PULSE_DOWN at {AIVolcano}+{0,200,0} time 1
							oVisual24 = create visual effect VISUAL_EFFECT_EPIC_VOLCANO_BEAM_PULSE_DOWN at {AIVolcano}+{0,205,0} time 1
							play string sound "SCRIPT1_vEpic_DECAYCHARGESPELL"
							wait 3.5 seconds
							stop visual effect oVisual3
							play string sound "SCRIPT1_vEpic_EXPLOSION3"
							invoke AIVolcano EPIC_START_EXPLOSION
							invoke AIVolcano EPIC_FLASH
							invoke AIVolcano EPIC_FLASH
							invoke AIVolcano EPIC_START_BUBBLING_LAVA
							invoke AIVolcano EPIC_START_LAVA
							wait 6 seconds
							run background script VolcanoFireBalls
							invoke AIVolcano EPIC_START_ASH
							invoke AIVolcano EPIC_START_SMOKE
							play string sound "SCRIPT1_vEpic_EXPLOSION3"
							invoke AIVolcano EPIC_START_EXPLOSION
							invoke AIVolcano EPIC_FLASH
							invoke AIVolcano EPIC_FLASH
							wait 0.2 seconds
							invoke AIVolcano EPIC_START_ROCK_SHOWER
							invoke AIVolcano EPIC_SPAWN_ROCKS
							wait 4 seconds
							play string sound "SCRIPT1_vEpic_EXPLOSION3"
							invoke AIVolcano EPIC_START_EXPLOSION
							invoke AIVolcano EPIC_FLASH
							invoke AIVolcano EPIC_FLASH
							wait 4.2 seconds
							play string sound "SCRIPT1_vEpic_EXPLOSION3"
							invoke AIVolcano EPIC_START_EXPLOSION
							invoke AIVolcano EPIC_FLASH
							invoke AIVolcano EPIC_FLASH
							wait 5 seconds
							play string sound "SCRIPT1_vEpic_EXPLOSION3"
							invoke AIVolcano EPIC_START_EXPLOSION
							invoke AIVolcano EPIC_FLASH
							invoke AIVolcano EPIC_FLASH
							enable predefined sky "DEFAULT" time 5
							wait 5 seconds
							play string sound "SCRIPT1_vEpic_EXPLOSION3"
							invoke AIVolcano EPIC_START_EXPLOSION
							invoke AIVolcano EPIC_FLASH
							invoke AIVolcano EPIC_FLASH
							wait 2 seconds
							play string sound "SCRIPT1_vEpic_EXPLOSION3"
							invoke AIVolcano EPIC_START_EXPLOSION
							invoke AIVolcano EPIC_FLASH
							invoke AIVolcano EPIC_FLASH
							play string sound "SCRIPT1_vEpic_EXPLOSION3"
							invoke AIVolcano EPIC_START_EXPLOSION
							invoke AIVolcano EPIC_FLASH
							invoke AIVolcano EPIC_FLASH
							wait 2 seconds
							play string sound "SCRIPT1_vEpic_EXPLOSION3"
							wait 28 seconds
							VolcanoStopFireBalls = 1
							invoke AIVolcano EPIC_STOP_ASH
							invoke AIVolcano EPIC_STOP_SMOKE
							invoke AIVolcano EPIC_END_ROCK_SHOWER
							invoke AIVolcano EPIC_START_FALLING
							invoke AIVolcano EPIC_STOP_BUBBLING_LAVA
							wait 10 seconds
							invoke AIVolcano EPIC_STOP_LAVA
							wait 5 seconds
							enable predefined sky "DEFAULT" time 10
							delete AIVolcano
							invoke vEpic EPIC_WONDER_STAGE_LAST
							AIVolcano = 1
							VolcanoActivated = 0
						end if
					end loop
				end if
			end if
		until AIVolcano == 1
	end loop
end loop

end script Volcano

begin script VolcanoFireBalls

	Number = 0
	FireBall = 0
	FireBallTarget = 0
	FireBallStart = 0

start

begin loop

	if PLAYER of AztecFirstTown == 0
		FireBallStart = marker at ({VolcanoPosAI} + {0,360,0})
		FireBallTarget = marker at ({FireBallStart} + {number from -60 to 60, 0, number from -60 to 60})
		FireBall = make player 1 throw miracle MIRACLE_TYPE_FIRE from ({FireBallStart} + {0,-3.0,0}) heading ({FireBallTarget} + {0,21,0} - {FireBallStart})
	elsif TownsConverted >= 3
		FireBallStart = marker at ({VolcanoPosAI} + {0,325,0})
		FireBallTarget = marker at ({FireBallStart} + {number from -60 to 60, 0, number from -60 to 60})
		FireBall = make player 1 throw miracle MIRACLE_TYPE_FIRE from ({FireBallStart} + {0,-3.0,0}) heading ({FireBallTarget} + {0,21,0} - {FireBallStart})
	else
		FireBallStart = marker at ({VolcanoPosAI} + {0,280,0})
		FireBallTarget = marker at ({FireBallStart} + {number from -60 to 60, 0, number from -60 to 60})//number from blabla... defines the speed of the fireballs
		FireBall = make player 1 throw miracle MIRACLE_TYPE_FIRE from ({FireBallStart} + {0,-3.0,0}) heading ({FireBallTarget} + {0,21,0} - {FireBallStart})
	end if
	
	Number = number from 1 to 3
	
	if Number == 1
		wait 1.5 seconds
	elsif Number == 2
		wait 2.75 seconds
	elsif Number == 3
		wait 4.4 seconds
	end if
	
	until VolcanoStopFireBalls == 1
end loop

end script VolcanoFireBalls

begin script VolcanoCinema

	CinemaEnd = 0

start

	CinemaEnd = 0

if PLAYER of AztecFirstTown == 0

	begin loop
		begin cinema
			set camera focus to {1756.33,333.23,1020.15}+{0,10,0}
			set camera position to {1504.13,369.44,938.31}+{0,20,0}
			wait 9 seconds
			set camera focus to {1756.33,333.23,1020.15}+{0,45,0}
			set camera position to {1638.10,245.04,1122.79}+{0,60,0}
			wait 4 seconds
		end cinema
		CinemaEnd = 1
		until CinemaEnd == 1 or key KB_ESC down
	end loop
	
elsif TownsConverted >= 3

	begin loop
		begin cinema
			set camera focus to {1273.89,313.51,934.78}+{0,10,0}
			set camera position to {1338.47,238.28,840.62}+{-20,40,-20}
			wait 9 seconds
			set camera focus to {1273.89,313.51,934.78}+{-5,10,-15}
			set camera position to {1329.19,316.39,542.59}+{0,90,0}
			wait 4 seconds
		end cinema
		CinemaEnd = 1
		until CinemaEnd == 1 or key KB_ESC down
	end loop

else
	
	begin loop
		begin cinema
			set camera focus to {1319.86,252.80,613.35}+{0,10,0}
			set camera position to {1338.47,238.28,840.62}+{0,80,0}
			wait 9 seconds
			set camera focus to {1319.86,252.80,613.35}+{0,30,0}
			set camera position to {1261.68,223.56,718.79}+{0,45,0}
			wait 4 seconds
		end cinema
		CinemaEnd = 1
		until CinemaEnd == 1 or key KB_ESC down
	end loop
	
end if

end script VolcanoCinema

begin script Land10BodgingInTheBackground(Hurricane)

ItThisRidiculous[50]
ThisIs[50]
count=0
howlong=0
HOusesThatCanBeDestroyed[11]
whichhouse=0
howmanyhousestodestroy=50

start

if EnemyFiringVersion == 1
	howmanyhousestodestroy=20
end if



HOusesThatCanBeDestroyed[0] = variable ABODE_A
HOusesThatCanBeDestroyed[1] = variable ABODE_B
HOusesThatCanBeDestroyed[2] = variable ABODE_C
HOusesThatCanBeDestroyed[3] = variable ABODE_D
HOusesThatCanBeDestroyed[4] = variable ABODE_E
HOusesThatCanBeDestroyed[5] = variable ABODE_NUMBER_ALTAR
HOusesThatCanBeDestroyed[6] = variable ABODE_NUMBER_TEMPLE
HOusesThatCanBeDestroyed[7] = variable ABODE_NUMBER_AMPITHEATRE
HOusesThatCanBeDestroyed[8] = variable ABODE_NUMBER_BATHHOUSE
HOusesThatCanBeDestroyed[9] = variable ABODE_NUMBER_WALLTOWER_TECH0
HOusesThatCanBeDestroyed[10] = variable ABODE_NUMBER_WALLTOWER_TECH0


while count != 20

		wait 0.2 seconds

		ItThisRidiculous[count] = get HOUSE constant HOusesThatCanBeDestroyed[whichhouse] at {Hurricane} radius 100 excluding scripted
			if whichhouse < 11
				whichhouse++
			else
				whichhouse = 0
			end if


		if ItThisRidiculous[count] exists and variable get ItThisRidiculous[count] sub type != variable GATEHOUSE and variable get ItThisRidiculous[count] sub type != variable ABODE_NUMBER_TOWN_CENTRE and variable get ItThisRidiculous[count] sub type != variable SCRIPT_OBJECT_TYPE_MINE
			ThisIs[count] = convert ItThisRidiculous[count] using SCRIPT_CONVERSION_ROCK
			set ThisIs[count] velocity heading {ThisIs[count]} speed 0.1

			run background script DeleteBuildingsWithExplode(ThisIs[count])	

		end if

		count++

end while

count = 0

wait until ClearUpStuff==1
while count != 50
	if ThisIs[count] exists
		delete ThisIs[count]// with explosion
	end if
	count++
end while

ClearUpStuff=0
wait 2 seconds

end script Land10BodgingInTheBackground

begin script Land10Hurricane(whichwonder, Hurricane)

MyDance = 0
Dancer = 0
Wonder = 0
Count = 0
RelCamPos=0
RelCamFoc=0
AboveH=0
Beam=0
Beam2=0
BeamPlace=0

MusicEventTimer=0
MusicEvent1=0
MusicEvent2=0
MusicEvent3=0
MusicEvent4=0
MusicEvent5=0
MusicEvent6=0
MusicEvent7=0
MusicEvent8=0
MusicEvent9=0

StarDude=0
StarAbode=0

MyHurricanePos=0
MyHurricaneFoc=0
MyWeather=0

checkthemofo=0
count=0

LoadsOfFloatingVillagers[20]

DodgyBuilding=0

Imwalkingaway=0

HowLongDoIWait = create timer for 0 seconds

start

	begin interruptible cinema

	//shake camera strength 6.0

		set camera position to ({PlayerTown} + {20,75,20})
		set camera focus to ({CastEpicPos} + {-10,15,-10})
		wait 1 seconds

		invoke Hurricane EPIC_HURRICANE_BEAM_DOWN
		invoke Hurricane EPIC_START_GROUND_SWIRL
		start music "hurricane_music"
		MusicEventTimer=create timer for 0 seconds
		MusicEvent1=get music "hurricane_music" event "1" time
		MusicEvent2=get music "hurricane_music" event "2" time
		MusicEvent3=get music "hurricane_music" event "3" time
		MusicEvent4=get music "hurricane_music" event "4" time
		MusicEvent5=get music "hurricane_music" event "5" time
		MusicEvent6=get music "hurricane_music" event "6" time
		MusicEvent7=get music "hurricane_music" event "7" time
		MusicEvent8=get music "hurricane_music" event "8" time
		MusicEvent9=get music "hurricane_music" event "9" time

		attach atmos "spells" to Hurricane// range 500
		set Hurricane atmos group 7 time 1 seconds

		wait 4 seconds
		invoke Hurricane EPIC_HURRICANE_END_BEAM

		
		RelCamPos = marker at get world position from Hurricane to {-118.462, 87.143, -39.850}
		RelCamFoc = marker at get world position from Hurricane to {-25.092, 60.366, -16.080}
		set camera position to {RelCamPos}
		set camera focus to {RelCamFoc}

		invoke Hurricane EPIC_START_TOP_SWIRL

		invoke Hurricane EPIC_CREATE_CLOUDS
		invoke Hurricane EPIC_SET_CLOUDS_STORM

		//wait until get MusicEventTimer time since set >= MusicEvent1
		wait 1 seconds
		invoke Hurricane EPIC_MOVE_TORNADO

		invoke Hurricane EPIC_EXIT_TORNADO

		skip current cutscene

        
		MyHurricanePos = marker at future position of epic miracle Hurricane with time 3 seconds
		MyHurricaneFoc = marker at future focus of epic miracle Hurricane with time 3 seconds
		set HowLongDoIWait time to 4 seconds

		while StarDude not exists and get HowLongDoIWait time remaining > 0
			StarDude = get star villager near {Hurricane}
		end while

		if StarDude exists
			disable StarDude moveable
			Imwalkingaway = marker at get target from {MyHurricanePos} to {StarDude} distance 2 angle 0
			set StarDude focus to {Imwalkingaway}
			move StarDude position to {Imwalkingaway}
			
			set HowLongDoIWait time to 3 seconds
			wait until {StarDude} near {Imwalkingaway} radius 1 or get HowLongDoIWait time remaining <= 0
			RelCamPos=marker at get world position from StarDude to {-4.789, 1.355, -0.787}
			RelCamFoc=marker at get world position from StarDude to {-3.814, 1.363, -0.567}
			set camera position to {RelCamPos}
			set camera focus to {RelCamFoc}
			wait 1 seconds
			enable StarDude moveable
			//set StarDude target {Hurricane} time 12
			set StarDude velocity heading {Hurricane} speed 50
			wait 1 seconds

		end if
/*
		set camera position follow Hurricane offset {-75.293, 19.012, -17.634}
		set camera focus follow Hurricane offset {-74.316, 18.923, -17.442}
		//wait 5 seconds//until get MusicEventTimer time since set >= MusicEvent2
		*/set HowLongDoIWait time to 4 seconds
		
		while StarAbode not exists and get HowLongDoIWait time remaining > 0
			StarAbode = get star abode near {Hurricane}
		end while

		if StarAbode exists
			MyWeather = create SCRIPT_OBJECT_TYPE_WEATHER_THING WEATHER_INFO_WHISPS at {StarAbode}
			wait 0.2 seconds
			invoke Hurricane EPIC_ENTER_TORNADO

			RelCamPos = marker at get world position from StarAbode to {-16.691, 9.941, -21.881}
			RelCamFoc = marker at get world position from StarAbode to {70.415, -12.137, 21.989}
			set camera position to {RelCamPos}
			set camera focus to {RelCamFoc}
			wait 1 seconds

			set lightning strike at {StarAbode} from MyWeather scale 1

			DodgyBuilding= convert StarAbode using SCRIPT_CONVERSION_ROCK
			
			set DodgyBuilding target {Hurricane} time 4
			run background script DeleteBuildingsWithExplode(DodgyBuilding)	
			wait 2 seconds

		end if

		run background script Land10BodgingInTheBackground(Hurricane)
	//	invoke Hurricane EPIC_ENABLE_TORNADO_DESTRUCTION

		//wait 3 seconds
		invoke Hurricane EPIC_EXIT_TORNADO

		set camera position follow Hurricane offset {-147.384, 35.429, 6.775}
		set camera focus follow Hurricane offset {-51.609, 36.574, -21.982}
		move follow camera position offset {-96.105, 51.055, 48.184} time 7
		move follow camera focus offset {-16.297, 47.515, -11.969} time 7

		wait 4 seconds//wait until get MusicEventTimer time since set >= MusicEvent5
		invoke Hurricane EPIC_ENTER_TORNADO

		set camera position follow Hurricane offset {-63.892, 74.378, 3.421}
		set camera focus follow Hurricane offset {-12.390, -8.397, -18.868}

		wait 4 seconds
		invoke Hurricane EPIC_EXIT_TORNADO


		MyHurricanePos = marker at future position of epic miracle Hurricane with time 1 seconds
		MyHurricaneFoc = marker at future focus of epic miracle Hurricane with time 1 seconds

		//wait until get MusicEventTimer time since set >= MusicEvent6
		//set Hurricane atmos group 9 time 1 seconds
		set camera position follow Hurricane offset {-169.625, 80.674, 125.683}
		set camera focus follow Hurricane offset {-168.884, 80.658, 125.011}
		move follow camera position offset {-145.876, 137.833, 143.560} time 7
		move follow camera focus offset {-145.292, 137.682, 142.763} time 7
		wait 4 seconds//wait until get MusicEventTimer time since set >= MusicEvent7

		/*RelCamPos = marker at get world position from Hurricane to {71.742, 17.985, -22.261}
		RelCamFoc = marker at get world position from Hurricane to {70.783, 17.759, -22.091}
		set camera position to {RelCamPos}
		set camera focus to {RelCamFoc}*/

		set camera position follow Hurricane offset {44.482, 46.008, 14.608}
		set camera focus follow Hurricane offset {-3.617, -2.455, -58.452}
		move follow camera position offset {71.533, 28.294, -9.278} time 5
		move follow camera focus offset {-25.260, 44.754, -28.255} time 5


		wait 4 seconds//wait until get MusicEventTimer time since set >= MusicEvent8

		set camera position follow Hurricane offset {-94.899, 231.106, 418.347}
		set camera focus follow Hurricane offset {-80.161, 232.516, 319.449}
		move follow camera position offset {-99.984, 230.621, 452.480} time 3
		move follow camera focus offset {-85.246, 232.032, 353.582} time 3
		wait 4 seconds//wait until get MusicEventTimer time since set >= MusicEvent9
		invoke Hurricane EPIC_STOP_TORNADO
		invoke Hurricane EPIC_CLEAR_CLOUDS
		invoke Hurricane EPIC_END_TORNADO
		detach atmos from Hurricane
		//stop camera shake

		//reset sky colour 3 seconds
		enable predefined sky "DEFAULT" time 3
		wait 3 seconds
		enable influence

	end cinema
	
HurricaneActivated = 0
HurricaneIsRunning = 0

wait 300 seconds

if not SCRIPT_OBJECT_PROPERTY_TYPE_CHARGE of AIHurricane == 1.0 SCRIPT_OBJECT_PROPERTY_TYPE_CHARGE of AIHurricane = 1.0 end if

end script Land10Hurricane
