How to code an interactive conversation with an NPC

Last updated: January 20, 2025

This is for when you want to speak back and forth, giving the player options to speak.
  1. Select the NPC you wish to talk to and open up the Code Builder.

  2. To start the code, from the Events Section, place a When Player Clicks Object

  3. Underneath, from the Dialogue section, place a Prompt Dialogue. You may adjust the npc's behavior and purpose using the drop down options.

  4. To start a conversation line, pick the Prompt Choice Tree and place it inside underneath the prompt dialogue, before the End

  5. To continue the responses, add another Prompt Choice Tree inside of the last one. Keep going for however long you want the conversation to last.

  6. EXTRA! If you want to give the player 2 options to choose from when talking, add Prompt Choice Tree down at the second last gap.

To test the code, play your game and see if you can talk!

Was this article helpful?

Thanks for your feedback!