[Solved] MultiResponse Module Speech Delay Fix?

Started by Vault15, Fri 01/06/2012 18:59:19

Previous topic - Next topic

Vault15

I'm fairly sure this could be an easy fix. I was unable to find a solution so my apologies if it was obvious.

I'm just trying to make it where the sound clip of the character speaking starts right as the text comes up. Right now it's playing once I click out of the text that appears above the character.

My code:
Code: AGS

function Toilet_Interact()
{
  
  int state=Multi.Say("Look around. Can you see anything? I can't either.>I only remember where things are because my days are the epitome of redundancy.>I don't have to go and it's too dark.");
  if (state==1) aCell_toodark1.Play();
  if (state==2) aCell_toodark2.Play();
  if (state==3) aCell_toodark3.Play();

  
}

Kweepa

I think the simplest way to fix this is to use the standard speech support.

Code: AGS

  int state = Multi.Say("&1 Look around. Can you see anything? I can't either.>&2 I only remember where things are because my days are the epitome of redundancy.>&3 I don't have to go and it's too dark.");


Should play the corresponding ego1.wav, ego2.ogg, or ego3.mp3. As a bonus, it will play translated lines from a speech pack, and skip the speech playback if the dialog line is skipped.
Still waiting for Purity of the Surf II

Vault15

I did actually try that as well and it seems to just literally display "&1". I don't know if it's the module's issue?

Kweepa

Hmm, sorry about that!
In that case you'll have to dig into the module a bit. You could add a separate Multi.Choose function that chooses the appropriate string and returns the state, then a Multi.SayChosen function that actually says the chosen string.

Then
Code: AGS

int state = Multi.Choose("Look...>I only...>I don't...");
if (state == 1) aCell_toodark1.Play();
if (state == 2) aCell_toodark2.Play();
if (state == 3) aCell_toodark3.Play();
Multi.SayChosen();
Still waiting for Purity of the Surf II

Vault15

Thanks for the info. I don't mean for someone to have to hold my hand, but is there any way you'd be able to explain the exact code I should add within MultiResponse? I feel like I will screw it up for sure just attempting that.

Kweepa

Digging into it a bit more, the easiest thing to do is this:

Code: AGS

string chosen = Multi.SRespond("A>B>C"); // or SLoop or SRandom
int state = Multi.response;
if (state == 1) a1.Play();
if (state == 2) a2.Play();
if (state == 3) a3.Play();
player.Say(chosen);
Still waiting for Purity of the Surf II

Vault15

#6
Outstanding, that did it! This makes the coding incredibly easy now =]

Also thank you for noting "SLoop or SRandom" as a comment since I do want some conversations to have a random response. I was actually trying to figure that out as well.

Khris


Vault15

#8
Surprisingly I have, although I realize now that it must have been for an older version. A lot of that looks familiar but beefed up info (I had found it on this forum earlier I believe). Definitely worth a bookmark, thanks.

SMF spam blocked by CleanTalk