Campaign Conversations

The campaign conversation system provides an interface for easy scripting of conversations. This is when multiple items of advice (or similar types of content, such as VO with subtitles) are played back-to-back with the player observing, and clicking through each.

Loaded in Campaign Loaded in Campaign
Loaded in Battle Loaded in Battle
Loaded in Frontend Loaded in Frontend
Back to top

At A Glance

A conversation is first declared with campaign_conversation:new. This returns a campaign conversation object.

Once declared, a conversation may optionlly be configured with the functions in the Configuration section of this documentation. It is mandatory, however, to add actions with campaign_conversation:add_advice or similar.

A conversation that is configured can then be started with campaign_conversation:start. A running conversation may be skipped by calling campaign_conversation:skip.

Example:

local conv_example = campaign_conversation:new(
    "example_conversation",
    function(),
        out("Conversation completed!")
    true
)

conv_example:set_default_delay(1.5)

conv_example:add_advice("example_advice_key_1")
conv_example:add_advice("example_advice_key_2")
conv_example:add_advice("example_advice_key_3")
conv_example:add_advice("example_advice_key_4")

conv_example:start()
Back to top

Declaration

campaign_conversation:new(string name, [function end callback])

Creates and returns a new campaign conversation object.

Parameters:

1

string

String name for the conversation. This is used for output.

2

function

optional, default value=nil

Callback to call when the conversation ends.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_conversation.lua, line 73

Back to top

Configuration

campaign_conversation:set_proceed_on_advice_finished([boolean proceed automatically])

Sets whether the conversation should automatically proceed to the next section when advice audio has finished playing. By default this is set to false which means the player will need to dismiss advice items manually to progress.
This default value can also be overridden on a per-advice basis as it is added with campaign_conversation:add_advice.

Parameters:

1

boolean

optional, default value=true

Proceed automatically on advice audio finished.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_conversation.lua, line 114

campaign_conversation:set_default_delay(number delay interval s)

Sets the default delay between one conversation item finishing and the next starting. By default this is half a second.
This default value can also be overridden on a per-advice basis as it is added with campaign_conversation:add_advice.

Parameters:

1

number

Delay interval in seconds.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_conversation.lua, line 127

campaign_conversation:set_play_with_cutscene_bars([boolean play with cutscene bars])

Sets whether the conversation should play out with cutscene bars. This is disabled by default - use this function to enable this behaviour.

Parameters:

1

boolean

optional, default value=true

play with cutscene bars

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_conversation.lua, line 140

Back to top

Actions

campaign_conversation:add_advice(
  
string advice key,
  [table
infotext],
  [boolean
show topic leader],
  [boolean
dismiss before playing],
  [number
initial delay],
  [boolean
proceed on advice finished],
  [function
start callback]
)

Adds an advice record to play in sequence as part of the conversation.

Parameters:

1

string

Advice key, from the advice_threads database table.

2

table

optional, default value=nil

Infotext to show with the advice. This should be a table of strings.

3

boolean

optional, default value=false

Use the first line of infotext as a topic leader.

4

boolean

optional, default value=nil

Dismiss the advisor before playing this item of advice. This happens by default, but this flag can be set to false to disable this behaviour.

5

number

optional, default value=nil

Delay in seconds between this section of the conversation starting and the advice being triggered. If supplied, this value overrides the default behaviour set with campaign_conversation:set_default_delay, but just for this advice.

6

boolean

optional, default value=nil

Proceed immediately after this advice has finished playing to the next advice (or end of the conversation). If supplied, this value overrides the default behaviour set with campaign_conversation:set_proceed_on_advice_finished, but just for this advice.

7

function

optional, default value=nil

Optional callback to call when this conversation item starts playing.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_conversation.lua, line 167

Back to top

Starting and Stopping

campaign_conversation:start()

Starts the conversation. Conversation records need to have been added with campaign_conversation:add_advice or equivalent before this function is called.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_conversation.lua, line 217

campaign_conversation:is_active()

Returns whether this conversation is currently playing or not.

Returns:

  1. boolean is conversation playing

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_conversation.lua, line 392

campaign_conversation:skip(string reason)

Skips the running conversation, ending it immediately. A string reason may be supplied for output purposes.

Parameters:

1

string

reason

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_conversation.lua, line 400

Last updated 8/23/2024 4:55:15 PM