[Workflow] Multiple actors but variables controlling active ones?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
grofit
Posts: 13
Joined: Sun Feb 07, 2016 2:47 pm

[Workflow] Multiple actors but variables controlling active ones?

Post by grofit »

Hello again,

So I am asking some of these questions ahead of time so I can be prepared for any technical/design issues when I come to them. So in my prototype I have a group of NPCs lets say about 10 of them, and based upon the players actions and events so far some NPCs may or may not be in certain conversations.

So for example lets say that I have NPC A, B ,C ,D and player. There is a group conversation where all would partake by default, but in some scenarios NPC C may not be there. I am expecting I can express this via the variable system in some way so the system would know if the actor is there etc.

So am I correct in assuming I would design the dialogue as if everyone was there (i.e create a dialogue and add all the actors and player to it), but weave in some conditions around certain dialogues to effectively cull the people who are not there? if my assumptions are correct are there any gotchas or quirks around doing things this way? (To add to the complexity I will possibly be using Articy and exporting from there but I will save that for another conversation :) )
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: [Workflow] Multiple actors but variables controlling active ones?

Post by Tony Li »

You got it; write it for all NPCs and use conditions.

You can also use link priorities to give one NPC's response a higher priority than another. For example, if NPC B is present and has a higher priority than NPC A, B would speak next.

For the conditions, you can either set the variables before the conversation starts (for example in an OnConversationStart method) or register a Lua function that checks an NPC's presence on the fly.

OnConversationStart example:

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;

public class SetNPCsOnConversation : MonoBehaviour { // Add to Dialogue Manager.

    void OnConversationStart(Transform actor) {
        // Assumes you have a function IsNPCHere():
        DialogueLua.SetVariable("A_Is_Here", IsNPCHere("A"));
        DialogueLua.SetVariable("B_Is_Here", IsNPCHere("B"));
        DialogueLua.SetVariable("C_Is_Here", IsNPCHere("C"));
        DialogueLua.SetVariable("D_Is_Here", IsNPCHere("D"));
    }
}
In this case, your condition might look something like this:
  • Conditions: Variable["A_Is_Here"] == true
Lua function example:

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;

public class NPCFunctions: MonoBehaviour { // Add to Dialogue Manager.

    void Start() {
        // Assumes this class has a function IsNPCHere():
        Lua.RegisterFunction("IsNPCHere", this, typeof(NPCFunctions).GetMethod("IsNPCHere"));   
    }
}
In this case, your condition might look something like this:
  • Conditions: IsNPCHere("A")

If you use articy:draft, I recommending using the articy:draft template project included in the Assets/Dialogue System/Prefabs folder. It contains custom fields that make it easier to write sequences, quests, and such.
grofit
Posts: 13
Joined: Sun Feb 07, 2016 2:47 pm

Re: [Workflow] Multiple actors but variables controlling active ones?

Post by grofit »

Thanks Tony, I am sure I will have other questions shortly :)
Post Reply