void CheckIfPlayerCompletedMyQuest() { if (!Quest.QuestCompletedAndTurnedIn)//This line was added because without it, it was completing Let Ed Know you're here twice. { Quest.CheckGoals(); } if (Quest.QuestStatus) { questGiver_UI.ChangeQuestStatus("?", false); //Debug.Log("Changed ? to false from QuestGiver"); if (Quest.QuestType.Contains(QuestType.CollectionGoal)) { TakeQuestItemsFromInventory(); } //Debug.Log("questgiver completed quest"); dialogueManager.SetupNewDialogue(this.gameObject, path[1]); //Debug.Log("questgiver loaded new dialogue"); Quest.GiveReward(); Quest.QuestGoal.ForEach(g => g.Terminate()); PlayerCompletedMyTask = true; AssignedQuest = false; Quest = null; //reset the current quest, //check if I have another quest to assign //put that new Quest into the variable, or don't depending } else {//load assignedQuest=true but has not completed it yet text //Debug.Log("i have given you a quest, but you have not yet completed it"); dialogueManager.SetupNewDialogue(this.gameObject, path[3]); } }
void InformQuestTurnInPoint() { QuestGiver target = quest.QuestTurnInPoint.GetComponent <QuestGiver>(); if (target.Quest != null) //if the target has a quest to give { string questTurnInPointName = quest.QuestTurnInPoint.name; GameObject questTurnInPointGo = quest.QuestTurnInPoint.gameObject; //Below will construct the path of the Conversation_NAME-5 string result = StringHelperClass.ConstructConversationPath(questTurnInPointName); //Below will load a QuestGiver's (that is the QuestTurnInPoint of this Quest) Conversation_NAME-5, dialogueManager.SetupNewDialogue(questTurnInPointGo, result); //We then need to change the TurnInPoint's QuestGiver's NPC_UI to show a question mark... NPC_UI turnInPointNPC_UI = questTurnInPointGo.GetComponentInChildren <NPC_UI>(); turnInPointNPC_UI.ChangeQuestStatus("?", true); Debug.Log("Changed ? to true from QuestGiver"); //...and update boolean value so he can act correctly target.amTurnInPoint = true; //...and send him the Quest that this object is holding. target.ForeignQuest = quest; } }
/*All Conversation_NAME-5's are to load a conversation that acknowledges * that it is the Turn-in point of a Quest. Thus, you must turn in a Quest * before you can start a Quest on the same QuestGiver. */ void InformQuestTurnInPoint() { if (Quest.QuestTurnInPoint.name != "Bird") //the bird is special => he dies and never comes back. { QuestGiver target = Quest.QuestTurnInPoint.GetComponent <QuestGiver>(); if (target.Quest != null && this.Quest.QuestStatus) //if the target has a quest to give && the assigning QuestGiver's quest is complete(just needs to be turned in) { string questTurnInPointName = Quest.QuestTurnInPoint.name; GameObject questTurnInPointGo = Quest.QuestTurnInPoint.gameObject; //Below will construct the path of the Conversation_NAME-5 which acknowledges that this is the turn in point of another's completed quest string result = StringHelperClass.ConstructConversationPath(questTurnInPointName); //Below will load a QuestGiver's (that is the QuestTurnInPoint of this Quest) //Conversation_NAME-5, dialogueManager.SetupNewDialogue(questTurnInPointGo, result); //We then need to change the TurnInPoint's QuestGiver's NPC_UI to show a question mark NPC_UI turnInPointNPC_UI = questTurnInPointGo.GetComponentInChildren <NPC_UI>(); turnInPointNPC_UI.ChangeQuestStatus("?", true); //Debug.Log("Changed ? to true from QuestGiver"); //And update boolean value so he can act correctly target.amTurnInPoint = true; } } }