This site has been archived and made available for preservation purposes. No edits can be made.

Results 1 to 3 of 3

Thread: Dialogues

  1. #1

    Dialogues

    I think dialogues could be done server side so the client only gets the message (what the npc says) and options (what you can say as a reply) for any given dialogue. When they choose one option they get the next.

    Could be done like so:
    Code :
    foo = new Dialog("dialog_file.xml");
    OnPlayerUse(player,object)
    {
        if (object.type == MyOwnGeckObjectTypeThatIsAComputerOrSomething)
            player.dialog = foo;
    }

    Having a dialogue in a file would make scripting more difficult so the dialogs could be hard-coded too which would give you much more control over what happens (dialogue exits with a timer or whatever you want)

    I've made a dialogue system like this for my own game that uses xml files and the scripting is done with lua.
    Code :
    <?xml version="1.0" encoding="utf-8"?>
    <dialogue name="Some healer guy">
        <segment name="default">
            <script>
            if (player.health < player.maxHealth) then
                dialog.addOption("heal","Heal me please!"))
            end
            </script>
     
            <message>...</message>
            <option goto="exit">Nevermind..</option>
        </segment>
     
        <segment name="heal">
            <script>
            player.health = player.maxHealth
            </script>
            <message>There you go. Good as new!</message>
            <option goto="exit">Thanks!</option>
        </segment>
    </dialogue>
    Edit: Removed cdata from scripts since it derped out and came out like this <=!=C=D=A=T=A=[

    There's also a <forward> element that you have in place of options which will append the message to the beginning of what it forwards to.
    Code :
    <segment name="foo">
        <message>Hello </message>
        <forward>bar</forward>
    </segment>
    <segment name="bar">
        <message>world</message>
        <option goto="exit">Ok</option>
    </segment>
    This would print out "Hello world"
    Last edited by zamp; 12-22-2012 at 04:11 PM.

  2. #2
    Administrator
    Join Date
    Jun 2011
    Location
    Germany
    Posts
    1,057
    Blog Entries
    5
    Sounds good. We'll have to deal with more important features like NPC synchronization first though, but I will get back to this!

  3. #3

    R: Dialogues

    I think dialogues should be handled like sa-mp handles custom menus, it's very flexible ;-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •