Mission Managers

Mission managers can be used to set up and manage scripted missions issued to the player. It isn't necessary to set up a mission manager in order to trigger a scripted mission, but they provide certain benefits:

  • Success, failure, cancellation and nearing-expiry callbacks may be registered with the mission manager, which calls these when the mission reaches a certain state.
  • Missions in the game may be triggered from a mission string - the mission manager offers easy methods to construct such a string.
  • Missions may be set up with scripted objectives - success and/or fail conditions that are triggered by script, allowing mission completion conditions to be implemented of arbitrary complexity, or that aren't supported natively by the game. Mission managers provide a framework for allowing this to be set up relatively easily.
  • Mission managers may be set up with first time and each time startup callbacks (see mission_manager:add_first_time_trigger_callback and mission_manager:add_each_time_trigger_callback for more details) allowing other scripts to be started while the mission is running.

Mission managers can also be used to trigger incidents and dilemmas.

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

Different Methods of Specifying Objectives

Most missions are only composed of one individual objective, but more than one is supported (chapter missions tend to have more). The objectives that make up a mission may be specified in one of three ways:

  • A mission may be constructed from a mission string. Refer to the section on Constructing From Strings to see how to do this.

    • Mission objectives may be scripted, which means that it is the responsibility of script to monitor completion/failure conditions and notify the game. Scripted objectives may be set up using the functions in the Scripted Objectives section. Scripted objectives are constructed internally from a mission string and as such can't be combined with mission records from the database or missions.txt file (see following points).
  • A mission may build its objectives from records in the database (see the cdir_events_mission_option_junctions table). To set a mission to build its objectives from the database set it to trigger from the database with mission_manager:set_is_mission_in_db, mission_manager:set_is_incident_in_db or mission_manager:set_is_dilemma_in_db and do not add any text objectives (see mission_manager:add_new_objective).
  • Mission strings may also be baked into the missions.txt file that accompanies each campaign. This is the default option, but arguably the least desirable and flexible.

Back to top

Persistence

If a mission manager has been set up to use certain features then it is classified as persistent. Persistent mission managers have script values that are saved into the savegame so the mission manager can know whether to start certain listeners when a saved game is loaded. As such, persistent mission managers must be declared and set up prior to the first tick.

Features that set a mission manager to be persistent are:

Mission managers that are not persistent are "fire and forget", meaning they can be discarded once triggered. The underlying campaign model will remember that a mission has been triggered, the script mission manager does not need to be re-established if the game is reloaded.

Back to top

Creation

mission_manager:new(
  string
faction name,
  string
mission key,
  [function
success callback],
  [function
failure callback],
  [function
cancellation callback],
  [function
nearing-expiry callback]
)

Creates a mission manager object. A faction name for the mission recipient and a mission key must be specified at the very least. The mission key must match a record in the missions table, which must be present in all cases.
A mission success callback, a mission failure callback, a mission cancellation callback and a mission nearing-expiry callback may optionally also be specified. Setting any of these also sets the mission to be persistent, which creates extra requirements for how the mission manager is declared - see the section above on Persistence.

Parameters:

1

string

Name of faction that will be receiving this mission.

2

string

Key corresponding to a record in the missions table.

3

function

optional, default value=nil

Callback to call if the mission is successfully completed. Setting this makes the mission manager persistent.

4

function

optional, default value=nil

Callback to call if the mission is failed. Setting this makes the mission manager persistent.

5

function

optional, default value=nil

Callback to call if the mission is cancelled. Setting this makes the mission manager persistent.

6

function

optional, default value=nil

Callback to call if the mission is nearing expiry. Setting this makes the mission manager persistent.

Returns:

  1. mission_manager Mission manager object

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 110

Back to top

Usage

Once a mission_manager object has been created with mission_manager:new, functions on it may be called in the form showed below.

Example - Specification:

<mission_manager_object>:<function_name>(<args>)

Example - Creation and Usage:

local mm_emp_05 = mission_manager:new("wh_main_emp_empire", "wh_empire_mission_05");

