Dialogue System Template (Templates)

Discuss Scirra's 2D Asset Store

Post » Mon Sep 04, 2017 9:36 am

Hi @Mante!

After you change the spritefont's sprite, you need to make sure the properties properly reflect the new sprite, otherwise some weird stuff are bound to happen. Also, you need to change a few variables accordingly, at the very least, DIALOGUE_LINEHEIGHT and DIALOGUE_MARGIN should be tweaked to smaller values.

The DIALOGUE_POSITIONX variable represents the top-left corner of the dialogue box, so this value should not be set to a centered point. For the dialogue box to be centered it should be "screenwidth / 2 - DIALOGUE_WIDTH / 2".

Hope this helps !
B
76
S
31
G
27
Posts: 1,016
Reputation: 20,792

Post » Tue Oct 31, 2017 6:48 pm

Message: TheGreatAdam12 can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Dear @magistross !

Help me with these variables! :D https://imgur.com/g38erfB
B
3
Posts: 2
Reputation: 177

Post » Wed Nov 01, 2017 3:55 pm

@TheGreatAdam12

Those are local variables under the "DialogueSystem" group.

What do you need to know exactly ?
B
76
S
31
G
27
Posts: 1,016
Reputation: 20,792

Post » Sat Nov 04, 2017 2:47 pm

@Magistros

What should be in these variables?
B
3
Posts: 2
Reputation: 177

Post » Mon Nov 06, 2017 2:07 pm

It all depends on the settings of your project.

For example, the DIALOGUE_WIDTH should match your game's window size or be a little smaller, depending on your need and the coordinates you used to position the dialogue window.

If your game's window size is very small, a DIALOGUE_MARGIN of 16 is probably too much and you should adjust it accordingly. For best results, it should match your 9-patch window object's margin size.

You can't really break anything unless you use absurd values that makes no sense, so don't be afraid to experiment a bit. ;)
B
76
S
31
G
27
Posts: 1,016
Reputation: 20,792

Post » Wed Nov 08, 2017 6:14 am

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')
B
43
S
18
G
14
Posts: 137
Reputation: 10,483

Post » Wed Nov 08, 2017 2:54 pm

Thanks for your input @Mikal, edited the instructions post with your findings concerning C3.
B
76
S
31
G
27
Posts: 1,016
Reputation: 20,792

Post » Thu Nov 09, 2017 4:29 am

Magistross wrote:Thanks for your input @Mikal, edited the instructions post with your findings concerning C3.


Sounds good. If C3 changes to allow moving object between projects, the changes above would not be needed anymore.

One other suggestion, change the SpriteFont object to be called DialogueSpriteFont (like you do with other objects), so that you won't have an object name clash when the template is added to another project. I had a clash with the Epic Platformer template code and I went through and changed all the Dialogue Event Sheet (and Dialogue original SpriteFont to refer to a new DialgoueSpriteFont object (and all the expression references also.) Luckily with the new 'Find' option in C3, I was able to make sure I got them all. If there is a better way to do that, I would be happy to hear how.

(The Epic Platformer code should also change their SpriteFont object name to something like EpicSpriteFont, so they don't clash with other templates also.)
B
43
S
18
G
14
Posts: 137
Reputation: 10,483

Post » Thu Nov 09, 2017 2:04 pm

Good suggestion. I started "namespacing" my variables/objects/ after a while, and forgot to revisit some. I'll add this on my list. ;)
B
76
S
31
G
27
Posts: 1,016
Reputation: 20,792

Post » Tue Nov 21, 2017 6:54 am

I want to write all my dialogues in a simple text editor and run a 'make' to create a *.json file. I find it more productive to be editing text directly rather than hacking up a *.csv file or using the Construct utility template and having to run Construct.

So I created a simple c# parser to parse a text file and create the *.json file. I got a version working, but looking for feedback if anyone is interested in it or had approached this in other ways.

Some dialogue lines will still be complex, e.g. choice and fork, but as I looked at those, I did not want to re-invent the wheel too much to define new ways that those would work in the text file. As I create more dialogues with those constructs, I'll see if that changes.

Here's my input text file:

Code: Select all
// Name of overall dialogue dictionary (currently not used in dialogue system)
[Header]
WarrenBeforeFire

// Default Character Information
// [CharacterName]:PortraitPosition[Left|Right]:[PortraitName]:[PortraitX int]:[PortraitY int]:[Mirrored|NotMirrored]:[ShowFrame|HideWindowFrame]
[Characters]
Thistle:Left:Portrait2:0:0:NotMirrored:ShowFrame
Nettle:Right:Portrait1:0:0:NotMirrored:ShowFrame
NettleSad:Right:Portrait3:0:0:NotMirrored:ShowFrame

// DialogueBlock
[Dialogue]   
// Dialogue Header / Key
DialogueExample2
// Actual Dialogue
// CharacterName: "blah blah blah"
Thistle: "{enablefog:192,192,192}Thistle you look worried.{pause} Is that smoke I smell in the warren?"
Nettle: "{showcutscene:GreenForestPath} Nettle, a fire! It's close we must escape to the swamp. We'll be safe there.{pause}{removecutscene}"
Thistle: "{showcutscene:ForestFire} Ah! The fire comes, now I hear the roar is it too late?{wait:500}{removecutscene}"

[Dialogue]
DialogueExample4
Nettle: "The smoke is choking us out!"
Thistle: "Let's run for it!"
Nettle: "No, I am ready to do that, wait for my doe!"
Thistle: "We don't have time, we must go now."
NettleSad: ".{pause}.{pause}.{pause} Sigh, all right, I hope she has already left!"
// End section required (all lines ignored in this section)
[End]


This produces a json file:

Code: Select all
{
        "c2dictionary": true,
        "data": {
"DialogueExample2": "{\"c2array\":true,\"size\":[3,7,1],\"data\":[[[ \"{enablefog:192,192,192}Thistle you look worried.{pause} Is that smoke I smell in the warren?\"],[1],[\"Portrait2\"],[0],[0],[0],[0]], [[ \"{showcutscene:GreenForestPath} Nettle, a fire! It's close we must escape to the swamp. We'll be safe there.{pause}{removecutscene}\"],[2],[\"Portrait1\"],[0],[0],[0],[0]], [[ \"{showcutscene:ForestFire} Ah! The fire comes, now I hear the roar is it too late?{wait:500}{removecutscene}\"],[1],[\"Portrait2\"],[0],[0],[0],[0]]]}"
, "DialogueExample4": "{\"c2array\":true,\"size\":[5,7,1],\"data\":[[[ \"The smoke is choking us out!\"],[2],[\"Portrait1\"],[0],[0],[0],[0]], [[ \"Let's run for it!\"],[1],[\"Portrait2\"],[0],[0],[0],[0]], [[ \"No, I am ready to do that, wait for my doe!\"],[2],[\"Portrait1\"],[0],[0],[0],[0]], [[ \"We don't have time, we must go now.\"],[1],[\"Portrait2\"],[0],[0],[0],[0]], [[ \".{pause}.{pause}.{pause} Sigh, all right, I hope she has already left!\"],[2],[\"Portrait3\"],[0],[0],[0],[0]]]}"
        }
}


Which I can then import into Construct and use.

(I also use a Makefile and cpp (preprocessor) to allow me to do file includes and use defines with my text files, but that's for another tool flow discussion...)
B
43
S
18
G
14
Posts: 137
Reputation: 10,483

PreviousNext

Return to Scirra Store

Who is online

Users browsing this forum: No registered users and 2 guests