Dialogue System Template (Templates)

Discuss Scirra's 2D Asset Store

Post » Thu Feb 05, 2015 4:38 pm



Dialogue System Template — Now for sale in the Scirra Store!
https://www.scirra.com/store/royalty-free-game-templates/dialogue-system-template-699

Highly customisable, this template will allow you to spice up your games with a full featured dialogue system as seen in many console RPG and adventure games of old.

Core features

  • Framerate independant typewriter effect, complete with flawless word wrapping.
  • Supports portrait, with custom placement.
  • Insert variables dynamically inside your dialogues (such as your heroes' names or currently stashed gold).
  • Moddable text commands. Play sound effects, pause between words, etc.
  • Comes bundled with an editor to create your dialogues and test them easily.
  • Data stored as a Jsoned C2 array.


Use this topic to leave comments, ask questions and talk about Dialogue System Template
B
74
S
31
G
26
Posts: 994
Reputation: 20,198

Post » Tue Jun 23, 2015 6:05 pm

Hey there magistross. This seems like a really solid dialogue system!

I just bought it from the store but I am a little lost.

It would be awesome if you could make a simple "get started" tutorial on how to implement this into another project.

Like, everything that needs to be copied, what objects need to be on the layout and how to have a couple of dialogues already loaded inside of construct 2. A quick how to, so that maybe in 10-15 minutes I can have this running in my game! Maybe show how to use the "dummy" layout, and get some dialogues being triggered there.
Image
B
22
S
5
G
2
Posts: 65
Reputation: 1,724

Post » Wed Jun 24, 2015 1:15 am

@fremachuca wrote:It would be awesome if you could make a simple "get started" tutorial on how to implement this into another project.
It's certainly the hardest part of this template, getting it to work inside an existing capx! However, when you know what to copy over, it's not that complicated, here's the breakdown of what you should do :

1. Copy these objects to your project (an event-less layout works wonder, like the "Dummy" layout) : ContinueIndicator, PortraitSprite, SpriteFont, WindowFrame
(edit: Version 1.02 now needs additional objects : UpArrow, DownArrow, ChoiceSelector)

2. Create these objects and name them like so :
1 Array Object named "DialogueData"
1 Dictionnary Object named "DialogueDictionary"
1 Dictionnary Object named "DialogueCommands"
1 Dictionnary Object named "GameVariables" (this is where you game should store its variables, so that dialogues can fetch them)
1 Function Object named "Function" (default)
1 Browser Object named "Browser" (default)
1 Audio Object named "Audio" (default)

3. Create a new event sheet, and copy over all the content from the "DialogueEvents" sheet from the template. If all objects were correctly copied / created, it should give no error message. (per @haddy22 's remark, variables should be copied over before other events, so doing it in chunks might be better)

4. Include this new event sheet inside whatever layout where you want to use the system.

5. Be sure to have a "HUD" layer in all your layouts where you need dialogues. (You can also define your own layer by changing the "DIALOGUE_LAYER" constant)

6. You can then initiate a dialogue with the "Dialogue_StartDialogue" function. It will start a dialogue with the data currently in the "DialogueData" array, or you can also provide a "key" parameter, it will then load the dialogue from the "DialogueDictionary" and start it. An AJAX call to retrieve either an array or a dictionnary JSON will most likely be needed.

Please let me know if you need further help !

edit: User mikal tried to import the template in a C3 project and found out that additional work must be done.

@mikal wrote:Porting to a project in Construct 3 took a few extra steps (I suggest editing the top post to include this).

The sample project works fine, to include the template into an existing project takes a little more work.

Since the current version of Construct 3 Beta (r66), does not seem to support copying between projects (Ashley turned it off when it was causing problems), you cannot copy the following objects from the template project to a new project, so you must create them (for example in Dummy layout) and then copy over the 'Animations' as needed from the original sprites in the template project.

ContinueIndicator (sprite)
PortraitSprite (sprite with multiple animations from default test case)
SpriteFont (sprite font, add instance variable type string: 'ID', 'choiceFork')
WindowFrame (9 patch, add instance variable type string: 'ID')
UpArrow (sprite)
DownArrow (sprite)
ChoiceSelector (9 patch, add instance variables type string: 'callback', 'params')
Last edited by Magistross on Wed Nov 08, 2017 3:06 pm, edited 9 times in total.
B
74
S
31
G
26
Posts: 994
Reputation: 20,198

Post » Wed Jun 24, 2015 5:06 pm

@magistross
thanks for the reply! It seems i managed to copy everything over to my project. Now I just need to get the dialogues workflow correctly (never used dictionaries/arrays before).

To test things out I used the "utility" that comes with the system to generate 2 different sequences, and save them to the dictionary, and then download the .json file.

Now what do I need to do with this file? How do I load this into the system?

I already have a Function StartDialogue with paramenter "dia01" (key of one of my dialogue sequences) set up.
Image
B
22
S
5
G
2
Posts: 65
Reputation: 1,724

Post » Wed Jun 24, 2015 9:54 pm

Oh, forgot about that part. The JSON file must be loaded via the "Load" action of the "DialogueDictionary". Best if you add the JSON file as a project file too first. There's probably a tutorial on how to load an external file somewhere but basically all you have to do is use the AJAX object, request a project file, and "Load" the AJAX.LastData inside the Dictionary with a "on request complete" event.
B
74
S
31
G
26
Posts: 994
Reputation: 20,198

Post » Thu Jun 25, 2015 12:13 am

Hi Magistross,

I got interested in this template because my game will have hundreds of dialogues. Just some questions for now, probably newbie questions, but better be sure than sorry:

Can we customize the dialog window and cursors to other objects?
Can we use any font we set to it, like SpriteFont?

Thanks for your time.

Best regards,
Lucius
B
8
S
2
G
1
Posts: 15
Reputation: 664

Post » Thu Jun 25, 2015 3:04 am

@LuciusCD
Certainly, the window is a 9-patch object, you can use any image you want. The size of the window and a lot of other options can be changed by simply modifying a few variables. The cursor object is a simple sprite, that can be changed to whatever you want, animated or not. The system use exclusively spritefonts, but you can use anyone you like, you just have to make sure you adjust some of the variables like the line-height so the system knows when to "overflow".

You can basically "theme" this dialogue system in any way you want, and still retain its full functionnality by adjusting a few variables in edit time.

Please let me know if you have any further question! ;)
B
74
S
31
G
26
Posts: 994
Reputation: 20,198

Post » Thu Jun 25, 2015 1:13 pm

Hi Magistross,

Thanks for the reply. One more question then:

I have 3 different reputations, like A, B and C, each one increases accordingly to choices made by the player. Using your template, can I "fork" the three of them and get only the highest reputation answer? I mean, if A is 80 and the others are lower, can I program it to show only the answer of the highest reputation in your template directly? How could I do that?

Best regards,
Lucius
B
8
S
2
G
1
Posts: 15
Reputation: 664

Post » Thu Jun 25, 2015 1:28 pm

@magistross awesome! got it working inside my game!

2 more questions (for now ;) )