-- calling a function on the object once created
mm_emp_05:add_first_time_trigger_callback(function() out("mm_emp_05 starting") end)
Back to top

Global Configuration Options

The functions in this section apply changes to the behaviour of the mission manager regardless of the type of mission being triggered.

mission_manager:set_should_cancel_before_issuing([boolean cancel before issuing])

When it goes to trigger the mission manager will, if the mission is persistent (see Persistence), issue a call to cancel any mission with the key specified in mission_manager:new before issuing its mission. This behaviour can be disabled, or enabled for non-persistent missions, by calling this function.

Parameters:

1

boolean

optional, default value=true

cancel before issuing

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 236

mission_manager:set_should_whitelist([boolean should whitelist])

When it goes to trigger the mission manager will, by default, add the relevant mission/dilemma/incident type to the event whitelist so that it triggers even if event messages are currently suppressed (see campaign_manager:suppress_all_event_feed_messages). Events are commonly suppressed when an intervention is triggering, for example. Use this function to disable this behaviour, if required, so that the triggered event is not whitelisted and does not show.

Parameters:

1

boolean

optional, default value=true

should whitelist

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 248

mission_manager:set_show_mission([boolean show event])

Activates/deactivates the showing of the mission event as it is triggered. By default, the event message is shown - this function may be used to disable this behaviour. When this setting is disabled, the mission manager will use cm:disable_event_feed_events to suppress the mission subcategory prior to triggering, and then again to unsuppress mission event once triggered.
This setting only takes effect if the mission manager is triggering a mission. It has no effect if the mission manager has been set to trigger an incident or dilemma with mission_manager:set_is_incident_in_db or mission_manager:set_is_dilemma_in_db.

Parameters:

1

boolean

optional, default value=true

show event

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 260

mission_manager:set_victory_mission([boolean show event])

Specifies that this mission is a victory condition. These missions have different string formatting, so use their own function for constructing the strings.
This setting only takes effect if the mission manager is triggering a mission via string. It has no effect if the mission manager has been set to trigger an incident or dilemma with mission_manager:set_is_incident_in_db or mission_manager:set_is_dilemma_in_db.

Parameters:

1

boolean

optional, default value=true

show event

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 273

Back to top

Startup Callbacks

mission_manager:add_first_time_trigger_callback(function callback)

Specifies a callback to call, one time, when the mission is first triggered. This can be used to set up other scripts or game objects for this mission.

Parameters:

1

function

callback

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 292

mission_manager:add_each_time_trigger_callback(function callback)

Adds a callback to call each time the mission is triggered, either for the first time or subsequently from a savegame. This can be used to set up other scripts or game objects for this mission each time the script is loaded, or to set up the mission manager itself with Persistent Values. Each-time callbacks are called after any first-time callbacks added with mission_manager:add_each_time_trigger_callback.

Parameters:

1

function

callback

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 305

Back to top

Constructing From Strings

Mission managers provide a mode where the mission being triggered is constructed from a string. Example of such strings can be found in the missions.txt found in data/campaigns/<campaign_name>/ for some campaigns. The main advantage of constructing missions from strings is that their initial setup may be dynamically constructed depending on game conditions at the time.

If new objectives are added with mission_manager:add_new_objective then the mission manager will be set to construct its mission with a string. It will subsequently attempt to construct the mission specification string when the mission is later triggered, with only the properties set in the missions table remaining immutable. The functions in this section are used to tell the mission manager what to put in the mission construction string.

mission_manager:add_new_objective is called to add a new objective to the mission. The first objective added is the primary objective; any further objectives added are treated as secondary/bonus objectives. Objective configuration functions such as mission_manager:add_condition and mission_manager:add_payload act on the most recently-added objective, so the ordering of these setup functions is important. At the very least at least one objective and one payload should be set using the functions below before the mission manager is triggered.

mission_manager:add_new_objective(string objective type)

Adds a new objective type to the mission specification, and also sets the mission manager to construct its mission from a string.
Multiple objectives may be added to a mission with this function. The first shall be the primary objective of the mission, while subsequent additions shall be set up as secondary objectives.

