Table of Contents

Class DialogueTopic

Namespace
SkyrimForge.Dialogue
Assembly
SkyrimForge.dll

A player dialogue topic in a dialogue branch that IDialogueBranchFactory creates.

public sealed class DialogueTopic
Inheritance
DialogueTopic
Inherited Members

Remarks

After a topic with no Choices that pass and with IsGoodbye false, the menu shows the branch's starting topic again.

Constructors

DialogueTopic(Func<Actor, string>, params IEnumerable<TopicResponse>)

Creates a topic whose text is computed each time the branch shows it, and whose responses are fixed. A string converts to an unvoiced response.

public DialogueTopic(Func<Actor, string> text, params IEnumerable<TopicResponse> responses)

Parameters

text Func<Actor, string>
responses IEnumerable<TopicResponse>

Remarks

For a choice, text runs after the BeginCallback of the topic before it. It also runs on each frame Condition is called. The game never frees the record created for each distinct text, so return few distinct texts.

Exceptions

ArgumentNullException

text or responses is null.

DialogueTopic(Func<Actor, string>, Func<Actor, IEnumerable<TopicResponse>>)

Creates a topic whose text and responses are computed each time the branch shows it.

public DialogueTopic(Func<Actor, string> text, Func<Actor, IEnumerable<TopicResponse>> responses)

Parameters

text Func<Actor, string>
responses Func<Actor, IEnumerable<TopicResponse>>

Remarks

For a choice, both run after the BeginCallback of the topic before it. text also runs on each frame Condition is called. The game never frees the record created for each distinct text, so return few distinct texts.

Exceptions

ArgumentNullException

text or responses is null.

DialogueTopic(string, params IEnumerable<TopicResponse>)

Creates a topic whose responses are fixed. A string converts to an unvoiced response.

public DialogueTopic(string text, params IEnumerable<TopicResponse> responses)

Parameters

text string
responses IEnumerable<TopicResponse>

Exceptions

ArgumentNullException

text or responses is null.

DialogueTopic(string, Func<Actor, IEnumerable<TopicResponse>>)

Creates a topic whose responses are computed each time the branch shows it.

public DialogueTopic(string text, Func<Actor, IEnumerable<TopicResponse>> responses)

Parameters

text string
responses Func<Actor, IEnumerable<TopicResponse>>

Remarks

For a choice, responses runs after the BeginCallback of the topic before it.

Exceptions

ArgumentNullException

text or responses is null.

Properties

BeginCallback

Runs on the game's thread when the player chooses the topic, as the speaker's responses start.

public Func<DialogueTopicContext, Task>? BeginCallback { get; init; }

Property Value

Func<DialogueTopicContext, Task>

Remarks

The conditions of Choices are evaluated when it returns its task, so only state changed before its first await affects them.

Choices

The topics shown once the player chooses this one, in the order the menu shows them.

public IList<DialogueTopic> Choices { get; }

Property Value

IList<DialogueTopic>

Remarks

A choice may be a topic shown earlier, which returns the conversation to that topic, and a topic may be a choice of several topics. Add choices before Create(string, DialogueTopic, Func<Actor, IEnumerable<TopicResponse>>?, Func<Actor, IEnumerable<TopicResponse>>?, bool, FormId<Quest>?) is called. A change after it throws InvalidOperationException.

Condition

Returns whether the menu shows the topic for the speaker. A null value always shows the topic.

public Func<Actor, bool>? Condition { get; init; }

Property Value

Func<Actor, bool>

Remarks

It is called on each frame for a topic the branch shows with no conversation open. For a choice, it is called once the topic before it is chosen, after that topic's BeginCallback.

EndCallback

Runs once BeginCallback has completed and the speaker's responses have ended or the conversation has closed, on the thread that completed the later of the two.

public Func<DialogueTopicContext, Task>? EndCallback { get; init; }

Property Value

Func<DialogueTopicContext, Task>

HidesOtherTopics

Whether the speaker's other topics are hidden while the branch shows this topic for that speaker.

public bool HidesOtherTopics { get; init; }

Property Value

bool

Remarks

If several branches show such a topic for one speaker, the topics of those branches all remain.

IsGoodbye

Whether the conversation ends after the speaker's responses, with no goodbye line from the game.

public bool IsGoodbye { get; init; }

Property Value

bool

IsSaidOnce

Whether the topic is shown only until the player chooses it with the speaker, in this save and every later one.

public bool IsSaidOnce { get; init; }

Property Value

bool

Remarks

The saved state records the speaker and the text, so a topic whose text changes is shown again, as is the same topic with another speaker.

Text

The text the dialogue menu shows. The value is null for a computed text.

public string? Text { get; }

Property Value

string