To make it easier to write your modules, complete with alternative
endings/paths based on PC decisions, you might consider using
www.inklestudios.com/inklewriter,
a tool developed to help write Choose Your Own Adventure stories. I had
a play around on it for about half an hour, and it's pretty intuitive
to use. Using this handy tool, you'll be able to write all your
conversations, scenes, etc, linking it all together in the right places,
before you start assembling it all in the game.