;########################## Germanicu5 Stakes Script +HA +Sally-Out +Elephants +Siege +Protect General fix +AI exp bonus v3.0 beta ###########################

script

declare_show_me
console_command clear_messages
suspend_unscripted_advice true
prepare_for_battle

;;;;;;;Stakes
declare_counter label_ready
;;;;;;;HA fix
declare_counter ha_fix
;;;;;;;Elephant
declare_counter elephant_fix
declare_counter second_ring
declare_counter third_ring
declare_counter elephant_gate
declare_counter elephant_gate_tier2
declare_counter elephant_gate_tier3
declare_counter del_objective
declare_counter rally_walls
;;;;;;;Siege
declare_counter siege_fix
declare_counter kill_it
declare_counter army_sieging
declare_counter army_south
declare_counter army_north
declare_counter army_east
declare_counter army_west
declare_counter wall_advance
declare_counter wall_advance_south
declare_counter wall_advance_north
declare_counter wall_advance_west
declare_counter wall_advance_east
declare_counter emergency_stop
declare_counter omfg_cannon_tower
;;;;;;;Protect General
declare_counter protect_general
declare_counter general_wait

monitor_event BattleConflictPhaseCommenced FactionIsLocal
	
	prepare_for_battle			
			
	;;;Army 1
	label_unit 0 0 0 General1
	label_unit 0 0 1 unit1
	label_unit 0 0 2 unit2
	label_unit 0 0 3 unit3
	label_unit 0 0 4 unit4
	label_unit 0 0 5 unit5
	label_unit 0 0 6 unit6
	label_unit 0 0 7 unit7
	label_unit 0 0 8 unit8
	label_unit 0 0 9 unit9
	label_unit 0 0 10 unit10
	label_unit 0 0 11 unit11
	label_unit 0 0 12 unit12
	label_unit 0 0 13 unit13
	label_unit 0 0 14 unit14
	label_unit 0 0 15 unit15
	label_unit 0 0 16 unit16
	label_unit 0 0 17 unit17
	label_unit 0 0 18 unit18
	label_unit 0 0 19 unit19
	
	;;;Army 2
	label_unit 1 0 0 General2
	label_unit 1 0 1 unit20
	label_unit 1 0 2 unit21
	label_unit 1 0 3 unit22
	label_unit 1 0 4 unit23
	label_unit 1 0 5 unit24
	label_unit 1 0 6 unit25
	label_unit 1 0 7 unit26
	label_unit 1 0 8 unit27
	label_unit 1 0 9 unit28
	label_unit 1 0 10 unit29
	label_unit 1 0 11 unit30
	label_unit 1 0 12 unit31
	label_unit 1 0 13 unit32
	label_unit 1 0 14 unit33
	label_unit 1 0 15 unit34
	label_unit 1 0 16 unit35
	label_unit 1 0 17 unit36
	label_unit 1 0 18 unit37
	label_unit 1 0 19 unit38

	define_unit_group army1 General1 unit1 unit2 unit3 unit4 unit5 unit6 unit7 unit8 unit9 unit10 unit11 unit12 unit13 unit14 unit15 unit16 unit17 unit18 unit19	
	define_unit_group army2 General2 unit20 unit21 unit22 unit23 unit24 unit25 unit26 unit27 unit28 unit29 unit30 unit31 unit32 unit33 unit34 unit35 unit36 unit37 unit38

	ai_active_set on

	if I_BattleEnemyArmyNumberOfAttribute stakes > 0
	set_counter label_ready 1
	end_if

	if I_ConflictType Siege
	set_counter siege_fix 1
	end_if

	if I_BattleEnemyArmyPercentageOfUnitCategory cavalry >= 60
	set_counter ha_fix 1
	end_if

	if I_ConflictType Siege
	and I_BattleEnemyArmyNumberOfMountClass elephant > 0
	set_counter elephant_fix 1
	end_if
end_monitor

;;;;;;;;Stakes;;;;;;;;;;;;

monitor_conditions I_BattleStarted
	and I_CompareCounter label_ready = 1
	and I_BattlePlayerArmyIsAttacker
   	and ! I_BattleAiAttacking
	and ! I_ConflictType SuccessfulAmbush
	and ! I_ConflictType Siege
	and I_BattlePlayerArmyNumberOfUnitCategory cavalry > 0
	and I_BattleEnemyArmyNumberOfAttribute stakes > 0
	and I_UnitEnemyUnitInRadius General2 115

	ai_active_set off
 	
	unit_group_order_halt army2

	unit_deploy_stakes General2
	unit_deploy_stakes unit20
	unit_deploy_stakes unit21
	unit_deploy_stakes unit22
	unit_deploy_stakes unit23
	unit_deploy_stakes unit24
	unit_deploy_stakes unit25
	unit_deploy_stakes unit26
	unit_deploy_stakes unit27
	unit_deploy_stakes unit28
	unit_deploy_stakes unit29
	unit_deploy_stakes unit30
	unit_deploy_stakes unit31
	unit_deploy_stakes unit32
	unit_deploy_stakes unit33
	unit_deploy_stakes unit34
	unit_deploy_stakes unit35
	unit_deploy_stakes unit36
	unit_deploy_stakes unit37
	unit_deploy_stakes unit38
	
	ai_active_set on
	set_counter label_ready 0
end_monitor

monitor_event BattleConflictPhaseCommenced FactionIsLocal
	and I_BattlePlayerArmyIsAttacker
	and I_ConflictType Siege
	and I_CompareCounter label_ready = 1 
	and I_BattlePlayerArmyNumberOfUnitCategory cavalry > 0
	and I_BattleEnemyArmyNumberOfUnitCategory cavalry = 0
	and I_BattleEnemyArmyNumberOfAttribute stakes > 0
		
	unit_deploy_stakes General2
	unit_deploy_stakes unit20
	unit_deploy_stakes unit21
	unit_deploy_stakes unit22
	unit_deploy_stakes unit23
	unit_deploy_stakes unit24
	unit_deploy_stakes unit25
	unit_deploy_stakes unit26
	unit_deploy_stakes unit27
	unit_deploy_stakes unit28
	unit_deploy_stakes unit29
	unit_deploy_stakes unit30
	unit_deploy_stakes unit31
	unit_deploy_stakes unit32
	unit_deploy_stakes unit33
	unit_deploy_stakes unit34
	unit_deploy_stakes unit35
	unit_deploy_stakes unit36
	unit_deploy_stakes unit37
	unit_deploy_stakes unit38
	
	ai_active_set on
	set_counter label_ready 0
end_monitor

;;;;;;;;HA fix;;;;;;;;;;;;

monitor_conditions I_InBattle
	and I_CompareCounter ha_fix = 1
	and ! I_ConflictType Siege
	and ! I_BattleIsSallyOutBattle
	and ! I_BattleIsFortBattle
	and I_BattlePlayerArmyIsAttacker
   	and ! I_BattleAiAttacking
	and I_BattleEnemyArmyPercentageOfUnitCategory cavalry >= 60
	and I_UnitEnemyUnitInRadius General2 250
	
	ai_gta_plan_set 1 ATTACK_ALL
	set_counter ha_fix 0
end_monitor

monitor_conditions I_InBattle
	and I_CompareCounter ha_fix = 1
	and ! I_ConflictType Siege
	and ! I_BattleIsSallyOutBattle
	and ! I_BattleIsFortBattle
	and ! I_BattleIsRiverBattle
	and ! I_BattlePlayerArmyIsAttacker
   	and ! I_BattleAiAttacking
;	and I_BattleEnemyArmyPercentageOfUnitCategory cavalry >= 60
	
	ai_gta_plan_set 1 ATTACK_ALL
	set_counter ha_fix 0
end_monitor

monitor_conditions I_InBattle
	and I_CompareCounter ha_fix = 1
	and I_BattleIsRiverBattle
	and ! I_BattlePlayerArmyIsAttacker
   	and ! I_BattleAiAttacking
;	and I_BattleEnemyArmyPercentageOfUnitCategory cavalry >= 60
	
	ai_gta_add_objective 1 ASSAULT_CROSSING 999

	ai_active_set off

	if I_BattleEnemyArmyNumberOfUnits > 0
	ai_gta_add_unit_label 1 0 General2
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 1
	ai_gta_add_unit_label 1 0 unit20
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 2
	ai_gta_add_unit_label 1 0 unit21
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 3
	ai_gta_add_unit_label 1 0 unit22
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 4
	ai_gta_add_unit_label 1 0 unit23
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 5
	ai_gta_add_unit_label 1 0 unit24
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 6
	ai_gta_add_unit_label 1 0 unit25
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 7
	ai_gta_add_unit_label 1 0 unit26
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 8
	ai_gta_add_unit_label 1 0 unit27
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 9
	ai_gta_add_unit_label 1 0 unit28
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 10
	ai_gta_add_unit_label 1 0 unit29
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 11
	ai_gta_add_unit_label 1 0 unit30
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 12
	ai_gta_add_unit_label 1 0 unit31
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 13
	ai_gta_add_unit_label 1 0 unit32
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 14
	ai_gta_add_unit_label 1 0 unit33
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 15
	ai_gta_add_unit_label 1 0 unit34
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 16
	ai_gta_add_unit_label 1 0 unit35
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 17
	ai_gta_add_unit_label 1 0 unit36
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 18
	ai_gta_add_unit_label 1 0 unit37
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 20
	ai_gta_add_unit_label 1 0 unit38
	end_if

	ai_active_set on

	set_counter ha_fix 0
end_monitor

;;;;;;;;Siege;;;;;;;;;;;;

monitor_conditions I_InBattle
	and I_CompareCounter elephant_fix = 1
	and I_ConflictType Siege
	and ! I_BattleIsFortBattle
	and ! I_BattlePlayerArmyIsAttacker
	and I_IsBattleSettlementCastle
	and I_BattleEnemyArmyNumberOfMountClass elephant > 0


	ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999
	ai_active_set off

	if I_BattleEnemyArmyNumberOfUnits > 1
	and I_UnitFormation General2 = horde
	ai_gta_add_unit_label 1 0 General2
;	remove_unit_from_group army2 General2
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 1
	and I_UnitFormation unit20 = horde
	ai_gta_add_unit_label 1 0 unit20
;	remove_unit_from_group army2 unit20
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 2
	and I_UnitFormation unit21 = horde
	ai_gta_add_unit_label 1 0 unit21
;	remove_unit_from_group army2 unit21
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 3
	and I_UnitFormation unit22 = horde
	ai_gta_add_unit_label 1 0 unit22
;	remove_unit_from_group army2 unit22
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 4
	and I_UnitFormation unit23 = horde
	ai_gta_add_unit_label 1 0 unit23
;	remove_unit_from_group army2 unit23
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 5
	and I_UnitFormation unit24 = horde
	ai_gta_add_unit_label 1 0 unit24
;	remove_unit_from_group army2 unit24
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 6
	and I_UnitFormation unit25 = horde
	ai_gta_add_unit_label 1 0 unit25
;	remove_unit_from_group army2 unit25
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 7
	and I_UnitFormation unit26 = horde
	ai_gta_add_unit_label 1 0 unit26
;	remove_unit_from_group army2 unit26
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 8
	and I_UnitFormation unit27 = horde
	ai_gta_add_unit_label 1 0 unit27
;	remove_unit_from_group army2 unit27
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 9
	and I_UnitFormation unit28 = horde
	ai_gta_add_unit_label 1 0 unit28
;	remove_unit_from_group army2 unit28
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 10
	and I_UnitFormation unit29 = horde
	ai_gta_add_unit_label 1 0 unit29
;	remove_unit_from_group army2 unit29
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 11
	and I_UnitFormation unit30 = horde
	ai_gta_add_unit_label 1 0 unit30
;	remove_unit_from_group army2 unit30
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 12
	and I_UnitFormation unit31 = horde
	ai_gta_add_unit_label 1 0 unit31
;	remove_unit_from_group army2 unit31
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 13
	and I_UnitFormation unit32 = horde
	ai_gta_add_unit_label 1 0 unit32
;	remove_unit_from_group army2 unit32
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 14
	and I_UnitFormation unit33 = horde
	ai_gta_add_unit_label 1 0 unit33
;	remove_unit_from_group army2 unit33
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 15
	and I_UnitFormation unit34 = horde
	ai_gta_add_unit_label 1 0 unit34
;	remove_unit_from_group army2 unit34
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 16
	and I_UnitFormation unit35 = horde
	ai_gta_add_unit_label 1 0 unit35
