g5script2.txt

Upload: federicohc

Post on 19-Oct-2015

17 views

Category:

Documents


0 download

TRANSCRIPT

;### Germanicu5 ReallyBadAI Battle System Scrips v5.x ;### This file contains manually programmed AI behaviour eliminating previously unfixable, hardcoded bugs and greatly influences battle performance ;### Support available at http://www.twcenter.net/forums/forumdisplay.php?f=1745 , http://www.twcenter.net/forums/showthread.php?t=257970 and http://www.twcente r.net/forums/showthread.php?t=253132 ;### Non-private use of code only by permission, ;### coded by Germanicu5 script declare_show_me dismiss_advice select_ui_element advisor_portrait_button simulate_mouse_click lclick_up ;prepare_for_battle ;;;;;;;Print Info log always Germanicu5 ReallyBadAI v5.7 Running. Please upload log and savegames when reporting battle CTDs for SS or TATW. ;;;;;;; declare_counter g5_cbattle_difficulty_high ;;;;;;; declare_counter fire_labels declare_counter player_unit_count declare_counter enemy_unit_count declare_counter open_battle declare_counter elephant_fix_check declare_counter labels_only declare_counter stakes_lock declare_counter script_delay ;;;;;;;Stakes declare_counter label_ready ;;;;;;;HA Fix declare_counter ha_fix ;;;;;;;Elephant Fix declare_counter elephant_fix declare_counter elephant_gate declare_counter elephant_gate_tier2 declare_counter elephant_gate_tier3 declare_counter rally_walls declare_counter second_ring declare_counter third_ring declare_counter del_objective ;;;;;;;Open Battles declare_counter ob_defense_launch declare_counter ob_defend declare_counter ob_siege_attack declare_counter ob_under_fire declare_counter ob_repeat_test declare_counter ob_engaged declare_counter player_units_closing declare_counter player_enveloping declare_counter player_engaged_reinf ;;;;;;;Protect General declare_counter general_wait declare_counter protect_general declare_counter g_stop

;;;;;;;AI Stuck declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter declare_counter

Fix ai_stuck_launch a2u1_stuck a2u2_stuck a2u3_stuck a2u4_stuck a2u5_stuck a2u6_stuck a2u7_stuck a2u8_stuck a2u9_stuck a2u10_stuck a2u11_stuck a2u12_stuck a2u13_stuck a2u14_stuck a2u15_stuck a2u16_stuck a2u17_stuck a2u18_stuck a2u19_stuck a2u20_stuck a2u1_status a2u2_status a2u3_status a2u4_status a2u5_status a2u6_status a2u7_status a2u8_status a2u9_status a2u10_status a2u11_status a2u12_status a2u13_status a2u14_status a2u15_status a2u16_status a2u17_status a2u18_status a2u19_status a2u20_status a2u1_distance a2u2_distance a2u3_distance a2u4_distance a2u5_distance a2u6_distance a2u7_distance a2u8_distance a2u9_distance a2u10_distance a2u11_distance a2u12_distance a2u13_distance a2u14_distance a2u15_distance a2u16_distance a2u17_distance a2u18_distance

declare_counter a2u19_distance declare_counter a2u20_distance monitor_event BattleConflictPhaseCommenced FactionIsLocal and BattleDifficulty > medium set_counter g5_cbattle_difficulty_high 1 terminate_monitor end_monitor if ! I_BattleIsSiegeBattle set_counter fire_labels 1 end_if if I_BattleIsSiegeBattle and I_BattleEnemyArmyNumberOfMountClass elephant > 0 set_counter fire_labels 1 end_if ; prepare_for_battle ;;;Army 1 set_counter player_unit_count 0 if I_BattlePlayerArmyNumberOfUnits label_unit 0 0 0 a1u1 inc_counter player_unit_count 1 if I_BattlePlayerArmyNumberOfUnits label_unit 0 0 1 a1u2 inc_counter player_unit_count 1 if I_BattlePlayerArmyNumberOfUnits label_unit 0 0 2 a1u3 inc_counter player_unit_count 1 if I_BattlePlayerArmyNumberOfUnits label_unit 0 0 3 a1u4 inc_counter player_unit_count 1 if I_BattlePlayerArmyNumberOfUnits label_unit 0 0 4 a1u5 inc_counter player_unit_count 1 if I_BattlePlayerArmyNumberOfUnits label_unit 0 0 5 a1u6 inc_counter player_unit_count 1 if I_BattlePlayerArmyNumberOfUnits label_unit 0 0 6 a1u7 inc_counter player_unit_count 1 if I_BattlePlayerArmyNumberOfUnits label_unit 0 0 7 a1u8 inc_counter player_unit_count 1 if I_BattlePlayerArmyNumberOfUnits label_unit 0 0 8 a1u9 inc_counter player_unit_count 1 if I_BattlePlayerArmyNumberOfUnits label_unit 0 0 9 a1u10 inc_counter player_unit_count 1 if I_BattlePlayerArmyNumberOfUnits label_unit 0 0 10 a1u11 inc_counter player_unit_count 1 if I_BattlePlayerArmyNumberOfUnits label_unit 0 0 11 a1u12 inc_counter player_unit_count 1 if I_BattlePlayerArmyNumberOfUnits

> 0 > 1 > 2 > 3 > 4 > 5 > 6 > 7 > 8 > 9 > 10 > 11 > 12

label_unit 0 0 12 a1u13 inc_counter player_unit_count 1 if I_BattlePlayerArmyNumberOfUnits label_unit 0 0 13 a1u14 inc_counter player_unit_count 1 if I_BattlePlayerArmyNumberOfUnits label_unit 0 0 14 a1u15 inc_counter player_unit_count 1 if I_BattlePlayerArmyNumberOfUnits label_unit 0 0 15 a1u16 inc_counter player_unit_count 1 if I_BattlePlayerArmyNumberOfUnits label_unit 0 0 16 a1u17 inc_counter player_unit_count 1 if I_BattlePlayerArmyNumberOfUnits label_unit 0 0 17 a1u18 inc_counter player_unit_count 1 if I_BattlePlayerArmyNumberOfUnits label_unit 0 0 18 a1u19 inc_counter player_unit_count 1 if I_BattlePlayerArmyNumberOfUnits label_unit 0 0 19 a1u20 inc_counter player_unit_count 1 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if ;;;Army 2 set_counter enemy_unit_count 0 if I_BattleEnemyArmyNumberOfUnits label_unit 1 0 0 a2u1 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 1 0 1 a2u2 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 1 0 2 a2u3 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 1 0 3 a2u4 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 1 0 4 a2u5

> 13 > 14 > 15 > 16 > 17 > 18 = 20

> 0 > 1 > 2 > 3 > 4

inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 1 0 5 a2u6 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 1 0 6 a2u7 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 1 0 7 a2u8 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 1 0 8 a2u9 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 1 0 9 a2u10 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 1 0 10 a2u11 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 1 0 11 a2u12 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 1 0 12 a2u13 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 1 0 13 a2u14 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 1 0 14 a2u15 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 1 0 15 a2u16 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 1 0 16 a2u17 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 1 0 17 a2u18 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 1 0 18 a2u19 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 1 0 19 a2u20 inc_counter enemy_unit_count 1 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if

> 5 > 6 > 7 > 8 > 9 > 10 > 11 > 12 > 13 > 14 > 15 > 16 > 17 > 18 = 20

end_if end_if end_if end_if end_if end_if if I_BattlePlayerArmyNumberOfUnits = 1 define_unit_group army1 a1u1 end_if if I_BattlePlayerArmyNumberOfUnits = 2 define_unit_group army1 a1u1 a1u2 end_if if I_BattlePlayerArmyNumberOfUnits = 3 define_unit_group army1 a1u1 a1u2 a1u3 end_if if I_BattlePlayerArmyNumberOfUnits = 4 define_unit_group army1 a1u1 a1u2 a1u3 a1u4 end_if if I_BattlePlayerArmyNumberOfUnits = 5 define_unit_group army1 a1u1 a1u2 a1u3 a1u4 end_if if I_BattlePlayerArmyNumberOfUnits = 6 define_unit_group army1 a1u1 a1u2 a1u3 a1u4 end_if if I_BattlePlayerArmyNumberOfUnits = 7 define_unit_group army1 a1u1 a1u2 a1u3 a1u4 end_if if I_BattlePlayerArmyNumberOfUnits = 8 define_unit_group army1 a1u1 a1u2 a1u3 a1u4 end_if if I_BattlePlayerArmyNumberOfUnits = 9 define_unit_group army1 a1u1 a1u2 a1u3 a1u4 end_if if I_BattlePlayerArmyNumberOfUnits = 10 define_unit_group army1 a1u1 a1u2 a1u3 a1u4 end_if if I_BattlePlayerArmyNumberOfUnits = 11 define_unit_group army1 a1u1 a1u2 a1u3 a1u4 1u11 end_if if I_BattlePlayerArmyNumberOfUnits = 12 define_unit_group army1 a1u1 a1u2 a1u3 a1u4 1u11 a1u12 end_if if I_BattlePlayerArmyNumberOfUnits = 13 define_unit_group army1 a1u1 a1u2 a1u3 a1u4 1u11 a1u12 a1u13 end_if if I_BattlePlayerArmyNumberOfUnits = 14 define_unit_group army1 a1u1 a1u2 a1u3 a1u4 1u11 a1u12 a1u13 a1u14 end_if if I_BattlePlayerArmyNumberOfUnits = 15 define_unit_group army1 a1u1 a1u2 a1u3 a1u4 1u11 a1u12 a1u13 a1u14 a1u15 end_if if I_BattlePlayerArmyNumberOfUnits = 16 define_unit_group army1 a1u1 a1u2 a1u3 a1u4 1u11 a1u12 a1u13 a1u14 a1u15 a1u16 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a

a1u5 a1u5 a1u6 a1u5 a1u6 a1u7 a1u5 a1u6 a1u7 a1u8 a1u5 a1u6 a1u7 a1u8 a1u9 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a

a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a

a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a

a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a

a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a

end_if if I_BattlePlayerArmyNumberOfUnits = 17 define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 1u11 a1u12 a1u13 a1u14 a1u15 a1u16 a1u17 end_if if I_BattlePlayerArmyNumberOfUnits = 18 define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 1u11 a1u12 a1u13 a1u14 a1u15 a1u16 a1u17 a1u18 end_if if I_BattlePlayerArmyNumberOfUnits = 19 define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 1u11 a1u12 a1u13 a1u14 a1u15 a1u16 a1u17 a1u18 a1u19 end_if if I_BattlePlayerArmyNumberOfUnits = 20 define_unit_group army1 a1u1 a1u2 a1u3 a1u4 a1u5 1u11 a1u12 a1u13 a1u14 a1u15 a1u16 a1u17 a1u18 a1u19 end_if if I_BattleEnemyArmyNumberOfUnits = 1 define_unit_group army2 a2u1 end_if if I_BattleEnemyArmyNumberOfUnits = 2 define_unit_group army2 a2u1 a2u2 end_if if I_BattleEnemyArmyNumberOfUnits = 3 define_unit_group army2 a2u1 a2u2 a2u3 end_if if I_BattleEnemyArmyNumberOfUnits = 4 define_unit_group army2 a2u1 a2u2 a2u3 a2u4 end_if if I_BattleEnemyArmyNumberOfUnits = 5 define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 end_if if I_BattleEnemyArmyNumberOfUnits = 6 define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 end_if if I_BattleEnemyArmyNumberOfUnits = 7 define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 end_if if I_BattleEnemyArmyNumberOfUnits = 8 define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 end_if if I_BattleEnemyArmyNumberOfUnits = 9 define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 end_if if I_BattleEnemyArmyNumberOfUnits = 10 define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 end_if if I_BattleEnemyArmyNumberOfUnits = 11 define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 2u11 end_if if I_BattleEnemyArmyNumberOfUnits = 12 define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 2u11 a2u12 end_if if I_BattleEnemyArmyNumberOfUnits = 13 define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 2u11 a2u12 a2u13 end_if if I_BattleEnemyArmyNumberOfUnits = 14

a1u6 a1u7 a1u8 a1u9 a1u10 a

a1u6 a1u7 a1u8 a1u9 a1u10 a

a1u6 a1u7 a1u8 a1u9 a1u10 a

a1u6 a1u7 a1u8 a1u9 a1u10 a a1u20

a2u6 a2u6 a2u7 a2u6 a2u7 a2u8 a2u6 a2u7 a2u8 a2u9 a2u6 a2u7 a2u8 a2u9 a2u10 a2u6 a2u7 a2u8 a2u9 a2u10 a

a2u6 a2u7 a2u8 a2u9 a2u10 a

a2u6 a2u7 a2u8 a2u9 a2u10 a

define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 2u11 a2u12 a2u13 a2u14 end_if if I_BattleEnemyArmyNumberOfUnits = 15 define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 2u11 a2u12 a2u13 a2u14 a2u15 end_if if I_BattleEnemyArmyNumberOfUnits = 16 define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 2u11 a2u12 a2u13 a2u14 a2u15 a2u16 end_if if I_BattleEnemyArmyNumberOfUnits = 17 define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 2u11 a2u12 a2u13 a2u14 a2u15 a2u16 a2u17 end_if if I_BattleEnemyArmyNumberOfUnits = 18 define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 2u11 a2u12 a2u13 a2u14 a2u15 a2u16 a2u17 a2u18 end_if if I_BattleEnemyArmyNumberOfUnits = 19 define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 2u11 a2u12 a2u13 a2u14 a2u15 a2u16 a2u17 a2u18 a2u19 end_if if I_BattleEnemyArmyNumberOfUnits = 20 define_unit_group army2 a2u1 a2u2 a2u3 a2u4 a2u5 2u11 a2u12 a2u13 a2u14 a2u15 a2u16 a2u17 a2u18 a2u19 end_if battle_wait 0.1 ai_active_set on

