Dialog example for the game engine

i have made an example on how you can use a XML document to store dialog data.


dialog.blend (1.82 MB)

How would I use this?

what part of the example do you have trouble with?

How would i add dialogue to it?

Verry usefull, Thank you for sharing!

And a question rises,
How do i insert empty lines? because
\r doesn’t work. (it works if you use it in a line between text, but you cant add 2x

to create an empty line)

As i see it, it places every line that has text, below eachother. But if you have a empty line it wont show it.

this is a simple dialog


<root>
    <npc name="NPC2">
        <dialog id="first">
            <text>
                i don' talk to strangers!!
            </text>
        </dialog>
    </npc>
</root>

this has a link to another dialog


<root>
    <npc name="NPC2">
        <dialog id="first">
            <text>
                i don' talk to strangers!!
            </text>

            <link id="1">are you sure you don't want to talk?</link>
        </dialog>

        <dialog id="1">
            <text>
                yes im sure.
                i don' talk to strangers!!
            </text>
        </dialog>
    </npc>
</root>

to try it out you can download the new blend below
and open a text editor and copy and past one of the code snips above and save the file as dialog-NPC2.xml
next to where you saved the dialog1.blend

http://15b.dk/dialog1.blend

<text>
some text
</text>

<text>
some other text
</text>

empty line come between the 2 blocks

haha didnt even try that, it works for what i want. thanks.