;	remove_unit_from_group army2 unit35
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 17
	and I_UnitFormation unit36 = horde
	ai_gta_add_unit_label 1 0 unit36
;	remove_unit_from_group army2 unit36
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 18
	and I_UnitFormation unit37 = horde
	ai_gta_add_unit_label 1 0 unit37
;	remove_unit_from_group army2 unit37
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 20
	and I_UnitFormation unit38 = horde
	ai_gta_add_unit_label 1 0 unit38
;	remove_unit_from_group army2 unit38
	end_if

	ai_active_set on
	set_counter elephant_gate 1
	set_counter elephant_fix 0
end_monitor

monitor_conditions I_InBattle
	and I_CompareCounter elephant_fix = 1
	and I_ConflictType Siege
	and ! I_BattleIsFortBattle
	and ! I_BattlePlayerArmyIsAttacker
	and ! I_IsBattleSettlementCastle
	and I_BattleEnemyArmyNumberOfMountClass elephant > 0


	ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999
	ai_active_set off
	unit_group_order_halt army2

	if I_BattleEnemyArmyNumberOfUnits > 1
	and I_UnitFormation General2 = horde
	ai_gta_add_unit_label 1 0 General2
;	remove_unit_from_group army2 General2
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 1
	and I_UnitFormation unit20 = horde
	ai_gta_add_unit_label 1 0 unit20
;	remove_unit_from_group army2 unit20
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 2
	and I_UnitFormation unit21 = horde
	ai_gta_add_unit_label 1 0 unit21
;	remove_unit_from_group army2 unit21
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 3
	and I_UnitFormation unit22 = horde
	ai_gta_add_unit_label 1 0 unit22
;	remove_unit_from_group army2 unit22
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 4
	and I_UnitFormation unit23 = horde
	ai_gta_add_unit_label 1 0 unit23
;	remove_unit_from_group army2 unit23
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 5
	and I_UnitFormation unit24 = horde
	ai_gta_add_unit_label 1 0 unit24
;	remove_unit_from_group army2 unit24
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 6
	and I_UnitFormation unit25 = horde
	ai_gta_add_unit_label 1 0 unit25
;	remove_unit_from_group army2 unit25
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 7
	and I_UnitFormation unit26 = horde
	ai_gta_add_unit_label 1 0 unit26
;	remove_unit_from_group army2 unit26
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 8
	and I_UnitFormation unit27 = horde
	ai_gta_add_unit_label 1 0 unit27
;	remove_unit_from_group army2 unit27
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 9
	and I_UnitFormation unit28 = horde
	ai_gta_add_unit_label 1 0 unit28
;	remove_unit_from_group army2 unit28
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 10
	and I_UnitFormation unit29 = horde
	ai_gta_add_unit_label 1 0 unit29
;	remove_unit_from_group army2 unit29
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 11
	and I_UnitFormation unit30 = horde
	ai_gta_add_unit_label 1 0 unit30
;	remove_unit_from_group army2 unit30
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 12
	and I_UnitFormation unit31 = horde
	ai_gta_add_unit_label 1 0 unit31
;	remove_unit_from_group army2 unit31
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 13
	and I_UnitFormation unit32 = horde
	ai_gta_add_unit_label 1 0 unit32
;	remove_unit_from_group army2 unit32
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 14
	and I_UnitFormation unit33 = horde
	ai_gta_add_unit_label 1 0 unit33
;	remove_unit_from_group army2 unit33
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 15
	and I_UnitFormation unit34 = horde
	ai_gta_add_unit_label 1 0 unit34
;	remove_unit_from_group army2 unit34
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 16
	and I_UnitFormation unit35 = horde
	ai_gta_add_unit_label 1 0 unit35
;	remove_unit_from_group army2 unit35
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 17
	and I_UnitFormation unit36 = horde
	ai_gta_add_unit_label 1 0 unit36
;	remove_unit_from_group army2 unit36
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 18
	and I_UnitFormation unit37 = horde
	ai_gta_add_unit_label 1 0 unit37
;	remove_unit_from_group army2 unit37
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 20
	and I_UnitFormation unit38 = horde
	ai_gta_add_unit_label 1 0 unit38
;	remove_unit_from_group army2 unit38
	end_if

	unit_group_order_halt army2
	unit_group_order_change_group_formation army2 ai_wall_assault
	battle_wait 180

	ai_active_set on
	set_counter elephant_gate 1
	set_counter elephant_fix 0
end_monitor

monitor_conditions I_InBattle
	and I_CompareCounter elephant_fix = 1
	and I_ConflictType Siege
	and I_BattleIsFortBattle
	and ! I_BattlePlayerArmyIsAttacker
	and I_BattleEnemyArmyNumberOfMountClass elephant > 0


	ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999
	ai_active_set off

	if I_BattleEnemyArmyNumberOfUnits > 1
	and I_UnitFormation General2 = horde
	ai_gta_add_unit_label 1 0 General2
	remove_unit_from_group army2 General2
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 1
	and I_UnitFormation unit20 = horde
	ai_gta_add_unit_label 1 0 unit20
	remove_unit_from_group army2 unit20
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 2
	and I_UnitFormation unit21 = horde
	ai_gta_add_unit_label 1 0 unit21
	remove_unit_from_group army2 unit21
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 3
	and I_UnitFormation unit22 = horde
	ai_gta_add_unit_label 1 0 unit22
	remove_unit_from_group army2 unit22
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 4
	and I_UnitFormation unit23 = horde
	ai_gta_add_unit_label 1 0 unit23
	remove_unit_from_group army2 unit23
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 5
	and I_UnitFormation unit24 = horde
	ai_gta_add_unit_label 1 0 unit24
	remove_unit_from_group army2 unit24
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 6
	and I_UnitFormation unit25 = horde
	ai_gta_add_unit_label 1 0 unit25
	remove_unit_from_group army2 unit25
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 7
	and I_UnitFormation unit26 = horde
	ai_gta_add_unit_label 1 0 unit26
	remove_unit_from_group army2 unit26
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 8
	and I_UnitFormation unit27 = horde
	ai_gta_add_unit_label 1 0 unit27
	remove_unit_from_group army2 unit27
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 9
	and I_UnitFormation unit28 = horde
	ai_gta_add_unit_label 1 0 unit28
	remove_unit_from_group army2 unit28
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 10
	and I_UnitFormation unit29 = horde
	ai_gta_add_unit_label 1 0 unit29
	remove_unit_from_group army2 unit29
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 11
	and I_UnitFormation unit30 = horde
	ai_gta_add_unit_label 1 0 unit30
	remove_unit_from_group army2 unit30
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 12
	and I_UnitFormation unit31 = horde
	ai_gta_add_unit_label 1 0 unit31
	remove_unit_from_group army2 unit31
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 13
	and I_UnitFormation unit32 = horde
	ai_gta_add_unit_label 1 0 unit32
	remove_unit_from_group army2 unit32
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 14
	and I_UnitFormation unit33 = horde
	ai_gta_add_unit_label 1 0 unit33
	remove_unit_from_group army2 unit33
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 15
	and I_UnitFormation unit34 = horde
	ai_gta_add_unit_label 1 0 unit34
	remove_unit_from_group army2 unit34
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 16
	and I_UnitFormation unit35 = horde
	ai_gta_add_unit_label 1 0 unit35
	remove_unit_from_group army2 unit35
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 17
	and I_UnitFormation unit36 = horde
	ai_gta_add_unit_label 1 0 unit36
	remove_unit_from_group army2 unit36
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 18
	and I_UnitFormation unit37 = horde
	ai_gta_add_unit_label 1 0 unit37
	remove_unit_from_group army2 unit37
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 20
	and I_UnitFormation unit38 = horde
	ai_gta_add_unit_label 1 0 unit38
	remove_unit_from_group army2 unit38
	end_if

	ai_active_set on
	set_counter elephant_gate 1
	set_counter elephant_fix 0
end_monitor

monitor_event BattleBattleGatesDestroyedByEngine TrueCondition
	and I_CompareCounter elephant_gate = 1
	and I_ConflictType Siege
	and ! I_BattlePlayerArmyIsAttacker
	and I_BattleEnemyArmyNumberOfMountClass elephant > 0 

	set_counter elephant_gate 0
	set_counter rally_walls 1
end_monitor

monitor_event BattleWallsCaptured TrueCondition
	and I_CompareCounter elephant_gate = 1
	and I_ConflictType Siege
	and ! I_BattlePlayerArmyIsAttacker
	and I_BattleEnemyArmyNumberOfMountClass elephant > 0 

	set_counter elephant_gate 0
	set_counter rally_walls 1
end_monitor

monitor_event BattleWallsBreachedByEngine TrueCondition
	and I_CompareCounter elephant_gate = 1
	and I_ConflictType Siege
	and ! I_BattlePlayerArmyIsAttacker
	and I_BattleEnemyArmyNumberOfMountClass elephant > 0 

	ai_gta_del_objective 1

	set_counter elephant_gate 2
	set_counter rally_walls 0
end_monitor

monitor_event BattleEnemyUnitAttacksPlayerUnit BattleIsMeleeAttack
	and I_CompareCounter rally_walls = 1

	if I_CompareCounter elephant_gate != 2
	set_counter elephant_gate 0
	set_counter del_objective 1
	end_if
	battle_wait 180
	set_counter elephant_gate_tier2 1
	set_counter rally_walls 0
end_monitor

monitor_conditions I_InBattle 
	and I_CompareCounter del_objective = 1
	and I_ConflictType Siege
	and ! I_BattlePlayerArmyIsAttacker
	and I_BattleEnemyArmyNumberOfMountClass elephant > 0 

	battle_wait 15
	ai_gta_del_objective 1
	ai_active_set off
	battle_wait 1
	ai_active_set on

	set_counter del_objective 0
end_monitor

monitor_conditions I_InBattle 
	and I_CompareCounter elephant_gate_tier2 = 1
	and ! I_BattleIsFortBattle
	and I_ConflictType Siege
	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_BattleEnemyArmyNumberOfUnits > 1
	and I_UnitFormation General2 = horde
	ai_gta_add_unit_label 1 0 General2
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 1
	and I_UnitFormation unit20 = horde
	ai_gta_add_unit_label 1 0 unit20
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 2
	and I_UnitFormation unit21 = horde
	ai_gta_add_unit_label 1 0 unit21
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 3
	and I_UnitFormation unit22 = horde
	ai_gta_add_unit_label 1 0 unit22
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 4
	and I_UnitFormation unit23 = horde
	ai_gta_add_unit_label 1 0 unit23
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 5
	and I_UnitFormation unit24 = horde
	ai_gta_add_unit_label 1 0 unit24
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 6
	and I_UnitFormation unit25 = horde
	ai_gta_add_unit_label 1 0 unit25
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 7
	and I_UnitFormation unit26 = horde
	ai_gta_add_unit_label 1 0 unit26
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 8
	and I_UnitFormation unit27 = horde
	ai_gta_add_unit_label 1 0 unit27
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 9
	and I_UnitFormation unit28 = horde
	ai_gta_add_unit_label 1 0 unit28
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 10
	and I_UnitFormation unit29 = horde
	ai_gta_add_unit_label 1 0 unit29
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 11
	and I_UnitFormation unit30 = horde
	ai_gta_add_unit_label 1 0 unit30
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 12
	and I_UnitFormation unit31 = horde
	ai_gta_add_unit_label 1 0 unit31
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 13
	and I_UnitFormation unit32 = horde
	ai_gta_add_unit_label 1 0 unit32
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 14
	and I_UnitFormation unit33 = horde
	ai_gta_add_unit_label 1 0 unit33
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 15
	and I_UnitFormation unit34 = horde
	ai_gta_add_unit_label 1 0 unit34
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 16
	and I_UnitFormation unit35 = horde
	ai_gta_add_unit_label 1 0 unit35
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 17
	and I_UnitFormation unit36 = horde
	ai_gta_add_unit_label 1 0 unit36
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 18
	and I_UnitFormation unit37 = horde
	ai_gta_add_unit_label 1 0 unit37
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 20
	and I_UnitFormation unit38 = horde
	ai_gta_add_unit_label 1 0 unit38
	end_if

	ai_active_set on
	set_counter second_ring 1
	set_counter elephant_gate_tier2 0
end_monitor

monitor_event BattleBattleGatesDestroyedByEngine TrueCondition
	and I_CompareCounter second_ring = 1
	and I_ConflictType Siege
	and ! I_BattlePlayerArmyIsAttacker
	and I_BattleEnemyArmyNumberOfMountClass elephant > 0 
	and I_IsBattleSettlementCastle
	and I_BattleSettlementFortificationLevel > 2

	set_counter second_ring 0
	set_counter rally_walls 2
