If it is to be the same max for all factions then you could use just the one counter and monitor (per agent type).
Code:
declare_counter spy_count
declare_counter assassin_count
monitor_event PreFactionTurnStart TrueCondition
set_counter spy_count 0
set_event_counter spy_limit_reached 0
set_counter assassin_count 0
set_event_counter assassin_limit_reached 0
end_monitor
monitor_event CharacterTurnStart AgentType spy
inc_counter spy_count 1
if I_CompareCounter spy_count >= 1 ; corresponding to desired max number of spies
set_event_counter spy_limit_reached 1
end_if
end_monitor
monitor_event CharacterTurnStart AgentType assassin
inc_counter assassin_count 1
if I_CompareCounter assassin_count >= 1 ; corresponding to desired max number of assassins
set_event_counter assassin_limit_reached 1
end_if
end_monitor
EDB:
Code:
capability
{
agent spy 0 requires factions { england, ...other factions..., } and not event_counter spy_limit_reached 1
agent_limit spy 1
}
Recruitment queuing happens before CharacterTurnEnd so by the time that event happens it would be too late to impose the EDB restrictions. In the above script it would be setting restrictions for the next faction based on agent numbers of the current faction. CharacterTurnStart avoids those problems.
If you want different max's for different factions then I would do it like this...
Code:
;faction_id: whose turn is it?
; 1 = england (spy = 2, assassin = 4)
; 2 = france (spy = 3, assassin = 3)
; 3 = hre (spy = 4, assassin = 1)
declare_counter faction_id
declare_counter spy_count
declare_counter assassin_count
monitor_event PreFactionTurnStart FactionType england
set_counter faction_id 1
end_monitor
monitor_event PreFactionTurnStart FactionType france
set_counter faction_id 2
end_monitor
monitor_event PreFactionTurnStart FactionType hre
set_counter faction_id 3
end_monitor
monitor_event PreFactionTurnStart TrueCondition
set_counter spy_count 0
set_event_counter spy_limit_reached 0
set_counter assassin_count 0
set_event_counter assassin_limit_reached 0
end_monitor
monitor_event CharacterTurnStart AgentType spy
inc_counter spy_count 1
if I_CompareCounter faction_id == 1 ;england
and I_CompareCounter spy_count >= 2
set_event_counter spy_limit_reached 1
end_if
if I_CompareCounter faction_id == 2 ;france
and I_CompareCounter spy_count >= 3
set_event_counter spy_limit_reached 1
end_if
if I_CompareCounter faction_id == 3 ;hre
and I_CompareCounter spy_count >= 4
set_event_counter spy_limit_reached 1
end_if
end_monitor
monitor_event CharacterTurnStart AgentType assassin
inc_counter assassin_count 1
if I_CompareCounter faction_id == 1 ;england
and I_CompareCounter assassin_count >= 4
set_event_counter assassin_limit_reached 1
end_if
if I_CompareCounter faction_id == 2 ;france
and I_CompareCounter assassin_count >= 3
set_event_counter assassin_limit_reached 1
end_if
if I_CompareCounter faction_id == 3 ;hre
and I_CompareCounter assassin_count >= 1
set_event_counter assassin_limit_reached 1
end_if
end_monitor
Still not pretty but at least it's only 1 + faction_count + agent_count monitors instead of 1 + (faction_count x agent_count) monitors.
EDIT:
Are changes in event counter values during xxxStart events reflected in recruitment conditions that use them for that turn? I half remember a problem related to that way of doing it.
EDIT2: ah, I didn't see post 2 in time.