How to make dialogue conversations the player can "click through"?

0 favourites
  • 6 posts
From the Asset Store
Create complex dialogues with ease with this tool/template!
  • Hey, all!

    I'm trying to make a vanilla walk-around-and-talk-to-NPCs game, and I'm having trouble with the dialogue system. I've followed the arrays tutorial and have all of my dialogue lines (or test lines) stored in an array in my project, but that tutorial doesn't include ways to call multiple lines of dialogue in a "chain." For example, I'd like to do this:

    (player presses spacebar while overlapping NPC)

    NPC: What can I do for you?

    (player presses spacebar again, which continues the conversation)

    Player: Not much.

    (player presses spacebar again, which continues the conversation)

    NPC: Fine.

    That's all—no choices, nothing too fancy, just pressing a button to get through a pre-written conversation.

    As it is right now, I only understand how to have my player sprite walk up to an NPC, press spacebar while overlapping, and get one line of dialogue from my array—not multiple lines of dialogue for a "full conversation." Is there a "Wait for key press" functionality or something that I can use within dialogue to allow the player to click/key press through?

    I've looked at the "Zelda Dialogue System" example as well as the "Dialogue Box for Lazy People", but I can't quite understand how their "go_to_next" function works—which I think is the function they're using to make dialogue appear in sequence?

    As a disclaimer, I know next to nothing about programming—all of my shaky understanding has come from tutorials and some experience in the Quest Text Adventure engine.

    A link to my game, if it helps.


  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I put the NPCs into a family called NPC, so you just have to check if the player is overlapping an "NPC"

    I gave the NPC family an instance variable to tell what line in the array their conversation is, and an instance variable that tells what position the conversation is at.

    every time you press the space bar it advances the conversation by one step, until the next step is "END".

    when the player is no longer overlapping the NPC, the conversation is hidden, and all positions reset to 0.

    if you want multiple conversations for NPCs, then you would have to add a list of array positions, and a variable to indicate what the next one is.

    if you plan on having a lot of NPCs, and a lot of conversations, this will eventually get hard to manage. There are lots of other ways this can be done...

  • AllanR, thank you SO much!! That makes so much more sense—adding 1 to the position in order to further the conversation by one line.

    And thanks for the additional suggestion to add all of my NPCs to a family in order to not have to repeat the overlapping for every single one—clearly I'm still very new to this, and that makes things so much easier! It's so obvious, I don't know why I didn't think of it.

    I'm adding a screenshot of the event sheet here, so that anyone else just starting out and with this same question can see what the solution could look like, even if the file is unavailable.

  • hamthegirl i would be interested in this, if you are willing to share the screenshot/code :)

  • Sorry, looks like my screenshots didn't work properly! Here they are:

    Event sheet:

    NPC family instance variables:

  • thanks :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)