Articy Custom Script property

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Nhysi
Posts: 14
Joined: Tue May 21, 2019 5:03 am

Articy Custom Script property

Post 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 ?
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Articy Custom Script property

Post 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.
Nhysi
Posts: 14
Joined: Tue May 21, 2019 5:03 am

Re: Articy Custom Script property

Post by Nhysi »

Thanks, it helps a lot!
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Articy Custom Script property

Post by Tony Li »

Glad to help!
Post Reply