Hello,
How can I make Quests to appear in "UI Quest Log Window" in order they are in "Quests/Items" table?
At the moment they are displayed alphabetically. I will prefer to make a script rather than changing the names of the quest as I already have the names used in many Triggers/Conditions etc.
Thanks.
Quests order in UI Quest Log Window
Re: Quests order in UI Quest Log Window
Hi,
The easiest way is to set the Name fields in the order you want, and set the Display Names to what you want to appear in the quest log window. Example:
The easiest way is to set the Name fields in the order you want, and set the Display Names to what you want to appear in the quest log window. Example:
Code: Select all
Name Display Name
------------ --------------------
01 Kill Rats Kill 5 Rats
02 Bake Cake Bake a Birthday Cake
03 Find Sword Find the Magic Sword
Re: Quests order in UI Quest Log Window
Thanks for the answer. Is there any other way? I am already using the names in Conditions and it will take ages to change it.
Re: Quests order in UI Quest Log Window
Hi,
You can make a subclass of your quest log window class (e.g., StandardUIQuestLogWindow) and override the OnQuestListUpdated() method to sort it however you want. Example:
You can make a subclass of your quest log window class (e.g., StandardUIQuestLogWindow) and override the OnQuestListUpdated() method to sort it however you want. Example:
Code: Select all
public class MyQuestLogWindow : StandardUIQuestLogWindow
{
public override void OnQuestListUpdated()
{
SortQuests();
base.OnQuestListUpdated();
}
private void SortQuests() // Sort by order in dialogue database.
{
var list = new List<QuestInfo>(quests);
list.Sort((x, y) => IndexInDatabase(x.Title).CompareTo(IndexInDatabase(y.Title)));
quests = list.ToArray();
}
private int IndexInDatabase(string questName)
{
return DialogueManager.masterDatabase.items.FindIndex(x => x.Name == questName);
}
}
Re: Quests order in UI Quest Log Window
Thanks.
I got en error in line:
* Cannot implicity convert type "bool" to "int" *
I got en error in line:
Code: Select all
list.Sort((x, y) => IndexInDatabase(x.Title) < IndexInDatabase(y.Title));
Re: Quests order in UI Quest Log Window
Sorry, I should have mentioned that I just typed that example into the reply. It's just an example idea. Try this:
Code: Select all
list.Sort((x, y) => IndexInDatabase(x.Title).CompareTo(IndexInDatabase(y.Title)));
Re: Quests order in UI Quest Log Window
I am sorry, you said it was example my bad.
Anyway it works! Thanks again for a help.
Anyway it works! Thanks again for a help.
Re: Quests order in UI Quest Log Window
Glad to help! Sorry about the earlier typo.