Parameters:

1

string

objective type

Returns:

  1. nil

Example:

mm:add_new_objective("CONSTRUCT_N_BUILDINGS_FROM")

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 354

mission_manager:add_condition(string condition)

Adds a condition to the objective last added with mission_manager:add_new_objective. Multiple conditions are commonly added - each objective type has different mandatory and optional conditions.

Parameters:

1

string

condition

Returns:

  1. nil

Example:

mm:add_condition("total 1")
mm:add_condition("building_level wh_main_emp_port_2")

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 377

mission_manager:add_payload(string payload, [boolean enable payload combining])

Adds a payload (reward) to the objective last added with mission_manager:add_new_objective. Many different payload types exists: faction_pooled_resource_transaction, add_mercenary_to_faction_pool, adjust_loyalty_for_faction, province_slaves_change, faction_slaves_change, money, influence, honour, grant_unit, grant_agent, ancillary, effect_bundle, rebellion, demolish_chain, damage_buildings, damage_character, building_restriction, unit_restriction, issue_mission, and game_victory. Each has a different parameter requirement - see existing examples or a programmer for more information.
The function will optionally attempt to combine this payload reward with others of the same type if they are found, if the enable combining parameter is set to true.

Parameters:

1

string

payload

2

boolean

optional, default value=false

enable payload combining

Returns:

  1. nil

Example - Adding money as a mission reward:

mm:add_payload("money 1000")

Example - Adding a pooled resource as a mission reward:

mm:add_payload("faction_pooled_resource_transaction{resource dwf_oathgold;factor grudges;amount 10;context absolute;}")

Example - Adding influence as a mission reward:

mm:add_payload("influence 5")

Example - Adding effect bundle as a mission reward:

mm:add_payload("effect_bundle{bundle_key wh_dlc06_bundle_eight_peaks_recapture;turns 0;}")

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 420

mission_manager:add_payload_from_mission_manager(mission_manager mm)

Adds the mission payloads from another mission manager to this mission manager.

Parameters:

1

mission_manager

mm

Returns:

  1. boolean payloads successfully added

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 470

mission_manager:add_failure_payload(string payload)

Adds a payload (on mission faiure) to the objective last added with mission_manager:add_new_objective. Many different payload types exists - the following list is pulled from code: faction_pooled_resource_transaction, add_mercenary_to_faction_pool, adjust_loyalty_for_faction, province_slaves_change, faction_slaves_change, money, influence, honour, grant_unit, grant_agent, effect_bundle, rebellion, demolish_chain, damage_buildings, damage_character, building_restriction, unit_restriction, issue_mission, and game_victory. Each has a different parameter requirement - see existing examples or a programmer for more information.

Parameters:

1

string

payload

Returns:

  1. nil

Example - Taking away money as a mission failure:

mm:add_failure_payload("money -1000")

Example - Taking away a pooled resource as a mission failure:

mm:add_failure_payload("faction_pooled_resource_transaction{resource dwf_oathgold;factor wh2_main_resource_factor_missions;amount -10;}")

Example - Decreasing influence as a mission failure:

mm:add_failure_payload("influence -5")

Example - Adding effect bundle as a mission failure:

mm:add_failure_payload("effect_bundle{bundle_key wh_dlc06_bundle_eight_peaks_recapture;turns 0;}")

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 495

mission_manager:add_heading(string heading key)

Adds a heading key override for the objective last added with mission_manager:add_new_objective. This should be supplied as a string in the full localised text format [table]_[field]_[record].

Parameters:

1

string

heading key

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 520

mission_manager:add_description(string description key)

Adds a description key override for the objective last added with mission_manager:add_new_objective. This should be supplied as a string in the full localised text format [table]_[field]_[record].

Parameters:

1

string

description key

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 538

mission_manager:set_turn_limit(number turn limit)

Sets a turn limit for the entire mission. This is optional.

Parameters:

1

number

turn limit

Returns:

  1. nil

Example - Mission expires in 5 turns:

mm:set_turn_limit(5)

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 556

mission_manager:set_chapter(number chapter number)