a2u6 a2u7 a2u8 a2u9 a2u10 a

a2u6 a2u7 a2u8 a2u9 a2u10 a

a2u6 a2u7 a2u8 a2u9 a2u10 a

a2u6 a2u7 a2u8 a2u9 a2u10 a

a2u6 a2u7 a2u8 a2u9 a2u10 a

a2u6 a2u7 a2u8 a2u9 a2u10 a

a2u6 a2u7 a2u8 a2u9 a2u10 a a2u20

if I_ConflictType Siege and ! I_BattlePlayerArmyIsAttacker and I_BattleEnemyArmyNumberOfSpecialAbility rally > 0 and I_BattleEnemyArmyNumberOfMountClass elephant = 0 and I_BattleEnemyArmyNumberOfUnits > 4 set_counter protect_general 1 end_if if ! I_BattleIsSiegeBattle and ! I_BattleIsSallyOutBattle and ! I_BattleIsRiverBattle and ! I_ConflictType SuccessfulAmbush set_counter open_battle 1 end_if if I_BattleEnemyArmyNumberOfAttribute stakes > 0 and I_CompareCounter g5_cbattle_difficulty_high = 1 and I_BattleIsSiegeBattle and I_CompareCounter fire_labels = 0 set_counter label_ready 1 end_if set_counter labels_only 1 if I_BattleIsSiegeBattle and I_BattlePlayerArmyIsAttacker set_counter ai_stuck_launch 1 end_if

if I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker and I_BattlePlayerArmyNumberOfAttribute stakes > 0 set_counter stakes_lock 1 end_if if I_CompareCounter fire_labels = 1 if I_CompareCounter open_battle = 1 and ! I_BattlePlayerArmyIsAttacker set_counter g_stop 1 end_if if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_BattleIsSiegeBattle set_counter elephant_fix 1 end_if if I_BattleEnemyArmyNumberOfAttribute stakes > 0 and I_CompareCounter g5_cbattle_difficulty_high = 1 and ! I_BattleIsSiegeBattle set_counter label_ready 1 end_if if I_BattlePlayerArmyIsAttacker and I_CompareCounter open_battle = 1 ai_gta_plan_set 1 DEFEND_FEATURE battle_wait 1 ai_active_set on set_counter ob_defense_launch 1 end_if end_if monitor_event BattleConflictPhaseCommenced FactionIsLocal set_counter script_delay 1 battle_wait 15 if I_CompareCounter script_delay = 1 if I_BattleStarted and I_CompareCounter fire_labels = 1 and I_CompareCounter open_battle = 1 set_counter ha_fix 1 end_if if I_BattleStarted and I_CompareCounter fire_labels = 1 and I_BattleIsRiverBattle and ! I_BattlePlayerArmyIsAttacker set_counter ha_fix 1 end_if end_if end_monitor ;;;;;;;;Stakes;;;;;;;;;;;; monitor_conditions I_BattleStarted and I_CompareCounter label_ready = 1 and I_BattlePlayerArmyIsAttacker and ! I_BattleAiAttacking

and and and and and

! I_ConflictType SuccessfulAmbush ! I_BattleIsSiegeBattle I_BattlePlayerArmyNumberOfUnitCategory cavalry > 0 I_BattleEnemyArmyNumberOfAttribute stakes > 0 I_UnitEnemyUnitInRadius a2u1 150

if I_CompareCounter enemy_unit_count > 0 if ! I_UnitDestroyed a2u1 and ! I_UnitStatus a2u1 left_battle and ! I_IsUnitRouting a2u1 and I_UnitEnemyUnitInRadius a2u1 60 and I_CompareCounter label_ready != 2 set_counter label_ready 2 end_if if I_CompareCounter enemy_unit_count > 1 if ! I_UnitDestroyed a2u2 and ! I_UnitStatus a2u2 left_battle and ! I_IsUnitRouting a2u2 and I_UnitEnemyUnitInRadius a2u2 60 and I_CompareCounter label_ready != 2 set_counter label_ready 2 end_if if I_CompareCounter enemy_unit_count > 2 if ! I_UnitDestroyed a2u3 and ! I_UnitStatus a2u3 left_battle and ! I_IsUnitRouting a2u3 and I_UnitEnemyUnitInRadius a2u3 60 and I_CompareCounter label_ready != 2 set_counter label_ready 2 end_if if I_CompareCounter enemy_unit_count > 3 if ! I_UnitDestroyed a2u4 and ! I_UnitStatus a2u4 left_battle and ! I_IsUnitRouting a2u4 and I_UnitEnemyUnitInRadius a2u4 60 and I_CompareCounter label_ready != 2 set_counter label_ready 2 end_if if I_CompareCounter enemy_unit_count > 4 if ! I_UnitDestroyed a2u5 and ! I_UnitStatus a2u5 left_battle and ! I_IsUnitRouting a2u5 and I_UnitEnemyUnitInRadius a2u5 60 and I_CompareCounter label_ready != 2 set_counter label_ready 2 end_if if I_CompareCounter enemy_unit_count > 5 if ! I_UnitDestroyed a2u6 and ! I_UnitStatus a2u6 left_battle and ! I_IsUnitRouting a2u6 and I_UnitEnemyUnitInRadius a2u6 60 and I_CompareCounter label_ready != 2 set_counter label_ready 2 end_if

if I_CompareCounter enemy_unit_count > 6 if ! I_UnitDestroyed a2u7 and ! I_UnitStatus a2u7 left_battle and ! I_IsUnitRouting a2u7 and I_UnitEnemyUnitInRadius a2u7 60 and I_CompareCounter label_ready != 2 set_counter label_ready 2 end_if if I_CompareCounter enemy_unit_count > 7 if ! I_UnitDestroyed a2u8 and ! I_UnitStatus a2u8 left_battle and ! I_IsUnitRouting a2u8 and I_UnitEnemyUnitInRadius a2u8 60 and I_CompareCounter label_ready != 2 set_counter label_ready 2 end_if if I_CompareCounter enemy_unit_count > 8 if ! I_UnitDestroyed a2u9 and ! I_UnitStatus a2u9 left_battle and ! I_IsUnitRouting a2u9 and I_UnitEnemyUnitInRadius a2u9 60 and I_CompareCounter label_ready != 2 set_counter label_ready 2 end_if if I_CompareCounter enemy_unit_count > 9 if ! I_UnitDestroyed a2u10 and ! I_UnitStatus a2u10 left_battle and ! I_IsUnitRouting a2u10 and I_UnitEnemyUnitInRadius a2u10 60 and I_CompareCounter label_ready != 2 set_counter label_ready 2 end_if if I_CompareCounter enemy_unit_count > 10 if ! I_UnitDestroyed a2u11 and ! I_UnitStatus a2u11 left_battle and ! I_IsUnitRouting a2u11 and I_UnitEnemyUnitInRadius a2u11 60 and I_CompareCounter label_ready != 2 set_counter label_ready 2 end_if if I_CompareCounter enemy_unit_count > 11 if ! I_UnitDestroyed a2u12 and ! I_UnitStatus a2u12 left_battle and ! I_IsUnitRouting a2u12 and I_UnitEnemyUnitInRadius a2u12 60 and I_CompareCounter label_ready != 2 set_counter label_ready 2 end_if if I_CompareCounter enemy_unit_count > 12 if ! I_UnitDestroyed a2u13 and ! I_UnitStatus a2u13 left_battle and ! I_IsUnitRouting a2u13 and I_UnitEnemyUnitInRadius a2u13 60 and I_CompareCounter label_ready != 2

set_counter label_ready 2 end_if if I_CompareCounter enemy_unit_count > 13 if ! I_UnitDestroyed a2u14 and ! I_UnitStatus a2u14 left_battle and ! I_IsUnitRouting a2u14 and I_UnitEnemyUnitInRadius a2u14 60 and I_CompareCounter label_ready != 2 set_counter label_ready 2 end_if if I_CompareCounter enemy_unit_count > 14 if ! I_UnitDestroyed a2u15 and ! I_UnitStatus a2u15 left_battle and ! I_IsUnitRouting a2u15 and I_UnitEnemyUnitInRadius a2u15 60 and I_CompareCounter label_ready != 2 set_counter label_ready 2 end_if if I_CompareCounter enemy_unit_count > 15 if ! I_UnitDestroyed a2u16 and ! I_UnitStatus a2u16 left_battle and ! I_IsUnitRouting a2u16 and I_UnitEnemyUnitInRadius a2u16 60 and I_CompareCounter label_ready != 2 set_counter label_ready 2 end_if if I_CompareCounter enemy_unit_count > 16 if ! I_UnitDestroyed a2u17 and ! I_UnitStatus a2u17 left_battle and ! I_IsUnitRouting a2u17 and I_UnitEnemyUnitInRadius a2u17 60 and I_CompareCounter label_ready != 2 set_counter label_ready 2 end_if if I_CompareCounter enemy_unit_count > 17 if ! I_UnitDestroyed a2u18 and ! I_UnitStatus a2u18 left_battle and ! I_IsUnitRouting a2u18 and I_UnitEnemyUnitInRadius a2u18 60 and I_CompareCounter label_ready != 2 set_counter label_ready 2 end_if if I_CompareCounter enemy_unit_count > 18 if ! I_UnitDestroyed a2u19 and ! I_UnitStatus a2u19 left_battle and ! I_IsUnitRouting a2u19 and I_UnitEnemyUnitInRadius a2u19 60 and I_CompareCounter label_ready != 2 set_counter label_ready 2 end_if if I_CompareCounter enemy_unit_count = 20 if ! I_UnitDestroyed a2u20 and ! I_UnitStatus a2u20 left_battle

and ! I_IsUnitRouting a2u20 and I_UnitEnemyUnitInRadius a2u20 60 and I_CompareCounter label_ready != 2 set_counter label_ready 2 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if if I_CompareCounter label_ready = 2 ; ai_active_set off unit_group_order_halt army2 if I_CompareCounter enemy_unit_count > 0 if ! I_UnitDestroyed a2u1 and ! I_UnitStatus a2u1 left_battle and ! I_IsUnitRouting a2u1 unit_deploy_stakes a2u1 end_if if I_CompareCounter enemy_unit_count > 1 if ! I_UnitDestroyed a2u2 and ! I_UnitStatus a2u2 left_battle and ! I_IsUnitRouting a2u2 unit_deploy_stakes a2u2 end_if if I_CompareCounter enemy_unit_count > 2 if ! I_UnitDestroyed a2u3 and ! I_UnitStatus a2u3 left_battle and ! I_IsUnitRouting a2u3 unit_deploy_stakes a2u3 end_if if I_CompareCounter enemy_unit_count > 3 if ! I_UnitDestroyed a2u4 and ! I_UnitStatus a2u4 left_battle and ! I_IsUnitRouting a2u4 unit_deploy_stakes a2u4 end_if if I_CompareCounter enemy_unit_count > 4 if ! I_UnitDestroyed a2u5

and ! I_UnitStatus a2u5 left_battle and ! I_IsUnitRouting a2u5 unit_deploy_stakes a2u5 end_if if I_CompareCounter enemy_unit_count > 5 if ! I_UnitDestroyed a2u6 and ! I_UnitStatus a2u6 left_battle and ! I_IsUnitRouting a2u6 unit_deploy_stakes a2u6 end_if if I_CompareCounter enemy_unit_count > 6 if ! I_UnitDestroyed a2u7 and ! I_UnitStatus a2u7 left_battle and ! I_IsUnitRouting a2u7 unit_deploy_stakes a2u7 end_if if I_CompareCounter enemy_unit_count > 7 if ! I_UnitDestroyed a2u8 and ! I_UnitStatus a2u8 left_battle and ! I_IsUnitRouting a2u8 unit_deploy_stakes a2u8 end_if if I_CompareCounter enemy_unit_count > 8 if ! I_UnitDestroyed a2u9 and ! I_UnitStatus a2u9 left_battle and ! I_IsUnitRouting a2u9 unit_deploy_stakes a2u9 end_if if I_CompareCounter enemy_unit_count > 9 if ! I_UnitDestroyed a2u10 and ! I_UnitStatus a2u10 left_battle and ! I_IsUnitRouting a2u10 unit_deploy_stakes a2u10 end_if if I_CompareCounter enemy_unit_count > 10 if ! I_UnitDestroyed a2u11 and ! I_UnitStatus a2u11 left_battle and ! I_IsUnitRouting a2u11 unit_deploy_stakes a2u11 end_if if I_CompareCounter enemy_unit_count > 11 if ! I_UnitDestroyed a2u12 and ! I_UnitStatus a2u12 left_battle and ! I_IsUnitRouting a2u12 unit_deploy_stakes a2u12 end_if if I_CompareCounter enemy_unit_count > 12 if ! I_UnitDestroyed a2u13 and ! I_UnitStatus a2u13 left_battle and ! I_IsUnitRouting a2u13 unit_deploy_stakes a2u13 end_if

