Context:
I have added two new fields to Dialogue Entries called "Points" and "Turn Cost".
I want to access the current dialog entry ID so that I can launch a Lua script.
====
AddPoints(Variable["Conversant"], GetEntryNumber(ID, "Points"));
DebugLog(GetEntryNumber(ID, "Points"));
====
Bonus Question: How to make each dialogue entry ALWAYS launch a Lua script?
How to Get Current Dialogue Entry ID?
Re: How to Get Current Dialogue Entry ID?
Hi,
Add a C# script with an OnConversationLine(Subtitle) method to the Dialogue Manager. For example, something like:
Although if AddPoints(), GetEntryNumber(), etc., are already C# methods that you've registered with Lua, it might be simpler to just call those C# methods directly in your OnConversationLine() method instead of running them as Lua code.
The current dialogue entry ID is in subtitle.dialogueEntry.id.
Add a C# script with an OnConversationLine(Subtitle) method to the Dialogue Manager. For example, something like:
Code: Select all
void OnConversationLine(Subtitle subtitle)
{
int ID = subtitle.dialogueEntry.id;
Lua.Run($"AddPoints(Variable['Conversant'], GetEntryNumber(ID, 'Points')); DebugLog(GetEntryNumber({ID}, 'Points'))");
}
The current dialogue entry ID is in subtitle.dialogueEntry.id.
Re: How to Get Current Dialogue Entry ID?
Thank you very much, Toni!
Re: How to Get Current Dialogue Entry ID?
Glad to help!