Dialogue best practices - and where to store text

0 favourites
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • Yeah the ajax fix is a blessing, but XML object is still listed as incompatible in Ashley's export to Cocoonjs page. I think XML is incompatible on CocoonJS's end.

    A finite state machine (spreadsheet) style model should still be a good alternative though. Something like this:

    <font face="Courier New, Courier, mono">

          |Normal|Happy |Sad   |

    Joe   |Yo.   |lol   |Nope |

    Doe   |Sup. |rofl |gtfo |

    Mary |Hi.   |Haha |...   |

    Sue   |Hello.|Teehee|...   |

    </font>

  • onion you can go back and edit the sprite. The one that liveswif had you could rewrite the text box without it being painted so to speak.

  • Hey guys I'm back on this now and still haven't found an elegant solution for what I want to do. I know I'm probably overthinking this solution, but I want something a bit better than having to manually use an event for each line of dialogue.

    What I'm trying to do is have 2 characters have a chat at the start of each level. Character 1 says something in a speech bubble, then char 2, then char 1 etc, then the game starts. I want to do this at the start of each level (I have 10 levels).

    So a repeatable method would be very handy.

    Arima the dictionary isn't really a good solution in my opinion. You have to give it named keys, and I don't think this will work for what I want. You'd have to know the name of each key when retrieving them in order. Arrays seem like a better solution, although arrays in C2 just seem... weird!! I'd have to add data to the array using separate actions, which would take ages, and I'd have to know where they end up. I know C2 usually has a visual and simlistic way of doing things, but the way we have to add data to an array actually seems more complicated than just writing it out in code.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi guys here's what I've got so far. This is a monologue by 1 character, although I think it's a bit clumsy tbh. Although it does work!

    dl.dropbox.com/u/24767479/c2%20project%20files/scripted%20dialogue.capx

    Is this a sensible way of doing scripted dialogue?

    The next step is to get character 1 talking too,but I've no idea how I'm going to do that using this method. Any ideas?

  • Hi Onion,

    I have been going through the same wringer as you it seems. This certainly appears to be a gap in construct 2`s functionality.

    My first impulse was to use Arrays (object gives an array index to look up the appropriate text) or Dictionary (same but dictionary key passed). First major problem with this is that these can only be populated at run time from the event sheet, not much use when I want to define dialogues for each level.

    Also for my game I want occasional events to start the dialog, with sets of dialogues chained together to make conversations, possible with arrays but not ideal.

    My current solution is to use just one pipe separated string like:

    Hello Joe|Hi how are you|Not too good can you help?|Sure, I`m the hero aren`t I?|{end}

    Then my events pass an ID to the dialogue text object (which has an 'is ID >0' event waiting) and that uses tokenat(dialogue.txt,ID,"|") to get the correct string. The rest of the conversation goes in sequence from that until it gets to a {end} string.

    This way I can have a different instance of the dialogue text object per level with several different conversations in it.

    Still a little clumsy to edit the string so not ideal (although you could read it from a text file and use newline as a separator). * - Also not too sure how many characters the text object allows?

    Hopefully Scirra will see the need and implement something more useful.

    I hope this helps someone with similar problems.

    RR

  • Well, I'll give away my aproch of the problem too.

    I used a CSV to store all the dialogs according to this format :

    PNJname;DialogID;type;dialog1;action1;param1;dialog2;action2;param2;dialog3;action3;param3

    Each and every dialog is then called using the PNJ.UID and the dialogID.

    • the type of dialog is "story", "random" or "choice" and will change how the columns are used.
    • in story mode, dialog1 will display first. If there is an action1/param1, I'll do a call function on the action1, giving param1 as parameter. If not, I'll display dialog2, then dialog3 using the same logic.
    • random will trigger a random dialog between the 3 present. It will then execute the action1 if it is mentioned.
    • choice will make the 3 lines appear and let the player choose one. It will then call the action corresponding to the dialog.

    It was quite long to program in events (around 50 to handle everything) but worth it, as it can easily accept a new type of dialog, and can be used in a lot of ways.

    The CSV was also a pretty easy choice to store the datas as rexrainbow's plugin is so simple to use and quite fast in runtime. Plus, it lets you prepare dialogs in excel ^^

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)