Set the SharedQuestDataObject class to use your derived class with custom variables.
Add all QuestGraphs for every quest in the game to this array.
QuestObjectives are used to track quest progress within a QuestBlock.
1. To make a quest objective, right click in the Content Browser and select "Blueprint Class". Then, for "Pick Parent Class" search "All Classes" for one of the two default base classes:
QuestObjectiveBase = This objective broadcasts completion the first time it is updated. It can be used to simply track a single task.
QuestObjectiveFloatCounter = This objective broadcasts completion when the numeric counter passes a threshhold.
Select the desired class to make a new Blueprint.
1a. Any quest objective derived class that requires set up within the objective should be done in the objective's Blueprint. If you are using a QuestObjectiveFloatCounter, on your Blueprint under "Class Defaults" set the "currentCount", "threshholdCount", and "countDown" as need for the purpose of this objective.
2. After making your quest objective Blueprint, you can right click and select Scripted Action Assets > Generate ID option to create a QuestObjectiveID linked to the QuestObjective automatically.
NOTE: You can also do this manually by opening the Content Browser right click menu and select Miscellaneous > Data Asset. The class for the data asset will be the QuestObjectiveID. Once created, open the QuestObjectiveID, click the dropdown arrow for the "GUID" variable and "Generate". Finally, open the QuestObjective and set the "ID" variable in the "Class Defaults" ot your new QuestObjectiveID.
QuestBlocks represent encapsulated stages of a quest within a QuestGraph. All QuestBlocks should contain at least one QuestObjective.
1. To make a quest objective, right click in the Content Browser and select "Blueprint Class". Then, for "Pick Parent Class" search "All Classes" for QuestBlockBase. Select the class to create a new Blueprint.
2. After making your QuestBlock Blueprint, you can right click and select Scripted Action Assets > Generate ID option to create a QuestBlockID linked to the QuestBlock automatically.
NOTE: You can also do this manually by opening the Content Browser right click menu and select Miscellaneous > Data Asset. The class for the data asset will be the QuestBlockID. Once created, open the QuestBlockID, click the dropdown arrow for the "GUID" variable and "Generate". Finally, open the QuestBlock Blueprint and set the "ID" variable in the "Class Defaults" ot your new QuestBlockID.
3. Next, you need to add QuestObjectives to your QuestBlock. Start by opening the QuestBlock Blueprint and add the BeginPlay() event node to the event graph.
4. Drag off the BeginPlay() execution pin and call the CreateQuestObjective() function.
5. In the purple "Objective" input pin, select your desired QuestObjective Blueprint class from the dropdown menu.
6. Finally drag off the red "On Objective Complete" input pin and create a new custom event. This linked event is called when the QuestObjective broadcasts its completion.
7. In this simple example, finish by dragging off the custom event execution pin and call the BlockComplete() function. In the BlockComplete() function, select either success or failure based on the state you want the QuestBlock to complete in. You can add whatever logic you want to the custom event as long as the QuestBlock eventually calls BlockComplete(). Below is an example of a QuestBlock that requires two QuestObjectives in order to complete.
8. If this QuestBlock requires a sublevel, you can set up the "Sublevels" map in the "Class Defaults". The left side level reference should be a static level that is loaded by the LevelManagerSubsystem and the right side is the sublevel you want to be loaded along with the static level.
QuestGraphs encapsulated a single quest chain within the quest system. All QuestGraphs should contain at least one QuestBlock.
1. To make a QuestGraph , right click in the Content Browser and select "Blueprint Class". Then, for "Pick Parent Class" search "All Classes" for QuestGraphBase. Select the class to create a new Blueprint.
2. After making your QuestGraph Blueprint, you can right click and select Scripted Action Assets > Generate ID option to create a QuestGraphID linked to the QuestGraph automatically.
NOTE: You can also do this manually by opening the Content Browser right click menu and select Miscellaneous > Data Asset. The class for the data asset will be the QuestGraphID. Once created, open the QuestGraphID, click the dropdown arrow for the "GUID" variable and "Generate". Finally, open the QuestGraph Blueprint and set the "ID" variable in the "Class Defaults" ot your new QuestGraphID.
3. Next, you need to add QuestBlocks to your QuestGraph. Start by opening the QuestGraph Blueprint and add the BeginPlay() event node to the event graph.
4. Drag off the BeginPlay() execution pin and call the CreateQuestBlock() function.
5. Drag off the "Return Value" output pin and select "Promote to variable" to store the QuestBlock for future use within the QuestGraph.
6. In the purple "Block" input pin, select your desired QuestBlock Blueprint class from the dropdown menu.
7. Next, drag off the red "On Objective Complete" input pin and create a new custom event. This linked event is called when the QuestBlock broadcasts its completion.
8. Your custom event can now do one of two things:
Call the GraphComplete() function which will complete the graph and prevent any further updates to any QuestBlocks and QuestObjectives within the graph.
Call ActivateQuestBlock() to activate the next QuestBlock(s) in the quest chain using your stored QuestBlock variables.
9. Next you need to set up the entry point for this QuestGraph when it is first activated in the game. To do this, on the left side of the Blueprint editor window in the "Functions" section open the "Override" dropdown menu and select EntryQuestBlocks(). This will add a red EntryQuestBlocks() event node.
10. Drag off EntryQuestBlocks() execution pin and call either ActivateQuestBlock(). Use your stored references to the QuestBlocks as the "Block" input pin reference.
11. Finally, you need to add your QuestGraph to be instantiated in the game by the QuestManagerSubsystem. To do this, open Project Settings > Plugins > KGameFramework Settings > Quests and add your QuestGraph to the array.
QuestGraphs, QuestBlocks, and QuestObjectives all have a "Class Default" property called "questText". This property is a map that allows you to pair an FName key with an FText value. Text can then be retreived from the quest object using functions in the KGameFrameworkStatics.
1. First, you should determine what commonly used information needs to be displayed with your implementation of the quest system. In example, if your UI needs to display the active quest name on your HUD, all QuestGraphs should use the same FName key so the quest name can be retreived from any QuestGraph using the same code.
2. Once you know what keys you want to use, add entries to the "questText" map for your graph/block/objective that use any relevant keys. Note that keys can be unique and don't have to be shared. The quest system will handle if no entry is found by returning an empty FString to be handled, in example, by your UI.
3. In order to assign a value to your key in the map, you'll need to create a string table. In the Content Browser, right click and select Miscellaneous > String Table to create a new string table if you don't have an existing one you want to use.
4. String tables are also key value pairs. The key on the left side will be used to find the string value on the right side. Add an entry for every unique entry from the "questText" map.
5. Now go back to your QuestGraph/QuestBlock/QuestObjective Blueprint and copy the string table key to the "questText" entry value.
6. Finally, click the flag next to the entry and select your string table.
To communicate with the quest system, use functions provided in KGameFrameworkStatics to activate, update and get information about a quest. There are also several events that can be subscribe to for receiving notifications from the quest system.