The quest système is a powerfull and easy to use tool which will give you the power to create quests for you game in only few click !
To use it, simply add a QuestHandler component to your player.
To create a quest you need a Data Table based on the QuestData structure :
Right click somewhere in the content browser and choose Miscellaneous/DataTable. Then choose the QuestData struct as the struct for the table rows.
Alternativly, you can directly use/copy the table which is in the Demo/ folder :
The content of the table looks like that :
As you can see, each quest breaks down into Quest Steps which themselves breaks down into Quest Objectives.
In QuestStep, AutoUnlockIfPreviousStepSucceedeed allows the steps be to automatically unlocked when the previous on is finished. Only unlocked Steps are visible in the interface.
For QuestObjectives :
To unlock a quest, simply use the UnlockQuest node :
One way to resolve quest objectives is to directly call :
But this methode has a drawback : Let say that you haven't unlocked the CollectItems quest yet. Then you pick up some items in the world and each time you pick up one, you call this function. Then when you will unlock the quest, the system won't remender that you have requested the objective to resolve !
An other drawback is that you may have an action which targets multiple quests/objectives, so you'll have to carefully call all the ResolveQuestObjective nodes for each objectives which are linked to this action.
The solution for all those issues is the ObjectiveResolver !
The ObjectiveResolver is a name which serves as a Key that many objectives can react to, and an "Advancement" value which serves to save the progression of the objectives.
Resolvers are stored inside the QuestHandler so each time you unlock a quest whose objectives needs to react to an already unlocked resolver, the objective will be updated.
Use these two nodes to update a resolver. All linked quests/objectives will also be updated :
A "One Shot" resolver is a resolver which is not stored and act only one time.
It's convenient for objectives that you can repeat at different time, like a "Talk to this NPC" objective which would tell you to talk to the NPC after each objective is resolved. If you would have set it as a regular Resolver, then the "Advancement" of the resolver would have been kept to something greater than 1 since the first time you talk to the NPC and you would have to be forced to reset this value to 0 before each unlock of objectives whic hwould have been linked to this resolver.
Once all the objectives have been successfully resolved, the quest is marked as resolved and you unlock the Reward associated with the quest (same thing happens when you success an objective).
When a reward is unlocked, the OnRewardUnlocked dispatcher will be called. You can then react to it to catch the reward an use it somewhere else.