The problem might be due to multiple egypt merchants. Just taking the first two monitors as an example...
They both fire for all of egypt's merchants, so long as they are in an egypt region. During the first merchant's turn end the script sets egypt_raider_jerus=1 if any of those "near resource" conditions are true. Then it spawns an army if egypt_raider_jerus=1 and sets egypt_raider_jerus=0.
Then the whole process is repeated for the second merchant, including setting the counter back to 1 if any "near resource" conditions are true (which they still will be if no merchants have moved since the previous merchant's turn end).
I didn't look deeply enough at the script to fully understand what is supposed to be happening but if you only want one of these spawns to happen per turn (not per merchant) then you might need another counter that is set to 0 at turn start and to 1 when a spawn happens and use that counter as an additional condition for your spawns.
Alternatively perhaps you could move this script out of the CharacterTurnEnd monitors and put it in one FactionTurnEnd monitor. It seems to me that you don't need this to happen during the merchants' turns, you just need to know whether egypt and jerusalem merchants are near each other (which are I_xxx tests and so can be tested anytime) and whether the factions are at war (again, only one test per turn is needed here: a single monitor to test just that).
Having said that though, there is also the RegionIsLocal condition which your script is using but my proposal can not. But... its use in your script is not necessarily 'accurate' anyway. It is saying "if this egypt merchant is in an egypt region and any egypt merchant is near resource X and any jerusalem merchant is near that same resource then set the counter to 1". That's the limitation of this I_NearXXX condition: it isn't testing whether this merchant is near tile X, only that a merchant is. A very frustrating limitation.
If you really need this "in egypt region" condition then perhaps instead of RegionIsLocal you could use I_SettlementOwner: the appropriate settlement for the region in which the particular resource lies.
e.g. Something like...
Code:
declare_counter spawned_this_turn
declare_counter egypt_jerus_atwar
monitor_event FactionTurnEnd FactionType egypt
set_counter spawned_this_turn 0
set_counter egypt_jerus_atwar 0
end_monitor
monitor_event FactionTurnEnd FactionType egypt
and DiplomaticStanceFromCharacter jerusalem == AtWar
set_counter egypt_jerus_atwar 1
end_monitor
monitor_event FactionTurnEnd FactionType egypt
and I_LocalFaction jerusalem
and I_CompareCounter egypt_jerus_atwar == 1
and I_CompareCounter spawned_this_turn == 0
;resource 1
if I_CharacterTypeNearTile egypt merchant, 2 101, 2
and I_CharacterTypeNearTile jerusalem merchant, 2 101, 2
and I_SettlementOwner {this resource's region's settlement} == egypt jerusalem
spawn_army...
end_if
;likewise for resource2, 3, etc.
end_monitor
The one-spawn-per-turn (spawned_this_turn) limitation is optional.
Actually it can be further simplified: no need for a separate monitor or counter for the AtWar test...
Code:
declare_counter spawned_this_turn
monitor_event FactionTurnEnd FactionType egypt
set_counter spawned_this_turn 0
end_monitor
monitor_event FactionTurnEnd FactionType egypt
and I_LocalFaction jerusalem
and DiplomaticStanceFromCharacter jerusalem == AtWar
and I_CompareCounter spawned_this_turn == 0
;resource 1
if I_CharacterTypeNearTile egypt merchant, 2 101, 2
and I_CharacterTypeNearTile jerusalem merchant, 2 101, 2
and I_SettlementOwner {this resource's region's settlement} == egypt jerusalem
spawn_army...
end_if
;likewise for resource2, 3, etc.
end_monitor
By the way, is this a typo..?
Code:
declare_counter agypt_raider_jerus
No such counter is used anywhere in that script and the egypt_raider_jerus is not declared.