Forum rules - please read before posting.

How can I redirect dialog lines from one Player to another without them appearing as subtitles?

Hi, I am currently working on a game that features multiple playable characters.

In a specific interaction, the primary player character (P1) can wear a costume. For this, I switch to a different player/prefab (P1_Costume). However, after the switch, all dialogue lines are displayed as subtitles.

Due to having multiple other player characters, we are not using 'Active Player' on the speech actions and would like to avoid this due to the amount of work that would be required to rework this in all existing dialogs and interactions.

Is there a way to redirect the dialogue lines from P1 to P1_Costume so that they appear as speech bubbles above P1_Costume instead of subtitles?

AC version: 1.75.4
Unity Version: 2021.3.7

Comments

  • I think I'd tackle this differently. I'd use the same player prefab, but I'd attach a script to it that swapped the animator controller for one with new animations if a global variable changed. Kind of like this:

    using UnityEngine;
    
    public class SwapAnimator : MonoBehaviour
    {
    
        public RuntimeAnimatorController defaultAnimator;
        public RuntimeAnimatorController costumeAnimator;
    
        void Start()
        {            
            if (AC.GlobalVariables.GetIntegerValue(1) == 1)
            {
                this.GetComponent<Animator>().runtimeAnimatorController = defaultAnimator;
            }
    
            if (AC.GlobalVariables.GetIntegerValue(1) == 2)
            {
                this.GetComponent<Animator>().runtimeAnimatorController = costumeAnimator;
            }
        }    
    }
    

    This is just an example, so you'd need to call Start() manually after changing the variable without changing scenes, but you get the idea.

  • I'd second @Rairun's approach of altering the animation of the Player character. Though, depending on their animation engine, you may be able to get by with relying on the same Animator Controller.

    With Sprites Unity, it'd be a case of placing a second set of standard animations that have a different naming convention (e.g. CostumeIdle instead of Idle), and use the Character: Animate Action's Set Standard method to switch to the new convention.

    With Sprites Unity Complex or Mecanim, it'd be a case of adding a new Bool parameter to the Controller (named e.g. "IsInCostume"), and have it re-route your animation transitions to a separate set of animations when True. The Character: Animate Action's Change Parameter Value could then be used to set the parameter's value.

    On the original topic, however, is this a case of you using a separate menu to display Player speech, with the Subtitles menu reserved for other characters - or is it more to do with the way audio is played/referenced? A speech Menu's properties can be configured to allow it to display exclusively for multiple characters - you can add "P1_Costume" to the Character(s) to limit to field.

    If you can share more details on how your menus/animations are set up, I can elaborate further on these approaches.

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.