I wrote a post on Quora today that iIthought would be fitting here.
Question: How do I write a character to contradict their values.
My answer: What is the value? What value do they hold higher than that? They will make a choice.
Example, they value life and think guns are bad. But they value their life and their child’s life more. So when a masked guy breaks into their home and somehow the main character gets a gun in their hand they have a choice…. Die and hold the value that guns are evil, or use it against the bad guy.
We make choices like this all the time. Sometimes it’s as simple as “don’t hurt bugs” until the creepy spider shows up in your bathtub. Sometimes it’s something bigger. There is always the question of what is more important to them.