Create a Dialogue - AnduoGames/ThirdCrisisModding GitHub Wiki

Creating a Dialogue

Dialogues in Third Crisis are basically a List of Dialogue Lines.

There are two ways to create a Dialogue: With the in-game editor or with code.

Dialogue Editor

To open the ingame editor, go to the game options tab and enable the dialogue editor using the checkbox.

Unity_iTZcZnM7K9
Dialogue.editor.demo.webm

Now with your dialogue created, you just need to save it. Once you do that, you can load it through your mod like so:

var dialogue = DialogueIngameEditor.LoadDialogue("Dialogue\\myDialogue.dialogue");

DialogueManager.StartDialogue(dialogue);

In code

To create a Dialogue programatically, you have to create at least one line first:
var line = new DialogueLine()
{
    LineID = "line_0",
    Text = "Hey I'm a modded Dialogue!",
    Speaker = "Test Speaker",
    TextColor = Color.white,
    NextID = "" //Add the LineID of another line here to have lines play in order
};

You can then create a Dialogue. Dialogues are Scriptable Objects, which need to be created using ScriptableObject.CreateInstance. Now, you can add lines to this dialogue and lastly play it.

var dialogue = ScriptableObject.CreateInstance<Dialogue>();
dialogue.Lines.Add(line);

DialogueManager.StartDialogue(dialogue);

To make a character like Jenna show up in the dialogue, you need to give the line a Character Reference.

var character = Character.Get("Jenna");
var expression = character.GetPresetExpressionID(PresetExpression.Idle);

var newLine = new DialogueLine()
{
    LineID = "line_1",
    Text = "Hey I'm Jenna!",
    Character = character,
    BrowExpression = expression,
    EyeExpression = expression,
    MouthExpression = expression
    NextID = "",
};

Note that the PresetExpression only holds a few expressions while many more are available. You can find all of them here.

For a list of all available Characters, see here.

To add custom image like a nsfw scene to a line, please see here.

To add animated sex scenes to dialogues, see here.

Choices

A DialogueLine can have choices attached to it. If a DialogueLine has at least one choice attached, the NextID will be ignored.

Choices usually lead to another lineID, this can be achieved by setting the choice's TargetID.

var choice = new DialogueChoice()
{
    Text = "This choice will simply show another line from it's own dialogue",
    TargetID = "line_3"
};
line.AddChoice(choice);

Alternatively, choices can also lead to a different Dialogue:

var choice2 = new DialogueChoice()
{
    Text = "This choice will switch to another dialogue",
    TargetID = "line_0",
    TargetDialogue = anotherDialogueReference
};
line.AddChoice(choice2);

Yet another way to use choices is by having code executed when a choice is selected. To do this, you can use the OnChosen UnityEvent:

var choice3 = new DialogueChoice()
{
   Text = "Choice 1"
};
choice3.OnChosen.AddListener(() => 
{
    Debug.Log("My choice was selected!"); 
});
line.AddChoice(choice3);

To add a stat requirement (usually perversion) to a choice:

var choice = new DialogueChoice()
{
    Text = "A choice that requires Perversion to be at least 200",
    StatAmount = 200,
    StatID = "stat_perversion",
    CharacterToCheck = Character.Get("Jenna")
};
⚠️ **GitHub.com Fallback** ⚠️