You are on page 1of 407

;======================================================== ;===================== G5 BAI STUFF ===================== ;======================================================== ;### Germanicu5 ReallyBadAI Battle System Scrips v5.

x ;### This file contains manually programmed AI behaviour eliminating previously unfixable, hardcoded bugs and greatly influences battle performance ;### Support available at http://www.twcenter.net/forums/forumdisplay.php?f=1745 , http://www.twcenter.net/forums/showthread.php?t=257970 and http://www.twcente r.net/forums/showthread.php?t=253132 ;### Non-private use of code only by permission, ;### coded by Germanicu5 ;;;;;;;Print Info log always Germanicu5 ReallyBadAI v5.3 Running. Please upload log and savegames when reporting battle CTDs. monitor_event GameReloaded log always Germanicu5 ReallyBadAI v5.3 Running. Please upload log and savegames when reporting battle CTDs. end_monitor ;;;;;;; declare_counter fire_labels declare_counter panel_check declare_counter player_unit_count declare_counter enemy_unit_count declare_counter open_battle declare_counter labels_only declare_counter stakes_lock ;;;;;;;Checks declare_counter check_timer declare_counter elephant_fix_check declare_counter elephant_fix_check_sally declare_counter reinf_check declare_counter sally_defense_check declare_counter sally_check ;;;;;;;Stakes declare_counter label_ready declare_counter stakes_on ;;;;;;;Reinforcements declare_counter army4_ready declare_counter army4_ready_siege declare_counter army3_ready declare_counter army_moving declare_counter def_reinf_arrive declare_counter att_reinf_arrive declare_counter reinf_late declare_counter army4_run declare_counter army4_run_siege declare_counter army3_run declare_counter distance_trigger1 declare_counter distance_trigger2 declare_counter distance_trigger3 declare_counter distance_trigger4 declare_counter distance_trigger5 ;;;;;;;HA Fix declare_counter ha_fix ;;;;;;;Elephant Fix declare_counter elephant_fix declare_counter elephant_gate declare_counter elephant_gate_s

declare_counter elephant_gate_tier2 declare_counter elephant_gate_tier3 declare_counter elephant_gate_tier2s declare_counter elephant_gate_tier3s declare_counter rally_walls declare_counter rally_walls_s declare_counter second_ring declare_counter third_ring declare_counter second_ring_s declare_counter third_ring_s declare_counter del_objective declare_counter del_objective_s ;;;;;;;Sally-out declare_counter sally-out_fix declare_counter sally_defense declare_counter reform_back declare_counter reform_multi declare_counter unit_under_fire declare_counter kill_sally declare_counter sally_reinf declare_counter reset_position declare_counter defend_location declare_counter reset_army2 declare_counter assign_labels ;;;;;;;Siege declare_counter siege_fix declare_counter army_sieging declare_counter army_south declare_counter army_north declare_counter army_east declare_counter army_west declare_counter emergency_stop declare_counter omfg_cannon_tower declare_counter army2_sally declare_counter wall_advance_s ;;;;;;;Protect General declare_counter protect_general declare_counter general_wait declare_counter protect_siege declare_counter g_stop ;;;;;;;Sally-out, AI defending declare_counter army4_ready_sally declare_counter army4_location declare_counter path_n declare_counter path_ne declare_counter path_e declare_counter path_se declare_counter path_s declare_counter path_sw declare_counter path_w declare_counter path_nw declare_counter obstacle_check declare_counter label_army4 declare_counter army4_moving_s declare_counter army4_idle_s declare_counter line_passed declare_counter army2_idle_s declare_counter army4_idle_r declare_counter wall_line_passed declare_counter reset_position_s

declare_counter repeat_test1 declare_counter repeat_test2 declare_counter repeat_test3 declare_counter repeat_test4 declare_counter repeat_test5 declare_counter repeat_test6 ;;;;;;;Open Battles declare_counter ob_defense_launch declare_counter ob_defend declare_counter ob_siege_attack declare_counter ob_under_fire declare_counter ob_repeat_test declare_counter ob_engaged declare_counter player_units_closing declare_counter player_enveloping declare_counter player_engaged_reinf ;;;;;;;AI Stuck Fix declare_counter ai_stuck_launch declare_counter a2g1_stuck declare_counter a2u2_stuck declare_counter a2u3_stuck declare_counter a2u4_stuck declare_counter a2u5_stuck declare_counter a2u6_stuck declare_counter a2u7_stuck declare_counter a2u8_stuck declare_counter a2u9_stuck declare_counter a2u10_stuck declare_counter a2u11_stuck declare_counter a2u12_stuck declare_counter a2u13_stuck declare_counter a2u14_stuck declare_counter a2u15_stuck declare_counter a2u16_stuck declare_counter a2u17_stuck declare_counter a2u18_stuck declare_counter a2u19_stuck declare_counter a2u20_stuck declare_counter a2g1_status declare_counter a2u2_status declare_counter a2u3_status declare_counter a2u4_status declare_counter a2u5_status declare_counter a2u6_status declare_counter a2u7_status declare_counter a2u8_status declare_counter a2u9_status declare_counter a2u10_status declare_counter a2u11_status declare_counter a2u12_status declare_counter a2u13_status declare_counter a2u14_status declare_counter a2u15_status declare_counter a2u16_status declare_counter a2u17_status declare_counter a2u18_status declare_counter a2u19_status declare_counter a2u20_status declare_counter a2g1_distance declare_counter a2u2_distance

declare_counter a2u3_distance declare_counter a2u4_distance declare_counter a2u5_distance declare_counter a2u6_distance declare_counter a2u7_distance declare_counter a2u8_distance declare_counter a2u9_distance declare_counter a2u10_distance declare_counter a2u11_distance declare_counter a2u12_distance declare_counter a2u13_distance declare_counter a2u14_distance declare_counter a2u15_distance declare_counter a2u16_distance declare_counter a2u17_distance declare_counter a2u18_distance declare_counter a2u19_distance declare_counter a2u20_distance ;;;;;;;Custom Settlements ;;;;;;;Imladris AI declare_counter imladris_check declare_counter imladris_siege_check declare_counter imladris_sally_check declare_counter imladris_under_fire declare_counter terminate_imladris_check declare_counter melee_count ;;;;;;;Common declare_counter g1_missile declare_counter u2_missile declare_counter u3_missile declare_counter u4_missile declare_counter u5_missile declare_counter u6_missile declare_counter u7_missile declare_counter u8_missile declare_counter u9_missile declare_counter u10_missile declare_counter u11_missile declare_counter u12_missile declare_counter u13_missile declare_counter u14_missile declare_counter u15_missile declare_counter u16_missile declare_counter u17_missile declare_counter u18_missile declare_counter u19_missile declare_counter u20_missile declare_counter g1_lock declare_counter u2_lock declare_counter u3_lock declare_counter u4_lock declare_counter u5_lock declare_counter u6_lock declare_counter u7_lock declare_counter u8_lock declare_counter u9_lock declare_counter u10_lock declare_counter u11_lock declare_counter u12_lock declare_counter u13_lock

declare_counter u14_lock declare_counter u15_lock declare_counter u16_lock declare_counter u17_lock declare_counter u18_lock declare_counter u19_lock declare_counter u20_lock declare_counter g1_attacking declare_counter u2_attacking declare_counter u3_attacking declare_counter u4_attacking declare_counter u5_attacking declare_counter u6_attacking declare_counter u7_attacking declare_counter u8_attacking declare_counter u9_attacking declare_counter u10_attacking declare_counter u11_attacking declare_counter u12_attacking declare_counter u13_attacking declare_counter u14_attacking declare_counter u15_attacking declare_counter u16_attacking declare_counter u17_attacking declare_counter u18_attacking declare_counter u19_attacking declare_counter u20_attacking ;;;;;;; set_event_counter no_advice 1 monitor_event PreFactionTurnStart FactionIsLocal and I_CompareCounter panel_check != 1 set_counter panel_check 1 set_counter imladris_check 0 end_monitor monitor_event GeneralAssaultsGeneral TargetFactionIsLocal and I_CompareCounter panel_check != 1 set_counter panel_check 1 set_counter imladris_check 0 end_monitor monitor_event GeneralAssaultsGeneral ! FactionIsLocal and ! TargetFactionIsLocal and I_CompareCounter panel_check != 2 set_counter panel_check 2 set_counter imladris_check 0 end_monitor monitor_event GeneralAssaultsResidence TargetFactionIsLocal and I_CompareCounter panel_check != 1 set_counter panel_check 1 set_counter imladris_check 0 end_monitor monitor_event GeneralAssaultsResidence ! FactionIsLocal

and ! TargetFactionIsLocal and I_CompareCounter panel_check != 2 set_counter panel_check 2 set_counter imladris_check 0 end_monitor monitor_event GeneralAssaultsResidence ! FactionIsLocal and TargetFactionIsLocal and IsRegionOneOf Imladris_Province and RegionIsLocal and I_SettlementUnderSiege Imladris and InEnemyLands ; and RemainingMPPercentage = 100 and I_CompareCounter panel_check != 2 set_counter imladris_check 1 end_monitor monitor_event GeneralAssaultsGeneral FactionIsLocal and ! TargetFactionIsLocal and IsRegionOneOf Imladris_Province and RegionIsLocal and I_SettlementUnderSiege Imladris and ! InEnemyLands and RemainingMPPercentage = 100 and I_CompareCounter panel_check != 2 set_counter imladris_check 1 end_monitor monitor_event ButtonPressed ButtonPressed prebattle_fight_button and I_CompareCounter panel_check = 1 ; suspend_unscripted_advice true set_counter fire_labels 10 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; set_counter player_unit_count 0 set_counter enemy_unit_count 0 set_counter open_battle 0 set_counter labels_only 0 set_counter stakes_lock 0 ;;;;;;;Checks set_counter check_timer 0 set_counter elephant_fix_check 0 set_counter elephant_fix_check_sally 0 set_counter reinf_check 0 set_counter sally_defense_check 0 ;;;;;;;Stakes set_counter label_ready 0 set_counter stakes_on 0 ;;;;;;;Reinforcements set_counter army4_ready 0 set_counter army4_ready_siege 0 set_counter army3_ready 0 set_counter army_moving 0 set_counter def_reinf_arrive 0 set_counter att_reinf_arrive 0 set_counter reinf_late 0 set_counter army4_run 0 set_counter army4_run_siege 0

set_counter army3_run 0 set_counter distance_trigger1 0 set_counter distance_trigger2 0 set_counter distance_trigger3 0 set_counter distance_trigger4 0 set_counter distance_trigger5 0 ;;;;;;;HA Fix set_counter ha_fix 0 ;;;;;;;Elephant Fix set_counter elephant_fix 0 set_counter elephant_gate 0 set_counter elephant_gate_s 0 set_counter elephant_gate_tier2 0 set_counter elephant_gate_tier3 0 set_counter elephant_gate_tier2s 0 set_counter elephant_gate_tier3s 0 set_counter rally_walls 0 set_counter rally_walls_s 0 set_counter second_ring 0 set_counter third_ring 0 set_counter second_ring_s 0 set_counter third_ring_s 0 set_counter del_objective 0 set_counter del_objective_s 0 ;;;;;;;Sally-out set_counter sally-out_fix 0 set_counter sally_defense 0 set_counter reform_back 0 set_counter reform_multi 0 set_counter unit_under_fire 0 set_counter kill_sally 0 set_counter sally_reinf 0 set_counter reset_position 0 set_counter defend_location 0 set_counter reset_army2 0 set_counter assign_labels 0 ;;;;;;;Siege set_counter siege_fix 0 set_counter army_sieging 0 set_counter army_south 0 set_counter army_north 0 set_counter army_east 0 set_counter army_west 0 set_counter emergency_stop 0 set_counter omfg_cannon_tower 0 set_counter army2_sally 0 set_counter wall_advance_s 0 ;;;;;;;Protect General set_counter protect_general 0 set_counter general_wait 0 set_counter protect_siege 0 set_counter g_stop 0 ;;;;;;;Sally-out, AI defending set_counter army4_ready_sally 0 set_counter army4_location 0 set_counter path_n 0 set_counter path_ne 0 set_counter path_e 0 set_counter path_se 0 set_counter path_s 0

set_counter path_sw 0 set_counter path_w 0 set_counter path_nw 0 set_counter obstacle_check 0 set_counter label_army4 0 set_counter army4_moving_s 0 set_counter army4_idle_s 0 set_counter line_passed 0 set_counter army2_idle_s 0 set_counter army4_idle_r 0 set_counter wall_line_passed 0 set_counter reset_position_s 0 set_counter repeat_test1 0 set_counter repeat_test2 0 set_counter repeat_test3 0 set_counter repeat_test4 0 set_counter repeat_test5 0 set_counter repeat_test6 0 ;;;;;;;Open Battles set_counter ob_defense_launch 0 set_counter ob_defend 0 set_counter ob_siege_attack 0 set_counter ob_under_fire 0 set_counter ob_repeat_test 0 set_counter ob_engaged 0 set_counter player_units_closing 0 set_counter player_enveloping 0 set_counter player_engaged_reinf 0 ;;;;;;;AI Stuck Fix set_counter ai_stuck_launch 0 set_counter a2g1_stuck 0 set_counter a2u2_stuck 0 set_counter a2u3_stuck 0 set_counter a2u4_stuck 0 set_counter a2u5_stuck 0 set_counter a2u6_stuck 0 set_counter a2u7_stuck 0 set_counter a2u8_stuck 0 set_counter a2u9_stuck 0 set_counter a2u10_stuck 0 set_counter a2u11_stuck 0 set_counter a2u12_stuck 0 set_counter a2u13_stuck 0 set_counter a2u14_stuck 0 set_counter a2u15_stuck 0 set_counter a2u16_stuck 0 set_counter a2u17_stuck 0 set_counter a2u18_stuck 0 set_counter a2u19_stuck 0 set_counter a2u20_stuck 0 set_counter a2g1_status 0 set_counter a2u2_status 0 set_counter a2u3_status 0 set_counter a2u4_status 0 set_counter a2u5_status 0 set_counter a2u6_status 0 set_counter a2u7_status 0 set_counter a2u8_status 0 set_counter a2u9_status 0 set_counter a2u10_status 0

set_counter a2u11_status 0 set_counter a2u12_status 0 set_counter a2u13_status 0 set_counter a2u14_status 0 set_counter a2u15_status 0 set_counter a2u16_status 0 set_counter a2u17_status 0 set_counter a2u18_status 0 set_counter a2u19_status 0 set_counter a2u20_status 0 set_counter a2g1_distance 0 set_counter a2u2_distance 0 set_counter a2u3_distance 0 set_counter a2u4_distance 0 set_counter a2u5_distance 0 set_counter a2u6_distance 0 set_counter a2u7_distance 0 set_counter a2u8_distance 0 set_counter a2u9_distance 0 set_counter a2u10_distance 0 set_counter a2u11_distance 0 set_counter a2u12_distance 0 set_counter a2u13_distance 0 set_counter a2u14_distance 0 set_counter a2u15_distance 0 set_counter a2u16_distance 0 set_counter a2u17_distance 0 set_counter a2u18_distance 0 set_counter a2u19_distance 0 set_counter a2u20_distance 0 ;;;;;;;Custom Settlements ;;;;;;;Imladris AI set_counter imladris_siege_check 0 set_counter imladris_sally_check 0 set_counter imladris_under_fire 0 set_counter terminate_imladris_check 0 set_counter melee_count 0 ;;;;;;;Common set_counter g1_missile 0 set_counter u2_missile 0 set_counter u3_missile 0 set_counter u4_missile 0 set_counter u5_missile 0 set_counter u6_missile 0 set_counter u7_missile 0 set_counter u8_missile 0 set_counter u9_missile 0 set_counter u10_missile 0 set_counter u11_missile 0 set_counter u12_missile 0 set_counter u13_missile 0 set_counter u14_missile 0 set_counter u15_missile 0 set_counter u16_missile 0 set_counter u17_missile 0 set_counter u18_missile 0 set_counter u19_missile 0 set_counter u20_missile 0 set_counter g1_lock 0 set_counter u2_lock 0

set_counter u3_lock 0 set_counter u4_lock 0 set_counter u5_lock 0 set_counter u6_lock 0 set_counter u7_lock 0 set_counter u8_lock 0 set_counter u9_lock 0 set_counter u10_lock 0 set_counter u11_lock 0 set_counter u12_lock 0 set_counter u13_lock 0 set_counter u14_lock 0 set_counter u15_lock 0 set_counter u16_lock 0 set_counter u17_lock 0 set_counter u18_lock 0 set_counter u19_lock 0 set_counter u20_lock 0 set_counter g1_attacking 0 set_counter u2_attacking 0 set_counter u3_attacking 0 set_counter u4_attacking 0 set_counter u5_attacking 0 set_counter u6_attacking 0 set_counter u7_attacking 0 set_counter u8_attacking 0 set_counter u9_attacking 0 set_counter u10_attacking 0 set_counter u11_attacking 0 set_counter u12_attacking 0 set_counter u13_attacking 0 set_counter u14_attacking 0 set_counter u15_attacking 0 set_counter u16_attacking 0 set_counter u17_attacking 0 set_counter u18_attacking 0 set_counter u19_attacking 0 set_counter u20_attacking 0 prepare_for_battle end_monitor monitor_conditions I_InBattle and I_CompareCounter fire_labels = 10 set_counter fire_labels 0 battle_wait 0.1 if ! I_BattleIsSiegeBattle set_counter fire_labels 1 end_if if I_BattleIsSiegeBattle and I_BattleEnemyArmyNumberOfMountClass elephant > 0 set_counter fire_labels 1 end_if if I_BattlePlayerArmyIsAttacker ;;;Army 1 set_counter player_unit_count 0

if I_BattlePlayerArmyNumberOfUnits label_unit 0 0 0 a1g1 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 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

> 0 > 1 > 2 > 3 > 4 > 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 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if if I_BattlePlayerArmyIsAttacker and ! I_BattleIsSiegeBattle ;;;Army 2 set_counter enemy_unit_count 0 if I_BattleEnemyArmyNumberOfUnits label_unit 1 0 0 a2g1 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 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

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

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 end_if end_if end_if end_if end_if end_if end_if if I_BattlePlayerArmyIsAttacker

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

if I_BattlePlayerArmyNumberOfUnits = 1 define_unit_group army1 a1g1 end_if if I_BattlePlayerArmyNumberOfUnits = 2 define_unit_group army1 a1g1 a1u2 end_if if I_BattlePlayerArmyNumberOfUnits = 3 define_unit_group army1 a1g1 a1u2 a1u3 end_if if I_BattlePlayerArmyNumberOfUnits = 4 define_unit_group army1 a1g1 a1u2 a1u3 a1u4

end_if if I_BattlePlayerArmyNumberOfUnits = 5 define_unit_group army1 a1g1 a1u2 a1u3 a1u4 end_if if I_BattlePlayerArmyNumberOfUnits = 6 define_unit_group army1 a1g1 a1u2 a1u3 a1u4 end_if if I_BattlePlayerArmyNumberOfUnits = 7 define_unit_group army1 a1g1 a1u2 a1u3 a1u4 end_if if I_BattlePlayerArmyNumberOfUnits = 8 define_unit_group army1 a1g1 a1u2 a1u3 a1u4 end_if if I_BattlePlayerArmyNumberOfUnits = 9 define_unit_group army1 a1g1 a1u2 a1u3 a1u4 end_if if I_BattlePlayerArmyNumberOfUnits = 10 define_unit_group army1 a1g1 a1u2 a1u3 a1u4 end_if if I_BattlePlayerArmyNumberOfUnits = 11 define_unit_group army1 a1g1 a1u2 a1u3 a1u4 1u11

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

end_if if I_BattlePlayerArmyNumberOfUnits = 12 define_unit_group army1 a1g1 a1u2 a1u3 a1u4 a1u5 1u11 a1u12 end_if if I_BattlePlayerArmyNumberOfUnits = 13 define_unit_group army1 a1g1 a1u2 a1u3 a1u4 a1u5 1u11 a1u12 a1u13 end_if if I_BattlePlayerArmyNumberOfUnits = 14 define_unit_group army1 a1g1 a1u2 a1u3 a1u4 a1u5 1u11 a1u12 a1u13 a1u14 end_if if I_BattlePlayerArmyNumberOfUnits = 15 define_unit_group army1 a1g1 a1u2 a1u3 a1u4 a1u5 1u11 a1u12 a1u13 a1u14 a1u15 end_if if I_BattlePlayerArmyNumberOfUnits = 16 define_unit_group army1 a1g1 a1u2 a1u3 a1u4 a1u5 1u11 a1u12 a1u13 a1u14 a1u15 a1u16 end_if if I_BattlePlayerArmyNumberOfUnits = 17 define_unit_group army1 a1g1 a1u2 a1u3 a1u4 a1u5 1u11 a1u12 a1u13 a1u14 a1u15 a1u16 a1u17 end_if if I_BattlePlayerArmyNumberOfUnits = 18 define_unit_group army1 a1g1 a1u2 a1u3 a1u4 a1u5 1u11 a1u12 a1u13 a1u14 a1u15 a1u16 a1u17 a1u18 end_if if I_BattlePlayerArmyNumberOfUnits = 19 define_unit_group army1 a1g1 a1u2 a1u3 a1u4 a1u5 1u11 a1u12 a1u13 a1u14 a1u15 a1u16 a1u17 a1u18 a1u19 end_if if I_BattlePlayerArmyNumberOfUnits = 20 define_unit_group army1 a1g1 a1u2 a1u3 a1u4 a1u5 1u11 a1u12 a1u13 a1u14 a1u15 a1u16 a1u17 a1u18 a1u19 end_if end_if

a1u6 a1u7 a1u8 a1u9 a1u10 a

a1u6 a1u7 a1u8 a1u9 a1u10 a

a1u6 a1u7 a1u8 a1u9 a1u10 a

a1u6 a1u7 a1u8 a1u9 a1u10 a

a1u6 a1u7 a1u8 a1u9 a1u10 a

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

if I_BattlePlayerArmyIsAttacker and ! I_BattleIsSiegeBattle if I_BattleEnemyArmyNumberOfUnits = 1 define_unit_group army2 a2g1 end_if if I_BattleEnemyArmyNumberOfUnits = 2 define_unit_group army2 a2g1 a2u2 end_if if I_BattleEnemyArmyNumberOfUnits = 3 define_unit_group army2 a2g1 a2u2 a2u3 end_if if I_BattleEnemyArmyNumberOfUnits = 4 define_unit_group army2 a2g1 a2u2 a2u3 end_if if I_BattleEnemyArmyNumberOfUnits = 5 define_unit_group army2 a2g1 a2u2 a2u3 end_if if I_BattleEnemyArmyNumberOfUnits = 6 define_unit_group army2 a2g1 a2u2 a2u3 end_if if I_BattleEnemyArmyNumberOfUnits = 7 define_unit_group army2 a2g1 a2u2 a2u3 end_if if I_BattleEnemyArmyNumberOfUnits = 8 define_unit_group army2 a2g1 a2u2 a2u3 end_if if I_BattleEnemyArmyNumberOfUnits = 9 define_unit_group army2 a2g1 a2u2 a2u3 end_if if I_BattleEnemyArmyNumberOfUnits = 10 define_unit_group army2 a2g1 a2u2 a2u3 end_if if I_BattleEnemyArmyNumberOfUnits = 11 define_unit_group army2 a2g1 a2u2 a2u3 2u11 end_if if I_BattleEnemyArmyNumberOfUnits = 12 define_unit_group army2 a2g1 a2u2 a2u3 2u11 a2u12 end_if if I_BattleEnemyArmyNumberOfUnits = 13 define_unit_group army2 a2g1 a2u2 a2u3 2u11 a2u12 a2u13 end_if if I_BattleEnemyArmyNumberOfUnits = 14 define_unit_group army2 a2g1 a2u2 a2u3 2u11 a2u12 a2u13 a2u14 end_if if I_BattleEnemyArmyNumberOfUnits = 15 define_unit_group army2 a2g1 a2u2 a2u3 2u11 a2u12 a2u13 a2u14 a2u15 end_if if I_BattleEnemyArmyNumberOfUnits = 16 define_unit_group army2 a2g1 a2u2 a2u3 2u11 a2u12 a2u13 a2u14 a2u15 a2u16 end_if if I_BattleEnemyArmyNumberOfUnits = 17 define_unit_group army2 a2g1 a2u2 a2u3 2u11 a2u12 a2u13 a2u14 a2u15 a2u16 a2u17

a2u4 a2u4 a2u5 a2u4 a2u5 a2u6 a2u4 a2u5 a2u6 a2u7 a2u4 a2u5 a2u6 a2u7 a2u8 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a

a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a

a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a

a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a

a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a

a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a

a2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 a

end_if if I_BattleEnemyArmyNumberOfUnits = 18 define_unit_group army2 a2g1 a2u2 a2u3 a2u4 a2u5 2u11 a2u12 a2u13 a2u14 a2u15 a2u16 a2u17 a2u18 end_if if I_BattleEnemyArmyNumberOfUnits = 19 define_unit_group army2 a2g1 a2u2 a2u3 a2u4 a2u5 2u11 a2u12 a2u13 a2u14 a2u15 a2u16 a2u17 a2u18 a2u19 end_if if I_BattleEnemyArmyNumberOfUnits = 20 define_unit_group army2 a2g1 a2u2 a2u3 a2u4 a2u5 2u11 a2u12 a2u13 a2u14 a2u15 a2u16 a2u17 a2u18 a2u19 end_if end_if if ! I_BattlePlayerArmyIsAttacker ;;;Army 1 set_counter enemy_unit_count 0 if I_BattleEnemyArmyNumberOfUnits > 0 label_unit 0 0 0 a1g1 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits > 1 label_unit 0 0 1 a1u2 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits > 2 label_unit 0 0 2 a1u3 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits > 3 label_unit 0 0 3 a1u4 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits > 4 label_unit 0 0 4 a1u5 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits > 5 label_unit 0 0 5 a1u6 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits > 6 label_unit 0 0 6 a1u7 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits > 7 label_unit 0 0 7 a1u8 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits > 8 label_unit 0 0 8 a1u9 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits > 9 label_unit 0 0 9 a1u10 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits > 10 label_unit 0 0 10 a1u11 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits > 11 label_unit 0 0 11 a1u12 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits > 12 label_unit 0 0 12 a1u13 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits > 13 label_unit 0 0 13 a1u14 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits > 14

a2u6 a2u7 a2u8 a2u9 a2u10 a

a2u6 a2u7 a2u8 a2u9 a2u10 a

a2u6 a2u7 a2u8 a2u9 a2u10 a a2u20

label_unit 0 0 14 a1u15 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 0 0 15 a1u16 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 0 0 16 a1u17 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 0 0 17 a1u18 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 0 0 18 a1u19 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 0 0 19 a1u20 inc_counter enemy_unit_count 1 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if ;;;Army 2 set_counter player_unit_count 0 if I_BattlePlayerArmyNumberOfUnits label_unit 1 0 0 a2g1 inc_counter player_unit_count 1 if I_BattlePlayerArmyNumberOfUnits label_unit 1 0 1 a2u2 inc_counter player_unit_count 1 if I_BattlePlayerArmyNumberOfUnits label_unit 1 0 2 a2u3 inc_counter player_unit_count 1 if I_BattlePlayerArmyNumberOfUnits label_unit 1 0 3 a2u4 inc_counter player_unit_count 1 if I_BattlePlayerArmyNumberOfUnits label_unit 1 0 4 a2u5 inc_counter player_unit_count 1 if I_BattlePlayerArmyNumberOfUnits label_unit 1 0 5 a2u6 inc_counter player_unit_count 1 if I_BattlePlayerArmyNumberOfUnits label_unit 1 0 6 a2u7

> 15 > 16 > 17 > 18 = 20

> 0 > 1 > 2 > 3 > 4 > 5 > 6

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

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

if I_BattleEnemyArmyNumberOfUnits define_unit_group army1 a1g1 end_if if I_BattleEnemyArmyNumberOfUnits define_unit_group army1 a1g1 a1u2 end_if if I_BattleEnemyArmyNumberOfUnits define_unit_group army1 a1g1 a1u2 end_if if I_BattleEnemyArmyNumberOfUnits define_unit_group army1 a1g1 a1u2 end_if if I_BattleEnemyArmyNumberOfUnits define_unit_group army1 a1g1 a1u2 end_if if I_BattleEnemyArmyNumberOfUnits define_unit_group army1 a1g1 a1u2 end_if if I_BattleEnemyArmyNumberOfUnits define_unit_group army1 a1g1 a1u2 end_if if I_BattleEnemyArmyNumberOfUnits define_unit_group army1 a1g1 a1u2 end_if if I_BattleEnemyArmyNumberOfUnits define_unit_group army1 a1g1 a1u2 end_if if I_BattleEnemyArmyNumberOfUnits define_unit_group army1 a1g1 a1u2 end_if if I_BattleEnemyArmyNumberOfUnits define_unit_group army1 a1g1 a1u2 1u11

= 1 = 2 = 3 a1u3 = 4 a1u3 a1u4 = 5 a1u3 a1u4 a1u5 = 6 a1u3 a1u4 a1u5 a1u6 = 7 a1u3 a1u4 a1u5 a1u6 a1u7 = 8 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 = 9 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 = 10 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 = 11 a1u3 a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a

end_if if I_BattleEnemyArmyNumberOfUnits = 12 define_unit_group army1 a1g1 a1u2 a1u3 1u11 a1u12 end_if if I_BattleEnemyArmyNumberOfUnits = 13 define_unit_group army1 a1g1 a1u2 a1u3 1u11 a1u12 a1u13 end_if if I_BattleEnemyArmyNumberOfUnits = 14 define_unit_group army1 a1g1 a1u2 a1u3 1u11 a1u12 a1u13 a1u14 end_if if I_BattleEnemyArmyNumberOfUnits = 15 define_unit_group army1 a1g1 a1u2 a1u3 1u11 a1u12 a1u13 a1u14 a1u15 end_if if I_BattleEnemyArmyNumberOfUnits = 16 define_unit_group army1 a1g1 a1u2 a1u3 1u11 a1u12 a1u13 a1u14 a1u15 a1u16 end_if if I_BattleEnemyArmyNumberOfUnits = 17 define_unit_group army1 a1g1 a1u2 a1u3 1u11 a1u12 a1u13 a1u14 a1u15 a1u16 a1u17 end_if if I_BattleEnemyArmyNumberOfUnits = 18

a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a

a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a

a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a

a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a

a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a

a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 a

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

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

a2u6 a2u7 a2u8 a2u9 a2u10 a

a2u6 a2u7 a2u8 a2u9 a2u10 a

end_if if I_BattlePlayerArmyNumberOfUnits = 16 define_unit_group army2 a2g1 a2u2 a2u3 a2u4 a2u5 2u11 a2u12 a2u13 a2u14 a2u15 a2u16 end_if if I_BattlePlayerArmyNumberOfUnits = 17 define_unit_group army2 a2g1 a2u2 a2u3 a2u4 a2u5 2u11 a2u12 a2u13 a2u14 a2u15 a2u16 a2u17 end_if if I_BattlePlayerArmyNumberOfUnits = 18 define_unit_group army2 a2g1 a2u2 a2u3 a2u4 a2u5 2u11 a2u12 a2u13 a2u14 a2u15 a2u16 a2u17 a2u18 end_if if I_BattlePlayerArmyNumberOfUnits = 19 define_unit_group army2 a2g1 a2u2 a2u3 a2u4 a2u5 2u11 a2u12 a2u13 a2u14 a2u15 a2u16 a2u17 a2u18 a2u19 end_if if I_BattlePlayerArmyNumberOfUnits = 20 define_unit_group army2 a2g1 a2u2 a2u3 a2u4 a2u5 2u11 a2u12 a2u13 a2u14 a2u15 a2u16 a2u17 a2u18 a2u19 end_if end_if ; battle_wait 0.1 ; ai_active_set off battle_wait 0.1 ai_active_set on set_counter labels_only 1 if I_BattleIsSiegeBattle and I_BattlePlayerArmyIsAttacker set_counter ai_stuck_launch 1 end_if

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_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker and I_BattlePlayerArmyNumberOfAttribute stakes > 0 set_counter stakes_lock 1 end_if if I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker and I_BattleEnemyArmyNumberOfSpecialAbility rally > 0 set_counter protect_siege 1 end_if if ! I_BattleIsSiegeBattle and ! I_BattleIsSallyOutBattle and ! I_BattleIsRiverBattle and ! I_ConflictType SuccessfulAmbush set_counter open_battle 1 end_if if I_BattleEnemyArmyNumberOfAttribute stakes > 0 and I_BattleIsSiegeBattle and I_CompareCounter fire_labels = 0 set_counter label_ready 1 end_if if I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker

and I_CompareCounter imladris_check = 1 set_counter fire_labels 0 set_counter imladris_siege_check 1 end_if if I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker and I_CompareCounter imladris_check = 1 set_counter fire_labels 0 ai_gta_plan_set 1 ATTACK_SETTLEMENT set_counter imladris_sally_check 1 end_if if I_CompareCounter fire_labels = 1 if I_BattleIsSiegeBattle label_location 0, -850, south_side label_location 0, 850, north_side label_location -850, 0, west_side label_location 850, 0, east_side end_if if I_BattleIsSallyOutBattle label_location 0, -850, south_side label_location 0, 850, north_side label_location -850, 0, west_side label_location 850, 0, east_side end_if if I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker label_location -470, -470, sw label_location 470, -470, se label_location -470, 470, nw label_location 470, 470, ne label_location -400, -400, sw_wall label_location 400, -400, se_wall label_location -400, 400, nw_wall label_location 400, 400, ne_wall end_if if I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker and I_UnitDistanceFromLine a1g1 west_side east_side > set_counter army_south 1 end_if if I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker and I_UnitDistanceFromLine a1g1 west_side east_side < set_counter army_north 1 end_if if I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker and I_UnitDistanceFromLine a1g1 south_side north_side set_counter army_east 1 end_if if I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker and I_UnitDistanceFromLine a1g1 south_side north_side

200

-200

> 200

< -200

set_counter army_west 1 end_if if I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker and I_UnitDistanceFromLine a2g1 west_side east_side > set_counter army_south 1 end_if if I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker and I_UnitDistanceFromLine a2g1 west_side east_side < set_counter army_north 1 end_if if I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker and I_UnitDistanceFromLine a2g1 south_side north_side set_counter army_east 1 end_if if I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker and I_UnitDistanceFromLine a2g1 south_side north_side set_counter army_west 1 end_if if I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker set_counter sally-out_fix 1 end_if if I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker set_counter siege_fix 1 end_if if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_BattleIsSiegeBattle set_counter elephant_fix 1 end_if if I_BattleEnemyArmyNumberOfAttribute stakes > 0 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 set_counter ob_defense_launch 1 end_if end_if end_monitor monitor_event BattleConflictPhaseCommenced FactionIsLocal and I_CompareCounter panel_check = 1 battle_wait 7 if ! I_BattleIsSiegeBattle and ! I_BattleIsSallyOutBattle and ! I_BattleIsRiverBattle

200

-200

> 200

< -200

and ! I_ConflictType SuccessfulAmbush and I_BattleEnemyArmyNumberOfUnits > 2 set_counter g_stop 1 end_if if I_BattleStarted and I_CompareCounter kill_sally = 0 and I_CompareCounter fire_labels = 1 and I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker set_counter sally_defense 1 set_counter assign_labels 1 end_if if I_BattleStarted and I_CompareCounter fire_labels = 1 and I_CompareCounter open_battle = 1 set_counter ha_fix 1 end_if if I_BattleStarted and I_CompareCounter fire_labels = 1 and I_BattleIsRiverBattle and ! I_BattlePlayerArmyIsAttacker set_counter ha_fix 1 end_if end_monitor monitor_event BattleReinforcementsArrive ! ArmyIsLocal ; and TargetArmyIsLocal and I_CompareCounter panel_check = 1 and I_CompareCounter fire_labels = 1 battle_wait 5.0 if ! I_BattlePlayerArmyIsAttacker ;;;Army 3 label_unit 0 1 0 a3g1 define_unit_group army33 a3g1 if ! I_PercentageUnitGroupKilled army33 = 100 undefine_unit_group army33 label_unit 0 1 0 a3g1 label_unit 0 1 1 a3u2 label_unit 0 1 2 a3u3 label_unit 0 1 3 a3u4 label_unit 0 1 4 a3u5 label_unit 0 1 5 a3u6 label_unit 0 1 6 a3u7 label_unit 0 1 7 a3u8 label_unit 0 1 8 a3u9 label_unit 0 1 9 a3u10 label_unit 0 1 10 a3u11 label_unit 0 1 11 a3u12 label_unit 0 1 12 a3u13 label_unit 0 1 13 a3u14 label_unit 0 1 14 a3u15 label_unit 0 1 15 a3u16 label_unit 0 1 16 a3u17 label_unit 0 1 17 a3u18 label_unit 0 1 18 a3u19 label_unit 0 1 19 a3u20

define_unit_group army3 a3g1 a3u2 a3u3 a3u4 a3u5 a3u6 a3u7 a3u8 a3u9 a3u10 a 3u11 a3u12 a3u13 a3u14 a3u15 a3u16 a3u17 a3u18 a3u19 a3u20 battle_wait 0.1 ai_active_set on end_if end_if if I_BattlePlayerArmyIsAttacker ;;;Army 4 label_unit 1 1 0 a4g1 define_unit_group army44 a4g1 if ! I_PercentageUnitGroupKilled army44 = 100 undefine_unit_group army44 label_unit 1 1 0 a4g1 label_unit 1 1 1 a4u2 label_unit 1 1 2 a4u3 label_unit 1 1 3 a4u4 label_unit 1 1 4 a4u5 label_unit 1 1 5 a4u6 label_unit 1 1 6 a4u7 label_unit 1 1 7 a4u8 label_unit 1 1 8 a4u9 label_unit 1 1 9 a4u10 label_unit 1 1 10 a4u11 label_unit 1 1 11 a4u12 label_unit 1 1 12 a4u13 label_unit 1 1 13 a4u14 label_unit 1 1 14 a4u15 label_unit 1 1 15 a4u16 label_unit 1 1 16 a4u17 label_unit 1 1 17 a4u18 label_unit 1 1 18 a4u19 label_unit 1 1 19 a4u20 define_unit_group army4 a4g1 a4u2 a4u3 a4u4 a4u5 a4u6 a4u7 a4u8 a4u9 a4u10 a 4u11 a4u12 a4u13 a4u14 a4u15 a4u16 a4u17 a4u18 a4u19 a4u20 battle_wait 0.1 ai_active_set on end_if end_if ;;;;;;;Reinforcements if I_BattlePlayerArmyIsAttacker and ! I_ConflictType SuccessfulAmbush and ! I_ConflictType FailedAmbush and ! I_PercentageUnitGroupKilled army4 = 100 set_counter reinf_check 1 ; counter filter commands battle_wait 20 if I_CompareCounter reinf_check = 1 set_counter def_reinf_arrive 1 end_if end_if if ! I_BattlePlayerArmyIsAttacker and ! I_ConflictType SuccessfulAmbush and ! I_ConflictType FailedAmbush and ! I_BattleIsSiegeBattle and ! I_PercentageUnitGroupKilled army3 = 100

set_counter reinf_check 2 battle_wait 20 if I_CompareCounter reinf_check = 2 set_counter att_reinf_arrive 1 end_if end_if end_monitor ;Normal; monitor_conditions I_BattleStarted and I_CompareCounter def_reinf_arrive = 1 and I_BattlePlayerArmyIsAttacker and ! I_ConflictType SuccessfulAmbush and ! I_ConflictType FailedAmbush and ! I_BattleIsSiegeBattle if ! I_BattleIsSallyOutBattle set_counter army4_ready 1 set_counter def_reinf_arrive 2 end_if if I_BattleIsSallyOutBattle set_counter army4_ready_sally 1 set_counter sally_reinf 1 set_counter def_reinf_arrive 0 end_if end_monitor ;Siege; monitor_conditions I_BattleStarted and I_CompareCounter def_reinf_arrive = 1 and I_BattlePlayerArmyIsAttacker and ! I_ConflictType SuccessfulAmbush and ! I_ConflictType FailedAmbush and I_BattleIsSiegeBattle set_counter army4_ready_siege 1 set_counter def_reinf_arrive 0 end_monitor ;Normal core monitor_conditions I_BattleStarted and I_CompareCounter army4_ready = 1 and I_CompareCounter army_moving = 0 and ! I_UnitEnemyUnitInRadius a4g1 160 and ! I_UnitGroupInRangeOfUnitGroup army2 army4 set_counter army4_run 1 set_counter army_moving 1 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army4_ready = 1 and I_CompareCounter army_moving = 1 and I_UnitEnemyUnitInRadius a4g1 160 and ! I_UnitGroupInRangeOfUnitGroup army2 army4 ; unit_group_order_halt army4 ai_active_set off

battle_wait 0.5 ai_active_set on set_counter army_moving 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter reinf_late = 1 and I_CompareCounter army4_ready = 1 and ! I_UnitEnemyUnitInRadius a4g1 160 and ! I_UnitGroupInRangeOfUnitGroup army2 army4 set_counter army4_run 1 set_counter army_moving 1 set_counter reinf_late 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army4_ready = 1 and I_CompareCounter army_moving = 1 and ! I_UnitEnemyUnitInRadius a4g1 160 and I_UnitDistanceFromUnit a2g1 a4g1 > 150 and I_IsUnitIdle a4g1 set_counter reinf_late 1 battle_wait 1 set_counter army_moving 1 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army4_ready = 1 and I_CompareCounter distance_trigger1 = 0 and I_UnitDistanceFromUnit a4g1 a2g1 < 1000 set_counter reinf_late 1 set_counter distance_trigger1 1 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army4_ready = 1 and I_CompareCounter distance_trigger2 = 0 and I_UnitDistanceFromUnit a4g1 a2g1 < 750 set_counter reinf_late 1 set_counter distance_trigger2 1 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army4_ready = 1 and I_CompareCounter distance_trigger3 = 0 and I_UnitDistanceFromUnit a4g1 a2g1 < 500 set_counter reinf_late 1 set_counter distance_trigger3 1 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army4_ready = 1 and I_CompareCounter distance_trigger4 = 0 and I_UnitDistanceFromUnit a4g1 a2g1 < 300

set_counter reinf_late 1 set_counter distance_trigger4 1 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army4_ready = 1 and I_CompareCounter distance_trigger5 = 0 and I_UnitDistanceFromUnit a4g1 a2g1 < 200 set_counter reinf_late 1 set_counter distance_trigger5 1 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army4_run = 1 ; and ! I_BattleIsSallyOutBattle label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 a4g1 1 a4u2 2 a4u3 3 a4u4 4 a4u5 5 a4u6 6 a4u7 7 a4u8 8 a4u9 9 a4u10 10 a4u11 11 a4u12 12 a4u13 13 a4u14 14 a4u15 15 a4u16 16 a4u17 17 a4u18 18 a4u19 19 a4u20

unit_group_order_halt army4 battle_wait 0.5 unit_group_move_to_missile_range_of_unit army4 a2g1 run set_counter army4_run 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army4_ready = 1 and I_UnitDistanceFromUnit a4g1 a2g1 < 180 and I_UnitEnemyUnitInRadius a2g1 100 set_counter army4_ready 0 unit_group_order_halt army4 battle_wait 0.5 ai_active_set on end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army4_ready = 1 and I_UnitDistanceFromUnit a4g1 a2g1 < 100

set_counter army4_ready 0 unit_group_order_halt army4 battle_wait 0.5 ai_active_set on end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army4_ready = 1 and I_PercentageUnitKilled a4g1 > 60 set_counter army4_ready 0 unit_group_order_halt army4 battle_wait 0.5 ai_active_set on end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army4_ready = 1 and I_UnitDistanceFromUnit a4g1 a1g1 < 200 and I_UnitDistanceFromUnit a2g1 a1g1 < 200 set_counter army4_ready 0 unit_group_order_halt army4 battle_wait 0.5 ai_active_set on end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army4_ready = 1 and I_PercentageUnitGroupKilled army4 > 50 set_counter army4_ready 0 unit_group_order_halt army4 battle_wait 0.5 ai_active_set on end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army4_ready = 1 and I_UnitDistanceFromUnit a4g1 a2g1 < 250 and I_UnitGroupInRangeOfUnit army4 a2g1 set_counter army4_ready 0 unit_group_order_halt army4 battle_wait 0.5 ai_active_set on end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army4_ready = 1 and I_UnitDistanceFromUnit a2g1 a4g1 < 250 and I_IsUnitIdle a4g1 set_counter army4_ready 0 unit_group_order_halt army4 battle_wait 0.5 ai_active_set on end_monitor monitor_conditions I_BattleStarted

and I_CompareCounter army4_ready = 1 and I_IsUnitRouting a2g1 set_counter army4_ready 0 unit_group_order_halt army4 battle_wait 0.5 ai_active_set on end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army4_ready = 1 and I_PercentageUnitKilled a2g1 > 80 set_counter army4_ready 0 unit_group_order_halt army4 battle_wait 0.5 ai_active_set on end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army4_ready = 1 and I_UnitDistanceFromUnit a2g1 a4g1 < 250 and I_IsUnitUnderFire a4g1 set_counter army4_ready 0 unit_group_order_halt army4 battle_wait 0.5 ai_active_set on end_monitor ;;;;;;;;;;;Sally-out, AI defending monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter army4_ready_sally = 1 if I_UnitDistanceFromPosition a4g1 0 850 < 200 set_counter army4_location 1 ;north end_if if I_UnitDistanceFromPosition a4g1 0 -850 < 200 set_counter army4_location 2 ;south end_if if I_UnitDistanceFromPosition a4g1 -850 0 < 200 set_counter army4_location 3 ;west end_if if I_UnitDistanceFromPosition a4g1 850 0 < 200 set_counter army4_location 4 ;east end_if if I_UnitDistanceFromPosition a4g1 -850 850 < 200 set_counter army4_location 5 ;nw end_if if I_UnitDistanceFromPosition a4g1 850 850 < 200 set_counter army4_location 6 ;ne end_if if I_UnitDistanceFromPosition a4g1 -850 850 < 200 set_counter army4_location 7 ;sw end_if if I_UnitDistanceFromPosition a4g1 850 -850 < 200 set_counter army4_location 8 ;se end_if

if I_CompareCounter army4_location = 1 and I_CompareCounter army_west = 1 if I_BattleSettlementFortificationLevel set_counter path_n 1 set_counter path_w 2 end_if if I_BattleSettlementFortificationLevel set_counter path_n 1 set_counter path_nw 2 set_counter path_w 3 end_if end_if if I_CompareCounter army4_location = 1 and I_CompareCounter army_south = 1 if I_BattleSettlementFortificationLevel set_counter path_n 1 set_counter path_w 2 set_counter path_s 3 end_if if I_BattleSettlementFortificationLevel set_counter path_n 1 set_counter path_nw 2 set_counter path_w 3 set_counter path_sw 4 set_counter path_s 5 end_if end_if if I_CompareCounter army4_location = 1 and I_CompareCounter army_east = 1 if I_BattleSettlementFortificationLevel set_counter path_n 1 set_counter path_e 2 end_if if I_BattleSettlementFortificationLevel set_counter path_n 1 set_counter path_ne 2 set_counter path_e 3 end_if end_if if I_CompareCounter army4_location = 2 and I_CompareCounter army_west = 1 if I_BattleSettlementFortificationLevel set_counter path_s 1 set_counter path_w 2 end_if if I_BattleSettlementFortificationLevel set_counter path_s 1 set_counter path_sw 2 set_counter path_w 3 end_if end_if if I_CompareCounter army4_location = 2 and I_CompareCounter army_north = 1 if I_BattleSettlementFortificationLevel set_counter path_s 1 set_counter path_w 2 set_counter path_n 3 end_if if I_BattleSettlementFortificationLevel

< 2

> 1

< 2

> 1

< 2

> 1

< 2

> 1

< 2

> 1

set_counter set_counter set_counter set_counter set_counter end_if end_if

path_s 1 path_sw 2 path_w 3 path_nw 4 path_n 5

if I_CompareCounter army4_location = 2 and I_CompareCounter army_east = 1 if I_BattleSettlementFortificationLevel set_counter path_s 1 set_counter path_e 2 end_if if I_BattleSettlementFortificationLevel set_counter path_s 1 set_counter path_se 2 set_counter path_e 3 end_if end_if if I_CompareCounter army4_location = 3 and I_CompareCounter army_north = 1 if I_BattleSettlementFortificationLevel set_counter path_w 1 set_counter path_n 2 end_if if I_BattleSettlementFortificationLevel set_counter path_w 1 set_counter path_nw 2 set_counter path_n 3 end_if end_if if I_CompareCounter army4_location = 3 and I_CompareCounter army_east = 1 if I_BattleSettlementFortificationLevel set_counter path_w 1 set_counter path_n 2 set_counter path_e 3 end_if if I_BattleSettlementFortificationLevel set_counter path_w 1 set_counter path_nw 2 set_counter path_n 3 set_counter path_ne 4 set_counter path_e 5 end_if end_if if I_CompareCounter army4_location = 3 and I_CompareCounter army_south = 1 if I_BattleSettlementFortificationLevel set_counter path_w 1 set_counter path_s 2 end_if if I_BattleSettlementFortificationLevel set_counter path_w 1 set_counter path_sw 2 set_counter path_s 3 end_if end_if

< 2

> 1

< 2

> 1

< 2

> 1

< 2

> 1

if I_CompareCounter army4_location = 4 and I_CompareCounter army_south = 1 if I_BattleSettlementFortificationLevel set_counter path_e 1 set_counter path_s 2 end_if if I_BattleSettlementFortificationLevel set_counter path_e 1 set_counter path_se 2 set_counter path_s 3 end_if end_if if I_CompareCounter army4_location = 4 and I_CompareCounter army_west = 1 if I_BattleSettlementFortificationLevel set_counter path_e 1 set_counter path_s 2 set_counter path_w 3 end_if if I_BattleSettlementFortificationLevel set_counter path_e 1 set_counter path_se 2 set_counter path_s 3 set_counter path_sw 4 set_counter path_w 5 end_if end_if if I_CompareCounter army4_location = 4 and I_CompareCounter army_north = 1 if I_BattleSettlementFortificationLevel set_counter path_e 1 set_counter path_n 2 end_if if I_BattleSettlementFortificationLevel set_counter path_e 1 set_counter path_ne 2 set_counter path_n 3 end_if end_if

< 2

> 1

< 2

> 1

< 2

> 1

if I_CompareCounter army4_location = 5 ;nw and I_CompareCounter army_north = 1 if I_BattleSettlementFortificationLevel < 2 set_counter path_n 1 end_if if I_BattleSettlementFortificationLevel > 1 set_counter path_n 1 end_if end_if if I_CompareCounter army4_location = 5 and I_CompareCounter army_west = 1 if I_BattleSettlementFortificationLevel < 2 set_counter path_w 1 end_if if I_BattleSettlementFortificationLevel > 1 set_counter path_w 1 end_if end_if if I_CompareCounter army4_location = 5

and I_CompareCounter army_south = 1 if I_BattleSettlementFortificationLevel set_counter path_w 1 set_counter path_s 2 end_if if I_BattleSettlementFortificationLevel set_counter path_w 1 set_counter path_sw 2 set_counter path_s 3 end_if end_if if I_CompareCounter army4_location = 5 and I_CompareCounter army_east = 1 if I_BattleSettlementFortificationLevel set_counter path_n 1 set_counter path_e 2 end_if if I_BattleSettlementFortificationLevel set_counter path_n 1 set_counter path_ne 2 set_counter path_e 3 end_if end_if

< 2

> 1

< 2

> 1

if I_CompareCounter army4_location = 6 ;ne and I_CompareCounter army_west = 1 if I_BattleSettlementFortificationLevel < 2 set_counter path_n 1 set_counter path_w 2 end_if if I_BattleSettlementFortificationLevel > 1 set_counter path_n 1 set_counter path_nw 2 set_counter path_w 3 end_if end_if if I_CompareCounter army4_location = 6 and I_CompareCounter army_north = 1 if I_BattleSettlementFortificationLevel < 2 set_counter path_n 1 end_if if I_BattleSettlementFortificationLevel > 1 set_counter path_n 1 end_if end_if if I_CompareCounter army4_location = 6 and I_CompareCounter army_east = 1 if I_BattleSettlementFortificationLevel < 2 set_counter path_e 1 end_if if I_BattleSettlementFortificationLevel > 1 set_counter path_e 1 end_if end_if if I_CompareCounter army4_location = 6 and I_CompareCounter army_south = 1 if I_BattleSettlementFortificationLevel < 2 set_counter path_e 1 set_counter path_s 2

end_if if I_BattleSettlementFortificationLevel > 1 set_counter path_e 1 set_counter path_se 2 set_counter path_s 3 end_if end_if if I_CompareCounter army4_location = 7 ;sw and I_CompareCounter army_north = 1 if I_BattleSettlementFortificationLevel < 2 set_counter path_w 1 set_counter path_n 2 end_if if I_BattleSettlementFortificationLevel > 1 set_counter path_w 1 set_counter path_nw 2 set_counter path_n 3 end_if end_if if I_CompareCounter army4_location = 7 and I_CompareCounter army_east = 1 if I_BattleSettlementFortificationLevel < 2 set_counter path_s 1 set_counter path_e 2 end_if if I_BattleSettlementFortificationLevel > 1 set_counter path_s 1 set_counter path_se 2 set_counter path_e 3 end_if end_if if I_CompareCounter army4_location = 7 and I_CompareCounter army_south = 1 if I_BattleSettlementFortificationLevel < 2 set_counter path_s 1 end_if if I_BattleSettlementFortificationLevel > 1 set_counter path_s 1 end_if end_if if I_CompareCounter army4_location = 7 and I_CompareCounter army_west = 1 if I_BattleSettlementFortificationLevel < 2 set_counter path_w 1 end_if if I_BattleSettlementFortificationLevel > 1 set_counter path_w 1 end_if end_if if I_CompareCounter army4_location = 8 ;se and I_CompareCounter army_south = 1 if I_BattleSettlementFortificationLevel < 2 set_counter path_s 1 end_if if I_BattleSettlementFortificationLevel > 1 set_counter path_s 1 end_if end_if if I_CompareCounter army4_location = 8

and I_CompareCounter army_west = 1 if I_BattleSettlementFortificationLevel set_counter path_s 1 set_counter path_w 2 end_if if I_BattleSettlementFortificationLevel set_counter path_s 1 set_counter path_sw 2 set_counter path_w 3 end_if end_if if I_CompareCounter army4_location = 8 and I_CompareCounter army_north = 1 if I_BattleSettlementFortificationLevel set_counter path_e 1 set_counter path_n 2 end_if if I_BattleSettlementFortificationLevel set_counter path_e 1 set_counter path_ne 2 set_counter path_n 3 end_if end_if if I_CompareCounter army4_location = 8 and I_CompareCounter army_east = 1 if I_BattleSettlementFortificationLevel set_counter path_e 1 end_if if I_BattleSettlementFortificationLevel set_counter path_e 1 end_if end_if if I_CompareCounter army4_location = 1 and I_CompareCounter army_north = 1 set_counter army4_ready_sally 3 set_counter army4_ready 0 end_if if I_CompareCounter army4_location = 2 and I_CompareCounter army_south = 1 set_counter army4_ready_sally 3 set_counter army4_ready 0 end_if if I_CompareCounter army4_location = 3 and I_CompareCounter army_west = 1 set_counter army4_ready_sally 3 set_counter army4_ready 0 end_if

< 2

> 1

< 2

> 1

< 2 > 1

if I_CompareCounter army4_location = 4 and I_CompareCounter army_east = 1 set_counter army4_ready_sally 3 set_counter army4_ready 0 end_if if I_CompareCounter army4_ready_sally = 1 unit_group_order_halt army4 battle_wait 0.5 unit_group_order_change_group_formation army4 ai_infantry_protecting battle_wait 45 battle_wait 20

if I_CompareCounter army4_ready_sally = 1 and I_BattleIsSallyOutBattle battle_wait 25 end_if if I_CompareCounter army4_ready_sally = 1 and I_BattleIsSallyOutBattle set_counter army4_ready_sally 2 end_if end_if end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter label_army4 = 1 label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit ; 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 a4g1 1 a4u2 2 a4u3 3 a4u4 4 a4u5 5 a4u6 6 a4u7 7 a4u8 8 a4u9 9 a4u10 10 a4u11 11 a4u12 12 a4u13 13 a4u14 14 a4u15 15 a4u16 16 a4u17 17 a4u18 18 a4u19 19 a4u20

unit_group_order_halt army4 set_counter label_army4 0 end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter army4_ready_sally = 2 and I_CompareCounter army4_moving_s = 1 and I_UnitEnemyUnitInRadius a4g1 130 and ! I_UnitGroupInRangeOfUnitGroup army2 army4 ; unit_group_order_halt army4 ai_active_set off battle_wait 0.5 ai_active_set on

set_counter army4_moving_s 0 end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter army4_ready_sally = 2 and I_CompareCounter path_n = 1 and ! I_UnitEnemyUnitInRadius a4g1 130

if I_UnitGroupDistanceFromPosition army4 0 700 > 100 and I_BattleSettlementFortificationLevel > 2 set_counter label_army4 1 battle_wait 0.5 unit_group_order_move_formed army4 0 700 run set_counter army4_moving_s 1 end_if if I_UnitGroupDistanceFromPosition army4 0 500 > 100 and I_BattleSettlementFortificationLevel < 3 set_counter label_army4 1 battle_wait 0.5 unit_group_order_move_formed army4 0 500 run set_counter army4_moving_s 1 end_if if I_UnitGroupDistanceFromPosition army4 0 700 < 100 and I_BattleSettlementFortificationLevel > 2 unit_group_order_halt army4 battle_wait 0.5 if I_UnitGroupDistanceFromPosition army4 0 700 < 100 set_counter path_n 0 if I_CompareCounter path_nw > 1 set_counter path_nw 1 end_if if I_CompareCounter path_ne > 1 set_counter path_ne 1 end_if if I_CompareCounter path_nw = 0 and I_CompareCounter path_ne = 0 set_counter army4_ready_sally 3 set_counter army4_ready 0 end_if end_if end_if if I_UnitGroupDistanceFromPosition army4 0 500 < 100 and I_BattleSettlementFortificationLevel < 3 unit_group_order_halt army4 battle_wait 0.5 if I_UnitGroupDistanceFromPosition army4 0 500 < 100 set_counter path_n 0 if I_CompareCounter path_w > 1 set_counter path_w 1 end_if if I_CompareCounter path_e > 1 set_counter path_e 1 end_if if I_CompareCounter path_w = 0 and I_CompareCounter path_e = 0 set_counter army4_ready_sally 3 set_counter army4_ready 0 end_if end_if end_if battle_wait 30 end_monitor

monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter army4_ready_sally = 2 and I_CompareCounter path_s = 1 and ! I_UnitEnemyUnitInRadius a4g1 130 if I_UnitGroupDistanceFromPosition army4 0 -700 > 100 and I_BattleSettlementFortificationLevel > 2 set_counter label_army4 1 battle_wait 0.5 unit_group_order_move_formed army4 0 -700 run set_counter army4_moving_s 1 end_if if I_UnitGroupDistanceFromPosition army4 0 -500 > 100 and I_BattleSettlementFortificationLevel < 3 set_counter label_army4 1 battle_wait 0.5 unit_group_order_move_formed army4 0 -500 run set_counter army4_moving_s 1 end_if if I_UnitGroupDistanceFromPosition army4 0 -700 < 100 and I_BattleSettlementFortificationLevel > 2 unit_group_order_halt army4 battle_wait 0.5 if I_UnitGroupDistanceFromPosition army4 0 -700 < 100 set_counter path_s 0 if I_CompareCounter path_sw > 1 set_counter path_sw 1 end_if if I_CompareCounter path_se > 1 set_counter path_se 1 end_if if I_CompareCounter path_sw = 0 and I_CompareCounter path_se = 0 set_counter army4_ready_sally 3 set_counter army4_ready 0 end_if end_if end_if if I_UnitGroupDistanceFromPosition army4 0 -500 < 100 and I_BattleSettlementFortificationLevel < 3 unit_group_order_halt army4 battle_wait 0.5 if I_UnitGroupDistanceFromPosition army4 0 -500 < 100 set_counter path_s 0 if I_CompareCounter path_w > 1 set_counter path_w 1 end_if if I_CompareCounter path_e > 1 set_counter path_e 1 end_if if I_CompareCounter path_w = 0 and I_CompareCounter path_e = 0 set_counter army4_ready_sally 3 set_counter army4_ready 0 end_if end_if

end_if battle_wait 20 end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter army4_ready_sally = 2 and I_CompareCounter path_w = 1 and ! I_UnitEnemyUnitInRadius a4g1 130 if I_UnitGroupDistanceFromPosition army4 -700 0 > 100 and I_BattleSettlementFortificationLevel > 2 set_counter label_army4 1 battle_wait 0.5 unit_group_order_move_formed army4 -700 0 run set_counter army4_moving_s 1 end_if if I_UnitGroupDistanceFromPosition army4 -500 0 > 100 and I_BattleSettlementFortificationLevel < 3 set_counter label_army4 1 battle_wait 0.5 unit_group_order_move_formed army4 -500 0 run set_counter army4_moving_s 1 end_if if I_UnitGroupDistanceFromPosition army4 -700 0 < 100 and I_BattleSettlementFortificationLevel > 2 unit_group_order_halt army4 battle_wait 0.5 if I_UnitGroupDistanceFromPosition army4 -700 0 < 100 set_counter path_w 0 if I_CompareCounter path_nw > 1 set_counter path_nw 1 end_if if I_CompareCounter path_sw > 1 set_counter path_sw 1 end_if if I_CompareCounter path_nw = 0 and I_CompareCounter path_sw = 0 set_counter army4_ready_sally 3 set_counter army4_ready 0 end_if end_if end_if if I_UnitGroupDistanceFromPosition army4 -500 0 < 100 and I_BattleSettlementFortificationLevel < 3 unit_group_order_halt army4 battle_wait 0.5 if I_UnitGroupDistanceFromPosition army4 -500 0 < 100 set_counter path_w 0 if I_CompareCounter path_n > 1 set_counter path_n 1 end_if if I_CompareCounter path_s > 1 set_counter path_s 1 end_if if I_CompareCounter path_n = 0

and I_CompareCounter path_s = 0 set_counter army4_ready_sally 3 set_counter army4_ready 0 end_if end_if end_if battle_wait 20 end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter army4_ready_sally = 2 and I_CompareCounter path_e = 1 and ! I_UnitEnemyUnitInRadius a4g1 130 if I_UnitGroupDistanceFromPosition army4 700 0 > 100 and I_BattleSettlementFortificationLevel > 2 set_counter label_army4 1 battle_wait 0.5 unit_group_order_move_formed army4 700 0 run set_counter army4_moving_s 1 end_if if I_UnitGroupDistanceFromPosition army4 500 0 > 100 and I_BattleSettlementFortificationLevel < 3 set_counter label_army4 1 battle_wait 0.5 unit_group_order_move_formed army4 500 0 run set_counter army4_moving_s 1 end_if if I_UnitGroupDistanceFromPosition army4 700 0 < 100 and I_BattleSettlementFortificationLevel > 2 unit_group_order_halt army4 battle_wait 0.5 if I_UnitGroupDistanceFromPosition army4 700 0 < 100 set_counter path_e 0 if I_CompareCounter path_ne > 1 set_counter path_ne 1 end_if if I_CompareCounter path_se > 1 set_counter path_se 1 end_if if I_CompareCounter path_ne = 0 and I_CompareCounter path_se = 0 set_counter army4_ready_sally 3 set_counter army4_ready 0 end_if end_if end_if if I_UnitGroupDistanceFromPosition army4 500 0 < 100 and I_BattleSettlementFortificationLevel < 3 unit_group_order_halt army4 battle_wait 0.5 if I_UnitGroupDistanceFromPosition army4 500 0 < 100 set_counter path_e 0 if I_CompareCounter path_n > 1 set_counter path_n 1

end_if if I_CompareCounter path_s > 1 set_counter path_s 1 end_if if I_CompareCounter path_n = 0 and I_CompareCounter path_s = 0 set_counter army4_ready_sally 3 set_counter army4_ready 0 end_if end_if end_if battle_wait 20 end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter army4_ready_sally = 2 and I_CompareCounter path_nw = 1 and I_BattleSettlementFortificationLevel > 2 and ! I_UnitEnemyUnitInRadius a4g1 130 if I_UnitGroupDistanceFromPosition army4 -700 700 > 100 set_counter label_army4 1 battle_wait 0.5 unit_group_order_move_formed army4 -700 700 run set_counter army4_moving_s 1 end_if if I_UnitGroupDistanceFromPosition army4 -700 700 < 100 unit_group_order_halt army4 battle_wait 0.5 if I_UnitGroupDistanceFromPosition army4 -700 700 < 100 set_counter path_nw 0 if I_CompareCounter path_n > 1 set_counter path_n 1 end_if if I_CompareCounter path_w > 1 set_counter path_w 1 end_if if I_CompareCounter path_n = 0 and I_CompareCounter path_w = 0 set_counter army4_ready_sally 3 set_counter army4_ready 0 end_if end_if end_if battle_wait 20 end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter army4_ready_sally = 2 and I_CompareCounter path_ne = 1 and I_BattleSettlementFortificationLevel > 2 and ! I_UnitEnemyUnitInRadius a4g1 130 if I_UnitGroupDistanceFromPosition army4 700 700 > 100 set_counter label_army4 1

battle_wait 0.5 unit_group_order_move_formed army4 700 700 run set_counter army4_moving_s 1 end_if if I_UnitGroupDistanceFromPosition army4 700 700 < 100 unit_group_order_halt army4 battle_wait 0.5 if I_UnitGroupDistanceFromPosition army4 700 700 < 100 set_counter path_ne 0 if I_CompareCounter path_e > 1 set_counter path_e 1 end_if if I_CompareCounter path_n > 1 set_counter path_n 1 end_if if I_CompareCounter path_e = 0 and I_CompareCounter path_n = 0 set_counter army4_ready_sally 3 set_counter army4_ready 0 end_if end_if end_if battle_wait 20 end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter army4_ready_sally = 2 and I_CompareCounter path_sw = 1 and I_BattleSettlementFortificationLevel > 2 and ! I_UnitEnemyUnitInRadius a4g1 130 if I_UnitGroupDistanceFromPosition army4 -700 -700 > 100 set_counter label_army4 1 battle_wait 0.5 unit_group_order_move_formed army4 -700 -700 run set_counter army4_moving_s 1 end_if if I_UnitGroupDistanceFromPosition army4 -700 -700 < 100 unit_group_order_halt army4 battle_wait 0.5 if I_UnitGroupDistanceFromPosition army4 -700 -700 < 100 set_counter path_sw 0 if I_CompareCounter path_w > 1 set_counter path_w 1 end_if if I_CompareCounter path_s > 1 set_counter path_s 1 end_if if I_CompareCounter path_w = 0 and I_CompareCounter path_s = 0 set_counter army4_ready_sally 3 set_counter army4_ready 0 end_if end_if end_if

battle_wait 20 end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter army4_ready_sally = 2 and I_CompareCounter path_se = 1 and I_BattleSettlementFortificationLevel > 2 and ! I_UnitEnemyUnitInRadius a4g1 130 if I_UnitGroupDistanceFromPosition army4 700 -700 > 100 set_counter label_army4 1 battle_wait 0.5 unit_group_order_move_formed army4 700 -700 run set_counter army4_moving_s 1 end_if if I_UnitGroupDistanceFromPosition army4 700 -700 < 100 unit_group_order_halt army4 battle_wait 0.5 if I_UnitGroupDistanceFromPosition army4 700 -700 < 100 set_counter path_se 0 if I_CompareCounter path_s > 1 set_counter path_s 1 end_if if I_CompareCounter path_e > 1 set_counter path_e 1 end_if if I_CompareCounter path_s = 0 and I_CompareCounter path_e = 0 set_counter army4_ready_sally 3 set_counter army4_ready 0 end_if end_if end_if battle_wait 20 end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter army4_ready_sally = 3 set_counter army4_ready_sally 0 unit_group_order_halt army4 ; ai_active_set off battle_wait 0.5 ai_active_set on end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter army4_ready_sally = 2 and I_IsUnitRouting a4g1 set_counter army4_ready_sally 3 end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle

and I_CompareCounter army4_ready_sally = 2 and I_PercentageUnitKilled a4g1 > 80 set_counter army4_ready_sally 3 end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter army4_ready_sally = 2 if I_IsUnitGroupIdle army4 inc_counter army4_idle_r 1 end_if if ! I_IsUnitGroupIdle army4 set_counter army4_idle_r 0 end_if if I_CompareCounter army4_idle_r > 12 set_counter army4_ready_sally 0 end_if battle_wait 10 end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter army4_ready_sally = 2 and ! I_UnitEnemyUnitInRadius a4g1 130 and I_CompareCounter path_n = 1 ; set_counter check_timer 1 battle_wait 600 battle_wait 30 if I_CompareCounter path_n = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 1 set_counter check_timer 2 battle_wait 30 if I_CompareCounter path_n = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 2 set_counter check_timer 3 battle_wait 30 if I_CompareCounter path_n = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 3 set_counter check_timer 4 battle_wait 30 if I_CompareCounter path_n = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 4 set_counter check_timer 5 battle_wait 30 if I_CompareCounter path_n = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 5 set_counter check_timer 6 battle_wait 30 if I_CompareCounter path_n = 1 and I_CompareCounter army4_ready_sally

= 2

= 2

= 2

= 2

= 2

= 2

and I_CompareCounter check_timer = 6 set_counter check_timer 7 battle_wait 30 if I_CompareCounter path_n = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 7 set_counter check_timer 8 battle_wait 30 if I_CompareCounter path_n = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 8 set_counter check_timer 9 battle_wait 30 if I_CompareCounter path_n = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 9 set_counter check_timer 10 battle_wait 30 if I_CompareCounter path_n = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 10 set_counter check_timer 11 battle_wait 30 if I_CompareCounter path_n = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 11 set_counter check_timer 12 battle_wait 30 if I_CompareCounter path_n = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 12 set_counter check_timer 13 battle_wait 30 if I_CompareCounter path_n = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 13 set_counter check_timer 14 battle_wait 30 if I_CompareCounter path_n = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 14 set_counter check_timer 15 battle_wait 30 if I_CompareCounter path_n = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 15 set_counter check_timer 16 battle_wait 30 if I_CompareCounter path_n = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 16 set_counter check_timer 17 battle_wait 30 if I_CompareCounter path_n = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 17 set_counter check_timer 18 battle_wait 30 if I_CompareCounter path_n = 1 and I_CompareCounter army4_ready_sally

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

and I_CompareCounter check_timer = 18 set_counter check_timer 19 battle_wait 30 if I_CompareCounter path_n = 1 and I_CompareCounter army4_ready_sally = 2 and I_CompareCounter check_timer = 19 set_counter check_timer 20 battle_wait 30 if I_CompareCounter path_n = 1 and I_CompareCounter army4_ready_sally = 2 and I_CompareCounter check_timer = 20 set_counter path_n 0 set_counter sally_reinf 0 set_counter army4_ready_sally 0 set_counter label_army4 1 ; battle_wait 0.5 ; ai_active_set off battle_wait 0.5 ai_active_set on end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter army4_ready_sally = 2 and ! I_UnitEnemyUnitInRadius a4g1 130 and I_CompareCounter path_s = 1 ; set_counter check_timer 1 battle_wait 600 battle_wait 30 if I_CompareCounter path_s = 1 and I_CompareCounter army4_ready_sally = 2 and I_CompareCounter check_timer = 1 set_counter check_timer 2 battle_wait 30 if I_CompareCounter path_s = 1 and I_CompareCounter army4_ready_sally = 2 and I_CompareCounter check_timer = 2 set_counter check_timer 3 battle_wait 30

if I_CompareCounter path_s = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 3 set_counter check_timer 4 battle_wait 30 if I_CompareCounter path_s = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 4 set_counter check_timer 5 battle_wait 30 if I_CompareCounter path_s = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 5 set_counter check_timer 6 battle_wait 30 if I_CompareCounter path_s = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 6 set_counter check_timer 7 battle_wait 30 if I_CompareCounter path_s = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 7 set_counter check_timer 8 battle_wait 30 if I_CompareCounter path_s = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 8 set_counter check_timer 9 battle_wait 30 if I_CompareCounter path_s = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 9 set_counter check_timer 10 battle_wait 30 if I_CompareCounter path_s = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 10 set_counter check_timer 11 battle_wait 30 if I_CompareCounter path_s = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 11 set_counter check_timer 12 battle_wait 30 if I_CompareCounter path_s = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 12 set_counter check_timer 13 battle_wait 30 if I_CompareCounter path_s = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 13 set_counter check_timer 14 battle_wait 30 if I_CompareCounter path_s = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 14 set_counter check_timer 15 battle_wait 30

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

if I_CompareCounter path_s = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 15 set_counter check_timer 16 battle_wait 30 if I_CompareCounter path_s = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 16 set_counter check_timer 17 battle_wait 30 if I_CompareCounter path_s = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 17 set_counter check_timer 18 battle_wait 30 if I_CompareCounter path_s = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 18 set_counter check_timer 19 battle_wait 30 if I_CompareCounter path_s = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 19 set_counter check_timer 20 battle_wait 30 if I_CompareCounter path_s = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 20 set_counter path_s 0 set_counter sally_reinf 0 set_counter army4_ready_sally 0 set_counter label_army4 1 ; battle_wait 0.5 ; ai_active_set off battle_wait 0.5 ai_active_set on end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle

= 2

= 2

= 2

= 2

= 2

= 2

and I_CompareCounter army4_ready_sally = 2 and ! I_UnitEnemyUnitInRadius a4g1 130 and I_CompareCounter path_w = 1 ; set_counter check_timer 1 battle_wait 600 battle_wait 30 if I_CompareCounter path_w = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 1 set_counter check_timer 2 battle_wait 30 if I_CompareCounter path_w = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 2 set_counter check_timer 3 battle_wait 30 if I_CompareCounter path_w = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 3 set_counter check_timer 4 battle_wait 30 if I_CompareCounter path_w = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 4 set_counter check_timer 5 battle_wait 30 if I_CompareCounter path_w = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 5 set_counter check_timer 6 battle_wait 30 if I_CompareCounter path_w = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 6 set_counter check_timer 7 battle_wait 30 if I_CompareCounter path_w = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 7 set_counter check_timer 8 battle_wait 30 if I_CompareCounter path_w = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 8 set_counter check_timer 9 battle_wait 30 if I_CompareCounter path_w = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 9 set_counter check_timer 10 battle_wait 30 if I_CompareCounter path_w = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 10 set_counter check_timer 11 battle_wait 30 if I_CompareCounter path_w = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 11

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

; ;

set_counter check_timer 12 battle_wait 30 if I_CompareCounter path_w = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 12 set_counter check_timer 13 battle_wait 30 if I_CompareCounter path_w = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 13 set_counter check_timer 14 battle_wait 30 if I_CompareCounter path_w = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 14 set_counter check_timer 15 battle_wait 30 if I_CompareCounter path_w = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 15 set_counter check_timer 16 battle_wait 30 if I_CompareCounter path_w = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 16 set_counter check_timer 17 battle_wait 30 if I_CompareCounter path_w = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 17 set_counter check_timer 18 battle_wait 30 if I_CompareCounter path_w = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 18 set_counter check_timer 19 battle_wait 30 if I_CompareCounter path_w = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 19 set_counter check_timer 20 battle_wait 30 if I_CompareCounter path_w = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 20 set_counter path_w 0 set_counter sally_reinf 0 set_counter army4_ready_sally 0 set_counter label_army4 1 battle_wait 0.5 ai_active_set off battle_wait 0.5 ai_active_set on end_if end_if end_if end_if end_if end_if end_if

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 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_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter army4_ready_sally = 2 and ! I_UnitEnemyUnitInRadius a4g1 130 and I_CompareCounter path_e = 1 ; set_counter check_timer 1 battle_wait 600 battle_wait 30 if I_CompareCounter path_e = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 1 set_counter check_timer 2 battle_wait 30 if I_CompareCounter path_e = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 2 set_counter check_timer 3 battle_wait 30 if I_CompareCounter path_e = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 3 set_counter check_timer 4 battle_wait 30 if I_CompareCounter path_e = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 4 set_counter check_timer 5 battle_wait 30 if I_CompareCounter path_e = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 5 set_counter check_timer 6 battle_wait 30 if I_CompareCounter path_e = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 6 set_counter check_timer 7 battle_wait 30 if I_CompareCounter path_e = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 7 set_counter check_timer 8 battle_wait 30 if I_CompareCounter path_e = 1

= 2

= 2

= 2

= 2

= 2

= 2

= 2

and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 8 set_counter check_timer 9 battle_wait 30 if I_CompareCounter path_e = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 9 set_counter check_timer 10 battle_wait 30 if I_CompareCounter path_e = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 10 set_counter check_timer 11 battle_wait 30 if I_CompareCounter path_e = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 11 set_counter check_timer 12 battle_wait 30 if I_CompareCounter path_e = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 12 set_counter check_timer 13 battle_wait 30 if I_CompareCounter path_e = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 13 set_counter check_timer 14 battle_wait 30 if I_CompareCounter path_e = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 14 set_counter check_timer 15 battle_wait 30 if I_CompareCounter path_e = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 15 set_counter check_timer 16 battle_wait 30 if I_CompareCounter path_e = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 16 set_counter check_timer 17 battle_wait 30 if I_CompareCounter path_e = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 17 set_counter check_timer 18 battle_wait 30 if I_CompareCounter path_e = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 18 set_counter check_timer 19 battle_wait 30 if I_CompareCounter path_e = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 19 set_counter check_timer 20 battle_wait 30 if I_CompareCounter path_e = 1

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

and I_CompareCounter army4_ready_sally = 2 and I_CompareCounter check_timer = 20 set_counter path_e 0 set_counter sally_reinf 0 set_counter army4_ready_sally 0 set_counter label_army4 1 ; battle_wait 0.5 ; ai_active_set off battle_wait 0.5 ai_active_set on end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter army4_ready_sally = 2 and ! I_UnitEnemyUnitInRadius a4g1 130 and I_CompareCounter path_nw = 1 ; set_counter check_timer 1 battle_wait 600 battle_wait 30 if I_CompareCounter path_nw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 1 set_counter check_timer 2 battle_wait 30 if I_CompareCounter path_nw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 2 set_counter check_timer 3 battle_wait 30 if I_CompareCounter path_nw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 3 set_counter check_timer 4 battle_wait 30 if I_CompareCounter path_nw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 4 set_counter check_timer 5

= 2

= 2

= 2

= 2

battle_wait 30 if I_CompareCounter path_nw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 5 set_counter check_timer 6 battle_wait 30 if I_CompareCounter path_nw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 6 set_counter check_timer 7 battle_wait 30 if I_CompareCounter path_nw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 7 set_counter check_timer 8 battle_wait 30 if I_CompareCounter path_nw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 8 set_counter check_timer 9 battle_wait 30 if I_CompareCounter path_nw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 9 set_counter check_timer 10 battle_wait 30 if I_CompareCounter path_nw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 10 set_counter check_timer 11 battle_wait 30 if I_CompareCounter path_nw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 11 set_counter check_timer 12 battle_wait 30 if I_CompareCounter path_nw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 12 set_counter check_timer 13 battle_wait 30 if I_CompareCounter path_nw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 13 set_counter check_timer 14 battle_wait 30 if I_CompareCounter path_nw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 14 set_counter check_timer 15 battle_wait 30 if I_CompareCounter path_nw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 15 set_counter check_timer 16 battle_wait 30 if I_CompareCounter path_nw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 16 set_counter check_timer 17

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

battle_wait 30 if I_CompareCounter path_nw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 17 set_counter check_timer 18 battle_wait 30 if I_CompareCounter path_nw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 18 set_counter check_timer 19 battle_wait 30 if I_CompareCounter path_nw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 19 set_counter check_timer 20 battle_wait 30 if I_CompareCounter path_nw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 20 set_counter path_nw 0 set_counter sally_reinf 0 set_counter army4_ready_sally 0 set_counter label_army4 1 ; battle_wait 0.5 ; ai_active_set off battle_wait 0.5 ai_active_set on end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_monitor

= 2

= 2

= 2

= 2

monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter army4_ready_sally = 2 and ! I_UnitEnemyUnitInRadius a4g1 130 and I_CompareCounter path_ne = 1 ; set_counter check_timer 1 battle_wait 600 battle_wait 30 if I_CompareCounter path_ne = 1 and I_CompareCounter army4_ready_sally = 2

and I_CompareCounter check_timer = 1 set_counter check_timer 2 battle_wait 30 if I_CompareCounter path_ne = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 2 set_counter check_timer 3 battle_wait 30 if I_CompareCounter path_ne = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 3 set_counter check_timer 4 battle_wait 30 if I_CompareCounter path_ne = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 4 set_counter check_timer 5 battle_wait 30 if I_CompareCounter path_ne = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 5 set_counter check_timer 6 battle_wait 30 if I_CompareCounter path_ne = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 6 set_counter check_timer 7 battle_wait 30 if I_CompareCounter path_ne = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 7 set_counter check_timer 8 battle_wait 30 if I_CompareCounter path_ne = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 8 set_counter check_timer 9 battle_wait 30 if I_CompareCounter path_ne = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 9 set_counter check_timer 10 battle_wait 30 if I_CompareCounter path_ne = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 10 set_counter check_timer 11 battle_wait 30 if I_CompareCounter path_ne = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 11 set_counter check_timer 12 battle_wait 30 if I_CompareCounter path_ne = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 12 set_counter check_timer 13 battle_wait 30 if I_CompareCounter path_ne = 1 and I_CompareCounter army4_ready_sally

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

; ;

and I_CompareCounter check_timer = 13 set_counter check_timer 14 battle_wait 30 if I_CompareCounter path_ne = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 14 set_counter check_timer 15 battle_wait 30 if I_CompareCounter path_ne = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 15 set_counter check_timer 16 battle_wait 30 if I_CompareCounter path_ne = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 16 set_counter check_timer 17 battle_wait 30 if I_CompareCounter path_ne = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 17 set_counter check_timer 18 battle_wait 30 if I_CompareCounter path_ne = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 18 set_counter check_timer 19 battle_wait 30 if I_CompareCounter path_ne = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 19 set_counter check_timer 20 battle_wait 30 if I_CompareCounter path_ne = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 20 set_counter path_ne 0 set_counter sally_reinf 0 set_counter army4_ready_sally 0 set_counter label_army4 1 battle_wait 0.5 ai_active_set off battle_wait 0.5 ai_active_set on end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if

= 2

= 2

= 2

= 2

= 2

= 2

= 2

end_if end_if end_if end_if end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter army4_ready_sally = 2 and ! I_UnitEnemyUnitInRadius a4g1 130 and I_CompareCounter path_sw = 1 ; set_counter check_timer 1 battle_wait 600 battle_wait 30 if I_CompareCounter path_sw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 1 set_counter check_timer 2 battle_wait 30 if I_CompareCounter path_sw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 2 set_counter check_timer 3 battle_wait 30 if I_CompareCounter path_sw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 3 set_counter check_timer 4 battle_wait 30 if I_CompareCounter path_sw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 4 set_counter check_timer 5 battle_wait 30 if I_CompareCounter path_sw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 5 set_counter check_timer 6 battle_wait 30 if I_CompareCounter path_sw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 6 set_counter check_timer 7 battle_wait 30 if I_CompareCounter path_sw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 7 set_counter check_timer 8 battle_wait 30 if I_CompareCounter path_sw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 8 set_counter check_timer 9 battle_wait 30 if I_CompareCounter path_sw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 9 set_counter check_timer 10 battle_wait 30

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

; ;

if I_CompareCounter path_sw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 10 set_counter check_timer 11 battle_wait 30 if I_CompareCounter path_sw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 11 set_counter check_timer 12 battle_wait 30 if I_CompareCounter path_sw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 12 set_counter check_timer 13 battle_wait 30 if I_CompareCounter path_sw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 13 set_counter check_timer 14 battle_wait 30 if I_CompareCounter path_sw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 14 set_counter check_timer 15 battle_wait 30 if I_CompareCounter path_sw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 15 set_counter check_timer 16 battle_wait 30 if I_CompareCounter path_sw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 16 set_counter check_timer 17 battle_wait 30 if I_CompareCounter path_sw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 17 set_counter check_timer 18 battle_wait 30 if I_CompareCounter path_sw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 18 set_counter check_timer 19 battle_wait 30 if I_CompareCounter path_sw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 19 set_counter check_timer 20 battle_wait 30 if I_CompareCounter path_sw = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 20 set_counter path_sw 0 set_counter sally_reinf 0 set_counter army4_ready_sally 0 set_counter label_army4 1 battle_wait 0.5 ai_active_set off battle_wait 0.5

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

ai_active_set on end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter army4_ready_sally = 2 and ! I_UnitEnemyUnitInRadius a4g1 130 and I_CompareCounter path_se = 1 ; set_counter check_timer 1 battle_wait 600 battle_wait 30 if I_CompareCounter path_se = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 1 set_counter check_timer 2 battle_wait 30 if I_CompareCounter path_se = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 2 set_counter check_timer 3 battle_wait 30 if I_CompareCounter path_se = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 3 set_counter check_timer 4 battle_wait 30 if I_CompareCounter path_se = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 4 set_counter check_timer 5 battle_wait 30 if I_CompareCounter path_se = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 5 set_counter check_timer 6 battle_wait 30 if I_CompareCounter path_se = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 6

= 2

= 2

= 2

= 2

= 2

= 2

set_counter check_timer 7 battle_wait 30 if I_CompareCounter path_se = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 7 set_counter check_timer 8 battle_wait 30 if I_CompareCounter path_se = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 8 set_counter check_timer 9 battle_wait 30 if I_CompareCounter path_se = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 9 set_counter check_timer 10 battle_wait 30 if I_CompareCounter path_se = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 10 set_counter check_timer 11 battle_wait 30 if I_CompareCounter path_se = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 11 set_counter check_timer 12 battle_wait 30 if I_CompareCounter path_se = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 12 set_counter check_timer 13 battle_wait 30 if I_CompareCounter path_se = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 13 set_counter check_timer 14 battle_wait 30 if I_CompareCounter path_se = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 14 set_counter check_timer 15 battle_wait 30 if I_CompareCounter path_se = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 15 set_counter check_timer 16 battle_wait 30 if I_CompareCounter path_se = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 16 set_counter check_timer 17 battle_wait 30 if I_CompareCounter path_se = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 17 set_counter check_timer 18 battle_wait 30 if I_CompareCounter path_se = 1 and I_CompareCounter army4_ready_sally and I_CompareCounter check_timer = 18

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

= 2

set_counter check_timer 19 battle_wait 30 if I_CompareCounter path_se = 1 and I_CompareCounter army4_ready_sally = 2 and I_CompareCounter check_timer = 19 set_counter check_timer 20 battle_wait 30 if I_CompareCounter path_se = 1 and I_CompareCounter army4_ready_sally = 2 and I_CompareCounter check_timer = 20 set_counter path_se 0 set_counter sally_reinf 0 set_counter army4_ready_sally 0 set_counter label_army4 1 ; battle_wait 0.5 ; ai_active_set off battle_wait 0.5 ai_active_set on end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_monitor ;;;;;;;;;;;Defending Siege;;;;;;;;;;;;;; monitor_conditions I_BattleStarted and I_BattleIsSiegeBattle and I_CompareCounter army4_ready_siege = 1 and I_CompareCounter army_moving = 0 and ! I_UnitEnemyUnitInRadius a4g1 160 and ! I_UnitGroupInRangeOfUnitGroup army2 army4 set_counter army4_run_siege 1 set_counter army_moving 1 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army4_ready_siege = 1 and I_CompareCounter army_moving = 1 and I_UnitEnemyUnitInRadius a4g1 160 unit_group_order_halt army4 battle_wait 0.5

ai_active_set on set_counter army_moving 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army4_ready_siege = 1 and I_CompareCounter army_moving = 1 and ! I_UnitEnemyUnitInRadius a4g1 160 and I_UnitDistanceFromUnit a2g1 a4g1 > 150 and I_IsUnitIdle a4g1 set_counter army4_run_siege 1 battle_wait 2 set_counter army_moving 1 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army4_run_siege = 1 label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 a4g1 1 a4u2 2 a4u3 3 a4u4 4 a4u5 5 a4u6 6 a4u7 7 a4u8 8 a4u9 9 a4u10 10 a4u11 11 a4u12 12 a4u13 13 a4u14 14 a4u15 15 a4u16 16 a4u17 17 a4u18 18 a4u19 19 a4u20

unit_group_order_halt army4 battle_wait 0.5 unit_group_order_move_formed army4 1 1 run set_counter army4_run_siege 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army4_ready_siege = 1 and I_UnitDistanceFromUnit a4g1 a2g1 < 200 set_counter army4_ready_siege 0 unit_group_order_halt army4 battle_wait 0.5 ai_active_set on end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army4_ready_siege = 1 and I_UnitDistanceFromPosition a4g1 1 1 < 150

set_counter army4_ready_siege 0 unit_group_order_halt army4 battle_wait 0.5 ai_active_set on end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army4_ready_siege = 1 and I_UnitDistanceFromUnit a2g1 a4g1 < 250 and I_IsUnitIdle a4g1 set_counter army4_ready_siege 0 unit_group_order_halt army4 battle_wait 0.5 ai_active_set on end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army4_ready_siege = 1 and I_UnitDistanceFromUnit a2g1 a4g1 < 250 and I_IsUnitUnderFire a4g1 set_counter army4_ready_siege 0 unit_group_order_halt army4 battle_wait 0.5 ai_active_set on end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army4_ready_siege = 1 and I_PercentageUnitGroupKilled army4 > 50 set_counter army4_ready_siege 0 unit_group_order_halt army4 battle_wait 0.5 ai_active_set on end_monitor ;;;;;;;;Attacking;;;;;;;;; monitor_conditions I_BattleStarted and I_CompareCounter att_reinf_arrive = 1 and ! I_BattlePlayerArmyIsAttacker and ! I_BattleIsSiegeBattle and ! I_ConflictType SuccessfulAmbush and ! I_ConflictType FailedAmbush set_counter army3_ready 1 set_counter att_reinf_arrive 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army3_ready = 1 and I_CompareCounter army_moving = 0 and ! I_UnitEnemyUnitInRadius a3g1 160 and ! I_UnitGroupInRangeOfUnitGroup army1 army3 set_counter army3_run 1 set_counter army_moving 1 end_monitor

monitor_conditions I_BattleStarted and I_CompareCounter army3_ready = 1 and I_CompareCounter army_moving = 1 and I_UnitEnemyUnitInRadius a3g1 160 and ! I_UnitGroupInRangeOfUnitGroup army1 army3 unit_group_order_halt army3 battle_wait 0.5 ai_active_set on set_counter army_moving 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter reinf_late = 1 and I_CompareCounter army3_ready = 1 and ! I_UnitEnemyUnitInRadius a3g1 160 and ! I_UnitGroupInRangeOfUnitGroup army1 army3 set_counter army3_run 1 set_counter army_moving 1 set_counter reinf_late 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army3_ready = 1 and I_CompareCounter army_moving = 1 and ! I_UnitEnemyUnitInRadius a3g1 160 and I_UnitDistanceFromUnit a1g1 a3g1 > 150 and I_IsUnitIdle a3g1 set_counter reinf_late 1 battle_wait 1 set_counter army_moving 1 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army3_ready = 1 and I_CompareCounter distance_trigger1 = 0 and I_UnitDistanceFromUnit a3g1 a1g1 < 1000 set_counter reinf_late 1 set_counter distance_trigger1 1 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army3_ready = 1 and I_CompareCounter distance_trigger2 = 0 and I_UnitDistanceFromUnit a3g1 a1g1 < 750 set_counter reinf_late 1 set_counter distance_trigger2 1 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army3_ready = 1 and I_CompareCounter distance_trigger3 = 0 and I_UnitDistanceFromUnit a3g1 a1g1 < 500 set_counter reinf_late 1

set_counter distance_trigger3 1 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army3_ready = 1 and I_CompareCounter distance_trigger4 = 0 and I_UnitDistanceFromUnit a3g1 a1g1 < 300 set_counter reinf_late 1 set_counter distance_trigger4 1 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army3_ready = 1 and I_CompareCounter distance_trigger5 = 0 and I_UnitDistanceFromUnit a3g1 a1g1 < 200 set_counter reinf_late 1 set_counter distance_trigger5 1 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army3_run = 1 label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit label_unit 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 a3g1 1 a3u2 2 a3u3 3 a3u4 4 a3u5 5 a3u6 6 a3u7 7 a3u8 8 a3u9 9 a3u10 10 a3u11 11 a3u12 12 a3u13 13 a3u14 14 a3u15 15 a3u16 16 a3u17 17 a3u18 18 a3u19 19 a3u20

unit_group_order_halt army3 battle_wait 0.5 unit_group_move_to_missile_range_of_unit army3 a1g1 run set_counter army3_run 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army3_ready = 1 and I_UnitDistanceFromUnit a3g1 a1g1 < 150 and I_UnitEnemyUnitInRadius a1g1 100 set_counter army3_ready 0 unit_group_order_halt army3 battle_wait 0.5 ai_active_set on

end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army3_ready = 1 and I_UnitDistanceFromUnit a3g1 a1g1 < 100 set_counter army3_ready 0 unit_group_order_halt army3 battle_wait 0.5 ai_active_set on end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army3_ready = 1 and I_PercentageUnitKilled a3g1 > 60 set_counter army3_ready 0 unit_group_order_halt army3 battle_wait 0.5 ai_active_set on end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army3_ready = 1 and I_UnitDistanceFromUnit a3g1 a2g1 < 200 and I_UnitDistanceFromUnit a1g1 a2g1 < 200 set_counter army3_ready 0 unit_group_order_halt army3 battle_wait 0.5 ai_active_set on end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army3_ready = 1 and I_PercentageUnitGroupKilled army3 > 50 set_counter army3_ready 0 unit_group_order_halt army3 battle_wait 0.5 ai_active_set on end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army3_ready = 1 and I_UnitDistanceFromUnit a3g1 a1g1 < 250 and I_UnitGroupInRangeOfUnit army3 a1g1 set_counter army3_ready 0 unit_group_order_halt army3 battle_wait 0.5 ai_active_set on end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army3_ready = 1 and I_UnitDistanceFromUnit a1g1 a3g1 < 250 and I_IsUnitIdle a3g1 set_counter army3_ready 0

unit_group_order_halt army3 battle_wait 0.5 ai_active_set on end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army3_ready = 1 and I_IsUnitRouting a1g1 set_counter army3_ready 0 unit_group_order_halt army3 battle_wait 0.5 ai_active_set on end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army3_ready = 1 and I_PercentageUnitKilled a1g1 > 80 set_counter army3_ready 0 unit_group_order_halt army3 battle_wait 0.5 ai_active_set on end_monitor monitor_conditions I_BattleStarted and I_CompareCounter army3_ready = 1 and I_UnitDistanceFromUnit a1g1 a3g1 < 250 and I_IsUnitUnderFire a3g1 set_counter army3_ready 0 unit_group_order_halt army3 battle_wait 0.5 ai_active_set on end_monitor ;################## Germanicu5 Integrated Stakes script ######################## ### monitor_conditions I_BattleStarted and I_CompareCounter label_ready = 1 and I_BattlePlayerArmyIsAttacker and ! I_BattleAiAttacking and ! I_ConflictType SuccessfulAmbush and ! I_BattleIsSiegeBattle and ! I_BattleIsSallyOutBattle and I_BattlePlayerArmyNumberOfUnitCategory cavalry > 0 and I_BattleEnemyArmyNumberOfAttribute stakes > 0 and I_UnitEnemyUnitInRadius a2g1 150 set_counter stakes_on 1 set_counter label_ready 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter label_ready = 1 and I_BattlePlayerArmyIsAttacker ; and ! I_BattleAiAttacking and I_BattleIsSallyOutBattle and I_BattleSettlementFortificationLevel < 3

and and and and and and and

I_IsBattleSettlementCastle I_BattlePlayerAllianceOddsAgainst < 2.0 I_BattleEnemyArmyNumberOfSpecialAbility drop_engines < 3 I_BattlePlayerArmyNumberOfUnitCategory cavalry > 0 I_BattleEnemyArmyNumberOfAttribute stakes > 0 I_BattleEnemyArmyNumberOfUnitCategory cavalry = 0 I_UnitEnemyUnitInRadius a2g1 150

set_counter stakes_on 1 set_counter label_ready 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter label_ready = 1 and I_BattlePlayerArmyIsAttacker ; and ! I_BattleAiAttacking and I_BattleIsSallyOutBattle and I_BattleSettlementFortificationLevel > 2 and I_IsBattleSettlementCastle and I_BattlePlayerAllianceOddsAgainst < 2.5 and I_BattleEnemyArmyNumberOfSpecialAbility drop_engines < 4 and I_BattlePlayerArmyNumberOfUnitCategory cavalry > 0 and I_BattleEnemyArmyNumberOfAttribute stakes > 0 and I_BattleEnemyArmyNumberOfUnitCategory cavalry = 0 and I_UnitEnemyUnitInRadius a2g1 150 set_counter stakes_on 1 set_counter label_ready 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter label_ready = 1 and I_BattlePlayerArmyIsAttacker ; and ! I_BattleAiAttacking and I_BattleIsSallyOutBattle and I_BattleSettlementFortificationLevel < 3 and ! I_IsBattleSettlementCastle and I_BattleEnemyArmyNumberOfSpecialAbility drop_engines < 3 and I_BattlePlayerAllianceOddsAgainst < 1.7 and I_BattlePlayerArmyNumberOfUnitCategory cavalry > 0 and I_BattleEnemyArmyNumberOfAttribute stakes > 0 and I_BattleEnemyArmyNumberOfUnitCategory cavalry = 0 and I_UnitEnemyUnitInRadius a2g1 150 set_counter stakes_on 1 set_counter label_ready 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter label_ready = 1 and I_BattlePlayerArmyIsAttacker ; and ! I_BattleAiAttacking and I_BattleIsSallyOutBattle and I_BattleSettlementFortificationLevel > 2 and ! I_IsBattleSettlementCastle and I_BattleEnemyArmyNumberOfSpecialAbility drop_engines < 3 and I_BattlePlayerAllianceOddsAgainst < 2.2 and I_BattlePlayerArmyNumberOfUnitCategory cavalry > 0 and I_BattleEnemyArmyNumberOfAttribute stakes > 0 and I_BattleEnemyArmyNumberOfUnitCategory cavalry = 0

and I_UnitEnemyUnitInRadius a2g1 150 set_counter stakes_on 1 set_counter label_ready 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter stakes_on = 1 and I_BattlePlayerArmyNumberOfUnitCategory cavalry > 0 and I_BattleEnemyArmyNumberOfAttribute stakes > 0 if I_CompareCounter enemy_unit_count > 0 if ! I_UnitDestroyed a2g1 and ! I_UnitStatus a2g1 left_battle and ! I_IsUnitRouting a2g1 and I_UnitEnemyUnitInRadius a2g1 60 and I_CompareCounter stakes_on != 2 set_counter stakes_on 2 end_if if I_CompareCounter enemy_unit_count > 1 if ! I_UnitDestroyed a2u2 and ! I_UnitStatus a2u2 left_battle and ! I_IsUnitRouting a2u2 and I_UnitEnemyUnitInRadius a2u2 60 and I_CompareCounter stakes_on != 2 set_counter stakes_on 2 end_if if I_CompareCounter enemy_unit_count > 2 if ! I_UnitDestroyed a2u3 and ! I_UnitStatus a2u3 left_battle and ! I_IsUnitRouting a2u3 and I_UnitEnemyUnitInRadius a2u3 60 and I_CompareCounter stakes_on != 2 set_counter stakes_on 2 end_if if I_CompareCounter enemy_unit_count > 3 if ! I_UnitDestroyed a2u4 and ! I_UnitStatus a2u4 left_battle and ! I_IsUnitRouting a2u4 and I_UnitEnemyUnitInRadius a2u4 60 and I_CompareCounter stakes_on != 2 set_counter stakes_on 2 end_if if I_CompareCounter enemy_unit_count > 4 if ! I_UnitDestroyed a2u5 and ! I_UnitStatus a2u5 left_battle and ! I_IsUnitRouting a2u5 and I_UnitEnemyUnitInRadius a2u5 60 and I_CompareCounter stakes_on != 2 set_counter stakes_on 2 end_if if I_CompareCounter enemy_unit_count > 5 if ! I_UnitDestroyed a2u6 and ! I_UnitStatus a2u6 left_battle and ! I_IsUnitRouting a2u6

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

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

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

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

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

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

if I_CompareCounter enemy_unit_count > 10 unit_deploy_stakes a2u11 if I_CompareCounter enemy_unit_count > 11 unit_deploy_stakes a2u12 if I_CompareCounter enemy_unit_count > 12 unit_deploy_stakes a2u13 if I_CompareCounter enemy_unit_count > 13 unit_deploy_stakes a2u14 if I_CompareCounter enemy_unit_count > 14 unit_deploy_stakes a2u15 if I_CompareCounter enemy_unit_count > 15 unit_deploy_stakes a2u16 if I_CompareCounter enemy_unit_count > 16 unit_deploy_stakes a2u17 if I_CompareCounter enemy_unit_count > 17 unit_deploy_stakes a2u18 if I_CompareCounter enemy_unit_count > 18 unit_deploy_stakes a2u19 if I_CompareCounter enemy_unit_count = 20 unit_deploy_stakes a2u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if battle_wait 0.5 ai_active_set on set_counter label_ready 0 end_monitor ;;;;;;;;HA fix;;;;;;;;;;;; ;monitor_conditions I_BattleStarted ; and I_CompareCounter ha_fix = 1

; and I_CompareCounter open_battle = 1 ; and I_BattlePlayerArmyIsAttacker ; and ! I_BattleAiAttacking ; and I_BattleEnemyArmyPercentageOfUnitCategory cavalry > 60 ; and I_UnitEnemyUnitInRadius a2g1 250 ; ai_gta_plan_set 1 ATTACK_ALL ; set_counter ha_fix 0 ; set_counter ob_defense_launch 0 ; set_counter ob_defend 4 ;end_monitor monitor_conditions I_BattleStarted and I_CompareCounter ha_fix = 1 and I_CompareCounter open_battle = 1 and ! I_BattlePlayerArmyIsAttacker and ! I_BattleAiAttacking ; and I_BattleEnemyArmyPercentageOfUnitCategory cavalry > 60 ai_gta_plan_set 0 ATTACK_ALL set_counter ha_fix 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter ha_fix = 1 and I_BattleIsRiverBattle and ! I_BattlePlayerArmyIsAttacker and ! I_BattleAiAssaultingCrossing ; and I_BattleEnemyArmyPercentageOfUnitCategory cavalry >= 60 ai_gta_add_objective 0 ASSAULT_CROSSING 999 ; ai_active_set off if I_CompareCounter enemy_unit_count > 0 ai_gta_add_unit_label 0 0 a1g1 if I_CompareCounter enemy_unit_count > 1 ai_gta_add_unit_label 0 0 a1u2 if I_CompareCounter enemy_unit_count > 2 ai_gta_add_unit_label 0 0 a1u3 if I_CompareCounter enemy_unit_count > 3 ai_gta_add_unit_label 0 0 a1u4 if I_CompareCounter enemy_unit_count > 4 ai_gta_add_unit_label 0 0 a1u5 if I_CompareCounter enemy_unit_count > 5 ai_gta_add_unit_label 0 0 a1u6 if I_CompareCounter enemy_unit_count > 6 ai_gta_add_unit_label 0 0 a1u7 if I_CompareCounter enemy_unit_count > 7 ai_gta_add_unit_label 0 0 a1u8 if I_CompareCounter enemy_unit_count > 8 ai_gta_add_unit_label 0 0 a1u9

if I_CompareCounter enemy_unit_count > 9 ai_gta_add_unit_label 0 0 a1u10 if I_CompareCounter enemy_unit_count > 10 ai_gta_add_unit_label 0 0 a1u11 if I_CompareCounter enemy_unit_count > 11 ai_gta_add_unit_label 0 0 a1u12 if I_CompareCounter enemy_unit_count > 12 ai_gta_add_unit_label 0 0 a1u13 if I_CompareCounter enemy_unit_count > 13 ai_gta_add_unit_label 0 0 a1u14 if I_CompareCounter enemy_unit_count > 14 ai_gta_add_unit_label 0 0 a1u15 if I_CompareCounter enemy_unit_count > 15 ai_gta_add_unit_label 0 0 a1u16 if I_CompareCounter enemy_unit_count > 16 ai_gta_add_unit_label 0 0 a1u17 if I_CompareCounter enemy_unit_count > 17 ai_gta_add_unit_label 0 0 a1u18 if I_CompareCounter enemy_unit_count > 18 ai_gta_add_unit_label 0 0 a1u19 if I_CompareCounter enemy_unit_count = 20 ai_gta_add_unit_label 0 0 a1u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if battle_wait 0.5 ai_active_set on set_counter ha_fix 0 end_monitor ;;;;;;;;Elephant;;;;;;;;;;;;

monitor_conditions I_BattleStarted and I_CompareCounter elephant_fix = 1 and I_BattleIsSiegeBattle and ! I_BattleIsFortBattle and ! I_BattlePlayerArmyIsAttacker and I_IsBattleSettlementCastle and I_BattleEnemyArmyNumberOfMountClass elephant > 0 ; ai_gta_add_objective 0 ATTACK_ENEMY_BATTLEGROUP 999 ai_active_set off if I_CompareCounter enemy_unit_count > 0 if I_UnitFormation a1g1 = horde and ! I_UnitStatus a1g1 running_amok and ! I_UnitDestroyed a1g1 and ! I_UnitStatus a1g1 left_battle and ! I_IsUnitRouting a1g1 ai_gta_add_unit_label 0 0 a1g1 end_if if I_CompareCounter enemy_unit_count > 1 if I_UnitFormation a1u2 = horde and ! I_UnitStatus a1u2 running_amok and ! I_UnitDestroyed a1u2 and ! I_UnitStatus a1u2 left_battle and ! I_IsUnitRouting a1u2 ai_gta_add_unit_label 0 0 a1u2 end_if if I_CompareCounter enemy_unit_count > 2 if I_UnitFormation a1u3 = horde and ! I_UnitStatus a1u3 running_amok and ! I_UnitDestroyed a1u3 and ! I_UnitStatus a1u3 left_battle and ! I_IsUnitRouting a1u3 ai_gta_add_unit_label 0 0 a1u3 end_if if I_CompareCounter enemy_unit_count > 3 if I_UnitFormation a1u4 = horde and ! I_UnitStatus a1u4 running_amok and ! I_UnitDestroyed a1u4 and ! I_UnitStatus a1u4 left_battle and ! I_IsUnitRouting a1u4 ai_gta_add_unit_label 0 0 a1u4 end_if if I_CompareCounter enemy_unit_count > 4 if I_UnitFormation a1u5 = horde and ! I_UnitStatus a1u5 running_amok and ! I_UnitDestroyed a1u5 and ! I_UnitStatus a1u5 left_battle and ! I_IsUnitRouting a1u5 ai_gta_add_unit_label 0 0 a1u5 end_if if I_CompareCounter enemy_unit_count > 5 if I_UnitFormation a1u6 = horde and ! I_UnitStatus a1u6 running_amok and ! I_UnitDestroyed a1u6

and ! I_UnitStatus a1u6 left_battle and ! I_IsUnitRouting a1u6 ai_gta_add_unit_label 0 0 a1u6 end_if if I_CompareCounter enemy_unit_count > 6 if I_UnitFormation a1u7 = horde and ! I_UnitStatus a1u7 running_amok and ! I_UnitDestroyed a1u7 and ! I_UnitStatus a1u7 left_battle and ! I_IsUnitRouting a1u7 ai_gta_add_unit_label 0 0 a1u7 end_if if I_CompareCounter enemy_unit_count > 7 if I_UnitFormation a1u8 = horde and ! I_UnitStatus a1u8 running_amok and ! I_UnitDestroyed a1u8 and ! I_UnitStatus a1u8 left_battle and ! I_IsUnitRouting a1u8 ai_gta_add_unit_label 0 0 a1u8 end_if if I_CompareCounter enemy_unit_count > 8 if I_UnitFormation a1u9 = horde and ! I_UnitStatus a1u9 running_amok and ! I_UnitDestroyed a1u9 and ! I_UnitStatus a1u9 left_battle and ! I_IsUnitRouting a1u9 ai_gta_add_unit_label 0 0 a1u9 end_if if I_CompareCounter enemy_unit_count > 9 if I_UnitFormation a1u10 = horde and ! I_UnitStatus a1u10 running_amok and ! I_UnitDestroyed a1u10 and ! I_UnitStatus a1u10 left_battle and ! I_IsUnitRouting a1u10 ai_gta_add_unit_label 0 0 a1u10 end_if if I_CompareCounter enemy_unit_count > 10 if I_UnitFormation a1u11 = horde and ! I_UnitStatus a1u11 running_amok and ! I_UnitDestroyed a1u11 and ! I_UnitStatus a1u11 left_battle and ! I_IsUnitRouting a1u11 ai_gta_add_unit_label 0 0 a1u11 end_if if I_CompareCounter enemy_unit_count > 11 if I_UnitFormation a1u12 = horde and ! I_UnitStatus a1u12 running_amok and ! I_UnitDestroyed a1u12 and ! I_UnitStatus a1u12 left_battle and ! I_IsUnitRouting a1u12 ai_gta_add_unit_label 0 0 a1u12 end_if if I_CompareCounter enemy_unit_count > 12

if I_UnitFormation a1u13 = horde and ! I_UnitStatus a1u13 running_amok and ! I_UnitDestroyed a1u13 and ! I_UnitStatus a1u13 left_battle and ! I_IsUnitRouting a1u13 ai_gta_add_unit_label 0 0 a1u13 end_if if I_CompareCounter enemy_unit_count > 13 if I_UnitFormation a1u14 = horde and ! I_UnitStatus a1u14 running_amok and ! I_UnitDestroyed a1u14 and ! I_UnitStatus a1u14 left_battle and ! I_IsUnitRouting a1u14 ai_gta_add_unit_label 0 0 a1u14 end_if if I_CompareCounter enemy_unit_count > 14 if I_UnitFormation a1u15 = horde and ! I_UnitStatus a1u15 running_amok and ! I_UnitDestroyed a1u15 and ! I_UnitStatus a1u15 left_battle and ! I_IsUnitRouting a1u15 ai_gta_add_unit_label 0 0 a1u15 end_if if I_CompareCounter enemy_unit_count > 15 if I_UnitFormation a1u16 = horde and ! I_UnitStatus a1u16 running_amok and ! I_UnitDestroyed a1u16 and ! I_UnitStatus a1u16 left_battle and ! I_IsUnitRouting a1u16 ai_gta_add_unit_label 0 0 a1u16 end_if if I_CompareCounter enemy_unit_count > 16 if I_UnitFormation a1u17 = horde and ! I_UnitStatus a1u17 running_amok and ! I_UnitDestroyed a1u17 and ! I_UnitStatus a1u17 left_battle and ! I_IsUnitRouting a1u17 ai_gta_add_unit_label 0 0 a1u17 end_if if I_CompareCounter enemy_unit_count > 17 if I_UnitFormation a1u18 = horde and ! I_UnitStatus a1u18 running_amok and ! I_UnitDestroyed a1u18 and ! I_UnitStatus a1u18 left_battle and ! I_IsUnitRouting a1u18 ai_gta_add_unit_label 0 0 a1u18 end_if if I_CompareCounter enemy_unit_count > 18 if I_UnitFormation a1u19 = horde and ! I_UnitStatus a1u19 running_amok and ! I_UnitDestroyed a1u19 and ! I_UnitStatus a1u19 left_battle and ! I_IsUnitRouting a1u19 ai_gta_add_unit_label 0 0 a1u19

end_if if I_CompareCounter enemy_unit_count = 20 if I_UnitFormation a1u20 = horde and ! I_UnitStatus a1u20 running_amok and ! I_UnitDestroyed a1u20 and ! I_UnitStatus a1u20 left_battle and ! I_IsUnitRouting a1u20 ai_gta_add_unit_label 0 0 a1u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if battle_wait 0.5 ai_active_set on set_counter elephant_gate 1 set_counter elephant_fix 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter elephant_fix = 1 and I_BattleIsSiegeBattle and ! I_BattleIsFortBattle and ! I_BattlePlayerArmyIsAttacker and ! I_IsBattleSettlementCastle and I_BattleEnemyArmyNumberOfMountClass elephant > 0 ; ai_gta_add_objective 0 ATTACK_ENEMY_BATTLEGROUP 999 ai_active_set off unit_group_order_halt army1 if I_CompareCounter enemy_unit_count > 0 if I_UnitFormation a1g1 = horde and ! I_UnitStatus a1g1 running_amok and ! I_UnitDestroyed a1g1 and ! I_UnitStatus a1g1 left_battle and ! I_IsUnitRouting a1g1 ai_gta_add_unit_label 0 0 a1g1 end_if if I_CompareCounter enemy_unit_count > 1 if I_UnitFormation a1u2 = horde

and ! I_UnitStatus a1u2 running_amok and ! I_UnitDestroyed a1u2 and ! I_UnitStatus a1u2 left_battle and ! I_IsUnitRouting a1u2 ai_gta_add_unit_label 0 0 a1u2 end_if if I_CompareCounter enemy_unit_count > 2 if I_UnitFormation a1u3 = horde and ! I_UnitStatus a1u3 running_amok and ! I_UnitDestroyed a1u3 and ! I_UnitStatus a1u3 left_battle and ! I_IsUnitRouting a1u3 ai_gta_add_unit_label 0 0 a1u3 end_if if I_CompareCounter enemy_unit_count > 3 if I_UnitFormation a1u4 = horde and ! I_UnitStatus a1u4 running_amok and ! I_UnitDestroyed a1u4 and ! I_UnitStatus a1u4 left_battle and ! I_IsUnitRouting a1u4 ai_gta_add_unit_label 0 0 a1u4 end_if if I_CompareCounter enemy_unit_count > 4 if I_UnitFormation a1u5 = horde and ! I_UnitStatus a1u5 running_amok and ! I_UnitDestroyed a1u5 and ! I_UnitStatus a1u5 left_battle and ! I_IsUnitRouting a1u5 ai_gta_add_unit_label 0 0 a1u5 end_if if I_CompareCounter enemy_unit_count > 5 if I_UnitFormation a1u6 = horde and ! I_UnitStatus a1u6 running_amok and ! I_UnitDestroyed a1u6 and ! I_UnitStatus a1u6 left_battle and ! I_IsUnitRouting a1u6 ai_gta_add_unit_label 0 0 a1u6 end_if if I_CompareCounter enemy_unit_count > 6 if I_UnitFormation a1u7 = horde and ! I_UnitStatus a1u7 running_amok and ! I_UnitDestroyed a1u7 and ! I_UnitStatus a1u7 left_battle and ! I_IsUnitRouting a1u7 ai_gta_add_unit_label 0 0 a1u7 end_if if I_CompareCounter enemy_unit_count > 7 if I_UnitFormation a1u8 = horde and ! I_UnitStatus a1u8 running_amok and ! I_UnitDestroyed a1u8 and ! I_UnitStatus a1u8 left_battle and ! I_IsUnitRouting a1u8 ai_gta_add_unit_label 0 0 a1u8 end_if

if I_CompareCounter enemy_unit_count > 8 if I_UnitFormation a1u9 = horde and ! I_UnitStatus a1u9 running_amok and ! I_UnitDestroyed a1u9 and ! I_UnitStatus a1u9 left_battle and ! I_IsUnitRouting a1u9 ai_gta_add_unit_label 0 0 a1u9 end_if if I_CompareCounter enemy_unit_count > 9 if I_UnitFormation a1u10 = horde and ! I_UnitStatus a1u10 running_amok and ! I_UnitDestroyed a1u10 and ! I_UnitStatus a1u10 left_battle and ! I_IsUnitRouting a1u10 ai_gta_add_unit_label 0 0 a1u10 end_if if I_CompareCounter enemy_unit_count > 10 if I_UnitFormation a1u11 = horde and ! I_UnitStatus a1u11 running_amok and ! I_UnitDestroyed a1u11 and ! I_UnitStatus a1u11 left_battle and ! I_IsUnitRouting a1u11 ai_gta_add_unit_label 0 0 a1u11 end_if if I_CompareCounter enemy_unit_count > 11 if I_UnitFormation a1u12 = horde and ! I_UnitStatus a1u12 running_amok and ! I_UnitDestroyed a1u12 and ! I_UnitStatus a1u12 left_battle and ! I_IsUnitRouting a1u12 ai_gta_add_unit_label 0 0 a1u12 end_if if I_CompareCounter enemy_unit_count > 12 if I_UnitFormation a1u13 = horde and ! I_UnitStatus a1u13 running_amok and ! I_UnitDestroyed a1u13 and ! I_UnitStatus a1u13 left_battle and ! I_IsUnitRouting a1u13 ai_gta_add_unit_label 0 0 a1u13 end_if if I_CompareCounter enemy_unit_count > 13 if I_UnitFormation a1u14 = horde and ! I_UnitStatus a1u14 running_amok and ! I_UnitDestroyed a1u14 and ! I_UnitStatus a1u14 left_battle and ! I_IsUnitRouting a1u14 ai_gta_add_unit_label 0 0 a1u14 end_if if I_CompareCounter enemy_unit_count > 14 if I_UnitFormation a1u15 = horde and ! I_UnitStatus a1u15 running_amok and ! I_UnitDestroyed a1u15 and ! I_UnitStatus a1u15 left_battle

and ! I_IsUnitRouting a1u15 ai_gta_add_unit_label 0 0 a1u15 end_if if I_CompareCounter enemy_unit_count > 15 if I_UnitFormation a1u16 = horde and ! I_UnitStatus a1u16 running_amok and ! I_UnitDestroyed a1u16 and ! I_UnitStatus a1u16 left_battle and ! I_IsUnitRouting a1u16 ai_gta_add_unit_label 0 0 a1u16 end_if if I_CompareCounter enemy_unit_count > 16 if I_UnitFormation a1u17 = horde and ! I_UnitStatus a1u17 running_amok and ! I_UnitDestroyed a1u17 and ! I_UnitStatus a1u17 left_battle and ! I_IsUnitRouting a1u17 ai_gta_add_unit_label 0 0 a1u17 end_if if I_CompareCounter enemy_unit_count > 17 if I_UnitFormation a1u18 = horde and ! I_UnitStatus a1u18 running_amok and ! I_UnitDestroyed a1u18 and ! I_UnitStatus a1u18 left_battle and ! I_IsUnitRouting a1u18 ai_gta_add_unit_label 0 0 a1u18 end_if if I_CompareCounter enemy_unit_count > 18 if I_UnitFormation a1u19 = horde and ! I_UnitStatus a1u19 running_amok and ! I_UnitDestroyed a1u19 and ! I_UnitStatus a1u19 left_battle and ! I_IsUnitRouting a1u19 ai_gta_add_unit_label 0 0 a1u19 end_if if I_CompareCounter enemy_unit_count = 20 if I_UnitFormation a1u20 = horde and ! I_UnitStatus a1u20 running_amok and ! I_UnitDestroyed a1u20 and ! I_UnitStatus a1u20 left_battle and ! I_IsUnitRouting a1u20 ai_gta_add_unit_label 0 0 a1u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if

end_if end_if end_if end_if end_if end_if end_if end_if unit_group_order_halt army1 battle_wait 0.5 unit_group_order_change_group_formation army1 ai_wall_assault battle_wait 0.5 ai_active_set on set_counter elephant_gate 1 set_counter elephant_fix 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter elephant_fix = 1 and I_BattleIsSiegeBattle and I_BattleIsFortBattle and ! I_BattlePlayerArmyIsAttacker and I_BattleEnemyArmyNumberOfMountClass elephant > 0 ; ai_gta_add_objective 0 ATTACK_ENEMY_BATTLEGROUP 999 ai_active_set off if I_CompareCounter enemy_unit_count > 0 if I_UnitFormation a1g1 = horde and ! I_UnitStatus a1g1 running_amok and ! I_UnitDestroyed a1g1 and ! I_UnitStatus a1g1 left_battle and ! I_IsUnitRouting a1g1 ai_gta_add_unit_label 0 0 a1g1 end_if if I_CompareCounter enemy_unit_count > 1 if I_UnitFormation a1u2 = horde and ! I_UnitStatus a1u2 running_amok and ! I_UnitDestroyed a1u2 and ! I_UnitStatus a1u2 left_battle and ! I_IsUnitRouting a1u2 ai_gta_add_unit_label 0 0 a1u2 end_if if I_CompareCounter enemy_unit_count > 2 if I_UnitFormation a1u3 = horde and ! I_UnitStatus a1u3 running_amok and ! I_UnitDestroyed a1u3 and ! I_UnitStatus a1u3 left_battle and ! I_IsUnitRouting a1u3 ai_gta_add_unit_label 0 0 a1u3 end_if if I_CompareCounter enemy_unit_count > 3 if I_UnitFormation a1u4 = horde and ! I_UnitStatus a1u4 running_amok and ! I_UnitDestroyed a1u4 and ! I_UnitStatus a1u4 left_battle

and ! I_IsUnitRouting a1u4 ai_gta_add_unit_label 0 0 a1u4 end_if if I_CompareCounter enemy_unit_count > 4 if I_UnitFormation a1u5 = horde and ! I_UnitStatus a1u5 running_amok and ! I_UnitDestroyed a1u5 and ! I_UnitStatus a1u5 left_battle and ! I_IsUnitRouting a1u5 ai_gta_add_unit_label 0 0 a1u5 end_if if I_CompareCounter enemy_unit_count > 5 if I_UnitFormation a1u6 = horde and ! I_UnitStatus a1u6 running_amok and ! I_UnitDestroyed a1u6 and ! I_UnitStatus a1u6 left_battle and ! I_IsUnitRouting a1u6 ai_gta_add_unit_label 0 0 a1u6 end_if if I_CompareCounter enemy_unit_count > 6 if I_UnitFormation a1u7 = horde and ! I_UnitStatus a1u7 running_amok and ! I_UnitDestroyed a1u7 and ! I_UnitStatus a1u7 left_battle and ! I_IsUnitRouting a1u7 ai_gta_add_unit_label 0 0 a1u7 end_if if I_CompareCounter enemy_unit_count > 7 if I_UnitFormation a1u8 = horde and ! I_UnitStatus a1u8 running_amok and ! I_UnitDestroyed a1u8 and ! I_UnitStatus a1u8 left_battle and ! I_IsUnitRouting a1u8 ai_gta_add_unit_label 0 0 a1u8 end_if if I_CompareCounter enemy_unit_count > 8 if I_UnitFormation a1u9 = horde and ! I_UnitStatus a1u9 running_amok and ! I_UnitDestroyed a1u9 and ! I_UnitStatus a1u9 left_battle and ! I_IsUnitRouting a1u9 ai_gta_add_unit_label 0 0 a1u9 end_if if I_CompareCounter enemy_unit_count > 9 if I_UnitFormation a1u10 = horde and ! I_UnitStatus a1u10 running_amok and ! I_UnitDestroyed a1u10 and ! I_UnitStatus a1u10 left_battle and ! I_IsUnitRouting a1u10 ai_gta_add_unit_label 0 0 a1u10 end_if if I_CompareCounter enemy_unit_count > 10 if I_UnitFormation a1u11 = horde

and ! I_UnitStatus a1u11 running_amok and ! I_UnitDestroyed a1u11 and ! I_UnitStatus a1u11 left_battle and ! I_IsUnitRouting a1u11 ai_gta_add_unit_label 0 0 a1u11 end_if if I_CompareCounter enemy_unit_count > 11 if I_UnitFormation a1u12 = horde and ! I_UnitStatus a1u12 running_amok and ! I_UnitDestroyed a1u12 and ! I_UnitStatus a1u12 left_battle and ! I_IsUnitRouting a1u12 ai_gta_add_unit_label 0 0 a1u12 end_if if I_CompareCounter enemy_unit_count > 12 if I_UnitFormation a1u13 = horde and ! I_UnitStatus a1u13 running_amok and ! I_UnitDestroyed a1u13 and ! I_UnitStatus a1u13 left_battle and ! I_IsUnitRouting a1u13 ai_gta_add_unit_label 0 0 a1u13 end_if if I_CompareCounter enemy_unit_count > 13 if I_UnitFormation a1u14 = horde and ! I_UnitStatus a1u14 running_amok and ! I_UnitDestroyed a1u14 and ! I_UnitStatus a1u14 left_battle and ! I_IsUnitRouting a1u14 ai_gta_add_unit_label 0 0 a1u14 end_if if I_CompareCounter enemy_unit_count > 14 if I_UnitFormation a1u15 = horde and ! I_UnitStatus a1u15 running_amok and ! I_UnitDestroyed a1u15 and ! I_UnitStatus a1u15 left_battle and ! I_IsUnitRouting a1u15 ai_gta_add_unit_label 0 0 a1u15 end_if if I_CompareCounter enemy_unit_count > 15 if I_UnitFormation a1u16 = horde and ! I_UnitStatus a1u16 running_amok and ! I_UnitDestroyed a1u16 and ! I_UnitStatus a1u16 left_battle and ! I_IsUnitRouting a1u16 ai_gta_add_unit_label 0 0 a1u16 end_if if I_CompareCounter enemy_unit_count > 16 if I_UnitFormation a1u17 = horde and ! I_UnitStatus a1u17 running_amok and ! I_UnitDestroyed a1u17 and ! I_UnitStatus a1u17 left_battle and ! I_IsUnitRouting a1u17 ai_gta_add_unit_label 0 0 a1u17 end_if

if I_CompareCounter enemy_unit_count > 17 if I_UnitFormation a1u18 = horde and ! I_UnitStatus a1u18 running_amok and ! I_UnitDestroyed a1u18 and ! I_UnitStatus a1u18 left_battle and ! I_IsUnitRouting a1u18 ai_gta_add_unit_label 0 0 a1u18 end_if if I_CompareCounter enemy_unit_count > 18 if I_UnitFormation a1u19 = horde and ! I_UnitStatus a1u19 running_amok and ! I_UnitDestroyed a1u19 and ! I_UnitStatus a1u19 left_battle and ! I_IsUnitRouting a1u19 ai_gta_add_unit_label 0 0 a1u19 end_if if I_CompareCounter enemy_unit_count = 20 if I_UnitFormation a1u20 = horde and ! I_UnitStatus a1u20 running_amok and ! I_UnitDestroyed a1u20 and ! I_UnitStatus a1u20 left_battle and ! I_IsUnitRouting a1u20 ai_gta_add_unit_label 0 0 a1u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if battle_wait 0.5 ai_active_set on set_counter elephant_gate 1 set_counter elephant_fix 0 end_monitor monitor_event BattleEnemyUnitAttacksPlayerUnit BattleIsMeleeAttack and I_CompareCounter panel_check = 1 and I_CompareCounter rally_walls = 1 and ! BattlePlayerUnitOnWalls and ! BattleEnemyUnitOnWalls

if I_CompareCounter elephant_gate != 2 set_counter elephant_gate 0 set_counter del_objective 1 end_if set_counter elephant_fix_check 1 set_counter rally_walls 3 ; battle_wait 180 battle_wait 30 if I_CompareCounter rally_walls = 3 and I_CompareCounter elephant_fix_check 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 panel_check = 1 and I_CompareCounter rally_walls = 1 and ! BattlePlayerUnitOnWalls and ! BattleEnemyUnitOnWalls if I_CompareCounter elephant_gate != 2 set_counter elephant_gate 0 set_counter del_objective 1 end_if set_counter elephant_fix_check 1 set_counter rally_walls 3 battle_wait 180 battle_wait 30 if I_CompareCounter rally_walls = 3 and I_CompareCounter elephant_fix_check = 1 set_counter elephant_fix_check 2 battle_wait 30 if I_CompareCounter rally_walls = 3 and I_CompareCounter elephant_fix_check = 2

set_counter elephant_fix_check 3 battle_wait 30 if I_CompareCounter rally_walls = 3 and I_CompareCounter elephant_fix_check 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

= 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 0 ai_active_set off battle_wait 0.5 ai_active_set on set_counter del_objective 0 end_if end_monitor monitor_conditions I_BattleStarted and I_CompareCounter elephant_gate_tier2 = 1 and ! I_BattleIsFortBattle and I_BattleIsSiegeBattle and I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel > 2 ai_gta_add_objective 0 ATTACK_ENEMY_BATTLEGROUP 999 if I_CompareCounter enemy_unit_count > 0 if I_UnitFormation a1g1 = horde and ! I_UnitStatus a1g1 running_amok and ! I_UnitDestroyed a1g1 and ! I_UnitStatus a1g1 left_battle and ! I_IsUnitRouting a1g1 ai_gta_add_unit_label 0 0 a1g1 end_if

if I_CompareCounter enemy_unit_count > 1 if I_UnitFormation a1u2 = horde and ! I_UnitStatus a1u2 running_amok and ! I_UnitDestroyed a1u2 and ! I_UnitStatus a1u2 left_battle and ! I_IsUnitRouting a1u2 ai_gta_add_unit_label 0 0 a1u2 end_if if I_CompareCounter enemy_unit_count > 2 if I_UnitFormation a1u3 = horde and ! I_UnitStatus a1u3 running_amok and ! I_UnitDestroyed a1u3 and ! I_UnitStatus a1u3 left_battle and ! I_IsUnitRouting a1u3 ai_gta_add_unit_label 0 0 a1u3 end_if if I_CompareCounter enemy_unit_count > 3 if I_UnitFormation a1u4 = horde and ! I_UnitStatus a1u4 running_amok and ! I_UnitDestroyed a1u4 and ! I_UnitStatus a1u4 left_battle and ! I_IsUnitRouting a1u4 ai_gta_add_unit_label 0 0 a1u4 end_if if I_CompareCounter enemy_unit_count > 4 if I_UnitFormation a1u5 = horde and ! I_UnitStatus a1u5 running_amok and ! I_UnitDestroyed a1u5 and ! I_UnitStatus a1u5 left_battle and ! I_IsUnitRouting a1u5 ai_gta_add_unit_label 0 0 a1u5 end_if if I_CompareCounter enemy_unit_count > 5 if I_UnitFormation a1u6 = horde and ! I_UnitStatus a1u6 running_amok and ! I_UnitDestroyed a1u6 and ! I_UnitStatus a1u6 left_battle and ! I_IsUnitRouting a1u6 ai_gta_add_unit_label 0 0 a1u6 end_if if I_CompareCounter enemy_unit_count > 6 if I_UnitFormation a1u7 = horde and ! I_UnitStatus a1u7 running_amok and ! I_UnitDestroyed a1u7 and ! I_UnitStatus a1u7 left_battle and ! I_IsUnitRouting a1u7 ai_gta_add_unit_label 0 0 a1u7 end_if if I_CompareCounter enemy_unit_count > 7 if I_UnitFormation a1u8 = horde and ! I_UnitStatus a1u8 running_amok and ! I_UnitDestroyed a1u8 and ! I_UnitStatus a1u8 left_battle

and ! I_IsUnitRouting a1u8 ai_gta_add_unit_label 0 0 a1u8 end_if if I_CompareCounter enemy_unit_count > 8 if I_UnitFormation a1u9 = horde and ! I_UnitStatus a1u9 running_amok and ! I_UnitDestroyed a1u9 and ! I_UnitStatus a1u9 left_battle and ! I_IsUnitRouting a1u9 ai_gta_add_unit_label 0 0 a1u9 end_if if I_CompareCounter enemy_unit_count > 9 if I_UnitFormation a1u10 = horde and ! I_UnitStatus a1u10 running_amok and ! I_UnitDestroyed a1u10 and ! I_UnitStatus a1u10 left_battle and ! I_IsUnitRouting a1u10 ai_gta_add_unit_label 0 0 a1u10 end_if if I_CompareCounter enemy_unit_count > 10 if I_UnitFormation a1u11 = horde and ! I_UnitStatus a1u11 running_amok and ! I_UnitDestroyed a1u11 and ! I_UnitStatus a1u11 left_battle and ! I_IsUnitRouting a1u11 ai_gta_add_unit_label 0 0 a1u11 end_if if I_CompareCounter enemy_unit_count > 11 if I_UnitFormation a1u12 = horde and ! I_UnitStatus a1u12 running_amok and ! I_UnitDestroyed a1u12 and ! I_UnitStatus a1u12 left_battle and ! I_IsUnitRouting a1u12 ai_gta_add_unit_label 0 0 a1u12 end_if if I_CompareCounter enemy_unit_count > 12 if I_UnitFormation a1u13 = horde and ! I_UnitStatus a1u13 running_amok and ! I_UnitDestroyed a1u13 and ! I_UnitStatus a1u13 left_battle and ! I_IsUnitRouting a1u13 ai_gta_add_unit_label 0 0 a1u13 end_if if I_CompareCounter enemy_unit_count > 13 if I_UnitFormation a1u14 = horde and ! I_UnitStatus a1u14 running_amok and ! I_UnitDestroyed a1u14 and ! I_UnitStatus a1u14 left_battle and ! I_IsUnitRouting a1u14 ai_gta_add_unit_label 0 0 a1u14 end_if if I_CompareCounter enemy_unit_count > 14 if I_UnitFormation a1u15 = horde

and ! I_UnitStatus a1u15 running_amok and ! I_UnitDestroyed a1u15 and ! I_UnitStatus a1u15 left_battle and ! I_IsUnitRouting a1u15 ai_gta_add_unit_label 0 0 a1u15 end_if if I_CompareCounter enemy_unit_count > 15 if I_UnitFormation a1u16 = horde and ! I_UnitStatus a1u16 running_amok and ! I_UnitDestroyed a1u16 and ! I_UnitStatus a1u16 left_battle and ! I_IsUnitRouting a1u16 ai_gta_add_unit_label 0 0 a1u16 end_if if I_CompareCounter enemy_unit_count > 16 if I_UnitFormation a1u17 = horde and ! I_UnitStatus a1u17 running_amok and ! I_UnitDestroyed a1u17 and ! I_UnitStatus a1u17 left_battle and ! I_IsUnitRouting a1u17 ai_gta_add_unit_label 0 0 a1u17 end_if if I_CompareCounter enemy_unit_count > 17 if I_UnitFormation a1u18 = horde and ! I_UnitStatus a1u18 running_amok and ! I_UnitDestroyed a1u18 and ! I_UnitStatus a1u18 left_battle and ! I_IsUnitRouting a1u18 ai_gta_add_unit_label 0 0 a1u18 end_if if I_CompareCounter enemy_unit_count > 18 if I_UnitFormation a1u19 = horde and ! I_UnitStatus a1u19 running_amok and ! I_UnitDestroyed a1u19 and ! I_UnitStatus a1u19 left_battle and ! I_IsUnitRouting a1u19 ai_gta_add_unit_label 0 0 a1u19 end_if if I_CompareCounter enemy_unit_count = 20 if I_UnitFormation a1u20 = horde and ! I_UnitStatus a1u20 running_amok and ! I_UnitDestroyed a1u20 and ! I_UnitStatus a1u20 left_battle and ! I_IsUnitRouting a1u20 ai_gta_add_unit_label 0 0 a1u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if

end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if battle_wait 0.5 ai_active_set on set_counter second_ring 1 set_counter elephant_gate_tier2 0 end_monitor monitor_event BattleEnemyUnitAttacksPlayerUnit BattleIsMeleeAttack and I_CompareCounter panel_check = 1 and I_CompareCounter rally_walls = 2 and ! BattlePlayerUnitOnWalls and ! BattleEnemyUnitOnWalls if I_CompareCounter second_ring != 2 set_counter second_ring 0 set_counter del_objective 1 end_if set_counter elephant_fix_check 1 set_counter rally_walls 4 battle_wait 180 battle_wait 30 if I_CompareCounter rally_walls = 4 and I_CompareCounter elephant_fix_check 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

= 1

= 2

= 3

= 4

= 5

= 6

end_if end_monitor monitor_event BattlePlayerUnitAttacksEnemyUnit BattleIsMeleeAttack and I_CompareCounter panel_check = 1 and I_CompareCounter rally_walls = 2 and ! BattlePlayerUnitOnWalls and ! BattleEnemyUnitOnWalls if I_CompareCounter second_ring != 2 set_counter second_ring 0 set_counter del_objective 1 end_if set_counter elephant_fix_check 1 set_counter rally_walls 4 ; battle_wait 180 battle_wait 30 if I_CompareCounter rally_walls = 4 and I_CompareCounter elephant_fix_check 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_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel > 2 ai_gta_add_objective 0 ATTACK_ENEMY_BATTLEGROUP 999 if I_CompareCounter enemy_unit_count > 0 if I_UnitFormation a1g1 = horde and ! I_UnitStatus a1g1 running_amok and ! I_UnitDestroyed a1g1 and ! I_UnitStatus a1g1 left_battle

and ! I_IsUnitRouting a1g1 ai_gta_add_unit_label 0 0 a1g1 end_if if I_CompareCounter enemy_unit_count > 1 if I_UnitFormation a1u2 = horde and ! I_UnitStatus a1u2 running_amok and ! I_UnitDestroyed a1u2 and ! I_UnitStatus a1u2 left_battle and ! I_IsUnitRouting a1u2 ai_gta_add_unit_label 0 0 a1u2 end_if if I_CompareCounter enemy_unit_count > 2 if I_UnitFormation a1u3 = horde and ! I_UnitStatus a1u3 running_amok and ! I_UnitDestroyed a1u3 and ! I_UnitStatus a1u3 left_battle and ! I_IsUnitRouting a1u3 ai_gta_add_unit_label 0 0 a1u3 end_if if I_CompareCounter enemy_unit_count > 3 if I_UnitFormation a1u4 = horde and ! I_UnitStatus a1u4 running_amok and ! I_UnitDestroyed a1u4 and ! I_UnitStatus a1u4 left_battle and ! I_IsUnitRouting a1u4 ai_gta_add_unit_label 0 0 a1u4 end_if if I_CompareCounter enemy_unit_count > 4 if I_UnitFormation a1u5 = horde and ! I_UnitStatus a1u5 running_amok and ! I_UnitDestroyed a1u5 and ! I_UnitStatus a1u5 left_battle and ! I_IsUnitRouting a1u5 ai_gta_add_unit_label 0 0 a1u5 end_if if I_CompareCounter enemy_unit_count > 5 if I_UnitFormation a1u6 = horde and ! I_UnitStatus a1u6 running_amok and ! I_UnitDestroyed a1u6 and ! I_UnitStatus a1u6 left_battle and ! I_IsUnitRouting a1u6 ai_gta_add_unit_label 0 0 a1u6 end_if if I_CompareCounter enemy_unit_count > 6 if I_UnitFormation a1u7 = horde and ! I_UnitStatus a1u7 running_amok and ! I_UnitDestroyed a1u7 and ! I_UnitStatus a1u7 left_battle and ! I_IsUnitRouting a1u7 ai_gta_add_unit_label 0 0 a1u7 end_if if I_CompareCounter enemy_unit_count > 7 if I_UnitFormation a1u8 = horde

and ! I_UnitStatus a1u8 running_amok and ! I_UnitDestroyed a1u8 and ! I_UnitStatus a1u8 left_battle and ! I_IsUnitRouting a1u8 ai_gta_add_unit_label 0 0 a1u8 end_if if I_CompareCounter enemy_unit_count > 8 if I_UnitFormation a1u9 = horde and ! I_UnitStatus a1u9 running_amok and ! I_UnitDestroyed a1u9 and ! I_UnitStatus a1u9 left_battle and ! I_IsUnitRouting a1u9 ai_gta_add_unit_label 0 0 a1u9 end_if if I_CompareCounter enemy_unit_count > 9 if I_UnitFormation a1u10 = horde and ! I_UnitStatus a1u10 running_amok and ! I_UnitDestroyed a1u10 and ! I_UnitStatus a1u10 left_battle and ! I_IsUnitRouting a1u10 ai_gta_add_unit_label 0 0 a1u10 end_if if I_CompareCounter enemy_unit_count > 10 if I_UnitFormation a1u11 = horde and ! I_UnitStatus a1u11 running_amok and ! I_UnitDestroyed a1u11 and ! I_UnitStatus a1u11 left_battle and ! I_IsUnitRouting a1u11 ai_gta_add_unit_label 0 0 a1u11 end_if if I_CompareCounter enemy_unit_count > 11 if I_UnitFormation a1u12 = horde and ! I_UnitStatus a1u12 running_amok and ! I_UnitDestroyed a1u12 and ! I_UnitStatus a1u12 left_battle and ! I_IsUnitRouting a1u12 ai_gta_add_unit_label 0 0 a1u12 end_if if I_CompareCounter enemy_unit_count > 12 if I_UnitFormation a1u13 = horde and ! I_UnitStatus a1u13 running_amok and ! I_UnitDestroyed a1u13 and ! I_UnitStatus a1u13 left_battle and ! I_IsUnitRouting a1u13 ai_gta_add_unit_label 0 0 a1u13 end_if if I_CompareCounter enemy_unit_count > 13 if I_UnitFormation a1u14 = horde and ! I_UnitStatus a1u14 running_amok and ! I_UnitDestroyed a1u14 and ! I_UnitStatus a1u14 left_battle and ! I_IsUnitRouting a1u14 ai_gta_add_unit_label 0 0 a1u14 end_if

if I_CompareCounter enemy_unit_count > 14 if I_UnitFormation a1u15 = horde and ! I_UnitStatus a1u15 running_amok and ! I_UnitDestroyed a1u15 and ! I_UnitStatus a1u15 left_battle and ! I_IsUnitRouting a1u15 ai_gta_add_unit_label 0 0 a1u15 end_if if I_CompareCounter enemy_unit_count > 15 if I_UnitFormation a1u16 = horde and ! I_UnitStatus a1u16 running_amok and ! I_UnitDestroyed a1u16 and ! I_UnitStatus a1u16 left_battle and ! I_IsUnitRouting a1u16 ai_gta_add_unit_label 0 0 a1u16 end_if if I_CompareCounter enemy_unit_count > 16 if I_UnitFormation a1u17 = horde and ! I_UnitStatus a1u17 running_amok and ! I_UnitDestroyed a1u17 and ! I_UnitStatus a1u17 left_battle and ! I_IsUnitRouting a1u17 ai_gta_add_unit_label 0 0 a1u17 end_if if I_CompareCounter enemy_unit_count > 17 if I_UnitFormation a1u18 = horde and ! I_UnitStatus a1u18 running_amok and ! I_UnitDestroyed a1u18 and ! I_UnitStatus a1u18 left_battle and ! I_IsUnitRouting a1u18 ai_gta_add_unit_label 0 0 a1u18 end_if if I_CompareCounter enemy_unit_count > 18 if I_UnitFormation a1u19 = horde and ! I_UnitStatus a1u19 running_amok and ! I_UnitDestroyed a1u19 and ! I_UnitStatus a1u19 left_battle and ! I_IsUnitRouting a1u19 ai_gta_add_unit_label 0 0 a1u19 end_if if I_CompareCounter enemy_unit_count = 20 if I_UnitFormation a1u20 = horde and ! I_UnitStatus a1u20 running_amok and ! I_UnitDestroyed a1u20 and ! I_UnitStatus a1u20 left_battle and ! I_IsUnitRouting a1u20 ai_gta_add_unit_label 0 0 a1u20 end_if end_if end_if end_if end_if end_if end_if

end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if ai_active_set on set_counter third_ring 1 set_counter elephant_gate_tier3 0 end_monitor ;;;;;;;;Sally-Out Elephant;;;;;;;;;;;; monitor_conditions I_BattleStarted and I_CompareCounter elephant_fix = 1 and I_BattleIsSallyOutBattle and ! I_BattleIsFortBattle and I_BattlePlayerArmyIsAttacker and I_BattleEnemyArmyNumberOfMountClass elephant > 0 ; set_counter sally-out_fix 1 ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999 if I_CompareCounter enemy_unit_count > 0 if I_UnitFormation a2g1 = horde and ! I_UnitStatus a2g1 running_amok and ! I_UnitDestroyed a2g1 and ! I_UnitStatus a2g1 left_battle and ! I_IsUnitRouting a2g1 ai_gta_add_unit_label 1 0 a2g1 end_if if I_CompareCounter enemy_unit_count > 1 if I_UnitFormation a2u2 = horde and ! I_UnitStatus a2u2 running_amok and ! I_UnitDestroyed a2u2 and ! I_UnitStatus a2u2 left_battle and ! I_IsUnitRouting a2u2 ai_gta_add_unit_label 1 0 a2u2 end_if if I_CompareCounter enemy_unit_count > 2 if I_UnitFormation a2u3 = horde and ! I_UnitStatus a2u3 running_amok and ! I_UnitDestroyed a2u3 and ! I_UnitStatus a2u3 left_battle and ! I_IsUnitRouting a2u3 ai_gta_add_unit_label 1 0 a2u3 end_if if I_CompareCounter enemy_unit_count > 3

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

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

and ! I_UnitStatus a2u17 left_battle and ! I_IsUnitRouting a2u17 ai_gta_add_unit_label 1 0 a2u17 end_if if I_CompareCounter enemy_unit_count > 17 if I_UnitFormation a2u18 = horde and ! I_UnitStatus a2u18 running_amok and ! I_UnitDestroyed a2u18 and ! I_UnitStatus a2u18 left_battle and ! I_IsUnitRouting a2u18 ai_gta_add_unit_label 1 0 a2u18 end_if if I_CompareCounter enemy_unit_count > 18 if I_UnitFormation a2u19 = horde and ! I_UnitStatus a2u19 running_amok and ! I_UnitDestroyed a2u19 and ! I_UnitStatus a2u19 left_battle and ! I_IsUnitRouting a2u19 ai_gta_add_unit_label 1 0 a2u19 end_if if I_CompareCounter enemy_unit_count = 20 if I_UnitFormation a2u20 = horde and ! I_UnitStatus a2u20 running_amok and ! I_UnitDestroyed a2u20 and ! I_UnitStatus a2u20 left_battle and ! I_IsUnitRouting a2u20 ai_gta_add_unit_label 1 0 a2u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if ai_active_set on set_counter elephant_gate_s 1 set_counter elephant_fix 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter elephant_fix = 1 and I_BattleIsSallyOutBattle

and I_BattleIsFortBattle and I_BattlePlayerArmyIsAttacker and I_BattleEnemyArmyNumberOfMountClass elephant > 0 ; set_counter sally-out_fix 1 ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999 if I_CompareCounter enemy_unit_count > 0 if I_UnitFormation a2g1 = horde and ! I_UnitStatus a2g1 running_amok and ! I_UnitDestroyed a2g1 and ! I_UnitStatus a2g1 left_battle and ! I_IsUnitRouting a2g1 ai_gta_add_unit_label 1 0 a2g1 end_if if I_CompareCounter enemy_unit_count > 1 if I_UnitFormation a2u2 = horde and ! I_UnitStatus a2u2 running_amok and ! I_UnitDestroyed a2u2 and ! I_UnitStatus a2u2 left_battle and ! I_IsUnitRouting a2u2 ai_gta_add_unit_label 1 0 a2u2 end_if if I_CompareCounter enemy_unit_count > 2 if I_UnitFormation a2u3 = horde and ! I_UnitStatus a2u3 running_amok and ! I_UnitDestroyed a2u3 and ! I_UnitStatus a2u3 left_battle and ! I_IsUnitRouting a2u3 ai_gta_add_unit_label 1 0 a2u3 end_if if I_CompareCounter enemy_unit_count > 3 if I_UnitFormation a2u4 = horde and ! I_UnitStatus a2u4 running_amok and ! I_UnitDestroyed a2u4 and ! I_UnitStatus a2u4 left_battle and ! I_IsUnitRouting a2u4 ai_gta_add_unit_label 1 0 a2u4 end_if if I_CompareCounter enemy_unit_count > 4 if I_UnitFormation a2u5 = horde and ! I_UnitStatus a2u5 running_amok and ! I_UnitDestroyed a2u5 and ! I_UnitStatus a2u5 left_battle and ! I_IsUnitRouting a2u5 ai_gta_add_unit_label 1 0 a2u5 end_if if I_CompareCounter enemy_unit_count > 5 if I_UnitFormation a2u6 = horde and ! I_UnitStatus a2u6 running_amok and ! I_UnitDestroyed a2u6 and ! I_UnitStatus a2u6 left_battle and ! I_IsUnitRouting a2u6 ai_gta_add_unit_label 1 0 a2u6 end_if

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

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

and ! I_UnitStatus a2u20 running_amok and ! I_UnitDestroyed a2u20 and ! I_UnitStatus a2u20 left_battle and ! I_IsUnitRouting a2u20 ai_gta_add_unit_label 1 0 a2u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if ai_active_set on set_counter elephant_gate_s 1 set_counter elephant_fix 0 end_monitor monitor_event BattleEnemyUnitAttacksPlayerUnit BattleIsMeleeAttack and I_CompareCounter panel_check = 1 and I_CompareCounter rally_walls_s = 1 and ! BattlePlayerUnitOnWalls and ! BattleEnemyUnitOnWalls if I_CompareCounter elephant_gate_s != 2 set_counter elephant_gate_s 0 set_counter del_objective_s 1 end_if set_counter elephant_fix_check_sally 1 set_counter rally_walls_s 3 battle_wait 180 battle_wait 30 if I_CompareCounter rally_walls_s = 3 and I_CompareCounter elephant_fix_check_sally set_counter elephant_fix_check_sally 2 battle_wait 30 if I_CompareCounter rally_walls_s = 3 and I_CompareCounter elephant_fix_check_sally set_counter elephant_fix_check_sally 3 battle_wait 30 if I_CompareCounter rally_walls_s = 3 and I_CompareCounter elephant_fix_check_sally set_counter elephant_fix_check_sally 4 battle_wait 30 if I_CompareCounter rally_walls_s = 3 and I_CompareCounter elephant_fix_check_sally

= 1

= 2

= 3

= 4

set_counter elephant_fix_check_sally 5 battle_wait 30 if I_CompareCounter rally_walls_s = 3 and I_CompareCounter elephant_fix_check_sally = 5 set_counter elephant_fix_check_sally 6 battle_wait 30 if I_CompareCounter rally_walls_s = 3 and I_CompareCounter elephant_fix_check_sally = 6 set_counter elephant_gate_tier2s 1 set_counter rally_walls_s 0 end_if end_if end_if end_if end_if end_if end_monitor monitor_event BattlePlayerUnitAttacksEnemyUnit BattleIsMeleeAttack and I_CompareCounter panel_check = 1 and I_CompareCounter rally_walls_s = 1 and ! BattlePlayerUnitOnWalls and ! BattleEnemyUnitOnWalls if I_CompareCounter elephant_gate_s != 2 set_counter elephant_gate_s 0 set_counter del_objective_s 1 end_if set_counter elephant_fix_check_sally 1 set_counter rally_walls_s 3 battle_wait 180 battle_wait 30 if I_CompareCounter rally_walls_s = 3 and I_CompareCounter elephant_fix_check_sally set_counter elephant_fix_check_sally 2 battle_wait 30 if I_CompareCounter rally_walls_s = 3 and I_CompareCounter elephant_fix_check_sally set_counter elephant_fix_check_sally 3 battle_wait 30 if I_CompareCounter rally_walls_s = 3 and I_CompareCounter elephant_fix_check_sally set_counter elephant_fix_check_sally 4 battle_wait 30 if I_CompareCounter rally_walls_s = 3 and I_CompareCounter elephant_fix_check_sally set_counter elephant_fix_check_sally 5 battle_wait 30 if I_CompareCounter rally_walls_s = 3 and I_CompareCounter elephant_fix_check_sally set_counter elephant_fix_check_sally 6 battle_wait 30 if I_CompareCounter rally_walls_s = 3 and I_CompareCounter elephant_fix_check_sally set_counter elephant_gate_tier2s 1 set_counter rally_walls_s 0 end_if end_if end_if end_if

= 1

= 2

= 3

= 4

= 5

= 6

end_if end_if end_monitor monitor_conditions I_BattleStarted and I_CompareCounter del_objective_s = 1 and I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker and I_BattleEnemyArmyNumberOfMountClass elephant > 0 set_counter del_objective_s 2 battle_wait 15 if I_CompareCounter del_objective_s = 2 ai_gta_del_objective 1 ai_active_set off battle_wait 0.5 ai_active_set on set_counter del_objective_s 0 end_if end_monitor monitor_conditions I_BattleStarted and I_CompareCounter elephant_gate_tier2s = 1 and I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker and I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel > 2 and I_BattleEnemyArmyNumberOfMountClass elephant > 0 ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999 if I_CompareCounter enemy_unit_count > 0 if I_UnitFormation a2g1 = horde and ! I_UnitStatus a2g1 running_amok and ! I_UnitDestroyed a2g1 and ! I_UnitStatus a2g1 left_battle and ! I_IsUnitRouting a2g1 ai_gta_add_unit_label 1 0 a2g1 end_if if I_CompareCounter enemy_unit_count > 1 if I_UnitFormation a2u2 = horde and ! I_UnitStatus a2u2 running_amok and ! I_UnitDestroyed a2u2 and ! I_UnitStatus a2u2 left_battle and ! I_IsUnitRouting a2u2 ai_gta_add_unit_label 1 0 a2u2 end_if if I_CompareCounter enemy_unit_count > 2 if I_UnitFormation a2u3 = horde and ! I_UnitStatus a2u3 running_amok and ! I_UnitDestroyed a2u3 and ! I_UnitStatus a2u3 left_battle and ! I_IsUnitRouting a2u3 ai_gta_add_unit_label 1 0 a2u3 end_if if I_CompareCounter enemy_unit_count > 3 if I_UnitFormation a2u4 = horde

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

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

and ! I_IsUnitRouting a2u17 ai_gta_add_unit_label 1 0 a2u17 end_if if I_CompareCounter enemy_unit_count > 17 if I_UnitFormation a2u18 = horde and ! I_UnitStatus a2u18 running_amok and ! I_UnitDestroyed a2u18 and ! I_UnitStatus a2u18 left_battle and ! I_IsUnitRouting a2u18 ai_gta_add_unit_label 1 0 a2u18 end_if if I_CompareCounter enemy_unit_count > 18 if I_UnitFormation a2u19 = horde and ! I_UnitStatus a2u19 running_amok and ! I_UnitDestroyed a2u19 and ! I_UnitStatus a2u19 left_battle and ! I_IsUnitRouting a2u19 ai_gta_add_unit_label 1 0 a2u19 end_if if I_CompareCounter enemy_unit_count = 20 if I_UnitFormation a2u20 = horde and ! I_UnitStatus a2u20 running_amok and ! I_UnitDestroyed a2u20 and ! I_UnitStatus a2u20 left_battle and ! I_IsUnitRouting a2u20 ai_gta_add_unit_label 1 0 a2u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if ai_active_set on set_counter second_ring_s 1 set_counter elephant_gate_tier2s 0 end_monitor monitor_event BattleEnemyUnitAttacksPlayerUnit BattleIsMeleeAttack and I_CompareCounter panel_check = 1 and I_CompareCounter rally_walls_s = 2 and ! BattlePlayerUnitOnWalls

and ! BattleEnemyUnitOnWalls if I_CompareCounter second_ring_s != 2 set_counter second_ring_s 0 set_counter del_objective_s 1 end_if set_counter elephant_fix_check_sally 1 set_counter rally_walls_s 4 ; battle_wait 180 battle_wait 30 if I_CompareCounter rally_walls_s = 4 and I_CompareCounter elephant_fix_check_sally set_counter elephant_fix_check_sally 2 battle_wait 30 if I_CompareCounter rally_walls_s = 4 and I_CompareCounter elephant_fix_check_sally set_counter elephant_fix_check_sally 3 battle_wait 30 if I_CompareCounter rally_walls_s = 4 and I_CompareCounter elephant_fix_check_sally set_counter elephant_fix_check_sally 4 battle_wait 30 if I_CompareCounter rally_walls_s = 4 and I_CompareCounter elephant_fix_check_sally set_counter elephant_fix_check_sally 5 battle_wait 30 if I_CompareCounter rally_walls_s = 4 and I_CompareCounter elephant_fix_check_sally set_counter elephant_fix_check_sally 6 battle_wait 30 if I_CompareCounter rally_walls_s = 4 and I_CompareCounter elephant_fix_check_sally set_counter elephant_gate_tier3s 1 set_counter rally_walls_s 0 end_if end_if end_if end_if end_if end_if end_monitor

= 1

= 2

= 3

= 4

= 5

= 6

monitor_event BattlePlayerUnitAttacksEnemyUnit BattleIsMeleeAttack and I_CompareCounter panel_check = 1 and I_CompareCounter rally_walls_s = 2 and ! BattlePlayerUnitOnWalls and ! BattleEnemyUnitOnWalls if I_CompareCounter second_ring_s != 2 set_counter second_ring_s 0 set_counter del_objective_s 1 end_if set_counter elephant_fix_check_sally 1 set_counter rally_walls_s 4 battle_wait 180 battle_wait 30 if I_CompareCounter rally_walls_s = 4 and I_CompareCounter elephant_fix_check_sally = 1 set_counter elephant_fix_check_sally 2 battle_wait 30

if I_CompareCounter rally_walls_s = 4 and I_CompareCounter elephant_fix_check_sally set_counter elephant_fix_check_sally 3 battle_wait 30 if I_CompareCounter rally_walls_s = 4 and I_CompareCounter elephant_fix_check_sally set_counter elephant_fix_check_sally 4 battle_wait 30 if I_CompareCounter rally_walls_s = 4 and I_CompareCounter elephant_fix_check_sally set_counter elephant_fix_check_sally 5 battle_wait 30 if I_CompareCounter rally_walls_s = 4 and I_CompareCounter elephant_fix_check_sally set_counter elephant_fix_check_sally 6 battle_wait 30 if I_CompareCounter rally_walls_s = 4 and I_CompareCounter elephant_fix_check_sally set_counter elephant_gate_tier3s 1 set_counter rally_walls_s 0 end_if end_if end_if end_if end_if end_if end_monitor

= 2

= 3

= 4

= 5

= 6

monitor_conditions I_BattleStarted and I_CompareCounter elephant_gate_tier3s = 1 and I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker and I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel > 2 and I_BattleEnemyArmyNumberOfMountClass elephant > 0 ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999 if I_CompareCounter enemy_unit_count > 0 if I_UnitFormation a2g1 = horde and ! I_UnitStatus a2g1 running_amok and ! I_UnitDestroyed a2g1 and ! I_UnitStatus a2g1 left_battle and ! I_IsUnitRouting a2g1 ai_gta_add_unit_label 1 0 a2g1 end_if if I_CompareCounter enemy_unit_count > 1 if I_UnitFormation a2u2 = horde and ! I_UnitStatus a2u2 running_amok and ! I_UnitDestroyed a2u2 and ! I_UnitStatus a2u2 left_battle and ! I_IsUnitRouting a2u2 ai_gta_add_unit_label 1 0 a2u2 end_if if I_CompareCounter enemy_unit_count > 2 if I_UnitFormation a2u3 = horde and ! I_UnitStatus a2u3 running_amok and ! I_UnitDestroyed a2u3

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

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

end_if if I_CompareCounter enemy_unit_count > 16 if I_UnitFormation a2u17 = horde and ! I_UnitStatus a2u17 running_amok and ! I_UnitDestroyed a2u17 and ! I_UnitStatus a2u17 left_battle and ! I_IsUnitRouting a2u17 ai_gta_add_unit_label 1 0 a2u17 end_if if I_CompareCounter enemy_unit_count > 17 if I_UnitFormation a2u18 = horde and ! I_UnitStatus a2u18 running_amok and ! I_UnitDestroyed a2u18 and ! I_UnitStatus a2u18 left_battle and ! I_IsUnitRouting a2u18 ai_gta_add_unit_label 1 0 a2u18 end_if if I_CompareCounter enemy_unit_count > 18 if I_UnitFormation a2u19 = horde and ! I_UnitStatus a2u19 running_amok and ! I_UnitDestroyed a2u19 and ! I_UnitStatus a2u19 left_battle and ! I_IsUnitRouting a2u19 ai_gta_add_unit_label 1 0 a2u19 end_if if I_CompareCounter enemy_unit_count = 20 if I_UnitFormation a2u20 = horde and ! I_UnitStatus a2u20 running_amok and ! I_UnitDestroyed a2u20 and ! I_UnitStatus a2u20 left_battle and ! I_IsUnitRouting a2u20 ai_gta_add_unit_label 1 0 a2u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if ai_active_set on set_counter third_ring_s 1

set_counter elephant_gate_tier3s 0 end_monitor ;;;;;;;Elephants Gate and Walls monitor_event BattleBattleGatesDestroyedByEngine TrueCondition ;wtf and I_CompareCounter panel_check = 1 if I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker and I_BattleEnemyArmyNumberOfMountClass elephant > 0 if I_CompareCounter elephant_gate = 1 set_counter elephant_gate 0 set_counter rally_walls 1 end_if if I_CompareCounter second_ring = 1 and I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel > 2 set_counter second_ring 0 set_counter rally_walls 2 end_if if I_CompareCounter third_ring = 1 and I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel > 2 set_counter third_ring 0 set_counter del_objective 1 end_if end_if if I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker and I_BattleEnemyArmyNumberOfMountClass elephant > 0 if I_CompareCounter elephant_gate_s = 1 set_counter elephant_gate_s 0 set_counter rally_walls_s 1 end_if if I_CompareCounter second_ring_s = 1 and I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel > 2 set_counter second_ring_s 0 set_counter rally_walls_s 2 end_if if I_CompareCounter third_ring_s = 1 and I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel > 2 set_counter third_ring_s 0 set_counter del_objective_s 1 end_if end_if end_monitor monitor_event BattleWallsCaptured TrueCondition and I_CompareCounter panel_check = 1

if I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker and I_BattleEnemyArmyNumberOfMountClass elephant > 0 if I_CompareCounter elephant_gate = 1 set_counter elephant_gate 0 set_counter rally_walls 1 end_if if I_CompareCounter second_ring = 1 and I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel > 2 set_counter second_ring 0 set_counter rally_walls 2 end_if if I_CompareCounter third_ring = 1 and I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel > 2 set_counter third_ring 0 set_counter del_objective 1 end_if end_if if I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker and I_BattleEnemyArmyNumberOfMountClass elephant > 0 if I_CompareCounter elephant_gate_s = 1 set_counter elephant_gate_s 0 set_counter rally_walls_s 1 end_if if I_CompareCounter second_ring_s = 1 and I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel > 2 set_counter second_ring_s 0 set_counter rally_walls_s 2 end_if if I_CompareCounter third_ring_s = 1 and I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel > 2 set_counter third_ring_s 0 set_counter del_objective_s 1 end_if end_if end_monitor monitor_event BattleWallsBreachedByEngine TrueCondition and I_CompareCounter panel_check = 1 if I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker and I_BattleEnemyArmyNumberOfMountClass elephant > 0 if I_CompareCounter elephant_gate = 1 ai_gta_del_objective 0 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_if if I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker and I_BattleEnemyArmyNumberOfMountClass elephant > 0 if I_CompareCounter elephant_gate_s = 1 ai_gta_del_objective 1 set_counter elephant_gate_s 2 set_counter rally_walls_s 1 end_if if I_CompareCounter second_ring_s = 1 and I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel > 2 ai_gta_del_objective 1 set_counter second_ring_s 2 set_counter rally_walls_s 2 end_if if I_CompareCounter third_ring_s = 1 and I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel > 2 set_counter third_ring_s 0 set_counter del_objective_s 1 end_if end_if end_monitor ;;;;;;;Sally Out Assault monitor_conditions I_BattleStarted and I_CompareCounter sally-out_fix = 1 and ! I_BattleIsFortBattle and I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker and I_BattleSettlementFortificationLevel < 3 and I_IsBattleSettlementCastle and I_BattleEnemyArmyNumberOfSpecialAbility drop_engines > 2 and I_BattlePlayerAllianceOddsAgainst > 2.0 set_counter kill_sally 1 ai_gta_plan_set 1 ATTACK_SETTLEMENT

ai_active_set on if I_BattleEnemyArmyNumberOfMountClass elephant > 0 set_counter elephant_fix 1 battle_wait 1 end_if set_counter army2_sally 1 if I_BattleEnemyArmyNumberOfClassAndCategory missile siege = 0 set_counter wall_advance_s 1 end_if set_counter sally-out_fix 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter sally-out_fix = 1 and ! I_BattleIsFortBattle and I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker and I_BattleSettlementFortificationLevel > 2 and I_IsBattleSettlementCastle and I_BattleEnemyArmyNumberOfSpecialAbility drop_engines > 3 and I_BattlePlayerAllianceOddsAgainst > 2.5 set_counter kill_sally 1 ai_gta_plan_set 1 ATTACK_SETTLEMENT ai_active_set on if I_BattleEnemyArmyNumberOfMountClass elephant > 0 set_counter elephant_fix 1 battle_wait 1 end_if set_counter army2_sally 1 if I_BattleEnemyArmyNumberOfClassAndCategory missile siege = 0 set_counter wall_advance_s 1 end_if set_counter sally-out_fix 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter sally-out_fix = 1 and ! I_BattleIsFortBattle and I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker and I_BattleSettlementFortificationLevel < 3 and ! I_IsBattleSettlementCastle and I_BattleEnemyArmyNumberOfSpecialAbility drop_engines > 2 and I_BattlePlayerAllianceOddsAgainst > 1.7 set_counter kill_sally 1 ai_gta_plan_set 1 ATTACK_SETTLEMENT ai_active_set on if I_BattleEnemyArmyNumberOfMountClass elephant > 0 set_counter elephant_fix 1 battle_wait 1 end_if set_counter army2_sally 1 if I_BattleEnemyArmyNumberOfClassAndCategory missile siege = 0 set_counter wall_advance_s 1 end_if set_counter sally-out_fix 0 end_monitor

monitor_conditions I_BattleStarted and I_CompareCounter sally-out_fix = 1 and ! I_BattleIsFortBattle and I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker and I_BattleSettlementFortificationLevel > 2 and ! I_IsBattleSettlementCastle and I_BattleEnemyArmyNumberOfSpecialAbility drop_engines > 2 and I_BattlePlayerAllianceOddsAgainst > 2.2 set_counter kill_sally 1 ai_gta_plan_set 1 ATTACK_SETTLEMENT ai_active_set on if I_BattleEnemyArmyNumberOfMountClass elephant > 0 set_counter elephant_fix 1 battle_wait 1 end_if set_counter army2_sally 1 if I_BattleEnemyArmyNumberOfClassAndCategory missile siege = 0 set_counter wall_advance_s 1 end_if set_counter sally-out_fix 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter sally-out_fix = 1 and I_BattleIsFortBattle and I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker and I_BattleEnemyArmyNumberOfSpecialAbility drop_engines > 2 and I_BattlePlayerAllianceOddsAgainst > 1.8 set_counter kill_sally 1 ai_gta_plan_set 1 ATTACK_SETTLEMENT ai_active_set on if I_BattleEnemyArmyNumberOfMountClass elephant > 0 set_counter elephant_fix 1 battle_wait 1 end_if set_counter army2_sally 1 if I_BattleEnemyArmyNumberOfClassAndCategory missile siege = 0 set_counter wall_advance_s 1 end_if set_counter sally-out_fix 0 end_monitor ;;;;;;;Sally Out Defense monitor_conditions I_BattleStarted and I_CompareCounter sally_defense = 1 and I_CompareCounter kill_sally = 0 ; and ! I_BattleIsFortBattle and I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker if I_CompareCounter army_south = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, -750, 100 end_if if I_CompareCounter army_north = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 0, 750, 100

end_if if I_CompareCounter army_east = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 750, 0, 100 end_if if I_CompareCounter army_west = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 -750, 0, 100 end_if if I_CompareCounter enemy_unit_count > 0 ai_gta_add_unit_label 1 0 a2g1 if I_CompareCounter enemy_unit_count > 1 ai_gta_add_unit_label 1 0 a2u2 if I_CompareCounter enemy_unit_count > 2 ai_gta_add_unit_label 1 0 a2u3 if I_CompareCounter enemy_unit_count > 3 ai_gta_add_unit_label 1 0 a2u4 if I_CompareCounter enemy_unit_count > 4 ai_gta_add_unit_label 1 0 a2u5 if I_CompareCounter enemy_unit_count > 5 ai_gta_add_unit_label 1 0 a2u6 if I_CompareCounter enemy_unit_count > 6 ai_gta_add_unit_label 1 0 a2u7 if I_CompareCounter enemy_unit_count > 7 ai_gta_add_unit_label 1 0 a2u8 if I_CompareCounter enemy_unit_count > 8 ai_gta_add_unit_label 1 0 a2u9 if I_CompareCounter enemy_unit_count > 9 ai_gta_add_unit_label 1 0 a2u10 if I_CompareCounter enemy_unit_count > 10 ai_gta_add_unit_label 1 0 a2u11 if I_CompareCounter enemy_unit_count > 11 ai_gta_add_unit_label 1 0 a2u12 if I_CompareCounter enemy_unit_count > 12 ai_gta_add_unit_label 1 0 a2u13 if I_CompareCounter enemy_unit_count > 13 ai_gta_add_unit_label 1 0 a2u14 if I_CompareCounter enemy_unit_count > 14 ai_gta_add_unit_label 1 0 a2u15 if I_CompareCounter enemy_unit_count > 15 ai_gta_add_unit_label 1 0 a2u16 if I_CompareCounter enemy_unit_count > 16 ai_gta_add_unit_label 1 0 a2u17 if I_CompareCounter enemy_unit_count > 17

ai_gta_add_unit_label 1 0 a2u18 if I_CompareCounter enemy_unit_count > 18 ai_gta_add_unit_label 1 0 a2u19 if I_CompareCounter enemy_unit_count = 20 ai_gta_add_unit_label 1 0 a2u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if set_counter sally_defense 2 set_counter defend_location 1 ; ai_active_set off battle_wait 0.5 ai_active_set on end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter sally_defense = 2 ; and I_BattlePlayerArmyNumberOfClassAndCategory missile siege > 0 and I_UnitDistanceFromPosition a2g1 1 1 > 630 and ! I_UnitEnemyUnitInRadius a2g1 160 and ! I_IsUnitGroupEngaged army2 set_counter sally_defense 0 if I_CompareCounter enemy_unit_count > 0 if I_IsUnitUnderFire a2g1 inc_counter unit_under_fire 2 end_if if I_UnitStatus a2g1 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2g1 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2g1 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 1

if I_IsUnitUnderFire a2u2 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u2 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u2 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u2 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 2 if I_IsUnitUnderFire a2u3 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u3 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u3 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u3 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 3 if I_IsUnitUnderFire a2u4 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u4 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u4 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u4 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 4 if I_IsUnitUnderFire a2u5 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u5 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u5 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u5 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 5 if I_IsUnitUnderFire a2u6 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u6 fighting

inc_counter reform_back 1 end_if if I_UnitStatus a2u6 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u6 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 6 if I_IsUnitUnderFire a2u7 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u7 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u7 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u7 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 7 if I_IsUnitUnderFire a2u8 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u8 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u8 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u8 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 8 if I_IsUnitUnderFire a2u9 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u9 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u9 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u9 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 9 if I_IsUnitUnderFire a2u10 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u10 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u10 pursuing inc_counter reform_back 1

end_if if I_UnitStatus a2u10 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 10 if I_IsUnitUnderFire a2u11 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u11 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u11 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u11 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 11 if I_IsUnitUnderFire a2u12 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u12 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u12 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u12 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 12 if I_IsUnitUnderFire a2u13 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u13 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u13 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u13 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 13 if I_IsUnitUnderFire a2u14 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u14 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u14 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u14 charging inc_counter reform_back 1 end_if

if I_CompareCounter enemy_unit_count > 14 if I_IsUnitUnderFire a2u15 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u15 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u15 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u15 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 15 if I_IsUnitUnderFire a2u16 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u16 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u16 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u16 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 16 if I_IsUnitUnderFire a2u17 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u17 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u17 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u17 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 17 if I_IsUnitUnderFire a2u18 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u18 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u18 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u18 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 18 if I_IsUnitUnderFire a2u19 inc_counter unit_under_fire 1

end_if if I_UnitStatus a2u19 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u19 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u19 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count = 20 if I_IsUnitUnderFire a2u20 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u20 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u20 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u20 charging inc_counter reform_back 1 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if if I_CompareCounter sally_reinf > 0 and I_UnitDistanceFromUnit a4g1 a2g1 < 300 if I_IsUnitUnderFire a4g1 inc_counter unit_under_fire 2 end_if if I_UnitStatus a4g1 fighting inc_counter reform_back 1 end_if if I_UnitStatus a4g1 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a4g1 charging inc_counter reform_back 1 end_if end_if

if I_CompareCounter unit_under_fire > 0 and I_CompareCounter reform_back < 1 ai_gta_del_objective 1 battle_wait 0.5 unit_group_order_halt army2 battle_wait 0.5 ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999 if I_CompareCounter enemy_unit_count > 0 if ! I_UnitDestroyed a2g1 and ! I_UnitStatus a2g1 left_battle ai_gta_add_unit_label 1 0 a2g1 end_if if I_CompareCounter enemy_unit_count > 1 if ! I_UnitDestroyed a2u2 and ! I_UnitStatus a2u2 left_battle ai_gta_add_unit_label 1 0 a2u2 end_if if I_CompareCounter enemy_unit_count > 2 if ! I_UnitDestroyed a2u3 and ! I_UnitStatus a2u3 left_battle ai_gta_add_unit_label 1 0 a2u3 end_if if I_CompareCounter enemy_unit_count > 3 if ! I_UnitDestroyed a2u4 and ! I_UnitStatus a2u4 left_battle ai_gta_add_unit_label 1 0 a2u4 end_if if I_CompareCounter enemy_unit_count > 4 if ! I_UnitDestroyed a2u5 and ! I_UnitStatus a2u5 left_battle ai_gta_add_unit_label 1 0 a2u5 end_if if I_CompareCounter enemy_unit_count > 5 if ! I_UnitDestroyed a2u6 and ! I_UnitStatus a2u6 left_battle ai_gta_add_unit_label 1 0 a2u6 end_if if I_CompareCounter enemy_unit_count > 6 if ! I_UnitDestroyed a2u7 and ! I_UnitStatus a2u7 left_battle ai_gta_add_unit_label 1 0 a2u7 end_if if I_CompareCounter enemy_unit_count > 7 if ! I_UnitDestroyed a2u8 and ! I_UnitStatus a2u8 left_battle ai_gta_add_unit_label 1 0 a2u8 end_if if I_CompareCounter enemy_unit_count > 8

if ! I_UnitDestroyed a2u9 and ! I_UnitStatus a2u9 left_battle ai_gta_add_unit_label 1 0 a2u9 end_if if I_CompareCounter enemy_unit_count > 9 if ! I_UnitDestroyed a2u10 and ! I_UnitStatus a2u10 left_battle ai_gta_add_unit_label 1 0 a2u10 end_if if I_CompareCounter enemy_unit_count > 10 if ! I_UnitDestroyed a2u11 and ! I_UnitStatus a2u11 left_battle ai_gta_add_unit_label 1 0 a2u11 end_if if I_CompareCounter enemy_unit_count > 11 if ! I_UnitDestroyed a2u12 and ! I_UnitStatus a2u12 left_battle ai_gta_add_unit_label 1 0 a2u12 end_if if I_CompareCounter enemy_unit_count > 12 if ! I_UnitDestroyed a2u13 and ! I_UnitStatus a2u13 left_battle ai_gta_add_unit_label 1 0 a2u13 end_if if I_CompareCounter enemy_unit_count > 13 if ! I_UnitDestroyed a2u14 and ! I_UnitStatus a2u14 left_battle ai_gta_add_unit_label 1 0 a2u14 end_if if I_CompareCounter enemy_unit_count > 14 if ! I_UnitDestroyed a2u15 and ! I_UnitStatus a2u15 left_battle ai_gta_add_unit_label 1 0 a2u15 end_if if I_CompareCounter enemy_unit_count > 15 if ! I_UnitDestroyed a2u16 and ! I_UnitStatus a2u16 left_battle ai_gta_add_unit_label 1 0 a2u16 end_if if I_CompareCounter enemy_unit_count > 16 if ! I_UnitDestroyed a2u17 and ! I_UnitStatus a2u17 left_battle ai_gta_add_unit_label 1 0 a2u17 end_if if I_CompareCounter enemy_unit_count > 17 if ! I_UnitDestroyed a2u18 and ! I_UnitStatus a2u18 left_battle ai_gta_add_unit_label 1 0 a2u18 end_if if I_CompareCounter enemy_unit_count > 18

if ! I_UnitDestroyed a2u19 and ! I_UnitStatus a2u19 left_battle ai_gta_add_unit_label 1 0 a2u19 end_if if I_CompareCounter enemy_unit_count = 20 if ! I_UnitDestroyed a2u20 and ! I_UnitStatus a2u20 left_battle ai_gta_add_unit_label 1 0 a2u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if ; ai_active_set off battle_wait 0.5 ai_active_set on inc_counter reform_multi 1 set_counter unit_under_fire 0 set_counter defend_location 2 set_counter sally_defense_check 1 battle_wait 30 if I_CompareCounter sally_defense_check = 1 set_counter sally_defense 3 end_if end_if if I_CompareCounter sally_defense = 0 set_counter sally_defense 2 end_if set_counter reform_back 0 battle_wait 7 end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter sally_defense = 2 ; and I_BattlePlayerArmyNumberOfClassAndCategory missile siege > 0 and I_UnitDistanceFromPosition a2g1 1 1 > 560 and I_UnitDistanceFromPosition a2g1 1 1 < 630 and ! I_UnitEnemyUnitInRadius a2g1 160 and ! I_IsUnitGroupEngaged army2

set_counter sally_defense 0 if I_CompareCounter enemy_unit_count > 0 if I_IsUnitUnderFire a2g1 inc_counter unit_under_fire 2 end_if if I_UnitStatus a2g1 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2g1 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2g1 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 1 if I_IsUnitUnderFire a2u2 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u2 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u2 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u2 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 2 if I_IsUnitUnderFire a2u3 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u3 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u3 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u3 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 3 if I_IsUnitUnderFire a2u4 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u4 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u4 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u4 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 4 if I_IsUnitUnderFire a2u5

inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u5 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u5 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u5 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 5 if I_IsUnitUnderFire a2u6 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u6 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u6 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u6 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 6 if I_IsUnitUnderFire a2u7 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u7 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u7 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u7 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 7 if I_IsUnitUnderFire a2u8 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u8 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u8 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u8 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 8 if I_IsUnitUnderFire a2u9 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u9 fighting inc_counter reform_back 1

end_if if I_UnitStatus a2u9 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u9 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 9 if I_IsUnitUnderFire a2u10 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u10 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u10 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u10 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 10 if I_IsUnitUnderFire a2u11 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u11 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u11 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u11 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 11 if I_IsUnitUnderFire a2u12 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u12 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u12 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u12 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 12 if I_IsUnitUnderFire a2u13 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u13 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u13 pursuing inc_counter reform_back 1 end_if

if I_UnitStatus a2u13 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 13 if I_IsUnitUnderFire a2u14 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u14 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u14 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u14 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 14 if I_IsUnitUnderFire a2u15 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u15 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u15 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u15 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 15 if I_IsUnitUnderFire a2u16 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u16 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u16 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u16 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 16 if I_IsUnitUnderFire a2u17 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u17 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u17 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u17 charging inc_counter reform_back 1 end_if

if I_CompareCounter enemy_unit_count > 17 if I_IsUnitUnderFire a2u18 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u18 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u18 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u18 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 18 if I_IsUnitUnderFire a2u19 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u19 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u19 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u19 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count = 20 if I_IsUnitUnderFire a2u20 inc_counter unit_under_fire 1 end_if if I_UnitStatus a2u20 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u20 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u20 charging inc_counter reform_back 1 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if

end_if if I_CompareCounter sally_reinf > 0 and I_UnitDistanceFromUnit a4g1 a2g1 < 300 if I_IsUnitUnderFire a4g1 inc_counter unit_under_fire 2 end_if if I_UnitStatus a4g1 fighting inc_counter reform_back 1 end_if if I_UnitStatus a4g1 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a4g1 charging inc_counter reform_back 1 end_if end_if if I_CompareCounter repeat_test1 = 1 set_counter repeat_test1 2 end_if if I_CompareCounter unit_under_fire > 0 and I_CompareCounter reform_back < 1 and I_CompareCounter repeat_test1 = 0 set_counter unit_under_fire 0 set_counter repeat_test1 1 ;battle_wait 10 end_if if I_CompareCounter unit_under_fire > 0 and I_CompareCounter reform_back < 1 and I_CompareCounter repeat_test1 = 2 ai_gta_del_objective 1 battle_wait 0.5 unit_group_order_halt army2 battle_wait 0.5 ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999 if I_CompareCounter enemy_unit_count > 0 if ! I_UnitDestroyed a2g1 and ! I_UnitStatus a2g1 left_battle ai_gta_add_unit_label 1 0 a2g1 end_if if I_CompareCounter enemy_unit_count > 1 if ! I_UnitDestroyed a2u2 and ! I_UnitStatus a2u2 left_battle ai_gta_add_unit_label 1 0 a2u2 end_if if I_CompareCounter enemy_unit_count > 2 if ! I_UnitDestroyed a2u3 and ! I_UnitStatus a2u3 left_battle ai_gta_add_unit_label 1 0 a2u3 end_if if I_CompareCounter enemy_unit_count > 3

if ! I_UnitDestroyed a2u4 and ! I_UnitStatus a2u4 left_battle ai_gta_add_unit_label 1 0 a2u4 end_if if I_CompareCounter enemy_unit_count > 4 if ! I_UnitDestroyed a2u5 and ! I_UnitStatus a2u5 left_battle ai_gta_add_unit_label 1 0 a2u5 end_if if I_CompareCounter enemy_unit_count > 5 if ! I_UnitDestroyed a2u6 and ! I_UnitStatus a2u6 left_battle ai_gta_add_unit_label 1 0 a2u6 end_if if I_CompareCounter enemy_unit_count > 6 if ! I_UnitDestroyed a2u7 and ! I_UnitStatus a2u7 left_battle ai_gta_add_unit_label 1 0 a2u7 end_if if I_CompareCounter enemy_unit_count > 7 if ! I_UnitDestroyed a2u8 and ! I_UnitStatus a2u8 left_battle ai_gta_add_unit_label 1 0 a2u8 end_if if I_CompareCounter enemy_unit_count > 8 if ! I_UnitDestroyed a2u9 and ! I_UnitStatus a2u9 left_battle ai_gta_add_unit_label 1 0 a2u9 end_if if I_CompareCounter enemy_unit_count > 9 if ! I_UnitDestroyed a2u10 and ! I_UnitStatus a2u10 left_battle ai_gta_add_unit_label 1 0 a2u10 end_if if I_CompareCounter enemy_unit_count > 10 if ! I_UnitDestroyed a2u11 and ! I_UnitStatus a2u11 left_battle ai_gta_add_unit_label 1 0 a2u11 end_if if I_CompareCounter enemy_unit_count > 11 if ! I_UnitDestroyed a2u12 and ! I_UnitStatus a2u12 left_battle ai_gta_add_unit_label 1 0 a2u12 end_if if I_CompareCounter enemy_unit_count > 12 if ! I_UnitDestroyed a2u13 and ! I_UnitStatus a2u13 left_battle ai_gta_add_unit_label 1 0 a2u13 end_if if I_CompareCounter enemy_unit_count > 13

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

ai_active_set off battle_wait 0.5 ai_active_set on inc_counter reform_multi 1 set_counter unit_under_fire 0 set_counter defend_location 2 set_counter sally_defense_check 1 battle_wait 30 if I_CompareCounter sally_defense_check = 1 set_counter sally_defense 3 end_if end_if if I_CompareCounter sally_defense = 0 set_counter sally_defense 2 end_if set_counter reform_back 0 battle_wait 7 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter sally_defense = 2 and I_BattleIsSallyOutBattle and I_UnitDistanceFromPosition a2g1 1 1 > 630 and I_UnitEnemyUnitInRadius a2g1 160 set_counter sally_defense 0 ai_gta_del_objective 1 battle_wait 0.5 unit_group_order_halt army2 battle_wait 0.5 ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999 if I_CompareCounter enemy_unit_count > 0 if ! I_UnitDestroyed a2g1 and ! I_UnitStatus a2g1 left_battle ai_gta_add_unit_label 1 0 a2g1 end_if if I_CompareCounter enemy_unit_count > 1 if ! I_UnitDestroyed a2u2 and ! I_UnitStatus a2u2 left_battle ai_gta_add_unit_label 1 0 a2u2 end_if if I_CompareCounter enemy_unit_count > 2 if ! I_UnitDestroyed a2u3 and ! I_UnitStatus a2u3 left_battle ai_gta_add_unit_label 1 0 a2u3 end_if if I_CompareCounter enemy_unit_count > 3 if ! I_UnitDestroyed a2u4 and ! I_UnitStatus a2u4 left_battle ai_gta_add_unit_label 1 0 a2u4 end_if if I_CompareCounter enemy_unit_count > 4 if ! I_UnitDestroyed a2u5

and ! I_UnitStatus a2u5 left_battle ai_gta_add_unit_label 1 0 a2u5 end_if if I_CompareCounter enemy_unit_count > 5 if ! I_UnitDestroyed a2u6 and ! I_UnitStatus a2u6 left_battle ai_gta_add_unit_label 1 0 a2u6 end_if if I_CompareCounter enemy_unit_count > 6 if ! I_UnitDestroyed a2u7 and ! I_UnitStatus a2u7 left_battle ai_gta_add_unit_label 1 0 a2u7 end_if if I_CompareCounter enemy_unit_count > 7 if ! I_UnitDestroyed a2u8 and ! I_UnitStatus a2u8 left_battle ai_gta_add_unit_label 1 0 a2u8 end_if if I_CompareCounter enemy_unit_count > 8 if ! I_UnitDestroyed a2u9 and ! I_UnitStatus a2u9 left_battle ai_gta_add_unit_label 1 0 a2u9 end_if if I_CompareCounter enemy_unit_count > 9 if ! I_UnitDestroyed a2u10 and ! I_UnitStatus a2u10 left_battle ai_gta_add_unit_label 1 0 a2u10 end_if if I_CompareCounter enemy_unit_count > 10 if ! I_UnitDestroyed a2u11 and ! I_UnitStatus a2u11 left_battle ai_gta_add_unit_label 1 0 a2u11 end_if if I_CompareCounter enemy_unit_count > 11 if ! I_UnitDestroyed a2u12 and ! I_UnitStatus a2u12 left_battle ai_gta_add_unit_label 1 0 a2u12 end_if if I_CompareCounter enemy_unit_count > 12 if ! I_UnitDestroyed a2u13 and ! I_UnitStatus a2u13 left_battle ai_gta_add_unit_label 1 0 a2u13 end_if if I_CompareCounter enemy_unit_count > 13 if ! I_UnitDestroyed a2u14 and ! I_UnitStatus a2u14 left_battle ai_gta_add_unit_label 1 0 a2u14 end_if if I_CompareCounter enemy_unit_count > 14 if ! I_UnitDestroyed a2u15

and ! I_UnitStatus a2u15 left_battle ai_gta_add_unit_label 1 0 a2u15 end_if if I_CompareCounter enemy_unit_count > 15 if ! I_UnitDestroyed a2u16 and ! I_UnitStatus a2u16 left_battle ai_gta_add_unit_label 1 0 a2u16 end_if if I_CompareCounter enemy_unit_count > 16 if ! I_UnitDestroyed a2u17 and ! I_UnitStatus a2u17 left_battle ai_gta_add_unit_label 1 0 a2u17 end_if if I_CompareCounter enemy_unit_count > 17 if ! I_UnitDestroyed a2u18 and ! I_UnitStatus a2u18 left_battle ai_gta_add_unit_label 1 0 a2u18 end_if if I_CompareCounter enemy_unit_count > 18 if ! I_UnitDestroyed a2u19 and ! I_UnitStatus a2u19 left_battle ai_gta_add_unit_label 1 0 a2u19 end_if if I_CompareCounter enemy_unit_count = 20 if ! I_UnitDestroyed a2u20 and ! I_UnitStatus a2u20 left_battle ai_gta_add_unit_label 1 0 a2u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if ; ai_active_set off battle_wait 0.5 ai_active_set on inc_counter reform_multi 1 set_counter defend_location 2 set_counter sally_defense_check 1

battle_wait 30 if I_CompareCounter sally_defense_check = 1 set_counter sally_defense 3 end_if end_monitor monitor_conditions I_BattleStarted and I_CompareCounter sally_defense = 2 and I_UnitDistanceFromPosition a2g1 1 1 > 560 and I_UnitDistanceFromPosition a2g1 1 1 < 630 and I_UnitEnemyUnitInRadius a2g1 160 set_counter sally_defense 0 ai_gta_del_objective 1 battle_wait 0.5 unit_group_order_halt army2 battle_wait 0.5 ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999 if I_CompareCounter enemy_unit_count > 0 if ! I_UnitDestroyed a2g1 and ! I_UnitStatus a2g1 left_battle ai_gta_add_unit_label 1 0 a2g1 end_if if I_CompareCounter enemy_unit_count > 1 if ! I_UnitDestroyed a2u2 and ! I_UnitStatus a2u2 left_battle ai_gta_add_unit_label 1 0 a2u2 end_if if I_CompareCounter enemy_unit_count > 2 if ! I_UnitDestroyed a2u3 and ! I_UnitStatus a2u3 left_battle ai_gta_add_unit_label 1 0 a2u3 end_if if I_CompareCounter enemy_unit_count > 3 if ! I_UnitDestroyed a2u4 and ! I_UnitStatus a2u4 left_battle ai_gta_add_unit_label 1 0 a2u4 end_if if I_CompareCounter enemy_unit_count > 4 if ! I_UnitDestroyed a2u5 and ! I_UnitStatus a2u5 left_battle ai_gta_add_unit_label 1 0 a2u5 end_if if I_CompareCounter enemy_unit_count > 5 if ! I_UnitDestroyed a2u6 and ! I_UnitStatus a2u6 left_battle ai_gta_add_unit_label 1 0 a2u6 end_if if I_CompareCounter enemy_unit_count > 6 if ! I_UnitDestroyed a2u7 and ! I_UnitStatus a2u7 left_battle ai_gta_add_unit_label 1 0 a2u7 end_if

if I_CompareCounter enemy_unit_count > 7 if ! I_UnitDestroyed a2u8 and ! I_UnitStatus a2u8 left_battle ai_gta_add_unit_label 1 0 a2u8 end_if if I_CompareCounter enemy_unit_count > 8 if ! I_UnitDestroyed a2u9 and ! I_UnitStatus a2u9 left_battle ai_gta_add_unit_label 1 0 a2u9 end_if if I_CompareCounter enemy_unit_count > 9 if ! I_UnitDestroyed a2u10 and ! I_UnitStatus a2u10 left_battle ai_gta_add_unit_label 1 0 a2u10 end_if if I_CompareCounter enemy_unit_count > 10 if ! I_UnitDestroyed a2u11 and ! I_UnitStatus a2u11 left_battle ai_gta_add_unit_label 1 0 a2u11 end_if if I_CompareCounter enemy_unit_count > 11 if ! I_UnitDestroyed a2u12 and ! I_UnitStatus a2u12 left_battle ai_gta_add_unit_label 1 0 a2u12 end_if if I_CompareCounter enemy_unit_count > 12 if ! I_UnitDestroyed a2u13 and ! I_UnitStatus a2u13 left_battle ai_gta_add_unit_label 1 0 a2u13 end_if if I_CompareCounter enemy_unit_count > 13 if ! I_UnitDestroyed a2u14 and ! I_UnitStatus a2u14 left_battle ai_gta_add_unit_label 1 0 a2u14 end_if if I_CompareCounter enemy_unit_count > 14 if ! I_UnitDestroyed a2u15 and ! I_UnitStatus a2u15 left_battle ai_gta_add_unit_label 1 0 a2u15 end_if if I_CompareCounter enemy_unit_count > 15 if ! I_UnitDestroyed a2u16 and ! I_UnitStatus a2u16 left_battle ai_gta_add_unit_label 1 0 a2u16 end_if if I_CompareCounter enemy_unit_count > 16 if ! I_UnitDestroyed a2u17 and ! I_UnitStatus a2u17 left_battle ai_gta_add_unit_label 1 0 a2u17 end_if

if I_CompareCounter enemy_unit_count > 17 if ! I_UnitDestroyed a2u18 and ! I_UnitStatus a2u18 left_battle ai_gta_add_unit_label 1 0 a2u18 end_if if I_CompareCounter enemy_unit_count > 18 if ! I_UnitDestroyed a2u19 and ! I_UnitStatus a2u19 left_battle ai_gta_add_unit_label 1 0 a2u19 end_if if I_CompareCounter enemy_unit_count = 20 if ! I_UnitDestroyed a2u20 and ! I_UnitStatus a2u20 left_battle ai_gta_add_unit_label 1 0 a2u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if ; ai_active_set off battle_wait 0.5 ai_active_set on inc_counter reform_multi 1 set_counter defend_location 2 set_counter sally_defense_check 1 battle_wait 30 if I_CompareCounter sally_defense_check = 1 set_counter sally_defense 3 end_if end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter sally_defense = 3 and I_CompareCounter reform_multi < 2 ; and I_UnitDistanceFromPosition a2g1 1 1 < 660 and I_UnitGroupDistanceFromPosition army2 1 1 < 630 and ! I_IsUnitGroupEngaged army2 set_counter sally_defense 6

if I_CompareCounter enemy_unit_count > 0 if I_UnitStatus a2g1 fighting inc_counter reform_back 3 end_if if I_UnitStatus a2g1 pursuing inc_counter reform_back 3 end_if if I_UnitStatus a2g1 charging inc_counter reform_back 3 end_if if I_CompareCounter enemy_unit_count > 1 if I_UnitStatus a2u2 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u2 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u2 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 2 if I_UnitStatus a2u3 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u3 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u3 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 3 if I_UnitStatus a2u4 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u4 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u4 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 4 if I_UnitStatus a2u5 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u5 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u5 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 5 if I_UnitStatus a2u6 fighting inc_counter reform_back 1 end_if

if I_UnitStatus a2u6 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u6 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 6 if I_UnitStatus a2u7 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u7 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u7 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 7 if I_UnitStatus a2u8 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u8 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u8 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 8 if I_UnitStatus a2u9 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u9 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u9 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 9 if I_UnitStatus a2u10 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u10 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u10 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 10 if I_UnitStatus a2u11 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u11 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u11 charging inc_counter reform_back 1

end_if if I_CompareCounter enemy_unit_count > 11 if I_UnitStatus a2u12 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u12 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u12 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 12 if I_UnitStatus a2u13 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u13 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u13 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 13 if I_UnitStatus a2u14 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u14 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u14 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 14 if I_UnitStatus a2u15 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u15 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u15 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 15 if I_UnitStatus a2u16 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u16 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u16 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 16 if I_UnitStatus a2u17 fighting inc_counter reform_back 1

end_if if I_UnitStatus a2u17 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u17 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 17 if I_UnitStatus a2u18 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u18 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u18 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 18 if I_UnitStatus a2u19 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u19 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u19 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count = 20 if I_UnitStatus a2u20 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u20 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u20 charging inc_counter reform_back 1 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if

if I_CompareCounter repeat_test2 = 1 set_counter repeat_test2 2 end_if if I_CompareCounter reform_back = 0 and I_CompareCounter repeat_test2 = 0 set_counter repeat_test2 1 set_counter sally_defense 3 end_if if I_CompareCounter reform_back = 0 and I_CompareCounter repeat_test2 = 2 ai_gta_del_objective 1 battle_wait 0.5 unit_group_order_halt army2 battle_wait 0.5 if I_CompareCounter army_south = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_north = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_east = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_west = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter enemy_unit_count > 0 if ! I_UnitDestroyed a2g1 and ! I_UnitStatus a2g1 left_battle ai_gta_add_unit_label 1 0 a2g1 end_if if I_CompareCounter enemy_unit_count > 1 if ! I_UnitDestroyed a2u2 and ! I_UnitStatus a2u2 left_battle ai_gta_add_unit_label 1 0 a2u2 end_if if I_CompareCounter enemy_unit_count > 2 if ! I_UnitDestroyed a2u3 and ! I_UnitStatus a2u3 left_battle ai_gta_add_unit_label 1 0 a2u3 end_if if I_CompareCounter enemy_unit_count > 3 if ! I_UnitDestroyed a2u4 and ! I_UnitStatus a2u4 left_battle ai_gta_add_unit_label 1 0 a2u4 end_if if I_CompareCounter enemy_unit_count > 4 if ! I_UnitDestroyed a2u5 and ! I_UnitStatus a2u5 left_battle ai_gta_add_unit_label 1 0 a2u5 999 0, -750, 100 999 0, 750, 100 999 750, 0, 100 999 -750, 0, 100

end_if if I_CompareCounter enemy_unit_count > 5 if ! I_UnitDestroyed a2u6 and ! I_UnitStatus a2u6 left_battle ai_gta_add_unit_label 1 0 a2u6 end_if if I_CompareCounter enemy_unit_count > 6 if ! I_UnitDestroyed a2u7 and ! I_UnitStatus a2u7 left_battle ai_gta_add_unit_label 1 0 a2u7 end_if if I_CompareCounter enemy_unit_count > 7 if ! I_UnitDestroyed a2u8 and ! I_UnitStatus a2u8 left_battle ai_gta_add_unit_label 1 0 a2u8 end_if if I_CompareCounter enemy_unit_count > 8 if ! I_UnitDestroyed a2u9 and ! I_UnitStatus a2u9 left_battle ai_gta_add_unit_label 1 0 a2u9 end_if if I_CompareCounter enemy_unit_count > 9 if ! I_UnitDestroyed a2u10 and ! I_UnitStatus a2u10 left_battle ai_gta_add_unit_label 1 0 a2u10 end_if if I_CompareCounter enemy_unit_count > 10 if ! I_UnitDestroyed a2u11 and ! I_UnitStatus a2u11 left_battle ai_gta_add_unit_label 1 0 a2u11 end_if if I_CompareCounter enemy_unit_count > 11 if ! I_UnitDestroyed a2u12 and ! I_UnitStatus a2u12 left_battle ai_gta_add_unit_label 1 0 a2u12 end_if if I_CompareCounter enemy_unit_count > 12 if ! I_UnitDestroyed a2u13 and ! I_UnitStatus a2u13 left_battle ai_gta_add_unit_label 1 0 a2u13 end_if if I_CompareCounter enemy_unit_count > 13 if ! I_UnitDestroyed a2u14 and ! I_UnitStatus a2u14 left_battle ai_gta_add_unit_label 1 0 a2u14 end_if if I_CompareCounter enemy_unit_count > 14 if ! I_UnitDestroyed a2u15 and ! I_UnitStatus a2u15 left_battle ai_gta_add_unit_label 1 0 a2u15

end_if if I_CompareCounter enemy_unit_count > 15 if ! I_UnitDestroyed a2u16 and ! I_UnitStatus a2u16 left_battle ai_gta_add_unit_label 1 0 a2u16 end_if if I_CompareCounter enemy_unit_count > 16 if ! I_UnitDestroyed a2u17 and ! I_UnitStatus a2u17 left_battle ai_gta_add_unit_label 1 0 a2u17 end_if if I_CompareCounter enemy_unit_count > 17 if ! I_UnitDestroyed a2u18 and ! I_UnitStatus a2u18 left_battle ai_gta_add_unit_label 1 0 a2u18 end_if if I_CompareCounter enemy_unit_count > 18 if ! I_UnitDestroyed a2u19 and ! I_UnitStatus a2u19 left_battle ai_gta_add_unit_label 1 0 a2u19 end_if if I_CompareCounter enemy_unit_count = 20 if ! I_UnitDestroyed a2u20 and ! I_UnitStatus a2u20 left_battle ai_gta_add_unit_label 1 0 a2u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if ; ; battle_wait 0.5 unit_group_order_halt army2 ai_active_set off battle_wait 0.5 ai_active_set on set_counter sally_defense 2 set_counter defend_location 1 set_counter reform_multi 1

set_counter set_counter set_counter set_counter set_counter set_counter set_counter end_if

reset_position 0 repeat_test1 0 repeat_test2 0 repeat_test3 0 repeat_test4 0 repeat_test5 0 repeat_test6 0

if I_CompareCounter reform_back > 0 and I_CompareCounter reform_back < 3 set_counter reform_back 0 set_counter sally_defense 3 battle_wait 20 end_if if I_CompareCounter reform_back > 2 set_counter reform_back 0 set_counter sally_defense 3 ;battle_wait 60 battle_wait 30 if I_CompareCounter sally_defense > 2 battle_wait 30 end_if end_if set_counter reform_back 0 if I_CompareCounter repeat_test2 = 1 battle_wait 20 end_if end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter sally_defense = 3 and I_CompareCounter reform_multi = 2 ; and I_UnitDistanceFromPosition a2g1 1 1 < 620 and I_UnitGroupDistanceFromPosition army2 1 1 < 600 and ! I_IsUnitGroupEngaged army2 set_counter sally_defense 6 if I_CompareCounter enemy_unit_count > 0 if I_UnitStatus a2g1 fighting inc_counter reform_back 3 end_if if I_UnitStatus a2g1 pursuing inc_counter reform_back 3 end_if if I_UnitStatus a2g1 charging inc_counter reform_back 3 end_if if I_CompareCounter enemy_unit_count > 1 if I_UnitStatus a2u2 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u2 pursuing inc_counter reform_back 1

end_if if I_UnitStatus a2u2 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 2 if I_UnitStatus a2u3 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u3 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u3 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 3 if I_UnitStatus a2u4 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u4 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u4 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 4 if I_UnitStatus a2u5 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u5 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u5 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 5 if I_UnitStatus a2u6 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u6 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u6 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 6 if I_UnitStatus a2u7 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u7 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u7 charging inc_counter reform_back 1 end_if

if I_CompareCounter enemy_unit_count > 7 if I_UnitStatus a2u8 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u8 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u8 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 8 if I_UnitStatus a2u9 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u9 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u9 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 9 if I_UnitStatus a2u10 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u10 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u10 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 10 if I_UnitStatus a2u11 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u11 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u11 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 11 if I_UnitStatus a2u12 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u12 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u12 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 12 if I_UnitStatus a2u13 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u13 pursuing

inc_counter reform_back 1 end_if if I_UnitStatus a2u13 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 13 if I_UnitStatus a2u14 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u14 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u14 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 14 if I_UnitStatus a2u15 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u15 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u15 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 15 if I_UnitStatus a2u16 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u16 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u16 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 16 if I_UnitStatus a2u17 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u17 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u17 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 17 if I_UnitStatus a2u18 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u18 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u18 charging inc_counter reform_back 1 end_if

if I_CompareCounter enemy_unit_count > 18 if I_UnitStatus a2u19 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u19 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u19 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count = 20 if I_UnitStatus a2u20 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u20 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u20 charging inc_counter reform_back 1 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if if I_CompareCounter repeat_test3 = 1 set_counter repeat_test3 2 end_if if I_CompareCounter reform_back = 0 and I_CompareCounter repeat_test3 = 0 set_counter repeat_test3 1 set_counter sally_defense 3 end_if if I_CompareCounter reform_back = 0 and I_CompareCounter repeat_test3 = 2 if ! I_UnitEnemyUnitInRadius a2g1 150 ai_gta_del_objective 1 battle_wait 0.5 unit_group_order_halt army2

battle_wait 0.5 if I_CompareCounter army_south = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_north = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_east = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_west = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if set_counter reform_multi 1 if I_CompareCounter enemy_unit_count > 0 if ! I_UnitDestroyed a2g1 and ! I_UnitStatus a2g1 left_battle ai_gta_add_unit_label 1 0 a2g1 end_if if I_CompareCounter enemy_unit_count > 1 if ! I_UnitDestroyed a2u2 and ! I_UnitStatus a2u2 left_battle ai_gta_add_unit_label 1 0 a2u2 end_if if I_CompareCounter enemy_unit_count > 2 if ! I_UnitDestroyed a2u3 and ! I_UnitStatus a2u3 left_battle ai_gta_add_unit_label 1 0 a2u3 end_if if I_CompareCounter enemy_unit_count > 3 if ! I_UnitDestroyed a2u4 and ! I_UnitStatus a2u4 left_battle ai_gta_add_unit_label 1 0 a2u4 end_if if I_CompareCounter enemy_unit_count > 4 if ! I_UnitDestroyed a2u5 and ! I_UnitStatus a2u5 left_battle ai_gta_add_unit_label 1 0 a2u5 end_if if I_CompareCounter enemy_unit_count > 5 if ! I_UnitDestroyed a2u6 and ! I_UnitStatus a2u6 left_battle ai_gta_add_unit_label 1 0 a2u6 end_if if I_CompareCounter enemy_unit_count > 6 if ! I_UnitDestroyed a2u7 and ! I_UnitStatus a2u7 left_battle ai_gta_add_unit_label 1 0 a2u7 end_if if I_CompareCounter enemy_unit_count > 7 if ! I_UnitDestroyed a2u8 and ! I_UnitStatus a2u8 left_battle

999 0, -750, 100 999 0, 750, -100 999 750, 0, -100 999 -750, 0, 100

ai_gta_add_unit_label 1 0 a2u8 end_if if I_CompareCounter enemy_unit_count > 8 if ! I_UnitDestroyed a2u9 and ! I_UnitStatus a2u9 left_battle ai_gta_add_unit_label 1 0 a2u9 end_if if I_CompareCounter enemy_unit_count > 9 if ! I_UnitDestroyed a2u10 and ! I_UnitStatus a2u10 left_battle ai_gta_add_unit_label 1 0 a2u10 end_if if I_CompareCounter enemy_unit_count > 10 if ! I_UnitDestroyed a2u11 and ! I_UnitStatus a2u11 left_battle ai_gta_add_unit_label 1 0 a2u11 end_if if I_CompareCounter enemy_unit_count > 11 if ! I_UnitDestroyed a2u12 and ! I_UnitStatus a2u12 left_battle ai_gta_add_unit_label 1 0 a2u12 end_if if I_CompareCounter enemy_unit_count > 12 if ! I_UnitDestroyed a2u13 and ! I_UnitStatus a2u13 left_battle ai_gta_add_unit_label 1 0 a2u13 end_if if I_CompareCounter enemy_unit_count > 13 if ! I_UnitDestroyed a2u14 and ! I_UnitStatus a2u14 left_battle ai_gta_add_unit_label 1 0 a2u14 end_if if I_CompareCounter enemy_unit_count > 14 if ! I_UnitDestroyed a2u15 and ! I_UnitStatus a2u15 left_battle ai_gta_add_unit_label 1 0 a2u15 end_if if I_CompareCounter enemy_unit_count > 15 if ! I_UnitDestroyed a2u16 and ! I_UnitStatus a2u16 left_battle ai_gta_add_unit_label 1 0 a2u16 end_if if I_CompareCounter enemy_unit_count > 16 if ! I_UnitDestroyed a2u17 and ! I_UnitStatus a2u17 left_battle ai_gta_add_unit_label 1 0 a2u17 end_if if I_CompareCounter enemy_unit_count > 17 if ! I_UnitDestroyed a2u18 and ! I_UnitStatus a2u18 left_battle

ai_gta_add_unit_label 1 0 a2u18 end_if if I_CompareCounter enemy_unit_count > 18 if ! I_UnitDestroyed a2u19 and ! I_UnitStatus a2u19 left_battle ai_gta_add_unit_label 1 0 a2u19 end_if if I_CompareCounter enemy_unit_count = 20 if ! I_UnitDestroyed a2u20 and ! I_UnitStatus a2u20 left_battle ai_gta_add_unit_label 1 0 a2u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if ; ; battle_wait 0.5 unit_group_order_halt army2 ai_active_set off battle_wait 0.5 ai_active_set on set_counter sally_defense 2 set_counter defend_location 1 set_counter reset_position 0 set_counter repeat_test1 0 set_counter repeat_test2 0 set_counter repeat_test3 0 set_counter repeat_test4 0 set_counter repeat_test5 0 set_counter repeat_test6 0 end_if

if I_UnitEnemyUnitInRadius a2g1 150 set_counter sally_defense 3 battle_wait 7 end_if end_if if I_CompareCounter reform_back > 0 and I_CompareCounter reform_back < 3

set_counter reform_back 0 set_counter sally_defense 3 battle_wait 20 end_if if I_CompareCounter reform_back > 2 set_counter reform_back 0 set_counter sally_defense 3 ;battle_wait 60 battle_wait 30 if I_CompareCounter sally_defense > 2 battle_wait 30 end_if end_if set_counter reform_back 0 if I_CompareCounter repeat_test3 = 1 battle_wait 20 end_if end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter sally_defense = 3 and I_CompareCounter reform_multi = 3 ; and I_UnitDistanceFromPosition a2g1 1 1 < 580 and I_UnitGroupDistanceFromPosition army2 1 1 < 560 and ! I_IsUnitGroupEngaged army2 set_counter sally_defense 6 if I_CompareCounter enemy_unit_count > 0 if I_UnitStatus a2g1 fighting inc_counter reform_back 3 end_if if I_UnitStatus a2g1 pursuing inc_counter reform_back 3 end_if if I_UnitStatus a2g1 charging inc_counter reform_back 3 end_if if I_CompareCounter enemy_unit_count > 1 if I_UnitStatus a2u2 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u2 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u2 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 2 if I_UnitStatus a2u3 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u3 pursuing inc_counter reform_back 1

end_if if I_UnitStatus a2u3 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 3 if I_UnitStatus a2u4 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u4 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u4 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 4 if I_UnitStatus a2u5 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u5 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u5 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 5 if I_UnitStatus a2u6 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u6 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u6 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 6 if I_UnitStatus a2u7 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u7 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u7 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 7 if I_UnitStatus a2u8 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u8 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u8 charging inc_counter reform_back 1 end_if

if I_CompareCounter enemy_unit_count > 8 if I_UnitStatus a2u9 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u9 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u9 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 9 if I_UnitStatus a2u10 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u10 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u10 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 10 if I_UnitStatus a2u11 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u11 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u11 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 11 if I_UnitStatus a2u12 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u12 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u12 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 12 if I_UnitStatus a2u13 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u13 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u13 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 13 if I_UnitStatus a2u14 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u14 pursuing

inc_counter reform_back 1 end_if if I_UnitStatus a2u14 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 14 if I_UnitStatus a2u15 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u15 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u15 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 15 if I_UnitStatus a2u16 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u16 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u16 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 16 if I_UnitStatus a2u17 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u17 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u17 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 17 if I_UnitStatus a2u18 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u18 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u18 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 18 if I_UnitStatus a2u19 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u19 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u19 charging inc_counter reform_back 1 end_if

if I_CompareCounter enemy_unit_count = 20 if I_UnitStatus a2u20 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u20 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u20 charging inc_counter reform_back 1 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if if I_CompareCounter sally_reinf > 0 and I_UnitDistanceFromUnit a4g1 a2g1 < 300 if I_UnitStatus a4g1 fighting inc_counter reform_back 1 end_if if I_UnitStatus a4g1 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a4g1 charging inc_counter reform_back 1 end_if end_if if I_CompareCounter repeat_test4 = 1 set_counter repeat_test4 2 end_if if I_CompareCounter reform_back = 0 and I_CompareCounter repeat_test4 = 0 set_counter repeat_test4 1 set_counter sally_defense 3 end_if if I_CompareCounter reform_back = 0 and I_CompareCounter repeat_test4 = 2 if I_UnitEnemyUnitInRadius a2g1 180 ai_gta_del_objective 1

battle_wait 0.5 unit_group_order_halt army2 battle_wait 0.5 if I_CompareCounter army_south = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_north = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_east = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_west = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if set_counter reform_multi 2 end_if if ! I_UnitEnemyUnitInRadius a2g1 180 ai_gta_del_objective 1 battle_wait 0.5 unit_group_order_halt army2 battle_wait 0.5 if I_CompareCounter army_south = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_north = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_east = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_west = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if set_counter reform_multi 1 end_if if I_CompareCounter enemy_unit_count > 0 if ! I_UnitDestroyed a2g1 and ! I_UnitStatus a2g1 left_battle ai_gta_add_unit_label 1 0 a2g1 end_if if I_CompareCounter enemy_unit_count > 1 if ! I_UnitDestroyed a2u2 and ! I_UnitStatus a2u2 left_battle ai_gta_add_unit_label 1 0 a2u2 end_if if I_CompareCounter enemy_unit_count > 2 if ! I_UnitDestroyed a2u3 and ! I_UnitStatus a2u3 left_battle ai_gta_add_unit_label 1 0 a2u3 end_if if I_CompareCounter enemy_unit_count > 3 if ! I_UnitDestroyed a2u4 and ! I_UnitStatus a2u4 left_battle ai_gta_add_unit_label 1 0 a2u4 999 0, -700, 100 999 0, 700, 100 999 700, 0, 100 999 -700, 0, 100

999 0, -725, 100 999 0, 725, 100 999 725, 0, 100 999 -725, 0, 100

end_if if I_CompareCounter enemy_unit_count > 4 if ! I_UnitDestroyed a2u5 and ! I_UnitStatus a2u5 left_battle ai_gta_add_unit_label 1 0 a2u5 end_if if I_CompareCounter enemy_unit_count > 5 if ! I_UnitDestroyed a2u6 and ! I_UnitStatus a2u6 left_battle ai_gta_add_unit_label 1 0 a2u6 end_if if I_CompareCounter enemy_unit_count > 6 if ! I_UnitDestroyed a2u7 and ! I_UnitStatus a2u7 left_battle ai_gta_add_unit_label 1 0 a2u7 end_if if I_CompareCounter enemy_unit_count > 7 if ! I_UnitDestroyed a2u8 and ! I_UnitStatus a2u8 left_battle ai_gta_add_unit_label 1 0 a2u8 end_if if I_CompareCounter enemy_unit_count > 8 if ! I_UnitDestroyed a2u9 and ! I_UnitStatus a2u9 left_battle ai_gta_add_unit_label 1 0 a2u9 end_if if I_CompareCounter enemy_unit_count > 9 if ! I_UnitDestroyed a2u10 and ! I_UnitStatus a2u10 left_battle ai_gta_add_unit_label 1 0 a2u10 end_if if I_CompareCounter enemy_unit_count > 10 if ! I_UnitDestroyed a2u11 and ! I_UnitStatus a2u11 left_battle ai_gta_add_unit_label 1 0 a2u11 end_if if I_CompareCounter enemy_unit_count > 11 if ! I_UnitDestroyed a2u12 and ! I_UnitStatus a2u12 left_battle ai_gta_add_unit_label 1 0 a2u12 end_if if I_CompareCounter enemy_unit_count > 12 if ! I_UnitDestroyed a2u13 and ! I_UnitStatus a2u13 left_battle ai_gta_add_unit_label 1 0 a2u13 end_if if I_CompareCounter enemy_unit_count > 13 if ! I_UnitDestroyed a2u14 and ! I_UnitStatus a2u14 left_battle ai_gta_add_unit_label 1 0 a2u14

end_if if I_CompareCounter enemy_unit_count > 14 if ! I_UnitDestroyed a2u15 and ! I_UnitStatus a2u15 left_battle ai_gta_add_unit_label 1 0 a2u15 end_if if I_CompareCounter enemy_unit_count > 15 if ! I_UnitDestroyed a2u16 and ! I_UnitStatus a2u16 left_battle ai_gta_add_unit_label 1 0 a2u16 end_if if I_CompareCounter enemy_unit_count > 16 if ! I_UnitDestroyed a2u17 and ! I_UnitStatus a2u17 left_battle ai_gta_add_unit_label 1 0 a2u17 end_if if I_CompareCounter enemy_unit_count > 17 if ! I_UnitDestroyed a2u18 and ! I_UnitStatus a2u18 left_battle ai_gta_add_unit_label 1 0 a2u18 end_if if I_CompareCounter enemy_unit_count > 18 if ! I_UnitDestroyed a2u19 and ! I_UnitStatus a2u19 left_battle ai_gta_add_unit_label 1 0 a2u19 end_if if I_CompareCounter enemy_unit_count = 20 if ! I_UnitDestroyed a2u20 and ! I_UnitStatus a2u20 left_battle ai_gta_add_unit_label 1 0 a2u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if ; battle_wait 0.5 unit_group_order_halt army2

ai_active_set off battle_wait 0.5 ai_active_set on set_counter sally_defense 2 set_counter defend_location 1 set_counter reset_position 0 set_counter repeat_test1 0 set_counter repeat_test2 0 set_counter repeat_test3 0 set_counter repeat_test4 0 set_counter repeat_test5 0 set_counter repeat_test6 0 end_if if I_CompareCounter reform_back > 0 and I_CompareCounter reform_back < 3 set_counter reform_back 0 set_counter sally_defense 3 battle_wait 20 end_if if I_CompareCounter reform_back > 2 set_counter reform_back 0 set_counter sally_defense 3 ;battle_wait 60 battle_wait 30 if I_CompareCounter sally_defense > 2 battle_wait 30 end_if end_if set_counter reform_back 0 if I_CompareCounter repeat_test4 = 1 battle_wait 20 end_if end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter sally_defense = 3 and I_CompareCounter reform_multi > 3 and ! I_IsUnitGroupEngaged army2 set_counter sally_defense 6 if I_CompareCounter army_south = 1 and I_UnitDistanceFromLine a2g1 sw set_counter line_passed 1 end_if if I_CompareCounter army_north = 1 and I_UnitDistanceFromLine a2g1 nw set_counter line_passed 1 end_if if I_CompareCounter army_west = 1 and I_UnitDistanceFromLine a2g1 sw set_counter line_passed 1 end_if if I_CompareCounter army_east = 1 and I_UnitDistanceFromLine a2g1 se

se < 0

ne > 0

nw > 0

ne < 0

set_counter line_passed 1 end_if if I_CompareCounter line_passed = 1 set_counter line_passed 0 if I_CompareCounter enemy_unit_count > 0 if I_UnitStatus a2g1 fighting inc_counter reform_back 3 end_if if I_UnitStatus a2g1 pursuing inc_counter reform_back 3 end_if if I_UnitStatus a2g1 charging inc_counter reform_back 3 end_if if I_CompareCounter enemy_unit_count > 1 if I_UnitStatus a2u2 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u2 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u2 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 2 if I_UnitStatus a2u3 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u3 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u3 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 3 if I_UnitStatus a2u4 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u4 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u4 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 4 if I_UnitStatus a2u5 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u5 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u5 charging inc_counter reform_back 1

end_if if I_CompareCounter enemy_unit_count > 5 if I_UnitStatus a2u6 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u6 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u6 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 6 if I_UnitStatus a2u7 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u7 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u7 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 7 if I_UnitStatus a2u8 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u8 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u8 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 8 if I_UnitStatus a2u9 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u9 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u9 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 9 if I_UnitStatus a2u10 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u10 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u10 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 10 if I_UnitStatus a2u11 fighting inc_counter reform_back 1

end_if if I_UnitStatus a2u11 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u11 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 11 if I_UnitStatus a2u12 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u12 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u12 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 12 if I_UnitStatus a2u13 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u13 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u13 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 13 if I_UnitStatus a2u14 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u14 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u14 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 14 if I_UnitStatus a2u15 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u15 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u15 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 15 if I_UnitStatus a2u16 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u16 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u16 charging

inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 16 if I_UnitStatus a2u17 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u17 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u17 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 17 if I_UnitStatus a2u18 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u18 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u18 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count > 18 if I_UnitStatus a2u19 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u19 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u19 charging inc_counter reform_back 1 end_if if I_CompareCounter enemy_unit_count = 20 if I_UnitStatus a2u20 fighting inc_counter reform_back 1 end_if if I_UnitStatus a2u20 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a2u20 charging inc_counter reform_back 1 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if

end_if end_if end_if end_if end_if end_if if I_CompareCounter sally_reinf > 0 and I_UnitDistanceFromUnit a4g1 a2g1 < 300 if I_UnitStatus a4g1 fighting inc_counter reform_back 1 end_if if I_UnitStatus a4g1 pursuing inc_counter reform_back 1 end_if if I_UnitStatus a4g1 charging inc_counter reform_back 1 end_if end_if if I_CompareCounter repeat_test5 = 1 set_counter repeat_test5 2 end_if if I_CompareCounter reform_back = 0 and I_CompareCounter repeat_test5 = 0 set_counter repeat_test5 1 end_if if I_CompareCounter reform_back = 0 and I_CompareCounter repeat_test5 = 2 if ! I_UnitEnemyUnitInRadius a2g1 20 if ! I_UnitEnemyUnitInRadius a2g1 20 and I_BattleSettlementFortificationLevel > ai_gta_del_objective 1 battle_wait 0.5 unit_group_order_halt army2 battle_wait 0.5 if I_CompareCounter army_south = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_north = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_east = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_west = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if set_counter reform_multi 2 end_if 2

999 0, -675, 100 999 0, 675, 100 999 675, 0, 100 999 -675, 0, 100

if ! I_UnitEnemyUnitInRadius a2g1 150 and I_BattleSettlementFortificationLevel < 3 ai_gta_del_objective 1 battle_wait 0.5 unit_group_order_halt army2

battle_wait 0.5 if I_CompareCounter army_south = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_north = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_east = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_west = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if set_counter reform_multi 2 end_if if I_CompareCounter enemy_unit_count > 0 if ! I_UnitDestroyed a2g1 and ! I_UnitStatus a2g1 left_battle ai_gta_add_unit_label 1 0 a2g1 end_if if I_CompareCounter enemy_unit_count > 1 if ! I_UnitDestroyed a2u2 and ! I_UnitStatus a2u2 left_battle ai_gta_add_unit_label 1 0 a2u2 end_if if I_CompareCounter enemy_unit_count > 2 if ! I_UnitDestroyed a2u3 and ! I_UnitStatus a2u3 left_battle ai_gta_add_unit_label 1 0 a2u3 end_if if I_CompareCounter enemy_unit_count > 3 if ! I_UnitDestroyed a2u4 and ! I_UnitStatus a2u4 left_battle ai_gta_add_unit_label 1 0 a2u4 end_if if I_CompareCounter enemy_unit_count > 4 if ! I_UnitDestroyed a2u5 and ! I_UnitStatus a2u5 left_battle ai_gta_add_unit_label 1 0 a2u5 end_if if I_CompareCounter enemy_unit_count > 5 if ! I_UnitDestroyed a2u6 and ! I_UnitStatus a2u6 left_battle ai_gta_add_unit_label 1 0 a2u6 end_if if I_CompareCounter enemy_unit_count > 6 if ! I_UnitDestroyed a2u7 and ! I_UnitStatus a2u7 left_battle ai_gta_add_unit_label 1 0 a2u7 end_if if I_CompareCounter enemy_unit_count > 7 if ! I_UnitDestroyed a2u8

999 0, -675, 100 999 0, 675, 100 999 675, 0, 100 999 -675, 0, 100

and ! I_UnitStatus a2u8 left_battle ai_gta_add_unit_label 1 0 a2u8 end_if if I_CompareCounter enemy_unit_count > 8 if ! I_UnitDestroyed a2u9 and ! I_UnitStatus a2u9 left_battle ai_gta_add_unit_label 1 0 a2u9 end_if if I_CompareCounter enemy_unit_count > 9 if ! I_UnitDestroyed a2u10 and ! I_UnitStatus a2u10 left_battle ai_gta_add_unit_label 1 0 a2u10 end_if if I_CompareCounter enemy_unit_count > 10 if ! I_UnitDestroyed a2u11 and ! I_UnitStatus a2u11 left_battle ai_gta_add_unit_label 1 0 a2u11 end_if if I_CompareCounter enemy_unit_count > 11 if ! I_UnitDestroyed a2u12 and ! I_UnitStatus a2u12 left_battle ai_gta_add_unit_label 1 0 a2u12 end_if if I_CompareCounter enemy_unit_count > 12 if ! I_UnitDestroyed a2u13 and ! I_UnitStatus a2u13 left_battle ai_gta_add_unit_label 1 0 a2u13 end_if if I_CompareCounter enemy_unit_count > 13 if ! I_UnitDestroyed a2u14 and ! I_UnitStatus a2u14 left_battle ai_gta_add_unit_label 1 0 a2u14 end_if if I_CompareCounter enemy_unit_count > 14 if ! I_UnitDestroyed a2u15 and ! I_UnitStatus a2u15 left_battle ai_gta_add_unit_label 1 0 a2u15 end_if if I_CompareCounter enemy_unit_count > 15 if ! I_UnitDestroyed a2u16 and ! I_UnitStatus a2u16 left_battle ai_gta_add_unit_label 1 0 a2u16 end_if if I_CompareCounter enemy_unit_count > 16 if ! I_UnitDestroyed a2u17 and ! I_UnitStatus a2u17 left_battle ai_gta_add_unit_label 1 0 a2u17 end_if if I_CompareCounter enemy_unit_count > 17 if ! I_UnitDestroyed a2u18

and ! I_UnitStatus a2u18 left_battle ai_gta_add_unit_label 1 0 a2u18 end_if if I_CompareCounter enemy_unit_count > 18 if ! I_UnitDestroyed a2u19 and ! I_UnitStatus a2u19 left_battle ai_gta_add_unit_label 1 0 a2u19 end_if if I_CompareCounter enemy_unit_count = 20 if ! I_UnitDestroyed a2u20 and ! I_UnitStatus a2u20 left_battle ai_gta_add_unit_label 1 0 a2u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if battle_wait 0.5 unit_group_order_halt army2 ai_active_set off battle_wait 0.5 ai_active_set on set_counter sally_defense 2 set_counter defend_location 1 set_counter reset_position 0 set_counter repeat_test1 0 set_counter repeat_test2 0 set_counter repeat_test3 0 set_counter repeat_test4 0 set_counter repeat_test5 0 set_counter repeat_test6 0 end_if if I_UnitEnemyUnitInRadius a2g1 20 set_counter sally_defense 3 battle_wait 20 end_if end_if ; ; if I_CompareCounter reform_back > 0 and I_CompareCounter reform_back < 3

set_counter reform_back 0 set_counter sally_defense 3 battle_wait 20 end_if if I_CompareCounter reform_back > 2 set_counter reform_back 0 set_counter sally_defense 3 ;battle_wait 60 battle_wait 30 if I_CompareCounter sally_defense > 2 battle_wait 30 end_if end_if set_counter reform_back 0 if I_CompareCounter repeat_test5 = 1 battle_wait 10 end_if end_if end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter sally_defense > 0 ;check and I_CompareCounter reform_multi > 2 and ! I_IsUnitGroupEngaged army2 and I_UnitEnemyUnitInRadius a2g1 160 ; and I_UnitDistanceFromPosition a2g1 1 1 < 560 and I_UnitGroupDistanceFromPosition army2 1 1 < 560 ; and I_BattleSettlementFortificationLevel > 2 if I_CompareCounter enemy_unit_count > 0 and I_IsUnitUnderFire a2g1 and ! I_IsUnitEngaged a2g1 and ! I_UnitStatus a2g1 pursuing and ! I_UnitStatus a2g1 charging and ! I_UnitStatus a2g1 moving inc_counter reset_position 2 end_if if I_CompareCounter enemy_unit_count > 1 and I_IsUnitUnderFire a2u2 and ! I_IsUnitEngaged a2u2 and ! I_UnitStatus a2u2 pursuing and ! I_UnitStatus a2u2 charging and ! I_UnitStatus a2u2 moving inc_counter reset_position 1 end_if if I_CompareCounter enemy_unit_count > 2 and I_IsUnitUnderFire a2u3 and ! I_IsUnitEngaged a2u3 and ! I_UnitStatus a2u3 pursuing and ! I_UnitStatus a2u3 charging and ! I_UnitStatus a2u3 moving inc_counter reset_position 1 end_if

if I_CompareCounter enemy_unit_count > 3 and I_IsUnitUnderFire a2u4 and ! I_IsUnitEngaged a2u4 and ! I_UnitStatus a2u4 pursuing and ! I_UnitStatus a2u4 charging and ! I_UnitStatus a2u4 moving inc_counter reset_position 1 end_if if I_CompareCounter enemy_unit_count > 4 and I_IsUnitUnderFire a2u5 and ! I_IsUnitEngaged a2u5 and ! I_UnitStatus a2u5 pursuing and ! I_UnitStatus a2u5 charging and ! I_UnitStatus a2u5 moving inc_counter reset_position 1 end_if if I_CompareCounter enemy_unit_count > 5 and I_IsUnitUnderFire a2u6 and ! I_IsUnitEngaged a2u6 and ! I_UnitStatus a2u6 pursuing and ! I_UnitStatus a2u6 charging and ! I_UnitStatus a2u6 moving inc_counter reset_position 1 end_if if I_CompareCounter enemy_unit_count > 6 and I_IsUnitUnderFire a2u7 and ! I_IsUnitEngaged a2u7 and ! I_UnitStatus a2u7 pursuing and ! I_UnitStatus a2u7 charging and ! I_UnitStatus a2u7 moving inc_counter reset_position 1 end_if if I_CompareCounter enemy_unit_count > 7 and I_IsUnitUnderFire a2u8 and ! I_IsUnitEngaged a2u8 and ! I_UnitStatus a2u8 pursuing and ! I_UnitStatus a2u8 charging and ! I_UnitStatus a2u8 moving inc_counter reset_position 1 end_if if I_CompareCounter enemy_unit_count > 8 and I_IsUnitUnderFire a2u9 and ! I_IsUnitEngaged a2u9 and ! I_UnitStatus a2u9 pursuing and ! I_UnitStatus a2u9 charging and ! I_UnitStatus a2u9 moving inc_counter reset_position 1 end_if if I_CompareCounter enemy_unit_count > 9 and I_IsUnitUnderFire a2u10 and ! I_IsUnitEngaged a2u10 and ! I_UnitStatus a2u10 pursuing and ! I_UnitStatus a2u10 charging and ! I_UnitStatus a2u10 moving

inc_counter reset_position 1 end_if if I_CompareCounter enemy_unit_count > 10 and I_IsUnitUnderFire a2u11 and ! I_IsUnitEngaged a2u11 and ! I_UnitStatus a2u11 pursuing and ! I_UnitStatus a2u11 charging and ! I_UnitStatus a2u11 moving inc_counter reset_position 1 end_if if I_CompareCounter enemy_unit_count > 11 and I_IsUnitUnderFire a2u12 and ! I_IsUnitEngaged a2u12 and ! I_UnitStatus a2u12 pursuing and ! I_UnitStatus a2u12 charging and ! I_UnitStatus a2u12 moving inc_counter reset_position 1 end_if if I_CompareCounter enemy_unit_count > 12 and I_IsUnitUnderFire a2u13 and ! I_IsUnitEngaged a2u13 and ! I_UnitStatus a2u13 pursuing and ! I_UnitStatus a2u13 charging and ! I_UnitStatus a2u13 moving inc_counter reset_position 1 end_if if I_CompareCounter enemy_unit_count > 13 and I_IsUnitUnderFire a2u14 and ! I_IsUnitEngaged a2u14 and ! I_UnitStatus a2u14 pursuing and ! I_UnitStatus a2u14 charging and ! I_UnitStatus a2u14 moving inc_counter reset_position 1 end_if if I_CompareCounter enemy_unit_count > 14 and I_IsUnitUnderFire a2u15 and ! I_IsUnitEngaged a2u15 and ! I_UnitStatus a2u15 pursuing and ! I_UnitStatus a2u15 charging and ! I_UnitStatus a2u15 moving inc_counter reset_position 1 end_if if I_CompareCounter enemy_unit_count > 15 and I_IsUnitUnderFire a2u16 and ! I_IsUnitEngaged a2u16 and ! I_UnitStatus a2u16 pursuing and ! I_UnitStatus a2u16 charging and ! I_UnitStatus a2u16 moving inc_counter reset_position 1 end_if if I_CompareCounter enemy_unit_count > 16 and I_IsUnitUnderFire a2u17 and ! I_IsUnitEngaged a2u17

and ! I_UnitStatus a2u17 pursuing and ! I_UnitStatus a2u17 charging and ! I_UnitStatus a2u17 moving inc_counter reset_position 1 end_if if I_CompareCounter enemy_unit_count > 17 and I_IsUnitUnderFire a2u18 and ! I_IsUnitEngaged a2u18 and ! I_UnitStatus a2u18 pursuing and ! I_UnitStatus a2u18 charging and ! I_UnitStatus a2u18 moving inc_counter reset_position 1 end_if if I_CompareCounter enemy_unit_count > 18 and I_IsUnitUnderFire a2u19 and ! I_IsUnitEngaged a2u19 and ! I_UnitStatus a2u19 pursuing and ! I_UnitStatus a2u19 charging and ! I_UnitStatus a2u19 moving inc_counter reset_position 1 end_if if I_CompareCounter enemy_unit_count = 20 and I_IsUnitUnderFire a2u20 and ! I_IsUnitEngaged a2u20 and ! I_UnitStatus a2u20 pursuing and ! I_UnitStatus a2u20 charging and ! I_UnitStatus a2u20 moving inc_counter reset_position 1 end_if if I_CompareCounter sally_reinf > 0 and I_CompareCounter army4_ready = 0 and I_IsUnitUnderFire a4g1 and ! I_IsUnitEngaged a4g1 and ! I_UnitStatus a4g1 pursuing and ! I_UnitStatus a4g1 charging and ! I_UnitStatus a4g1 moving inc_counter reset_position 2 end_if if I_CompareCounter reset_position > 3 if ! I_UnitEnemyUnitInRadius a2g1 20 and I_BattleSettlementFortificationLevel > ai_gta_del_objective 1 battle_wait 0.5 unit_group_order_halt army2 battle_wait 0.5 if I_CompareCounter army_south = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_north = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_east = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if 2

999 0, -675, 100 999 0, 675, 100 999 675, 0, 100

if I_CompareCounter army_west = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA 999 -675, 0, 100 end_if set_counter reform_multi 1 end_if if ! I_UnitEnemyUnitInRadius a2g1 150 and I_BattleSettlementFortificationLevel < ai_gta_del_objective 1 battle_wait 0.5 unit_group_order_halt army2 battle_wait 0.5 if I_CompareCounter army_south = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_north = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_east = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_west = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if set_counter reform_multi 2 end_if if I_CompareCounter enemy_unit_count > 0 if ! I_UnitDestroyed a2g1 and ! I_UnitStatus a2g1 left_battle ai_gta_add_unit_label 1 0 a2g1 end_if if I_CompareCounter enemy_unit_count > 1 if ! I_UnitDestroyed a2u2 and ! I_UnitStatus a2u2 left_battle ai_gta_add_unit_label 1 0 a2u2 end_if if I_CompareCounter enemy_unit_count > 2 if ! I_UnitDestroyed a2u3 and ! I_UnitStatus a2u3 left_battle ai_gta_add_unit_label 1 0 a2u3 end_if if I_CompareCounter enemy_unit_count > 3 if ! I_UnitDestroyed a2u4 and ! I_UnitStatus a2u4 left_battle ai_gta_add_unit_label 1 0 a2u4 end_if if I_CompareCounter enemy_unit_count > 4 if ! I_UnitDestroyed a2u5 and ! I_UnitStatus a2u5 left_battle ai_gta_add_unit_label 1 0 a2u5 end_if if I_CompareCounter enemy_unit_count > 5 if ! I_UnitDestroyed a2u6 and ! I_UnitStatus a2u6 left_battle 3

999 0, -675, 100 999 0, 675, 100 999 675, 0, 100 999 -675, 0, 100

ai_gta_add_unit_label 1 0 a2u6 end_if if I_CompareCounter enemy_unit_count > 6 if ! I_UnitDestroyed a2u7 and ! I_UnitStatus a2u7 left_battle ai_gta_add_unit_label 1 0 a2u7 end_if if I_CompareCounter enemy_unit_count > 7 if ! I_UnitDestroyed a2u8 and ! I_UnitStatus a2u8 left_battle ai_gta_add_unit_label 1 0 a2u8 end_if if I_CompareCounter enemy_unit_count > 8 if ! I_UnitDestroyed a2u9 and ! I_UnitStatus a2u9 left_battle ai_gta_add_unit_label 1 0 a2u9 end_if if I_CompareCounter enemy_unit_count > 9 if ! I_UnitDestroyed a2u10 and ! I_UnitStatus a2u10 left_battle ai_gta_add_unit_label 1 0 a2u10 end_if if I_CompareCounter enemy_unit_count > 10 if ! I_UnitDestroyed a2u11 and ! I_UnitStatus a2u11 left_battle ai_gta_add_unit_label 1 0 a2u11 end_if if I_CompareCounter enemy_unit_count > 11 if ! I_UnitDestroyed a2u12 and ! I_UnitStatus a2u12 left_battle ai_gta_add_unit_label 1 0 a2u12 end_if if I_CompareCounter enemy_unit_count > 12 if ! I_UnitDestroyed a2u13 and ! I_UnitStatus a2u13 left_battle ai_gta_add_unit_label 1 0 a2u13 end_if if I_CompareCounter enemy_unit_count > 13 if ! I_UnitDestroyed a2u14 and ! I_UnitStatus a2u14 left_battle ai_gta_add_unit_label 1 0 a2u14 end_if if I_CompareCounter enemy_unit_count > 14 if ! I_UnitDestroyed a2u15 and ! I_UnitStatus a2u15 left_battle ai_gta_add_unit_label 1 0 a2u15 end_if if I_CompareCounter enemy_unit_count > 15 if ! I_UnitDestroyed a2u16 and ! I_UnitStatus a2u16 left_battle

ai_gta_add_unit_label 1 0 a2u16 end_if if I_CompareCounter enemy_unit_count > 16 if ! I_UnitDestroyed a2u17 and ! I_UnitStatus a2u17 left_battle ai_gta_add_unit_label 1 0 a2u17 end_if if I_CompareCounter enemy_unit_count > 17 if ! I_UnitDestroyed a2u18 and ! I_UnitStatus a2u18 left_battle ai_gta_add_unit_label 1 0 a2u18 end_if if I_CompareCounter enemy_unit_count > 18 if ! I_UnitDestroyed a2u19 and ! I_UnitStatus a2u19 left_battle ai_gta_add_unit_label 1 0 a2u19 end_if if I_CompareCounter enemy_unit_count = 20 if ! I_UnitDestroyed a2u20 and ! I_UnitStatus a2u20 left_battle ai_gta_add_unit_label 1 0 a2u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if battle_wait 0.5 unit_group_order_halt army2 ai_active_set off battle_wait 0.5 ai_active_set on set_counter reset_position 0 set_counter sally_defense 2 set_counter defend_location 1 end_if ; ; if I_CompareCounter sally_defense != 2 set_counter sally_defense 3 battle_wait 15

end_if end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker and I_CompareCounter sally_defense > 0 and I_UnitEnemyUnitInRadius a2g1 200 if ! I_IsUnitGroupEngaged army2 and ! I_IsUnitGroupMoving army2 and ! I_UnitStatus a2g1 pursuing and ! I_UnitStatus a2g1 charging inc_counter army2_idle_s 1 end_if if I_CompareCounter army2_idle_s > 5 set_counter army2_idle_s 0 ai_gta_del_objective 1 battle_wait 0.5 unit_group_order_halt army2 battle_wait 0.5 if I_CompareCounter army_south = 1 if I_CompareCounter reform_multi > 2 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA set_counter reform_multi 2 end_if if I_CompareCounter reform_multi < 3 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA set_counter reform_multi 1 end_if end_if if I_CompareCounter army_north = 1 if I_CompareCounter reform_multi > 2 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA set_counter reform_multi 2 end_if if I_CompareCounter reform_multi < 3 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA set_counter reform_multi 1 end_if end_if if I_CompareCounter army_east = 1 if I_CompareCounter reform_multi > 2 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA set_counter reform_multi 2 end_if if I_CompareCounter reform_multi < 3 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA set_counter reform_multi 1 end_if end_if if I_CompareCounter army_west = 1 if I_CompareCounter reform_multi > 2 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA set_counter reform_multi 2 end_if if I_CompareCounter reform_multi < 3 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA

999 0, -675, 100

999 0, -725, 100

999 0, 675, 100

999 0, 725, 100

999 675, 0, 100

999 725, 0, 100

999 -675, 0, 100

999 -725, 0, 100

set_counter reform_multi 1 end_if end_if if I_CompareCounter enemy_unit_count > 0 if ! I_UnitDestroyed a2g1 and ! I_UnitStatus a2g1 left_battle ai_gta_add_unit_label 1 0 a2g1 end_if if I_CompareCounter enemy_unit_count > 1 if ! I_UnitDestroyed a2u2 and ! I_UnitStatus a2u2 left_battle ai_gta_add_unit_label 1 0 a2u2 end_if if I_CompareCounter enemy_unit_count > 2 if ! I_UnitDestroyed a2u3 and ! I_UnitStatus a2u3 left_battle ai_gta_add_unit_label 1 0 a2u3 end_if if I_CompareCounter enemy_unit_count > 3 if ! I_UnitDestroyed a2u4 and ! I_UnitStatus a2u4 left_battle ai_gta_add_unit_label 1 0 a2u4 end_if if I_CompareCounter enemy_unit_count > 4 if ! I_UnitDestroyed a2u5 and ! I_UnitStatus a2u5 left_battle ai_gta_add_unit_label 1 0 a2u5 end_if if I_CompareCounter enemy_unit_count > 5 if ! I_UnitDestroyed a2u6 and ! I_UnitStatus a2u6 left_battle ai_gta_add_unit_label 1 0 a2u6 end_if if I_CompareCounter enemy_unit_count > 6 if ! I_UnitDestroyed a2u7 and ! I_UnitStatus a2u7 left_battle ai_gta_add_unit_label 1 0 a2u7 end_if if I_CompareCounter enemy_unit_count > 7 if ! I_UnitDestroyed a2u8 and ! I_UnitStatus a2u8 left_battle ai_gta_add_unit_label 1 0 a2u8 end_if if I_CompareCounter enemy_unit_count > 8 if ! I_UnitDestroyed a2u9 and ! I_UnitStatus a2u9 left_battle ai_gta_add_unit_label 1 0 a2u9 end_if if I_CompareCounter enemy_unit_count > 9 if ! I_UnitDestroyed a2u10

and ! I_UnitStatus a2u10 left_battle ai_gta_add_unit_label 1 0 a2u10 end_if if I_CompareCounter enemy_unit_count > 10 if ! I_UnitDestroyed a2u11 and ! I_UnitStatus a2u11 left_battle ai_gta_add_unit_label 1 0 a2u11 end_if if I_CompareCounter enemy_unit_count > 11 if ! I_UnitDestroyed a2u12 and ! I_UnitStatus a2u12 left_battle ai_gta_add_unit_label 1 0 a2u12 end_if if I_CompareCounter enemy_unit_count > 12 if ! I_UnitDestroyed a2u13 and ! I_UnitStatus a2u13 left_battle ai_gta_add_unit_label 1 0 a2u13 end_if if I_CompareCounter enemy_unit_count > 13 if ! I_UnitDestroyed a2u14 and ! I_UnitStatus a2u14 left_battle ai_gta_add_unit_label 1 0 a2u14 end_if if I_CompareCounter enemy_unit_count > 14 if ! I_UnitDestroyed a2u15 and ! I_UnitStatus a2u15 left_battle ai_gta_add_unit_label 1 0 a2u15 end_if if I_CompareCounter enemy_unit_count > 15 if ! I_UnitDestroyed a2u16 and ! I_UnitStatus a2u16 left_battle ai_gta_add_unit_label 1 0 a2u16 end_if if I_CompareCounter enemy_unit_count > 16 if ! I_UnitDestroyed a2u17 and ! I_UnitStatus a2u17 left_battle ai_gta_add_unit_label 1 0 a2u17 end_if if I_CompareCounter enemy_unit_count > 17 if ! I_UnitDestroyed a2u18 and ! I_UnitStatus a2u18 left_battle ai_gta_add_unit_label 1 0 a2u18 end_if if I_CompareCounter enemy_unit_count > 18 if ! I_UnitDestroyed a2u19 and ! I_UnitStatus a2u19 left_battle ai_gta_add_unit_label 1 0 a2u19 end_if if I_CompareCounter enemy_unit_count = 20 if ! I_UnitDestroyed a2u20

and ! I_UnitStatus a2u20 left_battle ai_gta_add_unit_label 1 0 a2u20 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if ; ; ; battle_wait 0.5 unit_group_order_halt army2 ai_active_set off battle_wait 0.5 ai_active_set on set_counter reset_position 0 set_counter sally_defense 2 set_counter defend_location 1 end_if

if I_IsUnitGroupEngaged army2 set_counter army2_idle_s 0 end_if if I_IsUnitGroupMoving army2 set_counter army2_idle_s 0 end_if if I_UnitStatus a2g1 pursuing set_counter army2_idle_s 0 end_if if I_UnitStatus a2g1 charging set_counter army2_idle_s 0 end_if battle_wait 10 end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter sally_defense > 2 and I_BattleSettlementFortificationLevel > 2 ; and I_CompareCounter reform_multi > 3 and ! I_IsUnitGroupEngaged army2 and ! I_UnitEnemyUnitInRadius a2g1 80 set_counter sally_defense 6 set_counter wall_line_passed 0 set_counter reset_position_s 0

if I_CompareCounter enemy_unit_count > 0 if I_IsUnitEngaged a2g1 inc_counter reset_position_s 2 end_if if I_UnitStatus a2g1 pursuing inc_counter reset_position_s 2 end_if if I_UnitStatus a2g1 charging inc_counter reset_position_s 2 end_if end_if if I_CompareCounter enemy_unit_count > 1 if I_IsUnitEngaged a2u2 inc_counter reset_position_s 1 end_if if I_UnitStatus a2u2 pursuing inc_counter reset_position_s 1 end_if if I_UnitStatus a2u2 charging inc_counter reset_position_s 1 end_if end_if if I_CompareCounter enemy_unit_count > 2 if I_IsUnitEngaged a2u3 inc_counter reset_position_s 1 end_if if I_UnitStatus a2u3 pursuing inc_counter reset_position_s 1 end_if if I_UnitStatus a2u3 charging inc_counter reset_position_s 1 end_if end_if if I_CompareCounter enemy_unit_count > 3 if I_IsUnitEngaged a2u4 inc_counter reset_position_s 1 end_if if I_UnitStatus a2u4 pursuing inc_counter reset_position_s 1 end_if if I_UnitStatus a2u4 charging inc_counter reset_position_s 1 end_if end_if if I_CompareCounter enemy_unit_count > 4 if I_IsUnitEngaged a2u5 inc_counter reset_position_s 1 end_if if I_UnitStatus a2u5 pursuing inc_counter reset_position_s 1 end_if if I_UnitStatus a2u5 charging inc_counter reset_position_s 1 end_if end_if

if I_CompareCounter enemy_unit_count > 5 if I_IsUnitEngaged a2u6 inc_counter reset_position_s 1 end_if if I_UnitStatus a2u6 pursuing inc_counter reset_position_s 1 end_if if I_UnitStatus a2u6 charging inc_counter reset_position_s 1 end_if end_if if I_CompareCounter enemy_unit_count > 6 if I_IsUnitEngaged a2u7 inc_counter reset_position_s 1 end_if if I_UnitStatus a2u7 pursuing inc_counter reset_position_s 1 end_if if I_UnitStatus a2u7 charging inc_counter reset_position_s 1 end_if end_if if I_CompareCounter enemy_unit_count > 7 if I_IsUnitEngaged a2u8 inc_counter reset_position_s 1 end_if if I_UnitStatus a2u8 pursuing inc_counter reset_position_s 1 end_if if I_UnitStatus a2u8 charging inc_counter reset_position_s 1 end_if end_if if I_CompareCounter enemy_unit_count > 8 if I_IsUnitEngaged a2u9 inc_counter reset_position_s 1 end_if if I_UnitStatus a2u9 pursuing inc_counter reset_position_s 1 end_if if I_UnitStatus a2u9 charging inc_counter reset_position_s 1 end_if end_if if I_CompareCounter enemy_unit_count > 9 if I_IsUnitEngaged a2u10 inc_counter reset_position_s 1 end_if if I_UnitStatus a2u10 pursuing inc_counter reset_position_s 1 end_if if I_UnitStatus a2u10 charging inc_counter reset_position_s 1 end_if end_if

if I_CompareCounter enemy_unit_count > 10 if I_IsUnitEngaged a2u11 inc_counter reset_position_s 1 end_if if I_UnitStatus a2u11 pursuing inc_counter reset_position_s 1 end_if if I_UnitStatus a2u11 charging inc_counter reset_position_s 1 end_if end_if if I_CompareCounter enemy_unit_count > 11 if I_IsUnitEngaged a2u12 inc_counter reset_position_s 1 end_if if I_UnitStatus a2u12 pursuing inc_counter reset_position_s 1 end_if if I_UnitStatus a2u12 charging inc_counter reset_position_s 1 end_if end_if if I_CompareCounter enemy_unit_count > 12 if I_IsUnitEngaged a2u13 inc_counter reset_position_s 1 end_if if I_UnitStatus a2u13 pursuing inc_counter reset_position_s 1 end_if if I_UnitStatus a2u13 charging inc_counter reset_position_s 1 end_if end_if if I_CompareCounter enemy_unit_count > 13 if I_IsUnitEngaged a2u14 inc_counter reset_position_s 1 end_if if I_UnitStatus a2u14 pursuing inc_counter reset_position_s 1 end_if if I_UnitStatus a2u14 charging inc_counter reset_position_s 1 end_if end_if if I_CompareCounter enemy_unit_count > 14 if I_IsUnitEngaged a2u15 inc_counter reset_position_s 1 end_if if I_UnitStatus a2u15 pursuing inc_counter reset_position_s 1 end_if if I_UnitStatus a2u15 charging inc_counter reset_position_s 1 end_if end_if

if I_CompareCounter enemy_unit_count > 15 if I_IsUnitEngaged a2u16 inc_counter reset_position_s 1 end_if if I_UnitStatus a2u16 pursuing inc_counter reset_position_s 1 end_if if I_UnitStatus a2u16 charging inc_counter reset_position_s 1 end_if end_if if I_CompareCounter enemy_unit_count > 16 if I_IsUnitEngaged a2u17 inc_counter reset_position_s 1 end_if if I_UnitStatus a2u17 pursuing inc_counter reset_position_s 1 end_if if I_UnitStatus a2u17 charging inc_counter reset_position_s 1 end_if end_if if I_CompareCounter enemy_unit_count > 17 if I_IsUnitEngaged a2u18 inc_counter reset_position_s 1 end_if if I_UnitStatus a2u18 pursuing inc_counter reset_position_s 1 end_if if I_UnitStatus a2u18 charging inc_counter reset_position_s 1 end_if end_if if I_CompareCounter enemy_unit_count > 18 if I_IsUnitEngaged a2u19 inc_counter reset_position_s 1 end_if if I_UnitStatus a2u19 pursuing inc_counter reset_position_s 1 end_if if I_UnitStatus a2u19 charging inc_counter reset_position_s 1 end_if end_if if I_CompareCounter enemy_unit_count = 20 if I_IsUnitEngaged a2u20 inc_counter reset_position_s 1 end_if if I_UnitStatus a2u20 pursuing inc_counter reset_position_s 1 end_if if I_UnitStatus a2u20 charging inc_counter reset_position_s 1 end_if end_if

if I_CompareCounter reset_position_s = 0 if I_CompareCounter army_south = 1 if I_CompareCounter player_unit_count > 0 and I_UnitDistanceFromLine a1g1 sw_wall se_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 1 and I_UnitDistanceFromLine a1u2 sw_wall se_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 2 and I_UnitDistanceFromLine a1u3 sw_wall se_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 3 and I_UnitDistanceFromLine a1u4 sw_wall se_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 4 and I_UnitDistanceFromLine a1u5 sw_wall se_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 5 and I_UnitDistanceFromLine a1u6 sw_wall se_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 6 and I_UnitDistanceFromLine a1u7 sw_wall se_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 7 and I_UnitDistanceFromLine a1u8 sw_wall se_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 8 and I_UnitDistanceFromLine a1u9 sw_wall se_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 9 and I_UnitDistanceFromLine a1u10 sw_wall se_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 10 and I_UnitDistanceFromLine a1u11 sw_wall se_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 11 and I_UnitDistanceFromLine a1u12 sw_wall se_wall > 0

inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 12 and I_UnitDistanceFromLine a1u13 sw_wall se_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 13 and I_UnitDistanceFromLine a1u14 sw_wall se_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 14 and I_UnitDistanceFromLine a1u15 sw_wall se_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 15 and I_UnitDistanceFromLine a1u16 sw_wall se_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 16 and I_UnitDistanceFromLine a1u17 sw_wall se_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 17 and I_UnitDistanceFromLine a1u18 sw_wall se_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 18 and I_UnitDistanceFromLine a1u19 sw_wall se_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count = 20 and I_UnitDistanceFromLine a1u20 sw_wall se_wall > 0 inc_counter wall_line_passed 1 end_if end_if if I_CompareCounter army_north = 1 if I_CompareCounter player_unit_count > 0 and I_UnitDistanceFromLine a1g1 nw_wall ne_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 1 and I_UnitDistanceFromLine a1u2 nw_wall ne_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 2 and I_UnitDistanceFromLine a1u3 nw_wall ne_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 3

and I_UnitDistanceFromLine a1u4 nw_wall ne_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 4 and I_UnitDistanceFromLine a1u5 nw_wall ne_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 5 and I_UnitDistanceFromLine a1u6 nw_wall ne_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 6 and I_UnitDistanceFromLine a1u7 nw_wall ne_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 7 and I_UnitDistanceFromLine a1u8 nw_wall ne_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 8 and I_UnitDistanceFromLine a1u9 nw_wall ne_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 9 and I_UnitDistanceFromLine a1u10 nw_wall ne_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 10 and I_UnitDistanceFromLine a1u11 nw_wall ne_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 11 and I_UnitDistanceFromLine a1u12 nw_wall ne_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 12 and I_UnitDistanceFromLine a1u13 nw_wall ne_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 13 and I_UnitDistanceFromLine a1u14 nw_wall ne_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 14 and I_UnitDistanceFromLine a1u15 nw_wall ne_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 15

and I_UnitDistanceFromLine a1u16 nw_wall ne_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 16 and I_UnitDistanceFromLine a1u17 nw_wall ne_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 17 and I_UnitDistanceFromLine a1u18 nw_wall ne_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 18 and I_UnitDistanceFromLine a1u19 nw_wall ne_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count = 20 and I_UnitDistanceFromLine a1u20 nw_wall ne_wall < 0 inc_counter wall_line_passed 1 end_if end_if if I_CompareCounter army_west = 1 if I_CompareCounter player_unit_count > 0 and I_UnitDistanceFromLine a1g1 sw_wall nw_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 1 and I_UnitDistanceFromLine a1u2 sw_wall nw_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 2 and I_UnitDistanceFromLine a1u3 sw_wall nw_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 3 and I_UnitDistanceFromLine a1u4 sw_wall nw_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 4 and I_UnitDistanceFromLine a1u5 sw_wall nw_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 5 and I_UnitDistanceFromLine a1u6 sw_wall nw_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 6 and I_UnitDistanceFromLine a1u7 sw_wall nw_wall < 0 inc_counter wall_line_passed 1 end_if

if I_CompareCounter player_unit_count > 7 and I_UnitDistanceFromLine a1u8 sw_wall nw_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 8 and I_UnitDistanceFromLine a1u9 sw_wall nw_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 9 and I_UnitDistanceFromLine a1u10 sw_wall nw_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 10 and I_UnitDistanceFromLine a1u11 sw_wall nw_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 11 and I_UnitDistanceFromLine a1u12 sw_wall nw_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 12 and I_UnitDistanceFromLine a1u13 sw_wall nw_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 13 and I_UnitDistanceFromLine a1u14 sw_wall nw_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 14 and I_UnitDistanceFromLine a1u15 sw_wall nw_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 15 and I_UnitDistanceFromLine a1u16 sw_wall nw_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 16 and I_UnitDistanceFromLine a1u17 sw_wall nw_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 17 and I_UnitDistanceFromLine a1u18 sw_wall nw_wall < 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 18 and I_UnitDistanceFromLine a1u19 sw_wall nw_wall < 0 inc_counter wall_line_passed 1 end_if

if I_CompareCounter player_unit_count = 20 and I_UnitDistanceFromLine a1u20 sw_wall nw_wall < 0 inc_counter wall_line_passed 1 end_if end_if if I_CompareCounter army_east = 1 if I_CompareCounter player_unit_count > 0 and I_UnitDistanceFromLine a1g1 se_wall ne_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 1 and I_UnitDistanceFromLine a1u2 se_wall ne_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 2 and I_UnitDistanceFromLine a1u3 se_wall ne_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 3 and I_UnitDistanceFromLine a1u4 se_wall ne_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 4 and I_UnitDistanceFromLine a1u5 se_wall ne_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 5 and I_UnitDistanceFromLine a1u6 se_wall ne_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 6 and I_UnitDistanceFromLine a1u7 se_wall ne_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 7 and I_UnitDistanceFromLine a1u8 se_wall ne_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 8 and I_UnitDistanceFromLine a1u9 se_wall ne_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 9 and I_UnitDistanceFromLine a1u10 se_wall ne_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 10 and I_UnitDistanceFromLine a1u11 se_wall ne_wall > 0 inc_counter wall_line_passed 1 end_if

if I_CompareCounter player_unit_count > 11 and I_UnitDistanceFromLine a1u12 se_wall ne_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 12 and I_UnitDistanceFromLine a1u13 se_wall ne_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 13 and I_UnitDistanceFromLine a1u14 se_wall ne_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 14 and I_UnitDistanceFromLine a1u15 se_wall ne_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 15 and I_UnitDistanceFromLine a1u16 se_wall ne_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 16 and I_UnitDistanceFromLine a1u17 se_wall ne_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 17 and I_UnitDistanceFromLine a1u18 se_wall ne_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count > 18 and I_UnitDistanceFromLine a1u19 se_wall ne_wall > 0 inc_counter wall_line_passed 1 end_if if I_CompareCounter player_unit_count = 20 and I_UnitDistanceFromLine a1u20 se_wall ne_wall > 0 inc_counter wall_line_passed 1 end_if end_if end_if if I_CompareCounter repeat_test6 = 1 set_counter repeat_test6 2 end_if if I_CompareCounter wall_line_passed = 0 and I_CompareCounter reset_position_s = 0 and I_CompareCounter repeat_test6 = 0 set_counter repeat_test6 1 end_if if I_CompareCounter wall_line_passed = 0 and I_CompareCounter reset_position_s = 0 and I_CompareCounter repeat_test6 = 2

ai_gta_del_objective 1 battle_wait 0.5 unit_group_order_halt army2 battle_wait 0.5 if I_CompareCounter army_south = 1 if I_CompareCounter reform_multi > 2 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA set_counter reform_multi 2 end_if if I_CompareCounter reform_multi < 3 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA set_counter reform_multi 1 end_if end_if if I_CompareCounter army_north = 1 if I_CompareCounter reform_multi > 2 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA set_counter reform_multi 2 end_if if I_CompareCounter reform_multi < 3 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA set_counter reform_multi 1 end_if end_if if I_CompareCounter army_east = 1 if I_CompareCounter reform_multi > 2 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA set_counter reform_multi 2 end_if if I_CompareCounter reform_multi < 3 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA set_counter reform_multi 1 end_if end_if if I_CompareCounter army_west = 1 if I_CompareCounter reform_multi > 2 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA set_counter reform_multi 2 end_if if I_CompareCounter reform_multi < 3 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA set_counter reform_multi 1 end_if end_if if I_CompareCounter enemy_unit_count > 0 if ! I_UnitDestroyed a2g1 and ! I_UnitStatus a2g1 left_battle ai_gta_add_unit_label 1 0 a2g1 end_if if I_CompareCounter enemy_unit_count > 1 if ! I_UnitDestroyed a2u2 and ! I_UnitStatus a2u2 left_battle ai_gta_add_unit_label 1 0 a2u2 end_if if I_CompareCounter enemy_unit_count > 2 if ! I_UnitDestroyed a2u3 and ! I_UnitStatus a2u3 left_battle

999 0, -675, 100

999 0, -725, 100

999 0, 675, 100

999 0, 725, 100

999 675, 0, 100

999 725, 0, 100

999 -675, 0, 100

999 -725, 0, 100

ai_gta_add_unit_label 1 0 a2u3 end_if if I_CompareCounter enemy_unit_count > 3 if ! I_UnitDestroyed a2u4 and ! I_UnitStatus a2u4 left_battle ai_gta_add_unit_label 1 0 a2u4 end_if if I_CompareCounter enemy_unit_count > 4 if ! I_UnitDestroyed a2u5 and ! I_UnitStatus a2u5 left_battle ai_gta_add_unit_label 1 0 a2u5 end_if if I_CompareCounter enemy_unit_count > 5 if ! I_UnitDestroyed a2u6 and ! I_UnitStatus a2u6 left_battle ai_gta_add_unit_label 1 0 a2u6 end_if if I_CompareCounter enemy_unit_count > 6 if ! I_UnitDestroyed a2u7 and ! I_UnitStatus a2u7 left_battle ai_gta_add_unit_label 1 0 a2u7 end_if if I_CompareCounter enemy_unit_count > 7 if ! I_UnitDestroyed a2u8 and ! I_UnitStatus a2u8 left_battle ai_gta_add_unit_label 1 0 a2u8 end_if if I_CompareCounter enemy_unit_count > 8 if ! I_UnitDestroyed a2u9 and ! I_UnitStatus a2u9 left_battle ai_gta_add_unit_label 1 0 a2u9 end_if if I_CompareCounter enemy_unit_count > 9 if ! I_UnitDestroyed a2u10 and ! I_UnitStatus a2u10 left_battle ai_gta_add_unit_label 1 0 a2u10 end_if if I_CompareCounter enemy_unit_count > 10 if ! I_UnitDestroyed a2u11 and ! I_UnitStatus a2u11 left_battle ai_gta_add_unit_label 1 0 a2u11 end_if if I_CompareCounter enemy_unit_count > 11 if ! I_UnitDestroyed a2u12 and ! I_UnitStatus a2u12 left_battle ai_gta_add_unit_label 1 0 a2u12 end_if if I_CompareCounter enemy_unit_count > 12 if ! I_UnitDestroyed a2u13 and ! I_UnitStatus a2u13 left_battle

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

end_if end_if end_if end_if ; ; ; battle_wait 0.5 unit_group_order_halt army2 ai_active_set off battle_wait 0.5 ai_active_set on set_counter reset_position_s 0 set_counter sally_defense 2 set_counter defend_location 1 set_counter repeat_test1 0 set_counter repeat_test2 0 set_counter repeat_test3 0 set_counter repeat_test4 0 set_counter repeat_test5 0 set_counter repeat_test6 0 end_if

if I_CompareCounter sally_defense != 2 set_counter sally_defense 3 end_if if I_CompareCounter wall_line_passed > 0 battle_wait 15 end_if if I_CompareCounter reset_position_s > 0 battle_wait 15 end_if if I_CompareCounter repeat_test6 = 1 battle_wait 20 end_if end_monitor ;;;;;Termination monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter sally_defense > 0 and I_CompareCounter kill_sally = 0 and I_IsUnitRouting a2g1 and ! I_IsUnitGroupEngaged army2 and ! I_IsUnitGroupDestroyed army2 ai_gta_del_objective 1 battle_wait 0.5 unit_group_order_halt army2 battle_wait 0.5 if I_CompareCounter army_south = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_north = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_east = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if if I_CompareCounter army_west = 1 ai_gta_add_objective 1 DEFEND_TERRAIN_AREA end_if

999 0, -725, 100 999 0, 725, 100 999 725, 0, 100 999 -725, 0, 100

set_counter sally_defense 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter kill_sally = 0 and I_CompareCounter assign_labels = 1 and I_UnitDestroyed a2g1 and ! I_IsUnitGroupDestroyed army2 set_counter reset_army2 1 battle_wait 0.5 ai_active_set off battle_wait 0.5 ai_active_set on set_counter assign_labels 2 end_monitor ; ; monitor_conditions I_BattleStarted and I_CompareCounter kill_sally = 0 and I_CompareCounter assign_labels = 2 and I_UnitDestroyed a2g1 and ! I_IsUnitGroupDestroyed army2 set_counter assign_labels 1 end_monitor ;;;Sally Reinforcements monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter sally_reinf = 1 and I_CompareCounter kill_sally = 0 ; and ! I_BattleIsFortBattle and I_BattlePlayerArmyIsAttacker and ! I_IsUnitEngaged a4g1 if I_CompareCounter sally_defense < 3 set_counter defend_location 1 set_counter sally_reinf 2 end_if if I_CompareCounter sally_defense > 2 set_counter defend_location 2 set_counter sally_reinf 2 end_if end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker and I_CompareCounter sally_reinf = 2 and I_CompareCounter sally_defense < 3 and I_CompareCounter sally_defense != 1 and I_CompareCounter defend_location = 1 and I_CompareCounter army4_ready_sally = 0 and I_CompareCounter army4_ready = 0 and ! I_IsUnitGroupEngaged army4

and and and and

! ! ! !

I_IsUnitGroupEngaged army2 I_UnitStatus a4g1 pursuing I_UnitStatus a4g1 charging I_UnitEnemyUnitInRadius a4g1 20 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 DEFEND_TERRAIN_AREA DEFEND_TERRAIN_AREA DEFEND_TERRAIN_AREA DEFEND_TERRAIN_AREA DEFEND_TERRAIN_AREA DEFEND_TERRAIN_AREA DEFEND_TERRAIN_AREA DEFEND_TERRAIN_AREA DEFEND_TERRAIN_AREA DEFEND_TERRAIN_AREA DEFEND_TERRAIN_AREA DEFEND_TERRAIN_AREA DEFEND_TERRAIN_AREA DEFEND_TERRAIN_AREA DEFEND_TERRAIN_AREA DEFEND_TERRAIN_AREA DEFEND_TERRAIN_AREA DEFEND_TERRAIN_AREA DEFEND_TERRAIN_AREA DEFEND_TERRAIN_AREA a4g1 a4u2 a4u3 a4u4 a4u5 a4u6 a4u7 a4u8 a4u9 a4u10 a4u11 a4u12 a4u13 a4u14 a4u15 a4u16 a4u17 a4u18 a4u19 a4u20

;;;Army 4 ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label battle_wait 0.5 ai_active_set on

set_counter defend_location 0 ; set_counter army4_idle_s 0 battle_wait 20 end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker and I_CompareCounter sally_reinf = 2 and I_CompareCounter sally_defense > 2 and I_CompareCounter defend_location = 2 and I_CompareCounter army4_ready_sally = 0 and I_CompareCounter army4_ready = 0 ;;;Army 4 ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ATTACK_ENEMY_BATTLEGROUP ATTACK_ENEMY_BATTLEGROUP ATTACK_ENEMY_BATTLEGROUP ATTACK_ENEMY_BATTLEGROUP ATTACK_ENEMY_BATTLEGROUP ATTACK_ENEMY_BATTLEGROUP ATTACK_ENEMY_BATTLEGROUP ATTACK_ENEMY_BATTLEGROUP ATTACK_ENEMY_BATTLEGROUP ATTACK_ENEMY_BATTLEGROUP ATTACK_ENEMY_BATTLEGROUP ATTACK_ENEMY_BATTLEGROUP ATTACK_ENEMY_BATTLEGROUP ATTACK_ENEMY_BATTLEGROUP ATTACK_ENEMY_BATTLEGROUP a4g1 a4u2 a4u3 a4u4 a4u5 a4u6 a4u7 a4u8 a4u9 a4u10 a4u11 a4u12 a4u13 a4u14 a4u15

ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ai_gta_add_unit_label ;

1 1 1 1 1

ATTACK_ENEMY_BATTLEGROUP ATTACK_ENEMY_BATTLEGROUP ATTACK_ENEMY_BATTLEGROUP ATTACK_ENEMY_BATTLEGROUP ATTACK_ENEMY_BATTLEGROUP

a4u16 a4u17 a4u18 a4u19 a4u20

ai_active_set off battle_wait 0.5 ai_active_set on set_counter defend_location 0 end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker and I_CompareCounter sally_reinf = 2 ; and I_CompareCounter sally_defense > 2 and I_CompareCounter army4_ready_sally = 0 and I_CompareCounter army4_ready = 0 and I_CompareCounter defend_location = 0 ; and I_UnitEnemyUnitInRadius a4g1 200 if ! I_IsUnitGroupEngaged army4 and ! I_IsUnitGroupMoving army4 and ! I_UnitStatus a4g1 pursuing and ! I_UnitStatus a4g1 charging inc_counter army4_idle_s 1 end_if if I_CompareCounter army4_idle_s > 5 set_counter defend_location 1 set_counter sally_defense 2 end_if if I_IsUnitGroupEngaged army4 set_counter army4_idle_s 0 end_if if I_IsUnitGroupMoving army4 set_counter army4_idle_s 0 end_if if I_UnitStatus a4g1 pursuing set_counter army4_idle_s 0 end_if if I_UnitStatus a4g1 charging set_counter army4_idle_s 0 end_if battle_wait 10 end_monitor ;;;;;Termination monitor_conditions I_BattleStarted and I_CompareCounter sally_reinf > 0 and I_CompareCounter army4_ready_sally = 0 and I_CompareCounter army4_ready = 0 and I_IsUnitGroupDestroyed army4 and I_BattleIsSallyOutBattle set_counter sally_reinf 0 end_monitor

monitor_conditions I_BattleStarted and I_CompareCounter sally_reinf > 0 and I_CompareCounter army4_ready_sally = 0 and I_CompareCounter army4_ready = 0 and I_UnitDestroyed a4g1 and I_BattleIsSallyOutBattle set_counter label_army4 1 battle_wait 0.5 unit_group_enable_automation army4 false ai_active_set off battle_wait 0.5 ai_active_set on set_counter sally_reinf 0 end_monitor ; ; ; ;################## Germanicu5 Integrated Protect General script ############### ############ monitor_event BattleConflictPhaseCommenced FactionIsLocal and I_CompareCounter panel_check = 1 and I_BattleEnemyArmyNumberOfMountClass elephant = 0 and I_CompareCounter enemy_unit_count > 4 battle_wait 10 if I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker and I_BattleEnemyArmyNumberOfSpecialAbility rally > 0 and I_CompareCounter protect_siege = 1 set_counter protect_general 1 end_if if I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker and I_BattleEnemyArmyNumberOfSpecialAbility rally > 0 ; and I_CompareCounter labels_only = 1 and I_CompareCounter kill_sally = 1 set_counter protect_general 1 end_if end_monitor monitor_event BattleBattleGatesDestroyedByEngine TrueCondition and I_CompareCounter panel_check = 1 and I_CompareCounter protect_general = 1 set_counter protect_general 0 if I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker set_counter general_wait 1 end_if if I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker and I_CompareCounter kill_sally = 1 set_counter general_wait 1 end_if end_monitor monitor_event BattleWallsCaptured TrueCondition and I_CompareCounter panel_check = 1

and I_CompareCounter protect_general = 1 set_counter protect_general 0 if I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker set_counter general_wait 1 end_if if I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker set_counter general_wait 1 end_if end_monitor monitor_event BattleWallsBreachedByEngine TrueCondition and I_CompareCounter panel_check = 1 and I_CompareCounter protect_general = 1 set_counter protect_general 0 if I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker set_counter general_wait 1 end_if if I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker set_counter general_wait 1 end_if end_monitor monitor_conditions I_BattleStarted and I_BattleIsSiegeBattle and I_CompareCounter general_wait = 1 and I_IsUnitMoveFastSet a1g1 and I_BattleEnemyArmyNumberOfUnitCategory cavalry > 0 battle_wait 0.5 unit_order_halt a1g1 if I_CompareCounter enemy_unit_count < 7 set_counter general_wait 2 battle_wait 20 if I_BattleIsSiegeBattle and I_CompareCounter general_wait = 2 set_counter general_wait 3 battle_wait 20 end_if end_if if I_CompareCounter enemy_unit_count > 6 and I_CompareCounter enemy_unit_count < 12 set_counter general_wait 2 battle_wait 25 if I_BattleIsSiegeBattle and I_CompareCounter general_wait = 2 set_counter general_wait 3 battle_wait 25 end_if end_if if I_CompareCounter enemy_unit_count > 11 and I_CompareCounter enemy_unit_count < 16 set_counter general_wait 2

battle_wait 30 if I_BattleIsSiegeBattle and I_CompareCounter general_wait = 2 set_counter general_wait 3 battle_wait 30 end_if end_if if I_CompareCounter enemy_unit_count > 15 set_counter general_wait 2 battle_wait 35 if I_BattleIsSiegeBattle and I_CompareCounter general_wait = 2 set_counter general_wait 3 battle_wait 35 end_if end_if if I_BattleIsSiegeBattle and I_CompareCounter general_wait = 3 release_unit a1g1 set_counter general_wait 0 end_if end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter general_wait = 1 and I_IsUnitMoveFastSet a2g1 and I_BattleEnemyArmyNumberOfUnitCategory cavalry > 0 battle_wait 0.5 unit_order_halt a2g1 if I_CompareCounter enemy_unit_count < 7 set_counter general_wait 2 battle_wait 20 if I_BattleIsSallyOutBattle and I_CompareCounter general_wait = 2 set_counter general_wait 3 battle_wait 20 end_if end_if if I_CompareCounter enemy_unit_count > 6 and I_CompareCounter enemy_unit_count < 12 set_counter general_wait 2 battle_wait 25 if I_BattleIsSallyOutBattle and I_CompareCounter general_wait = 2 set_counter general_wait 3 battle_wait 25 end_if end_if if I_CompareCounter enemy_unit_count > 11 and I_CompareCounter enemy_unit_count < 16 set_counter general_wait 2 battle_wait 30 if I_BattleIsSallyOutBattle and I_CompareCounter general_wait = 2 set_counter general_wait 3 battle_wait 30 end_if

end_if if I_CompareCounter enemy_unit_count > 15 set_counter general_wait 2 battle_wait 35 if I_BattleIsSallyOutBattle and I_CompareCounter general_wait = 2 set_counter general_wait 3 battle_wait 35 end_if end_if if I_BattleIsSallyOutBattle and I_CompareCounter general_wait = 3 release_unit a2g1 set_counter general_wait 0 end_if end_monitor monitor_conditions I_BattleStarted and I_CompareCounter general_wait > 1 and I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker and I_UnitEnemyUnitInRadius a1g1 60 set_counter general_wait 0 release_unit a1g1 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter general_wait > 1 and I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker and I_UnitEnemyUnitInRadius a2g1 60 set_counter general_wait 0 release_unit a2g1 end_monitor ;################## Germanicu5 Integrated Siege script ######################### ## monitor_conditions I_BattleStarted and ! I_BattleIsFortBattle and I_BattleEnemyArmyNumberOfMountClass elephant = 0 and I_BattleSettlementFortificationLevel > 0 and I_CompareCounter siege_fix = 1 set_counter siege_fix 0 if I_BattleIsSallyOutBattle and I_BattleEnemyArmyNumberOfClassAndCategory missile siege > 0 set_counter army_sieging 1 end_if if I_BattleIsSallyOutBattle and I_BattleEnemyArmyNumberOfClassAndCategory missile siege = 0 set_counter wall_advance_s 1 end_if end_monitor ;;;;;;;Sally Out

monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker and I_CompareCounter reset_army2 = 1 set_counter reset_army2 0 set_counter enemy_unit_count 0 if I_BattleEnemyArmyNumberOfUnits label_unit 1 0 0 a2g1 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 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 > 0 > 1 > 2 > 3 > 4 > 5 > 6 > 7 > 8 > 9 > 10 > 11 > 12 > 13 > 14 > 15 > 16

if I_BattleEnemyArmyNumberOfUnits > 17 label_unit 1 0 17 a2u18 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits > 18 label_unit 1 0 18 a2u19 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits = 20 label_unit 1 0 19 a2u20 inc_counter enemy_unit_count 1 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_monitor ;;;;;;;Huge City monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and ! I_BattleIsFortBattle and I_CompareCounter army_sieging = 1 and I_CompareCounter army2_sally = 1 and I_BattleEnemyArmyNumberOfClassAndCategory missile siege > 0 and I_BattlePlayerArmyNumberOfAttribute extreme_range > 0 and I_BattlePlayerArmyIsAttacker and ! I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel 4 battle_wait 2 set_counter reset_army2 1 battle_wait 0.5 unit_group_order_halt army2 battle_wait 0.5 unit_group_order_relative_move_formed army2 0 35 set_counter emergency_stop 1 set_counter omfg_cannon_tower 1 battle_wait 2 ai_active_set on set_counter sally_check 10 battle_wait 30 if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 10

if I_BattleStarted and I_CompareCounter omfg_cannon_tower > 0 set_counter omfg_cannon_tower 0 end_if if I_BattleStarted and I_CompareCounter emergency_stop = 1 if ! I_IsUnitGroupMoving army2 set_counter emergency_stop 0 unit_group_order_halt army2 battle_wait 0.5 ai_active_set on end_if if I_IsUnitGroupMoving army2 battle_wait 170 set_counter sally_check 14 battle_wait 20 if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 14 set_counter sally_check 15 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 15 set_counter sally_check 16 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 16 set_counter sally_check 17 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 17 set_counter sally_check 18 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 18 set_counter sally_check 19 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 19 set_counter emergency_stop 0 unit_group_order_halt army2 battle_wait 0.5 ai_active_set on end_if end_if end_if

set_counter army_sieging 0 set_counter army2_sally 0 end_if end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and ! I_BattleIsFortBattle

and I_CompareCounter army_sieging = 1 and I_CompareCounter army2_sally = 1 and I_BattleEnemyArmyNumberOfClassAndCategory missile siege > 0 and I_BattlePlayerArmyNumberOfAttribute extreme_range = 0 and I_BattlePlayerArmyIsAttacker and ! I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel 4 battle_wait 2 set_counter reset_army2 1 battle_wait 0.5 unit_group_order_halt army2 battle_wait 0.5 unit_group_order_relative_move_formed army2 0 80 set_counter emergency_stop 1 set_counter omfg_cannon_tower 1 battle_wait 2 ai_active_set on ; battle_wait 60 set_counter sally_check 20 battle_wait 30 if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 20 set_counter sally_check 21 battle_wait 30 if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 21 if I_BattleStarted and I_CompareCounter omfg_cannon_tower > 0 set_counter omfg_cannon_tower 0 end_if if I_BattleStarted and I_CompareCounter emergency_stop = 1 if ! I_IsUnitGroupMoving army2 set_counter emergency_stop 0 unit_group_order_halt army2 battle_wait 0.5 ai_active_set on end_if if I_IsUnitGroupMoving army2 battle_wait 170 set_counter sally_check 24 battle_wait 20 if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 24 set_counter sally_check 25 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 25 set_counter sally_check 26 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 26 set_counter sally_check 27 battle_wait 30 end_if

if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 27 set_counter sally_check 28 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 28 set_counter sally_check 29 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 29 set_counter emergency_stop 0 unit_group_order_halt army2 battle_wait 0.5 ai_active_set on end_if end_if end_if set_counter army_sieging 0 set_counter army2_sally 0 end_if end_if end_monitor ;;;;;;;Large City monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and ! I_BattleIsFortBattle and I_CompareCounter army_sieging = 1 and I_CompareCounter army2_sally = 1 and I_BattleEnemyArmyNumberOfClassAndCategory missile siege > 0 and I_BattlePlayerArmyNumberOfAttribute extreme_range > 0 and I_BattlePlayerArmyIsAttacker and ! I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel 3 battle_wait 2 set_counter reset_army2 1 battle_wait 0.5 unit_group_order_halt army2 battle_wait 0.5 unit_group_order_relative_move_formed army2 0 45 set_counter emergency_stop 1 set_counter omfg_cannon_tower 1 battle_wait 2 ai_active_set on set_counter sally_check 30 battle_wait 37 if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 30 if I_BattleStarted and I_CompareCounter omfg_cannon_tower > 0 set_counter omfg_cannon_tower 0 end_if

if I_BattleStarted and I_CompareCounter emergency_stop = 1 if ! I_IsUnitGroupMoving army2 set_counter emergency_stop 0 unit_group_order_halt army2 battle_wait 0.5 ai_active_set on end_if if I_IsUnitGroupMoving army2 battle_wait 170 set_counter sally_check 34 battle_wait 20 if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 34 set_counter sally_check 35 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 35 set_counter sally_check 36 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 36 set_counter sally_check 37 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 37 set_counter sally_check 38 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 38 set_counter sally_check 39 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 39 set_counter emergency_stop 0 unit_group_order_halt army2 battle_wait 0.5 ai_active_set on end_if end_if end_if

set_counter army_sieging 0 set_counter army2_sally 0 end_if end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and ! I_BattleIsFortBattle and I_CompareCounter army_sieging = 1 and I_CompareCounter army2_sally = 1 and I_BattleEnemyArmyNumberOfClassAndCategory missile siege > 0 and I_BattlePlayerArmyNumberOfAttribute extreme_range = 0 and I_BattlePlayerArmyIsAttacker

and ! I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel 3 battle_wait 2 set_counter reset_army2 1 battle_wait 0.5 unit_group_order_halt army2 battle_wait 0.5 unit_group_order_relative_move_formed army2 0 90 set_counter emergency_stop 1 set_counter omfg_cannon_tower 1 battle_wait 2 ai_active_set on battle_wait 70 set_counter sally_check 40 battle_wait 35 if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 40 set_counter sally_check 41 battle_wait 35 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 41 if I_BattleStarted and I_CompareCounter emergency_stop = 1 if ! I_IsUnitGroupMoving army2 set_counter emergency_stop 0 if I_CompareCounter omfg_cannon_tower > 0 set_counter omfg_cannon_tower 0 end_if unit_group_order_halt army2 battle_wait 0.5 ai_active_set on end_if if I_IsUnitGroupMoving army2 battle_wait 170 set_counter sally_check 44 battle_wait 20 if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 44 set_counter sally_check 45 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 45 set_counter sally_check 46 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 46 set_counter sally_check 47 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 47 set_counter sally_check 48 battle_wait 30 end_if if I_BattleIsSallyOutBattle

and I_CompareCounter sally_check = 48 set_counter sally_check 49 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 49 set_counter emergency_stop 0 if I_CompareCounter omfg_cannon_tower > 0 set_counter omfg_cannon_tower 0 end_if unit_group_order_halt army2 battle_wait 0.5 ai_active_set on end_if end_if end_if set_counter army_sieging 0 set_counter army2_sally 0 end_if end_monitor ;;;;;;;Castle, Citadel and Fortress monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and ! I_BattleIsFortBattle and I_CompareCounter army_sieging = 1 and I_CompareCounter army2_sally = 1 and I_BattleEnemyArmyNumberOfClassAndCategory missile siege > 0 and I_BattlePlayerArmyNumberOfAttribute extreme_range > 0 and I_BattlePlayerArmyIsAttacker and I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel 3 battle_wait 2 set_counter reset_army2 1 battle_wait 0.5 unit_group_order_halt army2 battle_wait 0.5 unit_group_order_relative_move_formed army2 0 100 set_counter emergency_stop 1 set_counter omfg_cannon_tower 1 battle_wait 2 ai_active_set on battle_wait 75 set_counter sally_check 50 battle_wait 15 if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 50 set_counter sally_check 51 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 51 set_counter sally_check 52 battle_wait 30 end_if if I_BattleIsSallyOutBattle

and I_CompareCounter sally_check = 52 if I_BattleStarted and I_CompareCounter omfg_cannon_tower > 0 set_counter omfg_cannon_tower 0 end_if if I_BattleStarted and I_CompareCounter emergency_stop = 1 if ! I_IsUnitGroupMoving army2 set_counter emergency_stop 0 unit_group_order_halt army2 battle_wait 0.5 ai_active_set on end_if if I_IsUnitGroupMoving army2 battle_wait 170 set_counter sally_check 54 battle_wait 20 if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 54 set_counter sally_check 55 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 55 set_counter sally_check 56 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 56 set_counter sally_check 57 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 57 set_counter sally_check 58 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 58 set_counter sally_check 59 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 59 set_counter emergency_stop 0 unit_group_order_halt army2 battle_wait 0.5 ai_active_set on end_if end_if end_if

set_counter army_sieging 0 set_counter army2_sally 0 end_if end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle

and ! I_BattleIsFortBattle and I_CompareCounter army_sieging = 1 and I_CompareCounter army2_sally = 1 and I_BattleEnemyArmyNumberOfClassAndCategory missile siege > 0 and I_BattlePlayerArmyNumberOfAttribute extreme_range = 0 and I_BattlePlayerArmyIsAttacker and I_IsBattleSettlementCastle and I_BattleSettlementFortificationLevel 3 battle_wait 2 set_counter reset_army2 1 battle_wait 0.5 unit_group_order_halt army2 battle_wait 0.5 unit_group_order_relative_move_formed army2 0 170 set_counter emergency_stop 1 set_counter omfg_cannon_tower 1 battle_wait 2 ai_active_set on battle_wait 125 set_counter sally_check 60 battle_wait 30 if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 60 set_counter sally_check 61 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 61 set_counter sally_check 62 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 62 set_counter sally_check 63 battle_wait 35 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 63 if I_BattleStarted and I_CompareCounter omfg_cannon_tower > 0 set_counter omfg_cannon_tower 0 end_if if I_BattleStarted and I_CompareCounter emergency_stop = 1 if ! I_IsUnitGroupMoving army2 set_counter emergency_stop 0 unit_group_order_halt army2 battle_wait 0.5 ai_active_set on end_if if I_IsUnitGroupMoving army2 battle_wait 170 set_counter sally_check 64 battle_wait 20 if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 64 set_counter sally_check 65

battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check set_counter sally_check 66 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check set_counter sally_check 67 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check set_counter sally_check 68 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check set_counter sally_check 69 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check set_counter emergency_stop 0 unit_group_order_halt army2 battle_wait 0.5 ai_active_set on end_if end_if end_if set_counter army_sieging 0 set_counter army2_sally 0 end_if end_monitor ;;;;;;;Wall Advance

= 65

= 66

= 67

= 68

= 69

monitor_conditions I_BattleStarted and I_CompareCounter wall_advance_s = 1 and I_CompareCounter kill_sally = 1 and I_BattleIsSallyOutBattle battle_wait 2 if I_BattleSettlementFortificationLevel < 3 and I_CompareCounter wall_advance_s = 1 set_counter reset_army2 1 battle_wait 0.5 unit_group_order_halt army2 battle_wait 0.5 unit_group_order_relative_move_unformed army2 0 95 end_if if I_BattleSettlementFortificationLevel > 2 and I_CompareCounter wall_advance_s = 1 set_counter reset_army2 1 battle_wait 0.5 unit_group_order_halt army2 battle_wait 0.5

unit_group_order_relative_move_unformed army2 0 200 end_if set_counter emergency_stop 1 if I_BattleSettlementFortificationLevel < 3 battle_wait 72 set_counter sally_check 113 battle_wait 36 if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 113 set_counter sally_check 114 battle_wait 36 end_if end_if if I_BattleSettlementFortificationLevel > 2 battle_wait 145 set_counter sally_check 110 battle_wait 25 if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 110 set_counter sally_check 111 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 111 set_counter sally_check 112 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 112 set_counter sally_check 113 battle_wait 30 end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 113 set_counter sally_check 114 battle_wait 30 end_if end_if if I_BattleIsSallyOutBattle and I_CompareCounter sally_check = 114 if I_BattleStarted and I_CompareCounter emergency_stop = 1 set_counter emergency_stop 0 unit_group_order_halt army2 ; battle_wait 0.5 ; ai_active_set off battle_wait 0.5 ai_active_set on end_if set_counter wall_advance_s 0 end_if end_monitor monitor_conditions I_BattleStarted and I_BattleIsSallyOutBattle and I_CompareCounter omfg_cannon_tower > 0

set_counter omfg_cannon_tower 2 if I_CompareCounter player_unit_count > 0 if I_UnitStatus a1g1 missiles_firing set_counter omfg_cannon_tower 1 end_if if I_UnitStatus a1g1 missiles_reloading set_counter omfg_cannon_tower 1 end_if if I_CompareCounter player_unit_count > 1 and I_CompareCounter omfg_cannon_tower != 1 if I_UnitStatus a1u2 missiles_firing set_counter omfg_cannon_tower 1 end_if if I_UnitStatus a1u2 missiles_reloading set_counter omfg_cannon_tower 1 end_if if I_CompareCounter player_unit_count > 2 and I_CompareCounter omfg_cannon_tower != 1 if I_UnitStatus a1u3 missiles_firing set_counter omfg_cannon_tower 1 end_if if I_UnitStatus a1u3 missiles_reloading set_counter omfg_cannon_tower 1 end_if if I_CompareCounter player_unit_count > 3 and I_CompareCounter omfg_cannon_tower != 1 if I_UnitStatus a1u4 missiles_firing set_counter omfg_cannon_tower 1 end_if if I_UnitStatus a1u4 missiles_reloading set_counter omfg_cannon_tower 1 end_if if I_CompareCounter player_unit_count > 4 and I_CompareCounter omfg_cannon_tower != 1 if I_UnitStatus a1u5 missiles_firing set_counter omfg_cannon_tower 1 end_if if I_UnitStatus a1u5 missiles_reloading set_counter omfg_cannon_tower 1 end_if if I_CompareCounter player_unit_count > 5 and I_CompareCounter omfg_cannon_tower != 1 if I_UnitStatus a1u6 missiles_firing set_counter omfg_cannon_tower 1 end_if if I_UnitStatus a1u6 missiles_reloading set_counter omfg_cannon_tower 1 end_if if I_CompareCounter player_unit_count > 6 and I_CompareCounter omfg_cannon_tower != 1 if I_UnitStatus a1u7 missiles_firing set_counter omfg_cannon_tower 1 end_if if I_UnitStatus a1u7 missiles_reloading

set_counter omfg_cannon_tower 1 end_if if I_CompareCounter player_unit_count > 7 and I_CompareCounter omfg_cannon_tower != 1 if I_UnitStatus a1u8 missiles_firing set_counter omfg_cannon_tower 1 end_if if I_UnitStatus a1u8 missiles_reloading set_counter omfg_cannon_tower 1 end_if if I_CompareCounter player_unit_count > 8 and I_CompareCounter omfg_cannon_tower != 1 if I_UnitStatus a1u9 missiles_firing set_counter omfg_cannon_tower 1 end_if if I_UnitStatus a1u9 missiles_reloading set_counter omfg_cannon_tower 1 end_if if I_CompareCounter player_unit_count > 9 and I_CompareCounter omfg_cannon_tower != 1 if I_UnitStatus a1u10 missiles_firing set_counter omfg_cannon_tower 1 end_if if I_UnitStatus a1u10 missiles_reloading set_counter omfg_cannon_tower 1 end_if if I_CompareCounter player_unit_count > 10 and I_CompareCounter omfg_cannon_tower != 1 if I_UnitStatus a1u11 missiles_firing set_counter omfg_cannon_tower 1 end_if if I_UnitStatus a1u11 missiles_reloading set_counter omfg_cannon_tower 1 end_if if I_CompareCounter player_unit_count > 11 and I_CompareCounter omfg_cannon_tower != 1 if I_UnitStatus a1u12 missiles_firing set_counter omfg_cannon_tower 1 end_if if I_UnitStatus a1u12 missiles_reloading set_counter omfg_cannon_tower 1 end_if if I_CompareCounter player_unit_count > 12 and I_CompareCounter omfg_cannon_tower != 1 if I_UnitStatus a1u13 missiles_firing set_counter omfg_cannon_tower 1 end_if if I_UnitStatus a1u13 missiles_reloading set_counter omfg_cannon_tower 1 end_if if I_CompareCounter player_unit_count > 13 and I_CompareCounter omfg_cannon_tower != 1 if I_UnitStatus a1u14 missiles_firing

set_counter omfg_cannon_tower 1 end_if if I_UnitStatus a1u14 missiles_reloading set_counter omfg_cannon_tower 1 end_if if I_CompareCounter player_unit_count > 14 and I_CompareCounter omfg_cannon_tower != 1 if I_UnitStatus a1u15 missiles_firing set_counter omfg_cannon_tower 1 end_if if I_UnitStatus a1u15 missiles_reloading set_counter omfg_cannon_tower 1 end_if if I_CompareCounter player_unit_count > 15 and I_CompareCounter omfg_cannon_tower != 1 if I_UnitStatus a1u16 missiles_firing set_counter omfg_cannon_tower 1 end_if if I_UnitStatus a1u16 missiles_reloading set_counter omfg_cannon_tower 1 end_if if I_CompareCounter player_unit_count > 16 and I_CompareCounter omfg_cannon_tower != 1 if I_UnitStatus a1u17 missiles_firing set_counter omfg_cannon_tower 1 end_if if I_UnitStatus a1u17 missiles_reloading set_counter omfg_cannon_tower 1 end_if if I_CompareCounter player_unit_count > 17 and I_CompareCounter omfg_cannon_tower != 1 if I_UnitStatus a1u18 missiles_firing set_counter omfg_cannon_tower 1 end_if if I_UnitStatus a1u18 missiles_reloading set_counter omfg_cannon_tower 1 end_if if I_CompareCounter player_unit_count > 18 and I_CompareCounter omfg_cannon_tower != 1 if I_UnitStatus a1u19 missiles_firing set_counter omfg_cannon_tower 1 end_if if I_UnitStatus a1u19 missiles_reloading set_counter omfg_cannon_tower 1 end_if if I_CompareCounter player_unit_count > 19 and I_CompareCounter omfg_cannon_tower != 1 if I_UnitStatus a1u20 missiles_firing set_counter omfg_cannon_tower 1 end_if if I_UnitStatus a1u20 missiles_reloading set_counter omfg_cannon_tower 1 end_if

end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if if I_CompareCounter omfg_cannon_tower = 2 if I_CompareCounter enemy_unit_count > 0 and I_CompareCounter omfg_cannon_tower = 2 and I_IsUnitUnderFire a2g1 set_counter omfg_cannon_tower 3 end_if if I_CompareCounter enemy_unit_count > 1 and I_CompareCounter omfg_cannon_tower = 2 and I_IsUnitUnderFire a2u2 set_counter omfg_cannon_tower 3 end_if if I_CompareCounter enemy_unit_count > 2 and I_CompareCounter omfg_cannon_tower = 2 and I_IsUnitUnderFire a2u3 set_counter omfg_cannon_tower 3 end_if if I_CompareCounter enemy_unit_count > 3 and I_CompareCounter omfg_cannon_tower = 2 and I_IsUnitUnderFire a2u4 set_counter omfg_cannon_tower 3 end_if if I_CompareCounter enemy_unit_count > 4 and I_CompareCounter omfg_cannon_tower = 2 and I_IsUnitUnderFire a2u5 set_counter omfg_cannon_tower 3 end_if if I_CompareCounter enemy_unit_count > 5 and I_CompareCounter omfg_cannon_tower = 2 and I_IsUnitUnderFire a2u6 set_counter omfg_cannon_tower 3 end_if if I_CompareCounter enemy_unit_count > 6

and I_CompareCounter omfg_cannon_tower = 2 and I_IsUnitUnderFire a2u7 set_counter omfg_cannon_tower 3 end_if if I_CompareCounter enemy_unit_count > 7 and I_CompareCounter omfg_cannon_tower = 2 and I_IsUnitUnderFire a2u8 set_counter omfg_cannon_tower 3 end_if if I_CompareCounter enemy_unit_count > 8 and I_CompareCounter omfg_cannon_tower = 2 and I_IsUnitUnderFire a2u9 set_counter omfg_cannon_tower 3 end_if if I_CompareCounter enemy_unit_count > 9 and I_CompareCounter omfg_cannon_tower = 2 and I_IsUnitUnderFire a2u10 set_counter omfg_cannon_tower 3 end_if if I_CompareCounter enemy_unit_count > 10 and I_CompareCounter omfg_cannon_tower = 2 and I_IsUnitUnderFire a2u11 set_counter omfg_cannon_tower 3 end_if if I_CompareCounter enemy_unit_count > 11 and I_CompareCounter omfg_cannon_tower = 2 and I_IsUnitUnderFire a2u12 set_counter omfg_cannon_tower 3 end_if if I_CompareCounter enemy_unit_count > 12 and I_CompareCounter omfg_cannon_tower = 2 and I_IsUnitUnderFire a2u13 set_counter omfg_cannon_tower 3 end_if if I_CompareCounter enemy_unit_count > 13 and I_CompareCounter omfg_cannon_tower = 2 and I_IsUnitUnderFire a2u14 set_counter omfg_cannon_tower 3 end_if if I_CompareCounter enemy_unit_count > 14 and I_CompareCounter omfg_cannon_tower = 2 and I_IsUnitUnderFire a2u15 set_counter omfg_cannon_tower 3 end_if if I_CompareCounter enemy_unit_count > 15 and I_CompareCounter omfg_cannon_tower = 2 and I_IsUnitUnderFire a2u16 set_counter omfg_cannon_tower 3 end_if if I_CompareCounter enemy_unit_count > 16

and I_CompareCounter omfg_cannon_tower = 2 and I_IsUnitUnderFire a2u17 set_counter omfg_cannon_tower 3 end_if if I_CompareCounter enemy_unit_count > 17 and I_CompareCounter omfg_cannon_tower = 2 and I_IsUnitUnderFire a2u18 set_counter omfg_cannon_tower 3 end_if if I_CompareCounter enemy_unit_count > 18 and I_CompareCounter omfg_cannon_tower = 2 and I_IsUnitUnderFire a2u19 set_counter omfg_cannon_tower 3 end_if if I_CompareCounter enemy_unit_count = 20 and I_CompareCounter omfg_cannon_tower = 2 and I_IsUnitUnderFire a2u20 set_counter omfg_cannon_tower 3 end_if end_if if I_CompareCounter omfg_cannon_tower = 3 set_counter omfg_cannon_tower 0 set_counter emergency_stop 0 ; ai_active_set off ; battle_wait 0.5 ai_active_set on end_if battle_wait 7 end_monitor monitor_event BattlePlayerUnitAttacksEnemyUnit BattleIsMeleeAttack and I_CompareCounter panel_check = 1 and I_CompareCounter emergency_stop = 1 ; and I_CompareCounter labels_only = 1 and I_CompareCounter kill_sally = 1 if I_BattleIsSiegeBattle unit_group_order_halt army1 battle_wait 0.5 ai_active_set on set_counter emergency_stop 0 end_if if I_BattleIsSallyOutBattle unit_group_order_halt army2 battle_wait 0.5 ai_active_set on set_counter emergency_stop 0 end_if end_monitor ;################## Open Battles ################# monitor_conditions I_BattleStarted and I_CompareCounter ob_defense_launch = 1 and I_CompareCounter ob_defend = 0 and I_CompareCounter open_battle = 1

and I_BattlePlayerArmyIsAttacker set_counter ob_defend 2 if I_UnitDistanceFromUnit a1g1 a2g1 < 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 a1g1 a2g1 < 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 a2g1 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 and and and

BattleDirectionOfAttack != rear I_UnitEnemyUnitInRadius a2g1 200 BattleRangeOfAttack < 200 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 a2g1 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 a2g1 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 a1g1 a2g1 < 180 and ! I_UnitStatus a1g1 missiles_firing and ! I_UnitStatus a1g1 missiles_reloading inc_counter player_units_closing 1 end_if if I_CompareCounter player_unit_count > 1 and I_UnitDistanceFromUnit a1u2 a2g1 < 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 a2g1 < 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 a2g1 < 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 a2g1 < 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 a2g1 < 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 a2g1 < 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 a2g1 < 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 a2g1 < 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 a2g1 < 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 a2g1 < 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 a2g1 < 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 a2g1 < 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 a2g1 < 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 a2g1 < 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 a2g1 < 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 a2g1 < 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 a2g1 < 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 a2g1 < 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 a2g1 < 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 panel_check = 1 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 panel_check = 1 ; and I_CompareCounter ob_defense_launch = 1 ; and ! I_CompareCounter ob_defend > 1 ; and BattlePlayerUnitCategory siege ; and BattlePlayerUnitClass missile

; and BattleRangeOfAttack < 400 ; and I_CompareCounter open_battle = 1 ; and I_BattlePlayerArmyIsAttacker ; set_counter ob_siege_attack 1 ;end_monitor ;monitor_conditions I_BattleStarted ; and I_CompareCounter ob_defense_launch = 1 ; and I_CompareCounter ob_siege_attack = 1 ; and I_CompareCounter open_battle = 1 ; and I_BattlePlayerArmyIsAttacker ; if I_PercentageOfArmyKilled 0 0 < 3 ; and I_PercentageOfArmyKilled 1 0 > 5 ; set_counter ob_defend 2 ; set_counter ob_siege_attack 0 ; end_if ; if I_PercentageOfArmyKilled 0 0 < 5 ; and I_PercentageOfArmyKilled 1 0 > 10 ; if I_CompareCounter ob_repeat_test < 2 ; set_counter ob_repeat_test 2 ; end_if ; set_counter ob_defend 2 ; set_counter ob_siege_attack 0 ; end_if ; battle_wait 30 ;end_monitor ;;;;;; Reinf triggers monitor_conditions I_BattleStarted and I_CompareCounter def_reinf_arrive = 2 and I_CompareCounter ob_defense_launch = 1 and I_CompareCounter open_battle = 1 and I_CompareCounter ob_defend != 4 and I_BattlePlayerArmyIsAttacker if I_CompareCounter player_engaged_reinf = 4 ai_gta_plan_set 1 ATTACK_ALL set_counter ob_defend 4 set_counter ob_defense_launch 0 set_counter def_reinf_arrive 0 end_if if I_IsUnitGroupEngaged army1 inc_counter player_engaged_reinf 1 end_if if I_CompareCounter player_engaged_reinf > 0 and ! I_IsUnitGroupEngaged army1 set_counter player_engaged_reinf 0 end_if battle_wait 10 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter def_reinf_arrive = 2 and I_CompareCounter ob_defense_launch = 1 and I_CompareCounter open_battle = 1 and I_CompareCounter ob_defend != 4

and I_PercentageUnitGroupKilled army4 > 10 and I_BattlePlayerArmyIsAttacker ai_gta_plan_set 1 ATTACK_ALL set_counter ob_defend 4 set_counter ob_defense_launch 0 set_counter def_reinf_arrive 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter def_reinf_arrive = 2 and I_CompareCounter ob_defense_launch = 1 and I_CompareCounter open_battle = 1 and I_CompareCounter ob_defend != 4 and I_UnitEnemyUnitInRadius a4g1 100 and I_BattlePlayerArmyIsAttacker ai_gta_plan_set 1 ATTACK_ALL set_counter ob_defend 4 set_counter ob_defense_launch 0 set_counter def_reinf_arrive 0 end_monitor ;;;;;; Main monitor monitor_conditions I_BattleStarted and I_CompareCounter ob_defense_launch = 1 and I_CompareCounter ob_defend = 2 and I_CompareCounter open_battle = 1 and I_BattlePlayerArmyIsAttacker set_counter ob_defend 3 if I_CompareCounter enemy_unit_count > 0 if I_IsUnitUnderFire a2g1 inc_counter ob_under_fire 2 end_if if I_UnitStatus a2g1 fighting inc_counter ob_engaged 1 end_if if I_UnitStatus a2g1 pursuing inc_counter ob_engaged 1 end_if if I_UnitStatus a2g1 charging inc_counter ob_engaged 1 end_if if I_UnitStatus a2g1 missiles_firing inc_counter ob_under_fire -1 end_if if I_UnitStatus a2g1 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 ;;;;;;;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 a2g1 120 set_counter g_stop 2 label_unit 1 0 0 a2g1 battle_wait 0.1 unit_order_halt a2g1 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 a2g1 set_counter g_stop 0 end_if end_monitor monitor_conditions I_BattleStarted and I_CompareCounter g_stop = 1 ob_under_fire 0 ob_engaged 0 ob_defend 4 ob_repeat_test 0 ob_defense_launch 0

and and and and

I_CompareCounter open_battle = 1 ! I_BattlePlayerArmyIsAttacker I_BattleAiAttacking I_UnitEnemyUnitInRadius a1g1 120

set_counter g_stop 3 label_unit 0 0 0 a1g1 battle_wait 0.1 unit_order_halt a1g1 battle_wait 30 if ! I_BattlePlayerArmyIsAttacker and I_CompareCounter g_stop = 3 and I_BattleAiAttacking release_unit a1g1 set_counter g_stop 0 end_if end_monitor monitor_conditions I_BattleStarted and I_CompareCounter g_stop = 2 and I_CompareCounter open_battle = 1 and I_BattlePlayerArmyIsAttacker and I_UnitEnemyUnitInRadius a2g1 60 release_unit a2g1 set_counter g_stop 0 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter g_stop = 3 and I_CompareCounter open_battle = 1 and I_BattlePlayerArmyIsAttacker and I_UnitEnemyUnitInRadius a1g1 60 release_unit a2g1 set_counter g_stop 0 end_monitor ;;;;;;;AI Stuck Fix monitor_event BattleEnemyUnitAttacksPlayerUnit BattleIsMeleeAttack and I_CompareCounter ai_stuck_launch = 1 and I_BattleIsSiegeBattle set_counter ai_stuck_launch 2 end_monitor monitor_conditions I_CompareCounter ai_stuck_launch = 2 and I_BattleIsSiegeBattle if I_CompareCounter enemy_unit_count > 0 and ! I_UnitDestroyed a2g1 if I_UnitStatus a2g1 moving if I_CompareCounter a2g1_status = 0 set_counter a2g1_status 1 end_if if I_CompareCounter a2g1_status != 1 set_counter a2g1_status 0 end_if end_if

if I_UnitStatus a2g1 routing if I_CompareCounter a2g1_status = 0 set_counter a2g1_status 2 end_if if I_CompareCounter a2g1_status != 2 set_counter a2g1_status 0 end_if end_if if ! I_UnitStatus a2g1 moving and ! I_UnitStatus a2g1 routing set_counter a2g1_status 0 end_if if I_CompareCounter a2g1_status > 0 if I_UnitDistanceFromPosition a2g1 0,0 >= 150 and I_UnitDistanceFromPosition a2g1 0,0 < 175 if I_CompareCounter a2g1_distance != 1 set_counter a2g1_stuck 0 end_if set_counter a2g1_distance 1 inc_counter a2g1_stuck 1 end_if if I_UnitDistanceFromPosition a2g1 0,0 >= 175 and I_UnitDistanceFromPosition a2g1 0,0 < 200 if I_CompareCounter a2g1_distance != 2 set_counter a2g1_stuck 0 end_if set_counter a2g1_distance 2 inc_counter a2g1_stuck 1 end_if if I_UnitDistanceFromPosition a2g1 0,0 >= 200 and I_UnitDistanceFromPosition a2g1 0,0 < 225 if I_CompareCounter a2g1_distance != 3 set_counter a2g1_stuck 0 end_if set_counter a2g1_distance 3 inc_counter a2g1_stuck 1 end_if if I_UnitDistanceFromPosition a2g1 0,0 >= 225 and I_UnitDistanceFromPosition a2g1 0,0 < 250 if I_CompareCounter a2g1_distance != 4 set_counter a2g1_stuck 0 end_if set_counter a2g1_distance 4 inc_counter a2g1_stuck 1 end_if if I_UnitDistanceFromPosition a2g1 0,0 >= 250 and I_UnitDistanceFromPosition a2g1 0,0 < 275 if I_CompareCounter a2g1_distance != 5 set_counter a2g1_stuck 0 end_if set_counter a2g1_distance 5 inc_counter a2g1_stuck 1

end_if if I_UnitDistanceFromPosition a2g1 0,0 >= 275 and I_UnitDistanceFromPosition a2g1 0,0 < 300 if I_CompareCounter a2g1_distance != 6 set_counter a2g1_stuck 0 end_if set_counter a2g1_distance 6 inc_counter a2g1_stuck 1 end_if if I_UnitDistanceFromPosition a2g1 0,0 >= 300 and I_UnitDistanceFromPosition a2g1 0,0 < 325 if I_CompareCounter a2g1_distance != 7 set_counter a2g1_stuck 0 end_if set_counter a2g1_distance 7 inc_counter a2g1_stuck 1 end_if if I_UnitDistanceFromPosition a2g1 0,0 >= 325 and I_UnitDistanceFromPosition a2g1 0,0 < 350 if I_CompareCounter a2g1_distance != 8 set_counter a2g1_stuck 0 end_if set_counter a2g1_distance 8 inc_counter a2g1_stuck 1 end_if if I_UnitDistanceFromPosition a2g1 0,0 >= 350 and I_UnitDistanceFromPosition a2g1 0,0 < 375 if I_CompareCounter a2g1_distance != 9 set_counter a2g1_stuck 0 end_if set_counter a2g1_distance 9 inc_counter a2g1_stuck 1 end_if if I_UnitDistanceFromPosition a2g1 0,0 >= 375 and I_UnitDistanceFromPosition a2g1 0,0 < 400 if I_CompareCounter a2g1_distance != 10 set_counter a2g1_stuck 0 end_if set_counter a2g1_distance 10 inc_counter a2g1_stuck 1 end_if if I_UnitDistanceFromPosition a2g1 0,0 >= 400 and I_UnitDistanceFromPosition a2g1 0,0 < 425 if I_CompareCounter a2g1_distance != 11 set_counter a2g1_stuck 0 end_if set_counter a2g1_distance 11 inc_counter a2g1_stuck 1 end_if if I_UnitDistanceFromPosition a2g1 0,0 >= 425 and I_UnitDistanceFromPosition a2g1 0,0 < 450 if I_CompareCounter a2g1_distance != 12 set_counter a2g1_stuck 0

end_if set_counter a2g1_distance 12 inc_counter a2g1_stuck 1 end_if if I_UnitDistanceFromPosition a2g1 0,0 >= 450 and I_UnitDistanceFromPosition a2g1 0,0 < 500 if I_CompareCounter a2g1_distance != 13 set_counter a2g1_stuck 0 end_if set_counter a2g1_distance 13 inc_counter a2g1_stuck 1 end_if if I_UnitDistanceFromPosition a2g1 0,0 >= 500 and I_UnitDistanceFromPosition a2g1 0,0 < 550 if I_CompareCounter a2g1_distance != 14 set_counter a2g1_stuck 0 end_if set_counter a2g1_distance 14 inc_counter a2g1_stuck 1 end_if if I_UnitDistanceFromPosition a2g1 0,0 >= 550 and I_UnitDistanceFromPosition a2g1 0,0 < 600 if I_CompareCounter a2g1_distance != 15 set_counter a2g1_stuck 0 end_if set_counter a2g1_distance 15 inc_counter a2g1_stuck 1 end_if if I_CompareCounter a2g1_stuck = 4 unit_order_halt a2g1 unit_set_morale a2g1 wavering battle_wait 0.1 unit_unset_morale a2g1 release_unit a2g1 set_counter a2g1_stuck 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 1 and ! I_UnitDestroyed a2u2 if I_UnitStatus a2u2 moving if I_CompareCounter a2u2_status = 0 set_counter a2u2_status 1 end_if if I_CompareCounter a2u2_status != 1 set_counter a2u2_status 0 end_if end_if if I_UnitStatus a2u2 routing if I_CompareCounter a2u2_status = 0 set_counter a2u2_status 2 end_if

if I_CompareCounter a2u2_status != 2 set_counter a2u2_status 0 end_if end_if if ! I_UnitStatus a2u2 moving and ! I_UnitStatus a2u2 routing set_counter a2u2_status 0 end_if if I_CompareCounter a2u2_status > 0 if I_UnitDistanceFromPosition a2u2 0,0 >= 150 and I_UnitDistanceFromPosition a2u2 0,0 < 175 if I_CompareCounter a2u2_distance != 1 set_counter a2u2_stuck 0 end_if set_counter a2u2_distance 1 inc_counter a2u2_stuck 1 end_if if I_UnitDistanceFromPosition a2u2 0,0 >= 175 and I_UnitDistanceFromPosition a2u2 0,0 < 200 if I_CompareCounter a2u2_distance != 2 set_counter a2u2_stuck 0 end_if set_counter a2u2_distance 2 inc_counter a2u2_stuck 1 end_if if I_UnitDistanceFromPosition a2u2 0,0 >= 200 and I_UnitDistanceFromPosition a2u2 0,0 < 225 if I_CompareCounter a2u2_distance != 3 set_counter a2u2_stuck 0 end_if set_counter a2u2_distance 3 inc_counter a2u2_stuck 1 end_if if I_UnitDistanceFromPosition a2u2 0,0 >= 225 and I_UnitDistanceFromPosition a2u2 0,0 < 250 if I_CompareCounter a2u2_distance != 4 set_counter a2u2_stuck 0 end_if set_counter a2u2_distance 4 inc_counter a2u2_stuck 1 end_if if I_UnitDistanceFromPosition a2u2 0,0 >= 250 and I_UnitDistanceFromPosition a2u2 0,0 < 275 if I_CompareCounter a2u2_distance != 5 set_counter a2u2_stuck 0 end_if set_counter a2u2_distance 5 inc_counter a2u2_stuck 1 end_if if I_UnitDistanceFromPosition a2u2 0,0 >= 275 and I_UnitDistanceFromPosition a2u2 0,0 < 300 if I_CompareCounter a2u2_distance != 6

set_counter a2u2_stuck 0 end_if set_counter a2u2_distance 6 inc_counter a2u2_stuck 1 end_if if I_UnitDistanceFromPosition a2u2 0,0 >= 300 and I_UnitDistanceFromPosition a2u2 0,0 < 325 if I_CompareCounter a2u2_distance != 7 set_counter a2u2_stuck 0 end_if set_counter a2u2_distance 7 inc_counter a2u2_stuck 1 end_if if I_UnitDistanceFromPosition a2u2 0,0 >= 325 and I_UnitDistanceFromPosition a2u2 0,0 < 350 if I_CompareCounter a2u2_distance != 8 set_counter a2u2_stuck 0 end_if set_counter a2u2_distance 8 inc_counter a2u2_stuck 1 end_if if I_UnitDistanceFromPosition a2u2 0,0 >= 350 and I_UnitDistanceFromPosition a2u2 0,0 < 375 if I_CompareCounter a2u2_distance != 9 set_counter a2u2_stuck 0 end_if set_counter a2u2_distance 9 inc_counter a2u2_stuck 1 end_if if I_UnitDistanceFromPosition a2u2 0,0 >= 375 and I_UnitDistanceFromPosition a2u2 0,0 < 400 if I_CompareCounter a2u2_distance != 10 set_counter a2u2_stuck 0 end_if set_counter a2u2_distance 10 inc_counter a2u2_stuck 1 end_if if I_UnitDistanceFromPosition a2u2 0,0 >= 400 and I_UnitDistanceFromPosition a2u2 0,0 < 425 if I_CompareCounter a2u2_distance != 11 set_counter a2u2_stuck 0 end_if set_counter a2u2_distance 11 inc_counter a2u2_stuck 1 end_if if I_UnitDistanceFromPosition a2u2 0,0 >= 425 and I_UnitDistanceFromPosition a2u2 0,0 < 450 if I_CompareCounter a2u2_distance != 12 set_counter a2u2_stuck 0 end_if set_counter a2u2_distance 12 inc_counter a2u2_stuck 1 end_if

if I_UnitDistanceFromPosition a2u2 0,0 >= 450 and I_UnitDistanceFromPosition a2u2 0,0 < 500 if I_CompareCounter a2u2_distance != 13 set_counter a2u2_stuck 0 end_if set_counter a2u2_distance 13 inc_counter a2u2_stuck 1 end_if if I_UnitDistanceFromPosition a2u2 0,0 >= 500 and I_UnitDistanceFromPosition a2u2 0,0 < 550 if I_CompareCounter a2u2_distance != 14 set_counter a2u2_stuck 0 end_if set_counter a2u2_distance 14 inc_counter a2u2_stuck 1 end_if if I_UnitDistanceFromPosition a2u2 0,0 >= 550 and I_UnitDistanceFromPosition a2u2 0,0 < 600 if I_CompareCounter a2u2_distance != 15 set_counter a2u2_stuck 0 end_if set_counter a2u2_distance 15 inc_counter a2u2_stuck 1 end_if if I_CompareCounter a2u2_stuck = 4 unit_order_halt a2u2 unit_set_morale a2u2 wavering battle_wait 0.1 unit_unset_morale a2u2 release_unit a2u2 set_counter a2u2_stuck 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 2 and ! I_UnitDestroyed a2u3 if I_UnitStatus a2u3 moving if I_CompareCounter a2u3_status = 0 set_counter a2u3_status 1 end_if if I_CompareCounter a2u3_status != 1 set_counter a2u3_status 0 end_if end_if if I_UnitStatus a2u3 routing if I_CompareCounter a2u3_status = 0 set_counter a2u3_status 2 end_if if I_CompareCounter a2u3_status != 2 set_counter a2u3_status 0 end_if end_if

if ! I_UnitStatus a2u3 moving and ! I_UnitStatus a2u3 routing set_counter a2u3_status 0 end_if if I_CompareCounter a2u3_status > 0 if I_UnitDistanceFromPosition a2u3 0,0 >= 150 and I_UnitDistanceFromPosition a2u3 0,0 < 175 if I_CompareCounter a2u3_distance != 1 set_counter a2u3_stuck 0 end_if set_counter a2u3_distance 1 inc_counter a2u3_stuck 1 end_if if I_UnitDistanceFromPosition a2u3 0,0 >= 175 and I_UnitDistanceFromPosition a2u3 0,0 < 200 if I_CompareCounter a2u3_distance != 2 set_counter a2u3_stuck 0 end_if set_counter a2u3_distance 2 inc_counter a2u3_stuck 1 end_if if I_UnitDistanceFromPosition a2u3 0,0 >= 200 and I_UnitDistanceFromPosition a2u3 0,0 < 225 if I_CompareCounter a2u3_distance != 3 set_counter a2u3_stuck 0 end_if set_counter a2u3_distance 3 inc_counter a2u3_stuck 1 end_if if I_UnitDistanceFromPosition a2u3 0,0 >= 225 and I_UnitDistanceFromPosition a2u3 0,0 < 250 if I_CompareCounter a2u3_distance != 4 set_counter a2u3_stuck 0 end_if set_counter a2u3_distance 4 inc_counter a2u3_stuck 1 end_if if I_UnitDistanceFromPosition a2u3 0,0 >= 250 and I_UnitDistanceFromPosition a2u3 0,0 < 275 if I_CompareCounter a2u3_distance != 5 set_counter a2u3_stuck 0 end_if set_counter a2u3_distance 5 inc_counter a2u3_stuck 1 end_if if I_UnitDistanceFromPosition a2u3 0,0 >= 275 and I_UnitDistanceFromPosition a2u3 0,0 < 300 if I_CompareCounter a2u3_distance != 6 set_counter a2u3_stuck 0 end_if set_counter a2u3_distance 6 inc_counter a2u3_stuck 1 end_if

if I_UnitDistanceFromPosition a2u3 0,0 >= 300 and I_UnitDistanceFromPosition a2u3 0,0 < 325 if I_CompareCounter a2u3_distance != 7 set_counter a2u3_stuck 0 end_if set_counter a2u3_distance 7 inc_counter a2u3_stuck 1 end_if if I_UnitDistanceFromPosition a2u3 0,0 >= 325 and I_UnitDistanceFromPosition a2u3 0,0 < 350 if I_CompareCounter a2u3_distance != 8 set_counter a2u3_stuck 0 end_if set_counter a2u3_distance 8 inc_counter a2u3_stuck 1 end_if if I_UnitDistanceFromPosition a2u3 0,0 >= 350 and I_UnitDistanceFromPosition a2u3 0,0 < 375 if I_CompareCounter a2u3_distance != 9 set_counter a2u3_stuck 0 end_if set_counter a2u3_distance 9 inc_counter a2u3_stuck 1 end_if if I_UnitDistanceFromPosition a2u3 0,0 >= 375 and I_UnitDistanceFromPosition a2u3 0,0 < 400 if I_CompareCounter a2u3_distance != 10 set_counter a2u3_stuck 0 end_if set_counter a2u3_distance 10 inc_counter a2u3_stuck 1 end_if if I_UnitDistanceFromPosition a2u3 0,0 >= 400 and I_UnitDistanceFromPosition a2u3 0,0 < 425 if I_CompareCounter a2u3_distance != 11 set_counter a2u3_stuck 0 end_if set_counter a2u3_distance 11 inc_counter a2u3_stuck 1 end_if if I_UnitDistanceFromPosition a2u3 0,0 >= 425 and I_UnitDistanceFromPosition a2u3 0,0 < 450 if I_CompareCounter a2u3_distance != 12 set_counter a2u3_stuck 0 end_if set_counter a2u3_distance 12 inc_counter a2u3_stuck 1 end_if if I_UnitDistanceFromPosition a2u3 0,0 >= 450 and I_UnitDistanceFromPosition a2u3 0,0 < 500 if I_CompareCounter a2u3_distance != 13 set_counter a2u3_stuck 0 end_if

set_counter a2u3_distance 13 inc_counter a2u3_stuck 1 end_if if I_UnitDistanceFromPosition a2u3 0,0 >= 500 and I_UnitDistanceFromPosition a2u3 0,0 < 550 if I_CompareCounter a2u3_distance != 14 set_counter a2u3_stuck 0 end_if set_counter a2u3_distance 14 inc_counter a2u3_stuck 1 end_if if I_UnitDistanceFromPosition a2u3 0,0 >= 550 and I_UnitDistanceFromPosition a2u3 0,0 < 600 if I_CompareCounter a2u3_distance != 15 set_counter a2u3_stuck 0 end_if set_counter a2u3_distance 15 inc_counter a2u3_stuck 1 end_if if I_CompareCounter a2u3_stuck = 4 unit_order_halt a2u3 unit_set_morale a2u3 wavering battle_wait 0.1 unit_unset_morale a2u3 release_unit a2u3 set_counter a2u3_stuck 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 3 and ! I_UnitDestroyed a2u4 if I_UnitStatus a2u4 moving if I_CompareCounter a2u4_status = 0 set_counter a2u4_status 1 end_if if I_CompareCounter a2u4_status != 1 set_counter a2u4_status 0 end_if end_if if I_UnitStatus a2u4 routing if I_CompareCounter a2u4_status = 0 set_counter a2u4_status 2 end_if if I_CompareCounter a2u4_status != 2 set_counter a2u4_status 0 end_if end_if if ! I_UnitStatus a2u4 moving and ! I_UnitStatus a2u4 routing set_counter a2u4_status 0 end_if

if I_CompareCounter a2u4_status > 0 if I_UnitDistanceFromPosition a2u4 0,0 >= 150 and I_UnitDistanceFromPosition a2u4 0,0 < 175 if I_CompareCounter a2u4_distance != 1 set_counter a2u4_stuck 0 end_if set_counter a2u4_distance 1 inc_counter a2u4_stuck 1 end_if if I_UnitDistanceFromPosition a2u4 0,0 >= 175 and I_UnitDistanceFromPosition a2u4 0,0 < 200 if I_CompareCounter a2u4_distance != 2 set_counter a2u4_stuck 0 end_if set_counter a2u4_distance 2 inc_counter a2u4_stuck 1 end_if if I_UnitDistanceFromPosition a2u4 0,0 >= 200 and I_UnitDistanceFromPosition a2u4 0,0 < 225 if I_CompareCounter a2u4_distance != 3 set_counter a2u4_stuck 0 end_if set_counter a2u4_distance 3 inc_counter a2u4_stuck 1 end_if if I_UnitDistanceFromPosition a2u4 0,0 >= 225 and I_UnitDistanceFromPosition a2u4 0,0 < 250 if I_CompareCounter a2u4_distance != 4 set_counter a2u4_stuck 0 end_if set_counter a2u4_distance 4 inc_counter a2u4_stuck 1 end_if if I_UnitDistanceFromPosition a2u4 0,0 >= 250 and I_UnitDistanceFromPosition a2u4 0,0 < 275 if I_CompareCounter a2u4_distance != 5 set_counter a2u4_stuck 0 end_if set_counter a2u4_distance 5 inc_counter a2u4_stuck 1 end_if if I_UnitDistanceFromPosition a2u4 0,0 >= 275 and I_UnitDistanceFromPosition a2u4 0,0 < 300 if I_CompareCounter a2u4_distance != 6 set_counter a2u4_stuck 0 end_if set_counter a2u4_distance 6 inc_counter a2u4_stuck 1 end_if if I_UnitDistanceFromPosition a2u4 0,0 >= 300 and I_UnitDistanceFromPosition a2u4 0,0 < 325 if I_CompareCounter a2u4_distance != 7 set_counter a2u4_stuck 0

end_if set_counter a2u4_distance 7 inc_counter a2u4_stuck 1 end_if if I_UnitDistanceFromPosition a2u4 0,0 >= 325 and I_UnitDistanceFromPosition a2u4 0,0 < 350 if I_CompareCounter a2u4_distance != 8 set_counter a2u4_stuck 0 end_if set_counter a2u4_distance 8 inc_counter a2u4_stuck 1 end_if if I_UnitDistanceFromPosition a2u4 0,0 >= 350 and I_UnitDistanceFromPosition a2u4 0,0 < 375 if I_CompareCounter a2u4_distance != 9 set_counter a2u4_stuck 0 end_if set_counter a2u4_distance 9 inc_counter a2u4_stuck 1 end_if if I_UnitDistanceFromPosition a2u4 0,0 >= 375 and I_UnitDistanceFromPosition a2u4 0,0 < 400 if I_CompareCounter a2u4_distance != 10 set_counter a2u4_stuck 0 end_if set_counter a2u4_distance 10 inc_counter a2u4_stuck 1 end_if if I_UnitDistanceFromPosition a2u4 0,0 >= 400 and I_UnitDistanceFromPosition a2u4 0,0 < 425 if I_CompareCounter a2u4_distance != 11 set_counter a2u4_stuck 0 end_if set_counter a2u4_distance 11 inc_counter a2u4_stuck 1 end_if if I_UnitDistanceFromPosition a2u4 0,0 >= 425 and I_UnitDistanceFromPosition a2u4 0,0 < 450 if I_CompareCounter a2u4_distance != 12 set_counter a2u4_stuck 0 end_if set_counter a2u4_distance 12 inc_counter a2u4_stuck 1 end_if if I_UnitDistanceFromPosition a2u4 0,0 >= 450 and I_UnitDistanceFromPosition a2u4 0,0 < 500 if I_CompareCounter a2u4_distance != 13 set_counter a2u4_stuck 0 end_if set_counter a2u4_distance 13 inc_counter a2u4_stuck 1 end_if if I_UnitDistanceFromPosition a2u4 0,0 >= 500

and I_UnitDistanceFromPosition a2u4 0,0 < 550 if I_CompareCounter a2u4_distance != 14 set_counter a2u4_stuck 0 end_if set_counter a2u4_distance 14 inc_counter a2u4_stuck 1 end_if if I_UnitDistanceFromPosition a2u4 0,0 >= 550 and I_UnitDistanceFromPosition a2u4 0,0 < 600 if I_CompareCounter a2u4_distance != 15 set_counter a2u4_stuck 0 end_if set_counter a2u4_distance 15 inc_counter a2u4_stuck 1 end_if if I_CompareCounter a2u4_stuck = 4 unit_order_halt a2u4 unit_set_morale a2u4 wavering battle_wait 0.1 unit_unset_morale a2u4 release_unit a2u4 set_counter a2u4_stuck 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 4 and ! I_UnitDestroyed a2u5 if I_UnitStatus a2u5 moving if I_CompareCounter a2u5_status = 0 set_counter a2u5_status 1 end_if if I_CompareCounter a2u5_status != 1 set_counter a2u5_status 0 end_if end_if if I_UnitStatus a2u5 routing if I_CompareCounter a2u5_status = 0 set_counter a2u5_status 2 end_if if I_CompareCounter a2u5_status != 2 set_counter a2u5_status 0 end_if end_if if ! I_UnitStatus a2u5 moving and ! I_UnitStatus a2u5 routing set_counter a2u5_status 0 end_if if I_CompareCounter a2u5_status > 0 if I_UnitDistanceFromPosition a2u5 0,0 >= 150 and I_UnitDistanceFromPosition a2u5 0,0 < 175 if I_CompareCounter a2u5_distance != 1

set_counter a2u5_stuck 0 end_if set_counter a2u5_distance 1 inc_counter a2u5_stuck 1 end_if if I_UnitDistanceFromPosition a2u5 0,0 >= 175 and I_UnitDistanceFromPosition a2u5 0,0 < 200 if I_CompareCounter a2u5_distance != 2 set_counter a2u5_stuck 0 end_if set_counter a2u5_distance 2 inc_counter a2u5_stuck 1 end_if if I_UnitDistanceFromPosition a2u5 0,0 >= 200 and I_UnitDistanceFromPosition a2u5 0,0 < 225 if I_CompareCounter a2u5_distance != 3 set_counter a2u5_stuck 0 end_if set_counter a2u5_distance 3 inc_counter a2u5_stuck 1 end_if if I_UnitDistanceFromPosition a2u5 0,0 >= 225 and I_UnitDistanceFromPosition a2u5 0,0 < 250 if I_CompareCounter a2u5_distance != 4 set_counter a2u5_stuck 0 end_if set_counter a2u5_distance 4 inc_counter a2u5_stuck 1 end_if if I_UnitDistanceFromPosition a2u5 0,0 >= 250 and I_UnitDistanceFromPosition a2u5 0,0 < 275 if I_CompareCounter a2u5_distance != 5 set_counter a2u5_stuck 0 end_if set_counter a2u5_distance 5 inc_counter a2u5_stuck 1 end_if if I_UnitDistanceFromPosition a2u5 0,0 >= 275 and I_UnitDistanceFromPosition a2u5 0,0 < 300 if I_CompareCounter a2u5_distance != 6 set_counter a2u5_stuck 0 end_if set_counter a2u5_distance 6 inc_counter a2u5_stuck 1 end_if if I_UnitDistanceFromPosition a2u5 0,0 >= 300 and I_UnitDistanceFromPosition a2u5 0,0 < 325 if I_CompareCounter a2u5_distance != 7 set_counter a2u5_stuck 0 end_if set_counter a2u5_distance 7 inc_counter a2u5_stuck 1 end_if

if I_UnitDistanceFromPosition a2u5 0,0 >= 325 and I_UnitDistanceFromPosition a2u5 0,0 < 350 if I_CompareCounter a2u5_distance != 8 set_counter a2u5_stuck 0 end_if set_counter a2u5_distance 8 inc_counter a2u5_stuck 1 end_if if I_UnitDistanceFromPosition a2u5 0,0 >= 350 and I_UnitDistanceFromPosition a2u5 0,0 < 375 if I_CompareCounter a2u5_distance != 9 set_counter a2u5_stuck 0 end_if set_counter a2u5_distance 9 inc_counter a2u5_stuck 1 end_if if I_UnitDistanceFromPosition a2u5 0,0 >= 375 and I_UnitDistanceFromPosition a2u5 0,0 < 400 if I_CompareCounter a2u5_distance != 10 set_counter a2u5_stuck 0 end_if set_counter a2u5_distance 10 inc_counter a2u5_stuck 1 end_if if I_UnitDistanceFromPosition a2u5 0,0 >= 400 and I_UnitDistanceFromPosition a2u5 0,0 < 425 if I_CompareCounter a2u5_distance != 11 set_counter a2u5_stuck 0 end_if set_counter a2u5_distance 11 inc_counter a2u5_stuck 1 end_if if I_UnitDistanceFromPosition a2u5 0,0 >= 425 and I_UnitDistanceFromPosition a2u5 0,0 < 450 if I_CompareCounter a2u5_distance != 12 set_counter a2u5_stuck 0 end_if set_counter a2u5_distance 12 inc_counter a2u5_stuck 1 end_if if I_UnitDistanceFromPosition a2u5 0,0 >= 450 and I_UnitDistanceFromPosition a2u5 0,0 < 500 if I_CompareCounter a2u5_distance != 13 set_counter a2u5_stuck 0 end_if set_counter a2u5_distance 13 inc_counter a2u5_stuck 1 end_if if I_UnitDistanceFromPosition a2u5 0,0 >= 500 and I_UnitDistanceFromPosition a2u5 0,0 < 550 if I_CompareCounter a2u5_distance != 14 set_counter a2u5_stuck 0 end_if set_counter a2u5_distance 14

inc_counter a2u5_stuck 1 end_if if I_UnitDistanceFromPosition a2u5 0,0 >= 550 and I_UnitDistanceFromPosition a2u5 0,0 < 600 if I_CompareCounter a2u5_distance != 15 set_counter a2u5_stuck 0 end_if set_counter a2u5_distance 15 inc_counter a2u5_stuck 1 end_if if I_CompareCounter a2u5_stuck = 4 unit_order_halt a2u5 unit_set_morale a2u5 wavering battle_wait 0.1 unit_unset_morale a2u5 release_unit a2u5 set_counter a2u5_stuck 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 5 and ! I_UnitDestroyed a2u6 if I_UnitStatus a2u6 moving if I_CompareCounter a2u6_status = 0 set_counter a2u6_status 1 end_if if I_CompareCounter a2u6_status != 1 set_counter a2u6_status 0 end_if end_if if I_UnitStatus a2u6 routing if I_CompareCounter a2u6_status = 0 set_counter a2u6_status 2 end_if if I_CompareCounter a2u6_status != 2 set_counter a2u6_status 0 end_if end_if if ! I_UnitStatus a2u6 moving and ! I_UnitStatus a2u6 routing set_counter a2u6_status 0 end_if if I_CompareCounter a2u6_status > 0 if I_UnitDistanceFromPosition a2u6 0,0 >= 150 and I_UnitDistanceFromPosition a2u6 0,0 < 175 if I_CompareCounter a2u6_distance != 1 set_counter a2u6_stuck 0 end_if set_counter a2u6_distance 1 inc_counter a2u6_stuck 1 end_if

if I_UnitDistanceFromPosition a2u6 0,0 >= 175 and I_UnitDistanceFromPosition a2u6 0,0 < 200 if I_CompareCounter a2u6_distance != 2 set_counter a2u6_stuck 0 end_if set_counter a2u6_distance 2 inc_counter a2u6_stuck 1 end_if if I_UnitDistanceFromPosition a2u6 0,0 >= 200 and I_UnitDistanceFromPosition a2u6 0,0 < 225 if I_CompareCounter a2u6_distance != 3 set_counter a2u6_stuck 0 end_if set_counter a2u6_distance 3 inc_counter a2u6_stuck 1 end_if if I_UnitDistanceFromPosition a2u6 0,0 >= 225 and I_UnitDistanceFromPosition a2u6 0,0 < 250 if I_CompareCounter a2u6_distance != 4 set_counter a2u6_stuck 0 end_if set_counter a2u6_distance 4 inc_counter a2u6_stuck 1 end_if if I_UnitDistanceFromPosition a2u6 0,0 >= 250 and I_UnitDistanceFromPosition a2u6 0,0 < 275 if I_CompareCounter a2u6_distance != 5 set_counter a2u6_stuck 0 end_if set_counter a2u6_distance 5 inc_counter a2u6_stuck 1 end_if if I_UnitDistanceFromPosition a2u6 0,0 >= 275 and I_UnitDistanceFromPosition a2u6 0,0 < 300 if I_CompareCounter a2u6_distance != 6 set_counter a2u6_stuck 0 end_if set_counter a2u6_distance 6 inc_counter a2u6_stuck 1 end_if if I_UnitDistanceFromPosition a2u6 0,0 >= 300 and I_UnitDistanceFromPosition a2u6 0,0 < 325 if I_CompareCounter a2u6_distance != 7 set_counter a2u6_stuck 0 end_if set_counter a2u6_distance 7 inc_counter a2u6_stuck 1 end_if if I_UnitDistanceFromPosition a2u6 0,0 >= 325 and I_UnitDistanceFromPosition a2u6 0,0 < 350 if I_CompareCounter a2u6_distance != 8 set_counter a2u6_stuck 0 end_if

set_counter a2u6_distance 8 inc_counter a2u6_stuck 1 end_if if I_UnitDistanceFromPosition a2u6 0,0 >= 350 and I_UnitDistanceFromPosition a2u6 0,0 < 375 if I_CompareCounter a2u6_distance != 9 set_counter a2u6_stuck 0 end_if set_counter a2u6_distance 9 inc_counter a2u6_stuck 1 end_if if I_UnitDistanceFromPosition a2u6 0,0 >= 375 and I_UnitDistanceFromPosition a2u6 0,0 < 400 if I_CompareCounter a2u6_distance != 10 set_counter a2u6_stuck 0 end_if set_counter a2u6_distance 10 inc_counter a2u6_stuck 1 end_if if I_UnitDistanceFromPosition a2u6 0,0 >= 400 and I_UnitDistanceFromPosition a2u6 0,0 < 425 if I_CompareCounter a2u6_distance != 11 set_counter a2u6_stuck 0 end_if set_counter a2u6_distance 11 inc_counter a2u6_stuck 1 end_if if I_UnitDistanceFromPosition a2u6 0,0 >= 425 and I_UnitDistanceFromPosition a2u6 0,0 < 450 if I_CompareCounter a2u6_distance != 12 set_counter a2u6_stuck 0 end_if set_counter a2u6_distance 12 inc_counter a2u6_stuck 1 end_if if I_UnitDistanceFromPosition a2u6 0,0 >= 450 and I_UnitDistanceFromPosition a2u6 0,0 < 500 if I_CompareCounter a2u6_distance != 13 set_counter a2u6_stuck 0 end_if set_counter a2u6_distance 13 inc_counter a2u6_stuck 1 end_if if I_UnitDistanceFromPosition a2u6 0,0 >= 500 and I_UnitDistanceFromPosition a2u6 0,0 < 550 if I_CompareCounter a2u6_distance != 14 set_counter a2u6_stuck 0 end_if set_counter a2u6_distance 14 inc_counter a2u6_stuck 1 end_if if I_UnitDistanceFromPosition a2u6 0,0 >= 550 and I_UnitDistanceFromPosition a2u6 0,0 < 600

if I_CompareCounter a2u6_distance != 15 set_counter a2u6_stuck 0 end_if set_counter a2u6_distance 15 inc_counter a2u6_stuck 1 end_if if I_CompareCounter a2u6_stuck = 4 unit_order_halt a2u6 unit_set_morale a2u6 wavering battle_wait 0.1 unit_unset_morale a2u6 release_unit a2u6 set_counter a2u6_stuck 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 6 and ! I_UnitDestroyed a2u7 if I_UnitStatus a2u7 moving if I_CompareCounter a2u7_status = 0 set_counter a2u7_status 1 end_if if I_CompareCounter a2u7_status != 1 set_counter a2u7_status 0 end_if end_if if I_UnitStatus a2u7 routing if I_CompareCounter a2u7_status = 0 set_counter a2u7_status 2 end_if if I_CompareCounter a2u7_status != 2 set_counter a2u7_status 0 end_if end_if if ! I_UnitStatus a2u7 moving and ! I_UnitStatus a2u7 routing set_counter a2u7_status 0 end_if if I_CompareCounter a2u7_status > 0 if I_UnitDistanceFromPosition a2u7 0,0 >= 150 and I_UnitDistanceFromPosition a2u7 0,0 < 175 if I_CompareCounter a2u7_distance != 1 set_counter a2u7_stuck 0 end_if set_counter a2u7_distance 1 inc_counter a2u7_stuck 1 end_if if I_UnitDistanceFromPosition a2u7 0,0 >= 175 and I_UnitDistanceFromPosition a2u7 0,0 < 200 if I_CompareCounter a2u7_distance != 2 set_counter a2u7_stuck 0

end_if set_counter a2u7_distance 2 inc_counter a2u7_stuck 1 end_if if I_UnitDistanceFromPosition a2u7 0,0 >= 200 and I_UnitDistanceFromPosition a2u7 0,0 < 225 if I_CompareCounter a2u7_distance != 3 set_counter a2u7_stuck 0 end_if set_counter a2u7_distance 3 inc_counter a2u7_stuck 1 end_if if I_UnitDistanceFromPosition a2u7 0,0 >= 225 and I_UnitDistanceFromPosition a2u7 0,0 < 250 if I_CompareCounter a2u7_distance != 4 set_counter a2u7_stuck 0 end_if set_counter a2u7_distance 4 inc_counter a2u7_stuck 1 end_if if I_UnitDistanceFromPosition a2u7 0,0 >= 250 and I_UnitDistanceFromPosition a2u7 0,0 < 275 if I_CompareCounter a2u7_distance != 5 set_counter a2u7_stuck 0 end_if set_counter a2u7_distance 5 inc_counter a2u7_stuck 1 end_if if I_UnitDistanceFromPosition a2u7 0,0 >= 275 and I_UnitDistanceFromPosition a2u7 0,0 < 300 if I_CompareCounter a2u7_distance != 6 set_counter a2u7_stuck 0 end_if set_counter a2u7_distance 6 inc_counter a2u7_stuck 1 end_if if I_UnitDistanceFromPosition a2u7 0,0 >= 300 and I_UnitDistanceFromPosition a2u7 0,0 < 325 if I_CompareCounter a2u7_distance != 7 set_counter a2u7_stuck 0 end_if set_counter a2u7_distance 7 inc_counter a2u7_stuck 1 end_if if I_UnitDistanceFromPosition a2u7 0,0 >= 325 and I_UnitDistanceFromPosition a2u7 0,0 < 350 if I_CompareCounter a2u7_distance != 8 set_counter a2u7_stuck 0 end_if set_counter a2u7_distance 8 inc_counter a2u7_stuck 1 end_if if I_UnitDistanceFromPosition a2u7 0,0 >= 350

and I_UnitDistanceFromPosition a2u7 0,0 < 375 if I_CompareCounter a2u7_distance != 9 set_counter a2u7_stuck 0 end_if set_counter a2u7_distance 9 inc_counter a2u7_stuck 1 end_if if I_UnitDistanceFromPosition a2u7 0,0 >= 375 and I_UnitDistanceFromPosition a2u7 0,0 < 400 if I_CompareCounter a2u7_distance != 10 set_counter a2u7_stuck 0 end_if set_counter a2u7_distance 10 inc_counter a2u7_stuck 1 end_if if I_UnitDistanceFromPosition a2u7 0,0 >= 400 and I_UnitDistanceFromPosition a2u7 0,0 < 425 if I_CompareCounter a2u7_distance != 11 set_counter a2u7_stuck 0 end_if set_counter a2u7_distance 11 inc_counter a2u7_stuck 1 end_if if I_UnitDistanceFromPosition a2u7 0,0 >= 425 and I_UnitDistanceFromPosition a2u7 0,0 < 450 if I_CompareCounter a2u7_distance != 12 set_counter a2u7_stuck 0 end_if set_counter a2u7_distance 12 inc_counter a2u7_stuck 1 end_if if I_UnitDistanceFromPosition a2u7 0,0 >= 450 and I_UnitDistanceFromPosition a2u7 0,0 < 500 if I_CompareCounter a2u7_distance != 13 set_counter a2u7_stuck 0 end_if set_counter a2u7_distance 13 inc_counter a2u7_stuck 1 end_if if I_UnitDistanceFromPosition a2u7 0,0 >= 500 and I_UnitDistanceFromPosition a2u7 0,0 < 550 if I_CompareCounter a2u7_distance != 14 set_counter a2u7_stuck 0 end_if set_counter a2u7_distance 14 inc_counter a2u7_stuck 1 end_if if I_UnitDistanceFromPosition a2u7 0,0 >= 550 and I_UnitDistanceFromPosition a2u7 0,0 < 600 if I_CompareCounter a2u7_distance != 15 set_counter a2u7_stuck 0 end_if set_counter a2u7_distance 15 inc_counter a2u7_stuck 1

end_if if I_CompareCounter a2u7_stuck = 4 unit_order_halt a2u7 unit_set_morale a2u7 wavering battle_wait 0.1 unit_unset_morale a2u7 release_unit a2u7 set_counter a2u7_stuck 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 7 and ! I_UnitDestroyed a2u8 if I_UnitStatus a2u8 moving if I_CompareCounter a2u8_status = 0 set_counter a2u8_status 1 end_if if I_CompareCounter a2u8_status != 1 set_counter a2u8_status 0 end_if end_if if I_UnitStatus a2u8 routing if I_CompareCounter a2u8_status = 0 set_counter a2u8_status 2 end_if if I_CompareCounter a2u8_status != 2 set_counter a2u8_status 0 end_if end_if if ! I_UnitStatus a2u8 moving and ! I_UnitStatus a2u8 routing set_counter a2u8_status 0 end_if if I_CompareCounter a2u8_status > 0 if I_UnitDistanceFromPosition a2u8 0,0 >= 150 and I_UnitDistanceFromPosition a2u8 0,0 < 175 if I_CompareCounter a2u8_distance != 1 set_counter a2u8_stuck 0 end_if set_counter a2u8_distance 1 inc_counter a2u8_stuck 1 end_if if I_UnitDistanceFromPosition a2u8 0,0 >= 175 and I_UnitDistanceFromPosition a2u8 0,0 < 200 if I_CompareCounter a2u8_distance != 2 set_counter a2u8_stuck 0 end_if set_counter a2u8_distance 2 inc_counter a2u8_stuck 1 end_if

if I_UnitDistanceFromPosition a2u8 0,0 >= 200 and I_UnitDistanceFromPosition a2u8 0,0 < 225 if I_CompareCounter a2u8_distance != 3 set_counter a2u8_stuck 0 end_if set_counter a2u8_distance 3 inc_counter a2u8_stuck 1 end_if if I_UnitDistanceFromPosition a2u8 0,0 >= 225 and I_UnitDistanceFromPosition a2u8 0,0 < 250 if I_CompareCounter a2u8_distance != 4 set_counter a2u8_stuck 0 end_if set_counter a2u8_distance 4 inc_counter a2u8_stuck 1 end_if if I_UnitDistanceFromPosition a2u8 0,0 >= 250 and I_UnitDistanceFromPosition a2u8 0,0 < 275 if I_CompareCounter a2u8_distance != 5 set_counter a2u8_stuck 0 end_if set_counter a2u8_distance 5 inc_counter a2u8_stuck 1 end_if if I_UnitDistanceFromPosition a2u8 0,0 >= 275 and I_UnitDistanceFromPosition a2u8 0,0 < 300 if I_CompareCounter a2u8_distance != 6 set_counter a2u8_stuck 0 end_if set_counter a2u8_distance 6 inc_counter a2u8_stuck 1 end_if if I_UnitDistanceFromPosition a2u8 0,0 >= 300 and I_UnitDistanceFromPosition a2u8 0,0 < 325 if I_CompareCounter a2u8_distance != 7 set_counter a2u8_stuck 0 end_if set_counter a2u8_distance 7 inc_counter a2u8_stuck 1 end_if if I_UnitDistanceFromPosition a2u8 0,0 >= 325 and I_UnitDistanceFromPosition a2u8 0,0 < 350 if I_CompareCounter a2u8_distance != 8 set_counter a2u8_stuck 0 end_if set_counter a2u8_distance 8 inc_counter a2u8_stuck 1 end_if if I_UnitDistanceFromPosition a2u8 0,0 >= 350 and I_UnitDistanceFromPosition a2u8 0,0 < 375 if I_CompareCounter a2u8_distance != 9 set_counter a2u8_stuck 0 end_if set_counter a2u8_distance 9

inc_counter a2u8_stuck 1 end_if if I_UnitDistanceFromPosition a2u8 0,0 >= 375 and I_UnitDistanceFromPosition a2u8 0,0 < 400 if I_CompareCounter a2u8_distance != 10 set_counter a2u8_stuck 0 end_if set_counter a2u8_distance 10 inc_counter a2u8_stuck 1 end_if if I_UnitDistanceFromPosition a2u8 0,0 >= 400 and I_UnitDistanceFromPosition a2u8 0,0 < 425 if I_CompareCounter a2u8_distance != 11 set_counter a2u8_stuck 0 end_if set_counter a2u8_distance 11 inc_counter a2u8_stuck 1 end_if if I_UnitDistanceFromPosition a2u8 0,0 >= 425 and I_UnitDistanceFromPosition a2u8 0,0 < 450 if I_CompareCounter a2u8_distance != 12 set_counter a2u8_stuck 0 end_if set_counter a2u8_distance 12 inc_counter a2u8_stuck 1 end_if if I_UnitDistanceFromPosition a2u8 0,0 >= 450 and I_UnitDistanceFromPosition a2u8 0,0 < 500 if I_CompareCounter a2u8_distance != 13 set_counter a2u8_stuck 0 end_if set_counter a2u8_distance 13 inc_counter a2u8_stuck 1 end_if if I_UnitDistanceFromPosition a2u8 0,0 >= 500 and I_UnitDistanceFromPosition a2u8 0,0 < 550 if I_CompareCounter a2u8_distance != 14 set_counter a2u8_stuck 0 end_if set_counter a2u8_distance 14 inc_counter a2u8_stuck 1 end_if if I_UnitDistanceFromPosition a2u8 0,0 >= 550 and I_UnitDistanceFromPosition a2u8 0,0 < 600 if I_CompareCounter a2u8_distance != 15 set_counter a2u8_stuck 0 end_if set_counter a2u8_distance 15 inc_counter a2u8_stuck 1 end_if if I_CompareCounter a2u8_stuck = 4 unit_order_halt a2u8 unit_set_morale a2u8 wavering

battle_wait 0.1 unit_unset_morale a2u8 release_unit a2u8 set_counter a2u8_stuck 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 8 and ! I_UnitDestroyed a2u9 if I_UnitStatus a2u9 moving if I_CompareCounter a2u9_status = 0 set_counter a2u9_status 1 end_if if I_CompareCounter a2u9_status != 1 set_counter a2u9_status 0 end_if end_if if I_UnitStatus a2u9 routing if I_CompareCounter a2u9_status = 0 set_counter a2u9_status 2 end_if if I_CompareCounter a2u9_status != 2 set_counter a2u9_status 0 end_if end_if if ! I_UnitStatus a2u9 moving and ! I_UnitStatus a2u9 routing set_counter a2u9_status 0 end_if if I_CompareCounter a2u9_status > 0 if I_UnitDistanceFromPosition a2u9 0,0 >= 150 and I_UnitDistanceFromPosition a2u9 0,0 < 175 if I_CompareCounter a2u9_distance != 1 set_counter a2u9_stuck 0 end_if set_counter a2u9_distance 1 inc_counter a2u9_stuck 1 end_if if I_UnitDistanceFromPosition a2u9 0,0 >= 175 and I_UnitDistanceFromPosition a2u9 0,0 < 200 if I_CompareCounter a2u9_distance != 2 set_counter a2u9_stuck 0 end_if set_counter a2u9_distance 2 inc_counter a2u9_stuck 1 end_if if I_UnitDistanceFromPosition a2u9 0,0 >= 200 and I_UnitDistanceFromPosition a2u9 0,0 < 225 if I_CompareCounter a2u9_distance != 3 set_counter a2u9_stuck 0 end_if

set_counter a2u9_distance 3 inc_counter a2u9_stuck 1 end_if if I_UnitDistanceFromPosition a2u9 0,0 >= 225 and I_UnitDistanceFromPosition a2u9 0,0 < 250 if I_CompareCounter a2u9_distance != 4 set_counter a2u9_stuck 0 end_if set_counter a2u9_distance 4 inc_counter a2u9_stuck 1 end_if if I_UnitDistanceFromPosition a2u9 0,0 >= 250 and I_UnitDistanceFromPosition a2u9 0,0 < 275 if I_CompareCounter a2u9_distance != 5 set_counter a2u9_stuck 0 end_if set_counter a2u9_distance 5 inc_counter a2u9_stuck 1 end_if if I_UnitDistanceFromPosition a2u9 0,0 >= 275 and I_UnitDistanceFromPosition a2u9 0,0 < 300 if I_CompareCounter a2u9_distance != 6 set_counter a2u9_stuck 0 end_if set_counter a2u9_distance 6 inc_counter a2u9_stuck 1 end_if if I_UnitDistanceFromPosition a2u9 0,0 >= 300 and I_UnitDistanceFromPosition a2u9 0,0 < 325 if I_CompareCounter a2u9_distance != 7 set_counter a2u9_stuck 0 end_if set_counter a2u9_distance 7 inc_counter a2u9_stuck 1 end_if if I_UnitDistanceFromPosition a2u9 0,0 >= 325 and I_UnitDistanceFromPosition a2u9 0,0 < 350 if I_CompareCounter a2u9_distance != 8 set_counter a2u9_stuck 0 end_if set_counter a2u9_distance 8 inc_counter a2u9_stuck 1 end_if if I_UnitDistanceFromPosition a2u9 0,0 >= 350 and I_UnitDistanceFromPosition a2u9 0,0 < 375 if I_CompareCounter a2u9_distance != 9 set_counter a2u9_stuck 0 end_if set_counter a2u9_distance 9 inc_counter a2u9_stuck 1 end_if if I_UnitDistanceFromPosition a2u9 0,0 >= 375 and I_UnitDistanceFromPosition a2u9 0,0 < 400

if I_CompareCounter a2u9_distance != 10 set_counter a2u9_stuck 0 end_if set_counter a2u9_distance 10 inc_counter a2u9_stuck 1 end_if if I_UnitDistanceFromPosition a2u9 0,0 >= 400 and I_UnitDistanceFromPosition a2u9 0,0 < 425 if I_CompareCounter a2u9_distance != 11 set_counter a2u9_stuck 0 end_if set_counter a2u9_distance 11 inc_counter a2u9_stuck 1 end_if if I_UnitDistanceFromPosition a2u9 0,0 >= 425 and I_UnitDistanceFromPosition a2u9 0,0 < 450 if I_CompareCounter a2u9_distance != 12 set_counter a2u9_stuck 0 end_if set_counter a2u9_distance 12 inc_counter a2u9_stuck 1 end_if if I_UnitDistanceFromPosition a2u9 0,0 >= 450 and I_UnitDistanceFromPosition a2u9 0,0 < 500 if I_CompareCounter a2u9_distance != 13 set_counter a2u9_stuck 0 end_if set_counter a2u9_distance 13 inc_counter a2u9_stuck 1 end_if if I_UnitDistanceFromPosition a2u9 0,0 >= 500 and I_UnitDistanceFromPosition a2u9 0,0 < 550 if I_CompareCounter a2u9_distance != 14 set_counter a2u9_stuck 0 end_if set_counter a2u9_distance 14 inc_counter a2u9_stuck 1 end_if if I_UnitDistanceFromPosition a2u9 0,0 >= 550 and I_UnitDistanceFromPosition a2u9 0,0 < 600 if I_CompareCounter a2u9_distance != 15 set_counter a2u9_stuck 0 end_if set_counter a2u9_distance 15 inc_counter a2u9_stuck 1 end_if if I_CompareCounter a2u9_stuck = 4 unit_order_halt a2u9 unit_set_morale a2u9 wavering battle_wait 0.1 unit_unset_morale a2u9 release_unit a2u9 set_counter a2u9_stuck 0 end_if

end_if end_if if I_CompareCounter enemy_unit_count > 9 and ! I_UnitDestroyed a2u10 if I_UnitStatus a2u10 moving if I_CompareCounter a2u10_status = 0 set_counter a2u10_status 1 end_if if I_CompareCounter a2u10_status != 1 set_counter a2u10_status 0 end_if end_if if I_UnitStatus a2u10 routing if I_CompareCounter a2u10_status = 0 set_counter a2u10_status 2 end_if if I_CompareCounter a2u10_status != 2 set_counter a2u10_status 0 end_if end_if if ! I_UnitStatus a2u10 moving and ! I_UnitStatus a2u10 routing set_counter a2u10_status 0 end_if if I_CompareCounter a2u10_status > 0 if I_UnitDistanceFromPosition a2u10 0,0 >= 150 and I_UnitDistanceFromPosition a2u10 0,0 < 175 if I_CompareCounter a2u10_distance != 1 set_counter a2u10_stuck 0 end_if set_counter a2u10_distance 1 inc_counter a2u10_stuck 1 end_if if I_UnitDistanceFromPosition a2u10 0,0 >= 175 and I_UnitDistanceFromPosition a2u10 0,0 < 200 if I_CompareCounter a2u10_distance != 2 set_counter a2u10_stuck 0 end_if set_counter a2u10_distance 2 inc_counter a2u10_stuck 1 end_if if I_UnitDistanceFromPosition a2u10 0,0 >= 200 and I_UnitDistanceFromPosition a2u10 0,0 < 225 if I_CompareCounter a2u10_distance != 3 set_counter a2u10_stuck 0 end_if set_counter a2u10_distance 3 inc_counter a2u10_stuck 1 end_if if I_UnitDistanceFromPosition a2u10 0,0 >= 225

and I_UnitDistanceFromPosition a2u10 0,0 < 250 if I_CompareCounter a2u10_distance != 4 set_counter a2u10_stuck 0 end_if set_counter a2u10_distance 4 inc_counter a2u10_stuck 1 end_if if I_UnitDistanceFromPosition a2u10 0,0 >= 250 and I_UnitDistanceFromPosition a2u10 0,0 < 275 if I_CompareCounter a2u10_distance != 5 set_counter a2u10_stuck 0 end_if set_counter a2u10_distance 5 inc_counter a2u10_stuck 1 end_if if I_UnitDistanceFromPosition a2u10 0,0 >= 275 and I_UnitDistanceFromPosition a2u10 0,0 < 300 if I_CompareCounter a2u10_distance != 6 set_counter a2u10_stuck 0 end_if set_counter a2u10_distance 6 inc_counter a2u10_stuck 1 end_if if I_UnitDistanceFromPosition a2u10 0,0 >= 300 and I_UnitDistanceFromPosition a2u10 0,0 < 325 if I_CompareCounter a2u10_distance != 7 set_counter a2u10_stuck 0 end_if set_counter a2u10_distance 7 inc_counter a2u10_stuck 1 end_if if I_UnitDistanceFromPosition a2u10 0,0 >= 325 and I_UnitDistanceFromPosition a2u10 0,0 < 350 if I_CompareCounter a2u10_distance != 8 set_counter a2u10_stuck 0 end_if set_counter a2u10_distance 8 inc_counter a2u10_stuck 1 end_if if I_UnitDistanceFromPosition a2u10 0,0 >= 350 and I_UnitDistanceFromPosition a2u10 0,0 < 375 if I_CompareCounter a2u10_distance != 9 set_counter a2u10_stuck 0 end_if set_counter a2u10_distance 9 inc_counter a2u10_stuck 1 end_if if I_UnitDistanceFromPosition a2u10 0,0 >= 375 and I_UnitDistanceFromPosition a2u10 0,0 < 400 if I_CompareCounter a2u10_distance != 10 set_counter a2u10_stuck 0 end_if set_counter a2u10_distance 10 inc_counter a2u10_stuck 1

end_if if I_UnitDistanceFromPosition a2u10 0,0 >= 400 and I_UnitDistanceFromPosition a2u10 0,0 < 425 if I_CompareCounter a2u10_distance != 11 set_counter a2u10_stuck 0 end_if set_counter a2u10_distance 11 inc_counter a2u10_stuck 1 end_if if I_UnitDistanceFromPosition a2u10 0,0 >= 425 and I_UnitDistanceFromPosition a2u10 0,0 < 450 if I_CompareCounter a2u10_distance != 12 set_counter a2u10_stuck 0 end_if set_counter a2u10_distance 12 inc_counter a2u10_stuck 1 end_if if I_UnitDistanceFromPosition a2u10 0,0 >= 450 and I_UnitDistanceFromPosition a2u10 0,0 < 500 if I_CompareCounter a2u10_distance != 13 set_counter a2u10_stuck 0 end_if set_counter a2u10_distance 13 inc_counter a2u10_stuck 1 end_if if I_UnitDistanceFromPosition a2u10 0,0 >= 500 and I_UnitDistanceFromPosition a2u10 0,0 < 550 if I_CompareCounter a2u10_distance != 14 set_counter a2u10_stuck 0 end_if set_counter a2u10_distance 14 inc_counter a2u10_stuck 1 end_if if I_UnitDistanceFromPosition a2u10 0,0 >= 550 and I_UnitDistanceFromPosition a2u10 0,0 < 600 if I_CompareCounter a2u10_distance != 15 set_counter a2u10_stuck 0 end_if set_counter a2u10_distance 15 inc_counter a2u10_stuck 1 end_if if I_CompareCounter a2u10_stuck = 4 unit_order_halt a2u10 unit_set_morale a2u10 wavering battle_wait 0.1 unit_unset_morale a2u10 release_unit a2u10 set_counter a2u10_stuck 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 10

and ! I_UnitDestroyed a2u11 if I_UnitStatus a2u11 moving if I_CompareCounter a2u11_status = 0 set_counter a2u11_status 1 end_if if I_CompareCounter a2u11_status != 1 set_counter a2u11_status 0 end_if end_if if I_UnitStatus a2u11 routing if I_CompareCounter a2u11_status = 0 set_counter a2u11_status 2 end_if if I_CompareCounter a2u11_status != 2 set_counter a2u11_status 0 end_if end_if if ! I_UnitStatus a2u11 moving and ! I_UnitStatus a2u11 routing set_counter a2u11_status 0 end_if if I_CompareCounter a2u11_status > 0 if I_UnitDistanceFromPosition a2u11 0,0 >= 150 and I_UnitDistanceFromPosition a2u11 0,0 < 175 if I_CompareCounter a2u11_distance != 1 set_counter a2u11_stuck 0 end_if set_counter a2u11_distance 1 inc_counter a2u11_stuck 1 end_if if I_UnitDistanceFromPosition a2u11 0,0 >= 175 and I_UnitDistanceFromPosition a2u11 0,0 < 200 if I_CompareCounter a2u11_distance != 2 set_counter a2u11_stuck 0 end_if set_counter a2u11_distance 2 inc_counter a2u11_stuck 1 end_if if I_UnitDistanceFromPosition a2u11 0,0 >= 200 and I_UnitDistanceFromPosition a2u11 0,0 < 225 if I_CompareCounter a2u11_distance != 3 set_counter a2u11_stuck 0 end_if set_counter a2u11_distance 3 inc_counter a2u11_stuck 1 end_if if I_UnitDistanceFromPosition a2u11 0,0 >= 225 and I_UnitDistanceFromPosition a2u11 0,0 < 250 if I_CompareCounter a2u11_distance != 4 set_counter a2u11_stuck 0 end_if set_counter a2u11_distance 4

inc_counter a2u11_stuck 1 end_if if I_UnitDistanceFromPosition a2u11 0,0 >= 250 and I_UnitDistanceFromPosition a2u11 0,0 < 275 if I_CompareCounter a2u11_distance != 5 set_counter a2u11_stuck 0 end_if set_counter a2u11_distance 5 inc_counter a2u11_stuck 1 end_if if I_UnitDistanceFromPosition a2u11 0,0 >= 275 and I_UnitDistanceFromPosition a2u11 0,0 < 300 if I_CompareCounter a2u11_distance != 6 set_counter a2u11_stuck 0 end_if set_counter a2u11_distance 6 inc_counter a2u11_stuck 1 end_if if I_UnitDistanceFromPosition a2u11 0,0 >= 300 and I_UnitDistanceFromPosition a2u11 0,0 < 325 if I_CompareCounter a2u11_distance != 7 set_counter a2u11_stuck 0 end_if set_counter a2u11_distance 7 inc_counter a2u11_stuck 1 end_if if I_UnitDistanceFromPosition a2u11 0,0 >= 325 and I_UnitDistanceFromPosition a2u11 0,0 < 350 if I_CompareCounter a2u11_distance != 8 set_counter a2u11_stuck 0 end_if set_counter a2u11_distance 8 inc_counter a2u11_stuck 1 end_if if I_UnitDistanceFromPosition a2u11 0,0 >= 350 and I_UnitDistanceFromPosition a2u11 0,0 < 375 if I_CompareCounter a2u11_distance != 9 set_counter a2u11_stuck 0 end_if set_counter a2u11_distance 9 inc_counter a2u11_stuck 1 end_if if I_UnitDistanceFromPosition a2u11 0,0 >= 375 and I_UnitDistanceFromPosition a2u11 0,0 < 400 if I_CompareCounter a2u11_distance != 10 set_counter a2u11_stuck 0 end_if set_counter a2u11_distance 10 inc_counter a2u11_stuck 1 end_if if I_UnitDistanceFromPosition a2u11 0,0 >= 400 and I_UnitDistanceFromPosition a2u11 0,0 < 425 if I_CompareCounter a2u11_distance != 11

set_counter a2u11_stuck 0 end_if set_counter a2u11_distance 11 inc_counter a2u11_stuck 1 end_if if I_UnitDistanceFromPosition a2u11 0,0 >= 425 and I_UnitDistanceFromPosition a2u11 0,0 < 450 if I_CompareCounter a2u11_distance != 12 set_counter a2u11_stuck 0 end_if set_counter a2u11_distance 12 inc_counter a2u11_stuck 1 end_if if I_UnitDistanceFromPosition a2u11 0,0 >= 450 and I_UnitDistanceFromPosition a2u11 0,0 < 500 if I_CompareCounter a2u11_distance != 13 set_counter a2u11_stuck 0 end_if set_counter a2u11_distance 13 inc_counter a2u11_stuck 1 end_if if I_UnitDistanceFromPosition a2u11 0,0 >= 500 and I_UnitDistanceFromPosition a2u11 0,0 < 550 if I_CompareCounter a2u11_distance != 14 set_counter a2u11_stuck 0 end_if set_counter a2u11_distance 14 inc_counter a2u11_stuck 1 end_if if I_UnitDistanceFromPosition a2u11 0,0 >= 550 and I_UnitDistanceFromPosition a2u11 0,0 < 600 if I_CompareCounter a2u11_distance != 15 set_counter a2u11_stuck 0 end_if set_counter a2u11_distance 15 inc_counter a2u11_stuck 1 end_if if I_CompareCounter a2u11_stuck = 4 unit_order_halt a2u11 unit_set_morale a2u11 wavering battle_wait 0.1 unit_unset_morale a2u11 release_unit a2u11 set_counter a2u11_stuck 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 11 and ! I_UnitDestroyed a2u12 if I_UnitStatus a2u12 moving if I_CompareCounter a2u12_status = 0 set_counter a2u12_status 1

end_if if I_CompareCounter a2u12_status != 1 set_counter a2u12_status 0 end_if end_if if I_UnitStatus a2u12 routing if I_CompareCounter a2u12_status = 0 set_counter a2u12_status 2 end_if if I_CompareCounter a2u12_status != 2 set_counter a2u12_status 0 end_if end_if if ! I_UnitStatus a2u12 moving and ! I_UnitStatus a2u12 routing set_counter a2u12_status 0 end_if if I_CompareCounter a2u12_status > 0 if I_UnitDistanceFromPosition a2u12 0,0 >= 150 and I_UnitDistanceFromPosition a2u12 0,0 < 175 if I_CompareCounter a2u12_distance != 1 set_counter a2u12_stuck 0 end_if set_counter a2u12_distance 1 inc_counter a2u12_stuck 1 end_if if I_UnitDistanceFromPosition a2u12 0,0 >= 175 and I_UnitDistanceFromPosition a2u12 0,0 < 200 if I_CompareCounter a2u12_distance != 2 set_counter a2u12_stuck 0 end_if set_counter a2u12_distance 2 inc_counter a2u12_stuck 1 end_if if I_UnitDistanceFromPosition a2u12 0,0 >= 200 and I_UnitDistanceFromPosition a2u12 0,0 < 225 if I_CompareCounter a2u12_distance != 3 set_counter a2u12_stuck 0 end_if set_counter a2u12_distance 3 inc_counter a2u12_stuck 1 end_if if I_UnitDistanceFromPosition a2u12 0,0 >= 225 and I_UnitDistanceFromPosition a2u12 0,0 < 250 if I_CompareCounter a2u12_distance != 4 set_counter a2u12_stuck 0 end_if set_counter a2u12_distance 4 inc_counter a2u12_stuck 1 end_if if I_UnitDistanceFromPosition a2u12 0,0 >= 250 and I_UnitDistanceFromPosition a2u12 0,0 < 275

if I_CompareCounter a2u12_distance != 5 set_counter a2u12_stuck 0 end_if set_counter a2u12_distance 5 inc_counter a2u12_stuck 1 end_if if I_UnitDistanceFromPosition a2u12 0,0 >= 275 and I_UnitDistanceFromPosition a2u12 0,0 < 300 if I_CompareCounter a2u12_distance != 6 set_counter a2u12_stuck 0 end_if set_counter a2u12_distance 6 inc_counter a2u12_stuck 1 end_if if I_UnitDistanceFromPosition a2u12 0,0 >= 300 and I_UnitDistanceFromPosition a2u12 0,0 < 325 if I_CompareCounter a2u12_distance != 7 set_counter a2u12_stuck 0 end_if set_counter a2u12_distance 7 inc_counter a2u12_stuck 1 end_if if I_UnitDistanceFromPosition a2u12 0,0 >= 325 and I_UnitDistanceFromPosition a2u12 0,0 < 350 if I_CompareCounter a2u12_distance != 8 set_counter a2u12_stuck 0 end_if set_counter a2u12_distance 8 inc_counter a2u12_stuck 1 end_if if I_UnitDistanceFromPosition a2u12 0,0 >= 350 and I_UnitDistanceFromPosition a2u12 0,0 < 375 if I_CompareCounter a2u12_distance != 9 set_counter a2u12_stuck 0 end_if set_counter a2u12_distance 9 inc_counter a2u12_stuck 1 end_if if I_UnitDistanceFromPosition a2u12 0,0 >= 375 and I_UnitDistanceFromPosition a2u12 0,0 < 400 if I_CompareCounter a2u12_distance != 10 set_counter a2u12_stuck 0 end_if set_counter a2u12_distance 10 inc_counter a2u12_stuck 1 end_if if I_UnitDistanceFromPosition a2u12 0,0 >= 400 and I_UnitDistanceFromPosition a2u12 0,0 < 425 if I_CompareCounter a2u12_distance != 11 set_counter a2u12_stuck 0 end_if set_counter a2u12_distance 11 inc_counter a2u12_stuck 1 end_if

if I_UnitDistanceFromPosition a2u12 0,0 >= 425 and I_UnitDistanceFromPosition a2u12 0,0 < 450 if I_CompareCounter a2u12_distance != 12 set_counter a2u12_stuck 0 end_if set_counter a2u12_distance 12 inc_counter a2u12_stuck 1 end_if if I_UnitDistanceFromPosition a2u12 0,0 >= 450 and I_UnitDistanceFromPosition a2u12 0,0 < 500 if I_CompareCounter a2u12_distance != 13 set_counter a2u12_stuck 0 end_if set_counter a2u12_distance 13 inc_counter a2u12_stuck 1 end_if if I_UnitDistanceFromPosition a2u12 0,0 >= 500 and I_UnitDistanceFromPosition a2u12 0,0 < 550 if I_CompareCounter a2u12_distance != 14 set_counter a2u12_stuck 0 end_if set_counter a2u12_distance 14 inc_counter a2u12_stuck 1 end_if if I_UnitDistanceFromPosition a2u12 0,0 >= 550 and I_UnitDistanceFromPosition a2u12 0,0 < 600 if I_CompareCounter a2u12_distance != 15 set_counter a2u12_stuck 0 end_if set_counter a2u12_distance 15 inc_counter a2u12_stuck 1 end_if if I_CompareCounter a2u12_stuck = 4 unit_order_halt a2u12 unit_set_morale a2u12 wavering battle_wait 0.1 unit_unset_morale a2u12 release_unit a2u12 set_counter a2u12_stuck 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 12 and ! I_UnitDestroyed a2u13 if I_UnitStatus a2u13 moving if I_CompareCounter a2u13_status = 0 set_counter a2u13_status 1 end_if if I_CompareCounter a2u13_status != 1 set_counter a2u13_status 0 end_if end_if

if I_UnitStatus a2u13 routing if I_CompareCounter a2u13_status = 0 set_counter a2u13_status 2 end_if if I_CompareCounter a2u13_status != 2 set_counter a2u13_status 0 end_if end_if if ! I_UnitStatus a2u13 moving and ! I_UnitStatus a2u13 routing set_counter a2u13_status 0 end_if if I_CompareCounter a2u13_status > 0 if I_UnitDistanceFromPosition a2u13 0,0 >= 150 and I_UnitDistanceFromPosition a2u13 0,0 < 175 if I_CompareCounter a2u13_distance != 1 set_counter a2u13_stuck 0 end_if set_counter a2u13_distance 1 inc_counter a2u13_stuck 1 end_if if I_UnitDistanceFromPosition a2u13 0,0 >= 175 and I_UnitDistanceFromPosition a2u13 0,0 < 200 if I_CompareCounter a2u13_distance != 2 set_counter a2u13_stuck 0 end_if set_counter a2u13_distance 2 inc_counter a2u13_stuck 1 end_if if I_UnitDistanceFromPosition a2u13 0,0 >= 200 and I_UnitDistanceFromPosition a2u13 0,0 < 225 if I_CompareCounter a2u13_distance != 3 set_counter a2u13_stuck 0 end_if set_counter a2u13_distance 3 inc_counter a2u13_stuck 1 end_if if I_UnitDistanceFromPosition a2u13 0,0 >= 225 and I_UnitDistanceFromPosition a2u13 0,0 < 250 if I_CompareCounter a2u13_distance != 4 set_counter a2u13_stuck 0 end_if set_counter a2u13_distance 4 inc_counter a2u13_stuck 1 end_if if I_UnitDistanceFromPosition a2u13 0,0 >= 250 and I_UnitDistanceFromPosition a2u13 0,0 < 275 if I_CompareCounter a2u13_distance != 5 set_counter a2u13_stuck 0 end_if set_counter a2u13_distance 5 inc_counter a2u13_stuck 1

end_if if I_UnitDistanceFromPosition a2u13 0,0 >= 275 and I_UnitDistanceFromPosition a2u13 0,0 < 300 if I_CompareCounter a2u13_distance != 6 set_counter a2u13_stuck 0 end_if set_counter a2u13_distance 6 inc_counter a2u13_stuck 1 end_if if I_UnitDistanceFromPosition a2u13 0,0 >= 300 and I_UnitDistanceFromPosition a2u13 0,0 < 325 if I_CompareCounter a2u13_distance != 7 set_counter a2u13_stuck 0 end_if set_counter a2u13_distance 7 inc_counter a2u13_stuck 1 end_if if I_UnitDistanceFromPosition a2u13 0,0 >= 325 and I_UnitDistanceFromPosition a2u13 0,0 < 350 if I_CompareCounter a2u13_distance != 8 set_counter a2u13_stuck 0 end_if set_counter a2u13_distance 8 inc_counter a2u13_stuck 1 end_if if I_UnitDistanceFromPosition a2u13 0,0 >= 350 and I_UnitDistanceFromPosition a2u13 0,0 < 375 if I_CompareCounter a2u13_distance != 9 set_counter a2u13_stuck 0 end_if set_counter a2u13_distance 9 inc_counter a2u13_stuck 1 end_if if I_UnitDistanceFromPosition a2u13 0,0 >= 375 and I_UnitDistanceFromPosition a2u13 0,0 < 400 if I_CompareCounter a2u13_distance != 10 set_counter a2u13_stuck 0 end_if set_counter a2u13_distance 10 inc_counter a2u13_stuck 1 end_if if I_UnitDistanceFromPosition a2u13 0,0 >= 400 and I_UnitDistanceFromPosition a2u13 0,0 < 425 if I_CompareCounter a2u13_distance != 11 set_counter a2u13_stuck 0 end_if set_counter a2u13_distance 11 inc_counter a2u13_stuck 1 end_if if I_UnitDistanceFromPosition a2u13 0,0 >= 425 and I_UnitDistanceFromPosition a2u13 0,0 < 450 if I_CompareCounter a2u13_distance != 12 set_counter a2u13_stuck 0

end_if set_counter a2u13_distance 12 inc_counter a2u13_stuck 1 end_if if I_UnitDistanceFromPosition a2u13 0,0 >= 450 and I_UnitDistanceFromPosition a2u13 0,0 < 500 if I_CompareCounter a2u13_distance != 13 set_counter a2u13_stuck 0 end_if set_counter a2u13_distance 13 inc_counter a2u13_stuck 1 end_if if I_UnitDistanceFromPosition a2u13 0,0 >= 500 and I_UnitDistanceFromPosition a2u13 0,0 < 550 if I_CompareCounter a2u13_distance != 14 set_counter a2u13_stuck 0 end_if set_counter a2u13_distance 14 inc_counter a2u13_stuck 1 end_if if I_UnitDistanceFromPosition a2u13 0,0 >= 550 and I_UnitDistanceFromPosition a2u13 0,0 < 600 if I_CompareCounter a2u13_distance != 15 set_counter a2u13_stuck 0 end_if set_counter a2u13_distance 15 inc_counter a2u13_stuck 1 end_if if I_CompareCounter a2u13_stuck = 4 unit_order_halt a2u13 unit_set_morale a2u13 wavering battle_wait 0.1 unit_unset_morale a2u13 release_unit a2u13 set_counter a2u13_stuck 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 13 and ! I_UnitDestroyed a2u14 if I_UnitStatus a2u14 moving if I_CompareCounter a2u14_status = 0 set_counter a2u14_status 1 end_if if I_CompareCounter a2u14_status != 1 set_counter a2u14_status 0 end_if end_if if I_UnitStatus a2u14 routing if I_CompareCounter a2u14_status = 0 set_counter a2u14_status 2 end_if

if I_CompareCounter a2u14_status != 2 set_counter a2u14_status 0 end_if end_if if ! I_UnitStatus a2u14 moving and ! I_UnitStatus a2u14 routing set_counter a2u14_status 0 end_if if I_CompareCounter a2u14_status > 0 if I_UnitDistanceFromPosition a2u14 0,0 >= 150 and I_UnitDistanceFromPosition a2u14 0,0 < 175 if I_CompareCounter a2u14_distance != 1 set_counter a2u14_stuck 0 end_if set_counter a2u14_distance 1 inc_counter a2u14_stuck 1 end_if if I_UnitDistanceFromPosition a2u14 0,0 >= 175 and I_UnitDistanceFromPosition a2u14 0,0 < 200 if I_CompareCounter a2u14_distance != 2 set_counter a2u14_stuck 0 end_if set_counter a2u14_distance 2 inc_counter a2u14_stuck 1 end_if if I_UnitDistanceFromPosition a2u14 0,0 >= 200 and I_UnitDistanceFromPosition a2u14 0,0 < 225 if I_CompareCounter a2u14_distance != 3 set_counter a2u14_stuck 0 end_if set_counter a2u14_distance 3 inc_counter a2u14_stuck 1 end_if if I_UnitDistanceFromPosition a2u14 0,0 >= 225 and I_UnitDistanceFromPosition a2u14 0,0 < 250 if I_CompareCounter a2u14_distance != 4 set_counter a2u14_stuck 0 end_if set_counter a2u14_distance 4 inc_counter a2u14_stuck 1 end_if if I_UnitDistanceFromPosition a2u14 0,0 >= 250 and I_UnitDistanceFromPosition a2u14 0,0 < 275 if I_CompareCounter a2u14_distance != 5 set_counter a2u14_stuck 0 end_if set_counter a2u14_distance 5 inc_counter a2u14_stuck 1 end_if if I_UnitDistanceFromPosition a2u14 0,0 >= 275 and I_UnitDistanceFromPosition a2u14 0,0 < 300 if I_CompareCounter a2u14_distance != 6

set_counter a2u14_stuck 0 end_if set_counter a2u14_distance 6 inc_counter a2u14_stuck 1 end_if if I_UnitDistanceFromPosition a2u14 0,0 >= 300 and I_UnitDistanceFromPosition a2u14 0,0 < 325 if I_CompareCounter a2u14_distance != 7 set_counter a2u14_stuck 0 end_if set_counter a2u14_distance 7 inc_counter a2u14_stuck 1 end_if if I_UnitDistanceFromPosition a2u14 0,0 >= 325 and I_UnitDistanceFromPosition a2u14 0,0 < 350 if I_CompareCounter a2u14_distance != 8 set_counter a2u14_stuck 0 end_if set_counter a2u14_distance 8 inc_counter a2u14_stuck 1 end_if if I_UnitDistanceFromPosition a2u14 0,0 >= 350 and I_UnitDistanceFromPosition a2u14 0,0 < 375 if I_CompareCounter a2u14_distance != 9 set_counter a2u14_stuck 0 end_if set_counter a2u14_distance 9 inc_counter a2u14_stuck 1 end_if if I_UnitDistanceFromPosition a2u14 0,0 >= 375 and I_UnitDistanceFromPosition a2u14 0,0 < 400 if I_CompareCounter a2u14_distance != 10 set_counter a2u14_stuck 0 end_if set_counter a2u14_distance 10 inc_counter a2u14_stuck 1 end_if if I_UnitDistanceFromPosition a2u14 0,0 >= 400 and I_UnitDistanceFromPosition a2u14 0,0 < 425 if I_CompareCounter a2u14_distance != 11 set_counter a2u14_stuck 0 end_if set_counter a2u14_distance 11 inc_counter a2u14_stuck 1 end_if if I_UnitDistanceFromPosition a2u14 0,0 >= 425 and I_UnitDistanceFromPosition a2u14 0,0 < 450 if I_CompareCounter a2u14_distance != 12 set_counter a2u14_stuck 0 end_if set_counter a2u14_distance 12 inc_counter a2u14_stuck 1 end_if

if I_UnitDistanceFromPosition a2u14 0,0 >= 450 and I_UnitDistanceFromPosition a2u14 0,0 < 500 if I_CompareCounter a2u14_distance != 13 set_counter a2u14_stuck 0 end_if set_counter a2u14_distance 13 inc_counter a2u14_stuck 1 end_if if I_UnitDistanceFromPosition a2u14 0,0 >= 500 and I_UnitDistanceFromPosition a2u14 0,0 < 550 if I_CompareCounter a2u14_distance != 14 set_counter a2u14_stuck 0 end_if set_counter a2u14_distance 14 inc_counter a2u14_stuck 1 end_if if I_UnitDistanceFromPosition a2u14 0,0 >= 550 and I_UnitDistanceFromPosition a2u14 0,0 < 600 if I_CompareCounter a2u14_distance != 15 set_counter a2u14_stuck 0 end_if set_counter a2u14_distance 15 inc_counter a2u14_stuck 1 end_if if I_CompareCounter a2u14_stuck = 4 unit_order_halt a2u14 unit_set_morale a2u14 wavering battle_wait 0.1 unit_unset_morale a2u14 release_unit a2u14 set_counter a2u14_stuck 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 14 and ! I_UnitDestroyed a2u15 if I_UnitStatus a2u15 moving if I_CompareCounter a2u15_status = 0 set_counter a2u15_status 1 end_if if I_CompareCounter a2u15_status != 1 set_counter a2u15_status 0 end_if end_if if I_UnitStatus a2u15 routing if I_CompareCounter a2u15_status = 0 set_counter a2u15_status 2 end_if if I_CompareCounter a2u15_status != 2 set_counter a2u15_status 0 end_if end_if

if ! I_UnitStatus a2u15 moving and ! I_UnitStatus a2u15 routing set_counter a2u15_status 0 end_if if I_CompareCounter a2u15_status > 0 if I_UnitDistanceFromPosition a2u15 0,0 >= 150 and I_UnitDistanceFromPosition a2u15 0,0 < 175 if I_CompareCounter a2u15_distance != 1 set_counter a2u15_stuck 0 end_if set_counter a2u15_distance 1 inc_counter a2u15_stuck 1 end_if if I_UnitDistanceFromPosition a2u15 0,0 >= 175 and I_UnitDistanceFromPosition a2u15 0,0 < 200 if I_CompareCounter a2u15_distance != 2 set_counter a2u15_stuck 0 end_if set_counter a2u15_distance 2 inc_counter a2u15_stuck 1 end_if if I_UnitDistanceFromPosition a2u15 0,0 >= 200 and I_UnitDistanceFromPosition a2u15 0,0 < 225 if I_CompareCounter a2u15_distance != 3 set_counter a2u15_stuck 0 end_if set_counter a2u15_distance 3 inc_counter a2u15_stuck 1 end_if if I_UnitDistanceFromPosition a2u15 0,0 >= 225 and I_UnitDistanceFromPosition a2u15 0,0 < 250 if I_CompareCounter a2u15_distance != 4 set_counter a2u15_stuck 0 end_if set_counter a2u15_distance 4 inc_counter a2u15_stuck 1 end_if if I_UnitDistanceFromPosition a2u15 0,0 >= 250 and I_UnitDistanceFromPosition a2u15 0,0 < 275 if I_CompareCounter a2u15_distance != 5 set_counter a2u15_stuck 0 end_if set_counter a2u15_distance 5 inc_counter a2u15_stuck 1 end_if if I_UnitDistanceFromPosition a2u15 0,0 >= 275 and I_UnitDistanceFromPosition a2u15 0,0 < 300 if I_CompareCounter a2u15_distance != 6 set_counter a2u15_stuck 0 end_if set_counter a2u15_distance 6 inc_counter a2u15_stuck 1 end_if

if I_UnitDistanceFromPosition a2u15 0,0 >= 300 and I_UnitDistanceFromPosition a2u15 0,0 < 325 if I_CompareCounter a2u15_distance != 7 set_counter a2u15_stuck 0 end_if set_counter a2u15_distance 7 inc_counter a2u15_stuck 1 end_if if I_UnitDistanceFromPosition a2u15 0,0 >= 325 and I_UnitDistanceFromPosition a2u15 0,0 < 350 if I_CompareCounter a2u15_distance != 8 set_counter a2u15_stuck 0 end_if set_counter a2u15_distance 8 inc_counter a2u15_stuck 1 end_if if I_UnitDistanceFromPosition a2u15 0,0 >= 350 and I_UnitDistanceFromPosition a2u15 0,0 < 375 if I_CompareCounter a2u15_distance != 9 set_counter a2u15_stuck 0 end_if set_counter a2u15_distance 9 inc_counter a2u15_stuck 1 end_if if I_UnitDistanceFromPosition a2u15 0,0 >= 375 and I_UnitDistanceFromPosition a2u15 0,0 < 400 if I_CompareCounter a2u15_distance != 10 set_counter a2u15_stuck 0 end_if set_counter a2u15_distance 10 inc_counter a2u15_stuck 1 end_if if I_UnitDistanceFromPosition a2u15 0,0 >= 400 and I_UnitDistanceFromPosition a2u15 0,0 < 425 if I_CompareCounter a2u15_distance != 11 set_counter a2u15_stuck 0 end_if set_counter a2u15_distance 11 inc_counter a2u15_stuck 1 end_if if I_UnitDistanceFromPosition a2u15 0,0 >= 425 and I_UnitDistanceFromPosition a2u15 0,0 < 450 if I_CompareCounter a2u15_distance != 12 set_counter a2u15_stuck 0 end_if set_counter a2u15_distance 12 inc_counter a2u15_stuck 1 end_if if I_UnitDistanceFromPosition a2u15 0,0 >= 450 and I_UnitDistanceFromPosition a2u15 0,0 < 500 if I_CompareCounter a2u15_distance != 13 set_counter a2u15_stuck 0 end_if

set_counter a2u15_distance 13 inc_counter a2u15_stuck 1 end_if if I_UnitDistanceFromPosition a2u15 0,0 >= 500 and I_UnitDistanceFromPosition a2u15 0,0 < 550 if I_CompareCounter a2u15_distance != 14 set_counter a2u15_stuck 0 end_if set_counter a2u15_distance 14 inc_counter a2u15_stuck 1 end_if if I_UnitDistanceFromPosition a2u15 0,0 >= 550 and I_UnitDistanceFromPosition a2u15 0,0 < 600 if I_CompareCounter a2u15_distance != 15 set_counter a2u15_stuck 0 end_if set_counter a2u15_distance 15 inc_counter a2u15_stuck 1 end_if if I_CompareCounter a2u15_stuck = 4 unit_order_halt a2u15 unit_set_morale a2u15 wavering battle_wait 0.1 unit_unset_morale a2u15 release_unit a2u15 set_counter a2u15_stuck 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 15 and ! I_UnitDestroyed a2u16 if I_UnitStatus a2u16 moving if I_CompareCounter a2u16_status = 0 set_counter a2u16_status 1 end_if if I_CompareCounter a2u16_status != 1 set_counter a2u16_status 0 end_if end_if if I_UnitStatus a2u16 routing if I_CompareCounter a2u16_status = 0 set_counter a2u16_status 2 end_if if I_CompareCounter a2u16_status != 2 set_counter a2u16_status 0 end_if end_if if ! I_UnitStatus a2u16 moving and ! I_UnitStatus a2u16 routing set_counter a2u16_status 0 end_if

if I_CompareCounter a2u16_status > 0 if I_UnitDistanceFromPosition a2u16 0,0 >= 150 and I_UnitDistanceFromPosition a2u16 0,0 < 175 if I_CompareCounter a2u16_distance != 1 set_counter a2u16_stuck 0 end_if set_counter a2u16_distance 1 inc_counter a2u16_stuck 1 end_if if I_UnitDistanceFromPosition a2u16 0,0 >= 175 and I_UnitDistanceFromPosition a2u16 0,0 < 200 if I_CompareCounter a2u16_distance != 2 set_counter a2u16_stuck 0 end_if set_counter a2u16_distance 2 inc_counter a2u16_stuck 1 end_if if I_UnitDistanceFromPosition a2u16 0,0 >= 200 and I_UnitDistanceFromPosition a2u16 0,0 < 225 if I_CompareCounter a2u16_distance != 3 set_counter a2u16_stuck 0 end_if set_counter a2u16_distance 3 inc_counter a2u16_stuck 1 end_if if I_UnitDistanceFromPosition a2u16 0,0 >= 225 and I_UnitDistanceFromPosition a2u16 0,0 < 250 if I_CompareCounter a2u16_distance != 4 set_counter a2u16_stuck 0 end_if set_counter a2u16_distance 4 inc_counter a2u16_stuck 1 end_if if I_UnitDistanceFromPosition a2u16 0,0 >= 250 and I_UnitDistanceFromPosition a2u16 0,0 < 275 if I_CompareCounter a2u16_distance != 5 set_counter a2u16_stuck 0 end_if set_counter a2u16_distance 5 inc_counter a2u16_stuck 1 end_if if I_UnitDistanceFromPosition a2u16 0,0 >= 275 and I_UnitDistanceFromPosition a2u16 0,0 < 300 if I_CompareCounter a2u16_distance != 6 set_counter a2u16_stuck 0 end_if set_counter a2u16_distance 6 inc_counter a2u16_stuck 1 end_if if I_UnitDistanceFromPosition a2u16 0,0 >= 300 and I_UnitDistanceFromPosition a2u16 0,0 < 325 if I_CompareCounter a2u16_distance != 7 set_counter a2u16_stuck 0

end_if set_counter a2u16_distance 7 inc_counter a2u16_stuck 1 end_if if I_UnitDistanceFromPosition a2u16 0,0 >= 325 and I_UnitDistanceFromPosition a2u16 0,0 < 350 if I_CompareCounter a2u16_distance != 8 set_counter a2u16_stuck 0 end_if set_counter a2u16_distance 8 inc_counter a2u16_stuck 1 end_if if I_UnitDistanceFromPosition a2u16 0,0 >= 350 and I_UnitDistanceFromPosition a2u16 0,0 < 375 if I_CompareCounter a2u16_distance != 9 set_counter a2u16_stuck 0 end_if set_counter a2u16_distance 9 inc_counter a2u16_stuck 1 end_if if I_UnitDistanceFromPosition a2u16 0,0 >= 375 and I_UnitDistanceFromPosition a2u16 0,0 < 400 if I_CompareCounter a2u16_distance != 10 set_counter a2u16_stuck 0 end_if set_counter a2u16_distance 10 inc_counter a2u16_stuck 1 end_if if I_UnitDistanceFromPosition a2u16 0,0 >= 400 and I_UnitDistanceFromPosition a2u16 0,0 < 425 if I_CompareCounter a2u16_distance != 11 set_counter a2u16_stuck 0 end_if set_counter a2u16_distance 11 inc_counter a2u16_stuck 1 end_if if I_UnitDistanceFromPosition a2u16 0,0 >= 425 and I_UnitDistanceFromPosition a2u16 0,0 < 450 if I_CompareCounter a2u16_distance != 12 set_counter a2u16_stuck 0 end_if set_counter a2u16_distance 12 inc_counter a2u16_stuck 1 end_if if I_UnitDistanceFromPosition a2u16 0,0 >= 450 and I_UnitDistanceFromPosition a2u16 0,0 < 500 if I_CompareCounter a2u16_distance != 13 set_counter a2u16_stuck 0 end_if set_counter a2u16_distance 13 inc_counter a2u16_stuck 1 end_if if I_UnitDistanceFromPosition a2u16 0,0 >= 500

and I_UnitDistanceFromPosition a2u16 0,0 < 550 if I_CompareCounter a2u16_distance != 14 set_counter a2u16_stuck 0 end_if set_counter a2u16_distance 14 inc_counter a2u16_stuck 1 end_if if I_UnitDistanceFromPosition a2u16 0,0 >= 550 and I_UnitDistanceFromPosition a2u16 0,0 < 600 if I_CompareCounter a2u16_distance != 15 set_counter a2u16_stuck 0 end_if set_counter a2u16_distance 15 inc_counter a2u16_stuck 1 end_if if I_CompareCounter a2u16_stuck = 4 unit_order_halt a2u16 unit_set_morale a2u16 wavering battle_wait 0.1 unit_unset_morale a2u16 release_unit a2u16 set_counter a2u16_stuck 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 16 and ! I_UnitDestroyed a2u17 if I_UnitStatus a2u17 moving if I_CompareCounter a2u17_status = 0 set_counter a2u17_status 1 end_if if I_CompareCounter a2u17_status != 1 set_counter a2u17_status 0 end_if end_if if I_UnitStatus a2u17 routing if I_CompareCounter a2u17_status = 0 set_counter a2u17_status 2 end_if if I_CompareCounter a2u17_status != 2 set_counter a2u17_status 0 end_if end_if if ! I_UnitStatus a2u17 moving and ! I_UnitStatus a2u17 routing set_counter a2u17_status 0 end_if if I_CompareCounter a2u17_status > 0 if I_UnitDistanceFromPosition a2u17 0,0 >= 150 and I_UnitDistanceFromPosition a2u17 0,0 < 175 if I_CompareCounter a2u17_distance != 1

set_counter a2u17_stuck 0 end_if set_counter a2u17_distance 1 inc_counter a2u17_stuck 1 end_if if I_UnitDistanceFromPosition a2u17 0,0 >= 175 and I_UnitDistanceFromPosition a2u17 0,0 < 200 if I_CompareCounter a2u17_distance != 2 set_counter a2u17_stuck 0 end_if set_counter a2u17_distance 2 inc_counter a2u17_stuck 1 end_if if I_UnitDistanceFromPosition a2u17 0,0 >= 200 and I_UnitDistanceFromPosition a2u17 0,0 < 225 if I_CompareCounter a2u17_distance != 3 set_counter a2u17_stuck 0 end_if set_counter a2u17_distance 3 inc_counter a2u17_stuck 1 end_if if I_UnitDistanceFromPosition a2u17 0,0 >= 225 and I_UnitDistanceFromPosition a2u17 0,0 < 250 if I_CompareCounter a2u17_distance != 4 set_counter a2u17_stuck 0 end_if set_counter a2u17_distance 4 inc_counter a2u17_stuck 1 end_if if I_UnitDistanceFromPosition a2u17 0,0 >= 250 and I_UnitDistanceFromPosition a2u17 0,0 < 275 if I_CompareCounter a2u17_distance != 5 set_counter a2u17_stuck 0 end_if set_counter a2u17_distance 5 inc_counter a2u17_stuck 1 end_if if I_UnitDistanceFromPosition a2u17 0,0 >= 275 and I_UnitDistanceFromPosition a2u17 0,0 < 300 if I_CompareCounter a2u17_distance != 6 set_counter a2u17_stuck 0 end_if set_counter a2u17_distance 6 inc_counter a2u17_stuck 1 end_if if I_UnitDistanceFromPosition a2u17 0,0 >= 300 and I_UnitDistanceFromPosition a2u17 0,0 < 325 if I_CompareCounter a2u17_distance != 7 set_counter a2u17_stuck 0 end_if set_counter a2u17_distance 7 inc_counter a2u17_stuck 1 end_if

if I_UnitDistanceFromPosition a2u17 0,0 >= 325 and I_UnitDistanceFromPosition a2u17 0,0 < 350 if I_CompareCounter a2u17_distance != 8 set_counter a2u17_stuck 0 end_if set_counter a2u17_distance 8 inc_counter a2u17_stuck 1 end_if if I_UnitDistanceFromPosition a2u17 0,0 >= 350 and I_UnitDistanceFromPosition a2u17 0,0 < 375 if I_CompareCounter a2u17_distance != 9 set_counter a2u17_stuck 0 end_if set_counter a2u17_distance 9 inc_counter a2u17_stuck 1 end_if if I_UnitDistanceFromPosition a2u17 0,0 >= 375 and I_UnitDistanceFromPosition a2u17 0,0 < 400 if I_CompareCounter a2u17_distance != 10 set_counter a2u17_stuck 0 end_if set_counter a2u17_distance 10 inc_counter a2u17_stuck 1 end_if if I_UnitDistanceFromPosition a2u17 0,0 >= 400 and I_UnitDistanceFromPosition a2u17 0,0 < 425 if I_CompareCounter a2u17_distance != 11 set_counter a2u17_stuck 0 end_if set_counter a2u17_distance 11 inc_counter a2u17_stuck 1 end_if if I_UnitDistanceFromPosition a2u17 0,0 >= 425 and I_UnitDistanceFromPosition a2u17 0,0 < 450 if I_CompareCounter a2u17_distance != 12 set_counter a2u17_stuck 0 end_if set_counter a2u17_distance 12 inc_counter a2u17_stuck 1 end_if if I_UnitDistanceFromPosition a2u17 0,0 >= 450 and I_UnitDistanceFromPosition a2u17 0,0 < 500 if I_CompareCounter a2u17_distance != 13 set_counter a2u17_stuck 0 end_if set_counter a2u17_distance 13 inc_counter a2u17_stuck 1 end_if if I_UnitDistanceFromPosition a2u17 0,0 >= 500 and I_UnitDistanceFromPosition a2u17 0,0 < 550 if I_CompareCounter a2u17_distance != 14 set_counter a2u17_stuck 0 end_if set_counter a2u17_distance 14

inc_counter a2u17_stuck 1 end_if if I_UnitDistanceFromPosition a2u17 0,0 >= 550 and I_UnitDistanceFromPosition a2u17 0,0 < 600 if I_CompareCounter a2u17_distance != 15 set_counter a2u17_stuck 0 end_if set_counter a2u17_distance 15 inc_counter a2u17_stuck 1 end_if if I_CompareCounter a2u17_stuck = 4 unit_order_halt a2u17 unit_set_morale a2u17 wavering battle_wait 0.1 unit_unset_morale a2u17 release_unit a2u17 set_counter a2u17_stuck 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 17 and ! I_UnitDestroyed a2u18 if I_UnitStatus a2u18 moving if I_CompareCounter a2u18_status = 0 set_counter a2u18_status 1 end_if if I_CompareCounter a2u18_status != 1 set_counter a2u18_status 0 end_if end_if if I_UnitStatus a2u18 routing if I_CompareCounter a2u18_status = 0 set_counter a2u18_status 2 end_if if I_CompareCounter a2u18_status != 2 set_counter a2u18_status 0 end_if end_if if ! I_UnitStatus a2u18 moving and ! I_UnitStatus a2u18 routing set_counter a2u18_status 0 end_if if I_CompareCounter a2u18_status > 0 if I_UnitDistanceFromPosition a2u18 0,0 >= 150 and I_UnitDistanceFromPosition a2u18 0,0 < 175 if I_CompareCounter a2u18_distance != 1 set_counter a2u18_stuck 0 end_if set_counter a2u18_distance 1 inc_counter a2u18_stuck 1 end_if

if I_UnitDistanceFromPosition a2u18 0,0 >= 175 and I_UnitDistanceFromPosition a2u18 0,0 < 200 if I_CompareCounter a2u18_distance != 2 set_counter a2u18_stuck 0 end_if set_counter a2u18_distance 2 inc_counter a2u18_stuck 1 end_if if I_UnitDistanceFromPosition a2u18 0,0 >= 200 and I_UnitDistanceFromPosition a2u18 0,0 < 225 if I_CompareCounter a2u18_distance != 3 set_counter a2u18_stuck 0 end_if set_counter a2u18_distance 3 inc_counter a2u18_stuck 1 end_if if I_UnitDistanceFromPosition a2u18 0,0 >= 225 and I_UnitDistanceFromPosition a2u18 0,0 < 250 if I_CompareCounter a2u18_distance != 4 set_counter a2u18_stuck 0 end_if set_counter a2u18_distance 4 inc_counter a2u18_stuck 1 end_if if I_UnitDistanceFromPosition a2u18 0,0 >= 250 and I_UnitDistanceFromPosition a2u18 0,0 < 275 if I_CompareCounter a2u18_distance != 5 set_counter a2u18_stuck 0 end_if set_counter a2u18_distance 5 inc_counter a2u18_stuck 1 end_if if I_UnitDistanceFromPosition a2u18 0,0 >= 275 and I_UnitDistanceFromPosition a2u18 0,0 < 300 if I_CompareCounter a2u18_distance != 6 set_counter a2u18_stuck 0 end_if set_counter a2u18_distance 6 inc_counter a2u18_stuck 1 end_if if I_UnitDistanceFromPosition a2u18 0,0 >= 300 and I_UnitDistanceFromPosition a2u18 0,0 < 325 if I_CompareCounter a2u18_distance != 7 set_counter a2u18_stuck 0 end_if set_counter a2u18_distance 7 inc_counter a2u18_stuck 1 end_if if I_UnitDistanceFromPosition a2u18 0,0 >= 325 and I_UnitDistanceFromPosition a2u18 0,0 < 350 if I_CompareCounter a2u18_distance != 8 set_counter a2u18_stuck 0 end_if

set_counter a2u18_distance 8 inc_counter a2u18_stuck 1 end_if if I_UnitDistanceFromPosition a2u18 0,0 >= 350 and I_UnitDistanceFromPosition a2u18 0,0 < 375 if I_CompareCounter a2u18_distance != 9 set_counter a2u18_stuck 0 end_if set_counter a2u18_distance 9 inc_counter a2u18_stuck 1 end_if if I_UnitDistanceFromPosition a2u18 0,0 >= 375 and I_UnitDistanceFromPosition a2u18 0,0 < 400 if I_CompareCounter a2u18_distance != 10 set_counter a2u18_stuck 0 end_if set_counter a2u18_distance 10 inc_counter a2u18_stuck 1 end_if if I_UnitDistanceFromPosition a2u18 0,0 >= 400 and I_UnitDistanceFromPosition a2u18 0,0 < 425 if I_CompareCounter a2u18_distance != 11 set_counter a2u18_stuck 0 end_if set_counter a2u18_distance 11 inc_counter a2u18_stuck 1 end_if if I_UnitDistanceFromPosition a2u18 0,0 >= 425 and I_UnitDistanceFromPosition a2u18 0,0 < 450 if I_CompareCounter a2u18_distance != 12 set_counter a2u18_stuck 0 end_if set_counter a2u18_distance 12 inc_counter a2u18_stuck 1 end_if if I_UnitDistanceFromPosition a2u18 0,0 >= 450 and I_UnitDistanceFromPosition a2u18 0,0 < 500 if I_CompareCounter a2u18_distance != 13 set_counter a2u18_stuck 0 end_if set_counter a2u18_distance 13 inc_counter a2u18_stuck 1 end_if if I_UnitDistanceFromPosition a2u18 0,0 >= 500 and I_UnitDistanceFromPosition a2u18 0,0 < 550 if I_CompareCounter a2u18_distance != 14 set_counter a2u18_stuck 0 end_if set_counter a2u18_distance 14 inc_counter a2u18_stuck 1 end_if if I_UnitDistanceFromPosition a2u18 0,0 >= 550 and I_UnitDistanceFromPosition a2u18 0,0 < 600

if I_CompareCounter a2u18_distance != 15 set_counter a2u18_stuck 0 end_if set_counter a2u18_distance 15 inc_counter a2u18_stuck 1 end_if if I_CompareCounter a2u18_stuck = 4 unit_order_halt a2u18 unit_set_morale a2u18 wavering battle_wait 0.1 unit_unset_morale a2u18 release_unit a2u18 set_counter a2u18_stuck 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 18 and ! I_UnitDestroyed a2u19 if I_UnitStatus a2u19 moving if I_CompareCounter a2u19_status = 0 set_counter a2u19_status 1 end_if if I_CompareCounter a2u19_status != 1 set_counter a2u19_status 0 end_if end_if if I_UnitStatus a2u19 routing if I_CompareCounter a2u19_status = 0 set_counter a2u19_status 2 end_if if I_CompareCounter a2u19_status != 2 set_counter a2u19_status 0 end_if end_if if ! I_UnitStatus a2u19 moving and ! I_UnitStatus a2u19 routing set_counter a2u19_status 0 end_if if I_CompareCounter a2u19_status > 0 if I_UnitDistanceFromPosition a2u19 0,0 >= 150 and I_UnitDistanceFromPosition a2u19 0,0 < 175 if I_CompareCounter a2u19_distance != 1 set_counter a2u19_stuck 0 end_if set_counter a2u19_distance 1 inc_counter a2u19_stuck 1 end_if if I_UnitDistanceFromPosition a2u19 0,0 >= 175 and I_UnitDistanceFromPosition a2u19 0,0 < 200 if I_CompareCounter a2u19_distance != 2 set_counter a2u19_stuck 0

end_if set_counter a2u19_distance 2 inc_counter a2u19_stuck 1 end_if if I_UnitDistanceFromPosition a2u19 0,0 >= 200 and I_UnitDistanceFromPosition a2u19 0,0 < 225 if I_CompareCounter a2u19_distance != 3 set_counter a2u19_stuck 0 end_if set_counter a2u19_distance 3 inc_counter a2u19_stuck 1 end_if if I_UnitDistanceFromPosition a2u19 0,0 >= 225 and I_UnitDistanceFromPosition a2u19 0,0 < 250 if I_CompareCounter a2u19_distance != 4 set_counter a2u19_stuck 0 end_if set_counter a2u19_distance 4 inc_counter a2u19_stuck 1 end_if if I_UnitDistanceFromPosition a2u19 0,0 >= 250 and I_UnitDistanceFromPosition a2u19 0,0 < 275 if I_CompareCounter a2u19_distance != 5 set_counter a2u19_stuck 0 end_if set_counter a2u19_distance 5 inc_counter a2u19_stuck 1 end_if if I_UnitDistanceFromPosition a2u19 0,0 >= 275 and I_UnitDistanceFromPosition a2u19 0,0 < 300 if I_CompareCounter a2u19_distance != 6 set_counter a2u19_stuck 0 end_if set_counter a2u19_distance 6 inc_counter a2u19_stuck 1 end_if if I_UnitDistanceFromPosition a2u19 0,0 >= 300 and I_UnitDistanceFromPosition a2u19 0,0 < 325 if I_CompareCounter a2u19_distance != 7 set_counter a2u19_stuck 0 end_if set_counter a2u19_distance 7 inc_counter a2u19_stuck 1 end_if if I_UnitDistanceFromPosition a2u19 0,0 >= 325 and I_UnitDistanceFromPosition a2u19 0,0 < 350 if I_CompareCounter a2u19_distance != 8 set_counter a2u19_stuck 0 end_if set_counter a2u19_distance 8 inc_counter a2u19_stuck 1 end_if if I_UnitDistanceFromPosition a2u19 0,0 >= 350

and I_UnitDistanceFromPosition a2u19 0,0 < 375 if I_CompareCounter a2u19_distance != 9 set_counter a2u19_stuck 0 end_if set_counter a2u19_distance 9 inc_counter a2u19_stuck 1 end_if if I_UnitDistanceFromPosition a2u19 0,0 >= 375 and I_UnitDistanceFromPosition a2u19 0,0 < 400 if I_CompareCounter a2u19_distance != 10 set_counter a2u19_stuck 0 end_if set_counter a2u19_distance 10 inc_counter a2u19_stuck 1 end_if if I_UnitDistanceFromPosition a2u19 0,0 >= 400 and I_UnitDistanceFromPosition a2u19 0,0 < 425 if I_CompareCounter a2u19_distance != 11 set_counter a2u19_stuck 0 end_if set_counter a2u19_distance 11 inc_counter a2u19_stuck 1 end_if if I_UnitDistanceFromPosition a2u19 0,0 >= 425 and I_UnitDistanceFromPosition a2u19 0,0 < 450 if I_CompareCounter a2u19_distance != 12 set_counter a2u19_stuck 0 end_if set_counter a2u19_distance 12 inc_counter a2u19_stuck 1 end_if if I_UnitDistanceFromPosition a2u19 0,0 >= 450 and I_UnitDistanceFromPosition a2u19 0,0 < 500 if I_CompareCounter a2u19_distance != 13 set_counter a2u19_stuck 0 end_if set_counter a2u19_distance 13 inc_counter a2u19_stuck 1 end_if if I_UnitDistanceFromPosition a2u19 0,0 >= 500 and I_UnitDistanceFromPosition a2u19 0,0 < 550 if I_CompareCounter a2u19_distance != 14 set_counter a2u19_stuck 0 end_if set_counter a2u19_distance 14 inc_counter a2u19_stuck 1 end_if if I_UnitDistanceFromPosition a2u19 0,0 >= 550 and I_UnitDistanceFromPosition a2u19 0,0 < 600 if I_CompareCounter a2u19_distance != 15 set_counter a2u19_stuck 0 end_if set_counter a2u19_distance 15 inc_counter a2u19_stuck 1

end_if if I_CompareCounter a2u19_stuck = 4 unit_order_halt a2u19 unit_set_morale a2u19 wavering battle_wait 0.1 unit_unset_morale a2u19 release_unit a2u19 set_counter a2u19_stuck 0 end_if end_if end_if if I_CompareCounter enemy_unit_count = 20 and ! I_UnitDestroyed a2u20 if I_UnitStatus a2u20 moving if I_CompareCounter a2u20_status = 0 set_counter a2u20_status 1 end_if if I_CompareCounter a2u20_status != 1 set_counter a2u20_status 0 end_if end_if if I_UnitStatus a2u20 routing if I_CompareCounter a2u20_status = 0 set_counter a2u20_status 2 end_if if I_CompareCounter a2u20_status != 2 set_counter a2u20_status 0 end_if end_if if ! I_UnitStatus a2u20 moving and ! I_UnitStatus a2u20 routing set_counter a2u20_status 0 end_if if I_CompareCounter a2u20_status > 0 if I_UnitDistanceFromPosition a2u20 0,0 >= 150 and I_UnitDistanceFromPosition a2u20 0,0 < 175 if I_CompareCounter a2u20_distance != 1 set_counter a2u20_stuck 0 end_if set_counter a2u20_distance 1 inc_counter a2u20_stuck 1 end_if if I_UnitDistanceFromPosition a2u20 0,0 >= 175 and I_UnitDistanceFromPosition a2u20 0,0 < 200 if I_CompareCounter a2u20_distance != 2 set_counter a2u20_stuck 0 end_if set_counter a2u20_distance 2 inc_counter a2u20_stuck 1 end_if

if I_UnitDistanceFromPosition a2u20 0,0 >= 200 and I_UnitDistanceFromPosition a2u20 0,0 < 225 if I_CompareCounter a2u20_distance != 3 set_counter a2u20_stuck 0 end_if set_counter a2u20_distance 3 inc_counter a2u20_stuck 1 end_if if I_UnitDistanceFromPosition a2u20 0,0 >= 225 and I_UnitDistanceFromPosition a2u20 0,0 < 250 if I_CompareCounter a2u20_distance != 4 set_counter a2u20_stuck 0 end_if set_counter a2u20_distance 4 inc_counter a2u20_stuck 1 end_if if I_UnitDistanceFromPosition a2u20 0,0 >= 250 and I_UnitDistanceFromPosition a2u20 0,0 < 275 if I_CompareCounter a2u20_distance != 5 set_counter a2u20_stuck 0 end_if set_counter a2u20_distance 5 inc_counter a2u20_stuck 1 end_if if I_UnitDistanceFromPosition a2u20 0,0 >= 275 and I_UnitDistanceFromPosition a2u20 0,0 < 300 if I_CompareCounter a2u20_distance != 6 set_counter a2u20_stuck 0 end_if set_counter a2u20_distance 6 inc_counter a2u20_stuck 1 end_if if I_UnitDistanceFromPosition a2u20 0,0 >= 300 and I_UnitDistanceFromPosition a2u20 0,0 < 325 if I_CompareCounter a2u20_distance != 7 set_counter a2u20_stuck 0 end_if set_counter a2u20_distance 7 inc_counter a2u20_stuck 1 end_if if I_UnitDistanceFromPosition a2u20 0,0 >= 325 and I_UnitDistanceFromPosition a2u20 0,0 < 350 if I_CompareCounter a2u20_distance != 8 set_counter a2u20_stuck 0 end_if set_counter a2u20_distance 8 inc_counter a2u20_stuck 1 end_if if I_UnitDistanceFromPosition a2u20 0,0 >= 350 and I_UnitDistanceFromPosition a2u20 0,0 < 375 if I_CompareCounter a2u20_distance != 9 set_counter a2u20_stuck 0 end_if set_counter a2u20_distance 9

inc_counter a2u20_stuck 1 end_if if I_UnitDistanceFromPosition a2u20 0,0 >= 375 and I_UnitDistanceFromPosition a2u20 0,0 < 400 if I_CompareCounter a2u20_distance != 10 set_counter a2u20_stuck 0 end_if set_counter a2u20_distance 10 inc_counter a2u20_stuck 1 end_if if I_UnitDistanceFromPosition a2u20 0,0 >= 400 and I_UnitDistanceFromPosition a2u20 0,0 < 425 if I_CompareCounter a2u20_distance != 11 set_counter a2u20_stuck 0 end_if set_counter a2u20_distance 11 inc_counter a2u20_stuck 1 end_if if I_UnitDistanceFromPosition a2u20 0,0 >= 425 and I_UnitDistanceFromPosition a2u20 0,0 < 450 if I_CompareCounter a2u20_distance != 12 set_counter a2u20_stuck 0 end_if set_counter a2u20_distance 12 inc_counter a2u20_stuck 1 end_if if I_UnitDistanceFromPosition a2u20 0,0 >= 450 and I_UnitDistanceFromPosition a2u20 0,0 < 500 if I_CompareCounter a2u20_distance != 13 set_counter a2u20_stuck 0 end_if set_counter a2u20_distance 13 inc_counter a2u20_stuck 1 end_if if I_UnitDistanceFromPosition a2u20 0,0 >= 500 and I_UnitDistanceFromPosition a2u20 0,0 < 550 if I_CompareCounter a2u20_distance != 14 set_counter a2u20_stuck 0 end_if set_counter a2u20_distance 14 inc_counter a2u20_stuck 1 end_if if I_UnitDistanceFromPosition a2u20 0,0 >= 550 and I_UnitDistanceFromPosition a2u20 0,0 < 600 if I_CompareCounter a2u20_distance != 15 set_counter a2u20_stuck 0 end_if set_counter a2u20_distance 15 inc_counter a2u20_stuck 1 end_if if I_CompareCounter a2u20_stuck = 4 unit_order_halt a2u20 unit_set_morale a2u20 wavering

battle_wait 0.1 unit_unset_morale a2u20 release_unit a2u20 set_counter a2u20_stuck 0 end_if end_if end_if battle_wait 10 end_monitor ;;;;;;;Custom Settlements ;;;;;;;Imladris AI Siege monitor_conditions I_BattleStarted and I_CompareCounter imladris_siege_check = 1 and I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker set_counter enemy_unit_count 0 if I_BattleEnemyArmyNumberOfUnits label_unit 0 0 0 a1g1 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 0 0 1 a1u2 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 0 0 2 a1u3 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 0 0 3 a1u4 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 0 0 4 a1u5 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 0 0 5 a1u6 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 0 0 6 a1u7 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 0 0 7 a1u8 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 0 0 8 a1u9 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 0 0 9 a1u10 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 0 0 10 a1u11 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 0 0 11 a1u12 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 0 0 12 a1u13 > 0 > 1 > 2 > 3 > 4 > 5 > 6 > 7 > 8 > 9 > 10 > 11 > 12

inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 0 0 13 a1u14 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 0 0 14 a1u15 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 0 0 15 a1u16 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 0 0 16 a1u17 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 0 0 17 a1u18 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 0 0 18 a1u19 inc_counter enemy_unit_count 1 if I_BattleEnemyArmyNumberOfUnits label_unit 0 0 19 a1u20 inc_counter enemy_unit_count 1 end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if end_if

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

label_location -150, -215, imladris_assault unit_group_immediate_place army1 imladris_assault 0 battle_wait 0.5 unit_group_order_halt army1 battle_wait 0.1 unit_group_set_guard_mode army1 off battle_wait 0.1 unit_group_set_skirmish_mode army1 off battle_wait 0.1 unit_group_set_fire_at_will_mode army1 on battle_wait 0.1 if I_CompareCounter enemy_unit_count > 0 and I_CompareCounter g1_missile = 0

if I_UnitPercentageAmmoLeft a1g1 > 0 inc_counter melee_count -1 set_counter g1_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a1g1 = horde set_counter g1_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a1g1 190,145 end_if if I_CompareCounter enemy_unit_count > 1 and I_CompareCounter u2_missile = 0 if I_UnitPercentageAmmoLeft a1u2 > 0 inc_counter melee_count -1 set_counter u2_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a1u2 = horde set_counter u2_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a1u2 190,145 end_if if I_CompareCounter enemy_unit_count > 2 and I_CompareCounter u3_missile = 0 if I_UnitPercentageAmmoLeft a1u3 > 0 inc_counter melee_count -1 set_counter u3_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a1u3 = horde set_counter u3_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a1u3 190,145 end_if if I_CompareCounter enemy_unit_count > 3 and I_CompareCounter u4_missile = 0 if I_UnitPercentageAmmoLeft a1u4 > 0 inc_counter melee_count -1 set_counter u4_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a1u4 = horde set_counter u4_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a1u4 190,145 end_if if I_CompareCounter enemy_unit_count > 4 and I_CompareCounter u5_missile = 0

if I_UnitPercentageAmmoLeft a1u5 > 0 inc_counter melee_count -1 set_counter u5_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a1u5 = horde set_counter u5_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a1u5 190,145 end_if if I_CompareCounter enemy_unit_count > 5 and I_CompareCounter u6_missile = 0 if I_UnitPercentageAmmoLeft a1u6 > 0 inc_counter melee_count -1 set_counter u6_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a1u6 = horde set_counter u6_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a1u6 190,145 end_if if I_CompareCounter enemy_unit_count > 6 and I_CompareCounter u7_missile = 0 if I_UnitPercentageAmmoLeft a1u7 > 0 inc_counter melee_count -1 set_counter u7_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a1u7 = horde set_counter u7_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a1u7 190,145 end_if if I_CompareCounter enemy_unit_count > 7 and I_CompareCounter u8_missile = 0 if I_UnitPercentageAmmoLeft a1u8 > 0 inc_counter melee_count -1 set_counter u8_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a1u8 = horde set_counter u8_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a1u8 190,145 end_if if I_CompareCounter enemy_unit_count > 8 and I_CompareCounter u9_missile = 0

if I_UnitPercentageAmmoLeft a1u9 > 0 inc_counter melee_count -1 set_counter u9_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a1u9 = horde set_counter u9_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a1u9 190,145 end_if if I_CompareCounter enemy_unit_count > 9 and I_CompareCounter u10_missile = 0 if I_UnitPercentageAmmoLeft a1u10 > 0 inc_counter melee_count -1 set_counter u10_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a1u10 = horde set_counter u10_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a1u10 190,145 end_if if I_CompareCounter enemy_unit_count > 10 and I_CompareCounter u11_missile = 0 if I_UnitPercentageAmmoLeft a1u11 > 0 inc_counter melee_count -1 set_counter u11_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a1u11 = horde set_counter u11_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a1u11 190,145 end_if if I_CompareCounter enemy_unit_count > 11 and I_CompareCounter u12_missile = 0 if I_UnitPercentageAmmoLeft a1u12 > 0 inc_counter melee_count -1 set_counter u12_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a1u12 = horde set_counter u12_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a1u12 190,145 end_if if I_CompareCounter enemy_unit_count > 12 and I_CompareCounter u13_missile = 0

if I_UnitPercentageAmmoLeft a1u13 > 0 inc_counter melee_count -1 set_counter u13_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a1u13 = horde set_counter u13_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a1u13 190,145 end_if if I_CompareCounter enemy_unit_count > 13 and I_CompareCounter u14_missile = 0 if I_UnitPercentageAmmoLeft a1u14 > 0 inc_counter melee_count -1 set_counter u14_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a1u14 = horde set_counter u14_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a1u14 190,145 end_if if I_CompareCounter enemy_unit_count > 14 and I_CompareCounter u15_missile = 0 if I_UnitPercentageAmmoLeft a1u15 > 0 inc_counter melee_count -1 set_counter u15_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a1u15 = horde set_counter u15_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a1u15 190,145 end_if if I_CompareCounter enemy_unit_count > 15 and I_CompareCounter u16_missile = 0 if I_UnitPercentageAmmoLeft a1u16 > 0 inc_counter melee_count -1 set_counter u16_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a1u16 = horde set_counter u16_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a1u16 190,145 end_if if I_CompareCounter enemy_unit_count > 16 and I_CompareCounter u17_missile = 0

if I_UnitPercentageAmmoLeft a1u17 > 0 inc_counter melee_count -1 set_counter u17_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a1u17 = horde set_counter u17_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a1u17 190,145 end_if if I_CompareCounter enemy_unit_count > 17 and I_CompareCounter u18_missile = 0 if I_UnitPercentageAmmoLeft a1u18 > 0 inc_counter melee_count -1 set_counter u18_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a1u18 = horde set_counter u18_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a1u18 190,145 end_if if I_CompareCounter enemy_unit_count > 18 and I_CompareCounter u19_missile = 0 if I_UnitPercentageAmmoLeft a1u19 > 0 inc_counter melee_count -1 set_counter u19_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a1u19 = horde set_counter u19_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a1u19 190,145 end_if if I_CompareCounter enemy_unit_count = 20 and I_CompareCounter u20_missile = 0 if I_UnitPercentageAmmoLeft a1u20 > 0 inc_counter melee_count -1 set_counter u20_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a1u20 = horde set_counter u20_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a1u20 190,145 end_if battle_wait 5

if I_CompareCounter imladris_siege_check = 1 and I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker set_counter imladris_siege_check 2 end_if end_monitor monitor_conditions I_BattleStarted and I_CompareCounter imladris_siege_check = 2 and I_CompareCounter terminate_imladris_check = 0 and I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker if I_CompareCounter enemy_unit_count > 0 and I_IsUnitUnderFire a1g1 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 1 and I_IsUnitUnderFire a1u2 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 2 and I_IsUnitUnderFire a1u3 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 3 and I_IsUnitUnderFire a1u4 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 4 and I_IsUnitUnderFire a1u5 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 5 and I_IsUnitUnderFire a1u6 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 6 and I_IsUnitUnderFire a1u7 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 7 and I_IsUnitUnderFire a1u8 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 8 and I_IsUnitUnderFire a1u9 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 9 and I_IsUnitUnderFire a1u10

inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 10 and I_IsUnitUnderFire a1u11 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 11 and I_IsUnitUnderFire a1u12 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 12 and I_IsUnitUnderFire a1u13 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 13 and I_IsUnitUnderFire a1u14 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 14 and I_IsUnitUnderFire a1u15 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 15 and I_IsUnitUnderFire a1u16 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 16 and I_IsUnitUnderFire a1u17 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 17 and I_IsUnitUnderFire a1u18 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 18 and I_IsUnitUnderFire a1u19 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count = 20 and I_IsUnitUnderFire a1u20 inc_counter imladris_under_fire 1 end_if if I_PercentageOfArmyKilled 0 0 > 5 and I_CompareCounter imladris_under_fire < 6 set_counter imladris_under_fire 5 end_if if I_CompareCounter imladris_under_fire > 5

if I_CompareCounter enemy_unit_count > 0 and I_CompareCounter g1_attacking = 0 unit_order_move a1g1 190,145 run end_if if I_CompareCounter enemy_unit_count > 1 and I_CompareCounter u2_attacking = 0 unit_order_move a1u2 190,145 run end_if if I_CompareCounter enemy_unit_count > 2 and I_CompareCounter u3_attacking = 0 unit_order_move a1u3 190,145 run end_if if I_CompareCounter enemy_unit_count > 3 and I_CompareCounter u4_attacking = 0 unit_order_move a1u4 190,145 run end_if if I_CompareCounter enemy_unit_count > 4 and I_CompareCounter u5_attacking = 0 unit_order_move a1u5 190,145 run end_if if I_CompareCounter enemy_unit_count > 5 and I_CompareCounter u6_attacking = 0 unit_order_move a1u6 190,145 run end_if if I_CompareCounter enemy_unit_count > 6 and I_CompareCounter u7_attacking = 0 unit_order_move a1u7 190,145 run end_if if I_CompareCounter enemy_unit_count > 7 and I_CompareCounter u8_attacking = 0 unit_order_move a1u8 190,145 run end_if if I_CompareCounter enemy_unit_count > 8 and I_CompareCounter u9_attacking = 0 unit_order_move a1u9 190,145 run end_if if I_CompareCounter enemy_unit_count > 9 and I_CompareCounter u10_attacking = 0 unit_order_move a1u10 190,145 run end_if if I_CompareCounter enemy_unit_count > 10 and I_CompareCounter u11_attacking = 0 unit_order_move a1u11 190,145 run end_if if I_CompareCounter enemy_unit_count > 11 and I_CompareCounter u12_attacking = 0 unit_order_move a1u12 190,145 run end_if

if I_CompareCounter enemy_unit_count > 12 and I_CompareCounter u13_attacking = 0 unit_order_move a1u13 190,145 run end_if if I_CompareCounter enemy_unit_count > 13 and I_CompareCounter u14_attacking = 0 unit_order_move a1u14 190,145 run end_if if I_CompareCounter enemy_unit_count > 14 and I_CompareCounter u15_attacking = 0 unit_order_move a1u15 190,145 run end_if if I_CompareCounter enemy_unit_count > 15 and I_CompareCounter u16_attacking = 0 unit_order_move a1u16 190,145 run end_if if I_CompareCounter enemy_unit_count > 16 and I_CompareCounter u17_attacking = 0 unit_order_move a1u17 190,145 run end_if if I_CompareCounter enemy_unit_count > 17 and I_CompareCounter u18_attacking = 0 unit_order_move a1u18 190,145 run end_if if I_CompareCounter enemy_unit_count > 18 and I_CompareCounter u19_attacking = 0 unit_order_move a1u19 190,145 run end_if if I_CompareCounter enemy_unit_count = 20 and I_CompareCounter u20_attacking = 0 unit_order_move a1u20 190,145 run end_if set_counter terminate_imladris_check 1 end_if battle_wait 10 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter imladris_siege_check = 2 and I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker if I_CompareCounter enemy_unit_count > 0 and I_CompareCounter g1_attacking = 1 and ! I_UnitStatus a1g1 fighting and ! I_UnitStatus a1g1 pursuing and ! I_UnitStatus a1g1 charging and ! I_UnitStatus a1g1 moving if ! I_UnitEnemyUnitInRadius a1g1 90 and I_CompareCounter g1_missile != 1 unit_order_move a1g1 190,145 run

set_counter g1_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a1g1 50 and I_CompareCounter g1_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a1g1 missiles_reloading and ! I_UnitStatus a1g1 missiles_firing unit_order_move a1g1 190,145 run set_counter g1_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a1g1 190,145 run set_counter g1_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 1 and I_CompareCounter u2_attacking = 1 and ! I_UnitStatus a1u2 fighting and ! I_UnitStatus a1u2 pursuing and ! I_UnitStatus a1u2 charging and ! I_UnitStatus a1u2 moving if ! I_UnitEnemyUnitInRadius a1u2 90 and I_CompareCounter u2_missile != 1 unit_order_move a1u2 190,145 run set_counter u2_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a1u2 50 and I_CompareCounter u2_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a1u2 missiles_reloading and ! I_UnitStatus a1u2 missiles_firing unit_order_move a1u2 190,145 run set_counter u2_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a1u2 190,145 run set_counter u2_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 2 and I_CompareCounter u3_attacking = 1 and ! I_UnitStatus a1u3 fighting and ! I_UnitStatus a1u3 pursuing and ! I_UnitStatus a1u3 charging and ! I_UnitStatus a1u3 moving if ! I_UnitEnemyUnitInRadius a1u3 90 and I_CompareCounter u3_missile != 1 unit_order_move a1u3 190,145 run set_counter u3_attacking 0 end_if

if ! I_UnitEnemyUnitInRadius a1u3 50 and I_CompareCounter u3_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a1u3 missiles_reloading and ! I_UnitStatus a1u3 missiles_firing unit_order_move a1u3 190,145 run set_counter u3_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a1u3 190,145 run set_counter u3_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 3 and I_CompareCounter u4_attacking = 1 and ! I_UnitStatus a1u4 fighting and ! I_UnitStatus a1u4 pursuing and ! I_UnitStatus a1u4 charging and ! I_UnitStatus a1u4 moving if ! I_UnitEnemyUnitInRadius a1u4 90 and I_CompareCounter u4_missile != 1 unit_order_move a1u4 190,145 run set_counter u4_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a1u4 50 and I_CompareCounter u4_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a1u4 missiles_reloading and ! I_UnitStatus a1u4 missiles_firing unit_order_move a1u4 190,145 run set_counter u4_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a1u4 190,145 run set_counter u4_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 4 and I_CompareCounter u5_attacking = 1 and ! I_UnitStatus a1u5 fighting and ! I_UnitStatus a1u5 pursuing and ! I_UnitStatus a1u5 charging and ! I_UnitStatus a1u5 moving if ! I_UnitEnemyUnitInRadius a1u5 90 and I_CompareCounter u5_missile != 1 unit_order_move a1u5 190,145 run set_counter u5_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a1u5 50 and I_CompareCounter u5_missile = 1 if I_CompareCounter melee_count != -1

and ! I_UnitStatus a1u5 missiles_reloading and ! I_UnitStatus a1u5 missiles_firing unit_order_move a1u5 190,145 run set_counter u5_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a1u5 190,145 run set_counter u5_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 5 and I_CompareCounter u6_attacking = 1 and ! I_UnitStatus a1u6 fighting and ! I_UnitStatus a1u6 pursuing and ! I_UnitStatus a1u6 charging and ! I_UnitStatus a1u6 moving if ! I_UnitEnemyUnitInRadius a1u6 90 and I_CompareCounter u6_missile != 1 unit_order_move a1u6 190,145 run set_counter u6_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a1u6 50 and I_CompareCounter u6_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a1u6 missiles_reloading and ! I_UnitStatus a1u6 missiles_firing unit_order_move a1u6 190,145 run set_counter u6_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a1u6 190,145 run set_counter u6_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 6 and I_CompareCounter u7_attacking = 1 and ! I_UnitStatus a1u7 fighting and ! I_UnitStatus a1u7 pursuing and ! I_UnitStatus a1u7 charging and ! I_UnitStatus a1u7 moving if ! I_UnitEnemyUnitInRadius a1u7 90 and I_CompareCounter u7_missile != 1 unit_order_move a1u7 190,145 run set_counter u7_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a1u7 50 and I_CompareCounter u7_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a1u7 missiles_reloading and ! I_UnitStatus a1u7 missiles_firing unit_order_move a1u7 190,145 run set_counter u7_attacking 0

end_if if I_CompareCounter melee_count = -1 unit_order_move a1u7 190,145 run set_counter u7_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 7 and I_CompareCounter u8_attacking = 1 and ! I_UnitStatus a1u8 fighting and ! I_UnitStatus a1u8 pursuing and ! I_UnitStatus a1u8 charging and ! I_UnitStatus a1u8 moving if ! I_UnitEnemyUnitInRadius a1u8 90 and I_CompareCounter u8_missile != 1 unit_order_move a1u8 190,145 run set_counter u8_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a1u8 50 and I_CompareCounter u8_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a1u8 missiles_reloading and ! I_UnitStatus a1u8 missiles_firing unit_order_move a1u8 190,145 run set_counter u8_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a1u8 190,145 run set_counter u8_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 8 and I_CompareCounter u9_attacking = 1 and ! I_UnitStatus a1u9 fighting and ! I_UnitStatus a1u9 pursuing and ! I_UnitStatus a1u9 charging and ! I_UnitStatus a1u9 moving if ! I_UnitEnemyUnitInRadius a1u9 90 and I_CompareCounter u9_missile != 1 unit_order_move a1u9 190,145 run set_counter u9_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a1u9 50 and I_CompareCounter u9_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a1u9 missiles_reloading and ! I_UnitStatus a1u9 missiles_firing unit_order_move a1u9 190,145 run set_counter u9_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a1u9 190,145 run set_counter u9_attacking 0

end_if end_if end_if if I_CompareCounter enemy_unit_count > 9 and I_CompareCounter u10_attacking = 1 and ! I_UnitStatus a1u10 fighting and ! I_UnitStatus a1u10 pursuing and ! I_UnitStatus a1u10 charging and ! I_UnitStatus a1u10 moving if ! I_UnitEnemyUnitInRadius a1u10 90 and I_CompareCounter u10_missile != 1 unit_order_move a1u10 190,145 run set_counter u10_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a1u10 50 and I_CompareCounter u10_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a1u10 missiles_reloading and ! I_UnitStatus a1u10 missiles_firing unit_order_move a1u10 190,145 run set_counter u10_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a1u10 190,145 run set_counter u10_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 10 and I_CompareCounter u11_attacking = 1 and ! I_UnitStatus a1u11 fighting and ! I_UnitStatus a1u11 pursuing and ! I_UnitStatus a1u11 charging and ! I_UnitStatus a1u11 moving if ! I_UnitEnemyUnitInRadius a1u11 90 and I_CompareCounter u11_missile != 1 unit_order_move a1u11 190,145 run set_counter u11_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a1u11 50 and I_CompareCounter u11_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a1u11 missiles_reloading and ! I_UnitStatus a1u11 missiles_firing unit_order_move a1u11 190,145 run set_counter u11_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a1u11 190,145 run set_counter u11_attacking 0 end_if end_if end_if

if I_CompareCounter enemy_unit_count > 11 and I_CompareCounter u12_attacking = 1 and ! I_UnitStatus a1u12 fighting and ! I_UnitStatus a1u12 pursuing and ! I_UnitStatus a1u12 charging and ! I_UnitStatus a1u12 moving if ! I_UnitEnemyUnitInRadius a1u12 90 and I_CompareCounter u12_missile != 1 unit_order_move a1u12 190,145 run set_counter u12_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a1u12 50 and I_CompareCounter u12_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a1u12 missiles_reloading and ! I_UnitStatus a1u12 missiles_firing unit_order_move a1u12 190,145 run set_counter u12_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a1u12 190,145 run set_counter u12_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 12 and I_CompareCounter u13_attacking = 1 and ! I_UnitStatus a1u13 fighting and ! I_UnitStatus a1u13 pursuing and ! I_UnitStatus a1u13 charging and ! I_UnitStatus a1u13 moving if ! I_UnitEnemyUnitInRadius a1u13 90 and I_CompareCounter u13_missile != 1 unit_order_move a1u13 190,145 run set_counter u13_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a1u13 50 and I_CompareCounter u13_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a1u13 missiles_reloading and ! I_UnitStatus a1u13 missiles_firing unit_order_move a1u13 190,145 run set_counter u13_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a1u13 190,145 run set_counter u13_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 13 and I_CompareCounter u14_attacking = 1 and ! I_UnitStatus a1u14 fighting and ! I_UnitStatus a1u14 pursuing

and ! I_UnitStatus a1u14 charging and ! I_UnitStatus a1u14 moving if ! I_UnitEnemyUnitInRadius a1u14 90 and I_CompareCounter u14_missile != 1 unit_order_move a1u14 190,145 run set_counter u14_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a1u14 50 and I_CompareCounter u14_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a1u14 missiles_reloading and ! I_UnitStatus a1u14 missiles_firing unit_order_move a1u14 190,145 run set_counter u14_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a1u14 190,145 run set_counter u14_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 14 and I_CompareCounter u15_attacking = 1 and ! I_UnitStatus a1u15 fighting and ! I_UnitStatus a1u15 pursuing and ! I_UnitStatus a1u15 charging and ! I_UnitStatus a1u15 moving if ! I_UnitEnemyUnitInRadius a1u15 90 and I_CompareCounter u15_missile != 1 unit_order_move a1u15 190,145 run set_counter u15_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a1u15 50 and I_CompareCounter u15_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a1u15 missiles_reloading and ! I_UnitStatus a1u15 missiles_firing unit_order_move a1u15 190,145 run set_counter u15_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a1u15 190,145 run set_counter u15_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 15 and I_CompareCounter u16_attacking = 1 and ! I_UnitStatus a1u16 fighting and ! I_UnitStatus a1u16 pursuing and ! I_UnitStatus a1u16 charging and ! I_UnitStatus a1u16 moving if ! I_UnitEnemyUnitInRadius a1u16 90

and I_CompareCounter u16_missile != 1 unit_order_move a1u16 190,145 run set_counter u16_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a1u16 50 and I_CompareCounter u16_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a1u16 missiles_reloading and ! I_UnitStatus a1u16 missiles_firing unit_order_move a1u16 190,145 run set_counter u16_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a1u16 190,145 run set_counter u16_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 16 and I_CompareCounter u17_attacking = 1 and ! I_UnitStatus a1u17 fighting and ! I_UnitStatus a1u17 pursuing and ! I_UnitStatus a1u17 charging and ! I_UnitStatus a1u17 moving if ! I_UnitEnemyUnitInRadius a1u17 90 and I_CompareCounter u17_missile != 1 unit_order_move a1u17 190,145 run set_counter u17_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a1u17 50 and I_CompareCounter u17_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a1u17 missiles_reloading and ! I_UnitStatus a1u17 missiles_firing unit_order_move a1u17 190,145 run set_counter u17_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a1u17 190,145 run set_counter u17_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 17 and I_CompareCounter u18_attacking = 1 and ! I_UnitStatus a1u18 fighting and ! I_UnitStatus a1u18 pursuing and ! I_UnitStatus a1u18 charging and ! I_UnitStatus a1u18 moving if ! I_UnitEnemyUnitInRadius a1u18 90 and I_CompareCounter u18_missile != 1 unit_order_move a1u18 190,145 run set_counter u18_attacking 0 end_if

if ! I_UnitEnemyUnitInRadius a1u18 50 and I_CompareCounter u18_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a1u18 missiles_reloading and ! I_UnitStatus a1u18 missiles_firing unit_order_move a1u18 190,145 run set_counter u18_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a1u18 190,145 run set_counter u18_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 18 and I_CompareCounter u19_attacking = 1 and ! I_UnitStatus a1u19 fighting and ! I_UnitStatus a1u19 pursuing and ! I_UnitStatus a1u19 charging and ! I_UnitStatus a1u19 moving if ! I_UnitEnemyUnitInRadius a1u19 90 and I_CompareCounter u19_missile != 1 unit_order_move a1u19 190,145 run set_counter u19_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a1u19 50 and I_CompareCounter u19_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a1u19 missiles_reloading and ! I_UnitStatus a1u19 missiles_firing unit_order_move a1u19 190,145 run set_counter u19_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a1u19 190,145 run set_counter u19_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count = 20 and I_CompareCounter u20_attacking = 1 and ! I_UnitStatus a1u20 fighting and ! I_UnitStatus a1u20 pursuing and ! I_UnitStatus a1u20 charging and ! I_UnitStatus a1u20 moving if ! I_UnitEnemyUnitInRadius a1u20 90 and I_CompareCounter u20_missile != 1 unit_order_move a1u20 190,145 run set_counter u20_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a1u20 50 and I_CompareCounter u20_missile = 1 if I_CompareCounter melee_count != -1

and ! I_UnitStatus a1u20 missiles_reloading and ! I_UnitStatus a1u20 missiles_firing unit_order_move a1u20 190,145 run set_counter u20_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a1u20 190,145 run set_counter u20_attacking 0 end_if end_if end_if battle_wait 10 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter imladris_siege_check = 2 and I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker if I_CompareCounter enemy_unit_count > 0 and ! I_UnitStatus a1g1 routing and ! I_UnitStatus a1g1 moving and ! I_UnitStatus a1g1 missiles_firing and ! I_UnitStatus a1g1 missiles_reloading and ! I_UnitStatus a1g1 charging and ! I_UnitStatus a1g1 fighting and ! I_UnitStatus a1g1 pursuing and ! I_UnitStatus a1g1 running_amok and ! I_UnitStatus a1g1 dead unit_order_move a1g1 190,145 run if I_CompareCounter g1_missile != 1 set_counter g1_attacking 0 end_if if I_CompareCounter g1_missile = 1 battle_wait 5 set_counter g1_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 1 and ! I_UnitStatus a1u2 routing and ! I_UnitStatus a1u2 moving and ! I_UnitStatus a1u2 missiles_firing and ! I_UnitStatus a1u2 missiles_reloading and ! I_UnitStatus a1u2 charging and ! I_UnitStatus a1u2 fighting and ! I_UnitStatus a1u2 pursuing and ! I_UnitStatus a1u2 running_amok and ! I_UnitStatus a1u2 dead unit_order_move a1u2 190,145 run if I_CompareCounter u2_missile != 1 set_counter u2_attacking 0 end_if if I_CompareCounter u2_missile = 1 battle_wait 5 set_counter u2_attacking 0 end_if

end_if if I_CompareCounter enemy_unit_count > 2 and ! I_UnitStatus a1u3 routing and ! I_UnitStatus a1u3 moving and ! I_UnitStatus a1u3 missiles_firing and ! I_UnitStatus a1u3 missiles_reloading and ! I_UnitStatus a1u3 charging and ! I_UnitStatus a1u3 fighting and ! I_UnitStatus a1u3 pursuing and ! I_UnitStatus a1u3 running_amok and ! I_UnitStatus a1u3 dead unit_order_move a1u3 190,145 run if I_CompareCounter u3_missile != 1 set_counter u3_attacking 0 end_if if I_CompareCounter u3_missile = 1 battle_wait 5 set_counter u3_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 3 and ! I_UnitStatus a1u4 routing and ! I_UnitStatus a1u4 moving and ! I_UnitStatus a1u4 missiles_firing and ! I_UnitStatus a1u4 missiles_reloading and ! I_UnitStatus a1u4 charging and ! I_UnitStatus a1u4 fighting and ! I_UnitStatus a1u4 pursuing and ! I_UnitStatus a1u4 running_amok and ! I_UnitStatus a1u4 dead unit_order_move a1u4 190,145 run if I_CompareCounter u4_missile != 1 set_counter u4_attacking 0 end_if if I_CompareCounter u4_missile = 1 battle_wait 5 set_counter u4_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 4 and ! I_UnitStatus a1u5 routing and ! I_UnitStatus a1u5 moving and ! I_UnitStatus a1u5 missiles_firing and ! I_UnitStatus a1u5 missiles_reloading and ! I_UnitStatus a1u5 charging and ! I_UnitStatus a1u5 fighting and ! I_UnitStatus a1u5 pursuing and ! I_UnitStatus a1u5 running_amok and ! I_UnitStatus a1u5 dead unit_order_move a1u5 190,145 run if I_CompareCounter u5_missile != 1 set_counter u5_attacking 0 end_if if I_CompareCounter u5_missile = 1

battle_wait 5 set_counter u5_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 5 and ! I_UnitStatus a1u6 routing and ! I_UnitStatus a1u6 moving and ! I_UnitStatus a1u6 missiles_firing and ! I_UnitStatus a1u6 missiles_reloading and ! I_UnitStatus a1u6 charging and ! I_UnitStatus a1u6 fighting and ! I_UnitStatus a1u6 pursuing and ! I_UnitStatus a1u6 running_amok and ! I_UnitStatus a1u6 dead unit_order_move a1u6 190,145 run if I_CompareCounter u6_missile != 1 set_counter u6_attacking 0 end_if if I_CompareCounter u6_missile = 1 battle_wait 5 set_counter u6_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 6 and ! I_UnitStatus a1u7 routing and ! I_UnitStatus a1u7 moving and ! I_UnitStatus a1u7 missiles_firing and ! I_UnitStatus a1u7 missiles_reloading and ! I_UnitStatus a1u7 charging and ! I_UnitStatus a1u7 fighting and ! I_UnitStatus a1u7 pursuing and ! I_UnitStatus a1u7 running_amok and ! I_UnitStatus a1u7 dead unit_order_move a1u7 190,145 run if I_CompareCounter u7_missile != 1 set_counter u7_attacking 0 end_if if I_CompareCounter u7_missile = 1 battle_wait 5 set_counter u7_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 7 and ! I_UnitStatus a1u8 routing and ! I_UnitStatus a1u8 moving and ! I_UnitStatus a1u8 missiles_firing and ! I_UnitStatus a1u8 missiles_reloading and ! I_UnitStatus a1u8 charging and ! I_UnitStatus a1u8 fighting and ! I_UnitStatus a1u8 pursuing and ! I_UnitStatus a1u8 running_amok and ! I_UnitStatus a1u8 dead unit_order_move a1u8 190,145 run if I_CompareCounter u8_missile != 1

set_counter u8_attacking 0 end_if if I_CompareCounter u8_missile = 1 battle_wait 5 set_counter u8_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 8 and ! I_UnitStatus a1u9 routing and ! I_UnitStatus a1u9 moving and ! I_UnitStatus a1u9 missiles_firing and ! I_UnitStatus a1u9 missiles_reloading and ! I_UnitStatus a1u9 charging and ! I_UnitStatus a1u9 fighting and ! I_UnitStatus a1u9 pursuing and ! I_UnitStatus a1u9 running_amok and ! I_UnitStatus a1u9 dead unit_order_move a1u9 190,145 run if I_CompareCounter u9_missile != 1 set_counter u9_attacking 0 end_if if I_CompareCounter u9_missile = 1 battle_wait 5 set_counter u9_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 9 and ! I_UnitStatus a1u10 routing and ! I_UnitStatus a1u10 moving and ! I_UnitStatus a1u10 missiles_firing and ! I_UnitStatus a1u10 missiles_reloading and ! I_UnitStatus a1u10 charging and ! I_UnitStatus a1u10 fighting and ! I_UnitStatus a1u10 pursuing and ! I_UnitStatus a1u10 running_amok and ! I_UnitStatus a1u10 dead unit_order_move a1u10 190,145 run if I_CompareCounter u10_missile != 1 set_counter u10_attacking 0 end_if if I_CompareCounter u10_missile = 1 battle_wait 5 set_counter u10_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 10 and ! I_UnitStatus a1u11 routing and ! I_UnitStatus a1u11 moving and ! I_UnitStatus a1u11 missiles_firing and ! I_UnitStatus a1u11 missiles_reloading and ! I_UnitStatus a1u11 charging and ! I_UnitStatus a1u11 fighting and ! I_UnitStatus a1u11 pursuing and ! I_UnitStatus a1u11 running_amok and ! I_UnitStatus a1u11 dead

unit_order_move a1u11 190,145 run if I_CompareCounter u11_missile != 1 set_counter u11_attacking 0 end_if if I_CompareCounter u11_missile = 1 battle_wait 5 set_counter u11_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 11 and ! I_UnitStatus a1u12 routing and ! I_UnitStatus a1u12 moving and ! I_UnitStatus a1u12 missiles_firing and ! I_UnitStatus a1u12 missiles_reloading and ! I_UnitStatus a1u12 charging and ! I_UnitStatus a1u12 fighting and ! I_UnitStatus a1u12 pursuing and ! I_UnitStatus a1u12 running_amok and ! I_UnitStatus a1u12 dead unit_order_move a1u12 190,145 run if I_CompareCounter u12_missile != 1 set_counter u12_attacking 0 end_if if I_CompareCounter u12_missile = 1 battle_wait 5 set_counter u12_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 12 and ! I_UnitStatus a1u13 routing and ! I_UnitStatus a1u13 moving and ! I_UnitStatus a1u13 missiles_firing and ! I_UnitStatus a1u13 missiles_reloading and ! I_UnitStatus a1u13 charging and ! I_UnitStatus a1u13 fighting and ! I_UnitStatus a1u13 pursuing and ! I_UnitStatus a1u13 running_amok and ! I_UnitStatus a1u13 dead unit_order_move a1u13 190,145 run if I_CompareCounter u13_missile != 1 set_counter u13_attacking 0 end_if if I_CompareCounter u13_missile = 1 battle_wait 5 set_counter u13_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 13 and ! I_UnitStatus a1u14 routing and ! I_UnitStatus a1u14 moving and ! I_UnitStatus a1u14 missiles_firing and ! I_UnitStatus a1u14 missiles_reloading and ! I_UnitStatus a1u14 charging and ! I_UnitStatus a1u14 fighting

and ! I_UnitStatus a1u14 pursuing and ! I_UnitStatus a1u14 running_amok and ! I_UnitStatus a1u14 dead unit_order_move a1u14 190,145 run if I_CompareCounter u14_missile != 1 set_counter u14_attacking 0 end_if if I_CompareCounter u14_missile = 1 battle_wait 5 set_counter u14_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 14 and ! I_UnitStatus a1u15 routing and ! I_UnitStatus a1u15 moving and ! I_UnitStatus a1u15 missiles_firing and ! I_UnitStatus a1u15 missiles_reloading and ! I_UnitStatus a1u15 charging and ! I_UnitStatus a1u15 fighting and ! I_UnitStatus a1u15 pursuing and ! I_UnitStatus a1u15 running_amok and ! I_UnitStatus a1u15 dead unit_order_move a1u15 190,145 run if I_CompareCounter u15_missile != 1 set_counter u15_attacking 0 end_if if I_CompareCounter u15_missile = 1 battle_wait 5 set_counter u15_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 15 and ! I_UnitStatus a1u16 routing and ! I_UnitStatus a1u16 moving and ! I_UnitStatus a1u16 missiles_firing and ! I_UnitStatus a1u16 missiles_reloading and ! I_UnitStatus a1u16 charging and ! I_UnitStatus a1u16 fighting and ! I_UnitStatus a1u16 pursuing and ! I_UnitStatus a1u16 running_amok and ! I_UnitStatus a1u16 dead unit_order_move a1u16 190,145 run if I_CompareCounter u16_missile != 1 set_counter u16_attacking 0 end_if if I_CompareCounter u16_missile = 1 battle_wait 5 set_counter u16_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 16 and ! I_UnitStatus a1u17 routing and ! I_UnitStatus a1u17 moving and ! I_UnitStatus a1u17 missiles_firing

and and and and and and

! ! ! ! ! !

I_UnitStatus I_UnitStatus I_UnitStatus I_UnitStatus I_UnitStatus I_UnitStatus

a1u17 a1u17 a1u17 a1u17 a1u17 a1u17

missiles_reloading charging fighting pursuing running_amok dead

unit_order_move a1u17 190,145 run if I_CompareCounter u17_missile != 1 set_counter u17_attacking 0 end_if if I_CompareCounter u17_missile = 1 battle_wait 5 set_counter u17_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 17 and ! I_UnitStatus a1u18 routing and ! I_UnitStatus a1u18 moving and ! I_UnitStatus a1u18 missiles_firing and ! I_UnitStatus a1u18 missiles_reloading and ! I_UnitStatus a1u18 charging and ! I_UnitStatus a1u18 fighting and ! I_UnitStatus a1u18 pursuing and ! I_UnitStatus a1u18 running_amok and ! I_UnitStatus a1u18 dead unit_order_move a1u18 190,145 run if I_CompareCounter u18_missile != 1 set_counter u18_attacking 0 end_if if I_CompareCounter u18_missile = 1 battle_wait 5 set_counter u18_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 18 and ! I_UnitStatus a1u19 routing and ! I_UnitStatus a1u19 moving and ! I_UnitStatus a1u19 missiles_firing and ! I_UnitStatus a1u19 missiles_reloading and ! I_UnitStatus a1u19 charging and ! I_UnitStatus a1u19 fighting and ! I_UnitStatus a1u19 pursuing and ! I_UnitStatus a1u19 running_amok and ! I_UnitStatus a1u19 dead unit_order_move a1u19 190,145 run if I_CompareCounter u19_missile != 1 set_counter u19_attacking 0 end_if if I_CompareCounter u19_missile = 1 battle_wait 5 set_counter u19_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count = 20

and and and and and and and and and

! ! ! ! ! ! ! ! !

I_UnitStatus I_UnitStatus I_UnitStatus I_UnitStatus I_UnitStatus I_UnitStatus I_UnitStatus I_UnitStatus I_UnitStatus

a1u20 a1u20 a1u20 a1u20 a1u20 a1u20 a1u20 a1u20 a1u20

routing moving missiles_firing missiles_reloading charging fighting pursuing running_amok dead

unit_order_move a1u20 190,145 run if I_CompareCounter u20_missile != 1 set_counter u20_attacking 0 end_if if I_CompareCounter u20_missile = 1 battle_wait 5 set_counter u20_attacking 0 end_if end_if battle_wait 15 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter imladris_siege_check = 2 and I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker if I_CompareCounter enemy_unit_count > 0 and I_CompareCounter g1_attacking = 0 and ! I_UnitStatus a1g1 fighting and ! I_UnitStatus a1g1 pursuing and ! I_UnitStatus a1g1 charging and ! I_IsUnitRouting a1g1 if I_UnitEnemyUnitInRadius a1g1 90 and I_CompareCounter g1_missile = 0 unit_order_attack_closest_unit a1g1 270 run set_counter g1_attacking 1 end_if if I_UnitEnemyUnitInRadius a1g1 55 and I_CompareCounter g1_missile = 1 if I_UnitPercentageAmmoLeft a1g1 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a1g1 end_if if I_UnitPercentageAmmoLeft a1g1 > 0 and I_CompareCounter melee_count = -1 unit_order_move a1g1 190,145 run end_if if I_UnitPercentageAmmoLeft a1g1 = 0 unit_order_attack_closest_unit a1g1 270 run end_if set_counter g1_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 1 and I_CompareCounter u2_attacking = 0

and and and and

! ! ! !

I_UnitStatus a1u2 fighting I_UnitStatus a1u2 pursuing I_UnitStatus a1u2 charging I_IsUnitRouting a1u2

if I_UnitEnemyUnitInRadius a1u2 90 and I_CompareCounter u2_missile = 0 unit_order_attack_closest_unit a1u2 270 run set_counter u2_attacking 1 end_if if I_UnitEnemyUnitInRadius a1u2 55 and I_CompareCounter u2_missile = 1 if I_UnitPercentageAmmoLeft a1u2 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a1u2 end_if if I_UnitPercentageAmmoLeft a1u2 > 0 and I_CompareCounter melee_count = -1 unit_order_move a1u2 190,145 run end_if if I_UnitPercentageAmmoLeft a1u2 = 0 unit_order_attack_closest_unit a1u2 270 run end_if set_counter u2_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 2 and I_CompareCounter u3_attacking = 0 and ! I_UnitStatus a1u3 fighting and ! I_UnitStatus a1u3 pursuing and ! I_UnitStatus a1u3 charging and ! I_IsUnitRouting a1u3 if I_UnitEnemyUnitInRadius a1u3 90 and I_CompareCounter u3_missile = 0 unit_order_attack_closest_unit a1u3 270 run set_counter u3_attacking 1 end_if if I_UnitEnemyUnitInRadius a1u3 55 and I_CompareCounter u3_missile = 1 if I_UnitPercentageAmmoLeft a1u3 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a1u3 end_if if I_UnitPercentageAmmoLeft a1u3 > 0 and I_CompareCounter melee_count = -1 unit_order_move a1u3 190,145 run end_if if I_UnitPercentageAmmoLeft a1u3 = 0 unit_order_attack_closest_unit a1u3 270 run end_if set_counter u3_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 3 and I_CompareCounter u4_attacking = 0

and and and and

! ! ! !

I_UnitStatus a1u4 fighting I_UnitStatus a1u4 pursuing I_UnitStatus a1u4 charging I_IsUnitRouting a1u4

if I_UnitEnemyUnitInRadius a1u4 90 and I_CompareCounter u4_missile = 0 unit_order_attack_closest_unit a1u4 270 run set_counter u4_attacking 1 end_if if I_UnitEnemyUnitInRadius a1u4 55 and I_CompareCounter u4_missile = 1 if I_UnitPercentageAmmoLeft a1u4 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a1u4 end_if if I_UnitPercentageAmmoLeft a1u4 > 0 and I_CompareCounter melee_count = -1 unit_order_move a1u4 190,145 run end_if if I_UnitPercentageAmmoLeft a1u4 = 0 unit_order_attack_closest_unit a1u4 270 run end_if set_counter u4_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 4 and I_CompareCounter u5_attacking = 0 and ! I_UnitStatus a1u5 fighting and ! I_UnitStatus a1u5 pursuing and ! I_UnitStatus a1u5 charging and ! I_IsUnitRouting a1u5 if I_UnitEnemyUnitInRadius a1u5 90 and I_CompareCounter u5_missile = 0 unit_order_attack_closest_unit a1u5 270 run set_counter u5_attacking 1 end_if if I_UnitEnemyUnitInRadius a1u5 55 and I_CompareCounter u5_missile = 1 if I_UnitPercentageAmmoLeft a1u5 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a1u5 end_if if I_UnitPercentageAmmoLeft a1u5 > 0 and I_CompareCounter melee_count = -1 unit_order_move a1u5 190,145 run end_if if I_UnitPercentageAmmoLeft a1u5 = 0 unit_order_attack_closest_unit a1u5 270 run end_if set_counter u5_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 5 and I_CompareCounter u6_attacking = 0

and and and and

! ! ! !

I_UnitStatus a1u6 fighting I_UnitStatus a1u6 pursuing I_UnitStatus a1u6 charging I_IsUnitRouting a1u6

if I_UnitEnemyUnitInRadius a1u6 90 and I_CompareCounter u6_missile = 0 unit_order_attack_closest_unit a1u6 270 run set_counter u6_attacking 1 end_if if I_UnitEnemyUnitInRadius a1u6 55 and I_CompareCounter u6_missile = 1 if I_UnitPercentageAmmoLeft a1u6 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a1u6 end_if if I_UnitPercentageAmmoLeft a1u6 > 0 and I_CompareCounter melee_count = -1 unit_order_move a1u6 190,145 run end_if if I_UnitPercentageAmmoLeft a1u6 = 0 unit_order_attack_closest_unit a1u6 270 run end_if set_counter u6_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 6 and I_CompareCounter u7_attacking = 0 and ! I_UnitStatus a1u7 fighting and ! I_UnitStatus a1u7 pursuing and ! I_UnitStatus a1u7 charging and ! I_IsUnitRouting a1u7 if I_UnitEnemyUnitInRadius a1u7 90 and I_CompareCounter u7_missile = 0 unit_order_attack_closest_unit a1u7 270 run set_counter u7_attacking 1 end_if if I_UnitEnemyUnitInRadius a1u7 55 and I_CompareCounter u7_missile = 1 if I_UnitPercentageAmmoLeft a1u7 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a1u7 end_if if I_UnitPercentageAmmoLeft a1u7 > 0 and I_CompareCounter melee_count = -1 unit_order_move a1u7 190,145 run end_if if I_UnitPercentageAmmoLeft a1u7 = 0 unit_order_attack_closest_unit a1u7 270 run end_if set_counter u7_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 7 and I_CompareCounter u8_attacking = 0

and and and and

! ! ! !

I_UnitStatus a1u8 fighting I_UnitStatus a1u8 pursuing I_UnitStatus a1u8 charging I_IsUnitRouting a1u8

if I_UnitEnemyUnitInRadius a1u8 90 and I_CompareCounter u8_missile = 0 unit_order_attack_closest_unit a1u8 270 run set_counter u8_attacking 1 end_if if I_UnitEnemyUnitInRadius a1u8 55 and I_CompareCounter u8_missile = 1 if I_UnitPercentageAmmoLeft a1u8 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a1u8 end_if if I_UnitPercentageAmmoLeft a1u8 > 0 and I_CompareCounter melee_count = -1 unit_order_move a1u8 190,145 run end_if if I_UnitPercentageAmmoLeft a1u8 = 0 unit_order_attack_closest_unit a1u8 270 run end_if set_counter u8_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 8 and I_CompareCounter u9_attacking = 0 and ! I_UnitStatus a1u9 fighting and ! I_UnitStatus a1u9 pursuing and ! I_UnitStatus a1u9 charging and ! I_IsUnitRouting a1u9 if I_UnitEnemyUnitInRadius a1u9 90 and I_CompareCounter u9_missile = 0 unit_order_attack_closest_unit a1u9 270 run set_counter u9_attacking 1 end_if if I_UnitEnemyUnitInRadius a1u9 55 and I_CompareCounter u9_missile = 1 if I_UnitPercentageAmmoLeft a1u9 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a1u9 end_if if I_UnitPercentageAmmoLeft a1u9 > 0 and I_CompareCounter melee_count = -1 unit_order_move a1u9 190,145 run end_if if I_UnitPercentageAmmoLeft a1u9 = 0 unit_order_attack_closest_unit a1u9 270 run end_if set_counter u9_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 9 and I_CompareCounter u10_attacking = 0

and and and and

! ! ! !

I_UnitStatus a1u10 fighting I_UnitStatus a1u10 pursuing I_UnitStatus a1u10 charging I_IsUnitRouting a1u10

if I_UnitEnemyUnitInRadius a1u10 90 and I_CompareCounter u10_missile = 0 unit_order_attack_closest_unit a1u10 270 run set_counter u10_attacking 1 end_if if I_UnitEnemyUnitInRadius a1u10 55 and I_CompareCounter u10_missile = 1 if I_UnitPercentageAmmoLeft a1u10 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a1u10 end_if if I_UnitPercentageAmmoLeft a1u10 > 0 and I_CompareCounter melee_count = -1 unit_order_move a1u10 190,145 run end_if if I_UnitPercentageAmmoLeft a1u10 = 0 unit_order_attack_closest_unit a1u10 270 run end_if set_counter u10_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 10 and I_CompareCounter u11_attacking = 0 and ! I_UnitStatus a1u11 fighting and ! I_UnitStatus a1u11 pursuing and ! I_UnitStatus a1u11 charging and ! I_IsUnitRouting a1u11 if I_UnitEnemyUnitInRadius a1u11 90 and I_CompareCounter u11_missile = 0 unit_order_attack_closest_unit a1u11 270 run set_counter u11_attacking 1 end_if if I_UnitEnemyUnitInRadius a1u11 55 and I_CompareCounter u11_missile = 1 if I_UnitPercentageAmmoLeft a1u11 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a1u11 end_if if I_UnitPercentageAmmoLeft a1u11 > 0 and I_CompareCounter melee_count = -1 unit_order_move a1u11 190,145 run end_if if I_UnitPercentageAmmoLeft a1u11 = 0 unit_order_attack_closest_unit a1u11 270 run end_if set_counter u11_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 11 and I_CompareCounter u12_attacking = 0

and and and and

! ! ! !

I_UnitStatus a1u12 fighting I_UnitStatus a1u12 pursuing I_UnitStatus a1u12 charging I_IsUnitRouting a1u12

if I_UnitEnemyUnitInRadius a1u12 90 and I_CompareCounter u12_missile = 0 unit_order_attack_closest_unit a1u12 270 run set_counter u12_attacking 1 end_if if I_UnitEnemyUnitInRadius a1u12 55 and I_CompareCounter u12_missile = 1 if I_UnitPercentageAmmoLeft a1u12 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a1u12 end_if if I_UnitPercentageAmmoLeft a1u12 > 0 and I_CompareCounter melee_count = -1 unit_order_move a1u12 190,145 run end_if if I_UnitPercentageAmmoLeft a1u12 = 0 unit_order_attack_closest_unit a1u12 270 run end_if set_counter u12_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 12 and I_CompareCounter u13_attacking = 0 and ! I_UnitStatus a1u13 fighting and ! I_UnitStatus a1u13 pursuing and ! I_UnitStatus a1u13 charging and ! I_IsUnitRouting a1u13 if I_UnitEnemyUnitInRadius a1u13 90 and I_CompareCounter u13_missile = 0 unit_order_attack_closest_unit a1u13 270 run set_counter u13_attacking 1 end_if if I_UnitEnemyUnitInRadius a1u13 55 and I_CompareCounter u13_missile = 1 if I_UnitPercentageAmmoLeft a1u13 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a1u13 end_if if I_UnitPercentageAmmoLeft a1u13 > 0 and I_CompareCounter melee_count = -1 unit_order_move a1u13 190,145 run end_if if I_UnitPercentageAmmoLeft a1u13 = 0 unit_order_attack_closest_unit a1u13 270 run end_if set_counter u13_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 13 and I_CompareCounter u14_attacking = 0

and and and and

! ! ! !

I_UnitStatus a1u14 fighting I_UnitStatus a1u14 pursuing I_UnitStatus a1u14 charging I_IsUnitRouting a1u14

if I_UnitEnemyUnitInRadius a1u14 90 and I_CompareCounter u14_missile = 0 unit_order_attack_closest_unit a1u14 270 run set_counter u14_attacking 1 end_if if I_UnitEnemyUnitInRadius a1u14 55 and I_CompareCounter u14_missile = 1 if I_UnitPercentageAmmoLeft a1u14 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a1u14 end_if if I_UnitPercentageAmmoLeft a1u14 > 0 and I_CompareCounter melee_count = -1 unit_order_move a1u14 190,145 run end_if if I_UnitPercentageAmmoLeft a1u14 = 0 unit_order_attack_closest_unit a1u14 270 run end_if set_counter u14_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 14 and I_CompareCounter u15_attacking = 0 and ! I_UnitStatus a1u15 fighting and ! I_UnitStatus a1u15 pursuing and ! I_UnitStatus a1u15 charging and ! I_IsUnitRouting a1u15 if I_UnitEnemyUnitInRadius a1u15 90 and I_CompareCounter u15_missile = 0 unit_order_attack_closest_unit a1u15 270 run set_counter u15_attacking 1 end_if if I_UnitEnemyUnitInRadius a1u15 55 and I_CompareCounter u15_missile = 1 if I_UnitPercentageAmmoLeft a1u15 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a1u15 end_if if I_UnitPercentageAmmoLeft a1u15 > 0 and I_CompareCounter melee_count = -1 unit_order_move a1u15 190,145 run end_if if I_UnitPercentageAmmoLeft a1u15 = 0 unit_order_attack_closest_unit a1u15 270 run end_if set_counter u15_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 15 and I_CompareCounter u16_attacking = 0

and and and and

! ! ! !

I_UnitStatus a1u16 fighting I_UnitStatus a1u16 pursuing I_UnitStatus a1u16 charging I_IsUnitRouting a1u16

if I_UnitEnemyUnitInRadius a1u16 90 and I_CompareCounter u16_missile = 0 unit_order_attack_closest_unit a1u16 270 run set_counter u16_attacking 1 end_if if I_UnitEnemyUnitInRadius a1u16 55 and I_CompareCounter u16_missile = 1 if I_UnitPercentageAmmoLeft a1u16 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a1u16 end_if if I_UnitPercentageAmmoLeft a1u16 > 0 and I_CompareCounter melee_count = -1 unit_order_move a1u16 190,145 run end_if if I_UnitPercentageAmmoLeft a1u16 = 0 unit_order_attack_closest_unit a1u16 270 run end_if set_counter u16_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 16 and I_CompareCounter u17_attacking = 0 and ! I_UnitStatus a1u17 fighting and ! I_UnitStatus a1u17 pursuing and ! I_UnitStatus a1u17 charging and ! I_IsUnitRouting a1u17 if I_UnitEnemyUnitInRadius a1u17 90 and I_CompareCounter u17_missile = 0 unit_order_attack_closest_unit a1u17 270 run set_counter u17_attacking 1 end_if if I_UnitEnemyUnitInRadius a1u17 55 and I_CompareCounter u17_missile = 1 if I_UnitPercentageAmmoLeft a1u17 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a1u17 end_if if I_UnitPercentageAmmoLeft a1u17 > 0 and I_CompareCounter melee_count = -1 unit_order_move a1u17 190,145 run end_if if I_UnitPercentageAmmoLeft a1u17 = 0 unit_order_attack_closest_unit a1u17 270 run end_if set_counter u17_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 17 and I_CompareCounter u18_attacking = 0

and and and and

! ! ! !

I_UnitStatus a1u18 fighting I_UnitStatus a1u18 pursuing I_UnitStatus a1u18 charging I_IsUnitRouting a1u18

if I_UnitEnemyUnitInRadius a1u18 90 and I_CompareCounter u18_missile = 0 unit_order_attack_closest_unit a1u18 270 run set_counter u18_attacking 1 end_if if I_UnitEnemyUnitInRadius a1u18 55 and I_CompareCounter u18_missile = 1 if I_UnitPercentageAmmoLeft a1u18 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a1u18 end_if if I_UnitPercentageAmmoLeft a1u18 > 0 and I_CompareCounter melee_count = -1 unit_order_move a1u18 190,145 run end_if if I_UnitPercentageAmmoLeft a1u18 = 0 unit_order_attack_closest_unit a1u18 270 run end_if set_counter u18_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 18 and I_CompareCounter u19_attacking = 0 and ! I_UnitStatus a1u19 fighting and ! I_UnitStatus a1u19 pursuing and ! I_UnitStatus a1u19 charging and ! I_IsUnitRouting a1u19 if I_UnitEnemyUnitInRadius a1u19 90 and I_CompareCounter u19_missile = 0 unit_order_attack_closest_unit a1u19 270 run set_counter u19_attacking 1 end_if if I_UnitEnemyUnitInRadius a1u19 55 and I_CompareCounter u19_missile = 1 if I_UnitPercentageAmmoLeft a1u19 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a1u19 end_if if I_UnitPercentageAmmoLeft a1u19 > 0 and I_CompareCounter melee_count = -1 unit_order_move a1u19 190,145 run end_if if I_UnitPercentageAmmoLeft a1u19 = 0 unit_order_attack_closest_unit a1u19 270 run end_if set_counter u19_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count = 20 and I_CompareCounter u20_attacking = 0

and and and and

! ! ! !

I_UnitStatus a1u20 fighting I_UnitStatus a1u20 pursuing I_UnitStatus a1u20 charging I_IsUnitRouting a1u20

if I_UnitEnemyUnitInRadius a1u20 90 and I_CompareCounter u20_missile = 0 unit_order_attack_closest_unit a1u20 270 run set_counter u20_attacking 1 end_if if I_UnitEnemyUnitInRadius a1u20 55 and I_CompareCounter u20_missile = 1 if I_UnitPercentageAmmoLeft a1u20 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a1u20 end_if if I_UnitPercentageAmmoLeft a1u20 > 0 and I_CompareCounter melee_count = -1 unit_order_move a1u20 190,145 run end_if if I_UnitPercentageAmmoLeft a1u20 = 0 unit_order_attack_closest_unit a1u20 270 run end_if set_counter u20_attacking 1 end_if end_if battle_wait 2 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter imladris_siege_check = 2 and I_CompareCounter melee_count >= 0 and I_BattleIsSiegeBattle and ! I_BattlePlayerArmyIsAttacker if I_CompareCounter enemy_unit_count > 0 and I_CompareCounter g1_missile = 0 and I_CompareCounter g1_lock = 0 if I_PercentageUnitKilled a1g1 > 85 set_counter g1_lock 1 end_if if I_IsUnitRouting a1g1 set_counter g1_lock 1 end_if if I_UnitDestroyed a1g1 set_counter g1_lock 1 end_if if I_UnitStatus a1g1 running_amok set_counter g1_lock 1 end_if if I_CompareCounter g1_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 1 and I_CompareCounter u2_missile = 0

and I_CompareCounter u2_lock = 0 if I_PercentageUnitKilled a1u2 > 85 set_counter u2_lock 1 end_if if I_IsUnitRouting a1u2 set_counter u2_lock 1 end_if if I_UnitDestroyed a1u2 set_counter u2_lock 1 end_if if I_UnitStatus a1u2 running_amok set_counter u2_lock 1 end_if if I_CompareCounter u2_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 2 and I_CompareCounter u3_missile = 0 and I_CompareCounter u3_lock = 0 if I_PercentageUnitKilled a1u3 > 85 set_counter u3_lock 1 end_if if I_IsUnitRouting a1u3 set_counter u3_lock 1 end_if if I_UnitDestroyed a1u3 set_counter u3_lock 1 end_if if I_UnitStatus a1u3 running_amok set_counter u3_lock 1 end_if if I_CompareCounter u3_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 3 and I_CompareCounter u4_missile = 0 and I_CompareCounter u4_lock = 0 if I_PercentageUnitKilled a1u4 > 85 set_counter u4_lock 1 end_if if I_IsUnitRouting a1u4 set_counter u4_lock 1 end_if if I_UnitDestroyed a1u4 set_counter u4_lock 1 end_if if I_UnitStatus a1u4 running_amok set_counter u4_lock 1 end_if if I_CompareCounter u4_lock = 1 inc_counter melee_count -1 end_if end_if

if I_CompareCounter enemy_unit_count > 4 and I_CompareCounter u5_missile = 0 and I_CompareCounter u5_lock = 0 if I_PercentageUnitKilled a1u5 > 85 set_counter u5_lock 1 end_if if I_IsUnitRouting a1u5 set_counter u5_lock 1 end_if if I_UnitDestroyed a1u5 set_counter u5_lock 1 end_if if I_UnitStatus a1u5 running_amok set_counter u5_lock 1 end_if if I_CompareCounter u5_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 5 and I_CompareCounter u6_missile = 0 and I_CompareCounter u6_lock = 0 if I_PercentageUnitKilled a1u6 > 85 set_counter u6_lock 1 end_if if I_IsUnitRouting a1u6 set_counter u6_lock 1 end_if if I_UnitDestroyed a1u6 set_counter u6_lock 1 end_if if I_UnitStatus a1u6 running_amok set_counter u6_lock 1 end_if if I_CompareCounter u6_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 6 and I_CompareCounter u7_missile = 0 and I_CompareCounter u7_lock = 0 if I_PercentageUnitKilled a1u7 > 85 set_counter u7_lock 1 end_if if I_IsUnitRouting a1u7 set_counter u7_lock 1 end_if if I_UnitDestroyed a1u7 set_counter u7_lock 1 end_if if I_UnitStatus a1u7 running_amok set_counter u7_lock 1 end_if if I_CompareCounter u7_lock = 1

inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 7 and I_CompareCounter u8_missile = 0 and I_CompareCounter u8_lock = 0 if I_PercentageUnitKilled a1u8 > 85 set_counter u8_lock 1 end_if if I_IsUnitRouting a1u8 set_counter u8_lock 1 end_if if I_UnitDestroyed a1u8 set_counter u8_lock 1 end_if if I_UnitStatus a1u8 running_amok set_counter u8_lock 1 end_if if I_CompareCounter u8_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 8 and I_CompareCounter u9_missile = 0 and I_CompareCounter u9_lock = 0 if I_PercentageUnitKilled a1u9 > 85 set_counter u9_lock 1 end_if if I_IsUnitRouting a1u9 set_counter u9_lock 1 end_if if I_UnitDestroyed a1u9 set_counter u9_lock 1 end_if if I_UnitStatus a1u9 running_amok set_counter u9_lock 1 end_if if I_CompareCounter u9_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 9 and I_CompareCounter u10_missile = 0 and I_CompareCounter u10_lock = 0 if I_PercentageUnitKilled a1u10 > 85 set_counter u10_lock 1 end_if if I_IsUnitRouting a1u10 set_counter u10_lock 1 end_if if I_UnitDestroyed a1u10 set_counter u10_lock 1 end_if if I_UnitStatus a1u10 running_amok

set_counter u10_lock 1 end_if if I_CompareCounter u10_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 10 and I_CompareCounter u11_missile = 0 and I_CompareCounter u11_lock = 0 if I_PercentageUnitKilled a1u11 > 85 set_counter u11_lock 1 end_if if I_IsUnitRouting a1u11 set_counter u11_lock 1 end_if if I_UnitDestroyed a1u11 set_counter u11_lock 1 end_if if I_UnitStatus a1u11 running_amok set_counter u11_lock 1 end_if if I_CompareCounter u11_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 11 and I_CompareCounter u12_missile = 0 and I_CompareCounter u12_lock = 0 if I_PercentageUnitKilled a1u12 > 85 set_counter u12_lock 1 end_if if I_IsUnitRouting a1u12 set_counter u12_lock 1 end_if if I_UnitDestroyed a1u12 set_counter u12_lock 1 end_if if I_UnitStatus a1u12 running_amok set_counter u12_lock 1 end_if if I_CompareCounter u12_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 12 and I_CompareCounter u13_missile = 0 and I_CompareCounter u13_lock = 0 if I_PercentageUnitKilled a1u13 > 85 set_counter u13_lock 1 end_if if I_IsUnitRouting a1u13 set_counter u13_lock 1 end_if if I_UnitDestroyed a1u13

set_counter u13_lock 1 end_if if I_UnitStatus a1u13 running_amok set_counter u13_lock 1 end_if if I_CompareCounter u13_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 13 and I_CompareCounter u14_missile = 0 and I_CompareCounter u14_lock = 0 if I_PercentageUnitKilled a1u14 > 85 set_counter u14_lock 1 end_if if I_IsUnitRouting a1u14 set_counter u14_lock 1 end_if if I_UnitDestroyed a1u14 set_counter u14_lock 1 end_if if I_UnitStatus a1u14 running_amok set_counter u14_lock 1 end_if if I_CompareCounter u14_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 14 and I_CompareCounter u15_missile = 0 and I_CompareCounter u15_lock = 0 if I_PercentageUnitKilled a1u15 > 85 set_counter u15_lock 1 end_if if I_IsUnitRouting a1u15 set_counter u15_lock 1 end_if if I_UnitDestroyed a1u15 set_counter u15_lock 1 end_if if I_UnitStatus a1u15 running_amok set_counter u15_lock 1 end_if if I_CompareCounter u15_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 15 and I_CompareCounter u16_missile = 0 and I_CompareCounter u16_lock = 0 if I_PercentageUnitKilled a1u16 > 85 set_counter u16_lock 1 end_if if I_IsUnitRouting a1u16

set_counter u16_lock 1 end_if if I_UnitDestroyed a1u16 set_counter u16_lock 1 end_if if I_UnitStatus a1u16 running_amok set_counter u16_lock 1 end_if if I_CompareCounter u16_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 16 and I_CompareCounter u17_missile = 0 and I_CompareCounter u17_lock = 0 if I_PercentageUnitKilled a1u17 > 85 set_counter u17_lock 1 end_if if I_IsUnitRouting a1u17 set_counter u17_lock 1 end_if if I_UnitDestroyed a1u17 set_counter u17_lock 1 end_if if I_UnitStatus a1u17 running_amok set_counter u17_lock 1 end_if if I_CompareCounter u17_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 17 and I_CompareCounter u18_missile = 0 and I_CompareCounter u18_lock = 0 if I_PercentageUnitKilled a1u18 > 85 set_counter u18_lock 1 end_if if I_IsUnitRouting a1u18 set_counter u18_lock 1 end_if if I_UnitDestroyed a1u18 set_counter u18_lock 1 end_if if I_UnitStatus a1u18 running_amok set_counter u18_lock 1 end_if if I_CompareCounter u18_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 18 and I_CompareCounter u19_missile = 0 and I_CompareCounter u19_lock = 0 if I_PercentageUnitKilled a1u19 > 85

set_counter u19_lock 1 end_if if I_IsUnitRouting a1u19 set_counter u19_lock 1 end_if if I_UnitDestroyed a1u19 set_counter u19_lock 1 end_if if I_UnitStatus a1u19 running_amok set_counter u19_lock 1 end_if if I_CompareCounter u19_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count = 20 and I_CompareCounter u20_missile = 0 and I_CompareCounter u20_lock = 0 if I_PercentageUnitKilled a1u20 > 85 set_counter u20_lock 1 end_if if I_IsUnitRouting a1u20 set_counter u20_lock 1 end_if if I_UnitDestroyed a1u20 set_counter u20_lock 1 end_if if I_UnitStatus a1u20 running_amok set_counter u20_lock 1 end_if if I_CompareCounter u20_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter melee_count < 2 if I_CompareCounter enemy_unit_count > 0 and I_CompareCounter g1_missile = 1 and ! I_UnitStatus a1g1 fighting and ! I_UnitStatus a1g1 pursuing and ! I_UnitStatus a1g1 charging unit_order_move a1g1 190,145 run set_counter g1_attacking 0 end_if if I_CompareCounter enemy_unit_count > 1 and I_CompareCounter u2_missile = 1 and ! I_UnitStatus a1u2 fighting and ! I_UnitStatus a1u2 pursuing and ! I_UnitStatus a1u2 charging unit_order_move a1u2 190,145 run set_counter u2_attacking 0 end_if if I_CompareCounter enemy_unit_count > 2

and and and and

I_CompareCounter u3_missile = 1 ! I_UnitStatus a1u3 fighting ! I_UnitStatus a1u3 pursuing ! I_UnitStatus a1u3 charging

unit_order_move a1u3 190,145 run set_counter u3_attacking 0 end_if if I_CompareCounter enemy_unit_count > 3 and I_CompareCounter u4_missile = 1 and ! I_UnitStatus a1u4 fighting and ! I_UnitStatus a1u4 pursuing and ! I_UnitStatus a1u4 charging unit_order_move a1u4 190,145 run set_counter u4_attacking 0 end_if if I_CompareCounter enemy_unit_count > 4 and I_CompareCounter u5_missile = 1 and ! I_UnitStatus a1u5 fighting and ! I_UnitStatus a1u5 pursuing and ! I_UnitStatus a1u5 charging unit_order_move a1u5 190,145 run set_counter u5_attacking 0 end_if if I_CompareCounter enemy_unit_count > 5 and I_CompareCounter u6_missile = 1 and ! I_UnitStatus a1u6 fighting and ! I_UnitStatus a1u6 pursuing and ! I_UnitStatus a1u6 charging unit_order_move a1u6 190,145 run set_counter u6_attacking 0 end_if if I_CompareCounter enemy_unit_count > 6 and I_CompareCounter u7_missile = 1 and ! I_UnitStatus a1u7 fighting and ! I_UnitStatus a1u7 pursuing and ! I_UnitStatus a1u7 charging unit_order_move a1u7 190,145 run set_counter u7_attacking 0 end_if if I_CompareCounter enemy_unit_count > 7 and I_CompareCounter u8_missile = 1 and ! I_UnitStatus a1u8 fighting and ! I_UnitStatus a1u8 pursuing and ! I_UnitStatus a1u8 charging unit_order_move a1u8 190,145 run set_counter u8_attacking 0 end_if if I_CompareCounter enemy_unit_count > 8

and and and and

I_CompareCounter u9_missile = 1 ! I_UnitStatus a1u9 fighting ! I_UnitStatus a1u9 pursuing ! I_UnitStatus a1u9 charging

unit_order_move a1u9 190,145 run set_counter u9_attacking 0 end_if if I_CompareCounter enemy_unit_count > 9 and I_CompareCounter u10_missile = 1 and ! I_UnitStatus a1u10 fighting and ! I_UnitStatus a1u10 pursuing and ! I_UnitStatus a1u10 charging unit_order_move a1u10 190,145 run set_counter u10_attacking 0 end_if if I_CompareCounter enemy_unit_count > 10 and I_CompareCounter u11_missile = 1 and ! I_UnitStatus a1u11 fighting and ! I_UnitStatus a1u11 pursuing and ! I_UnitStatus a1u11 charging unit_order_move a1u11 190,145 run set_counter u11_attacking 0 end_if if I_CompareCounter enemy_unit_count > 11 and I_CompareCounter u12_missile = 1 and ! I_UnitStatus a1u12 fighting and ! I_UnitStatus a1u12 pursuing and ! I_UnitStatus a1u12 charging unit_order_move a1u12 190,145 run set_counter u12_attacking 0 end_if if I_CompareCounter enemy_unit_count > 12 and I_CompareCounter u13_missile = 1 and ! I_UnitStatus a1u13 fighting and ! I_UnitStatus a1u13 pursuing and ! I_UnitStatus a1u13 charging unit_order_move a1u13 190,145 run set_counter u13_attacking 0 end_if if I_CompareCounter enemy_unit_count > 13 and I_CompareCounter u14_missile = 1 and ! I_UnitStatus a1u14 fighting and ! I_UnitStatus a1u14 pursuing and ! I_UnitStatus a1u14 charging unit_order_move a1u14 190,145 run set_counter u14_attacking 0 end_if if I_CompareCounter enemy_unit_count > 14

and and and and

I_CompareCounter u15_missile = 1 ! I_UnitStatus a1u15 fighting ! I_UnitStatus a1u15 pursuing ! I_UnitStatus a1u15 charging

unit_order_move a1u15 190,145 run set_counter u15_attacking 0 end_if if I_CompareCounter enemy_unit_count > 15 and I_CompareCounter u16_missile = 1 and ! I_UnitStatus a1u16 fighting and ! I_UnitStatus a1u16 pursuing and ! I_UnitStatus a1u16 charging unit_order_move a1u16 190,145 run set_counter u16_attacking 0 end_if if I_CompareCounter enemy_unit_count > 16 and I_CompareCounter u17_missile = 1 and ! I_UnitStatus a1u17 fighting and ! I_UnitStatus a1u17 pursuing and ! I_UnitStatus a1u17 charging unit_order_move a1u17 190,145 run set_counter u17_attacking 0 end_if if I_CompareCounter enemy_unit_count > 17 and I_CompareCounter u18_missile = 1 and ! I_UnitStatus a1u18 fighting and ! I_UnitStatus a1u18 pursuing and ! I_UnitStatus a1u18 charging unit_order_move a1u18 190,145 run set_counter u18_attacking 0 end_if if I_CompareCounter enemy_unit_count > 18 and I_CompareCounter u19_missile = 1 and ! I_UnitStatus a1u19 fighting and ! I_UnitStatus a1u19 pursuing and ! I_UnitStatus a1u19 charging unit_order_move a1u19 190,145 run set_counter u19_attacking 0 end_if if I_CompareCounter enemy_unit_count = 20 and I_CompareCounter u20_missile = 1 and ! I_UnitStatus a1u20 fighting and ! I_UnitStatus a1u20 pursuing and ! I_UnitStatus a1u20 charging unit_order_move a1u20 190,145 run set_counter u20_attacking 0 end_if set_counter melee_count -1

end_if battle_wait 20 end_monitor ;;;;;;;Imladris AI Sally monitor_conditions I_BattleStarted and I_CompareCounter imladris_sally_check = 1 and I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker set_counter enemy_unit_count 0 if I_BattleEnemyArmyNumberOfUnits label_unit 1 0 0 a2g1 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 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 > 0 > 1 > 2 > 3 > 4 > 5 > 6 > 7 > 8 > 9 > 10 > 11 > 12 > 13 > 14 > 15

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 end_if end_if end_if end_if end_if end_if

> 16 > 17 > 18 = 20

label_location -150, -215, imladris_assault unit_group_immediate_place army2 imladris_assault 0 battle_wait 0.5 unit_group_order_halt army2 battle_wait 0.1 unit_group_set_guard_mode army2 off battle_wait 0.1 unit_group_set_skirmish_mode army2 off battle_wait 0.1 unit_group_set_fire_at_will_mode army2 on battle_wait 0.1 if I_CompareCounter enemy_unit_count > 0 and I_CompareCounter g1_missile = 0 if I_UnitPercentageAmmoLeft a2g1 > 0 inc_counter melee_count -1 set_counter g1_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a2g1 = horde set_counter g1_missile 2 end_if end_if

inc_counter melee_count 1 unit_order_move a2g1 190,145 end_if if I_CompareCounter enemy_unit_count > 1 and I_CompareCounter u2_missile = 0 if I_UnitPercentageAmmoLeft a2u2 > 0 inc_counter melee_count -1 set_counter u2_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a2u2 = horde set_counter u2_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a2u2 190,145 end_if if I_CompareCounter enemy_unit_count > 2 and I_CompareCounter u3_missile = 0 if I_UnitPercentageAmmoLeft a2u3 > 0 inc_counter melee_count -1 set_counter u3_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a2u3 = horde set_counter u3_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a2u3 190,145 end_if if I_CompareCounter enemy_unit_count > 3 and I_CompareCounter u4_missile = 0 if I_UnitPercentageAmmoLeft a2u4 > 0 inc_counter melee_count -1 set_counter u4_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a2u4 = horde set_counter u4_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a2u4 190,145 end_if if I_CompareCounter enemy_unit_count > 4 and I_CompareCounter u5_missile = 0 if I_UnitPercentageAmmoLeft a2u5 > 0 inc_counter melee_count -1 set_counter u5_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a2u5 = horde set_counter u5_missile 2 end_if end_if

inc_counter melee_count 1 unit_order_move a2u5 190,145 end_if if I_CompareCounter enemy_unit_count > 5 and I_CompareCounter u6_missile = 0 if I_UnitPercentageAmmoLeft a2u6 > 0 inc_counter melee_count -1 set_counter u6_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a2u6 = horde set_counter u6_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a2u6 190,145 end_if if I_CompareCounter enemy_unit_count > 6 and I_CompareCounter u7_missile = 0 if I_UnitPercentageAmmoLeft a2u7 > 0 inc_counter melee_count -1 set_counter u7_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a2u7 = horde set_counter u7_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a2u7 190,145 end_if if I_CompareCounter enemy_unit_count > 7 and I_CompareCounter u8_missile = 0 if I_UnitPercentageAmmoLeft a2u8 > 0 inc_counter melee_count -1 set_counter u8_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a2u8 = horde set_counter u8_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a2u8 190,145 end_if if I_CompareCounter enemy_unit_count > 8 and I_CompareCounter u9_missile = 0 if I_UnitPercentageAmmoLeft a2u9 > 0 inc_counter melee_count -1 set_counter u9_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a2u9 = horde set_counter u9_missile 2 end_if end_if

inc_counter melee_count 1 unit_order_move a2u9 190,145 end_if if I_CompareCounter enemy_unit_count > 9 and I_CompareCounter u10_missile = 0 if I_UnitPercentageAmmoLeft a2u10 > 0 inc_counter melee_count -1 set_counter u10_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a2u10 = horde set_counter u10_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a2u10 190,145 end_if if I_CompareCounter enemy_unit_count > 10 and I_CompareCounter u11_missile = 0 if I_UnitPercentageAmmoLeft a2u11 > 0 inc_counter melee_count -1 set_counter u11_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a2u11 = horde set_counter u11_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a2u11 190,145 end_if if I_CompareCounter enemy_unit_count > 11 and I_CompareCounter u12_missile = 0 if I_UnitPercentageAmmoLeft a2u12 > 0 inc_counter melee_count -1 set_counter u12_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a2u12 = horde set_counter u12_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a2u12 190,145 end_if if I_CompareCounter enemy_unit_count > 12 and I_CompareCounter u13_missile = 0 if I_UnitPercentageAmmoLeft a2u13 > 0 inc_counter melee_count -1 set_counter u13_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a2u13 = horde set_counter u13_missile 2 end_if end_if

inc_counter melee_count 1 unit_order_move a2u13 190,145 end_if if I_CompareCounter enemy_unit_count > 13 and I_CompareCounter u14_missile = 0 if I_UnitPercentageAmmoLeft a2u14 > 0 inc_counter melee_count -1 set_counter u14_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a2u14 = horde set_counter u14_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a2u14 190,145 end_if if I_CompareCounter enemy_unit_count > 14 and I_CompareCounter u15_missile = 0 if I_UnitPercentageAmmoLeft a2u15 > 0 inc_counter melee_count -1 set_counter u15_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a2u15 = horde set_counter u15_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a2u15 190,145 end_if if I_CompareCounter enemy_unit_count > 15 and I_CompareCounter u16_missile = 0 if I_UnitPercentageAmmoLeft a2u16 > 0 inc_counter melee_count -1 set_counter u16_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a2u16 = horde set_counter u16_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a2u16 190,145 end_if if I_CompareCounter enemy_unit_count > 16 and I_CompareCounter u17_missile = 0 if I_UnitPercentageAmmoLeft a2u17 > 0 inc_counter melee_count -1 set_counter u17_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a2u17 = horde set_counter u17_missile 2 end_if end_if

inc_counter melee_count 1 unit_order_move a2u17 190,145 end_if if I_CompareCounter enemy_unit_count > 17 and I_CompareCounter u18_missile = 0 if I_UnitPercentageAmmoLeft a2u18 > 0 inc_counter melee_count -1 set_counter u18_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a2u18 = horde set_counter u18_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a2u18 190,145 end_if if I_CompareCounter enemy_unit_count > 18 and I_CompareCounter u19_missile = 0 if I_UnitPercentageAmmoLeft a2u19 > 0 inc_counter melee_count -1 set_counter u19_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a2u19 = horde set_counter u19_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a2u19 190,145 end_if if I_CompareCounter enemy_unit_count = 20 and I_CompareCounter u20_missile = 0 if I_UnitPercentageAmmoLeft a2u20 > 0 inc_counter melee_count -1 set_counter u20_missile 1 if I_BattleEnemyArmyNumberOfMountClass elephant > 0 and I_UnitFormation a2u20 = horde set_counter u20_missile 2 end_if end_if inc_counter melee_count 1 unit_order_move a2u20 190,145 end_if battle_wait 5 if I_CompareCounter imladris_sally_check = 1 and I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker set_counter imladris_sally_check 2 end_if end_monitor monitor_conditions I_BattleStarted and I_CompareCounter imladris_sally_check = 2

and I_CompareCounter terminate_imladris_check = 0 and I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker if I_CompareCounter enemy_unit_count > 0 and I_IsUnitUnderFire a2g1 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 1 and I_IsUnitUnderFire a2u2 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 2 and I_IsUnitUnderFire a2u3 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 3 and I_IsUnitUnderFire a2u4 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 4 and I_IsUnitUnderFire a2u5 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 5 and I_IsUnitUnderFire a2u6 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 6 and I_IsUnitUnderFire a2u7 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 7 and I_IsUnitUnderFire a2u8 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 8 and I_IsUnitUnderFire a2u9 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 9 and I_IsUnitUnderFire a2u10 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 10 and I_IsUnitUnderFire a2u11 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 11

and I_IsUnitUnderFire a2u12 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 12 and I_IsUnitUnderFire a2u13 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 13 and I_IsUnitUnderFire a2u14 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 14 and I_IsUnitUnderFire a2u15 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 15 and I_IsUnitUnderFire a2u16 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 16 and I_IsUnitUnderFire a2u17 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 17 and I_IsUnitUnderFire a2u18 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count > 18 and I_IsUnitUnderFire a2u19 inc_counter imladris_under_fire 1 end_if if I_CompareCounter enemy_unit_count = 20 and I_IsUnitUnderFire a2u20 inc_counter imladris_under_fire 1 end_if if I_PercentageOfArmyKilled 0 0 > 5 and I_CompareCounter imladris_under_fire < 6 set_counter imladris_under_fire 5 end_if if I_CompareCounter imladris_under_fire > 5 if I_CompareCounter enemy_unit_count > 0 and I_CompareCounter g1_attacking = 0 unit_order_move a2g1 190,145 run end_if if I_CompareCounter enemy_unit_count > 1 and I_CompareCounter u2_attacking = 0 unit_order_move a2u2 190,145 run end_if

if I_CompareCounter enemy_unit_count > 2 and I_CompareCounter u3_attacking = 0 unit_order_move a2u3 190,145 run end_if if I_CompareCounter enemy_unit_count > 3 and I_CompareCounter u4_attacking = 0 unit_order_move a2u4 190,145 run end_if if I_CompareCounter enemy_unit_count > 4 and I_CompareCounter u5_attacking = 0 unit_order_move a2u5 190,145 run end_if if I_CompareCounter enemy_unit_count > 5 and I_CompareCounter u6_attacking = 0 unit_order_move a2u6 190,145 run end_if if I_CompareCounter enemy_unit_count > 6 and I_CompareCounter u7_attacking = 0 unit_order_move a2u7 190,145 run end_if if I_CompareCounter enemy_unit_count > 7 and I_CompareCounter u8_attacking = 0 unit_order_move a2u8 190,145 run end_if if I_CompareCounter enemy_unit_count > 8 and I_CompareCounter u9_attacking = 0 unit_order_move a2u9 190,145 run end_if if I_CompareCounter enemy_unit_count > 9 and I_CompareCounter u10_attacking = 0 unit_order_move a2u10 190,145 run end_if if I_CompareCounter enemy_unit_count > 10 and I_CompareCounter u11_attacking = 0 unit_order_move a2u11 190,145 run end_if if I_CompareCounter enemy_unit_count > 11 and I_CompareCounter u12_attacking = 0 unit_order_move a2u12 190,145 run end_if if I_CompareCounter enemy_unit_count > 12 and I_CompareCounter u13_attacking = 0 unit_order_move a2u13 190,145 run end_if if I_CompareCounter enemy_unit_count > 13 and I_CompareCounter u14_attacking = 0 unit_order_move a2u14 190,145 run end_if

if I_CompareCounter enemy_unit_count > 14 and I_CompareCounter u15_attacking = 0 unit_order_move a2u15 190,145 run end_if if I_CompareCounter enemy_unit_count > 15 and I_CompareCounter u16_attacking = 0 unit_order_move a2u16 190,145 run end_if if I_CompareCounter enemy_unit_count > 16 and I_CompareCounter u17_attacking = 0 unit_order_move a2u17 190,145 run end_if if I_CompareCounter enemy_unit_count > 17 and I_CompareCounter u18_attacking = 0 unit_order_move a2u18 190,145 run end_if if I_CompareCounter enemy_unit_count > 18 and I_CompareCounter u19_attacking = 0 unit_order_move a2u19 190,145 run end_if if I_CompareCounter enemy_unit_count = 20 and I_CompareCounter u20_attacking = 0 unit_order_move a2u20 190,145 run end_if set_counter terminate_imladris_check 1 end_if battle_wait 10 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter imladris_sally_check = 2 and I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker if I_CompareCounter enemy_unit_count > 0 and I_CompareCounter g1_attacking = 1 and ! I_UnitStatus a2g1 fighting and ! I_UnitStatus a2g1 pursuing and ! I_UnitStatus a2g1 charging and ! I_UnitStatus a2g1 moving if ! I_UnitEnemyUnitInRadius a2g1 90 and I_CompareCounter g1_missile != 1 unit_order_move a2g1 190,145 run set_counter g1_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a2g1 50 and I_CompareCounter g1_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a2g1 missiles_reloading and ! I_UnitStatus a2g1 missiles_firing

unit_order_move a2g1 190,145 run set_counter g1_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a2g1 190,145 run set_counter g1_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 1 and I_CompareCounter u2_attacking = 1 and ! I_UnitStatus a2u2 fighting and ! I_UnitStatus a2u2 pursuing and ! I_UnitStatus a2u2 charging and ! I_UnitStatus a2u2 moving if ! I_UnitEnemyUnitInRadius a2u2 90 and I_CompareCounter u2_missile != 1 unit_order_move a2u2 190,145 run set_counter u2_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a2u2 50 and I_CompareCounter u2_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a2u2 missiles_reloading and ! I_UnitStatus a2u2 missiles_firing unit_order_move a2u2 190,145 run set_counter u2_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a2u2 190,145 run set_counter u2_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 2 and I_CompareCounter u3_attacking = 1 and ! I_UnitStatus a2u3 fighting and ! I_UnitStatus a2u3 pursuing and ! I_UnitStatus a2u3 charging and ! I_UnitStatus a2u3 moving if ! I_UnitEnemyUnitInRadius a2u3 90 and I_CompareCounter u3_missile != 1 unit_order_move a2u3 190,145 run set_counter u3_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a2u3 50 and I_CompareCounter u3_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a2u3 missiles_reloading and ! I_UnitStatus a2u3 missiles_firing unit_order_move a2u3 190,145 run set_counter u3_attacking 0 end_if

if I_CompareCounter melee_count = -1 unit_order_move a2u3 190,145 run set_counter u3_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 3 and I_CompareCounter u4_attacking = 1 and ! I_UnitStatus a2u4 fighting and ! I_UnitStatus a2u4 pursuing and ! I_UnitStatus a2u4 charging and ! I_UnitStatus a2u4 moving if ! I_UnitEnemyUnitInRadius a2u4 90 and I_CompareCounter u4_missile != 1 unit_order_move a2u4 190,145 run set_counter u4_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a2u4 50 and I_CompareCounter u4_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a2u4 missiles_reloading and ! I_UnitStatus a2u4 missiles_firing unit_order_move a2u4 190,145 run set_counter u4_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a2u4 190,145 run set_counter u4_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 4 and I_CompareCounter u5_attacking = 1 and ! I_UnitStatus a2u5 fighting and ! I_UnitStatus a2u5 pursuing and ! I_UnitStatus a2u5 charging and ! I_UnitStatus a2u5 moving if ! I_UnitEnemyUnitInRadius a2u5 90 and I_CompareCounter u5_missile != 1 unit_order_move a2u5 190,145 run set_counter u5_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a2u5 50 and I_CompareCounter u5_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a2u5 missiles_reloading and ! I_UnitStatus a2u5 missiles_firing unit_order_move a2u5 190,145 run set_counter u5_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a2u5 190,145 run set_counter u5_attacking 0 end_if

end_if end_if if I_CompareCounter enemy_unit_count > 5 and I_CompareCounter u6_attacking = 1 and ! I_UnitStatus a2u6 fighting and ! I_UnitStatus a2u6 pursuing and ! I_UnitStatus a2u6 charging and ! I_UnitStatus a2u6 moving if ! I_UnitEnemyUnitInRadius a2u6 90 and I_CompareCounter u6_missile != 1 unit_order_move a2u6 190,145 run set_counter u6_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a2u6 50 and I_CompareCounter u6_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a2u6 missiles_reloading and ! I_UnitStatus a2u6 missiles_firing unit_order_move a2u6 190,145 run set_counter u6_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a2u6 190,145 run set_counter u6_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 6 and I_CompareCounter u7_attacking = 1 and ! I_UnitStatus a2u7 fighting and ! I_UnitStatus a2u7 pursuing and ! I_UnitStatus a2u7 charging and ! I_UnitStatus a2u7 moving if ! I_UnitEnemyUnitInRadius a2u7 90 and I_CompareCounter u7_missile != 1 unit_order_move a2u7 190,145 run set_counter u7_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a2u7 50 and I_CompareCounter u7_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a2u7 missiles_reloading and ! I_UnitStatus a2u7 missiles_firing unit_order_move a2u7 190,145 run set_counter u7_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a2u7 190,145 run set_counter u7_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 7

and and and and and

I_CompareCounter u8_attacking = 1 ! I_UnitStatus a2u8 fighting ! I_UnitStatus a2u8 pursuing ! I_UnitStatus a2u8 charging ! I_UnitStatus a2u8 moving

if ! I_UnitEnemyUnitInRadius a2u8 90 and I_CompareCounter u8_missile != 1 unit_order_move a2u8 190,145 run set_counter u8_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a2u8 50 and I_CompareCounter u8_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a2u8 missiles_reloading and ! I_UnitStatus a2u8 missiles_firing unit_order_move a2u8 190,145 run set_counter u8_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a2u8 190,145 run set_counter u8_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 8 and I_CompareCounter u9_attacking = 1 and ! I_UnitStatus a2u9 fighting and ! I_UnitStatus a2u9 pursuing and ! I_UnitStatus a2u9 charging and ! I_UnitStatus a2u9 moving if ! I_UnitEnemyUnitInRadius a2u9 90 and I_CompareCounter u9_missile != 1 unit_order_move a2u9 190,145 run set_counter u9_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a2u9 50 and I_CompareCounter u9_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a2u9 missiles_reloading and ! I_UnitStatus a2u9 missiles_firing unit_order_move a2u9 190,145 run set_counter u9_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a2u9 190,145 run set_counter u9_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 9 and I_CompareCounter u10_attacking = 1 and ! I_UnitStatus a2u10 fighting and ! I_UnitStatus a2u10 pursuing and ! I_UnitStatus a2u10 charging

and ! I_UnitStatus a2u10 moving if ! I_UnitEnemyUnitInRadius a2u10 90 and I_CompareCounter u10_missile != 1 unit_order_move a2u10 190,145 run set_counter u10_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a2u10 50 and I_CompareCounter u10_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a2u10 missiles_reloading and ! I_UnitStatus a2u10 missiles_firing unit_order_move a2u10 190,145 run set_counter u10_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a2u10 190,145 run set_counter u10_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 10 and I_CompareCounter u11_attacking = 1 and ! I_UnitStatus a2u11 fighting and ! I_UnitStatus a2u11 pursuing and ! I_UnitStatus a2u11 charging and ! I_UnitStatus a2u11 moving if ! I_UnitEnemyUnitInRadius a2u11 90 and I_CompareCounter u11_missile != 1 unit_order_move a2u11 190,145 run set_counter u11_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a2u11 50 and I_CompareCounter u11_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a2u11 missiles_reloading and ! I_UnitStatus a2u11 missiles_firing unit_order_move a2u11 190,145 run set_counter u11_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a2u11 190,145 run set_counter u11_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 11 and I_CompareCounter u12_attacking = 1 and ! I_UnitStatus a2u12 fighting and ! I_UnitStatus a2u12 pursuing and ! I_UnitStatus a2u12 charging and ! I_UnitStatus a2u12 moving if ! I_UnitEnemyUnitInRadius a2u12 90 and I_CompareCounter u12_missile != 1

unit_order_move a2u12 190,145 run set_counter u12_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a2u12 50 and I_CompareCounter u12_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a2u12 missiles_reloading and ! I_UnitStatus a2u12 missiles_firing unit_order_move a2u12 190,145 run set_counter u12_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a2u12 190,145 run set_counter u12_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 12 and I_CompareCounter u13_attacking = 1 and ! I_UnitStatus a2u13 fighting and ! I_UnitStatus a2u13 pursuing and ! I_UnitStatus a2u13 charging and ! I_UnitStatus a2u13 moving if ! I_UnitEnemyUnitInRadius a2u13 90 and I_CompareCounter u13_missile != 1 unit_order_move a2u13 190,145 run set_counter u13_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a2u13 50 and I_CompareCounter u13_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a2u13 missiles_reloading and ! I_UnitStatus a2u13 missiles_firing unit_order_move a2u13 190,145 run set_counter u13_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a2u13 190,145 run set_counter u13_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 13 and I_CompareCounter u14_attacking = 1 and ! I_UnitStatus a2u14 fighting and ! I_UnitStatus a2u14 pursuing and ! I_UnitStatus a2u14 charging and ! I_UnitStatus a2u14 moving if ! I_UnitEnemyUnitInRadius a2u14 90 and I_CompareCounter u14_missile != 1 unit_order_move a2u14 190,145 run set_counter u14_attacking 0 end_if

if ! I_UnitEnemyUnitInRadius a2u14 50 and I_CompareCounter u14_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a2u14 missiles_reloading and ! I_UnitStatus a2u14 missiles_firing unit_order_move a2u14 190,145 run set_counter u14_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a2u14 190,145 run set_counter u14_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 14 and I_CompareCounter u15_attacking = 1 and ! I_UnitStatus a2u15 fighting and ! I_UnitStatus a2u15 pursuing and ! I_UnitStatus a2u15 charging and ! I_UnitStatus a2u15 moving if ! I_UnitEnemyUnitInRadius a2u15 90 and I_CompareCounter u15_missile != 1 unit_order_move a2u15 190,145 run set_counter u15_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a2u15 50 and I_CompareCounter u15_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a2u15 missiles_reloading and ! I_UnitStatus a2u15 missiles_firing unit_order_move a2u15 190,145 run set_counter u15_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a2u15 190,145 run set_counter u15_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 15 and I_CompareCounter u16_attacking = 1 and ! I_UnitStatus a2u16 fighting and ! I_UnitStatus a2u16 pursuing and ! I_UnitStatus a2u16 charging and ! I_UnitStatus a2u16 moving if ! I_UnitEnemyUnitInRadius a2u16 90 and I_CompareCounter u16_missile != 1 unit_order_move a2u16 190,145 run set_counter u16_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a2u16 50 and I_CompareCounter u16_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a2u16 missiles_reloading

and ! I_UnitStatus a2u16 missiles_firing unit_order_move a2u16 190,145 run set_counter u16_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a2u16 190,145 run set_counter u16_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 16 and I_CompareCounter u17_attacking = 1 and ! I_UnitStatus a2u17 fighting and ! I_UnitStatus a2u17 pursuing and ! I_UnitStatus a2u17 charging and ! I_UnitStatus a2u17 moving if ! I_UnitEnemyUnitInRadius a2u17 90 and I_CompareCounter u17_missile != 1 unit_order_move a2u17 190,145 run set_counter u17_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a2u17 50 and I_CompareCounter u17_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a2u17 missiles_reloading and ! I_UnitStatus a2u17 missiles_firing unit_order_move a2u17 190,145 run set_counter u17_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a2u17 190,145 run set_counter u17_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 17 and I_CompareCounter u18_attacking = 1 and ! I_UnitStatus a2u18 fighting and ! I_UnitStatus a2u18 pursuing and ! I_UnitStatus a2u18 charging and ! I_UnitStatus a2u18 moving if ! I_UnitEnemyUnitInRadius a2u18 90 and I_CompareCounter u18_missile != 1 unit_order_move a2u18 190,145 run set_counter u18_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a2u18 50 and I_CompareCounter u18_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a2u18 missiles_reloading and ! I_UnitStatus a2u18 missiles_firing unit_order_move a2u18 190,145 run set_counter u18_attacking 0 end_if

if I_CompareCounter melee_count = -1 unit_order_move a2u18 190,145 run set_counter u18_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count > 18 and I_CompareCounter u19_attacking = 1 and ! I_UnitStatus a2u19 fighting and ! I_UnitStatus a2u19 pursuing and ! I_UnitStatus a2u19 charging and ! I_UnitStatus a2u19 moving if ! I_UnitEnemyUnitInRadius a2u19 90 and I_CompareCounter u19_missile != 1 unit_order_move a2u19 190,145 run set_counter u19_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a2u19 50 and I_CompareCounter u19_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a2u19 missiles_reloading and ! I_UnitStatus a2u19 missiles_firing unit_order_move a2u19 190,145 run set_counter u19_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a2u19 190,145 run set_counter u19_attacking 0 end_if end_if end_if if I_CompareCounter enemy_unit_count = 20 and I_CompareCounter u20_attacking = 1 and ! I_UnitStatus a2u20 fighting and ! I_UnitStatus a2u20 pursuing and ! I_UnitStatus a2u20 charging and ! I_UnitStatus a2u20 moving if ! I_UnitEnemyUnitInRadius a2u20 90 and I_CompareCounter u20_missile != 1 unit_order_move a2u20 190,145 run set_counter u20_attacking 0 end_if if ! I_UnitEnemyUnitInRadius a2u20 50 and I_CompareCounter u20_missile = 1 if I_CompareCounter melee_count != -1 and ! I_UnitStatus a2u20 missiles_reloading and ! I_UnitStatus a2u20 missiles_firing unit_order_move a2u20 190,145 run set_counter u20_attacking 0 end_if if I_CompareCounter melee_count = -1 unit_order_move a2u20 190,145 run set_counter u20_attacking 0 end_if

end_if end_if battle_wait 10 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter imladris_sally_check = 2 and I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker if I_CompareCounter enemy_unit_count > 0 and ! I_UnitStatus a2g1 routing and ! I_UnitStatus a2g1 moving and ! I_UnitStatus a2g1 missiles_firing and ! I_UnitStatus a2g1 missiles_reloading and ! I_UnitStatus a2g1 charging and ! I_UnitStatus a2g1 fighting and ! I_UnitStatus a2g1 pursuing and ! I_UnitStatus a2g1 running_amok and ! I_UnitStatus a2g1 dead unit_order_move a2g1 190,145 run if I_CompareCounter g1_missile != 1 set_counter g1_attacking 0 end_if if I_CompareCounter g1_missile = 1 battle_wait 5 set_counter g1_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 1 and ! I_UnitStatus a2u2 routing and ! I_UnitStatus a2u2 moving and ! I_UnitStatus a2u2 missiles_firing and ! I_UnitStatus a2u2 missiles_reloading and ! I_UnitStatus a2u2 charging and ! I_UnitStatus a2u2 fighting and ! I_UnitStatus a2u2 pursuing and ! I_UnitStatus a2u2 running_amok and ! I_UnitStatus a2u2 dead unit_order_move a2u2 190,145 run if I_CompareCounter u2_missile != 1 set_counter u2_attacking 0 end_if if I_CompareCounter u2_missile = 1 battle_wait 5 set_counter u2_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 2 and ! I_UnitStatus a2u3 routing and ! I_UnitStatus a2u3 moving and ! I_UnitStatus a2u3 missiles_firing and ! I_UnitStatus a2u3 missiles_reloading and ! I_UnitStatus a2u3 charging and ! I_UnitStatus a2u3 fighting

and ! I_UnitStatus a2u3 pursuing and ! I_UnitStatus a2u3 running_amok and ! I_UnitStatus a2u3 dead unit_order_move a2u3 190,145 run if I_CompareCounter u3_missile != 1 set_counter u3_attacking 0 end_if if I_CompareCounter u3_missile = 1 battle_wait 5 set_counter u3_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 3 and ! I_UnitStatus a2u4 routing and ! I_UnitStatus a2u4 moving and ! I_UnitStatus a2u4 missiles_firing and ! I_UnitStatus a2u4 missiles_reloading and ! I_UnitStatus a2u4 charging and ! I_UnitStatus a2u4 fighting and ! I_UnitStatus a2u4 pursuing and ! I_UnitStatus a2u4 running_amok and ! I_UnitStatus a2u4 dead unit_order_move a2u4 190,145 run if I_CompareCounter u4_missile != 1 set_counter u4_attacking 0 end_if if I_CompareCounter u4_missile = 1 battle_wait 5 set_counter u4_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 4 and ! I_UnitStatus a2u5 routing and ! I_UnitStatus a2u5 moving and ! I_UnitStatus a2u5 missiles_firing and ! I_UnitStatus a2u5 missiles_reloading and ! I_UnitStatus a2u5 charging and ! I_UnitStatus a2u5 fighting and ! I_UnitStatus a2u5 pursuing and ! I_UnitStatus a2u5 running_amok and ! I_UnitStatus a2u5 dead unit_order_move a2u5 190,145 run if I_CompareCounter u5_missile != 1 set_counter u5_attacking 0 end_if if I_CompareCounter u5_missile = 1 battle_wait 5 set_counter u5_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 5 and ! I_UnitStatus a2u6 routing and ! I_UnitStatus a2u6 moving and ! I_UnitStatus a2u6 missiles_firing

and and and and and and

! ! ! ! ! !

I_UnitStatus I_UnitStatus I_UnitStatus I_UnitStatus I_UnitStatus I_UnitStatus

a2u6 a2u6 a2u6 a2u6 a2u6 a2u6

missiles_reloading charging fighting pursuing running_amok dead

unit_order_move a2u6 190,145 run if I_CompareCounter u6_missile != 1 set_counter u6_attacking 0 end_if if I_CompareCounter u6_missile = 1 battle_wait 5 set_counter u6_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 6 and ! I_UnitStatus a2u7 routing and ! I_UnitStatus a2u7 moving and ! I_UnitStatus a2u7 missiles_firing and ! I_UnitStatus a2u7 missiles_reloading and ! I_UnitStatus a2u7 charging and ! I_UnitStatus a2u7 fighting and ! I_UnitStatus a2u7 pursuing and ! I_UnitStatus a2u7 running_amok and ! I_UnitStatus a2u7 dead unit_order_move a2u7 190,145 run if I_CompareCounter u7_missile != 1 set_counter u7_attacking 0 end_if if I_CompareCounter u7_missile = 1 battle_wait 5 set_counter u7_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 7 and ! I_UnitStatus a2u8 routing and ! I_UnitStatus a2u8 moving and ! I_UnitStatus a2u8 missiles_firing and ! I_UnitStatus a2u8 missiles_reloading and ! I_UnitStatus a2u8 charging and ! I_UnitStatus a2u8 fighting and ! I_UnitStatus a2u8 pursuing and ! I_UnitStatus a2u8 running_amok and ! I_UnitStatus a2u8 dead unit_order_move a2u8 190,145 run if I_CompareCounter u8_missile != 1 set_counter u8_attacking 0 end_if if I_CompareCounter u8_missile = 1 battle_wait 5 set_counter u8_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 8

and and and and and and and and and

! ! ! ! ! ! ! ! !

I_UnitStatus I_UnitStatus I_UnitStatus I_UnitStatus I_UnitStatus I_UnitStatus I_UnitStatus I_UnitStatus I_UnitStatus

a2u9 a2u9 a2u9 a2u9 a2u9 a2u9 a2u9 a2u9 a2u9

routing moving missiles_firing missiles_reloading charging fighting pursuing running_amok dead

unit_order_move a2u9 190,145 run if I_CompareCounter u9_missile != 1 set_counter u9_attacking 0 end_if if I_CompareCounter u9_missile = 1 battle_wait 5 set_counter u9_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 9 and ! I_UnitStatus a2u10 routing and ! I_UnitStatus a2u10 moving and ! I_UnitStatus a2u10 missiles_firing and ! I_UnitStatus a2u10 missiles_reloading and ! I_UnitStatus a2u10 charging and ! I_UnitStatus a2u10 fighting and ! I_UnitStatus a2u10 pursuing and ! I_UnitStatus a2u10 running_amok and ! I_UnitStatus a2u10 dead unit_order_move a2u10 190,145 run if I_CompareCounter u10_missile != 1 set_counter u10_attacking 0 end_if if I_CompareCounter u10_missile = 1 battle_wait 5 set_counter u10_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 10 and ! I_UnitStatus a2u11 routing and ! I_UnitStatus a2u11 moving and ! I_UnitStatus a2u11 missiles_firing and ! I_UnitStatus a2u11 missiles_reloading and ! I_UnitStatus a2u11 charging and ! I_UnitStatus a2u11 fighting and ! I_UnitStatus a2u11 pursuing and ! I_UnitStatus a2u11 running_amok and ! I_UnitStatus a2u11 dead unit_order_move a2u11 190,145 run if I_CompareCounter u11_missile != 1 set_counter u11_attacking 0 end_if if I_CompareCounter u11_missile = 1 battle_wait 5 set_counter u11_attacking 0 end_if

end_if if I_CompareCounter enemy_unit_count > 11 and ! I_UnitStatus a2u12 routing and ! I_UnitStatus a2u12 moving and ! I_UnitStatus a2u12 missiles_firing and ! I_UnitStatus a2u12 missiles_reloading and ! I_UnitStatus a2u12 charging and ! I_UnitStatus a2u12 fighting and ! I_UnitStatus a2u12 pursuing and ! I_UnitStatus a2u12 running_amok and ! I_UnitStatus a2u12 dead unit_order_move a2u12 190,145 run if I_CompareCounter u12_missile != 1 set_counter u12_attacking 0 end_if if I_CompareCounter u12_missile = 1 battle_wait 5 set_counter u12_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 12 and ! I_UnitStatus a2u13 routing and ! I_UnitStatus a2u13 moving and ! I_UnitStatus a2u13 missiles_firing and ! I_UnitStatus a2u13 missiles_reloading and ! I_UnitStatus a2u13 charging and ! I_UnitStatus a2u13 fighting and ! I_UnitStatus a2u13 pursuing and ! I_UnitStatus a2u13 running_amok and ! I_UnitStatus a2u13 dead unit_order_move a2u13 190,145 run if I_CompareCounter u13_missile != 1 set_counter u13_attacking 0 end_if if I_CompareCounter u13_missile = 1 battle_wait 5 set_counter u13_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 13 and ! I_UnitStatus a2u14 routing and ! I_UnitStatus a2u14 moving and ! I_UnitStatus a2u14 missiles_firing and ! I_UnitStatus a2u14 missiles_reloading and ! I_UnitStatus a2u14 charging and ! I_UnitStatus a2u14 fighting and ! I_UnitStatus a2u14 pursuing and ! I_UnitStatus a2u14 running_amok and ! I_UnitStatus a2u14 dead unit_order_move a2u14 190,145 run if I_CompareCounter u14_missile != 1 set_counter u14_attacking 0 end_if if I_CompareCounter u14_missile = 1

battle_wait 5 set_counter u14_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 14 and ! I_UnitStatus a2u15 routing and ! I_UnitStatus a2u15 moving and ! I_UnitStatus a2u15 missiles_firing and ! I_UnitStatus a2u15 missiles_reloading and ! I_UnitStatus a2u15 charging and ! I_UnitStatus a2u15 fighting and ! I_UnitStatus a2u15 pursuing and ! I_UnitStatus a2u15 running_amok and ! I_UnitStatus a2u15 dead unit_order_move a2u15 190,145 run if I_CompareCounter u15_missile != 1 set_counter u15_attacking 0 end_if if I_CompareCounter u15_missile = 1 battle_wait 5 set_counter u15_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 15 and ! I_UnitStatus a2u16 routing and ! I_UnitStatus a2u16 moving and ! I_UnitStatus a2u16 missiles_firing and ! I_UnitStatus a2u16 missiles_reloading and ! I_UnitStatus a2u16 charging and ! I_UnitStatus a2u16 fighting and ! I_UnitStatus a2u16 pursuing and ! I_UnitStatus a2u16 running_amok and ! I_UnitStatus a2u16 dead unit_order_move a2u16 190,145 run if I_CompareCounter u16_missile != 1 set_counter u16_attacking 0 end_if if I_CompareCounter u16_missile = 1 battle_wait 5 set_counter u16_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 16 and ! I_UnitStatus a2u17 routing and ! I_UnitStatus a2u17 moving and ! I_UnitStatus a2u17 missiles_firing and ! I_UnitStatus a2u17 missiles_reloading and ! I_UnitStatus a2u17 charging and ! I_UnitStatus a2u17 fighting and ! I_UnitStatus a2u17 pursuing and ! I_UnitStatus a2u17 running_amok and ! I_UnitStatus a2u17 dead unit_order_move a2u17 190,145 run if I_CompareCounter u17_missile != 1

set_counter u17_attacking 0 end_if if I_CompareCounter u17_missile = 1 battle_wait 5 set_counter u17_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 17 and ! I_UnitStatus a2u18 routing and ! I_UnitStatus a2u18 moving and ! I_UnitStatus a2u18 missiles_firing and ! I_UnitStatus a2u18 missiles_reloading and ! I_UnitStatus a2u18 charging and ! I_UnitStatus a2u18 fighting and ! I_UnitStatus a2u18 pursuing and ! I_UnitStatus a2u18 running_amok and ! I_UnitStatus a2u18 dead unit_order_move a2u18 190,145 run if I_CompareCounter u18_missile != 1 set_counter u18_attacking 0 end_if if I_CompareCounter u18_missile = 1 battle_wait 5 set_counter u18_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count > 18 and ! I_UnitStatus a2u19 routing and ! I_UnitStatus a2u19 moving and ! I_UnitStatus a2u19 missiles_firing and ! I_UnitStatus a2u19 missiles_reloading and ! I_UnitStatus a2u19 charging and ! I_UnitStatus a2u19 fighting and ! I_UnitStatus a2u19 pursuing and ! I_UnitStatus a2u19 running_amok and ! I_UnitStatus a2u19 dead unit_order_move a2u19 190,145 run if I_CompareCounter u19_missile != 1 set_counter u19_attacking 0 end_if if I_CompareCounter u19_missile = 1 battle_wait 5 set_counter u19_attacking 0 end_if end_if if I_CompareCounter enemy_unit_count = 20 and ! I_UnitStatus a2u20 routing and ! I_UnitStatus a2u20 moving and ! I_UnitStatus a2u20 missiles_firing and ! I_UnitStatus a2u20 missiles_reloading and ! I_UnitStatus a2u20 charging and ! I_UnitStatus a2u20 fighting and ! I_UnitStatus a2u20 pursuing and ! I_UnitStatus a2u20 running_amok and ! I_UnitStatus a2u20 dead

unit_order_move a2u20 190,145 run if I_CompareCounter u20_missile != 1 set_counter u20_attacking 0 end_if if I_CompareCounter u20_missile = 1 battle_wait 5 set_counter u20_attacking 0 end_if end_if battle_wait 15 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter imladris_sally_check = 2 and I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker if I_CompareCounter enemy_unit_count > 0 and I_CompareCounter g1_attacking = 0 and ! I_UnitStatus a2g1 fighting and ! I_UnitStatus a2g1 pursuing and ! I_UnitStatus a2g1 charging and ! I_IsUnitRouting a2g1 if I_UnitEnemyUnitInRadius a2g1 90 and I_CompareCounter g1_missile = 0 unit_order_attack_closest_unit a2g1 270 run set_counter g1_attacking 1 end_if if I_UnitEnemyUnitInRadius a2g1 55 and I_CompareCounter g1_missile = 1 if I_UnitPercentageAmmoLeft a2g1 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a2g1 end_if if I_UnitPercentageAmmoLeft a2g1 > 0 and I_CompareCounter melee_count = -1 unit_order_move a2g1 190,145 run end_if if I_UnitPercentageAmmoLeft a2g1 = 0 unit_order_attack_closest_unit a2g1 270 run end_if set_counter g1_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 1 and I_CompareCounter u2_attacking = 0 and ! I_UnitStatus a2u2 fighting and ! I_UnitStatus a2u2 pursuing and ! I_UnitStatus a2u2 charging and ! I_IsUnitRouting a2u2 if I_UnitEnemyUnitInRadius a2u2 90 and I_CompareCounter u2_missile = 0 unit_order_attack_closest_unit a2u2 270 run set_counter u2_attacking 1

end_if if I_UnitEnemyUnitInRadius a2u2 55 and I_CompareCounter u2_missile = 1 if I_UnitPercentageAmmoLeft a2u2 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a2u2 end_if if I_UnitPercentageAmmoLeft a2u2 > 0 and I_CompareCounter melee_count = -1 unit_order_move a2u2 190,145 run end_if if I_UnitPercentageAmmoLeft a2u2 = 0 unit_order_attack_closest_unit a2u2 270 run end_if set_counter u2_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 2 and I_CompareCounter u3_attacking = 0 and ! I_UnitStatus a2u3 fighting and ! I_UnitStatus a2u3 pursuing and ! I_UnitStatus a2u3 charging and ! I_IsUnitRouting a2u3 if I_UnitEnemyUnitInRadius a2u3 90 and I_CompareCounter u3_missile = 0 unit_order_attack_closest_unit a2u3 270 run set_counter u3_attacking 1 end_if if I_UnitEnemyUnitInRadius a2u3 55 and I_CompareCounter u3_missile = 1 if I_UnitPercentageAmmoLeft a2u3 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a2u3 end_if if I_UnitPercentageAmmoLeft a2u3 > 0 and I_CompareCounter melee_count = -1 unit_order_move a2u3 190,145 run end_if if I_UnitPercentageAmmoLeft a2u3 = 0 unit_order_attack_closest_unit a2u3 270 run end_if set_counter u3_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 3 and I_CompareCounter u4_attacking = 0 and ! I_UnitStatus a2u4 fighting and ! I_UnitStatus a2u4 pursuing and ! I_UnitStatus a2u4 charging and ! I_IsUnitRouting a2u4 if I_UnitEnemyUnitInRadius a2u4 90 and I_CompareCounter u4_missile = 0 unit_order_attack_closest_unit a2u4 270 run set_counter u4_attacking 1

end_if if I_UnitEnemyUnitInRadius a2u4 55 and I_CompareCounter u4_missile = 1 if I_UnitPercentageAmmoLeft a2u4 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a2u4 end_if if I_UnitPercentageAmmoLeft a2u4 > 0 and I_CompareCounter melee_count = -1 unit_order_move a2u4 190,145 run end_if if I_UnitPercentageAmmoLeft a2u4 = 0 unit_order_attack_closest_unit a2u4 270 run end_if set_counter u4_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 4 and I_CompareCounter u5_attacking = 0 and ! I_UnitStatus a2u5 fighting and ! I_UnitStatus a2u5 pursuing and ! I_UnitStatus a2u5 charging and ! I_IsUnitRouting a2u5 if I_UnitEnemyUnitInRadius a2u5 90 and I_CompareCounter u5_missile = 0 unit_order_attack_closest_unit a2u5 270 run set_counter u5_attacking 1 end_if if I_UnitEnemyUnitInRadius a2u5 55 and I_CompareCounter u5_missile = 1 if I_UnitPercentageAmmoLeft a2u5 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a2u5 end_if if I_UnitPercentageAmmoLeft a2u5 > 0 and I_CompareCounter melee_count = -1 unit_order_move a2u5 190,145 run end_if if I_UnitPercentageAmmoLeft a2u5 = 0 unit_order_attack_closest_unit a2u5 270 run end_if set_counter u5_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 5 and I_CompareCounter u6_attacking = 0 and ! I_UnitStatus a2u6 fighting and ! I_UnitStatus a2u6 pursuing and ! I_UnitStatus a2u6 charging and ! I_IsUnitRouting a2u6 if I_UnitEnemyUnitInRadius a2u6 90 and I_CompareCounter u6_missile = 0 unit_order_attack_closest_unit a2u6 270 run set_counter u6_attacking 1

end_if if I_UnitEnemyUnitInRadius a2u6 55 and I_CompareCounter u6_missile = 1 if I_UnitPercentageAmmoLeft a2u6 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a2u6 end_if if I_UnitPercentageAmmoLeft a2u6 > 0 and I_CompareCounter melee_count = -1 unit_order_move a2u6 190,145 run end_if if I_UnitPercentageAmmoLeft a2u6 = 0 unit_order_attack_closest_unit a2u6 270 run end_if set_counter u6_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 6 and I_CompareCounter u7_attacking = 0 and ! I_UnitStatus a2u7 fighting and ! I_UnitStatus a2u7 pursuing and ! I_UnitStatus a2u7 charging and ! I_IsUnitRouting a2u7 if I_UnitEnemyUnitInRadius a2u7 90 and I_CompareCounter u7_missile = 0 unit_order_attack_closest_unit a2u7 270 run set_counter u7_attacking 1 end_if if I_UnitEnemyUnitInRadius a2u7 55 and I_CompareCounter u7_missile = 1 if I_UnitPercentageAmmoLeft a2u7 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a2u7 end_if if I_UnitPercentageAmmoLeft a2u7 > 0 and I_CompareCounter melee_count = -1 unit_order_move a2u7 190,145 run end_if if I_UnitPercentageAmmoLeft a2u7 = 0 unit_order_attack_closest_unit a2u7 270 run end_if set_counter u7_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 7 and I_CompareCounter u8_attacking = 0 and ! I_UnitStatus a2u8 fighting and ! I_UnitStatus a2u8 pursuing and ! I_UnitStatus a2u8 charging and ! I_IsUnitRouting a2u8 if I_UnitEnemyUnitInRadius a2u8 90 and I_CompareCounter u8_missile = 0 unit_order_attack_closest_unit a2u8 270 run set_counter u8_attacking 1

end_if if I_UnitEnemyUnitInRadius a2u8 55 and I_CompareCounter u8_missile = 1 if I_UnitPercentageAmmoLeft a2u8 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a2u8 end_if if I_UnitPercentageAmmoLeft a2u8 > 0 and I_CompareCounter melee_count = -1 unit_order_move a2u8 190,145 run end_if if I_UnitPercentageAmmoLeft a2u8 = 0 unit_order_attack_closest_unit a2u8 270 run end_if set_counter u8_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 8 and I_CompareCounter u9_attacking = 0 and ! I_UnitStatus a2u9 fighting and ! I_UnitStatus a2u9 pursuing and ! I_UnitStatus a2u9 charging and ! I_IsUnitRouting a2u9 if I_UnitEnemyUnitInRadius a2u9 90 and I_CompareCounter u9_missile = 0 unit_order_attack_closest_unit a2u9 270 run set_counter u9_attacking 1 end_if if I_UnitEnemyUnitInRadius a2u9 55 and I_CompareCounter u9_missile = 1 if I_UnitPercentageAmmoLeft a2u9 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a2u9 end_if if I_UnitPercentageAmmoLeft a2u9 > 0 and I_CompareCounter melee_count = -1 unit_order_move a2u9 190,145 run end_if if I_UnitPercentageAmmoLeft a2u9 = 0 unit_order_attack_closest_unit a2u9 270 run end_if set_counter u9_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 9 and I_CompareCounter u10_attacking = 0 and ! I_UnitStatus a2u10 fighting and ! I_UnitStatus a2u10 pursuing and ! I_UnitStatus a2u10 charging and ! I_IsUnitRouting a2u10 if I_UnitEnemyUnitInRadius a2u10 90 and I_CompareCounter u10_missile = 0 unit_order_attack_closest_unit a2u10 270 run set_counter u10_attacking 1

end_if if I_UnitEnemyUnitInRadius a2u10 55 and I_CompareCounter u10_missile = 1 if I_UnitPercentageAmmoLeft a2u10 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a2u10 end_if if I_UnitPercentageAmmoLeft a2u10 > 0 and I_CompareCounter melee_count = -1 unit_order_move a2u10 190,145 run end_if if I_UnitPercentageAmmoLeft a2u10 = 0 unit_order_attack_closest_unit a2u10 270 run end_if set_counter u10_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 10 and I_CompareCounter u11_attacking = 0 and ! I_UnitStatus a2u11 fighting and ! I_UnitStatus a2u11 pursuing and ! I_UnitStatus a2u11 charging and ! I_IsUnitRouting a2u11 if I_UnitEnemyUnitInRadius a2u11 90 and I_CompareCounter u11_missile = 0 unit_order_attack_closest_unit a2u11 270 run set_counter u11_attacking 1 end_if if I_UnitEnemyUnitInRadius a2u11 55 and I_CompareCounter u11_missile = 1 if I_UnitPercentageAmmoLeft a2u11 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a2u11 end_if if I_UnitPercentageAmmoLeft a2u11 > 0 and I_CompareCounter melee_count = -1 unit_order_move a2u11 190,145 run end_if if I_UnitPercentageAmmoLeft a2u11 = 0 unit_order_attack_closest_unit a2u11 270 run end_if set_counter u11_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 11 and I_CompareCounter u12_attacking = 0 and ! I_UnitStatus a2u12 fighting and ! I_UnitStatus a2u12 pursuing and ! I_UnitStatus a2u12 charging and ! I_IsUnitRouting a2u12 if I_UnitEnemyUnitInRadius a2u12 90 and I_CompareCounter u12_missile = 0 unit_order_attack_closest_unit a2u12 270 run set_counter u12_attacking 1

end_if if I_UnitEnemyUnitInRadius a2u12 55 and I_CompareCounter u12_missile = 1 if I_UnitPercentageAmmoLeft a2u12 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a2u12 end_if if I_UnitPercentageAmmoLeft a2u12 > 0 and I_CompareCounter melee_count = -1 unit_order_move a2u12 190,145 run end_if if I_UnitPercentageAmmoLeft a2u12 = 0 unit_order_attack_closest_unit a2u12 270 run end_if set_counter u12_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 12 and I_CompareCounter u13_attacking = 0 and ! I_UnitStatus a2u13 fighting and ! I_UnitStatus a2u13 pursuing and ! I_UnitStatus a2u13 charging and ! I_IsUnitRouting a2u13 if I_UnitEnemyUnitInRadius a2u13 90 and I_CompareCounter u13_missile = 0 unit_order_attack_closest_unit a2u13 270 run set_counter u13_attacking 1 end_if if I_UnitEnemyUnitInRadius a2u13 55 and I_CompareCounter u13_missile = 1 if I_UnitPercentageAmmoLeft a2u13 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a2u13 end_if if I_UnitPercentageAmmoLeft a2u13 > 0 and I_CompareCounter melee_count = -1 unit_order_move a2u13 190,145 run end_if if I_UnitPercentageAmmoLeft a2u13 = 0 unit_order_attack_closest_unit a2u13 270 run end_if set_counter u13_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 13 and I_CompareCounter u14_attacking = 0 and ! I_UnitStatus a2u14 fighting and ! I_UnitStatus a2u14 pursuing and ! I_UnitStatus a2u14 charging and ! I_IsUnitRouting a2u14 if I_UnitEnemyUnitInRadius a2u14 90 and I_CompareCounter u14_missile = 0 unit_order_attack_closest_unit a2u14 270 run set_counter u14_attacking 1

end_if if I_UnitEnemyUnitInRadius a2u14 55 and I_CompareCounter u14_missile = 1 if I_UnitPercentageAmmoLeft a2u14 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a2u14 end_if if I_UnitPercentageAmmoLeft a2u14 > 0 and I_CompareCounter melee_count = -1 unit_order_move a2u14 190,145 run end_if if I_UnitPercentageAmmoLeft a2u14 = 0 unit_order_attack_closest_unit a2u14 270 run end_if set_counter u14_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 14 and I_CompareCounter u15_attacking = 0 and ! I_UnitStatus a2u15 fighting and ! I_UnitStatus a2u15 pursuing and ! I_UnitStatus a2u15 charging and ! I_IsUnitRouting a2u15 if I_UnitEnemyUnitInRadius a2u15 90 and I_CompareCounter u15_missile = 0 unit_order_attack_closest_unit a2u15 270 run set_counter u15_attacking 1 end_if if I_UnitEnemyUnitInRadius a2u15 55 and I_CompareCounter u15_missile = 1 if I_UnitPercentageAmmoLeft a2u15 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a2u15 end_if if I_UnitPercentageAmmoLeft a2u15 > 0 and I_CompareCounter melee_count = -1 unit_order_move a2u15 190,145 run end_if if I_UnitPercentageAmmoLeft a2u15 = 0 unit_order_attack_closest_unit a2u15 270 run end_if set_counter u15_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 15 and I_CompareCounter u16_attacking = 0 and ! I_UnitStatus a2u16 fighting and ! I_UnitStatus a2u16 pursuing and ! I_UnitStatus a2u16 charging and ! I_IsUnitRouting a2u16 if I_UnitEnemyUnitInRadius a2u16 90 and I_CompareCounter u16_missile = 0 unit_order_attack_closest_unit a2u16 270 run set_counter u16_attacking 1

end_if if I_UnitEnemyUnitInRadius a2u16 55 and I_CompareCounter u16_missile = 1 if I_UnitPercentageAmmoLeft a2u16 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a2u16 end_if if I_UnitPercentageAmmoLeft a2u16 > 0 and I_CompareCounter melee_count = -1 unit_order_move a2u16 190,145 run end_if if I_UnitPercentageAmmoLeft a2u16 = 0 unit_order_attack_closest_unit a2u16 270 run end_if set_counter u16_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 16 and I_CompareCounter u17_attacking = 0 and ! I_UnitStatus a2u17 fighting and ! I_UnitStatus a2u17 pursuing and ! I_UnitStatus a2u17 charging and ! I_IsUnitRouting a2u17 if I_UnitEnemyUnitInRadius a2u17 90 and I_CompareCounter u17_missile = 0 unit_order_attack_closest_unit a2u17 270 run set_counter u17_attacking 1 end_if if I_UnitEnemyUnitInRadius a2u17 55 and I_CompareCounter u17_missile = 1 if I_UnitPercentageAmmoLeft a2u17 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a2u17 end_if if I_UnitPercentageAmmoLeft a2u17 > 0 and I_CompareCounter melee_count = -1 unit_order_move a2u17 190,145 run end_if if I_UnitPercentageAmmoLeft a2u17 = 0 unit_order_attack_closest_unit a2u17 270 run end_if set_counter u17_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 17 and I_CompareCounter u18_attacking = 0 and ! I_UnitStatus a2u18 fighting and ! I_UnitStatus a2u18 pursuing and ! I_UnitStatus a2u18 charging and ! I_IsUnitRouting a2u18 if I_UnitEnemyUnitInRadius a2u18 90 and I_CompareCounter u18_missile = 0 unit_order_attack_closest_unit a2u18 270 run set_counter u18_attacking 1

end_if if I_UnitEnemyUnitInRadius a2u18 55 and I_CompareCounter u18_missile = 1 if I_UnitPercentageAmmoLeft a2u18 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a2u18 end_if if I_UnitPercentageAmmoLeft a2u18 > 0 and I_CompareCounter melee_count = -1 unit_order_move a2u18 190,145 run end_if if I_UnitPercentageAmmoLeft a2u18 = 0 unit_order_attack_closest_unit a2u18 270 run end_if set_counter u18_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count > 18 and I_CompareCounter u19_attacking = 0 and ! I_UnitStatus a2u19 fighting and ! I_UnitStatus a2u19 pursuing and ! I_UnitStatus a2u19 charging and ! I_IsUnitRouting a2u19 if I_UnitEnemyUnitInRadius a2u19 90 and I_CompareCounter u19_missile = 0 unit_order_attack_closest_unit a2u19 270 run set_counter u19_attacking 1 end_if if I_UnitEnemyUnitInRadius a2u19 55 and I_CompareCounter u19_missile = 1 if I_UnitPercentageAmmoLeft a2u19 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a2u19 end_if if I_UnitPercentageAmmoLeft a2u19 > 0 and I_CompareCounter melee_count = -1 unit_order_move a2u19 190,145 run end_if if I_UnitPercentageAmmoLeft a2u19 = 0 unit_order_attack_closest_unit a2u19 270 run end_if set_counter u19_attacking 1 end_if end_if if I_CompareCounter enemy_unit_count = 20 and I_CompareCounter u20_attacking = 0 and ! I_UnitStatus a2u20 fighting and ! I_UnitStatus a2u20 pursuing and ! I_UnitStatus a2u20 charging and ! I_IsUnitRouting a2u20 if I_UnitEnemyUnitInRadius a2u20 90 and I_CompareCounter u20_missile = 0 unit_order_attack_closest_unit a2u20 270 run set_counter u20_attacking 1

end_if if I_UnitEnemyUnitInRadius a2u20 55 and I_CompareCounter u20_missile = 1 if I_UnitPercentageAmmoLeft a2u20 > 0 and I_CompareCounter melee_count != -1 unit_order_halt a2u20 end_if if I_UnitPercentageAmmoLeft a2u20 > 0 and I_CompareCounter melee_count = -1 unit_order_move a2u20 190,145 run end_if if I_UnitPercentageAmmoLeft a2u20 = 0 unit_order_attack_closest_unit a2u20 270 run end_if set_counter u20_attacking 1 end_if end_if battle_wait 2 end_monitor monitor_conditions I_BattleStarted and I_CompareCounter imladris_sally_check = 2 and I_CompareCounter melee_count >= 0 and I_BattleIsSallyOutBattle and I_BattlePlayerArmyIsAttacker if I_CompareCounter enemy_unit_count > 0 and I_CompareCounter g1_missile = 0 and I_CompareCounter g1_lock = 0 if I_PercentageUnitKilled a2g1 > 85 set_counter g1_lock 1 end_if if I_IsUnitRouting a2g1 set_counter g1_lock 1 end_if if I_UnitDestroyed a2g1 set_counter g1_lock 1 end_if if I_UnitStatus a2g1 running_amok set_counter g1_lock 1 end_if if I_CompareCounter g1_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 1 and I_CompareCounter u2_missile = 0 and I_CompareCounter u2_lock = 0 if I_PercentageUnitKilled a2u2 > 85 set_counter u2_lock 1 end_if if I_IsUnitRouting a2u2 set_counter u2_lock 1 end_if if I_UnitDestroyed a2u2

set_counter u2_lock 1 end_if if I_UnitStatus a2u2 running_amok set_counter u2_lock 1 end_if if I_CompareCounter u2_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 2 and I_CompareCounter u3_missile = 0 and I_CompareCounter u3_lock = 0 if I_PercentageUnitKilled a2u3 > 85 set_counter u3_lock 1 end_if if I_IsUnitRouting a2u3 set_counter u3_lock 1 end_if if I_UnitDestroyed a2u3 set_counter u3_lock 1 end_if if I_UnitStatus a2u3 running_amok set_counter u3_lock 1 end_if if I_CompareCounter u3_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 3 and I_CompareCounter u4_missile = 0 and I_CompareCounter u4_lock = 0 if I_PercentageUnitKilled a2u4 > 85 set_counter u4_lock 1 end_if if I_IsUnitRouting a2u4 set_counter u4_lock 1 end_if if I_UnitDestroyed a2u4 set_counter u4_lock 1 end_if if I_UnitStatus a2u4 running_amok set_counter u4_lock 1 end_if if I_CompareCounter u4_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 4 and I_CompareCounter u5_missile = 0 and I_CompareCounter u5_lock = 0 if I_PercentageUnitKilled a2u5 > 85 set_counter u5_lock 1 end_if if I_IsUnitRouting a2u5

set_counter u5_lock 1 end_if if I_UnitDestroyed a2u5 set_counter u5_lock 1 end_if if I_UnitStatus a2u5 running_amok set_counter u5_lock 1 end_if if I_CompareCounter u5_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 5 and I_CompareCounter u6_missile = 0 and I_CompareCounter u6_lock = 0 if I_PercentageUnitKilled a2u6 > 85 set_counter u6_lock 1 end_if if I_IsUnitRouting a2u6 set_counter u6_lock 1 end_if if I_UnitDestroyed a2u6 set_counter u6_lock 1 end_if if I_UnitStatus a2u6 running_amok set_counter u6_lock 1 end_if if I_CompareCounter u6_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 6 and I_CompareCounter u7_missile = 0 and I_CompareCounter u7_lock = 0 if I_PercentageUnitKilled a2u7 > 85 set_counter u7_lock 1 end_if if I_IsUnitRouting a2u7 set_counter u7_lock 1 end_if if I_UnitDestroyed a2u7 set_counter u7_lock 1 end_if if I_UnitStatus a2u7 running_amok set_counter u7_lock 1 end_if if I_CompareCounter u7_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 7 and I_CompareCounter u8_missile = 0 and I_CompareCounter u8_lock = 0 if I_PercentageUnitKilled a2u8 > 85

set_counter u8_lock 1 end_if if I_IsUnitRouting a2u8 set_counter u8_lock 1 end_if if I_UnitDestroyed a2u8 set_counter u8_lock 1 end_if if I_UnitStatus a2u8 running_amok set_counter u8_lock 1 end_if if I_CompareCounter u8_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 8 and I_CompareCounter u9_missile = 0 and I_CompareCounter u9_lock = 0 if I_PercentageUnitKilled a2u9 > 85 set_counter u9_lock 1 end_if if I_IsUnitRouting a2u9 set_counter u9_lock 1 end_if if I_UnitDestroyed a2u9 set_counter u9_lock 1 end_if if I_UnitStatus a2u9 running_amok set_counter u9_lock 1 end_if if I_CompareCounter u9_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 9 and I_CompareCounter u10_missile = 0 and I_CompareCounter u10_lock = 0 if I_PercentageUnitKilled a2u10 > 85 set_counter u10_lock 1 end_if if I_IsUnitRouting a2u10 set_counter u10_lock 1 end_if if I_UnitDestroyed a2u10 set_counter u10_lock 1 end_if if I_UnitStatus a2u10 running_amok set_counter u10_lock 1 end_if if I_CompareCounter u10_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 10 and I_CompareCounter u11_missile = 0

and I_CompareCounter u11_lock = 0 if I_PercentageUnitKilled a2u11 > 85 set_counter u11_lock 1 end_if if I_IsUnitRouting a2u11 set_counter u11_lock 1 end_if if I_UnitDestroyed a2u11 set_counter u11_lock 1 end_if if I_UnitStatus a2u11 running_amok set_counter u11_lock 1 end_if if I_CompareCounter u11_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 11 and I_CompareCounter u12_missile = 0 and I_CompareCounter u12_lock = 0 if I_PercentageUnitKilled a2u12 > 85 set_counter u12_lock 1 end_if if I_IsUnitRouting a2u12 set_counter u12_lock 1 end_if if I_UnitDestroyed a2u12 set_counter u12_lock 1 end_if if I_UnitStatus a2u12 running_amok set_counter u12_lock 1 end_if if I_CompareCounter u12_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 12 and I_CompareCounter u13_missile = 0 and I_CompareCounter u13_lock = 0 if I_PercentageUnitKilled a2u13 > 85 set_counter u13_lock 1 end_if if I_IsUnitRouting a2u13 set_counter u13_lock 1 end_if if I_UnitDestroyed a2u13 set_counter u13_lock 1 end_if if I_UnitStatus a2u13 running_amok set_counter u13_lock 1 end_if if I_CompareCounter u13_lock = 1 inc_counter melee_count -1 end_if end_if

if I_CompareCounter enemy_unit_count > 13 and I_CompareCounter u14_missile = 0 and I_CompareCounter u14_lock = 0 if I_PercentageUnitKilled a2u14 > 85 set_counter u14_lock 1 end_if if I_IsUnitRouting a2u14 set_counter u14_lock 1 end_if if I_UnitDestroyed a2u14 set_counter u14_lock 1 end_if if I_UnitStatus a2u14 running_amok set_counter u14_lock 1 end_if if I_CompareCounter u14_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 14 and I_CompareCounter u15_missile = 0 and I_CompareCounter u15_lock = 0 if I_PercentageUnitKilled a2u15 > 85 set_counter u15_lock 1 end_if if I_IsUnitRouting a2u15 set_counter u15_lock 1 end_if if I_UnitDestroyed a2u15 set_counter u15_lock 1 end_if if I_UnitStatus a2u15 running_amok set_counter u15_lock 1 end_if if I_CompareCounter u15_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 15 and I_CompareCounter u16_missile = 0 and I_CompareCounter u16_lock = 0 if I_PercentageUnitKilled a2u16 > 85 set_counter u16_lock 1 end_if if I_IsUnitRouting a2u16 set_counter u16_lock 1 end_if if I_UnitDestroyed a2u16 set_counter u16_lock 1 end_if if I_UnitStatus a2u16 running_amok set_counter u16_lock 1 end_if if I_CompareCounter u16_lock = 1

inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 16 and I_CompareCounter u17_missile = 0 and I_CompareCounter u17_lock = 0 if I_PercentageUnitKilled a2u17 > 85 set_counter u17_lock 1 end_if if I_IsUnitRouting a2u17 set_counter u17_lock 1 end_if if I_UnitDestroyed a2u17 set_counter u17_lock 1 end_if if I_UnitStatus a2u17 running_amok set_counter u17_lock 1 end_if if I_CompareCounter u17_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 17 and I_CompareCounter u18_missile = 0 and I_CompareCounter u18_lock = 0 if I_PercentageUnitKilled a2u18 > 85 set_counter u18_lock 1 end_if if I_IsUnitRouting a2u18 set_counter u18_lock 1 end_if if I_UnitDestroyed a2u18 set_counter u18_lock 1 end_if if I_UnitStatus a2u18 running_amok set_counter u18_lock 1 end_if if I_CompareCounter u18_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count > 18 and I_CompareCounter u19_missile = 0 and I_CompareCounter u19_lock = 0 if I_PercentageUnitKilled a2u19 > 85 set_counter u19_lock 1 end_if if I_IsUnitRouting a2u19 set_counter u19_lock 1 end_if if I_UnitDestroyed a2u19 set_counter u19_lock 1 end_if if I_UnitStatus a2u19 running_amok

set_counter u19_lock 1 end_if if I_CompareCounter u19_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter enemy_unit_count = 20 and I_CompareCounter u20_missile = 0 and I_CompareCounter u20_lock = 0 if I_PercentageUnitKilled a2u20 > 85 set_counter u20_lock 1 end_if if I_IsUnitRouting a2u20 set_counter u20_lock 1 end_if if I_UnitDestroyed a2u20 set_counter u20_lock 1 end_if if I_UnitStatus a2u20 running_amok set_counter u20_lock 1 end_if if I_CompareCounter u20_lock = 1 inc_counter melee_count -1 end_if end_if if I_CompareCounter melee_count < 2 if I_CompareCounter enemy_unit_count > 0 and I_CompareCounter g1_missile = 1 and ! I_UnitStatus a2g1 fighting and ! I_UnitStatus a2g1 pursuing and ! I_UnitStatus a2g1 charging unit_order_move a2g1 190,145 run set_counter g1_attacking 0 end_if if I_CompareCounter enemy_unit_count > 1 and I_CompareCounter u2_missile = 1 and ! I_UnitStatus a2u2 fighting and ! I_UnitStatus a2u2 pursuing and ! I_UnitStatus a2u2 charging unit_order_move a2u2 190,145 run set_counter u2_attacking 0 end_if if I_CompareCounter enemy_unit_count > 2 and I_CompareCounter u3_missile = 1 and ! I_UnitStatus a2u3 fighting and ! I_UnitStatus a2u3 pursuing and ! I_UnitStatus a2u3 charging unit_order_move a2u3 190,145 run set_counter u3_attacking 0 end_if

if I_CompareCounter enemy_unit_count > 3 and I_CompareCounter u4_missile = 1 and ! I_UnitStatus a2u4 fighting and ! I_UnitStatus a2u4 pursuing and ! I_UnitStatus a2u4 charging unit_order_move a2u4 190,145 run set_counter u4_attacking 0 end_if if I_CompareCounter enemy_unit_count > 4 and I_CompareCounter u5_missile = 1 and ! I_UnitStatus a2u5 fighting and ! I_UnitStatus a2u5 pursuing and ! I_UnitStatus a2u5 charging unit_order_move a2u5 190,145 run set_counter u5_attacking 0 end_if if I_CompareCounter enemy_unit_count > 5 and I_CompareCounter u6_missile = 1 and ! I_UnitStatus a2u6 fighting and ! I_UnitStatus a2u6 pursuing and ! I_UnitStatus a2u6 charging unit_order_move a2u6 190,145 run set_counter u6_attacking 0 end_if if I_CompareCounter enemy_unit_count > 6 and I_CompareCounter u7_missile = 1 and ! I_UnitStatus a2u7 fighting and ! I_UnitStatus a2u7 pursuing and ! I_UnitStatus a2u7 charging unit_order_move a2u7 190,145 run set_counter u7_attacking 0 end_if if I_CompareCounter enemy_unit_count > 7 and I_CompareCounter u8_missile = 1 and ! I_UnitStatus a2u8 fighting and ! I_UnitStatus a2u8 pursuing and ! I_UnitStatus a2u8 charging unit_order_move a2u8 190,145 run set_counter u8_attacking 0 end_if if I_CompareCounter enemy_unit_count > 8 and I_CompareCounter u9_missile = 1 and ! I_UnitStatus a2u9 fighting and ! I_UnitStatus a2u9 pursuing and ! I_UnitStatus a2u9 charging unit_order_move a2u9 190,145 run set_counter u9_attacking 0 end_if

if I_CompareCounter enemy_unit_count > 9 and I_CompareCounter u10_missile = 1 and ! I_UnitStatus a2u10 fighting and ! I_UnitStatus a2u10 pursuing and ! I_UnitStatus a2u10 charging unit_order_move a2u10 190,145 run set_counter u10_attacking 0 end_if if I_CompareCounter enemy_unit_count > 10 and I_CompareCounter u11_missile = 1 and ! I_UnitStatus a2u11 fighting and ! I_UnitStatus a2u11 pursuing and ! I_UnitStatus a2u11 charging unit_order_move a2u11 190,145 run set_counter u11_attacking 0 end_if if I_CompareCounter enemy_unit_count > 11 and I_CompareCounter u12_missile = 1 and ! I_UnitStatus a2u12 fighting and ! I_UnitStatus a2u12 pursuing and ! I_UnitStatus a2u12 charging unit_order_move a2u12 190,145 run set_counter u12_attacking 0 end_if if I_CompareCounter enemy_unit_count > 12 and I_CompareCounter u13_missile = 1 and ! I_UnitStatus a2u13 fighting and ! I_UnitStatus a2u13 pursuing and ! I_UnitStatus a2u13 charging unit_order_move a2u13 190,145 run set_counter u13_attacking 0 end_if if I_CompareCounter enemy_unit_count > 13 and I_CompareCounter u14_missile = 1 and ! I_UnitStatus a2u14 fighting and ! I_UnitStatus a2u14 pursuing and ! I_UnitStatus a2u14 charging unit_order_move a2u14 190,145 run set_counter u14_attacking 0 end_if if I_CompareCounter enemy_unit_count > 14 and I_CompareCounter u15_missile = 1 and ! I_UnitStatus a2u15 fighting and ! I_UnitStatus a2u15 pursuing and ! I_UnitStatus a2u15 charging unit_order_move a2u15 190,145 run set_counter u15_attacking 0 end_if

if I_CompareCounter enemy_unit_count > 15 and I_CompareCounter u16_missile = 1 and ! I_UnitStatus a2u16 fighting and ! I_UnitStatus a2u16 pursuing and ! I_UnitStatus a2u16 charging unit_order_move a2u16 190,145 run set_counter u16_attacking 0 end_if if I_CompareCounter enemy_unit_count > 16 and I_CompareCounter u17_missile = 1 and ! I_UnitStatus a2u17 fighting and ! I_UnitStatus a2u17 pursuing and ! I_UnitStatus a2u17 charging unit_order_move a2u17 190,145 run set_counter u17_attacking 0 end_if if I_CompareCounter enemy_unit_count > 17 and I_CompareCounter u18_missile = 1 and ! I_UnitStatus a2u18 fighting and ! I_UnitStatus a2u18 pursuing and ! I_UnitStatus a2u18 charging unit_order_move a2u18 190,145 run set_counter u18_attacking 0 end_if if I_CompareCounter enemy_unit_count > 18 and I_CompareCounter u19_missile = 1 and ! I_UnitStatus a2u19 fighting and ! I_UnitStatus a2u19 pursuing and ! I_UnitStatus a2u19 charging unit_order_move a2u19 190,145 run set_counter u19_attacking 0 end_if if I_CompareCounter enemy_unit_count = 20 and I_CompareCounter u20_missile = 1 and ! I_UnitStatus a2u20 fighting and ! I_UnitStatus a2u20 pursuing and ! I_UnitStatus a2u20 charging unit_order_move a2u20 190,145 run set_counter u20_attacking 0 end_if set_counter melee_count -1 end_if battle_wait 20 end_monitor ;;;;;;;Anti-CTD monitor_event BattleDeploymentPhaseCommenced FactionIsLocal wait 0.5 simulate_mouse_click lclick_down

simulate_mouse_click lclick_up end_monitor ;################## Cleaning up ################## monitor_event ScrollOpened ScrollOpened post_battle_scroll set_counter fire_labels 0 set_counter player_unit_count 0 set_counter enemy_unit_count 0 set_counter open_battle 0 set_counter labels_only 0 set_counter stakes_lock 0 ;;;;;;;Checks set_counter check_timer 0 set_counter elephant_fix_check 0 set_counter elephant_fix_check_sally 0 set_counter reinf_check 0 set_counter sally_defense_check 0 ;;;;;;;Stakes set_counter label_ready 0 set_counter stakes_on 0 ;;;;;;;Reinforcements set_counter army4_ready 0 set_counter army4_ready_siege 0 set_counter army3_ready 0 set_counter army_moving 0 set_counter def_reinf_arrive 0 set_counter att_reinf_arrive 0 set_counter reinf_late 0 set_counter army4_run 0 set_counter army4_run_siege 0 set_counter army3_run 0 set_counter distance_trigger1 0 set_counter distance_trigger2 0 set_counter distance_trigger3 0 set_counter distance_trigger4 0 set_counter distance_trigger5 0 ;;;;;;;HA Fix set_counter ha_fix 0 ;;;;;;;Elephant Fix set_counter elephant_fix 0 set_counter elephant_gate 0 set_counter elephant_gate_s 0 set_counter elephant_gate_tier2 0 set_counter elephant_gate_tier3 0 set_counter elephant_gate_tier2s 0 set_counter elephant_gate_tier3s 0 set_counter rally_walls 0 set_counter rally_walls_s 0 set_counter second_ring 0 set_counter third_ring 0 set_counter second_ring_s 0 set_counter third_ring_s 0 set_counter del_objective 0 set_counter del_objective_s 0 ;;;;;;;Sally-out set_counter sally-out_fix 0 set_counter sally_defense 0 set_counter reform_back 0

set_counter reform_multi 0 set_counter unit_under_fire 0 set_counter kill_sally 0 set_counter sally_reinf 0 set_counter reset_position 0 set_counter defend_location 0 set_counter reset_army2 0 set_counter assign_labels 0 ;;;;;;;Siege set_counter siege_fix 0 set_counter army_sieging 0 set_counter army_south 0 set_counter army_north 0 set_counter army_east 0 set_counter army_west 0 set_counter emergency_stop 0 set_counter omfg_cannon_tower 0 set_counter army2_sally 0 set_counter wall_advance_s 0 ;;;;;;;Protect General set_counter protect_general 0 set_counter general_wait 0 set_counter protect_siege 0 set_counter g_stop 0 ;;;;;;;Sally-out, AI defending set_counter army4_ready_sally 0 set_counter army4_location 0 set_counter path_n 0 set_counter path_ne 0 set_counter path_e 0 set_counter path_se 0 set_counter path_s 0 set_counter path_sw 0 set_counter path_w 0 set_counter path_nw 0 set_counter obstacle_check 0 set_counter label_army4 0 set_counter army4_moving_s 0 set_counter army4_idle_s 0 set_counter line_passed 0 set_counter army2_idle_s 0 set_counter army4_idle_r 0 set_counter wall_line_passed 0 set_counter reset_position_s 0 set_counter repeat_test1 0 set_counter repeat_test2 0 set_counter repeat_test3 0 set_counter repeat_test4 0 set_counter repeat_test5 0 set_counter repeat_test6 0 ;;;;;;;Open Battles set_counter ob_defense_launch 0 set_counter ob_defend 0 set_counter ob_siege_attack 0 set_counter ob_under_fire 0 set_counter ob_repeat_test 0 set_counter ob_engaged 0 set_counter player_units_closing 0 set_counter player_enveloping 0 set_counter player_engaged_reinf 0

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

set_counter a2u19_distance 0 set_counter a2u20_distance 0 ;;;;;;;Custom Settlements ;;;;;;;Imladris AI set_counter imladris_check 0 set_counter imladris_siege_check 0 set_counter imladris_sally_check 0 set_counter imladris_under_fire 0 set_counter terminate_imladris_check 0 set_counter melee_count 0 ;;;;;;;Common set_counter g1_missile 0 set_counter u2_missile 0 set_counter u3_missile 0 set_counter u4_missile 0 set_counter u5_missile 0 set_counter u6_missile 0 set_counter u7_missile 0 set_counter u8_missile 0 set_counter u9_missile 0 set_counter u10_missile 0 set_counter u11_missile 0 set_counter u12_missile 0 set_counter u13_missile 0 set_counter u14_missile 0 set_counter u15_missile 0 set_counter u16_missile 0 set_counter u17_missile 0 set_counter u18_missile 0 set_counter u19_missile 0 set_counter u20_missile 0 set_counter g1_lock 0 set_counter u2_lock 0 set_counter u3_lock 0 set_counter u4_lock 0 set_counter u5_lock 0 set_counter u6_lock 0 set_counter u7_lock 0 set_counter u8_lock 0 set_counter u9_lock 0 set_counter u10_lock 0 set_counter u11_lock 0 set_counter u12_lock 0 set_counter u13_lock 0 set_counter u14_lock 0 set_counter u15_lock 0 set_counter u16_lock 0 set_counter u17_lock 0 set_counter u18_lock 0 set_counter u19_lock 0 set_counter u20_lock 0 set_counter g1_attacking 0 set_counter u2_attacking 0 set_counter u3_attacking 0 set_counter u4_attacking 0 set_counter u5_attacking 0 set_counter u6_attacking 0 set_counter u7_attacking 0 set_counter u8_attacking 0 set_counter u9_attacking 0

set_counter u10_attacking 0 set_counter u11_attacking 0 set_counter u12_attacking 0 set_counter u13_attacking 0 set_counter u14_attacking 0 set_counter u15_attacking 0 set_counter u16_attacking 0 set_counter u17_attacking 0 set_counter u18_attacking 0 set_counter u19_attacking 0 set_counter u20_attacking 0 ; suspend_unscripted_advice false end_monitor ;=======================================================; ;================= ADDITIONAL SCRIPTS ==================; ;=======================================================;

You might also like