Topic Leader

A topic leader is a message panel that can be made to appear front/centre on-screen, and will then animate away towards a point on the screen. It's intended usage is to draw the player's attention towards an area of the screen, mainly during tutorial content.

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

Creation

topic_leader:new(string name, string text key, [string text state], [boolean unlocalised])

Creates and returns a new topic leader object.

Parameters:

1

string

Names for this topic leader. The topic leader uicomponent will be named after this.

2

string

Localisation key (or unlocalised text) to use for the first data entry in the topic leader. This should be supplied in the full [table]_[field]_[key] localisation format, or just as a plain unlocalised string if the fourth argument is set to true.

3

string

optional, default value=nil

Component state for the first text entry on the topic leader. If nil is supplied then the default state is used.

4

boolean

optional, default value=false

Use the string supplied as the second argument to this function for display directly, instead of using it to look up a localised key. This can be useful for debugging, but shouldn't be used for released content.

Returns:

  1. topic_leader

defined in ../../Warhammer/working_data/script/_lib/lib_topic_leader.lua, line 56

Back to top

Usage

Once created, functions on the topic leader be called in the form showed below.

Example - Specification:

<topic_leader_object>:<function_name>(<args>)

Example - Creation and Usage:

local tl = topic_leader:new("new_objective", "random_localisation_strings_string_new_objective");
tl:set_shrink_target_uicomponent(get_objectives_manager():get_uicomponent(), 20, 20);
tl:set_hold_duration(2000);
tl:start();
Back to top

Configuration

topic_leader:add_content(string text key, [string text state], [boolean unlocalised])

Adds a new line of content to the topic leader.

Parameters:

1

string

Localisation key (or unlocalised text) to display. This should be supplied in the full [table]_[field]_[key] localisation format, or just as a plain unlocalised string if the third argument is set to true.

2

string

optional, default value=nil

Component state for the text entry. If nil is supplied then the default state is used.

3

boolean

optional, default value=false

Use the string supplied as the first argument to this function for display directly, instead of using it to look up a localised key. This can be useful for debugging, but shouldn't be used for released content.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_topic_leader.lua, line 120

topic_leader:set_text_state(string state)

Sets the uicomponent state of the text uicomponent of the topic leader. Use this to customise how the text is displayed.

Parameters:

1

string

state

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_topic_leader.lua, line 146

topic_leader:set_hold_duration(number hold duration in ms)

Sets the duration for which the leader uicomponent should hold in place before beginning to animate off-screen. This duration is set in milliseconds, in all game modes. The default value is 2000ms.

Parameters:

1

number

hold duration in ms

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_topic_leader.lua, line 159

topic_leader:set_shrink_target(number x, number y)

Sets a screen position to which the topic leader should shrink to when playing its shrink animation.

Parameters:

1

number

x co-ordinate in pixels.

2

number

y co-ordinate in pixels.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_topic_leader.lua, line 172

topic_leader:set_shrink_target_uicomponent(uicomponent uicomponent, [number x], [number y])

Sets a uicomponent target to which the topic leader should shrink to when playing its shrink animation. This sets the topic leader to shrink to the top-left of the uicomponent, offset by the optionally-supplied offset co-ordinates. The position of the uicomponent is computed when topic_leader:start is called.

Parameters:

1

uicomponent

UIComponent to which the topic leader should shrink towards when its shrink animation is played.

2

number

optional, default value=nil

x offset co-ordinate in pixels.

3

number

optional, default value=nil

y offset co-ordinate in pixels.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_topic_leader.lua, line 193

topic_leader:add_shrink_callback(function callback)

Adds a shrink callback for the topic leader. This function will be called topic_leader:shrink is called, immediately prior to the topic leader beginning its shrink animation. This functionality may be used to set up the shrink target, amongst other things. Multiple shrink callbacks may be added to one topic leader.

Parameters:

1

function

callback

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_topic_leader.lua, line 221

Back to top

Animating

topic_leader:start()

Creates the topic leader uicomponent and starts its animated sequence.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_topic_leader.lua, line 263

topic_leader:shrink()

Forces the topic leader to start playing its shrink animation. Once the topic leader is displayed the shrink animation will play automatically after the hold duration has elapsed, but this function can be called to force it to play early.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_topic_leader.lua, line 357

topic_leader:hide()

Immediately hides the topic leader, if it's showing, and destroys all running processes and listeners started by it.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_topic_leader.lua, line 453

Last updated 12/08/2022 11:56:58