the utility is awesome to test a couple of sequences out. but what I would like to is to have all my dialogue in a google docs spreadsheet so that it would be easier to organize, tweak and send to others to translate later.
how could i make this transition from google docs -> DialogueDictionary ?

AND

is there a way to make a yes or no choice in the dialogue?
for example:
dialogue = "do you want to buy something?"
option/choice = yes or no
if yes "fork" to dialogue X
if no "fork" to dialogue Y
Image
B
22
S
5
G
2
Posts: 65
Reputation: 1,724

Post » Thu Jun 25, 2015 4:41 pm

@LuciusCD
Yes it's possible, even though the fork command is originally intended only for a two branch. You'd have to use multiple sequences with only a fork command to simulate a triple branched fork. Here, you can load this dialogue JSON and see how I'd do it.

@fremachuca
Unfortunately, the utility is the only "official" way to organize and edit your dialogues. However, it would be quite possible to create a Google Apps Script to generate a DialogueDictionary JSON from a spreadsheet given that all the data follow a specific template.

A choice "command" is definitely something I want to add. However, I'm still struggling on how to organize things so that it becomes easily customizable... Stay tuned for this functionality !
B
74
S
31
G
26
Posts: 994
Reputation: 20,198

Next

Return to Scirra Store

Who is online

Users browsing this forum: No registered users and 5 guests