if I_CompareCounter enemy_unit_count > 13 if ! I_UnitDestroyed a2u14 and ! I_UnitStatus a2u14 left_battle and ! I_IsUnitRouting a2u14 unit_deploy_stakes a2u14 end_if if I_CompareCounter enemy_unit_count > 14 if ! I_UnitDestroyed a2u15 and ! I_UnitStatus a2u15 left_battle and ! I_IsUnitRouting a2u15 unit_deploy_stakes a2u15 end_if if I_CompareCounter enemy_unit_count > 15 if ! I_UnitDestroyed a2u16 and ! I_UnitStatus a2u16 left_battle and ! I_IsUnitRouting a2u16 unit_deploy_stakes a2u16 end_if if I_CompareCounter enemy_unit_count > 16 if ! I_UnitDestroyed a2u17 and ! I_UnitStatus a2u17 left_battle and ! I_IsUnitRouting a2u17 unit_deploy_stakes a2u17 end_if if I_CompareCounter enemy_unit_count > 17 if ! I_UnitDestroyed a2u18 and ! I_UnitStatus a2u18 left_battle and ! I_IsUnitRouting a2u18 unit_deploy_stakes a2u18 end_if if I_CompareCounter enemy_unit_count > 18 if ! I_UnitDestroyed a2u19 and ! I_UnitStatus a2u19 left_battle and ! I_IsUnitRouting a2u19 unit_deploy_stakes a2u19 end_if if I_CompareCounter enemy_unit_count = 20 if ! I_UnitDestroyed a2u20 and ! I_UnitStatus a2u20 left_battle and ! I_IsUnitRouting a2u20 unit_deploy_stakes a2u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if

end_if end_if end_if end_if end_if end_if end_if end_if end_if battle_wait 0.5 ai_active_set on set_counter label_ready 0 end_if battle_wait 1.5 end_monitor monitor_event BattleConflictPhaseCommenced FactionIsLocal and I_CompareCounter label_ready = 1 and I_BattlePlayerArmyIsAttacker and I_BattleIsSiegeBattle and I_BattlePlayerArmyNumberOfUnitCategory cavalry > 0 and I_BattleEnemyArmyNumberOfUnitCategory cavalry = 0 and I_BattleEnemyArmyNumberOfAttribute stakes > 0 if I_CompareCounter enemy_unit_count > 0 unit_deploy_stakes a2u1 if I_CompareCounter enemy_unit_count > 1 unit_deploy_stakes a2u2 if I_CompareCounter enemy_unit_count > 2 unit_deploy_stakes a2u3 if I_CompareCounter enemy_unit_count > 3 unit_deploy_stakes a2u4 if I_CompareCounter enemy_unit_count > 4 unit_deploy_stakes a2u5 if I_CompareCounter enemy_unit_count > 5 unit_deploy_stakes a2u6 if I_CompareCounter enemy_unit_count > 6 unit_deploy_stakes a2u7 if I_CompareCounter enemy_unit_count > 7 unit_deploy_stakes a2u8 if I_CompareCounter enemy_unit_count > 8 unit_deploy_stakes a2u9 if I_CompareCounter enemy_unit_count > 9 unit_deploy_stakes a2u10 if I_CompareCounter enemy_unit_count > 10 unit_deploy_stakes a2u11 if I_CompareCounter enemy_unit_count > 11 unit_deploy_stakes a2u12

if I_CompareCounter enemy_unit_count > 12 unit_deploy_stakes a2u13 if I_CompareCounter enemy_unit_count > 13 unit_deploy_stakes a2u14 if I_CompareCounter enemy_unit_count > 14 unit_deploy_stakes a2u15 if I_CompareCounter enemy_unit_count > 15 unit_deploy_stakes a2u16 if I_CompareCounter enemy_unit_count > 16 unit_deploy_stakes a2u17 if I_CompareCounter enemy_unit_count > 17 unit_deploy_stakes a2u18 if I_CompareCounter enemy_unit_count > 18 unit_deploy_stakes a2u19 if I_CompareCounter enemy_unit_count = 20 unit_deploy_stakes a2u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if battle_wait 0.1 ai_active_set on set_counter label_ready 0 end_monitor ;;;;;;;;HA fix;;;;;;;;;;;; ;monitor_conditions I_BattleStarted ; and I_CompareCounter ha_fix = 1 ; and I_CompareCounter open_battle = 1 ; and I_BattlePlayerArmyIsAttacker ; and ! I_BattleAiAttacking ; and I_BattleEnemyArmyPercentageOfUnitCategory cavalry > 60 ; and I_UnitEnemyUnitInRadius a2u1 250 ;; ai_gta_plan_set 1 ATTACK_ALL

; set_counter ha_fix 0 ;end_monitor monitor_conditions I_BattleStarted and I_CompareCounter ha_fix = 1 and I_CompareCounter open_battle = 1 and ! I_BattlePlayerArmyIsAttacker and ! I_BattleAiAttacking ; and I_BattleEnemyArmyPercentageOfUnitCategory cavalry > 60 ai_gta_plan_set 1 ATTACK_ALL set_counter ha_fix 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter ha_fix = 1 and I_BattleIsRiverBattle and ! I_BattlePlayerArmyIsAttacker and ! I_BattleAiAssaultingCrossing ai_gta_add_objective 1 ASSAULT_CROSSING 999 ;ai_active_set off if I_CompareCounter enemy_unit_count > 0 ai_gta_add_unit_label 1 0 a2u1 if I_CompareCounter enemy_unit_count > 1 ai_gta_add_unit_label 1 0 a2u2 if I_CompareCounter enemy_unit_count > 2 ai_gta_add_unit_label 1 0 a2u3 if I_CompareCounter enemy_unit_count > 3 ai_gta_add_unit_label 1 0 a2u4 if I_CompareCounter enemy_unit_count > 4 ai_gta_add_unit_label 1 0 a2u5 if I_CompareCounter enemy_unit_count > 5 ai_gta_add_unit_label 1 0 a2u6 if I_CompareCounter enemy_unit_count > 6 ai_gta_add_unit_label 1 0 a2u7 if I_CompareCounter enemy_unit_count > 7 ai_gta_add_unit_label 1 0 a2u8 if I_CompareCounter enemy_unit_count > 8 ai_gta_add_unit_label 1 0 a2u9 if I_CompareCounter enemy_unit_count > 9 ai_gta_add_unit_label 1 0 a2u10 if I_CompareCounter enemy_unit_count > 10 ai_gta_add_unit_label 1 0 a2u11 if I_CompareCounter enemy_unit_count > 11 ai_gta_add_unit_label 1 0 a2u12

if I_CompareCounter enemy_unit_count > 12 ai_gta_add_unit_label 1 0 a2u13 if I_CompareCounter enemy_unit_count > 13 ai_gta_add_unit_label 1 0 a2u14 if I_CompareCounter enemy_unit_count > 14 ai_gta_add_unit_label 1 0 a2u15 if I_CompareCounter enemy_unit_count > 15 ai_gta_add_unit_label 1 0 a2u16 if I_CompareCounter enemy_unit_count > 16 ai_gta_add_unit_label 1 0 a2u17 if I_CompareCounter enemy_unit_count > 17 ai_gta_add_unit_label 1 0 a2u18 if I_CompareCounter enemy_unit_count > 18 ai_gta_add_unit_label 1 0 a2u19 if I_CompareCounter enemy_unit_count = 20 ai_gta_add_unit_label 1 0 a2u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if battle_wait 0.5 ai_active_set on set_counter ha_fix 0 end_monitor ;;;;;;;;Siege;;;;;;;;;;;; monitor_conditions I_BattleStarted and I_CompareCounter elephant_fix = 1 and I_BattleIsSiegeBattle and ! I_BattleIsFortBattle and ! I_BattlePlayerArmyIsAttacker and I_IsBattleSettlementCastle and I_BattleEnemyArmyNumberOfMountClass elephant > 0

ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999 if I_CompareCounter enemy_unit_count > 0 if I_UnitFormation a2u1 = horde and ! I_UnitStatus a2u1 running_amok and ! I_UnitDestroyed a2u1 and ! I_UnitStatus a2u1 left_battle and ! I_IsUnitRouting a2u1 ai_gta_add_unit_label 1 0 a2u1 end_if if I_CompareCounter enemy_unit_count > 1 if I_UnitFormation a2u2 = horde and ! I_UnitStatus a2u2 running_amok and ! I_UnitDestroyed a2u2 and ! I_UnitStatus a2u2 left_battle and ! I_IsUnitRouting a2u2 ai_gta_add_unit_label 1 0 a2u2 end_if if I_CompareCounter enemy_unit_count > 2 if I_UnitFormation a2u3 = horde and ! I_UnitStatus a2u3 running_amok and ! I_UnitDestroyed a2u3 and ! I_UnitStatus a2u3 left_battle and ! I_IsUnitRouting a2u3 ai_gta_add_unit_label 1 0 a2u3 end_if if I_CompareCounter enemy_unit_count > 3 if I_UnitFormation a2u4 = horde and ! I_UnitStatus a2u4 running_amok and ! I_UnitDestroyed a2u4 and ! I_UnitStatus a2u4 left_battle and ! I_IsUnitRouting a2u4 ai_gta_add_unit_label 1 0 a2u4 end_if if I_CompareCounter enemy_unit_count > 4 if I_UnitFormation a2u5 = horde and ! I_UnitStatus a2u5 running_amok and ! I_UnitDestroyed a2u5 and ! I_UnitStatus a2u5 left_battle and ! I_IsUnitRouting a2u5 ai_gta_add_unit_label 1 0 a2u5 end_if if I_CompareCounter enemy_unit_count > 5 if I_UnitFormation a2u6 = horde and ! I_UnitStatus a2u6 running_amok and ! I_UnitDestroyed a2u6 and ! I_UnitStatus a2u6 left_battle and ! I_IsUnitRouting a2u6 ai_gta_add_unit_label 1 0 a2u6 end_if if I_CompareCounter enemy_unit_count > 6 if I_UnitFormation a2u7 = horde and ! I_UnitStatus a2u7 running_amok and ! I_UnitDestroyed a2u7

and ! I_UnitStatus a2u7 left_battle and ! I_IsUnitRouting a2u7 ai_gta_add_unit_label 1 0 a2u7 end_if if I_CompareCounter enemy_unit_count > 7 if I_UnitFormation a2u8 = horde and ! I_UnitStatus a2u8 running_amok and ! I_UnitDestroyed a2u8 and ! I_UnitStatus a2u8 left_battle and ! I_IsUnitRouting a2u8 ai_gta_add_unit_label 1 0 a2u8 end_if if I_CompareCounter enemy_unit_count > 8 if I_UnitFormation a2u9 = horde and ! I_UnitStatus a2u9 running_amok and ! I_UnitDestroyed a2u9 and ! I_UnitStatus a2u9 left_battle and ! I_IsUnitRouting a2u9 ai_gta_add_unit_label 1 0 a2u9 end_if if I_CompareCounter enemy_unit_count > 9 if I_UnitFormation a2u10 = horde and ! I_UnitStatus a2u10 running_amok and ! I_UnitDestroyed a2u10 and ! I_UnitStatus a2u10 left_battle and ! I_IsUnitRouting a2u10 ai_gta_add_unit_label 1 0 a2u10 end_if if I_CompareCounter enemy_unit_count > 10 if I_UnitFormation a2u11 = horde and ! I_UnitStatus a2u11 running_amok and ! I_UnitDestroyed a2u11 and ! I_UnitStatus a2u11 left_battle and ! I_IsUnitRouting a2u11 ai_gta_add_unit_label 1 0 a2u11 end_if if I_CompareCounter enemy_unit_count > 11 if I_UnitFormation a2u12 = horde and ! I_UnitStatus a2u12 running_amok and ! I_UnitDestroyed a2u12 and ! I_UnitStatus a2u12 left_battle and ! I_IsUnitRouting a2u12 ai_gta_add_unit_label 1 0 a2u12 end_if if I_CompareCounter enemy_unit_count > 12 if I_UnitFormation a2u13 = horde and ! I_UnitStatus a2u13 running_amok and ! I_UnitDestroyed a2u13 and ! I_UnitStatus a2u13 left_battle and ! I_IsUnitRouting a2u13 ai_gta_add_unit_label 1 0 a2u13 end_if if I_CompareCounter enemy_unit_count > 13

if I_UnitFormation a2u14 = horde and ! I_UnitStatus a2u14 running_amok and ! I_UnitDestroyed a2u14 and ! I_UnitStatus a2u14 left_battle and ! I_IsUnitRouting a2u14 ai_gta_add_unit_label 1 0 a2u14 end_if if I_CompareCounter enemy_unit_count > 14 if I_UnitFormation a2u15 = horde and ! I_UnitStatus a2u15 running_amok and ! I_UnitDestroyed a2u15 and ! I_UnitStatus a2u15 left_battle and ! I_IsUnitRouting a2u15 ai_gta_add_unit_label 1 0 a2u15 end_if if I_CompareCounter enemy_unit_count > 15 if I_UnitFormation a2u16 = horde and ! I_UnitStatus a2u16 running_amok and ! I_UnitDestroyed a2u16 and ! I_UnitStatus a2u16 left_battle and ! I_IsUnitRouting a2u16 ai_gta_add_unit_label 1 0 a2u16 end_if if I_CompareCounter enemy_unit_count > 16 if I_UnitFormation a2u17 = horde and ! I_UnitStatus a2u17 running_amok and ! I_UnitDestroyed a2u17 and ! I_UnitStatus a2u17 left_battle and ! I_IsUnitRouting a2u17 ai_gta_add_unit_label 1 0 a2u17 end_if if I_CompareCounter enemy_unit_count > 17 if I_UnitFormation a2u18 = horde and ! I_UnitStatus a2u18 running_amok and ! I_UnitDestroyed a2u18 and ! I_UnitStatus a2u18 left_battle and ! I_IsUnitRouting a2u18 ai_gta_add_unit_label 1 0 a2u18 end_if if I_CompareCounter enemy_unit_count > 18 if I_UnitFormation a2u19 = horde and ! I_UnitStatus a2u19 running_amok and ! I_UnitDestroyed a2u19 and ! I_UnitStatus a2u19 left_battle and ! I_IsUnitRouting a2u19 ai_gta_add_unit_label 1 0 a2u19 end_if if I_CompareCounter enemy_unit_count = 20 if I_UnitFormation a2u20 = horde and ! I_UnitStatus a2u20 running_amok and ! I_UnitDestroyed a2u20 and ! I_UnitStatus a2u20 left_battle and ! I_IsUnitRouting a2u20 ai_gta_add_unit_label 1 0 a2u20

