Quote Originally Posted by Monkwarrior
Hopefully it is so easy.
I thought that you should specify in the script:
- which settlement is that
- that the spy is there at the moment

What I understand from that script is:
- the game check every briton spy
- the game search for a settlement where the stone_wall exists (irrespective whether the spy is there or not)
- then the game applies the random percent

What happens with the spies that are out of a settlement?
Am I wrong?
I've not tested this but here is my logic:

This is the event:

---------------------------------------------------
Identifier: CharacterTurnEnd
Event: A Character has finished its turn
Exports: nc_character_record, character_record, faction, region_id, character_type, settlement
Class: ET_CHARACTER_TURN_END
Author: Guy

Note that the event has a settlement export, that export relates to the specific city that the character is in. That is why you can have SettlementName as in the following example from vanilla prologue

monitor_event GeneralCaptureSettlement FactionType romans_julii
and SettlementName Messana

This monitor fires when the general captures Messana, not when the general captures the city and a city called Messana exists somewhere.

So:

monitor_event CharacterTurnEnd AgentType = spy
; Check each spy at the end of their turn turn
and FactionType britons
; Check to see if their faction type is Britons
and SettlementBuildingExists = stone_wall
; Check to see if the settlement they're in has a stone wall
and RandomPercent < 20
; Apply random percent

The only confusion in that script, I think perhaps, will be between whether the agent has to be Britons or whether the settlement has to be Britons. Without testing it, I couldn't tell you how the game is reading it.