Dialogue System Template (Templates)

3 favourites
From the Asset Store
Fruit Slicer Template & Quality fruit and slice graphics (c3p,png,illustrator files)
  • Magistross Hello again! Hoping you could help me out to fix this.

    How can I adjust the text either to be centered or to be close to the "rightside" portrait.

    Doesn't feel good at all. I'd like to adjust the text to the right side whenever the right portrait character speaks. Either that or center the text for every dialogue line.

    Hopefully you could point me in the right direction! Thanks

  • Hi Smileh, this shouldn't be too hard.

    You can easily center the text of every line by adjusting the horizontal aligment of the SpriteFont object to center and be done with it.

    But if you want it to adapt according to which side is the portrait, simply add a "Set horizontal alignment to right" on event 16 (under the "Set Mirrored" action). I would also make sure the spritefont revert to the default left aligment by adding a "Set horizontal alignment to left" on event 12.

  • Hi Smileh, this shouldn't be too hard.

    You can easily center the text of every line by adjusting the horizontal aligment of the SpriteFont object to center and be done with it.

    But if you want it to adapt according to which side is the portrait, simply add a "Set horizontal alignment to right" on event 16 (under the "Set Mirrored" action). I would also make sure the spritefont revert to the default left aligment by adding a "Set horizontal alignment to left" on event 12.

    Thank you I tried the center aligment before and it didnt work but it was because other reasons, so when I fixed that stuff forgot to test that again lol. Sorry and thanks for the help!

    Now also, is there a way to adjust the margin just for the up and down, and not the right and left? I explain myself.

    I need to set the dialogue margin to 8 so the portrait is centered, but then it wont fit 2 lines on text. So how can I adjust for example the margin to 8 for the sides and to maybe 4 for top and bottom sides.

  • The size of the spritefont is set on event 12.

    Here's the formula for the height : DIALOGUE_HEIGHT - DIALOGUE_MARGIN * 2 + DIALOGUE_LINEHEIGHT

    If your spritefont's lineheight property doesn't fit 2 times in that, only one line will ever show. You could either tweak the variable values, or the change the formula so it uses a new variable with a value distinct from the DIALOGUE_MARGIN.

  • The size of the spritefont is set on event 12.

    Here's the formula for the height : DIALOGUE_HEIGHT - DIALOGUE_MARGIN * 2 + DIALOGUE_LINEHEIGHT

    If your spritefont's lineheight property doesn't fit 2 times in that, only one line will ever show. You could either tweak the variable values, or the change the formula so it uses a new variable with a value distinct from the DIALOGUE_MARGIN.

    Ok thanks, will see if I can make it work. One last thing!

    If I set text alignment to the right, can I make the scrolling of the text also to change it's direction? It "grows" in a weird way.

  • If I set text alignment to the right, can I make the scrolling of the text also to change it's direction? It "grows" in a weird way.

    Unfortunately, that's how it works. Left align -> Text grows to the right, Right align -> Text grows to the left.

    If you used a strictly monospaced font, maybe you could make it so the text becomes less and less appended with whitespaces so it looks like it grows to the right while still being right-aligned.

    "H          "
    "He         "
    "Hel        "
    "Hell       "
    "Hello      "
    "Hello s    "
    "Hello si   "
    "Hello sir  "
    "Hello sir !"[/code:1f9ozaof]
    However that would require a rewrite of how the text is processed.
  • I made the below for my dialogue writer as a guide for when they write dialogue and scripted events. (Taken from the comments in the code.) Great plugin.

    Dialogue text commands cheat sheet:

    • {pause}
      Force user to make an input for the current sequence to continue.
    • {wait:<delay>}
      Add a delay for the next character to display.
      <delay>: delay in ms
    • {setdelay:<delay>}
      Set the character delay for the current sequence.
      <delay>: delay in ms
    • {next}
      Automatically skip current sequence and go to the next. Use it at the end of a sequence, coupled with a wait command just before so the user can read. (Perfect for cutscene).
    • {end}
      End the current dialogue. Useful in a multiple forks dialogue.
    • {playsound:<filename>,<tag>}
      Play a sound file.
      <filename>: the sound filename without extension
      <tag>:tag
    • {playmusic:<filename>,<tag>}
      Play a music file.
      <filename>:the music filename without extension
      <tag>:tag
    • {fademusic:,<tag>,<duration>}
      Fade a music file.
      <tag>:tag
      <duration>: duration in ms to fade
    • {changeportrait:<animation>}
      Change portrait (only works if portrait is shown).
      <animation>: new animation name
    • {fork:<expression>, <truePath>, <falsePath>}
      Fork the current dialogue sequence into two possible path. Can fork inside the current dialogue or start a new one.
      <expression>: expression used to fork. Use the "GameVariables" dictionary for dynamic values. ex: {#goldAmount} >= 50. It will be evaluated with javascript "eval" function, so use valid javascript syntax. String litterals should be double quoted, and not containing any comma. String coming from the "GameVariables" dictionary should also be quoted. ex: "{#playerName}" == "Zelda".
      <truePath>: path if true, use a number to fork to another sequence index, or use a name to fork to a new dialogue. (A numeric value lesser or equal to 0 or an empty string will end the dialogue).
      <falsePath>: path if false, use a number to fork to another sequence index, or use a name to fork to a new dialogue. (A numeric value lesser or equal to 0 or an empty string will end the dialogue).
    • {choice:<choiceText0>::<choiceDiaglogue0>, <choiceText1>::<choiceDiaglogue1>, ...}
      Offer a choice of input to the user. Dialogue will fork according to the choice selected. One parameter per choice. If you need commas in your texts, escape them with a backslash (like this : \, ). Every parameter needs to end with ::"fork options" with "fork options" being a number to fork to another sequence index, or a name to fork to a new dialogue. (A numeric value lesser or equal to 0 or an empty string will end the dialogue) ex: {choice:Yes::saidYes,No::saidNo} -> Selecting the "Yes" choice would make me fork to the "saidYes" dialogue.
      <choiceTextx>: Choice menu text for for choice x.
      <choiceDialoguex>: target of fork to dialogue for choosing choice x.
    • {setvalue:<variable>,<value>,[operation]}
      Set a value inside the GameVariables dictionary.
      <variable>: key of value in GameVariables Dictionary object.
      <value>: value to set variable to.
      [operation]: (optional) = Operation to do on the value (must be numeric), if omitted, value will be SET. Possible values are : + - * /.
  • Nice doc! It indeeds can be handy to writers and scripters so they don't have to rummage through the capx!

  • I just tried to add this to a fresh project and for some reason its not working- ive gone through and checked to make sure ive done things the same as previous files-

    what is most likely the error if the box pops up and you can see the dialog- but the text just reads "text" instead of "o"

    Looks like its not getting all the way through the dialogueEvents or something-

    Trying to do something quick for Ludum Dare

  • Hey Magistross,

    I was wanting to make a dialog system where the player builds a sentence from the options provided, and each path generates varying reactions from the NPC's. For example:

    • Haha! That's...
      • ...so funny!
      • ...the dumbest thing I've ever heard!
      • (back)
    • I'm not sure...
      • ...if that was supposed to be a joke or not.
      • ...you should talk that way about him,...
        • ...that's mean.
        • ...he might hear you.
        • (back)
      • ...I want to be around you, after hearing you say that.
      • (back)

    and the respective sublist would only appear onscreen after the option in the previous list was chosen (with the "Back" option allowing them to undo their choice and go back to the previous list).

    Any ideas how I would go about getting this system to work in the template?

  • Hi Evdog! I think I understood what you wanted. Try one of these files with the templates, and tell me what you think.

    https://dl.dropboxusercontent.com/u/700 ... Evdog.json

    https://dl.dropboxusercontent.com/u/700 ... yEvdog.csv

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi Evdog! I think I understood what you wanted. Try one of these files with the templates, and tell me what you think.

    https://dl.dropboxusercontent.com/u/700 ... Evdog.json

    https://dl.dropboxusercontent.com/u/700 ... yEvdog.csv

    Yes! <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy"> That's just what I'd had in mind! Thank you heaps, I'll be implementing this in my RPG

  • Just picked up the Template and it's awesome in the Utility, but I can't get it to work.

    I've looked through the entire thread and read your comments on how to use it and came up with this.

    What am I missing?

    [UPDATE]

    It helps when you have the event sheet attached to your layout... d'oh!

  • ephrisian I believe you finally got it working ?

  • Yes! I actually am working on some changes that allow me to have the dialogue follow the player or switch locations based on the players location on the screen.

    My next modification will be to make a "target" for the dialogue box to follow.

    It will hopefully look like a comic strip when I've made the changes.

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