Ok I am doing some research here. I think if we use the event_counters such as I described above we will have the best chance of getting this somewhat right.
I suggest all of you read through the Transgression triggers in descr_faction_standings.txt for a little insight into how faction relationships work.
These events work, we need a set of them for each possible alliance, and they have to go both ways. In this example, Scotland offers and breaks the alliance with France, but we need an option where France initiates the action as well. We can set the same counter, but 4 options per alliance is needed.
Code:
monitor_event FactionAllianceDeclared FactionType Scotland ;faction initiating alliance
and TargetFactionType france ;faction accepting alliance
set_event_counter scotland_france_alliance 1
end_monitor
monitor_event FactionBreakAlliance FactionType scotland ;faction breaking alliance
and TargetFactionType france ;faction alliance is broken with
set_event_counter scotland_france_alliance 0
end_monitor
This code also works. I only built this to prove we could detect which faction has attacked the settlement of which faction.
Code:
monitor_event Transgression TransgressionName TC_INSTIGATE_SIEGE
and FactionType england
and TargetFactionType slave
add_money england 20000
end_monitor
Once the start of the siege is detected, then we apply conditions:
Code:
monitor_event Transgression TransgressionName TC_INSTIGATE_SIEGE
and FactionType england
and TargetFactionType scotland
if I_EventCounter scotland_france_alliance == 1
put some conditions here to determine whether or not france helps scotland
we may have to run another monitor_event if we want to check stuff like
army garrison strength and stuff like that
set_counter spawn_reinforcements 1
end_if
if I_SettlementUnderSiege Edinburgh
and I_SettlementOwner Edinbirgh == scotland
and I_EventCounter spawn_reinforcements == 1
spawn_army near Edinburgh
end_if
end_monitor