How to add an enum type to possible actor's field variables?
How to add an enum type to possible actor's field variables?
I would like to add a field to actors to denote their emotional state and I would prefer this to be a code defined enum instead of a text field to be safe. How can I make my enum an option in the field type (ie: among Actor, Boolean, Files, Item, etc...)
Re: How to add an enum type to possible actor's field variables?
While it would still be good to know, I think I'll just work around the issue and use the "Items" definitions
Re: How to add an enum type to possible actor's field variables?
Hmm that is still a problem because in the Dialogue Entry's Script area, setting the actor's item field that I called "Emotion" can only be done via string, so that puts me back to square one
Re: How to add an enum type to possible actor's field variables?
Hi,
Define a custom field type to store the value as a string in the back-end but use an enum on the front-end so the designer can only set it to valid enum values.
Define a custom field type to store the value as a string in the back-end but use an enum on the front-end so the designer can only set it to valid enum values.
Re: How to add an enum type to possible actor's field variables?
I did it and the enum dropdown works in the "All Fields" section, but not in the "Script section. This appears to be a Lua wizard problem
Re: How to add an enum type to possible actor's field variables?
That would be a handy feature. I'll add that in the next release.
Re: How to add an enum type to possible actor's field variables?
To confirm, there's no way at the moment for a designer in a dialogue entry to select an enum value from a dropdown that I can read in code?
Re: How to add an enum type to possible actor's field variables?
No, you can do that. Add the field in the All Fields section:
Alternatively, add the field to the dialogue entry's template on the Templates page, and tick the Main checkbox. It will appear in the dialogue entry's main inspector section so you don't have to expand All Fields.
The only thing you can't do right now is use a custom dropdown drawer in the Lua wizards.
Alternatively, add the field to the dialogue entry's template on the Templates page, and tick the Main checkbox. It will appear in the dialogue entry's main inspector section so you don't have to expand All Fields.
The only thing you can't do right now is use a custom dropdown drawer in the Lua wizards.
Re: How to add an enum type to possible actor's field variables?
I know how to access actor fields via code, but not how to access the entry's "all fields" section. I seem unable to get the current entry, even. How can I get the fields for the current dialogue entry via code?
Re: How to add an enum type to possible actor's field variables?
Hi,
The current dialogue entry is DialogueManager.currentConversationState.subtitle.dialogueEntry.
If you're inside an OnConversationLine method, you have direct access to the Subtitle:
The current dialogue entry is DialogueManager.currentConversationState.subtitle.dialogueEntry.
Code: Select all
if (DialogueManager.isConversationActive)
{
DialogueEntry entry = DialogueManager.currentConversationState.subtitle.dialogueEntry;
string someValue = Field.LookupValue(entry.fields, "Some Field");
}
If you're inside an OnConversationLine method, you have direct access to the Subtitle:
Code: Select all
void OnConversationLine(Subtitle subtitle)
{
DialogueEntry entry = subtitle.dialogueEntry;
string someValue = Field.LookupValue(entry.fields, "Some Field");
}