Page 1 of 1

Modify Dialogue Entry inspector to add new templates fields

Posted: Mon Apr 25, 2022 11:12 am
by Jaximus
Hi,

I'm new with Dialog System and I wonder if there is a way to modify the of DialogueEntry class or editor class to add new field I haded in the dialogEntry Template.

Exemple :
I hadded a mood and moodTexture field to the DialogueEntry template

Image

Image

In the inspector, I can modify those new fields (Mood and MoodTextures) by expanding AllFields field but I would like to be able to have directly a field for mood and moodTexture just above actor field.

My goal is to change the actor texture according to the given moodTexture and display a text with the given mood. It would change multiple time during the same conversation.
Maybe there is already a way to do that without changing any script or inspectorScript.

Thanks,
Jaximus

Re: Modify Dialogue Entry inspector to add new templates fields

Posted: Mon Apr 25, 2022 12:44 pm
by Tony Li
Hi,

In the Templates section, tick the Main checkbox for your Mood and MoodTexture fields.

The "Files" field type probably doesn't work the way you'd want it to. Instead, you may want to define a custom field type.

Re: Modify Dialogue Entry inspector to add new templates fields

Posted: Tue Apr 26, 2022 6:08 am
by Jaximus
Hi,

Thanks, that was to quite easy :lol:

But it bring me to another problem, how to use localization with this new mood text field. Maybe I should try to find another way to do that, in a way that allow me to use the localization tools and export as .csv. Do you have an idea ?

I'm about to add a new linked dialogue entry with a new isMood attribut to true for each dialog entry that need a special mood. And then try to catch it while the conversation run.

Image
Image

What do you think about it ?

Best,
Jaximus

Re: Modify Dialogue Entry inspector to add new templates fields

Posted: Tue Apr 26, 2022 8:49 am
by Tony Li
Jaximus wrote: Tue Apr 26, 2022 6:08 amBut it bring me to another problem, how to use localization with this new mood text field. Maybe I should try to find another way to do that, in a way that allow me to use the localization tools and export as .csv. Do you have an idea ?
How would you intend to use localized versions of the Mood field? If it's only for internal use (e.g., to decide what animation to play), you probably don't need localized versions.

If you need to show the Mood to the player, you can create localized versions of your Mood field. Language codes are up to you, but I recommend standard codes such as "fr" for French, "es" for Spanish, etc. Just add the language code to the end, separated by a space:

mood1.png
mood1.png (9.42 KiB) Viewed 600 times

You can get the localized version in C# code like this:

Code: Select all

// Get a reference to the current dialogue entry:
DialogueEntry entry = DialogueManager.currentConversationState.subtitle.dialogueEntry;

// Get the Mood text for the current language:
string moodText = Field.LookupLocalizedValue(entry.fields, "Mood");
If the language is set to "fr", the code above will return the value of "Heureux".
Jaximus wrote: Tue Apr 26, 2022 6:08 amI'm about to add a new linked dialogue entry with a new isMood attribute to true for each dialog entry that need a special mood. And then try to catch it while the conversation run.

Image
Image

What do you think about it ?
Why not add "isMood" to the "Stressed?" node instead?

When the Dialogue System gets to the "Stressed?" node, it will make a list of all linked NPC nodes (gray nodes) and PC nodes (blue), rejecting any nodes that have Conditions that are false.

If the linked NPC node list has anything, the conversation will follow the first node in the list.

Otherwise, if the PC node list has anything, it will show it as a response menu or a PC subtitle.

In your screenshot above, the "Stressed?" node's NPC node list will always have "playful", so you're guaranteed that the conversation will show "Stressed?" and then "playful". It will never get to the "No! No at all!" node.

Re: Modify Dialogue Entry inspector to add new templates fields

Posted: Thu Apr 28, 2022 5:45 am
by Jaximus
Thank for the answer.

I'm going to try the version with Mood fr Mood es and it should be fine.