Using references to actor display names in dialogue text when directly accessing dialogue entries
Posted: Fri Aug 04, 2023 7:21 am
Hi,
Information about my setup:
We are making a game with comics. All texts are stored in a conversation in the Dialogue Database. I am not using Dialogue System Trigger components to display the texts. Instead every comic panel has a reference to a certain dialogue entry. I use a custom script to display the panels which basically just replaces a TextMeshPro text with the text of the dialogue entry.
This works fine, also with localized texts (which is important as we need localization).
My issue
We are in the beginning of the writing process. It could happen that we have to replace some names later in development. Sometimes Characters mention each other. I want to be able to replace names easily in case something changes. So instead of writing the names in the dialogue text I am referencing their display name in the dialogue text like this:
So, what's [lua(Actor["Jennifer"].Display_Name)] doing?
My actor is called Jennifer, her display name is "Jenny".
When I am using the DialogueSystemTrigger component to display this text it writes:
So, what's Jenny doing?
However, when I directly access the entry.subtitle text as described above it writes:
So, what's [lua(Actor["Jennifer"].Display_Name)] doing?
I thought about running a check whether the string _entry.subtitleText contains [lua(Actor["respective actor's name"].Display_Name)], search for the actor, get their display name and then replace the lua expression with this name, store this in a new string and assign that new string to the textMeshPro.text.
But maybe there is an easier way to achieve being able to replace the names?
I appreciate any suggestions and tips Thank you!!
Best
Lorena
Information about my setup:
We are making a game with comics. All texts are stored in a conversation in the Dialogue Database. I am not using Dialogue System Trigger components to display the texts. Instead every comic panel has a reference to a certain dialogue entry. I use a custom script to display the panels which basically just replaces a TextMeshPro text with the text of the dialogue entry.
Code: Select all
DialogueEntry _entry = dialogueDatabase.GetDialogueEntry(conversation.id, comics[activeComic].panels[activePanel].dialogueEntryID);
textMeshPro.text = _entry.subtitleText;
My issue
We are in the beginning of the writing process. It could happen that we have to replace some names later in development. Sometimes Characters mention each other. I want to be able to replace names easily in case something changes. So instead of writing the names in the dialogue text I am referencing their display name in the dialogue text like this:
So, what's [lua(Actor["Jennifer"].Display_Name)] doing?
My actor is called Jennifer, her display name is "Jenny".
When I am using the DialogueSystemTrigger component to display this text it writes:
So, what's Jenny doing?
However, when I directly access the entry.subtitle text as described above it writes:
So, what's [lua(Actor["Jennifer"].Display_Name)] doing?
I thought about running a check whether the string _entry.subtitleText contains [lua(Actor["respective actor's name"].Display_Name)], search for the actor, get their display name and then replace the lua expression with this name, store this in a new string and assign that new string to the textMeshPro.text.
But maybe there is an easier way to achieve being able to replace the names?
I appreciate any suggestions and tips Thank you!!
Best
Lorena