Dialogue System Template (Templates)

Discuss Scirra's 2D Asset Store

Post » Thu Mar 31, 2016 2:42 am

Hi @bclikesyou, you are indeed calling dialogue the right way, assuming the dictionary is correctly loaded before the call.

You also have to change the default position of the dialogue objects, by adjusting the following variables in the dialogue event sheet : DIALOGUE_POSITIONX, DIALOGUE_POSITIONY.

Let me know if this helped you! ;)
B
75
S
31
G
27
Posts: 1,000
Reputation: 20,735

Post » Thu Mar 31, 2016 1:43 pm

@magistross That helps but was I not loading the dictionary correctly because I'm still not seeing it? I thought my first event in the image was how I was supposed to preload the "DialogueDictionary". I also loaded the .json project file to "Files".
B
44
S
13
G
1
Posts: 267
Reputation: 3,555

Post » Thu Mar 31, 2016 2:26 pm

Ok, I thought your image was a mock-up of the actual loading events. You need to do an AJAX call to get the project file and retrieve its content. First you use "request project file", select your file, and then add a "On completed" AJAX event where you do the actual dictionary loading. (i.e. Load from JSON string AJAX.LastData)
B
75
S
31
G
27
Posts: 1,000
Reputation: 20,735

Post » Fri Apr 01, 2016 3:55 pm

Thanks! I'll give that a try this weekend.
B
44
S
13
G
1
Posts: 267
Reputation: 3,555

Post » Sat Apr 02, 2016 8:23 pm

@magistross Got a little farther but still having trouble :oops:

I can't get my dialogue to populate. Text window and Sprite Font shows up but no text. Debug mode has SpriteFont there but no text.
Image

Here is my code. Using DialogueDictionary with my dialogue key "Level1Convo1" which I set in the Utility. I have "dictionary.json" loaded into Files.
Image

Am I doing this right? I know it's an error on my end and not with your plugin :D I should also mention I'm using a small layout size (256 x 144) and a small text box (200x30). Not sure if that's causing the issue.

Thanks for all the help!
B
44
S
13
G
1
Posts: 267
Reputation: 3,555

Post » Sat Apr 02, 2016 9:00 pm

Alright, this problem is most likely spritefont's height related. Since you are using a very low resolution, you needed to reduce the dialogue height in such a way that there is not enough space to display a single line of text, meaning the system will enter in a perpetual "text overflow" mode, continually prompting the user to continue the dialogue.

I definitely did not think this would ever happen ! :lol:

What you need to do is adjust things a bit so you can better use the space inside the window. First, reduce the DIALOGUE_MARGIN variable to something much less than 16. This number represent the amount of pixels between the window border and the spritefont, normally equal to the 9-patch object's margins. So you could use a low number like 2 and alter the 9-patch sprite to have a single pixel border, and adjust its margin to 2 on all sides. Second, you should probably use a spritefont better suited for such a low resolution. The font I provided with the template is 16x16, which is quite big considering your window size.
B
75
S
31
G
27
Posts: 1,000
Reputation: 20,735

Post » Tue Apr 05, 2016 4:00 am

Image

Success! Still need to tweak the dialogue box, add portraits, get the continue button oriented, but I did add my own font and so far it looks great.

Thanks for the help!
B
44
S
13
G
1
Posts: 267
Reputation: 3,555

Post » Tue Apr 05, 2016 5:00 am

Haha! Good going, nice to see you're getting the hang of my system.

Don't forget to adjust the other variables if you need. DIALOGUE_PORTRAITWIDTH and DIALOGUE_LINEHEIGHT might need some tweaking. DIALOGUE_HEIGHT - DIALOGUE_MARGIN * 2 should be a multiple of DIALOGUE_LINEHEIGHT, this way the space available will be optimally used. Might also consider tweaking DIALOGUE_ARROWSIZE too if you plan on having dialogues with lots of "choices" ({choice} command with many different inputs), you'd need smaller sprites too for DownArray and UpArrow. The ContinueIndicator could also use a new, smaller sprite, and if you want to change its position, look at events 27 and 30, where it is created.

Glad I could help! :D
B
75
S
31
G
27
Posts: 1,000
Reputation: 20,735

Post » Thu Apr 07, 2016 6:23 am

This is such a great template! Had my fair share of doubts but reading through these comments helped me a lot and I got most of the implementation done in a single night (only have to adapt the portrait and I'm set).

Image

I have a small request though, if possible - for future updates would you consider adding commands buttons on the utility template? That's what I did in mine at least, this way I could add and edit the text much easier.

Image
B
125
S
43
G
41
Posts: 849
Reputation: 28,260

Post » Thu Apr 07, 2016 1:42 pm

Pretty clever actually, the idea had crossed my mind but seeing it in action sure does help realizing how useful it would be. I'll be sure to add it in the next version!

That said, that game of yours looks pretty good. If it plays as well as it looks, I'm sure it will be a hit!
B
75
S
31
G
27
Posts: 1,000
Reputation: 20,735

PreviousNext

Return to Scirra Store

Who is online

Users browsing this forum: No registered users and 4 guests