How to create several optional characters?

I have a story where the MC gets to choose which friends he takes with him into a haunted house. Depending on his friend choices, certain options and stats will change.
His options are as such:

Jeebs (a dog)

The MC will be restricted to only choosing 3 of the 5 choices. As I said, depending on the players selection, certain things may or may not happen in the story, and the MC’s stats will change.
What would the best way to code this up?

Currently I have created a bunch of variables such as:
*create characterDean “false”
*create characterNatalie “false”
*create characterLuke “false”
*create characterLucy “false”
*create characterJeebs “false”

My thinking was when the player selects his three characters, I will set those three to “true” and then I would do if statements to see if they were true.
Does this sound logical? Is there anything I’m missing? Is there an easier way to do this?

Hey :slight_smile:

I’ve tried something similar. I had 3 “empty” character slots and filled those after the MCs choices. Made coding after the choices much easier.




All stats for every character would need to be the same (though obviously the values of those stats would change).

MC just picks the characters they want and you load the character slots with the relevant values.

This might not work for you if - especially - the dog character has different stats (not different stat values)? I guess a (very bad / bad taste) example might be “CollarOnOff” which a human character “might” not have.

This is a pretty big decision to make, your code would work, but reallyits how you would implement it that matters.

As far as execution goes, you would just set the various ‘characterName’ variables to true via plot choices with a ‘*set characterName true’ command. then check them with an ‘*if’ command

But, this really really depends on how you are going to write your story - and how you are going to use these variable to structure branches and conversations where there are multiple people who can be present or not present depending on prior choices. its one of the more complicated things to do, not really code wise but writing, plot and complexity wise.

Anyway here’s a little example for how you would implement multiple characters who may or may not be present, in the same scene. I’ve used 0 and 1 rather than false and true but it works the same.

*create companion_red 0
*create companion_blue 0

Pick your companions
       *set companion_red 1
        You chose Red
        *set companion_blue 1
        You chose Blue
    #Red and Blue
        *set companion_red 1
        *set companion_blue 1
        You chose them both
    #Actually I think I'll go alone.
        You're better off alone.

*if ((companion_red = 1) and (companion_blue != 1))
    Red is amazed at the view, "nice view" she says.
*if ((companion_red != 1) and (companion_blue = 1))
    Blue gazes out from the balcony. "Wow," is all she says.
*if ((companion_red = 1) and (companion_blue = 1))
    Red and blue are stood on the balcony, they both look amazed. "Nice view," says Red. "Yeah, wow," says Blue.
*if ((companion_red != 1) and (companion_blue != 1))
You stand on the balcony alone, admiring the view.


As you can see, your ability to write multiple optional companions is mostly dependent on your ability to write multiple path-lines of the same story and your patience for coding the same thing and debugging the inevitable continuity bugs. And of course, the complexity increeses exponentially the more characters you introduce to a scene due to the increasing number of combinations.


Thank you, you both have helped me out on this.

I can see that it would be a lot of repetition code-wise, and can get confusing plot-wise. Anyways, I was thinking about having the player choose 3 out of the 5 options…is there a code that would basically let them choose their first companion, then present them with the list again, but have the previous selection grayed out?


*temp companion_count  0

*label companion_choice
*if companion_count = 0
Chose your first companion
*if companion_count = 1
Chose your second companion:
*if companion_count = 2
    *goto final_scene
    *disable_reuse #Red
       *set companion_red 1
       *set companion_count  + 1
        You chose Red
        *goto companion_choice
    *disable_reuse #Blue
        *set companion_blue 1
        *set companion_count  + 1
        You chose Blue
        *goto companion_choice
    *disable_reuse #Green
        *set companion_green 1
        *set companion_count  + 1
        You chose Green
        *goto companion_choice
*label final_scene

Fantastic! Thank you so much for being so helpful!