Download

Variable delays for lengths of different dialogue answer sounds?

Hi , so I have a quest system with some audio component sounds for the answer dialogues. I can play the different answers sounds as each of the answer dialogues are clicked, but the answers are different lengths, so with a delay node in after the "Play " node of say, 3 seconds , then real short answers are waiting to move on , or answers longer than 3 seconds are cut short. So I am trying to figure a way to add some code to the delay node so that it will cover the different length of each answer. Or say, all the answers with one delay node. I think "Length " node is more for amount of things in an array , rather than length, as I tried to pull off of “Answer Sound” pin and create array , then tie into “Length” node and then into the “Duration” pin on the delay but it not working with various different types of code I added. In pic

is where the delay sits in relation to the other code. Any help or Ideas? Thanx

you can add a float var to the struct and set each sounds length.

How would I access each sound then? The setup the way it is just accesses all the sounds. Other thing is there could be dozens of different answers and length’s.

Based on your image you have an array of structs feeding a foreach loop. Each array element (STR_DS_Answer) is a struct that has “Answer sound”.

Did you manually set the values for each struct (STR_DS_Answer) or is it populated dynamically?

If it’s manually, then add a new element to the the STR_DS_Answer struct … “answer length” and manually set each value.

Have you tried “Get Duration” ?

The other approach I mentioned above …

I’d assume you would want the delay to be a tad bit longer than the actual sound duration. Maybe a half second or more. Setting your own custom delay values for each dialogue answer gives more control.

No i haven’t tried " get duration" , didn’t know there was such a node. I will try. So if I add an " Answer length" variable , then this would be a Float? I added “Answer Sound” manually . Are you saying if I add " Answer Length" , then I would set the length’s right in the struct?

Wow , so far I think the " get duration" node is working. Thanx , let me test some more

Thanks for your help , man ! I didn’t think it could be that easy. How about this one without creating a new thread ? When I have more than one answer , I can select them and they will advance the quest correctly , but the sound always plays the last answer in that section . So if I have 2 answers and click the 1st one , it plays the sound for the second one. This pic is the conversation data table , at the very bottom under “speaker” is the dialogue sound that the NPC speaks to the character, the 2 sections above it are how the answers sections are. And this area is one page of of the conversation. What the NPC would say (at bottom) and 2 answer examples above it.

Like it cant differentiate the difference between the sound for the 2 answers.

Or it may be possible it is playing through both answer sounds in order and I only hear the second answer sound. Because if the 1st answer is a long answer and the 2nd answer is a short 1 word answer , there is a longer delay before it goes to the next page of text. Like the delay of the 1st answer sound (long answer). If I put 2 short 1 word answers in , then I still only hear the 2nd one but there is very short delay before it moves on to the next page of text.

I’d have to see the code you’re using to play the answers.

Well basically its just this coming off of Answer Event Clicked (where this event is mainly for the answer text ), but the other pic is where the "for each loop " connects to , which is basically breaking the various data table structs to access the answer struct.

Where answer sound is just a sound wave variable added to the answer struct.

I tried adding an integer variable in the answer struct called “answer index” , then put answer one at 0 , and answer two at 1 in the index , but I cant get it to choose the answer I click on and play it. I can make array of the index and use an == integer or a " contains" node and switch one or the other and get it to play answer one or answer two (depending on what I set the node to ), but I cant get it to pick between the two and play which one I click on.

I mean , the answer text chooses which one I click on , but not the sound along with it.

I tried all manner of nodes in there , but no luck.