Payload String Constructor
When constructing mission definitions from a string, a particularly fiddly point is assembling the payload strings for mission rewards. The payload table contains utility functions that should hopefully make this process a bit easier.
The various functions provided in the payload table can each be called with the minimum of vital data. Each will return a string which can be plugged in to mission_manager:add_payload
(or equivalent functions) to specify that the mission should deliver that reward.
The payload table also provides a basic remapping feature. This is useful for when a particular faction doesn't take a particular reward (usually money) but another reward in its place (e.g. a race-specific currency like daemonic glory). Rather than having to manually override each mission record for a particular faction which would be time-consuming and error-prone, data is provided which a remapping function can use to replace the mission rewards with something more appropriate.
Example:
local mm = mission_manager:new(faction_key, mission_key);
mm:add_new_objective("SEARCH_RUINS");
mm:add_condition("total 1");
mm:add_payload(payload.money(500));
Loaded in Campaign | |
Loaded in Battle | |
Loaded in Frontend |
-
payload.add_money_equivalence_mapping(
faction keystring
,
remapping callbackfunction
)
-
Adds a payload remapping for a particular faction, for money. Once this remapping is established, payloads for this faction set up with
payload.money
will instead be replaced with an alternative. The alternative is determined by the callback that is supplied to this function.
When a money payload is requested, the callback will be called and supplied three arguments - the amount of money to add, the faction key, and a table of arbitrary parameters supplied topayload.money
that can be used to determine the equivalent payload. What goes in to this table of arbitrary parameters can be decided by the implementer, but what is added to each mission specification should match what the callback looks for.Parameters:
1
faction key
2
remapping callback
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 1990
-
payload.add_ancillary_equivalence_mapping(
faction keystring
,
remapping callbackfunction
)
-
Adds a payload remapping for a particular faction, for ancillary payloads. Once this remapping is established, payloads for this faction set up with
payload.ancillary_mission_payload
will instead be replaced with an alternative. The alternative is determined by the callback that is supplied to this function.
When an ancillary payload is requested, the callback will be called and supplied three arguments - the faction key, the ancillary categorystring
, and the ancillary raritystring
.Parameters:
1
faction key
2
remapping callback
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2008
-
payload.money_direct(
amountnumber
)
-
Returns a payload string which defines a money reward for a string mission definition. No money-equivalence is looked up when this function is called - use
payload.money
to return a money-equivalent reward when appropriate.Parameters:
1
amount
Returns:
payload stringstring
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2033
-
payload.money(
amountnumber
,
faction keystring
,
equivalence parameterstable
)
-
Returns a payload string which defines a money reward (or equivalent) for a string mission definition. When this function is called, a money-equivalence mapping is looking up based on the supplied faction key. If one was previously added with
payload.add_money_equivalence_mapping
then the mapping callback that was supplied to that function is called, and the returned result of that callback is returned by this function. If no remapping for this faction is found, then a money payload string is returned.Parameters:
1
amount
2
faction key
3
equivalence parameters
Returns:
payload stringstring
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2046
-
payload.text_display(
text keystring
)
-
Returns a payload string which defines a text override for the payload description. If a text override is specified, the mission panel will display that message as the mission reward instead of trying to generate one itself. This is useful in certain circumstances, such as if completing the mission brings some custom scripted reward that the game does not natively support.
Parameters:
1
Key of text to display, from the
campaign_payloads_ui_details
database table.Returns:
payload stringstring
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2075
-
payload.agent(
spawn regionstring
,
agent typestring
,
agent subtypestring
, [
action pointsnumber
])
-
Returns a payload string which defines an agent reward for a string mission definition. No kind of equivalence is looked up.
Parameters:
1
Key of region in which to spawn the agent, from the
regions
database table.2
Agent type key, from the
agents
database table.3
Agent subtype key, from the
agent_subtypes
database table.4
optional, default value=100
Percentage of action points that the spawned agent should start with. By default the agent starts with 100% action points.
Returns:
payload stringstring
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2102
-
payload.agent_for_faction(
faction key
string
,
agent type
string
,
agent subtype
[string
],
action points
[number
]
) -
Returns a payload string which defines an agent reward for a string mission definition, for a faction. This differs from
payload.agent
in that this function takes a faction key, and looks up the home region of that faction. If the faction has no home region, then a script error is thrown and money is substituted.Parameters:
1
Key of faction for which the agent is being spawned, from the
factions
table. This is used to specify the region in which the agent is spawned - the home region of the faction is used.2
Agent type key, from the
agents
database table.3
optional, default value=nil
Agent subtype key, from the
agent_subtypes
database table.4
optional, default value=100
Percentage of action points that the spawned agent should start with. By default the agent starts with 100% action points.
Returns:
payload stringstring
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2140
-
payload.ancillary_mission_payload(
ancillary key
string
,
faction key
string
,
ancillary category
string
,
ancillary rarity
string
) -
Returns a mission reward string that adds the specified ancillary to the faction pool when the mission being constructed is completed.
Parameters:
1
Ancillary key, from the
ancillaries
database table.2
Faction key, from the
factions
database table.3
Ancillary category. Valid values are presently
"armour"
,"enchanted_item"
>,"banner"
>,"talisman"
>,"weapon"
and"arcane_item"
. Arcane items may only be equipped by spellcasters.4
Ancillary rarity. Valid values are presently
"common"
,"uncommon"
and"rare"
.Returns:
ancillary
mission reward string
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2180
-
payload.pooled_resource_mission_payload(
pooled resource keystring
,
factor keystring
,
quantitynumber
)
-
Returns a mission reward string that adds the specified quantity of the specified pooled resource with the specified factor when the mission being constructed is completed.
Parameters:
1
Pooled resource key, from the
pooled_resources
database table.2
Factor key, from the
factor
field in thepooled_resource_factor_junctions
database table.3
Quantity of pooled resource to award.
Returns:
pooled resource mission reward stringstring
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2226
-
payload.khorne_glory(
amountnumber
)
-
Returns a payload string which defines a Khorne glory reward for a Daemons of Chaos string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2237
-
payload.nurgle_glory(
amountnumber
)
-
Returns a payload string which defines a Nurgle glory reward for a Daemons of Chaos string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2250
-
payload.slaanesh_glory(
amountnumber
)
-
Returns a payload string which defines a Slaanesh glory reward for a Daemons of Chaos string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2263
-
payload.tzeentch_glory(
amountnumber
)
-
Returns a payload string which defines a Tzeentch glory reward for a Daemons of Chaos string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2276
-
payload.undivided_glory(
amountnumber
)
-
Returns a payload string which defines an Undivided glory reward for a Daemons of Chaos string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2289
-
payload.skulls(
amountnumber
)
-
Returns a payload string which defines a Skulls reward for a Khorne string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2302
-
payload.infections(
amountnumber
)
-
Returns a payload string which defines an Infections reward for a Nurgle string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2315
-
payload.devotees(
amountnumber
)
-
Returns a payload string which defines a Devotees reward for a Slaanesh string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2328
-
payload.grimoires(
amountnumber
)
-
Returns a payload string which defines a Grimoires reward for a Tzeentch string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2341
-
payload.devotion(
amountnumber
)
-
Returns a payload string which defines a Devotion reward for a Kislev string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2354
-
payload.supporters(
amountnumber
)
-
Returns a payload string which defines a Supporters reward for a Kislev string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2367
-
payload.meat(
amountnumber
)
-
Returns a payload string which defines a Meat reward for an Ogre Kingdoms string mission definition. No kind of equivalence is looked up.
Parameters:
1
amount
Returns:
payload stringstring
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2380
-
payload.mercenary_mission_payload(
unit keystring
,
quantitynumber
)
-
Returns a mission reward string that adds the specified quantity of the specified unit to the faction's mercenary pool when the mission being constructed is completed. This would only have an effect for faction's that feature a mercenary pool.
Parameters:
1
Unit key, from the
main_units
database table.2
Quantity of units to add.
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2405
-
payload.effect_bundle_mission_payload(
effect bundle keystring
,
turnsnumber
)
-
Returns a mission reward string that applies the specified effect bundle to the faction when the mission being constructed is completed. An optional duration in turns may be specified.
Parameters:
1
Effect bundle key, from the
effect_bundles
database table.2
Number of turns the effect should be applied for. If this is omitted
Returns:
nil
defined in ../../Warhammer/working_data/script/_lib/lib_campaign_mission_manager.lua, line 2427