Interface IDialogueBranchFactory
- Namespace
- SkyrimForge
- Assembly
- SkyrimForge.dll
Creates dialogue branches at runtime, without an .esp file, from DialogueTopic trees.
public interface IDialogueBranchFactory
Remarks
Closing the conversation shows the starting topic again, unless the branch resumes conversations. Topics of several branches shown for one speaker appear in no set order. An exception thrown by a topic's text, condition, responses, OnBegin, or OnEnd, by the greeting or goodbye function passed to Create(string, DialogueTopic, Func<Actor, IEnumerable<TopicResponse>>?, Func<Actor, IEnumerable<TopicResponse>>?, bool, Quest?), or by a function passed to IDialogueBranch.Show, reaches the caller of IDialogueBranch.Show when that call runs the function. Elsewhere it is logged and ends the handling that ran it, such as the branch's update on each frame, its tracking of the crosshair, or the menu entry of the topic chosen. Call members on the game's thread.
Methods
Create(string, DialogueTopic, Func<Actor, IEnumerable<TopicResponse>>?, Func<Actor, IEnumerable<TopicResponse>>?, bool, Quest?)
Creates a hidden branch.
IDialogueBranch Create(string key, DialogueTopic startingTopic, Func<Actor, IEnumerable<TopicResponse>>? greeting = null, Func<Actor, IEnumerable<TopicResponse>>? goodbye = null, bool resumes = false, Quest? quest = null)
Parameters
keystringThe name under which the topics the player has chosen are stored by speaker and text. A stored topic is dimmed, and one whose IsSaidOnce is true is hidden. It is unique among this plugin's branches and must not change between versions of the plugin.
startingTopicDialogueTopicThe topic the branch starts with.
greetingFunc<Actor, IEnumerable<TopicResponse>>Returns the responses that replace the speaker's greeting as a conversation opens while the branch shows its starting topic. An empty result makes the speaker say nothing. It is called on each frame with no conversation open. A null value leaves the game's greeting.
goodbyeFunc<Actor, IEnumerable<TopicResponse>>Returns the responses that replace the speaker's line as the player leaves a conversation without choosing a topic whose IsGoodbye is true. An empty result makes the speaker say nothing. It is called on each frame the branch shows a topic for the speaker. A null value leaves the game's goodbye.
resumesboolWhether a new conversation with the speaker of the last topic chosen shows that topic's choices in place of the starting topic, with no greeting. Choosing a goodbye, starting a new game, and loading a save clear that topic.
questQuest?The quest that lists the topics. Defaults to DialogueGeneric (00013EB3). A quest exists once the game has loaded its data, so pass one from OnDataLoaded or later.
Returns
- IDialogueBranch
The branch. The game creates its records on the first frame of a loaded game with no conversation open.
Remarks
Callable from a plugin's start, before the game has loaded its data. The game never frees a branch's records, so create each branch once. Adding to, replacing, or removing from a DialogueTopic's Choices after this call throws InvalidOperationException.
Exceptions
- ArgumentNullException
keyorstartingTopicisnull.- ArgumentException
This plugin created a branch with
keyalready, or the branch shows more than 50 goodbye topics or 50 other topics at once.- FileNotFoundException
The voice file of a fixed response does not exist.