Skip to content
Carenalga edited this page Nov 28, 2022 · 6 revisions

Description

Each dialog tree you create will have its own script file (based on DialogTemplate.gd). This is created with the name you give the dialog in the Create dialog popup prefixed by Dialog: E.g. DialogChatWithGlottis.gd, DialogQuestionare.gd.

Methods

  • on_start() void

Use it to trigger something you want to happen before the dialog options appear.

IMPORTANT: You must always use a yield.

func start() -> void:
  yield(E.run([
    C.walk_to_clicked(),
    C.face_clicked(),
    "Player: What's going down, clown?",
    'Clown: Hey, back off, Suit',
    "Clown: I'm practicing",
  ]), 'completed')
  .start()

Called when a dialog option is clicked. The id property in opt can be used to check which was the option selected.

func option_selected(opt: PopochiuDialogOption) -> void:
  match opt.id:
    case 'Opt1':
      yield(E.run([
        'Player: Practicing what?',
        'Clown: Wringing your neck, what does it look like?'
      ]))
      opt.visible = false
      options[3].visible = true
    case 'The Second One':
      yield(E.run([
        'Player: Can I walk through your tent?',
        'Clown: No! Do I look like a turnstile to you?'
      ]))
      opt.visible = false
    case 'Exit':
      yield(E.run([
        'Player: I have to go.',
        'Clown: Thankfully.',
      ]))
      D.emit_signal('dialog_finished') # Exit the dialog
      return
  _show_options() # Keep in the dialog and show the list of options again.
Clone this wiki locally