Start game with active quest

Announcements, support questions, and discussion for Quest Machine.
Post Reply
mroshaw
Posts: 96
Joined: Wed Jan 19, 2022 4:10 am

Start game with active quest

Post by mroshaw »

Hi! I want my player to have a quest start automatically when the game starts. The quest involves visiting a character, who will then kick off the narrative of the game.

I've created a quest and assigned it to the NPC character in question. I have 3 nodes: Start > Return to Quest Giver > Success. I've added the quest to the Quest Database.

I've tried setting the Quest "Current State" to "Active" as well as tried setting the "Start" node to "Active". Whatever I try, I haven't been able to see the quest appear in the player journal or on the HUD as an active quest.

Is there a better way to have a quest immediately become active when the player starts the game?

Many thanks!
mroshaw
Posts: 96
Joined: Wed Jan 19, 2022 4:10 am

Re: Start game with active quest

Post by mroshaw »

Getting somewhere with this! I'm now trying to use the QuestGiver.GiveQuestToQuester() method in a component Start().

I've got as far as this, but I'm stuck on how to retrieve the QuestListContainer for the player:

Code: Select all

Quest questInstance = QuestMachine.GetQuestInstance(questId);
QuestListContainer questList = QuestMachine.GetQuestListContainer(???)
questGiver.GiveQuestToQuester(questInstance, questList);
How do I set / retrieve the "id" of the appropriate QuestListContainer for the player?
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Start game with active quest

Post by Tony Li »

Hi,

You can use QuestMachine.GetQuestJournal():

Code: Select all

questGiver.GiveQuestToQuester(questInstance, QuestMachine.GetQuestJournal());
However, you may be looking for How To: Start Quest From Quest.
mroshaw
Posts: 96
Joined: Wed Jan 19, 2022 4:10 am

Re: Start game with active quest

Post by mroshaw »

That's the one! Thanks again, Tony!
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Start game with active quest

Post by Tony Li »

Glad to help!
Post Reply