end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if ai_active_set on set_counter elephant_gate 1 set_counter elephant_fix 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter elephant_fix = 1 and I_BattleIsSiegeBattle and ! I_BattleIsFortBattle and ! I_BattlePlayerArmyIsAttacker and ! I_IsBattleSettlementCastle and I_BattleEnemyArmyNumberOfMountClass elephant > 0 ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999 if I_CompareCounter enemy_unit_count > 0 if I_UnitFormation a2u1 = horde and ! I_UnitStatus a2u1 running_amok and ! I_UnitDestroyed a2u1 and ! I_UnitStatus a2u1 left_battle and ! I_IsUnitRouting a2u1 ai_gta_add_unit_label 1 0 a2u1 end_if if I_CompareCounter enemy_unit_count > 1 if I_UnitFormation a2u2 = horde and ! I_UnitStatus a2u2 running_amok and ! I_UnitDestroyed a2u2 and ! I_UnitStatus a2u2 left_battle and ! I_IsUnitRouting a2u2 ai_gta_add_unit_label 1 0 a2u2 end_if if I_CompareCounter enemy_unit_count > 2 if I_UnitFormation a2u3 = horde and ! I_UnitStatus a2u3 running_amok and ! I_UnitDestroyed a2u3 and ! I_UnitStatus a2u3 left_battle

and ! I_IsUnitRouting a2u3 ai_gta_add_unit_label 1 0 a2u3 end_if if I_CompareCounter enemy_unit_count > 3 if I_UnitFormation a2u4 = horde and ! I_UnitStatus a2u4 running_amok and ! I_UnitDestroyed a2u4 and ! I_UnitStatus a2u4 left_battle and ! I_IsUnitRouting a2u4 ai_gta_add_unit_label 1 0 a2u4 end_if if I_CompareCounter enemy_unit_count > 4 if I_UnitFormation a2u5 = horde and ! I_UnitStatus a2u5 running_amok and ! I_UnitDestroyed a2u5 and ! I_UnitStatus a2u5 left_battle and ! I_IsUnitRouting a2u5 ai_gta_add_unit_label 1 0 a2u5 end_if if I_CompareCounter enemy_unit_count > 5 if I_UnitFormation a2u6 = horde and ! I_UnitStatus a2u6 running_amok and ! I_UnitDestroyed a2u6 and ! I_UnitStatus a2u6 left_battle and ! I_IsUnitRouting a2u6 ai_gta_add_unit_label 1 0 a2u6 end_if if I_CompareCounter enemy_unit_count > 6 if I_UnitFormation a2u7 = horde and ! I_UnitStatus a2u7 running_amok and ! I_UnitDestroyed a2u7 and ! I_UnitStatus a2u7 left_battle and ! I_IsUnitRouting a2u7 ai_gta_add_unit_label 1 0 a2u7 end_if if I_CompareCounter enemy_unit_count > 7 if I_UnitFormation a2u8 = horde and ! I_UnitStatus a2u8 running_amok and ! I_UnitDestroyed a2u8 and ! I_UnitStatus a2u8 left_battle and ! I_IsUnitRouting a2u8 ai_gta_add_unit_label 1 0 a2u8 end_if if I_CompareCounter enemy_unit_count > 8 if I_UnitFormation a2u9 = horde and ! I_UnitStatus a2u9 running_amok and ! I_UnitDestroyed a2u9 and ! I_UnitStatus a2u9 left_battle and ! I_IsUnitRouting a2u9 ai_gta_add_unit_label 1 0 a2u9 end_if if I_CompareCounter enemy_unit_count > 9 if I_UnitFormation a2u10 = horde

and ! I_UnitStatus a2u10 running_amok and ! I_UnitDestroyed a2u10 and ! I_UnitStatus a2u10 left_battle and ! I_IsUnitRouting a2u10 ai_gta_add_unit_label 1 0 a2u10 end_if if I_CompareCounter enemy_unit_count > 10 if I_UnitFormation a2u11 = horde and ! I_UnitStatus a2u11 running_amok and ! I_UnitDestroyed a2u11 and ! I_UnitStatus a2u11 left_battle and ! I_IsUnitRouting a2u11 ai_gta_add_unit_label 1 0 a2u11 end_if if I_CompareCounter enemy_unit_count > 11 if I_UnitFormation a2u12 = horde and ! I_UnitStatus a2u12 running_amok and ! I_UnitDestroyed a2u12 and ! I_UnitStatus a2u12 left_battle and ! I_IsUnitRouting a2u12 ai_gta_add_unit_label 1 0 a2u12 end_if if I_CompareCounter enemy_unit_count > 12 if I_UnitFormation a2u13 = horde and ! I_UnitStatus a2u13 running_amok and ! I_UnitDestroyed a2u13 and ! I_UnitStatus a2u13 left_battle and ! I_IsUnitRouting a2u13 ai_gta_add_unit_label 1 0 a2u13 end_if if I_CompareCounter enemy_unit_count > 13 if I_UnitFormation a2u14 = horde and ! I_UnitStatus a2u14 running_amok and ! I_UnitDestroyed a2u14 and ! I_UnitStatus a2u14 left_battle and ! I_IsUnitRouting a2u14 ai_gta_add_unit_label 1 0 a2u14 end_if if I_CompareCounter enemy_unit_count > 14 if I_UnitFormation a2u15 = horde and ! I_UnitStatus a2u15 running_amok and ! I_UnitDestroyed a2u15 and ! I_UnitStatus a2u15 left_battle and ! I_IsUnitRouting a2u15 ai_gta_add_unit_label 1 0 a2u15 end_if if I_CompareCounter enemy_unit_count > 15 if I_UnitFormation a2u16 = horde and ! I_UnitStatus a2u16 running_amok and ! I_UnitDestroyed a2u16 and ! I_UnitStatus a2u16 left_battle and ! I_IsUnitRouting a2u16 ai_gta_add_unit_label 1 0 a2u16 end_if

if I_CompareCounter enemy_unit_count > 16 if I_UnitFormation a2u17 = horde and ! I_UnitStatus a2u17 running_amok and ! I_UnitDestroyed a2u17 and ! I_UnitStatus a2u17 left_battle and ! I_IsUnitRouting a2u17 ai_gta_add_unit_label 1 0 a2u17 end_if if I_CompareCounter enemy_unit_count > 17 if I_UnitFormation a2u18 = horde and ! I_UnitStatus a2u18 running_amok and ! I_UnitDestroyed a2u18 and ! I_UnitStatus a2u18 left_battle and ! I_IsUnitRouting a2u18 ai_gta_add_unit_label 1 0 a2u18 end_if if I_CompareCounter enemy_unit_count > 18 if I_UnitFormation a2u19 = horde and ! I_UnitStatus a2u19 running_amok and ! I_UnitDestroyed a2u19 and ! I_UnitStatus a2u19 left_battle and ! I_IsUnitRouting a2u19 ai_gta_add_unit_label 1 0 a2u19 end_if if I_CompareCounter enemy_unit_count = 20 if I_UnitFormation a2u20 = horde and ! I_UnitStatus a2u20 running_amok and ! I_UnitDestroyed a2u20 and ! I_UnitStatus a2u20 left_battle and ! I_IsUnitRouting a2u20 ai_gta_add_unit_label 1 0 a2u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if unit_group_order_halt army2 battle_wait 0.5 unit_group_order_change_group_formation army2 ai_wall_assault

battle_wait 0.5 ai_active_set on set_counter elephant_gate 1 set_counter elephant_fix 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter elephant_fix = 1 and I_BattleIsSiegeBattle and I_BattleIsFortBattle and ! I_BattlePlayerArmyIsAttacker and I_BattleEnemyArmyNumberOfMountClass elephant > 0 ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999 if I_CompareCounter enemy_unit_count > 0 if I_UnitFormation a2u1 = horde and ! I_UnitStatus a2u1 running_amok and ! I_UnitDestroyed a2u1 and ! I_UnitStatus a2u1 left_battle and ! I_IsUnitRouting a2u1 ai_gta_add_unit_label 1 0 a2u1 end_if if I_CompareCounter enemy_unit_count > 1 if I_UnitFormation a2u2 = horde and ! I_UnitStatus a2u2 running_amok and ! I_UnitDestroyed a2u2 and ! I_UnitStatus a2u2 left_battle and ! I_IsUnitRouting a2u2 ai_gta_add_unit_label 1 0 a2u2 end_if if I_CompareCounter enemy_unit_count > 2 if I_UnitFormation a2u3 = horde and ! I_UnitStatus a2u3 running_amok and ! I_UnitDestroyed a2u3 and ! I_UnitStatus a2u3 left_battle and ! I_IsUnitRouting a2u3 ai_gta_add_unit_label 1 0 a2u3 end_if if I_CompareCounter enemy_unit_count > 3 if I_UnitFormation a2u4 = horde and ! I_UnitStatus a2u4 running_amok and ! I_UnitDestroyed a2u4 and ! I_UnitStatus a2u4 left_battle and ! I_IsUnitRouting a2u4 ai_gta_add_unit_label 1 0 a2u4 end_if if I_CompareCounter enemy_unit_count > 4 if I_UnitFormation a2u5 = horde and ! I_UnitStatus a2u5 running_amok and ! I_UnitDestroyed a2u5 and ! I_UnitStatus a2u5 left_battle and ! I_IsUnitRouting a2u5 ai_gta_add_unit_label 1 0 a2u5 end_if

if I_CompareCounter enemy_unit_count > 5 if I_UnitFormation a2u6 = horde and ! I_UnitStatus a2u6 running_amok and ! I_UnitDestroyed a2u6 and ! I_UnitStatus a2u6 left_battle and ! I_IsUnitRouting a2u6 ai_gta_add_unit_label 1 0 a2u6 end_if if I_CompareCounter enemy_unit_count > 6 if I_UnitFormation a2u7 = horde and ! I_UnitStatus a2u7 running_amok and ! I_UnitDestroyed a2u7 and ! I_UnitStatus a2u7 left_battle and ! I_IsUnitRouting a2u7 ai_gta_add_unit_label 1 0 a2u7 end_if if I_CompareCounter enemy_unit_count > 7 if I_UnitFormation a2u8 = horde and ! I_UnitStatus a2u8 running_amok and ! I_UnitDestroyed a2u8 and ! I_UnitStatus a2u8 left_battle and ! I_IsUnitRouting a2u8 ai_gta_add_unit_label 1 0 a2u8 end_if if I_CompareCounter enemy_unit_count > 8 if I_UnitFormation a2u9 = horde and ! I_UnitStatus a2u9 running_amok and ! I_UnitDestroyed a2u9 and ! I_UnitStatus a2u9 left_battle and ! I_IsUnitRouting a2u9 ai_gta_add_unit_label 1 0 a2u9 end_if if I_CompareCounter enemy_unit_count > 9 if I_UnitFormation a2u10 = horde and ! I_UnitStatus a2u10 running_amok and ! I_UnitDestroyed a2u10 and ! I_UnitStatus a2u10 left_battle and ! I_IsUnitRouting a2u10 ai_gta_add_unit_label 1 0 a2u10 end_if if I_CompareCounter enemy_unit_count > 10 if I_UnitFormation a2u11 = horde and ! I_UnitStatus a2u11 running_amok and ! I_UnitDestroyed a2u11 and ! I_UnitStatus a2u11 left_battle and ! I_IsUnitRouting a2u11 ai_gta_add_unit_label 1 0 a2u11 end_if if I_CompareCounter enemy_unit_count > 11 if I_UnitFormation a2u12 = horde and ! I_UnitStatus a2u12 running_amok and ! I_UnitDestroyed a2u12 and ! I_UnitStatus a2u12 left_battle and ! I_IsUnitRouting a2u12

ai_gta_add_unit_label 1 0 a2u12 end_if if I_CompareCounter enemy_unit_count > 12 if I_UnitFormation a2u13 = horde and ! I_UnitStatus a2u13 running_amok and ! I_UnitDestroyed a2u13 and ! I_UnitStatus a2u13 left_battle and ! I_IsUnitRouting a2u13 ai_gta_add_unit_label 1 0 a2u13 end_if if I_CompareCounter enemy_unit_count > 13 if I_UnitFormation a2u14 = horde and ! I_UnitStatus a2u14 running_amok and ! I_UnitDestroyed a2u14 and ! I_UnitStatus a2u14 left_battle and ! I_IsUnitRouting a2u14 ai_gta_add_unit_label 1 0 a2u14 end_if if I_CompareCounter enemy_unit_count > 14 if I_UnitFormation a2u15 = horde and ! I_UnitStatus a2u15 running_amok and ! I_UnitDestroyed a2u15 and ! I_UnitStatus a2u15 left_battle and ! I_IsUnitRouting a2u15 ai_gta_add_unit_label 1 0 a2u15 end_if if I_CompareCounter enemy_unit_count > 15 if I_UnitFormation a2u16 = horde and ! I_UnitStatus a2u16 running_amok and ! I_UnitDestroyed a2u16 and ! I_UnitStatus a2u16 left_battle and ! I_IsUnitRouting a2u16 ai_gta_add_unit_label 1 0 a2u16 end_if if I_CompareCounter enemy_unit_count > 16 if I_UnitFormation a2u17 = horde and ! I_UnitStatus a2u17 running_amok and ! I_UnitDestroyed a2u17 and ! I_UnitStatus a2u17 left_battle and ! I_IsUnitRouting a2u17 ai_gta_add_unit_label 1 0 a2u17 end_if if I_CompareCounter enemy_unit_count > 17 if I_UnitFormation a2u18 = horde and ! I_UnitStatus a2u18 running_amok and ! I_UnitDestroyed a2u18 and ! I_UnitStatus a2u18 left_battle and ! I_IsUnitRouting a2u18 ai_gta_add_unit_label 1 0 a2u18 end_if if I_CompareCounter enemy_unit_count > 18 if I_UnitFormation a2u19 = horde and ! I_UnitStatus a2u19 running_amok