Sets this mission to be a particular chapter mission, which affects how it is displayed and categorised on the UI.

Parameters:

1

number

chapter number

Returns:

  1. nil

Example - Mission is first chapter mission:

mm:set_chapter(1)

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 571

mission_manager:set_mission_issuer(string mission issuer)

Sets an issuer for this mission, which determines some aspects of the mission's presentation. By default this is set to "CLAN_ELDERS", but use this function to change this. A list of valid mission issuers can be found in the mission_issuers table.

Parameters:

1

string

mission issuer

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 586

mission_manager:set_position(number x, number y)

Sets a position for this mission, which is used to zoom to a location.

Parameters:

1

number

Logical x co-ordinate

2

number

Logical y co-ordinate

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 599

mission_manager:set_victory_type(string victory type)

Sets a victory type for this mission, which is used for victory conditions only. A list of valid victory types can be found in the victory_types table.

Parameters:

1

string

victory type

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 613

Back to top

Scripted Objectives

Missions may contain scripted objectives, where the script is responsible for their monitoring and completion. Scripted objectives are constructed from strings, and set the mission manager into a mode where it will construct all its objectives in this way. As such they cannot be used in combination with objectives from the database or from the missions.txt file.

A scripted objective may be added to the mission manager with mission_manager:add_new_scripted_objective, which sets some display text and an initial success monitor - some script which determines when the mission has been succeeded. Once a scripted objective has been added, additional success or failure monitors may be added with mission_manager:add_scripted_objective_success_condition and mission_manager:add_scripted_objective_failure_condition.

Scripted objectives may also be forceably succeeded or failed by external scripts calling mission_manager:force_scripted_objective_success or mission_manager:force_scripted_objective_failure, and their displayed text may be updated with mission_manager:update_scripted_objective_text.

If multiple scripted objectives are to be added they may optionally be individually named by giving them a script key. This allows individual target objectives to be specified when calling mission_manager:add_scripted_objective_success_condition, mission_manager:add_scripted_objective_failure_condition, mission_manager:force_scripted_objective_success or mission_manager:force_scripted_objective_failure, which will otherwise just target the first scripted objective in the mission.

As mentioned in the section on Persistence, setting a scripted objective forces the mission manager to be persistent, which means it must have a unique key and must be set up somewhere in the root of the script so that it's declared by the time the first tick happens after loading.

mission_manager:add_new_scripted_objective(
  string
display text,
  string
event,
  function
condition,
  [string
script name]
)

Adds a new scripted objective, along with some text to display, a completion event and condition to monitor. An optional script name for this objective may also be specified, which can be useful if there is more than one objective.

Parameters:

1

string

Display text for this objective. This should be supplied as a full localisation key, i.e. [table]_[field]_[key].

2

string

Script event name of mission success condition.

3

function

A function that returns a boolean value when called. The function will be passed the context of the event specified in the second parameter. Alternatively, if no conditional test needs to be performed then true may be supplied in place of a function block.

While the mission is active the mission manager listens for the event specified in the second parameter. When it is received, the condition specified here is called. If it returns true, or if true was specified in place of a condition function, the mission objective is marked as being successfully completed.

4

string

optional, default value=nil

Script name for this objective. If specified, this allows calls to mission_manager:add_scripted_objective_success_condition, mission_manager:add_scripted_objective_failure_condition, mission_manager:force_scripted_objective_success or mission_manager:force_scripted_objective_failure to target this objective (they target the first objective by default).

Returns:

  1. string script name of the new scripted objective

Example:

An example scripted objective that is completed when the player researches a technology.
mm:add_new_scripted_objective(
    "mission_text_text_research_technology_mission_objective",
    "ResearchCompleted",
    function(context)
        return context:faction():name() == cm:get_local_faction_name();
    end;
);

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 644

mission_manager:add_scripted_objective_success_condition(
  string
event,
  function
condition,
  [string
script name]
)

Adds a new success condition to a scripted objective. scripted objective. If a script key is specified the success condition is added to the objective with this key (assuming it exists), otherwise the success condition is added to the first scripted objective.

