Hi,
I'm wondering if there's a better way to trigger the next quest when coming from the same quest giver? Right now, if the player returns to a quest giver and talks to a quest giver, the previous quest ends and is given an award. To trigger the next quest from the quest giver, the player has to walk away and then come back (seeing the exclamation mark above the quest giver).
Is there another way to trigger the next quest? Possibly not leave the quest giver but when hitting close on the dialogue box, that brings up the next? Or another solution?
Quest Giver Trigger [SOLVED]
-
- Posts: 118
- Joined: Thu Dec 19, 2019 7:38 am
Quest Giver Trigger [SOLVED]
Last edited by mschoenhals on Sun Dec 29, 2019 7:57 pm, edited 1 time in total.
Re: Quest Giver Trigger
Hi,
I'll add this in the next update. In the meantime, you can replace your QuestGiver components with this QuestGiverCustom script:
QuestGiverCustom.cs
I'll add this in the next update. In the meantime, you can replace your QuestGiver components with this QuestGiverCustom script:
QuestGiverCustom.cs
Code: Select all
using PixelCrushers.QuestMachine;
public class QuestGiverCustom : QuestGiver
{
private UnityUIQuestDialogueUI dialogueUI;
public override void Start()
{
base.Start();
dialogueUI = QuestMachine.defaultQuestDialogueUI as UnityUIQuestDialogueUI;
}
protected override void ShowActiveQuest(Quest quest)
{
base.ShowActiveQuest(quest);
// Disable the Close button's default event (Hide) and call our custom method instead.
dialogueUI.closeButton.onClick.SetPersistentListenerState(0, UnityEngine.Events.UnityEventCallState.Off);
dialogueUI.closeButton.onClick.AddListener(OnCloseActiveQuest);
}
protected void OnCloseActiveQuest()
{
// Re-enable the Close button's default event and remove out custom method.
dialogueUI.closeButton.onClick.SetPersistentListenerState(0, UnityEngine.Events.UnityEventCallState.RuntimeOnly);
dialogueUI.closeButton.onClick.RemoveListener(OnCloseActiveQuest);
// Check if there are any new offerable quests. If so, show it. Otherwise close.
RecordQuestsByState();
if (offerableQuests.Count > 0)
{
StartMostRelevantDialogue();
}
else
{
dialogueUI.closeButton.onClick.Invoke();
}
}
}
-
- Posts: 118
- Joined: Thu Dec 19, 2019 7:38 am
Re: Quest Giver Trigger
This works perfectly!
Thank you.
Thank you.
Re: Quest Giver Trigger [SOLVED]
Glad to help!