end_monitor

monitor_event BattleWallsCaptured TrueCondition
	and I_CompareCounter second_ring = 1
	and I_ConflictType Siege
	and ! I_BattlePlayerArmyIsAttacker
	and I_BattleEnemyArmyNumberOfMountClass elephant > 0 
	and I_IsBattleSettlementCastle
	and I_BattleSettlementFortificationLevel > 2

	set_counter second_ring 0
	set_counter rally_walls 2
end_monitor

monitor_event BattleWallsBreachedByEngine TrueCondition
	and I_CompareCounter second_ring = 1
	and I_ConflictType Siege
	and ! I_BattlePlayerArmyIsAttacker
	and I_BattleEnemyArmyNumberOfMountClass elephant > 0 
	and I_IsBattleSettlementCastle
	and I_BattleSettlementFortificationLevel > 2

	ai_gta_del_objective 1

	set_counter second_ring 2
	set_counter rally_walls 2
end_monitor

monitor_event BattleEnemyUnitAttacksPlayerUnit BattleIsMeleeAttack
	and I_CompareCounter rally_walls = 2

	if I_CompareCounter second_ring != 2
	set_counter second_ring 0
	set_counter del_objective 1
	end_if
	battle_wait 180
	set_counter elephant_gate_tier3 1
end_monitor

monitor_conditions I_InBattle 
	and I_CompareCounter elephant_gate_tier3 = 1
	and I_ConflictType Siege
	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_BattleEnemyArmyNumberOfUnits > 1
	and I_UnitFormation General2 = horde
	ai_gta_add_unit_label 1 0 General2
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 1
	and I_UnitFormation unit20 = horde
	ai_gta_add_unit_label 1 0 unit20
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 2
	and I_UnitFormation unit21 = horde
	ai_gta_add_unit_label 1 0 unit21
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 3
	and I_UnitFormation unit22 = horde
	ai_gta_add_unit_label 1 0 unit22
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 4
	and I_UnitFormation unit23 = horde
	ai_gta_add_unit_label 1 0 unit23
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 5
	and I_UnitFormation unit24 = horde
	ai_gta_add_unit_label 1 0 unit24
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 6
	and I_UnitFormation unit25 = horde
	ai_gta_add_unit_label 1 0 unit25
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 7
	and I_UnitFormation unit26 = horde
	ai_gta_add_unit_label 1 0 unit26
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 8
	and I_UnitFormation unit27 = horde
	ai_gta_add_unit_label 1 0 unit27
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 9
	and I_UnitFormation unit28 = horde
	ai_gta_add_unit_label 1 0 unit28
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 10
	and I_UnitFormation unit29 = horde
	ai_gta_add_unit_label 1 0 unit29
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 11
	and I_UnitFormation unit30 = horde
	ai_gta_add_unit_label 1 0 unit30
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 12
	and I_UnitFormation unit31 = horde
	ai_gta_add_unit_label 1 0 unit31
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 13
	and I_UnitFormation unit32 = horde
	ai_gta_add_unit_label 1 0 unit32
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 14
	and I_UnitFormation unit33 = horde
	ai_gta_add_unit_label 1 0 unit33
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 15
	and I_UnitFormation unit34 = horde
	ai_gta_add_unit_label 1 0 unit34
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 16
	and I_UnitFormation unit35 = horde
	ai_gta_add_unit_label 1 0 unit35
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 17
	and I_UnitFormation unit36 = horde
	ai_gta_add_unit_label 1 0 unit36
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 18
	and I_UnitFormation unit37 = horde
	ai_gta_add_unit_label 1 0 unit37
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 20
	and I_UnitFormation unit38 = horde
	ai_gta_add_unit_label 1 0 unit38
	end_if
	ai_active_set on
	set_counter third_ring 1
	set_counter elephant_gate_tier3 0
end_monitor

monitor_event BattleBattleGatesDestroyedByEngine TrueCondition
	and I_CompareCounter third_ring = 1
	and I_ConflictType Siege
	and ! I_BattlePlayerArmyIsAttacker
	and I_BattleEnemyArmyNumberOfMountClass elephant > 0
	and I_IsBattleSettlementCastle
	and I_BattleSettlementFortificationLevel > 2

	set_counter third_ring 0
	set_counter del_objective 1
end_monitor

monitor_event BattleWallsCaptured TrueCondition
	and I_CompareCounter third_ring = 1
	and I_ConflictType Siege
	and ! I_BattlePlayerArmyIsAttacker
	and I_BattleEnemyArmyNumberOfMountClass elephant > 0 
	and I_IsBattleSettlementCastle
	and I_BattleSettlementFortificationLevel > 2

	set_counter third_ring 0
	set_counter del_objective 1
end_monitor

monitor_event BattleWallsBreachedByEngine TrueCondition
	and I_CompareCounter third_ring = 1
	and I_ConflictType Siege
	and ! I_BattlePlayerArmyIsAttacker
	and I_BattleEnemyArmyNumberOfMountClass elephant > 0 
	and I_IsBattleSettlementCastle
	and I_BattleSettlementFortificationLevel > 2

	set_counter third_ring 0
	set_counter del_objective 1
end_monitor

;################## Germanicu5 Integrated Protect General script v0.2 ###########################

monitor_event BattleConflictPhaseCommenced FactionIsLocal
	and I_ConflictType Siege
	and ! I_BattlePlayerArmyIsAttacker
	and I_BattleEnemyArmyNumberOfSpecialAbility rally > 0
	and I_BattleEnemyArmyNumberOfMountClass elephant = 0
	and I_BattleEnemyArmyNumberOfUnits > 4

	battle_wait 1
 	set_counter protect_general 1
end_monitor

monitor_event BattleBattleGatesDestroyedByEngine TrueCondition
	and I_CompareCounter protect_general = 1
	and I_ConflictType Siege
	and ! I_BattlePlayerArmyIsAttacker

	set_counter protect_general 0
	set_counter general_wait 1
end_monitor

monitor_event BattleWallsCaptured TrueCondition
	and I_CompareCounter protect_general = 1
	and I_ConflictType Siege
	and ! I_BattlePlayerArmyIsAttacker

	set_counter protect_general 0
	set_counter general_wait 1
end_monitor

monitor_event BattleWallsBreachedByEngine TrueCondition
	and I_CompareCounter protect_general = 1
	and I_ConflictType Siege
	and ! I_BattlePlayerArmyIsAttacker

	set_counter protect_general 0
	set_counter general_wait 1
end_monitor

monitor_conditions I_BattleStarted
	and I_CompareCounter general_wait = 1
	and I_IsUnitMoveFastSet General2
	and I_BattleEnemyArmyNumberOfUnitCategory cavalry > 0

	wait 1
	ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999
	ai_gta_add_unit_label 1 0 General2

	set_counter general_wait 0

	if I_BattleEnemyArmyNumberOfUnits < 7
	battle_wait 40
	end_if	
	if I_BattleEnemyArmyNumberOfUnits > 6
	and I_BattleEnemyArmyNumberOfUnits < 12
	battle_wait 50
	end_if
	if I_BattleEnemyArmyNumberOfUnits > 11
	and I_BattleEnemyArmyNumberOfUnits < 16
	battle_wait 60
	end_if
	if I_BattleEnemyArmyNumberOfUnits > 15
	battle_wait 70
	end_if

	ai_gta_del_objective 1
	wait 1
	ai_active_set off
	wait 1
	ai_active_set on
end_monitor

;################## Germanicu5 Integrated Siege script v0.2 ###########################

monitor_conditions I_InBattle
	and I_ConflictType Siege
	and ! I_BattleIsFortBattle
	and I_BattleEnemyArmyNumberOfMountClass elephant = 0
	and I_CompareCounter siege_fix = 1

	label_location 0, -850, south_side
	label_location 0, 850, north_side
	label_location -850, 0, west_side
	label_location 850, 0, east_side

	if I_UnitDistanceFromLine General2 west_side east_side > 200
	set_counter army_south 1
	end_if
	if I_UnitDistanceFromLine General2 west_side east_side < -200
	set_counter army_north 1
	end_if
	if I_UnitDistanceFromLine General2 south_side north_side > 200
	set_counter army_east 1
	end_if
	if I_UnitDistanceFromLine General2 south_side north_side < -200
	set_counter army_west 1
	end_if

	set_counter siege_fix 0

	if I_CompareCounter army_south = 1
	set_counter army_sieging 1
	end_if

	if I_CompareCounter army_north = 1
	set_counter army_sieging 1
	end_if

	if I_CompareCounter army_east = 1
	set_counter army_sieging 1
	end_if

	if I_CompareCounter army_west = 1
	set_counter army_sieging 1
	end_if

	if I_BattleEnemyArmyNumberOfClassAndCategory missile siege = 0
 	and I_CompareCounter army_south = 1
	set_counter wall_advance_south 1
	set_counter wall_advance 1
	end_if

	if I_BattleEnemyArmyNumberOfClassAndCategory missile siege = 0
 	and I_CompareCounter army_north = 1
	set_counter wall_advance_north 1
	set_counter wall_advance 1
	end_if

	if I_BattleEnemyArmyNumberOfClassAndCategory missile siege = 0
 	and I_CompareCounter army_west = 1
	set_counter wall_advance_west 1
	set_counter wall_advance 1
	end_if

	if I_BattleEnemyArmyNumberOfClassAndCategory missile siege = 0
 	and I_CompareCounter army_east = 1
	set_counter wall_advance_east 1
	set_counter wall_advance 1
	end_if
end_monitor

;;;;;;;Huge City

monitor_conditions I_InBattle
	and I_ConflictType Siege
	and ! I_BattleIsFortBattle
 	and I_CompareCounter army_sieging = 1
	and I_BattleEnemyArmyNumberOfClassAndCategory missile siege > 0
	and I_BattlePlayerArmyNumberOfAttribute extreme_range > 0
	and ! I_BattlePlayerArmyIsAttacker
	and ! I_IsBattleSettlementCastle
	and I_BattleSettlementFortificationLevel 4

	unit_group_order_halt army2
	if I_CompareCounter army_south = 1
	unit_group_order_relative_move_formed army2 0 65
	end_if
	if I_CompareCounter army_north = 1
	unit_group_order_relative_move_formed army2 0 -65
	end_if
	if I_CompareCounter army_east = 1
	unit_group_order_relative_move_formed army2 -65 0
	end_if
	if I_CompareCounter army_west = 1
	unit_group_order_relative_move_formed army2 65 0
	end_if
	set_counter emergency_stop 1
	set_counter omfg_cannon_tower 1
	battle_wait 85

	if I_InBattle
	and I_CompareCounter omfg_cannon_tower = 1
	set_counter omfg_cannon_tower 0
	end_if

	if I_InBattle
	and I_CompareCounter emergency_stop = 1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	battle_wait 1
	ai_active_set on
	set_counter move_forward 1
	end_if

	set_counter army_sieging 0
end_monitor

monitor_conditions I_InBattle
	and I_ConflictType Siege
	and ! I_BattleIsFortBattle
 	and I_CompareCounter army_sieging = 1
	and I_BattleEnemyArmyNumberOfClassAndCategory missile siege > 0
	and I_BattlePlayerArmyNumberOfAttribute extreme_range = 0
	and ! I_BattlePlayerArmyIsAttacker
	and ! I_IsBattleSettlementCastle
	and I_BattleSettlementFortificationLevel 4

	unit_group_order_halt army2
	if I_CompareCounter army_south = 1
	unit_group_order_relative_move_formed army2 0 135
	end_if
	if I_CompareCounter army_north = 1
	unit_group_order_relative_move_formed army2 0 -135
	end_if
	if I_CompareCounter army_east = 1
	unit_group_order_relative_move_formed army2 -135 0
	end_if
	if I_CompareCounter army_west = 1
	unit_group_order_relative_move_formed army2 135 0
	end_if
	set_counter emergency_stop 1
	set_counter omfg_cannon_tower 1
	battle_wait 130

	if I_InBattle
	and I_CompareCounter omfg_cannon_tower = 1
	set_counter omfg_cannon_tower 0
	end_if

	if I_InBattle
	and I_CompareCounter emergency_stop = 1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	battle_wait 1
	ai_active_set on
	end_if

	set_counter army_sieging 0
end_monitor

;;;;;;;Large City

