How would I go about make a system that choosing certain option will lead you to an ending?

Hello there. I’m currently making a game a came to a problem and need a solution. I want to achieve making a system that depending on the choices you made it would lead you to an “ending”.

This is an example of what I’m talking about:

  • I give the player a question like: Would you like cake? If the player says yes he gets an ending of the cake. If he says no then another question will be asked like: Would you like taco then? If he says yes then he gets the taco ending. If he says no then he gets the nothing ending.

This is just an example as there will be ALOT of questions and you would have to go through alot of options to get a certain ending. Sometimes selecting different a option might lead you to the same question as If you’d have selected the other option would lead you to.

An image to be more clear (sorry for the bad diagram):
diagram

Please notice I’m not asking for any scripts.
Any help or suggestion is appreciated!

local line = {
  Beggining = {
    Text = 'Would you like a cake?'
    Options = {
      Yes = 'Option1',
      No = 'Ending1'
    }
  },

  Option1 = {
    Text = 'What taste?'
    Options = {
      Strawberry = 'Ending2',
      Raspberry = 'Ending2',
      Chocolatte = 'Ending3'
    }
  },

  Ending1 = {
    Text = 'Okay!'
  },

  Ending2 = {
    Text = 'The cake will be prepared soon'
  },

  Ending3 = {
    Text = 'Sorry, we don\'t have this one'
  }
}

This is how your data structure could look like, pretty self-explanatory.
Hope it helps!

1 Like