script
;show the whole map
restrict_strat_radar false
;setup some event counters
monitor_event FactionTurnStart
;setup LITHUANIA CONVERSION counters
add_events
event counter lithuania_conversion_accepted
event counter lithuania_conversion_declined
event counter lithuania_conversion_timer
date 0
end_add_events
generate_random_counter lithuania_conversion_timer 0 25
set_event_counter lithuania_conversion_accepted 0
set_event_counter lithuania_conversion_declined 0
;setup KALMAR UNION counters
add_events
event counter kalmar_union
event counter kalmar_question_accepted
date 0
end_add_events
set_event_counter kalmar_union 0
set_event_counter kalmar_question_accepted 0
;setup HANSEATIC LEAGUE counters
add_events
event counter hansaetic_formation_timer
event counter hanseatic_constructed
date 0
end_add_events
generate_random_counter hanseatic_formation_timer 0 10
set_event_counter hanseatic_constructed 0 ;DONT RENAME - counter referenced by name in export_descr_guilds
;setup CRUSADING NOBLE counters
declare_counter teutonic_lithuania_allied 0
declare_counter crusader1_active 0
declare_counter crusader2_active 0
declare_counter crusader3_active 0
add_events
event counter crusader1_timer
event counter crusader2_timer
event counter crusader3_timer
date 0
end_add_events
generate_random_counter crusader1_timer 0 10
generate_random_counter crusader2_timer 0 10
generate_random_counter crusader3_timer 0 30
;setup TECH TREE counters
add_events
event counter pagan_lithuania ;DONT RENAME - counter referenced by name in export_descr_buildings
event counter not_pagan_lithuania ;DONT RENAME - counter referenced by name in export_descr_buildings
event counter not_teutonic ;DONT RENAME - counter referenced by name in export_descr_buildings
date 0
end_add_events
set_event_counter pagan_lithuania 0
set_event_counter not_pagan_lithuania 0
set_event_counter not_teutonic 0
terminate_monitor
end_monitor
;------------------- TECHTREE -------------------;
monitor_event PreFactionTurnStart not FactionType lithuania
and not FactionType teutonic_order
set_event_counter pagan_lithuania 0
set_event_counter not_pagan_lithuania 1
set_event_counter not_teutonic 1
end_monitor
monitor_event PreFactionTurnStart FactionType lithuania
set_event_counter pagan_lithuania 1
set_event_counter not_pagan_lithuania 0
set_event_counter not_teutonic 1
if I_EventCounter lithuania_conversion_accepted = 1
set_event_counter pagan_lithuania 0
set_event_counter not_pagan_lithuania 1
end_if
end_monitor
monitor_event PreFactionTurnStart FactionType teutonic_order
set_event_counter not_teutonic 0
set_event_counter pagan_lithuania 0
set_event_counter not_pagan_lithuania 1
end_monitor
;set counters on FactionTurnStart once only to ensure correct tech tree options are present at turn 0
monitor_event FactionTurnStart not FactionType lithuania
and not FactionType teutonic_order
set_event_counter pagan_lithuania 0
set_event_counter not_pagan_lithuania 1
set_event_counter not_teutonic 1
terminate_monitor
end_monitor
monitor_event FactionTurnStart FactionType lithuania
set_event_counter pagan_lithuania 1
set_event_counter not_pagan_lithuania 0
set_event_counter not_teutonic 1
if I_EventCounter lithuania_conversion_accepted = 1
set_event_counter pagan_lithuania 0
set_event_counter not_pagan_lithuania 1
end_if
terminate_monitor
end_monitor
monitor_event FactionTurnStart FactionType teutonic_order
set_event_counter not_teutonic 0
set_event_counter pagan_lithuania 0
set_event_counter not_pagan_lithuania 1
terminate_monitor
end_monitor
;teutonic_order does not allow the brothel/tavern chain in their cities
monitor_event GeneralCaptureSettlement FactionType teutonic_order
destroy_buildings teutonic_order taverns true
end_monitor
monitor_event GiveSettlement TargetFactionType teutonic_order
destroy_buildings teutonic_order taverns true
end_monitor
monitor_event CityRebels TargetFactionType teutonic_order
destroy_buildings teutonic_order taverns true
end_monitor
monitor_event GovernorCityRebels TargetFactionType teutonic_order
destroy_buildings teutonic_order taverns true
end_monitor
monitor_event FactionTurnStart FactionType teutonic_order
destroy_buildings teutonic_order taverns true
end_monitor
;------------------- LITHUANIA CONVERSION TO CATHOLICISM -------------------;
;increment the timer for conversion offer
monitor_event FactionTurnStart FactionType lithuania
inc_event_counter lithuania_conversion_timer 1
if I_EventCounter lithuania_conversion_accepted = 1
terminate_monitor
end_if
end_monitor
;offer the conversion to Lithuania if the correct conditions are met
monitor_event FactionTurnStart FactionType lithuania
if I_NumberOfSettlements lithuania < 5
and I_EventCounter lithuania_conversion_timer >= 37
and I_EventCounter lithuania_conversion_accepted = 0
;offer conversion to christianity
historic_event lithuania_conversion true factions { lithuania, }
;if AI random chance to accept
if I_IsFactionAIControlled lithuania
generate_random_counter random_accept 0 2
if I_EventCounter random_accept < 2
set_event_counter lithuania_conversion_accepted 1
end_if
end_if
terminate_monitor
end_if
if I_EventCounter lithuania_conversion_timer >= 65
and I_EventCounter lithuania_conversion_accepted = 0
;offer conversion to christianity
historic_event lithuania_conversion true factions { lithuania, }
;if AI random chance to accept
if I_IsFactionAIControlled lithuania
generate_random_counter random_accept 0 2
if I_EventCounter random_accept < 2
set_event_counter lithuania_conversion_accepted 1
end_if
end_if
terminate_monitor
end_if
end_monitor
monitor_conditions I_EventCounter lithuania_conversion_accepted = 1
;Three easy steps for conversion
;1 - Convert the people
set_religion lithuania catholic
change_population_religion lithuania catholic 75 pagan
;2 - Destroy the pagan buildings
destroy_buildings lithuania temple_dievas true
destroy_buildings lithuania temple_dievas_castle true
destroy_buildings lithuania temple_perkunas true
destroy_buildings lithuania temple_perkunas_castle true
destroy_buildings lithuania temple_giltine true
destroy_buildings lithuania temple_giltine_castle true
;3 - Disband the pagan units
retire_characters Lithuania priest
destroy_units Lithuania pagan_unit
;notify all factions that Lithuania has converted and become Catholic
historic_event lithuania_converts event/Lithuania_converts.bik
set_event_counter pagan_lithuania 0
set_event_counter not_pagan_lithuania 1
; change teutonic order ai label
link_faction_ai teutonic_order teutonic_order_non_pagan
link_faction_ai poland poland_non_pagan
link_faction_ai lithuania lithuania_non_pagan
terminate_monitor
end_monitor
;------------------- KALMAR UNION FORMATION -------------------;
;Notify the player early in the game about to possibility to form the kalmar union
monitor_event FactionTurnStart FactionType denmark
and I_TurnNumber = 8
historic_event kalmar_notification factions { denmark, }
terminate_monitor
end_monitor
monitor_event FactionTurnStart FactionType denmark
and I_TurnNumber > 8
and I_NumberOfSettlements norway > 0
if I_SettlementOwner Kalmar denmark
and I_SettlementOwner Goteborg denmark
and I_SettlementOwner Uppsala denmark
and I_SettlementOwner Visby denmark
and I_SettlementOwner Abo denmark
historic_event kalmar_stage2 factions { denmark, }
terminate_monitor
end_if
end_monitor
monitor_event BecomesFactionLeader FactionType norway
and I_TurnNumber > 9
if I_SettlementOwner Kalmar denmark
and I_SettlementOwner Goteborg denmark
and I_SettlementOwner Uppsala denmark
and I_SettlementOwner Visby denmark
and I_SettlementOwner Abo denmark
historic_event kalmar_question true factions { denmark, }
if I_IsFactionAIControlled denmark
set_event_counter kalmar_question_accepted 1
end_if
terminate_monitor
end_if
end_monitor
monitor_conditions I_EventCounter kalmar_question_accepted = 1
;apply kalmar union faction banner to denmark
set_faction_banner
faction denmark
banner kalmar_union
end_set_faction_banner
;turn over norways assets to denmark
give_everything_to_faction norway denmark false
historic_event denmark_joins_kalmar event/Kalmar_union.bik
terminate_monitor
end_monitor
;------------------- HANSEATIC LEAGUE -------------------;
;announcement event
monitor_event SettlementTurnStart SettlementName Visby
inc_event_counter hanseatic_formation_timer 1
if I_EventCounter hanseatic_formation_timer >= 25
historic_event hanseatic_formation factions { teutonic_order, denmark, novgorod, poland, hre, }
terminate_monitor
end_if
end_monitor
monitor_event GuildUpgraded BuildingName = hanseatic_guild
and FactionType teutonic_order
if I_EventCounter lithuania_conversion_accepted = 1
historic_event hanseatic_built_teutonic factions { lithuania, denmark, novgorod, poland, hre, }
end_if
if I_EventCounter lithuania_conversion_accepted = 0
historic_event hanseatic_built_teutonic factions { denmark, novgorod, poland, hre, }
end_if
end_monitor
monitor_event GuildUpgraded BuildingName = hanseatic_guild
and FactionType lithuania
historic_event hanseatic_built_teutonic factions { teutonic_order, denmark, novgorod, poland, hre, }
end_monitor
monitor_event GuildUpgraded BuildingName = hanseatic_guild
and FactionType denmark
if I_EventCounter lithuania_conversion_accepted = 1
historic_event hanseatic_built_teutonic factions { lithuania, teutonic_order, novgorod, poland, hre, }
end_if
if I_EventCounter lithuania_conversion_accepted = 0
historic_event hanseatic_built_teutonic factions { teutonic_order, novgorod, poland, hre, }
end_if
end_monitor
monitor_event GuildUpgraded BuildingName = hanseatic_guild
and FactionType novgorod
if I_EventCounter lithuania_conversion_accepted = 1
historic_event hanseatic_built_teutonic factions { lithuania, denmark, teutonic_order, poland, hre, }
end_if
if I_EventCounter lithuania_conversion_accepted = 0
historic_event hanseatic_built_teutonic factions { denmark, teutonic_order, poland, hre, }
end_if
end_monitor
monitor_event GuildUpgraded BuildingName = hanseatic_guild
and FactionType poland
if I_EventCounter lithuania_conversion_accepted = 1
historic_event hanseatic_built_teutonic factions { lithuania, denmark, teutonic_order, novgorod, hre, }
end_if
if I_EventCounter lithuania_conversion_accepted = 0
historic_event hanseatic_built_teutonic factions { denmark, teutonic_order, novgorod, hre, }
end_if
end_monitor
monitor_event GuildUpgraded BuildingName = hanseatic_guild
and FactionType hre
if I_EventCounter lithuania_conversion_accepted = 1
historic_event hanseatic_built_teutonic factions { lithuania, denmark, teutonic_order, novgorod, poland, }
end_if
if I_EventCounter lithuania_conversion_accepted = 0
historic_event hanseatic_built_teutonic factions { denmark, teutonic_order, novgorod, poland, }
end_if
end_monitor
monitor_event GuildUpgraded BuildingName = hanseatic_guild
set_event_counter hanseatic_constructed 1
reset_guild_standing hanseatic_guild
end_monitor
monitor_event BuildingDestroyed BuildingName = hanseatic_guild
and FactionType teutonic_order
if I_EventCounter lithuania_conversion_accepted = 1
historic_event hanseatic_destroyed factions { lithuania, denmark, novgorod, poland, hre, }
end_if
if I_EventCounter lithuania_conversion_accepted = 0
historic_event hanseatic_destroyed factions { denmark, novgorod, poland, hre, }
end_if
end_monitor
monitor_event BuildingDestroyed BuildingName = hanseatic_guild
and FactionType lithuania
historic_event hanseatic_destroyed factions { teutonic_order, denmark, novgorod, poland, hre, }
end_monitor
monitor_event BuildingDestroyed BuildingName = hanseatic_guild
and FactionType denmark
if I_EventCounter lithuania_conversion_accepted = 1
historic_event hanseatic_destroyed factions { lithuania, teutonic_order, novgorod, poland, hre, }
end_if
if I_EventCounter lithuania_conversion_accepted = 0
historic_event hanseatic_destroyed factions { teutonic_order, novgorod, poland, hre, }
end_if
end_monitor
monitor_event BuildingDestroyed BuildingName = hanseatic_guild
and FactionType novgorod
if I_EventCounter lithuania_conversion_accepted = 1
historic_event hanseatic_destroyed factions { lithuania, teutonic_order, denmark, poland, hre, }
end_if
if I_EventCounter lithuania_conversion_accepted = 0
historic_event hanseatic_destroyed factions { teutonic_order, denmark, poland, hre, }
end_if
end_monitor
monitor_event BuildingDestroyed BuildingName = hanseatic_guild
and FactionType poland
if I_EventCounter lithuania_conversion_accepted = 1
historic_event hanseatic_destroyed factions { lithuania, teutonic_order, denmark, novgorod, hre, }
end_if
if I_EventCounter lithuania_conversion_accepted = 0
historic_event hanseatic_destroyed factions { teutonic_order, denmark, novgorod, hre, }
end_if
end_monitor
monitor_event BuildingDestroyed BuildingName = hanseatic_guild
and FactionType hre
if I_EventCounter lithuania_conversion_accepted = 1
historic_event hanseatic_destroyed factions { lithuania, teutonic_order, denmark, novgorod, poland, }
end_if
if I_EventCounter lithuania_conversion_accepted = 0
historic_event hanseatic_destroyed factions { teutonic_order, denmark, novgorod, poland, }
end_if
end_monitor
monitor_event BuildingDestroyed BuildingName = hanseatic_guild
set_event_counter hanseatic_constructed 0
reset_guild_standing hanseatic_guild
end_monitor
;------------------- CRUSADING NOBLES -------------------;
;increment crusader spawn timers
monitor_event FactionTurnStart FactionType teutonic_order
inc_event_counter crusader1_timer 1
inc_event_counter crusader2_timer 1
inc_event_counter crusader3_timer 1
end_monitor
;monitor the alliance status of lithuania and the teutonic order
monitor_event FactionAllianceDeclared FactionType teutonic_order
and TargetFactionType lithuania
set_counter teutonic_lithuania_allied 1
end_monitor
monitor_event FactionAllianceDeclared FactionType lithuania
and TargetFactionType teutonic_order
set_counter teutonic_lithuania_allied 1
end_monitor
monitor_event FactionBreakAlliance FactionType teutonic_order
and TargetFactionType lithuania
set_counter teutonic_lithuania_allied 0
end_monitor
monitor_event FactionBreakAlliance FactionType lithuania
and TargetFactionType teutonic_order
set_counter teutonic_lithuania_allied 0
end_monitor
;spawn an army with the labelled character and 'adv_crusade' tagged unit
monitor_event FactionTurnStart I_EventCounter crusader1_timer >= 15
and I_EventCounter crusader1_timer <= 20
and I_CompareCounter teutonic_lithuania_allied = 0
and I_NumberOfSettlements lithuania > 0
and I_EventCounter lithuania_conversion_accepted = 0
set_counter crusader1_active 1
spawn_army
faction teutonic_order
character Ulrich Salier, admiral, age 31, x 57, y 53, direction SE
unit cog exp 0 armour 0 weapon_lvl 0
unit cog exp 0 armour 0 weapon_lvl 0
unit cog exp 0 armour 0 weapon_lvl 0
end
spawn_army
faction teutonic_order
character Charles, named character, x 57, y 53, label crus1, battle_model Adv_Northern_General_Eng
traits LoyaltyStarter 1, ReligionStarter 1, Upright 2, GoodAttacker 1, PublicFaith 2, EnglishCrusader 1
unit Adv English Bodyguard exp 0 armour 0 weapon_lvl 0
unit Adv Levy Spearmen exp 0 armour 0 weapon_lvl 0
unit Adv Levy Spearmen exp 0 armour 0 weapon_lvl 0
unit Adv Levy Spearmen exp 0 armour 0 weapon_lvl 0
unit Adv Feudal Knights exp 0 armour 0 weapon_lvl 0
unit Adv Feudal Knights exp 0 armour 0 weapon_lvl 0
unit Adv Dismounted Feudal Knights exp 0 armour 0 weapon_lvl 0
unit Adv Dismounted Feudal Knights exp 0 armour 0 weapon_lvl 0
unit Adv Dismounted Feudal Knights exp 0 armour 0 weapon_lvl 0
end
create_mission adventure_crusader teutonic_order crus1
create_mission kill_crusader lithuania crus1
terminate_monitor
end_monitor
monitor_event FactionTurnStart I_EventCounter crusader2_timer >= 46
and I_EventCounter crusader2_timer <= 52
and I_CompareCounter teutonic_lithuania_allied = 0
and I_NumberOfSettlements lithuania > 0
and I_EventCounter lithuania_conversion_accepted = 0
set_counter crusader2_active 1
spawn_army
faction teutonic_order
character Kurt, admiral, age 25, x 57, y 60, direction SE
unit cog exp 0 armour 0 weapon_lvl 0
unit cog exp 0 armour 0 weapon_lvl 0
unit cog exp 0 armour 0 weapon_lvl 0
end
spawn_army
faction teutonic_order
character Philipp, named character, x 57, y 60, label crus2, battle_model Adv_Northern_General_Fra
traits LoyaltyStarter 1, ReligionStarter 1, Loyal 3, BadAttacker 2, Girls 3, BadSiegeAttacker 2, FrenchCrusader 1
unit Adv French Generals Bodyguard exp 0 armour 0 weapon_lvl 0
unit Adv Religious Fanatics exp 0 armour 0 weapon_lvl 0
unit Adv Religious Fanatics exp 0 armour 0 weapon_lvl 0
unit Adv Religious Fanatics exp 0 armour 0 weapon_lvl 0
unit Adv Religious Fanatics exp 0 armour 0 weapon_lvl 0
unit Adv Dismounted French Archers exp 0 armour 0 weapon_lvl 0
unit Adv Dismounted French Archers exp 0 armour 0 weapon_lvl 0
unit Adv French Mounted Archers exp 0 armour 0 weapon_lvl 0
unit Adv Chivalric Knights exp 0 armour 0 weapon_lvl 0
unit Adv Chivalric Knights exp 0 armour 0 weapon_lvl 0
unit Adv Dismounted Chivalric Knights exp 0 armour 0 weapon_lvl 0
unit Adv Dismounted Chivalric Knights exp 0 armour 0 weapon_lvl 0
end
create_mission adventure_crusader teutonic_order crus2
create_mission kill_crusader lithuania crus2
terminate_monitor
end_monitor
monitor_event FactionTurnStart I_EventCounter crusader3_timer > 98
and I_CompareCounter teutonic_lithuania_allied = 0
and I_NumberOfSettlements lithuania > 0
and I_EventCounter lithuania_conversion_accepted = 0
set_counter crusader3_active 1
spawn_army
faction teutonic_order
character Ortwinus, admiral, age 38, x 53, y 53, direction S
unit holk exp 0 armour 0 weapon_lvl 0
unit holk exp 0 armour 0 weapon_lvl 0
unit holk exp 0 armour 0 weapon_lvl 0
end
spawn_army
faction teutonic_order
character Henry, named character, x 53, y 53, label crus3, battle_model Adv_Northern_General_Eng
traits LoyaltyStarter 1, ReligionStarter 1, Upright 1, Drink 5, Stoic 1, Just 1, EnglishCrusader 1
unit Adv English Late Bodyguard exp 0 armour 0 weapon_lvl 0
unit Adv Longbowmen exp 0 armour 0 weapon_lvl 0
unit Adv Longbowmen exp 0 armour 0 weapon_lvl 0
unit Adv Longbowmen exp 0 armour 0 weapon_lvl 0
unit Adv Longbowmen exp 0 armour 0 weapon_lvl 0
unit Adv English Knights exp 0 armour 0 weapon_lvl 0
unit Adv English Knights exp 0 armour 0 weapon_lvl 0
unit Adv Dismounted English Knights exp 0 armour 0 weapon_lvl 0
unit Adv Dismounted English Knights exp 0 armour 0 weapon_lvl 0
end
create_mission adventure_crusader teutonic_order crus3
create_mission kill_crusader lithuania crus3
terminate_monitor
end_monitor
monitor_event MissionFinished MissionID adventure_crusader
;kill the adventure crusader
if I_CompareCounter crusader1_active = 1
kill_character crus1
destroy_units teutonic_order adv_crusade_eng
set_counter crusader1_active 0
end_if
if I_CompareCounter crusader2_active = 1
kill_character crus2
destroy_units teutonic_order adv_crusade_fra
set_counter crusader2_active 0
end_if
if I_CompareCounter crusader3_active = 1
kill_character crus3
destroy_units teutonic_order adv_crusade_eng
set_counter crusader3_active 0
end_if
;kill his units
end_monitor
;--------------- HOCHMEISTER BATTLE MODEL -----------------;
;apply the Hochmeister battle_model to the Teutonic Order faction leader whenever a new leader is assigned
monitor_event BecomesFactionLeader FactionType teutonic_order
change_battle_model teutonic_order leader Teutonic_Hochmeister
end_monitor
;------------------- REVEALED TILES ------------------------;
; reveal certain tiles to certain factions
monitor_event FactionTurnStart FactionType lithuania
and not I_IsFactionAIControlled lithuania
reveal_tile 81, 5
reveal_tile 92, 1
reveal_tile 134, 16
reveal_tile 129, 2
reveal_tile 118, 27
reveal_tile 129, 50
reveal_tile 70, 13
hide_all_revealed_tiles
terminate_monitor
end_monitor
monitor_event FactionTurnStart FactionType teutonic_order
and not I_IsFactionAIControlled teutonic_order
reveal_tile 30, 37
reveal_tile 18, 21
reveal_tile 31, 2
reveal_tile 2, 25
reveal_tile 70, 13
reveal_tile 66, 1
reveal_tile 82, 58
reveal_tile 88, 92
hide_all_revealed_tiles
terminate_monitor
end_monitor
monitor_event FactionTurnStart FactionType denmark
if not I_IsFactionAIControlled denmark
reveal_tile 2, 25
reveal_tile 18, 21
reveal_tile 41, 70
reveal_tile 21, 79
reveal_tile 55, 74
reveal_tile 86, 83
reveal_tile 76, 82
reveal_tile 120, 88
hide_all_revealed_tiles
end_if
terminate_monitor
end_monitor
monitor_event FactionTurnStart FactionType poland
if not I_IsFactionAIControlled poland
reveal_tile 60, 36
reveal_tile 65, 46
reveal_tile 60, 36
reveal_tile 84, 33
reveal_tile 31, 2
reveal_tile 32, 21
reveal_tile 30, 37
hide_all_revealed_tiles
end_if
terminate_monitor
end_monitor
monitor_event FactionTurnStart FactionType poland
if not I_IsFactionAIControlled poland
reveal_tile 60, 36
reveal_tile 65, 46
reveal_tile 60, 36
reveal_tile 84, 33
reveal_tile 31, 2
reveal_tile 32, 21
reveal_tile 30, 37
hide_all_revealed_tiles
end_if
terminate_monitor
end_monitor
monitor_event FactionTurnStart FactionType novgorod
if not I_IsFactionAIControlled novgorod
reveal_tile 103, 94
reveal_tile 86, 83
reveal_tile 100, 59
reveal_tile 113, 35
reveal_tile 134, 16
reveal_tile 85, 68
hide_all_revealed_tiles
end_if
terminate_monitor
end_monitor
monitor_event FactionTurnStart FactionType hre
if not I_IsFactionAIControlled hre
reveal_tile 32, 21
reveal_tile 47, 19
reveal_tile 3, 43
reveal_tile 19, 58
reveal_tile 58, 24
reveal_tile 60, 36
hide_all_revealed_tiles
end_if
terminate_monitor
end_monitor
;------------------- AI KINGS PURSE BONUS -------------------;
;money granted to AI as they do not carry out missions
monitor_event FactionTurnStart I_TurnNumber >= 0
and CampaignDifficulty = easy
if I_IsFactionAIControlled teutonic_order
increment_kings_purse teutonic_order 1000
end_if
if I_IsFactionAIControlled lithuania
increment_kings_purse lithuania 1000
end_if
if I_IsFactionAIControlled denmark
increment_kings_purse denmark 1000
end_if
if I_IsFactionAIControlled novgorod
increment_kings_purse novgorod 1000
end_if
if I_IsFactionAIControlled poland
increment_kings_purse poland 1000
end_if
if I_IsFactionAIControlled hre
increment_kings_purse hre 1000
end_if
if I_IsFactionAIControlled norway
increment_kings_purse norway 200
end_if
if I_IsFactionAIControlled mongols
increment_kings_purse mongols 1000
end_if
terminate_monitor
end_monitor
monitor_event FactionTurnStart I_TurnNumber >= 0
and CampaignDifficulty = medium
if I_IsFactionAIControlled teutonic_order
increment_kings_purse teutonic_order 2000
end_if
if I_IsFactionAIControlled lithuania
increment_kings_purse lithuania 2000
end_if
if I_IsFactionAIControlled denmark
increment_kings_purse denmark 2000
end_if
if I_IsFactionAIControlled novgorod
increment_kings_purse novgorod 2000
end_if
if I_IsFactionAIControlled poland
increment_kings_purse poland 2000
end_if
if I_IsFactionAIControlled hre
increment_kings_purse hre 2000
end_if
if I_IsFactionAIControlled norway
increment_kings_purse norway 400
end_if
if I_IsFactionAIControlled mongols
increment_kings_purse mongols 2000
end_if
terminate_monitor
end_monitor
monitor_event FactionTurnStart I_TurnNumber >= 0
and CampaignDifficulty = hard
if I_IsFactionAIControlled teutonic_order
increment_kings_purse teutonic_order 4000
end_if
if I_IsFactionAIControlled lithuania
increment_kings_purse lithuania 4000
end_if
if I_IsFactionAIControlled denmark
increment_kings_purse denmark 4000
end_if
if I_IsFactionAIControlled novgorod
increment_kings_purse novgorod 4000
end_if
if I_IsFactionAIControlled poland
increment_kings_purse poland 4000
end_if
if I_IsFactionAIControlled hre
increment_kings_purse hre 4000
end_if
if I_IsFactionAIControlled norway
increment_kings_purse norway 800
end_if
if I_IsFactionAIControlled mongols
increment_kings_purse mongols 4000
end_if
terminate_monitor
end_monitor
monitor_event FactionTurnStart I_TurnNumber >= 0
and CampaignDifficulty = very_hard
if I_IsFactionAIControlled teutonic_order
increment_kings_purse teutonic_order 7000
end_if
if I_IsFactionAIControlled lithuania
increment_kings_purse lithuania 7000
end_if
if I_IsFactionAIControlled denmark
increment_kings_purse denmark 7000
end_if
if I_IsFactionAIControlled novgorod
increment_kings_purse novgorod 7000
end_if
if I_IsFactionAIControlled poland
increment_kings_purse poland 7000
end_if
if I_IsFactionAIControlled hre
increment_kings_purse hre 7000
end_if
if I_IsFactionAIControlled norway
increment_kings_purse norway 1400
end_if
if I_IsFactionAIControlled mongols
increment_kings_purse mongols 7000
end_if
terminate_monitor
end_monitor
;------------------- AI LAST STAND BONUS -------------------;
; allow each AI faction to make a last stand when they near destruction
monitor_event FactionTurnStart FactionType teutonic_order
and I_TurnNumber > 15
and I_NumberOfSettlements teutonic_order < 4
and IsFactionAIControlled
add_money teutonic_order 10000
terminate_monitor
end_monitor
monitor_event FactionTurnStart FactionType lithuania
and I_TurnNumber > 15
and I_NumberOfSettlements lithuania < 4
and IsFactionAIControlled
add_money lithuania 10000
terminate_monitor
end_monitor
monitor_event FactionTurnStart FactionType denmark
and I_TurnNumber > 15
and I_NumberOfSettlements denmark < 4
and IsFactionAIControlled
add_money denmark 10000
terminate_monitor
end_monitor
monitor_event FactionTurnStart FactionType novgorod
and I_TurnNumber > 15
and I_NumberOfSettlements novgorod < 4
and IsFactionAIControlled
add_money novgorod 10000
terminate_monitor
end_monitor
monitor_event FactionTurnStart FactionType poland
and I_TurnNumber > 15
and I_NumberOfSettlements poland < 4
and IsFactionAIControlled
add_money poland 10000
terminate_monitor
end_monitor
monitor_event FactionTurnStart FactionType hre
and I_TurnNumber > 15
and I_NumberOfSettlements hre < 4
and IsFactionAIControlled
add_money hre 10000
terminate_monitor
end_monitor
monitor_event FactionTurnStart FactionType norway
and I_TurnNumber > 15
and I_NumberOfSettlements norway < 2
and IsFactionAIControlled
add_money norway 2000
terminate_monitor
end_monitor
monitor_event FactionTurnStart FactionType mongols
and I_TurnNumber > 15
and I_NumberOfSettlements mongols < 4
and IsFactionAIControlled
add_money mongols 10000
terminate_monitor
end_monitor
;------------------- AI DEBT -------------------;
monitor_event FactionTurnStart FactionType teutonic_order
and IsFactionAIControlled
and Treasury < -5000
add_money teutonic_order 10000
end_monitor
monitor_event FactionTurnStart FactionType lithuania
and IsFactionAIControlled
and Treasury < -5000
add_money lithuania 10000
end_monitor
monitor_event FactionTurnStart FactionType denmark
and IsFactionAIControlled
and Treasury < -5000
add_money denmark 10000
end_monitor
monitor_event FactionTurnStart FactionType novgorod
and IsFactionAIControlled
and Treasury < -5000
add_money novgorod 10000
end_monitor
monitor_event FactionTurnStart FactionType poland
and IsFactionAIControlled
and Treasury < -5000
add_money poland 10000
end_monitor
monitor_event FactionTurnStart FactionType norway
and IsFactionAIControlled
and Treasury < -5000
add_money norway 2000
end_monitor
monitor_event FactionTurnStart FactionType mongols
and IsFactionAIControlled
and Treasury < -5000
add_money mongols 10000
end_monitor
;------------------- AI ATTACK POWERFUL PLAYER -------------------;
; All AI factions turn on the players faction when they nearing their victory conditions
declare_counter AI_attack_player_level 0
declare_counter target_human_active 0
monitor_event FactionTurnStart FactionType teutonic_order
and not I_HotseatEnabled
and CampaignDifficulty > easy
and not IsFactionAIControlled
and I_NumberOfSettlements teutonic_order >= 35
set_counter AI_attack_player_level 2
end_monitor
monitor_event FactionTurnStart FactionType teutonic_order
and not I_HotseatEnabled
and CampaignDifficulty > easy
and not IsFactionAIControlled
and I_NumberOfSettlements teutonic_order >= 25
and I_NumberOfSettlements teutonic_order < 35
set_counter AI_attack_player_level 1
end_monitor
monitor_event FactionTurnStart FactionType teutonic_order
and not I_HotseatEnabled
and CampaignDifficulty > easy
and not IsFactionAIControlled
and I_NumberOfSettlements teutonic_order < 20
set_counter AI_attack_player_level 0
end_monitor
monitor_event FactionTurnStart FactionType lithuania
and not I_HotseatEnabled
and CampaignDifficulty > easy
and not IsFactionAIControlled
and I_NumberOfSettlements lithuania >= 35
set_counter AI_attack_player_level 2
end_monitor
monitor_event FactionTurnStart FactionType lithuania
and not I_HotseatEnabled
and CampaignDifficulty > easy
and not IsFactionAIControlled
and I_NumberOfSettlements lithuania >= 25
and I_NumberOfSettlements lithuania < 35
set_counter AI_attack_player_level 1
end_monitor
monitor_event FactionTurnStart FactionType lithuania
and not I_HotseatEnabled
and CampaignDifficulty > easy
and not IsFactionAIControlled
and I_NumberOfSettlements lithuania < 20
set_counter AI_attack_player_level 0
end_monitor
monitor_event FactionTurnStart FactionType denmark
and not I_HotseatEnabled
and CampaignDifficulty > easy
and not IsFactionAIControlled
and I_NumberOfSettlements denmark >= 35
set_counter AI_attack_player_level 2
end_monitor
monitor_event FactionTurnStart FactionType denmark
and not I_HotseatEnabled
and CampaignDifficulty > easy
and not IsFactionAIControlled
and I_NumberOfSettlements denmark >= 25
and I_NumberOfSettlements denmark < 35
set_counter AI_attack_player_level 1
end_monitor
monitor_event FactionTurnStart FactionType denmark
and not I_HotseatEnabled
and CampaignDifficulty > easy
and not IsFactionAIControlled
and I_NumberOfSettlements denmark < 20
set_counter AI_attack_player_level 0
end_monitor
monitor_event FactionTurnStart FactionType novgorod
and not I_HotseatEnabled
and CampaignDifficulty > easy
and not IsFactionAIControlled
and I_NumberOfSettlements novgorod >= 35
set_counter AI_attack_player_level 2
end_monitor
monitor_event FactionTurnStart FactionType novgorod
and not I_HotseatEnabled
and CampaignDifficulty > easy
and not IsFactionAIControlled
and I_NumberOfSettlements novgorod >= 25
and I_NumberOfSettlements novgorod < 35
set_counter AI_attack_player_level 1
end_monitor
monitor_event FactionTurnStart FactionType novgorod
and not I_HotseatEnabled
and CampaignDifficulty > easy
and not IsFactionAIControlled
and I_NumberOfSettlements novgorod < 20
set_counter AI_attack_player_level 0
end_monitor
monitor_event FactionTurnStart FactionType poland
and not I_HotseatEnabled
and CampaignDifficulty > easy
and not IsFactionAIControlled
and I_NumberOfSettlements poland >= 35
set_counter AI_attack_player_level 2
end_monitor
monitor_event FactionTurnStart FactionType poland
and not I_HotseatEnabled
and CampaignDifficulty > easy
and not IsFactionAIControlled
and I_NumberOfSettlements poland >= 25
and I_NumberOfSettlements poland < 35
set_counter AI_attack_player_level 1
end_monitor
monitor_event FactionTurnStart FactionType poland
and not I_HotseatEnabled
and CampaignDifficulty > easy
and not IsFactionAIControlled
and I_NumberOfSettlements poland < 20
set_counter AI_attack_player_level 0
end_monitor
monitor_conditions I_CompareCounter AI_attack_player_level = 0
and I_CompareCounter target_human_active = 1
if I_EventCounter lithuania_conversion_accepted = 1
link_faction_ai teutonic_order teutonic_order_non_pagan
link_faction_ai lithuania lithuania_non_pagan
link_faction_ai poland poland_non_pagan
end_if
if I_EventCounter lithuania_conversion_accepted = 0
link_faction_ai teutonic_order teutonic_order
link_faction_ai lithuania lithuania
link_faction_ai poland poland
end_if
link_faction_ai denmark denmark
link_faction_ai novgorod novgorod
link_faction_ai hre turtle
link_faction_ai norway turtle
link_faction_ai mongols turtle
set_counter target_human_active 0
end_monitor
;Stage 1 attack label
monitor_conditions I_CompareCounter AI_attack_player_level >= 1
and I_CompareCounter target_human_active = 0
if I_CompareCounter AI_attack_player_level = 1
link_faction_ai teutonic_order target_human_stage1
link_faction_ai lithuania target_human_stage1
link_faction_ai poland target_human_stage1
link_faction_ai denmark target_human_stage1
link_faction_ai novgorod target_human_stage1
link_faction_ai hre target_human_stage1
link_faction_ai norway target_human_stage1
link_faction_ai mongols target_human_stage1
end_if
if I_CompareCounter AI_attack_player_level = 2
link_faction_ai teutonic_order target_human_stage2
link_faction_ai lithuania target_human_stage2
link_faction_ai poland target_human_stage2
link_faction_ai denmark target_human_stage2
link_faction_ai novgorod target_human_stage2
link_faction_ai hre target_human_stage2
link_faction_ai norway target_human_stage2
link_faction_ai mongols target_human_stage2
end_if
set_counter target_human_active 1
end_monitor
wait_monitors
;See this post for more information and how to create a campaign script
;
http://www.twcenter.net/forums/showt...ttle-Scripting
; *********************************************************************************************
; EBII Battle Scripts
; 6/5/2016
; z3n
; *********************************************************************************************
while ! I_BattleStarted
end_while
; *********************************************************************************************
; EBII Battle Script Counteres/Timers
; *********************************************************************************************
declare_counter command_and_control
declare_counter deploy_check
declare_counter start_battle
declare_counter FaW_and_S
declare_counter Release_Labels
declare_counter AI_GRP
declare_counter AI_HTC
declare_counter AI_reinforcements
declare_counter AI_reinforcements_tc
declare_counter capture_pike
declare_counter capture_hoplite
declare_counter medium_battle
declare_counter large_battle
declare_timer AI_reinforcements_timer
log always EBII Campaign Based Battle Scripts
log always Activated
; *********************************************************************************************
; EBII Battle Script Frequency Check - sum of battle_wait = total seconds between repeats
; *********************************************************************************************
monitor_conditions I_InBattle
inc_counter command_and_control 1
if I_CompareCounter command_and_control = 125
set_counter command_and_control 0
end_if
end_monitor
; *********************************************************************************************
; Game Reloaded
; *********************************************************************************************
monitor_event GameReloaded
log always Game Reloaded
set_counter deploy_check 0
set_counter Release_Labels 0
set_counter command_and_control 0
set_counter AI_GRP 0
set_counter AI_reinforcements 0
set_counter AI_HTC 0
log always Battle Scripts Reset
end_monitor
; *********************************************************************************************
; Battle Starting
; *********************************************************************************************
monitor_event ScrollClosed ScrollClosed prebattle_scroll
prepare_for_battle
set_counter command_and_control 0
set_counter Release_Labels 0
set_counter AI_GRP 0
set_counter AI_reinforcements 0
set_counter AI_HTC 0
set_counter deploy_check 0
set_counter capture_pike 0
set_counter capture_hoplite 0
set_counter medium_battle 0
set_counter large_battle 0
restart_timer AI_reinforcements_timer
if I_CompareCounter deploy_check = 0
log always Battle Loading
end_if
end_monitor
; *********************************************************************************************
; Shared Reinforcements Monitor
; *********************************************************************************************
monitor_event BattleReinforcementsArrive
;AI Reinforcements - Set Counter - Fires Once Per Battle
set_counter AI_reinforcements 1
end_monitor
; *********************************************************************************************
; Battle Started
; *********************************************************************************************
monitor_conditions I_BattleStarted
inc_counter deploy_check 1
if I_CompareCounter deploy_check = 1
log always Battle Started
set_counter start_battle 1
end_if
end_monitor
;;;;*************************************************************************************************
;;;; Create Labels
;;;;*************************************************************************************************
monitor_conditions I_BattleStarted
and I_CompareCounter start_battle = 1
set_counter Release_Labels 1
set_counter FaW_and_S 1
if I_CompareCounter Release_Labels = 1
set_counter start_battle 0
end_if
if I_CompareCounter deploy_check = 1
; *********************************************************************************************
; Main Army unit Labels
; *********************************************************************************************
label_unit 0 0 0 MAu1
label_unit 0 0 1 MAu2
label_unit 0 0 2 MAu3
label_unit 0 0 3 MAu4
label_unit 0 0 4 MAu5
label_unit 0 0 5 MAu6
label_unit 0 0 6 MAu7
label_unit 0 0 7 MAu8
label_unit 0 0 8 MAu9
label_unit 0 0 9 MAu10
label_unit 0 0 10 MAu11
label_unit 0 0 11 MAu12
label_unit 0 0 12 MAu13
label_unit 0 0 13 MAu14
label_unit 0 0 14 MAu15
label_unit 0 0 15 MAu16
label_unit 0 0 16 MAu17
label_unit 0 0 17 MAu18
label_unit 0 0 18 MAu19
label_unit 0 0 19 MAu20
label_unit 0 0 20 MAu21
label_unit 0 0 21 MAu22
label_unit 0 0 22 MAu23
label_unit 0 0 23 MAu24
label_unit 0 0 24 MAu25
label_unit 0 0 25 MAu26
label_unit 0 0 26 MAu27
label_unit 0 0 27 MAu28
label_unit 0 0 28 MAu29
label_unit 0 0 29 MAu30
label_unit 0 0 30 MAu31
label_unit 0 0 31 MAu32
label_unit 0 0 32 MAu33
label_unit 0 0 33 MAu34
label_unit 0 0 34 MAu35
label_unit 0 0 35 MAu36
label_unit 0 0 36 MAu37
label_unit 0 0 37 MAu38
label_unit 0 0 38 MAu39
label_unit 0 0 39 MAu40
; *********************************************************************************************
; Allied unit Labels
; *********************************************************************************************
label_unit 1 0 0 Eu1
label_unit 1 0 1 Eu2
label_unit 1 0 2 Eu3
label_unit 1 0 3 Eu4
label_unit 1 0 4 Eu5
label_unit 1 0 5 Eu6
label_unit 1 0 6 Eu7
label_unit 1 0 7 Eu8
label_unit 1 0 8 Eu9
label_unit 1 0 9 Eu10
label_unit 1 0 10 Eu11
label_unit 1 0 11 Eu12
label_unit 1 0 12 Eu13
label_unit 1 0 13 Eu14
label_unit 1 0 14 Eu15
label_unit 1 0 15 Eu16
label_unit 1 0 16 Eu17
label_unit 1 0 17 Eu18
label_unit 1 0 18 Eu19
label_unit 1 0 19 Eu20
label_unit 1 0 20 Eu21
label_unit 1 0 21 Eu22
label_unit 1 0 22 Eu23
label_unit 1 0 23 Eu24
label_unit 1 0 24 Eu25
label_unit 1 0 25 Eu26
label_unit 1 0 26 Eu27
label_unit 1 0 27 Eu28
label_unit 1 0 28 Eu29
label_unit 1 0 29 Eu30
label_unit 1 0 30 Eu31
label_unit 1 0 31 Eu32
label_unit 1 0 32 Eu33
label_unit 1 0 33 Eu34
label_unit 1 0 34 Eu35
label_unit 1 0 35 Eu36
label_unit 1 0 36 Eu37
label_unit 1 0 37 Eu38
label_unit 1 0 38 Eu39
label_unit 1 0 39 Eu40
end_if
end_monitor
monitor_conditions I_BattleStarted
and I_BattlePlayerArmyNumberOfAttribute general_unit > 0
and I_BattleEnemyArmyNumberOfAttribute general_unit = 0
if I_CompareCounter deploy_check = 1
; *********************************************************************************************
; Help The Captain - AI
; *********************************************************************************************
unit_set_experience Eu1 6
unit_set_experience Eu2 6
unit_set_experience Eu3 6
unit_set_experience Eu4 6
unit_set_experience Eu5 6
unit_set_experience Eu6 6
unit_set_experience Eu7 6
unit_set_experience Eu8 6
unit_set_experience Eu9 6
unit_set_experience Eu10 6
unit_set_experience Eu11 6
unit_set_experience Eu12 6
unit_set_experience Eu13 6
unit_set_experience Eu14 6
unit_set_experience Eu15 6
unit_set_experience Eu16 6
unit_set_experience Eu17 6
unit_set_experience Eu18 6
unit_set_experience Eu19 6
unit_set_experience Eu20 6
unit_set_experience Eu21 6
unit_set_experience Eu22 6
unit_set_experience Eu23 6
unit_set_experience Eu24 6
unit_set_experience Eu25 6
unit_set_experience Eu26 6
unit_set_experience Eu27 6
unit_set_experience Eu28 6
unit_set_experience Eu29 6
unit_set_experience Eu30 6
unit_set_experience Eu31 6
unit_set_experience Eu32 6
unit_set_experience Eu33 6
unit_set_experience Eu34 6
unit_set_experience Eu35 6
unit_set_experience Eu36 6
unit_set_experience Eu37 6
unit_set_experience Eu38 6
unit_set_experience Eu39 6
unit_set_experience Eu40 6
end_if
end_monitor
monitor_conditions I_BattleStarted
and I_CompareCounter Release_Labels = 1
if I_CompareCounter deploy_check = 1
;Must release Main Army, internal army label is recalibrated upon arrival of AI reinforcements causing 1 (previously the main AI army) to become 0 and 1 to become the secondary AI army.
release_unit MAu1
release_unit MAu2
release_unit MAu3
release_unit MAu4
release_unit MAu5
release_unit MAu6
release_unit MAu7
release_unit MAu8
release_unit MAu9
release_unit MAu10
release_unit MAu11
release_unit MAu12
release_unit MAu13
release_unit MAu14
release_unit MAu15
release_unit MAu16
release_unit MAu17
release_unit MAu18
release_unit MAu19
release_unit MAu20
release_unit MAu21
release_unit MAu22
release_unit MAu23
release_unit MAu24
release_unit MAu25
release_unit MAu26
release_unit MAu27
release_unit MAu28
release_unit MAu29
release_unit MAu30
release_unit MAu31
release_unit MAu32
release_unit MAu33
release_unit MAu34
release_unit MAu35
release_unit MAu36
release_unit MAu37
release_unit MAu38
release_unit MAu39
release_unit MAu40
release_unit Eu1
release_unit Eu2
release_unit Eu3
release_unit Eu4
release_unit Eu5
release_unit Eu6
release_unit Eu7
release_unit Eu8
release_unit Eu9
release_unit Eu10
release_unit Eu11
release_unit Eu12
release_unit Eu13
release_unit Eu14
release_unit Eu15
release_unit Eu16
release_unit Eu17
release_unit Eu18
release_unit Eu19
release_unit Eu20
release_unit Eu21
release_unit Eu22
release_unit Eu23
release_unit Eu24
release_unit Eu25
release_unit Eu26
release_unit Eu27
release_unit Eu28
release_unit Eu29
release_unit Eu30
release_unit Eu31
release_unit Eu32
release_unit Eu33
release_unit Eu34
release_unit Eu35
release_unit Eu36
release_unit Eu37
release_unit Eu38
release_unit Eu39
release_unit Eu40
end_if
end_monitor
monitor_conditions I_BattleStarted
and I_CompareCounter deploy_check = 1
set_counter Release_Labels 0
if I_CompareCounter Release_Labels = 0
; *********************************************************************************************
; Group Labels
; *********************************************************************************************
define_unit_group Allies MAu1 MAu2 MAu3 MAu4 MAu5 MAu6 MAu7 MAu8 MAu9 MAu10 MAu11 MAu12 MAu13 MAu14 MAu15 MAu16 MAu17 MAu18 MAu19 MAu20 MAu21 MAu22 MAu23 MAu24 MAu25 MAu26 MAu27 MAu28 MAu29 MAu30 MAu31 MAu32 MAu33 MAu34 MAu35 MAu36 MAu37 MAu38 MAu39 MAu40
define_unit_group Enemy Eu1 Eu2 Eu3 Eu4 Eu5 Eu6 Eu7 Eu8 Eu9 Eu10 Eu11 Eu12 Eu13 Eu14 Eu15 Eu16 Eu17 Eu18 Eu19 Eu20 Eu21 Eu22 Eu23 Eu24 Eu25 Eu26 Eu27 Eu28 Eu29 Eu30 Eu31 Eu32 Eu33 Eu34 Eu35 Eu36 Eu37 Eu38 Eu39 Eu40
set_counter FaW_and_S 0
end_if
end_monitor
; *********************************************************************************************
; unit Group Orders - Disabled
; *********************************************************************************************
;monitor_conditions I_BattleStarted
;and I_ConflictType Normal
;and I_BattleEnemyArmyNumberOfClassAndCategory missile cavalry > 9
;and I_PercentageOfArmyKilled 1 0 >= 5
;unit_group_set_morale Enemy routing
;end_monitor
;Test Order - Player Allies Only
; unit_group_order_relative_move_formed Allies 0 200
; I_UnitGroupInRangeOfUnitGroup
; I_PercentageUnitGroupKilled
; *********************************************************************************************
; Initialize Battle Plans & Monitors
; *********************************************************************************************
; *********************************************************************************************
; AI Reinforcement Plans
; *********************************************************************************************
monitor_conditions I_CompareCounter command_and_control = 10
and I_BattleStarted
and I_ConflictType Normal
and I_CompareCounter AI_reinforcements > 0
if I_TimerElapsed AI_reinforcements_timer = 5000
inc_counter AI_reinforcements_tc 1
end_if
if I_TimerElapsed AI_reinforcements_timer > 5000
restart_timer AI_reinforcements_timer
end_if
; *********************************************************************************************
; AI Reinforcements Defend Plan
; *********************************************************************************************
if I_CompareCounter AI_GRP = 0
and I_CompareCounter AI_reinforcements_tc < 30
;AI Units from Army 1 Battle Objective
;ai_gta_add_objective 0 DEFEND_LINE 999
;AI Army 1 Battle Objective
ai_gta_plan_set 0 DEFEND_FEATURE
;AI Units from Army 2 Battle Objective
ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999
;AI Army 2 Battle Objective
ai_gta_plan_set 1 ATTACK_ALL
end_if
; *********************************************************************************************
; AI Reinforcements Reaction Plan
; *********************************************************************************************
if I_CompareCounter AI_reinforcements > 0
and I_CompareCounter AI_GRP > 0
;AI Units from Army 1 Battle Objective
ai_gta_add_objective 0 ATTACK_ENEMY_BATTLEGROUP 999
;AI Army 1 Battle Objective
ai_gta_plan_set 0 ATTACK_ALL
;AI Units from Army 2 Battle Objective
ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999
;AI Army 2 Battle Objective
ai_gta_plan_set 1 ATTACK_ALL
end_if
; *********************************************************************************************
; AI Reinforcements Attack Plan
; *********************************************************************************************
if I_CompareCounter AI_reinforcements_tc > 30
and not I_BattlePlayerArmyIsAttacker
;AI Units from Army 1 Battle Objective
ai_gta_add_objective 0 ATTACK_ENEMY_BATTLEGROUP 999
;AI Army 1 Battle Objective
ai_gta_plan_set 0 ATTACK_ALL
;AI Units from Army 2 Battle Objective
ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999
;AI Army 2 Battle Objective
ai_gta_plan_set 1 ATTACK_ALL
end_if
end_monitor
; *********************************************************************************************
; Normal Attack Plan
; *********************************************************************************************
monitor_conditions I_CompareCounter command_and_control = 20
and I_BattleStarted
and I_CompareCounter AI_reinforcements = 0
and I_ConflictType Normal
and not I_BattlePlayerArmyIsAttacker
;AI Units Battle Objective
ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999
;AI Alliance Battle Objective
ai_gta_plan_set 1 ATTACK_ALL
end_monitor
; *********************************************************************************************
; Normal Defend Plan
; Recurring counters fire above 0
; *********************************************************************************************
monitor_conditions I_CompareCounter command_and_control = 30
and I_BattleStarted
and I_CompareCounter AI_reinforcements = 0
and I_ConflictType Normal
and I_BattlePlayerArmyIsAttacker
if I_CompareCounter AI_GRP = 0
;AI Units Battle Objective Main Army
;ai_gta_add_objective 1 DEFEND_LINE 999
;AI Alliance Battle Objective Main Army
ai_gta_plan_set 1 DEFEND_FEATURE
end_if
if I_CompareCounter AI_GRP > 0
;AI Units Battle Objective
ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999
;AI Alliance Battle Objective
ai_gta_plan_set 1 ATTACK_ALL
end_if
end_monitor
; *********************************************************************************************
; Assault Crossing
; *********************************************************************************************
monitor_conditions I_CompareCounter command_and_control = 40
and I_BattleStarted
and I_BattleIsRiverBattle
and not I_BattlePlayerArmyIsAttacker
if I_CompareCounter AI_reinforcements = 0
;AI Units from Army 2 Battle Objective
ai_gta_add_objective 1 ASSAULT_CROSSING 999
;AI Units from Army 2 Battle Objective
ai_gta_plan_set 1 ATTACK_ALL
end_if
if I_CompareCounter AI_reinforcements = 1
and I_CompareCounter AI_reinforcements_tc < 30
;AI Alliance Battle Objective
ai_gta_plan_set 0 DEFEND_FEATURE
;AI Alliance Battle Objective 2
ai_gta_plan_set 1 ATTACK_ALL
;AI Units Battle Objective 2
ai_gta_add_objective 1 ASSAULT_CROSSING 999
end_if
; *********************************************************************************************
; Assault Crossing - Reinforcements
; *********************************************************************************************
if I_CompareCounter AI_reinforcements = 1
and I_CompareCounter AI_reinforcements_tc > 30
;AI Units Battle Objective
ai_gta_add_objective 0 ASSAULT_CROSSING 999
;AI Alliance Battle Objective
ai_gta_plan_set 0 ATTACK_ALL
;AI Units Battle Objective 2
ai_gta_add_objective 1 ASSAULT_CROSSING 999
;AI Alliance Battle Objective 2
ai_gta_plan_set 1 ATTACK_ALL
end_if
end_monitor
; *********************************************************************************************
; Assault Settlement
; *********************************************************************************************
monitor_conditions I_CompareCounter command_and_control = 50
and I_BattleStarted
and I_BattleIsSiegeBattle
and not I_BattlePlayerArmyIsAttacker
if I_CompareCounter AI_reinforcements = 0
;AI Alliance Battle Objective
ai_gta_plan_set 1 ATTACK_SETTLEMENT
end_if
; *********************************************************************************************
; Assault Settlement - Reinforcements
; *********************************************************************************************
if I_CompareCounter AI_reinforcements = 1
and I_CompareCounter AI_reinforcements_tc > 30
;AI Alliance Battle Objective
ai_gta_plan_set 1 ATTACK_SETTLEMENT
;AI Alliance Battle Objective 2
ai_gta_plan_set 0 ATTACK_SETTLEMENT
end_if
end_monitor
; *********************************************************************************************
; Sally Out
; *********************************************************************************************
monitor_conditions I_CompareCounter command_and_control = 60
and I_BattleStarted
and I_BattleIsSallyOutBattle
and not I_BattlePlayerArmyIsAttacker
;AI Units Battle Objective
ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999
;AI Alliance Battle Objective
ai_gta_plan_set 1 ATTACK_ALL
if I_CompareCounter AI_reinforcements = 1
and I_CompareCounter AI_reinforcements_tc > 30
;AI Units Battle Objective
ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999
;AI Alliance Battle Objective
ai_gta_plan_set 1 ATTACK_ALL
;AI Units Battle Objective 2
ai_gta_add_objective 0 ATTACK_ENEMY_BATTLEGROUP 999
;AI Alliance Battle Objective 2
ai_gta_plan_set 0 ATTACK_ALL
end_if
end_monitor
; *********************************************************************************************
; Custom Formations - Can be based on unit composition - Disabled
; *********************************************************************************************
; monitor_conditions I_CompareCounter command_and_control = 70
; and I_BattleStarted
; and I_ConflictType Normal
; if I_BattleEnemyArmyNumberOfAttribute rome_gen > 0
; unit_group_order_change_group_formation Enemy ordered_triple_line_1
; end_if
; if I_BattlePlayerArmyNumberOfAttribute rome_gen > 0
; unit_group_order_change_group_formation Allies ordered_triple_line_1
; end_if
; end_monitor
; *********************************************************************************************
; AI unit Monitors
; *********************************************************************************************
monitor_conditions I_CompareCounter command_and_control = 80
and I_BattleStarted
and not I_BattleIsSiegeBattle
and I_PercentageUnitKilled Eu1 > 5
inc_counter AI_GRP 1
;AI Units Battle Objective
ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999
;AI Alliance Battle Objective
ai_gta_plan_set 1 ATTACK_ALL
end_monitor
; *********************************************************************************************
; AI Reactions Toward Attacks (Missile/Artillery/Charges)
; *********************************************************************************************
monitor_conditions I_CompareCounter command_and_control = 90
and I_BattleStarted
and I_PercentageOfArmyKilled 1 0 > 3
and I_BattlePlayerArmyIsAttacker
and not I_BattleIsSiegeBattle
inc_counter AI_GRP 1
;AI Units Battle Objective
ai_gta_add_objective 1 ATTACK_ENEMY_BATTLEGROUP 999
;AI Alliance Battle Objective
ai_gta_plan_set 1 ATTACK_ALL
end_monitor
; *********************************************************************************************
; Counters for export
; *********************************************************************************************
; !! declare and reset counters in 'Battle Starting' section !!
monitor_conditions I_CompareCounter command_and_control = 100
and I_BattleStarted
; --- testing for number of units with 'rehire_makedones' attribute in AI army - ie Phalangitai ---
if I_BattleEnemyArmyNumberOfAttribute rehire_makedones > 0 ; at least one unit with this attribute was present in the enemy army
set_counter capture_pike 1
end_if
; --- testing for number of units with 'rehire_hoplite' attribute in AI army - ie Hoplitai, Etruscans, Liby-Phoenician Infantry or Babylonian Spearmen ---
if I_BattleEnemyArmyNumberOfAttribute rehire_hoplite > 0 ; at least one unit with this attribute was present in the enemy army
set_counter capture_hoplite 1
end_if
; --- testing for battle size
if I_BattleEnemyArmyNumberOfUnits > 7
and I_BattleEnemyArmyNumberOfUnits < 11
set_counter medium_battle 1 ; this was a medium sized battle
end_if
if I_BattleEnemyArmyNumberOfUnits > 10
set_counter large_battle 1 ; this was a large sized battle
end_if
; add more tests
end_monitor
; *** DO NOT ADD BATTLE SCRIPT CODE BELOW THIS LINE!! ***
while I_InBattle ; end of battle script
end_while
end_script