Page 1 of 1

Articy Custom Script property

Posted: Fri Jan 29, 2021 7:58 am
by Nhysi
Hi Tony!

Working on a huge narrative game, I want to create custom articy node with default script for differents actions. (Quest status update for example).
So I've created an Articy Template who contain a script field, a slot and a quest state dorp-down.

Image

Is it possible to execute my script when my node is reached ?

Re: Articy Custom Script property

Posted: Fri Jan 29, 2021 9:18 am
by Tony Li
Hi - Yes, but two notes:

1. The Dialogue System uses Lua, not articy:expresso. Enter Lua code in the field, such as:

Code: Select all

SetQuestState("MyQuest", active);
In Unity, you can add a script that has an OnConversationLine method to the Dialogue Manager GameObject. The method can look up the field and run it through Lua:

Code: Select all

void OnConversationLine(Subtitle subtitle)
{
    string script = Field.LookupValue(subtitle.dialogueEntry.fields, "MediumScriptValue");
    if (!string.IsNullOrEmpty(script))
    {
        Lua.Run(script);
    }
}
2. You may find it easier to simply put the Lua code in the output pins of articy nodes (e.g., dialogue fragment nodes). Articy will say that it's not valid articy:expresso, but the Dialogue System will happily run it through Lua.

Re: Articy Custom Script property

Posted: Fri Feb 12, 2021 5:29 am
by Nhysi
Thanks, it helps a lot!

Re: Articy Custom Script property

Posted: Fri Feb 12, 2021 8:25 am
by Tony Li
Glad to help!