Adventure Creator  1.79.1
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2022
AC.Conversation Class Reference
Inheritance diagram for AC.Conversation:
AC.ITranslatable AC.iActionListAssetReferencer AC.IItemReferencer AC.IVariableReferencer

Public Member Functions

void Interact ()
 
void Interact (ActionList actionList, ActionConversation actionConversation)
 Shows the Conversation's dialogue options. More...
 
void TurnOn ()
 
bool IsActive (bool includeResponses)
 Checks if the Conversation is currently active. More...
 
void TurnOff ()
 
void RunOption (int slot, bool force=false)
 Runs a dialogue option. More...
 
void RunOptionWithID (int ID, bool force=false)
 Runs a dialogue option with a specific ID. More...
 
float GetTimeRemaining ()
 Gets the time remaining before a timed Conversation ends. More...
 
bool SlotIsAvailable (int slot)
 Checks if a given slot exists More...
 
int GetOptionID (int slot)
 Gets the ID of a dialogue option. More...
 
string GetOptionName (int slot)
 Gets the display label of a dialogue option. More...
 
string GetOptionNameWithID (int ID)
 Gets the display label of a dialogue option with a specific ID. More...
 
CursorIconBase GetOptionIcon (int slot)
 Gets the display icon of a dialogue option. More...
 
CursorIconBase GetOptionIconWithID (int ID)
 Gets the display icon of a dialogue option with a specific ID. More...
 
ButtonDialog GetOption (int slot)
 Gets the ButtonDialog data container, which stores data for a dialogue option. More...
 
ButtonDialog GetOptionWithID (int id)
 Gets the ButtonDialog data container with a given ID number, which stores data for a dialogue option. More...
 
int GetNumEnabledOptions ()
 Gets the number of dialogue options that are currently enabled. More...
 
bool OptionHasBeenChosen (int slot)
 Checks if a dialogue option has been chosen at least once by the player. More...
 
bool OptionWithIDHasBeenChosen (int ID)
 Checks if a dialogue option with a specific ID has been chosen at least once by the player. More...
 
bool AllOptionsBeenChosen (bool onlyEnabled)
 Checks if all options have been chosen at least once by the player More...
 
void TurnOptionOn (int id)
 Turns a dialogue option on, provided that it is unlocked. More...
 
void TurnOptionOff (int id)
 Turns a dialogue option off, provided that it is unlocked. More...
 
void SetOptionState (int id, bool flag, bool isLocked)
 Sets the enabled and locked states of a dialogue option, provided that it is unlocked. More...
 
void TurnAllOptionsOn (bool includingLocked)
 Turns all dialogue options on More...
 
void RenameOption (int id, string newLabel, int newLineID)
 Renames a dialogue option. More...
 
int GetCount ()
 Gets the number of enabled dialogue options. More...
 
bool OptionWithIDIsActive (int ID)
 Checks if a dialogue option with a specific ID is active. More...
 
int[] GetIDArray ()
 
bool HasActionListOverride ()
 
bool ConvertLocalVariableToGlobal (int oldLocalID, int newGlobalID)
 Converts the Conversations's references from a given local variable to a given global variable More...
 
int GetNumVariableReferences (VariableLocation location, int varID, Variables variables=null, int _variablesConstantID=0)
 Gets the number of references to a given variable More...
 
int UpdateVariableReferences (VariableLocation location, int oldVariableID, int newVariableID, Variables variables=null, int variablesConstantID=0)
 
int GetNumItemReferences (int itemID)
 
int UpdateItemReferences (int oldItemID, int newItemID)
 
bool ConvertGlobalVariableToLocal (int oldGlobalID, int newLocalID, bool isCorrectScene)
 Converts the Conversations's references from a given global variable to a given local variable More...
 
string GetTranslatableString (int index)
 Gets the text to be translated, given its index. More...
 
int GetTranslationID (int index)
 Gets the translation ID of a given text index. More...
 
AC_TextType GetTranslationType (int index)
 Gets the translation type of a given text index. More...
 
void UpdateTranslatableString (int index, string updatedText)
 
int GetNumTranslatables ()
 Gets the maximum number of possible translatable texts. More...
 
bool HasExistingTranslation (int index)
 Checks if a given text index has already been assigned a unique translation ID. More...
 
void SetTranslationID (int index, int _lineID)
 Sets the translation ID of a given text index More...
 
string GetOwner (int index)
 Gets the name of the translatable text's owner. In the case of speech text, it is the name of the character. In the case of menu element text, it is the name of the menu element. More...
 
