Sites


Creating Point and Click Games with Escoria

Dialog trees

As you can imagine, dialogs use the say command quite extensively.

Some more Esc syntax is available in order to create nice life-like dialogs with other game characters.

To start a new dialog with multiple choice options, you have to use the ? and - special commands.

These two commands implicitly open a new block, so you have to indent the following commands correctly.

The ? command opens a new dialog choice interface as we explained in the "Dialog Interface" chapter in the "Escoria Fundamentals" section, containing all the options defined via the - command. It also takes four optional parameters:

  1. type, defining the dialog interface type for this dialog
  2. avatar, defining the avatar to use for the dialog window
  3. timeout, a number of seconds that the dialog will wait until selecting the default option and…
  4. timeout_option, the default dialog line to select after the timeout has elapsed.

Each dialog choice is defined by the - command inside an ? block.

The - command only requires the text of the dialog choice as a parameter and opens a block which will be run if this dialog line is chosen.

Inside both of those blocks, you can do anything you want, by using any command you like. And, as always, you can put conditionals to these two new dialog commands so that you can only show some dialog or option when some requirements are met.

Here’s a complete example from the second scene of our mini-game, a dialog between the panda player and a chameleon:

:talk

say player "What a strange critter…" default avatar_panda
say chameleon "You know I can hear you, right?" default avatar_chameleon

say player "What? You can talk!?" default avatar_panda
say chameleon "Sure, can't you?" default avatar_chameleon
say player "..." default avatar_panda
say player "Good point." default avatar_panda

? default avatar_panda
    - "You're a chameleon right?"
        say player "You're a chameleon right?" default avatar_panda
        say chameleon "That's right!" default avatar_chameleon
        ? default avatar_panda
            - "What's a chameleon doing here?"
                say player "What's a chameleon doing in this part of the world?" default avatar_panda
                say chameleon "Oh you know, I just like traveling a lot." default avatar_chameleon
            - "I have never seen one before!"
                say player "Whoooah! I've never seen one before!" default avatar_panda
                say chameleon "I guess not many of us are around this part of the globe." default avatar_chameleon
    - "Do you enjoy our babmoo forest?"
        say player "Do you enjoy our bamboo forest? Are you comfortable?" default avatar_panda
        say chameleon "Sure, I like it. Where are all other pandas though?" default avatar_chameleon
        ? default avatar_panda
            - "Aliens"
                say player "Aliens abducted them!" default avatar_panda
                say chameleon "Hahahaha! Nice one little panda!" default avatar_chameleon
            - "Forest destruction"
                say player "The humans are destroying our forest with their machines..." default avatar_panda
                say chameleon "Ow, that doesn't sound so nice, are you doing anything about it?" default avatar_chameleon
                ? default avatar_panda
                    - "No"
                        say player "No... We can't do anything I guess." default avatar_panda
                        say chameleon "Oh, I see..." default avatar_chameleon
                    - "Imploring the Pandas' god"
                        say player "We are making offerings for the Pandas' god so that we can ask him for help. I'm actually gathering some fine bamboos for him! It would be my very first offering to him." default avatar_panda
                        say chameleon "Well! Today is your lucky day! default avatar_chameleon

Il y a une erreur de communication avec le serveur Booktype. Nous ne savons pas actuellement où est le problème.

Vous devriez rafraîchir la page.