Hi again!
In my game, the player is able to select from male and female characters. The player controller is spawned when the scene loads, from one of two prefabs that I have configured with Dialog and Quest Machine components.
Is there a way to configure the "Player" actor name within each of my player prefabs, so that an appropriate name is used within dialogues, depending on which player controller prefab instance is spawned? I thought perhaps the Dialog Actor component would give me this, and while I can configure a unique portrait image for each character, I cannot configure a unique name.
Your thoughts as ever are greatly appreciated. Thank you!
Dynamic "Player" actor name
Re: Dynamic "Player" actor name
Hi,
There are two ways to do this:
1. My preference: Set your Dialogue Actor to the Player actor. Set the Player actor's Display Name to the male or female version of the name. You can do this in C# code like this:
Or without scripting, for example using a Dialogue System Trigger that runs this Lua statement:
2. Or create two separate player actors (e.g., MalePlayer and FemalePlayer) and assign them to your male and female player prefabs. The catch with this one is that you'll need to either assign the player to Dialogue System Triggers' Conversation Actor fields, or rely on setting the trigger to OnUse and OnTriggerEnter and leave the Conversation Actor field blank so it will use the GameObject that interacted with the trigger. (More info)
There are two ways to do this:
1. My preference: Set your Dialogue Actor to the Player actor. Set the Player actor's Display Name to the male or female version of the name. You can do this in C# code like this:
Code: Select all
DialogueLua.SetActorField("Player", "Display Name", "name goes here");
Code: Select all
Actor["Player"].Display_Name = "name goes here"
2. Or create two separate player actors (e.g., MalePlayer and FemalePlayer) and assign them to your male and female player prefabs. The catch with this one is that you'll need to either assign the player to Dialogue System Triggers' Conversation Actor fields, or rely on setting the trigger to OnUse and OnTriggerEnter and leave the Conversation Actor field blank so it will use the GameObject that interacted with the trigger. (More info)
Re: Dynamic "Player" actor name
Amazing, thank you Tony. The first option looks to be ideal for this!
Re: Dynamic "Player" actor name
And, of course, it works absolutely perfectly!
Re: Dynamic "Player" actor name
Looks good!