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!