Quest Design Notes

This page contains notes about quest design in the Dialogue System.


Quests and the Game World

The Dialogue System's Quest Log System provides the means to manage quest descriptions, quest states, and quest-related variables in the Lua environment. It doesn't, however, provide functionality to make changes in the game world, such as spawning monsters for a "kill" quest, because every game has different needs. In Blizzard's World of Warcraft, for example, the game constantly spawns mobs regardless of whether you have a quest or not. In adventure games, on the other hand, you might not spawn generic mobs but instead activate very specific, handmade boss characters. How quests take form in the game world is up to you.

The Dialogue System does provide some help, however. When you accept a quest in a Dialogue System conversation, you can set the dialogue entry's Sequence field. There are many sequencer commands that you can use such as SetActive() to enable a deactivated boss character, or SendMessage() to send a message to a spawner to tell it to spawn a certain number of prefab monsters.

Using Third Party Assets with Quests

If you use third party assets such as Dark Tonic's Core GameKit, the Dialogue System provides custom sequencer commands and/or Lua functions that are useful for quests, such as sequencer commands that to control Core GameKit's spawners. Read the Core GameKit section for more information about Core GameKit, and Third Party Support for a list of supported third party assets.

Using the Increment On Destroy Component

For "kill" quests and "gather" quests, you can use the Dialogue System's Increment On Destroy component to update a Lua variable whenever the target object (e.g., a monster or a resource to gather) is destroyed.

For example, for a "kill 5 rats" quest you can add Increment On Destroy to the rats and set the Variable property to the name of a variable in the dialogue database such as NumRatsKilled. When you kill a rat and its object is destroyed, it will increment NumRatsKilled. (To decrement, simply set the Increment property to a negative value.) In your conversation, you can check the value of Variable["NumRatsKilled"].

If you're using Opsive's UFPS, you will need to use Dialogue System On Die as described in Set Up Destructibles instead because UFPS doesn't destroy killed enemies.


Quest Rewards

The Dialogue System does not lock you into any particular "reward" system for quests. The concept of a "reward" can mean completely different things depending on the type of game. If you're implementing a traditional RPG, you can add a custom field such as "XP" to record the quest's XP reward. If the player completes the quest in a conversation (for example, turning in the quest to the quest giver), then in the Script field you can write a short line of Lua code to apply the XP reward, such as:

Actor["Player"].XP = Actor["Player"].XP + Quest["MyQuest"].XP;
Variable["Alert"] = "XP Gained: " + Quest["MyQuest"].XP

Or you could use Lua.RegisterFunction() to register your own C# code with the Lua environment. Say you've registered a C# method named RewardXP(). Then your Script field could be:

RewardXP(Quest["MyQuest"].XP);

If the player completes the quest outside of a conversation, you can look up the quest's XP value using DialogueLua.GetItemField():

float xpReward = DialogueLua.GetItemField("MyQuest", "XP").AsFloat;

If, on the other hand, you're implementing an adventure game, perhaps you want to unlock a door when the player turns in a quest. In this case, the reward is a change to the game's state. You have a lot of options here, such as sending a message to a GameObject by adding a SendMessage() sequencer command to the Sequence field:

SendMessage(Unlock,,Red Door)

Assuming there's an object named "Red Door" in the scene, it will receive the message "Unlock".

If you're implementing a visual novel, you might want to use the built-in SetRelationship() or IncRelationship() Lua functions to adjust a relationship/faction/status value between the player and an NPC:

IncRelationship(Actor["Player"], Actor["Miranda"], "Affection", 50)

<< Quest Data | How To Manage Quests >>