Hello everyone,
I am stuck in creating a faction emerge script. I read the threads, I tried several variants, but it seems that I could not get it to work.
Code:
;Faction EMERGE TEST variant
declare_counter scotland_emerge
set_counter scotland_emerge 0
declare_counter scotlandEdinburgh
set_counter scotlandEdinburgh 0
monitor_event SettlementTurnStart SettlementName London
and I_NumberOfSettlements scotland < 1
and SettlementLoyaltyLevel < loyalty_content
and I_TurnNumber > 0
set_counter scotlandEdinburgh 1
inc_counter scotland_emerge 1
end_monitor
monitor_event FactionTurnEnd FactionType slave
and I_CompareCounter scotland_emerge >= 1
if I_CompareCounter scotlandEdinburgh >= 1
;console_command create_building Edinburgh ros_target
;set_counter scotland_building 0
spawn_army
faction scotland
character random_name, named character, age 30, x 107, y 164, family
traits ReligionStarter 1, LoyaltyStarter 1, NaturalMilitarySkill 2, GoodCommander 2, BattleChivalry 2, Loyal 2, Just 2
unit NE Bodyguard exp 1 armour 1 weapon_lvl 0
unit Feudal Knights exp 1 armour 0 weapon_lvl 0
;unit Dismounted Mailed Knights exp 1 armour 1 weapon_lvl 0
;unit Dismounted Mailed Knights exp 1 armour 1 weapon_lvl 0
unit Highland Nobles exp 1 armour 1 weapon_lvl 0
unit Highland Nobles exp 1 armour 1 weapon_lvl 0
unit Highlanders exp 1 armour 1 weapon_lvl 0
unit Highlanders exp 1 armour 1 weapon_lvl 0
unit Highlanders exp 1 armour 1 weapon_lvl 0
unit Highlanders exp 1 armour 1 weapon_lvl 0
unit Highlanders exp 1 armour 1 weapon_lvl 0
unit Highlanders exp 1 armour 1 weapon_lvl 0
unit Spear Militia exp 1 armour 1 weapon_lvl 0
unit Spear Militia exp 1 armour 1 weapon_lvl 0
unit Spear Militia exp 1 armour 1 weapon_lvl 0
unit Noble Highland Archers exp 1 armour 1 weapon_lvl 0
unit Highland Archers exp 1 armour 1 weapon_lvl 0
unit Highland Archers exp 1 armour 1 weapon_lvl 0
end
end_if
if I_SettlementOwner London = england
faction_emerge scotland england 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
end_if
set_counter scotland_emerge 0
set_counter scotlandEdinburgh 0
end_monitor
Code:
;Faction EMERGE TEST variant 2
declare_counter scotland_emerge
set_counter scotland_emerge 0
declare_counter scotlandEdinburgh
set_counter scotlandEdinburgh 0
monitor_event SettlementTurnStart SettlementName London
and I_NumberOfSettlements scotland < 1
and SettlementLoyaltyLevel < loyalty_content
and I_TurnNumber > 0
set_counter scotlandEdinburgh 1
inc_counter scotland_emerge 1
end_monitor
monitor_event FactionTurnEnd FactionType slave
and I_CompareCounter scotland_emerge >= 1
if I_CompareCounter scotlandEdinburgh >= 1
;console_command create_building Edinburgh ros_target
;set_counter scotland_building 0
if I_SettlementOwner London = england
faction_emerge scotland england 1 400.0 0.0 1.2 town true unused_label1 unused_name 30
end_if
spawn_army
faction scotland
character random_name, named character, age 30, x 107, y 164, family
traits ReligionStarter 1, LoyaltyStarter 1, NaturalMilitarySkill 2, GoodCommander 2, BattleChivalry 2, Loyal 2, Just 2
unit NE Bodyguard exp 1 armour 1 weapon_lvl 0
unit Feudal Knights exp 1 armour 0 weapon_lvl 0
;unit Dismounted Mailed Knights exp 1 armour 1 weapon_lvl 0
;unit Dismounted Mailed Knights exp 1 armour 1 weapon_lvl 0
unit Highland Nobles exp 1 armour 1 weapon_lvl 0
unit Highland Nobles exp 1 armour 1 weapon_lvl 0
unit Highlanders exp 1 armour 1 weapon_lvl 0
unit Highlanders exp 1 armour 1 weapon_lvl 0
unit Highlanders exp 1 armour 1 weapon_lvl 0
unit Highlanders exp 1 armour 1 weapon_lvl 0
unit Highlanders exp 1 armour 1 weapon_lvl 0
unit Highlanders exp 1 armour 1 weapon_lvl 0
unit Spear Militia exp 1 armour 1 weapon_lvl 0
unit Spear Militia exp 1 armour 1 weapon_lvl 0
unit Spear Militia exp 1 armour 1 weapon_lvl 0
unit Noble Highland Archers exp 1 armour 1 weapon_lvl 0
unit Highland Archers exp 1 armour 1 weapon_lvl 0
unit Highland Archers exp 1 armour 1 weapon_lvl 0
end
end_if
set_counter scotland_emerge 0
set_counter scotlandEdinburgh 0
end_monitor
In my test I start a grand campaign, surrender_regions scotland, then evacuate London and let it riot for 2 or more turns.
Scotland should emerge now in London, or at least in some England owned settlement, as far as I have understood this.
But nothing happens. No army spawns (as it should regarding the script) nor does scotland emerge.
I have tried several variants of code (the above one is the last iteration).
I do not know where my mistake lies.
I have 31 factions in my mod. Maybe I would need a free faction slot for a successful emergence?
Help would be much appreciated.
cheers
zumi