monitor_conditions I_InBattle
	and I_ConflictType Siege
	and ! I_BattleIsFortBattle
 	and I_CompareCounter army_sieging = 1
	and I_BattleEnemyArmyNumberOfClassAndCategory missile siege > 0
	and I_BattlePlayerArmyNumberOfAttribute extreme_range > 0
	and ! I_BattlePlayerArmyIsAttacker
	and ! I_IsBattleSettlementCastle
	and I_BattleSettlementFortificationLevel 3

	unit_group_order_halt army2
	if I_CompareCounter army_south = 1
	unit_group_order_relative_move_formed army2 0 60
	end_if
	if I_CompareCounter army_north = 1
	unit_group_order_relative_move_formed army2 0 -60
	end_if
	if I_CompareCounter army_east = 1
	unit_group_order_relative_move_formed army2 -60 0
	end_if
	if I_CompareCounter army_west = 1
	unit_group_order_relative_move_formed army2 60 0
	end_if
	set_counter emergency_stop 1
	set_counter omfg_cannon_tower 1
	battle_wait 80

	if I_InBattle
	and I_CompareCounter omfg_cannon_tower = 1
	set_counter omfg_cannon_tower 0
	end_if

	if I_InBattle
	and I_CompareCounter emergency_stop = 1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	battle_wait 1
	ai_active_set on
	end_if

	set_counter army_sieging 0
end_monitor

monitor_conditions I_InBattle
	and I_ConflictType Siege
	and ! I_BattleIsFortBattle
 	and I_CompareCounter army_sieging = 1
	and I_BattleEnemyArmyNumberOfClassAndCategory missile siege > 0
	and I_BattlePlayerArmyNumberOfAttribute extreme_range = 0
	and ! I_BattlePlayerArmyIsAttacker
	and ! I_IsBattleSettlementCastle
	and I_BattleSettlementFortificationLevel 3

	unit_group_order_halt army2
	if I_CompareCounter army_south = 1
	unit_group_order_relative_move_formed army2 0 130
	end_if
	if I_CompareCounter army_north = 1
	unit_group_order_relative_move_formed army2 0 -130
	end_if
	if I_CompareCounter army_east = 1
	unit_group_order_relative_move_formed army2 -130 0
	end_if
	if I_CompareCounter army_west = 1
	unit_group_order_relative_move_formed army2 130 0
	end_if
	set_counter emergency_stop 1
	set_counter omfg_cannon_tower 1
	battle_wait 125 

	if I_InBattle
	and I_CompareCounter omfg_cannon_tower = 1
	set_counter omfg_cannon_tower 0
	end_if

	if I_InBattle
	and I_CompareCounter emergency_stop = 1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	battle_wait 1
	ai_active_set on
	end_if

	set_counter army_sieging 0
end_monitor

;;;;;;;Castle, Citadel and Fortress

monitor_conditions I_InBattle
	and I_ConflictType Siege
	and ! I_BattleIsFortBattle
 	and I_CompareCounter army_sieging = 1
	and I_BattleEnemyArmyNumberOfClassAndCategory missile siege > 0
	and I_BattlePlayerArmyNumberOfAttribute extreme_range > 0
	and ! I_BattlePlayerArmyIsAttacker
	and I_IsBattleSettlementCastle
	and I_BattleSettlementFortificationLevel 3

	unit_group_order_halt army2
	if I_CompareCounter army_south = 1
	unit_group_order_relative_move_formed army2 0 100
	end_if
	if I_CompareCounter army_north = 1
	unit_group_order_relative_move_formed army2 0 -100
	end_if
	if I_CompareCounter army_east = 1
	unit_group_order_relative_move_formed army2 -100 0
	end_if
	if I_CompareCounter army_west = 1
	unit_group_order_relative_move_formed army2 100 0
	end_if
	set_counter emergency_stop 1
	set_counter omfg_cannon_tower 1
	battle_wait 115

	if I_InBattle
	and I_CompareCounter omfg_cannon_tower = 1
	set_counter omfg_cannon_tower 0
	end_if 

	if I_InBattle
	and I_CompareCounter emergency_stop = 1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	battle_wait 1
	ai_active_set on
	end_if

	set_counter army_sieging 0
end_monitor

monitor_conditions I_InBattle 
	and I_ConflictType Siege
	and ! I_BattleIsFortBattle
 	and I_CompareCounter army_sieging = 1
	and I_BattleEnemyArmyNumberOfClassAndCategory missile siege > 0
	and I_BattlePlayerArmyNumberOfAttribute extreme_range = 0
	and ! I_BattlePlayerArmyIsAttacker
	and I_IsBattleSettlementCastle
	and I_BattleSettlementFortificationLevel 3

	unit_group_order_halt army2
	if I_CompareCounter army_south = 1
	unit_group_order_relative_move_formed army2 0 170
	end_if
	if I_CompareCounter army_north = 1
	unit_group_order_relative_move_formed army2 0 -170
	end_if
	if I_CompareCounter army_east = 1
	unit_group_order_relative_move_formed army2 -170 0
	end_if
	if I_CompareCounter army_west = 1
	unit_group_order_relative_move_formed army2 170 0
	end_if
	set_counter emergency_stop 1
	set_counter omfg_cannon_tower 1
	battle_wait 160
 
	if I_InBattle
	and I_CompareCounter omfg_cannon_tower = 1
	set_counter omfg_cannon_tower 0
	end_if

	if I_InBattle
	and I_CompareCounter emergency_stop = 1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	battle_wait 1
	ai_active_set on
	end_if

	set_counter army_sieging 0
end_monitor

;;;;;;;Wall Advance

monitor_conditions I_InBattle
 	and I_CompareCounter wall_advance = 1
	and I_ConflictType Siege

	unit_group_order_halt army2
	if I_CompareCounter wall_advance_south = 1
	unit_group_order_relative_move_formed army2 0 95
	end_if
	if I_CompareCounter wall_advance_north = 1
	unit_group_order_relative_move_formed army2 0 -95
	end_if
	if I_CompareCounter wall_advance_east = 1
	unit_group_order_relative_move_formed army2 -95 0
	end_if
	if I_CompareCounter wall_advance_west = 1
	unit_group_order_relative_move_formed army2 95 0
	end_if

	set_counter wall_advance 0
	set_counter emergency_stop 1
	battle_wait 80

	if I_InBattle
	and I_CompareCounter emergency_stop = 1
	
	set_counter emergency_stop 0
	unit_group_order_halt army2
	battle_wait 1
	ai_active_set on
	end_if
end_monitor

monitor_conditions I_BattleStarted
	and I_CompareCounter omfg_cannon_tower = 1

	battle_wait 5

	if I_BattleEnemyArmyNumberOfUnits > 1
	and I_CompareCounter omfg_cannon_tower = 1
	and I_IsUnitUnderFire General2
	and ! I_UnitInRangeOfUnitGroup General2 army1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	set_counter omfg_cannon_tower 2
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 1
	and I_CompareCounter omfg_cannon_tower = 1
	and I_IsUnitUnderFire unit20
	and ! I_UnitInRangeOfUnitGroup unit20 army1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	set_counter omfg_cannon_tower 2
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 2
	and I_CompareCounter omfg_cannon_tower = 1
	and I_IsUnitUnderFire unit21
	and ! I_UnitInRangeOfUnitGroup unit21 army1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	set_counter omfg_cannon_tower 2
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 3
	and I_CompareCounter omfg_cannon_tower = 1
	and I_IsUnitUnderFire unit22
	and ! I_UnitInRangeOfUnitGroup unit22 army1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	set_counter omfg_cannon_tower 2
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 4
	and I_CompareCounter omfg_cannon_tower = 1
	and I_IsUnitUnderFire unit23
	and ! I_UnitInRangeOfUnitGroup unit23 army1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	set_counter omfg_cannon_tower 2
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 5
	and I_CompareCounter omfg_cannon_tower = 1
	and I_IsUnitUnderFire unit24
	and ! I_UnitInRangeOfUnitGroup unit24 army1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	set_counter omfg_cannon_tower 2
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 6
	and I_CompareCounter omfg_cannon_tower = 1
	and I_IsUnitUnderFire unit25
	and ! I_UnitInRangeOfUnitGroup unit25 army1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	set_counter omfg_cannon_tower 2
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 7
	and I_CompareCounter omfg_cannon_tower = 1
	and I_IsUnitUnderFire unit26
	and ! I_UnitInRangeOfUnitGroup unit26 army1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	set_counter omfg_cannon_tower 2
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 8
	and I_CompareCounter omfg_cannon_tower = 1
	and I_IsUnitUnderFire unit27
	and ! I_UnitInRangeOfUnitGroup unit27 army1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	set_counter omfg_cannon_tower 2
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 9
	and I_CompareCounter omfg_cannon_tower = 1
	and I_IsUnitUnderFire unit28
	and ! I_UnitInRangeOfUnitGroup unit28 army1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	set_counter omfg_cannon_tower 2
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 10
	and I_CompareCounter omfg_cannon_tower = 1
	and I_IsUnitUnderFire unit29
	and ! I_UnitInRangeOfUnitGroup unit29 army1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	set_counter omfg_cannon_tower 2
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 11
	and I_CompareCounter omfg_cannon_tower = 1
	and I_IsUnitUnderFire unit30
	and ! I_UnitInRangeOfUnitGroup unit30 army1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	set_counter omfg_cannon_tower 2
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 12
	and I_CompareCounter omfg_cannon_tower = 1
	and I_IsUnitUnderFire unit31
	and ! I_UnitInRangeOfUnitGroup unit31 army1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	set_counter omfg_cannon_tower 2
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 13
	and I_CompareCounter omfg_cannon_tower = 1
	and I_IsUnitUnderFire unit32
	and ! I_UnitInRangeOfUnitGroup unit32 army1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	set_counter omfg_cannon_tower 2
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 14
	and I_CompareCounter omfg_cannon_tower = 1
	and I_IsUnitUnderFire unit33
	and ! I_UnitInRangeOfUnitGroup unit33 army1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	set_counter omfg_cannon_tower 2
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 15
	and I_CompareCounter omfg_cannon_tower = 1
	and I_IsUnitUnderFire unit34
	and ! I_UnitInRangeOfUnitGroup unit34 army1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	set_counter omfg_cannon_tower 2
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 16
	and I_CompareCounter omfg_cannon_tower = 1
	and I_IsUnitUnderFire unit35
	and ! I_UnitInRangeOfUnitGroup unit35 army1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	set_counter omfg_cannon_tower 2
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 17
	and I_CompareCounter omfg_cannon_tower = 1
	and I_IsUnitUnderFire unit36
	and ! I_UnitInRangeOfUnitGroup unit36 army1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	set_counter omfg_cannon_tower 2
	end_if

	if I_BattleEnemyArmyNumberOfUnits > 18
	and I_CompareCounter omfg_cannon_tower = 1
	and I_IsUnitUnderFire unit37
	and ! I_UnitInRangeOfUnitGroup unit37 army1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	set_counter omfg_cannon_tower 2
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 20
	and I_CompareCounter omfg_cannon_tower = 1
	and I_IsUnitUnderFire unit38
	and ! I_UnitInRangeOfUnitGroup unit38 army1
	set_counter emergency_stop 0
	unit_group_order_halt army2
	set_counter omfg_cannon_tower 2
	end_if

	wait 1

;;;;;;;South

