Forum rules - please read before posting.

Replay speech.

I would like to give the users more control over dialog timing.
Display speech forever until user skips it option is very useful. In addition, would it be possible to have a "Repeat" button so that it replays speech for the subtitle currently displayed?

Comments

  • As in repeat indefinitely?  I don't believe many other users would find that too useful.  Better to comment out the line "audioSource.loop = false;" in Speech.cs, so that you can set the "Loop" property on the character's AudioSource manually.
  • >> As in repeat indefinitely?

    No. This is basically for people who want to hear the line more than once and don't want to automatically move to the next line.

    How about 2 buttons: "Continue the dialog" and "Repeat the line"?
  • I still can't see that being widely used, and also quite fiddly - e.g. would you have to wait for the line to finish once before being able to repeat it, or would spamming the mouse button cause the audio to repeat many times also?

    I think you'll be better off writing a custom script that looks for any currently-playing character audio, and re-playing it if it detects a mouse click.
  • >> I think you'll be better off writing a custom script that looks for any
    currently-playing character audio, >> and re-playing it if it detects a
    mouse click.

    Yes, I think this would work. Is there some example code that I could look at? Also, I would prefer to trigger re-play with a button. We could disable the "re-play" button while the audio is playing to prevent spamming.
  • You can access the Speech class of the most recently-played line with the following:

    KickStarter.dialog.GetLatestSpeech ();

    This page covers the public functions available in the Speech class.  You should be able to get the audio clip by referencing the GetSpeakingCharacter () function, to get the character, then the AudioSource component, then the clip within it.
  • Thanks again. I added a custom script, but how would I trigger it with a menu button? The gameState is Cutscene during an interaction. So, even though the "repeat" button is visible, I can't click on it because the cursor is off. What did I miss?
  • Don't link it to AC's Menu System if you don't have to.  A regular Unity UI button will not care about the gamestate if it's not listed in the Menu Manager.

    Know that you can also trigger an ActionList to call your script when the player presses a key - even during Cutscenes.  This is the Active Inputs feature, and is covered in the Manual's Section 2.14.
  • >> Know that you can also trigger an ActionList to call your script when
    the player presses a key - even >> during Cutscenes.  This is the Active
    Inputs feature, and is covered in the Manual's Section 2.14.

    That won't work on mobile. Correct?


  • >> A regular Unity UI button will not care about the gamestate if it's not listed in the Menu Manager.

    I have added a UI button, but how do I click on it during an Interaction? The cursor is not visible. Sorry, I must be missing something obvious :)
  • >> A regular Unity UI button will not care about the gamestate if it's not listed in the Menu Manager.

    I have added a UI button, but how do I click on it during an Interaction? The cursor is not visible. Sorry, I must be missing something obvious :)
  • edited December 2015
    That won't work on mobile. Correct?

    Correct.

    I have added a UI button, but how do I click on it during an Interaction? The cursor is not visible. Sorry, I must be missing something obvious

    By default, the cursor'll be hidden whenever gameplay is blocked, but you can override this by defining a "Wait cursor" in your Cursor Manager.
  • Thanks! "Wait cursor" works great.

    I'm using Display speech forever until user skips it. Would it be possible to continue a dialog by clicking a button (UI or AC menu) instead of a mouse click?
  • You could, but you'd have to modify AC's Speech.cs script.

    Basically, you'd want to change any instance of:

    KickStarter.playerInput.GetMouseState () == MouseState.SingleClick

    with:

    KickStarter.playerInput.InputGetButtonDown (axisName)

    Where "axisName" is the name of an input axis.  If you're simulating it through a button tab/click, you don't actually need it defined in your Input Manager.  To link it to an AC button, create a new Button with a "Click type" of "Simulate Input", and fill in the fields beneath.

    To link it to a UI button that isn't registered in AC's Menu Manager, you'll have to link it to run the following code manually:

    AC.KickStarter.playerInput.SimulateInput (SimulateInputType.Button, axisName, 1f);
  • Thanks! That worked perfectly. I have a couple follow-up questions:

    1. I modified Speech.cs script as you suggested. Should I do the same with the Version 1.50 or there's a way to accomplish this by changing some settings in the Editor?

    2. Is it possible to toggle Display speech forever until user skips it during runtime?
  • 1) I'm afraid you will have to do the same to v1.50.

    2) You can write a script that changes it for you, eg:

    void Update ()
    {
      if (AC.KickStarter.gameState == GameState.Normal)
      {
        // During gameplay
        AC.KickStarter.speechManager.displayForever = true;
      }
      else
      {
        // During cutscene
        AC.KickStarter.speechManager.displayForever = false;
      }
    }

  • Just wanted to let you know that this worked great. Thanks again!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.