Parameters:

1

string

Script event name of mission success condition.

2

function

A function that returns a boolean value when called. The function will be passed the context of the event specified in the second parameter. Alternatively, if no conditional test needs to be performed then true may be supplied in place of a function block.

While the mission is active the mission manager listens for the event specified in the second parameter. When it is received, the condition specified here is called. If it returns true, or if true was specified in place of a condition function, the mission objective is marked as being successfully completed.

3

string

optional, default value=nil

Script name of the scripted objective to append this success condition to.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 716

mission_manager:add_scripted_objective_failure_condition(
  string
event,
  function
condition,
  [string
script name]
)

Adds a new failure condition to a scripted objective. scripted objective. If a script key is specified the failure condition is added to the objective with this key (assuming it exists), otherwise the failure condition is added to the first scripted objective.

Parameters:

1

string

Script event name of mission failure condition.

2

function

A function that returns a boolean value when called. The function will be passed the context of the event specified in the second parameter. Alternatively, if no conditional test needs to be performed then true may be supplied in place of a function block.

While the mission is active the mission manager listens for the event specified in the second parameter. When it is received, the condition specified here is called. If it returns true, or if true was specified in place of a condition function, the mission objective is marked as being failed.

3

string

optional, default value=nil

Script name of the scripted objective to append this failure condition to.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 727

mission_manager:force_scripted_objective_success([string script name])

Immediately forces the success of a scripted objective. A particular scripted objective may be specified by supplying a script key, otherwise this function will target the first scripted objective in the mission manager.
This should only be called after the mission manager has been triggered.

Parameters:

1

string

optional, default value=nil

Script name of the scripted objective to force the success of.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 807

mission_manager:force_scripted_objective_failure([string script name])

Immediately forces the failure of a scripted objective. A particular scripted objective may be specified by supplying a script key, otherwise this function will target the first scripted objective in the mission manager.
This should only be called after the mission manager has been triggered.

Parameters:

1

string

optional, default value=nil

Script name of the scripted objective to force the failure of.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 816

mission_manager:update_scripted_objective_text(
  
string display text,
  [number
count],
  [number
total],
  [string
script name]
)

Updates the displayed objective text of a scripted objective. This can be useful if some counter needs to be updated as progress towards an objective is made, and optional count and total numerical values may be specified which are formatted in to the displayed text. A particular scripted objective may be specified by supplying a script key, otherwise this function will target the first scripted objective in the mission manager.
This should only be called after the mission manager has been triggered.

Parameters:

1

string

Display text for this objective. This should be supplied as a full localisation key, i.e. [table]_[field]_[key].

2

number

optional, default value=nil

Numeric count value to display. This is an optional first number formatted in to the display text, to allow a count value to be shown (e.g. "Current progress towards goal: %n")

3

number

optional, default value=nil

Numeric total value to display. This is an optional second number formatted in to the display text, to allow a count and total value to be shown (e.g. "Current progress towards goal: %n of %n")

4

string

optional, default value=nil

Script name of the scripted objective to update the key of.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 851

Back to top

Persistent Values

Persistent values may be stored and retrieved on a persistent mission manager. The mission manager will save those to the savegame and keep them available for client scripts to query even after the game has been reloaded. This can be useful if values important to the mission manager's working are only determined at the time that the mission manager is triggered, and can't be known when the mission manager is declared. For example, a Scripted Objectives mission to build x number of temples, where x is the number of temples held by a rival faction at the time the mission is issued, would need to store x in the savegame in order to re-establish the mission manager with the correct success conditions.

For example, a mission manager may establish its scripted conditions within a callback passed to mission_manager:add_each_time_trigger_callback which uses persistent values that are first generated when the mission is first triggered.o

Example:

local mm = mission_manager:new(cm:get_local_faction_name(), "test_mission_key");

