You talked about the degree of suffering changing based on if that person has been helpful in your life. Both people who died suffered the same fate why is it less consequential if the person killed was a stranger?

The person who helped you has done things to make your life easier in some ways. Even then, one commits negative action towards them it has a higher degree of suffering attached to it. Although both a stranger and this person suffered the same fate, it is your actions and your Karma that is important here.

If you are just doing a job for example a soldier is just doing their duty, do they still have to suffer?

Absolutely. The soldier has a choice of whether to commit that negative consequence and by choosing to commit that action, they are creating conditions that will affect them negatively. Now, this is different from imminent danger. For example, if there is someone with a bomb who is about to kill hundreds of people and you kill that person you don’t suffer negative consequences. In this case, you actually saved hundreds of lives.