and ! I_UnitDestroyed a2u19 and ! I_UnitStatus a2u19 left_battle and ! I_IsUnitRouting a2u19 ai_gta_add_unit_label 1 0 a2u19 end_if if I_CompareCounter enemy_unit_count = 20 if I_UnitFormation a2u20 = horde and ! I_UnitStatus a2u20 running_amok and ! I_UnitDestroyed a2u20 and ! I_UnitStatus a2u20 left_battle and ! I_IsUnitRouting a2u20 ai_gta_add_unit_label 1 0 a2u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if ai_active_set on set_counter elephant_gate 1 set_counter elephant_fix 0 end_monitor monitor_event BattleBattleGatesDestroyedByEngine TrueCondition and I_CompareCounter elephant_gate = 1 and I_BattleIsSiegeBattle 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_BattleIsSiegeBattle 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_BattleIsSiegeBattle 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 and ! BattlePlayerUnitOnWalls and ! BattleEnemyUnitOnWalls if I_CompareCounter elephant_gate != 2 set_counter elephant_gate 0 set_counter del_objective 1 end_if set_counter elephant_fix_check 1 set_counter rally_walls 3 ; battle_wait 180 battle_wait 30 if I_CompareCounter rally_walls = 3 and I_CompareCounter elephant_fix_check set_counter elephant_fix_check 2 battle_wait 30 if I_CompareCounter rally_walls = 3 and I_CompareCounter elephant_fix_check set_counter elephant_fix_check 3 battle_wait 30 if I_CompareCounter rally_walls = 3 and I_CompareCounter elephant_fix_check set_counter elephant_fix_check 4 battle_wait 30 if I_CompareCounter rally_walls = 3 and I_CompareCounter elephant_fix_check set_counter elephant_fix_check 5 battle_wait 30 if I_CompareCounter rally_walls = 3 and I_CompareCounter elephant_fix_check set_counter elephant_fix_check 6 battle_wait 30 if I_CompareCounter rally_walls = 3 and I_CompareCounter elephant_fix_check set_counter elephant_gate_tier2 1 set_counter rally_walls 0 end_if end_if end_if end_if end_if end_if end_monitor

= 1

= 2

= 3

= 4

= 5

= 6

monitor_event BattlePlayerUnitAttacksEnemyUnit BattleIsMeleeAttack and I_CompareCounter rally_walls = 1 and ! BattlePlayerUnitOnWalls

and ! BattleEnemyUnitOnWalls if I_CompareCounter elephant_gate != 2 set_counter elephant_gate 0 set_counter del_objective 1 end_if set_counter elephant_fix_check 1 set_counter rally_walls 3 ; battle_wait 180 battle_wait 30 if I_CompareCounter rally_walls = 3 and I_CompareCounter elephant_fix_check set_counter elephant_fix_check 2 battle_wait 30 if I_CompareCounter rally_walls = 3 and I_CompareCounter elephant_fix_check set_counter elephant_fix_check 3 battle_wait 30 if I_CompareCounter rally_walls = 3 and I_CompareCounter elephant_fix_check set_counter elephant_fix_check 4 battle_wait 30 if I_CompareCounter rally_walls = 3 and I_CompareCounter elephant_fix_check set_counter elephant_fix_check 5 battle_wait 30 if I_CompareCounter rally_walls = 3 and I_CompareCounter elephant_fix_check set_counter elephant_fix_check 6 battle_wait 30 if I_CompareCounter rally_walls = 3 and I_CompareCounter elephant_fix_check set_counter elephant_gate_tier2 1 set_counter rally_walls 0 end_if end_if end_if end_if end_if end_if end_monitor

= 1

= 2

= 3

= 4

= 5

= 6

monitor_conditions I_BattleStarted and I_CompareCounter del_objective = 1 and I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker and I_BattleEnemyArmyNumberOfMountClass elephant > 0 set_counter del_objective 2 battle_wait 15 if I_CompareCounter del_objective = 2 ai_gta_del_objective 1 ai_active_set off battle_wait 0.5 ai_active_set on set_counter del_objective 0 end_if end_monitor monitor_conditions I_BattleStarted

and and and and and and and

I_CompareCounter elephant_gate_tier2 = 1 ! I_BattleIsFortBattle I_BattleIsSiegeBattle ! I_BattlePlayerArmyIsAttacker I_IsBattleSettlementCastle I_BattleSettlementFortificationLevel > 2 I_BattleEnemyArmyNumberOfMountClass elephant > 0

ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999 if I_CompareCounter enemy_unit_count > 0 if I_UnitFormation a2u1 = horde and ! I_UnitStatus a2u1 running_amok and ! I_UnitDestroyed a2u1 and ! I_UnitStatus a2u1 left_battle and ! I_IsUnitRouting a2u1 ai_gta_add_unit_label 1 0 a2u1 end_if if I_CompareCounter enemy_unit_count > 1 if I_UnitFormation a2u2 = horde and ! I_UnitStatus a2u2 running_amok and ! I_UnitDestroyed a2u2 and ! I_UnitStatus a2u2 left_battle and ! I_IsUnitRouting a2u2 ai_gta_add_unit_label 1 0 a2u2 end_if if I_CompareCounter enemy_unit_count > 2 if I_UnitFormation a2u3 = horde and ! I_UnitStatus a2u3 running_amok and ! I_UnitDestroyed a2u3 and ! I_UnitStatus a2u3 left_battle and ! I_IsUnitRouting a2u3 ai_gta_add_unit_label 1 0 a2u3 end_if if I_CompareCounter enemy_unit_count > 3 if I_UnitFormation a2u4 = horde and ! I_UnitStatus a2u4 running_amok and ! I_UnitDestroyed a2u4 and ! I_UnitStatus a2u4 left_battle and ! I_IsUnitRouting a2u4 ai_gta_add_unit_label 1 0 a2u4 end_if if I_CompareCounter enemy_unit_count > 4 if I_UnitFormation a2u5 = horde and ! I_UnitStatus a2u5 running_amok and ! I_UnitDestroyed a2u5 and ! I_UnitStatus a2u5 left_battle and ! I_IsUnitRouting a2u5 ai_gta_add_unit_label 1 0 a2u5 end_if if I_CompareCounter enemy_unit_count > 5 if I_UnitFormation a2u6 = horde and ! I_UnitStatus a2u6 running_amok and ! I_UnitDestroyed a2u6 and ! I_UnitStatus a2u6 left_battle

and ! I_IsUnitRouting a2u6 ai_gta_add_unit_label 1 0 a2u6 end_if if I_CompareCounter enemy_unit_count > 6 if I_UnitFormation a2u7 = horde and ! I_UnitStatus a2u7 running_amok and ! I_UnitDestroyed a2u7 and ! I_UnitStatus a2u7 left_battle and ! I_IsUnitRouting a2u7 ai_gta_add_unit_label 1 0 a2u7 end_if if I_CompareCounter enemy_unit_count > 7 if I_UnitFormation a2u8 = horde and ! I_UnitStatus a2u8 running_amok and ! I_UnitDestroyed a2u8 and ! I_UnitStatus a2u8 left_battle and ! I_IsUnitRouting a2u8 ai_gta_add_unit_label 1 0 a2u8 end_if if I_CompareCounter enemy_unit_count > 8 if I_UnitFormation a2u9 = horde and ! I_UnitStatus a2u9 running_amok and ! I_UnitDestroyed a2u9 and ! I_UnitStatus a2u9 left_battle and ! I_IsUnitRouting a2u9 ai_gta_add_unit_label 1 0 a2u9 end_if if I_CompareCounter enemy_unit_count > 9 if I_UnitFormation a2u10 = horde and ! I_UnitStatus a2u10 running_amok and ! I_UnitDestroyed a2u10 and ! I_UnitStatus a2u10 left_battle and ! I_IsUnitRouting a2u10 ai_gta_add_unit_label 1 0 a2u10 end_if if I_CompareCounter enemy_unit_count > 10 if I_UnitFormation a2u11 = horde and ! I_UnitStatus a2u11 running_amok and ! I_UnitDestroyed a2u11 and ! I_UnitStatus a2u11 left_battle and ! I_IsUnitRouting a2u11 ai_gta_add_unit_label 1 0 a2u11 end_if if I_CompareCounter enemy_unit_count > 11 if I_UnitFormation a2u12 = horde and ! I_UnitStatus a2u12 running_amok and ! I_UnitDestroyed a2u12 and ! I_UnitStatus a2u12 left_battle and ! I_IsUnitRouting a2u12 ai_gta_add_unit_label 1 0 a2u12 end_if if I_CompareCounter enemy_unit_count > 12 if I_UnitFormation a2u13 = horde

and ! I_UnitStatus a2u13 running_amok and ! I_UnitDestroyed a2u13 and ! I_UnitStatus a2u13 left_battle and ! I_IsUnitRouting a2u13 ai_gta_add_unit_label 1 0 a2u13 end_if if I_CompareCounter enemy_unit_count > 13 if I_UnitFormation a2u14 = horde and ! I_UnitStatus a2u14 running_amok and ! I_UnitDestroyed a2u14 and ! I_UnitStatus a2u14 left_battle and ! I_IsUnitRouting a2u14 ai_gta_add_unit_label 1 0 a2u14 end_if if I_CompareCounter enemy_unit_count > 14 if I_UnitFormation a2u15 = horde and ! I_UnitStatus a2u15 running_amok and ! I_UnitDestroyed a2u15 and ! I_UnitStatus a2u15 left_battle and ! I_IsUnitRouting a2u15 ai_gta_add_unit_label 1 0 a2u15 end_if if I_CompareCounter enemy_unit_count > 15 if I_UnitFormation a2u16 = horde and ! I_UnitStatus a2u16 running_amok and ! I_UnitDestroyed a2u16 and ! I_UnitStatus a2u16 left_battle and ! I_IsUnitRouting a2u16 ai_gta_add_unit_label 1 0 a2u16 end_if if I_CompareCounter enemy_unit_count > 16 if I_UnitFormation a2u17 = horde and ! I_UnitStatus a2u17 running_amok and ! I_UnitDestroyed a2u17 and ! I_UnitStatus a2u17 left_battle and ! I_IsUnitRouting a2u17 ai_gta_add_unit_label 1 0 a2u17 end_if if I_CompareCounter enemy_unit_count > 17 if I_UnitFormation a2u18 = horde and ! I_UnitStatus a2u18 running_amok and ! I_UnitDestroyed a2u18 and ! I_UnitStatus a2u18 left_battle and ! I_IsUnitRouting a2u18 ai_gta_add_unit_label 1 0 a2u18 end_if if I_CompareCounter enemy_unit_count > 18 if I_UnitFormation a2u19 = horde and ! I_UnitStatus a2u19 running_amok and ! I_UnitDestroyed a2u19 and ! I_UnitStatus a2u19 left_battle and ! I_IsUnitRouting a2u19 ai_gta_add_unit_label 1 0 a2u19 end_if

if I_CompareCounter enemy_unit_count = 20 if I_UnitFormation a2u20 = horde and ! I_UnitStatus a2u20 running_amok and ! I_UnitDestroyed a2u20 and ! I_UnitStatus a2u20 left_battle and ! I_IsUnitRouting a2u20 ai_gta_add_unit_label 1 0 a2u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if ai_active_set on set_counter second_ring 1 set_counter elephant_gate_tier2 0 end_monitor monitor_event BattleBattleGatesDestroyedByEngine TrueCondition and I_CompareCounter second_ring = 1 and I_BattleIsSiegeBattle 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_BattleIsSiegeBattle 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 and and and and and

I_CompareCounter second_ring = 1 I_BattleIsSiegeBattle ! I_BattlePlayerArmyIsAttacker I_BattleEnemyArmyNumberOfMountClass elephant > 0 I_IsBattleSettlementCastle 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 and ! BattlePlayerUnitOnWalls and ! BattleEnemyUnitOnWalls if I_CompareCounter second_ring != 2 set_counter second_ring 0 set_counter del_objective 1 end_if set_counter elephant_fix_check 1 set_counter rally_walls 4 ; battle_wait 180 battle_wait 30 if I_CompareCounter rally_walls = 4 and I_CompareCounter elephant_fix_check set_counter elephant_fix_check 2 battle_wait 30 if I_CompareCounter rally_walls = 4 and I_CompareCounter elephant_fix_check set_counter elephant_fix_check 3 battle_wait 30 if I_CompareCounter rally_walls = 4 and I_CompareCounter elephant_fix_check set_counter elephant_fix_check 4 battle_wait 30 if I_CompareCounter rally_walls = 4 and I_CompareCounter elephant_fix_check set_counter elephant_fix_check 5 battle_wait 30 if I_CompareCounter rally_walls = 4 and I_CompareCounter elephant_fix_check set_counter elephant_fix_check 6 battle_wait 30 if I_CompareCounter rally_walls = 4 and I_CompareCounter elephant_fix_check set_counter elephant_gate_tier3 1 end_if end_if end_if end_if end_if end_if end_monitor

