[Tutorial]A dialog box system using XML

0 favourites
From the Asset Store
Over 2700 files with all the colour combinations from a 15 colours palette!
  • Playable example and capx download in Scirra's arcade

    Find the tutorial video

    Subscribe to Construct videos now

    ,

    Subscribe to Construct videos now

    and

    Subscribe to Construct videos now

    for this game in the Construct2 Academy playlist on Youtube

    *DISCLAIMER*

    The code and logic of the example can be pretty complicated.

    If you are a complete beginner, try your hands at beginner's tutorials first and small examples to get the hang of Construct 2 and its events system.

    Feel free to use this topic to discuss the example and implementation.

    I won't necessarily have answers for all questions/comments but the community is welcome to participate as well.

  • Find the tutorial video

    Subscribe to Construct videos now

    ,

    Subscribe to Construct videos now

    and

    Subscribe to Construct videos now

    for this game in the Construct2 Academy playlist on Youtube

    The videos are now uploaded and can be viewed.

  • :Thanks! I requested this on Twitter and you guys obviously listen

    Will be trying it out over the next week or two.

  • Wow, this is very useful, thanks. Also, where can we find the .xml file? it's not attached to the project

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The 'Dialogs.xml' is already part of the .capx as a Project file.

    The .capx is available from the playable Arcade link, as mentioned in the first post by Kyatric.

  • Thanks Kyatric for this brilliant XML dialogue system method.

    You can check my prototyping based on your work by here:

    http://spinofgames.com/?url=dialog

    USER=SPI PASS=NOF

    Best regards! Seb

  • Sebastien : Pretty cool

    Thanks for sharing.

    Although, it is a bit brutal, I wonder if unions do really negotiate like that

  • "Any resemblance to real and actual names is purely coincidental..."

    I hope to have more time to experiment. Thanks again, happy you like it.

  • Hello everyone! Somebody ask me in private about the "once only answer type".

    Here is a part of my reply in case this simple method can help someone else.

    I have created a "once" attribute in XML with the value 1 on concerned answers.

    Eg: <answer id='YOUR_ID' once='1'>Bla, bla, bla...</answer>

    NB: in my version, "id" attribute is numeric.

    And next, here is a screenshot on how to manage it in the event sheet:

    I hope it will help. Best regards, Sébastien

  • Kyatric Is there a reason you used 'ids' instead of using node index?

    All of the XML tutorials I have seen set ids to numbers which is exactly the same as using the node index but makes it completely barbaric when you want to insert a line somewhere (have to update the id numbers after each change).

    Is there a reason for choosing this way? If you are not aware of what I am referring to I can provide an example.

  • : I'm not sure what you are talking about (as OP posting date shows, the tutorial is almost a year old now).

    Also, as usual with my tutorials they are examples of implementation only, not absolute truths.

  • : I'm not sure what you are talking about (as OP posting date shows, the tutorial is almost a year old now).

    Also, as usual with my tutorials they are examples of implementation only, not absolute truths.

    I know it is a year old but you just fed me a link to it. I'm not trying to be critical—I just feel like the way I mentioned is more efficient and I don't see tutorials use it...

  • : Possibly a lack of knowledge in XML.

    Again, I'm not completely sure what "node index" is supposed to be and how it works better in this case.

    From my quick research, in XPATH it will mostly be used to know the position of a node, which in the end, I'm not sure how is so different then setting IDs to situate it.

    If you have a concrete example I'll be glad to have a look at it.

  • Kyatric: I'm not sure what it is called exactly but node index seemed logical. Example:

    /bookstore/book[1] Selects the first book element that is the child of the bookstore element.

    For some of the examples I have seen it won't be different at all than using IDs but it can save a lot of work in some cases. A lot of times I have used xml has been for dialogue and intro/story where it is subject to a lot of change but I never have to change any id numbers or anything.

    The reason why I am asking is that not too long ago I knew nothing about xml. So I want to keep learning and figure out if there are better ways. Also, haven't done one before but was thinking about writing a tutorial on it.

    If you want to see some capx: (sorry, they aren't examples, just things I have worked on before, so lots of other stuff in them)

    Chooses random node (between 1 and node count):

    viewtopic.php?f=148&t=170355

    First time using XML, simply changes text every couple of seconds to the next line. Once at end (variable > nodeCount) starts over. I bookmarked the event:

    https://www.dropbox.com/s/fvytszs9v3bup ... .capx?dl=0

    Something I'm working on now, bookmarked a couple of events. Can talk to people and just got it working where npc can ask you a question and have a response for each answer:

    https://www.dropbox.com/s/eschjyoosogyc ... .capx?dl=0

    Take a look at the XML sheets in some of these. The Construct events probably won't vary much from your examples but the XML is more straightforward and easier to read. I was looking at your examples and was having a hard time following the XML. Your way works, so there is nothing wrong with it, and it probably helps other people so great, but I didn't want to change my whole system so figured out how to work it with what I had already.

    Let me know what you think. That is why I am asking, not to be critical but to get your insight.

    Thanks

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