Page 1 of 1

Event hooks for modifying Lua state before evaluating conditions.

Posted: Sun May 04, 2025 4:56 pm
by ashapcott
Hi, sorry if this has been answered elsewhere but I haven't had much luck finding an answer.

I'm looking for a way to modify the Lua state in C# before the conditional script on a DialogueEntry is evaluated. I need to do so before evaluating each entry's conditions to allow for setting up my own Lua variables. As far as I can tell this would require some kind of message to be sent during ConversationModel.EvaluateLinksAtPriority but I wasn't able to find one. Is there a way to do this that I'm missing?

For details on my specific use case: I have conversations that use a field to specify that they belong to a particular questline (note that I'm not using the built-in quest system, but I don't think that matters). When entries are evaluated in the conversation, I use the OnPrepareConversationLine message to set a global variable "quest" in the current Lua state based on this field. This improves brevity when writing Lua scripts for entries. However, this doesn't work for conditional scripts.

Re: Event hooks for modifying Lua state before evaluating conditions.

Posted: Sun May 04, 2025 7:22 pm
by Tony Li
Hi,

You should be able to use OnPrepareConversationLine().

Say dialogue entry A links to entries B, C, and D. When the Dialogue System prepares entry A, it calls OnPrepareConversationLine(A) before running EvaluateLinks to determine which of B, C, and D are currently valid.