bool OwnerIsPlayer (int index)
 Checks if the translatable text's owner is a Player. This is necessary for speech lines, since multiple player prefabs can feasibly share the same line. More...
 
bool CanTranslate (int index)
 Checks if a given text index can and should be translated. More...
 
bool ReferencesAsset (ActionListAsset actionListAsset)
 
List< ActionListAssetGetReferencedActionListAssets ()
 

Public Attributes

AC.InteractionSource interactionSource
 
List< ButtonDialogoptions = new List<ButtonDialog>()
 
ButtonDialog selectedOption
 
int lastOption = -1
 
bool autoPlay = false
 
bool isTimed = false
 
float timer = 5f
 
int defaultOption = 0
 

Protected Member Functions

void RunOption (ButtonDialog _option)
 
void RunDefault ()
 
int ConvertSlotToOption (int slot, bool force=false)
 
void OnEndActionList (ActionList actionList, ActionListAsset actionListAsset, bool isSkipping)
 
void OnEndConversation (Conversation conversation)
 
void OnFinishLoading (int saveID)
 

Protected Attributes

float startTime
 
ActiveList overrideActiveList
 
ActiveList onFinishActiveList
 
MenuDialogList linkedDialogList
 

Properties

MenuDialogList LinkedDialogList [get, set]
 

Detailed Description

This component provides the player with a list of dialogue options that their character can say. Options are display in a MenuDialogList element, and will usually run a DialogueOption ActionList when clicked - unless overrided by the "Dialogue: Start conversation" Action that triggers it.

Member Function Documentation

◆ AllOptionsBeenChosen()

bool AC.Conversation.AllOptionsBeenChosen ( bool  onlyEnabled)

Checks if all options have been chosen at least once by the player

Parameters
onlyEnabledIf True, then only options that are currently enabled will be included in the check
Returns
True if all options have been chosen at least once by the player

◆ CanTranslate()

bool AC.Conversation.CanTranslate ( int  index)

Checks if a given text index can and should be translated.

Parameters
indexThe index of the translatable text
Returns
True if the text can and should be translated

Implements AC.ITranslatable.

◆ ConvertGlobalVariableToLocal()

bool AC.Conversation.ConvertGlobalVariableToLocal ( int  oldGlobalID,
int  newLocalID,
bool  isCorrectScene 
)

Converts the Conversations's references from a given global variable to a given local variable

Parameters
oldLocalIDThe ID number of the old global variable
newLocalIDThe ID number of the new local variable
Returns
True if the Action was amended

◆ ConvertLocalVariableToGlobal()

bool AC.Conversation.ConvertLocalVariableToGlobal ( int  oldLocalID,
int  newGlobalID 
)

Converts the Conversations's references from a given local variable to a given global variable

Parameters
oldLocalIDThe ID number of the old local variable
newGlobalIDThe ID number of the new global variable
Returns
True if the Action was amended

◆ GetCount()

int AC.Conversation.GetCount ( )

Gets the number of enabled dialogue options.

Returns
The number of enabled dialogue options

◆ GetIDArray()

int [] AC.Conversation.GetIDArray ( )

<summmary>Gets an array of ID numbers of existing ButtonDialog classes, so that a unique number can be generated.

Returns
Gets an array of ID numbers of existing ButtonDialog classes

◆ GetNumEnabledOptions()

int AC.Conversation.GetNumEnabledOptions ( )

Gets the number of dialogue options that are currently enabled.

Returns
The number of currently-enabled dialogue options

◆ GetNumTranslatables()

int AC.Conversation.GetNumTranslatables ( )

Gets the maximum number of possible translatable texts.

Returns
The maximum number of possible translatable texts.

Implements AC.ITranslatable.

◆ GetNumVariableReferences()

int AC.Conversation.GetNumVariableReferences ( VariableLocation  location,
int  varID,
Variables  variables = null,
int  _variablesConstantID = 0 
)

Gets the number of references to a given variable

Parameters
locationThe location of the variable (Global, Local)
varIDThe ID number of the variable
Returns
The number of references to the variable

Implements AC.IVariableReferencer.

◆ GetOption()

ButtonDialog AC.Conversation.GetOption ( int  slot)

Gets the ButtonDialog data container, which stores data for a dialogue option.

Parameters
slotThe index number of the dialogue option to find
Returns
The ButtonDialog data container

◆ GetOptionIcon()

