Manually assigning instance of Quest at runtime for debug

Announcements, support questions, and discussion for Quest Machine.
Post Reply
Ollymuk
Posts: 39
Joined: Wed Oct 14, 2020 12:59 pm

Manually assigning instance of Quest at runtime for debug

Post by Ollymuk »

Hi

Is there a way to manually assign an instance of a quest to the player at rutime? I want to test some quests but some quests are given out at the start, and I want to test a node that might be 10 mins in. Each attempt takes at least 10 mins. It would be more useful if I can manually assign an instance to the player when needed just to test dialogues etc.

Olly
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Manually assigning instance of Quest at runtime for debug

Post by Tony Li »

Hi Olly,

An easy, no-scripting way is to create an empty GameObject with a QuestGiver component. Add the quest to the QuestGiver's Quests list.

Then you just need to call QuestGiver.GiveAllQuestsToQuester: Player (or whatever the player's ID is).

One way is to set the GameObject inactive. Add a TimedEvent component, and configure OnTimeReached() to call QuestGiver.GiveAllQuestsToQuester:

testGivePeskyRabbits.png
testGivePeskyRabbits.png (38.08 KiB) Viewed 428 times

During play, activate the GameObject to give the quest to the player.

Alternatively, you can keep the GameObject active and hook up a UI Button's OnClick() event to QuestGiver.GiveAllQuestsToQuester. Using this technique, you can set up a debug menu with a whole bunch of UI buttons that give various quests, or send messages (e.g., "Killed"+"Orc"), etc.
Post Reply