Code:
;-------- Turcoman Help for Rum ----------------------------------------------------------------------- ;======================================================================================================
; by JoC 2020, augmented 2022
;====================================================================================================== Turcoman Help for Rum
; the goal is to save Rum and make the life of Byzantium more difficult early game (when it matters)
; script is a modification of the William Wallace script
; no time limit - but can be introduced in the future
; in the 098 April 2022 playtests it did not prevent the Biz player from overwhelming Rum - let's see how the augmented script would work
monitor_event PreFactionTurnStart FactionType rum
and I_EventCounter faction_size_smallormedium == 1 ; Rum has fewer than 11 settlements
and I_EventCounter Turcoman_Help_for_Rum < 1 ; at least 15 years after the previous help
and DiplomaticStanceFromFaction byzantium = AtWar ; it works only in danger from Byzantium (ergo: not Georgia, Jerusalem etc.)
and I_NumberOfSettlements rum > 0 ; just in case of a bug (perhaps not needed)
and RandomPercent < 50
log ------ script : Turcoman Help for Rum (1) TERMINATION AFTER MONGOL INVASION (historically they take over the Nomadic tribes)
if I_EventCounter mongols_invasion > 0
terminate_monitor
end_if
log ------ script : Turcoman Help for Rum (2) INFORMATION ---------------------
if I_SettlementOwner Angora = rum
and I_EventCounter Byzantines_Invade_Rum_Konya = 0 ; redundant but just in case
and I_CharacterTypeNearTile byzantium, named_character, 10, 312, 132 ; danger 10 tiles from Angora
historic_event TURCOMAN_HELP_RUM ; info for the player
set_event_counter turcoman_help_rum_started 1 ; used below in parts 3, 4
set_event_counter byzantines_invade_rum_angora 1 ; not yet used but may be in the future
end_if
if I_SettlementOwner Konya = rum
and I_EventCounter Byzantines_Invade_Rum_Angora = 0
and I_CharacterTypeNearTile byzantium, named_character, 10, 310, 118 ; danger 10 tiles from Konya
historic_event TURCOMAN_HELP_RUM
set_event_counter turcoman_help_rum_started 1
set_event_counter byzantines_invade_rum_konya 1
end_if
log ------ script : Turcoman Help for Rum (3) FUNDING FOR THE ARMIES -----------
if I_EventCounter temp_purse_rum < 1 ; in case it was increased somewhere else in the script
and I_EventCounter turcoman_help_rum_started == 1
add_money rum 5000 ; in case the faction is in debts and would disband the armies outright
increment_kings_purse rum 5000 ; to ensure the AI doesn't disband the armies for some time
inc_event_counter temp_purse_rum 21 ; this counter goes down in another script and after 20 turns this additional income is removed
end_if
log ------ script : Turcoman Help for Rum (4) SPAWN OF ARMIES ------------------
if RandomPercent > 80
and I_EventCounter turcoman_help_rum_started == 1
log ------ spawn Orhan Arslan
spawn_army
faction rum
character Orhan Arslan, named character, age 35, x 314, y 135, family
traits LoyaltyStarter 3 , MilitaryInclination 1 , Military_Edu 3 , GoodCommander 2 , ReligionStarter 1 , Royal_Blood_Rum_Turkish 1 , BiologicalSon 1 , Handsome 6 , Intelligent 8
unit ME Bodyguard exp 3 armour 1 weapon_lvl 0
unit Ghulams exp 7 armour 1 weapon_lvl 0
unit Ghulams exp 4 armour 1 weapon_lvl 0
unit Ghulams exp 1 armour 1 weapon_lvl 0
unit Ghulams exp 0 armour 0 weapon_lvl 0
unit Turkomans exp 7 armour 1 weapon_lvl 0
unit Turkomans exp 4 armour 1 weapon_lvl 0
unit Turkomans exp 1 armour 1 weapon_lvl 0
unit Turkomans exp 0 armour 0 weapon_lvl 0
unit Turkish Horse Archers exp 7 armour 0 weapon_lvl 0
unit Turkish Horse Archers exp 4 armour 0 weapon_lvl 0
unit Turkish Horse Archers exp 1 armour 0 weapon_lvl 0
unit Turkish Horse Archers exp 0 armour 0 weapon_lvl 0
end
inc_event_counter Turcoman_Help_for_Rum 10 ; it goes down in another script
end_if
if RandomPercent < 40
and I_EventCounter TURCOMAN_HELP_RUM == 1
log ------ spawn Ahmed Arslan
spawn_army
faction rum
character Ahmed Arslan, named character, age 28, x 314, y 130, family
traits LoyaltyStarter 3 , MilitaryInclination 1 , Military_Edu 2 , GoodCommander 1 , ReligionStarter 1 , Royal_Blood_Rum_Turkish 1 , BiologicalSon 1 , Handsome 4 , Intelligent 6
unit ME Bodyguard exp 3 armour 1 weapon_lvl 0
unit Ghulams exp 7 armour 1 weapon_lvl 0
unit Ghulams exp 4 armour 1 weapon_lvl 0
unit Ghulams exp 0 armour 0 weapon_lvl 0
unit Turkomans exp 7 armour 1 weapon_lvl 0
unit Turkomans exp 4 armour 1 weapon_lvl 0
unit Turkomans exp 0 armour 0 weapon_lvl 0
unit Turkish Horse Archers exp 7 armour 0 weapon_lvl 0
unit Turkish Horse Archers exp 4 armour 0 weapon_lvl 0
unit Turkish Horse Archers exp 0 armour 0 weapon_lvl 0
end
inc_event_counter Turcoman_Help_for_Rum 10 ; it goes down in another script
end_if
if RandomPercent < 60
and I_EventCounter TURCOMAN_HELP_RUM == 1
log ------ spawn Fakih Arslan
spawn_army
faction rum
character Fakih Arslan, named character, age 26, x 306, y 124, family
traits LoyaltyStarter 3 , MilitaryInclination 1 , Military_Edu 1 , Austere 1 , ReligionStarter 1 , Royal_Blood_Rum_Turkish 1 , BiologicalSon 1 , Handsome 4 , Intelligent 6
unit ME Bodyguard exp 3 armour 1 weapon_lvl 0
unit Ghulams exp 4 armour 1 weapon_lvl 0
unit Ghulams exp 0 armour 0 weapon_lvl 0
unit Turkomans exp 4 armour 1 weapon_lvl 0
unit Turkomans exp 0 armour 0 weapon_lvl 0
unit Turkish Horse Archers exp 4 armour 0 weapon_lvl 0
unit Turkish Horse Archers exp 0 armour 0 weapon_lvl 0
end
inc_event_counter Turcoman_Help_for_Rum 10 ; it goes down in another script
end_if
log -------------------- Turcoman Help for Rum (5) CHANGES IN DIPLOMACY ------------------
if I_SettlementOwner Konya = byzantium
and I_EventCounter TURCOMAN_HELP_RUM == 1
console_command diplomatic_stance rum byzantium war
end_if
log -------------------- Turcoman Help for Rum (6) END ------------------
end_monitor