Page 1 of 1
How to access new field in Quest Entry (via Code)
Posted: Tue Nov 14, 2023 9:36 am
by Saper
Hi Tony
I have a question, how to access "New Field" added to quest entry:
- Dialogue_1.png (8.22 KiB) Viewed 1022 times
- Dialogue_2.png (8.63 KiB) Viewed 1022 times
- Dialogue_3.png (7.09 KiB) Viewed 1022 times
I would like to access this second field, how i can do it?
Re: How to access new field in Quest Entry (via Code)
Posted: Tue Nov 14, 2023 10:51 am
by Tony Li
Hi,
You have a duplicate field. Expand All Fields, and delete the second "Entry 3" field:
- duplicateFields.png (61.03 KiB) Viewed 1014 times
When you add a new entry field, enter some text to append to the end of the field name. For example, to create a field named "Entry 3 Reward", set the text entry area to "Reward" before clicking Create:
- addNewField.png (12.52 KiB) Viewed 1014 times
To access this field in C#, use
DialogueLua.
GetQuestField(). Example:
Code: Select all
string reward = DialogueLua.GetQuestField("Thief Quest", "Entry 3 Reward").asString;
Re: How to access new field in Quest Entry (via Code)
Posted: Wed Nov 15, 2023 8:31 am
by Saper
Thanks for answer, it will help a lot
I understand that with help of SetQuestField() I can change field value via code. Where i can check what variables is accepted by what field type?
Re: How to access new field in Quest Entry (via Code)
Posted: Wed Nov 15, 2023 10:01 am
by Tony Li
Lua is a dynamically typed language. You can assign any type of value to any variable or field. So you can do this, even though it might not make sense:
Code: Select all
DialogueLua.SetQuestField("Kill Rats", "XP Reward", 50); // Set the XP Reward field to the number 50.
DialogueLua.SetQuestField("Kill Rats", "XP Reward", "Internet Exposure"); // Set the XP Reward field to the string "Internet Exposure".
Re: How to access new field in Quest Entry (via Code)
Posted: Thu Nov 30, 2023 9:11 am
by Saper
Hi Tony
One more question, Let's say quest was changed from Timeline or Dialogue Trigger is there a some kinda event telling unity that this quest was changed to another state?
Re: How to access new field in Quest Entry (via Code)
Posted: Thu Nov 30, 2023 9:20 am
by Tony Li