while I_CompareCounter army_south = 1
	and I_CompareCounter omfg_cannon_tower = 2

	if I_BattleEnemyArmyNumberOfUnits = 2
	ai_active_set off
	unit_order_move_relative General2 0 -40 run
	unit_order_move_relative unit20 0 -40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 3
	ai_active_set off
	unit_order_move_relative General2 0 -40 run
	unit_order_move_relative unit20 0 -40 run
	unit_order_move_relative unit21 0 -40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 4
	ai_active_set off
	unit_order_move_relative General2 0 -40 run
	unit_order_move_relative unit20 0 -40 run
	unit_order_move_relative unit21 0 -40 run
	unit_order_move_relative unit22 0 -40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 5
	ai_active_set off
	unit_order_move_relative General2 0 -40 run
	unit_order_move_relative unit20 0 -40 run
	unit_order_move_relative unit21 0 -40 run
	unit_order_move_relative unit22 0 -40 run
	unit_order_move_relative unit23 0 -40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 6
	ai_active_set off
	unit_order_move_relative General2 0 -40 run
	unit_order_move_relative unit20 0 -40 run
	unit_order_move_relative unit21 0 -40 run
	unit_order_move_relative unit22 0 -40 run
	unit_order_move_relative unit23 0 -40 run
	unit_order_move_relative unit24 0 -40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 7
	ai_active_set off
	unit_order_move_relative General2 0 -40 run
	unit_order_move_relative unit20 0 -40 run
	unit_order_move_relative unit21 0 -40 run
	unit_order_move_relative unit22 0 -40 run
	unit_order_move_relative unit23 0 -40 run
	unit_order_move_relative unit24 0 -40 run
	unit_order_move_relative unit25 0 -40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 8
	ai_active_set off
	unit_order_move_relative General2 0 -40 run
	unit_order_move_relative unit20 0 -40 run
	unit_order_move_relative unit21 0 -40 run
	unit_order_move_relative unit22 0 -40 run
	unit_order_move_relative unit23 0 -40 run
	unit_order_move_relative unit24 0 -40 run
	unit_order_move_relative unit25 0 -40 run
	unit_order_move_relative unit26 0 -40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 9
	ai_active_set off
	unit_order_move_relative General2 0 -40 run
	unit_order_move_relative unit20 0 -40 run
	unit_order_move_relative unit21 0 -40 run
	unit_order_move_relative unit22 0 -40 run
	unit_order_move_relative unit23 0 -40 run
	unit_order_move_relative unit24 0 -40 run
	unit_order_move_relative unit25 0 -40 run
	unit_order_move_relative unit26 0 -40 run
	unit_order_move_relative unit27 0 -40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 10
	ai_active_set off
	unit_order_move_relative General2 0 -40 run
	unit_order_move_relative unit20 0 -40 run
	unit_order_move_relative unit21 0 -40 run
	unit_order_move_relative unit22 0 -40 run
	unit_order_move_relative unit23 0 -40 run
	unit_order_move_relative unit24 0 -40 run
	unit_order_move_relative unit25 0 -40 run
	unit_order_move_relative unit26 0 -40 run
	unit_order_move_relative unit27 0 -40 run
	unit_order_move_relative unit28 0 -40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 11
	ai_active_set off
	unit_order_move_relative General2 0 -40 run
	unit_order_move_relative unit20 0 -40 run
	unit_order_move_relative unit21 0 -40 run
	unit_order_move_relative unit22 0 -40 run
	unit_order_move_relative unit23 0 -40 run
	unit_order_move_relative unit24 0 -40 run
	unit_order_move_relative unit25 0 -40 run
	unit_order_move_relative unit26 0 -40 run
	unit_order_move_relative unit27 0 -40 run
	unit_order_move_relative unit28 0 -40 run
	unit_order_move_relative unit29 0 -40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 12
	ai_active_set off
	unit_order_move_relative General2 0 -40 run
	unit_order_move_relative unit20 0 -40 run
	unit_order_move_relative unit21 0 -40 run
	unit_order_move_relative unit22 0 -40 run
	unit_order_move_relative unit23 0 -40 run
	unit_order_move_relative unit24 0 -40 run
	unit_order_move_relative unit25 0 -40 run
	unit_order_move_relative unit26 0 -40 run
	unit_order_move_relative unit27 0 -40 run
	unit_order_move_relative unit28 0 -40 run
	unit_order_move_relative unit29 0 -40 run
	unit_order_move_relative unit30 0 -40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 13
	ai_active_set off
	unit_order_move_relative General2 0 -40 run
	unit_order_move_relative unit20 0 -40 run
	unit_order_move_relative unit21 0 -40 run
	unit_order_move_relative unit22 0 -40 run
	unit_order_move_relative unit23 0 -40 run
	unit_order_move_relative unit24 0 -40 run
	unit_order_move_relative unit25 0 -40 run
	unit_order_move_relative unit26 0 -40 run
	unit_order_move_relative unit27 0 -40 run
	unit_order_move_relative unit28 0 -40 run
	unit_order_move_relative unit29 0 -40 run
	unit_order_move_relative unit30 0 -40 run
	unit_order_move_relative unit31 0 -40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 14
	ai_active_set off
	unit_order_move_relative General2 0 -40 run
	unit_order_move_relative unit20 0 -40 run
	unit_order_move_relative unit21 0 -40 run
	unit_order_move_relative unit22 0 -40 run
	unit_order_move_relative unit23 0 -40 run
	unit_order_move_relative unit24 0 -40 run
	unit_order_move_relative unit25 0 -40 run
	unit_order_move_relative unit26 0 -40 run
	unit_order_move_relative unit27 0 -40 run
	unit_order_move_relative unit28 0 -40 run
	unit_order_move_relative unit29 0 -40 run
	unit_order_move_relative unit30 0 -40 run
	unit_order_move_relative unit31 0 -40 run
	unit_order_move_relative unit32 0 -40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 15
	ai_active_set off
	unit_order_move_relative General2 0 -40 run
	unit_order_move_relative unit20 0 -40 run
	unit_order_move_relative unit21 0 -40 run
	unit_order_move_relative unit22 0 -40 run
	unit_order_move_relative unit23 0 -40 run
	unit_order_move_relative unit24 0 -40 run
	unit_order_move_relative unit25 0 -40 run
	unit_order_move_relative unit26 0 -40 run
	unit_order_move_relative unit27 0 -40 run
	unit_order_move_relative unit28 0 -40 run
	unit_order_move_relative unit29 0 -40 run
	unit_order_move_relative unit30 0 -40 run
	unit_order_move_relative unit31 0 -40 run
	unit_order_move_relative unit32 0 -40 run
	unit_order_move_relative unit33 0 -40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	unit_order_turn unit33 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 16
	ai_active_set off
	unit_order_move_relative General2 0 -40 run
	unit_order_move_relative unit20 0 -40 run
	unit_order_move_relative unit21 0 -40 run
	unit_order_move_relative unit22 0 -40 run
	unit_order_move_relative unit23 0 -40 run
	unit_order_move_relative unit24 0 -40 run
	unit_order_move_relative unit25 0 -40 run
	unit_order_move_relative unit26 0 -40 run
	unit_order_move_relative unit27 0 -40 run
	unit_order_move_relative unit28 0 -40 run
	unit_order_move_relative unit29 0 -40 run
	unit_order_move_relative unit30 0 -40 run
	unit_order_move_relative unit31 0 -40 run
	unit_order_move_relative unit32 0 -40 run
	unit_order_move_relative unit33 0 -40 run
	unit_order_move_relative unit34 0 -40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	unit_order_turn unit33 -180 relative
	unit_order_turn unit34 -180 relative
	battle_wait 1
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 17
	ai_active_set off
	unit_order_move_relative General2 0 -40 run
	unit_order_move_relative unit20 0 -40 run
	unit_order_move_relative unit21 0 -40 run
	unit_order_move_relative unit22 0 -40 run
	unit_order_move_relative unit23 0 -40 run
	unit_order_move_relative unit24 0 -40 run
	unit_order_move_relative unit25 0 -40 run
	unit_order_move_relative unit26 0 -40 run
	unit_order_move_relative unit27 0 -40 run
	unit_order_move_relative unit28 0 -40 run
	unit_order_move_relative unit29 0 -40 run
	unit_order_move_relative unit30 0 -40 run
	unit_order_move_relative unit31 0 -40 run
	unit_order_move_relative unit32 0 -40 run
	unit_order_move_relative unit33 0 -40 run
	unit_order_move_relative unit34 0 -40 run
	unit_order_move_relative unit35 0 -40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	unit_order_turn unit33 -180 relative
	unit_order_turn unit34 -180 relative
	unit_order_turn unit35 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 18
	ai_active_set off
	unit_order_move_relative General2 0 -40 run
	unit_order_move_relative unit20 0 -40 run
	unit_order_move_relative unit21 0 -40 run
	unit_order_move_relative unit22 0 -40 run
	unit_order_move_relative unit23 0 -40 run
	unit_order_move_relative unit24 0 -40 run
	unit_order_move_relative unit25 0 -40 run
	unit_order_move_relative unit26 0 -40 run
	unit_order_move_relative unit27 0 -40 run
	unit_order_move_relative unit28 0 -40 run
	unit_order_move_relative unit29 0 -40 run
	unit_order_move_relative unit30 0 -40 run
	unit_order_move_relative unit31 0 -40 run
	unit_order_move_relative unit32 0 -40 run
	unit_order_move_relative unit33 0 -40 run
	unit_order_move_relative unit34 0 -40 run
	unit_order_move_relative unit35 0 -40 run
	unit_order_move_relative unit36 0 -40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	unit_order_turn unit33 -180 relative
	unit_order_turn unit34 -180 relative
	unit_order_turn unit35 -180 relative
	unit_order_turn unit36 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 19
	ai_active_set off
	unit_order_move_relative General2 0 -40 run
	unit_order_move_relative unit20 0 -40 run
	unit_order_move_relative unit21 0 -40 run
	unit_order_move_relative unit22 0 -40 run
	unit_order_move_relative unit23 0 -40 run
	unit_order_move_relative unit24 0 -40 run
	unit_order_move_relative unit25 0 -40 run
	unit_order_move_relative unit26 0 -40 run
	unit_order_move_relative unit27 0 -40 run
	unit_order_move_relative unit28 0 -40 run
	unit_order_move_relative unit29 0 -40 run
	unit_order_move_relative unit30 0 -40 run
	unit_order_move_relative unit31 0 -40 run
	unit_order_move_relative unit32 0 -40 run
	unit_order_move_relative unit33 0 -40 run
	unit_order_move_relative unit34 0 -40 run
	unit_order_move_relative unit35 0 -40 run
	unit_order_move_relative unit36 0 -40 run
	unit_order_move_relative unit37 0 -40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	unit_order_turn unit33 -180 relative
	unit_order_turn unit34 -180 relative
	unit_order_turn unit35 -180 relative
	unit_order_turn unit36 -180 relative
	unit_order_turn unit37 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 20
	ai_active_set off
	unit_order_move_relative General2 0 -40 run
	unit_order_move_relative unit20 0 -40 run
	unit_order_move_relative unit21 0 -40 run
	unit_order_move_relative unit22 0 -40 run
	unit_order_move_relative unit23 0 -40 run
	unit_order_move_relative unit24 0 -40 run
	unit_order_move_relative unit25 0 -40 run
	unit_order_move_relative unit26 0 -40 run
	unit_order_move_relative unit27 0 -40 run
	unit_order_move_relative unit28 0 -40 run
	unit_order_move_relative unit29 0 -40 run
	unit_order_move_relative unit30 0 -40 run
	unit_order_move_relative unit31 0 -40 run
	unit_order_move_relative unit32 0 -40 run
	unit_order_move_relative unit33 0 -40 run
	unit_order_move_relative unit34 0 -40 run
	unit_order_move_relative unit35 0 -40 run
	unit_order_move_relative unit36 0 -40 run
	unit_order_move_relative unit37 0 -40 run
	unit_order_move_relative unit38 0 -40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	unit_order_turn unit33 -180 relative
	unit_order_turn unit34 -180 relative
	unit_order_turn unit35 -180 relative
	unit_order_turn unit36 -180 relative
	unit_order_turn unit37 -180 relative
	unit_order_turn unit38 -180 relative
	battle_wait 10
	end_if

	set_counter omfg_cannon_tower 0
	unit_group_order_halt army2
	wait 1
	ai_active_set off
	wait 1
	ai_active_set on
end_while

;;;;;;; North

