Hi!
I'm thinking of better conversation structuring, since conversation/quest tables are getting bit out of hand in terms of size. What I need is to automate some condition checks.
For instance I assign a custom field of "Item" type to conversation to hold relative quest name.
Then I want to create formal conversation template -
Conversation having dialogue entry for "unassigned","active", "success","failed" quest states.
Ordinary we have to do checks in these entries like this GetCurrentQuestState("QuestName") == "unassigned"
But since we have a quest field in conversation object, how can I get current evaluated Conversation id?
To do the following: GetCurrentQuestState(Conversations[ID].quest) == "unassigned"
How can i get this ID?
This will be very helpful for restructuring dialogues based on quests.
Best regards,
Iegor
[Solved] Getting some context in conditions
[Solved] Getting some context in conditions
Last edited by Iegor on Mon Jun 13, 2016 10:48 am, edited 1 time in total.
Re: Getting some context in conditions
Hi Iegor,
You could set a Lua variable "ID" in a script attached to the Dialogue Manager. Something like:
Then use it like this in your Conditions field:
You could set a Lua variable "ID" in a script attached to the Dialogue Manager. Something like:
Code: Select all
using UnityEngine;
using PixelCrushers.DialogueSystem;
public class SetConversationID : MonoBehaviour {
void OnConversationStart(Transform actor) {
Lua.Run("ID = " + DialogueManager.MasterDatabase.GetConversation(DialogueManager.LastConversationStarted).id);
}
}
Code: Select all
GetCurrentQuestState(Conversations[ID].quest) == "unassigned"
Re: Getting some context in conditions
Yes thought of something like this, but this will not help when I check entry for validity right?
Using
So, for example, standard conversation trigger won't work, because ID variable is not set correctly when it checks?
Also I sometimes check for valid dialogue lines to put a quest mark over npc, this happens without starting conversation.
Thing I want to achieve is a method for checking quest state in conversation that is linked to quest , without entering quest name to condition script.
Using
Code: Select all
DialogueManager.ConversationHasValidEntry ();
Also I sometimes check for valid dialogue lines to put a quest mark over npc, this happens without starting conversation.
Thing I want to achieve is a method for checking quest state in conversation that is linked to quest , without entering quest name to condition script.
Re: Getting some context in conditions
Try this instead:
The Dialogue System calls OnPrepareConversationLine(dialogueEntry) before evaluating links in ConversationHasValidEntry.
Code: Select all
using UnityEngine;
using PixelCrushers.DialogueSystem;
public class SetConversationID : MonoBehaviour {
void OnPrepareConversationLine(DialogueEntry dialogueEntry) {
Lua.Run("ID = " + dialogueEntry.conversationID);
}
}
Re: Getting some context in conditions
Hi!
Thank you for your help, it worked, I now use simple checks like this :
And state changes like this:
And effectively link conversations to specific quests!
Kind regards,
Iegor
Thank you for your help, it worked, I now use simple checks like this :
Code: Select all
CurrentQuestState(ConversationQuestName) == "success"
Code: Select all
SetQuestState(ConversationQuestName,"done");
Kind regards,
Iegor
Re: [Solved] Getting some context in conditions
Whew! I'm glad that worked.