Dialogs - Auto choose last dialog option

  • #1, von sebastianSonntag, 03. April 2016, 23:12 Uhr vor 9 Jahren
    Hello there lads and ladies,

    i played some of the good old adventure games from lucas arts and co.
    One thing which attracted my attention is that in the dialogs the last remaining dialog option gets chosen automatically when talking to someone.
    Every Dialogpart is set up that it disappears after chosen it once. So in the end there would be one option left out.

    Example:
    Lets say we have a dialog tree like that:

    1. Tell me more about Edward
    2. Tell me more about Arnold
    3. Tell me more about Lisa


    Ok. Now inside the game i would talk to that person and chose randomly 2 of the above dialog options.
    After the second talk is finished the last remaining option from the dialog options is shown.
    Instead of clicking it i want that it will get activated automatically so i don't have to click it anymore.

    Any ideas how to achieve this (via lua)?


    kind regards
    Sebastian



    Thread König

    2346 Posts


  • #2, von afrlmeSonntag, 03. April 2016, 23:43 Uhr vor 9 Jahren
    The Lua side of dialogs is pretty much non-existent.

    You could consider using some conditions / values & creating a called by other action which checks the value of a value which you increase / decrease at the end of each selected dialog part & if the value equals a specific value then check which condition is still true & display the text for that & then end the dialog. Sorry for being a bit vague, but I hate the built-in dialog system - it's not very flexible.

    * edit #1: there is something else you could potentially try but I don't think anyone playing your game would appreciate it very much as it involves taking control of the mouse & forcing it to move or jump to a specific position on the screen, then creating a temporary left click event.
    if Values["test"].Int == 0 then
     setCursorPos( { x = 500, y = 500 }  ) -- update cursor position
     createEvent('eEvtMouseLeftButtonDown'); createEvent('eEvtMouseLeftButtonUp') -- create left mouse button pressed & released event
    end
    

    I have no idea if this would work & it's a shitty hack-job either way! grin

    * edit #2: figuring out the x, y position would be fairly easy & should remain consistent throughout each dialog. Run your game, get to a dialog part & run through them until only the last one is left (though technically it should be in same position as the first dialog I think) then hover your mouse cursor over it somewhere so that it highlights it (preferably somewhere near the beginning of the line) & then press TAB key to open up the developer console & type... exec print( getCursorPos().x, getCursorPos().y ) then press enter, now do the same again except type PRINT LOG & then press enter to display the log. Now look for the values it printed & make a note of them.

    Foren Imperator

    7285 Posts

  • #3, von sebastianMontag, 04. April 2016, 00:22 Uhr vor 9 Jahren
    Lets see... There is a possible way to do this without adding additional conditions or values:
    For my dialog system i execute in the end of each dialogpart a script to count the remaining dialog options because i edit the dialogbox size like in deponia. I could just check this variable with lua and test if it is 1 and do the stuff with the cursor positiin setting.

    But i dont like to move the cursor to auto click it... But maybe it is so fast that i can reset the cursorposition to the original position.

    Another way would be to execute/start dialogs via lua (is this possible?) . By that i could include in my script that if the count of dialogparts is 1 to start the remaining dialogpart... Hmm... The question is if i can really check what the remaining part is...

    Thread König

    2346 Posts

  • #4, von afrlmeMontag, 04. April 2016, 00:38 Uhr vor 9 Jahren
    Look at the data structure page in the wiki. Pretty much all of the dialog related stuff isn't scriptable & there's not that many options there either - nothing that you could use at any rate from what I can see. & sure, you could use Lua & a variable to count down with, you could also probably temporarily store the current mouse position in a variable & restore it. I think it would be pretty quick - you could always create a cursor that has no image or uses a transparent png / webp file.

    I guess it wouldn't matter about which dialog part is still available as you would be clicking whatever is left either way.

    Foren Imperator

    7285 Posts

  • #5, von sebastianMontag, 04. April 2016, 01:04 Uhr vor 9 Jahren
    Yeah i guess using the mouse and executing a mouse event is the easiest way because i see no scriptable method to activate a dialogpart without clicking it while inside the dialog

    Thread König

    2346 Posts

  • #6, von afrlmeMontag, 04. April 2016, 01:48 Uhr vor 9 Jahren
    My recommendation? Make your own dialog system!

    Lot of work, sure, but it would be a lot more flexible than the default dialog system. wink

    Foren Imperator

    7285 Posts

  • #7, von sebastianMontag, 04. April 2016, 01:50 Uhr vor 9 Jahren
    I have no idea how to achieve this xD

    Thread König

    2346 Posts

  • #8, von afrlmeMontag, 04. April 2016, 04:47 Uhr vor 9 Jahren
    Well... I guess you'll just have to make do then. razz

    Foren Imperator

    7285 Posts

  • #9, von sebastianMontag, 04. April 2016, 07:46 Uhr vor 9 Jahren
    Well i have an idea how to do it theoretically but not how to transfer it to visionaire...



    Also i overthought the solution with the mouse positioning and auto executed left click:
    Its not possible... When i do this via script, i am still at the end of the previous dialog part. So the dialog options are still not visible when executing it.

    Thread König

    2346 Posts

  • #10, von ke4Montag, 04. April 2016, 08:44 Uhr vor 9 Jahren
    Mmm.. i was trying to achieve a similar thing once. To end automatically dialog when no option is left. I always have this "end dialog option" to not get stuck in there, but it's weird when i have to click it when there's nothing to talk about. I didn't make it work.

    about creating a whole own dialogue system.. i guess it's all done thourgh display narative text options?

    Tastenjunkie

    810 Posts

  • #11, von sebastianMontag, 04. April 2016, 09:20 Uhr vor 9 Jahren
    Well i could try the following:
    Checking in the Main loop if a dialog exists at the moment (lua) and then call a function which counts the dialog part links inside it which are left (partly done as mentioned above). When count is 1 exec the cursor repositioning

    Thread König

    2346 Posts