CursorIconBase AC.Conversation.GetOptionIcon ( int  slot)

Gets the display icon of a dialogue option.

Parameters
slotThe index number of the dialogue option to find
Returns
The display icon of the dialogue option

◆ GetOptionIconWithID()

CursorIconBase AC.Conversation.GetOptionIconWithID ( int  ID)

Gets the display icon of a dialogue option with a specific ID.

Parameters
IDThe ID of the dialogue option to find
Returns
The display icon of the dialogue option

◆ GetOptionID()

int AC.Conversation.GetOptionID ( int  slot)

Gets the ID of a dialogue option.

Parameters
slotThe index number of the enabled dialogue option to find
Returns
The dialogue option's ID number, if found - or -1 otherwise.

◆ GetOptionName()

string AC.Conversation.GetOptionName ( int  slot)

Gets the display label of a dialogue option.

Parameters
slotThe index number of the enabled dialogue option to find
Returns
The display label of the dialogue option

◆ GetOptionNameWithID()

string AC.Conversation.GetOptionNameWithID ( int  ID)

Gets the display label of a dialogue option with a specific ID.

Parameters
IDThe ID of the dialogue option to find
Returns
The display label of the dialogue option

◆ GetOptionWithID()

ButtonDialog AC.Conversation.GetOptionWithID ( int  id)

Gets the ButtonDialog data container with a given ID number, which stores data for a dialogue option.

Parameters
idThe ID number associated with the dialogue option to find
Returns
The ButtonDialog data container

◆ GetOwner()

string AC.Conversation.GetOwner ( int  index)

Gets the name of the translatable text's owner. In the case of speech text, it is the name of the character. In the case of menu element text, it is the name of the menu element.

Parameters
indexThe index of the translatable text
Returns
The name of the translatable text's owner.

Implements AC.ITranslatable.

◆ GetTimeRemaining()

float AC.Conversation.GetTimeRemaining ( )

Gets the time remaining before a timed Conversation ends.

Returns
The time remaining before a timed Conversation ends.

◆ GetTranslatableString()

string AC.Conversation.GetTranslatableString ( int  index)

Gets the text to be translated, given its index.

Parameters
indexThe index of the translatable text
Returns
The text to be translated

Implements AC.ITranslatable.

◆ GetTranslationID()

int AC.Conversation.GetTranslationID ( int  index)

Gets the translation ID of a given text index.

Parameters
indexThe index of the translatable text
Returns
The translation ID of the text

Implements AC.ITranslatable.

◆ GetTranslationType()

AC_TextType AC.Conversation.GetTranslationType ( int  index)

Gets the translation type of a given text index.

Parameters
indexThe index of the translatable text
Returns
The translation type of a given text index.

Implements AC.ITranslatable.

◆ HasActionListOverride()

bool AC.Conversation.HasActionListOverride ( )

Checks if the Converations options are currently being overridden by an ActionList

◆ HasExistingTranslation()

bool AC.Conversation.HasExistingTranslation ( int  index)

Checks if a given text index has already been assigned a unique translation ID.

Parameters
indexThe index of the translatable text
Returns
True if the text has been assigned a unique translation ID

Implements AC.ITranslatable.

◆ Interact() [1/2]

void AC.Conversation.Interact ( )

Show the Conversation's dialogue options.

◆ Interact() [2/2]

void AC.Conversation.Interact ( ActionList  actionList,
ActionConversation  actionConversation 
)

Shows the Conversation's dialogue options.

Parameters
actionListThe ActionList that contains the Action that calls this function
actionConversationThe "Dialogue: Start conversation" Action that calls this function. This is necessary when that Action overrides the Converstion's options.

◆ IsActive()

bool AC.Conversation.IsActive ( bool  includeResponses)

Checks if the Conversation is currently active.

Parameters
includeResponsesIf True, then the Conversation will be considered active if any of its dialogue option ActionLists are currently-running, as opposed to only when its options are displayed as choices on screen

True if the Conversation is active

◆ OptionHasBeenChosen()

bool AC.Conversation.OptionHasBeenChosen ( int  slot)

Checks if a dialogue option has been chosen at least once by the player.

Parameters
slotThe index number of the dialogue option to find
Returns
True if the dialogue option has been chosen at least once by the player.

◆ OptionWithIDHasBeenChosen()

bool AC.Conversation.OptionWithIDHasBeenChosen ( int  ID)

Checks if a dialogue option with a specific ID has been chosen at least once by the player.