= 1

= 2

= 3

= 4

= 5

= 6

monitor_event BattlePlayerUnitAttacksEnemyUnit BattleIsMeleeAttack and I_CompareCounter rally_walls = 2 and ! BattlePlayerUnitOnWalls

and ! BattleEnemyUnitOnWalls if I_CompareCounter second_ring != 2 set_counter second_ring 0 set_counter del_objective 1 end_if set_counter elephant_fix_check 1 set_counter rally_walls 4 ; battle_wait 180 battle_wait 30 if I_CompareCounter rally_walls = 4 and I_CompareCounter elephant_fix_check set_counter elephant_fix_check 2 battle_wait 30 if I_CompareCounter rally_walls = 4 and I_CompareCounter elephant_fix_check set_counter elephant_fix_check 3 battle_wait 30 if I_CompareCounter rally_walls = 4 and I_CompareCounter elephant_fix_check set_counter elephant_fix_check 4 battle_wait 30 if I_CompareCounter rally_walls = 4 and I_CompareCounter elephant_fix_check set_counter elephant_fix_check 5 battle_wait 30 if I_CompareCounter rally_walls = 4 and I_CompareCounter elephant_fix_check set_counter elephant_fix_check 6 battle_wait 30 if I_CompareCounter rally_walls = 4 and I_CompareCounter elephant_fix_check set_counter elephant_gate_tier3 1 end_if end_if end_if end_if end_if end_if end_monitor

= 1

= 2

= 3

= 4

= 5

= 6

monitor_conditions I_BattleStarted and I_CompareCounter elephant_gate_tier3 = 1 and I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker and I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel > 2 and I_BattleEnemyArmyNumberOfMountClass elephant > 0 ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999 if I_CompareCounter enemy_unit_count > 0 if I_UnitFormation a2u1 = horde and ! I_UnitStatus a2u1 running_amok and ! I_UnitDestroyed a2u1 and ! I_UnitStatus a2u1 left_battle and ! I_IsUnitRouting a2u1 ai_gta_add_unit_label 1 0 a2u1 end_if

if I_CompareCounter enemy_unit_count > 1 if I_UnitFormation a2u2 = horde and ! I_UnitStatus a2u2 running_amok and ! I_UnitDestroyed a2u2 and ! I_UnitStatus a2u2 left_battle and ! I_IsUnitRouting a2u2 ai_gta_add_unit_label 1 0 a2u2 end_if if I_CompareCounter enemy_unit_count > 2 if I_UnitFormation a2u3 = horde and ! I_UnitStatus a2u3 running_amok and ! I_UnitDestroyed a2u3 and ! I_UnitStatus a2u3 left_battle and ! I_IsUnitRouting a2u3 ai_gta_add_unit_label 1 0 a2u3 end_if if I_CompareCounter enemy_unit_count > 3 if I_UnitFormation a2u4 = horde and ! I_UnitStatus a2u4 running_amok and ! I_UnitDestroyed a2u4 and ! I_UnitStatus a2u4 left_battle and ! I_IsUnitRouting a2u4 ai_gta_add_unit_label 1 0 a2u4 end_if if I_CompareCounter enemy_unit_count > 4 if I_UnitFormation a2u5 = horde and ! I_UnitStatus a2u5 running_amok and ! I_UnitDestroyed a2u5 and ! I_UnitStatus a2u5 left_battle and ! I_IsUnitRouting a2u5 ai_gta_add_unit_label 1 0 a2u5 end_if if I_CompareCounter enemy_unit_count > 5 if I_UnitFormation a2u6 = horde and ! I_UnitStatus a2u6 running_amok and ! I_UnitDestroyed a2u6 and ! I_UnitStatus a2u6 left_battle and ! I_IsUnitRouting a2u6 ai_gta_add_unit_label 1 0 a2u6 end_if if I_CompareCounter enemy_unit_count > 6 if I_UnitFormation a2u7 = horde and ! I_UnitStatus a2u7 running_amok and ! I_UnitDestroyed a2u7 and ! I_UnitStatus a2u7 left_battle and ! I_IsUnitRouting a2u7 ai_gta_add_unit_label 1 0 a2u7 end_if if I_CompareCounter enemy_unit_count > 7 if I_UnitFormation a2u8 = horde and ! I_UnitStatus a2u8 running_amok and ! I_UnitDestroyed a2u8 and ! I_UnitStatus a2u8 left_battle and ! I_IsUnitRouting a2u8

ai_gta_add_unit_label 1 0 a2u8 end_if if I_CompareCounter enemy_unit_count > 8 if I_UnitFormation a2u9 = horde and ! I_UnitStatus a2u9 running_amok and ! I_UnitDestroyed a2u9 and ! I_UnitStatus a2u9 left_battle and ! I_IsUnitRouting a2u9 ai_gta_add_unit_label 1 0 a2u9 end_if if I_CompareCounter enemy_unit_count > 9 if I_UnitFormation a2u10 = horde and ! I_UnitStatus a2u10 running_amok and ! I_UnitDestroyed a2u10 and ! I_UnitStatus a2u10 left_battle and ! I_IsUnitRouting a2u10 ai_gta_add_unit_label 1 0 a2u10 end_if if I_CompareCounter enemy_unit_count > 10 if I_UnitFormation a2u11 = horde and ! I_UnitStatus a2u11 running_amok and ! I_UnitDestroyed a2u11 and ! I_UnitStatus a2u11 left_battle and ! I_IsUnitRouting a2u11 ai_gta_add_unit_label 1 0 a2u11 end_if if I_CompareCounter enemy_unit_count > 11 if I_UnitFormation a2u12 = horde and ! I_UnitStatus a2u12 running_amok and ! I_UnitDestroyed a2u12 and ! I_UnitStatus a2u12 left_battle and ! I_IsUnitRouting a2u12 ai_gta_add_unit_label 1 0 a2u12 end_if if I_CompareCounter enemy_unit_count > 12 if I_UnitFormation a2u13 = horde and ! I_UnitStatus a2u13 running_amok and ! I_UnitDestroyed a2u13 and ! I_UnitStatus a2u13 left_battle and ! I_IsUnitRouting a2u13 ai_gta_add_unit_label 1 0 a2u13 end_if if I_CompareCounter enemy_unit_count > 13 if I_UnitFormation a2u14 = horde and ! I_UnitStatus a2u14 running_amok and ! I_UnitDestroyed a2u14 and ! I_UnitStatus a2u14 left_battle and ! I_IsUnitRouting a2u14 ai_gta_add_unit_label 1 0 a2u14 end_if if I_CompareCounter enemy_unit_count > 14 if I_UnitFormation a2u15 = horde and ! I_UnitStatus a2u15 running_amok

and ! I_UnitDestroyed a2u15 and ! I_UnitStatus a2u15 left_battle and ! I_IsUnitRouting a2u15 ai_gta_add_unit_label 1 0 a2u15 end_if if I_CompareCounter enemy_unit_count > 15 if I_UnitFormation a2u16 = horde and ! I_UnitStatus a2u16 running_amok and ! I_UnitDestroyed a2u16 and ! I_UnitStatus a2u16 left_battle and ! I_IsUnitRouting a2u16 ai_gta_add_unit_label 1 0 a2u16 end_if if I_CompareCounter enemy_unit_count > 16 if I_UnitFormation a2u17 = horde and ! I_UnitStatus a2u17 running_amok and ! I_UnitDestroyed a2u17 and ! I_UnitStatus a2u17 left_battle and ! I_IsUnitRouting a2u17 ai_gta_add_unit_label 1 0 a2u17 end_if if I_CompareCounter enemy_unit_count > 17 if I_UnitFormation a2u18 = horde and ! I_UnitStatus a2u18 running_amok and ! I_UnitDestroyed a2u18 and ! I_UnitStatus a2u18 left_battle and ! I_IsUnitRouting a2u18 ai_gta_add_unit_label 1 0 a2u18 end_if if I_CompareCounter enemy_unit_count > 18 if I_UnitFormation a2u19 = horde and ! I_UnitStatus a2u19 running_amok and ! I_UnitDestroyed a2u19 and ! I_UnitStatus a2u19 left_battle and ! I_IsUnitRouting a2u19 ai_gta_add_unit_label 1 0 a2u19 end_if if I_CompareCounter enemy_unit_count = 20 if I_UnitFormation a2u20 = horde and ! I_UnitStatus a2u20 running_amok and ! I_UnitDestroyed a2u20 and ! I_UnitStatus a2u20 left_battle and ! I_IsUnitRouting a2u20 ai_gta_add_unit_label 1 0 a2u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if

end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if ai_active_set on set_counter third_ring 1 set_counter elephant_gate_tier3 0 end_monitor ;################## Open Battles ################# monitor_conditions I_BattleStarted and I_CompareCounter ob_defense_launch = 1 and I_CompareCounter ob_defend = 0 and I_CompareCounter open_battle = 1 and I_BattlePlayerArmyIsAttacker set_counter ob_defend 2 if I_UnitDistanceFromUnit a1u1 a2u1 < 220 and I_BattleEnemyArmyNumberOfUnitClass missile = 0 and I_BattleEnemyArmyNumberOfUnitClass skirmish = 0 ai_gta_plan_set 1 ATTACK_ALL set_counter ob_defend 4 set_counter ob_defense_launch 0 end_if if I_CompareCounter ob_defend = 2 and I_BattleEnemyArmyPercentageOfUnitCategory cavalry > 60 and I_UnitDistanceFromUnit a1u1 a2u1 < 270 ai_gta_plan_set 1 ATTACK_ALL set_counter ob_defend 4 set_counter ob_defense_launch 0 end_if if I_CompareCounter ob_defend = 2 and I_BattleEnemyArmyPercentageOfUnitCategory cavalry > 60 set_counter ob_repeat_test 3 end_if if I_CompareCounter ob_defend = 2 and I_BattlePlayerAllianceOddsInFavour > 1.7 set_counter ob_repeat_test 3 end_if if I_CompareCounter ob_defend = 2 and I_BattleEnemyArmyNumberOfUnitClass missile = 0 and I_BattleEnemyArmyNumberOfUnitClass skirmish = 0 set_counter ob_repeat_test 1 end_if ; if I_BattlePlayerArmyNumberOfClassAndCategory missile siege > 0 ; end_if end_monitor

monitor_event BattlePlayerUnitAttacksEnemyUnit BattleIsMeleeAttack and I_CompareCounter ob_defense_launch = 1 and I_CompareCounter open_battle = 1 and I_CompareCounter ob_defend != 4 and I_BattlePlayerArmyIsAttacker and I_UnitEnemyUnitInRadius a2u1 200 and BattleEnemyUnitClass != missile and BattleEnemyUnitClass != skirmish and BattleDirectionOfAttack != front and BattleRangeOfAttack < 200 ai_gta_plan_set 1 ATTACK_ALL set_counter ob_defend 4 set_counter ob_defense_launch 0 end_monitor monitor_event BattlePlayerUnitAttacksEnemyUnit BattleIsMeleeAttack and I_CompareCounter ob_defense_launch = 1 and I_CompareCounter open_battle = 1 and I_CompareCounter ob_defend != 4 and I_BattlePlayerArmyIsAttacker and BattleDirectionOfAttack != rear and I_UnitEnemyUnitInRadius a2u1 200 and BattleRangeOfAttack < 200 and BattlePlayerUnitCategory infantry ai_gta_plan_set 1 ATTACK_ALL set_counter ob_defend 4 set_counter ob_defense_launch 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter ob_defense_launch = 1 and I_CompareCounter open_battle = 1 and I_CompareCounter ob_defend != 4 and I_UnitEnemyUnitInRadius a2u1 100 and I_BattlePlayerArmyIsAttacker ai_gta_plan_set 1 ATTACK_ALL set_counter ob_defend 4 set_counter ob_defense_launch 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter ob_defense_launch = 1 and I_CompareCounter open_battle = 1 and I_CompareCounter ob_defend != 4 and I_BattleEnemyArmyPercentageOfUnitCategory cavalry > 60 and I_UnitEnemyUnitInRadius a2u1 250 and I_BattlePlayerArmyIsAttacker ai_gta_plan_set 1 ATTACK_ALL set_counter ob_defend 4 set_counter ob_defense_launch 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter ob_defense_launch = 1 and I_CompareCounter open_battle = 1

