Hi,
jcfalcone wrote: ↑Fri Jun 21, 2019 6:41 pmI'm using Quest Machine to handle quests in my game, but I'm having problems to change the language or at least I don't know how. I've two language in my text tables and I'm using the following code to handle the language:
Code: Select all
PixelCrushers.DialogueSystem.Localization.language = this.m_currLanguage;
PixelCrushers.DialogueSystem.DialogueManager.SetLanguage(this.m_currLanguage);
I'm sure the m_currLanguage is using a valid string.
You only need the second line. Internally, DialogueManager.SetLanguage also sets Localization.language.
As a test, temporarily disable your code, and set the Dialogue Manager's
Display Settings > Localization Settings > Language field to the name of the language as defined in your text table.
Then make sure your main text table is assigned to the the Dialogue Manager's
Display Settings > Localization Settings > Text Table field. (This will assign it to the shared UILocalizationManager so Quest Machine will also know about it. The Dialogue Manager will add a UILocalizationManager component at runtime if one doesn't exist.)
Make sure your quest's text uses a text table:
- questTextUsesTable.png (11.59 KiB) Viewed 1079 times
If your text is written into the quest, you can move it into a text table by selecting
(gear menu) > Text > Move Text To Table.
Also keep in mind that when you set a language (even by setting the Dialogue Manager's Language field and playing the scene), it stores the current language in PlayerPrefs. You can click the
Reset Language PlayerPrefs button to clear it.
jcfalcone wrote: ↑Fri Jun 21, 2019 6:41 pmAnother thing is that I need to create some custom keys to use inside the Quest Log, like build names or characters, from my other systems. How can I create it? I couldn't find anything in the manual.
It may depend on what you need to do. Generally speaking, you can't put a {key} inside the text of another key. Otherwise you could write infinite loops like this:
- A: "Same as {B}"
- B: "Same as {A}"
If you were to get the value of the key A it would try to replace {B} with the value of the key B.
But since B's text has {A}, it would try to replace {A} with the value of the key A, and so on until the universe implodes.
This means you're not allowed to do this:
- Quest Description: "Download build number {BUILD}"
- BUILD: "3.14159"
However, you can add entries to a quest's
tagDictionary. The tagDictionary contains tags such as {QUESTGIVER} and {#rabbits} (a counter). These are replaced after the text is retrieved from the text table. For example:
Code: Select all
var playerJournal = QuestMachine.GetQuestJournal();
var quest = playerJournal.FindQuest("Some Quest ID");
quest.tagDictionary.SetTag(@"{BUILD}", "3.14159");