;;;;;Особенности скрипта:
;1)нельзя обойти шпионами и катапультами - впервые такая фича
;2)Юниты из гарнизона удаляются - впервые такая фича
;3)Исправлены некоторые ошибки в отличие от патча 1.4.1
;4)Новое удаление юнитов через атрибут garrison_unit в EDU
;5)Тормозит ходы на 0 секунд = ЭПИК!
;6)Скрипт также работает если игрок нападёт на армию, стояющую рядом с городом.
;7)Гарнизонный скрипт не имеет ни одной движковой лазейки (долгие осады города, напасть на армию рядом с городом, катапульты и шпионы и прочее)
;armour 0 = Euro units
;armour 1 = Russia units
;armour 2 = Steppe units
;armour 3 = Muslim units
;;;;;;Cоздадим всего 1 коунтер, вместо 400 в пачте 1.4.1!
declare_counter garrison
;;;;Если включен этот скрипт, тогда отключаем гарнизонный скрипт для монголов:
monitor_event PreFactionTurnStart FactionIsLocal
and I_TurnNumber = 1
set_counter NoGarrisonmongols 1
terminate_monitor
end_monitor
;===================== Блок юнитов из Ungarison Settlement когда город был захвачен =================
declare_counter MayBeVulazka
monitor_event PreFactionTurnStart not FactionIsLocal
set_counter MayBeVulazka 1
end_monitor
monitor_event GeneralCaptureSettlement
set_counter MayBeVulazka 1
;; Город уже занят. Он не пустой, надо возможность вылазки включить.
end_monitor
monitor_event GeneralAssaultsResidence ! TargetFactionIsLocal
and I_CompareCounter MayBeVulazka != 0
set_counter MayBeVulazka 0
;; Атака снаружи - Это точно не вылазка
end_monitor
monitor_event GeneralAssaultsGeneral TargetFactionIsLocal
and ! FactionIsLocal
and I_CompareCounter MayBeVulazka != 1
set_counter MayBeVulazka 1
end_monitor
;============================Скрипт если человек напал на город или на армию стоящую рядом с ним===========================
monitor_event GeneralAssaultsResidence FactionIsLocal
and IsTargetRegionOneOf Paris_Province
and I_SettlementUnderSiege Paris
and not RegionIsLocal
create_unit Paris, Garrison Spearmen, num 3, exp 3, arm 0, wep 0
create_unit Paris, Garrison Cavalry, num 3, exp 3, arm 0, wep 0
create_unit Paris, Garrison Swordsmen, num 3, exp 3, arm 0, wep 0
set_counter garrison 1
end_monitor
;;;;Игрок напал на армию, стояющую рядом с городом или ИИ пришёл на помощь своему городу
monitor_event GeneralAssaultsGeneral CharacterIsLocal
and IsRegionOneOf Paris_Province
and not RegionIsLocal
and not TargetCharacterIsLocal
create_unit Paris, Garrison Spearmen, num 3, exp 3, arm 0, wep 0
create_unit Paris, Garrison Cavalry, num 3, exp 3, arm 0, wep 0
create_unit Paris, Garrison Swordsmen, num 3, exp 3, arm 0, wep 0
set_counter garrison 1
end_monitor
;==================== Если ИИ сделал вылазку - Часть N2 ====================================
monitor_event UngarrisonedSettlement SettlementName Paris
and I_SettlementUnderSiege Paris
and not SettlementIsLocal
and I_CompareCounter MayBeVulazka = 1
create_unit Paris, Garrison Spearmen, num 3, exp 3, arm 0, wep 0
create_unit Paris, Garrison Cavalry, num 3, exp 3, arm 0, wep 0
create_unit Paris, Garrison Swordsmen, num 3, exp 3, arm 0, wep 0
set_counter garrison 1
end_monitor
;===============Удалить юнитов из гарнизона когда ИИ против ИИ вылазка =================
monitor_event GeneralAssaultsGeneral not FactionIsLocal
and not TargetFactionIsLocal
and I_CompareCounter garrison = 1
if I_IsFactionAIControlled venice
destroy_units venice garrison_unit
end_if
if I_IsFactionAIControlled sicily
destroy_units sicily garrison_unit
end_if
if I_IsFactionAIControlled milan
destroy_units milan garrison_unit
end_if
if I_IsFactionAIControlled denmark
destroy_units denmark garrison_unit
end_if
if I_IsFactionAIControlled egypt
destroy_units egypt garrison_unit
end_if
if I_IsFactionAIControlled scotland
destroy_units scotland garrison_unit
end_if
if I_IsFactionAIControlled cumans
destroy_units cumans garrison_unit
end_if
if I_IsFactionAIControlled russia
destroy_units russia garrison_unit
end_if
if I_IsFactionAIControlled spain
destroy_units spain garrison_unit
end_if
if I_IsFactionAIControlled hungary
destroy_units hungary garrison_unit
end_if
if I_IsFactionAIControlled aragon
destroy_units aragon garrison_unit
end_if
if I_IsFactionAIControlled lithuania
destroy_units lithuania garrison_unit
end_if
if I_IsFactionAIControlled kievan_rus
destroy_units kievan_rus garrison_unit
end_if
if I_IsFactionAIControlled teutonic_order
destroy_units teutonic_order garrison_unit
end_if
if I_IsFactionAIControlled norway
destroy_units norway garrison_unit
end_if
if I_IsFactionAIControlled jerusalem
destroy_units jerusalem garrison_unit
end_if
if I_IsFactionAIControlled kwarezm
destroy_units kwarezm garrison_unit
end_if
if I_IsFactionAIControlled vladimir
destroy_units vladimir garrison_unit
end_if
if I_IsFactionAIControlled sweden
destroy_units sweden garrison_unit
end_if
if I_IsFactionAIControlled georgia
destroy_units georgia garrison_unit
end_if
if I_IsFactionAIControlled slave
destroy_units slave garrison_unit
end_if
if I_IsFactionAIControlled turks
destroy_units turks garrison_unit
end_if
if I_IsFactionAIControlled france
destroy_units france garrison_unit
end_if
if I_IsFactionAIControlled papal_states
destroy_units papal_states garrison_unit
end_if
if I_IsFactionAIControlled hre
destroy_units hre garrison_unit
end_if
if I_IsFactionAIControlled england
destroy_units england garrison_unit
end_if
if I_IsFactionAIControlled portugal
destroy_units portugal garrison_unit
end_if
if I_IsFactionAIControlled poland
destroy_units poland garrison_unit
end_if
if I_IsFactionAIControlled byzantium
destroy_units byzantium garrison_unit
end_if
if I_IsFactionAIControlled mongols
destroy_units mongols garrison_unit
end_if
if I_IsFactionAIControlled moors
destroy_units moors garrison_unit
end_if
set_counter garrison 0
end_monitor
;==================Clear Unit from Garrison (Удалить Юнитов из гарнизона атрибут "garrison unit" из kingdoms.exe подлечил)===================
monitor_event PostBattle I_CompareCounter garrison = 1
if I_IsFactionAIControlled venice
destroy_units venice garrison_unit
end_if
if I_IsFactionAIControlled sicily
destroy_units sicily garrison_unit
end_if
if I_IsFactionAIControlled milan
destroy_units milan garrison_unit
end_if
if I_IsFactionAIControlled denmark
destroy_units denmark garrison_unit
end_if
if I_IsFactionAIControlled egypt
destroy_units egypt garrison_unit
end_if
if I_IsFactionAIControlled scotland
destroy_units scotland garrison_unit
end_if
if I_IsFactionAIControlled cumans
destroy_units cumans garrison_unit
end_if
if I_IsFactionAIControlled russia
destroy_units russia garrison_unit
end_if
if I_IsFactionAIControlled spain
destroy_units spain garrison_unit
end_if
if I_IsFactionAIControlled hungary
destroy_units hungary garrison_unit
end_if
if I_IsFactionAIControlled aragon
destroy_units aragon garrison_unit
end_if
if I_IsFactionAIControlled lithuania
destroy_units lithuania garrison_unit
end_if
if I_IsFactionAIControlled kievan_rus
destroy_units kievan_rus garrison_unit
end_if
if I_IsFactionAIControlled teutonic_order
destroy_units teutonic_order garrison_unit
end_if
if I_IsFactionAIControlled norway
destroy_units norway garrison_unit
end_if
if I_IsFactionAIControlled jerusalem
destroy_units jerusalem garrison_unit
end_if
if I_IsFactionAIControlled kwarezm
destroy_units kwarezm garrison_unit
end_if
if I_IsFactionAIControlled vladimir
destroy_units vladimir garrison_unit
end_if
if I_IsFactionAIControlled sweden
destroy_units sweden garrison_unit
end_if
if I_IsFactionAIControlled georgia
destroy_units georgia garrison_unit
end_if
if I_IsFactionAIControlled slave
destroy_units slave garrison_unit
end_if
if I_IsFactionAIControlled turks
destroy_units turks garrison_unit
end_if
if I_IsFactionAIControlled france
destroy_units france garrison_unit
end_if
if I_IsFactionAIControlled papal_states
destroy_units papal_states garrison_unit
end_if
if I_IsFactionAIControlled hre
destroy_units hre garrison_unit
end_if
if I_IsFactionAIControlled england
destroy_units england garrison_unit
end_if
if I_IsFactionAIControlled portugal
destroy_units portugal garrison_unit
end_if
if I_IsFactionAIControlled poland
destroy_units poland garrison_unit
end_if
if I_IsFactionAIControlled byzantium
destroy_units byzantium garrison_unit
end_if
if I_IsFactionAIControlled mongols
destroy_units mongols garrison_unit
end_if
if I_IsFactionAIControlled moors
destroy_units moors garrison_unit
end_if
set_counter garrison 0
end_monitor
monitor_event PreBattleWithdrawal I_CompareCounter garrison = 1
if I_IsFactionAIControlled venice
destroy_units venice garrison_unit
end_if
if I_IsFactionAIControlled sicily
destroy_units sicily garrison_unit
end_if
if I_IsFactionAIControlled milan
destroy_units milan garrison_unit
end_if
if I_IsFactionAIControlled denmark
destroy_units denmark garrison_unit
end_if
if I_IsFactionAIControlled egypt
destroy_units egypt garrison_unit
end_if
if I_IsFactionAIControlled scotland
destroy_units scotland garrison_unit
end_if
if I_IsFactionAIControlled cumans
destroy_units cumans garrison_unit
end_if
if I_IsFactionAIControlled russia
destroy_units russia garrison_unit
end_if
if I_IsFactionAIControlled spain
destroy_units spain garrison_unit
end_if
if I_IsFactionAIControlled hungary
destroy_units hungary garrison_unit
end_if
if I_IsFactionAIControlled aragon
destroy_units aragon garrison_unit
end_if
if I_IsFactionAIControlled lithuania
destroy_units lithuania garrison_unit
end_if
if I_IsFactionAIControlled kievan_rus
destroy_units kievan_rus garrison_unit
end_if
if I_IsFactionAIControlled teutonic_order
destroy_units teutonic_order garrison_unit
end_if
if I_IsFactionAIControlled norway
destroy_units norway garrison_unit
end_if
if I_IsFactionAIControlled jerusalem
destroy_units jerusalem garrison_unit
end_if
if I_IsFactionAIControlled kwarezm
destroy_units kwarezm garrison_unit
end_if
if I_IsFactionAIControlled vladimir
destroy_units vladimir garrison_unit
end_if
if I_IsFactionAIControlled sweden
destroy_units sweden garrison_unit
end_if
if I_IsFactionAIControlled georgia
destroy_units georgia garrison_unit
end_if
if I_IsFactionAIControlled slave
destroy_units slave garrison_unit
end_if
if I_IsFactionAIControlled turks
destroy_units turks garrison_unit
end_if
if I_IsFactionAIControlled france
destroy_units france garrison_unit
end_if
if I_IsFactionAIControlled papal_states
destroy_units papal_states garrison_unit
end_if
if I_IsFactionAIControlled hre
destroy_units hre garrison_unit
end_if
if I_IsFactionAIControlled england
destroy_units england garrison_unit
end_if
if I_IsFactionAIControlled portugal
destroy_units portugal garrison_unit
end_if
if I_IsFactionAIControlled poland
destroy_units poland garrison_unit
end_if
if I_IsFactionAIControlled byzantium
destroy_units byzantium garrison_unit
end_if
if I_IsFactionAIControlled mongols
destroy_units mongols garrison_unit
end_if
if I_IsFactionAIControlled moors
destroy_units moors garrison_unit
end_if
set_counter garrison 0
end_monitor