while I_CompareCounter army_north = 1
	and I_CompareCounter omfg_cannon_tower = 2

	if I_BattleEnemyArmyNumberOfUnits = 2
	ai_active_set off
	unit_order_move_relative General2 0 40 run
	unit_order_move_relative unit20 0 40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 3
	ai_active_set off
	unit_order_move_relative General2 0 40 run
	unit_order_move_relative unit20 0 40 run
	unit_order_move_relative unit21 0 40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 4
	ai_active_set off
	unit_order_move_relative General2 0 40 run
	unit_order_move_relative unit20 0 40 run
	unit_order_move_relative unit21 0 40 run
	unit_order_move_relative unit22 0 40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 5
	ai_active_set off
	unit_order_move_relative General2 0 40 run
	unit_order_move_relative unit20 0 40 run
	unit_order_move_relative unit21 0 40 run
	unit_order_move_relative unit22 0 40 run
	unit_order_move_relative unit23 0 40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 6
	ai_active_set off
	unit_order_move_relative General2 0 40 run
	unit_order_move_relative unit20 0 40 run
	unit_order_move_relative unit21 0 40 run
	unit_order_move_relative unit22 0 40 run
	unit_order_move_relative unit23 0 40 run
	unit_order_move_relative unit24 0 40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 7
	ai_active_set off
	unit_order_move_relative General2 0 40 run
	unit_order_move_relative unit20 0 40 run
	unit_order_move_relative unit21 0 40 run
	unit_order_move_relative unit22 0 40 run
	unit_order_move_relative unit23 0 40 run
	unit_order_move_relative unit24 0 40 run
	unit_order_move_relative unit25 0 40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 8
	ai_active_set off
	unit_order_move_relative General2 0 40 run
	unit_order_move_relative unit20 0 40 run
	unit_order_move_relative unit21 0 40 run
	unit_order_move_relative unit22 0 40 run
	unit_order_move_relative unit23 0 40 run
	unit_order_move_relative unit24 0 40 run
	unit_order_move_relative unit25 0 40 run
	unit_order_move_relative unit26 0 40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 9
	ai_active_set off
	unit_order_move_relative General2 0 40 run
	unit_order_move_relative unit20 0 40 run
	unit_order_move_relative unit21 0 40 run
	unit_order_move_relative unit22 0 40 run
	unit_order_move_relative unit23 0 40 run
	unit_order_move_relative unit24 0 40 run
	unit_order_move_relative unit25 0 40 run
	unit_order_move_relative unit26 0 40 run
	unit_order_move_relative unit27 0 40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 10
	ai_active_set off
	unit_order_move_relative General2 0 40 run
	unit_order_move_relative unit20 0 40 run
	unit_order_move_relative unit21 0 40 run
	unit_order_move_relative unit22 0 40 run
	unit_order_move_relative unit23 0 40 run
	unit_order_move_relative unit24 0 40 run
	unit_order_move_relative unit25 0 40 run
	unit_order_move_relative unit26 0 40 run
	unit_order_move_relative unit27 0 40 run
	unit_order_move_relative unit28 0 40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 11
	ai_active_set off
	unit_order_move_relative General2 0 40 run
	unit_order_move_relative unit20 0 40 run
	unit_order_move_relative unit21 0 40 run
	unit_order_move_relative unit22 0 40 run
	unit_order_move_relative unit23 0 40 run
	unit_order_move_relative unit24 0 40 run
	unit_order_move_relative unit25 0 40 run
	unit_order_move_relative unit26 0 40 run
	unit_order_move_relative unit27 0 40 run
	unit_order_move_relative unit28 0 40 run
	unit_order_move_relative unit29 0 40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 12
	ai_active_set off
	unit_order_move_relative General2 0 40 run
	unit_order_move_relative unit20 0 40 run
	unit_order_move_relative unit21 0 40 run
	unit_order_move_relative unit22 0 40 run
	unit_order_move_relative unit23 0 40 run
	unit_order_move_relative unit24 0 40 run
	unit_order_move_relative unit25 0 40 run
	unit_order_move_relative unit26 0 40 run
	unit_order_move_relative unit27 0 40 run
	unit_order_move_relative unit28 0 40 run
	unit_order_move_relative unit29 0 40 run
	unit_order_move_relative unit30 0 40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 13
	ai_active_set off
	unit_order_move_relative General2 0 40 run
	unit_order_move_relative unit20 0 40 run
	unit_order_move_relative unit21 0 40 run
	unit_order_move_relative unit22 0 40 run
	unit_order_move_relative unit23 0 40 run
	unit_order_move_relative unit24 0 40 run
	unit_order_move_relative unit25 0 40 run
	unit_order_move_relative unit26 0 40 run
	unit_order_move_relative unit27 0 40 run
	unit_order_move_relative unit28 0 40 run
	unit_order_move_relative unit29 0 40 run
	unit_order_move_relative unit30 0 40 run
	unit_order_move_relative unit31 0 40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 14
	ai_active_set off
	unit_order_move_relative General2 0 40 run
	unit_order_move_relative unit20 0 40 run
	unit_order_move_relative unit21 0 40 run
	unit_order_move_relative unit22 0 40 run
	unit_order_move_relative unit23 0 40 run
	unit_order_move_relative unit24 0 40 run
	unit_order_move_relative unit25 0 40 run
	unit_order_move_relative unit26 0 40 run
	unit_order_move_relative unit27 0 40 run
	unit_order_move_relative unit28 0 40 run
	unit_order_move_relative unit29 0 40 run
	unit_order_move_relative unit30 0 40 run
	unit_order_move_relative unit31 0 40 run
	unit_order_move_relative unit32 0 40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 15
	ai_active_set off
	unit_order_move_relative General2 0 40 run
	unit_order_move_relative unit20 0 40 run
	unit_order_move_relative unit21 0 40 run
	unit_order_move_relative unit22 0 40 run
	unit_order_move_relative unit23 0 40 run
	unit_order_move_relative unit24 0 40 run
	unit_order_move_relative unit25 0 40 run
	unit_order_move_relative unit26 0 40 run
	unit_order_move_relative unit27 0 40 run
	unit_order_move_relative unit28 0 40 run
	unit_order_move_relative unit29 0 40 run
	unit_order_move_relative unit30 0 40 run
	unit_order_move_relative unit31 0 40 run
	unit_order_move_relative unit32 0 40 run
	unit_order_move_relative unit33 0 40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	unit_order_turn unit33 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 16
	ai_active_set off
	unit_order_move_relative General2 0 40 run
	unit_order_move_relative unit20 0 40 run
	unit_order_move_relative unit21 0 40 run
	unit_order_move_relative unit22 0 40 run
	unit_order_move_relative unit23 0 40 run
	unit_order_move_relative unit24 0 40 run
	unit_order_move_relative unit25 0 40 run
	unit_order_move_relative unit26 0 40 run
	unit_order_move_relative unit27 0 40 run
	unit_order_move_relative unit28 0 40 run
	unit_order_move_relative unit29 0 40 run
	unit_order_move_relative unit30 0 40 run
	unit_order_move_relative unit31 0 40 run
	unit_order_move_relative unit32 0 40 run
	unit_order_move_relative unit33 0 40 run
	unit_order_move_relative unit34 0 40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	unit_order_turn unit33 -180 relative
	unit_order_turn unit34 -180 relative
	battle_wait 1
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 17
	ai_active_set off
	unit_order_move_relative General2 0 40 run
	unit_order_move_relative unit20 0 40 run
	unit_order_move_relative unit21 0 40 run
	unit_order_move_relative unit22 0 40 run
	unit_order_move_relative unit23 0 40 run
	unit_order_move_relative unit24 0 40 run
	unit_order_move_relative unit25 0 40 run
	unit_order_move_relative unit26 0 40 run
	unit_order_move_relative unit27 0 40 run
	unit_order_move_relative unit28 0 40 run
	unit_order_move_relative unit29 0 40 run
	unit_order_move_relative unit30 0 40 run
	unit_order_move_relative unit31 0 40 run
	unit_order_move_relative unit32 0 40 run
	unit_order_move_relative unit33 0 40 run
	unit_order_move_relative unit34 0 40 run
	unit_order_move_relative unit35 0 40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	unit_order_turn unit33 -180 relative
	unit_order_turn unit34 -180 relative
	unit_order_turn unit35 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 18
	ai_active_set off
	unit_order_move_relative General2 0 40 run
	unit_order_move_relative unit20 0 40 run
	unit_order_move_relative unit21 0 40 run
	unit_order_move_relative unit22 0 40 run
	unit_order_move_relative unit23 0 40 run
	unit_order_move_relative unit24 0 40 run
	unit_order_move_relative unit25 0 40 run
	unit_order_move_relative unit26 0 40 run
	unit_order_move_relative unit27 0 40 run
	unit_order_move_relative unit28 0 40 run
	unit_order_move_relative unit29 0 40 run
	unit_order_move_relative unit30 0 40 run
	unit_order_move_relative unit31 0 40 run
	unit_order_move_relative unit32 0 40 run
	unit_order_move_relative unit33 0 40 run
	unit_order_move_relative unit34 0 40 run
	unit_order_move_relative unit35 0 40 run
	unit_order_move_relative unit36 0 40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	unit_order_turn unit33 -180 relative
	unit_order_turn unit34 -180 relative
	unit_order_turn unit35 -180 relative
	unit_order_turn unit36 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 19
	ai_active_set off
	unit_order_move_relative General2 0 40 run
	unit_order_move_relative unit20 0 40 run
	unit_order_move_relative unit21 0 40 run
	unit_order_move_relative unit22 0 40 run
	unit_order_move_relative unit23 0 40 run
	unit_order_move_relative unit24 0 40 run
	unit_order_move_relative unit25 0 40 run
	unit_order_move_relative unit26 0 40 run
	unit_order_move_relative unit27 0 40 run
	unit_order_move_relative unit28 0 40 run
	unit_order_move_relative unit29 0 40 run
	unit_order_move_relative unit30 0 40 run
	unit_order_move_relative unit31 0 40 run
	unit_order_move_relative unit32 0 40 run
	unit_order_move_relative unit33 0 40 run
	unit_order_move_relative unit34 0 40 run
	unit_order_move_relative unit35 0 40 run
	unit_order_move_relative unit36 0 40 run
	unit_order_move_relative unit37 0 40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	unit_order_turn unit33 -180 relative
	unit_order_turn unit34 -180 relative
	unit_order_turn unit35 -180 relative
	unit_order_turn unit36 -180 relative
	unit_order_turn unit37 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 20
	ai_active_set off
	unit_order_move_relative General2 0 40 run
	unit_order_move_relative unit20 0 40 run
	unit_order_move_relative unit21 0 40 run
	unit_order_move_relative unit22 0 40 run
	unit_order_move_relative unit23 0 40 run
	unit_order_move_relative unit24 0 40 run
	unit_order_move_relative unit25 0 40 run
	unit_order_move_relative unit26 0 40 run
	unit_order_move_relative unit27 0 40 run
	unit_order_move_relative unit28 0 40 run
	unit_order_move_relative unit29 0 40 run
	unit_order_move_relative unit30 0 40 run
	unit_order_move_relative unit31 0 40 run
	unit_order_move_relative unit32 0 40 run
	unit_order_move_relative unit33 0 40 run
	unit_order_move_relative unit34 0 40 run
	unit_order_move_relative unit35 0 40 run
	unit_order_move_relative unit36 0 40 run
	unit_order_move_relative unit37 0 40 run
	unit_order_move_relative unit38 0 40 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	unit_order_turn unit33 -180 relative
	unit_order_turn unit34 -180 relative
	unit_order_turn unit35 -180 relative
	unit_order_turn unit36 -180 relative
	unit_order_turn unit37 -180 relative
	unit_order_turn unit38 -180 relative
	battle_wait 10
	end_if

	set_counter omfg_cannon_tower 0
	unit_group_order_halt army2
	wait 1
	ai_active_set off
	wait 1
	ai_active_set on
end_while

;;;;;;;East

