reallybadai_scripts_v5.txt

Download ReallyBadAI_Scripts_v5.txt

If you can't read please download the document

Upload: federicohc

Post on 19-Oct-2015

23 views

Category:

Documents


0 download

TRANSCRIPT

;======================================================== ;===================== 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_sdeclare_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_sdeclare_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_distancedeclare_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_lockdeclare_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 ! FactionIsLocaland ! 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 0set_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 0set_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 0set_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 0set_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 0if 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 = 20end_if end_if end_if end_if end_if end_if end_if end_if end_if 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 > 11inc_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 = 20if 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 a1u4end_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 1u11a1u5 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 aend_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_ifa1u6 a1u7 a1u8 a1u9 a1u10 aa1u6 a1u7 a1u8 a1u9 a1u10 aa1u6 a1u7 a1u8 a1u9 a1u10 aa1u6 a1u7 a1u8 a1u9 a1u10 aa1u6 a1u7 a1u8 a1u9 a1u10 aa1u6 a1u7 a1u8 a1u9 a1u10 aa1u6 a1u7 a1u8 a1u9 a1u10 aa1u6 a1u7 a1u8 a1u9 a1u10 aa1u6 a1u7 a1u8 a1u9 a1u10 a a1u20if 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 a2u17a2u4 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 aa2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 aa2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 aa2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 aa2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 aa2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 aa2u4 a2u5 a2u6 a2u7 a2u8 a2u9 a2u10 aend_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 > 14a2u6 a2u7 a2u8 a2u9 a2u10 aa2u6 a2u7 a2u8 a2u9 a2u10 aa2u6 a2u7 a2u8 a2u9 a2u10 a a2u20label_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 > 6inc_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 = 20if 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 aend_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 = 18a1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 aa1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 aa1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 aa1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 aa1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 aa1u4 a1u5 a1u6 a1u7 a1u8 a1u9 a1u10 adefine_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 a2u15a1u6 a1u7 a1u8 a1u9 a1u10 aa1u6 a1u7 a1u8 a1u9 a1u10 aa1u6 a1u7 a1u8 a1u9 a1u10 a a1u20a2u6 a2u6 a2u7 a2u6 a2u7 a2u8 a2u6 a2u7 a2u8 a2u9 a2u6 a2u7 a2u8 a2u9 a2u10 a2u6 a2u7 a2u8 a2u9 a2u10 aa2u6 a2u7 a2u8 a2u9 a2u10 aa2u6 a2u7 a2u8 a2u9 a2u10 aa2u6 a2u7 a2u8 a2u9 a2u10 aa2u6 a2u7 a2u8 a2u9 a2u10 aend_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_ifa2u6 a2u7 a2u8 a2u9 a2u10 aa2u6 a2u7 a2u8 a2u9 a2u10 aa2u6 a2u7 a2u8 a2u9 a2u10 aa2u6 a2u7 a2u8 a2u9 a2u10 aa2u6 a2u7 a2u8 a2u9 a2u10 a a2u20if 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_BattlePlayerArmyIsAttackerand 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_side200-200> 200< -200set_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_BattleIsRiverBattle200-200> 200< -200and ! 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 a3u20define_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 = 100set_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 offbattle_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 < 300set_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 a4u20unit_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 < 100set_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_BattleStartedand 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_ifif 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> 1set_counter set_counter set_counter set_counter set_counter end_if end_ifpath_s 1 path_sw 2 path_w 3 path_nw 4 path_n 5if 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> 1if 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> 1if 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 = 5and 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> 1if 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 2end_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 = 8and 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 20if 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 a4u20unit_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 onset_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 130if 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_monitormonitor_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_ifend_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 = 0and 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 1end_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 1battle_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_ifbattle_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_BattleIsSallyOutBattleand 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= 2and 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= 2and 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 30if 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= 2if 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= 2and 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= 2end_if end_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= 2and 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= 2and 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= 2battle_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= 2battle_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= 2monitor_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 = 2and 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