Hi, I am implementing two features that need some mechanic to memorize if a line is read already:
1. A skip-through feature that allows the player to jump to the next unread line.
2. Reading some lines will cost player's resource. However, if the line is already read (i.e. the player already paid to read), the player doesn't need to "pay" twice.
I want the line's read/unread status also be savable along with other data as well. Does Dialogue System for Unity provide such metadata on lines to keep track of? Or do I need to implement my own system to do so? Any suggestions?
Thank you!
How to track if a line is read already?
Re: How to track if a line is read already?
If you want to track all lines (all dialogue entries) use SimStatus. In code, you can check DialogueLua.GetSimStatus().
If you only need to track a much smaller subset of lines, you might find it easier to use DS variables for those specific dialogue entries.
If you only need to track a much smaller subset of lines, you might find it easier to use DS variables for those specific dialogue entries.
Re: How to track if a line is read already?
Thanks Tony, this is the script I appended to a node, but it seems raising some syntax errors:
Variable["Option_1_energy_cost"] = -3;
Variable["Option_2_energy_cost"] = -3;
Variable["Option_3_energy_cost"] = 0;
if Dialogue[203].SimStatus == "WasDisplayed" then Variable["Option_2_energy_cost"] = 0
I am not sure which part went wrong as I am very new to Lua... Though I am pretty sure it's line 4 causing the problem. Could you help me to take a look? Thanks!
Variable["Option_1_energy_cost"] = -3;
Variable["Option_2_energy_cost"] = -3;
Variable["Option_3_energy_cost"] = 0;
if Dialogue[203].SimStatus == "WasDisplayed" then Variable["Option_2_energy_cost"] = 0
I am not sure which part went wrong as I am very new to Lua... Though I am pretty sure it's line 4 causing the problem. Could you help me to take a look? Thanks!
Re: How to track if a line is read already?
Hi,
Try this:
Lua, unlike C#, expects "end" at the end of an "if" statement, like;
Also, use "Dialog[]", not "Dialogue[]". It's inconsistent with the spelling of "dialogue" elsewhere in the Dialogue System, but this naming convention is a precedent carried over from Chat Mapper. (The Dialogue System shares the same internal data structure as Chat Mapper.)
Try this:
Code: Select all
if Dialog[203].SimStatus == "WasDisplayed" then Variable["Option_2_energy_cost"] = 0 end
Code: Select all
if (condition) then
your_code
end