Sound on the dialogue selection Interface

  • #1, by bananeisafreeWednesday, 03. August 2016, 02:49 4 years ago
    Hi everyone.

    A quick question.
    Is there a way to add a sound when the mouse hover the dialogue selection interface, as well as adding a sound when clicking on one of the option.
    Our Game's interface is filled with satisfying little blips and blops everywhere. And the dialogue area feels awfully mute in comparison.
    I did not found anything regarding the matter ...

    Any help would be loved.
    As well as some coffee ...

    Cheers

    Cesar

    Forum Fan

    120 Posts


  • #2, by afrlmeWednesday, 03. August 2016, 03:52 4 years ago
    To be honest I'm not sure. I don't see anything usable in the data structure under dialogs or fonts...

    Ah wait... had an idea...

    You can specify which cursor to use for selecting dialog in your active
    characters properties tab, so...


    1. create a unique mouse cursor for dialogs
    2. assign it to the dialog cursor in your active characters properties tab
    3. create a condition somewhere, this will be used to determine if a sound should be played or not. Name it something appropriate like: "ds_played".
    4. inside of the first frame of the mouse cursors inactive animation add a set condition action part & set the condition you created earlier to false.
    5. inside of the first frame of the mouse cursors active animation create an if query, something along the lines of... if condition 'ds_played' is false; play sound 'x.ogg'; set condition 'ds_played' to true; end if


    I think you more or less get the idea.

    P.S: if you want to spice it up a bit then you could create a value, set a random value then query said value to select a random sound to be played within an if query. Alternatively you could the same with the Lua functions for the openAL sound engine...
    --[[ 
    add this as definition type script, update tables as needed.
    to use: create an execute a script action which includes: randDialog()
    --]]

    dfx =
    {
    "vispath:sfx/(1).ogg",
    "vispath:sfx/(2).ogg",
    "vispath:sfx/(3).ogg",
    "vispath:sfx/(4).ogg",
    "vispath:sfx/(5).ogg"
    }

    function randDialog()
    startSound( dfx[math.random( #dfx )] )
    end
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18

    Imperator

    6842 Posts

  • #3, by bananeisafreeWednesday, 03. August 2016, 04:14 4 years ago
    ... Man ... I Was on my way to bed... And here you come with your bloody clever idea ... Now I HAVE to test it out !
    Damn you and your crafty way of thinking !


    Joke aside, it sounds like a plan ! thanks a lot!
    If that clever brain of yours ever think of a way to do the same thing for the "clicking on the entry" bit of my problem, don't hesitate to deprive me from more sleep !

    Cheers

    Forum Fan

    120 Posts

  • #4, by afrlmeWednesday, 03. August 2016, 04:21 4 years ago
    Hmm... you can add custom actions to each dialog part I believe? Don't think I can do much about clicking on a dialog part. You could start a loop though I suppose when you show / start a dialog conversation then end the loop after you've done. The loop should listen out for when game.Dialog ~= nil or game.Dialog ~= current dialog (which should be set as nil to begin with).

    P.S: I messed up my script before. I just updated it with a working version before writing this reply.

    Imperator

    6842 Posts

  • #5, by bananeisafreeWednesday, 03. August 2016, 04:42 4 years ago
    Ok So I did as you suggested for the mouse hovering part. It works... kindof.
    Basically if you hover too quickly between the dialog parts the cursor does not reset to the ''inactive" state and thus does not change the condition.
    I don't think we can do much more to optimize this though.

    For the clicking part ... I can't understand why I did not think of it ... Since I literally use the "execute action if dialogue part is selected" for EVERY FREAKING LINE due to the nature of the dialogue in the game.
    I Cheated a bit though, since the action is called only once the "text of dialog part" is done being displayed.

    At first I tried to remove the text and rename the dialog layer. But that led to nothing showing up ingame at the dialogue selection. So I wrote back the text. adding a < p 0 > at the end of it that way the text would show in the dialog selection, but will not be displayed on over the character's head. next in the action part, I play the dialogue selection sound and then display the selected text. It turns out pretty decent actually !

    Thanks a lot mate, did not think that crisis would be solved that quickly!

    Cesar

    Forum Fan

    120 Posts

  • #6, by afrlmeWednesday, 03. August 2016, 04:54 4 years ago
    hmm... I guess you could create 2 frames inside of the active cursor animation... in the first one reset the condition, then force it to play from second frame onwards & in the second frame you add the if condition query to check if a sound should be played. I didn't test it, so I had no idea how it would work out.

    Imperator

    6842 Posts

  • #7, by bananeisafreeWednesday, 03. August 2016, 05:24 4 years ago
    It does not appear to change much. I also tried to create a condition to check if the loop was done fully using the last frame; but it did not do anything either...
    even though it is annoying, I won't call it a major problem. And it is definitely better than having no sounds.
    Thank you again, you were (as usual) more than helpful !

    Forum Fan

    120 Posts

  • #8, by afrlmeWednesday, 03. August 2016, 12:14 4 years ago
    I'm not sure if it's possible to check if a dialog part is currently being hovered over or not. If it is possible then you could use a loop to listen out for it, but I don't know as the data structure didn't offer me much insight - then again I was half asleep last night when I checked & wrote my theoretical solutions to the problems you posted. wink

    Imperator

    6842 Posts

  • #9, by bananeisafreeWednesday, 03. August 2016, 16:27 4 years ago
    It works well enough as it is. If this is gonna be the "worst" part of my interface, then I'll be glad with the way it turns out :p

    Forum Fan

    120 Posts

  • #10, by afrlmeWednesday, 03. August 2016, 16:50 4 years ago
    If you increase the line space value for the dialogs then there's less chance the player will be able to move the cursor too fast to prevent it from changing back to inactive cursor state before hovering over a different dialog option.

    Your best option would actually have been to build a custom dialog interface using the interface section rather than using the built in dialog system as it's really limited.

    Imperator

    6842 Posts

  • #11, by bananeisafreeWednesday, 03. August 2016, 22:15 4 years ago
    You are totally right.
    For the techdemo/prototype we are making, I'm gonna say it is enough.But for the whole game, I think I'll make one myself.

    Forum Fan

    120 Posts

Write post