Extending the JSON Dialogue System

10

Index

Features on these Courses

Attached Files

The following files have been attached to this tutorial:

.c3p

extendedjsondialogueexample.c3p

Download now 173.58 KB

Stats

6,971 visits, 13,426 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 28 Jan, 2020. Last updated 31 Jan, 2020
.C3P

extendedjsondialogueexample.c3p

Download now 173.58 KB

Welcome to another tutorial regarding the use of JSON for NPC-based dialogue. This tutorial uses the same project as the Using a JSON Dialogue System with NPCs tutorial, however, it’s been extended to showcase some additional, more advanced functionality.

Starting with what’s changed in the layout of the project, you’ll see that there are now three NPC objects. The new addition will be used to demonstrate calling a function using the JSON file.

Talking of the JSON file, that’s had a few changes made to it too. There’s now an additional key in the array for each dialogue called “type” – this determines the type of line to be displayed, be it a function, timeline or just a regular line so that the correct functions can be called.

Each dialogue contains an ID number, (attached to the NPC to call the correct lines) and an array which itself contains the dialogue data including the character’s name, dialogue type and of course the dialogue text itself.

If you take a look through the JSON file, you’ll see there are a few things that look a bit like BBCode tags, only with curved brackets instead of square ones. That’s because square brackets are already used to denote Arrays within JSON, so we need to use a function to apply the necessary formatting.

  • 2 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • Hello, I'm Giuseppe from Italy.

    I tried to use this method to my buttons in Construct 3, but it dosen't work, why?

    Here I put my example code:

    nCasuale: random number

    Questiti.At(nCasuale,1): bidimensional array of sentencies (X,Y), where I inserted the /br code

    Line: string variable

    + System: on functio CreaQuesito

    -> Sistema: set text to Quesiti.At(nCasuale,1)

    -> Tasto01: set text to replace(line,"/br",newline)

    -> Tasto01: [Set CSS style "font-size" to "18px"]

    I hope you can help me

    Giuseppe