Error in updating Quest fileds through code at runtime
Posted: Thu Jan 27, 2022 7:25 am
Hi, I write a QuestManager script to manage quests, and want to synchronize the quest data between script and Dialogue Database. When the quest conversation start, I use code below to change the quest field in database:
And when the quest is accepted, I use this method to change quest states in script:
However, I found that the quest field "questcode", "target1" , "target1num" did'nt change, Where is the problem?
Code: Select all
public void OnQuestAccepted(int index)
{
DialogueLua.SetQuestField("DOG HELP Quest", "questcode", AllQuests[index].hashcode);
if (!string.IsNullOrEmpty(AllQuests[index].target1))
{
DialogueLua.SetQuestField("DOG HELP Quest", "target1", AllQuests[index].target1);
DialogueLua.SetQuestField("DOG HELP Quest", "target1num", AllQuests[index].targetNum1);
}
if (!string.IsNullOrEmpty(AllQuests[index].target2))
{
DialogueLua.SetQuestField("DOG HELP Quest", "target2", AllQuests[index].target2);
DialogueLua.SetQuestField("DOG HELP Quest", "target2num", AllQuests[index].targetNum2);
}
}
Code: Select all
private void SetQuestStateInCode(double hashcode, double state)
{
AllQuests[(int)hashcode].questState = (int)state;
}