Code:
;============== Teutonic Order Emergent =================
monitor_event EventCounter EventCounterType inquisition
and EventCounter > 0
;monitor_event FactionTurnEnd FactionType slave; testing
; and I_TurnNumber = 2; testing
add_events
event emergent_faction teutonic_order
date 0
end_add_events
spawn_army
faction teutonic_order
; character Herrmann von_Salza, named character, age 40, x 231, y 244, label teuton4leader, family
; Spawns right under Palanga
character Herrmann von_Salza, named character, family, age 40, x 224, y 238, label teuton4leader, direction N
traits FactionleaderTO 1, MilitaryInclination 1 , Military_Edu 3 , NaturalMilitarySkill 2 , GoodCommander 3 , Bloodthirsty 2 , BattleDread 2 , StrategyDread 2 , PublicFaith 3 , ContentGeneral 3 , Prim 2 , ReligionStarter 1
unit TO Bodyguard exp 5 armour 0 weapon_lvl 0
unit Order Militia exp 2 armour 0 weapon_lvl 0
unit Order Militia exp 2 armour 0 weapon_lvl 0
unit Sword Brethren exp 3 armour 0 weapon_lvl 0
unit Sword Brethren exp 2 armour 0 weapon_lvl 0
unit Sword Brethren exp 3 armour 0 weapon_lvl 0
unit Burgher Pikemen exp 4 armour 0 weapon_lvl 0
unit Burgher Pikemen exp 3 armour 0 weapon_lvl 0
unit NE Catapult exp 1 armour 0 weapon_lvl 0
unit NE Catapult exp 1 armour 0 weapon_lvl 0
unit Prussian Archers exp 3 armour 0 weapon_lvl 0
unit Prussian Archers exp 3 armour 0 weapon_lvl 0
unit Prussian Archers exp 3 armour 0 weapon_lvl 0
unit Prussian Archers exp 4 armour 0 weapon_lvl 0
unit Christ Knights exp 3 armour 0 weapon_lvl 0
unit Christ Knights exp 1 armour 0 weapon_lvl 0
unit Knechten exp 2 armour 0 weapon_lvl 0
unit Knechten exp 1 armour 0 weapon_lvl 0
unit Ritterbruder exp 3 armour 0 weapon_lvl 0
unit Ritterbruder exp 2 armour 0 weapon_lvl 0
end
add_money teutonic_order, 5000
spawn_army
faction teutonic_order
; character Conrad von_Thuringen, named character, age 30, x 232, y 243, label teuton4heir, family
; Spawns right under Riga
character Conrad von_Thuringen, named character, family, age 30, x 250, y 254, label teuton4heir, direction N
traits FactionheirTO 1, MilitaryInclination 1 , Military_Edu 3 , NaturalMilitarySkill 1 , GoodCommander 2 , LoyaltyStarter 1 , Drink 1 , PublicFaith 1 , ContentGeneral 3 , ReligionStarter 1
unit TO Bodyguard exp 3 armour 0 weapon_lvl 0
unit Order Militia exp 2 armour 0 weapon_lvl 0
unit Order Militia exp 1 armour 0 weapon_lvl 0
unit Order Militia exp 2 armour 0 weapon_lvl 0
unit Sword Brethren exp 2 armour 0 weapon_lvl 0
unit Sword Brethren exp 3 armour 0 weapon_lvl 0
unit Sword Brethren exp 2 armour 0 weapon_lvl 0
unit Sword Brethren exp 3 armour 0 weapon_lvl 0
unit NE Catapult exp 1 armour 0 weapon_lvl 0
unit NE Catapult exp 1 armour 0 weapon_lvl 0
unit Prussian Archers exp 3 armour 0 weapon_lvl 0
unit Prussian Archers exp 3 armour 0 weapon_lvl 0
unit Prussian Archers exp 3 armour 0 weapon_lvl 0
unit Prussian Archers exp 4 armour 0 weapon_lvl 0
unit Christ Knights exp 2 armour 0 weapon_lvl 0
unit Christ Knights exp 1 armour 0 weapon_lvl 0
unit Christ Knights exp 3 armour 0 weapon_lvl 0
unit Christ Knights exp 1 armour 0 weapon_lvl 0
unit Ritterbruder exp 3 armour 0 weapon_lvl 0
unit Ritterbruder exp 2 armour 0 weapon_lvl 0
end
add_money teutonic_order, 5000
spawn_character teutonic_order random_name, priest, age 27, x 222, y 238
spawn_character teutonic_order random_name, priest, age 35, x 224, y 236
historic_event teutonic_order_invasion event/teutonic_faction_intro.bik
console_command diplomatic_stance teutonic_order lithuania war
destroy_buildings hre teutonic_knights_chapter_house false
terminate_monitor
end_monitor
declare_counter attack_palanga
set_counter attack_palanga 0
monitor_event FactionTurnStart FactionType teutonic_order
and not I_SettlementOwner Palanga = teutonic_order
and I_CharacterExists teuton4leader
if not I_SettlementOwner Palanga = lithuania
and not I_SettlementOwner Palanga = slave
and not I_SettlementOwner Palanga = russia
and not I_SettlementOwner Palanga = kievan_rus
and not I_SettlementOwner Palanga = cumans
terminate_monitor
end_if
if I_SettlementUnderSiege Palanga;if settlement under siege already, avoid ctd.
and I_CompareCounter attack_palanga = 0
terminate_monitor
end_if
if not I_CharacterTypeNearTile teutonic_order, named_character, 0, 224, 238 ;if character not standing where it should, avoid ctd
terminate_monitor
end_if
if not I_SettlementUnderSiege Palanga
siege_settlement teuton4leader, Palanga, maintain
set_counter attack_palanga 1
end_if
if I_SettlementUnderSiege Palanga
and I_CompareCounter attack_palanga = 1
siege_settlement teuton4leader, Palanga, attack
set_counter attack_palanga 0
terminate_monitor
end_if
end_monitor
declare_counter attack_riga
set_counter attack_riga 0
monitor_event FactionTurnStart FactionType teutonic_order
and not I_SettlementOwner Riga = teutonic_order
and I_CharacterExists teuton4heir
if not I_SettlementOwner Riga = lithuania
and not I_SettlementOwner Riga = slave
and not I_SettlementOwner Riga = russia
and not I_SettlementOwner Riga = kievan_rus
and not I_SettlementOwner Riga = cumans
terminate_monitor
end_if
if I_SettlementUnderSiege Riga;if settlement under siege already, avoid ctd.
and I_CompareCounter attack_riga = 0
terminate_monitor
end_if
if not I_CharacterTypeNearTile teutonic_order, named_character, 0, 250, 254 ;if character not standing where it should, avoid ctd
terminate_monitor
end_if
if not I_SettlementUnderSiege Riga
siege_settlement teuton4heir, Riga, maintain
set_counter attack_riga 1
end_if
if I_SettlementUnderSiege Riga
and I_CompareCounter attack_riga = 1
siege_settlement teuton4leader, Palanga, attack
set_counter attack_riga 0
terminate_monitor
end_if
end_monitor
monitor_event FactionTurnStart FactionType teutonic_order
and I_IsFactionAIControlled lithuania
and I_TurnNumber < 170
console_command diplomatic_stance teutonic_order lithuania war
end_monitor
monitor_event FactionTurnStart FactionType teutonic_order
and I_TurnNumber = 165
spawn_army
faction teutonic_order
character random_name, named character, age 40, x 231, y 248, family, direction E
traits MilitaryInclination 1 , Military_Edu 2 , NaturalMilitarySkill 1 , GoodCommander 2 , BattleDread 2 , StrategyDread 2 , PublicFaith 2 , Drink 2 , ReligionStarter 1
unit TO Bodyguard exp 5 armour 0 weapon_lvl 0
unit Order Militia exp 2 armour 0 weapon_lvl 0
unit Order Militia exp 2 armour 0 weapon_lvl 0
unit Sword Brethren exp 3 armour 0 weapon_lvl 0
unit Sword Brethren exp 2 armour 0 weapon_lvl 0
unit Sword Brethren exp 3 armour 0 weapon_lvl 0
unit Burgher Pikemen exp 4 armour 0 weapon_lvl 0
unit Burgher Pikemen exp 3 armour 0 weapon_lvl 0
unit NE Catapult exp 1 armour 0 weapon_lvl 0
unit NE Catapult exp 1 armour 0 weapon_lvl 0
unit Prussian Archers exp 3 armour 0 weapon_lvl 0
unit Prussian Archers exp 3 armour 0 weapon_lvl 0
unit Prussian Archers exp 3 armour 0 weapon_lvl 0
unit Prussian Archers exp 4 armour 0 weapon_lvl 0
unit Christ Knights exp 3 armour 0 weapon_lvl 0
unit Christ Knights exp 1 armour 0 weapon_lvl 0
unit Knechten exp 2 armour 0 weapon_lvl 0
unit Knechten exp 1 armour 0 weapon_lvl 0
unit Ritterbruder exp 3 armour 0 weapon_lvl 0
unit Ritterbruder exp 2 armour 0 weapon_lvl 0
end
add_money teutonic_order 5000
terminate_monitor
end_monitor
monitor_event FactionTurnStart FactionType teutonic_order
and I_TurnNumber = 170
and not I_SettlementOwner Palanga = teutonic_order
and not I_SettlementOwner Riga = teutonic_order
spawn_army
faction teutonic_order
character random_name, named character, age 40, x 232, y 248, family, direction E
traits MilitaryInclination 1 , Military_Edu 2 , NaturalMilitarySkill 1 , GoodCommander 2 , BattleDread 2 , StrategyDread 2 , PublicFaith 2 , Drink 2 , ReligionStarter 1
unit TO Bodyguard exp 5 armour 0 weapon_lvl 0
unit Order Militia exp 2 armour 0 weapon_lvl 0
unit Order Militia exp 2 armour 0 weapon_lvl 0
unit Sword Brethren exp 3 armour 0 weapon_lvl 0
unit Sword Brethren exp 2 armour 0 weapon_lvl 0
unit Sword Brethren exp 3 armour 0 weapon_lvl 0
unit Burgher Pikemen exp 4 armour 0 weapon_lvl 0
unit Burgher Pikemen exp 3 armour 0 weapon_lvl 0
unit NE Catapult exp 1 armour 0 weapon_lvl 0
unit NE Catapult exp 1 armour 0 weapon_lvl 0
unit Prussian Archers exp 3 armour 0 weapon_lvl 0
unit Prussian Archers exp 3 armour 0 weapon_lvl 0
unit Prussian Archers exp 3 armour 0 weapon_lvl 0
unit Prussian Archers exp 4 armour 0 weapon_lvl 0
unit Christ Knights exp 3 armour 0 weapon_lvl 0
unit Christ Knights exp 1 armour 0 weapon_lvl 0
unit Knechten exp 2 armour 0 weapon_lvl 0
unit Knechten exp 1 armour 0 weapon_lvl 0
unit Ritterbruder exp 3 armour 0 weapon_lvl 0
unit Ritterbruder exp 2 armour 0 weapon_lvl 0
end
spawn_army
faction teutonic_order
character random_name, named character, age 22, x 233, y 248, family, direction E
traits MilitaryInclination 1 , Military_Edu 2 , NaturalMilitarySkill 1 , GoodCommander 3 , BattleDread 2 , StrategyDread 2 , PublicFaith 2 , Drink 2 , ReligionStarter 1
unit TO Bodyguard exp 5 armour 0 weapon_lvl 0
unit Order Militia exp 2 armour 0 weapon_lvl 0
unit Order Militia exp 2 armour 0 weapon_lvl 0
unit Sword Brethren exp 3 armour 0 weapon_lvl 0
unit Sword Brethren exp 2 armour 0 weapon_lvl 0
unit Sword Brethren exp 3 armour 0 weapon_lvl 0
unit Burgher Pikemen exp 4 armour 0 weapon_lvl 0
unit Burgher Pikemen exp 3 armour 0 weapon_lvl 0
unit NE Catapult exp 1 armour 0 weapon_lvl 0
unit NE Catapult exp 1 armour 0 weapon_lvl 0
unit Prussian Archers exp 3 armour 0 weapon_lvl 0
unit Prussian Archers exp 3 armour 0 weapon_lvl 0
unit Prussian Archers exp 3 armour 0 weapon_lvl 0
unit Prussian Archers exp 4 armour 0 weapon_lvl 0
unit Christ Knights exp 3 armour 0 weapon_lvl 0
unit Christ Knights exp 1 armour 0 weapon_lvl 0
unit Knechten exp 2 armour 0 weapon_lvl 0
unit Knechten exp 1 armour 0 weapon_lvl 0
unit Ritterbruder exp 3 armour 0 weapon_lvl 0
unit Ritterbruder exp 2 armour 0 weapon_lvl 0
end
spawn_army
faction teutonic_order
character random_name, named character, age 20, x 234, y 248, family, direction E
traits MilitaryInclination 1 , Military_Edu 2 , NaturalMilitarySkill 1 , GoodCommander 3 , BattleDread 3 , StrategyDread 2 , PublicFaith 2 , Drink 2 , ReligionStarter 1
unit TO Bodyguard exp 5 armour 0 weapon_lvl 0
unit Order Militia exp 2 armour 0 weapon_lvl 0
unit Order Militia exp 2 armour 0 weapon_lvl 0
unit Sword Brethren exp 3 armour 0 weapon_lvl 0
unit Sword Brethren exp 2 armour 0 weapon_lvl 0
unit Sword Brethren exp 3 armour 0 weapon_lvl 0
unit Burgher Pikemen exp 4 armour 0 weapon_lvl 0
unit Burgher Pikemen exp 3 armour 0 weapon_lvl 0
unit NE Catapult exp 1 armour 0 weapon_lvl 0
unit NE Catapult exp 1 armour 0 weapon_lvl 0
unit Prussian Archers exp 3 armour 0 weapon_lvl 0
unit Prussian Archers exp 3 armour 0 weapon_lvl 0
unit Prussian Archers exp 3 armour 0 weapon_lvl 0
unit Prussian Archers exp 4 armour 0 weapon_lvl 0
unit Christ Knights exp 3 armour 0 weapon_lvl 0
unit Christ Knights exp 1 armour 0 weapon_lvl 0
unit Knechten exp 2 armour 0 weapon_lvl 0
unit Knechten exp 1 armour 0 weapon_lvl 0
unit Ritterbruder exp 3 armour 0 weapon_lvl 0
unit Ritterbruder exp 2 armour 0 weapon_lvl 0
end
add_money teutonic_order 40000
terminate_monitor
end_monitor
;;Old scripted sieges of Riga and Palanga that caused CTD
;declare_counter attack_palanga
;set_counter attack_palanga 0
;
;monitor_event FactionTurnStart FactionType teutonic_order
; and not I_SettlementOwner Palanga = teutonic_order
; and I_CharacterExists teuton4leader
; and I_CharacterExists teuton4heir
;
; if I_CompareCounter attack_palanga = 1
; siege_settlement teuton4leader, Palanga, maintain
; siege_settlement teuton4heir, Palanga, attack
; set_counter attack_palanga 2
; move teuton4heir, 250, 255;for riga
; terminate_monitor
; end_if
;
; if not I_SettlementUnderSiege Palanga
; if I_CompareCounter attack_palanga = 0
; siege_settlement teuton4leader, Palanga, maintain
; siege_settlement teuton4heir, Palanga, maintain
; set_counter attack_palanga 1
; end_if
; end_if
;end_monitor
;
;declare_counter attack_riga
;set_counter attack_riga 0
;
;monitor_event FactionTurnStart FactionType teutonic_order
; and I_CharacterExists teuton4heir
; and I_CompareCounter attack_palanga = 2
;
; if not I_CharacterTypeNearTile teutonic_order, named_character, 1, 250, 255
; move teuton4heir, 250, 255
; end_if
;
; if I_CompareCounter attack_riga = 1
; siege_settlement teuton4heir, Riga, attack
; set_counter attack_riga 0
; end_if
;
; if not I_SettlementUnderSiege Riga
; if I_CharacterTypeNearTile teutonic_order, named_character, 0, 249, 254
; siege_settlement teuton4heir, Riga, maintain
; set_counter attack_riga 1
; end_if
; if I_CharacterTypeNearTile teutonic_order, named_character, 1, 250, 255
; siege_settlement teuton4heir, Riga, maintain
; set_counter attack_riga 1
; end_if
; end_if
;
; if I_SettlementOwner Riga = teutonic_order
; terminate_monitor
; end_if
;end_monitor