Hi,
I would like to record some statistics about the responses that the player selects. I was wondering what the best way might be to do this.
Here is my logic:
1. Before the game scene starts, search all the conversations in the given database for all questions that the player will be asked throughout the game. I need to know how many total questions there are so I can calculate percentages.
2. Not all player questions will be scorable, so I need to find a way to tag a question/response that needs to be included in the statistics.
3. As the player gives a response, record that data (probably to a scriptable object).
The main issue is that I do not know how to search through conversations to check for scorable questions.
Response Statistics
Re: Response Statistics
Let's assume you're adding a custom Boolean field named "Scorable" to the response dialogue entries.
Then you can count them up and get a list like this (e.g., in a Start() method or something like that):
Then you can count them up and get a list like this (e.g., in a Start() method or something like that):
Code: Select all
List<DialogueEntry> scorableResponses = new List<DialogueEntry>();
int numScorable = 0;
foreach (Conversation conversation in DialogueManager.masterDatabase.conversations)
{
foreach (DialogueEntry entry in conversation.dialogueEntries)
{
if (Field.LookupBool(entry.fields, "Scorable"))
{
scorableResponses.Add(entry);
numScorable++;
}
}
}