Page 1 of 1

[HOWTO] How To: Read Custom Fields From Dialogue Database

Posted: Thu Dec 12, 2024 8:44 am
by Tony Li
If you've defined custom fields in your dialogue database (or if you want to access built-in fields), here are two ways:

If the text fields are static, you can read them directly from the dialogue database using, for example, GetActor(). Example:

Code: Select all

var actor = DialogueManager.masterDatabase.GetActor("Charles");
string rank = actor.LookupValue("Rank");
Debug.Log("Charles is " + rank);
If the text field values can change at runtime, or if you simply prefer to use this method, use DialogueLua.GetActorField():

Code: Select all

string rank = DialogueLua.GetActorField("Charles", "Rank").asString;
Debug.Log("Charles is currently " + rank);