[CUSTOM] dialog system (working/tutorial pending)

  • #30, by ke4Wednesday, 28. September 2016, 13:27 8 years ago
    Okay this works even though it gives me an error in the log file.

    Warning: Unsupported event 'textStopped'.
    Error: Failed to execute hook function 'onTextStopped': [string "customDialog"]:34: Failed to execute command unregisterEventHandler
    

    Key Killer

    810 Posts


  • #31, by afrlmeWednesday, 28. September 2016, 13:51 8 years ago
    Because you're trying to unregister something that doesn't need unregistering.

    All hook & event handler (except mainLoop) can only be registered one time per project. mainLoop is the only event handler you can create multiple instances of, thus it's the only one you can unregister.

    Just remove the else & unregister bit...

    Imperator

    7278 Posts

  • #32, by sebastianWednesday, 28. September 2016, 13:53 8 years ago
    im not sure what text started and text stopped has to do with the dialog system. can you tell me what your approach you are trying?

    I do display the text as by run an action for line 1 to display the text of dialogtable entry 1+offset (0),
    line 2 to display the text of dialogtable entry 2 +offset(0),etc

    offset is 0 when calling the display funtion, because i want to display the first entry on top. of offset =1,entry 2 is displayed in line 1.

    Thread Captain

    2346 Posts

  • #33, by ke4Wednesday, 28. September 2016, 13:56 8 years ago
    But won't this "loop" now be running in the background permanently and slowing the game down? I would like it to run only if its needed.

    Key Killer

    810 Posts

  • #34, by ke4Wednesday, 28. September 2016, 14:01 8 years ago
    @Sebastian.204:
    It's all quite complex, so i've tried to display a basic dialogue ( no conditions, no trees yet) in the most simple way i could think of.
    Loop the table and display the texts one by one. But it needed the textStopped listener to start the texts one by one.

    Key Killer

    810 Posts

  • #35, by sebastianWednesday, 28. September 2016, 14:28 8 years ago
    Im confused xD why are you registering an eventhandler?

    Im not quite sure if you know what my dialog system does: It just displays the selectable texts like with the normal dialog boxes. It doesn't show any character texts or needs to hook into something to check if a text is spoken.

    What you need to do:
    - have a dialog table like you did in yoir screen.
    - have an interface with as much buttons (action area) as selectable texts and name it e. g. line 1 - 4.
    - let your lua function run an action which displays a text for object "line1". the text itself has vs=line_1_string in it.
    the string of the value line_1_string was set before to the text out of the table entry 1.the same for line2-4...

    Thread Captain

    2346 Posts

  • #36, by ke4Wednesday, 28. September 2016, 14:35 8 years ago
    Well i thought you've created a complete dialogue system including displaying character's texts.
    So it's your own interface system for dialogues that are still created in the editor?

    The eventhandler is for checking if the text is done so i could start the another one grin

    Key Killer

    810 Posts

  • #37, by sebastianWednesday, 28. September 2016, 14:45 8 years ago
    ah yeah now it makes sense.
    No, my system just replaces the builtin dialog SELECT. The displayed text which is choosable, the action to run when a line is clicked and ita
    s conditions and pointer are defined via a script. everything what happens when clicking the text is setup running a normal action.

    what you want to do is replacing the whole action which is activated from the dialog select, right... ? Thats a bit too high math for me xD

    Thread Captain

    2346 Posts

  • #38, by ke4Wednesday, 28. September 2016, 14:51 8 years ago
    grin grin
    I don't mate, i just like the idea of creating own dialogue system to get the extra features like sliding in animation when the dialogue stars & other nice stuff i would welcome.
    So i started from scratch grin

    Key Killer

    810 Posts

  • #39, by sebastianWednesday, 28. September 2016, 15:15 8 years ago
    well this would be possible with animating speechbubbles or flying in portraits, etc. but this would mainly be executed from the action itself.

    Thread Captain

    2346 Posts

  • #40, by afrlmeWednesday, 28. September 2016, 16:46 8 years ago
    The dialog thing I did recently (freelance) was just to take a conversation from some Lua tables we generated & have it iterate through the entire conversation automatically. In this case we used

    tag to force the player to skip texts manually as there's no voice over, each time a text ended we checked the incrementing index value against the conversation table entry total to see if we wanted to display the next text or close the dialog interface & kill the loop.

    Basic principal is some Lua tables for storing texts, animation names & so on. Then you need a couple of functions to init the dialog system, then one to update / quit the dialog system. Finally you need a called by other action block which contains something like...

    if values 'dialog_index' less than or equal to values 'dialog_total'
     execute a script > updateDialog()
     display narration text ' <p>
     pause for 150ms
     jump to action part #1
    end if
    

    Obviously that doesn't show you how I wrote my functions, but it should be enough to get the general idea.

    In regards to text effects, flying in, fading in out. I believe there's supposed to be some built in text transition options in the next version. What exactly!? I've no clue!

    Imperator

    7278 Posts