@Cephalophore: you definitely deserve credit! This is impressive!
The name changing is pretty straightforward and I usually add in the file guidance for modders to make their changes. Eg. in the script.txt you may find a Table of contents at the begining and then explanation.
See below examples of how to do it without religion concerns. You need to use the internal codes for factions.
Code:
;===============================================================================================
;======================================================================================================
;---- SETTLEMENTS CAPTURED & NAME CHANGES ----------------------------------------------
;======================================================================================================
; if you add a name in this script, remember to add it also in the expanded.txt (and leave the last line empty!)
; if you add a "historic_event" you must add the relevant entry in the "historic_events.txt"
; for some cities there's a special notification and pics used (see below eg Wroclaw) - this may be copied also to the other cities. However, if in the future many such entried would be added then they may get too burdensome for the players - so think about it.
; a willing modder could also make movie files (.bik) for certain great cities (eg. Constantinople, Kiev, Cairo, Baghdad) to provide more immersion for the players
;====================================================================================================== JERUSALEM
;---------- Jerusalem ---------------------------------------------------------------------------------
declare_counter Jerusalem_christian
declare_counter Jerusalem_islam
declare_counter Jerusalem_pagan
set_counter Jerusalem_christian 0
set_counter Jerusalem_islam 0
set_counter Jerusalem_pagan 0
monitor_event GeneralCaptureSettlement SettlementName Jerusalem
and CharacterReligion catholic
and I_CompareCounter Jerusalem_christian = 0
change_settlement_name Jerusalem Jerusalem
historic_event jerusalem_christian event/Christians_Capture_Jerusalem.bik
set_counter Jerusalem_christian 1
end_monitor
monitor_event GeneralCaptureSettlement SettlementName Jerusalem
and CharacterReligion orthodox
and I_CompareCounter Jerusalem_christian = 0
change_settlement_name Jerusalem Hierosolyma
historic_event jerusalem_christian event/Christians_Capture_Jerusalem.bik
set_counter Jerusalem_christian 1
end_monitor
monitor_event GeneralCaptureSettlement SettlementName Jerusalem
and CharacterReligion islam
and I_CompareCounter Jerusalem_islam = 0
change_settlement_name Jerusalem al_Quds
historic_event jerusalem_muslim event/Muslims_Capture_Jerusalem.bik
set_counter Jerusalem_islam 1
end_monitor
monitor_event GeneralCaptureSettlement SettlementName Jerusalem
and CharacterReligion pagan
and IsFactionAIControlled
and I_CompareCounter Jerusalem_pagan = 0
historic_event jerusalem_pagan
set_counter Jerusalem_pagan 1
end_monitor
;====================================================================================================== BALTICS
;---------- Baltics -----------------------------------------------------------------------------------
;------------------------------------------------------------------------------ TURKU
monitor_event GeneralCaptureSettlement SettlementName Turku
and CharacterReligion catholic
change_settlement_name Turku Abo
if not IsFactionAIControlled
historic_event SETTLEMENT_NAME_CHANGE
end_if
end_monitor
monitor_event GeneralCaptureSettlement SettlementName Turku
and not CharacterReligion catholic
change_settlement_name Turku Turku
end_monitor
...
;------------------------------------------------------------------------------ KERNAVE
monitor_event GeneralCaptureSettlement SettlementName Kernave
and CharacterReligion catholic
change_settlement_name Kernave Vilnius
if not IsFactionAIControlled
historic_event SETTLEMENT_NAME_CHANGE_MOVE
end_if
end_monitor
monitor_event GeneralCaptureSettlement SettlementName Kernave
and CharacterReligion pagan
and I_TurnNumber < 401
change_settlement_name Kernave Kernave
end_monitor
monitor_event GeneralCaptureSettlement SettlementName Kernave
and CharacterReligion pagan
and I_TurnNumber > 400
change_settlement_name Kernave Trakai
if not IsFactionAIControlled
historic_event SETTLEMENT_NAME_CHANGE_MOVE
end_if
end_monitor
...
;------------------------------------------------------------------------------ GDANSK
monitor_event GeneralCaptureSettlement SettlementName Gdansk
and FactionType poland
change_settlement_name Gdansk Gdansk
end_monitor
monitor_event GeneralCaptureSettlement SettlementName Gdansk
and CharacterReligion catholic
and not FactionType poland
change_settlement_name Gdansk Danczig
if not IsFactionAIControlled
historic_event SETTLEMENT_NAME_CHANGE
end_if
end_monitor