and I_CompareCounter ob_defend != 4 set_counter player_units_closing 0 if I_CompareCounter player_unit_count > 0 and I_UnitDistanceFromUnit a1u1 a2u1 < 180 and ! I_UnitStatus a1u1 missiles_firing and ! I_UnitStatus a1u1 missiles_reloading inc_counter player_units_closing 1 end_if if I_CompareCounter player_unit_count > 1 and I_UnitDistanceFromUnit a1u2 a2u1 < 180 and ! I_UnitStatus a1u2 missiles_firing and ! I_UnitStatus a1u2 missiles_reloading inc_counter player_units_closing 1 end_if if I_CompareCounter player_unit_count > 2 and I_UnitDistanceFromUnit a1u3 a2u1 < 180 and ! I_UnitStatus a1u3 missiles_firing and ! I_UnitStatus a1u3 missiles_reloading inc_counter player_units_closing 1 end_if if I_CompareCounter player_unit_count > 3 and I_UnitDistanceFromUnit a1u4 a2u1 < 180 and ! I_UnitStatus a1u4 missiles_firing and ! I_UnitStatus a1u4 missiles_reloading inc_counter player_units_closing 1 end_if if I_CompareCounter player_unit_count > 4 and I_UnitDistanceFromUnit a1u5 a2u1 < 180 and ! I_UnitStatus a1u5 missiles_firing and ! I_UnitStatus a1u5 missiles_reloading inc_counter player_units_closing 1 end_if if I_CompareCounter player_unit_count > 5 and I_UnitDistanceFromUnit a1u6 a2u1 < 180 and ! I_UnitStatus a1u6 missiles_firing and ! I_UnitStatus a1u6 missiles_reloading inc_counter player_units_closing 1 end_if if I_CompareCounter player_unit_count > 6 and I_UnitDistanceFromUnit a1u7 a2u1 < 180 and ! I_UnitStatus a1u7 missiles_firing and ! I_UnitStatus a1u7 missiles_reloading inc_counter player_units_closing 1 end_if if I_CompareCounter player_unit_count > 7 and I_UnitDistanceFromUnit a1u8 a2u1 < 180 and ! I_UnitStatus a1u8 missiles_firing and ! I_UnitStatus a1u8 missiles_reloading inc_counter player_units_closing 1 end_if

if I_CompareCounter player_unit_count > 8 and I_UnitDistanceFromUnit a1u9 a2u1 < 180 and ! I_UnitStatus a1u9 missiles_firing and ! I_UnitStatus a1u9 missiles_reloading inc_counter player_units_closing 1 end_if if I_CompareCounter player_unit_count > 9 and I_UnitDistanceFromUnit a1u10 a2u1 < 180 and ! I_UnitStatus a1u10 missiles_firing and ! I_UnitStatus a1u10 missiles_reloading inc_counter player_units_closing 1 end_if if I_CompareCounter player_unit_count > 10 and I_UnitDistanceFromUnit a1u11 a2u1 < 180 and ! I_UnitStatus a1u11 missiles_firing and ! I_UnitStatus a1u11 missiles_reloading inc_counter player_units_closing 1 end_if if I_CompareCounter player_unit_count > 11 and I_UnitDistanceFromUnit a1u12 a2u1 < 180 and ! I_UnitStatus a1u12 missiles_firing and ! I_UnitStatus a1u12 missiles_reloading inc_counter player_units_closing 1 end_if if I_CompareCounter player_unit_count > 12 and I_UnitDistanceFromUnit a1u13 a2u1 < 180 and ! I_UnitStatus a1u13 missiles_firing and ! I_UnitStatus a1u13 missiles_reloading inc_counter player_units_closing 1 end_if if I_CompareCounter player_unit_count > 13 and I_UnitDistanceFromUnit a1u14 a2u1 < 180 and ! I_UnitStatus a1u14 missiles_firing and ! I_UnitStatus a1u14 missiles_reloading inc_counter player_units_closing 1 end_if if I_CompareCounter player_unit_count > 14 and I_UnitDistanceFromUnit a1u15 a2u1 < 180 and ! I_UnitStatus a1u15 missiles_firing and ! I_UnitStatus a1u15 missiles_reloading inc_counter player_units_closing 1 end_if if I_CompareCounter player_unit_count > 15 and I_UnitDistanceFromUnit a1u16 a2u1 < 180 and ! I_UnitStatus a1u16 missiles_firing and ! I_UnitStatus a1u16 missiles_reloading inc_counter player_units_closing 1 end_if if I_CompareCounter player_unit_count > 16 and I_UnitDistanceFromUnit a1u17 a2u1 < 180 and ! I_UnitStatus a1u17 missiles_firing and ! I_UnitStatus a1u17 missiles_reloading

inc_counter player_units_closing 1 end_if if I_CompareCounter player_unit_count > 17 and I_UnitDistanceFromUnit a1u18 a2u1 < 180 and ! I_UnitStatus a1u18 missiles_firing and ! I_UnitStatus a1u18 missiles_reloading inc_counter player_units_closing 1 end_if if I_CompareCounter player_unit_count > 18 and I_UnitDistanceFromUnit a1u19 a2u1 < 180 and ! I_UnitStatus a1u19 missiles_firing and ! I_UnitStatus a1u19 missiles_reloading inc_counter player_units_closing 1 end_if if I_CompareCounter player_unit_count = 20 and I_UnitDistanceFromUnit a1u20 a2u1 < 180 and ! I_UnitStatus a1u20 missiles_firing and ! I_UnitStatus a1u20 missiles_reloading inc_counter player_units_closing 1 end_if if I_CompareCounter player_units_closing > 1 inc_counter player_enveloping 1 end_if if I_CompareCounter player_units_closing < 1 set_counter player_enveloping 0 end_if if I_CompareCounter player_enveloping > 5 ai_gta_plan_set 1 ATTACK_ALL set_counter ob_defend 4 set_counter ob_defense_launch 0 end_if battle_wait 10 end_monitor monitor_event BattleEnemyUnitAttacksPlayerUnit BattleIsMeleeAttack and I_CompareCounter ob_defend > 1 and I_CompareCounter ob_defend != 4 and BattleEnemyUnitClass heavy and BattleEnemyUnitCategory cavalry and ! BattlePlayerUnitClass heavy and ! BattlePlayerUnitClass heavy and I_CompareCounter open_battle = 1 and I_BattlePlayerArmyIsAttacker inc_counter ob_engaged -1 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter ob_defend > 1 and I_CompareCounter ob_defend != 4 and I_CompareCounter open_battle = 1 and I_BattlePlayerArmyIsAttacker if I_PercentageOfArmyKilled 0 0 < 5 and I_PercentageOfArmyKilled 1 0 > 10

set_counter ob_repeat_test 4 end_if if I_PercentageOfArmyKilled 0 0 < 10 and I_PercentageOfArmyKilled 1 0 > 20 set_counter ob_repeat_test 4 end_if if I_PercentageOfArmyKilled 0 0 < 15 and I_PercentageOfArmyKilled 1 0 > 25 set_counter ob_repeat_test 4 end_if battle_wait 30 end_monitor ;monitor_event BattlePlayerUnitAttacksEnemyUnit TrueCondition ; and I_CompareCounter ob_defense_launch = 1 ; and ! I_CompareCounter ob_defend > 1 ; and BattlePlayerUnitCategory siege ; and BattlePlayerUnitClass missile ; and BattleRangeOfAttack < 400 ; and I_CompareCounter open_battle = 1 ; and I_BattlePlayerArmyIsAttacker ;; set_counter ob_siege_attack 1 ;end_monitor ;monitor_conditions I_BattleStarted ; and I_CompareCounter ob_defense_launch = 1 ; and I_CompareCounter ob_siege_attack = 1 ; and I_CompareCounter open_battle = 1 ; and I_BattlePlayerArmyIsAttacker ;; if I_PercentageOfArmyKilled 0 0 < 3 ; and I_PercentageOfArmyKilled 1 0 > 5 ; set_counter ob_defend 2 ; set_counter ob_siege_attack 0 ; end_if ; if I_PercentageOfArmyKilled 0 0 < 5 ; and I_PercentageOfArmyKilled 1 0 > 10 ; if I_CompareCounter ob_repeat_test < 2 ; set_counter ob_repeat_test 2 ; end_if ; set_counter ob_defend 2 ; set_counter ob_siege_attack 0 ; end_if ; battle_wait 30 ;end_monitor ;;;;;; Main monitor monitor_conditions I_BattleStarted and I_CompareCounter ob_defense_launch = 1 and I_CompareCounter ob_defend = 2 and I_CompareCounter open_battle = 1 and I_BattlePlayerArmyIsAttacker set_counter ob_defend 3 if I_CompareCounter enemy_unit_count > 0 if I_IsUnitUnderFire a2u1 inc_counter ob_under_fire 2

end_if if I_UnitStatus a2u1 fighting inc_counter ob_engaged 1 end_if if I_UnitStatus a2u1 pursuing inc_counter ob_engaged 1 end_if if I_UnitStatus a2u1 charging inc_counter ob_engaged 1 end_if if I_UnitStatus a2u1 missiles_firing inc_counter ob_under_fire -1 end_if if I_UnitStatus a2u1 missiles_reloading inc_counter ob_under_fire -1 end_if if I_CompareCounter enemy_unit_count > 1 if I_IsUnitUnderFire a2u2 inc_counter ob_under_fire 1 end_if if I_UnitStatus a2u2 fighting inc_counter ob_engaged 1 end_if if I_UnitStatus a2u2 pursuing inc_counter ob_engaged 1 end_if if I_UnitStatus a2u2 charging inc_counter ob_engaged 1 end_if if I_UnitStatus a2u2 missiles_firing inc_counter ob_under_fire -1 end_if if I_UnitStatus a2u2 missiles_reloading inc_counter ob_under_fire -1 end_if if I_CompareCounter enemy_unit_count > 2 if I_IsUnitUnderFire a2u3 inc_counter ob_under_fire 1 end_if if I_UnitStatus a2u3 fighting inc_counter ob_engaged 1 end_if if I_UnitStatus a2u3 pursuing inc_counter ob_engaged 1 end_if if I_UnitStatus a2u3 charging inc_counter ob_engaged 1 end_if if I_UnitStatus a2u3 missiles_firing inc_counter ob_under_fire -1 end_if if I_UnitStatus a2u3 missiles_reloading inc_counter ob_under_fire -1 end_if if I_CompareCounter enemy_unit_count > 3 if I_IsUnitUnderFire a2u4 inc_counter ob_under_fire 1

end_if if I_UnitStatus a2u4 fighting inc_counter ob_engaged 1 end_if if I_UnitStatus a2u4 pursuing inc_counter ob_engaged 1 end_if if I_UnitStatus a2u4 charging inc_counter ob_engaged 1 end_if if I_UnitStatus a2u4 missiles_firing inc_counter ob_under_fire -1 end_if if I_UnitStatus a2u4 missiles_reloading inc_counter ob_under_fire -1 end_if if I_CompareCounter enemy_unit_count > 4 if I_IsUnitUnderFire a2u5 inc_counter ob_under_fire 1 end_if if I_UnitStatus a2u5 fighting inc_counter ob_engaged 1 end_if if I_UnitStatus a2u5 pursuing inc_counter ob_engaged 1 end_if if I_UnitStatus a2u5 charging inc_counter ob_engaged 1 end_if if I_UnitStatus a2u5 missiles_firing inc_counter ob_under_fire -1 end_if if I_UnitStatus a2u5 missiles_reloading inc_counter ob_under_fire -1 end_if if I_CompareCounter enemy_unit_count > 5 if I_IsUnitUnderFire a2u6 inc_counter ob_under_fire 1 end_if if I_UnitStatus a2u6 fighting inc_counter ob_engaged 1 end_if if I_UnitStatus a2u6 pursuing inc_counter ob_engaged 1 end_if if I_UnitStatus a2u6 charging inc_counter ob_engaged 1 end_if if I_UnitStatus a2u6 missiles_firing inc_counter ob_under_fire -1 end_if if I_UnitStatus a2u6 missiles_reloading inc_counter ob_under_fire -1 end_if if I_CompareCounter enemy_unit_count > 6 if I_IsUnitUnderFire a2u7 inc_counter ob_under_fire 1

end_if if I_UnitStatus a2u7 fighting inc_counter ob_engaged 1 end_if if I_UnitStatus a2u7 pursuing inc_counter ob_engaged 1 end_if if I_UnitStatus a2u7 charging inc_counter ob_engaged 1 end_if if I_UnitStatus a2u7 missiles_firing inc_counter ob_under_fire -1 end_if if I_UnitStatus a2u7 missiles_reloading inc_counter ob_under_fire -1 end_if if I_CompareCounter enemy_unit_count > 7 if I_IsUnitUnderFire a2u8 inc_counter ob_under_fire 1 end_if if I_UnitStatus a2u8 fighting inc_counter ob_engaged 1 end_if if I_UnitStatus a2u8 pursuing inc_counter ob_engaged 1 end_if if I_UnitStatus a2u8 charging inc_counter ob_engaged 1 end_if if I_UnitStatus a2u8 missiles_firing inc_counter ob_under_fire -1 end_if if I_UnitStatus a2u8 missiles_reloading inc_counter ob_under_fire -1 end_if if I_CompareCounter enemy_unit_count > 8 if I_IsUnitUnderFire a2u9 inc_counter ob_under_fire 1 end_if if I_UnitStatus a2u9 fighting inc_counter ob_engaged 1 end_if if I_UnitStatus a2u9 pursuing inc_counter ob_engaged 1 end_if if I_UnitStatus a2u9 charging inc_counter ob_engaged 1 end_if if I_UnitStatus a2u9 missiles_firing inc_counter ob_under_fire -1 end_if if I_UnitStatus a2u9 missiles_reloading inc_counter ob_under_fire -1 end_if if I_CompareCounter enemy_unit_count > 9 if I_IsUnitUnderFire a2u10 inc_counter ob_under_fire 1

