Narrative

The narrative table contains data and functions that help drive the narrative system.

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

At A Glance

  1. The narrative table is created when this file is loaded.
  2. Data setup callbacks are added to the narrative system as scripts are loaded using calls to narrative.add_data_setup_callback.
  3. These data setup callbacks contain calls to functions that set up narrative override data, such as narrative.add_playable_faction, narrative.add_data_for_faction and narrative.add_data_for_campaign.
  4. These data setup callbacks contain calls to functions that set up narrative override data, such as narrative.add_playable_faction, narrative.add_data_for_faction and narrative.add_data_for_campaign.
  5. Back to top

    Data Setup Callbacks

    Data setup callbacks for the narrative system may be added with narrative.add_data_setup_callback. Callbacks added with this function are not called until narrative.start is called, which doesn't happen until the first tick. This structure allows narrative data to be added as scripts are loaded (potentially before the model is loaded) and only quer

    narrative.add_data_setup_callback(function callback)

    Adds a callback which sets up data for the narrative system. The callback can make calls to functions such as narrative.add_playable_faction and narrative.add_data_for_faction to set up narrative override data.
    Callbacks added here will be called when narrative.start is called.

    Parameters:

    1

    function

    callback

    Returns:

    1. nil

    defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_system.lua, line 62

    Back to top

    Adding Data

    narrative.add_playable_faction(string faction key)

    Adds a playable faction, by key, to the narrative data. Calls to this function should be made within setup functions that are passed to narrative.add_data_setup_callback.
    Factions will need to be added to the narrative data with this function before any data can be added for them with narrative.add_data_for_faction.

    Parameters:

    1

    string

    faction key

    Returns:

    1. nil

    defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_system.lua, line 86

    narrative.add_exception_faction(string faction key)

    Adds a playable faction, by key, to the narrative exception faction list data. Calls to this function should be made within setup functions that are passed to narrative.add_data_setup_callback.
    Factions will need to be added to the exception list to skip some elements of the narrative data.

    Parameters:

    1

    string

    faction key

    Returns:

    1. nil

    defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_system.lua, line 95

    narrative.add_data_for_faction(string faction key, string data key, value data)

    Adds a data override for a faction within the narrative system. Factions must have been added with narrative.add_playable_faction before data overrides can be added for them.
    If narrative.get is later called and the faction and data keys supplied to it match a data override, then the data associated with that override is returned. This can be used to override data keys for specific factions.
    Calls to narrative.get should be made within the narrative event declarations.

    Parameters:

    1

    string

    faction key

    2

    string

    data key

    3

    value

    data

    Returns:

    1. nil

    defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_system.lua, line 104

    narrative.add_data_for_campaign()

    Adds a data override for a particular data key to the narrative system. This override is for all playable factions in the campaign, rather than any specific faction.
    If narrative.get is later called and the data key supplied to it matches the campaign data override, then the data associated with that override is returned by narrative.get. Note that faction data overrides added with narrative.add_data_for_faction are checked before campaign-wide overrides.

    Returns:

    1. nil

    defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_system.lua, line 135

    narrative.add_loader(function loader)

    Adds a narrative event loader callback. When the narrative system is started with narrative.start, each loader function is called for each human-controlled faction in the campaign, with the faction key supplied to that function as a single argument. In a multiplayer game, each loader function will be called multiple times.

    Parameters:

    1

    function

    loader

    Returns:

    1. nil

    defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_system.lua, line 159

    narrative.add_loader_for_faction(string faction key, function loader)

    Adds a narrative event loader callback for a specific faction. If the subject faction is controlled by a human when the narrative system is started with narrative.start this loader function will be called with the faction key supplied as a single argument.

    Parameters:

    1

    string

    faction key

    2

    function

    loader

    Returns:

    1. nil

    defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_system.lua, line 172

    narrative.add_loader_for_culture(string culture key, function loader)

    Adds a narrative event loader callback for a specific culture. When the narrative system is started with narrative.start, for each human-controlled faction that matches the supplied culture, this loader function will be called with the faction key supplied as a single argument.

    Parameters:

    1

    string

    culture key

    2

    function

    loader

    Returns:

    1. nil

    defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_system.lua, line 194

    narrative.add_loader_for_subculture(string subculture key, function loader)

    Adds a narrative event loader callback for a specific subculture. When the narrative system is started with narrative.start, for each human-controlled faction that matches the supplied subculture, this loader function will be called with the faction key supplied as a single argument.

    Parameters:

    1

    string

    subculture key

    2

    function

    loader

    Returns:

    1. nil

    defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_system.lua, line 216

    Back to top

    Starting

    narrative.start()

    Calls all setup and loader functions associated with the narrative system, setting up all data.

    Returns:

    1. nil

    defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_system.lua, line 250

    Back to top

    Data Retrieval

    narrative.get(string faction key, string data key)

    Gets a data override for the specified faction key and data key, if one exists. Faction data registered with narrative.add_data_for_faction will be checked first, then campaign data registered with narrative.add_data_for_campaign.

    Parameters:

    1

    string

    faction key

    2

    string

    data key

    Returns:

    1. value data

    defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_system.lua, line 367

    Back to top

    Output

    narrative.output_chain_header(string chain name, string faction key)

    Helper function which produces header output for a narrative chain when it's loaded.

    Parameters:

    1

    string

    chain name

    2

    string

    faction key

    Returns:

    1. nil

    defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_system.lua, line 388

    narrative.output_chain_footer()

    Helper function which produces footer output for a narrative chain when it's loaded.

    Returns:

    1. nil

    defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_system.lua, line 399

    narrative.unimplemented_output(string message)

    Helper function which prints output about unimplemented narrative chains.

    Parameters:

    1

    string

    message

    Returns:

    1. nil

    defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_system.lua, line 407

    narrative.todo_output(string message)

    Helper function which prints output about narrative improvements to do.

    Parameters:

    1

    string

    message

    Returns:

    1. nil

    defined in ../../Warhammer/working_data/script/campaign/_narrative/wh3_narrative_system.lua, line 419

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