Great news! I have found out what the problem is.
Apparently the monitor for SettlementTurnStart is triggered before the monitor for FactionTurnStart which results in the poleis and markets being counted and reset before the reform can be checked.
I put this code into the campaign script:
Code:
monitor_event SettlementTurnStart FactionType f_rome
log f_rome: Settlement turn
end_monitor
So I could see in the log what order the monitors trigger and this is what I find in the log:
Code:
20:11:33.551 [game.script] [always] f_rome: Faction turn pre-start
20:11:33.622 [game.script] [always] f_rome: Settlement turn
20:11:33.622 [game.script] [always] f_rome: Settlement turn
20:11:33.622 [game.script] [always] f_rome: Settlement turn
20:11:33.622 [game.script] [always] f_rome: Settlement turn
20:11:33.623 [game.script] [always] f_rome: Settlement turn
20:11:33.624 [game.script] [always] f_rome: Faction turn start
20:11:44.824 [game.script] [always] f_rome: Faction turn end
So to fix your problem you will have to modify the campaign script and make the FactionTurnStart monitor into a PreFactionTurnStart monitor so this:
Code:
monitor_event FactionTurnStart FactionType f_nabatu
if I_EventCounter ecNabatu_Imperial > 0 ; reform has happened
terminate_monitor ; kill this monitor
end_if
if not I_IsFactionAIControlled f_nabatu ; reset loop for the human player
and I_EventCounter ecNabatu_Imperial < 1 ; reform has not happened yet
set_counter nabatu_hel_poleis 0 ; reset counter
set_counter nabatu_trade_centers 0 ; reset counter
end_if
if I_IsFactionAIControlled f_nabatu ; Fallback trigger for the AI
and I_NumberOfSettlements f_nabatu > 9 ; have at least 10 settlements
;set_event_counter ecNabatu_Settled 0
set_event_counter ecNabatu_Imperial 1
set_religion f_nabatu rel_c ;;; change to Eastern Imperial "religion"
terminate_monitor
end_if
end_monitor
Becomes this instead:
Code:
monitor_event PreFactionTurnStart FactionType f_nabatu
if I_EventCounter ecNabatu_Imperial > 0 ; reform has happened
terminate_monitor ; kill this monitor
end_if
if not I_IsFactionAIControlled f_nabatu ; reset loop for the human player
and I_EventCounter ecNabatu_Imperial < 1 ; reform has not happened yet
set_counter nabatu_hel_poleis 0 ; reset counter
set_counter nabatu_trade_centers 0 ; reset counter
end_if
if I_IsFactionAIControlled f_nabatu ; Fallback trigger for the AI
and I_NumberOfSettlements f_nabatu > 9 ; have at least 10 settlements
;set_event_counter ecNabatu_Settled 0
set_event_counter ecNabatu_Imperial 1
set_religion f_nabatu rel_c ;;; change to Eastern Imperial "religion"
terminate_monitor
end_if
end_monitor
Unfortunately you will have to start a new campaign for the changes to take effect.