Page 1 of 1

Manually assigning instance of Quest at runtime for debug

Posted: Sun Nov 01, 2020 2:58 pm
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

Re: Manually assigning instance of Quest at runtime for debug

Posted: Sun Nov 01, 2020 4:27 pm
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 429 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.