end_if if I_UnitStatus a2u10 fighting inc_counter ob_engaged 1 end_if if I_UnitStatus a2u10 pursuing inc_counter ob_engaged 1 end_if if I_UnitStatus a2u10 charging inc_counter ob_engaged 1 end_if if I_UnitStatus a2u10 missiles_firing inc_counter ob_under_fire -1 end_if if I_UnitStatus a2u10 missiles_reloading inc_counter ob_under_fire -1 end_if if I_CompareCounter enemy_unit_count > 10 if I_IsUnitUnderFire a2u11 inc_counter ob_under_fire 1 end_if if I_UnitStatus a2u11 fighting inc_counter ob_engaged 1 end_if if I_UnitStatus a2u11 pursuing inc_counter ob_engaged 1 end_if if I_UnitStatus a2u11 charging inc_counter ob_engaged 1 end_if if I_UnitStatus a2u11 missiles_firing inc_counter ob_under_fire -1 end_if if I_UnitStatus a2u11 missiles_reloading inc_counter ob_under_fire -1 end_if if I_CompareCounter enemy_unit_count > 11 if I_IsUnitUnderFire a2u12 inc_counter ob_under_fire 1 end_if if I_UnitStatus a2u12 fighting inc_counter ob_engaged 1 end_if if I_UnitStatus a2u12 pursuing inc_counter ob_engaged 1 end_if if I_UnitStatus a2u12 charging inc_counter ob_engaged 1 end_if if I_UnitStatus a2u12 missiles_firing inc_counter ob_under_fire -1 end_if if I_UnitStatus a2u12 missiles_reloading inc_counter ob_under_fire -1 end_if if I_CompareCounter enemy_unit_count > 12 if I_IsUnitUnderFire a2u13 inc_counter ob_under_fire 1

end_if if I_UnitStatus a2u13 fighting inc_counter ob_engaged 1 end_if if I_UnitStatus a2u13 pursuing inc_counter ob_engaged 1 end_if if I_UnitStatus a2u13 charging inc_counter ob_engaged 1 end_if if I_UnitStatus a2u13 missiles_firing inc_counter ob_under_fire -1 end_if if I_UnitStatus a2u13 missiles_reloading inc_counter ob_under_fire -1 end_if if I_CompareCounter enemy_unit_count > 13 if I_IsUnitUnderFire a2u14 inc_counter ob_under_fire 1 end_if if I_UnitStatus a2u14 fighting inc_counter ob_engaged 1 end_if if I_UnitStatus a2u14 pursuing inc_counter ob_engaged 1 end_if if I_UnitStatus a2u14 charging inc_counter ob_engaged 1 end_if if I_UnitStatus a2u14 missiles_firing inc_counter ob_under_fire -1 end_if if I_UnitStatus a2u14 missiles_reloading inc_counter ob_under_fire -1 end_if if I_CompareCounter enemy_unit_count > 14 if I_IsUnitUnderFire a2u15 inc_counter ob_under_fire 1 end_if if I_UnitStatus a2u15 fighting inc_counter ob_engaged 1 end_if if I_UnitStatus a2u15 pursuing inc_counter ob_engaged 1 end_if if I_UnitStatus a2u15 charging inc_counter ob_engaged 1 end_if if I_UnitStatus a2u15 missiles_firing inc_counter ob_under_fire -1 end_if if I_UnitStatus a2u15 missiles_reloading inc_counter ob_under_fire -1 end_if if I_CompareCounter enemy_unit_count > 15 if I_IsUnitUnderFire a2u16 inc_counter ob_under_fire 1

end_if if I_UnitStatus a2u16 fighting inc_counter ob_engaged 1 end_if if I_UnitStatus a2u16 pursuing inc_counter ob_engaged 1 end_if if I_UnitStatus a2u16 charging inc_counter ob_engaged 1 end_if if I_UnitStatus a2u16 missiles_firing inc_counter ob_under_fire -1 end_if if I_UnitStatus a2u16 missiles_reloading inc_counter ob_under_fire -1 end_if if I_CompareCounter enemy_unit_count > 16 if I_IsUnitUnderFire a2u17 inc_counter ob_under_fire 1 end_if if I_UnitStatus a2u17 fighting inc_counter ob_engaged 1 end_if if I_UnitStatus a2u17 pursuing inc_counter ob_engaged 1 end_if if I_UnitStatus a2u17 charging inc_counter ob_engaged 1 end_if if I_UnitStatus a2u17 missiles_firing inc_counter ob_under_fire -1 end_if if I_UnitStatus a2u17 missiles_reloading inc_counter ob_under_fire -1 end_if if I_CompareCounter enemy_unit_count > 17 if I_IsUnitUnderFire a2u18 inc_counter ob_under_fire 1 end_if if I_UnitStatus a2u18 fighting inc_counter ob_engaged 1 end_if if I_UnitStatus a2u18 pursuing inc_counter ob_engaged 1 end_if if I_UnitStatus a2u18 charging inc_counter ob_engaged 1 end_if if I_UnitStatus a2u18 missiles_firing inc_counter ob_under_fire -1 end_if if I_UnitStatus a2u18 missiles_reloading inc_counter ob_under_fire -1 end_if if I_CompareCounter enemy_unit_count > 18 if I_IsUnitUnderFire a2u19 inc_counter ob_under_fire 1

end_if if I_UnitStatus a2u19 fighting inc_counter ob_engaged 1 end_if if I_UnitStatus a2u19 pursuing inc_counter ob_engaged 1 end_if if I_UnitStatus a2u19 charging inc_counter ob_engaged 1 end_if if I_UnitStatus a2u19 missiles_firing inc_counter ob_under_fire -1 end_if if I_UnitStatus a2u19 missiles_reloading inc_counter ob_under_fire -1 end_if if I_CompareCounter enemy_unit_count = 20 if I_IsUnitUnderFire a2u20 inc_counter ob_under_fire 1 end_if if I_UnitStatus a2u20 fighting inc_counter ob_engaged 1 end_if if I_UnitStatus a2u20 pursuing inc_counter ob_engaged 1 end_if if I_UnitStatus a2u20 charging inc_counter ob_engaged 1 end_if if I_UnitStatus a2u20 missiles_firing inc_counter ob_under_fire -1 end_if if I_UnitStatus a2u20 missiles_reloading inc_counter ob_under_fire -1 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if if I_CompareCounter ob_under_fire < 1 if I_CompareCounter ob_engaged > 0

if I_CompareCounter ob_repeat_test = 3 set_counter ob_repeat_test 4 end_if if I_CompareCounter ob_repeat_test = 2 set_counter ob_engaged 0 set_counter ob_repeat_test 3 end_if if I_CompareCounter ob_repeat_test = 1 set_counter ob_engaged 0 set_counter ob_under_fire 0 set_counter ob_repeat_test 2 end_if if I_CompareCounter ob_repeat_test = 0 set_counter ob_engaged 0 set_counter ob_under_fire 0 set_counter ob_repeat_test 1 end_if end_if if I_CompareCounter ob_engaged < 1 if I_CompareCounter ob_repeat_test = 3 set_counter ob_repeat_test 2 set_counter ob_under_fire 0 set_counter ob_engaged 0 end_if if I_CompareCounter ob_repeat_test < 3 set_counter ob_repeat_test 1 set_counter ob_under_fire 0 set_counter ob_engaged 0 end_if end_if end_if if I_CompareCounter ob_under_fire > 0 if I_CompareCounter ob_engaged > 0 if I_CompareCounter ob_repeat_test = 3 set_counter ob_repeat_test 4 end_if if I_CompareCounter ob_repeat_test = 2 set_counter ob_engaged 0 set_counter ob_repeat_test 3 end_if if I_CompareCounter ob_repeat_test < 2 set_counter ob_under_fire 0 set_counter ob_engaged 0 set_counter ob_repeat_test 2 end_if end_if if I_CompareCounter ob_engaged < 1 if I_CompareCounter ob_repeat_test = 3

set_counter ob_repeat_test 4 end_if if I_CompareCounter ob_repeat_test = 2 set_counter ob_repeat_test 3 end_if if I_CompareCounter ob_repeat_test = 1 set_counter ob_under_fire 0 set_counter ob_repeat_test 2 end_if if I_CompareCounter ob_repeat_test = 0 set_counter ob_under_fire 0 set_counter ob_repeat_test 1 end_if end_if end_if if I_CompareCounter ob_repeat_test = 4 if I_CompareCounter ob_under_fire < 1 and I_CompareCounter ob_engaged < 1 set_counter ob_under_fire 0 set_counter ob_engaged 0 set_counter ob_defend 3 set_counter ob_repeat_test 2 end_if if I_CompareCounter ob_under_fire > 0 ai_gta_plan_set 1 ATTACK_ALL set_counter ob_under_fire 0 set_counter ob_engaged 0 set_counter ob_defend 4 set_counter ob_repeat_test 0 set_counter ob_defense_launch 0 end_if if I_CompareCounter ob_engaged > 0 ai_gta_plan_set 1 ATTACK_ALL set_counter set_counter set_counter set_counter set_counter end_if end_if if I_CompareCounter ob_defend = 3 set_counter ob_defend 2 end_if battle_wait 15 end_monitor ;;;;;;; Protect General monitor_event BattleBattleGatesDestroyedByEngine TrueCondition and I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker and I_BattleEnemyArmyNumberOfMountClass elephant > 0 ob_under_fire 0 ob_engaged 0 ob_defend 4 ob_repeat_test 0 ob_defense_launch 0

if I_CompareCounter elephant_gate = 1 set_counter elephant_gate 0 set_counter rally_walls 1 end_if if I_CompareCounter second_ring = 1 and I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel > 2 set_counter second_ring 0 set_counter rally_walls 2 end_if if I_CompareCounter third_ring = 1 and I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel > 2 set_counter third_ring 0 set_counter del_objective 1 end_if end_monitor monitor_event BattleWallsCaptured TrueCondition and I_CompareCounter third_ring = 1 and I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker and I_BattleEnemyArmyNumberOfMountClass elephant > 0 if I_CompareCounter elephant_gate = 1 set_counter elephant_gate 0 set_counter rally_walls 1 end_if if I_CompareCounter second_ring = 1 and I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel > 2 set_counter second_ring 0 set_counter rally_walls 2 end_if if I_CompareCounter third_ring = 1 and I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel > 2 set_counter third_ring 0 set_counter del_objective 1 end_if end_monitor monitor_event BattleWallsBreachedByEngine TrueCondition and I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker and I_BattleEnemyArmyNumberOfMountClass elephant > 0 if I_CompareCounter elephant_gate = 1 ai_gta_del_objective 0 set_counter elephant_gate 2 set_counter rally_walls 0 end_if if I_CompareCounter second_ring = 1

and I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel > 2 ai_gta_del_objective 0 set_counter second_ring 2 set_counter rally_walls 2 end_if if I_CompareCounter third_ring = 1 and I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel > 2 set_counter third_ring 0 set_counter del_objective 1 end_if end_monitor monitor_event BattleBattleGatesDestroyedByEngine TrueCondition and I_CompareCounter protect_general = 1 and I_BattleIsSiegeBattle 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_BattleIsSiegeBattle 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_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker set_counter protect_general 0 set_counter general_wait 1 end_monitor monitor_conditions I_BattleStarted and I_BattleIsSiegeBattle and I_CompareCounter general_wait = 1 and I_IsUnitMoveFastSet a2u1 and I_BattleEnemyArmyNumberOfUnitCategory cavalry > 0 battle_wait 0.5 unit_order_halt a2u1 if I_CompareCounter enemy_unit_count < 7 set_counter general_wait 2 battle_wait 20 if I_BattleIsSiegeBattle and I_CompareCounter general_wait = 2 set_counter general_wait 3 battle_wait 20 end_if end_if

if I_CompareCounter enemy_unit_count > 6 and I_CompareCounter enemy_unit_count < 12 set_counter general_wait 2 battle_wait 25 if I_BattleIsSiegeBattle and I_CompareCounter general_wait = 2 set_counter general_wait 3 battle_wait 25 end_if end_if if I_CompareCounter enemy_unit_count > 11 and I_CompareCounter enemy_unit_count < 16 set_counter general_wait 2 battle_wait 30 if I_BattleIsSiegeBattle and I_CompareCounter general_wait = 2 set_counter general_wait 3 battle_wait 30 end_if end_if if I_CompareCounter enemy_unit_count > 15 set_counter general_wait 2 battle_wait 35 if I_BattleIsSiegeBattle and I_CompareCounter general_wait = 2 set_counter general_wait 3 battle_wait 35 end_if end_if if I_BattleIsSiegeBattle and I_CompareCounter general_wait = 3 set_counter general_wait 9 release_unit a2u1 end_if end_monitor monitor_conditions I_BattleStarted and I_CompareCounter general_wait > 1 and I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker and I_UnitEnemyUnitInRadius a2u1 60 set_counter general_wait 0 release_unit a2u1 end_monitor ;;;;;;;General Stop monitor_conditions I_BattleStarted and I_CompareCounter g_stop = 1 and I_CompareCounter open_battle = 1 and I_BattleEnemyArmyNumberOfUnits > 2 and ! I_BattlePlayerArmyIsAttacker and I_BattleAiAttacking and I_UnitEnemyUnitInRadius a2u1 120 set_counter g_stop 2 label_unit 1 0 0 a2u1 battle_wait 0.1 unit_order_halt a2u1

if I_BattleEnemyArmyNumberOfUnits > 5 battle_wait 30 end_if if I_BattleEnemyArmyNumberOfUnits < 6 battle_wait 15 end_if if ! I_BattlePlayerArmyIsAttacker and I_CompareCounter g_stop = 2 and I_BattleAiAttacking release_unit a2u1 set_counter g_stop 0 end_if end_monitor monitor_conditions I_BattleStarted and I_CompareCounter g_stop = 2 and I_CompareCounter open_battle = 1 and ! I_BattlePlayerArmyIsAttacker and I_UnitEnemyUnitInRad