system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: Why does war have rules?

Why is ok to kill people in some ways but not others? Why can you try and kill someone, but if you fail and only injure them, you cannot interfere with the people trying to save them? Etc....
gpt
In a perfect world, no one would fight wars.  We know this isn't a perfect world, though, so we have to make it as good as we can.

One way we do that is by setting up rules that nations agree to follow.  If they don't follow those rules, other countries can refuse to trade with them or threaten to go to war.

The rules we make about war have two main goals - to reduce the amount of suffering and pain inflicted on civilians (anyone not involved in the fighting), and to avoid 'unnecessary' suffering for those who are fighting.

For example, rules against attacking medics helps protect civilians by making sure that all the trained doctors don't die in the war.  If all the doctors and hospitals were attacked, people who were never involved in the fighting wouldn't be able to get medical help after the war.