Parameters
IDThe ID of the dialogue option to find
Returns
True if the dialogue option has been chosen at least once by the player.

◆ OptionWithIDIsActive()

bool AC.Conversation.OptionWithIDIsActive ( int  ID)

Checks if a dialogue option with a specific ID is active.

Parameters
IDThe ID of the dialogue option to check for
Returns
True if the specified option is active

◆ OwnerIsPlayer()

bool AC.Conversation.OwnerIsPlayer ( int  index)

Checks if the translatable text's owner is a Player. This is necessary for speech lines, since multiple player prefabs can feasibly share the same line.

Parameters
indexThe index of the translatable text
Returns
True if the translatable text's owner is a Player.

Implements AC.ITranslatable.

◆ RenameOption()

void AC.Conversation.RenameOption ( int  id,
string  newLabel,
int  newLineID 
)

Renames a dialogue option.

Parameters
idThe ID number of the dialogue option to rename
newLabelThe new label text to give the dialogue option<param>
Parameters
newLindIDThe line ID number to give the dialogue option, as set by the Speech Manager

◆ RunOption()

void AC.Conversation.RunOption ( int  slot,
bool  force = false 
)

Runs a dialogue option.

Parameters
slotThe index number of the dialogue option to run
forceIf True, then the option will be run regardless of whether it's enabled or valid

◆ RunOptionWithID()

void AC.Conversation.RunOptionWithID ( int  ID,
bool  force = false 
)

Runs a dialogue option with a specific ID.

Parameters
IDThe ID number of the dialogue option to run
forceIf True, then the option will be run regardless of whether it's enabled or valid

◆ SetOptionState()

void AC.Conversation.SetOptionState ( int  id,
bool  flag,
bool  isLocked 
)

Sets the enabled and locked states of a dialogue option, provided that it is unlocked.

Parameters
idThe ID number of the dialogue option to change
flagThe "on/off" state to set the option
isLockedThe "locked/unlocked" state to set the option

◆ SetTranslationID()

void AC.Conversation.SetTranslationID ( int  index,
int  lineID 
)

Sets the translation ID of a given text index

Parameters
indexThe index of the translatable text
lineIDThe new translation ID to assign the translatable text

Implements AC.ITranslatable.

◆ SlotIsAvailable()

bool AC.Conversation.SlotIsAvailable ( int  slot)

Checks if a given slot exists

Parameters
slotThe index number of the enabled dialogue option to find
Returns
True if a given slot exists

◆ TurnAllOptionsOn()

void AC.Conversation.TurnAllOptionsOn ( bool  includingLocked)

Turns all dialogue options on

Parameters
includingLockedIf True, then locked options will be unlocked and turned on as well. Otherwise, they will remain locked

◆ TurnOff()

void AC.Conversation.TurnOff ( )

Hides the Conversation's dialogue options, if it is the currently-active Conversation.

◆ TurnOn()

void AC.Conversation.TurnOn ( )

Show the Conversation's dialogue options.

◆ TurnOptionOff()

void AC.Conversation.TurnOptionOff ( int  id)

Turns a dialogue option off, provided that it is unlocked.

Parameters
idThe ID number of the dialogue option to disable

◆ TurnOptionOn()

void AC.Conversation.TurnOptionOn ( int  id)

Turns a dialogue option on, provided that it is unlocked.

Parameters
idThe ID number of the dialogue option to enable

Member Data Documentation

◆ autoPlay

bool AC.Conversation.autoPlay = false

If True, and only one option is available, then the option will be chosen automatically

◆ defaultOption

int AC.Conversation.defaultOption = 0

The index number of the option to select, if isTimed = True and the timer runs out before the player has made a choice. If -1, then the conversation will end

◆ interactionSource

AC.InteractionSource AC.Conversation.interactionSource

The source of the commands that are run when an option is chosen (InScene, AssetFile, CustomScript)

◆ isTimed

bool AC.Conversation.isTimed = false

If True, then the Conversation is timed, and the options will only be shown for a fixed period

◆ lastOption

int AC.Conversation.lastOption = -1

The index number of the last-chosen Conversation dialogue option

◆ options

List<ButtonDialog> AC.Conversation.options = new List<ButtonDialog>()

All available dialogue options that make up the Conversation

◆ selectedOption

ButtonDialog AC.Conversation.selectedOption

The option selected within the Conversation's Inspector

◆ timer

float AC.Conversation.timer = 5f

The duration, in seconds, that the Conversation is active, if isTime = True