working quest do not show dialog

Announcements, support questions, and discussion for Quest Machine.
Post Reply
linyangyang2015
Posts: 11
Joined: Fri Sep 07, 2018 10:24 pm

working quest do not show dialog

Post by linyangyang2015 »

quest.png
quest.png (72.36 KiB) Viewed 972 times
1、I want auto start a quest,the quest's "Autostart" is set "Message:FindGlass Start"
2、Then,My code is "MessageSystem.SendMessage(this, "FindGlass", "Start",null);"
3、result,the quest is active,but the dialog do not show in viewport,detail in attachment,quest.png

I want to auto start a quest and show the dialog,not use "QuestGiver.StartDialogue",because I don't let user select "Accept/decline".
Thanks.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: working quest do not show dialog

Post by Tony Li »

Hello,

If the quest is already active, you can use QuestGiver.StartDialogueWithPlayer(). It won't show the Accept/Decline dialogue because it doesn't need to offer the quest. Instead, it will show the Active > Dialogue Text.

Example:

Code: Select all

MessageSystem.SendMessage(this, "FindGlass", "Start");
GetComponent<QuestGiver>().StartDialogueWithPlayer();
linyangyang2015
Posts: 11
Joined: Fri Sep 07, 2018 10:24 pm

Re: working quest do not show dialog

Post by linyangyang2015 »

OK,I have a try,thanks!
linyangyang2015
Posts: 11
Joined: Fri Sep 07, 2018 10:24 pm

Re: working quest do not show dialog

Post by linyangyang2015 »

quest2.png
quest2.png (72.36 KiB) Viewed 969 times
using code:
MessageSystem.SendMessage(this, "FindGlass", "Start");
questGiver.StartDialogueWithPlayer();
it don't show attachment mark(Heading Text/Body Text/Caption Text)?
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: working quest do not show dialog

Post by Tony Li »

Sorry, I misunderstood. Now I understand that you want to show HUD text, not dialogue.

Is the quest on the player? It must be in the player's Quest Journal component.

If the quest is already in the player's Quest Journal but it is not active yet, you can do this:

Code: Select all

MessageSystem.SendMessage(this, "FindGlass", "Start");
If the quest is not in the player's Quest Journal but on a quest giver GameObject, you can call QuestGiver.GiveQuestToQuester to put it in the player's Quest Journal first:

Code: Select all

QuestGiver giver = GetComponent<QuestGiver>(); // Need a reference to QuestGiver.
Quest quest = giver.FindQuest("Task1:FindGlass"); // Find quest in QuestGiver's list.
giver.GiveQuestToQuester(quest, "Player"); // Give quest to player's journal. Assumes player's ID is "Player".
MessageSystem.SendMessage(this, "FindGlass", "Start");
Confirm that the player's Quest Journal has a copy of the quest, and this copy is active. If that is correct, then make sure the "findglass" node's Active > HUD Text contains content.

If you get stuck, you are welcome to send an example project to tony (at) pixelcrushers.com. I'll be happy to take a look.
linyangyang2015
Posts: 11
Joined: Fri Sep 07, 2018 10:24 pm

Re: working quest do not show dialog

Post by linyangyang2015 »

It's OK,Thank you very much.
Post Reply