

You can also update quests in Lua code elsewhere, for example using the Lua On Dialogue Event component or in your own scripts. SetQuestEntryState("Escape", 2, "success") SetQuestEntryState(questName, entryNum, state)

Returns a quest state as "unassigned", "active", "success", or "failure"ĬurrentQuestState("Kill 5 Rats") = "active"ĬurrentQuestEntryState(questName, entryNum)ĬurrentQuestEntryState("Escape", 2) = "active" You can also set quest states using Timeline Support. However, the Lua functions SetQuestState and SetQuestEntryState also update the quest tracker and send the OnQuestStateChange message that your scripts can handle.

You can even add new quest entries by increasing Entry_Count and adding the additional entry fields. Since the Quest table is a normal table in Lua, you can use any Lua commands on it – for example, to add new quests, remove quests, change descriptions, etc.

The dialogue entry will only be shown if the condition is true – that is, if the quest's state is "unassigned". Condition: CurrentQuestState("Kill 5 Rats") = "unassigned".Dialogue Text: (Baker to PC) "If you bring me 5 dead rats, I'll bake us a pie.".You only want to show this entry if the quest is not assigned yet. Using the quest defined in Example 1: Kill 5 Rats, say the baker has a dialogue entry asking the PC to start the quest. If you do use Lua tables, remember when referencing table indices in Lua code that you must replace spaces and hyphens with underscores as described in Important Note About Table Indices. The Dialogue System now provides CurrentQuestState and SetQuestState Lua functions (and equivalents for quest entries), so you usually don't need to work with Lua tables directly. You can use the Lua Wizards, so you don't have to type a single character, just pick the conditions from a dropdown menu. This condition will usually be in a dialogue entry's Conditions field. To check the state of a quest inside a conversation, you'll specify a simple Lua condition. Lua functions to check and control quests are summarized in Quest-Related Lua Functions and described in more detail below. This page describes how to manage quests at runtime.
