To create a quest you should use the editor. The editor has various nodes required to create quests. These nodes are:
Quest Node
- This Node is the main quest node it requires thequest_name
andquest_details
Step Node
- This node is anaction_step
node and only requires a discription of the action to complete.Incremental Step Node
- This node is anincremental_step
node and requires both itsdetails
,item_name
and therequired
amount to complete.Item Step Node
- This node is anitems_step
node and requires thedetails
as well as the list of items/actions to completeGroup Node
- A group node only requires itsgroup
name and can be connected to multiple quest nodes.Meta Data Node
- A meta data node is use to add meta data to quest such as quest rewards or any arbitrary information stored as aString
,Integer
,float
orboolean
Timer Node
- This Node is atimer_step
node that is used as a Timer or a StopwatchCallable Node
- This Node is acallable_step
node that is used to call a function from an Autoloaded Script.Branch Node
- The Node is abranch_step
that works similar to ancaction_step
but has 2 output for creating branching quests.Rewards Node
-This Node is similar to a meta_data node but can only be connected to aQuest Node
End Node
- This node is required to end a quest after the final step.
For this example we'll keep it simple and create a 1 step Quest to kill 15 enemies.
-
First add a Quest node, an Incremental Step Node and a End Node.
-
Connect these nodes dragging the green connection pins from one to another: Quest Node > Incremental Node > End Node
-
Additionally, you can add a group and Meta Data Node and Fill in the information for each node we wont use the Group and meta data so theyre not required here.
-
Save the quest file choosing a location and giving it a name. Quest files are save with the
.quest
extension. -
The Space Arcade Scene is included in the Examples Folder. Open it and find the UI node. Drag the quest file into the Quest property in the UI inspector window.
-
Notice the Quest Resource is Read only and has 2 dictionaries.
Quest Data
-Contains all the quests stored in the quest resourceGraph Data
-Contains all the Data for the Editor
-
Open up the UI.gd script. Notice in the _ready() function we do a few things:
QuestManager.add_quest_from_resource(quest,"ShootEmUp")
- Here we tell the Quest Manager to load this resource and add its quest thats namedShootEmUp
to the player quests- We also connect a few signals:
step_updated
- we update the UI to show what changed in the case an enemy was killed so the value increasesstep_complete
- We just use a lambda here to print step completequest complete
- We update the UI to show that the quest was completedquest_failed
- Show if the quest failed i.e if the player died
- Then we set the QuestStart label text to the quest details and do some tweening the start the level
-
Open up the
Example/ExampleOne/Projectile.gd
script. Notice we check to see if the bullet hits an enemy. If it did, we call$QMStepTracker.update_step()
before removing the projectile. -
QMStepTracker is a Node you can add to objects in your project to track a quest's step. You set its type and pass in the quest_id and Step id. In this case this Trancker is an Incremental Step Tracker that increases
collected
items of theIncremental Step
by 1 by default. -
In the UI we also check if the player ran out of lives. If so we call
QuestManager.fail_quest("ShootEmUp")
This sets the quest as failed and emits thequest_failed
signal. -
And Thats about it for the tutorial. If a quest has multiple steps the
step_updated
andstep_completed
signals returns a new step its up to you how you want to display the information of that current step by checking itsstep_type
. Check the API for what properties eachstep_type
contains.
As of version 0.3.0, you can now create quest at Run-Time using the ScriptQuest class. This allows you to be able to randomly/procedurally make quests if necessary. To do this check the ScriptQuest class in the Script Quest API
Running a project in the editor is fine but when you want to export a project youll need to tell godot to export your quest files. To do this, in the export window, select your export format(Window/Linux/Android etc) then open the Resources tab and add *.quest
as an entry with comma seperating other file types.