Extending the JSON Dialogue System

9

Index

Attached Files

The following files have been attached to this tutorial:

.c3p

extendedjsondialogueexample.c3p

Download now 173.58 KB

Stats

6,010 visits, 11,867 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.

So, you can call functions from your JSON file now, but did you know you can do the same thing with Timelines?

The events to do this are almost identical to those used to call functions, only this time there’s a different line “type” in the JSON file and you’re obviously referring to the Timeline object rather than a function.

Once you’ve created your timeline, you can add an action to play it by name. This means we can use a DisplayTimeline function to play a timeline based on a string stored in the JSON file:

On function DisplayTimeline

Number Parameter: dialogueID

Number Parameter: sceneID

Action

System ▶︎ Set layer “Dialogue” invisible

Timeline ▶︎ Play JSON.Get(“scene.” & curScene & “.dialogs.” & curDialogue & “.timeline”) with tags “”

I’ve not used tags in this example, but if you want to use a lot of timelines, you might want to consider tagging them appropriately.

You’ll then need to make sure you have the event to call the DisplayTimeline function as you did previously with DisplayFunction:

Now when you speak to an NPC with the appropriate dialogue assigned to it, you should be able to trigger timelines while talking to them!

Next Tutorial In Course

Branching Dialogue using JSON 08:09

Adding branching and 'event' dialogue to the JSON system.

  • 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