while I_CompareCounter army_east = 1
	and I_CompareCounter omfg_cannon_tower = 2

	if I_BattleEnemyArmyNumberOfUnits = 2
	ai_active_set off
	unit_order_move_relative General2 -40 0 run
	unit_order_move_relative unit20 -40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 3
	ai_active_set off
	unit_order_move_relative General2 -40 0 run
	unit_order_move_relative unit20 -40 0 run
	unit_order_move_relative unit21 -40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 4
	ai_active_set off
	unit_order_move_relative General2 -40 0 run
	unit_order_move_relative unit20 -40 0 run
	unit_order_move_relative unit21 -40 0 run
	unit_order_move_relative unit22 -40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 5
	ai_active_set off
	unit_order_move_relative General2 -40 0 run
	unit_order_move_relative unit20 -40 0 run
	unit_order_move_relative unit21 -40 0 run
	unit_order_move_relative unit22 -40 0 run
	unit_order_move_relative unit23 -40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 6
	ai_active_set off
	unit_order_move_relative General2 -40 0 run
	unit_order_move_relative unit20 -40 0 run
	unit_order_move_relative unit21 -40 0 run
	unit_order_move_relative unit22 -40 0 run
	unit_order_move_relative unit23 -40 0 run
	unit_order_move_relative unit24 -40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 7
	ai_active_set off
	unit_order_move_relative General2 -40 0 run
	unit_order_move_relative unit20 -40 0 run
	unit_order_move_relative unit21 -40 0 run
	unit_order_move_relative unit22 -40 0 run
	unit_order_move_relative unit23 -40 0 run
	unit_order_move_relative unit24 -40 0 run
	unit_order_move_relative unit25 -40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 8
	ai_active_set off
	unit_order_move_relative General2 -40 0 run
	unit_order_move_relative unit20 -40 0 run
	unit_order_move_relative unit21 -40 0 run
	unit_order_move_relative unit22 -40 0 run
	unit_order_move_relative unit23 -40 0 run
	unit_order_move_relative unit24 -40 0 run
	unit_order_move_relative unit25 -40 0 run
	unit_order_move_relative unit26 -40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 9
	ai_active_set off
	unit_order_move_relative General2 -40 0 run
	unit_order_move_relative unit20 -40 0 run
	unit_order_move_relative unit21 -40 0 run
	unit_order_move_relative unit22 -40 0 run
	unit_order_move_relative unit23 -40 0 run
	unit_order_move_relative unit24 -40 0 run
	unit_order_move_relative unit25 -40 0 run
	unit_order_move_relative unit26 -40 0 run
	unit_order_move_relative unit27 -40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 10
	ai_active_set off
	unit_order_move_relative General2 -40 0 run
	unit_order_move_relative unit20 -40 0 run
	unit_order_move_relative unit21 -40 0 run
	unit_order_move_relative unit22 -40 0 run
	unit_order_move_relative unit23 -40 0 run
	unit_order_move_relative unit24 -40 0 run
	unit_order_move_relative unit25 -40 0 run
	unit_order_move_relative unit26 -40 0 run
	unit_order_move_relative unit27 -40 0 run
	unit_order_move_relative unit28 -40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 11
	ai_active_set off
	unit_order_move_relative General2 -40 0 run
	unit_order_move_relative unit20 -40 0 run
	unit_order_move_relative unit21 -40 0 run
	unit_order_move_relative unit22 -40 0 run
	unit_order_move_relative unit23 -40 0 run
	unit_order_move_relative unit24 -40 0 run
	unit_order_move_relative unit25 -40 0 run
	unit_order_move_relative unit26 -40 0 run
	unit_order_move_relative unit27 -40 0 run
	unit_order_move_relative unit28 -40 0 run
	unit_order_move_relative unit29 -40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 12
	ai_active_set off
	unit_order_move_relative General2 -40 0 run
	unit_order_move_relative unit20 -40 0 run
	unit_order_move_relative unit21 -40 0 run
	unit_order_move_relative unit22 -40 0 run
	unit_order_move_relative unit23 -40 0 run
	unit_order_move_relative unit24 -40 0 run
	unit_order_move_relative unit25 -40 0 run
	unit_order_move_relative unit26 -40 0 run
	unit_order_move_relative unit27 -40 0 run
	unit_order_move_relative unit28 -40 0 run
	unit_order_move_relative unit29 -40 0 run
	unit_order_move_relative unit30 -40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 13
	ai_active_set off
	unit_order_move_relative General2 -40 0 run
	unit_order_move_relative unit20 -40 0 run
	unit_order_move_relative unit21 -40 0 run
	unit_order_move_relative unit22 -40 0 run
	unit_order_move_relative unit23 -40 0 run
	unit_order_move_relative unit24 -40 0 run
	unit_order_move_relative unit25 -40 0 run
	unit_order_move_relative unit26 -40 0 run
	unit_order_move_relative unit27 -40 0 run
	unit_order_move_relative unit28 -40 0 run
	unit_order_move_relative unit29 -40 0 run
	unit_order_move_relative unit30 -40 0 run
	unit_order_move_relative unit31 -40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 14
	ai_active_set off
	unit_order_move_relative General2 -40 0 run
	unit_order_move_relative unit20 -40 0 run
	unit_order_move_relative unit21 -40 0 run
	unit_order_move_relative unit22 -40 0 run
	unit_order_move_relative unit23 -40 0 run
	unit_order_move_relative unit24 -40 0 run
	unit_order_move_relative unit25 -40 0 run
	unit_order_move_relative unit26 -40 0 run
	unit_order_move_relative unit27 -40 0 run
	unit_order_move_relative unit28 -40 0 run
	unit_order_move_relative unit29 -40 0 run
	unit_order_move_relative unit30 -40 0 run
	unit_order_move_relative unit31 -40 0 run
	unit_order_move_relative unit32 -40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 15
	ai_active_set off
	unit_order_move_relative General2 -40 0 run
	unit_order_move_relative unit20 -40 0 run
	unit_order_move_relative unit21 -40 0 run
	unit_order_move_relative unit22 -40 0 run
	unit_order_move_relative unit23 -40 0 run
	unit_order_move_relative unit24 -40 0 run
	unit_order_move_relative unit25 -40 0 run
	unit_order_move_relative unit26 -40 0 run
	unit_order_move_relative unit27 -40 0 run
	unit_order_move_relative unit28 -40 0 run
	unit_order_move_relative unit29 -40 0 run
	unit_order_move_relative unit30 -40 0 run
	unit_order_move_relative unit31 -40 0 run
	unit_order_move_relative unit32 -40 0 run
	unit_order_move_relative unit33 -40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	unit_order_turn unit33 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 16
	ai_active_set off
	unit_order_move_relative General2 -40 0 run
	unit_order_move_relative unit20 -40 0 run
	unit_order_move_relative unit21 -40 0 run
	unit_order_move_relative unit22 -40 0 run
	unit_order_move_relative unit23 -40 0 run
	unit_order_move_relative unit24 -40 0 run
	unit_order_move_relative unit25 -40 0 run
	unit_order_move_relative unit26 -40 0 run
	unit_order_move_relative unit27 -40 0 run
	unit_order_move_relative unit28 -40 0 run
	unit_order_move_relative unit29 -40 0 run
	unit_order_move_relative unit30 -40 0 run
	unit_order_move_relative unit31 -40 0 run
	unit_order_move_relative unit32 -40 0 run
	unit_order_move_relative unit33 -40 0 run
	unit_order_move_relative unit34 -40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	unit_order_turn unit33 -180 relative
	unit_order_turn unit34 -180 relative
	battle_wait 1
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 17
	ai_active_set off
	unit_order_move_relative General2 -40 0 run
	unit_order_move_relative unit20 -40 0 run
	unit_order_move_relative unit21 -40 0 run
	unit_order_move_relative unit22 -40 0 run
	unit_order_move_relative unit23 -40 0 run
	unit_order_move_relative unit24 -40 0 run
	unit_order_move_relative unit25 -40 0 run
	unit_order_move_relative unit26 -40 0 run
	unit_order_move_relative unit27 -40 0 run
	unit_order_move_relative unit28 -40 0 run
	unit_order_move_relative unit29 -40 0 run
	unit_order_move_relative unit30 -40 0 run
	unit_order_move_relative unit31 -40 0 run
	unit_order_move_relative unit32 -40 0 run
	unit_order_move_relative unit33 -40 0 run
	unit_order_move_relative unit34 -40 0 run
	unit_order_move_relative unit35 -40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	unit_order_turn unit33 -180 relative
	unit_order_turn unit34 -180 relative
	unit_order_turn unit35 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 18
	ai_active_set off
	unit_order_move_relative General2 -40 0 run
	unit_order_move_relative unit20 -40 0 run
	unit_order_move_relative unit21 -40 0 run
	unit_order_move_relative unit22 -40 0 run
	unit_order_move_relative unit23 -40 0 run
	unit_order_move_relative unit24 -40 0 run
	unit_order_move_relative unit25 -40 0 run
	unit_order_move_relative unit26 -40 0 run
	unit_order_move_relative unit27 -40 0 run
	unit_order_move_relative unit28 -40 0 run
	unit_order_move_relative unit29 -40 0 run
	unit_order_move_relative unit30 -40 0 run
	unit_order_move_relative unit31 -40 0 run
	unit_order_move_relative unit32 -40 0 run
	unit_order_move_relative unit33 -40 0 run
	unit_order_move_relative unit34 -40 0 run
	unit_order_move_relative unit35 -40 0 run
	unit_order_move_relative unit36 -40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	unit_order_turn unit33 -180 relative
	unit_order_turn unit34 -180 relative
	unit_order_turn unit35 -180 relative
	unit_order_turn unit36 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 19
	ai_active_set off
	unit_order_move_relative General2 -40 0 run
	unit_order_move_relative unit20 -40 0 run
	unit_order_move_relative unit21 -40 0 run
	unit_order_move_relative unit22 -40 0 run
	unit_order_move_relative unit23 -40 0 run
	unit_order_move_relative unit24 -40 0 run
	unit_order_move_relative unit25 -40 0 run
	unit_order_move_relative unit26 -40 0 run
	unit_order_move_relative unit27 -40 0 run
	unit_order_move_relative unit28 -40 0 run
	unit_order_move_relative unit29 -40 0 run
	unit_order_move_relative unit30 -40 0 run
	unit_order_move_relative unit31 -40 0 run
	unit_order_move_relative unit32 -40 0 run
	unit_order_move_relative unit33 -40 0 run
	unit_order_move_relative unit34 -40 0 run
	unit_order_move_relative unit35 -40 0 run
	unit_order_move_relative unit36 -40 0 run
	unit_order_move_relative unit37 -40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	unit_order_turn unit33 -180 relative
	unit_order_turn unit34 -180 relative
	unit_order_turn unit35 -180 relative
	unit_order_turn unit36 -180 relative
	unit_order_turn unit37 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 20
	ai_active_set off
	unit_order_move_relative General2 -40 0 run
	unit_order_move_relative unit20 -40 0 run
	unit_order_move_relative unit21 -40 0 run
	unit_order_move_relative unit22 -40 0 run
	unit_order_move_relative unit23 -40 0 run
	unit_order_move_relative unit24 -40 0 run
	unit_order_move_relative unit25 -40 0 run
	unit_order_move_relative unit26 -40 0 run
	unit_order_move_relative unit27 -40 0 run
	unit_order_move_relative unit28 -40 0 run
	unit_order_move_relative unit29 -40 0 run
	unit_order_move_relative unit30 -40 0 run
	unit_order_move_relative unit31 -40 0 run
	unit_order_move_relative unit32 -40 0 run
	unit_order_move_relative unit33 -40 0 run
	unit_order_move_relative unit34 -40 0 run
	unit_order_move_relative unit35 -40 0 run
	unit_order_move_relative unit36 -40 0 run
	unit_order_move_relative unit37 -40 0 run
	unit_order_move_relative unit38 -40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	unit_order_turn unit33 -180 relative
	unit_order_turn unit34 -180 relative
	unit_order_turn unit35 -180 relative
	unit_order_turn unit36 -180 relative
	unit_order_turn unit37 -180 relative
	unit_order_turn unit38 -180 relative
	battle_wait 10
	end_if

	set_counter omfg_cannon_tower 0
	unit_group_order_halt army2
	wait 1
	ai_active_set off
	wait 1
	ai_active_set on
end_while

;;;;;;; West

