Forum rules - please read before posting.

Can't get the "Stop Speech" action to work

Because of the way we designed one of our scenes, sometimes the player's speech overlaps with some NPCs' random speech. We can't redesign the level, so I'm trying to make the NPCs shut up whenever the player says something (for instance, when he examines an inventory object).

What I've done is to attach a behaviour script to the player's Talk animation, and inject an ActionListAsset to it, which contains a Stop Speech action inside for Specific Characters Only (with "Force off subtitles" activated). I have two characters separated by commas (the names of the parent objects where the NPC script is, although I've tried with the children too). The action gets executed but the NPCs keep talking. Am I missing something here? I just want them to stop talking whenever the player says something.

I'm using Unity 2017.4.36f1 and Adventure Creator 1.66.1.

Thank you

Comments

  • Character names should be separated by colons, not commas.

    It's also easier to do this with script, rather than relying on an ActionList asset that gets called every animation loop:

    using UnityEngine;
    using AC;
    
    public class StopBackgroundSpeech : MonoBehaviour
    {
    
        private void OnEnable () { EventManager.OnStartSpeech += OnStartSpeech; }
    
        private void OnDisable () { EventManager.OnStartSpeech -= OnStartSpeech; }
    
        private void OnStartSpeech (AC.Char character, string speechText, int lineID)
        {
            if (character != null && character.IsPlayer)
            {
                KickStarter.dialog.KillDialog (true, true, SpeechMenuLimit.BackgroundOnly);
            }
        }
    
    }
    

    This will stop all "Background" speech whenever the Player speaks.

  • @ChrisIceBox as always thank you for the super quick answer - amazing customer support. This solved the problem - I wasn't aware of the ability to subscribe to these sorts of events. Thank you!

  • No problem. See the Manual's "Custom events" chapter, as well as this tutorial, for more on this topic.

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.