What I meant was surely you don't have to check which faction the player switched too each frame, just whether the player switched.
Oh gotcha I understand now! I am being too general and not explaining the technical implementation. The player locks portraits based on the faction in question before the encounter that would trigger the EveryFrameScript even begins. So the check isn't for whether the player switched factions at all, but whether they:
A) Have locked player portraits on a specific faction.
This is the boolean which is faction specific because it
also serves as the flag to populate the dialogue to reverse back to all portraits. So because the rule that checks each flag offers faction specific dialogue to reverse it and relies on a unique faction-based check to fire the rule- it must inherently remain unique as well.
- To your point, however, I see now
another player variable- set as an int being set to 0 or 1- indicating a general all-purpose lock/not lock to player portraits- would very well serve the same function since you can't have more than one commission and so theoretically you couldn't have more than one faction's portraits locked to the player's when checking the EveryFrameScript. However:
B) No longer has a commission
with that specific faction when the assumption is they originally did have one before.
- This is harder to get around since I would therefore have to determine the origin faction to check for an active commission
with that faction. That is where the faction specific boolean comes into play. Unless I can just check for player.hasCommission() in general without determining faction (not sure honestly), I wouldn't be able to use the above all-purpose player variable.