Objectives Manager
Provides an interface for setting and managing the scripted objectives that appear in the scripted objectives panel, underneath the advisor in campaign and battle. With no advisor present, the scripted objectives panel appears in the top-left of the screen (it is displaced down the screen should the advisor appear). Scripted objectives are mainly used by tutorial scripts, but are also used in quest battles to deliver gameplay objectives.
Once a scripted objective is set, with objectives_manager:set_objective
, it is down to the script to mark it as complete with objectives_manager:complete_objective
or failed with objectives_manager:fail_objective
, and to subsequently remove it from the scripted objectives panel with objectives_manager:remove_objective
.
The objectives manager also provides an interface for setting up an objectives chain, which allows only one objective from the chain to be shown at a time. This is useful for tutorial scripts which are providing close instruction to the player, allowing them to set up a cooking-recipe series of mini-steps (e.g. "Select your army" / "Open the Recruitment panel" / "Recruit a Unit") which are chained together and can be advanced/rewound.
Note that the battle_manager
and campaign_manager
both create an objectives manager, and provide passthrough interfaces for its most common functionality, so it should be rare for a battle or campaign script to need to get a handle to an objectives manager, or call functions on it directly.
Loaded in Campaign | |
Loaded in Battle | |
Loaded in Frontend |
-
objectives_manager:new()
-
Creates an objective manager. It should never be necessary for client scripts to call this directly, for an objective manager is automatically set up whenever a
battle_manager
orcampaign_manager
is created.Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_objectives.lua, line 44
Once an objectives_manager
object has been created with objectives_manager:new
, functions on it may be called in the form showed below.
Example - Specification:
<objectives_manager_object>:<function_name>(<args>)
Example - Creation and Usage:
local om = objectives_manager:new() -- set up automatically by campaign or battle managers
local uic_objectives = om:get_uicomponent() -- calling a function on the object once created
-
objectives_manager:set_debug([boolean
debug mode])
-
Sets the objectives manager into debug mode for more verbose output
Parameters:
1
boolean
optional, default value=true
debug mode
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_objectives.lua, line 108
-
objectives_manager:get_uicomponent()
-
Gets a uicomponent handle to the scripted objectives panel
Returns:
uicomponent
defined in ../../Warhammer/working_data/script/_lib/lib_objectives.lua, line 168
-
objectives_manager:set_objective(
objective keystring
, [
param anumber
], [
param bnumber
])
-
Sets up a scripted objective for the player, which appears in the scripted objectives panel. This objective can then be updated, removed, or marked as completed or failed by the script at a later time.
A key to thescripted_objectives
table must be supplied with set_objective, and optionally one or two numeric parameters to show some running count related to the objective. To update these parameter values later,set_objective
may be re-called with the same objective key and updated values.Parameters:
1
Objective key, from the
scripted_objectives
table.2
optional, default value=nil]
number
param a, First numeric objective parameter. If set, the objective will be presented to the player in the form [objective text]: [param aFirst numeric objective parameter. If set, the objective will be presented to the player in the form [objective text]: [param a]. Useful for showing a running count of something related to the objective.
3
optional, default value=nil]
number
param b, Second numeric objective parameter. A value for the first must be set if this is used. If set, the objective will be presented to the player in the form [objective text]: [param a] / [param bSecond numeric objective parameter. A value for the first must be set if this is used. If set, the objective will be presented to the player in the form [objective text]: [param a] / [param b]. Useful for showing a running count of something related to the objective.
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_objectives.lua, line 373
-
objectives_manager:set_objective_with_leader(
objective key
string
,
param a
[number
],
param b
[number
],
callback
[function
]
) -
Sets up a scripted objective for the player which appears in the scripted objectives panel, with a
topic_leader
. This objective can then be updated, removed, or marked as completed or failed by the script at a later time.
A key to thescripted_objectives
table must be supplied with set_objective, and optionally one or two numeric parameters to show some running count related to the objective. To update these parameter values later,set_objective
may be re-called with the same objective key and updated values.Parameters:
1
Objective key, from the
scripted_objectives
table.2
optional, default value=nil]
number
param a, First numeric objective parameter. If set, the objective will be presented to the player in the form [objective text]: [param aFirst numeric objective parameter. If set, the objective will be presented to the player in the form [objective text]: [param a]. Useful for showing a running count of something related to the objective.
3
optional, default value=nil]
number
param b, Second numeric objective parameter. A value for the first must be set if this is used. If set, the objective will be presented to the player in the form [objective text]: [param a] / [param bSecond numeric objective parameter. A value for the first must be set if this is used. If set, the objective will be presented to the player in the form [objective text]: [param a] / [param b]. Useful for showing a running count of something related to the objective.
4
optional, default value=nil
Optional callback to call when the objective is shown.
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_objectives.lua, line 432
-
objectives_manager:complete_objective(
objective keystring
)
-
Marks a scripted objective as completed for the player to see. Note that it will remain on the scripted objectives panel until removed with
objectives_manager:remove_objective
.
Note also that is possible to mark an objective as complete before it has been registered withobjectives_manager:set_objective
- in this case, it is marked as complete as soon asobjectives_manager:set_objective
is called.Parameters:
1
Objective key, from the scripted_objectives table.
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_objectives.lua, line 460
-
objectives_manager:fail_objective(
objective keystring
)
-
Marks a scripted objective as failed for the player to see. Note that it will remain on the scripted objectives panel until removed with
objectives_manager:remove_objective
.Parameters:
1
Objective key, from the scripted_objectives table.
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_objectives.lua, line 491
-
objectives_manager:remove_objective(
objective keystring
)
-
Removes a scripted objective from the scripted objectives panel.
Parameters:
1
Objective key, from the scripted_objectives table.
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_objectives.lua, line 508
Objectives chains allow calling scripts to set up a sequence of objectives that are conceptually linked in such a manner that they are sequentially delivered to the player. This is useful for tutorial scripts which may wish to deliver close support to the player while they are performing a task for the first time e.g. "Open this panel" then "click on that button" then "select that option" and so on. Client scripts can update the status of an objective chain by name, and the objectives manager automatically removes or updates the onscreen objective.
An objective chain may be started with objectives_manager:activate_objective_chain
, updated with objectives_manager:update_objective_chain
and finally terminated with objectives_manager:end_objective_chain
. Only one objective chain may be active at once, so terminate an existing chain before starting a new one.
-
objectives_manager:activate_objective_chain(
chain name
string,
objective key
string,
number param a
[number],
number param b
[number]
) -
Starts a new objective chain. Each objective chain must be given a unique string name, by which the objectives chain is later updated or ended.
Parameters:
1
string
Name for the objective chain. Must not be shared with other objective chain names.
2
string
Objective key, from the scripted_objectives table.
3
number
optional, default value=nil
First numeric objective parameter. See documentation for
objectives_manager:set_objective
.4
number
optional, default value=nil
Second numeric objective parameter. See documentation for
objectives_manager:set_objective
.Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_objectives.lua, line 592
-
objectives_manager:activate_objective_chain_with_leader(
chain name
string,
objective key
string,
number param a
[number],
number param b
[number],
on-show callback
[function
]
) -
Starts a new objective chain, with a topic leader. Each objective chain must be given a unique string name, by which the objectives chain is later updated or ended.
Parameters:
1
string
Name for the objective chain. Must not be shared with other objective chain names.
2
string
Objective key, from the scripted_objectives table.
3
number
optional, default value=nil
First numeric objective parameter. See documentation for
objectives_manager:set_objective
.4
number
optional, default value=nil
Second numeric objective parameter. See documentation for
objectives_manager:set_objective
.5
optional, default value=nil
Optional callback to call when the objective is shown.
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_objectives.lua, line 622
-
objectives_manager:update_objective_chain(
chain name
string,
objective key
string,
number param a
[number],
number param b
[number]
) -
Updates an objective chain, either with new parameters for the existing objective or a new objective (in which case the existing objective will be removed).
Parameters:
1
string
Name for the objective chain.
2
string
Objective key, from the scripted_objectives table.
3
number
optional, default value=nil
First numeric objective parameter. See documentation for
objectives_manager:set_objective
.4
number
optional, default value=nil
Second numeric objective parameter. See documentation for
objectives_manager:set_objective
.Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_objectives.lua, line 646
-
objectives_manager:end_objective_chain(
chain name
string,
objective key
string,
number param a
[number],
number param b
[number]
) -
Ends an objective chain.
Parameters:
1
string
Name for the objective chain.
2
string
Objective key, from the scripted_objectives table.
3
number
optional, default value=nil
First numeric objective parameter. See documentation for
objectives_manager:set_objective
.4
number
optional, default value=nil
Second numeric objective parameter. See documentation for
objectives_manager:set_objective
.Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_objectives.lua, line 695
-
objectives_manager:reset_objective_chain(string
chain name)
-
Removes this objective chain from the previous objective chains list, which allows it to be triggered again.
Parameters:
1
string
chain name
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_objectives.lua, line 720