SurrenderToEnemies [Solved]

I’ve recently found that SurrenderToEnemies is a much more reliable method of stopping combat than its description suggests, as it isn’t limited to a 10 foot radius.

For a local faction member surrendering to a single player with multiple associates, everyone just stops, as intended, regardless of where they are.

When necessary, the NPC will resume combat, if the player is given a bad reputation before DetermineCombatRound.

However, I hit a glitch. When the player is fighting a bunch of local faction members, I want one of them to be a turncoat and start fighting the others. So they SurrenderToEnemies, ChangeFaction to a global one hostile to the locals, and DetermineCombatRound.

This stops the turncoat fighting the PC and associates, and vice-versa, but the turncoat won’t attack the locals. The locals just attack the PC and associates.

It’s as though SurrenderToEnemies has embargoed combat between all NPCs present at the time, enemies or not. Evidence - the turncoat will attack the locals if they harm a friendly summoned creature, or a long time elapses (possibly the 3 minutes mentioned in the description).

EDIT : I’ve looked at the turncoat’s data in a saved .git file. They have a friendly personal reputation with many of the locals in the area (approximately 50 foot radius). However, strangely, clearing those reputations by script seems to result in continued attacks by associates on the turncoat - I guess it breaks SurrenderToEnemies somehow?

I’m reluctant to abandon SurrenderToEnemies in this case. I have scripted this with more primitive functions, but for some reason that doesn’t reliably stop associates attacking the turncoat.

Any suggestions?

Solved - a one second delay between SurrenderToEnemies and clearing the local’s reputations with the turncoat, followed by DetermineCombatRound, produced the desired behaviour - associates and turncoat stop fighting each other, and start fighting the locals.

I’ll document the key findings in the Lexicon.