while I_CompareCounter army_west = 1
	and I_CompareCounter omfg_cannon_tower = 2

	if I_BattleEnemyArmyNumberOfUnits = 2
	ai_active_set off
	unit_order_move_relative General2 40 0 run
	unit_order_move_relative unit20 40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 3
	ai_active_set off
	unit_order_move_relative General2 40 0 run
	unit_order_move_relative unit20 40 0 run
	unit_order_move_relative unit21 40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 4
	ai_active_set off
	unit_order_move_relative General2 40 0 run
	unit_order_move_relative unit20 40 0 run
	unit_order_move_relative unit21 40 0 run
	unit_order_move_relative unit22 40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 5
	ai_active_set off
	unit_order_move_relative General2 40 0 run
	unit_order_move_relative unit20 40 0 run
	unit_order_move_relative unit21 40 0 run
	unit_order_move_relative unit22 40 0 run
	unit_order_move_relative unit23 40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 6
	ai_active_set off
	unit_order_move_relative General2 40 0 run
	unit_order_move_relative unit20 40 0 run
	unit_order_move_relative unit21 40 0 run
	unit_order_move_relative unit22 40 0 run
	unit_order_move_relative unit23 40 0 run
	unit_order_move_relative unit24 40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 7
	ai_active_set off
	unit_order_move_relative General2 40 0 run
	unit_order_move_relative unit20 40 0 run
	unit_order_move_relative unit21 40 0 run
	unit_order_move_relative unit22 40 0 run
	unit_order_move_relative unit23 40 0 run
	unit_order_move_relative unit24 40 0 run
	unit_order_move_relative unit25 40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 8
	ai_active_set off
	unit_order_move_relative General2 40 0 run
	unit_order_move_relative unit20 40 0 run
	unit_order_move_relative unit21 40 0 run
	unit_order_move_relative unit22 40 0 run
	unit_order_move_relative unit23 40 0 run
	unit_order_move_relative unit24 40 0 run
	unit_order_move_relative unit25 40 0 run
	unit_order_move_relative unit26 40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 9
	ai_active_set off
	unit_order_move_relative General2 40 0 run
	unit_order_move_relative unit20 40 0 run
	unit_order_move_relative unit21 40 0 run
	unit_order_move_relative unit22 40 0 run
	unit_order_move_relative unit23 40 0 run
	unit_order_move_relative unit24 40 0 run
	unit_order_move_relative unit25 40 0 run
	unit_order_move_relative unit26 40 0 run
	unit_order_move_relative unit27 40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 10
	ai_active_set off
	unit_order_move_relative General2 40 0 run
	unit_order_move_relative unit20 40 0 run
	unit_order_move_relative unit21 40 0 run
	unit_order_move_relative unit22 40 0 run
	unit_order_move_relative unit23 40 0 run
	unit_order_move_relative unit24 40 0 run
	unit_order_move_relative unit25 40 0 run
	unit_order_move_relative unit26 40 0 run
	unit_order_move_relative unit27 40 0 run
	unit_order_move_relative unit28 40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 11
	ai_active_set off
	unit_order_move_relative General2 40 0 run
	unit_order_move_relative unit20 40 0 run
	unit_order_move_relative unit21 40 0 run
	unit_order_move_relative unit22 40 0 run
	unit_order_move_relative unit23 40 0 run
	unit_order_move_relative unit24 40 0 run
	unit_order_move_relative unit25 40 0 run
	unit_order_move_relative unit26 40 0 run
	unit_order_move_relative unit27 40 0 run
	unit_order_move_relative unit28 40 0 run
	unit_order_move_relative unit29 40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 12
	ai_active_set off
	unit_order_move_relative General2 40 0 run
	unit_order_move_relative unit20 40 0 run
	unit_order_move_relative unit21 40 0 run
	unit_order_move_relative unit22 40 0 run
	unit_order_move_relative unit23 40 0 run
	unit_order_move_relative unit24 40 0 run
	unit_order_move_relative unit25 40 0 run
	unit_order_move_relative unit26 40 0 run
	unit_order_move_relative unit27 40 0 run
	unit_order_move_relative unit28 40 0 run
	unit_order_move_relative unit29 40 0 run
	unit_order_move_relative unit30 40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 13
	ai_active_set off
	unit_order_move_relative General2 40 0 run
	unit_order_move_relative unit20 40 0 run
	unit_order_move_relative unit21 40 0 run
	unit_order_move_relative unit22 40 0 run
	unit_order_move_relative unit23 40 0 run
	unit_order_move_relative unit24 40 0 run
	unit_order_move_relative unit25 40 0 run
	unit_order_move_relative unit26 40 0 run
	unit_order_move_relative unit27 40 0 run
	unit_order_move_relative unit28 40 0 run
	unit_order_move_relative unit29 40 0 run
	unit_order_move_relative unit30 40 0 run
	unit_order_move_relative unit31 40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 14
	ai_active_set off
	unit_order_move_relative General2 40 0 run
	unit_order_move_relative unit20 40 0 run
	unit_order_move_relative unit21 40 0 run
	unit_order_move_relative unit22 40 0 run
	unit_order_move_relative unit23 40 0 run
	unit_order_move_relative unit24 40 0 run
	unit_order_move_relative unit25 40 0 run
	unit_order_move_relative unit26 40 0 run
	unit_order_move_relative unit27 40 0 run
	unit_order_move_relative unit28 40 0 run
	unit_order_move_relative unit29 40 0 run
	unit_order_move_relative unit30 40 0 run
	unit_order_move_relative unit31 40 0 run
	unit_order_move_relative unit32 40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 15
	ai_active_set off
	unit_order_move_relative General2 40 0 run
	unit_order_move_relative unit20 40 0 run
	unit_order_move_relative unit21 40 0 run
	unit_order_move_relative unit22 40 0 run
	unit_order_move_relative unit23 40 0 run
	unit_order_move_relative unit24 40 0 run
	unit_order_move_relative unit25 40 0 run
	unit_order_move_relative unit26 40 0 run
	unit_order_move_relative unit27 40 0 run
	unit_order_move_relative unit28 40 0 run
	unit_order_move_relative unit29 40 0 run
	unit_order_move_relative unit30 40 0 run
	unit_order_move_relative unit31 40 0 run
	unit_order_move_relative unit32 40 0 run
	unit_order_move_relative unit33 40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	unit_order_turn unit33 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 16
	ai_active_set off
	unit_order_move_relative General2 40 0 run
	unit_order_move_relative unit20 40 0 run
	unit_order_move_relative unit21 40 0 run
	unit_order_move_relative unit22 40 0 run
	unit_order_move_relative unit23 40 0 run
	unit_order_move_relative unit24 40 0 run
	unit_order_move_relative unit25 40 0 run
	unit_order_move_relative unit26 40 0 run
	unit_order_move_relative unit27 40 0 run
	unit_order_move_relative unit28 40 0 run
	unit_order_move_relative unit29 40 0 run
	unit_order_move_relative unit30 40 0 run
	unit_order_move_relative unit31 40 0 run
	unit_order_move_relative unit32 40 0 run
	unit_order_move_relative unit33 40 0 run
	unit_order_move_relative unit34 40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	unit_order_turn unit33 -180 relative
	unit_order_turn unit34 -180 relative
	battle_wait 1
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 17
	ai_active_set off
	unit_order_move_relative General2 40 0 run
	unit_order_move_relative unit20 40 0 run
	unit_order_move_relative unit21 40 0 run
	unit_order_move_relative unit22 40 0 run
	unit_order_move_relative unit23 40 0 run
	unit_order_move_relative unit24 40 0 run
	unit_order_move_relative unit25 40 0 run
	unit_order_move_relative unit26 40 0 run
	unit_order_move_relative unit27 40 0 run
	unit_order_move_relative unit28 40 0 run
	unit_order_move_relative unit29 40 0 run
	unit_order_move_relative unit30 40 0 run
	unit_order_move_relative unit31 40 0 run
	unit_order_move_relative unit32 40 0 run
	unit_order_move_relative unit33 40 0 run
	unit_order_move_relative unit34 40 0 run
	unit_order_move_relative unit35 40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	unit_order_turn unit33 -180 relative
	unit_order_turn unit34 -180 relative
	unit_order_turn unit35 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 18
	ai_active_set off
	unit_order_move_relative General2 40 0 run
	unit_order_move_relative unit20 40 0 run
	unit_order_move_relative unit21 40 0 run
	unit_order_move_relative unit22 40 0 run
	unit_order_move_relative unit23 40 0 run
	unit_order_move_relative unit24 40 0 run
	unit_order_move_relative unit25 40 0 run
	unit_order_move_relative unit26 40 0 run
	unit_order_move_relative unit27 40 0 run
	unit_order_move_relative unit28 40 0 run
	unit_order_move_relative unit29 40 0 run
	unit_order_move_relative unit30 40 0 run
	unit_order_move_relative unit31 40 0 run
	unit_order_move_relative unit32 40 0 run
	unit_order_move_relative unit33 40 0 run
	unit_order_move_relative unit34 40 0 run
	unit_order_move_relative unit35 40 0 run
	unit_order_move_relative unit36 40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	unit_order_turn unit33 -180 relative
	unit_order_turn unit34 -180 relative
	unit_order_turn unit35 -180 relative
	unit_order_turn unit36 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 19
	ai_active_set off
	unit_order_move_relative General2 40 0 run
	unit_order_move_relative unit20 40 0 run
	unit_order_move_relative unit21 40 0 run
	unit_order_move_relative unit22 40 0 run
	unit_order_move_relative unit23 40 0 run
	unit_order_move_relative unit24 40 0 run
	unit_order_move_relative unit25 40 0 run
	unit_order_move_relative unit26 40 0 run
	unit_order_move_relative unit27 40 0 run
	unit_order_move_relative unit28 40 0 run
	unit_order_move_relative unit29 40 0 run
	unit_order_move_relative unit30 40 0 run
	unit_order_move_relative unit31 40 0 run
	unit_order_move_relative unit32 40 0 run
	unit_order_move_relative unit33 40 0 run
	unit_order_move_relative unit34 40 0 run
	unit_order_move_relative unit35 40 0 run
	unit_order_move_relative unit36 40 0 run
	unit_order_move_relative unit37 40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	unit_order_turn unit33 -180 relative
	unit_order_turn unit34 -180 relative
	unit_order_turn unit35 -180 relative
	unit_order_turn unit36 -180 relative
	unit_order_turn unit37 -180 relative
	battle_wait 10
	end_if

	if I_BattleEnemyArmyNumberOfUnits = 20
	ai_active_set off
	unit_order_move_relative General2 40 0 run
	unit_order_move_relative unit20 40 0 run
	unit_order_move_relative unit21 40 0 run
	unit_order_move_relative unit22 40 0 run
	unit_order_move_relative unit23 40 0 run
	unit_order_move_relative unit24 40 0 run
	unit_order_move_relative unit25 40 0 run
	unit_order_move_relative unit26 40 0 run
	unit_order_move_relative unit27 40 0 run
	unit_order_move_relative unit28 40 0 run
	unit_order_move_relative unit29 40 0 run
	unit_order_move_relative unit30 40 0 run
	unit_order_move_relative unit31 40 0 run
	unit_order_move_relative unit32 40 0 run
	unit_order_move_relative unit33 40 0 run
	unit_order_move_relative unit34 40 0 run
	unit_order_move_relative unit35 40 0 run
	unit_order_move_relative unit36 40 0 run
	unit_order_move_relative unit37 40 0 run
	unit_order_move_relative unit38 40 0 run
	battle_wait 40
	unit_order_turn General2 -180 relative
	unit_order_turn unit20 -180 relative
	unit_order_turn unit21 -180 relative
	unit_order_turn unit22 -180 relative
	unit_order_turn unit23 -180 relative
	unit_order_turn unit24 -180 relative
	unit_order_turn unit25 -180 relative
	unit_order_turn unit26 -180 relative
	unit_order_turn unit27 -180 relative
	unit_order_turn unit28 -180 relative
	unit_order_turn unit29 -180 relative
	unit_order_turn unit30 -180 relative
	unit_order_turn unit31 -180 relative
	unit_order_turn unit32 -180 relative
	unit_order_turn unit33 -180 relative
	unit_order_turn unit34 -180 relative
	unit_order_turn unit35 -180 relative
	unit_order_turn unit36 -180 relative
	unit_order_turn unit37 -180 relative
	unit_order_turn unit38 -180 relative
	battle_wait 10
	end_if

	set_counter omfg_cannon_tower 0
	unit_group_order_halt army2
	wait 1
	ai_active_set off
	wait 1
	ai_active_set on
end_while

end_monitor


monitor_event BattlePlayerUnitAttacksEnemyUnit BattleIsMeleeAttack
	and I_CompareCounter emergency_stop = 1

	unit_group_order_halt army2
	battle_wait 1
	ai_active_set on
	set_counter emergency_stop 0
end_monitor

monitor_event BattleEnemySiegeEngineDestroyed BattleEnemyUnitSiegeEngineClass = ram

	unit_group_order_halt army2
	battle_wait 1
	ai_active_set on
end_monitor

;;;;;;; AI General Exp Bonus

monitor_event BattleConflictPhaseCommenced FactionIsLocal
and BattleDifficulty = hard

	battle_wait 2
	unit_set_experience General2 2
end_monitor

monitor_event BattleConflictPhaseCommenced FactionIsLocal
and BattleDifficulty = very_hard

	battle_wait 2
	unit_set_experience General2 4
end_monitor
;;;;;;; end of Exp Bonus

monitor_event ScrollOpened ScrollOpened post_battle_scroll

	;;;;;;;Stakes
	set_counter label_ready 0
	;;;;;;;HA fix
	set_counter ha_fix 0
	;;;;;;;Elephant
	set_counter elephant_fix 0
	set_counter second_ring 0
	set_counter third_ring 0
	set_counter elephant_gate 0
	set_counter elephant_gate_tier2 0
	set_counter elephant_gate_tier3 0
	set_counter del_objective 0
	set_counter rally_walls 0
	;;;;;;;Siege
	set_counter siege_fix 0
	set_counter kill_it 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 wall_advance 0
	set_counter wall_advance_south 0
	set_counter wall_advance_north 0
	set_counter wall_advance_west 0
	set_counter wall_advance_east 0
	set_counter emergency_stop 0
	set_counter omfg_cannon_tower 0
	;;;;;;;Protect General 
	set_counter protect_general 0
	set_counter general_wait 0
	prepare_for_battle
	suspend_unscripted_advice false
end_monitor

wait_monitors
end_script