More on Quests and Items

The Item table just holds data. It doesn't do anything with the data. You can define your own fields such as "Is Collected" or "Weight" or "Cost" and use them however you want. For example, if an NPC gives the player a Banana during a conversation, you could set the dialogue entry's Script field:

  • Dialogue Text: "Here, take this banana."
  • Script: Item["Banana"].Is_Collected = true

The exception is if the item has a field named "Is Item" that is False. This indicates that the item is actually a quest definition. The Dialogue System has special handling for quest definitions, such as showing them in the quest log window and quest tracker HUD. The table name "Quest" is an alias for "Item". You can use them interchangeably. So this:

Item["Escape_Prison"].State = "active"

is the same as this:

Quest["Escape_Prison"].State = "active"

Quests and items share the Item table because the Dialogue System's data structure is based on Chat Mapper. Rather than make up a data structure from scratch, the Dialogue System adopted Chat Mapper's data structure, which had already been refined and proven in many commercial games and other applications for years. However, Chat Mapper doesn't define a data structure for quests. In order to make quest editing accessible in Chat Mapper's interface, quests share the Item table.

When working with items, it's up to you to manage the values in the Item table. You can work with the Item table by putting Lua statements in the Script and Conditions fields of conversations. Or you can set values in your own scripts using the DialogueLua class. For example, if you have a pickup script on your Banana GameObject in the game, you could use this code:

DialogueLua.SetItemField("Banana", "Is_Collected", true);

If you're working with items and inventory in your game world, you may instead prefer to use an inventory management asset from the Asset Store, such as S-Inventory or Inventory Pro. The Dialogue System comes with S-Inventory Support and Inventory Pro Support. They provide additional functionality so you don't have to manage the Item table yourself.


<< Dialogue Database

PixelCrushers.DialogueSystem.Articy.EntityCategory.Item
PixelCrushers.DialogueSystem.Articy.EntityCategory.Quest