What does an author do?

When you write a story, you are the author. You can choose everything that happens in the story. That's called authorial intent.