Howdy,
Is there a way to keep the name of the conversant hidden until a condition is met? (You know, like asking "What's your name?")
Display name when condition is met
Re: Display name when condition is met
Hi,
You'll need to use a script. Let's say each actor in your database has a custom Boolean field named "Known" that starts false. When the NPC reveals his name, set it true. You can use the Lua wizard in that dialogue entry node to set the field. The script below (written for Unity UI) sets the portrait name's color alpha to solid or invisible based on the value of this field.
ControlPortraitName.cs
You'll need to use a script. Let's say each actor in your database has a custom Boolean field named "Known" that starts false. When the NPC reveals his name, set it true. You can use the Lua wizard in that dialogue entry node to set the field. The script below (written for Unity UI) sets the portrait name's color alpha to solid or invisible based on the value of this field.
ControlPortraitName.cs
Code: Select all
using UnityEngine;
using PixelCrushers.DialogueSystem;
public class ControlPortraitName : MonoBehaviour {
void OnConversationLine(Subtitle subtitle) {
if (!subtitle.speakerInfo.isNPC) return;
var actorName = subtitle.speakerInfo.nameInDatabase;
var known = DialogueLua.GetActorField(actorName, "Known").AsBool;
var dialogueUI = DialogueManager.DialogueUI as UnityUIDialogueUI;
var portraitName = dialogueUI.dialogue.npcSubtitle.portraitName;
var color = portraitName.color;
portraitName.color = new Color(color.r, color.g, color.b, known ? 1 : 0);
}
}