-- Call this setup function each time the mission manager is triggered
mm:add_each_time_trigger_callback(
    function()
        -- Mission is triggering - if persistent values have not been set
        -- (i.e. we are triggering for the first time) then set them
        if not mm:get_persistent_value("total_buildings") then
            mm:set_persistent_value("current_buildings", 0);
            
            -- Threshold value will be a random number 1-3, decided at the point the mission is first triggered
            mm:set_persistent_value("total_buildings", cm:random_number(3))
        end;
        
        mm:add_new_scripted_objective(
            "mission_text_text_test_mission_construct_random_num_buildings",
            "BuildingCompleted",                -- event
            function(context)                    -- condition to test
                if context:building():faction():name() == cm:get_local_faction_name() then
                    -- Local faction has constructed a building, increment our current
                    -- building counter and return true if we've hit the threshold value
                    mm:set_persistent_value("current_buildings", mm:get_persistent_value("current_buildings") + 1);
                                                
                    if mm:get_persistent_value("current_buildings") >= mm:get_persistent_value("total_buildings") then
                        return true;
                    end;
                end;
            end
        );
        
        -- This has to be added after scripted objectives
        mm:add_payload("money 1000");
    end
);

-- ...Later
mm:trigger();

mission_manager:set_persistent_value(string name, value value)

Sets a persistent value on the mission manager with a supplied string name. The value can be a boolean, number, string or table.

Parameters:

1

string

name

2

value

value

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 953

mission_manager:get_persistent_value()

Returns a persistent value previously saved with mission_manager:set_persistent_value. If no persistent value has been saved on this mission manager with the supplied name.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 973

Back to top

Sourcing Objectives from Database

If the mission manager is not set to generate its objectives from strings then it will fall back to one of two sources - from the missions.txt file which accompanies the campaign data or from database records. By default, the missions.txt file is used as the source of the mission - use mission_manager:set_is_mission_in_db, mission_manager:set_is_incident_in_db or mission_manager:set_is_dilemma_in_db to have the mission manager construct its mission objectives from the database instead. Doing this will require that records are present in various tables such as cdir_events_mission_option_junctions to allow the mission to fire (different but equivalent tables are used if the mission is actually an incident or a dilemma).

mission_manager:set_is_mission_in_db()

Sets that the mission objectives should be constructed from records in the game database.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 994

mission_manager:set_is_incident_in_db()

Sets that the mission objectives should be constructed from records in the game database, and that the mission is actually an incident.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 1005

mission_manager:set_is_dilemma_in_db([boolean is intervention])

Sets that the mission objectives should be constructed from records in the game database, and that the mission is actually a dilemma.

Parameters:

1

boolean

optional, default value=false

Is a dilemma in an intervention. If this is set to true, the dilemma will be triggered directly using campaign_manager:trigger_dilemma_raw, which can cause softlocks when triggered from outside of an intervention. If set to false or left blank then the dilemma will be triggered in campaign_manager:trigger_dilemma which attempts to package the dilemma in an intervention.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 1016

Back to top

Querying

mission_manager:has_been_triggered()

Returns true if the mission manager has been triggered in the past, false otherwise. If triggered it might not still be running, as the mission could have been completed.

Returns:

  1. boolean is triggered

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 1047

mission_manager:is_active()

Returns true if the mission manager has been triggered but not yet completed.

Returns:

  1. boolean is active

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 1055

mission_manager:is_completed()

Returns true if the mission has been completed, false otherwise. Success, failure or cancellation all count as completion.

Returns:

  1. boolean is completed

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 1063

Back to top

Resetting

mission_manager:reset()

Resets a running mission manager, so that it is ready to be triggered again.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 1090

Back to top

Triggering

mission_manager:trigger([function dismiss callback], [number callback delay])

Triggers the mission, causing it to be issued.

Parameters:

1

function

optional, default value=nil

Dismiss callback. If specified, this is called when the event panel is dismissed.

2

number

optional, default value=nil

Dismiss callback delay, in seconds. If specified this introduces a delay between the event panel being dismissed and the dismiss callback being called.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 1113

mission_manager:cancel_dismiss_callback_listeners()

Cancels any dismiss callback listeners started by mission_manager:trigger. This can be useful in certain circumstances if the mission has failed to trigger.

Returns:

  1. nil

defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 1636

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